@sentry/browser 6.16.1 → 6.17.2

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.
Files changed (111) hide show
  1. package/build/bundle.es6.js +1311 -1428
  2. package/build/bundle.es6.js.map +1 -1
  3. package/build/bundle.es6.min.js +2 -2
  4. package/build/bundle.es6.min.js.map +1 -1
  5. package/build/bundle.js +1350 -1483
  6. package/build/bundle.js.map +1 -1
  7. package/build/bundle.min.js +2 -2
  8. package/build/bundle.min.js.map +1 -1
  9. package/dist/eventbuilder.d.ts +2 -2
  10. package/dist/eventbuilder.d.ts.map +1 -1
  11. package/dist/eventbuilder.js +7 -7
  12. package/dist/eventbuilder.js.map +1 -1
  13. package/dist/exports.d.ts +1 -1
  14. package/dist/exports.d.ts.map +1 -1
  15. package/dist/exports.js +0 -1
  16. package/dist/exports.js.map +1 -1
  17. package/dist/helpers.d.ts.map +1 -1
  18. package/dist/helpers.js +26 -37
  19. package/dist/helpers.js.map +1 -1
  20. package/dist/integrations/breadcrumbs.d.ts +0 -20
  21. package/dist/integrations/breadcrumbs.d.ts.map +1 -1
  22. package/dist/integrations/breadcrumbs.js +132 -173
  23. package/dist/integrations/breadcrumbs.js.map +1 -1
  24. package/dist/integrations/dedupe.d.ts +0 -14
  25. package/dist/integrations/dedupe.d.ts.map +1 -1
  26. package/dist/integrations/dedupe.js +126 -126
  27. package/dist/integrations/dedupe.js.map +1 -1
  28. package/dist/integrations/globalhandlers.d.ts +7 -25
  29. package/dist/integrations/globalhandlers.d.ts.map +1 -1
  30. package/dist/integrations/globalhandlers.js +176 -168
  31. package/dist/integrations/globalhandlers.js.map +1 -1
  32. package/dist/integrations/linkederrors.d.ts +15 -13
  33. package/dist/integrations/linkederrors.d.ts.map +1 -1
  34. package/dist/integrations/linkederrors.js +26 -28
  35. package/dist/integrations/linkederrors.js.map +1 -1
  36. package/dist/integrations/trycatch.d.ts +0 -8
  37. package/dist/integrations/trycatch.d.ts.map +1 -1
  38. package/dist/integrations/trycatch.js +154 -153
  39. package/dist/integrations/trycatch.js.map +1 -1
  40. package/dist/integrations/useragent.js +2 -3
  41. package/dist/integrations/useragent.js.map +1 -1
  42. package/dist/sdk.d.ts.map +1 -1
  43. package/dist/sdk.js +23 -19
  44. package/dist/sdk.js.map +1 -1
  45. package/dist/transports/base.d.ts +9 -4
  46. package/dist/transports/base.d.ts.map +1 -1
  47. package/dist/transports/base.js +23 -19
  48. package/dist/transports/base.js.map +1 -1
  49. package/dist/transports/fetch.d.ts +2 -10
  50. package/dist/transports/fetch.d.ts.map +1 -1
  51. package/dist/transports/fetch.js +6 -20
  52. package/dist/transports/fetch.js.map +1 -1
  53. package/dist/transports/utils.d.ts.map +1 -1
  54. package/dist/transports/utils.js +7 -5
  55. package/dist/transports/utils.js.map +1 -1
  56. package/dist/transports/xhr.d.ts +2 -10
  57. package/dist/transports/xhr.d.ts.map +1 -1
  58. package/dist/transports/xhr.js +3 -17
  59. package/dist/transports/xhr.js.map +1 -1
  60. package/esm/eventbuilder.d.ts +2 -2
  61. package/esm/eventbuilder.d.ts.map +1 -1
  62. package/esm/eventbuilder.js +8 -8
  63. package/esm/eventbuilder.js.map +1 -1
  64. package/esm/exports.d.ts +1 -1
  65. package/esm/exports.d.ts.map +1 -1
  66. package/esm/exports.js +1 -1
  67. package/esm/exports.js.map +1 -1
  68. package/esm/helpers.d.ts.map +1 -1
  69. package/esm/helpers.js +28 -39
  70. package/esm/helpers.js.map +1 -1
  71. package/esm/integrations/breadcrumbs.d.ts +0 -20
  72. package/esm/integrations/breadcrumbs.d.ts.map +1 -1
  73. package/esm/integrations/breadcrumbs.js +134 -175
  74. package/esm/integrations/breadcrumbs.js.map +1 -1
  75. package/esm/integrations/dedupe.d.ts +0 -14
  76. package/esm/integrations/dedupe.d.ts.map +1 -1
  77. package/esm/integrations/dedupe.js +126 -126
  78. package/esm/integrations/dedupe.js.map +1 -1
  79. package/esm/integrations/globalhandlers.d.ts +7 -25
  80. package/esm/integrations/globalhandlers.d.ts.map +1 -1
  81. package/esm/integrations/globalhandlers.js +178 -170
  82. package/esm/integrations/globalhandlers.js.map +1 -1
  83. package/esm/integrations/linkederrors.d.ts +15 -13
  84. package/esm/integrations/linkederrors.d.ts.map +1 -1
  85. package/esm/integrations/linkederrors.js +24 -28
  86. package/esm/integrations/linkederrors.js.map +1 -1
  87. package/esm/integrations/trycatch.d.ts +0 -8
  88. package/esm/integrations/trycatch.d.ts.map +1 -1
  89. package/esm/integrations/trycatch.js +155 -154
  90. package/esm/integrations/trycatch.js.map +1 -1
  91. package/esm/integrations/useragent.js +2 -3
  92. package/esm/integrations/useragent.js.map +1 -1
  93. package/esm/sdk.d.ts.map +1 -1
  94. package/esm/sdk.js +24 -20
  95. package/esm/sdk.js.map +1 -1
  96. package/esm/transports/base.d.ts +9 -4
  97. package/esm/transports/base.d.ts.map +1 -1
  98. package/esm/transports/base.js +25 -21
  99. package/esm/transports/base.js.map +1 -1
  100. package/esm/transports/fetch.d.ts +2 -10
  101. package/esm/transports/fetch.d.ts.map +1 -1
  102. package/esm/transports/fetch.js +6 -20
  103. package/esm/transports/fetch.js.map +1 -1
  104. package/esm/transports/utils.d.ts.map +1 -1
  105. package/esm/transports/utils.js +8 -6
  106. package/esm/transports/utils.js.map +1 -1
  107. package/esm/transports/xhr.d.ts +2 -10
  108. package/esm/transports/xhr.d.ts.map +1 -1
  109. package/esm/transports/xhr.js +3 -17
  110. package/esm/transports/xhr.js.map +1 -1
  111. package/package.json +4 -5
