@sentry/browser 6.14.3 → 6.17.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.
Files changed (119) hide show
  1. package/build/bundle.es6.js +1271 -1393
  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 +1367 -1520
  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/backend.d.ts +2 -2
  10. package/dist/backend.d.ts.map +1 -1
  11. package/dist/backend.js +1 -2
  12. package/dist/backend.js.map +1 -1
  13. package/dist/eventbuilder.d.ts +2 -2
  14. package/dist/eventbuilder.d.ts.map +1 -1
  15. package/dist/eventbuilder.js +20 -13
  16. package/dist/eventbuilder.js.map +1 -1
  17. package/dist/exports.d.ts +1 -1
  18. package/dist/exports.d.ts.map +1 -1
  19. package/dist/exports.js +0 -3
  20. package/dist/exports.js.map +1 -1
  21. package/dist/helpers.d.ts.map +1 -1
  22. package/dist/helpers.js +26 -37
  23. package/dist/helpers.js.map +1 -1
  24. package/dist/integrations/breadcrumbs.d.ts +0 -20
  25. package/dist/integrations/breadcrumbs.d.ts.map +1 -1
  26. package/dist/integrations/breadcrumbs.js +132 -174
  27. package/dist/integrations/breadcrumbs.js.map +1 -1
  28. package/dist/integrations/dedupe.d.ts +0 -14
  29. package/dist/integrations/dedupe.d.ts.map +1 -1
  30. package/dist/integrations/dedupe.js +126 -126
  31. package/dist/integrations/dedupe.js.map +1 -1
  32. package/dist/integrations/globalhandlers.d.ts +7 -25
  33. package/dist/integrations/globalhandlers.d.ts.map +1 -1
  34. package/dist/integrations/globalhandlers.js +176 -169
  35. package/dist/integrations/globalhandlers.js.map +1 -1
  36. package/dist/integrations/linkederrors.d.ts +15 -13
  37. package/dist/integrations/linkederrors.d.ts.map +1 -1
  38. package/dist/integrations/linkederrors.js +26 -28
  39. package/dist/integrations/linkederrors.js.map +1 -1
  40. package/dist/integrations/trycatch.d.ts +0 -8
  41. package/dist/integrations/trycatch.d.ts.map +1 -1
  42. package/dist/integrations/trycatch.js +154 -153
  43. package/dist/integrations/trycatch.js.map +1 -1
  44. package/dist/integrations/useragent.js +2 -3
  45. package/dist/integrations/useragent.js.map +1 -1
  46. package/dist/sdk.d.ts.map +1 -1
  47. package/dist/sdk.js +23 -19
  48. package/dist/sdk.js.map +1 -1
  49. package/dist/transports/base.d.ts +9 -4
  50. package/dist/transports/base.d.ts.map +1 -1
  51. package/dist/transports/base.js +23 -19
  52. package/dist/transports/base.js.map +1 -1
  53. package/dist/transports/fetch.d.ts +2 -10
  54. package/dist/transports/fetch.d.ts.map +1 -1
  55. package/dist/transports/fetch.js +3 -17
  56. package/dist/transports/fetch.js.map +1 -1
  57. package/dist/transports/utils.d.ts.map +1 -1
  58. package/dist/transports/utils.js +7 -5
  59. package/dist/transports/utils.js.map +1 -1
  60. package/dist/transports/xhr.d.ts +2 -10
  61. package/dist/transports/xhr.d.ts.map +1 -1
  62. package/dist/transports/xhr.js +3 -17
  63. package/dist/transports/xhr.js.map +1 -1
  64. package/esm/backend.d.ts +2 -2
  65. package/esm/backend.d.ts.map +1 -1
  66. package/esm/backend.js +1 -2
  67. package/esm/backend.js.map +1 -1
  68. package/esm/eventbuilder.d.ts +2 -2
  69. package/esm/eventbuilder.d.ts.map +1 -1
  70. package/esm/eventbuilder.js +21 -14
  71. package/esm/eventbuilder.js.map +1 -1
  72. package/esm/exports.d.ts +1 -1
  73. package/esm/exports.d.ts.map +1 -1
  74. package/esm/exports.js +0 -1
  75. package/esm/exports.js.map +1 -1
  76. package/esm/helpers.d.ts.map +1 -1
  77. package/esm/helpers.js +28 -39
  78. package/esm/helpers.js.map +1 -1
  79. package/esm/integrations/breadcrumbs.d.ts +0 -20
  80. package/esm/integrations/breadcrumbs.d.ts.map +1 -1
  81. package/esm/integrations/breadcrumbs.js +134 -176
  82. package/esm/integrations/breadcrumbs.js.map +1 -1
  83. package/esm/integrations/dedupe.d.ts +0 -14
  84. package/esm/integrations/dedupe.d.ts.map +1 -1
  85. package/esm/integrations/dedupe.js +126 -126
  86. package/esm/integrations/dedupe.js.map +1 -1
  87. package/esm/integrations/globalhandlers.d.ts +7 -25
  88. package/esm/integrations/globalhandlers.d.ts.map +1 -1
  89. package/esm/integrations/globalhandlers.js +178 -171
  90. package/esm/integrations/globalhandlers.js.map +1 -1
  91. package/esm/integrations/linkederrors.d.ts +15 -13
  92. package/esm/integrations/linkederrors.d.ts.map +1 -1
  93. package/esm/integrations/linkederrors.js +24 -28
  94. package/esm/integrations/linkederrors.js.map +1 -1
  95. package/esm/integrations/trycatch.d.ts +0 -8
  96. package/esm/integrations/trycatch.d.ts.map +1 -1
  97. package/esm/integrations/trycatch.js +155 -154
  98. package/esm/integrations/trycatch.js.map +1 -1
  99. package/esm/integrations/useragent.js +2 -3
  100. package/esm/integrations/useragent.js.map +1 -1
  101. package/esm/sdk.d.ts.map +1 -1
  102. package/esm/sdk.js +24 -20
  103. package/esm/sdk.js.map +1 -1
  104. package/esm/transports/base.d.ts +9 -4
  105. package/esm/transports/base.d.ts.map +1 -1
  106. package/esm/transports/base.js +25 -21
  107. package/esm/transports/base.js.map +1 -1
  108. package/esm/transports/fetch.d.ts +2 -10
  109. package/esm/transports/fetch.d.ts.map +1 -1
  110. package/esm/transports/fetch.js +3 -17
  111. package/esm/transports/fetch.js.map +1 -1
  112. package/esm/transports/utils.d.ts.map +1 -1
  113. package/esm/transports/utils.js +8 -6
  114. package/esm/transports/utils.js.map +1 -1
  115. package/esm/transports/xhr.d.ts +2 -10
  116. package/esm/transports/xhr.d.ts.map +1 -1
  117. package/esm/transports/xhr.js +3 -17
  118. package/esm/transports/xhr.js.map +1 -1
  119. package/package.json +15 -17
