1(() => { 2 var __create = Object.create; 3 var __defProp = Object.defineProperty; 4 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 5 var __getOwnPropNames = Object.getOwnPropertyNames; 6 var __getProtoOf = Object.getPrototypeOf; 7 var __hasOwnProp = Object.prototype.hasOwnProperty; 8 var __commonJS = (cb, mod) => function __require() { 9 try { 10 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 11 } catch (e) { 12 throw mod = 0, e; 13 } 14 }; 15 var __copyProps = (to, from, except, desc) => { 16 if (from && typeof from === "object" || typeof from === "function") { 17 for (let key of __getOwnPropNames(from)) 18 if (!__hasOwnProp.call(to, key) && key !== except) 19 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 20 } 21 return to; 22 }; 23 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 24 // If the importer is in node compatibility mode or this is not an ESM 25 // file that has been converted to a CommonJS file using a Babel- 26 // compatible transform (i.e. "__esModule" has not been set), then set 27 // "default" to the CommonJS "module.exports" for node compatibility. 28 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 29 mod 30 )); 31 32 // (disabled):https 33 var require_https = __commonJS({ 34 "(disabled):https"() { 35 } 36 }); 37 38
vendor: 5,227 bytes, lines 38-200
38// node_modules/tslib/tslib.es6.mjs 39 var extendStatics = function(d, b) { 40 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { 41 d2.__proto__ = b2; 42 } || function(d2, b2) { 43 for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; 44 }; 45 return extendStatics(d, b); 46 }; 47 function __extends(d, b) { 48 if (typeof b !== "function" && b !== null) 49 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 50 extendStatics(d, b); 51 function __() { 52 this.constructor = d; 53 } 54 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 55 } 56 var __assign = function() { 57 __assign = Object.assign || function __assign2(t) { 58 for (var s, i = 1, n = arguments.length; i < n; i++) { 59 s = arguments[i]; 60 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 61 } 62 return t; 63 }; 64 return __assign.apply(this, arguments); 65 }; 66 function __awaiter(thisArg, _arguments, P, generator) { 67 function adopt(value) { 68 return value instanceof P ? value : new P(function(resolve) { 69 resolve(value); 70 }); 71 } 72 return new (P || (P = Promise))(function(resolve, reject) { 73 function fulfilled(value) { 74 try { 75 step(generator.next(value)); 76 } catch (e) { 77 reject(e); 78 } 79 } 80 function rejected(value) { 81 try { 82 step(generator["throw"](value)); 83 } catch (e) { 84 reject(e); 85 } 86 } 87 function step(result) { 88 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 89 } 90 step((generator = generator.apply(thisArg, _arguments || [])).next()); 91 }); 92 } 93 function __generator(thisArg, body) { 94 var _ = { label: 0, sent: function() { 95 if (t[0] & 1) throw t[1]; 96 return t[1]; 97 }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); 98 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { 99 return this; 100 }), g; 101 function verb(n) { 102 return function(v) { 103 return step([n, v]); 104 }; 105 } 106 function step(op) { 107 if (f) throw new TypeError("Generator is already executing."); 108 while (g && (g = 0, op[0] && (_ = 0)), _) try { 109 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 110 if (y = 0, t) op = [op[0] & 2, t.value]; 111 switch (op[0]) { 112 case 0: 113 case 1: 114 t = op; 115 break; 116 case 4: 117 _.label++; 118 return { value: op[1], done: false }; 119 case 5: 120 _.label++; 121 y = op[1]; 122 op = [0]; 123 continue; 124 case 7: 125 op = _.ops.pop(); 126 _.trys.pop(); 127 continue; 128 default: 129 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { 130 _ = 0; 131 continue; 132 } 133 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { 134 _.label = op[1]; 135 break; 136 } 137 if (op[0] === 6 && _.label < t[1]) { 138 _.label = t[1]; 139 t = op; 140 break; 141 } 142 if (t && _.label < t[2]) { 143 _.label = t[2]; 144 _.ops.push(op); 145 break; 146 } 147 if (t[2]) _.ops.pop(); 148 _.trys.pop(); 149 continue; 150 } 151 op = body.call(thisArg, _); 152 } catch (e) { 153 op = [6, e]; 154 y = 0; 155 } finally { 156 f = t = 0; 157 } 158 if (op[0] & 5) throw op[1]; 159 return { value: op[0] ? op[1] : void 0, done: true }; 160 } 161 } 162 function __values(o) { 163 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; 164 if (m) return m.call(o); 165 if (o && typeof o.length === "number") return { 166 next: function() { 167 if (o && i >= o.length) o = void 0; 168 return { value: o && o[i++], done: !o }; 169 } 170 }; 171 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); 172 } 173 function __read(o, n) { 174 var m = typeof Symbol === "function" && o[Symbol.iterator]; 175 if (!m) return o; 176 var i = m.call(o), r, ar = [], e; 177 try { 178 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 179 } catch (error) { 180 e = { error }; 181 } finally { 182 try { 183 if (r && !r.done && (m = i["return"])) m.call(i); 184 } finally { 185 if (e) throw e.error; 186 } 187 } 188 return ar; 189 } 190 function __spreadArray(to, from, pack) { 191 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 192 if (ar || !(i in from)) { 193 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 194 ar[i] = from[i]; 195 } 196 } 197 return to.concat(ar || Array.prototype.slice.call(from)); 198 } 199 200
vendor: 723 bytes, lines 200-220
200// node_modules/@appsignal/javascript/dist/esm/error.js 201 function isError(error) { 202 return typeof error === "object" && typeof error.message !== "undefined"; 203 } 204 function getStacktrace(error) { 205 if (typeof error.stacktrace !== "undefined" || typeof error["opera#sourceloc"] !== "undefined") { 206 var _a = error.stacktrace, stacktrace = _a === void 0 ? "" : _a; 207 return stacktrace.split("\n").filter(function(line) { 208 return line !== ""; 209 }); 210 } else if (error.stack) { 211 var _b = error.stack, stack = _b === void 0 ? "" : _b; 212 return stack.split("\n").filter(function(line) { 213 return line !== ""; 214 }); 215 } else { 216 return ["No stacktrace available"]; 217 } 218 } 219 220
vendor: 676 bytes, lines 220-248
220// node_modules/@appsignal/javascript/dist/esm/hashmap.js 221 function toHashMapString(obj) { 222 if (!obj) 223 return; 224 var hm = {}; 225 Object.keys(obj).forEach(function(k) { 226 if (typeof obj[k] === "object") { 227 hm[k] = JSON.stringify(obj[k]); 228 } else { 229 hm[k] = String(obj[k]); 230 } 231 }); 232 return hm; 233 } 234 function toHashMap(obj) { 235 if (!obj) 236 return; 237 var hm = {}; 238 Object.keys(obj).forEach(function(k) { 239 if (typeof obj[k] === "string" || typeof obj[k] === "boolean" || typeof obj[k] === "number") { 240 hm[k] = obj[k]; 241 } else { 242 hm[k] = JSON.stringify(obj[k]); 243 } 244 }); 245 return hm; 246 } 247 248
vendor: 86 bytes, lines 248-251
248// node_modules/@appsignal/javascript/dist/esm/version.js 249 var VERSION = "1.6.0"; 250 251
vendor: 1,671 bytes, lines 251-299
251// node_modules/@appsignal/javascript/dist/esm/environment.js 252 var Environment = (function() { 253 function Environment2() { 254 } 255 Environment2.serialize = function() { 256 return { 257 transport: this.transport(), 258 origin: this.origin() 259 }; 260 }; 261 Environment2.origin = function() { 262 var globals = getGlobalObject(); 263 if (!globals.location) { 264 return ""; 265 } 266 return globals.location.origin || "".concat(globals.location.protocol, "//").concat(globals.location.hostname); 267 }; 268 Environment2.transport = function() { 269 var globals = getGlobalObject(); 270 if (isNodeEnv() && typeof jest === "undefined") { 271 return "NodeHTTP"; 272 } else if (globals.XDomainRequest) { 273 return "XDomainRequest"; 274 } else if (globals.XMLHttpRequest && !globals.fetch) { 275 return "XMLHttpRequest"; 276 } else { 277 return "fetch"; 278 } 279 }; 280 Environment2.supportsPromises = function() { 281 var globals = getGlobalObject(); 282 return "Promise" in globals && "resolve" in globals.Promise && "reject" in globals.Promise && "all" in globals.Promise && "race" in globals.Promise && (function() { 283 var resolve; 284 new globals.Promise(function(r) { 285 resolve = r; 286 }); 287 return typeof resolve === "function"; 288 })(); 289 }; 290 return Environment2; 291 })(); 292 function isNodeEnv() { 293 return Object.prototype.toString.call(typeof process !== "undefined" ? process : 0) === "[object process]"; 294 } 295 function getGlobalObject() { 296 return isNodeEnv() ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}; 297 } 298 299
vendor: 857 bytes, lines 299-326
299// node_modules/@appsignal/javascript/dist/esm/transports/xdomain.js 300 var XDomainTransport = (function() { 301 function XDomainTransport2(url) { 302 this.url = url; 303 } 304 XDomainTransport2.prototype.send = function(data) { 305 var _this = this; 306 return new Promise(function(resolve, reject) { 307 var _a; 308 var req = new XDomainRequest(); 309 var rx = new RegExp("^https?:"); 310 req.onload = function() { 311 return resolve({}); 312 }; 313 req.open("POST", _this.url.replace(rx, (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.protocol)); 314 setTimeout(function() { 315 try { 316 req.send(data); 317 } catch (e) { 318 reject(e); 319 } 320 }, 0); 321 }); 322 }; 323 return XDomainTransport2; 324 })(); 325 326
vendor: 689 bytes, lines 326-351
326// node_modules/@appsignal/javascript/dist/esm/transports/xhr.js 327 var XHRTransport = (function() { 328 function XHRTransport2(url) { 329 this.url = url; 330 } 331 XHRTransport2.prototype.send = function(data) { 332 var _this = this; 333 return new Promise(function(resolve, reject) { 334 try { 335 var req_1 = new XMLHttpRequest(); 336 req_1.onreadystatechange = function() { 337 if (req_1.readyState === XMLHttpRequest.DONE) { 338 resolve({}); 339 } 340 }; 341 req_1.open("POST", _this.url); 342 req_1.send(data); 343 } catch (e) { 344 reject(e); 345 } 346 }); 347 }; 348 return XHRTransport2; 349 })(); 350 351
vendor: 813 bytes, lines 351-377
351// node_modules/@appsignal/javascript/dist/esm/transports/fetch.js 352 var FetchTransport = (function() { 353 function FetchTransport2(url, headers) { 354 this.url = url; 355 } 356 FetchTransport2.prototype.send = function(data) { 357 return __awaiter(this, void 0, void 0, function() { 358 var res, statusText, ok; 359 return __generator(this, function(_a) { 360 switch (_a.label) { 361 case 0: 362 return [4, fetch(this.url, { 363 method: "POST", 364 body: data 365 })]; 366 case 1: 367 res = _a.sent(); 368 statusText = res.statusText, ok = res.ok; 369 return [2, ok ? Promise.resolve({}) : Promise.reject({ statusText })]; 370 } 371 }); 372 }); 373 }; 374 return FetchTransport2; 375 })(); 376 377
vendor: 1,076 bytes, lines 377-410
377// node_modules/@appsignal/javascript/dist/esm/transports/node.js 378 var NodeTransport = (function() { 379 function NodeTransport2(url) { 380 this.url = url; 381 this.https = Promise.resolve().then(() => __toESM(require_https())); 382 } 383 NodeTransport2.prototype.send = function(data) { 384 var _this = this; 385 var options = { 386 method: "POST", 387 headers: { 388 "Content-Type": "application/json", 389 "Content-Length": data.length 390 } 391 }; 392 return new Promise(function(resolve, reject) { 393 _this.https.then(function(https) { 394 var req = https.request(_this.url, options, function() { 395 }).on("error", function(error) { 396 return reject(error); 397 }); 398 req.write(data); 399 req.end(); 400 resolve({}); 401 }).catch(function(reason) { 402 console.warn("NodeTransport is being used, but the HTTPS module could not be imported. No data will be sent to AppSignal."); 403 reject(reason); 404 }); 405 }); 406 }; 407 return NodeTransport2; 408 })(); 409 410
vendor: 1,642 bytes, lines 410-461
410// node_modules/@appsignal/javascript/dist/esm/api.js 411 var PushApi = (function() { 412 function PushApi2(options) { 413 this._uri = options.uri || "https://appsignal-endpoint.net/collect"; 414 this._apiKey = options.key; 415 this._clientVersion = options.version; 416 this._transport = this._createTransport(this._url()); 417 } 418 PushApi2.prototype.push = function(span) { 419 return __awaiter(this, void 0, void 0, function() { 420 return __generator(this, function(_a) { 421 switch (_a.label) { 422 case 0: 423 return [4, this._transport.send(span.toJSON())]; 424 case 1: 425 _a.sent(); 426 return [2, span]; 427 } 428 }); 429 }); 430 }; 431 PushApi2.prototype._createTransport = function(url) { 432 switch (Environment.transport()) { 433 case "XDomainRequest": 434 return new XDomainTransport(url); 435 case "XMLHttpRequest": 436 return new XHRTransport(url); 437 case "NodeHTTP": 438 return new NodeTransport(url); 439 default: 440 return new FetchTransport(url); 441 } 442 }; 443 PushApi2.prototype._url = function() { 444 var auth = this._authorization(); 445 return "".concat(this._uri, "?").concat(urlEncode(auth)); 446 }; 447 PushApi2.prototype._authorization = function() { 448 return { 449 api_key: this._apiKey, 450 version: this._clientVersion 451 }; 452 }; 453 return PushApi2; 454 })(); 455 function urlEncode(object) { 456 return Object.keys(object).map(function(key) { 457 return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(object[key])); 458 }).join("&"); 459 } 460 461
vendor: 384 bytes, lines 461-475
461// node_modules/@appsignal/javascript/dist/esm/serializable.js 462 var Serializable = (function() { 463 function Serializable2(data) { 464 this._data = data; 465 } 466 Serializable2.prototype.toJSON = function() { 467 return JSON.stringify(this._data); 468 }; 469 Serializable2.prototype.serialize = function() { 470 return this._data; 471 }; 472 return Serializable2; 473 })(); 474 475
vendor: 5,061 bytes, lines 475-618
475// node_modules/@appsignal/javascript/dist/esm/span.js 476 var Span = (function(_super) { 477 __extends(Span2, _super); 478 function Span2(span) { 479 return _super.call(this, __assign({ timestamp: Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3), namespace: "frontend", error: { 480 name: "NullError", 481 message: "No error has been set", 482 backtrace: [] 483 } }, span)) || this; 484 } 485 Span2.prototype.setAction = function(name) { 486 if (!name || typeof name !== "string") { 487 return this; 488 } 489 this._data.action = name; 490 return this; 491 }; 492 Span2.prototype.getAction = function() { 493 return this._data.action; 494 }; 495 Span2.prototype.setNamespace = function(name) { 496 if (!name || typeof name !== "string") { 497 return this; 498 } 499 this._data.namespace = name; 500 return this; 501 }; 502 Span2.prototype.getNamespace = function() { 503 return this._data.namespace; 504 }; 505 Span2.prototype.setError = function(error) { 506 if (!error || !isError(error)) 507 return this; 508 this._data.error = { 509 name: error.name || "[unknown]", 510 message: error.message, 511 backtrace: getStacktrace(error) 512 }; 513 return this; 514 }; 515 Span2.prototype.getError = function() { 516 return this._data.error; 517 }; 518 Span2.prototype.setTags = function(tags) { 519 this._data.tags = __assign(__assign({}, this._data.tags), toHashMapString(tags)); 520 return this; 521 }; 522 Span2.prototype.getTags = function() { 523 var _a; 524 return (_a = this._data.tags) !== null && _a !== void 0 ? _a : {}; 525 }; 526 Span2.prototype.setParams = function(params) { 527 this._data.params = __assign(__assign({}, this._data.params), params); 528 return this; 529 }; 530 Span2.prototype.getParams = function() { 531 var _a; 532 return (_a = this._data.params) !== null && _a !== void 0 ? _a : {}; 533 }; 534 Span2.prototype.setBreadcrumbs = function(breadcrumbs) { 535 this._data.breadcrumbs = breadcrumbs; 536 return this; 537 }; 538 Span2.prototype.getBreadcrumbs = function() { 539 var _a; 540 return (_a = this._data.breadcrumbs) !== null && _a !== void 0 ? _a : []; 541 }; 542 Span2.prototype.setEnvironment = function(environment) { 543 this._data.environment = __assign(__assign({}, this._data.environment), environment); 544 return this; 545 }; 546 Span2.prototype.getEnvironment = function() { 547 var _a; 548 return (_a = this._data.environment) !== null && _a !== void 0 ? _a : {}; 549 }; 550 Span2.prototype.cleanBacktracePath = function(matchBacktracePaths) { 551 if (matchBacktracePaths.length === 0) { 552 return this; 553 } 554 if (!this._data.error || !this._data.error.backtrace) { 555 return this; 556 } 557 var linesMatched = 0; 558 this._data.error.backtrace = this._data.error.backtrace.map(function(line) { 559 var e_1, _a; 560 var path = extractPath(line); 561 if (!path) { 562 return line; 563 } 564 try { 565 for (var matchBacktracePaths_1 = __values(matchBacktracePaths), matchBacktracePaths_1_1 = matchBacktracePaths_1.next(); !matchBacktracePaths_1_1.done; matchBacktracePaths_1_1 = matchBacktracePaths_1.next()) { 566 var matcher = matchBacktracePaths_1_1.value; 567 var relevantPath = matcher(path); 568 if (!relevantPath) { 569 continue; 570 } 571 linesMatched++; 572 return line.replace(path, relevantPath); 573 } 574 } catch (e_1_1) { 575 e_1 = { error: e_1_1 }; 576 } finally { 577 try { 578 if (matchBacktracePaths_1_1 && !matchBacktracePaths_1_1.done && (_a = matchBacktracePaths_1.return)) _a.call(matchBacktracePaths_1); 579 } finally { 580 if (e_1) throw e_1.error; 581 } 582 } 583 return line; 584 }); 585 if (linesMatched > 0) { 586 this.setEnvironment({ 587 backtrace_paths_matched: linesMatched.toString() 588 }); 589 } 590 return this; 591 }; 592 return Span2; 593 })(Serializable); 594 function toBacktraceMatcher(regexp) { 595 return function(path) { 596 var match = path.match(regexp); 597 if (!match || match.length < 2) { 598 return; 599 } 600 return match.slice(1).join(""); 601 }; 602 } 603 function extractPath(backtraceLine) { 604 var _a, _b, _c, _d; 605 var IS_CHROME = /^\s*at\s/; 606 var CHROME_PATH_WITH_FUNCTION_NAME = /^\s*at(?:\s[^\(]+)?\s\((.*):\d+:\d+\)$/; 607 var CHROME_PATH_WITHOUT_FUNCTION_NAME = /^\s*at\s(.*):\d+:\d+$/; 608 if (backtraceLine.match(IS_CHROME)) { 609 return (_b = (_a = backtraceLine.match(CHROME_PATH_WITH_FUNCTION_NAME)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : (_c = backtraceLine.match(CHROME_PATH_WITHOUT_FUNCTION_NAME)) === null || _c === void 0 ? void 0 : _c[1]; 610 } 611 var IS_SAFARI_FF = /^.*@/; 612 var SAFARI_FF_PATH = /^.*@\s?(.*):\d+:\d+$/; 613 if (backtraceLine.match(IS_SAFARI_FF)) { 614 return (_d = backtraceLine.match(SAFARI_FF_PATH)) === null || _d === void 0 ? void 0 : _d[1]; 615 } 616 } 617 618
vendor: 897 bytes, lines 618-650
618// node_modules/@appsignal/javascript/dist/esm/queue.js 619 var Queue = (function() { 620 function Queue2(data) { 621 this._data = data || []; 622 } 623 Queue2.prototype.clear = function() { 624 this._data = []; 625 }; 626 Queue2.prototype.values = function() { 627 return this._data; 628 }; 629 Queue2.prototype.push = function(item) { 630 var _a; 631 return Array.isArray(item) ? (_a = this._data).push.apply(_a, __spreadArray([], __read(item), false)) : this._data.push(item); 632 }; 633 Queue2.prototype.drain = function() { 634 return __generator(this, function(_a) { 635 switch (_a.label) { 636 case 0: 637 if (!(this._data.length > 0)) return [3, 2]; 638 return [4, this._data.shift()]; 639 case 1: 640 _a.sent(); 641 return [3, 0]; 642 case 2: 643 return [2]; 644 } 645 }); 646 }; 647 return Queue2; 648 })(); 649 650
vendor: 2,732 bytes, lines 650-734
650// node_modules/@appsignal/javascript/dist/esm/dispatcher.js 651 var Dispatcher = (function() { 652 function Dispatcher2(queue, api, options) { 653 this._retries = 0; 654 this._timerID = 0; 655 this._duration = 0; 656 this._api = api; 657 this._queue = queue; 658 this.options = __assign({ limit: 5, initialDuration: 1e3 }, options); 659 this.reset(); 660 } 661 Dispatcher2.prototype.schedule = function(time) { 662 var _this = this; 663 if (time === void 0) { 664 time = this._duration; 665 } 666 var globals = getGlobalObject(); 667 var BACKOFF_FACTOR = 1.3; 668 var cb = function() { 669 return __awaiter(_this, void 0, void 0, function() { 670 var _a, _b, span, e_1, expDuration, e_2_1; 671 var e_2, _c; 672 return __generator(this, function(_d) { 673 switch (_d.label) { 674 case 0: 675 _d.trys.push([0, 7, 8, 9]); 676 _a = __values(this._queue.drain()), _b = _a.next(); 677 _d.label = 1; 678 case 1: 679 if (!!_b.done) return [3, 6]; 680 span = _b.value; 681 if (!span) 682 return [2]; 683 _d.label = 2; 684 case 2: 685 _d.trys.push([2, 4, , 5]); 686 return [4, this._api.push(span)]; 687 case 3: 688 _d.sent(); 689 return [3, 5]; 690 case 4: 691 e_1 = _d.sent(); 692 expDuration = Math.floor(Math.pow(time, BACKOFF_FACTOR)); 693 this._retries = this._retries - 1; 694 if (this._retries === 0) { 695 this.reset(); 696 } else { 697 this._queue.push(span); 698 this._timerID = this.schedule(expDuration); 699 } 700 return [2]; 701 case 5: 702 _b = _a.next(); 703 return [3, 1]; 704 case 6: 705 return [3, 9]; 706 case 7: 707 e_2_1 = _d.sent(); 708 e_2 = { error: e_2_1 }; 709 return [3, 9]; 710 case 8: 711 try { 712 if (_b && !_b.done && (_c = _a.return)) _c.call(_a); 713 } finally { 714 if (e_2) throw e_2.error; 715 } 716 return [7]; 717 case 9: 718 this.reset(); 719 return [2]; 720 } 721 }); 722 }); 723 }; 724 return globals.setTimeout(cb, time); 725 }; 726 Dispatcher2.prototype.reset = function() { 727 var _a = this.options, limit = _a.limit, initialDuration = _a.initialDuration; 728 this._retries = limit; 729 this._duration = initialDuration; 730 }; 731 return Dispatcher2; 732 })(); 733 734
vendor: 8,564 bytes, lines 734-974
734// node_modules/@appsignal/javascript/dist/esm/index.js 735 var Appsignal = (function() { 736 function Appsignal2(options) { 737 var e_1, _a; 738 this.VERSION = VERSION; 739 this.ignored = []; 740 this.backtraceMatchers = []; 741 this._breadcrumbs = []; 742 this._hooks = { 743 decorators: Array(), 744 overrides: Array() 745 }; 746 this._env = Environment.serialize(); 747 this._queue = new Queue([]); 748 var _b = options.key, key = _b === void 0 ? "" : _b, uri = options.uri, revision = options.revision, ignoreErrors = options.ignoreErrors, matchBacktracePaths = options.matchBacktracePaths; 749 if (revision && typeof revision !== "string") { 750 options.revision = String(revision); 751 } 752 if (key === "") { 753 console.info("[APPSIGNAL]: No API key provided. Started in development mode. No data will be sent."); 754 } 755 this._api = new PushApi({ 756 key, 757 uri, 758 version: this.VERSION 759 }); 760 if (ignoreErrors && Array.isArray(ignoreErrors)) { 761 this.ignored = ignoreErrors.filter(function(value) { 762 return value instanceof RegExp; 763 }).map(unglobalize); 764 } 765 if (matchBacktracePaths) { 766 var paths = void 0; 767 if (Array.isArray(matchBacktracePaths)) { 768 paths = matchBacktracePaths; 769 } else { 770 paths = [matchBacktracePaths]; 771 } 772 try { 773 for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) { 774 var matcher = paths_1_1.value; 775 if (matcher instanceof RegExp) { 776 this.backtraceMatchers.push(toBacktraceMatcher(unglobalize(matcher))); 777 } else if (typeof matcher === "function") { 778 this.backtraceMatchers.push(matcher); 779 } 780 } 781 } catch (e_1_1) { 782 e_1 = { error: e_1_1 }; 783 } finally { 784 try { 785 if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1); 786 } finally { 787 if (e_1) throw e_1.error; 788 } 789 } 790 } 791 this._dispatcher = new Dispatcher(this._queue, this._api); 792 this._options = options; 793 } 794 Appsignal2.prototype.send = function(data, tagsOrFn, namespace) { 795 var e_2, _a, e_3, _b; 796 var _this = this; 797 var _c; 798 if (!(data instanceof Error) && !(data instanceof Span) && !(data && data.error instanceof Error)) { 799 console.error("[APPSIGNAL]: Can't send error, given error is not a valid type"); 800 return; 801 } 802 var error; 803 if ("error" in data) { 804 error = data.error; 805 } else { 806 error = data; 807 } 808 var span = error instanceof Span ? error : this._createSpanFromError(error); 809 try { 810 for (var _d = __values(this._hooks.decorators), _e = _d.next(); !_e.done; _e = _d.next()) { 811 var decorator = _e.value; 812 var previousSpan = span; 813 span = decorator(span); 814 if (span === void 0) { 815 span = previousSpan; 816 } 817 } 818 } catch (e_2_1) { 819 e_2 = { error: e_2_1 }; 820 } finally { 821 try { 822 if (_e && !_e.done && (_a = _d.return)) _a.call(_d); 823 } finally { 824 if (e_2) throw e_2.error; 825 } 826 } 827 if (tagsOrFn) { 828 if (typeof tagsOrFn === "function") { 829 var callback = tagsOrFn; 830 callback(span); 831 } else { 832 console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a tags object is deprecated. Use the callback argument instead."); 833 var tags = toHashMap(tagsOrFn) || {}; 834 span.setTags(tags); 835 } 836 } 837 if (namespace) { 838 console.warn("[APPSIGNAL]: DEPRECATED: Calling the `send`/`sendError` function with a namespace is deprecated. Use the callback argument instead."); 839 span.setNamespace(namespace); 840 } 841 if (this._breadcrumbs.length > 0) 842 span.setBreadcrumbs(this._breadcrumbs); 843 try { 844 for (var _f = __values(this._hooks.overrides), _g = _f.next(); !_g.done; _g = _f.next()) { 845 var override = _g.value; 846 var previousSpan = span; 847 var nextSpan = override(span); 848 if (nextSpan === false) { 849 console.warn("[APPSIGNAL]: Ignored a span due to override."); 850 return; 851 } 852 span = nextSpan !== null && nextSpan !== void 0 ? nextSpan : previousSpan; 853 } 854 } catch (e_3_1) { 855 e_3 = { error: e_3_1 }; 856 } finally { 857 try { 858 if (_g && !_g.done && (_b = _f.return)) _b.call(_f); 859 } finally { 860 if (e_3) throw e_3.error; 861 } 862 } 863 var message = (_c = span.getError()) === null || _c === void 0 ? void 0 : _c.message; 864 if (message && this.ignored.some(function(el) { 865 return el.test(message); 866 })) { 867 console.warn("[APPSIGNAL]: Ignored a span: ".concat(message)); 868 return; 869 } 870 span.cleanBacktracePath(this.backtraceMatchers); 871 if (Environment.supportsPromises()) { 872 this._breadcrumbs = []; 873 if (!this._options.key) { 874 console.warn("[APPSIGNAL]: Span not sent because we're in development mode:", span); 875 } else { 876 return this._api.push(span).catch(function() { 877 _this._queue.push(span); 878 setTimeout(function() { 879 return _this._dispatcher.schedule(); 880 }, 0); 881 }); 882 } 883 } else { 884 console.error("[APPSIGNAL]: Error not sent. A Promise polyfill is required."); 885 return; 886 } 887 }; 888 Appsignal2.prototype.sendError = function(error, tagsOrFn, namespace) { 889 return this.send(error, tagsOrFn, namespace); 890 }; 891 Appsignal2.prototype.use = function(plugin) { 892 plugin.call(this); 893 }; 894 Appsignal2.prototype.createSpan = function(fn) { 895 var _a = this._options, _b = _a.revision, revision = _b === void 0 ? "" : _b, namespace = _a.namespace; 896 var span = new Span({ 897 environment: this._env, 898 revision 899 }); 900 if (namespace) 901 span.setNamespace(namespace); 902 if (fn && typeof fn === "function") 903 fn(span); 904 return span; 905 }; 906 Appsignal2.prototype.wrap = function(fn, tagsOrFn, namespace) { 907 return __awaiter(this, void 0, void 0, function() { 908 var e_4; 909 return __generator(this, function(_a) { 910 switch (_a.label) { 911 case 0: 912 _a.trys.push([0, 2, , 5]); 913 return [4, fn()]; 914 case 1: 915 return [2, _a.sent()]; 916 case 2: 917 e_4 = _a.sent(); 918 if (!(e_4 instanceof Error || e_4 instanceof ErrorEvent)) return [3, 4]; 919 return [4, this.sendError(e_4, tagsOrFn, namespace)]; 920 case 3: 921 _a.sent(); 922 _a.label = 4; 923 case 4: 924 return [2, Promise.reject(e_4)]; 925 case 5: 926 return [2]; 927 } 928 }); 929 }); 930 }; 931 Appsignal2.prototype.addDecorator = function(decorator) { 932 this._hooks.decorators.push(decorator); 933 }; 934 Appsignal2.prototype.addOverride = function(override) { 935 this._hooks.overrides.push(override); 936 }; 937 Appsignal2.prototype.demo = function() { 938 var span = this._createSpanFromError(new Error("Hello world! This is an error used for demonstration purposes.")); 939 span.setAction("TestAction").setParams({ 940 path: "/hello", 941 method: "GET" 942 }).setTags({ 943 demo_sample: "true" 944 }); 945 this.send(span); 946 }; 947 Appsignal2.prototype.addBreadcrumb = function(breadcrumb) { 948 var crumb = __assign(__assign({ timestamp: Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3) }, breadcrumb), { metadata: toHashMap(breadcrumb.metadata) }); 949 if (!crumb.category) { 950 console.warn("[APPSIGNAL]: Breadcrumb not added. `category` is missing."); 951 return; 952 } 953 if (!crumb.action) { 954 console.warn("[APPSIGNAL]: Breadcrumb not added. `action` is missing."); 955 return; 956 } 957 if (this._breadcrumbs.length === 20) { 958 this._breadcrumbs.pop(); 959 } 960 this._breadcrumbs.unshift(crumb); 961 }; 962 Appsignal2.prototype._createSpanFromError = function(error) { 963 var event = this.createSpan(); 964 event.setError(error); 965 return event; 966 }; 967 return Appsignal2; 968 })(); 969 var esm_default = Appsignal; 970 function unglobalize(regexp) { 971 return new RegExp(regexp.source, regexp.flags.replace("g", "")); 972 } 973 974
974// app/javascript/appsignal.js 975 var appsignal = new esm_default({ 976 key: window.appsignalConfig.frontendApiKey 977 }); 978 window.Appsignal = appsignal; 979})(); 980
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.