@sentry/browser 6.19.7 → 7.0.0-beta.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/cjs/client.d.ts +63 -0
- package/cjs/client.d.ts.map +1 -0
- package/cjs/client.js +116 -0
- package/cjs/client.js.map +1 -0
- package/cjs/eventbuilder.d.ts +37 -0
- package/cjs/eventbuilder.d.ts.map +1 -0
- package/{dist → cjs}/eventbuilder.js +52 -53
- package/cjs/eventbuilder.js.map +1 -0
- package/cjs/exports.d.ts +11 -0
- package/cjs/exports.d.ts.map +1 -0
- package/{dist → cjs}/exports.js +21 -7
- package/cjs/exports.js.map +1 -0
- package/{dist → cjs}/flags.d.ts +0 -0
- package/{dist → cjs}/flags.d.ts.map +0 -0
- package/{dist → cjs}/flags.js +0 -0
- package/{dist → cjs}/flags.js.map +0 -0
- package/{dist → cjs}/helpers.d.ts +0 -5
- package/cjs/helpers.d.ts.map +1 -0
- package/{dist → cjs}/helpers.js +15 -49
- package/cjs/helpers.js.map +1 -0
- package/{dist → cjs}/index.d.ts +1 -2
- package/{dist → cjs}/index.d.ts.map +1 -1
- package/cjs/index.js +15 -0
- package/cjs/index.js.map +1 -0
- package/{dist → cjs}/integrations/breadcrumbs.d.ts +6 -7
- package/cjs/integrations/breadcrumbs.d.ts.map +1 -0
- package/{dist → cjs}/integrations/breadcrumbs.js +39 -57
- package/cjs/integrations/breadcrumbs.js.map +1 -0
- package/{dist → cjs}/integrations/dedupe.d.ts +0 -0
- package/{dist → cjs}/integrations/dedupe.d.ts.map +1 -1
- package/{dist → cjs}/integrations/dedupe.js +28 -30
- package/cjs/integrations/dedupe.js.map +1 -0
- package/{dist → cjs}/integrations/globalhandlers.d.ts +0 -0
- package/cjs/integrations/globalhandlers.d.ts.map +1 -0
- package/{dist → cjs}/integrations/globalhandlers.js +57 -57
- package/cjs/integrations/globalhandlers.js.map +1 -0
- package/{dist → cjs}/integrations/index.d.ts +0 -0
- package/{dist → cjs}/integrations/index.d.ts.map +0 -0
- package/{dist → cjs}/integrations/index.js +0 -0
- package/{dist → cjs}/integrations/index.js.map +0 -0
- package/{dist → cjs}/integrations/linkederrors.d.ts +3 -3
- package/cjs/integrations/linkederrors.d.ts.map +1 -0
- package/cjs/integrations/linkederrors.js +62 -0
- package/cjs/integrations/linkederrors.js.map +1 -0
- package/{dist → cjs}/integrations/trycatch.d.ts +0 -0
- package/{dist → cjs}/integrations/trycatch.d.ts.map +0 -0
- package/{dist → cjs}/integrations/trycatch.js +30 -40
- package/cjs/integrations/trycatch.js.map +1 -0
- package/{dist → cjs}/integrations/useragent.d.ts +0 -0
- package/{dist → cjs}/integrations/useragent.d.ts.map +0 -0
- package/cjs/integrations/useragent.js +40 -0
- package/cjs/integrations/useragent.js.map +1 -0
- package/{dist → cjs}/sdk.d.ts +3 -3
- package/cjs/sdk.d.ts.map +1 -0
- package/{dist → cjs}/sdk.js +47 -28
- package/cjs/sdk.js.map +1 -0
- package/cjs/stack-parsers.d.ts +9 -0
- package/cjs/stack-parsers.d.ts.map +1 -0
- package/{dist → cjs}/stack-parsers.js +45 -44
- package/cjs/stack-parsers.js.map +1 -0
- package/{esm/transports/new-fetch.d.ts → cjs/transports/fetch.d.ts} +3 -3
- package/cjs/transports/fetch.d.ts.map +1 -0
- package/cjs/transports/fetch.js +20 -0
- package/cjs/transports/fetch.js.map +1 -0
- package/cjs/transports/index.d.ts +3 -0
- package/cjs/transports/index.d.ts.map +1 -0
- package/cjs/transports/index.js +6 -0
- package/cjs/transports/index.js.map +1 -0
- package/{dist → cjs}/transports/utils.d.ts +0 -0
- package/{dist → cjs}/transports/utils.d.ts.map +1 -1
- package/{dist → cjs}/transports/utils.js +17 -17
- package/cjs/transports/utils.js.map +1 -0
- package/{types/transports/new-xhr.d.ts → cjs/transports/xhr.d.ts} +3 -3
- package/cjs/transports/xhr.d.ts.map +1 -0
- package/{esm/transports/new-xhr.js → cjs/transports/xhr.js} +14 -14
- package/cjs/transports/xhr.js.map +1 -0
- package/{dist → cjs}/version.d.ts +0 -0
- package/{dist → cjs}/version.d.ts.map +0 -0
- package/{dist → cjs}/version.js +0 -0
- package/{dist → cjs}/version.js.map +0 -0
- package/esm/client.d.ts +41 -11
- package/esm/client.d.ts.map +1 -1
- package/esm/client.js +79 -41
- package/esm/client.js.map +1 -1
- package/esm/eventbuilder.d.ts +10 -12
- package/esm/eventbuilder.d.ts.map +1 -1
- package/esm/eventbuilder.js +52 -53
- package/esm/eventbuilder.js.map +1 -1
- package/esm/exports.d.ts +7 -6
- package/esm/exports.d.ts.map +1 -1
- package/esm/exports.js +4 -4
- package/esm/exports.js.map +1 -1
- package/esm/flags.js +1 -1
- package/esm/flags.js.map +1 -1
- package/esm/helpers.d.ts +0 -5
- package/esm/helpers.d.ts.map +1 -1
- package/esm/helpers.js +15 -48
- package/esm/helpers.js.map +1 -1
- package/esm/index.d.ts +1 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -6
- package/esm/index.js.map +1 -1
- package/esm/integrations/breadcrumbs.d.ts +6 -7
- package/esm/integrations/breadcrumbs.d.ts.map +1 -1
- package/esm/integrations/breadcrumbs.js +38 -57
- package/esm/integrations/breadcrumbs.js.map +1 -1
- package/esm/integrations/dedupe.d.ts.map +1 -1
- package/esm/integrations/dedupe.js +26 -29
- package/esm/integrations/dedupe.js.map +1 -1
- package/esm/integrations/globalhandlers.d.ts.map +1 -1
- package/esm/integrations/globalhandlers.js +52 -53
- package/esm/integrations/globalhandlers.js.map +1 -1
- package/esm/integrations/linkederrors.d.ts +3 -3
- package/esm/integrations/linkederrors.d.ts.map +1 -1
- package/esm/integrations/linkederrors.js +24 -25
- package/esm/integrations/linkederrors.js.map +1 -1
- package/esm/integrations/trycatch.js +28 -39
- package/esm/integrations/trycatch.js.map +1 -1
- package/esm/integrations/useragent.js +17 -20
- package/esm/integrations/useragent.js.map +1 -1
- package/esm/sdk.d.ts +3 -3
- package/esm/sdk.d.ts.map +1 -1
- package/esm/sdk.js +44 -25
- package/esm/sdk.js.map +1 -1
- package/esm/stack-parsers.d.ts +8 -6
- package/esm/stack-parsers.d.ts.map +1 -1
- package/esm/stack-parsers.js +45 -44
- package/esm/stack-parsers.js.map +1 -1
- package/esm/transports/fetch.d.ts +7 -14
- package/esm/transports/fetch.d.ts.map +1 -1
- package/esm/transports/fetch.js +15 -77
- package/esm/transports/fetch.js.map +1 -1
- package/esm/transports/index.d.ts +2 -5
- package/esm/transports/index.d.ts.map +1 -1
- package/esm/transports/index.js +2 -5
- package/esm/transports/index.js.map +1 -1
- package/esm/transports/utils.d.ts.map +1 -1
- package/esm/transports/utils.js +16 -16
- package/esm/transports/utils.js.map +1 -1
- package/esm/transports/xhr.d.ts +9 -9
- package/esm/transports/xhr.d.ts.map +1 -1
- package/esm/transports/xhr.js +38 -59
- package/esm/transports/xhr.js.map +1 -1
- package/esm/version.js +1 -1
- package/esm/version.js.map +1 -1
- package/package.json +6 -7
- package/types/client.d.ts +41 -11
- package/types/client.d.ts.map +1 -1
- package/types/eventbuilder.d.ts +10 -12
- package/types/eventbuilder.d.ts.map +1 -1
- package/types/exports.d.ts +7 -6
- package/types/exports.d.ts.map +1 -1
- package/types/helpers.d.ts +0 -5
- package/types/helpers.d.ts.map +1 -1
- package/types/index.d.ts +1 -2
- package/types/index.d.ts.map +1 -1
- package/types/integrations/breadcrumbs.d.ts +6 -7
- package/types/integrations/breadcrumbs.d.ts.map +1 -1
- package/types/integrations/dedupe.d.ts.map +1 -1
- package/types/integrations/globalhandlers.d.ts.map +1 -1
- package/types/integrations/linkederrors.d.ts +3 -3
- package/types/integrations/linkederrors.d.ts.map +1 -1
- package/types/sdk.d.ts +3 -3
- package/types/sdk.d.ts.map +1 -1
- package/types/stack-parsers.d.ts +8 -6
- package/types/stack-parsers.d.ts.map +1 -1
- package/types/transports/fetch.d.ts +7 -14
- package/types/transports/fetch.d.ts.map +1 -1
- package/types/transports/index.d.ts +2 -5
- package/types/transports/index.d.ts.map +1 -1
- package/types/transports/utils.d.ts.map +1 -1
- package/types/transports/xhr.d.ts +9 -9
- package/types/transports/xhr.d.ts.map +1 -1
- package/build/bundle.debug.min.js +0 -3
- package/build/bundle.debug.min.js.map +0 -1
- package/build/bundle.es6.debug.min.js +0 -3
- package/build/bundle.es6.debug.min.js.map +0 -1
- package/build/bundle.es6.js +0 -6868
- 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 +0 -7169
- package/build/bundle.js.map +0 -1
- package/build/bundle.min.js +0 -3
- package/build/bundle.min.js.map +0 -1
- package/dist/backend.d.ts +0 -43
- package/dist/backend.d.ts.map +0 -1
- package/dist/backend.js +0 -58
- package/dist/backend.js.map +0 -1
- package/dist/client.d.ts +0 -33
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -77
- package/dist/client.js.map +0 -1
- package/dist/eventbuilder.d.ts +0 -39
- package/dist/eventbuilder.d.ts.map +0 -1
- package/dist/eventbuilder.js.map +0 -1
- package/dist/exports.d.ts +0 -10
- package/dist/exports.d.ts.map +0 -1
- package/dist/exports.js.map +0 -1
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +0 -1
- package/dist/integrations/breadcrumbs.d.ts.map +0 -1
- package/dist/integrations/breadcrumbs.js.map +0 -1
- package/dist/integrations/dedupe.js.map +0 -1
- package/dist/integrations/globalhandlers.d.ts.map +0 -1
- package/dist/integrations/globalhandlers.js.map +0 -1
- package/dist/integrations/linkederrors.d.ts.map +0 -1
- package/dist/integrations/linkederrors.js +0 -62
- package/dist/integrations/linkederrors.js.map +0 -1
- package/dist/integrations/trycatch.js.map +0 -1
- package/dist/integrations/useragent.js +0 -42
- package/dist/integrations/useragent.js.map +0 -1
- package/dist/sdk.d.ts.map +0 -1
- package/dist/sdk.js.map +0 -1
- package/dist/stack-parsers.d.ts +0 -7
- package/dist/stack-parsers.d.ts.map +0 -1
- package/dist/stack-parsers.js.map +0 -1
- package/dist/transports/base.d.ts +0 -65
- package/dist/transports/base.d.ts.map +0 -1
- package/dist/transports/base.js +0 -141
- package/dist/transports/base.js.map +0 -1
- package/dist/transports/fetch.d.ts +0 -17
- package/dist/transports/fetch.d.ts.map +0 -1
- package/dist/transports/fetch.js +0 -81
- package/dist/transports/fetch.js.map +0 -1
- package/dist/transports/index.d.ts +0 -6
- package/dist/transports/index.d.ts.map +0 -1
- package/dist/transports/index.js +0 -12
- package/dist/transports/index.js.map +0 -1
- package/dist/transports/new-fetch.d.ts +0 -10
- package/dist/transports/new-fetch.d.ts.map +0 -1
- package/dist/transports/new-fetch.js +0 -27
- package/dist/transports/new-fetch.js.map +0 -1
- package/dist/transports/new-xhr.d.ts +0 -11
- package/dist/transports/new-xhr.d.ts.map +0 -1
- package/dist/transports/new-xhr.js +0 -46
- package/dist/transports/new-xhr.js.map +0 -1
- package/dist/transports/utils.js.map +0 -1
- package/dist/transports/xhr.d.ts +0 -11
- package/dist/transports/xhr.d.ts.map +0 -1
- package/dist/transports/xhr.js +0 -64
- package/dist/transports/xhr.js.map +0 -1
- package/esm/backend.d.ts +0 -43
- package/esm/backend.d.ts.map +0 -1
- package/esm/backend.js +0 -57
- package/esm/backend.js.map +0 -1
- package/esm/transports/base.d.ts +0 -65
- package/esm/transports/base.d.ts.map +0 -1
- package/esm/transports/base.js +0 -140
- package/esm/transports/base.js.map +0 -1
- package/esm/transports/new-fetch.d.ts.map +0 -1
- package/esm/transports/new-fetch.js +0 -25
- package/esm/transports/new-fetch.js.map +0 -1
- package/esm/transports/new-xhr.d.ts +0 -11
- package/esm/transports/new-xhr.d.ts.map +0 -1
- package/esm/transports/new-xhr.js.map +0 -1
- package/types/backend.d.ts +0 -43
- package/types/backend.d.ts.map +0 -1
- package/types/transports/base.d.ts +0 -65
- package/types/transports/base.d.ts.map +0 -1
- package/types/transports/new-fetch.d.ts +0 -10
- package/types/transports/new-fetch.d.ts.map +0 -1
- package/types/transports/new-xhr.d.ts.map +0 -1
package/{dist → cjs}/helpers.js
RENAMED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var flags_1 = require("./flags");
|
|
6
|
-
var global = utils_1.getGlobalObject();
|
|
7
|
-
var ignoreOnError = 0;
|
|
2
|
+
const core_1 = require("@sentry/core");
|
|
3
|
+
const utils_1 = require("@sentry/utils");
|
|
4
|
+
let ignoreOnError = 0;
|
|
8
5
|
/**
|
|
9
6
|
* @hidden
|
|
10
7
|
*/
|
|
@@ -18,7 +15,7 @@ exports.shouldIgnoreOnError = shouldIgnoreOnError;
|
|
|
18
15
|
function ignoreNextOnError() {
|
|
19
16
|
// onerror should trigger before setTimeout
|
|
20
17
|
ignoreOnError += 1;
|
|
21
|
-
setTimeout(
|
|
18
|
+
setTimeout(() => {
|
|
22
19
|
ignoreOnError -= 1;
|
|
23
20
|
});
|
|
24
21
|
}
|
|
@@ -31,21 +28,20 @@ exports.ignoreNextOnError = ignoreNextOnError;
|
|
|
31
28
|
* @returns The wrapped function.
|
|
32
29
|
* @hidden
|
|
33
30
|
*/
|
|
34
|
-
function wrap(fn, options, before) {
|
|
31
|
+
function wrap(fn, options = {}, before) {
|
|
35
32
|
// for future readers what this does is wrap a function and then create
|
|
36
33
|
// a bi-directional wrapping between them.
|
|
37
34
|
//
|
|
38
35
|
// example: wrapped = wrap(original);
|
|
39
36
|
// original.__sentry_wrapped__ -> wrapped
|
|
40
37
|
// wrapped.__sentry_original__ -> original
|
|
41
|
-
if (options === void 0) { options = {}; }
|
|
42
38
|
if (typeof fn !== 'function') {
|
|
43
39
|
return fn;
|
|
44
40
|
}
|
|
45
41
|
try {
|
|
46
42
|
// if we're dealing with a function that was previously wrapped, return
|
|
47
43
|
// the original wrapper.
|
|
48
|
-
|
|
44
|
+
const wrapper = fn.__sentry_wrapped__;
|
|
49
45
|
if (wrapper) {
|
|
50
46
|
return wrapper;
|
|
51
47
|
}
|
|
@@ -62,14 +58,14 @@ function wrap(fn, options, before) {
|
|
|
62
58
|
}
|
|
63
59
|
/* eslint-disable prefer-rest-params */
|
|
64
60
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
const sentryWrapped = function () {
|
|
62
|
+
const args = Array.prototype.slice.call(arguments);
|
|
67
63
|
try {
|
|
68
64
|
if (before && typeof before === 'function') {
|
|
69
65
|
before.apply(this, arguments);
|
|
70
66
|
}
|
|
71
67
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
72
|
-
|
|
68
|
+
const wrappedArguments = args.map((arg) => wrap(arg, options));
|
|
73
69
|
// Attempt to invoke user-land function
|
|
74
70
|
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
|
|
75
71
|
// means the sentry.javascript SDK caught an error invoking your application code. This
|
|
@@ -78,13 +74,13 @@ function wrap(fn, options, before) {
|
|
|
78
74
|
}
|
|
79
75
|
catch (ex) {
|
|
80
76
|
ignoreNextOnError();
|
|
81
|
-
core_1.withScope(
|
|
82
|
-
scope.addEventProcessor(
|
|
77
|
+
core_1.withScope((scope) => {
|
|
78
|
+
scope.addEventProcessor((event) => {
|
|
83
79
|
if (options.mechanism) {
|
|
84
80
|
utils_1.addExceptionTypeValue(event, undefined, undefined);
|
|
85
81
|
utils_1.addExceptionMechanism(event, options.mechanism);
|
|
86
82
|
}
|
|
87
|
-
event.extra =
|
|
83
|
+
event.extra = Object.assign(Object.assign({}, event.extra), { arguments: args });
|
|
88
84
|
return event;
|
|
89
85
|
});
|
|
90
86
|
core_1.captureException(ex);
|
|
@@ -96,7 +92,7 @@ function wrap(fn, options, before) {
|
|
|
96
92
|
// Accessing some objects may throw
|
|
97
93
|
// ref: https://github.com/getsentry/sentry-javascript/issues/1168
|
|
98
94
|
try {
|
|
99
|
-
for (
|
|
95
|
+
for (const property in fn) {
|
|
100
96
|
if (Object.prototype.hasOwnProperty.call(fn, property)) {
|
|
101
97
|
sentryWrapped[property] = fn[property];
|
|
102
98
|
}
|
|
@@ -109,10 +105,10 @@ function wrap(fn, options, before) {
|
|
|
109
105
|
utils_1.addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);
|
|
110
106
|
// Restore original function name (not all browsers allow that)
|
|
111
107
|
try {
|
|
112
|
-
|
|
108
|
+
const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name');
|
|
113
109
|
if (descriptor.configurable) {
|
|
114
110
|
Object.defineProperty(sentryWrapped, 'name', {
|
|
115
|
-
get
|
|
111
|
+
get() {
|
|
116
112
|
return fn.name;
|
|
117
113
|
},
|
|
118
114
|
});
|
|
@@ -123,34 +119,4 @@ function wrap(fn, options, before) {
|
|
|
123
119
|
return sentryWrapped;
|
|
124
120
|
}
|
|
125
121
|
exports.wrap = wrap;
|
|
126
|
-
/**
|
|
127
|
-
* Injects the Report Dialog script
|
|
128
|
-
* @hidden
|
|
129
|
-
*/
|
|
130
|
-
function injectReportDialog(options) {
|
|
131
|
-
if (options === void 0) { options = {}; }
|
|
132
|
-
if (!global.document) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
if (!options.eventId) {
|
|
136
|
-
flags_1.IS_DEBUG_BUILD && utils_1.logger.error('Missing eventId option in showReportDialog call');
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
if (!options.dsn) {
|
|
140
|
-
flags_1.IS_DEBUG_BUILD && utils_1.logger.error('Missing dsn option in showReportDialog call');
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
var script = global.document.createElement('script');
|
|
144
|
-
script.async = true;
|
|
145
|
-
script.src = core_1.getReportDialogEndpoint(options.dsn, options);
|
|
146
|
-
if (options.onLoad) {
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
148
|
-
script.onload = options.onLoad;
|
|
149
|
-
}
|
|
150
|
-
var injectionPoint = global.document.head || global.document.body;
|
|
151
|
-
if (injectionPoint) {
|
|
152
|
-
injectionPoint.appendChild(script);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
exports.injectReportDialog = injectReportDialog;
|
|
156
122
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/helpers.ts"],"names":[],"mappings":";AAAA,uCAA2D;AAE3D,yCAMuB;AAEvB,IAAI,aAAa,GAAW,CAAC,CAAC;AAE9B;;GAEG;AACH,SAAgB,mBAAmB;IACjC,OAAO,aAAa,GAAG,CAAC,CAAC;AAC3B,CAAC;AAFD,kDAEC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,2CAA2C;IAC3C,aAAa,IAAI,CAAC,CAAC;IACnB,UAAU,CAAC,GAAG,EAAE;QACd,aAAa,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAND,8CAMC;AAED;;;;;;;GAOG;AACH,SAAgB,IAAI,CAClB,EAAmB,EACnB,UAEI,EAAE,EACN,MAAwB;IAGxB,uEAAuE;IACvE,0CAA0C;IAC1C,EAAE;IACF,qCAAqC;IACrC,0CAA0C;IAC1C,2CAA2C;IAE3C,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE;QAC5B,OAAO,EAAE,CAAC;KACX;IAED,IAAI;QACF,uEAAuE;QACvE,wBAAwB;QACxB,MAAM,OAAO,GAAG,EAAE,CAAC,kBAAkB,CAAC;QACtC,IAAI,OAAO,EAAE;YACX,OAAO,OAAO,CAAC;SAChB;QAED,+BAA+B;QAC/B,IAAI,2BAAmB,CAAC,EAAE,CAAC,EAAE;YAC3B,OAAO,EAAE,CAAC;SACX;KACF;IAAC,OAAO,CAAC,EAAE;QACV,4DAA4D;QAC5D,gEAAgE;QAChE,6EAA6E;QAC7E,OAAO,EAAE,CAAC;KACX;IAED,uCAAuC;IACvC,8DAA8D;IAC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AAc,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE;gBACtD,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;aACxC;SACF;KACF;IAAC,OAAO,GAAG,EAAE,GAAE,CAAC,+BAA+B;IAEhD,4DAA4D;IAC5D,qEAAqE;IACrE,2BAAmB,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAEvC,gCAAwB,CAAC,EAAE,EAAE,oBAAoB,EAAE,aAAa,CAAC,CAAC;IAElE,+DAA+D;IAC/D,IAAI;QACF,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,aAAa,EAAE,MAAM,CAAuB,CAAC;QAChG,IAAI,UAAU,CAAC,YAAY,EAAE;YAC3B,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE;gBAC3C,GAAG;oBACD,OAAO,EAAE,CAAC,IAAI,CAAC;gBACjB,CAAC;aACF,CAAC,CAAC;SACJ;QACD,oCAAoC;KACrC;IAAC,OAAO,GAAG,EAAE,GAAE;IAEhB,OAAO,aAAa,CAAC;AACvB,CAAC;AAhHD,oBAgHC","sourcesContent":["import { captureException, withScope } from '@sentry/core';\nimport { DsnLike, Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n addNonEnumerableProperty,\n getOriginalFunction,\n markFunctionWrapped,\n} from '@sentry/utils';\n\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"]}
|
package/{dist → cjs}/index.d.ts
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './exports';
|
|
2
2
|
import { Integrations as CoreIntegrations } from '@sentry/core';
|
|
3
3
|
import * as BrowserIntegrations from './integrations';
|
|
4
|
-
import * as Transports from './transports';
|
|
5
4
|
declare const INTEGRATIONS: {
|
|
6
5
|
GlobalHandlers: typeof BrowserIntegrations.GlobalHandlers;
|
|
7
6
|
TryCatch: typeof BrowserIntegrations.TryCatch;
|
|
@@ -12,5 +11,5 @@ declare const INTEGRATIONS: {
|
|
|
12
11
|
FunctionToString: typeof CoreIntegrations.FunctionToString;
|
|
13
12
|
InboundFilters: typeof CoreIntegrations.InboundFilters;
|
|
14
13
|
};
|
|
15
|
-
export { INTEGRATIONS as Integrations
|
|
14
|
+
export { INTEGRATIONS as Integrations };
|
|
16
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAUtD,QAAA,MAAM,YAAY;;;;;;;;;CAIjB,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,YAAY,EAAE,CAAC"}
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const tslib_1 = require("tslib");
|
|
3
|
+
tslib_1.__exportStar(require("./exports"), exports);
|
|
4
|
+
const core_1 = require("@sentry/core");
|
|
5
|
+
const utils_1 = require("@sentry/utils");
|
|
6
|
+
const BrowserIntegrations = require("./integrations");
|
|
7
|
+
let windowIntegrations = {};
|
|
8
|
+
// This block is needed to add compatibility with the integrations packages when used with a CDN
|
|
9
|
+
const _window = utils_1.getGlobalObject();
|
|
10
|
+
if (_window.Sentry && _window.Sentry.Integrations) {
|
|
11
|
+
windowIntegrations = _window.Sentry.Integrations;
|
|
12
|
+
}
|
|
13
|
+
const INTEGRATIONS = Object.assign(Object.assign(Object.assign({}, windowIntegrations), core_1.Integrations), BrowserIntegrations);
|
|
14
|
+
exports.Integrations = INTEGRATIONS;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;AAAA,oDAA0B;AAE1B,uCAAgE;AAChE,yCAAgD;AAEhD,sDAAsD;AAEtD,IAAI,kBAAkB,GAAG,EAAE,CAAC;AAE5B,gGAAgG;AAChG,MAAM,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,MAAM,YAAY,iDACb,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';\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 };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Integration } from '@sentry/types';
|
|
2
2
|
/** JSDoc */
|
|
3
3
|
interface BreadcrumbsOptions {
|
|
4
4
|
console: boolean;
|
|
@@ -10,6 +10,7 @@ interface BreadcrumbsOptions {
|
|
|
10
10
|
sentry: boolean;
|
|
11
11
|
xhr: boolean;
|
|
12
12
|
}
|
|
13
|
+
export declare const BREADCRUMB_INTEGRATION_ID = "Breadcrumbs";
|
|
13
14
|
/**
|
|
14
15
|
* Default Breadcrumbs instrumentations
|
|
15
16
|
* TODO: Deprecated - with v6, this will be renamed to `Instrument`
|
|
@@ -23,16 +24,14 @@ export declare class Breadcrumbs implements Integration {
|
|
|
23
24
|
* @inheritDoc
|
|
24
25
|
*/
|
|
25
26
|
name: string;
|
|
26
|
-
/** JSDoc */
|
|
27
|
-
private readonly _options;
|
|
28
27
|
/**
|
|
29
|
-
*
|
|
28
|
+
* Options of the breadcrumbs integration.
|
|
30
29
|
*/
|
|
31
|
-
|
|
30
|
+
readonly options: Readonly<BreadcrumbsOptions>;
|
|
32
31
|
/**
|
|
33
|
-
*
|
|
32
|
+
* @inheritDoc
|
|
34
33
|
*/
|
|
35
|
-
|
|
34
|
+
constructor(options?: Partial<BreadcrumbsOptions>);
|
|
36
35
|
/**
|
|
37
36
|
* Instrument browser built-ins w/ breadcrumb capturing
|
|
38
37
|
* - Console API
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/integrations/breadcrumbs.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAU5C,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;AAED,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AAEvD;;;GAGG;AACH,qBAAa,WAAY,YAAW,WAAW;IAC7C;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAA6B;IAErD;;OAEG;IACI,IAAI,EAAE,MAAM,CAAkB;IAErC;;OAEG;IAEH,SAAgB,OAAO,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEtD;;OAEG;gBACgB,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC;IAYxD;;;;;;;OAOG;IACI,SAAS,IAAI,IAAI;CAiBzB"}
|
|
@@ -1,41 +1,24 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
var tslib_1 = require("tslib");
|
|
3
2
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
4
3
|
/* eslint-disable max-lines */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const core_1 = require("@sentry/core");
|
|
5
|
+
const utils_1 = require("@sentry/utils");
|
|
6
|
+
exports.BREADCRUMB_INTEGRATION_ID = 'Breadcrumbs';
|
|
8
7
|
/**
|
|
9
8
|
* Default Breadcrumbs instrumentations
|
|
10
9
|
* TODO: Deprecated - with v6, this will be renamed to `Instrument`
|
|
11
10
|
*/
|
|
12
|
-
|
|
11
|
+
class Breadcrumbs {
|
|
13
12
|
/**
|
|
14
13
|
* @inheritDoc
|
|
15
14
|
*/
|
|
16
|
-
|
|
15
|
+
constructor(options) {
|
|
17
16
|
/**
|
|
18
17
|
* @inheritDoc
|
|
19
18
|
*/
|
|
20
19
|
this.name = Breadcrumbs.id;
|
|
21
|
-
this.
|
|
20
|
+
this.options = Object.assign({ console: true, dom: true, fetch: true, history: true, sentry: true, xhr: true }, options);
|
|
22
21
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Create a breadcrumb of `sentry` from the events themselves
|
|
25
|
-
*/
|
|
26
|
-
Breadcrumbs.prototype.addSentryBreadcrumb = function (event) {
|
|
27
|
-
if (!this._options.sentry) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
core_1.getCurrentHub().addBreadcrumb({
|
|
31
|
-
category: "sentry." + (event.type === 'transaction' ? 'transaction' : 'event'),
|
|
32
|
-
event_id: event.event_id,
|
|
33
|
-
level: event.level,
|
|
34
|
-
message: utils_1.getEventDescription(event),
|
|
35
|
-
}, {
|
|
36
|
-
event: event,
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
22
|
/**
|
|
40
23
|
* Instrument browser built-ins w/ breadcrumb capturing
|
|
41
24
|
* - Console API
|
|
@@ -44,30 +27,29 @@ var Breadcrumbs = /** @class */ (function () {
|
|
|
44
27
|
* - Fetch API
|
|
45
28
|
* - History API
|
|
46
29
|
*/
|
|
47
|
-
|
|
48
|
-
if (this.
|
|
30
|
+
setupOnce() {
|
|
31
|
+
if (this.options.console) {
|
|
49
32
|
utils_1.addInstrumentationHandler('console', _consoleBreadcrumb);
|
|
50
33
|
}
|
|
51
|
-
if (this.
|
|
52
|
-
utils_1.addInstrumentationHandler('dom', _domBreadcrumb(this.
|
|
34
|
+
if (this.options.dom) {
|
|
35
|
+
utils_1.addInstrumentationHandler('dom', _domBreadcrumb(this.options.dom));
|
|
53
36
|
}
|
|
54
|
-
if (this.
|
|
37
|
+
if (this.options.xhr) {
|
|
55
38
|
utils_1.addInstrumentationHandler('xhr', _xhrBreadcrumb);
|
|
56
39
|
}
|
|
57
|
-
if (this.
|
|
40
|
+
if (this.options.fetch) {
|
|
58
41
|
utils_1.addInstrumentationHandler('fetch', _fetchBreadcrumb);
|
|
59
42
|
}
|
|
60
|
-
if (this.
|
|
43
|
+
if (this.options.history) {
|
|
61
44
|
utils_1.addInstrumentationHandler('history', _historyBreadcrumb);
|
|
62
45
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
* @inheritDoc
|
|
66
|
-
*/
|
|
67
|
-
Breadcrumbs.id = 'Breadcrumbs';
|
|
68
|
-
return Breadcrumbs;
|
|
69
|
-
}());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
70
48
|
exports.Breadcrumbs = Breadcrumbs;
|
|
49
|
+
/**
|
|
50
|
+
* @inheritDoc
|
|
51
|
+
*/
|
|
52
|
+
Breadcrumbs.id = exports.BREADCRUMB_INTEGRATION_ID;
|
|
71
53
|
/**
|
|
72
54
|
* A HOC that creaes a function that creates breadcrumbs from DOM API calls.
|
|
73
55
|
* This is a HOC so that we get access to dom options in the closure.
|
|
@@ -76,8 +58,8 @@ exports.Breadcrumbs = Breadcrumbs;
|
|
|
76
58
|
function _domBreadcrumb(dom) {
|
|
77
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
60
|
function _innerDomBreadcrumb(handlerData) {
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
let target;
|
|
62
|
+
let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;
|
|
81
63
|
if (typeof keyAttrs === 'string') {
|
|
82
64
|
keyAttrs = [keyAttrs];
|
|
83
65
|
}
|
|
@@ -94,7 +76,7 @@ function _domBreadcrumb(dom) {
|
|
|
94
76
|
return;
|
|
95
77
|
}
|
|
96
78
|
core_1.getCurrentHub().addBreadcrumb({
|
|
97
|
-
category:
|
|
79
|
+
category: `ui.${handlerData.name}`,
|
|
98
80
|
message: target,
|
|
99
81
|
}, {
|
|
100
82
|
event: handlerData.event,
|
|
@@ -109,18 +91,18 @@ function _domBreadcrumb(dom) {
|
|
|
109
91
|
*/
|
|
110
92
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
93
|
function _consoleBreadcrumb(handlerData) {
|
|
112
|
-
|
|
94
|
+
const breadcrumb = {
|
|
113
95
|
category: 'console',
|
|
114
96
|
data: {
|
|
115
97
|
arguments: handlerData.args,
|
|
116
98
|
logger: 'console',
|
|
117
99
|
},
|
|
118
|
-
level: utils_1.
|
|
100
|
+
level: utils_1.severityLevelFromString(handlerData.level),
|
|
119
101
|
message: utils_1.safeJoin(handlerData.args, ' '),
|
|
120
102
|
};
|
|
121
103
|
if (handlerData.level === 'assert') {
|
|
122
104
|
if (handlerData.args[0] === false) {
|
|
123
|
-
breadcrumb.message =
|
|
105
|
+
breadcrumb.message = `Assertion failed: ${utils_1.safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;
|
|
124
106
|
breadcrumb.data.arguments = handlerData.args.slice(1);
|
|
125
107
|
}
|
|
126
108
|
else {
|
|
@@ -143,13 +125,13 @@ function _xhrBreadcrumb(handlerData) {
|
|
|
143
125
|
if (handlerData.xhr.__sentry_own_request__) {
|
|
144
126
|
return;
|
|
145
127
|
}
|
|
146
|
-
|
|
128
|
+
const { method, url, status_code, body } = handlerData.xhr.__sentry_xhr__ || {};
|
|
147
129
|
core_1.getCurrentHub().addBreadcrumb({
|
|
148
130
|
category: 'xhr',
|
|
149
131
|
data: {
|
|
150
|
-
method
|
|
151
|
-
url
|
|
152
|
-
status_code
|
|
132
|
+
method,
|
|
133
|
+
url,
|
|
134
|
+
status_code,
|
|
153
135
|
},
|
|
154
136
|
type: 'http',
|
|
155
137
|
}, {
|
|
@@ -176,7 +158,7 @@ function _fetchBreadcrumb(handlerData) {
|
|
|
176
158
|
core_1.getCurrentHub().addBreadcrumb({
|
|
177
159
|
category: 'fetch',
|
|
178
160
|
data: handlerData.fetchData,
|
|
179
|
-
level:
|
|
161
|
+
level: 'error',
|
|
180
162
|
type: 'http',
|
|
181
163
|
}, {
|
|
182
164
|
data: handlerData.error,
|
|
@@ -186,7 +168,7 @@ function _fetchBreadcrumb(handlerData) {
|
|
|
186
168
|
else {
|
|
187
169
|
core_1.getCurrentHub().addBreadcrumb({
|
|
188
170
|
category: 'fetch',
|
|
189
|
-
data:
|
|
171
|
+
data: Object.assign(Object.assign({}, handlerData.fetchData), { status_code: handlerData.response.status }),
|
|
190
172
|
type: 'http',
|
|
191
173
|
}, {
|
|
192
174
|
input: handlerData.args,
|
|
@@ -199,12 +181,12 @@ function _fetchBreadcrumb(handlerData) {
|
|
|
199
181
|
*/
|
|
200
182
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
201
183
|
function _historyBreadcrumb(handlerData) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
184
|
+
const global = utils_1.getGlobalObject();
|
|
185
|
+
let from = handlerData.from;
|
|
186
|
+
let to = handlerData.to;
|
|
187
|
+
const parsedLoc = utils_1.parseUrl(global.location.href);
|
|
188
|
+
let parsedFrom = utils_1.parseUrl(from);
|
|
189
|
+
const parsedTo = utils_1.parseUrl(to);
|
|
208
190
|
// Initial pushState doesn't provide `from` information
|
|
209
191
|
if (!parsedFrom.path) {
|
|
210
192
|
parsedFrom = parsedLoc;
|
|
@@ -220,8 +202,8 @@ function _historyBreadcrumb(handlerData) {
|
|
|
220
202
|
core_1.getCurrentHub().addBreadcrumb({
|
|
221
203
|
category: 'navigation',
|
|
222
204
|
data: {
|
|
223
|
-
from
|
|
224
|
-
to
|
|
205
|
+
from,
|
|
206
|
+
to,
|
|
225
207
|
},
|
|
226
208
|
});
|
|
227
209
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../../../src/integrations/breadcrumbs.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,8BAA8B;AAC9B,uCAA6C;AAE7C,yCAOuB;AAYV,QAAA,yBAAyB,GAAG,aAAa,CAAC;AAEvD;;;GAGG;AACH,MAAa,WAAW;IAiBtB;;OAEG;IACH,YAAmB,OAAqC;QAdxD;;WAEG;QACI,SAAI,GAAW,WAAW,CAAC,EAAE,CAAC;QAYnC,IAAI,CAAC,OAAO,mBACV,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;;;;;;;OAOG;IACI,SAAS;QACd,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACxB,iCAAyB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;SAC1D;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YACpB,iCAAyB,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,C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,CAAC,QAAQ;SAC/B,CACF,CAAC;KACH;AACH,CAAC;AAED;;GAEG;AACH,8DAA8D;AAC9D,SAAS,kBAAkB,CAAC,WAAmC;IAC7D,MAAM,MAAM,GAAG,uBAAe,EAAU,CAAC;IACzC,IAAI,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAC5B,IAAI,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC;IACxB,MAAM,SAAS,GAAG,gBAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,UAAU,GAAG,gBAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,gBAAQ,CAAC,EAAE,CAAC,CAAC;IAE9B,uDAAuD;IACvD,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;QACpB,UAAU,GAAG,SAAS,CAAC;KACxB;IAED,wEAAwE;IACxE,sDAAsD;IACtD,IAAI,SAAS,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE;QAChF,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC;KACxB;IACD,IAAI,SAAS,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE;QACpF,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;KAC5B;IAED,oBAAa,EAAE,CAAC,aAAa,CAAC;QAC5B,QAAQ,EAAE,YAAY;QACtB,IAAI,EAAE;YACJ,IAAI;YACJ,EAAE;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 { Integration } from '@sentry/types';\nimport {\n addInstrumentationHandler,\n getGlobalObject,\n htmlTreeAsString,\n parseUrl,\n safeJoin,\n severityLevelFromString,\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\nexport const BREADCRUMB_INTEGRATION_ID = 'Breadcrumbs';\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 = BREADCRUMB_INTEGRATION_ID;\n\n /**\n * @inheritDoc\n */\n public name: string = Breadcrumbs.id;\n\n /**\n * Options of the breadcrumbs integration.\n */\n // This field is public, because we use it in the browser client to check if the `sentry` option is enabled.\n public readonly options: Readonly<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 * 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: severityLevelFromString(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: '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"]}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
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;AAK/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;
|
|
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;AAK/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;CAsB9G"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const utils_1 = require("@sentry/utils");
|
|
3
|
+
const flags_1 = require("../flags");
|
|
4
4
|
/** Deduplication filter */
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
class Dedupe {
|
|
6
|
+
constructor() {
|
|
7
7
|
/**
|
|
8
8
|
* @inheritDoc
|
|
9
9
|
*/
|
|
@@ -12,9 +12,9 @@ var Dedupe = /** @class */ (function () {
|
|
|
12
12
|
/**
|
|
13
13
|
* @inheritDoc
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
setupOnce(addGlobalEventProcessor, getCurrentHub) {
|
|
16
|
+
const eventProcessor = currentEvent => {
|
|
17
|
+
const self = getCurrentHub().getIntegration(Dedupe);
|
|
18
18
|
if (self) {
|
|
19
19
|
// Juuust in case something goes wrong
|
|
20
20
|
try {
|
|
@@ -29,15 +29,16 @@ var Dedupe = /** @class */ (function () {
|
|
|
29
29
|
return (self._previousEvent = currentEvent);
|
|
30
30
|
}
|
|
31
31
|
return currentEvent;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Dedupe.id = 'Dedupe';
|
|
38
|
-
return Dedupe;
|
|
39
|
-
}());
|
|
32
|
+
};
|
|
33
|
+
eventProcessor.id = this.name;
|
|
34
|
+
addGlobalEventProcessor(eventProcessor);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
40
37
|
exports.Dedupe = Dedupe;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
Dedupe.id = 'Dedupe';
|
|
41
42
|
/** JSDoc */
|
|
42
43
|
function _shouldDropEvent(currentEvent, previousEvent) {
|
|
43
44
|
if (!previousEvent) {
|
|
@@ -53,8 +54,8 @@ function _shouldDropEvent(currentEvent, previousEvent) {
|
|
|
53
54
|
}
|
|
54
55
|
/** JSDoc */
|
|
55
56
|
function _isSameMessageEvent(currentEvent, previousEvent) {
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
const currentMessage = currentEvent.message;
|
|
58
|
+
const previousMessage = previousEvent.message;
|
|
58
59
|
// If neither event has a message property, they were both exceptions, so bail out
|
|
59
60
|
if (!currentMessage && !previousMessage) {
|
|
60
61
|
return false;
|
|
@@ -76,8 +77,8 @@ function _isSameMessageEvent(currentEvent, previousEvent) {
|
|
|
76
77
|
}
|
|
77
78
|
/** JSDoc */
|
|
78
79
|
function _isSameExceptionEvent(currentEvent, previousEvent) {
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
const previousException = _getExceptionFromEvent(previousEvent);
|
|
81
|
+
const currentException = _getExceptionFromEvent(currentEvent);
|
|
81
82
|
if (!previousException || !currentException) {
|
|
82
83
|
return false;
|
|
83
84
|
}
|
|
@@ -94,8 +95,8 @@ function _isSameExceptionEvent(currentEvent, previousEvent) {
|
|
|
94
95
|
}
|
|
95
96
|
/** JSDoc */
|
|
96
97
|
function _isSameStacktrace(currentEvent, previousEvent) {
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
let currentFrames = _getFramesFromEvent(currentEvent);
|
|
99
|
+
let previousFrames = _getFramesFromEvent(previousEvent);
|
|
99
100
|
// If neither event has a stacktrace, they are assumed to be the same
|
|
100
101
|
if (!currentFrames && !previousFrames) {
|
|
101
102
|
return true;
|
|
@@ -111,9 +112,9 @@ function _isSameStacktrace(currentEvent, previousEvent) {
|
|
|
111
112
|
return false;
|
|
112
113
|
}
|
|
113
114
|
// Otherwise, compare the two
|
|
114
|
-
for (
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
for (let i = 0; i < previousFrames.length; i++) {
|
|
116
|
+
const frameA = previousFrames[i];
|
|
117
|
+
const frameB = currentFrames[i];
|
|
117
118
|
if (frameA.filename !== frameB.filename ||
|
|
118
119
|
frameA.lineno !== frameB.lineno ||
|
|
119
120
|
frameA.colno !== frameB.colno ||
|
|
@@ -125,8 +126,8 @@ function _isSameStacktrace(currentEvent, previousEvent) {
|
|
|
125
126
|
}
|
|
126
127
|
/** JSDoc */
|
|
127
128
|
function _isSameFingerprint(currentEvent, previousEvent) {
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
let currentFingerprint = currentEvent.fingerprint;
|
|
130
|
+
let previousFingerprint = previousEvent.fingerprint;
|
|
130
131
|
// If neither event has a fingerprint, they are assumed to be the same
|
|
131
132
|
if (!currentFingerprint && !previousFingerprint) {
|
|
132
133
|
return true;
|
|
@@ -151,7 +152,7 @@ function _getExceptionFromEvent(event) {
|
|
|
151
152
|
}
|
|
152
153
|
/** JSDoc */
|
|
153
154
|
function _getFramesFromEvent(event) {
|
|
154
|
-
|
|
155
|
+
const exception = event.exception;
|
|
155
156
|
if (exception) {
|
|
156
157
|
try {
|
|
157
158
|
// @ts-ignore Object could be undefined
|
|
@@ -161,9 +162,6 @@ function _getFramesFromEvent(event) {
|
|
|
161
162
|
return undefined;
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
|
-
else if (event.stacktrace) {
|
|
165
|
-
return event.stacktrace.frames;
|
|
166
|
-
}
|
|
167
165
|
return undefined;
|
|
168
166
|
}
|
|
169
167
|
//# sourceMappingURL=dedupe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedupe.js","sourceRoot":"","sources":["../../../../src/integrations/dedupe.ts"],"names":[],"mappings":";AACA,yCAAuC;AAEvC,oCAA0C;AAE1C,2BAA2B;AAC3B,MAAa,MAAM;IAAnB;QAME;;WAEG;QACI,SAAI,GAAW,MAAM,CAAC,EAAE,CAAC;IAgClC,CAAC;IAzBC;;OAEG;IACI,SAAS,CAAC,uBAA2D,EAAE,aAAwB;QACpG,MAAM,cAAc,GAAmB,YAAY,CAAC,EAAE;YACpD,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACpD,IAAI,IAAI,EAAE;gBACR,sCAAsC;gBACtC,IAAI;oBACF,IAAI,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE;wBACvD,sBAAc,IAAI,cAAM,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;wBACtG,OAAO,IAAI,CAAC;qBACb;iBACF;gBAAC,OAAO,GAAG,EAAE;oBACZ,OAAO,CAAC,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC,CAAC;iBAC7C;gBAED,OAAO,CAA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AAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAED,YAAY;AACZ,SAAS,mBAAmB,CAAC,KAAY;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IAElC,IAAI,SAAS,EAAE;QACb,IAAI;YACF,uCAAuC;YACvC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;SAC9C;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,SAAS,CAAC;SAClB;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { Event, EventProcessor, Exception, Hub, Integration, StackFrame } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { IS_DEBUG_BUILD } from '../flags';\n\n/** Deduplication filter */\nexport class Dedupe implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Dedupe';\n\n /**\n * @inheritDoc\n */\n public name: string = Dedupe.id;\n\n /**\n * @inheritDoc\n */\n private _previousEvent?: Event;\n\n /**\n * @inheritDoc\n */\n public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {\n const eventProcessor: EventProcessor = currentEvent => {\n const self = getCurrentHub().getIntegration(Dedupe);\n if (self) {\n // Juuust in case something goes wrong\n try {\n if (_shouldDropEvent(currentEvent, self._previousEvent)) {\n IS_DEBUG_BUILD && logger.warn('Event dropped due to being a duplicate of previously captured event.');\n return null;\n }\n } catch (_oO) {\n return (self._previousEvent = currentEvent);\n }\n\n return (self._previousEvent = currentEvent);\n }\n return currentEvent;\n };\n\n eventProcessor.id = this.name;\n addGlobalEventProcessor(eventProcessor);\n }\n}\n\n/** JSDoc */\nfunction _shouldDropEvent(currentEvent: Event, previousEvent?: Event): boolean {\n if (!previousEvent) {\n return false;\n }\n\n if (_isSameMessageEvent(currentEvent, previousEvent)) {\n return true;\n }\n\n if (_isSameExceptionEvent(currentEvent, previousEvent)) {\n return true;\n }\n\n return false;\n}\n\n/** JSDoc */\nfunction _isSameMessageEvent(currentEvent: Event, previousEvent: Event): boolean {\n const currentMessage = currentEvent.message;\n const previousMessage = previousEvent.message;\n\n // If neither event has a message property, they were both exceptions, so bail out\n if (!currentMessage && !previousMessage) {\n return false;\n }\n\n // If only one event has a stacktrace, but not the other one, they are not the same\n if ((currentMessage && !previousMessage) || (!currentMessage && previousMessage)) {\n return false;\n }\n\n if (currentMessage !== previousMessage) {\n return false;\n }\n\n if (!_isSameFingerprint(currentEvent, previousEvent)) {\n return false;\n }\n\n if (!_isSameStacktrace(currentEvent, previousEvent)) {\n return false;\n }\n\n return true;\n}\n\n/** JSDoc */\nfunction _isSameExceptionEvent(currentEvent: Event, previousEvent: Event): boolean {\n const previousException = _getExceptionFromEvent(previousEvent);\n const currentException = _getExceptionFromEvent(currentEvent);\n\n if (!previousException || !currentException) {\n return false;\n }\n\n if (previousException.type !== currentException.type || previousException.value !== currentException.value) {\n return false;\n }\n\n if (!_isSameFingerprint(currentEvent, previousEvent)) {\n return false;\n }\n\n if (!_isSameStacktrace(currentEvent, previousEvent)) {\n return false;\n }\n\n return true;\n}\n\n/** JSDoc */\nfunction _isSameStacktrace(currentEvent: Event, previousEvent: Event): boolean {\n let currentFrames = _getFramesFromEvent(currentEvent);\n let previousFrames = _getFramesFromEvent(previousEvent);\n\n // If neither event has a stacktrace, they are assumed to be the same\n if (!currentFrames && !previousFrames) {\n return true;\n }\n\n // If only one event has a stacktrace, but not the other one, they are not the same\n if ((currentFrames && !previousFrames) || (!currentFrames && previousFrames)) {\n return false;\n }\n\n currentFrames = currentFrames as StackFrame[];\n previousFrames = previousFrames as StackFrame[];\n\n // If number of frames differ, they are not the same\n if (previousFrames.length !== currentFrames.length) {\n return false;\n }\n\n // Otherwise, compare the two\n for (let i = 0; i < previousFrames.length; i++) {\n const frameA = previousFrames[i];\n const frameB = currentFrames[i];\n\n if (\n frameA.filename !== frameB.filename ||\n frameA.lineno !== frameB.lineno ||\n frameA.colno !== frameB.colno ||\n frameA.function !== frameB.function\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/** JSDoc */\nfunction _isSameFingerprint(currentEvent: Event, previousEvent: Event): boolean {\n let currentFingerprint = currentEvent.fingerprint;\n let previousFingerprint = previousEvent.fingerprint;\n\n // If neither event has a fingerprint, they are assumed to be the same\n if (!currentFingerprint && !previousFingerprint) {\n return true;\n }\n\n // If only one event has a fingerprint, but not the other one, they are not the same\n if ((currentFingerprint && !previousFingerprint) || (!currentFingerprint && previousFingerprint)) {\n return false;\n }\n\n currentFingerprint = currentFingerprint as string[];\n previousFingerprint = previousFingerprint as string[];\n\n // Otherwise, compare the two\n try {\n return !!(currentFingerprint.join('') === previousFingerprint.join(''));\n } catch (_oO) {\n return false;\n }\n}\n\n/** JSDoc */\nfunction _getExceptionFromEvent(event: Event): Exception | undefined {\n return event.exception && event.exception.values && event.exception.values[0];\n}\n\n/** JSDoc */\nfunction _getFramesFromEvent(event: Event): StackFrame[] | undefined {\n const exception = event.exception;\n\n if (exception) {\n try {\n // @ts-ignore Object could be undefined\n return exception.values[0].stacktrace.frames;\n } catch (_oO) {\n return undefined;\n }\n }\n return undefined;\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globalhandlers.d.ts","sourceRoot":"","sources":["../../../../src/integrations/globalhandlers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,WAAW,EAA0B,MAAM,eAAe,CAAC;AAgB3F,aAAK,oCAAoC,GAAG,SAAS,GAAG,sBAAsB,CAAC;AAE/E,YAAY;AACZ,aAAK,0BAA0B,GAAG,MAAM,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;AAExF,sBAAsB;AACtB,qBAAa,cAAe,YAAW,WAAW;IAChD;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAoB;IAE5C;;OAEG;IACI,IAAI,EAAE,MAAM,CAAqB;IAExC,YAAY;IACZ,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IAEtD;;;OAGG;IACH,OAAO,CAAC,YAAY,CAGlB;IAEF,YAAY;gBACO,OAAO,CAAC,EAAE,0BAA0B;IAOvD;;OAEG;IACI,SAAS,IAAI,IAAI;CAgBzB"}
|