@honeybadger-io/js 4.1.2 → 4.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -209,22 +209,49 @@
|
|
|
209
209
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
210
210
|
});
|
|
211
211
|
};
|
|
212
|
+
var __generator = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
213
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
214
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
215
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
216
|
+
function step(op) {
|
|
217
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
218
|
+
while (_) try {
|
|
219
|
+
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;
|
|
220
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
221
|
+
switch (op[0]) {
|
|
222
|
+
case 0: case 1: t = op; break;
|
|
223
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
224
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
225
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
226
|
+
default:
|
|
227
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
228
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
229
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
230
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
231
|
+
if (t[2]) _.ops.pop();
|
|
232
|
+
_.trys.pop(); continue;
|
|
233
|
+
}
|
|
234
|
+
op = body.call(thisArg, _);
|
|
235
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
236
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
237
|
+
}
|
|
238
|
+
};
|
|
212
239
|
Object.defineProperty(util$1, "__esModule", { value: true });
|
|
213
240
|
util$1.isBrowserConfig = util$1.clone = util$1.formatCGIData = util$1.filterUrl = util$1.filter = util$1.generateStackTrace = util$1.endpoint = util$1.instrument = util$1.isErrorObject = util$1.makeNotice = util$1.logger = util$1.sanitize = util$1.shallowClone = util$1.runAfterNotifyHandlers = util$1.runBeforeNotifyHandlers = util$1.getSourceForBacktrace = util$1.getCauses = util$1.makeBacktrace = util$1.objectIsExtensible = util$1.objectIsEmpty = util$1.mergeNotice = util$1.merge = void 0;
|
|
214
|
-
|
|
241
|
+
var stackTraceParser = __importStar(require$$0);
|
|
215
242
|
function merge$1(obj1, obj2) {
|
|
216
|
-
|
|
217
|
-
for (
|
|
243
|
+
var result = {};
|
|
244
|
+
for (var k in obj1) {
|
|
218
245
|
result[k] = obj1[k];
|
|
219
246
|
}
|
|
220
|
-
for (
|
|
247
|
+
for (var k in obj2) {
|
|
221
248
|
result[k] = obj2[k];
|
|
222
249
|
}
|
|
223
250
|
return result;
|
|
224
251
|
}
|
|
225
252
|
util$1.merge = merge$1;
|
|
226
253
|
function mergeNotice(notice1, notice2) {
|
|
227
|
-
|
|
254
|
+
var result = merge$1(notice1, notice2);
|
|
228
255
|
if (notice1.context && notice2.context) {
|
|
229
256
|
result.context = merge$1(notice1.context, notice2.context);
|
|
230
257
|
}
|
|
@@ -232,7 +259,7 @@
|
|
|
232
259
|
}
|
|
233
260
|
util$1.mergeNotice = mergeNotice;
|
|
234
261
|
function objectIsEmpty(obj) {
|
|
235
|
-
for (
|
|
262
|
+
for (var k in obj) {
|
|
236
263
|
if (Object.prototype.hasOwnProperty.call(obj, k)) {
|
|
237
264
|
return false;
|
|
238
265
|
}
|
|
@@ -247,11 +274,12 @@
|
|
|
247
274
|
return Object.isExtensible(obj);
|
|
248
275
|
}
|
|
249
276
|
util$1.objectIsExtensible = objectIsExtensible$1;
|
|
250
|
-
function makeBacktrace(stack, shift
|
|
277
|
+
function makeBacktrace(stack, shift) {
|
|
278
|
+
if (shift === void 0) { shift = 0; }
|
|
251
279
|
try {
|
|
252
|
-
|
|
280
|
+
var backtrace = stackTraceParser
|
|
253
281
|
.parse(stack)
|
|
254
|
-
.map(line
|
|
282
|
+
.map(function (line) {
|
|
255
283
|
return {
|
|
256
284
|
file: line.file,
|
|
257
285
|
method: line.methodName,
|
|
@@ -270,8 +298,8 @@
|
|
|
270
298
|
util$1.makeBacktrace = makeBacktrace;
|
|
271
299
|
function getCauses(notice) {
|
|
272
300
|
if (notice.cause) {
|
|
273
|
-
|
|
274
|
-
|
|
301
|
+
var causes = [];
|
|
302
|
+
var cause = notice;
|
|
275
303
|
while (causes.length < 3 && (cause = cause.cause)) {
|
|
276
304
|
causes.push({
|
|
277
305
|
class: cause.name,
|
|
@@ -285,26 +313,36 @@
|
|
|
285
313
|
}
|
|
286
314
|
util$1.getCauses = getCauses;
|
|
287
315
|
function getSourceForBacktrace(backtrace, getSourceFileHandler) {
|
|
288
|
-
return __awaiter(this, void 0, void 0, function
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
316
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
317
|
+
var result, index, trace, fileContent;
|
|
318
|
+
return __generator(this, function (_a) {
|
|
319
|
+
switch (_a.label) {
|
|
320
|
+
case 0:
|
|
321
|
+
result = [];
|
|
322
|
+
if (!getSourceFileHandler || !backtrace || !backtrace.length) {
|
|
323
|
+
return [2 /*return*/, result];
|
|
324
|
+
}
|
|
325
|
+
index = 0;
|
|
326
|
+
_a.label = 1;
|
|
327
|
+
case 1:
|
|
328
|
+
if (!backtrace.length) return [3 /*break*/, 3];
|
|
329
|
+
trace = backtrace.splice(0)[index];
|
|
330
|
+
return [4 /*yield*/, getSourceFileHandler(trace.file)];
|
|
331
|
+
case 2:
|
|
332
|
+
fileContent = _a.sent();
|
|
333
|
+
result[index] = getSourceCodeSnippet(fileContent, trace.number);
|
|
334
|
+
index++;
|
|
335
|
+
return [3 /*break*/, 1];
|
|
336
|
+
case 3: return [2 /*return*/, result];
|
|
337
|
+
}
|
|
338
|
+
});
|
|
301
339
|
});
|
|
302
340
|
}
|
|
303
341
|
util$1.getSourceForBacktrace = getSourceForBacktrace;
|
|
304
342
|
function runBeforeNotifyHandlers(notice, handlers) {
|
|
305
|
-
|
|
306
|
-
for (
|
|
307
|
-
|
|
343
|
+
var result = true;
|
|
344
|
+
for (var i = 0, len = handlers.length; i < len; i++) {
|
|
345
|
+
var handler = handlers[i];
|
|
308
346
|
if (handler(notice) === false) {
|
|
309
347
|
result = false;
|
|
310
348
|
}
|
|
@@ -316,7 +354,7 @@
|
|
|
316
354
|
if (notice && notice.afterNotify) {
|
|
317
355
|
notice.afterNotify(error, notice);
|
|
318
356
|
}
|
|
319
|
-
for (
|
|
357
|
+
for (var i = 0, len = handlers.length; i < len; i++) {
|
|
320
358
|
handlers[i](error, notice);
|
|
321
359
|
}
|
|
322
360
|
return true;
|
|
@@ -327,21 +365,22 @@
|
|
|
327
365
|
if (typeof (obj) !== 'object' || obj === null) {
|
|
328
366
|
return {};
|
|
329
367
|
}
|
|
330
|
-
|
|
331
|
-
for (
|
|
368
|
+
var result = {};
|
|
369
|
+
for (var k in obj) {
|
|
332
370
|
result[k] = obj[k];
|
|
333
371
|
}
|
|
334
372
|
return result;
|
|
335
373
|
}
|
|
336
374
|
util$1.shallowClone = shallowClone;
|
|
337
|
-
function sanitize$2(obj, maxDepth
|
|
338
|
-
|
|
375
|
+
function sanitize$2(obj, maxDepth) {
|
|
376
|
+
if (maxDepth === void 0) { maxDepth = 8; }
|
|
377
|
+
var seenObjects = [];
|
|
339
378
|
function seen(obj) {
|
|
340
379
|
if (!obj || typeof (obj) !== 'object') {
|
|
341
380
|
return false;
|
|
342
381
|
}
|
|
343
|
-
for (
|
|
344
|
-
|
|
382
|
+
for (var i = 0; i < seenObjects.length; i++) {
|
|
383
|
+
var value = seenObjects[i];
|
|
345
384
|
if (value === obj) {
|
|
346
385
|
return true;
|
|
347
386
|
}
|
|
@@ -350,7 +389,7 @@
|
|
|
350
389
|
return false;
|
|
351
390
|
}
|
|
352
391
|
function canSerialize(obj) {
|
|
353
|
-
|
|
392
|
+
var typeOfObj = typeof obj;
|
|
354
393
|
// Functions are TMI
|
|
355
394
|
if (/function/.test(typeOfObj)) {
|
|
356
395
|
// Let special toJSON method pass as it's used by JSON.stringify (#722)
|
|
@@ -369,7 +408,8 @@
|
|
|
369
408
|
}
|
|
370
409
|
return true;
|
|
371
410
|
}
|
|
372
|
-
function serialize(obj, depth
|
|
411
|
+
function serialize(obj, depth) {
|
|
412
|
+
if (depth === void 0) { depth = 0; }
|
|
373
413
|
if (depth >= maxDepth) {
|
|
374
414
|
return '[DEPTH]';
|
|
375
415
|
}
|
|
@@ -383,13 +423,13 @@
|
|
|
383
423
|
}
|
|
384
424
|
// Serialize inside arrays
|
|
385
425
|
if (Array.isArray(obj)) {
|
|
386
|
-
return obj.map(o
|
|
426
|
+
return obj.map(function (o) { return safeSerialize(o, depth + 1); });
|
|
387
427
|
}
|
|
388
428
|
// Serialize inside objects
|
|
389
429
|
if (typeof (obj) === 'object') {
|
|
390
|
-
|
|
391
|
-
for (
|
|
392
|
-
|
|
430
|
+
var ret = {};
|
|
431
|
+
for (var k in obj) {
|
|
432
|
+
var v = obj[k];
|
|
393
433
|
if (Object.prototype.hasOwnProperty.call(obj, k) && (k != null) && (v != null)) {
|
|
394
434
|
ret[k] = safeSerialize(v, depth + 1);
|
|
395
435
|
}
|
|
@@ -399,20 +439,26 @@
|
|
|
399
439
|
// Return everything else untouched
|
|
400
440
|
return obj;
|
|
401
441
|
}
|
|
402
|
-
function safeSerialize(obj, depth
|
|
442
|
+
function safeSerialize(obj, depth) {
|
|
443
|
+
if (depth === void 0) { depth = 0; }
|
|
403
444
|
try {
|
|
404
445
|
return serialize(obj, depth);
|
|
405
446
|
}
|
|
406
447
|
catch (e) {
|
|
407
|
-
return
|
|
448
|
+
return "[ERROR] ".concat(e);
|
|
408
449
|
}
|
|
409
450
|
}
|
|
410
451
|
return safeSerialize(obj);
|
|
411
452
|
}
|
|
412
453
|
util$1.sanitize = sanitize$2;
|
|
413
454
|
function logger(client) {
|
|
414
|
-
|
|
415
|
-
return function (
|
|
455
|
+
var log = function (method) {
|
|
456
|
+
return function () {
|
|
457
|
+
var _a;
|
|
458
|
+
var args = [];
|
|
459
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
460
|
+
args[_i] = arguments[_i];
|
|
461
|
+
}
|
|
416
462
|
if (method === 'debug') {
|
|
417
463
|
if (!client.config.debug) {
|
|
418
464
|
return;
|
|
@@ -422,7 +468,7 @@
|
|
|
422
468
|
method = 'log';
|
|
423
469
|
}
|
|
424
470
|
args.unshift('[Honeybadger]');
|
|
425
|
-
client.config.logger[method](
|
|
471
|
+
(_a = client.config.logger)[method].apply(_a, args);
|
|
426
472
|
};
|
|
427
473
|
};
|
|
428
474
|
return {
|
|
@@ -439,19 +485,19 @@
|
|
|
439
485
|
* properties as Error, but supports additional Honeybadger properties.)
|
|
440
486
|
*/
|
|
441
487
|
function makeNotice$1(thing) {
|
|
442
|
-
|
|
488
|
+
var notice;
|
|
443
489
|
if (!thing) {
|
|
444
490
|
notice = {};
|
|
445
491
|
}
|
|
446
492
|
else if (isErrorObject(thing)) {
|
|
447
|
-
|
|
493
|
+
var e = thing;
|
|
448
494
|
notice = merge$1(thing, { name: e.name, message: e.message, stack: e.stack, cause: e.cause });
|
|
449
495
|
}
|
|
450
496
|
else if (typeof thing === 'object') {
|
|
451
497
|
notice = shallowClone(thing);
|
|
452
498
|
}
|
|
453
499
|
else {
|
|
454
|
-
|
|
500
|
+
var m = String(thing);
|
|
455
501
|
notice = { message: m };
|
|
456
502
|
}
|
|
457
503
|
return notice;
|
|
@@ -473,7 +519,7 @@
|
|
|
473
519
|
if (!object || !name || !replacement || !(name in object)) {
|
|
474
520
|
return;
|
|
475
521
|
}
|
|
476
|
-
|
|
522
|
+
var original = object[name];
|
|
477
523
|
while (original && original.__hb_original) {
|
|
478
524
|
original = original.__hb_original;
|
|
479
525
|
}
|
|
@@ -489,9 +535,9 @@
|
|
|
489
535
|
}
|
|
490
536
|
util$1.instrument = instrument$5;
|
|
491
537
|
function endpoint(base, path) {
|
|
492
|
-
|
|
538
|
+
var endpoint = base.trim().replace(/\/$/, '');
|
|
493
539
|
path = path.trim().replace(/(^\/|\/$)/g, '');
|
|
494
|
-
return
|
|
540
|
+
return "".concat(endpoint, "/").concat(path);
|
|
495
541
|
}
|
|
496
542
|
util$1.endpoint = endpoint;
|
|
497
543
|
function generateStackTrace() {
|
|
@@ -503,9 +549,9 @@
|
|
|
503
549
|
return e.stack;
|
|
504
550
|
}
|
|
505
551
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
552
|
+
var maxStackSize = 10;
|
|
553
|
+
var stack = [];
|
|
554
|
+
var curr = arguments.callee;
|
|
509
555
|
while (curr && stack.length < maxStackSize) {
|
|
510
556
|
if (/function(?:\s+([\w$]+))+\s*\(/.test(curr.toString())) {
|
|
511
557
|
stack.push(RegExp.$1 || '<anonymous>');
|
|
@@ -530,9 +576,9 @@
|
|
|
530
576
|
if (!is('Array', filters)) {
|
|
531
577
|
filters = [];
|
|
532
578
|
}
|
|
533
|
-
|
|
579
|
+
var seen = [];
|
|
534
580
|
function filter(obj) {
|
|
535
|
-
|
|
581
|
+
var k, newObj;
|
|
536
582
|
if (is('Object', obj) || is('Array', obj)) {
|
|
537
583
|
if (seen.indexOf(obj) !== -1) {
|
|
538
584
|
return '[CIRCULAR DATA STRUCTURE]';
|
|
@@ -565,7 +611,7 @@
|
|
|
565
611
|
}
|
|
566
612
|
util$1.filter = filter$1;
|
|
567
613
|
function filterMatch(key, filters) {
|
|
568
|
-
for (
|
|
614
|
+
for (var i = 0; i < filters.length; i++) {
|
|
569
615
|
if (key.toLowerCase().indexOf(filters[i].toLowerCase()) !== -1) {
|
|
570
616
|
return true;
|
|
571
617
|
}
|
|
@@ -573,7 +619,7 @@
|
|
|
573
619
|
return false;
|
|
574
620
|
}
|
|
575
621
|
function is(type, obj) {
|
|
576
|
-
|
|
622
|
+
var klass = Object.prototype.toString.call(obj).slice(8, -1);
|
|
577
623
|
return obj !== undefined && obj !== null && klass === type;
|
|
578
624
|
}
|
|
579
625
|
function filterUrl(url, filters) {
|
|
@@ -583,24 +629,25 @@
|
|
|
583
629
|
if (typeof url !== 'string') {
|
|
584
630
|
return url;
|
|
585
631
|
}
|
|
586
|
-
|
|
632
|
+
var query = url.split(/\?/, 2)[1];
|
|
587
633
|
if (!query) {
|
|
588
634
|
return url;
|
|
589
635
|
}
|
|
590
|
-
|
|
591
|
-
query.split(/[&]\s?/).forEach((pair)
|
|
592
|
-
|
|
636
|
+
var result = url;
|
|
637
|
+
query.split(/[&]\s?/).forEach(function (pair) {
|
|
638
|
+
var _a = pair.split('=', 2), key = _a[0], value = _a[1];
|
|
593
639
|
if (filterMatch(key, filters)) {
|
|
594
|
-
result = result.replace(
|
|
640
|
+
result = result.replace("".concat(key, "=").concat(value), "".concat(key, "=[FILTERED]"));
|
|
595
641
|
}
|
|
596
642
|
});
|
|
597
643
|
return result;
|
|
598
644
|
}
|
|
599
645
|
util$1.filterUrl = filterUrl;
|
|
600
|
-
function formatCGIData(vars, prefix
|
|
601
|
-
|
|
646
|
+
function formatCGIData(vars, prefix) {
|
|
647
|
+
if (prefix === void 0) { prefix = ''; }
|
|
648
|
+
var formattedVars = {};
|
|
602
649
|
Object.keys(vars).forEach(function (key) {
|
|
603
|
-
|
|
650
|
+
var formattedKey = prefix + key.replace(/\W/g, '_').toUpperCase();
|
|
604
651
|
formattedVars[formattedKey] = vars[key];
|
|
605
652
|
});
|
|
606
653
|
return formattedVars;
|
|
@@ -610,18 +657,19 @@
|
|
|
610
657
|
return JSON.parse(JSON.stringify(obj));
|
|
611
658
|
}
|
|
612
659
|
util$1.clone = clone;
|
|
613
|
-
function getSourceCodeSnippet(fileData, lineNumber, sourceRadius
|
|
660
|
+
function getSourceCodeSnippet(fileData, lineNumber, sourceRadius) {
|
|
661
|
+
if (sourceRadius === void 0) { sourceRadius = 2; }
|
|
614
662
|
if (!fileData) {
|
|
615
663
|
return null;
|
|
616
664
|
}
|
|
617
|
-
|
|
665
|
+
var lines = fileData.split('\n');
|
|
618
666
|
// add one empty line because array index starts from 0, but error line number is counted from 1
|
|
619
667
|
lines.unshift('');
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
for (
|
|
624
|
-
|
|
668
|
+
var start = lineNumber - sourceRadius;
|
|
669
|
+
var end = lineNumber + sourceRadius;
|
|
670
|
+
var result = {};
|
|
671
|
+
for (var i = start; i <= end; i++) {
|
|
672
|
+
var line = lines[i];
|
|
625
673
|
if (typeof line === 'string') {
|
|
626
674
|
result[i] = line;
|
|
627
675
|
}
|
|
@@ -637,80 +685,99 @@
|
|
|
637
685
|
|
|
638
686
|
Object.defineProperty(store, "__esModule", { value: true });
|
|
639
687
|
store.GlobalStore = void 0;
|
|
640
|
-
|
|
641
|
-
|
|
688
|
+
var GlobalStore = /** @class */ (function () {
|
|
689
|
+
function GlobalStore(store) {
|
|
642
690
|
this.store = store;
|
|
643
691
|
}
|
|
644
|
-
getStore() {
|
|
692
|
+
GlobalStore.prototype.getStore = function () {
|
|
645
693
|
return this.store;
|
|
646
|
-
}
|
|
647
|
-
run(store, callback
|
|
694
|
+
};
|
|
695
|
+
GlobalStore.prototype.run = function (store, callback) {
|
|
696
|
+
var args = [];
|
|
697
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
698
|
+
args[_i - 2] = arguments[_i];
|
|
699
|
+
}
|
|
648
700
|
this.store = store;
|
|
649
|
-
return callback(
|
|
650
|
-
}
|
|
651
|
-
|
|
701
|
+
return callback.apply(void 0, args);
|
|
702
|
+
};
|
|
703
|
+
return GlobalStore;
|
|
704
|
+
}());
|
|
652
705
|
store.GlobalStore = GlobalStore;
|
|
653
706
|
|
|
707
|
+
var __assign$1 = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
708
|
+
__assign$1 = Object.assign || function(t) {
|
|
709
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
710
|
+
s = arguments[i];
|
|
711
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
712
|
+
t[p] = s[p];
|
|
713
|
+
}
|
|
714
|
+
return t;
|
|
715
|
+
};
|
|
716
|
+
return __assign$1.apply(this, arguments);
|
|
717
|
+
};
|
|
654
718
|
Object.defineProperty(client, "__esModule", { value: true });
|
|
655
719
|
client.Client = void 0;
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
720
|
+
var util_1$2 = util$1;
|
|
721
|
+
var store_1 = store;
|
|
722
|
+
var notifier = {
|
|
659
723
|
name: 'honeybadger-js',
|
|
660
724
|
url: 'https://github.com/honeybadger-io/honeybadger-js',
|
|
661
|
-
version: '4.1.
|
|
725
|
+
version: '4.1.3'
|
|
662
726
|
};
|
|
663
727
|
// Split at commas and spaces
|
|
664
|
-
|
|
728
|
+
var TAG_SEPARATOR = /,|\s+/;
|
|
665
729
|
// Checks for non-blank characters
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
730
|
+
var NOT_BLANK = /\S/;
|
|
731
|
+
var Client = /** @class */ (function () {
|
|
732
|
+
function Client(opts, transport) {
|
|
733
|
+
if (opts === void 0) { opts = {}; }
|
|
669
734
|
this.__pluginsExecuted = false;
|
|
670
735
|
this.__store = null;
|
|
671
736
|
this.__beforeNotifyHandlers = [];
|
|
672
737
|
this.__afterNotifyHandlers = [];
|
|
673
|
-
this.config =
|
|
738
|
+
this.config = __assign$1({ apiKey: null, endpoint: 'https://api.honeybadger.io', environment: null, hostname: null, projectRoot: null, component: null, action: null, revision: null, reportData: null, breadcrumbsEnabled: true, maxBreadcrumbs: 40, maxObjectDepth: 8, logger: console, developmentEnvironments: ['dev', 'development', 'test'], debug: false, tags: null, enableUncaught: true, enableUnhandledRejection: true, afterUncaught: function () { return true; }, filters: ['creditcard', 'password'], __plugins: [] }, opts);
|
|
674
739
|
// First, we go with the global (shared) store.
|
|
675
740
|
// Webserver middleware can then switch to the AsyncStore for async context tracking.
|
|
676
741
|
this.__store = new store_1.GlobalStore({ context: {}, breadcrumbs: [] });
|
|
677
742
|
this.__transport = transport;
|
|
678
743
|
this.logger = (0, util_1$2.logger)(this);
|
|
679
744
|
}
|
|
680
|
-
getVersion() {
|
|
745
|
+
Client.prototype.getVersion = function () {
|
|
681
746
|
return notifier.version;
|
|
682
|
-
}
|
|
683
|
-
configure
|
|
684
|
-
|
|
747
|
+
};
|
|
748
|
+
Client.prototype.configure = function (opts) {
|
|
749
|
+
var _this = this;
|
|
750
|
+
if (opts === void 0) { opts = {}; }
|
|
751
|
+
for (var k in opts) {
|
|
685
752
|
this.config[k] = opts[k];
|
|
686
753
|
}
|
|
687
754
|
if (!this.__pluginsExecuted) {
|
|
688
755
|
this.__pluginsExecuted = true;
|
|
689
|
-
this.config.__plugins.forEach((plugin)
|
|
756
|
+
this.config.__plugins.forEach(function (plugin) { return plugin.load(_this); });
|
|
690
757
|
}
|
|
691
758
|
return this;
|
|
692
|
-
}
|
|
693
|
-
__setStore(store) {
|
|
759
|
+
};
|
|
760
|
+
Client.prototype.__setStore = function (store) {
|
|
694
761
|
this.__store = store;
|
|
695
|
-
}
|
|
696
|
-
beforeNotify(handler) {
|
|
762
|
+
};
|
|
763
|
+
Client.prototype.beforeNotify = function (handler) {
|
|
697
764
|
this.__beforeNotifyHandlers.push(handler);
|
|
698
765
|
return this;
|
|
699
|
-
}
|
|
700
|
-
afterNotify(handler) {
|
|
766
|
+
};
|
|
767
|
+
Client.prototype.afterNotify = function (handler) {
|
|
701
768
|
this.__afterNotifyHandlers.push(handler);
|
|
702
769
|
return this;
|
|
703
|
-
}
|
|
704
|
-
setContext(context) {
|
|
770
|
+
};
|
|
771
|
+
Client.prototype.setContext = function (context) {
|
|
705
772
|
if (typeof context === 'object') {
|
|
706
|
-
|
|
773
|
+
var store = this.__store.getStore();
|
|
707
774
|
store.context = (0, util_1$2.merge)(store.context, context);
|
|
708
775
|
}
|
|
709
776
|
return this;
|
|
710
|
-
}
|
|
711
|
-
resetContext(context) {
|
|
777
|
+
};
|
|
778
|
+
Client.prototype.resetContext = function (context) {
|
|
712
779
|
this.logger.warn('Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.');
|
|
713
|
-
|
|
780
|
+
var store = this.__store.getStore();
|
|
714
781
|
if (typeof context === 'object' && context !== null) {
|
|
715
782
|
store.context = context;
|
|
716
783
|
}
|
|
@@ -718,16 +785,19 @@
|
|
|
718
785
|
store.context = {};
|
|
719
786
|
}
|
|
720
787
|
return this;
|
|
721
|
-
}
|
|
722
|
-
clear() {
|
|
723
|
-
|
|
788
|
+
};
|
|
789
|
+
Client.prototype.clear = function () {
|
|
790
|
+
var store = this.__store.getStore();
|
|
724
791
|
store.context = {};
|
|
725
792
|
store.breadcrumbs = [];
|
|
726
793
|
return this;
|
|
727
|
-
}
|
|
728
|
-
notify(noticeable, name
|
|
729
|
-
|
|
730
|
-
|
|
794
|
+
};
|
|
795
|
+
Client.prototype.notify = function (noticeable, name, extra) {
|
|
796
|
+
var _this = this;
|
|
797
|
+
if (name === void 0) { name = undefined; }
|
|
798
|
+
if (extra === void 0) { extra = undefined; }
|
|
799
|
+
var preConditionError = null;
|
|
800
|
+
var notice = this.makeNotice(noticeable, name, extra);
|
|
731
801
|
if (!notice) {
|
|
732
802
|
this.logger.debug('failed to build error report');
|
|
733
803
|
preConditionError = new Error('failed to build error report');
|
|
@@ -746,8 +816,8 @@
|
|
|
746
816
|
}
|
|
747
817
|
// we need to have the source file data before the beforeNotifyHandlers,
|
|
748
818
|
// in case they modify them
|
|
749
|
-
|
|
750
|
-
|
|
819
|
+
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1$2.shallowClone)(trace); }) : null;
|
|
820
|
+
var beforeNotifyResult = (0, util_1$2.runBeforeNotifyHandlers)(notice, this.__beforeNotifyHandlers);
|
|
751
821
|
if (!preConditionError && !beforeNotifyResult) {
|
|
752
822
|
this.logger.debug('skipping error report: beforeNotify handlers returned false', notice);
|
|
753
823
|
preConditionError = new Error('beforeNotify handlers returned false');
|
|
@@ -764,58 +834,61 @@
|
|
|
764
834
|
stack: notice.stack
|
|
765
835
|
}
|
|
766
836
|
});
|
|
767
|
-
|
|
837
|
+
var breadcrumbs = this.__getStoreContentsOrDefault().breadcrumbs;
|
|
768
838
|
notice.__breadcrumbs = this.config.breadcrumbsEnabled ? breadcrumbs.slice() : [];
|
|
769
839
|
(0, util_1$2.getSourceForBacktrace)(sourceCodeData, this.__getSourceFileHandler)
|
|
770
|
-
.then(sourcePerTrace
|
|
771
|
-
sourcePerTrace.forEach((source, index)
|
|
840
|
+
.then(function (sourcePerTrace) {
|
|
841
|
+
sourcePerTrace.forEach(function (source, index) {
|
|
772
842
|
notice.backtrace[index].source = source;
|
|
773
843
|
});
|
|
774
|
-
|
|
775
|
-
|
|
844
|
+
var payload = _this.__buildPayload(notice);
|
|
845
|
+
_this.__transport
|
|
776
846
|
.send({
|
|
777
847
|
headers: {
|
|
778
|
-
'X-API-Key':
|
|
848
|
+
'X-API-Key': _this.config.apiKey,
|
|
779
849
|
'Content-Type': 'application/json',
|
|
780
850
|
'Accept': 'text/json, application/json'
|
|
781
851
|
},
|
|
782
852
|
method: 'POST',
|
|
783
|
-
endpoint: (0, util_1$2.endpoint)(
|
|
784
|
-
maxObjectDepth:
|
|
785
|
-
logger:
|
|
786
|
-
async: (0, util_1$2.isBrowserConfig)(
|
|
853
|
+
endpoint: (0, util_1$2.endpoint)(_this.config.endpoint, '/v1/notices/js'),
|
|
854
|
+
maxObjectDepth: _this.config.maxObjectDepth,
|
|
855
|
+
logger: _this.logger,
|
|
856
|
+
async: (0, util_1$2.isBrowserConfig)(_this.config) ? _this.config.async : undefined,
|
|
787
857
|
}, payload)
|
|
788
|
-
.then(res
|
|
858
|
+
.then(function (res) {
|
|
789
859
|
if (res.statusCode !== 201) {
|
|
790
|
-
(0, util_1$2.runAfterNotifyHandlers)(notice,
|
|
791
|
-
|
|
860
|
+
(0, util_1$2.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, new Error("Bad HTTP response: ".concat(res.statusCode)));
|
|
861
|
+
_this.logger.warn("Error report failed: unknown response from server. code=".concat(res.statusCode));
|
|
792
862
|
return;
|
|
793
863
|
}
|
|
794
|
-
|
|
864
|
+
var uuid = JSON.parse(res.body).id;
|
|
795
865
|
(0, util_1$2.runAfterNotifyHandlers)((0, util_1$2.merge)(notice, {
|
|
796
866
|
id: uuid
|
|
797
|
-
}),
|
|
798
|
-
|
|
867
|
+
}), _this.__afterNotifyHandlers);
|
|
868
|
+
_this.logger.info("Error report sent \u26A1 https://app.honeybadger.io/notice/".concat(uuid));
|
|
799
869
|
})
|
|
800
|
-
.catch(err
|
|
801
|
-
|
|
802
|
-
(0, util_1$2.runAfterNotifyHandlers)(notice,
|
|
870
|
+
.catch(function (err) {
|
|
871
|
+
_this.logger.error('Error report failed: an unknown error occurred.', "message=".concat(err.message));
|
|
872
|
+
(0, util_1$2.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, err);
|
|
803
873
|
});
|
|
804
874
|
});
|
|
805
875
|
return true;
|
|
806
|
-
}
|
|
876
|
+
};
|
|
807
877
|
/**
|
|
808
878
|
* An async version of {@link notify} that resolves only after the notice has been reported to Honeybadger.
|
|
809
879
|
* Implemented using the {@link afterNotify} hook.
|
|
810
880
|
* Rejects if for any reason the report failed to be reported.
|
|
811
881
|
* Useful in serverless environments (AWS Lambda).
|
|
812
882
|
*/
|
|
813
|
-
notifyAsync(noticeable, name
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
883
|
+
Client.prototype.notifyAsync = function (noticeable, name, extra) {
|
|
884
|
+
var _this = this;
|
|
885
|
+
if (name === void 0) { name = undefined; }
|
|
886
|
+
if (extra === void 0) { extra = undefined; }
|
|
887
|
+
return new Promise(function (resolve, reject) {
|
|
888
|
+
var applyAfterNotify = function (partialNotice) {
|
|
889
|
+
var originalAfterNotify = partialNotice.afterNotify;
|
|
890
|
+
partialNotice.afterNotify = function (err) {
|
|
891
|
+
originalAfterNotify === null || originalAfterNotify === void 0 ? void 0 : originalAfterNotify.call(_this, err);
|
|
819
892
|
if (err) {
|
|
820
893
|
return reject(err);
|
|
821
894
|
}
|
|
@@ -823,7 +896,7 @@
|
|
|
823
896
|
};
|
|
824
897
|
};
|
|
825
898
|
// We have to respect any afterNotify hooks that come from the arguments
|
|
826
|
-
|
|
899
|
+
var objectToOverride;
|
|
827
900
|
if (noticeable.afterNotify) {
|
|
828
901
|
objectToOverride = noticeable;
|
|
829
902
|
}
|
|
@@ -843,13 +916,15 @@
|
|
|
843
916
|
objectToOverride = name = {};
|
|
844
917
|
}
|
|
845
918
|
applyAfterNotify(objectToOverride);
|
|
846
|
-
|
|
919
|
+
_this.notify(noticeable, name, extra);
|
|
847
920
|
});
|
|
848
|
-
}
|
|
849
|
-
makeNotice(noticeable, name
|
|
850
|
-
|
|
921
|
+
};
|
|
922
|
+
Client.prototype.makeNotice = function (noticeable, name, extra) {
|
|
923
|
+
if (name === void 0) { name = undefined; }
|
|
924
|
+
if (extra === void 0) { extra = undefined; }
|
|
925
|
+
var notice = (0, util_1$2.makeNotice)(noticeable);
|
|
851
926
|
if (name && !(typeof name === 'object')) {
|
|
852
|
-
|
|
927
|
+
var n = String(name);
|
|
853
928
|
name = { name: n };
|
|
854
929
|
}
|
|
855
930
|
if (name) {
|
|
@@ -861,13 +936,13 @@
|
|
|
861
936
|
if ((0, util_1$2.objectIsEmpty)(notice)) {
|
|
862
937
|
return null;
|
|
863
938
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
939
|
+
var context = this.__getStoreContentsOrDefault().context;
|
|
940
|
+
var noticeTags = this.__constructTags(notice.tags);
|
|
941
|
+
var contextTags = this.__constructTags(context['tags']);
|
|
942
|
+
var configTags = this.__constructTags(this.config.tags);
|
|
868
943
|
// Turning into a Set will remove duplicates
|
|
869
|
-
|
|
870
|
-
|
|
944
|
+
var tags = noticeTags.concat(contextTags).concat(configTags);
|
|
945
|
+
var uniqueTags = tags.filter(function (item, index) { return tags.indexOf(item) === index; });
|
|
871
946
|
notice = (0, util_1$2.merge)(notice, {
|
|
872
947
|
name: notice.name || 'Error',
|
|
873
948
|
context: (0, util_1$2.merge)(context, notice.context),
|
|
@@ -878,46 +953,46 @@
|
|
|
878
953
|
revision: notice.revision || this.config.revision,
|
|
879
954
|
tags: uniqueTags,
|
|
880
955
|
});
|
|
881
|
-
|
|
956
|
+
var backtraceShift = 0;
|
|
882
957
|
if (typeof notice.stack !== 'string' || !notice.stack.trim()) {
|
|
883
958
|
notice.stack = (0, util_1$2.generateStackTrace)();
|
|
884
959
|
backtraceShift = 2;
|
|
885
960
|
}
|
|
886
961
|
notice.backtrace = (0, util_1$2.makeBacktrace)(notice.stack, backtraceShift);
|
|
887
962
|
return notice;
|
|
888
|
-
}
|
|
889
|
-
addBreadcrumb(message, opts) {
|
|
963
|
+
};
|
|
964
|
+
Client.prototype.addBreadcrumb = function (message, opts) {
|
|
890
965
|
if (!this.config.breadcrumbsEnabled) {
|
|
891
966
|
return;
|
|
892
967
|
}
|
|
893
968
|
opts = opts || {};
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
969
|
+
var metadata = (0, util_1$2.shallowClone)(opts.metadata);
|
|
970
|
+
var category = opts.category || 'custom';
|
|
971
|
+
var timestamp = new Date().toISOString();
|
|
972
|
+
var store = this.__store.getStore();
|
|
973
|
+
var breadcrumbs = store.breadcrumbs;
|
|
899
974
|
breadcrumbs.push({
|
|
900
975
|
category: category,
|
|
901
976
|
message: message,
|
|
902
977
|
metadata: metadata,
|
|
903
978
|
timestamp: timestamp
|
|
904
979
|
});
|
|
905
|
-
|
|
980
|
+
var limit = this.config.maxBreadcrumbs;
|
|
906
981
|
if (breadcrumbs.length > limit) {
|
|
907
982
|
breadcrumbs = breadcrumbs.slice(breadcrumbs.length - limit);
|
|
908
983
|
}
|
|
909
984
|
store.breadcrumbs = breadcrumbs;
|
|
910
985
|
return this;
|
|
911
|
-
}
|
|
912
|
-
__developmentMode() {
|
|
986
|
+
};
|
|
987
|
+
Client.prototype.__developmentMode = function () {
|
|
913
988
|
if (this.config.reportData === true) {
|
|
914
989
|
return false;
|
|
915
990
|
}
|
|
916
991
|
return (this.config.environment && this.config.developmentEnvironments.includes(this.config.environment));
|
|
917
|
-
}
|
|
918
|
-
__buildPayload(notice) {
|
|
919
|
-
|
|
920
|
-
|
|
992
|
+
};
|
|
993
|
+
Client.prototype.__buildPayload = function (notice) {
|
|
994
|
+
var headers = (0, util_1$2.filter)(notice.headers, this.config.filters) || {};
|
|
995
|
+
var cgiData = (0, util_1$2.filter)(__assign$1(__assign$1({}, notice.cgiData), (0, util_1$2.formatCGIData)(headers, 'HTTP_')), this.config.filters);
|
|
921
996
|
return {
|
|
922
997
|
notifier: notifier,
|
|
923
998
|
breadcrumbs: {
|
|
@@ -950,24 +1025,25 @@
|
|
|
950
1025
|
},
|
|
951
1026
|
details: notice.details || {}
|
|
952
1027
|
};
|
|
953
|
-
}
|
|
954
|
-
__constructTags(tags) {
|
|
1028
|
+
};
|
|
1029
|
+
Client.prototype.__constructTags = function (tags) {
|
|
955
1030
|
if (!tags) {
|
|
956
1031
|
return [];
|
|
957
1032
|
}
|
|
958
|
-
return tags.toString().split(TAG_SEPARATOR).filter((tag)
|
|
959
|
-
}
|
|
1033
|
+
return tags.toString().split(TAG_SEPARATOR).filter(function (tag) { return NOT_BLANK.test(tag); });
|
|
1034
|
+
};
|
|
960
1035
|
/**
|
|
961
1036
|
* For ALS, the store may be uninitialized (if .run()` has not been called).
|
|
962
1037
|
* This provides an easy way to read the existing store object or fall back to a default.
|
|
963
1038
|
* Returns *a copy* of the s tore contents.
|
|
964
1039
|
*/
|
|
965
|
-
__getStoreContentsOrDefault() {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
return
|
|
969
|
-
}
|
|
970
|
-
|
|
1040
|
+
Client.prototype.__getStoreContentsOrDefault = function () {
|
|
1041
|
+
var existingStoreContents = this.__store.getStore();
|
|
1042
|
+
var storeContents = existingStoreContents || {};
|
|
1043
|
+
return __assign$1({ context: {}, breadcrumbs: [] }, storeContents);
|
|
1044
|
+
};
|
|
1045
|
+
return Client;
|
|
1046
|
+
}());
|
|
971
1047
|
client.Client = Client;
|
|
972
1048
|
|
|
973
1049
|
var types = {};
|
|
@@ -1020,46 +1096,46 @@
|
|
|
1020
1096
|
if (!element || !element.tagName) {
|
|
1021
1097
|
return '';
|
|
1022
1098
|
}
|
|
1023
|
-
|
|
1099
|
+
var name = element.tagName.toLowerCase();
|
|
1024
1100
|
// Ignore the root <html> element in selectors and events.
|
|
1025
1101
|
if (name === 'html') {
|
|
1026
1102
|
return '';
|
|
1027
1103
|
}
|
|
1028
1104
|
if (element.id) {
|
|
1029
|
-
name +=
|
|
1105
|
+
name += "#".concat(element.id);
|
|
1030
1106
|
}
|
|
1031
|
-
|
|
1107
|
+
var stringClassNames = element.getAttribute('class');
|
|
1032
1108
|
if (stringClassNames) {
|
|
1033
|
-
stringClassNames.split(/\s+/).forEach(className
|
|
1034
|
-
name +=
|
|
1109
|
+
stringClassNames.split(/\s+/).forEach(function (className) {
|
|
1110
|
+
name += ".".concat(className);
|
|
1035
1111
|
});
|
|
1036
1112
|
}
|
|
1037
|
-
['alt', 'name', 'title', 'type'].forEach(attrName
|
|
1038
|
-
|
|
1113
|
+
['alt', 'name', 'title', 'type'].forEach(function (attrName) {
|
|
1114
|
+
var attr = element.getAttribute(attrName);
|
|
1039
1115
|
if (attr) {
|
|
1040
|
-
name +=
|
|
1116
|
+
name += "[".concat(attrName, "=\"").concat(attr, "\"]");
|
|
1041
1117
|
}
|
|
1042
1118
|
});
|
|
1043
|
-
|
|
1119
|
+
var siblings = getSiblings(element);
|
|
1044
1120
|
if (siblings.length > 1) {
|
|
1045
|
-
name +=
|
|
1121
|
+
name += ":nth-child(".concat(Array.prototype.indexOf.call(siblings, element) + 1, ")");
|
|
1046
1122
|
}
|
|
1047
1123
|
return name;
|
|
1048
1124
|
}
|
|
1049
1125
|
util.stringNameOfElement = stringNameOfElement;
|
|
1050
1126
|
function stringSelectorOfElement(element) {
|
|
1051
|
-
|
|
1127
|
+
var name = stringNameOfElement(element);
|
|
1052
1128
|
if (element.parentNode && element.parentNode.tagName) {
|
|
1053
|
-
|
|
1129
|
+
var parentName = stringSelectorOfElement(element.parentNode);
|
|
1054
1130
|
if (parentName.length > 0) {
|
|
1055
|
-
return
|
|
1131
|
+
return "".concat(parentName, " > ").concat(name);
|
|
1056
1132
|
}
|
|
1057
1133
|
}
|
|
1058
1134
|
return name;
|
|
1059
1135
|
}
|
|
1060
1136
|
util.stringSelectorOfElement = stringSelectorOfElement;
|
|
1061
1137
|
function stringTextOfElement(element) {
|
|
1062
|
-
|
|
1138
|
+
var text = element.textContent || element.innerText || '';
|
|
1063
1139
|
if (!text && (element.type === 'submit' || element.type === 'button')) {
|
|
1064
1140
|
text = element.value;
|
|
1065
1141
|
}
|
|
@@ -1076,10 +1152,10 @@
|
|
|
1076
1152
|
// If fetch isn't native, it may be wrapped by someone else. Try to get
|
|
1077
1153
|
// a pristine function from an iframe.
|
|
1078
1154
|
try {
|
|
1079
|
-
|
|
1155
|
+
var sandbox = document.createElement('iframe');
|
|
1080
1156
|
sandbox.style.display = 'none';
|
|
1081
1157
|
document.head.appendChild(sandbox);
|
|
1082
|
-
|
|
1158
|
+
var result = sandbox.contentWindow.fetch && isNative(sandbox.contentWindow.fetch);
|
|
1083
1159
|
document.head.removeChild(sandbox);
|
|
1084
1160
|
return result;
|
|
1085
1161
|
}
|
|
@@ -1096,7 +1172,7 @@
|
|
|
1096
1172
|
}
|
|
1097
1173
|
function parseURL(url) {
|
|
1098
1174
|
// Regexp: https://tools.ietf.org/html/rfc3986#appendix-B
|
|
1099
|
-
|
|
1175
|
+
var match = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/) || {};
|
|
1100
1176
|
return {
|
|
1101
1177
|
protocol: match[2],
|
|
1102
1178
|
host: match[4],
|
|
@@ -1105,8 +1181,8 @@
|
|
|
1105
1181
|
}
|
|
1106
1182
|
util.parseURL = parseURL;
|
|
1107
1183
|
function localURLPathname(url) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1184
|
+
var parsed = parseURL(url);
|
|
1185
|
+
var parsedDocURL = parseURL(document.URL);
|
|
1110
1186
|
// URL must be relative
|
|
1111
1187
|
if (!parsed.host || !parsed.protocol) {
|
|
1112
1188
|
return parsed.pathname;
|
|
@@ -1116,13 +1192,13 @@
|
|
|
1116
1192
|
return parsed.pathname;
|
|
1117
1193
|
}
|
|
1118
1194
|
// x-domain
|
|
1119
|
-
return
|
|
1195
|
+
return "".concat(parsed.protocol, "://").concat(parsed.host).concat(parsed.pathname);
|
|
1120
1196
|
}
|
|
1121
1197
|
util.localURLPathname = localURLPathname;
|
|
1122
1198
|
function decodeCookie(string) {
|
|
1123
|
-
|
|
1124
|
-
string.split(/[;,]\s?/).forEach((pair)
|
|
1125
|
-
|
|
1199
|
+
var result = {};
|
|
1200
|
+
string.split(/[;,]\s?/).forEach(function (pair) {
|
|
1201
|
+
var _a = pair.split('=', 2), key = _a[0], value = _a[1];
|
|
1126
1202
|
result[key] = value;
|
|
1127
1203
|
});
|
|
1128
1204
|
return result;
|
|
@@ -1132,8 +1208,8 @@
|
|
|
1132
1208
|
if (typeof object !== 'object') {
|
|
1133
1209
|
return undefined;
|
|
1134
1210
|
}
|
|
1135
|
-
|
|
1136
|
-
for (
|
|
1211
|
+
var cookies = [];
|
|
1212
|
+
for (var k in object) {
|
|
1137
1213
|
cookies.push(k + '=' + object[k]);
|
|
1138
1214
|
}
|
|
1139
1215
|
return cookies.join(';');
|
|
@@ -1142,14 +1218,14 @@
|
|
|
1142
1218
|
// Helpers
|
|
1143
1219
|
function getSiblings(element) {
|
|
1144
1220
|
try {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
Array.prototype.forEach.call(nodes, node
|
|
1221
|
+
var nodes = element.parentNode.childNodes;
|
|
1222
|
+
var siblings_1 = [];
|
|
1223
|
+
Array.prototype.forEach.call(nodes, function (node) {
|
|
1148
1224
|
if (node.tagName && node.tagName === element.tagName) {
|
|
1149
|
-
|
|
1225
|
+
siblings_1.push(node);
|
|
1150
1226
|
}
|
|
1151
1227
|
});
|
|
1152
|
-
return
|
|
1228
|
+
return siblings_1;
|
|
1153
1229
|
}
|
|
1154
1230
|
catch (e) {
|
|
1155
1231
|
return [];
|
|
@@ -1165,7 +1241,7 @@
|
|
|
1165
1241
|
// handlers: try/catch, or `window.onerror`. When available, `window.onerror`
|
|
1166
1242
|
// will provide more information in modern browsers.
|
|
1167
1243
|
util.preferCatch = (function () {
|
|
1168
|
-
|
|
1244
|
+
var preferCatch = true;
|
|
1169
1245
|
// IE < 10
|
|
1170
1246
|
if (!window.atob) {
|
|
1171
1247
|
preferCatch = false;
|
|
@@ -1189,24 +1265,25 @@
|
|
|
1189
1265
|
Object.defineProperty(onerror, "__esModule", { value: true });
|
|
1190
1266
|
onerror.onError = onerror.ignoreNextOnError = void 0;
|
|
1191
1267
|
/* eslint-disable prefer-rest-params */
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1268
|
+
var core_1$6 = src;
|
|
1269
|
+
var instrument$4 = core_1$6.Util.instrument, makeNotice = core_1$6.Util.makeNotice;
|
|
1270
|
+
var ignoreOnError = 0;
|
|
1271
|
+
var currentTimeout;
|
|
1196
1272
|
function ignoreNextOnError() {
|
|
1197
1273
|
ignoreOnError += 1;
|
|
1198
1274
|
clearTimeout(currentTimeout);
|
|
1199
|
-
currentTimeout = setTimeout(()
|
|
1275
|
+
currentTimeout = setTimeout(function () {
|
|
1200
1276
|
ignoreOnError = 0;
|
|
1201
1277
|
});
|
|
1202
1278
|
}
|
|
1203
1279
|
onerror.ignoreNextOnError = ignoreNextOnError;
|
|
1204
1280
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1205
|
-
function onError(_window
|
|
1281
|
+
function onError(_window) {
|
|
1282
|
+
if (_window === void 0) { _window = window; }
|
|
1206
1283
|
return {
|
|
1207
|
-
load: (client)
|
|
1284
|
+
load: function (client) {
|
|
1208
1285
|
instrument$4(_window, 'onerror', function (original) {
|
|
1209
|
-
|
|
1286
|
+
var onerror = function (msg, url, line, col, err) {
|
|
1210
1287
|
client.logger.debug('window.onerror callback invoked', arguments);
|
|
1211
1288
|
if (ignoreOnError > 0) {
|
|
1212
1289
|
client.logger.debug('Ignoring window.onerror (error likely reported earlier)', arguments);
|
|
@@ -1221,7 +1298,7 @@
|
|
|
1221
1298
|
}
|
|
1222
1299
|
return;
|
|
1223
1300
|
}
|
|
1224
|
-
|
|
1301
|
+
var notice = makeNotice(err);
|
|
1225
1302
|
if (!notice.name) {
|
|
1226
1303
|
notice.name = 'window.onerror';
|
|
1227
1304
|
}
|
|
@@ -1232,7 +1309,7 @@
|
|
|
1232
1309
|
// Simulate v8 stack
|
|
1233
1310
|
notice.stack = [notice.message, '\n at ? (', url || 'unknown', ':', line || 0, ':', col || 0, ')'].join('');
|
|
1234
1311
|
}
|
|
1235
|
-
client.addBreadcrumb((notice.name === 'window.onerror' || !notice.name) ? 'window.onerror' :
|
|
1312
|
+
client.addBreadcrumb((notice.name === 'window.onerror' || !notice.name) ? 'window.onerror' : "window.onerror: ".concat(notice.name), {
|
|
1236
1313
|
category: 'error',
|
|
1237
1314
|
metadata: {
|
|
1238
1315
|
name: notice.name,
|
|
@@ -1261,12 +1338,13 @@
|
|
|
1261
1338
|
|
|
1262
1339
|
Object.defineProperty(onunhandledrejection, "__esModule", { value: true });
|
|
1263
1340
|
/* eslint-disable prefer-rest-params */
|
|
1264
|
-
|
|
1265
|
-
|
|
1341
|
+
var core_1$5 = src;
|
|
1342
|
+
var instrument$3 = core_1$5.Util.instrument;
|
|
1266
1343
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1267
|
-
function default_1$3(_window
|
|
1344
|
+
function default_1$3(_window) {
|
|
1345
|
+
if (_window === void 0) { _window = window; }
|
|
1268
1346
|
return {
|
|
1269
|
-
load: (client)
|
|
1347
|
+
load: function (client) {
|
|
1270
1348
|
if (!client.config.enableUnhandledRejection) {
|
|
1271
1349
|
return;
|
|
1272
1350
|
}
|
|
@@ -1278,31 +1356,31 @@
|
|
|
1278
1356
|
if (!client.config.enableUnhandledRejection) {
|
|
1279
1357
|
return;
|
|
1280
1358
|
}
|
|
1281
|
-
|
|
1359
|
+
var reason = promiseRejectionEvent.reason;
|
|
1282
1360
|
if (reason instanceof Error) {
|
|
1283
1361
|
// simulate v8 stack
|
|
1284
1362
|
// const fileName = reason.fileName || 'unknown'
|
|
1285
1363
|
// const lineNumber = reason.lineNumber || 0
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1364
|
+
var fileName = 'unknown';
|
|
1365
|
+
var lineNumber = 0;
|
|
1366
|
+
var stackFallback = "".concat(reason.message, "\n at ? (").concat(fileName, ":").concat(lineNumber, ")");
|
|
1367
|
+
var stack = reason.stack || stackFallback;
|
|
1368
|
+
var err = {
|
|
1291
1369
|
name: reason.name,
|
|
1292
|
-
message:
|
|
1293
|
-
stack
|
|
1370
|
+
message: "UnhandledPromiseRejectionWarning: ".concat(reason),
|
|
1371
|
+
stack: stack
|
|
1294
1372
|
};
|
|
1295
|
-
client.addBreadcrumb(
|
|
1373
|
+
client.addBreadcrumb("window.onunhandledrejection: ".concat(err.name), {
|
|
1296
1374
|
category: 'error',
|
|
1297
1375
|
metadata: err
|
|
1298
1376
|
});
|
|
1299
1377
|
client.notify(err);
|
|
1300
1378
|
return;
|
|
1301
1379
|
}
|
|
1302
|
-
|
|
1380
|
+
var message = typeof reason === 'string' ? reason : ((_a = JSON.stringify(reason)) !== null && _a !== void 0 ? _a : 'Unspecified reason');
|
|
1303
1381
|
client.notify({
|
|
1304
1382
|
name: 'window.onunhandledrejection',
|
|
1305
|
-
message:
|
|
1383
|
+
message: "UnhandledPromiseRejectionWarning: ".concat(message)
|
|
1306
1384
|
});
|
|
1307
1385
|
}
|
|
1308
1386
|
return function (promiseRejectionEvent) {
|
|
@@ -1321,12 +1399,13 @@
|
|
|
1321
1399
|
|
|
1322
1400
|
Object.defineProperty(breadcrumbs, "__esModule", { value: true });
|
|
1323
1401
|
/* eslint-disable prefer-rest-params */
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
function default_1$2(_window
|
|
1402
|
+
var core_1$4 = src;
|
|
1403
|
+
var util_1$1 = util;
|
|
1404
|
+
var sanitize$1 = core_1$4.Util.sanitize, instrument$2 = core_1$4.Util.instrument;
|
|
1405
|
+
function default_1$2(_window) {
|
|
1406
|
+
if (_window === void 0) { _window = window; }
|
|
1328
1407
|
return {
|
|
1329
|
-
load: (client)
|
|
1408
|
+
load: function (client) {
|
|
1330
1409
|
function breadcrumbsEnabled(type) {
|
|
1331
1410
|
if (client.config.breadcrumbsEnabled === true) {
|
|
1332
1411
|
return true;
|
|
@@ -1345,7 +1424,7 @@
|
|
|
1345
1424
|
if (!Array.isArray(obj)) {
|
|
1346
1425
|
return '';
|
|
1347
1426
|
}
|
|
1348
|
-
return obj.map(value
|
|
1427
|
+
return obj.map(function (value) {
|
|
1349
1428
|
try {
|
|
1350
1429
|
return String(value);
|
|
1351
1430
|
}
|
|
@@ -1354,12 +1433,12 @@
|
|
|
1354
1433
|
}
|
|
1355
1434
|
}).join(' ');
|
|
1356
1435
|
}
|
|
1357
|
-
['debug', 'info', 'warn', 'error', 'log'].forEach(level
|
|
1436
|
+
['debug', 'info', 'warn', 'error', 'log'].forEach(function (level) {
|
|
1358
1437
|
instrument$2(_window.console, level, function (original) {
|
|
1359
1438
|
return function () {
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1439
|
+
var args = Array.prototype.slice.call(arguments);
|
|
1440
|
+
var message = inspectArray(args);
|
|
1441
|
+
var opts = {
|
|
1363
1442
|
category: 'log',
|
|
1364
1443
|
metadata: {
|
|
1365
1444
|
level: level,
|
|
@@ -1379,8 +1458,8 @@
|
|
|
1379
1458
|
if (!breadcrumbsEnabled('dom')) {
|
|
1380
1459
|
return;
|
|
1381
1460
|
}
|
|
1382
|
-
_window.addEventListener('click', (event)
|
|
1383
|
-
|
|
1461
|
+
_window.addEventListener('click', function (event) {
|
|
1462
|
+
var message, selector, text;
|
|
1384
1463
|
try {
|
|
1385
1464
|
message = (0, util_1$1.stringNameOfElement)(event.target);
|
|
1386
1465
|
selector = (0, util_1$1.stringSelectorOfElement)(event.target);
|
|
@@ -1398,9 +1477,9 @@
|
|
|
1398
1477
|
client.addBreadcrumb(message, {
|
|
1399
1478
|
category: 'ui.click',
|
|
1400
1479
|
metadata: {
|
|
1401
|
-
selector,
|
|
1402
|
-
text,
|
|
1403
|
-
event
|
|
1480
|
+
selector: selector,
|
|
1481
|
+
text: text,
|
|
1482
|
+
event: event
|
|
1404
1483
|
}
|
|
1405
1484
|
});
|
|
1406
1485
|
}, true);
|
|
@@ -1414,15 +1493,15 @@
|
|
|
1414
1493
|
instrument$2(XMLHttpRequest.prototype, 'open', function (original) {
|
|
1415
1494
|
return function () {
|
|
1416
1495
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1496
|
+
var xhr = this;
|
|
1497
|
+
var url = arguments[1];
|
|
1498
|
+
var method = typeof arguments[0] === 'string' ? arguments[0].toUpperCase() : arguments[0];
|
|
1499
|
+
var message = "".concat(method, " ").concat((0, util_1$1.localURLPathname)(url));
|
|
1421
1500
|
this.__hb_xhr = {
|
|
1422
1501
|
type: 'xhr',
|
|
1423
|
-
method,
|
|
1424
|
-
url,
|
|
1425
|
-
message
|
|
1502
|
+
method: method,
|
|
1503
|
+
url: url,
|
|
1504
|
+
message: message
|
|
1426
1505
|
};
|
|
1427
1506
|
if (typeof original === 'function') {
|
|
1428
1507
|
original.apply(xhr, arguments);
|
|
@@ -1433,10 +1512,10 @@
|
|
|
1433
1512
|
instrument$2(XMLHttpRequest.prototype, 'send', function (original) {
|
|
1434
1513
|
return function () {
|
|
1435
1514
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1436
|
-
|
|
1515
|
+
var xhr = this;
|
|
1437
1516
|
function onreadystatechangeHandler() {
|
|
1438
1517
|
if (xhr.readyState === 4) {
|
|
1439
|
-
|
|
1518
|
+
var message = void 0;
|
|
1440
1519
|
if (xhr.__hb_xhr) {
|
|
1441
1520
|
xhr.__hb_xhr.status_code = xhr.status;
|
|
1442
1521
|
message = xhr.__hb_xhr.message;
|
|
@@ -1481,9 +1560,9 @@
|
|
|
1481
1560
|
instrument$2(_window, 'fetch', function (original) {
|
|
1482
1561
|
return function () {
|
|
1483
1562
|
// eslint-disable-next-line prefer-rest-params
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1563
|
+
var input = arguments[0];
|
|
1564
|
+
var method = 'GET';
|
|
1565
|
+
var url;
|
|
1487
1566
|
if (typeof input === 'string') {
|
|
1488
1567
|
url = input;
|
|
1489
1568
|
}
|
|
@@ -1502,11 +1581,11 @@
|
|
|
1502
1581
|
if (typeof method === 'string') {
|
|
1503
1582
|
method = method.toUpperCase();
|
|
1504
1583
|
}
|
|
1505
|
-
|
|
1506
|
-
|
|
1584
|
+
var message = "".concat(method, " ").concat((0, util_1$1.localURLPathname)(url));
|
|
1585
|
+
var metadata = {
|
|
1507
1586
|
type: 'fetch',
|
|
1508
|
-
method,
|
|
1509
|
-
url
|
|
1587
|
+
method: method,
|
|
1588
|
+
url: url
|
|
1510
1589
|
};
|
|
1511
1590
|
return original
|
|
1512
1591
|
.apply(this, arguments)
|
|
@@ -1514,14 +1593,14 @@
|
|
|
1514
1593
|
metadata['status_code'] = response.status;
|
|
1515
1594
|
client.addBreadcrumb(message, {
|
|
1516
1595
|
category: 'request',
|
|
1517
|
-
metadata
|
|
1596
|
+
metadata: metadata
|
|
1518
1597
|
});
|
|
1519
1598
|
return response;
|
|
1520
1599
|
})
|
|
1521
1600
|
.catch(function (error) {
|
|
1522
1601
|
client.addBreadcrumb('fetch error', {
|
|
1523
1602
|
category: 'error',
|
|
1524
|
-
metadata
|
|
1603
|
+
metadata: metadata
|
|
1525
1604
|
});
|
|
1526
1605
|
throw error;
|
|
1527
1606
|
});
|
|
@@ -1534,14 +1613,14 @@
|
|
|
1534
1613
|
return;
|
|
1535
1614
|
}
|
|
1536
1615
|
// The last known href of the current page
|
|
1537
|
-
|
|
1616
|
+
var lastHref = _window.location.href;
|
|
1538
1617
|
function recordUrlChange(from, to) {
|
|
1539
1618
|
lastHref = to;
|
|
1540
1619
|
client.addBreadcrumb('Page changed', {
|
|
1541
1620
|
category: 'navigation',
|
|
1542
1621
|
metadata: {
|
|
1543
|
-
from,
|
|
1544
|
-
to
|
|
1622
|
+
from: from,
|
|
1623
|
+
to: to
|
|
1545
1624
|
}
|
|
1546
1625
|
});
|
|
1547
1626
|
}
|
|
@@ -1558,7 +1637,7 @@
|
|
|
1558
1637
|
// https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
|
|
1559
1638
|
function historyWrapper(original) {
|
|
1560
1639
|
return function () {
|
|
1561
|
-
|
|
1640
|
+
var url = arguments.length > 2 ? arguments[2] : undefined;
|
|
1562
1641
|
if (url) {
|
|
1563
1642
|
recordUrlChange(lastHref, String(url));
|
|
1564
1643
|
}
|
|
@@ -1577,11 +1656,12 @@
|
|
|
1577
1656
|
|
|
1578
1657
|
Object.defineProperty(timers, "__esModule", { value: true });
|
|
1579
1658
|
/* eslint-disable prefer-rest-params */
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
function default_1$1(_window
|
|
1659
|
+
var core_1$3 = src;
|
|
1660
|
+
var instrument$1 = core_1$3.Util.instrument;
|
|
1661
|
+
function default_1$1(_window) {
|
|
1662
|
+
if (_window === void 0) { _window = window; }
|
|
1583
1663
|
return {
|
|
1584
|
-
load: (client)
|
|
1664
|
+
load: function (client) {
|
|
1585
1665
|
// Wrap timers
|
|
1586
1666
|
(function () {
|
|
1587
1667
|
function instrumentTimer(wrapOpts) {
|
|
@@ -1589,10 +1669,10 @@
|
|
|
1589
1669
|
// See https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout
|
|
1590
1670
|
return function (func, delay) {
|
|
1591
1671
|
if (typeof func === 'function') {
|
|
1592
|
-
|
|
1672
|
+
var args_1 = Array.prototype.slice.call(arguments, 2);
|
|
1593
1673
|
func = client.__wrap(func, wrapOpts);
|
|
1594
1674
|
return original(function () {
|
|
1595
|
-
func(
|
|
1675
|
+
func.apply(void 0, args_1);
|
|
1596
1676
|
}, delay);
|
|
1597
1677
|
}
|
|
1598
1678
|
else {
|
|
@@ -1612,20 +1692,21 @@
|
|
|
1612
1692
|
var event_listeners = {};
|
|
1613
1693
|
|
|
1614
1694
|
Object.defineProperty(event_listeners, "__esModule", { value: true });
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
function default_1(_window
|
|
1695
|
+
var core_1$2 = src;
|
|
1696
|
+
var instrument = core_1$2.Util.instrument;
|
|
1697
|
+
function default_1(_window) {
|
|
1698
|
+
if (_window === void 0) { _window = window; }
|
|
1618
1699
|
return {
|
|
1619
|
-
load: (client)
|
|
1700
|
+
load: function (client) {
|
|
1620
1701
|
// Wrap event listeners
|
|
1621
1702
|
// Event targets borrowed from bugsnag-js:
|
|
1622
1703
|
// See https://github.com/bugsnag/bugsnag-js/blob/d55af916a4d3c7757f979d887f9533fe1a04cc93/src/bugsnag.js#L542
|
|
1623
|
-
|
|
1704
|
+
var targets = ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'];
|
|
1624
1705
|
targets.forEach(function (prop) {
|
|
1625
|
-
|
|
1706
|
+
var prototype = _window[prop] && _window[prop].prototype;
|
|
1626
1707
|
if (prototype && Object.prototype.hasOwnProperty.call(prototype, 'addEventListener')) {
|
|
1627
1708
|
instrument(prototype, 'addEventListener', function (original) {
|
|
1628
|
-
|
|
1709
|
+
var wrapOpts = { component: "".concat(prop, ".prototype.addEventListener") };
|
|
1629
1710
|
// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
|
|
1630
1711
|
return function (type, listener, useCapture, wantsUntrusted) {
|
|
1631
1712
|
try {
|
|
@@ -1657,83 +1738,116 @@
|
|
|
1657
1738
|
|
|
1658
1739
|
Object.defineProperty(transport, "__esModule", { value: true });
|
|
1659
1740
|
transport.BrowserTransport = void 0;
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1741
|
+
var core_1$1 = src;
|
|
1742
|
+
var sanitize = core_1$1.Util.sanitize;
|
|
1743
|
+
var BrowserTransport = /** @class */ (function () {
|
|
1744
|
+
function BrowserTransport() {
|
|
1745
|
+
}
|
|
1746
|
+
BrowserTransport.prototype.send = function (options, payload) {
|
|
1747
|
+
return new Promise(function (resolve, reject) {
|
|
1665
1748
|
try {
|
|
1666
|
-
|
|
1667
|
-
|
|
1749
|
+
var x_1 = new XMLHttpRequest();
|
|
1750
|
+
x_1.open(options.method, options.endpoint, options.async);
|
|
1668
1751
|
if (Object.keys(options.headers || []).length) {
|
|
1669
|
-
for (
|
|
1752
|
+
for (var i in options.headers) {
|
|
1670
1753
|
if (typeof options.headers[i] !== 'undefined') {
|
|
1671
|
-
|
|
1754
|
+
x_1.setRequestHeader(i, String(options.headers[i]));
|
|
1672
1755
|
}
|
|
1673
1756
|
}
|
|
1674
1757
|
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1758
|
+
x_1.send(payload ? JSON.stringify(sanitize(payload, options.maxObjectDepth)) : undefined);
|
|
1759
|
+
x_1.onload = function () { return resolve({ statusCode: x_1.status, body: x_1.response }); };
|
|
1677
1760
|
}
|
|
1678
1761
|
catch (err) {
|
|
1679
1762
|
reject(err);
|
|
1680
1763
|
}
|
|
1681
1764
|
});
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1765
|
+
};
|
|
1766
|
+
return BrowserTransport;
|
|
1767
|
+
}());
|
|
1684
1768
|
transport.BrowserTransport = BrowserTransport;
|
|
1685
1769
|
|
|
1770
|
+
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
1771
|
+
var extendStatics = function (d, b) {
|
|
1772
|
+
extendStatics = Object.setPrototypeOf ||
|
|
1773
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
1774
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
1775
|
+
return extendStatics(d, b);
|
|
1776
|
+
};
|
|
1777
|
+
return function (d, b) {
|
|
1778
|
+
if (typeof b !== "function" && b !== null)
|
|
1779
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1780
|
+
extendStatics(d, b);
|
|
1781
|
+
function __() { this.constructor = d; }
|
|
1782
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1783
|
+
};
|
|
1784
|
+
})();
|
|
1785
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
1786
|
+
__assign = Object.assign || function(t) {
|
|
1787
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1788
|
+
s = arguments[i];
|
|
1789
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1790
|
+
t[p] = s[p];
|
|
1791
|
+
}
|
|
1792
|
+
return t;
|
|
1793
|
+
};
|
|
1794
|
+
return __assign.apply(this, arguments);
|
|
1795
|
+
};
|
|
1686
1796
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
1687
1797
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1688
1798
|
};
|
|
1689
1799
|
Object.defineProperty(browser, "__esModule", { value: true });
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1800
|
+
var core_1 = src;
|
|
1801
|
+
var util_1 = util;
|
|
1802
|
+
var onerror_1 = onerror;
|
|
1803
|
+
var onunhandledrejection_1 = __importDefault(onunhandledrejection);
|
|
1804
|
+
var breadcrumbs_1 = __importDefault(breadcrumbs);
|
|
1805
|
+
var timers_1 = __importDefault(timers);
|
|
1806
|
+
var event_listeners_1 = __importDefault(event_listeners);
|
|
1807
|
+
var transport_1 = transport;
|
|
1808
|
+
var merge = core_1.Util.merge, filter = core_1.Util.filter, objectIsExtensible = core_1.Util.objectIsExtensible;
|
|
1809
|
+
var Honeybadger = /** @class */ (function (_super) {
|
|
1810
|
+
__extends(Honeybadger, _super);
|
|
1811
|
+
function Honeybadger(opts) {
|
|
1812
|
+
if (opts === void 0) { opts = {}; }
|
|
1813
|
+
var _this = _super.call(this, __assign({ async: true, maxErrors: null, projectRoot: window.location.protocol + '//' + window.location.host }, opts), new transport_1.BrowserTransport()) || this;
|
|
1702
1814
|
/** @internal */
|
|
1703
|
-
|
|
1815
|
+
_this.__errorsSent = 0;
|
|
1704
1816
|
/** @internal */
|
|
1705
|
-
|
|
1817
|
+
_this.__lastWrapErr = undefined;
|
|
1706
1818
|
/** @internal */
|
|
1707
|
-
|
|
1708
|
-
(notice)
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1819
|
+
_this.__beforeNotifyHandlers = [
|
|
1820
|
+
function (notice) {
|
|
1821
|
+
if (_this.__exceedsMaxErrors()) {
|
|
1822
|
+
_this.logger.debug('Dropping notice: max errors exceeded', notice);
|
|
1711
1823
|
return false;
|
|
1712
1824
|
}
|
|
1713
1825
|
if (notice && !notice.url) {
|
|
1714
1826
|
notice.url = document.URL;
|
|
1715
1827
|
}
|
|
1716
|
-
|
|
1828
|
+
_this.__incrementErrorsCount();
|
|
1717
1829
|
return true;
|
|
1718
1830
|
}
|
|
1719
1831
|
];
|
|
1832
|
+
return _this;
|
|
1720
1833
|
}
|
|
1721
|
-
configure
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1834
|
+
Honeybadger.prototype.configure = function (opts) {
|
|
1835
|
+
if (opts === void 0) { opts = {}; }
|
|
1836
|
+
return _super.prototype.configure.call(this, opts);
|
|
1837
|
+
};
|
|
1838
|
+
Honeybadger.prototype.resetMaxErrors = function () {
|
|
1725
1839
|
return (this.__errorsSent = 0);
|
|
1726
|
-
}
|
|
1727
|
-
factory(opts) {
|
|
1840
|
+
};
|
|
1841
|
+
Honeybadger.prototype.factory = function (opts) {
|
|
1728
1842
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1729
1843
|
return new Honeybadger(opts);
|
|
1730
|
-
}
|
|
1731
|
-
checkIn(_id) {
|
|
1844
|
+
};
|
|
1845
|
+
Honeybadger.prototype.checkIn = function (_id) {
|
|
1732
1846
|
throw new Error('Honeybadger.checkIn() is not supported on the browser');
|
|
1733
|
-
}
|
|
1847
|
+
};
|
|
1734
1848
|
/** @internal */
|
|
1735
|
-
__buildPayload(notice) {
|
|
1736
|
-
|
|
1849
|
+
Honeybadger.prototype.__buildPayload = function (notice) {
|
|
1850
|
+
var cgiData = {
|
|
1737
1851
|
HTTP_USER_AGENT: undefined,
|
|
1738
1852
|
HTTP_REFERER: undefined,
|
|
1739
1853
|
HTTP_COOKIE: undefined
|
|
@@ -1742,7 +1856,7 @@
|
|
|
1742
1856
|
if (document.referrer.match(/\S/)) {
|
|
1743
1857
|
cgiData.HTTP_REFERER = document.referrer;
|
|
1744
1858
|
}
|
|
1745
|
-
|
|
1859
|
+
var cookiesObject;
|
|
1746
1860
|
if (typeof notice.cookies === 'string') {
|
|
1747
1861
|
cookiesObject = (0, util_1.decodeCookie)(notice.cookies);
|
|
1748
1862
|
}
|
|
@@ -1752,17 +1866,18 @@
|
|
|
1752
1866
|
if (cookiesObject) {
|
|
1753
1867
|
cgiData.HTTP_COOKIE = (0, util_1.encodeCookie)(filter(cookiesObject, this.config.filters));
|
|
1754
1868
|
}
|
|
1755
|
-
|
|
1869
|
+
var payload = _super.prototype.__buildPayload.call(this, notice);
|
|
1756
1870
|
payload.request.cgi_data = merge(cgiData, payload.request.cgi_data);
|
|
1757
1871
|
return payload;
|
|
1758
|
-
}
|
|
1872
|
+
};
|
|
1759
1873
|
/**
|
|
1760
1874
|
* wrap always returns the same function so that callbacks can be removed via
|
|
1761
1875
|
* removeEventListener.
|
|
1762
1876
|
* @internal
|
|
1763
1877
|
*/
|
|
1764
|
-
__wrap(f, opts
|
|
1765
|
-
|
|
1878
|
+
Honeybadger.prototype.__wrap = function (f, opts) {
|
|
1879
|
+
if (opts === void 0) { opts = {}; }
|
|
1880
|
+
var func = f;
|
|
1766
1881
|
if (!opts) {
|
|
1767
1882
|
opts = {};
|
|
1768
1883
|
}
|
|
@@ -1775,7 +1890,7 @@
|
|
|
1775
1890
|
}
|
|
1776
1891
|
if (!func.___hb) {
|
|
1777
1892
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
1778
|
-
|
|
1893
|
+
var client_1 = this;
|
|
1779
1894
|
func.___hb = function () {
|
|
1780
1895
|
if (util_1.preferCatch) {
|
|
1781
1896
|
try {
|
|
@@ -1783,12 +1898,12 @@
|
|
|
1783
1898
|
return func.apply(this, arguments);
|
|
1784
1899
|
}
|
|
1785
1900
|
catch (err) {
|
|
1786
|
-
if (
|
|
1901
|
+
if (client_1.__lastWrapErr === err) {
|
|
1787
1902
|
throw (err);
|
|
1788
1903
|
}
|
|
1789
|
-
|
|
1904
|
+
client_1.__lastWrapErr = err;
|
|
1790
1905
|
(0, onerror_1.ignoreNextOnError)();
|
|
1791
|
-
|
|
1906
|
+
client_1.addBreadcrumb(opts.component ? "".concat(opts.component, ": ").concat(err.name) : err.name, {
|
|
1792
1907
|
category: 'error',
|
|
1793
1908
|
metadata: {
|
|
1794
1909
|
message: err.message,
|
|
@@ -1796,8 +1911,8 @@
|
|
|
1796
1911
|
stack: err.stack
|
|
1797
1912
|
}
|
|
1798
1913
|
});
|
|
1799
|
-
if (
|
|
1800
|
-
|
|
1914
|
+
if (client_1.config.enableUncaught) {
|
|
1915
|
+
client_1.notify(err);
|
|
1801
1916
|
}
|
|
1802
1917
|
throw (err);
|
|
1803
1918
|
}
|
|
@@ -1814,16 +1929,17 @@
|
|
|
1814
1929
|
catch (_e) {
|
|
1815
1930
|
return func;
|
|
1816
1931
|
}
|
|
1817
|
-
}
|
|
1932
|
+
};
|
|
1818
1933
|
/** @internal */
|
|
1819
|
-
__incrementErrorsCount() {
|
|
1934
|
+
Honeybadger.prototype.__incrementErrorsCount = function () {
|
|
1820
1935
|
return this.__errorsSent++;
|
|
1821
|
-
}
|
|
1936
|
+
};
|
|
1822
1937
|
/** @internal */
|
|
1823
|
-
__exceedsMaxErrors() {
|
|
1938
|
+
Honeybadger.prototype.__exceedsMaxErrors = function () {
|
|
1824
1939
|
return this.config.maxErrors && this.__errorsSent >= this.config.maxErrors;
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1940
|
+
};
|
|
1941
|
+
return Honeybadger;
|
|
1942
|
+
}(core_1.Client));
|
|
1827
1943
|
var _default = browser.default = new Honeybadger({
|
|
1828
1944
|
__plugins: [
|
|
1829
1945
|
(0, onerror_1.onError)(),
|