@honeybadger-io/js 6.16.4 → 6.16.6
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.ext.min.js +1 -1
- package/dist/browser/honeybadger.ext.min.js.map +1 -1
- package/dist/browser/honeybadger.js +201 -15
- 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/server/fastify.js +84 -3
- package/dist/server/fastify.js.map +1 -1
- package/dist/server/honeybadger.js +190 -7
- package/dist/server/honeybadger.js.map +1 -1
- package/package.json +3 -3
|
@@ -200,6 +200,17 @@ var stackTraceParser_esm = /*#__PURE__*/Object.freeze({
|
|
|
200
200
|
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(stackTraceParser_esm);
|
|
201
201
|
|
|
202
202
|
(function (exports) {
|
|
203
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
204
|
+
__assign = Object.assign || function(t) {
|
|
205
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
206
|
+
s = arguments[i];
|
|
207
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
208
|
+
t[p] = s[p];
|
|
209
|
+
}
|
|
210
|
+
return t;
|
|
211
|
+
};
|
|
212
|
+
return __assign.apply(this, arguments);
|
|
213
|
+
};
|
|
203
214
|
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
204
215
|
if (k2 === undefined) k2 = k;
|
|
205
216
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -260,7 +271,7 @@ var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(stackTraceParser_esm);
|
|
|
260
271
|
}
|
|
261
272
|
};
|
|
262
273
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
263
|
-
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.shouldSampleEvent = exports.resolveInsights = exports.runBeforeEventHandlers = exports.runBeforeNotifyHandlers = exports.getSourceForBacktrace = exports.getCauses = exports.calculateBacktraceShift = exports.DEFAULT_BACKTRACE_SHIFT = exports.makeBacktrace = exports.objectIsExtensible = exports.objectIsEmpty = exports.mergeNotice = exports.merge = void 0;
|
|
274
|
+
exports.logDeprecatedMethod = exports.globalThisOrWindow = exports.isBrowserConfig = exports.clone = exports.formatCGIData = exports.filterBreadcrumbs = 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.shouldSampleEvent = exports.resolveInsights = exports.runBeforeEventHandlers = exports.runBeforeNotifyHandlers = exports.getSourceForBacktrace = exports.getCauses = exports.calculateBacktraceShift = exports.DEFAULT_BACKTRACE_SHIFT = exports.makeBacktrace = exports.objectIsExtensible = exports.objectIsEmpty = exports.mergeNotice = exports.merge = void 0;
|
|
264
275
|
/* eslint-disable prefer-rest-params */
|
|
265
276
|
var stackTraceParser = __importStar(require$$0$1);
|
|
266
277
|
function merge(obj1, obj2) {
|
|
@@ -846,6 +857,76 @@ var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(stackTraceParser_esm);
|
|
|
846
857
|
return result;
|
|
847
858
|
}
|
|
848
859
|
exports.filterUrl = filterUrl;
|
|
860
|
+
/**
|
|
861
|
+
* Breadcrumb metadata keys whose value is a URL, and so may carry a query string.
|
|
862
|
+
*
|
|
863
|
+
* Checked by name rather than by running `filterUrl` over every string value: a `?` is
|
|
864
|
+
* ordinary punctuation in a breadcrumb message or a console argument, and rewriting around
|
|
865
|
+
* it would mangle text that is not a URL at all.
|
|
866
|
+
*/
|
|
867
|
+
var URL_METADATA_KEYS = ['url', 'from', 'to', 'href'];
|
|
868
|
+
/**
|
|
869
|
+
* Recursively rewrites the query string of every URL-bearing value.
|
|
870
|
+
*
|
|
871
|
+
* Nested as well as top-level: a breadcrumb may well carry
|
|
872
|
+
* `metadata: { request: { url: '/checkout?token=secret' } }`, and `filter` leaves that URL
|
|
873
|
+
* alone because the key `request` matches no filter.
|
|
874
|
+
*
|
|
875
|
+
* Safe to recurse without a seen-list because `filter` has already run: it replaces a
|
|
876
|
+
* circular reference with a string, so what arrives here is acyclic.
|
|
877
|
+
*/
|
|
878
|
+
function filterUrlValues(value, filters) {
|
|
879
|
+
if (is('Array', value)) {
|
|
880
|
+
return value.map(function (entry) { return filterUrlValues(entry, filters); });
|
|
881
|
+
}
|
|
882
|
+
if (!is('Object', value)) {
|
|
883
|
+
return value;
|
|
884
|
+
}
|
|
885
|
+
var result = {};
|
|
886
|
+
var source = value;
|
|
887
|
+
// Own enumerable keys only, assigned with `defineProperty`: a plain `result[key] =` would
|
|
888
|
+
// reassign the prototype rather than create a property for a key named `__proto__`, and
|
|
889
|
+
// breadcrumb metadata is host-supplied.
|
|
890
|
+
Object.keys(source).forEach(function (key) {
|
|
891
|
+
var entry = source[key];
|
|
892
|
+
var filtered = URL_METADATA_KEYS.includes(key.toLowerCase()) && typeof entry === 'string'
|
|
893
|
+
? filterUrl(entry, filters)
|
|
894
|
+
: filterUrlValues(entry, filters);
|
|
895
|
+
Object.defineProperty(result, key, {
|
|
896
|
+
value: filtered,
|
|
897
|
+
enumerable: true,
|
|
898
|
+
writable: true,
|
|
899
|
+
configurable: true
|
|
900
|
+
});
|
|
901
|
+
});
|
|
902
|
+
return result;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Applies `filters` to a breadcrumb trail.
|
|
906
|
+
*
|
|
907
|
+
* Metadata is filtered by key, exactly as `params` and `session` are, and any value under a
|
|
908
|
+
* URL-bearing key additionally has its query string filtered. Breadcrumb metadata is mostly
|
|
909
|
+
* generated by this library -- the XHR, fetch and navigation integrations all record a full
|
|
910
|
+
* URL -- so a query string lands there without the user ever choosing to put it there.
|
|
911
|
+
*/
|
|
912
|
+
function filterBreadcrumbs(trail, filters) {
|
|
913
|
+
if (!is('Array', trail)) {
|
|
914
|
+
return [];
|
|
915
|
+
}
|
|
916
|
+
return trail.map(function (breadcrumb) {
|
|
917
|
+
// Leave a crumb that never carried metadata exactly as it is, so the payload shape does
|
|
918
|
+
// not change for it.
|
|
919
|
+
if (!is('Object', breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.metadata)) {
|
|
920
|
+
return breadcrumb;
|
|
921
|
+
}
|
|
922
|
+
// `filter` runs first, so a key-matched value is already '[FILTERED]' by the time the
|
|
923
|
+
// URL pass sees it. Passing that through `filterUrl` is harmless: it holds no '?', so
|
|
924
|
+
// it is returned untouched.
|
|
925
|
+
var metadata = filterUrlValues(filter(breadcrumb.metadata, filters), filters);
|
|
926
|
+
return __assign(__assign({}, breadcrumb), { metadata: metadata });
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
exports.filterBreadcrumbs = filterBreadcrumbs;
|
|
849
930
|
function formatCGIData(vars, prefix) {
|
|
850
931
|
if (prefix === void 0) { prefix = ''; }
|
|
851
932
|
var formattedVars = {};
|
|
@@ -1473,7 +1554,7 @@ var Client = /** @class */ (function () {
|
|
|
1473
1554
|
this.__notifier = {
|
|
1474
1555
|
name: '@honeybadger-io/core',
|
|
1475
1556
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
|
|
1476
|
-
version: '6.16.
|
|
1557
|
+
version: '6.16.6'
|
|
1477
1558
|
};
|
|
1478
1559
|
this.config = __assign$1(__assign$1({}, defaults_1.CONFIG), opts);
|
|
1479
1560
|
this.__initStore();
|
|
@@ -1834,7 +1915,7 @@ var Client = /** @class */ (function () {
|
|
|
1834
1915
|
notifier: this.__notifier,
|
|
1835
1916
|
breadcrumbs: {
|
|
1836
1917
|
enabled: !!this.config.breadcrumbsEnabled,
|
|
1837
|
-
trail: notice.__breadcrumbs || []
|
|
1918
|
+
trail: (0, util_1$5.filterBreadcrumbs)(notice.__breadcrumbs || [], this.config.filters)
|
|
1838
1919
|
},
|
|
1839
1920
|
error: {
|
|
1840
1921
|
class: notice.name,
|
|
@@ -3747,6 +3828,104 @@ client.CheckInsClient = CheckInsClient;
|
|
|
3747
3828
|
|
|
3748
3829
|
} (checkInsManager));
|
|
3749
3830
|
|
|
3831
|
+
var globalSingleton = {};
|
|
3832
|
+
|
|
3833
|
+
(function (exports) {
|
|
3834
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3835
|
+
exports.getOrCreateSingleton = exports.singletonKey = exports.DISABLE_GLOBAL_SINGLETON_KEY = void 0;
|
|
3836
|
+
var core_1 = src;
|
|
3837
|
+
/**
|
|
3838
|
+
* Set this on the global object before the package is loaded to opt out of sharing.
|
|
3839
|
+
* Two independently bundled copies on one page then keep their own clients, the way
|
|
3840
|
+
* they did before the singleton was shared.
|
|
3841
|
+
*/
|
|
3842
|
+
exports.DISABLE_GLOBAL_SINGLETON_KEY = '__HONEYBADGER_DISABLE_GLOBAL_SINGLETON__';
|
|
3843
|
+
/**
|
|
3844
|
+
* Stamped on the client when it is stored, and required when it is read back, so the slot
|
|
3845
|
+
* is only ever trusted when this package wrote it. Duck typing would not do: a value that
|
|
3846
|
+
* happens to carry a `notify` method would be handed out as the client.
|
|
3847
|
+
*/
|
|
3848
|
+
var CLIENT_MARKER = '__honeybadger_client__';
|
|
3849
|
+
function singletonKey(target, version) {
|
|
3850
|
+
return "__honeybadger_singleton_".concat(target, "_").concat(version, "__");
|
|
3851
|
+
}
|
|
3852
|
+
exports.singletonKey = singletonKey;
|
|
3853
|
+
function isSingleton(value) {
|
|
3854
|
+
return !!value && value[CLIENT_MARKER] === true;
|
|
3855
|
+
}
|
|
3856
|
+
function markAsSingleton(client) {
|
|
3857
|
+
Object.defineProperty(client, CLIENT_MARKER, {
|
|
3858
|
+
value: true,
|
|
3859
|
+
writable: false,
|
|
3860
|
+
configurable: true,
|
|
3861
|
+
enumerable: false,
|
|
3862
|
+
});
|
|
3863
|
+
}
|
|
3864
|
+
/**
|
|
3865
|
+
* Returns the client stored on the global object, creating and storing it the first time.
|
|
3866
|
+
*
|
|
3867
|
+
* Bundlers can emit more than one copy of this module — Next.js compiles the
|
|
3868
|
+
* instrumentation, page-rendering and edge contexts into separate module graphs — and
|
|
3869
|
+
* each copy would otherwise build its own client. Only the copy the configuration code
|
|
3870
|
+
* ran in would be configured, so a `Honeybadger.notify()` made through any other copy
|
|
3871
|
+
* would silently do nothing. Keeping the instance on the realm's global object lets every
|
|
3872
|
+
* copy find the same configured client.
|
|
3873
|
+
*
|
|
3874
|
+
* The slot is keyed by build target and by exact version: an older copy must never be
|
|
3875
|
+
* handed to a newer caller that would then call a method it does not have. Two different
|
|
3876
|
+
* versions in one realm fall back to one client each, which is the behaviour that shipped
|
|
3877
|
+
* before the singleton was shared.
|
|
3878
|
+
*/
|
|
3879
|
+
function getOrCreateSingleton(target, version, create, _global) {
|
|
3880
|
+
if (_global === void 0) { _global = core_1.Util.globalThisOrWindow(); }
|
|
3881
|
+
if (!_global) {
|
|
3882
|
+
return create();
|
|
3883
|
+
}
|
|
3884
|
+
var key = singletonKey(target, version);
|
|
3885
|
+
var shared;
|
|
3886
|
+
var canShare = false;
|
|
3887
|
+
// Reading the global object can throw as easily as writing to it can: the opt-out
|
|
3888
|
+
// flag, the slot and the marker are all ordinary properties, and a host or another
|
|
3889
|
+
// script may have installed a getter on any of them. `create()` stays outside, so a
|
|
3890
|
+
// genuine failure to build the client still propagates.
|
|
3891
|
+
try {
|
|
3892
|
+
if (_global[exports.DISABLE_GLOBAL_SINGLETON_KEY] !== true) {
|
|
3893
|
+
canShare = true;
|
|
3894
|
+
var existing = _global[key];
|
|
3895
|
+
if (isSingleton(existing)) {
|
|
3896
|
+
shared = existing;
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
catch (_e) {
|
|
3901
|
+
canShare = false;
|
|
3902
|
+
}
|
|
3903
|
+
if (shared) {
|
|
3904
|
+
return shared;
|
|
3905
|
+
}
|
|
3906
|
+
var created = create();
|
|
3907
|
+
if (!canShare) {
|
|
3908
|
+
return created;
|
|
3909
|
+
}
|
|
3910
|
+
try {
|
|
3911
|
+
markAsSingleton(created);
|
|
3912
|
+
Object.defineProperty(_global, key, {
|
|
3913
|
+
value: created,
|
|
3914
|
+
writable: true,
|
|
3915
|
+
configurable: true,
|
|
3916
|
+
enumerable: false,
|
|
3917
|
+
});
|
|
3918
|
+
}
|
|
3919
|
+
catch (_e) {
|
|
3920
|
+
// A frozen global object (node --frozen-intrinsics, SES lockdown). Importing this
|
|
3921
|
+
// package must never throw, so this copy keeps the client to itself.
|
|
3922
|
+
}
|
|
3923
|
+
return created;
|
|
3924
|
+
}
|
|
3925
|
+
exports.getOrCreateSingleton = getOrCreateSingleton;
|
|
3926
|
+
|
|
3927
|
+
} (globalSingleton));
|
|
3928
|
+
|
|
3750
3929
|
(function (exports) {
|
|
3751
3930
|
var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
3752
3931
|
var extendStatics = function (d, b) {
|
|
@@ -3813,7 +3992,6 @@ client.CheckInsClient = CheckInsClient;
|
|
|
3813
3992
|
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
3814
3993
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3815
3994
|
};
|
|
3816
|
-
var _a;
|
|
3817
3995
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3818
3996
|
exports.CheckIn = exports.Types = void 0;
|
|
3819
3997
|
var os_1 = __importDefault(require$$0__default["default"]);
|
|
@@ -3828,6 +4006,7 @@ client.CheckInsClient = CheckInsClient;
|
|
|
3828
4006
|
var transport_1 = transport;
|
|
3829
4007
|
var stacked_store_1 = stacked_store;
|
|
3830
4008
|
var check_ins_manager_1 = checkInsManager;
|
|
4009
|
+
var global_singleton_1 = globalSingleton;
|
|
3831
4010
|
var endpoint = core_1.Util.endpoint;
|
|
3832
4011
|
var DEFAULT_PLUGINS = [
|
|
3833
4012
|
(0, uncaught_exception_plugin_1.default)(),
|
|
@@ -3991,13 +4170,17 @@ client.CheckInsClient = CheckInsClient;
|
|
|
3991
4170
|
var NOTIFIER = {
|
|
3992
4171
|
name: '@honeybadger-io/js',
|
|
3993
4172
|
url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
|
|
3994
|
-
version: '6.16.
|
|
4173
|
+
version: '6.16.6'
|
|
3995
4174
|
};
|
|
3996
4175
|
var userAgent = function () {
|
|
3997
4176
|
return "Honeybadger JS Server Client ".concat(NOTIFIER.version, ", ").concat(os_1.default.version(), "; ").concat(os_1.default.platform());
|
|
3998
4177
|
};
|
|
3999
|
-
var singleton =
|
|
4000
|
-
|
|
4178
|
+
var singleton = (0, global_singleton_1.getOrCreateSingleton)('server', NOTIFIER.version, function () {
|
|
4179
|
+
var _a;
|
|
4180
|
+
var client = new Honeybadger(__assign({ __plugins: DEFAULT_PLUGINS }, ((_a = (0, util_1.readConfigFromFileSystem)()) !== null && _a !== void 0 ? _a : {})));
|
|
4181
|
+
client.setNotifier(NOTIFIER);
|
|
4182
|
+
return client;
|
|
4183
|
+
});
|
|
4001
4184
|
var core_2 = src;
|
|
4002
4185
|
Object.defineProperty(exports, "Types", { enumerable: true, get: function () { return core_2.Types; } });
|
|
4003
4186
|
var check_in_1 = requireCheckIn();
|