@@ -3,7 +3,6 @@ var tslib_1 = require("tslib");
3
3
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
4
  /* eslint-disable max-lines */
5
5
  var core_1 = require("@sentry/core");
6
- var types_1 = require("@sentry/types");
7
6
  var utils_1 = require("@sentry/utils");
8
7
  /**
9
8
  * Default Breadcrumbs instrumentations
@@ -45,104 +44,39 @@ var Breadcrumbs = /** @class */ (function () {
45
44
  * - History API
46
45
  */
47
46
  Breadcrumbs.prototype.setupOnce = function () {
48
- var _this = this;
49
47
  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
- });
48
+ utils_1.addInstrumentationHandler('console', _consoleBreadcrumb);
60
49
  }
61
50
  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
- });
51
+ utils_1.addInstrumentationHandler('dom', _domBreadcrumb(this._options.dom));
72
52
  }
73
53
  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
- });
54
+ utils_1.addInstrumentationHandler('xhr', _xhrBreadcrumb);
84
55
  }
85
56
  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
- });
57
+ utils_1.addInstrumentationHandler('fetch', _fetchBreadcrumb);
96
58
  }
97
59
  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
- });
60
+ utils_1.addInstrumentationHandler('history', _historyBreadcrumb);
108
61
  }
109
62
  };
110
63
  /**
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
64
+ * @inheritDoc
141
65
  */