@@ -45,104 +45,39 @@ var Breadcrumbs = /** @class */ (function () {
45
45
  * - History API
46
46
  */
47
47
  Breadcrumbs.prototype.setupOnce = function () {
48
- var _this = this;
49
48
  if (this._options.console) {
50
- utils_1.addInstrumentationHandler({
51
- callback: function () {
52
- var args = [];
53
- for (var _i = 0; _i < arguments.length; _i++) {
54
- args[_i] = arguments[_i];
55
- }
56
- _this._consoleBreadcrumb.apply(_this, tslib_1.__spread(args));
57
- },
58
- type: 'console',
59
- });
49
+ utils_1.addInstrumentationHandler('console', _consoleBreadcrumb);
60
50
  }
61
51
  if (this._options.dom) {
62
- utils_1.addInstrumentationHandler({
63
- callback: function () {
64
- var args = [];
65
- for (var _i = 0; _i < arguments.length; _i++) {
66
- args[_i] = arguments[_i];
67
- }
68
- _this._domBreadcrumb.apply(_this, tslib_1.__spread(args));
69
- },
70
- type: 'dom',
71
- });
52
+ utils_1.addInstrumentationHandler('dom', _domBreadcrumb(this._options.dom));
72
53
  }
73
54
  if (this._options.xhr) {
74
- utils_1.addInstrumentationHandler({
75
- callback: function () {
76
- var args = [];
77
- for (var _i = 0; _i < arguments.length; _i++) {
78
- args[_i] = arguments[_i];
79
- }
80
- _this._xhrBreadcrumb.apply(_this, tslib_1.__spread(args));
81
- },
82
- type: 'xhr',
83
- });
55
+ utils_1.addInstrumentationHandler('xhr', _xhrBreadcrumb);
84
56
  }
85
57
  if (this._options.fetch) {
86
- utils_1.addInstrumentationHandler({
87
- callback: function () {
88
- var args = [];
89
- for (var _i = 0; _i < arguments.length; _i++) {
90
- args[_i] = arguments[_i];
91
- }
92
- _this._fetchBreadcrumb.apply(_this, tslib_1.__spread(args));
93
- },
94
- type: 'fetch',
95
- });
58
+ utils_1.addInstrumentationHandler('fetch', _fetchBreadcrumb);
96
59
  }
97
60
  if (this._options.history) {
98
- utils_1.addInstrumentationHandler({
99
- callback: function () {
100
- var args = [];
101
- for (var _i = 0; _i < arguments.length; _i++) {
102
- args[_i] = arguments[_i];
103
- }
104
- _this._historyBreadcrumb.apply(_this, tslib_1.__spread(args));
105
- },
106
- type: 'history',
107
- });
61
+ utils_1.addInstrumentationHandler('history', _historyBreadcrumb);
108
62
  }
109
63
  };
110
64
  /**
111
- * Creates breadcrumbs from console API calls
112
- */
113
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
- Breadcrumbs.prototype._consoleBreadcrumb = function (handlerData) {
115
- var breadcrumb = {
116
- category: 'console',
117
- data: {
118
- arguments: handlerData.args,
119
- logger: 'console',
120
- },
121
- level: types_1.Severity.fromString(handlerData.level),
122
- message: utils_1.safeJoin(handlerData.args, ' '),
123
- };
124
- if (handlerData.level === 'assert') {
125
- if (handlerData.args[0] === false) {
126
- breadcrumb.message = "Assertion failed: " + (utils_1.safeJoin(handlerData.args.slice(1), ' ') || 'console.assert');
127
- breadcrumb.data.arguments = handlerData.args.slice(1);
128
- }
129
- else {
130
- // Don't capture a breadcrumb for passed assertions
131
- return;
132
- }
133
- }
134
- core_1.getCurrentHub().addBreadcrumb(breadcrumb, {
135
- input: handlerData.args,
136
- level: handlerData.level,
137
- });
138
- };
139
- /**
140
- * Creates breadcrumbs from DOM API calls
65
+ * @inheritDoc
141
66
  */
67
+ Breadcrumbs.id = 'Breadcrumbs';
68
+ return Breadcrumbs;
69
+ }());
70
+ exports.Breadcrumbs = Breadcrumbs;
71
+ /**
72
+ * A HOC that creaes a function that creates breadcrumbs from DOM API calls.
73
+ * This is a HOC so that we get access to dom options in the closure.
74
+ */
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ function _domBreadcrumb(dom) {
142
77
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
- Breadcrumbs.prototype._domBreadcrumb = function (handlerData) {
78
+ function _innerDomBreadcrumb(handlerData) {
144
79
  var target;
145
- var keyAttrs = typeof this._options.dom === 'object' ? this._options.dom.serializeAttribute : undefined;
80
+ var keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;
146
81
  if (typeof keyAttrs === 'string') {
147
82
  keyAttrs = [keyAttrs];
148
83
  }
@@ -166,104 +101,128 @@ var Breadcrumbs = /** @class */ (function () {
166
101
  name: handlerData.name,
167
102
  global: handlerData.global,
168
103
  });
104
+ }
105
+ return _innerDomBreadcrumb;
106
+ }
107
+ /**
108
+ * Creates breadcrumbs from console API calls
109
+ */
110
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
111
+ function _consoleBreadcrumb(handlerData) {
112
+ var breadcrumb = {
113
+ category: 'console',
114
+ data: {
115
+ arguments: handlerData.args,
116
+ logger: 'console',
117
+ },
118
+ level: utils_1.severityFromString(handlerData.level),
119
+ message: utils_1.safeJoin(handlerData.args, ' '),
169
120
  };
170
- /**
171
- * Creates breadcrumbs from XHR API calls
172
- */
173
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
174
- Breadcrumbs.prototype._xhrBreadcrumb = function (handlerData) {
175
- if (handlerData.endTimestamp) {
176
- // We only capture complete, non-sentry requests
177
- if (handlerData.xhr.__sentry_own_request__) {
178
- return;
179
- }
180
- var _a = handlerData.xhr.__sentry_xhr__ || {}, method = _a.method, url = _a.url, status_code = _a.status_code, body = _a.body;
181
- core_1.getCurrentHub().addBreadcrumb({
182
- category: 'xhr',
183
- data: {
184
- method: method,
185
- url: url,
186
- status_code: status_code,
187
- },
188
- type: 'http',
189
- }, {
190
- xhr: handlerData.xhr,
191
- input: body,
192
- });
193
- return;
121
+ if (handlerData.level === 'assert') {
122
+ if (handlerData.args[0] === false) {
123
+ breadcrumb.message = "Assertion failed: " + (utils_1.safeJoin(handlerData.args.slice(1), ' ') || 'console.assert');
124
+ breadcrumb.data.arguments = handlerData.args.slice(1);
194
125
  }
195
- };
196
- /**
197
- * Creates breadcrumbs from fetch API calls
198
- */
199
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
200
- Breadcrumbs.prototype._fetchBreadcrumb = function (handlerData) {
201
- // We only capture complete fetch requests
202
- if (!handlerData.endTimestamp) {
126
+ else {
127
+ // Don't capture a breadcrumb for passed assertions
203
128
  return;
204
129
  }
205
- if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {
206
- // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)
130
+ }
131
+ core_1.getCurrentHub().addBreadcrumb(breadcrumb, {
132
+ input: handlerData.args,
133
+ level: handlerData.level,
134
+ });
135
+ }
136
+ /**
137
+ * Creates breadcrumbs from XHR API calls
138
+ */
139
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
140
+ function _xhrBreadcrumb(handlerData) {
141
+ if (handlerData.endTimestamp) {
142
+ // We only capture complete, non-sentry requests
143
+ if (handlerData.xhr.__sentry_own_request__) {
207
144
  return;
208
145
  }
209
- if (handlerData.error) {
210
- core_1.getCurrentHub().addBreadcrumb({
211
- category: 'fetch',
212
- data: handlerData.fetchData,
213
- level: types_1.Severity.Error,
214
- type: 'http',
215
- }, {
216
- data: handlerData.error,
217
- input: handlerData.args,
218
- });
219
- }
220
- else {
221
- core_1.getCurrentHub().addBreadcrumb({
222
- category: 'fetch',
223
- data: tslib_1.__assign(tslib_1.__assign({}, handlerData.fetchData), { status_code: handlerData.response.status }),
224
- type: 'http',
225
- }, {
226
- input: handlerData.args,
227
- response: handlerData.response,
228
- });
229
- }
230
- };
231
- /**
232
- * Creates breadcrumbs from history API calls
233
- */
234
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
235
- Breadcrumbs.prototype._historyBreadcrumb = function (handlerData) {
236
- var global = utils_1.getGlobalObject();
237
- var from = handlerData.from;
238
- var to = handlerData.to;
239
- var parsedLoc = utils_1.parseUrl(global.location.href);
240
- var parsedFrom = utils_1.parseUrl(from);
241
- var parsedTo = utils_1.parseUrl(to);
242
- // Initial pushState doesn't provide `from` information
243
- if (!parsedFrom.path) {
244
- parsedFrom = parsedLoc;
245
- }
246
- // Use only the path component of the URL if the URL matches the current
247
- // document (almost all the time when using pushState)
248
- if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {
249
- to = parsedTo.relative;
250
- }
251
- if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {
252
- from = parsedFrom.relative;
253
- }
146
+ var _a = handlerData.xhr.__sentry_xhr__ || {}, method = _a.method, url = _a.url, status_code = _a.status_code, body = _a.body;
254
147
  core_1.getCurrentHub().addBreadcrumb({
255
- category: 'navigation',
148
+ category: 'xhr',
256
149
  data: {
257
- from: from,
258
- to: to,
150
+ method: method,
151
+ url: url,
152
+ status_code: status_code,
259
153
  },
154
+ type: 'http',
155
+ }, {
156
+ xhr: handlerData.xhr,
157
+ input: body,
260
158
  });
261
- };
262
- /**
263
- * @inheritDoc
264
- */
265
- Breadcrumbs.id = 'Breadcrumbs';
266
- return Breadcrumbs;
267
- }());
268
- exports.Breadcrumbs = Breadcrumbs;
159
+ return;
160
+ }
161
+ }
162
+ /**
163
+ * Creates breadcrumbs from fetch API calls
164
+ */
165
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
+ function _fetchBreadcrumb(handlerData) {
167
+ // We only capture complete fetch requests
168
+ if (!handlerData.endTimestamp) {
169
+ return;
170
+ }
171
+ if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {
172
+ // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)
173
+ return;
174
+ }
175
+ if (handlerData.error) {
176
+ core_1.getCurrentHub().addBreadcrumb({
177
+ category: 'fetch',
178
+ data: handlerData.fetchData,
179
+ level: types_1.Severity.Error,
180
+ type: 'http',
181
+ }, {
182
+ data: handlerData.error,
183
+ input: handlerData.args,
184
+ });
185
+ }
186
+ else {
187
+ core_1.getCurrentHub().addBreadcrumb({
188
+ category: 'fetch',
189
+ data: tslib_1.__assign(tslib_1.__assign({}, handlerData.fetchData), { status_code: handlerData.response.status }),
190
+ type: 'http',
191
+ }, {
192
+ input: handlerData.args,
193
+ response: handlerData.response,
194
+ });
195
+ }
196
+ }
197
+ /**
198
+ * Creates breadcrumbs from history API calls
199
+ */
200
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
201
+ function _historyBreadcrumb(handlerData) {
202
+ var global = utils_1.getGlobalObject();
203
+ var from = handlerData.from;
204
+ var to = handlerData.to;
205
+ var parsedLoc = utils_1.parseUrl(global.location.href);
206
+ var parsedFrom = utils_1.parseUrl(from);
207
+ var parsedTo = utils_1.parseUrl(to);
208
+ // Initial pushState doesn't provide `from` information
209
+ if (!parsedFrom.path) {
210
+ parsedFrom = parsedLoc;
211
+ }
212
+ // Use only the path component of the URL if the URL matches the current
213
+ // document (almost all the time when using pushState)
214
+ if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {
215
+ to = parsedTo.relative;
216
+ }
217
+ if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {
218
+ from = parsedFrom.relative;
219
+ }
220
+ core_1.getCurrentHub().addBreadcrumb({
221
+ category: 'navigation',
222
+ data: {
223
+ from: from,
224
+ to: to,
225
+ },
226
+ });
227
+ }
269
228
  //# sourceMappingURL=breadcrumbs.js.map
@@ -1 +1 @@
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,uCAOuB;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,KAAK;YAClB,OAAO,EAAE,2BAAmB,CAAC,KAAK,CAAC;SACpC,EACD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AAC;QACzC,IAAI,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;QAC5B,IAAI,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC;QACxB,IAAM,SAAS,GAAG,gBAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,UAAU,GAAG,gBAAQ,CAAC,IAAI,CAAC,CAAC;QAChC,IAAM,QAAQ,GAAG,gBAAQ,CAAC,EAAE,CAAC,CAAC;QAE9B,uDAAuD;QACvD,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;YACpB,UAAU,GAAG,SAAS,CAAC;SACxB;QAED,wEAAwE;QACxE,sDAAsD;QACtD,IAAI,SAAS,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE;YAChF,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC;SACxB;QACD,IAAI,SAAS,CAAC,QAAQ,KAAK,UAAU,CAAC,QAAQ,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE;YACpF,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;SAC5B;QAED,oBAAa,EAAE,CAAC,aAAa,CAAC;YAC5B,QAAQ,EAAE,YAAY;YACtB,IAAI,EAAE;gBACJ,IAAI,MAAA;gBACJ,EAAE,IAAA;aACH;SACF,CAAC,CAAC;IACL,CAAC;IAxRD;;OAEG;IACW,cAAE,GAAW,aAAa,CAAC;IAsR3C,kBAAC;CAAA,AA1RD,IA0RC;AA1RY,kCAAW","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} 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({\n callback: (...args) => {\n this._consoleBreadcrumb(...args);\n },\n type: 'console',\n });\n }\n if (this._options.dom) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._domBreadcrumb(...args);\n },\n type: 'dom',\n });\n }\n if (this._options.xhr) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._xhrBreadcrumb(...args);\n },\n type: 'xhr',\n });\n }\n if (this._options.fetch) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._fetchBreadcrumb(...args);\n },\n type: 'fetch',\n });\n }\n if (this._options.history) {\n addInstrumentationHandler({\n callback: (...args) => {\n this._historyBreadcrumb(...args);\n },\n type: 'history',\n });\n }\n }\n\n /**\n * Creates breadcrumbs from console API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _consoleBreadcrumb(handlerData: { [key: string]: any }): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: handlerData.args,\n logger: 'console',\n },\n level: Severity.fromString(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 DOM API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _domBreadcrumb(handlerData: { [key: string]: any }): void {\n let target;\n let keyAttrs = typeof this._options.dom === 'object' ? this._options.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 /**\n * Creates breadcrumbs from XHR API calls\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _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\n private _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\n private _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}\n"]}
1
+ {"version":3,"file":"bread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ED;;GAEG;AACH,8DAA8D;AAC9D,SAAS,kBAAkB,CAAC,WAAmC;IAC7D,IAAM,MAAM,GAAG,uBAAe,EAAU,CAAC;IACzC,IAAI,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAC5B,IAAI,EAAE,GAAG,WAAW,CAAC,EAAE,CAAC;IACxB,IAAM,SAAS,GAAG,gBAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,UAAU,GAAG,gBAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,IAAM,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,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"]}
@@ -17,19 +17,5 @@ export declare class Dedupe implements Integration {
17
17
  * @inheritDoc
18
18
  */
19
19
  setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
20
- /** JSDoc */
21
- private _shouldDropEvent;
22
- /** JSDoc */
23
- private _isSameMessageEvent;
24
- /** JSDoc */
25
- private _getFramesFromEvent;
26
- /** JSDoc */
27
- private _isSameStacktrace;
28
- /** JSDoc */
29
- private _getExceptionFromEvent;
30
- /** JSDoc */
31
- private _isSameExceptionEvent;
32
- /** JSDoc */
33
- private _isSameFingerprint;
34
20
  }
35
21
  //# sourceMappingURL=dedupe.d.ts.map
@@ -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;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;IAoB7G,YAAY;IACZ,OAAO,CAAC,gBAAgB;IAgBxB,YAAY;IACZ,OAAO,CAAC,mBAAmB;IA6B3B,YAAY;IACZ,OAAO,CAAC,mBAAmB;IAgB3B,YAAY;IACZ,OAAO,CAAC,iBAAiB;IAwCzB,YAAY;IACZ,OAAO,CAAC,sBAAsB;IAI9B,YAAY;IACZ,OAAO,CAAC,qBAAqB;IAuB7B,YAAY;IACZ,OAAO,CAAC,kBAAkB;CAwB3B"}
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"}