@honeybadger-io/js 6.6.1 → 6.7.1
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 +355 -83
- 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/integrations/events.d.ts +3 -0
- package/dist/server/check-ins-sync-exec.js +2 -1
- package/dist/server/check-ins-sync-exec.js.map +1 -1
- package/dist/server/honeybadger.js +258 -15
- package/dist/server/honeybadger.js.map +1 -1
- package/package.json +3 -3
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
parse: parse
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
var require$$0 = /*@__PURE__*/getAugmentedNamespace(stackTraceParser_esm);
|
|
182
|
+
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(stackTraceParser_esm);
|
|
183
183
|
|
|
184
184
|
(function (exports) {
|
|
185
185
|
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -242,8 +242,9 @@
|
|
|
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.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
|
-
|
|
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;
|
|
246
|
+
/* eslint-disable prefer-rest-params */
|
|
247
|
+
var stackTraceParser = __importStar(require$$0$1);
|
|
247
248
|
function merge(obj1, obj2) {
|
|
248
249
|
var result = {};
|
|
249
250
|
for (var k in obj1) {
|
|
@@ -603,6 +604,39 @@
|
|
|
603
604
|
}
|
|
604
605
|
}
|
|
605
606
|
exports.instrument = instrument;
|
|
607
|
+
var _consoleAlreadyInstrumented = false;
|
|
608
|
+
var listeners = [];
|
|
609
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
610
|
+
function instrumentConsole(_window, handler) {
|
|
611
|
+
if (!_window || !_window.console || !handler) {
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
listeners.push(handler);
|
|
615
|
+
if (_consoleAlreadyInstrumented) {
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
_consoleAlreadyInstrumented = true;
|
|
619
|
+
['debug', 'info', 'warn', 'error', 'log'].forEach(function (level) {
|
|
620
|
+
instrument(_window.console, level, function hbLogger(original) {
|
|
621
|
+
return function () {
|
|
622
|
+
var args = Array.prototype.slice.call(arguments);
|
|
623
|
+
listeners.forEach(function (listener) {
|
|
624
|
+
try {
|
|
625
|
+
listener(level, args);
|
|
626
|
+
}
|
|
627
|
+
catch (_e) {
|
|
628
|
+
// ignore
|
|
629
|
+
// should never reach here because instrument method already wraps with try/catch block
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
if (typeof original === 'function') {
|
|
633
|
+
Function.prototype.apply.call(original, _window.console, arguments);
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
});
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
exports.instrumentConsole = instrumentConsole;
|
|
606
640
|
function endpoint(base, path) {
|
|
607
641
|
var endpoint = base.trim().replace(/\/$/, '');
|
|
608
642
|
path = path.trim().replace(/(^\/|\/$)/g, '');
|
|
@@ -756,7 +790,7 @@
|
|
|
756
790
|
|
|
757
791
|
Object.defineProperty(store, "__esModule", { value: true });
|
|
758
792
|
store.GlobalStore = void 0;
|
|
759
|
-
var util_1$
|
|
793
|
+
var util_1$9 = util$1;
|
|
760
794
|
var GlobalStore = /** @class */ (function () {
|
|
761
795
|
function GlobalStore(contents, breadcrumbsLimit) {
|
|
762
796
|
this.contents = contents;
|
|
@@ -773,7 +807,7 @@
|
|
|
773
807
|
return JSON.parse(JSON.stringify(value));
|
|
774
808
|
};
|
|
775
809
|
GlobalStore.prototype.setContext = function (context) {
|
|
776
|
-
this.contents.context = (0, util_1$
|
|
810
|
+
this.contents.context = (0, util_1$9.merge)(this.contents.context, context || {});
|
|
777
811
|
};
|
|
778
812
|
GlobalStore.prototype.addBreadcrumb = function (breadcrumb) {
|
|
779
813
|
if (this.contents.breadcrumbs.length == this.breadcrumbsLimit) {
|
|
@@ -792,6 +826,202 @@
|
|
|
792
826
|
}());
|
|
793
827
|
store.GlobalStore = GlobalStore;
|
|
794
828
|
|
|
829
|
+
var throttled_events_logger = {};
|
|
830
|
+
|
|
831
|
+
class NdJson {
|
|
832
|
+
static parse(data) {
|
|
833
|
+
const lines = data.trim().split('\n');
|
|
834
|
+
return lines.map(line => JSON.parse(line));
|
|
835
|
+
}
|
|
836
|
+
static stringify(data) {
|
|
837
|
+
return data.map(item => JSON.stringify(item)).join('\n');
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
var module = /*#__PURE__*/Object.freeze({
|
|
842
|
+
__proto__: null,
|
|
843
|
+
NdJson: NdJson
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(module);
|
|
847
|
+
|
|
848
|
+
var defaults = {};
|
|
849
|
+
|
|
850
|
+
Object.defineProperty(defaults, "__esModule", { value: true });
|
|
851
|
+
defaults.CONFIG = void 0;
|
|
852
|
+
defaults.CONFIG = {
|
|
853
|
+
apiKey: null,
|
|
854
|
+
endpoint: 'https://api.honeybadger.io',
|
|
855
|
+
environment: null,
|
|
856
|
+
hostname: null,
|
|
857
|
+
projectRoot: null,
|
|
858
|
+
component: null,
|
|
859
|
+
action: null,
|
|
860
|
+
revision: null,
|
|
861
|
+
reportData: null,
|
|
862
|
+
breadcrumbsEnabled: true,
|
|
863
|
+
eventsEnabled: false,
|
|
864
|
+
maxBreadcrumbs: 40,
|
|
865
|
+
maxObjectDepth: 8,
|
|
866
|
+
logger: console,
|
|
867
|
+
developmentEnvironments: ['dev', 'development', 'test'],
|
|
868
|
+
debug: false,
|
|
869
|
+
tags: null,
|
|
870
|
+
enableUncaught: true,
|
|
871
|
+
enableUnhandledRejection: true,
|
|
872
|
+
afterUncaught: function () { return true; },
|
|
873
|
+
filters: ['creditcard', 'password'],
|
|
874
|
+
__plugins: [],
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
var __assign$1 = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
878
|
+
__assign$1 = Object.assign || function(t) {
|
|
879
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
880
|
+
s = arguments[i];
|
|
881
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
882
|
+
t[p] = s[p];
|
|
883
|
+
}
|
|
884
|
+
return t;
|
|
885
|
+
};
|
|
886
|
+
return __assign$1.apply(this, arguments);
|
|
887
|
+
};
|
|
888
|
+
var __awaiter$2 = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
889
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
890
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
891
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
892
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
893
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
894
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
895
|
+
});
|
|
896
|
+
};
|
|
897
|
+
var __generator$2 = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
|
|
898
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
899
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
900
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
901
|
+
function step(op) {
|
|
902
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
903
|
+
while (_) try {
|
|
904
|
+
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;
|
|
905
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
906
|
+
switch (op[0]) {
|
|
907
|
+
case 0: case 1: t = op; break;
|
|
908
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
909
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
910
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
911
|
+
default:
|
|
912
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
913
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
914
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
915
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
916
|
+
if (t[2]) _.ops.pop();
|
|
917
|
+
_.trys.pop(); continue;
|
|
918
|
+
}
|
|
919
|
+
op = body.call(thisArg, _);
|
|
920
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
921
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
Object.defineProperty(throttled_events_logger, "__esModule", { value: true });
|
|
925
|
+
throttled_events_logger.ThrottledEventsLogger = void 0;
|
|
926
|
+
var json_nd_1 = require$$0;
|
|
927
|
+
var util_1$8 = util$1;
|
|
928
|
+
var defaults_1$1 = defaults;
|
|
929
|
+
var ThrottledEventsLogger = /** @class */ (function () {
|
|
930
|
+
function ThrottledEventsLogger(config, transport) {
|
|
931
|
+
this.config = config;
|
|
932
|
+
this.transport = transport;
|
|
933
|
+
this.queue = [];
|
|
934
|
+
this.isProcessing = false;
|
|
935
|
+
this.config = __assign$1(__assign$1({}, defaults_1$1.CONFIG), config);
|
|
936
|
+
this.logger = this.originalLogger();
|
|
937
|
+
}
|
|
938
|
+
ThrottledEventsLogger.prototype.configure = function (opts) {
|
|
939
|
+
for (var k in opts) {
|
|
940
|
+
this.config[k] = opts[k];
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
ThrottledEventsLogger.prototype.logEvent = function (data) {
|
|
944
|
+
this.queue.push(data);
|
|
945
|
+
if (!this.isProcessing) {
|
|
946
|
+
this.processQueue();
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
ThrottledEventsLogger.prototype.processQueue = function () {
|
|
950
|
+
var _this = this;
|
|
951
|
+
if (this.queue.length === 0 || this.isProcessing) {
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
this.isProcessing = true;
|
|
955
|
+
var eventsData = this.queue.slice();
|
|
956
|
+
this.queue = [];
|
|
957
|
+
var data = json_nd_1.NdJson.stringify(eventsData);
|
|
958
|
+
this.makeHttpRequest(data)
|
|
959
|
+
.then(function () {
|
|
960
|
+
setTimeout(function () {
|
|
961
|
+
_this.isProcessing = false;
|
|
962
|
+
_this.processQueue();
|
|
963
|
+
}, 50);
|
|
964
|
+
})
|
|
965
|
+
.catch(function (error) {
|
|
966
|
+
_this.logger.error('[Honeybadger] Error making HTTP request:', error);
|
|
967
|
+
// Continue processing the queue even if there's an error
|
|
968
|
+
setTimeout(function () {
|
|
969
|
+
_this.isProcessing = false;
|
|
970
|
+
_this.processQueue();
|
|
971
|
+
}, 50);
|
|
972
|
+
});
|
|
973
|
+
};
|
|
974
|
+
ThrottledEventsLogger.prototype.makeHttpRequest = function (data) {
|
|
975
|
+
return __awaiter$2(this, void 0, void 0, function () {
|
|
976
|
+
var _this = this;
|
|
977
|
+
return __generator$2(this, function (_a) {
|
|
978
|
+
return [2 /*return*/, this.transport
|
|
979
|
+
.send({
|
|
980
|
+
headers: {
|
|
981
|
+
'X-API-Key': this.config.apiKey,
|
|
982
|
+
'Content-Type': 'application/json',
|
|
983
|
+
},
|
|
984
|
+
method: 'POST',
|
|
985
|
+
endpoint: (0, util_1$8.endpoint)(this.config.endpoint, '/v1/events'),
|
|
986
|
+
maxObjectDepth: this.config.maxObjectDepth,
|
|
987
|
+
logger: this.logger,
|
|
988
|
+
}, data)
|
|
989
|
+
.then(function () {
|
|
990
|
+
if (_this.config.debug) {
|
|
991
|
+
_this.logger.debug('[Honeybadger] Events sent successfully');
|
|
992
|
+
}
|
|
993
|
+
})
|
|
994
|
+
.catch(function (err) {
|
|
995
|
+
_this.logger.error("[Honeybadger] Error sending events: ".concat(err.message));
|
|
996
|
+
})];
|
|
997
|
+
});
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
/**
|
|
1001
|
+
* todo: improve this
|
|
1002
|
+
*
|
|
1003
|
+
* The EventsLogger overrides the console methods
|
|
1004
|
+
* so if we want to log something we need to use the original methods
|
|
1005
|
+
*/
|
|
1006
|
+
ThrottledEventsLogger.prototype.originalLogger = function () {
|
|
1007
|
+
var _a, _b, _c, _d, _e;
|
|
1008
|
+
return {
|
|
1009
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1010
|
+
log: (_a = console.log.__hb_original) !== null && _a !== void 0 ? _a : console.log,
|
|
1011
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1012
|
+
info: (_b = console.info.__hb_original) !== null && _b !== void 0 ? _b : console.info,
|
|
1013
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1014
|
+
debug: (_c = console.debug.__hb_original) !== null && _c !== void 0 ? _c : console.debug,
|
|
1015
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1016
|
+
warn: (_d = console.warn.__hb_original) !== null && _d !== void 0 ? _d : console.warn,
|
|
1017
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1018
|
+
error: (_e = console.error.__hb_original) !== null && _e !== void 0 ? _e : console.error,
|
|
1019
|
+
};
|
|
1020
|
+
};
|
|
1021
|
+
return ThrottledEventsLogger;
|
|
1022
|
+
}());
|
|
1023
|
+
throttled_events_logger.ThrottledEventsLogger = ThrottledEventsLogger;
|
|
1024
|
+
|
|
795
1025
|
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
796
1026
|
__assign = Object.assign || function(t) {
|
|
797
1027
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -841,8 +1071,10 @@
|
|
|
841
1071
|
};
|
|
842
1072
|
Object.defineProperty(client, "__esModule", { value: true });
|
|
843
1073
|
client.Client = void 0;
|
|
844
|
-
var util_1$
|
|
1074
|
+
var util_1$7 = util$1;
|
|
845
1075
|
var store_1 = store;
|
|
1076
|
+
var throttled_events_logger_1 = throttled_events_logger;
|
|
1077
|
+
var defaults_1 = defaults;
|
|
846
1078
|
// Split at commas and spaces
|
|
847
1079
|
var TAG_SEPARATOR = /,|\s+/;
|
|
848
1080
|
// Checks for non-blank characters
|
|
@@ -857,12 +1089,13 @@
|
|
|
857
1089
|
this.__notifier = {
|
|
858
1090
|
name: '@honeybadger-io/core',
|
|
859
1091
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
|
|
860
|
-
version: '6.
|
|
1092
|
+
version: '6.7.1'
|
|
861
1093
|
};
|
|
862
|
-
this.config = __assign({
|
|
1094
|
+
this.config = __assign(__assign({}, defaults_1.CONFIG), opts);
|
|
863
1095
|
this.__initStore();
|
|
864
1096
|
this.__transport = transport;
|
|
865
|
-
this.
|
|
1097
|
+
this.__eventsLogger = new throttled_events_logger_1.ThrottledEventsLogger(this.config, this.__transport);
|
|
1098
|
+
this.logger = (0, util_1$7.logger)(this);
|
|
866
1099
|
}
|
|
867
1100
|
Client.prototype.getVersion = function () {
|
|
868
1101
|
return this.__notifier.version;
|
|
@@ -885,6 +1118,7 @@
|
|
|
885
1118
|
for (var k in opts) {
|
|
886
1119
|
this.config[k] = opts[k];
|
|
887
1120
|
}
|
|
1121
|
+
this.__eventsLogger.configure(this.config);
|
|
888
1122
|
this.loadPlugins();
|
|
889
1123
|
return this;
|
|
890
1124
|
};
|
|
@@ -932,16 +1166,16 @@
|
|
|
932
1166
|
var notice = this.makeNotice(noticeable, name, extra);
|
|
933
1167
|
// we need to have the source file data before the beforeNotifyHandlers,
|
|
934
1168
|
// in case they modify them
|
|
935
|
-
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1$
|
|
1169
|
+
var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1$7.shallowClone)(trace); }) : null;
|
|
936
1170
|
var preConditionsResult = this.__runPreconditions(notice);
|
|
937
1171
|
if (preConditionsResult instanceof Error) {
|
|
938
|
-
(0, util_1$
|
|
1172
|
+
(0, util_1$7.runAfterNotifyHandlers)(notice, this.__afterNotifyHandlers, preConditionsResult);
|
|
939
1173
|
return false;
|
|
940
1174
|
}
|
|
941
1175
|
if (preConditionsResult instanceof Promise) {
|
|
942
1176
|
preConditionsResult.then(function (result) {
|
|
943
1177
|
if (result instanceof Error) {
|
|
944
|
-
(0, util_1$
|
|
1178
|
+
(0, util_1$7.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, result);
|
|
945
1179
|
return false;
|
|
946
1180
|
}
|
|
947
1181
|
return _this.__send(notice, sourceCodeData);
|
|
@@ -999,18 +1233,18 @@
|
|
|
999
1233
|
Client.prototype.makeNotice = function (noticeable, name, extra) {
|
|
1000
1234
|
if (name === void 0) { name = undefined; }
|
|
1001
1235
|
if (extra === void 0) { extra = undefined; }
|
|
1002
|
-
var notice = (0, util_1$
|
|
1236
|
+
var notice = (0, util_1$7.makeNotice)(noticeable);
|
|
1003
1237
|
if (name && !(typeof name === 'object')) {
|
|
1004
1238
|
var n = String(name);
|
|
1005
1239
|
name = { name: n };
|
|
1006
1240
|
}
|
|
1007
1241
|
if (name) {
|
|
1008
|
-
notice = (0, util_1$
|
|
1242
|
+
notice = (0, util_1$7.mergeNotice)(notice, name);
|
|
1009
1243
|
}
|
|
1010
1244
|
if (typeof extra === 'object' && extra !== null) {
|
|
1011
|
-
notice = (0, util_1$
|
|
1245
|
+
notice = (0, util_1$7.mergeNotice)(notice, extra);
|
|
1012
1246
|
}
|
|
1013
|
-
if ((0, util_1$
|
|
1247
|
+
if ((0, util_1$7.objectIsEmpty)(notice)) {
|
|
1014
1248
|
return null;
|
|
1015
1249
|
}
|
|
1016
1250
|
var context = this.__store.getContents('context');
|
|
@@ -1020,9 +1254,9 @@
|
|
|
1020
1254
|
// Turning into a Set will remove duplicates
|
|
1021
1255
|
var tags = noticeTags.concat(contextTags).concat(configTags);
|
|
1022
1256
|
var uniqueTags = tags.filter(function (item, index) { return tags.indexOf(item) === index; });
|
|
1023
|
-
notice = (0, util_1$
|
|
1257
|
+
notice = (0, util_1$7.merge)(notice, {
|
|
1024
1258
|
name: notice.name || 'Error',
|
|
1025
|
-
context: (0, util_1$
|
|
1259
|
+
context: (0, util_1$7.merge)(context, notice.context),
|
|
1026
1260
|
projectRoot: notice.projectRoot || this.config.projectRoot,
|
|
1027
1261
|
environment: notice.environment || this.config.environment,
|
|
1028
1262
|
component: notice.component || this.config.component,
|
|
@@ -1034,11 +1268,11 @@
|
|
|
1034
1268
|
// Otherwise we make one.
|
|
1035
1269
|
if (!Array.isArray(notice.backtrace) || !notice.backtrace.length) {
|
|
1036
1270
|
if (typeof notice.stack !== 'string' || !notice.stack.trim()) {
|
|
1037
|
-
notice.stack = (0, util_1$
|
|
1038
|
-
notice.backtrace = (0, util_1$
|
|
1271
|
+
notice.stack = (0, util_1$7.generateStackTrace)();
|
|
1272
|
+
notice.backtrace = (0, util_1$7.makeBacktrace)(notice.stack, true, this.logger);
|
|
1039
1273
|
}
|
|
1040
1274
|
else {
|
|
1041
|
-
notice.backtrace = (0, util_1$
|
|
1275
|
+
notice.backtrace = (0, util_1$7.makeBacktrace)(notice.stack, false, this.logger);
|
|
1042
1276
|
}
|
|
1043
1277
|
}
|
|
1044
1278
|
return notice;
|
|
@@ -1048,7 +1282,7 @@
|
|
|
1048
1282
|
return;
|
|
1049
1283
|
}
|
|
1050
1284
|
opts = opts || {};
|
|
1051
|
-
var metadata = (0, util_1$
|
|
1285
|
+
var metadata = (0, util_1$7.shallowClone)(opts.metadata);
|
|
1052
1286
|
var category = opts.category || 'custom';
|
|
1053
1287
|
var timestamp = new Date().toISOString();
|
|
1054
1288
|
this.__store.addBreadcrumb({
|
|
@@ -1059,6 +1293,9 @@
|
|
|
1059
1293
|
});
|
|
1060
1294
|
return this;
|
|
1061
1295
|
};
|
|
1296
|
+
Client.prototype.logEvent = function (data) {
|
|
1297
|
+
this.__eventsLogger.logEvent(data);
|
|
1298
|
+
};
|
|
1062
1299
|
Client.prototype.__getBreadcrumbs = function () {
|
|
1063
1300
|
return this.__store.getContents('breadcrumbs').slice();
|
|
1064
1301
|
};
|
|
@@ -1072,8 +1309,8 @@
|
|
|
1072
1309
|
return (this.config.environment && this.config.developmentEnvironments.includes(this.config.environment));
|
|
1073
1310
|
};
|
|
1074
1311
|
Client.prototype.__buildPayload = function (notice) {
|
|
1075
|
-
var headers = (0, util_1$
|
|
1076
|
-
var cgiData = (0, util_1$
|
|
1312
|
+
var headers = (0, util_1$7.filter)(notice.headers, this.config.filters) || {};
|
|
1313
|
+
var cgiData = (0, util_1$7.filter)(__assign(__assign({}, notice.cgiData), (0, util_1$7.formatCGIData)(headers, 'HTTP_')), this.config.filters);
|
|
1077
1314
|
return {
|
|
1078
1315
|
notifier: this.__notifier,
|
|
1079
1316
|
breadcrumbs: {
|
|
@@ -1086,16 +1323,16 @@
|
|
|
1086
1323
|
backtrace: notice.backtrace,
|
|
1087
1324
|
fingerprint: notice.fingerprint,
|
|
1088
1325
|
tags: notice.tags,
|
|
1089
|
-
causes: (0, util_1$
|
|
1326
|
+
causes: (0, util_1$7.getCauses)(notice, this.logger),
|
|
1090
1327
|
},
|
|
1091
1328
|
request: {
|
|
1092
|
-
url: (0, util_1$
|
|
1329
|
+
url: (0, util_1$7.filterUrl)(notice.url, this.config.filters),
|
|
1093
1330
|
component: notice.component,
|
|
1094
1331
|
action: notice.action,
|
|
1095
1332
|
context: notice.context,
|
|
1096
1333
|
cgi_data: cgiData,
|
|
1097
|
-
params: (0, util_1$
|
|
1098
|
-
session: (0, util_1$
|
|
1334
|
+
params: (0, util_1$7.filter)(notice.params, this.config.filters) || {},
|
|
1335
|
+
session: (0, util_1$7.filter)(notice.session, this.config.filters) || {}
|
|
1099
1336
|
},
|
|
1100
1337
|
server: {
|
|
1101
1338
|
project_root: notice.projectRoot,
|
|
@@ -1132,7 +1369,7 @@
|
|
|
1132
1369
|
this.logger.warn('could not send error report: no API key has been configured', notice);
|
|
1133
1370
|
preConditionError = new Error('missing API key');
|
|
1134
1371
|
}
|
|
1135
|
-
var beforeNotifyResult = (0, util_1$
|
|
1372
|
+
var beforeNotifyResult = (0, util_1$7.runBeforeNotifyHandlers)(notice, this.__beforeNotifyHandlers);
|
|
1136
1373
|
if (!preConditionError && !beforeNotifyResult.result) {
|
|
1137
1374
|
this.logger.debug('skipping error report: one or more beforeNotify handlers returned false', notice);
|
|
1138
1375
|
preConditionError = new Error('beforeNotify handlers returned false');
|
|
@@ -1167,7 +1404,7 @@
|
|
|
1167
1404
|
else {
|
|
1168
1405
|
notice.__breadcrumbs = [];
|
|
1169
1406
|
}
|
|
1170
|
-
return (0, util_1$
|
|
1407
|
+
return (0, util_1$7.getSourceForBacktrace)(originalBacktrace, this.__getSourceFileHandler)
|
|
1171
1408
|
.then(function (sourcePerTrace) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
1172
1409
|
var payload;
|
|
1173
1410
|
return __generator$1(this, function (_a) {
|
|
@@ -1183,7 +1420,7 @@
|
|
|
1183
1420
|
'Accept': 'text/json, application/json'
|
|
1184
1421
|
},
|
|
1185
1422
|
method: 'POST',
|
|
1186
|
-
endpoint: (0, util_1$
|
|
1423
|
+
endpoint: (0, util_1$7.endpoint)(this.config.endpoint, '/v1/notices/js'),
|
|
1187
1424
|
maxObjectDepth: this.config.maxObjectDepth,
|
|
1188
1425
|
logger: this.logger,
|
|
1189
1426
|
}, payload)];
|
|
@@ -1191,12 +1428,12 @@
|
|
|
1191
1428
|
}); })
|
|
1192
1429
|
.then(function (res) {
|
|
1193
1430
|
if (res.statusCode !== 201) {
|
|
1194
|
-
(0, util_1$
|
|
1431
|
+
(0, util_1$7.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, new Error("Bad HTTP response: ".concat(res.statusCode)));
|
|
1195
1432
|
_this.logger.warn("Error report failed: unknown response from server. code=".concat(res.statusCode));
|
|
1196
1433
|
return false;
|
|
1197
1434
|
}
|
|
1198
1435
|
var uuid = JSON.parse(res.body).id;
|
|
1199
|
-
(0, util_1$
|
|
1436
|
+
(0, util_1$7.runAfterNotifyHandlers)((0, util_1$7.merge)(notice, {
|
|
1200
1437
|
id: uuid
|
|
1201
1438
|
}), _this.__afterNotifyHandlers);
|
|
1202
1439
|
_this.logger.info("Error report sent \u26A1 https://app.honeybadger.io/notice/".concat(uuid));
|
|
@@ -1204,7 +1441,7 @@
|
|
|
1204
1441
|
})
|
|
1205
1442
|
.catch(function (err) {
|
|
1206
1443
|
_this.logger.error('Error report failed: an unknown error occurred.', "message=".concat(err.message));
|
|
1207
|
-
(0, util_1$
|
|
1444
|
+
(0, util_1$7.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, err);
|
|
1208
1445
|
return false;
|
|
1209
1446
|
});
|
|
1210
1447
|
};
|
|
@@ -1455,9 +1692,9 @@
|
|
|
1455
1692
|
Object.defineProperty(onerror, "__esModule", { value: true });
|
|
1456
1693
|
onerror.onError = onerror.ignoreNextOnError = void 0;
|
|
1457
1694
|
/* eslint-disable prefer-rest-params */
|
|
1458
|
-
var core_1$
|
|
1459
|
-
var util_1$
|
|
1460
|
-
var instrument$4 = core_1$
|
|
1695
|
+
var core_1$6 = src;
|
|
1696
|
+
var util_1$6 = util;
|
|
1697
|
+
var instrument$4 = core_1$6.Util.instrument, makeNotice = core_1$6.Util.makeNotice;
|
|
1461
1698
|
var ignoreOnError = 0;
|
|
1462
1699
|
var currentTimeout;
|
|
1463
1700
|
function ignoreNextOnError() {
|
|
@@ -1470,7 +1707,7 @@
|
|
|
1470
1707
|
onerror.ignoreNextOnError = ignoreNextOnError;
|
|
1471
1708
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1472
1709
|
function onError(_window) {
|
|
1473
|
-
if (_window === void 0) { _window = (0, util_1$
|
|
1710
|
+
if (_window === void 0) { _window = (0, util_1$6.globalThisOrWindow)(); }
|
|
1474
1711
|
return {
|
|
1475
1712
|
load: function (client) {
|
|
1476
1713
|
instrument$4(_window, 'onerror', function (original) {
|
|
@@ -1529,12 +1766,12 @@
|
|
|
1529
1766
|
|
|
1530
1767
|
Object.defineProperty(onunhandledrejection, "__esModule", { value: true });
|
|
1531
1768
|
/* eslint-disable prefer-rest-params */
|
|
1532
|
-
var core_1$
|
|
1533
|
-
var util_1$
|
|
1534
|
-
var instrument$3 = core_1$
|
|
1769
|
+
var core_1$5 = src;
|
|
1770
|
+
var util_1$5 = util;
|
|
1771
|
+
var instrument$3 = core_1$5.Util.instrument;
|
|
1535
1772
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1536
|
-
function default_1$
|
|
1537
|
-
if (_window === void 0) { _window = (0, util_1$
|
|
1773
|
+
function default_1$4(_window) {
|
|
1774
|
+
if (_window === void 0) { _window = (0, util_1$5.globalThisOrWindow)(); }
|
|
1538
1775
|
return {
|
|
1539
1776
|
load: function (client) {
|
|
1540
1777
|
if (!client.config.enableUnhandledRejection) {
|
|
@@ -1585,17 +1822,17 @@
|
|
|
1585
1822
|
}
|
|
1586
1823
|
};
|
|
1587
1824
|
}
|
|
1588
|
-
onunhandledrejection.default = default_1$
|
|
1825
|
+
onunhandledrejection.default = default_1$4;
|
|
1589
1826
|
|
|
1590
1827
|
var breadcrumbs = {};
|
|
1591
1828
|
|
|
1592
1829
|
Object.defineProperty(breadcrumbs, "__esModule", { value: true });
|
|
1593
1830
|
/* eslint-disable prefer-rest-params */
|
|
1594
|
-
var core_1$
|
|
1595
|
-
var util_1$
|
|
1596
|
-
var sanitize$1 = core_1$
|
|
1597
|
-
function default_1$
|
|
1598
|
-
if (_window === void 0) { _window = (0, util_1$
|
|
1831
|
+
var core_1$4 = src;
|
|
1832
|
+
var util_1$4 = util;
|
|
1833
|
+
var sanitize$1 = core_1$4.Util.sanitize, instrument$2 = core_1$4.Util.instrument, instrumentConsole$1 = core_1$4.Util.instrumentConsole;
|
|
1834
|
+
function default_1$3(_window) {
|
|
1835
|
+
if (_window === void 0) { _window = (0, util_1$4.globalThisOrWindow)(); }
|
|
1599
1836
|
return {
|
|
1600
1837
|
load: function (client) {
|
|
1601
1838
|
function breadcrumbsEnabled(type) {
|
|
@@ -1625,24 +1862,16 @@
|
|
|
1625
1862
|
}
|
|
1626
1863
|
}).join(' ');
|
|
1627
1864
|
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
}
|
|
1639
|
-
};
|
|
1640
|
-
client.addBreadcrumb(message, opts);
|
|
1641
|
-
if (typeof original === 'function') {
|
|
1642
|
-
Function.prototype.apply.call(original, _window.console, arguments);
|
|
1643
|
-
}
|
|
1644
|
-
};
|
|
1645
|
-
});
|
|
1865
|
+
instrumentConsole$1(_window, function (level, args) {
|
|
1866
|
+
var message = inspectArray(args);
|
|
1867
|
+
var opts = {
|
|
1868
|
+
category: 'log',
|
|
1869
|
+
metadata: {
|
|
1870
|
+
level: level,
|
|
1871
|
+
arguments: sanitize$1(args, 3)
|
|
1872
|
+
}
|
|
1873
|
+
};
|
|
1874
|
+
client.addBreadcrumb(message, opts);
|
|
1646
1875
|
});
|
|
1647
1876
|
})();
|
|
1648
1877
|
// Breadcrumbs: instrument click events
|
|
@@ -1656,9 +1885,9 @@
|
|
|
1656
1885
|
_window.addEventListener('click', function (event) {
|
|
1657
1886
|
var message, selector, text;
|
|
1658
1887
|
try {
|
|
1659
|
-
message = (0, util_1$
|
|
1660
|
-
selector = (0, util_1$
|
|
1661
|
-
text = (0, util_1$
|
|
1888
|
+
message = (0, util_1$4.stringNameOfElement)(event.target);
|
|
1889
|
+
selector = (0, util_1$4.stringSelectorOfElement)(event.target);
|
|
1890
|
+
text = (0, util_1$4.stringTextOfElement)(event.target);
|
|
1662
1891
|
}
|
|
1663
1892
|
catch (e) {
|
|
1664
1893
|
message = 'UI Click';
|
|
@@ -1697,7 +1926,7 @@
|
|
|
1697
1926
|
// in case of url being URL object (which is valid input) we need to stringify it
|
|
1698
1927
|
var url = typeof rawUrl === 'string' ? rawUrl : String(rawUrl);
|
|
1699
1928
|
var method = typeof arguments[0] === 'string' ? arguments[0].toUpperCase() : arguments[0];
|
|
1700
|
-
var message = "".concat(method, " ").concat((0, util_1$
|
|
1929
|
+
var message = "".concat(method, " ").concat((0, util_1$4.localURLPathname)(url));
|
|
1701
1930
|
this.__hb_xhr = {
|
|
1702
1931
|
type: 'xhr',
|
|
1703
1932
|
method: method,
|
|
@@ -1754,7 +1983,7 @@
|
|
|
1754
1983
|
if (!breadcrumbsEnabled('network')) {
|
|
1755
1984
|
return;
|
|
1756
1985
|
}
|
|
1757
|
-
if (!(0, util_1$
|
|
1986
|
+
if (!(0, util_1$4.nativeFetch)()) {
|
|
1758
1987
|
// Polyfills use XHR.
|
|
1759
1988
|
return;
|
|
1760
1989
|
}
|
|
@@ -1783,7 +2012,7 @@
|
|
|
1783
2012
|
method = method.toUpperCase();
|
|
1784
2013
|
}
|
|
1785
2014
|
// localURLPathname cant be constructed for CF workers due to reliance on "document".
|
|
1786
|
-
var message = "".concat(method, " ").concat(typeof document === 'undefined' ? url : (0, util_1$
|
|
2015
|
+
var message = "".concat(method, " ").concat(typeof document === 'undefined' ? url : (0, util_1$4.localURLPathname)(url));
|
|
1787
2016
|
var metadata = {
|
|
1788
2017
|
type: 'fetch',
|
|
1789
2018
|
method: method,
|
|
@@ -1855,7 +2084,40 @@
|
|
|
1855
2084
|
}
|
|
1856
2085
|
};
|
|
1857
2086
|
}
|
|
1858
|
-
breadcrumbs.default = default_1$
|
|
2087
|
+
breadcrumbs.default = default_1$3;
|
|
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;
|
|
1859
2121
|
|
|
1860
2122
|
var timers = {};
|
|
1861
2123
|
|
|
@@ -2019,8 +2281,8 @@
|
|
|
2019
2281
|
headers: headers
|
|
2020
2282
|
};
|
|
2021
2283
|
// GET methods cannot have a body.
|
|
2022
|
-
if (options.method === 'POST') {
|
|
2023
|
-
requestInit.body = payload ? JSON.stringify(sanitize(payload, options.maxObjectDepth))
|
|
2284
|
+
if (options.method === 'POST' && payload) {
|
|
2285
|
+
requestInit.body = typeof payload === 'string' ? payload : JSON.stringify(sanitize(payload, options.maxObjectDepth));
|
|
2024
2286
|
}
|
|
2025
2287
|
return [4 /*yield*/, (0, util_1.globalThisOrWindow)().fetch(options.endpoint, requestInit)];
|
|
2026
2288
|
case 1:
|
|
@@ -2110,6 +2372,7 @@
|
|
|
2110
2372
|
var onerror_1 = onerror;
|
|
2111
2373
|
var onunhandledrejection_1 = __importDefault(onunhandledrejection);
|
|
2112
2374
|
var breadcrumbs_1 = __importDefault(breadcrumbs);
|
|
2375
|
+
var events_1 = __importDefault(events);
|
|
2113
2376
|
var timers_1 = __importDefault(timers);
|
|
2114
2377
|
var event_listeners_1 = __importDefault(event_listeners);
|
|
2115
2378
|
var transport_1 = transport;
|
|
@@ -2132,7 +2395,9 @@
|
|
|
2132
2395
|
__extends(Honeybadger, _super);
|
|
2133
2396
|
function Honeybadger(opts) {
|
|
2134
2397
|
if (opts === void 0) { opts = {}; }
|
|
2135
|
-
var _this = _super.call(this, __assign({ userFeedbackEndpoint: 'https://api.honeybadger.io/v2/feedback', async: true, maxErrors: null, projectRoot: getProjectRoot() }, opts), new transport_1.BrowserTransport(
|
|
2398
|
+
var _this = _super.call(this, __assign({ userFeedbackEndpoint: 'https://api.honeybadger.io/v2/feedback', async: true, maxErrors: null, projectRoot: getProjectRoot() }, opts), new transport_1.BrowserTransport({
|
|
2399
|
+
'User-Agent': userAgent(),
|
|
2400
|
+
})) || this;
|
|
2136
2401
|
/** @internal */
|
|
2137
2402
|
_this.__errorsSent = 0;
|
|
2138
2403
|
/** @internal */
|
|
@@ -2327,20 +2592,27 @@
|
|
|
2327
2592
|
};
|
|
2328
2593
|
return Honeybadger;
|
|
2329
2594
|
}(core_1.Client));
|
|
2595
|
+
var NOTIFIER = {
|
|
2596
|
+
name: '@honeybadger-io/js',
|
|
2597
|
+
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
|
|
2598
|
+
version: '6.7.1'
|
|
2599
|
+
};
|
|
2600
|
+
var userAgent = function () {
|
|
2601
|
+
if (typeof navigator !== undefined) {
|
|
2602
|
+
return "Honeybadger JS Browser Client ".concat(NOTIFIER.version, "; ").concat(navigator.userAgent);
|
|
2603
|
+
}
|
|
2604
|
+
return "Honeybadger JS Browser Client ".concat(NOTIFIER.version, "; n/a; n/a");
|
|
2605
|
+
};
|
|
2330
2606
|
var singleton = new Honeybadger({
|
|
2331
2607
|
__plugins: [
|
|
2332
2608
|
(0, onerror_1.onError)(),
|
|
2333
2609
|
(0, onunhandledrejection_1.default)(),
|
|
2334
2610
|
(0, timers_1.default)(),
|
|
2335
2611
|
(0, event_listeners_1.default)(),
|
|
2336
|
-
(0, breadcrumbs_1.default)()
|
|
2612
|
+
(0, breadcrumbs_1.default)(),
|
|
2613
|
+
(0, events_1.default)(),
|
|
2337
2614
|
]
|
|
2338
2615
|
});
|
|
2339
|
-
var NOTIFIER = {
|
|
2340
|
-
name: '@honeybadger-io/js',
|
|
2341
|
-
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
|
|
2342
|
-
version: '6.6.1'
|
|
2343
|
-
};
|
|
2344
2616
|
singleton.setNotifier(NOTIFIER);
|
|
2345
2617
|
var core_2 = src;
|
|
2346
2618
|
Object.defineProperty(exports, "Types", { enumerable: true, get: function () { return core_2.Types; } });
|