66
+ Breadcrumbs.id = 'Breadcrumbs';
67
+ return Breadcrumbs;
68
+ }());
69
+ exports.Breadcrumbs = Breadcrumbs;
70
+ /**
71
+ * A HOC that creaes a function that creates breadcrumbs from DOM API calls.
72
+ * This is a HOC so that we get access to dom options in the closure.
73
+ */
74
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
+ function _domBreadcrumb(dom) {
142
76
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
- Breadcrumbs.prototype._domBreadcrumb = function (handlerData) {
77
+ function _innerDomBreadcrumb(handlerData) {
144
78
  var target;
145
- var keyAttrs = typeof this._options.dom === 'object' ? this._options.dom.serializeAttribute : undefined;
79
+ var keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;
146
80
  if (typeof keyAttrs === 'string') {
147
81
  keyAttrs = [keyAttrs];
148
82
  }
@@ -166,104 +100,128 @@ var Breadcrumbs = /** @class */ (function () {
166
100
  name: handlerData.name,
167
101
  global: handlerData.global,
168
102
  });
103
+ }
104
+ return _innerDomBreadcrumb;
105
+ }
106
+ /**
107
+ * Creates breadcrumbs from console API calls
108
+ */
109
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
+ function _consoleBreadcrumb(handlerData) {
111
+ var breadcrumb = {
112
+ category: 'console',
113
+ data: {
114
+ arguments: handlerData.args,
115
+ logger: 'console',
116
+ },
117
+ level: utils_1.severityFromString(handlerData.level),
118
+ message: utils_1.safeJoin(handlerData.args, ' '),
169
119
  };
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;
120
+ if (handlerData.level === 'assert') {
121
+ if (handlerData.args[0] === false) {
122
+ breadcrumb.message = "Assertion failed: " + (utils_1.safeJoin(handlerData.args.slice(1), ' ') || 'console.assert');
123
+ breadcrumb.data.arguments = handlerData.args.slice(1);
194
124
  }
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) {
125
+ else {
126
+ // Don't capture a breadcrumb for passed assertions
203
127
  return;
204
128
  }
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)
129
+ }
130
+ core_1.getCurrentHub().addBreadcrumb(breadcrumb, {
131
+ input: handlerData.args,
132
+ level: handlerData.level,
133
+ });
134
+ }
135
+ /**
136
+ * Creates breadcrumbs from XHR API calls
137
+ */
138
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
+ function _xhrBreadcrumb(handlerData) {
140
+ if (handlerData.endTimestamp) {
141
+ // We only capture complete, non-sentry requests
142
+ if (handlerData.xhr.__sentry_own_request__) {
207
143
  return;
208
144
  }
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
- }
145
+ var _a = handlerData.xhr.__sentry_xhr__ || {}, method = _a.method, url = _a.url, status_code = _a.status_code, body = _a.body;
254
146
  core_1.getCurrentHub().addBreadcrumb({
255
- category: 'navigation',
147
+ category: 'xhr',
256
148
  data: {
257
- from: from,
258
- to: to,
149
+ method: method,
150
+ url: url,
151
+ status_code: status_code,
259
152
  },
153
+ type: 'http',
154
+ }, {
155
+ xhr: handlerData.xhr,
156
+ input: body,
260
157
  });
261
- };
262
- /**
263
- * @inheritDoc
264
- */
265
- Breadcrumbs.id = 'Breadcrumbs';
266
- return Breadcrumbs;
267
- }());
268
- exports.Breadcrumbs = Breadcrumbs;
158
+ return;
159
+ }
160
+ }
161
+ /**
162
+ * Creates breadcrumbs from fetch API calls
163
+ */
164
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
165
+ function _fetchBreadcrumb(handlerData) {
166
+ // We only capture complete fetch requests
167
+ if (!handlerData.endTimestamp) {
168
+ return;
169
+ }
170
+ if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {
171
+ // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)
172
+ return;
173
+ }
174
+ if (handlerData.error) {
175
+ core_1.getCurrentHub().addBreadcrumb({
176
+ category: 'fetch',
177
+ data: handlerData.fetchData,
178
+ level: 'error',
179
+ type: 'http',
180
+ }, {
181
+ data: handlerData.error,
182
+ input: handlerData.args,
183
+ });
184
+ }
185
+ else {
186
+ core_1.getCurrentHub().addBreadcrumb({
187
+ category: 'fetch',
188
+ data: tslib_1.__assign(tslib_1.__assign({}, handlerData.fetchData), { status_code: handlerData.response.status }),
189
+ type: 'http',
190
+ }, {
191
+ input: handlerData.args,
192
+ response: handlerData.response,
193
+ });
194
+ }
195
+ }
196
+ /**
197
+ * Creates breadcrumbs from history API calls
198
+ */
199
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
200
+ function _historyBreadcrumb(handlerData) {
201
+ var global = utils_1.getGlobalObject();
202
+ var from = handlerData.from;
203
+ var to = handlerData.to;
204
+ var parsedLoc = utils_1.parseUrl(global.location.href);
205
+ var parsedFrom = utils_1.parseUrl(from);
206
+ var parsedTo = utils_1.parseUrl(to);
207
+ // Initial pushState doesn't provide `from` information
208
+ if (!parsedFrom.path) {
209
+ parsedFrom = parsedLoc;
210
+ }
211
+ // Use only the path component of the URL if the URL matches the current
212
+ // document (almost all the time when using pushState)
213
+ if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {
214
+ to = parsedTo.relative;
215
+ }
216
+ if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {
217
+ from = parsedFrom.relative;
218
+ }
219
+ core_1.getCurrentHub().addBreadcrumb({
220
+ category: 'navigation',
221
+ data: {
222
+ from: from,
223
+ to: to,
224
+ },
225
+ });
226
+ }
269
227
  //# 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,CAA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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":"breadcrumbs.js","sourceRoot":"","sources":["../../src/integrations/breadcrumbs.ts"],"names":[],"mappings":";;AAAA,+DAA+D;AAC/D,8BAA8B;AAC9B,qCAA6C;AAE7C,uCAQuB;AAYvB;;;GAGG;AACH;IAcE;;OAEG;IACH,qBAAmB,OAAqC;QAXxD;;WAEG;QACI,SAAI,GAAW,WAAW,CAAC,EAAE,CAAC;QASnC,IAAI,CAAC,QAAQ,sBACX,OAAO,EAAE,IAAI,EACb,GAAG,EAAE,IAAI,EACT,KAAK,EAAE,IAAI,EACX,OAAO,EAAE,IAAI,EACb,MAAM,EAAE,IAAI,EACZ,GAAG,EAAE,IAAI,IACN,OAAO,CACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,yCAAmB,GAA1B,UAA2B,KAAY;QACrC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzB,OAAO;SACR;QACD,oBAAa,EAAE,CAAC,aAAa,CAC3B;YACE,QAAQ,EAAE,aAAU,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAE;YAC5E,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,2BAAmB,CAAC,KAAK,CAAC;SACpC,E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AE,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 } 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: '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"}