@honeybadger-io/js 6.8.2 → 6.9.0
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.
- package/dist/browser/honeybadger.js +169 -127
- package/dist/browser/honeybadger.js.map +1 -1
- package/dist/browser/honeybadger.min.js +1 -1
- package/dist/browser/honeybadger.min.js.map +1 -1
- package/dist/browser/util.d.ts +0 -4
- package/dist/server/honeybadger.js +104 -11
- package/dist/server/honeybadger.js.map +1 -1
- package/package.json +4 -5
- package/dist/browser/integrations/events.d.ts +0 -3
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
var src = {};
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var events = {};
|
|
39
39
|
|
|
40
40
|
var util$1 = {};
|
|
41
41
|
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
245
|
-
exports.isBrowserConfig = exports.clone = exports.formatCGIData = exports.filterUrl = exports.filter = exports.generateStackTrace = exports.endpoint = exports.instrumentConsole = exports.instrument = exports.isErrorObject = exports.makeNotice = exports.logger = exports.sanitize = exports.shallowClone = exports.runAfterNotifyHandlers = exports.runBeforeNotifyHandlers = exports.getSourceForBacktrace = exports.getCauses = exports.calculateBacktraceShift = exports.DEFAULT_BACKTRACE_SHIFT = exports.makeBacktrace = exports.objectIsExtensible = exports.objectIsEmpty = exports.mergeNotice = exports.merge = void 0;
|
|
245
|
+
exports.logDeprecatedMethod = exports.globalThisOrWindow = exports.isBrowserConfig = exports.clone = exports.formatCGIData = exports.filterUrl = exports.filter = exports.generateStackTrace = exports.endpoint = exports.instrumentConsole = exports.instrument = exports.isErrorObject = exports.makeNotice = exports.logger = exports.sanitize = exports.shallowClone = exports.runAfterNotifyHandlers = exports.runBeforeNotifyHandlers = exports.getSourceForBacktrace = exports.getCauses = exports.calculateBacktraceShift = exports.DEFAULT_BACKTRACE_SHIFT = exports.makeBacktrace = exports.objectIsExtensible = exports.objectIsEmpty = exports.mergeNotice = exports.merge = void 0;
|
|
246
246
|
/* eslint-disable prefer-rest-params */
|
|
247
247
|
var stackTraceParser = __importStar(require$$0$1);
|
|
248
248
|
function merge(obj1, obj2) {
|
|
@@ -783,14 +783,85 @@
|
|
|
783
783
|
return config.async !== undefined;
|
|
784
784
|
}
|
|
785
785
|
exports.isBrowserConfig = isBrowserConfig;
|
|
786
|
+
/** globalThis has fairly good support. But just in case, lets check its defined.
|
|
787
|
+
* @see {https://caniuse.com/?search=globalThis}
|
|
788
|
+
*/
|
|
789
|
+
function globalThisOrWindow() {
|
|
790
|
+
if (typeof globalThis !== 'undefined') {
|
|
791
|
+
return globalThis;
|
|
792
|
+
}
|
|
793
|
+
if (typeof self !== 'undefined') {
|
|
794
|
+
return self;
|
|
795
|
+
}
|
|
796
|
+
return window;
|
|
797
|
+
}
|
|
798
|
+
exports.globalThisOrWindow = globalThisOrWindow;
|
|
799
|
+
var _deprecatedMethodCalls = {};
|
|
800
|
+
/**
|
|
801
|
+
* Logs a deprecation warning, every X calls to the method.
|
|
802
|
+
*/
|
|
803
|
+
function logDeprecatedMethod(logger, oldMethod, newMethod, callCountThreshold) {
|
|
804
|
+
if (callCountThreshold === void 0) { callCountThreshold = 100; }
|
|
805
|
+
var key = "".concat(oldMethod, "-").concat(newMethod);
|
|
806
|
+
if (typeof _deprecatedMethodCalls[key] === 'undefined') {
|
|
807
|
+
_deprecatedMethodCalls[key] = 0;
|
|
808
|
+
}
|
|
809
|
+
if (_deprecatedMethodCalls[key] % callCountThreshold !== 0) {
|
|
810
|
+
_deprecatedMethodCalls[key]++;
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
var msg = "Deprecation warning: ".concat(oldMethod, " has been deprecated; please use ").concat(newMethod, " instead.");
|
|
814
|
+
logger.warn(msg);
|
|
815
|
+
_deprecatedMethodCalls[key]++;
|
|
816
|
+
}
|
|
817
|
+
exports.logDeprecatedMethod = logDeprecatedMethod;
|
|
786
818
|
|
|
787
819
|
} (util$1));
|
|
788
820
|
|
|
821
|
+
Object.defineProperty(events, "__esModule", { value: true });
|
|
822
|
+
var util_1$4 = util$1;
|
|
823
|
+
function default_1$4(_window) {
|
|
824
|
+
if (_window === void 0) { _window = (0, util_1$4.globalThisOrWindow)(); }
|
|
825
|
+
return {
|
|
826
|
+
shouldReloadOnConfigure: false,
|
|
827
|
+
load: function (client) {
|
|
828
|
+
function sendEventsToInsights() {
|
|
829
|
+
return client.config.eventsEnabled;
|
|
830
|
+
}
|
|
831
|
+
if (!sendEventsToInsights()) {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
(0, util_1$4.instrumentConsole)(_window, function (level, args) {
|
|
835
|
+
if (!sendEventsToInsights()) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
if (args.length === 0) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
var data = {
|
|
842
|
+
severity: level,
|
|
843
|
+
};
|
|
844
|
+
if (typeof args[0] === 'string') {
|
|
845
|
+
data.message = args[0];
|
|
846
|
+
data.args = args.slice(1);
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
data.args = args;
|
|
850
|
+
}
|
|
851
|
+
client.event('log', data);
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
events.default = default_1$4;
|
|
857
|
+
|
|
858
|
+
var client = {};
|
|
859
|
+
|
|
789
860
|
var store = {};
|
|
790
861
|
|
|
791
862
|
Object.defineProperty(store, "__esModule", { value: true });
|
|
792
863
|
store.GlobalStore = void 0;
|
|
793
|
-
var util_1$
|
|
864
|
+
var util_1$3 = util$1;
|
|
794
865
|
var GlobalStore = /** @class */ (function () {
|
|
795
866
|
function GlobalStore(contents, breadcrumbsLimit) {
|
|
796
867
|
this.contents = contents;
|
|
@@ -807,7 +878,7 @@
|
|
|
807
878
|
return JSON.parse(JSON.stringify(value));
|
|
808
879
|
};
|
|
809
880
|
GlobalStore.prototype.setContext = function (context) {
|
|
810
|
-
this.contents.context = (0, util_1$
|
|
881
|
+
this.contents.context = (0, util_1$3.merge)(this.contents.context, context || {});
|
|
811
882
|
};
|
|
812
883
|
GlobalStore.prototype.addBreadcrumb = function (breadcrumb) {
|
|
813
884
|
if (this.contents.breadcrumbs.length == this.breadcrumbsLimit) {
|
|
@@ -860,6 +931,7 @@
|
|
|
860
931
|
revision: null,
|
|
861
932
|
reportData: null,
|
|
862
933
|
breadcrumbsEnabled: true,
|
|
934
|
+
// we could decide the value of eventsEnabled based on `env` and `developmentEnvironments`
|
|
863
935
|
eventsEnabled: false,
|
|
864
936
|
maxBreadcrumbs: 40,
|
|
865
937
|
maxObjectDepth: 8,
|
|
@@ -924,7 +996,7 @@
|
|
|
924
996
|
Object.defineProperty(throttled_events_logger, "__esModule", { value: true });
|
|
925
997
|
throttled_events_logger.ThrottledEventsLogger = void 0;
|
|
926
998
|
var json_nd_1 = require$$0;
|
|
927
|
-
var util_1$
|
|
999
|
+
var util_1$2 = util$1;
|
|
928
1000
|
var defaults_1$1 = defaults;
|
|
929
1001
|
var ThrottledEventsLogger = /** @class */ (function () {
|
|
930
1002
|
function ThrottledEventsLogger(config, transport) {
|
|
@@ -940,8 +1012,8 @@
|
|
|
940
1012
|
this.config[k] = opts[k];
|
|
941
1013
|
}
|
|
942
1014
|
};
|
|
943
|
-
ThrottledEventsLogger.prototype.
|
|
944
|
-
this.queue.push(
|
|
1015
|
+
ThrottledEventsLogger.prototype.log = function (payload) {
|
|
1016
|
+
this.queue.push(payload);
|
|
945
1017
|
if (!this.isProcessing) {
|
|
946
1018
|
this.processQueue();
|
|
947
1019
|
}
|
|
@@ -982,7 +1054,7 @@
|
|
|
982
1054
|
'Content-Type': 'application/json',
|
|
983
1055
|
},
|
|
984
1056
|
method: 'POST',
|
|
985
|
-
endpoint: (0, util_1$
|
|
1057
|
+
endpoint: (0, util_1$2.endpoint)(this.config.endpoint, '/v1/events'),
|
|
986
1058
|
maxObjectDepth: this.config.maxObjectDepth,
|
|
987
1059
|
logger: this.logger,
|
|
988
1060
|
}, data)
|
|
@@ -1000,8 +1072,9 @@
|
|
|
1000
1072
|
/**
|
|
1001
1073
|
* todo: improve this
|
|
1002
1074
|
*
|
|
1003
|
-
* The EventsLogger overrides the console methods
|
|
1004
|
-
*
|
|
1075
|
+
* The EventsLogger overrides the console methods to enable automatic instrumentation
|
|
1076
|
+
* of console logs to the Honeybadger API.
|
|
1077
|
+
* So if we want to log something in here we need to use the original methods.
|
|
1005
1078
|
*/
|
|
1006
1079
|
ThrottledEventsLogger.prototype.originalLogger = function () {
|
|
1007
1080
|
var _a, _b, _c, _d, _e;
|
|
@@ -1071,7 +1144,7 @@
|
|
|
1071
1144
|
};
|
|
1072
1145
|
Object.defineProperty(client, "__esModule", { value: true });
|
|
1073
1146
|
client.Client = void 0;
|
|
1074
|
-
var util_1$
|
|
1147
|
+
var util_1$1 = util$1;
|
|
1075
1148
|
var store_1 = store;
|
|
1076
1149
|
var throttled_events_logger_1 = throttled_events_logger;
|
|
1077
1150
|
var defaults_1 = defaults;
|
|
@@ -1089,13 +1162,13 @@
|
|
|
1089
1162
|
this.__notifier = {
|
|
1090
1163
|
name: '@honeybadger-io/core',
|
|
1091
1164
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
|
|
1092
|
-
version: '6.
|
|
1165
|
+
version: '6.9.0'
|
|
1093
1166
|
};
|
|
1094
1167
|
this.config = __assign(__assign({}, defaults_1.CONFIG), opts);
|
|
1095
1168
|
this.__initStore();
|
|
1096
1169
|
this.__transport = transport;
|
|
1097
1170
|
this.__eventsLogger = new throttled_events_logger_1.ThrottledEventsLogger(this.config, this.__transport);
|
|
1098
|
-
this.logger = (0, util_1$
|
|
1171
|
+
this.logger = (0, util_1$1.logger)(this);
|
|
1099
1172
|
}
|
|
1100
1173
|
Client.prototype.getVersion = function () {
|
|
1101
1174
|
return this.__notifier.version;
|
|
@@ -1166,16 +1239,16 @@
|
|
|
1166
1239
|
var notice = this.makeNotice(noticeable, name, extra);
|
|
1167
1240
|
// we need to have the source file data before the beforeNotifyHandlers,
|
|
1168
1241
|
// in case they modify them
|
|
1169
|
-
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1$
|
|
1242
|
+
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1$1.shallowClone)(trace); }) : null;
|
|
1170
1243
|
var preConditionsResult = this.__runPreconditions(notice);
|
|
1171
1244
|
if (preConditionsResult instanceof Error) {
|
|
1172
|
-
(0, util_1$
|
|
1245
|
+
(0, util_1$1.runAfterNotifyHandlers)(notice, this.__afterNotifyHandlers, preConditionsResult);
|
|
1173
1246
|
return false;
|
|
1174
1247
|
}
|
|
1175
1248
|
if (preConditionsResult instanceof Promise) {
|
|
1176
1249
|
preConditionsResult.then(function (result) {
|
|
1177
1250
|
if (result instanceof Error) {
|
|
1178
|
-
(0, util_1$
|
|
1251
|
+
(0, util_1$1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, result);
|
|
1179
1252
|
return false;
|
|
1180
1253
|
}
|
|
1181
1254
|
return _this.__send(notice, sourceCodeData);
|
|
@@ -1233,18 +1306,18 @@
|
|
|
1233
1306
|
Client.prototype.makeNotice = function (noticeable, name, extra) {
|
|
1234
1307
|
if (name === void 0) { name = undefined; }
|
|
1235
1308
|
if (extra === void 0) { extra = undefined; }
|
|
1236
|
-
var notice = (0, util_1$
|
|
1309
|
+
var notice = (0, util_1$1.makeNotice)(noticeable);
|
|
1237
1310
|
if (name && !(typeof name === 'object')) {
|
|
1238
1311
|
var n = String(name);
|
|
1239
1312
|
name = { name: n };
|
|
1240
1313
|
}
|
|
1241
1314
|
if (name) {
|
|
1242
|
-
notice = (0, util_1$
|
|
1315
|
+
notice = (0, util_1$1.mergeNotice)(notice, name);
|
|
1243
1316
|
}
|
|
1244
1317
|
if (typeof extra === 'object' && extra !== null) {
|
|
1245
|
-
notice = (0, util_1$
|
|
1318
|
+
notice = (0, util_1$1.mergeNotice)(notice, extra);
|
|
1246
1319
|
}
|
|
1247
|
-
if ((0, util_1$
|
|
1320
|
+
if ((0, util_1$1.objectIsEmpty)(notice)) {
|
|
1248
1321
|
return null;
|
|
1249
1322
|
}
|
|
1250
1323
|
var context = this.__store.getContents('context');
|
|
@@ -1254,9 +1327,9 @@
|
|
|
1254
1327
|
// Turning into a Set will remove duplicates
|
|
1255
1328
|
var tags = noticeTags.concat(contextTags).concat(configTags);
|
|
1256
1329
|
var uniqueTags = tags.filter(function (item, index) { return tags.indexOf(item) === index; });
|
|
1257
|
-
notice = (0, util_1$
|
|
1330
|
+
notice = (0, util_1$1.merge)(notice, {
|
|
1258
1331
|
name: notice.name || 'Error',
|
|
1259
|
-
context: (0, util_1$
|
|
1332
|
+
context: (0, util_1$1.merge)(context, notice.context),
|
|
1260
1333
|
projectRoot: notice.projectRoot || this.config.projectRoot,
|
|
1261
1334
|
environment: notice.environment || this.config.environment,
|
|
1262
1335
|
component: notice.component || this.config.component,
|
|
@@ -1268,11 +1341,11 @@
|
|
|
1268
1341
|
// Otherwise we make one.
|
|
1269
1342
|
if (!Array.isArray(notice.backtrace) || !notice.backtrace.length) {
|
|
1270
1343
|
if (typeof notice.stack !== 'string' || !notice.stack.trim()) {
|
|
1271
|
-
notice.stack = (0, util_1$
|
|
1272
|
-
notice.backtrace = (0, util_1$
|
|
1344
|
+
notice.stack = (0, util_1$1.generateStackTrace)();
|
|
1345
|
+
notice.backtrace = (0, util_1$1.makeBacktrace)(notice.stack, true, this.logger);
|
|
1273
1346
|
}
|
|
1274
1347
|
else {
|
|
1275
|
-
notice.backtrace = (0, util_1$
|
|
1348
|
+
notice.backtrace = (0, util_1$1.makeBacktrace)(notice.stack, false, this.logger);
|
|
1276
1349
|
}
|
|
1277
1350
|
}
|
|
1278
1351
|
return notice;
|
|
@@ -1282,7 +1355,7 @@
|
|
|
1282
1355
|
return;
|
|
1283
1356
|
}
|
|
1284
1357
|
opts = opts || {};
|
|
1285
|
-
var metadata = (0, util_1$
|
|
1358
|
+
var metadata = (0, util_1$1.shallowClone)(opts.metadata);
|
|
1286
1359
|
var category = opts.category || 'custom';
|
|
1287
1360
|
var timestamp = new Date().toISOString();
|
|
1288
1361
|
this.__store.addBreadcrumb({
|
|
@@ -1293,8 +1366,20 @@
|
|
|
1293
1366
|
});
|
|
1294
1367
|
return this;
|
|
1295
1368
|
};
|
|
1369
|
+
/**
|
|
1370
|
+
* @deprecated Use {@link event} instead.
|
|
1371
|
+
*/
|
|
1296
1372
|
Client.prototype.logEvent = function (data) {
|
|
1297
|
-
this.
|
|
1373
|
+
(0, util_1$1.logDeprecatedMethod)(this.logger, 'Honeybadger.logEvent', 'Honeybadger.event');
|
|
1374
|
+
this.event('log', data);
|
|
1375
|
+
};
|
|
1376
|
+
Client.prototype.event = function (type, data) {
|
|
1377
|
+
var _a;
|
|
1378
|
+
if (typeof type === 'object') {
|
|
1379
|
+
data = type;
|
|
1380
|
+
type = (_a = type['event_type']) !== null && _a !== void 0 ? _a : undefined;
|
|
1381
|
+
}
|
|
1382
|
+
this.__eventsLogger.log(__assign({ event_type: type, ts: new Date().toISOString() }, data));
|
|
1298
1383
|
};
|
|
1299
1384
|
Client.prototype.__getBreadcrumbs = function () {
|
|
1300
1385
|
return this.__store.getContents('breadcrumbs').slice();
|
|
@@ -1309,8 +1394,8 @@
|
|
|
1309
1394
|
return (this.config.environment && this.config.developmentEnvironments.includes(this.config.environment));
|
|
1310
1395
|
};
|
|
1311
1396
|
Client.prototype.__buildPayload = function (notice) {
|
|
1312
|
-
var headers = (0, util_1$
|
|
1313
|
-
var cgiData = (0, util_1$
|
|
1397
|
+
var headers = (0, util_1$1.filter)(notice.headers, this.config.filters) || {};
|
|
1398
|
+
var cgiData = (0, util_1$1.filter)(__assign(__assign({}, notice.cgiData), (0, util_1$1.formatCGIData)(headers, 'HTTP_')), this.config.filters);
|
|
1314
1399
|
return {
|
|
1315
1400
|
notifier: this.__notifier,
|
|
1316
1401
|
breadcrumbs: {
|
|
@@ -1323,16 +1408,16 @@
|
|
|
1323
1408
|
backtrace: notice.backtrace,
|
|
1324
1409
|
fingerprint: notice.fingerprint,
|
|
1325
1410
|
tags: notice.tags,
|
|
1326
|
-
causes: (0, util_1$
|
|
1411
|
+
causes: (0, util_1$1.getCauses)(notice, this.logger),
|
|
1327
1412
|
},
|
|
1328
1413
|
request: {
|
|
1329
|
-
url: (0, util_1$
|
|
1414
|
+
url: (0, util_1$1.filterUrl)(notice.url, this.config.filters),
|
|
1330
1415
|
component: notice.component,
|
|
1331
1416
|
action: notice.action,
|
|
1332
1417
|
context: notice.context,
|
|
1333
1418
|
cgi_data: cgiData,
|
|
1334
|
-
params: (0, util_1$
|
|
1335
|
-
session: (0, util_1$
|
|
1419
|
+
params: (0, util_1$1.filter)(notice.params, this.config.filters) || {},
|
|
1420
|
+
session: (0, util_1$1.filter)(notice.session, this.config.filters) || {}
|
|
1336
1421
|
},
|
|
1337
1422
|
server: {
|
|
1338
1423
|
project_root: notice.projectRoot,
|
|
@@ -1369,7 +1454,7 @@
|
|
|
1369
1454
|
this.logger.warn('could not send error report: no API key has been configured', notice);
|
|
1370
1455
|
preConditionError = new Error('missing API key');
|
|
1371
1456
|
}
|
|
1372
|
-
var beforeNotifyResult = (0, util_1$
|
|
1457
|
+
var beforeNotifyResult = (0, util_1$1.runBeforeNotifyHandlers)(notice, this.__beforeNotifyHandlers);
|
|
1373
1458
|
if (!preConditionError && !beforeNotifyResult.result) {
|
|
1374
1459
|
this.logger.debug('skipping error report: one or more beforeNotify handlers returned false', notice);
|
|
1375
1460
|
preConditionError = new Error('beforeNotify handlers returned false');
|
|
@@ -1404,7 +1489,7 @@
|
|
|
1404
1489
|
else {
|
|
1405
1490
|
notice.__breadcrumbs = [];
|
|
1406
1491
|
}
|
|
1407
|
-
return (0, util_1$
|
|
1492
|
+
return (0, util_1$1.getSourceForBacktrace)(originalBacktrace, this.__getSourceFileHandler)
|
|
1408
1493
|
.then(function (sourcePerTrace) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
1409
1494
|
var payload;
|
|
1410
1495
|
return __generator$1(this, function (_a) {
|
|
@@ -1420,7 +1505,7 @@
|
|
|
1420
1505
|
'Accept': 'text/json, application/json'
|
|
1421
1506
|
},
|
|
1422
1507
|
method: 'POST',
|
|
1423
|
-
endpoint: (0, util_1$
|
|
1508
|
+
endpoint: (0, util_1$1.endpoint)(this.config.endpoint, '/v1/notices/js'),
|
|
1424
1509
|
maxObjectDepth: this.config.maxObjectDepth,
|
|
1425
1510
|
logger: this.logger,
|
|
1426
1511
|
}, payload)];
|
|
@@ -1428,12 +1513,12 @@
|
|
|
1428
1513
|
}); })
|
|
1429
1514
|
.then(function (res) {
|
|
1430
1515
|
if (res.statusCode !== 201) {
|
|
1431
|
-
(0, util_1$
|
|
1516
|
+
(0, util_1$1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, new Error("Bad HTTP response: ".concat(res.statusCode)));
|
|
1432
1517
|
_this.logger.warn("Error report failed: unknown response from server. code=".concat(res.statusCode));
|
|
1433
1518
|
return false;
|
|
1434
1519
|
}
|
|
1435
1520
|
var uuid = JSON.parse(res.body).id;
|
|
1436
|
-
(0, util_1$
|
|
1521
|
+
(0, util_1$1.runAfterNotifyHandlers)((0, util_1$1.merge)(notice, {
|
|
1437
1522
|
id: uuid
|
|
1438
1523
|
}), _this.__afterNotifyHandlers);
|
|
1439
1524
|
_this.logger.info("Error report sent \u26A1 https://app.honeybadger.io/notice/".concat(uuid));
|
|
@@ -1441,7 +1526,7 @@
|
|
|
1441
1526
|
})
|
|
1442
1527
|
.catch(function (err) {
|
|
1443
1528
|
_this.logger.error('Error report failed: an unknown error occurred.', "message=".concat(err.message));
|
|
1444
|
-
(0, util_1$
|
|
1529
|
+
(0, util_1$1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, err);
|
|
1445
1530
|
return false;
|
|
1446
1531
|
});
|
|
1447
1532
|
};
|
|
@@ -1480,20 +1565,29 @@
|
|
|
1480
1565
|
__setModuleDefault(result, mod);
|
|
1481
1566
|
return result;
|
|
1482
1567
|
};
|
|
1568
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
1569
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1570
|
+
};
|
|
1483
1571
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1484
|
-
exports.Util = exports.Types = exports.Client = void 0;
|
|
1572
|
+
exports.Plugins = exports.Util = exports.Types = exports.Client = void 0;
|
|
1573
|
+
var events_1 = __importDefault(events);
|
|
1485
1574
|
var client_1 = client;
|
|
1486
1575
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
1487
1576
|
__exportStar(store, exports);
|
|
1488
1577
|
exports.Types = __importStar(types);
|
|
1489
1578
|
exports.Util = __importStar(util$1);
|
|
1579
|
+
exports.Plugins = {
|
|
1580
|
+
events: events_1.default
|
|
1581
|
+
};
|
|
1490
1582
|
|
|
1491
1583
|
} (src));
|
|
1492
1584
|
|
|
1493
1585
|
var util = {};
|
|
1494
1586
|
|
|
1495
1587
|
Object.defineProperty(util, "__esModule", { value: true });
|
|
1496
|
-
util.
|
|
1588
|
+
util.preferCatch = util.encodeCookie = util.decodeCookie = util.localURLPathname = util.parseURL = util.nativeFetch = util.stringTextOfElement = util.stringSelectorOfElement = util.stringNameOfElement = void 0;
|
|
1589
|
+
var core_1$6 = src;
|
|
1590
|
+
var globalThisOrWindow$6 = core_1$6.Util.globalThisOrWindow;
|
|
1497
1591
|
/**
|
|
1498
1592
|
* Converts an HTMLElement into a human-readable string.
|
|
1499
1593
|
* @param {!HTMLElement} element
|
|
@@ -1550,7 +1644,7 @@
|
|
|
1550
1644
|
}
|
|
1551
1645
|
util.stringTextOfElement = stringTextOfElement;
|
|
1552
1646
|
function nativeFetch() {
|
|
1553
|
-
var global = globalThisOrWindow();
|
|
1647
|
+
var global = globalThisOrWindow$6();
|
|
1554
1648
|
if (!global.fetch) {
|
|
1555
1649
|
return false;
|
|
1556
1650
|
}
|
|
@@ -1673,28 +1767,14 @@
|
|
|
1673
1767
|
}
|
|
1674
1768
|
return preferCatch;
|
|
1675
1769
|
})();
|
|
1676
|
-
/** globalThis has fairly good support. But just in case, lets check its defined.
|
|
1677
|
-
* @see {https://caniuse.com/?search=globalThis}
|
|
1678
|
-
*/
|
|
1679
|
-
function globalThisOrWindow() {
|
|
1680
|
-
if (typeof globalThis !== 'undefined') {
|
|
1681
|
-
return globalThis;
|
|
1682
|
-
}
|
|
1683
|
-
if (typeof self !== 'undefined') {
|
|
1684
|
-
return self;
|
|
1685
|
-
}
|
|
1686
|
-
return window;
|
|
1687
|
-
}
|
|
1688
|
-
util.globalThisOrWindow = globalThisOrWindow;
|
|
1689
1770
|
|
|
1690
1771
|
var onerror = {};
|
|
1691
1772
|
|
|
1692
1773
|
Object.defineProperty(onerror, "__esModule", { value: true });
|
|
1693
1774
|
onerror.onError = onerror.ignoreNextOnError = void 0;
|
|
1694
1775
|
/* eslint-disable prefer-rest-params */
|
|
1695
|
-
var core_1$
|
|
1696
|
-
var
|
|
1697
|
-
var instrument$4 = core_1$6.Util.instrument, makeNotice = core_1$6.Util.makeNotice;
|
|
1776
|
+
var core_1$5 = src;
|
|
1777
|
+
var instrument$4 = core_1$5.Util.instrument, makeNotice = core_1$5.Util.makeNotice, globalThisOrWindow$5 = core_1$5.Util.globalThisOrWindow;
|
|
1698
1778
|
var ignoreOnError = 0;
|
|
1699
1779
|
var currentTimeout;
|
|
1700
1780
|
function ignoreNextOnError() {
|
|
@@ -1707,7 +1787,7 @@
|
|
|
1707
1787
|
onerror.ignoreNextOnError = ignoreNextOnError;
|
|
1708
1788
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1709
1789
|
function onError(_window) {
|
|
1710
|
-
if (_window === void 0) { _window =
|
|
1790
|
+
if (_window === void 0) { _window = globalThisOrWindow$5(); }
|
|
1711
1791
|
return {
|
|
1712
1792
|
load: function (client) {
|
|
1713
1793
|
instrument$4(_window, 'onerror', function (original) {
|
|
@@ -1766,12 +1846,11 @@
|
|
|
1766
1846
|
|
|
1767
1847
|
Object.defineProperty(onunhandledrejection, "__esModule", { value: true });
|
|
1768
1848
|
/* eslint-disable prefer-rest-params */
|
|
1769
|
-
var core_1$
|
|
1770
|
-
var
|
|
1771
|
-
var instrument$3 = core_1$5.Util.instrument;
|
|
1849
|
+
var core_1$4 = src;
|
|
1850
|
+
var instrument$3 = core_1$4.Util.instrument, globalThisOrWindow$4 = core_1$4.Util.globalThisOrWindow;
|
|
1772
1851
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1773
|
-
function default_1$
|
|
1774
|
-
if (_window === void 0) { _window =
|
|
1852
|
+
function default_1$3(_window) {
|
|
1853
|
+
if (_window === void 0) { _window = globalThisOrWindow$4(); }
|
|
1775
1854
|
return {
|
|
1776
1855
|
load: function (client) {
|
|
1777
1856
|
if (!client.config.enableUnhandledRejection) {
|
|
@@ -1822,17 +1901,17 @@
|
|
|
1822
1901
|
}
|
|
1823
1902
|
};
|
|
1824
1903
|
}
|
|
1825
|
-
onunhandledrejection.default = default_1$
|
|
1904
|
+
onunhandledrejection.default = default_1$3;
|
|
1826
1905
|
|
|
1827
1906
|
var breadcrumbs = {};
|
|
1828
1907
|
|
|
1829
1908
|
Object.defineProperty(breadcrumbs, "__esModule", { value: true });
|
|
1830
1909
|
/* eslint-disable prefer-rest-params */
|
|
1831
|
-
var core_1$
|
|
1832
|
-
var util_1
|
|
1833
|
-
var sanitize$1 = core_1$
|
|
1834
|
-
function default_1$
|
|
1835
|
-
if (_window === void 0) { _window =
|
|
1910
|
+
var core_1$3 = src;
|
|
1911
|
+
var util_1 = util;
|
|
1912
|
+
var sanitize$1 = core_1$3.Util.sanitize, instrument$2 = core_1$3.Util.instrument, instrumentConsole = core_1$3.Util.instrumentConsole, globalThisOrWindow$3 = core_1$3.Util.globalThisOrWindow;
|
|
1913
|
+
function default_1$2(_window) {
|
|
1914
|
+
if (_window === void 0) { _window = globalThisOrWindow$3(); }
|
|
1836
1915
|
return {
|
|
1837
1916
|
load: function (client) {
|
|
1838
1917
|
function breadcrumbsEnabled(type) {
|
|
@@ -1862,7 +1941,7 @@
|
|
|
1862
1941
|
}
|
|
1863
1942
|
}).join(' ');
|
|
1864
1943
|
}
|
|
1865
|
-
instrumentConsole
|
|
1944
|
+
instrumentConsole(_window, function (level, args) {
|
|
1866
1945
|
var message = inspectArray(args);
|
|
1867
1946
|
var opts = {
|
|
1868
1947
|
category: 'log',
|
|
@@ -1885,9 +1964,9 @@
|
|
|
1885
1964
|
_window.addEventListener('click', function (event) {
|
|
1886
1965
|
var message, selector, text;
|
|
1887
1966
|
try {
|
|
1888
|
-
message = (0, util_1
|
|
1889
|
-
selector = (0, util_1
|
|
1890
|
-
text = (0, util_1
|
|
1967
|
+
message = (0, util_1.stringNameOfElement)(event.target);
|
|
1968
|
+
selector = (0, util_1.stringSelectorOfElement)(event.target);
|
|
1969
|
+
text = (0, util_1.stringTextOfElement)(event.target);
|
|
1891
1970
|
}
|
|
1892
1971
|
catch (e) {
|
|
1893
1972
|
message = 'UI Click';
|
|
@@ -1926,7 +2005,7 @@
|
|
|
1926
2005
|
// in case of url being URL object (which is valid input) we need to stringify it
|
|
1927
2006
|
var url = typeof rawUrl === 'string' ? rawUrl : String(rawUrl);
|
|
1928
2007
|
var method = typeof arguments[0] === 'string' ? arguments[0].toUpperCase() : arguments[0];
|
|
1929
|
-
var message = "".concat(method, " ").concat((0, util_1
|
|
2008
|
+
var message = "".concat(method, " ").concat((0, util_1.localURLPathname)(url));
|
|
1930
2009
|
this.__hb_xhr = {
|
|
1931
2010
|
type: 'xhr',
|
|
1932
2011
|
method: method,
|
|
@@ -1983,7 +2062,7 @@
|
|
|
1983
2062
|
if (!breadcrumbsEnabled('network')) {
|
|
1984
2063
|
return;
|
|
1985
2064
|
}
|
|
1986
|
-
if (!(0, util_1
|
|
2065
|
+
if (!(0, util_1.nativeFetch)()) {
|
|
1987
2066
|
// Polyfills use XHR.
|
|
1988
2067
|
return;
|
|
1989
2068
|
}
|
|
@@ -2012,7 +2091,7 @@
|
|
|
2012
2091
|
method = method.toUpperCase();
|
|
2013
2092
|
}
|
|
2014
2093
|
// localURLPathname cant be constructed for CF workers due to reliance on "document".
|
|
2015
|
-
var message = "".concat(method, " ").concat(typeof document === 'undefined' ? url : (0, util_1
|
|
2094
|
+
var message = "".concat(method, " ").concat(typeof document === 'undefined' ? url : (0, util_1.localURLPathname)(url));
|
|
2016
2095
|
var metadata = {
|
|
2017
2096
|
type: 'fetch',
|
|
2018
2097
|
method: method,
|
|
@@ -2084,50 +2163,16 @@
|
|
|
2084
2163
|
}
|
|
2085
2164
|
};
|
|
2086
2165
|
}
|
|
2087
|
-
breadcrumbs.default = default_1$
|
|
2088
|
-
|
|
2089
|
-
var events = {};
|
|
2090
|
-
|
|
2091
|
-
Object.defineProperty(events, "__esModule", { value: true });
|
|
2092
|
-
/* eslint-disable prefer-rest-params */
|
|
2093
|
-
var core_1$3 = src;
|
|
2094
|
-
var util_1$3 = util;
|
|
2095
|
-
var instrumentConsole = core_1$3.Util.instrumentConsole;
|
|
2096
|
-
function default_1$2(_window) {
|
|
2097
|
-
if (_window === void 0) { _window = (0, util_1$3.globalThisOrWindow)(); }
|
|
2098
|
-
return {
|
|
2099
|
-
shouldReloadOnConfigure: false,
|
|
2100
|
-
load: function (client) {
|
|
2101
|
-
function sendEventsToInsights() {
|
|
2102
|
-
return client.config.eventsEnabled;
|
|
2103
|
-
}
|
|
2104
|
-
if (!sendEventsToInsights()) {
|
|
2105
|
-
return;
|
|
2106
|
-
}
|
|
2107
|
-
instrumentConsole(_window, function (level, args) {
|
|
2108
|
-
if (!sendEventsToInsights()) {
|
|
2109
|
-
return;
|
|
2110
|
-
}
|
|
2111
|
-
// todo: send browser info
|
|
2112
|
-
client.logEvent({
|
|
2113
|
-
level: level,
|
|
2114
|
-
args: args
|
|
2115
|
-
});
|
|
2116
|
-
});
|
|
2117
|
-
}
|
|
2118
|
-
};
|
|
2119
|
-
}
|
|
2120
|
-
events.default = default_1$2;
|
|
2166
|
+
breadcrumbs.default = default_1$2;
|
|
2121
2167
|
|
|
2122
2168
|
var timers = {};
|
|
2123
2169
|
|
|
2124
2170
|
Object.defineProperty(timers, "__esModule", { value: true });
|
|
2125
2171
|
/* eslint-disable prefer-rest-params */
|
|
2126
2172
|
var core_1$2 = src;
|
|
2127
|
-
var
|
|
2128
|
-
var instrument$1 = core_1$2.Util.instrument;
|
|
2173
|
+
var instrument$1 = core_1$2.Util.instrument, globalThisOrWindow$2 = core_1$2.Util.globalThisOrWindow;
|
|
2129
2174
|
function default_1$1(_window) {
|
|
2130
|
-
if (_window === void 0) { _window =
|
|
2175
|
+
if (_window === void 0) { _window = globalThisOrWindow$2(); }
|
|
2131
2176
|
return {
|
|
2132
2177
|
load: function (client) {
|
|
2133
2178
|
// Wrap timers
|
|
@@ -2161,10 +2206,9 @@
|
|
|
2161
2206
|
|
|
2162
2207
|
Object.defineProperty(event_listeners, "__esModule", { value: true });
|
|
2163
2208
|
var core_1$1 = src;
|
|
2164
|
-
var
|
|
2165
|
-
var instrument = core_1$1.Util.instrument;
|
|
2209
|
+
var instrument = core_1$1.Util.instrument, globalThisOrWindow$1 = core_1$1.Util.globalThisOrWindow;
|
|
2166
2210
|
function default_1(_window) {
|
|
2167
|
-
if (_window === void 0) { _window =
|
|
2211
|
+
if (_window === void 0) { _window = globalThisOrWindow$1(); }
|
|
2168
2212
|
return {
|
|
2169
2213
|
load: function (client) {
|
|
2170
2214
|
// Wrap event listeners
|
|
@@ -2244,8 +2288,7 @@
|
|
|
2244
2288
|
Object.defineProperty(transport, "__esModule", { value: true });
|
|
2245
2289
|
transport.BrowserTransport = void 0;
|
|
2246
2290
|
var core_1 = src;
|
|
2247
|
-
var
|
|
2248
|
-
var sanitize = core_1.Util.sanitize;
|
|
2291
|
+
var sanitize = core_1.Util.sanitize, globalThisOrWindow = core_1.Util.globalThisOrWindow;
|
|
2249
2292
|
/**
|
|
2250
2293
|
* Helper function to get typesafe Object.entries()
|
|
2251
2294
|
* https://twitter.com/mattpocockuk/status/1502264005251018754?lang=en
|
|
@@ -2284,7 +2327,7 @@
|
|
|
2284
2327
|
if (options.method === 'POST' && payload) {
|
|
2285
2328
|
requestInit.body = typeof payload === 'string' ? payload : JSON.stringify(sanitize(payload, options.maxObjectDepth));
|
|
2286
2329
|
}
|
|
2287
|
-
return [4 /*yield*/,
|
|
2330
|
+
return [4 /*yield*/, globalThisOrWindow().fetch(options.endpoint, requestInit)];
|
|
2288
2331
|
case 1:
|
|
2289
2332
|
response = _a.sent();
|
|
2290
2333
|
return [4 /*yield*/, response.text()];
|
|
@@ -2372,13 +2415,12 @@
|
|
|
2372
2415
|
var onerror_1 = onerror;
|
|
2373
2416
|
var onunhandledrejection_1 = __importDefault(onunhandledrejection);
|
|
2374
2417
|
var breadcrumbs_1 = __importDefault(breadcrumbs);
|
|
2375
|
-
var events_1 = __importDefault(events);
|
|
2376
2418
|
var timers_1 = __importDefault(timers);
|
|
2377
2419
|
var event_listeners_1 = __importDefault(event_listeners);
|
|
2378
2420
|
var transport_1 = transport;
|
|
2379
|
-
var merge = core_1.Util.merge, filter = core_1.Util.filter, objectIsExtensible = core_1.Util.objectIsExtensible;
|
|
2421
|
+
var merge = core_1.Util.merge, filter = core_1.Util.filter, objectIsExtensible = core_1.Util.objectIsExtensible, globalThisOrWindow = core_1.Util.globalThisOrWindow;
|
|
2380
2422
|
var getProjectRoot = function () {
|
|
2381
|
-
var global =
|
|
2423
|
+
var global = globalThisOrWindow();
|
|
2382
2424
|
var projectRoot = '';
|
|
2383
2425
|
// Cloudflare workers do not have access to location API.
|
|
2384
2426
|
if (global.location != null) {
|
|
@@ -2456,7 +2498,7 @@
|
|
|
2456
2498
|
this.logger.debug("Can't show user feedback form without a notice already reported");
|
|
2457
2499
|
return [2 /*return*/];
|
|
2458
2500
|
}
|
|
2459
|
-
global =
|
|
2501
|
+
global = globalThisOrWindow();
|
|
2460
2502
|
if (typeof global.document === 'undefined') {
|
|
2461
2503
|
this.logger.debug('global.document is undefined. Cannot attach script');
|
|
2462
2504
|
return [2 /*return*/];
|
|
@@ -2482,7 +2524,7 @@
|
|
|
2482
2524
|
(commonjsGlobal.document.head || commonjsGlobal.document.body).appendChild(script);
|
|
2483
2525
|
};
|
|
2484
2526
|
Honeybadger.prototype.isUserFeedbackScriptUrlAlreadyVisible = function () {
|
|
2485
|
-
var global =
|
|
2527
|
+
var global = globalThisOrWindow();
|
|
2486
2528
|
var feedbackScriptUrl = this.getUserFeedbackSubmitUrl();
|
|
2487
2529
|
for (var i = 0; i < global.document.scripts.length; i++) {
|
|
2488
2530
|
var script = global.document.scripts[i];
|
|
@@ -2595,7 +2637,7 @@
|
|
|
2595
2637
|
var NOTIFIER = {
|
|
2596
2638
|
name: '@honeybadger-io/js',
|
|
2597
2639
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
|
|
2598
|
-
version: '6.
|
|
2640
|
+
version: '6.9.0'
|
|
2599
2641
|
};
|
|
2600
2642
|
var userAgent = function () {
|
|
2601
2643
|
if (typeof navigator !== 'undefined') {
|
|
@@ -2610,7 +2652,7 @@
|
|
|
2610
2652
|
(0, timers_1.default)(),
|
|
2611
2653
|
(0, event_listeners_1.default)(),
|
|
2612
2654
|
(0, breadcrumbs_1.default)(),
|
|
2613
|
-
|
|
2655
|
+
core_1.Plugins.events(),
|
|
2614
2656
|
]
|
|
2615
2657
|
});
|
|
2616
2658
|
singleton.setNotifier(NOTIFIER);
|