@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
@@ -1,9 +1,8 @@
1
- import { __assign, __read, __spread } from "tslib";
1
+ import { __assign } from "tslib";
2
2
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
3
3
  /* eslint-disable max-lines */
4
4
  import { getCurrentHub } from '@sentry/core';
5
- import { Severity } from '@sentry/types';
6
- import { addInstrumentationHandler, getEventDescription, getGlobalObject, htmlTreeAsString, parseUrl, safeJoin, } from '@sentry/utils';
5
+ import { addInstrumentationHandler, getEventDescription, getGlobalObject, htmlTreeAsString, parseUrl, safeJoin, severityFromString, } from '@sentry/utils';
7
6
  /**
8
7
  * Default Breadcrumbs instrumentations
9
8
  * TODO: Deprecated - with v6, this will be renamed to `Instrument`
@@ -44,104 +43,39 @@ var Breadcrumbs = /** @class */ (function () {
44
43
  * - History API
45
44
  */
46
45
  Breadcrumbs.prototype.setupOnce = function () {
47
- var _this = this;
48
46
  if (this._options.console) {
49
- addInstrumentationHandler({
50
- callback: function () {
51
- var args = [];
52
- for (var _i = 0; _i < arguments.length; _i++) {
53
- args[_i] = arguments[_i];
54
- }
55
- _this._consoleBreadcrumb.apply(_this, __spread(args));
56
- },
57
- type: 'console',
58
- });
47
+ addInstrumentationHandler('console', _consoleBreadcrumb);
59
48
  }
60
49
  if (this._options.dom) {
61
- addInstrumentationHandler({
62
- callback: function () {
63
- var args = [];
64
- for (var _i = 0; _i < arguments.length; _i++) {
65
- args[_i] = arguments[_i];
66
- }
67
- _this._domBreadcrumb.apply(_this, __spread(args));
68
- },
69
- type: 'dom',
70
- });
50
+ addInstrumentationHandler('dom', _domBreadcrumb(this._options.dom));
71
51
  }
72
52
  if (this._options.xhr) {
73
- addInstrumentationHandler({
74
- callback: function () {
75
- var args = [];
76
- for (var _i = 0; _i < arguments.length; _i++) {
77
- args[_i] = arguments[_i];
78
- }
79
- _this._xhrBreadcrumb.apply(_this, __spread(args));
80
- },
81
- type: 'xhr',
82
- });
53
+ addInstrumentationHandler('xhr', _xhrBreadcrumb);
83
54
  }
84
55
  if (this._options.fetch) {
85
- addInstrumentationHandler({
86
- callback: function () {
87
- var args = [];
88
- for (var _i = 0; _i < arguments.length; _i++) {
89
- args[_i] = arguments[_i];
90
- }
91
- _this._fetchBreadcrumb.apply(_this, __spread(args));
92
- },
93
- type: 'fetch',
94
- });
56
+ addInstrumentationHandler('fetch', _fetchBreadcrumb);
95
57
  }
96
58
  if (this._options.history) {
97
- addInstrumentationHandler({
98
- callback: function () {
99
- var args = [];
100
- for (var _i = 0; _i < arguments.length; _i++) {
101
- args[_i] = arguments[_i];
102
- }
103
- _this._historyBreadcrumb.apply(_this, __spread(args));
104
- },
105
- type: 'history',
106
- });
59
+ addInstrumentationHandler('history', _historyBreadcrumb);
107
60
  }
108
61
  };
109
62
  /**
110
- * Creates breadcrumbs from console API calls
111
- */
112
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
- Breadcrumbs.prototype._consoleBreadcrumb = function (handlerData) {
114
- var breadcrumb = {
115
- category: 'console',
116
- data: {
117
- arguments: handlerData.args,
118
- logger: 'console',
119
- },
120
- level: Severity.fromString(handlerData.level),
121
- message: safeJoin(handlerData.args, ' '),
122
- };
123
- if (handlerData.level === 'assert') {
124
- if (handlerData.args[0] === false) {
125
- breadcrumb.message = "Assertion failed: " + (safeJoin(handlerData.args.slice(1), ' ') || 'console.assert');
126
- breadcrumb.data.arguments = handlerData.args.slice(1);
127
- }
128
- else {
129
- // Don't capture a breadcrumb for passed assertions
130
- return;
131
- }
132
- }
133
- getCurrentHub().addBreadcrumb(breadcrumb, {
134
- input: handlerData.args,
135
- level: handlerData.level,
136
- });
137
- };
138
- /**
139
- * Creates breadcrumbs from DOM API calls
63
+ * @inheritDoc
140
64
  */
65
+ Breadcrumbs.id = 'Breadcrumbs';
66
+ return Breadcrumbs;
67
+ }());
68
+ export { Breadcrumbs };
69
+ /**
70
+ * A HOC that creaes a function that creates breadcrumbs from DOM API calls.
71
+ * This is a HOC so that we get access to dom options in the closure.
72
+ */
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ function _domBreadcrumb(dom) {
141
75
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
- Breadcrumbs.prototype._domBreadcrumb = function (handlerData) {
76
+ function _innerDomBreadcrumb(handlerData) {
143
77
  var target;
144
- var keyAttrs = typeof this._options.dom === 'object' ? this._options.dom.serializeAttribute : undefined;
78
+ var keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;
145
79
  if (typeof keyAttrs === 'string') {
146
80
  keyAttrs = [keyAttrs];
147
81
  }
@@ -165,104 +99,128 @@ var Breadcrumbs = /** @class */ (function () {
165
99
  name: handlerData.name,
166
100
  global: handlerData.global,
167
101
  });
102
+ }
103
+ return _innerDomBreadcrumb;
104
+ }
105
+ /**
106
+ * Creates breadcrumbs from console API calls
107
+ */
108
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
109
+ function _consoleBreadcrumb(handlerData) {
110
+ var breadcrumb = {
111
+ category: 'console',
112
+ data: {
113
+ arguments: handlerData.args,
114
+ logger: 'console',
115
+ },
116
+ level: severityFromString(handlerData.level),
117
+ message: safeJoin(handlerData.args, ' '),
168
118
  };
169
- /**
170
- * Creates breadcrumbs from XHR API calls
171
- */
172
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
173
- Breadcrumbs.prototype._xhrBreadcrumb = function (handlerData) {
174
- if (handlerData.endTimestamp) {
175
- // We only capture complete, non-sentry requests
176
- if (handlerData.xhr.__sentry_own_request__) {
177
- return;
178
- }
179
- var _a = handlerData.xhr.__sentry_xhr__ || {}, method = _a.method, url = _a.url, status_code = _a.status_code, body = _a.body;
180
- getCurrentHub().addBreadcrumb({
181
- category: 'xhr',
182
- data: {
183
- method: method,
184
- url: url,
185
- status_code: status_code,
186
- },
187
- type: 'http',
188
- }, {
189
- xhr: handlerData.xhr,
190
- input: body,
191
- });
192
- return;
119
+ if (handlerData.level === 'assert') {
120
+ if (handlerData.args[0] === false) {
121
+ breadcrumb.message = "Assertion failed: " + (safeJoin(handlerData.args.slice(1), ' ') || 'console.assert');
122
+ breadcrumb.data.arguments = handlerData.args.slice(1);
193
123
  }
194
- };
195
- /**
196
- * Creates breadcrumbs from fetch API calls
197
- */
198
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
199
- Breadcrumbs.prototype._fetchBreadcrumb = function (handlerData) {
200
- // We only capture complete fetch requests
201
- if (!handlerData.endTimestamp) {
124
+ else {
125
+ // Don't capture a breadcrumb for passed assertions
202
126
  return;
203
127
  }
204
- if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {
205
- // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)
128
+ }
129
+ getCurrentHub().addBreadcrumb(breadcrumb, {
130
+ input: handlerData.args,
131
+ level: handlerData.level,
132
+ });
133
+ }
134
+ /**
135
+ * Creates breadcrumbs from XHR API calls
136
+ */
137
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
138
+ function _xhrBreadcrumb(handlerData) {
139
+ if (handlerData.endTimestamp) {
140
+ // We only capture complete, non-sentry requests
141
+ if (handlerData.xhr.__sentry_own_request__) {
206
142
  return;
207
143
  }
208
- if (handlerData.error) {
209
- getCurrentHub().addBreadcrumb({
210
- category: 'fetch',
211
- data: handlerData.fetchData,
212
- level: Severity.Error,
213
- type: 'http',
214
- }, {
215
- data: handlerData.error,
216
- input: handlerData.args,
217
- });
218
- }
219
- else {
220
- getCurrentHub().addBreadcrumb({
221
- category: 'fetch',
222
- data: __assign(__assign({}, handlerData.fetchData), { status_code: handlerData.response.status }),
223
- type: 'http',
224
- }, {
225
- input: handlerData.args,
226
- response: handlerData.response,
227
- });
228
- }
229
- };
230
- /**
231
- * Creates breadcrumbs from history API calls
232
- */
233
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
234
- Breadcrumbs.prototype._historyBreadcrumb = function (handlerData) {
235
- var global = getGlobalObject();
236
- var from = handlerData.from;
237
- var to = handlerData.to;
238
- var parsedLoc = parseUrl(global.location.href);
239
- var parsedFrom = parseUrl(from);
240
- var parsedTo = parseUrl(to);
241
- // Initial pushState doesn't provide `from` information
242
- if (!parsedFrom.path) {
243
- parsedFrom = parsedLoc;
244
- }
245
- // Use only the path component of the URL if the URL matches the current
246
- // document (almost all the time when using pushState)
247
- if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {
248
- to = parsedTo.relative;
249
- }
250
- if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {
251
- from = parsedFrom.relative;
252
- }
144
+ var _a = handlerData.xhr.__sentry_xhr__ || {}, method = _a.method, url = _a.url, status_code = _a.status_code, body = _a.body;
253
145
  getCurrentHub().addBreadcrumb({
254
- category: 'navigation',
146
+ category: 'xhr',
255
147
  data: {
256
- from: from,
257
- to: to,
148
+ method: method,
149
+ url: url,
150
+ status_code: status_code,
258
151
  },
152
+ type: 'http',
153
+ }, {
154
+ xhr: handlerData.xhr,
155
+ input: body,
259
156
  });
260
- };
261
- /**
262
- * @inheritDoc
263
- */
264
- Breadcrumbs.id = 'Breadcrumbs';
265
- return Breadcrumbs;
266
- }());
267
- export { Breadcrumbs };
157
+ return;
158
+ }
159
+ }
160
+ /**
161
+ * Creates breadcrumbs from fetch API calls
162
+ */
163
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
164
+ function _fetchBreadcrumb(handlerData) {
165
+ // We only capture complete fetch requests
166
+ if (!handlerData.endTimestamp) {
167
+ return;
168
+ }
169
+ if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {
170
+ // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)
171
+ return;
172
+ }
173
+ if (handlerData.error) {
174
+ getCurrentHub().addBreadcrumb({
175
+ category: 'fetch',
176
+ data: handlerData.fetchData,
177
+ level: 'error',
178
+ type: 'http',
179
+ }, {
180
+ data: handlerData.error,
181
+ input: handlerData.args,
182
+ });
183
+ }
184
+ else {
185
+ getCurrentHub().addBreadcrumb({
186
+ category: 'fetch',
187
+ data: __assign(__assign({}, handlerData.fetchData), { status_code: handlerData.response.status }),
188
+ type: 'http',
189
+ }, {
190
+ input: handlerData.args,
191
+ response: handlerData.response,
192
+ });
193
+ }
194
+ }
195
+ /**
196
+ * Creates breadcrumbs from history API calls
197
+ */
198
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
199
+ function _historyBreadcrumb(handlerData) {
200
+ var global = getGlobalObject();
201
+ var from = handlerData.from;
202
+ var to = handlerData.to;
203
+ var parsedLoc = parseUrl(global.location.href);
204
+ var parsedFrom = parseUrl(from);
205
+ var parsedTo = parseUrl(to);
206
+ // Initial pushState doesn't provide `from` information
207
+ if (!parsedFrom.path) {
208
+ parsedFrom = parsedLoc;
209
+ }
210
+ // Use only the path component of the URL if the URL matches the current
211
+ // document (almost all the time when using pushState)
212
+ if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {
213
+ to = parsedTo.relative;
214
+ }
215
+ if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {
216
+ from = parsedFrom.relative;
217
+ }
218
+ getCurrentHub().addBreadcrumb({
219
+ category: 'navigation',
220
+ data: {
221
+ from: from,
222
+ to: to,
223
+ },
224
+ });
225
+ }
268
226
  //# 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,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAsB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,GACT,MAAM,eAAe,CAAC;AAYvB;;;GAGG;AACH;IAcE;;OAEG;IACH,qBAAmB,OAAqC;QAXxD;;WAEG;QACI,SAAI,GAAW,WAAW,CAAC,EAAE,CAAC;QASnC,IAAI,CAAC,QAAQ,cACX,OAAO,EAAE,IAAI,EACb,GAAG,EAAE,IAAI,EACT,KAAK,EA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aAAa,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;SA1RY,WAAW","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,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAYvB;;;GAGG;AACH;IAcE;;OAEG;IACH,qBAAmB,OAAqC;QAXxD;;WAEG;QACI,SAAI,GAAW,WAAW,CAAC,EAAE,CAAC;QASnC,IAAI,CAAC,QAAQ,cACX,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,aAAa,EAAE,CAAC,aAAa,CAC3B;YACE,QAAQ,EAAE,a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,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,aAAa,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 } 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"}