@sentry/browser 6.18.1-beta.0 → 6.19.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/bundles/bundle.debug.min.js +3 -0
- package/bundles/bundle.debug.min.js.map +1 -0
- package/bundles/bundle.es6.debug.min.js +3 -0
- package/bundles/bundle.es6.debug.min.js.map +1 -0
- package/{build → bundles}/bundle.es6.js +270 -278
- package/bundles/bundle.es6.js.map +1 -0
- package/bundles/bundle.es6.min.js +3 -0
- package/bundles/bundle.es6.min.js.map +1 -0
- package/{build → bundles}/bundle.js +305 -306
- package/bundles/bundle.js.map +1 -0
- package/bundles/bundle.min.js +3 -0
- package/bundles/bundle.min.js.map +1 -0
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +2 -2
- package/dist/backend.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/eventbuilder.d.ts +24 -10
- package/dist/eventbuilder.d.ts.map +1 -1
- package/dist/eventbuilder.js +119 -23
- package/dist/eventbuilder.js.map +1 -1
- package/dist/exports.d.ts.map +1 -1
- package/dist/exports.js.map +1 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +2 -6
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/breadcrumbs.d.ts.map +1 -1
- package/dist/integrations/breadcrumbs.js.map +1 -1
- package/dist/integrations/dedupe.d.ts.map +1 -1
- package/dist/integrations/dedupe.js +1 -1
- package/dist/integrations/dedupe.js.map +1 -1
- package/dist/integrations/globalhandlers.d.ts.map +1 -1
- package/dist/integrations/globalhandlers.js +3 -11
- package/dist/integrations/globalhandlers.js.map +1 -1
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/linkederrors.d.ts.map +1 -1
- package/dist/integrations/linkederrors.js +2 -2
- package/dist/integrations/linkederrors.js.map +1 -1
- package/dist/integrations/trycatch.d.ts.map +1 -1
- package/dist/integrations/trycatch.js +26 -21
- package/dist/integrations/trycatch.js.map +1 -1
- package/dist/integrations/useragent.d.ts.map +1 -1
- package/dist/integrations/useragent.js.map +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +3 -9
- package/dist/sdk.js.map +1 -1
- package/dist/stack-parsers.d.ts +5 -5
- package/dist/stack-parsers.d.ts.map +1 -1
- package/dist/stack-parsers.js +16 -6
- package/dist/stack-parsers.js.map +1 -1
- package/dist/transports/base.d.ts +6 -6
- package/dist/transports/base.d.ts.map +1 -1
- package/dist/transports/base.js +17 -68
- package/dist/transports/base.js.map +1 -1
- package/dist/transports/fetch.d.ts.map +1 -1
- package/dist/transports/fetch.js +2 -0
- package/dist/transports/fetch.js.map +1 -1
- package/dist/transports/index.d.ts.map +1 -1
- package/dist/transports/index.js.map +1 -1
- package/dist/transports/utils.d.ts.map +1 -1
- package/dist/transports/utils.js +2 -3
- package/dist/transports/utils.js.map +1 -1
- package/dist/transports/xhr.d.ts.map +1 -1
- package/dist/transports/xhr.js +2 -0
- package/dist/transports/xhr.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js.map +1 -1
- package/esm/backend.d.ts.map +1 -1
- package/esm/backend.js +2 -2
- package/esm/backend.js.map +1 -1
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +2 -2
- package/esm/client.js.map +1 -1
- package/esm/eventbuilder.d.ts +24 -10
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js +113 -21
- package/esm/eventbuilder.js.map +1 -1
- package/esm/exports.d.ts.map +1 -1
- package/esm/exports.js.map +1 -1
- package/esm/helpers.d.ts.map +1 -1
- package/esm/helpers.js +2 -6
- package/esm/helpers.js.map +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js.map +1 -1
- package/esm/integrations/breadcrumbs.d.ts.map +1 -1
- package/esm/integrations/breadcrumbs.js.map +1 -1
- package/esm/integrations/dedupe.d.ts.map +1 -1
- package/esm/integrations/dedupe.js +2 -2
- package/esm/integrations/dedupe.js.map +1 -1
- package/esm/integrations/globalhandlers.d.ts.map +1 -1
- package/esm/integrations/globalhandlers.js +3 -11
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/index.d.ts.map +1 -1
- package/esm/integrations/index.js.map +1 -1
- package/esm/integrations/linkederrors.d.ts.map +1 -1
- package/esm/integrations/linkederrors.js +1 -1
- package/esm/integrations/linkederrors.js.map +1 -1
- package/esm/integrations/trycatch.d.ts.map +1 -1
- package/esm/integrations/trycatch.js +26 -21
- package/esm/integrations/trycatch.js.map +1 -1
- package/esm/integrations/useragent.d.ts.map +1 -1
- package/esm/integrations/useragent.js.map +1 -1
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +3 -9
- package/esm/sdk.js.map +1 -1
- package/esm/stack-parsers.d.ts +5 -5
- package/esm/stack-parsers.d.ts.map +1 -1
- package/esm/stack-parsers.js +16 -6
- package/esm/stack-parsers.js.map +1 -1
- package/esm/transports/base.d.ts +6 -6
- package/esm/transports/base.d.ts.map +1 -1
- package/esm/transports/base.js +19 -70
- package/esm/transports/base.js.map +1 -1
- package/esm/transports/fetch.d.ts.map +1 -1
- package/esm/transports/fetch.js +2 -0
- package/esm/transports/fetch.js.map +1 -1
- package/esm/transports/index.d.ts.map +1 -1
- package/esm/transports/index.js.map +1 -1
- package/esm/transports/utils.d.ts.map +1 -1
- package/esm/transports/utils.js +2 -3
- package/esm/transports/utils.js.map +1 -1
- package/esm/transports/xhr.d.ts.map +1 -1
- package/esm/transports/xhr.js +2 -0
- package/esm/transports/xhr.js.map +1 -1
- package/esm/version.d.ts.map +1 -1
- package/esm/version.js.map +1 -1
- package/package.json +16 -14
- package/types/backend.d.ts +43 -0
- package/types/backend.d.ts.map +1 -0
- package/types/client.d.ts +33 -0
- package/types/client.d.ts.map +1 -0
- package/types/eventbuilder.d.ts +39 -0
- package/types/eventbuilder.d.ts.map +1 -0
- package/types/exports.d.ts +10 -0
- package/types/exports.d.ts.map +1 -0
- package/types/helpers.d.ts +52 -0
- package/types/helpers.d.ts.map +1 -0
- package/types/index.d.ts +16 -0
- package/types/index.d.ts.map +1 -0
- package/types/integrations/breadcrumbs.d.ts +47 -0
- package/types/integrations/breadcrumbs.d.ts.map +1 -0
- package/types/integrations/dedupe.d.ts +21 -0
- package/types/integrations/dedupe.d.ts.map +1 -0
- package/types/integrations/globalhandlers.d.ts +30 -0
- package/types/integrations/globalhandlers.d.ts.map +1 -0
- package/types/integrations/index.d.ts +7 -0
- package/types/integrations/index.d.ts.map +1 -0
- package/types/integrations/linkederrors.d.ts +42 -0
- package/types/integrations/linkederrors.d.ts.map +1 -0
- package/types/integrations/trycatch.d.ts +33 -0
- package/types/integrations/trycatch.d.ts.map +1 -0
- package/types/integrations/useragent.d.ts +17 -0
- package/types/integrations/useragent.d.ts.map +1 -0
- package/types/sdk.d.ts +112 -0
- package/types/sdk.d.ts.map +1 -0
- package/types/stack-parsers.d.ts +7 -0
- package/types/stack-parsers.d.ts.map +1 -0
- package/types/transports/base.d.ts +65 -0
- package/types/transports/base.d.ts.map +1 -0
- package/types/transports/fetch.d.ts +17 -0
- package/types/transports/fetch.d.ts.map +1 -0
- package/types/transports/index.d.ts +4 -0
- package/types/transports/index.d.ts.map +1 -0
- package/types/transports/utils.d.ts +48 -0
- package/types/transports/utils.d.ts.map +1 -0
- package/types/transports/xhr.d.ts +11 -0
- package/types/transports/xhr.d.ts.map +1 -0
- package/types/version.d.ts +2 -0
- package/types/version.d.ts.map +1 -0
- package/build/bundle.es6.js.map +0 -1
- package/build/bundle.es6.min.js +0 -3
- package/build/bundle.es6.min.js.map +0 -1
- package/build/bundle.js.map +0 -1
- package/build/bundle.min.js +0 -3
- package/build/bundle.min.js.map +0 -1
- package/dist/parsers.d.ts +0 -21
- package/dist/parsers.d.ts.map +0 -1
- package/dist/parsers.js +0 -108
- package/dist/parsers.js.map +0 -1
- package/esm/parsers.d.ts +0 -21
- package/esm/parsers.d.ts.map +0 -1
- package/esm/parsers.js +0 -103
- package/esm/parsers.js.map +0 -1
package/dist/backend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM/E;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEnC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAElC,yDAAyD;IACzD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEvC,wDAAwD;IACxD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACxC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC7D;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAGnF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAI/G;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;CAsBvC"}
|
package/dist/backend.js
CHANGED
|
@@ -18,14 +18,14 @@ var BrowserBackend = /** @class */ (function (_super) {
|
|
|
18
18
|
* @inheritDoc
|
|
19
19
|
*/
|
|
20
20
|
BrowserBackend.prototype.eventFromException = function (exception, hint) {
|
|
21
|
-
return eventbuilder_1.eventFromException(
|
|
21
|
+
return eventbuilder_1.eventFromException(exception, hint, this._options.attachStacktrace);
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* @inheritDoc
|
|
25
25
|
*/
|
|
26
26
|
BrowserBackend.prototype.eventFromMessage = function (message, level, hint) {
|
|
27
27
|
if (level === void 0) { level = types_1.Severity.Info; }
|
|
28
|
-
return eventbuilder_1.eventFromMessage(
|
|
28
|
+
return eventbuilder_1.eventFromMessage(message, level, hint, this._options.attachStacktrace);
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* @inheritDoc
|
package/dist/backend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":";;AAAA,qCAA2C;AAC3C,uCAA+E;AAC/E,uCAA8C;AAE9C,+CAAsE;AACtE,2CAA4D;AA4B5D;;;GAGG;AACH;IAAoC,0CAA2B;IAA/D;;IAuCA,CAAC;IAtCC;;OAEG;IACI,2CAAkB,GAAzB,UAA0B,SAAkB,EAAE,IAAgB;QAC5D,OAAO,iCAAkB,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7E,CAAC;IACD;;OAEG;IACI,yCAAgB,GAAvB,UAAwB,OAAe,EAAE,KAA+B,EAAE,IAAgB;QAAjD,sBAAA,EAAA,QAAkB,gBAAQ,CAAC,IAAI;QACtE,OAAO,+BAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAChF,CAAC;IAED;;OAEG;IACO,wCAAe,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACtB,6DAA6D;YAC7D,OAAO,iBAAM,eAAe,WAAE,CAAC;SAChC;QAED,IAAM,gBAAgB,yCACjB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,KACjC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EACtB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAC5B,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAClD,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,GACnC,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;YAC3B,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;SACtD;QACD,IAAI,qBAAa,EAAE,EAAE;YACnB,OAAO,IAAI,2BAAc,CAAC,gBAAgB,CAAC,CAAC;SAC7C;QACD,OAAO,IAAI,yBAAY,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IACH,qBAAC;AAAD,CAAC,AAvCD,CAAoC,kBAAW,GAuC9C;AAvCY,wCAAc","sourcesContent":["import { BaseBackend } from '@sentry/core';\nimport { Event, EventHint, Options, Severity, Transport } from '@sentry/types';\nimport { supportsFetch } from '@sentry/utils';\n\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { FetchTransport, XHRTransport } from './transports';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see BrowserClient for more information.\n */\nexport interface BrowserOptions extends Options {\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.denyUrls}.\n * By default, all errors will be sent.\n */\n allowUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To allow certain errors instead, use {@link Options.allowUrls}.\n * By default, all errors will be sent.\n */\n denyUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.allowUrls} instead. */\n whitelistUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.denyUrls} instead. */\n blacklistUrls?: Array<string | RegExp>;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class BrowserBackend extends BaseBackend<BrowserOptions> {\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(exception, hint, this._options.attachStacktrace);\n }\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const transportOptions = {\n ...this._options.transportOptions,\n dsn: this._options.dsn,\n tunnel: this._options.tunnel,\n sendClientReports: this._options.sendClientReports,\n _metadata: this._options._metadata,\n };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n if (supportsFetch()) {\n return new FetchTransport(transportOptions);\n }\n return new XHRTransport(transportOptions);\n }\n}\n"]}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAsB,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGpE;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,cAAc,EAAE,cAAc,CAAC;IAC3E;;;;OAIG;gBACgB,OAAO,GAAE,cAAmB;IAgB/C;;;;OAIG;IACI,gBAAgB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI;IAkBhE;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAKjG;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAOzC"}
|
package/dist/client.js
CHANGED
|
@@ -48,7 +48,7 @@ var BrowserClient = /** @class */ (function (_super) {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
if (!this._isEnabled()) {
|
|
51
|
-
utils_1.logger.error('Trying to call showReportDialog with Sentry Client disabled');
|
|
51
|
+
utils_1.isDebugBuild() && utils_1.logger.error('Trying to call showReportDialog with Sentry Client disabled');
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
helpers_1.injectReportDialog(tslib_1.__assign(tslib_1.__assign({}, options), { dsn: options.dsn || this.getDsn() }));
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;AAAA,qCAA8D;AAE9D,uCAAsE;AAEtE,qCAA2D;AAC3D,qCAAoE;AACpE,+CAA6C;AAE7C;;;;;GAKG;AACH;IAAmC,yCAA0C;IAC3E;;;;OAIG;IACH,uBAAmB,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;QAA/C,iBAcC;QAbC,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,CAAC,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;YAC/C,IAAI,EAAE,2BAA2B;YACjC,QA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entry/types';\nimport { getGlobalObject, isDebugBuild, logger } from '@sentry/utils';\n\nimport { BrowserBackend, BrowserOptions } from './backend';\nimport { injectReportDialog, ReportDialogOptions } from './helpers';\nimport { Breadcrumbs } from './integrations';\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserOptions = {}) {\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || {\n name: 'sentry.javascript.browser',\n packages: [\n {\n name: 'npm:@sentry/browser',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n\n super(BrowserBackend, options);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n const document = getGlobalObject<Window>().document;\n if (!document) {\n return;\n }\n\n if (!this._isEnabled()) {\n isDebugBuild() && logger.error('Trying to call showReportDialog with Sentry Client disabled');\n return;\n }\n\n injectReportDialog({\n ...options,\n dsn: options.dsn || this.getDsn(),\n });\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * @inheritDoc\n */\n protected _sendEvent(event: Event): void {\n const integration = this.getIntegration(Breadcrumbs);\n if (integration) {\n integration.addSentryBreadcrumb(event);\n }\n super._sendEvent(event);\n }\n}\n"]}
|
package/dist/eventbuilder.d.ts
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
import { Event, EventHint,
|
|
1
|
+
import { Event, EventHint, Exception, Severity, StackFrame } from '@sentry/types';
|
|
2
|
+
/**
|
|
3
|
+
* This function creates an exception from an TraceKitStackTrace
|
|
4
|
+
* @param stacktrace TraceKitStackTrace that will be converted to an exception
|
|
5
|
+
* @hidden
|
|
6
|
+
*/
|
|
7
|
+
export declare function exceptionFromError(ex: Error): Exception;
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export declare function eventFromPlainObject(exception: Record<string, unknown>, syntheticException?: Error, isUnhandledRejection?: boolean): Event;
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
export declare function eventFromError(ex: Error): Event;
|
|
16
|
+
/** Parses stack frames from an error */
|
|
17
|
+
export declare function parseStackFrames(ex: Error & {
|
|
18
|
+
framesToPop?: number;
|
|
19
|
+
stacktrace?: string;
|
|
20
|
+
}): StackFrame[];
|
|
2
21
|
/**
|
|
3
22
|
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
4
23
|
* @hidden
|
|
5
24
|
*/
|
|
6
|
-
export declare function eventFromException(
|
|
25
|
+
export declare function eventFromException(exception: unknown, hint?: EventHint, attachStacktrace?: boolean): PromiseLike<Event>;
|
|
7
26
|
/**
|
|
8
27
|
* Builds and Event from a Message
|
|
9
28
|
* @hidden
|
|
10
29
|
*/
|
|
11
|
-
export declare function eventFromMessage(
|
|
30
|
+
export declare function eventFromMessage(message: string, level?: Severity, hint?: EventHint, attachStacktrace?: boolean): PromiseLike<Event>;
|
|
12
31
|
/**
|
|
13
32
|
* @hidden
|
|
14
33
|
*/
|
|
15
|
-
export declare function eventFromUnknownInput(exception: unknown, syntheticException?: Error,
|
|
16
|
-
isRejection?: boolean;
|
|
17
|
-
attachStacktrace?: boolean;
|
|
18
|
-
}): Event;
|
|
34
|
+
export declare function eventFromUnknownInput(exception: unknown, syntheticException?: Error, attachStacktrace?: boolean, isUnhandledRejection?: boolean): Event;
|
|
19
35
|
/**
|
|
20
36
|
* @hidden
|
|
21
37
|
*/
|
|
22
|
-
export declare function eventFromString(input: string, syntheticException?: Error,
|
|
23
|
-
attachStacktrace?: boolean;
|
|
24
|
-
}): Event;
|
|
38
|
+
export declare function eventFromString(input: string, syntheticException?: Error, attachStacktrace?: boolean): Event;
|
|
25
39
|
//# sourceMappingURL=eventbuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventbuilder.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"eventbuilder.d.ts","sourceRoot":"","sources":["../../src/eventbuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAwBlF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,KAAK,GAAG,SAAS,CAkBvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,kBAAkB,CAAC,EAAE,KAAK,EAC1B,oBAAoB,CAAC,EAAE,OAAO,GAC7B,KAAK,CAyBP;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,CAM/C;AAED,wCAAwC;AACxC,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,KAAK,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,EAAE,CAqBxG;AAmCD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,OAAO,EAClB,IAAI,CAAC,EAAE,SAAS,EAChB,gBAAgB,CAAC,EAAE,OAAO,GACzB,WAAW,CAAC,KAAK,CAAC,CASpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,QAAwB,EAC/B,IAAI,CAAC,EAAE,SAAS,EAChB,gBAAgB,CAAC,EAAE,OAAO,GACzB,WAAW,CAAC,KAAK,CAAC,CAQpB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,OAAO,EAClB,kBAAkB,CAAC,EAAE,KAAK,EAC1B,gBAAgB,CAAC,EAAE,OAAO,EAC1B,oBAAoB,CAAC,EAAE,OAAO,GAC7B,KAAK,CAiEP;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAa5G"}
|
package/dist/eventbuilder.js
CHANGED
|
@@ -2,16 +2,116 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
2
2
|
var tslib_1 = require("tslib");
|
|
3
3
|
var types_1 = require("@sentry/types");
|
|
4
4
|
var utils_1 = require("@sentry/utils");
|
|
5
|
-
var
|
|
5
|
+
var stack_parsers_1 = require("./stack-parsers");
|
|
6
|
+
/**
|
|
7
|
+
* This function creates an exception from an TraceKitStackTrace
|
|
8
|
+
* @param stacktrace TraceKitStackTrace that will be converted to an exception
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
function exceptionFromError(ex) {
|
|
12
|
+
// Get the frames first since Opera can lose the stack if we touch anything else first
|
|
13
|
+
var frames = parseStackFrames(ex);
|
|
14
|
+
var exception = {
|
|
15
|
+
type: ex && ex.name,
|
|
16
|
+
value: extractMessage(ex),
|
|
17
|
+
};
|
|
18
|
+
if (frames.length) {
|
|
19
|
+
exception.stacktrace = { frames: frames };
|
|
20
|
+
}
|
|
21
|
+
if (exception.type === undefined && exception.value === '') {
|
|
22
|
+
exception.value = 'Unrecoverable error caught';
|
|
23
|
+
}
|
|
24
|
+
return exception;
|
|
25
|
+
}
|
|
26
|
+
exports.exceptionFromError = exceptionFromError;
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
function eventFromPlainObject(exception, syntheticException, isUnhandledRejection) {
|
|
31
|
+
var event = {
|
|
32
|
+
exception: {
|
|
33
|
+
values: [
|
|
34
|
+
{
|
|
35
|
+
type: utils_1.isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',
|
|
36
|
+
value: "Non-Error " + (isUnhandledRejection ? 'promise rejection' : 'exception') + " captured with keys: " + utils_1.extractExceptionKeysForMessage(exception),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
extra: {
|
|
41
|
+
__serialized__: utils_1.normalizeToSize(exception),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
if (syntheticException) {
|
|
45
|
+
var frames_1 = parseStackFrames(syntheticException);
|
|
46
|
+
if (frames_1.length) {
|
|
47
|
+
event.stacktrace = { frames: frames_1 };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return event;
|
|
51
|
+
}
|
|
52
|
+
exports.eventFromPlainObject = eventFromPlainObject;
|
|
53
|
+
/**
|
|
54
|
+
* @hidden
|
|
55
|
+
*/
|
|
56
|
+
function eventFromError(ex) {
|
|
57
|
+
return {
|
|
58
|
+
exception: {
|
|
59
|
+
values: [exceptionFromError(ex)],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.eventFromError = eventFromError;
|
|
64
|
+
/** Parses stack frames from an error */
|
|
65
|
+
function parseStackFrames(ex) {
|
|
66
|
+
// Access and store the stacktrace property before doing ANYTHING
|
|
67
|
+
// else to it because Opera is not very good at providing it
|
|
68
|
+
// reliably in other circumstances.
|
|
69
|
+
var stacktrace = ex.stacktrace || ex.stack || '';
|
|
70
|
+
var popSize = getPopSize(ex);
|
|
71
|
+
try {
|
|
72
|
+
return utils_1.createStackParser(stack_parsers_1.opera10StackParser, stack_parsers_1.opera11StackParser, stack_parsers_1.chromeStackParser, stack_parsers_1.winjsStackParser, stack_parsers_1.geckoStackParser)(stacktrace, popSize);
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
// no-empty
|
|
76
|
+
}
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
exports.parseStackFrames = parseStackFrames;
|
|
80
|
+
// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108
|
|
81
|
+
var reactMinifiedRegexp = /Minified React error #\d+;/i;
|
|
82
|
+
function getPopSize(ex) {
|
|
83
|
+
if (ex) {
|
|
84
|
+
if (typeof ex.framesToPop === 'number') {
|
|
85
|
+
return ex.framesToPop;
|
|
86
|
+
}
|
|
87
|
+
if (reactMinifiedRegexp.test(ex.message)) {
|
|
88
|
+
return 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* There are cases where stacktrace.message is an Event object
|
|
95
|
+
* https://github.com/getsentry/sentry-javascript/issues/1949
|
|
96
|
+
* In this specific case we try to extract stacktrace.message.error.message
|
|
97
|
+
*/
|
|
98
|
+
function extractMessage(ex) {
|
|
99
|
+
var message = ex && ex.message;
|
|
100
|
+
if (!message) {
|
|
101
|
+
return 'No error message';
|
|
102
|
+
}
|
|
103
|
+
if (message.error && typeof message.error.message === 'string') {
|
|
104
|
+
return message.error.message;
|
|
105
|
+
}
|
|
106
|
+
return message;
|
|
107
|
+
}
|
|
6
108
|
/**
|
|
7
109
|
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
|
8
110
|
* @hidden
|
|
9
111
|
*/
|
|
10
|
-
function eventFromException(
|
|
112
|
+
function eventFromException(exception, hint, attachStacktrace) {
|
|
11
113
|
var syntheticException = (hint && hint.syntheticException) || undefined;
|
|
12
|
-
var event = eventFromUnknownInput(exception, syntheticException,
|
|
13
|
-
attachStacktrace: options.attachStacktrace,
|
|
14
|
-
});
|
|
114
|
+
var event = eventFromUnknownInput(exception, syntheticException, attachStacktrace);
|
|
15
115
|
utils_1.addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }
|
|
16
116
|
event.level = types_1.Severity.Error;
|
|
17
117
|
if (hint && hint.event_id) {
|
|
@@ -24,12 +124,10 @@ exports.eventFromException = eventFromException;
|
|
|
24
124
|
* Builds and Event from a Message
|
|
25
125
|
* @hidden
|
|
26
126
|
*/
|
|
27
|
-
function eventFromMessage(
|
|
127
|
+
function eventFromMessage(message, level, hint, attachStacktrace) {
|
|
28
128
|
if (level === void 0) { level = types_1.Severity.Info; }
|
|
29
129
|
var syntheticException = (hint && hint.syntheticException) || undefined;
|
|
30
|
-
var event = eventFromString(message, syntheticException,
|
|
31
|
-
attachStacktrace: options.attachStacktrace,
|
|
32
|
-
});
|
|
130
|
+
var event = eventFromString(message, syntheticException, attachStacktrace);
|
|
33
131
|
event.level = level;
|
|
34
132
|
if (hint && hint.event_id) {
|
|
35
133
|
event.event_id = hint.event_id;
|
|
@@ -40,13 +138,12 @@ exports.eventFromMessage = eventFromMessage;
|
|
|
40
138
|
/**
|
|
41
139
|
* @hidden
|
|
42
140
|
*/
|
|
43
|
-
function eventFromUnknownInput(exception, syntheticException,
|
|
44
|
-
if (options === void 0) { options = {}; }
|
|
141
|
+
function eventFromUnknownInput(exception, syntheticException, attachStacktrace, isUnhandledRejection) {
|
|
45
142
|
var event;
|
|
46
143
|
if (utils_1.isErrorEvent(exception) && exception.error) {
|
|
47
144
|
// If it is an ErrorEvent with `error` property, extract it to get actual Error
|
|
48
145
|
var errorEvent = exception;
|
|
49
|
-
return
|
|
146
|
+
return eventFromError(errorEvent.error);
|
|
50
147
|
}
|
|
51
148
|
// If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name
|
|
52
149
|
// and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be
|
|
@@ -58,12 +155,12 @@ function eventFromUnknownInput(exception, syntheticException, options) {
|
|
|
58
155
|
if (utils_1.isDOMError(exception) || utils_1.isDOMException(exception)) {
|
|
59
156
|
var domException = exception;
|
|
60
157
|
if ('stack' in exception) {
|
|
61
|
-
event =
|
|
158
|
+
event = eventFromError(exception);
|
|
62
159
|
}
|
|
63
160
|
else {
|
|
64
161
|
var name_1 = domException.name || (utils_1.isDOMError(domException) ? 'DOMError' : 'DOMException');
|
|
65
162
|
var message = domException.message ? name_1 + ": " + domException.message : name_1;
|
|
66
|
-
event = eventFromString(message, syntheticException,
|
|
163
|
+
event = eventFromString(message, syntheticException, attachStacktrace);
|
|
67
164
|
utils_1.addExceptionTypeValue(event, message);
|
|
68
165
|
}
|
|
69
166
|
if ('code' in domException) {
|
|
@@ -73,14 +170,14 @@ function eventFromUnknownInput(exception, syntheticException, options) {
|
|
|
73
170
|
}
|
|
74
171
|
if (utils_1.isError(exception)) {
|
|
75
172
|
// we have a real Error object, do nothing
|
|
76
|
-
return
|
|
173
|
+
return eventFromError(exception);
|
|
77
174
|
}
|
|
78
175
|
if (utils_1.isPlainObject(exception) || utils_1.isEvent(exception)) {
|
|
79
176
|
// If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize
|
|
80
177
|
// it manually. This will allow us to group events based on top-level keys which is much better than creating a new
|
|
81
178
|
// group on any key/value change.
|
|
82
179
|
var objectException = exception;
|
|
83
|
-
event =
|
|
180
|
+
event = eventFromPlainObject(objectException, syntheticException, isUnhandledRejection);
|
|
84
181
|
utils_1.addExceptionMechanism(event, {
|
|
85
182
|
synthetic: true,
|
|
86
183
|
});
|
|
@@ -95,7 +192,7 @@ function eventFromUnknownInput(exception, syntheticException, options) {
|
|
|
95
192
|
// - a plain Object
|
|
96
193
|
//
|
|
97
194
|
// So bail out and capture it as a simple message:
|
|
98
|
-
event = eventFromString(exception, syntheticException,
|
|
195
|
+
event = eventFromString(exception, syntheticException, attachStacktrace);
|
|
99
196
|
utils_1.addExceptionTypeValue(event, "" + exception, undefined);
|
|
100
197
|
utils_1.addExceptionMechanism(event, {
|
|
101
198
|
synthetic: true,
|
|
@@ -106,15 +203,14 @@ exports.eventFromUnknownInput = eventFromUnknownInput;
|
|
|
106
203
|
/**
|
|
107
204
|
* @hidden
|
|
108
205
|
*/
|
|
109
|
-
function eventFromString(input, syntheticException,
|
|
110
|
-
if (options === void 0) { options = {}; }
|
|
206
|
+
function eventFromString(input, syntheticException, attachStacktrace) {
|
|
111
207
|
var event = {
|
|
112
208
|
message: input,
|
|
113
209
|
};
|
|
114
|
-
if (
|
|
115
|
-
var
|
|
116
|
-
if (
|
|
117
|
-
event.stacktrace = { frames:
|
|
210
|
+
if (attachStacktrace && syntheticException) {
|
|
211
|
+
var frames_2 = parseStackFrames(syntheticException);
|
|
212
|
+
if (frames_2.length) {
|
|
213
|
+
event.stacktrace = { frames: frames_2 };
|
|
118
214
|
}
|
|
119
215
|
}
|
|
120
216
|
return event;
|
package/dist/eventbuilder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventbuilder.js","sourceRoot":"","sources":["../src/eventbuilder.ts"],"names":[],"mappings":";;AAAA,uCAAoE;AACpE,uCAUuB;AAEvB,qCAAmF;AAEnF;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,OAAgB,EAAE,SAAkB,EAAE,IAAgB;IACvF,IAAM,kBAAkB,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,SAAS,CAAC;IAC1E,IAAM,KAAK,GAAG,qBAAqB,CAAC,SAAS,EAAE,kBAAkB,EAAE;QACjE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC3C,CAAC,CAAC;IACH,6BAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,iDAAiD;IAC/E,KAAK,CAAC,KAAK,GAAG,gBAAQ,CAAC,KAAK,CAAC;IAC7B,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;QACzB,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;KAChC;IACD,OAAO,2BAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CA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KAAK,EAAE,KAAG,SAAW,EAAE,SAAS,CAAC,CAAC;IACxD,6BAAqB,CAAC,KAAK,EAAE;QAC3B,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAxED,sDAwEC;AAED;;GAEG;AACH,SAAgB,eAAe,CAC7B,KAAa,EACb,kBAA0B,EAC1B,OAEM;IAFN,wBAAA,EAAA,YAEM;IAEN,IAAM,KAAK,GAAU;QACnB,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,IAAI,OAAO,CAAC,gBAAgB,IAAI,kBAAkB,EAAE;QAClD,IAAM,QAAM,GAAG,0BAAgB,CAAC,kBAAkB,CAAC,CAAC;QACpD,IAAI,QAAM,CAAC,MAAM,EAAE;YACjB,KAAK,CAAC,UAAU,GAAG,EAAE,MAAM,UAAA,EAAE,CAAC;SAC/B;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAnBD,0CAmBC","sourcesContent":["import { Event, EventHint, Options, Severity } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isEvent,\n isPlainObject,\n resolvedSyncPromise,\n} from '@sentry/utils';\n\nimport { eventFromError, eventFromPlainObject, parseStackFrames } from './parsers';\n\n/**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n * @hidden\n */\nexport function eventFromException(options: Options, exception: unknown, hint?: EventHint): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(exception, syntheticException, {\n attachStacktrace: options.attachStacktrace,\n });\n addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }\n event.level = Severity.Error;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nexport function eventFromMessage(\n options: Options,\n message: string,\n level: Severity = Severity.Info,\n hint?: EventHint,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(message, syntheticException, {\n attachStacktrace: options.attachStacktrace,\n });\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * @hidden\n */\nexport function eventFromUnknownInput(\n exception: unknown,\n syntheticException?: Error,\n options: {\n isRejection?: boolean;\n attachStacktrace?: boolean;\n } = {},\n): Event {\n let event: Event;\n\n if (isErrorEvent(exception as ErrorEvent) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n return eventFromError(errorEvent.error as Error);\n }\n\n // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name\n // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be\n // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`.\n //\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n // https://webidl.spec.whatwg.org/#es-DOMException-specialness\n if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {\n const domException = exception as DOMException;\n\n if ('stack' in (exception as Error)) {\n event = eventFromError(exception as Error);\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n event = eventFromString(message, syntheticException, options);\n addExceptionTypeValue(event, message);\n }\n if ('code' in domException) {\n event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };\n }\n\n return event;\n }\n if (isError(exception as Error)) {\n // we have a real Error object, do nothing\n return eventFromError(exception as Error);\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize\n // it manually. This will allow us to group events based on top-level keys which is much better than creating a new\n // group on any key/value change.\n const objectException = exception as Record<string, unknown>;\n event = eventFromPlainObject(objectException, syntheticException, options.isRejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n event = eventFromString(exception as string, syntheticException, options);\n addExceptionTypeValue(event, `${exception}`, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromString(\n input: string,\n syntheticException?: Error,\n options: {\n attachStacktrace?: boolean;\n } = {},\n): Event {\n const event: Event = {\n message: input,\n };\n\n if (options.attachStacktrace && syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"eventbuilder.js","sourceRoot":"","sources":["../../src/eventbuilder.ts"],"names":[],"mappings":";;AAAA,uCAAkF;AAClF,uCAauB;AAEvB,iDAMyB;AAEzB;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,EAAS;IAC1C,sFAAsF;IACtF,IAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAEpC,IAAM,SAAS,GAAc;QAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI;QACnB,KAAK,EAAE,cAAc,CAAC,EAAE,CAAC;KAC1B,CAAC;IAEF,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,SAAS,CAAC,UAAU,GAAG,EAAE,MAAM,QAAA,EAAE,CAAC;KACnC;IAED,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,EAAE,EAAE;QAC1D,SAAS,CAAC,KAAK,GAAG,4BAA4B,CAAC;KAChD;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAlBD,gDAkBC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAClC,S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AC,SAAmB,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;IACnF,6BAAqB,CAAC,KAAK,EAAE,KAAG,SAAW,EAAE,SAAS,CAAC,CAAC;IACxD,6BAAqB,CAAC,KAAK,EAAE;QAC3B,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAtED,sDAsEC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,KAAa,EAAE,kBAA0B,EAAE,gBAA0B;IACnG,IAAM,KAAK,GAAU;QACnB,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,IAAI,gBAAgB,IAAI,kBAAkB,EAAE;QAC1C,IAAM,QAAM,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;QACpD,IAAI,QAAM,CAAC,MAAM,EAAE;YACjB,KAAK,CAAC,UAAU,GAAG,EAAE,MAAM,UAAA,EAAE,CAAC;SAC/B;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,0CAaC","sourcesContent":["import { Event, EventHint, Exception, Severity, StackFrame } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n createStackParser,\n extractExceptionKeysForMessage,\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isEvent,\n isPlainObject,\n normalizeToSize,\n resolvedSyncPromise,\n} from '@sentry/utils';\n\nimport {\n chromeStackParser,\n geckoStackParser,\n opera10StackParser,\n opera11StackParser,\n winjsStackParser,\n} from './stack-parsers';\n\n/**\n * This function creates an exception from an TraceKitStackTrace\n * @param stacktrace TraceKitStackTrace that will be converted to an exception\n * @hidden\n */\nexport function exceptionFromError(ex: Error): Exception {\n // Get the frames first since Opera can lose the stack if we touch anything else first\n const frames = parseStackFrames(ex);\n\n const exception: Exception = {\n type: ex && ex.name,\n value: extractMessage(ex),\n };\n\n if (frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\n/**\n * @hidden\n */\nexport function eventFromPlainObject(\n exception: Record<string, unknown>,\n syntheticException?: Error,\n isUnhandledRejection?: boolean,\n): Event {\n const event: Event = {\n exception: {\n values: [\n {\n type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',\n value: `Non-Error ${\n isUnhandledRejection ? 'promise rejection' : 'exception'\n } captured with keys: ${extractExceptionKeysForMessage(exception)}`,\n },\n ],\n },\n extra: {\n __serialized__: normalizeToSize(exception),\n },\n };\n\n if (syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromError(ex: Error): Event {\n return {\n exception: {\n values: [exceptionFromError(ex)],\n },\n };\n}\n\n/** Parses stack frames from an error */\nexport function parseStackFrames(ex: Error & { framesToPop?: number; stacktrace?: string }): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || '';\n\n const popSize = getPopSize(ex);\n\n try {\n return createStackParser(\n opera10StackParser,\n opera11StackParser,\n chromeStackParser,\n winjsStackParser,\n geckoStackParser,\n )(stacktrace, popSize);\n } catch (e) {\n // no-empty\n }\n\n return [];\n}\n\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\nfunction getPopSize(ex: Error & { framesToPop?: number }): number {\n if (ex) {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n\n if (reactMinifiedRegexp.test(ex.message)) {\n return 1;\n }\n }\n\n return 0;\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\nfunction extractMessage(ex: Error & { message: { error?: Error } }): string {\n const message = ex && ex.message;\n if (!message) {\n return 'No error message';\n }\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message;\n }\n return message;\n}\n\n/**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n * @hidden\n */\nexport function eventFromException(\n exception: unknown,\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(exception, syntheticException, attachStacktrace);\n addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }\n event.level = Severity.Error;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nexport function eventFromMessage(\n message: string,\n level: Severity = Severity.Info,\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(message, syntheticException, attachStacktrace);\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * @hidden\n */\nexport function eventFromUnknownInput(\n exception: unknown,\n syntheticException?: Error,\n attachStacktrace?: boolean,\n isUnhandledRejection?: boolean,\n): Event {\n let event: Event;\n\n if (isErrorEvent(exception as ErrorEvent) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n return eventFromError(errorEvent.error as Error);\n }\n\n // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name\n // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be\n // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`.\n //\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n // https://webidl.spec.whatwg.org/#es-DOMException-specialness\n if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {\n const domException = exception as DOMException;\n\n if ('stack' in (exception as Error)) {\n event = eventFromError(exception as Error);\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n event = eventFromString(message, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, message);\n }\n if ('code' in domException) {\n event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };\n }\n\n return event;\n }\n if (isError(exception as Error)) {\n // we have a real Error object, do nothing\n return eventFromError(exception as Error);\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize\n // it manually. This will allow us to group events based on top-level keys which is much better than creating a new\n // group on any key/value change.\n const objectException = exception as Record<string, unknown>;\n event = eventFromPlainObject(objectException, syntheticException, isUnhandledRejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n event = eventFromString(exception as string, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, `${exception}`, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromString(input: string, syntheticException?: Error, attachStacktrace?: boolean): Event {\n const event: Event = {\n message: input,\n };\n\n if (attachStacktrace && syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n"]}
|
package/dist/exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,GACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/exports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":";AAAA,uCAeuB;AALrB,2BAAA,QAAQ,CAAA;AASV,qCAsBsB;AArBpB,yCAAA,uBAAuB,CAAA;AACvB,+BAAA,aAAa,CAAA;AACb,kCAAA,gBAAgB,CAAA;AAChB,8BAAA,YAAY,CAAA;AACZ,gCAAA,cAAc,CAAA;AACd,gCAAA,cAAc,CAAA;AACd,mCAAA,iBAAiB,CAAA;AACjB,+BAAA,aAAa,CAAA;AACb,qBAAA,GAAG,CAAA;AACH,0BAAA,QAAQ,CAAA;AACR,uBAAA,KAAK,CAAA;AACL,yBAAA,OAAO,CAAA;AACP,kCAAA,gBAAgB,CAAA;AAChB,6BAAA,WAAW,CAAA;AACX,4BAAA,UAAU,CAAA;AACV,0BAAA,QAAQ,CAAA;AACR,2BAAA,SAAS,CAAA;AACT,wBAAA,MAAM,CAAA;AACN,yBAAA,OAAO,CAAA;AACP,yBAAA,OAAO,CAAA;AACP,2BAAA,SAAS,CAAA;AAIX,mCAAyC;AAAhC,iCAAA,aAAa,CAAA;AACtB,qCAAoE;AAA3D,uCAAA,kBAAkB,CAAA;AAC3B,+CAAsE;AAA7D,4CAAA,kBAAkB,CAAA;AAAE,0CAAA,gBAAgB,CAAA;AAC7C,6BAAwH;AAA/G,oCAAA,mBAAmB,CAAA;AAAE,0BAAA,SAAS,CAAA;AAAE,qBAAA,IAAI,CAAA;AAAE,4BAAA,WAAW,CAAA;AAAE,uBAAA,MAAM,CAAA;AAAE,iCAAA,gBAAgB,CAAA;AAAE,sBAAA,KAAK,CAAA;AAAE,sBAAA,KAAK,CAAA;AAAE,qBAAA,IAAI,CAAA;AACxG,qCAAqC;AAA5B,6BAAA,QAAQ,CAAA","sourcesContent":["export {\n Breadcrumb,\n BreadcrumbHint,\n Request,\n SdkInfo,\n Event,\n EventHint,\n EventStatus,\n Exception,\n Response,\n Severity,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n} from '@sentry/types';\n\nexport { SeverityLevel } from '@sentry/utils';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n configureScope,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n makeMain,\n Scope,\n Session,\n startTransaction,\n SDK_VERSION,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n withScope,\n} from '@sentry/core';\n\nexport { BrowserOptions } from './backend';\nexport { BrowserClient } from './client';\nexport { injectReportDialog, ReportDialogOptions } from './helpers';\nexport { eventFromException, eventFromMessage } from './eventbuilder';\nexport { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close, wrap } from './sdk';\nexport { SDK_NAME } from './version';\n"]}
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAwB,SAAS,EAAS,eAAe,EAAE,MAAM,eAAe,CAAC;AAejG;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAClB,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,SAAS,CAAC;CAClB,EACN,MAAM,CAAC,EAAE,eAAe,GAEvB,GAAG,CAyGL;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAElC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,MAAM,CAAC,IAAI,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI,CA6B1E"}
|
package/dist/helpers.js
CHANGED
|
@@ -132,15 +132,11 @@ function injectReportDialog(options) {
|
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
if (!options.eventId) {
|
|
135
|
-
|
|
136
|
-
utils_1.logger.error("Missing eventId option in showReportDialog call");
|
|
137
|
-
}
|
|
135
|
+
utils_1.isDebugBuild() && utils_1.logger.error('Missing eventId option in showReportDialog call');
|
|
138
136
|
return;
|
|
139
137
|
}
|
|
140
138
|
if (!options.dsn) {
|
|
141
|
-
|
|
142
|
-
utils_1.logger.error("Missing dsn option in showReportDialog call");
|
|
143
|
-
}
|
|
139
|
+
utils_1.isDebugBuild() && utils_1.logger.error('Missing dsn option in showReportDialog call');
|
|
144
140
|
return;
|
|
145
141
|
}
|
|
146
142
|
var script = global.document.createElement('script');
|
package/dist/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;AAAA,qCAAoF;AAEpF,uCASuB;AAEvB,IAAM,MAAM,GAAG,uBAAe,EAAU,CAAC;AACzC,IAAI,aAAa,GAAW,CAAC,CAAC;AAE9B;;GAEG;AACH,SAAgB,mBAAmB;IACjC,OAAO,aAAa,GA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C","sourcesContent":["import { captureException, getReportDialogEndpoint, withScope } from '@sentry/core';\nimport { DsnLike, Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n addNonEnumerableProperty,\n getGlobalObject,\n getOriginalFunction,\n isDebugBuild,\n logger,\n markFunctionWrapped,\n} from '@sentry/utils';\n\nconst global = getGlobalObject<Window>();\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError += 1;\n setTimeout(() => {\n ignoreOnError -= 1;\n });\n}\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap(\n fn: WrappedFunction,\n options: {\n mechanism?: Mechanism;\n } = {},\n before?: WrappedFunction,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n // for future readers what this does is wrap a function and then create\n // a bi-directional wrapping between them.\n //\n // example: wrapped = wrap(original);\n // original.__sentry_wrapped__ -> wrapped\n // wrapped.__sentry_original__ -> original\n\n if (typeof fn !== 'function') {\n return fn;\n }\n\n try {\n // if we're dealing with a function that was previously wrapped, return\n // the original wrapper.\n const wrapper = fn.__sentry_wrapped__;\n if (wrapper) {\n return wrapper;\n }\n\n // We don't wanna wrap it twice\n if (getOriginalFunction(fn)) {\n return fn;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n /* eslint-disable prefer-rest-params */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sentryWrapped: WrappedFunction = function (this: any): void {\n const args = Array.prototype.slice.call(arguments);\n\n try {\n if (before && typeof before === 'function') {\n before.apply(this, arguments);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const wrappedArguments = args.map((arg: any) => wrap(arg, options));\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope((scope: Scope) => {\n scope.addEventProcessor((event: SentryEvent) => {\n if (options.mechanism) {\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, options.mechanism);\n }\n\n event.extra = {\n ...event.extra,\n arguments: args,\n };\n\n return event;\n });\n\n captureException(ex);\n });\n\n throw ex;\n }\n };\n /* eslint-enable prefer-rest-params */\n\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property] = fn[property];\n }\n }\n } catch (_oO) {} // eslint-disable-line no-empty\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n markFunctionWrapped(sentryWrapped, fn);\n\n addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);\n\n // Restore original function name (not all browsers allow that)\n try {\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') as PropertyDescriptor;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n // eslint-disable-next-line no-empty\n } catch (_oO) {}\n\n return sentryWrapped;\n}\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * Injects the Report Dialog script\n * @hidden\n */\nexport function injectReportDialog(options: ReportDialogOptions = {}): void {\n if (!global.document) {\n return;\n }\n\n if (!options.eventId) {\n isDebugBuild() && logger.error('Missing eventId option in showReportDialog call');\n return;\n }\n\n if (!options.dsn) {\n isDebugBuild() && logger.error('Missing dsn option in showReportDialog call');\n return;\n }\n\n const script = global.document.createElement('script');\n script.async = true;\n script.src = getReportDialogEndpoint(options.dsn, options);\n\n if (options.onLoad) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n script.onload = options.onLoad;\n }\n\n const injectionPoint = global.document.head || global.document.body;\n\n if (injectionPoint) {\n injectionPoint.appendChild(script);\n }\n}\n"]}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,KAAK,mBAAmB,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAU3C,QAAA,MAAM,YAAY;;;;;;;;;CAIjB,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,oDAA0B;AAE1B,qCAAgE;AAChE,uCAAgD;AAEhD,oDAAsD;AACtD,yCAA2C;AAgBJ,gCAAU;AAdjD,IAAI,kBAAkB,GAAG,EAAE,CAAC;AAE5B,gGAAgG;AAChG,IAAM,OAAO,GAAG,uBAAe,EAAU,CAAC;AAC1C,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE;IACjD,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;CAClD;AAED,IAAM,YAAY,0DACb,kBAAkB,GAClB,mBAAgB,GAChB,mBAAmB,CACvB,CAAC;AAEuB,oCAAY","sourcesContent":["export * from './exports';\n\nimport { Integrations as CoreIntegrations } from '@sentry/core';\nimport { getGlobalObject } from '@sentry/utils';\n\nimport * as BrowserIntegrations from './integrations';\nimport * as Transports from './transports';\n\nlet windowIntegrations = {};\n\n// This block is needed to add compatibility with the integrations packages when used with a CDN\nconst _window = getGlobalObject<Window>();\nif (_window.Sentry && _window.Sentry.Integrations) {\n windowIntegrations = _window.Sentry.Integrations;\n}\n\nconst INTEGRATIONS = {\n ...windowIntegrations,\n ...CoreIntegrations,\n ...BrowserIntegrations,\n};\n\nexport { INTEGRATIONS as Integrations, Transports };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../../src/integrations/breadcrumbs.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAY,MAAM,eAAe,CAAC;AAW7D,YAAY;AACZ,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,GAAG;QAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IACzD,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;CACd;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GAAG,UAAU,CAAC,QAAQ,CAAC;KAC5B;IAED,oBAAa,EAAE,CAAC,aAAa,CAAC;QAC5B,QAAQ,EAAE,YAAY;QACtB,IAAI,EAAE;YACJ,IAAI,MAAA;YACJ,EAAE,IAAA;SACH;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable max-lines */\nimport { getCurrentHub } from '@sentry/core';\nimport { Event, Integration, Severity } from '@sentry/types';\nimport {\n addInstrumentationHandler,\n getEventDescription,\n getGlobalObject,\n htmlTreeAsString,\n parseUrl,\n safeJoin,\n severityFromString,\n} from '@sentry/utils';\n\n/** JSDoc */\ninterface BreadcrumbsOptions {\n console: boolean;\n dom: boolean | { serializeAttribute: string | string[] };\n fetch: boolean;\n history: boolean;\n sentry: boolean;\n xhr: boolean;\n}\n\n/**\n * Default Breadcrumbs instrumentations\n * TODO: Deprecated - with v6, this will be renamed to `Instrument`\n */\nexport class Breadcrumbs implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Breadcrumbs';\n\n /**\n * @inheritDoc\n */\n public name: string = Breadcrumbs.id;\n\n /** JSDoc */\n private readonly _options: BreadcrumbsOptions;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: Partial<BreadcrumbsOptions>) {\n this._options = {\n console: true,\n dom: true,\n fetch: true,\n history: true,\n sentry: true,\n xhr: true,\n ...options,\n };\n }\n\n /**\n * Create a breadcrumb of `sentry` from the events themselves\n */\n public addSentryBreadcrumb(event: Event): void {\n if (!this._options.sentry) {\n return;\n }\n getCurrentHub().addBreadcrumb(\n {\n category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,\n event_id: event.event_id,\n level: event.level,\n message: getEventDescription(event),\n },\n {\n event,\n },\n );\n }\n\n /**\n * Instrument browser built-ins w/ breadcrumb capturing\n * - Console API\n * - DOM API (click/typing)\n * - XMLHttpRequest API\n * - Fetch API\n * - History API\n */\n public setupOnce(): void {\n if (this._options.console) {\n addInstrumentationHandler('console', _consoleBreadcrumb);\n }\n if (this._options.dom) {\n addInstrumentationHandler('dom', _domBreadcrumb(this._options.dom));\n }\n if (this._options.xhr) {\n addInstrumentationHandler('xhr', _xhrBreadcrumb);\n }\n if (this._options.fetch) {\n addInstrumentationHandler('fetch', _fetchBreadcrumb);\n }\n if (this._options.history) {\n addInstrumentationHandler('history', _historyBreadcrumb);\n }\n }\n}\n\n/**\n * A HOC that creaes a function that creates breadcrumbs from DOM API calls.\n * This is a HOC so that we get access to dom options in the closure.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: { [key: string]: any }) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _innerDomBreadcrumb(handlerData: { [key: string]: any }): void {\n let target;\n let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;\n\n if (typeof keyAttrs === 'string') {\n keyAttrs = [keyAttrs];\n }\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n target = handlerData.event.target\n ? htmlTreeAsString(handlerData.event.target as Node, keyAttrs)\n : htmlTreeAsString(handlerData.event as unknown as Node, keyAttrs);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n getCurrentHub().addBreadcrumb(\n {\n category: `ui.${handlerData.name}`,\n message: target,\n },\n {\n event: handlerData.event,\n name: handlerData.name,\n global: handlerData.global,\n },\n );\n }\n\n return _innerDomBreadcrumb;\n}\n\n/**\n * Creates breadcrumbs from console API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _consoleBreadcrumb(handlerData: { [key: string]: any }): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: handlerData.args,\n logger: 'console',\n },\n level: severityFromString(handlerData.level),\n message: safeJoin(handlerData.args, ' '),\n };\n\n if (handlerData.level === 'assert') {\n if (handlerData.args[0] === false) {\n breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;\n breadcrumb.data.arguments = handlerData.args.slice(1);\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n getCurrentHub().addBreadcrumb(breadcrumb, {\n input: handlerData.args,\n level: handlerData.level,\n });\n}\n\n/**\n * Creates breadcrumbs from XHR API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _xhrBreadcrumb(handlerData: { [key: string]: any }): void {\n if (handlerData.endTimestamp) {\n // We only capture complete, non-sentry requests\n if (handlerData.xhr.__sentry_own_request__) {\n return;\n }\n\n const { method, url, status_code, body } = handlerData.xhr.__sentry_xhr__ || {};\n\n getCurrentHub().addBreadcrumb(\n {\n category: 'xhr',\n data: {\n method,\n url,\n status_code,\n },\n type: 'http',\n },\n {\n xhr: handlerData.xhr,\n input: body,\n },\n );\n\n return;\n }\n}\n\n/**\n * Creates breadcrumbs from fetch API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _fetchBreadcrumb(handlerData: { [key: string]: any }): void {\n // We only capture complete fetch requests\n if (!handlerData.endTimestamp) {\n return;\n }\n\n if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {\n // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)\n return;\n }\n\n if (handlerData.error) {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: handlerData.fetchData,\n level: Severity.Error,\n type: 'http',\n },\n {\n data: handlerData.error,\n input: handlerData.args,\n },\n );\n } else {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: {\n ...handlerData.fetchData,\n status_code: handlerData.response.status,\n },\n type: 'http',\n },\n {\n input: handlerData.args,\n response: handlerData.response,\n },\n );\n }\n}\n\n/**\n * Creates breadcrumbs from history API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _historyBreadcrumb(handlerData: { [key: string]: any }): void {\n const global = getGlobalObject<Window>();\n let from = handlerData.from;\n let to = handlerData.to;\n const parsedLoc = parseUrl(global.location.href);\n let parsedFrom = parseUrl(from);\n const parsedTo = parseUrl(to);\n\n // Initial pushState doesn't provide `from` information\n if (!parsedFrom.path) {\n parsedFrom = parsedLoc;\n }\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {\n to = parsedTo.relative;\n }\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {\n from = parsedFrom.relative;\n }\n\n getCurrentHub().addBreadcrumb({\n category: 'navigation',\n data: {\n from,\n to,\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../../src/integrations/breadcrumbs.ts"],"names":[],"mappings":";;AAAA,+DAA+D;AAC/D,8BAA8B;AAC9B,qCAA6C;AAC7C,uCAA6D;AAC7D,uCAQuB;AAYvB;;;GAGG;AACH;IAcE;;OAEG;IACH,qBAAmB,OAAqC;QAXxD;;WAEG;QACI,SAAI,GAAW,WAAW,CAAC,EAAE,CAAC;QASnC,IAAI,CAAC,QAAQ,sBACX,OAAO,EAAE,IAAI,EACb,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,IAAI,EACX,OAAO,EAAE,IAAI,EACb,MAAM,EAAE,IAAI,EACZ,GAAG,EAAE,IAAI,IACN,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,yCAAmB,GAA1B,UAA2B,KAAY;QACrC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,OAAO;SACR;QACD,oBAAa,EAAE,CAAC,aAAa,CAC3B;YACE,QAAQ,EAAE,aAAU,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAE;YAC5E,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,KAAK,EAAE,KAAK,CAAC,KA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EAAE;QACpF,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;KAC5B;IAED,oBAAa,EAAE,CAAC,aAAa,CAAC;QAC5B,QAAQ,EAAE,YAAY;QACtB,IAAI,EAAE;YACJ,IAAI,MAAA;YACJ,EAAE,IAAA;SACH;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable max-lines */\nimport { getCurrentHub } from '@sentry/core';\nimport { Event, Integration, Severity } from '@sentry/types';\nimport {\n addInstrumentationHandler,\n getEventDescription,\n getGlobalObject,\n htmlTreeAsString,\n parseUrl,\n safeJoin,\n severityFromString,\n} from '@sentry/utils';\n\n/** JSDoc */\ninterface BreadcrumbsOptions {\n console: boolean;\n dom: boolean | { serializeAttribute: string | string[] };\n fetch: boolean;\n history: boolean;\n sentry: boolean;\n xhr: boolean;\n}\n\n/**\n * Default Breadcrumbs instrumentations\n * TODO: Deprecated - with v6, this will be renamed to `Instrument`\n */\nexport class Breadcrumbs implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Breadcrumbs';\n\n /**\n * @inheritDoc\n */\n public name: string = Breadcrumbs.id;\n\n /** JSDoc */\n private readonly _options: BreadcrumbsOptions;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: Partial<BreadcrumbsOptions>) {\n this._options = {\n console: true,\n dom: true,\n fetch: true,\n history: true,\n sentry: true,\n xhr: true,\n ...options,\n };\n }\n\n /**\n * Create a breadcrumb of `sentry` from the events themselves\n */\n public addSentryBreadcrumb(event: Event): void {\n if (!this._options.sentry) {\n return;\n }\n getCurrentHub().addBreadcrumb(\n {\n category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,\n event_id: event.event_id,\n level: event.level,\n message: getEventDescription(event),\n },\n {\n event,\n },\n );\n }\n\n /**\n * Instrument browser built-ins w/ breadcrumb capturing\n * - Console API\n * - DOM API (click/typing)\n * - XMLHttpRequest API\n * - Fetch API\n * - History API\n */\n public setupOnce(): void {\n if (this._options.console) {\n addInstrumentationHandler('console', _consoleBreadcrumb);\n }\n if (this._options.dom) {\n addInstrumentationHandler('dom', _domBreadcrumb(this._options.dom));\n }\n if (this._options.xhr) {\n addInstrumentationHandler('xhr', _xhrBreadcrumb);\n }\n if (this._options.fetch) {\n addInstrumentationHandler('fetch', _fetchBreadcrumb);\n }\n if (this._options.history) {\n addInstrumentationHandler('history', _historyBreadcrumb);\n }\n }\n}\n\n/**\n * A HOC that creaes a function that creates breadcrumbs from DOM API calls.\n * This is a HOC so that we get access to dom options in the closure.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: { [key: string]: any }) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _innerDomBreadcrumb(handlerData: { [key: string]: any }): void {\n let target;\n let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;\n\n if (typeof keyAttrs === 'string') {\n keyAttrs = [keyAttrs];\n }\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n target = handlerData.event.target\n ? htmlTreeAsString(handlerData.event.target as Node, keyAttrs)\n : htmlTreeAsString(handlerData.event as unknown as Node, keyAttrs);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n getCurrentHub().addBreadcrumb(\n {\n category: `ui.${handlerData.name}`,\n message: target,\n },\n {\n event: handlerData.event,\n name: handlerData.name,\n global: handlerData.global,\n },\n );\n }\n\n return _innerDomBreadcrumb;\n}\n\n/**\n * Creates breadcrumbs from console API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _consoleBreadcrumb(handlerData: { [key: string]: any }): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: handlerData.args,\n logger: 'console',\n },\n level: severityFromString(handlerData.level),\n message: safeJoin(handlerData.args, ' '),\n };\n\n if (handlerData.level === 'assert') {\n if (handlerData.args[0] === false) {\n breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;\n breadcrumb.data.arguments = handlerData.args.slice(1);\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n getCurrentHub().addBreadcrumb(breadcrumb, {\n input: handlerData.args,\n level: handlerData.level,\n });\n}\n\n/**\n * Creates breadcrumbs from XHR API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _xhrBreadcrumb(handlerData: { [key: string]: any }): void {\n if (handlerData.endTimestamp) {\n // We only capture complete, non-sentry requests\n if (handlerData.xhr.__sentry_own_request__) {\n return;\n }\n\n const { method, url, status_code, body } = handlerData.xhr.__sentry_xhr__ || {};\n\n getCurrentHub().addBreadcrumb(\n {\n category: 'xhr',\n data: {\n method,\n url,\n status_code,\n },\n type: 'http',\n },\n {\n xhr: handlerData.xhr,\n input: body,\n },\n );\n\n return;\n }\n}\n\n/**\n * Creates breadcrumbs from fetch API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _fetchBreadcrumb(handlerData: { [key: string]: any }): void {\n // We only capture complete fetch requests\n if (!handlerData.endTimestamp) {\n return;\n }\n\n if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {\n // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)\n return;\n }\n\n if (handlerData.error) {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: handlerData.fetchData,\n level: Severity.Error,\n type: 'http',\n },\n {\n data: handlerData.error,\n input: handlerData.args,\n },\n );\n } else {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: {\n ...handlerData.fetchData,\n status_code: handlerData.response.status,\n },\n type: 'http',\n },\n {\n input: handlerData.args,\n response: handlerData.response,\n },\n );\n }\n}\n\n/**\n * Creates breadcrumbs from history API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _historyBreadcrumb(handlerData: { [key: string]: any }): void {\n const global = getGlobalObject<Window>();\n let from = handlerData.from;\n let to = handlerData.to;\n const parsedLoc = parseUrl(global.location.href);\n let parsedFrom = parseUrl(from);\n const parsedTo = parseUrl(to);\n\n // Initial pushState doesn't provide `from` information\n if (!parsedFrom.path) {\n parsedFrom = parsedLoc;\n }\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {\n to = parsedTo.relative;\n }\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {\n from = parsedFrom.relative;\n }\n\n getCurrentHub().addBreadcrumb({\n category: 'navigation',\n data: {\n from,\n to,\n },\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedupe.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"dedupe.d.ts","sourceRoot":"","sources":["../../../src/integrations/dedupe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,cAAc,EAAa,GAAG,EAAE,WAAW,EAAc,MAAM,eAAe,CAAC;AAG/F,2BAA2B;AAC3B,qBAAa,MAAO,YAAW,WAAW;IACxC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAY;IAEpC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAa;IAEhC;;OAEG;IACH,OAAO,CAAC,cAAc,CAAC,CAAQ;IAE/B;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,IAAI;CAmB9G"}
|