@sentry/browser 6.19.2 → 6.19.5

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 (179) hide show
  1. package/build/bundle.debug.min.js +3 -0
  2. package/build/bundle.debug.min.js.map +1 -0
  3. package/build/bundle.es6.debug.min.js +3 -0
  4. package/build/bundle.es6.debug.min.js.map +1 -0
  5. package/{bundles → build}/bundle.es6.js +476 -270
  6. package/build/bundle.es6.js.map +1 -0
  7. package/build/bundle.es6.min.js +3 -0
  8. package/build/bundle.es6.min.js.map +1 -0
  9. package/{bundles → build}/bundle.js +486 -289
  10. package/build/bundle.js.map +1 -0
  11. package/build/bundle.min.js +3 -0
  12. package/build/bundle.min.js.map +1 -0
  13. package/dist/backend.d.ts.map +1 -1
  14. package/dist/backend.js +8 -0
  15. package/dist/backend.js.map +1 -1
  16. package/dist/client.d.ts.map +1 -1
  17. package/dist/client.js +2 -1
  18. package/dist/client.js.map +1 -1
  19. package/dist/eventbuilder.d.ts.map +1 -1
  20. package/dist/eventbuilder.js.map +1 -1
  21. package/dist/exports.d.ts.map +1 -1
  22. package/dist/exports.js.map +1 -1
  23. package/dist/flags.d.ts +3 -0
  24. package/dist/flags.d.ts.map +1 -0
  25. package/dist/flags.js +17 -0
  26. package/dist/flags.js.map +1 -0
  27. package/dist/helpers.d.ts.map +1 -1
  28. package/dist/helpers.js +3 -2
  29. package/dist/helpers.js.map +1 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/integrations/breadcrumbs.d.ts.map +1 -1
  33. package/dist/integrations/breadcrumbs.js.map +1 -1
  34. package/dist/integrations/dedupe.d.ts.map +1 -1
  35. package/dist/integrations/dedupe.js +2 -1
  36. package/dist/integrations/dedupe.js.map +1 -1
  37. package/dist/integrations/globalhandlers.d.ts.map +1 -1
  38. package/dist/integrations/globalhandlers.js +2 -1
  39. package/dist/integrations/globalhandlers.js.map +1 -1
  40. package/dist/integrations/index.d.ts.map +1 -1
  41. package/dist/integrations/index.js.map +1 -1
  42. package/dist/integrations/linkederrors.d.ts.map +1 -1
  43. package/dist/integrations/linkederrors.js.map +1 -1
  44. package/dist/integrations/trycatch.d.ts.map +1 -1
  45. package/dist/integrations/trycatch.js.map +1 -1
  46. package/dist/integrations/useragent.d.ts.map +1 -1
  47. package/dist/integrations/useragent.js.map +1 -1
  48. package/dist/sdk.d.ts.map +1 -1
  49. package/dist/sdk.js +4 -3
  50. package/dist/sdk.js.map +1 -1
  51. package/dist/stack-parsers.d.ts.map +1 -1
  52. package/dist/stack-parsers.js.map +1 -1
  53. package/dist/transports/base.d.ts.map +1 -1
  54. package/dist/transports/base.js +7 -6
  55. package/dist/transports/base.js.map +1 -1
  56. package/dist/transports/fetch.d.ts.map +1 -1
  57. package/dist/transports/fetch.js.map +1 -1
  58. package/dist/transports/index.d.ts +2 -0
  59. package/dist/transports/index.d.ts.map +1 -1
  60. package/dist/transports/index.js +4 -0
  61. package/dist/transports/index.js.map +1 -1
  62. package/dist/transports/new-fetch.d.ts +10 -0
  63. package/dist/transports/new-fetch.d.ts.map +1 -0
  64. package/dist/transports/new-fetch.js +27 -0
  65. package/dist/transports/new-fetch.js.map +1 -0
  66. package/dist/transports/new-xhr.d.ts +11 -0
  67. package/dist/transports/new-xhr.d.ts.map +1 -0
  68. package/dist/transports/new-xhr.js +46 -0
  69. package/dist/transports/new-xhr.js.map +1 -0
  70. package/dist/transports/utils.d.ts.map +1 -1
  71. package/dist/transports/utils.js +2 -1
  72. package/dist/transports/utils.js.map +1 -1
  73. package/dist/transports/xhr.d.ts.map +1 -1
  74. package/dist/transports/xhr.js.map +1 -1
  75. package/dist/version.d.ts.map +1 -1
  76. package/dist/version.js.map +1 -1
  77. package/esm/backend.d.ts.map +1 -1
  78. package/esm/backend.js +10 -2
  79. package/esm/backend.js.map +1 -1
  80. package/esm/client.d.ts.map +1 -1
  81. package/esm/client.js +3 -2
  82. package/esm/client.js.map +1 -1
  83. package/esm/eventbuilder.d.ts.map +1 -1
  84. package/esm/eventbuilder.js.map +1 -1
  85. package/esm/exports.d.ts.map +1 -1
  86. package/esm/exports.js.map +1 -1
  87. package/esm/flags.d.ts +3 -0
  88. package/esm/flags.d.ts.map +1 -0
  89. package/esm/flags.js +16 -0
  90. package/esm/flags.js.map +1 -0
  91. package/esm/helpers.d.ts.map +1 -1
  92. package/esm/helpers.js +4 -3
  93. package/esm/helpers.js.map +1 -1
  94. package/esm/index.d.ts.map +1 -1
  95. package/esm/index.js.map +1 -1
  96. package/esm/integrations/breadcrumbs.d.ts.map +1 -1
  97. package/esm/integrations/breadcrumbs.js.map +1 -1
  98. package/esm/integrations/dedupe.d.ts.map +1 -1
  99. package/esm/integrations/dedupe.js +3 -2
  100. package/esm/integrations/dedupe.js.map +1 -1
  101. package/esm/integrations/globalhandlers.d.ts.map +1 -1
  102. package/esm/integrations/globalhandlers.js +3 -2
  103. package/esm/integrations/globalhandlers.js.map +1 -1
  104. package/esm/integrations/index.d.ts.map +1 -1
  105. package/esm/integrations/index.js.map +1 -1
  106. package/esm/integrations/linkederrors.d.ts.map +1 -1
  107. package/esm/integrations/linkederrors.js.map +1 -1
  108. package/esm/integrations/trycatch.d.ts.map +1 -1
  109. package/esm/integrations/trycatch.js.map +1 -1
  110. package/esm/integrations/useragent.d.ts.map +1 -1
  111. package/esm/integrations/useragent.js.map +1 -1
  112. package/esm/sdk.d.ts.map +1 -1
  113. package/esm/sdk.js +5 -4
  114. package/esm/sdk.js.map +1 -1
  115. package/esm/stack-parsers.d.ts.map +1 -1
  116. package/esm/stack-parsers.js.map +1 -1
  117. package/esm/transports/base.d.ts.map +1 -1
  118. package/esm/transports/base.js +8 -7
  119. package/esm/transports/base.js.map +1 -1
  120. package/esm/transports/fetch.d.ts.map +1 -1
  121. package/esm/transports/fetch.js.map +1 -1
  122. package/esm/transports/index.d.ts +2 -0
  123. package/esm/transports/index.d.ts.map +1 -1
  124. package/esm/transports/index.js +2 -0
  125. package/esm/transports/index.js.map +1 -1
  126. package/esm/transports/new-fetch.d.ts +10 -0
  127. package/esm/transports/new-fetch.d.ts.map +1 -0
  128. package/esm/transports/new-fetch.js +25 -0
  129. package/esm/transports/new-fetch.js.map +1 -0
  130. package/esm/transports/new-xhr.d.ts +11 -0
  131. package/esm/transports/new-xhr.d.ts.map +1 -0
  132. package/esm/transports/new-xhr.js +44 -0
  133. package/esm/transports/new-xhr.js.map +1 -0
  134. package/esm/transports/utils.d.ts.map +1 -1
  135. package/esm/transports/utils.js +3 -2
  136. package/esm/transports/utils.js.map +1 -1
  137. package/esm/transports/xhr.d.ts.map +1 -1
  138. package/esm/transports/xhr.js.map +1 -1
  139. package/esm/version.d.ts.map +1 -1
  140. package/esm/version.js.map +1 -1
  141. package/package.json +6 -45
  142. package/types/backend.d.ts.map +1 -1
  143. package/types/client.d.ts.map +1 -1
  144. package/types/eventbuilder.d.ts.map +1 -1
  145. package/types/exports.d.ts.map +1 -1
  146. package/types/flags.d.ts +3 -0
  147. package/types/flags.d.ts.map +1 -0
  148. package/types/helpers.d.ts.map +1 -1
  149. package/types/index.d.ts.map +1 -1
  150. package/types/integrations/breadcrumbs.d.ts.map +1 -1
  151. package/types/integrations/dedupe.d.ts.map +1 -1
  152. package/types/integrations/globalhandlers.d.ts.map +1 -1
  153. package/types/integrations/index.d.ts.map +1 -1
  154. package/types/integrations/linkederrors.d.ts.map +1 -1
  155. package/types/integrations/trycatch.d.ts.map +1 -1
  156. package/types/integrations/useragent.d.ts.map +1 -1
  157. package/types/sdk.d.ts.map +1 -1
  158. package/types/stack-parsers.d.ts.map +1 -1
  159. package/types/transports/base.d.ts.map +1 -1
  160. package/types/transports/fetch.d.ts.map +1 -1
  161. package/types/transports/index.d.ts +2 -0
  162. package/types/transports/index.d.ts.map +1 -1
  163. package/types/transports/new-fetch.d.ts +10 -0
  164. package/types/transports/new-fetch.d.ts.map +1 -0
  165. package/types/transports/new-xhr.d.ts +11 -0
  166. package/types/transports/new-xhr.d.ts.map +1 -0
  167. package/types/transports/utils.d.ts.map +1 -1
  168. package/types/transports/xhr.d.ts.map +1 -1
  169. package/types/version.d.ts.map +1 -1
  170. package/bundles/bundle.debug.min.js +0 -3
  171. package/bundles/bundle.debug.min.js.map +0 -1
  172. package/bundles/bundle.es6.debug.min.js +0 -3
  173. package/bundles/bundle.es6.debug.min.js.map +0 -1
  174. package/bundles/bundle.es6.js.map +0 -1
  175. package/bundles/bundle.es6.min.js +0 -3
  176. package/bundles/bundle.es6.min.js.map +0 -1
  177. package/bundles/bundle.js.map +0 -1
  178. package/bundles/bundle.min.js +0 -3
  179. package/bundles/bundle.min.js.map +0 -1
@@ -0,0 +1,46 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ var core_1 = require("@sentry/core");
3
+ var utils_1 = require("@sentry/utils");
4
+ /**
5
+ * The DONE ready state for XmlHttpRequest
6
+ *
7
+ * Defining it here as a constant b/c XMLHttpRequest.DONE is not always defined
8
+ * (e.g. during testing, it is `undefined`)
9
+ *
10
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState}
11
+ */
12
+ var XHR_READYSTATE_DONE = 4;
13
+ /**
14
+ * Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.
15
+ */
16
+ function makeNewXHRTransport(options) {
17
+ function makeRequest(request) {
18
+ return new utils_1.SyncPromise(function (resolve, _reject) {
19
+ var xhr = new XMLHttpRequest();
20
+ xhr.onreadystatechange = function () {
21
+ if (xhr.readyState === XHR_READYSTATE_DONE) {
22
+ var response = {
23
+ body: xhr.response,
24
+ headers: {
25
+ 'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'),
26
+ 'retry-after': xhr.getResponseHeader('Retry-After'),
27
+ },
28
+ reason: xhr.statusText,
29
+ statusCode: xhr.status,
30
+ };
31
+ resolve(response);
32
+ }
33
+ };
34
+ xhr.open('POST', options.url);
35
+ for (var header in options.headers) {
36
+ if (Object.prototype.hasOwnProperty.call(options.headers, header)) {
37
+ xhr.setRequestHeader(header, options.headers[header]);
38
+ }
39
+ }
40
+ xhr.send(request.body);
41
+ });
42
+ }
43
+ return core_1.createTransport({ bufferSize: options.bufferSize }, makeRequest);
44
+ }
45
+ exports.makeNewXHRTransport = makeNewXHRTransport;
46
+ //# sourceMappingURL=new-xhr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-xhr.js","sourceRoot":"","sources":["../../../../src/transports/new-xhr.ts"],"names":[],"mappings":";AAAA,qCAMsB;AACtB,uCAA4C;AAE5C;;;;;;;GAOG;AACH,IAAM,mBAAmB,GAAG,CAAC,CAAC;AAM9B;;GAEG;AACH,SAAgB,mBAAmB,CAAC,OAA4B;IAC9D,SAAS,WAAW,CAAC,OAAyB;QAC5C,OAAO,IAAI,mBAAW,CAA+B,UAAC,OAAO,EAAE,OAAO;YACpE,IAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YAEjC,GAAG,CAAC,kBAAkB,GAAG;gBACvB,IAAI,GAAG,CAAC,UAAU,KAAK,mBAAmB,EAAE;oBAC1C,IAAM,QAAQ,GAAG;wBACf,IAAI,EAAE,GAAG,CAAC,QAAQ;wBAClB,OAAO,EAAE;4BACP,sBAAsB,EAAE,GAAG,CAAC,iBAAiB,CAAC,sBAAsB,CAAC;4BACrE,aAAa,EAAE,GAAG,CAAC,iBAAiB,CAAC,aAAa,CAAC;yBACpD;wBACD,MAAM,EAAE,GAAG,CAAC,UAAU;wBACtB,UAAU,EAAE,GAAG,CAAC,MAAM;qBACvB,CAAC;oBACF,OAAO,CAAC,QAAQ,CAAC,CAAC;iBACnB;YACH,CAAC,CAAC;YAEF,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;YAE9B,KAAK,IAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE;gBACpC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;oBACjE,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;iBACvD;aACF;YAED,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,sBAAe,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,WAAW,CAAC,CAAC;AAC1E,CAAC;AAjCD,kDAiCC","sourcesContent":["import {\n BaseTransportOptions,\n createTransport,\n NewTransport,\n TransportMakeRequestResponse,\n TransportRequest,\n} from '@sentry/core';\nimport { SyncPromise } from '@sentry/utils';\n\n/**\n * The DONE ready state for XmlHttpRequest\n *\n * Defining it here as a constant b/c XMLHttpRequest.DONE is not always defined\n * (e.g. during testing, it is `undefined`)\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState}\n */\nconst XHR_READYSTATE_DONE = 4;\n\nexport interface XHRTransportOptions extends BaseTransportOptions {\n headers?: { [key: string]: string };\n}\n\n/**\n * Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.\n */\nexport function makeNewXHRTransport(options: XHRTransportOptions): NewTransport {\n function makeRequest(request: TransportRequest): PromiseLike<TransportMakeRequestResponse> {\n return new SyncPromise<TransportMakeRequestResponse>((resolve, _reject) => {\n const xhr = new XMLHttpRequest();\n\n xhr.onreadystatechange = (): void => {\n if (xhr.readyState === XHR_READYSTATE_DONE) {\n const response = {\n body: xhr.response,\n headers: {\n 'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': xhr.getResponseHeader('Retry-After'),\n },\n reason: xhr.statusText,\n statusCode: xhr.status,\n };\n resolve(response);\n }\n };\n\n xhr.open('POST', options.url);\n\n for (const header in options.headers) {\n if (Object.prototype.hasOwnProperty.call(options.headers, header)) {\n xhr.setRequestHeader(header, options.headers[header]);\n }\n }\n\n xhr.send(request.body);\n });\n }\n\n return createTransport({ bufferSize: options.bufferSize }, makeRequest);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/transports/utils.ts"],"names":[],"mappings":"AAKA,oBAAY,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,4BAA4B,IAAI,SAAS,CAiCxD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAqB1D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/transports/utils.ts"],"names":[],"mappings":"AAOA,oBAAY,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,4BAA4B,IAAI,SAAS,CAiCxD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAqB1D"}
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
2
  var utils_1 = require("@sentry/utils");
3
+ var flags_1 = require("../flags");
3
4
  var global = utils_1.getGlobalObject();
4
5
  var cachedFetchImpl;
5
6
  /**
@@ -64,7 +65,7 @@ function getNativeFetchImplementation() {
64
65
  document.head.removeChild(sandbox);
65
66
  }
66
67
  catch (e) {
67
- utils_1.isDebugBuild() &&
68
+ flags_1.IS_DEBUG_BUILD &&
68
69
  utils_1.logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);
69
70
  }
70
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/transports/utils.ts"],"names":[],"mappings":";AAAA,uCAA4G;AAE5G,IAAM,MAAM,GAAG,uBA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ClD,IAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,oBAAoB,CAAC;IAC5G,IAAM,aAAa,GAAG,eAAe,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;IAE3F,IAAI,aAAa,EAAE;QACjB,wHAAwH;QACxH,IAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtE,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAC9B;IAED,IAAI,qBAAa,EAAE,EAAE;QACnB,IAAM,OAAK,GAAG,4BAA4B,EAAE,CAAC;QAC7C,OAAO,cAAM,CACX,OAAK,CAAC,GAAG,EAAE;YACT,IAAI,MAAA;YACJ,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,IAAI;SAChB,CAAC,CACH,CAAC;KACH;AACH,CAAC;AArBD,gCAqBC","sourcesContent":["import { forget, getGlobalObject, isDebugBuild, isNativeFetch, logger, supportsFetch } from '@sentry/utils';\n\nconst global = getGlobalObject<Window>();\nlet cachedFetchImpl: FetchImpl;\n\nexport type FetchImpl = typeof fetch;\n\n/**\n * A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.\n * Whenever someone wraps the Fetch API and returns the wrong promise chain,\n * this chain becomes orphaned and there is no possible way to capture it's rejections\n * other than allowing it bubble up to this very handler. eg.\n *\n * const f = window.fetch;\n * window.fetch = function () {\n * const p = f.apply(this, arguments);\n *\n * p.then(function() {\n * console.log('hi.');\n * });\n *\n * return p;\n * }\n *\n * `p.then(function () { ... })` is producing a completely separate promise chain,\n * however, what's returned is `p` - the result of original `fetch` call.\n *\n * This mean, that whenever we use the Fetch API to send our own requests, _and_\n * some ad-blocker blocks it, this orphaned chain will _always_ reject,\n * effectively causing another event to be captured.\n * This makes a whole process become an infinite loop, which we need to somehow\n * deal with, and break it in one way or another.\n *\n * To deal with this issue, we are making sure that we _always_ use the real\n * browser Fetch API, instead of relying on what `window.fetch` exposes.\n * The only downside to this would be missing our own requests as breadcrumbs,\n * but because we are already not doing this, it should be just fine.\n *\n * Possible failed fetch error messages per-browser:\n *\n * Chrome: Failed to fetch\n * Edge: Failed to Fetch\n * Firefox: NetworkError when attempting to fetch resource\n * Safari: resource blocked by content blocker\n */\nexport function getNativeFetchImplementation(): FetchImpl {\n if (cachedFetchImpl) {\n return cachedFetchImpl;\n }\n\n /* eslint-disable @typescript-eslint/unbound-method */\n\n // Fast path to avoid DOM I/O\n if (isNativeFetch(global.fetch)) {\n return (cachedFetchImpl = global.fetch.bind(global));\n }\n\n const document = global.document;\n let fetchImpl = global.fetch;\n // eslint-disable-next-line deprecation/deprecation\n if (document && typeof document.createElement === 'function') {\n try {\n const sandbox = document.createElement('iframe');\n sandbox.hidden = true;\n document.head.appendChild(sandbox);\n const contentWindow = sandbox.contentWindow;\n if (contentWindow && contentWindow.fetch) {\n fetchImpl = contentWindow.fetch;\n }\n document.head.removeChild(sandbox);\n } catch (e) {\n isDebugBuild() &&\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);\n }\n }\n\n return (cachedFetchImpl = fetchImpl.bind(global));\n /* eslint-enable @typescript-eslint/unbound-method */\n}\n\n/**\n * Sends sdk client report using sendBeacon or fetch as a fallback if available\n *\n * @param url report endpoint\n * @param body report payload\n */\nexport function sendReport(url: string, body: string): void {\n const isRealNavigator = Object.prototype.toString.call(global && global.navigator) === '[object Navigator]';\n const hasSendBeacon = isRealNavigator && typeof global.navigator.sendBeacon === 'function';\n\n if (hasSendBeacon) {\n // Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch\n const sendBeacon = global.navigator.sendBeacon.bind(global.navigator);\n return sendBeacon(url, body);\n }\n\n if (supportsFetch()) {\n const fetch = getNativeFetchImplementation();\n return forget(\n fetch(url, {\n body,\n method: 'POST',\n credentials: 'omit',\n keepalive: true,\n }),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/transports/utils.ts"],"names":[],"mappings":";AAAA,uCAA8F;AAE9F,kCAA0C;AAE1C,IAAM,MAAM,GAAG,uBAAe,EAAU,CAAC;AACzC,IAAI,eAA0B,CAAC;AAI/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,SAAgB,4BAA4B;IAC1C,IAAI,eAAe,EAAE;QACnB,OAAO,eAAe,CAAC;KACxB;IAED,sDAAsD;IAEtD,6BAA6B;IAC7B,IAAI,qBAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC/B,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;KACtD;IAED,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACjC,IAAI,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;IAC7B,mDAAmD;IACnD,IAAI,QAAQ,IAAI,OAAO,QAAQ,CAAC,aAAa,KAAK,UAAU,EAAE;QAC5D,IAAI;YACF,IAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YACjD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YACtB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACnC,IAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;YAC5C,IAAI,aAAa,IAAI,aAAa,CAAC,KAAK,EAAE;gBACxC,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC;aACjC;YACD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SACpC;QAAC,OAAO,CAAC,EAAE;YACV,sBAAc;gBACZ,cAAM,CAAC,IAAI,CAAC,iFAAiF,EAAE,CAAC,CAAC,CAAC;SACrG;KACF;IAED,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,qDAAqD;AACvD,CAAC;AAjCD,oEAiCC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,GAAW,EAAE,IAAY;IAClD,IAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,oBAAoB,CAAC;IAC5G,IAAM,aAAa,GAAG,eAAe,IAAI,OAAO,MAAM,CAAC,SAAS,CAAC,UAAU,KAAK,UAAU,CAAC;IAE3F,IAAI,aAAa,EAAE;QACjB,wHAAwH;QACxH,IAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtE,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;KAC9B;IAED,IAAI,qBAAa,EAAE,EAAE;QACnB,IAAM,OAAK,GAAG,4BAA4B,EAAE,CAAC;QAC7C,OAAO,cAAM,CACX,OAAK,CAAC,GAAG,EAAE;YACT,IAAI,MAAA;YACJ,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,MAAM;YACnB,SAAS,EAAE,IAAI;SAChB,CAAC,CACH,CAAC;KACH;AACH,CAAC;AArBD,gCAqBC","sourcesContent":["import { forget, getGlobalObject, isNativeFetch, logger, supportsFetch } from '@sentry/utils';\n\nimport { IS_DEBUG_BUILD } from '../flags';\n\nconst global = getGlobalObject<Window>();\nlet cachedFetchImpl: FetchImpl;\n\nexport type FetchImpl = typeof fetch;\n\n/**\n * A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.\n * Whenever someone wraps the Fetch API and returns the wrong promise chain,\n * this chain becomes orphaned and there is no possible way to capture it's rejections\n * other than allowing it bubble up to this very handler. eg.\n *\n * const f = window.fetch;\n * window.fetch = function () {\n * const p = f.apply(this, arguments);\n *\n * p.then(function() {\n * console.log('hi.');\n * });\n *\n * return p;\n * }\n *\n * `p.then(function () { ... })` is producing a completely separate promise chain,\n * however, what's returned is `p` - the result of original `fetch` call.\n *\n * This mean, that whenever we use the Fetch API to send our own requests, _and_\n * some ad-blocker blocks it, this orphaned chain will _always_ reject,\n * effectively causing another event to be captured.\n * This makes a whole process become an infinite loop, which we need to somehow\n * deal with, and break it in one way or another.\n *\n * To deal with this issue, we are making sure that we _always_ use the real\n * browser Fetch API, instead of relying on what `window.fetch` exposes.\n * The only downside to this would be missing our own requests as breadcrumbs,\n * but because we are already not doing this, it should be just fine.\n *\n * Possible failed fetch error messages per-browser:\n *\n * Chrome: Failed to fetch\n * Edge: Failed to Fetch\n * Firefox: NetworkError when attempting to fetch resource\n * Safari: resource blocked by content blocker\n */\nexport function getNativeFetchImplementation(): FetchImpl {\n if (cachedFetchImpl) {\n return cachedFetchImpl;\n }\n\n /* eslint-disable @typescript-eslint/unbound-method */\n\n // Fast path to avoid DOM I/O\n if (isNativeFetch(global.fetch)) {\n return (cachedFetchImpl = global.fetch.bind(global));\n }\n\n const document = global.document;\n let fetchImpl = global.fetch;\n // eslint-disable-next-line deprecation/deprecation\n if (document && typeof document.createElement === 'function') {\n try {\n const sandbox = document.createElement('iframe');\n sandbox.hidden = true;\n document.head.appendChild(sandbox);\n const contentWindow = sandbox.contentWindow;\n if (contentWindow && contentWindow.fetch) {\n fetchImpl = contentWindow.fetch;\n }\n document.head.removeChild(sandbox);\n } catch (e) {\n IS_DEBUG_BUILD &&\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);\n }\n }\n\n return (cachedFetchImpl = fetchImpl.bind(global));\n /* eslint-enable @typescript-eslint/unbound-method */\n}\n\n/**\n * Sends sdk client report using sendBeacon or fetch as a fallback if available\n *\n * @param url report endpoint\n * @param body report payload\n */\nexport function sendReport(url: string, body: string): void {\n const isRealNavigator = Object.prototype.toString.call(global && global.navigator) === '[object Navigator]';\n const hasSendBeacon = isRealNavigator && typeof global.navigator.sendBeacon === 'function';\n\n if (hasSendBeacon) {\n // Prevent illegal invocations - https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch\n const sendBeacon = global.navigator.sendBeacon.bind(global.navigator);\n return sendBeacon(url, body);\n }\n\n if (supportsFetch()) {\n const fetch = getNativeFetchImplementation();\n return forget(\n fetch(url, {\n body,\n method: 'POST',\n credentials: 'omit',\n keepalive: true,\n }),\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../../src/transports/xhr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,4BAA4B;AAC5B,qBAAa,YAAa,SAAQ,aAAa;IAC7C;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC;CAmD9G"}
1
+ {"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../../../../src/transports/xhr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,4BAA4B;AAC5B,qBAAa,YAAa,SAAQ,aAAa;IAC7C;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,GAAG,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC;CAmD9G"}
@@ -1 +1 @@
1
- {"version":3,"file":"xhr.js","sourceRoot":"","sources":["../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IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;gBACxC,KAAK,IAAM,MAAM,IAAI,KAAI,CAAC,OAAO,CAAC,OAAO,EAAE;oBACzC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;wBACtE,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;qBAChE;iBACF;gBACD,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC,CAAC;QApBF,CAoBE,CACL;aACA,IAAI,CAAC,SAAS,EAAE,UAAA,MAAM;YACrB,gGAAgG;YAChG,IAAI,MAAM,YAAY,mBAAW,EAAE;gBACjC,KAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC5D;iBAAM;gBACL,KAAI,CAAC,eAAe,CAAC,eAAe,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC3D;YACD,MAAM,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;IACH,mBAAC;AAAD,CAAC,AAxDD,CAAkC,oBAAa,GAwD9C;AAxDY,oCAAY","sourcesContent":["import { Event, Response, SentryRequest, Session } from '@sentry/types';\nimport { SentryError, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\n/** `XHR` based transport */\nexport class XHRTransport extends BaseTransport {\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n protected _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n // eslint-disable-next-line deprecation/deprecation\n if (this._isRateLimited(sentryRequest.type)) {\n this.recordLostEvent('ratelimit_backoff', sentryRequest.type);\n\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n // eslint-disable-next-line deprecation/deprecation\n reason: `Transport for ${sentryRequest.type} requests locked till ${this._disabledUntil(\n sentryRequest.type,\n )} due to too many requests.`,\n status: 429,\n });\n }\n\n return this._buffer\n .add(\n () =>\n new SyncPromise<Response>((resolve, reject) => {\n const request = new XMLHttpRequest();\n\n request.onreadystatechange = (): void => {\n if (request.readyState === 4) {\n const headers = {\n 'x-sentry-rate-limits': request.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': request.getResponseHeader('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response: request, headers, resolve, reject });\n }\n };\n\n request.open('POST', sentryRequest.url);\n for (const header in this.options.headers) {\n if (Object.prototype.hasOwnProperty.call(this.options.headers, header)) {\n request.setRequestHeader(header, this.options.headers[header]);\n }\n }\n request.send(sentryRequest.body);\n }),\n )\n .then(undefined, reason => {\n // It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.\n if (reason instanceof SentryError) {\n this.recordLostEvent('queue_overflow', sentryRequest.type);\n } else {\n this.recordLostEvent('network_error', sentryRequest.type);\n }\n throw reason;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"xhr.js","sourceRoot":"","sources":["../../../../src/transports/xhr.ts"],"names":[],"mappings":";;AACA,uCAAyD;AAEzD,+BAAuC;AAEvC,4BAA4B;AAC5B;IAAkC,wCAAa;IAA/C;;IAwDA,CAAC;IAvDC;;;OAGG;IACO,mCAAY,GAAtB,UAAuB,aAA4B,EAAE,eAAgC;QAArF,iBAkDC;QAjDC,mDAAmD;QACnD,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;YAC3C,IAAI,CAAC,eAAe,CAAC,mBAAmB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;YAE9D,OAAO,OAAO,CAAC,MAAM,CAAC;gBACpB,KAAK,EAAE,eAAe;gBACtB,IAAI,EAAE,aAAa,CAAC,IAAI;gBACxB,mDAAmD;gBACnD,MAAM,EAAE,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AM;YACrB,gGAAgG;YAChG,IAAI,MAAM,YAAY,mBAAW,EAAE;gBACjC,KAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC5D;iBAAM;gBACL,KAAI,CAAC,eAAe,CAAC,eAAe,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;aAC3D;YACD,MAAM,MAAM,CAAC;QACf,CAAC,CAAC,CAAC;IACP,CAAC;IACH,mBAAC;AAAD,CAAC,AAxDD,CAAkC,oBAAa,GAwD9C;AAxDY,oCAAY","sourcesContent":["import { Event, Response, SentryRequest, Session } from '@sentry/types';\nimport { SentryError, SyncPromise } from '@sentry/utils';\n\nimport { BaseTransport } from './base';\n\n/** `XHR` based transport */\nexport class XHRTransport extends BaseTransport {\n /**\n * @param sentryRequest Prepared SentryRequest to be delivered\n * @param originalPayload Original payload used to create SentryRequest\n */\n protected _sendRequest(sentryRequest: SentryRequest, originalPayload: Event | Session): PromiseLike<Response> {\n // eslint-disable-next-line deprecation/deprecation\n if (this._isRateLimited(sentryRequest.type)) {\n this.recordLostEvent('ratelimit_backoff', sentryRequest.type);\n\n return Promise.reject({\n event: originalPayload,\n type: sentryRequest.type,\n // eslint-disable-next-line deprecation/deprecation\n reason: `Transport for ${sentryRequest.type} requests locked till ${this._disabledUntil(\n sentryRequest.type,\n )} due to too many requests.`,\n status: 429,\n });\n }\n\n return this._buffer\n .add(\n () =>\n new SyncPromise<Response>((resolve, reject) => {\n const request = new XMLHttpRequest();\n\n request.onreadystatechange = (): void => {\n if (request.readyState === 4) {\n const headers = {\n 'x-sentry-rate-limits': request.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': request.getResponseHeader('Retry-After'),\n };\n this._handleResponse({ requestType: sentryRequest.type, response: request, headers, resolve, reject });\n }\n };\n\n request.open('POST', sentryRequest.url);\n for (const header in this.options.headers) {\n if (Object.prototype.hasOwnProperty.call(this.options.headers, header)) {\n request.setRequestHeader(header, this.options.headers[header]);\n }\n }\n request.send(sentryRequest.body);\n }),\n )\n .then(undefined, reason => {\n // It's either buffer rejection or any other xhr/fetch error, which are treated as NetworkError.\n if (reason instanceof SentryError) {\n this.recordLostEvent('queue_overflow', sentryRequest.type);\n } else {\n this.recordLostEvent('network_error', sentryRequest.type);\n }\n throw reason;\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,8BAA8B,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,8BAA8B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA,wGAAwG;AAC3F,QAAA,QAAQ,GAAG,2BAA2B,CAAC","sourcesContent":["// TODO: Remove in the next major release and rely only on @sentry/core SDK_VERSION and SdkInfo metadata\nexport const SDK_NAME = 'sentry.javascript.browser';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":";AAAA,wGAAwG;AAC3F,QAAA,QAAQ,GAAG,2BAA2B,CAAC","sourcesContent":["// TODO: Remove in the next major release and rely only on @sentry/core SDK_VERSION and SdkInfo metadata\nexport const SDK_NAME = 'sentry.javascript.browser';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM/E;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,M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AAC;CACxC;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC7D;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAGnF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,QAAwB,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAI/G;;OAEG;IACH,SAAS,CAAC,eAAe,IAAI,SAAS;CAgCvC"}
package/esm/backend.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { __assign, __extends } from "tslib";
2
- import { BaseBackend } from '@sentry/core';
2
+ import { BaseBackend, getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails } from '@sentry/core';
3
3
  import { Severity } from '@sentry/types';
4
4
  import { supportsFetch } from '@sentry/utils';
5
5
  import { eventFromException, eventFromMessage } from './eventbuilder';
6
- import { FetchTransport, XHRTransport } from './transports';
6
+ import { FetchTransport, makeNewFetchTransport, makeNewXHRTransport, XHRTransport } from './transports';
7
7
  /**
8
8
  * The Sentry Browser SDK Backend.
9
9
  * @hidden
@@ -35,12 +35,20 @@ var BrowserBackend = /** @class */ (function (_super) {
35
35
  return _super.prototype._setupTransport.call(this);
36
36
  }
37
37
  var transportOptions = __assign(__assign({}, this._options.transportOptions), { dsn: this._options.dsn, tunnel: this._options.tunnel, sendClientReports: this._options.sendClientReports, _metadata: this._options._metadata });
38
+ var api = initAPIDetails(transportOptions.dsn, transportOptions._metadata, transportOptions.tunnel);
39
+ var url = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);
38
40
  if (this._options.transport) {
39
41
  return new this._options.transport(transportOptions);
40
42
  }
41
43
  if (supportsFetch()) {
44
+ var requestOptions = __assign({}, transportOptions.fetchParameters);
45
+ this._newTransport = makeNewFetchTransport({ requestOptions: requestOptions, url: url });
42
46
  return new FetchTransport(transportOptions);
43
47
  }
48
+ this._newTransport = makeNewXHRTransport({
49
+ url: url,
50
+ headers: transportOptions.headers,
51
+ });
44
52
  return new XHRTransport(transportOptions);
45
53
  };
46
54
  return BrowserBackend;
@@ -1 +1 @@
1
- {"version":3,"file":"backend.js","sourceRoot":"","sources":["../../src/backend.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAA6B,QAAQ,EAAa,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA4B5D;;;GAGG;AACH;IAAoC,kCAA2B;IAA/D;;IAuCA,CAAC;IAtCC;;OAEG;IACI,2CAAkB,GAAzB,UAA0B,SAAkB,EAAE,IAAgB;QAC5D,OAAO,kBAAkB,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7E,CAAC;IACD;;OAEG;IACI,yCAAgB,GAAvB,UAAwB,OAAe,EAAE,KAA+B,EAAE,IAAgB;QAAjD,sBAAA,EAAA,QAAkB,QAAQ,CAAC,IAAI;QACtE,OAAO,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAChF,CAAC;IAED;;OAEG;IACO,wCAAe,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACtB,6DAA6D;YAC7D,OAAO,iBAAM,eAAe,WAAE,CAAC;SAChC;QAED,IAAM,gBAAgB,yBACjB,IAAI,CAAC,QAAQ,CAAC,gBAAgB,KACjC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EACtB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAC5B,iBAAiB,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,EAClD,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,GACnC,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;YAC3B,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;SACtD;QACD,IAAI,aAAa,EAAE,EAAE;YACnB,OAAO,IAAI,cAAc,CAAC,gBAAgB,CAAC,CAAC;SAC7C;QACD,OAAO,IAAI,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IACH,qBAAC;AAAD,CAAC,AAvCD,CAAoC,WAAW,GAuC9C","sourcesContent":["import { BaseBackend } from '@sentry/core';\nimport { Event, EventHint, Options, Severity, Transport } from '@sentry/types';\nimport { supportsFetch } from '@sentry/utils';\n\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { FetchTransport, XHRTransport } from './transports';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see BrowserClient for more information.\n */\nexport interface BrowserOptions extends Options {\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.denyUrls}.\n * By default, all errors will be sent.\n */\n allowUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To allow certain errors instead, use {@link Options.allowUrls}.\n * By default, all errors will be sent.\n */\n denyUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.allowUrls} instead. */\n whitelistUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.denyUrls} instead. */\n blacklistUrls?: Array<string | RegExp>;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class BrowserBackend extends BaseBackend<BrowserOptions> {\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(exception, hint, this._options.attachStacktrace);\n }\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const transportOptions = {\n ...this._options.transportOptions,\n dsn: this._options.dsn,\n tunnel: this._options.tunnel,\n sendClientReports: this._options.sendClientReports,\n _metadata: this._options._metadata,\n };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n if (supportsFetch()) {\n return new FetchTransport(transportOptions);\n }\n return new XHRTransport(transportOptions);\n }\n}\n"]}
1
+ {"version":3,"file":"backend.js","sourceRoot":"","sources":["../../../src/backend.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,qCAAqC,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,EAA6B,QAAQ,EAA+B,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA4BxG;;;GAGG;AACH;IAAoC,kCAA2B;IAA/D;;IAiDA,CAAC;IAhDC;;OAEG;IACI,2CAAkB,GAAzB,UAA0B,SAAkB,EAAE,IAAgB;QAC5D,OAAO,kBAAkB,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7E,CAAC;IACD;;OAEG;IACI,yCAAgB,GAAvB,UAAwB,OAAe,EAAE,KAA+B,EAAE,IAAgB;QAAjD,sBAAA,EAAA,QAAkB,QAAQ,CAAC,IAAI;QACt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ClC,CAAC,CAAC;QACH,OAAO,IAAI,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IACH,qBAAC;AAAD,CAAC,AAjDD,CAAoC,WAAW,GAiD9C","sourcesContent":["import { BaseBackend, getEnvelopeEndpointWithUrlEncodedAuth, initAPIDetails } from '@sentry/core';\nimport { Event, EventHint, Options, Severity, Transport, TransportOptions } from '@sentry/types';\nimport { supportsFetch } from '@sentry/utils';\n\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { FetchTransport, makeNewFetchTransport, makeNewXHRTransport, XHRTransport } from './transports';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see BrowserClient for more information.\n */\nexport interface BrowserOptions extends Options {\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.denyUrls}.\n * By default, all errors will be sent.\n */\n allowUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To allow certain errors instead, use {@link Options.allowUrls}.\n * By default, all errors will be sent.\n */\n denyUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.allowUrls} instead. */\n whitelistUrls?: Array<string | RegExp>;\n\n /** @deprecated use {@link Options.denyUrls} instead. */\n blacklistUrls?: Array<string | RegExp>;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class BrowserBackend extends BaseBackend<BrowserOptions> {\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint?: EventHint): PromiseLike<Event> {\n return eventFromException(exception, hint, this._options.attachStacktrace);\n }\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const transportOptions: TransportOptions = {\n ...this._options.transportOptions,\n dsn: this._options.dsn,\n tunnel: this._options.tunnel,\n sendClientReports: this._options.sendClientReports,\n _metadata: this._options._metadata,\n };\n\n const api = initAPIDetails(transportOptions.dsn, transportOptions._metadata, transportOptions.tunnel);\n const url = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n if (supportsFetch()) {\n const requestOptions: RequestInit = { ...transportOptions.fetchParameters };\n this._newTransport = makeNewFetchTransport({ requestOptions, url });\n return new FetchTransport(transportOptions);\n }\n\n this._newTransport = makeNewXHRTransport({\n url,\n headers: transportOptions.headers,\n });\n return new XHRTransport(transportOptions);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAsB,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGpE;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,cAAc,EAAE,cAAc,CAAC;IAC3E;;;;OAIG;gBACgB,OAAO,GAAE,cAAmB;IAgB/C;;;;OAIG;IACI,gBAAgB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI;IAkBhE;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAKjG;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAOzC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAe,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3D,OAAO,EAAsB,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAGpE;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,cAAc,EAAE,cAAc,CAAC;IAC3E;;;;OAIG;gBACgB,OAAO,GAAE,cAAmB;IAgB/C;;;;OAIG;IACI,gBAAgB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI;IAkBhE;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAKjG;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAOzC"}
package/esm/client.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { __assign, __extends } from "tslib";
2
2
  import { BaseClient, SDK_VERSION } from '@sentry/core';
3
- import { getGlobalObject, isDebugBuild, logger } from '@sentry/utils';
3
+ import { getGlobalObject, logger } from '@sentry/utils';
4
4
  import { BrowserBackend } from './backend';
5
+ import { IS_DEBUG_BUILD } from './flags';
5
6
  import { injectReportDialog } from './helpers';
6
7
  import { Breadcrumbs } from './integrations';
7
8
  /**
@@ -47,7 +48,7 @@ var BrowserClient = /** @class */ (function (_super) {
47
48
  return;
48
49
  }
49
50
  if (!this._isEnabled()) {
50
- isDebugBuild() && logger.error('Trying to call showReportDialog with Sentry Client disabled');
51
+ IS_DEBUG_BUILD && logger.error('Trying to call showReportDialog with Sentry Client disabled');
51
52
  return;
52
53
  }
53
54
  injectReportDialog(__assign(__assign({}, options), { dsn: options.dsn || this.getDsn() }));
package/esm/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAS,WAAW,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAuB,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;GAKG;AACH;IAAmC,iCAA0C;IAC3E;;;;OAIG;IACH,uBAAmB,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;QAA/C,iBAcC;QAbC,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,CAAC,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;YAC/C,IAAI,EAAE,2BAA2B;YACjC,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,qBAAqB;oBAC3B,OAAO,EAAE,WAAW;iBACrB;aACF;YACD,OAAO,EAAE,WAAW;SACrB,CAAC;QAEF,QAAA,kBAAM,cAAc,EAAE,OAAO,CAAC,SAAC;;IACjC,CAAC;IAED;;;;OAIG;IACI,wCAAgB,GAAvB,UAAwB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QACvD,iDAAiD;QACjD,IAAM,QAAQ,GAAG,eAAe,EAAU,CAAC,QAAQ,CAAC;QACpD,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;YACtB,YAAY,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAC9F,OAAO;SACR;QAED,kBAAkB,uBACb,OAAO,KACV,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,IACjC,CAAC;IACL,CAAC;IAED;;OAEG;IACO,qCAAa,GAAvB,UAAwB,KAAY,EAAE,KAAa,EAAE,IAAgB;QACnE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC;QAChD,OAAO,iBAAM,aAAa,YAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACO,kCAAU,GAApB,UAAqB,KAAY;QAC/B,IAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,WAAW,EAAE;YACf,WAAW,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;SACxC;QACD,iBAAM,UAAU,YAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IACH,oBAAC;AAAD,CAAC,AA/DD,CAAmC,UAAU,GA+D5C","sourcesContent":["import { BaseClient, Scope, SDK_VERSION } from '@sentry/core';\nimport { Event, EventHint } from '@sentry/types';\nimport { getGlobalObject, isDebugBuild, logger } from '@sentry/utils';\n\nimport { BrowserBackend, BrowserOptions } from './backend';\nimport { injectReportDialog, ReportDialogOptions } from './helpers';\nimport { Breadcrumbs } from './integrations';\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserOptions = {}) {\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || {\n name: 'sentry.javascript.browser',\n packages: [\n {\n name: 'npm:@sentry/browser',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n\n super(BrowserBackend, options);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n const document = getGlobalObject<Window>().document;\n if (!document) {\n return;\n }\n\n if (!this._isEnabled()) {\n isDebugBuild() && logger.error('Trying to call showReportDialog with Sentry Client disabled');\n return;\n }\n\n injectReportDialog({\n ...options,\n dsn: options.dsn || this.getDsn(),\n });\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * @inheritDoc\n */\n protected _sendEvent(event: Event): void {\n const integration = this.getIntegration(Breadcrumbs);\n if (integration) {\n integration.addSentryBreadcrumb(event);\n }\n super._sendEvent(event);\n }\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAS,WAAW,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,cAAc,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAuB,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;GAKG;AACH;IAAmC,iCAA0C;IAC3E;;;;OAIG;IACH,uBAAmB,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;QAA/C,iBAcC;QAbC,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,CAAC,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;YAC/C,IAAI,EAAE,2BAA2B;YACjC,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,qBAAqB;oBAC3B,OAAO,EAAE,WAAW;iBACrB;aACF;YACD,OAAO,EAAE,WAAW;SACrB,CAAC;QAEF,QAAA,kBAAM,cAAc,EAAE,OAAO,CAAC,SAAC;;IACjC,CAAC;IAED;;;;OAIG;IACI,wCAAgB,GAAvB,UAAwB,OAAiC;QAAjC,wBAAA,EAAA,YAAiC;QACvD,iDAAiD;QACjD,IAAM,QAAQ,GAAG,eAAe,EAAU,CAAC,QAAQ,CAAC;QACpD,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;YACtB,cAAc,IAAI,MAAM,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAC9F,OAAO;SACR;QAED,kBAAkB,uBACb,OAAO,KACV,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,IACjC,CAAC;IACL,CAAC;IAED;;OAEG;IACO,qCAAa,GAAvB,UAAwB,KAAY,EAAE,KAAa,EAAE,IAAgB;QACnE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC;QAChD,OAAO,iBAAM,aAAa,YAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACO,kCAAU,GAApB,UAAqB,KAAY;QAC/B,IAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,WAAW,EAAE;YACf,WAAW,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;SACxC;QACD,iBAAM,UAAU,YAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IACH,oBAAC;AAAD,CAAC,AA/DD,CAAmC,UAAU,GA+D5C","sourcesContent":["import { BaseClient, Scope, SDK_VERSION } from '@sentry/core';\nimport { Event, EventHint } from '@sentry/types';\nimport { getGlobalObject, logger } from '@sentry/utils';\n\nimport { BrowserBackend, BrowserOptions } from './backend';\nimport { IS_DEBUG_BUILD } from './flags';\nimport { injectReportDialog, ReportDialogOptions } from './helpers';\nimport { Breadcrumbs } from './integrations';\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserOptions = {}) {\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || {\n name: 'sentry.javascript.browser',\n packages: [\n {\n name: 'npm:@sentry/browser',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n\n super(BrowserBackend, options);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n const document = getGlobalObject<Window>().document;\n if (!document) {\n return;\n }\n\n if (!this._isEnabled()) {\n IS_DEBUG_BUILD && logger.error('Trying to call showReportDialog with Sentry Client disabled');\n return;\n }\n\n injectReportDialog({\n ...options,\n dsn: options.dsn || this.getDsn(),\n });\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): PromiseLike<Event | null> {\n event.platform = event.platform || 'javascript';\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * @inheritDoc\n */\n protected _sendEvent(event: Event): void {\n const integration = this.getIntegration(Breadcrumbs);\n if (integration) {\n integration.addSentryBreadcrumb(event);\n }\n super._sendEvent(event);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"eventbuilder.d.ts","sourceRoot":"","sources":["../../src/eventbuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAwBlF;;;;GAIG;AACH,wBAAgB,kBAAk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,CAAC,KAAa,EAAE,kBAA0B,EAAE,gBAA0B;IACnG,IAAM,KAAK,GAAU;QACnB,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,IAAI,gBAAgB,IAAI,kBAAkB,EAAE;QAC1C,IAAM,QAAM,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;QACpD,IAAI,QAAM,CAAC,MAAM,EAAE;YACjB,KAAK,CAAC,UAAU,GAAG,EAAE,MAAM,UAAA,EAAE,CAAC;SAC/B;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { Event, EventHint, Exception, Severity, StackFrame } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n createStackParser,\n extractExceptionKeysForMessage,\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isEvent,\n isPlainObject,\n normalizeToSize,\n resolvedSyncPromise,\n} from '@sentry/utils';\n\nimport {\n chromeStackParser,\n geckoStackParser,\n opera10StackParser,\n opera11StackParser,\n winjsStackParser,\n} from './stack-parsers';\n\n/**\n * This function creates an exception from an TraceKitStackTrace\n * @param stacktrace TraceKitStackTrace that will be converted to an exception\n * @hidden\n */\nexport function exceptionFromError(ex: Error): Exception {\n // Get the frames first since Opera can lose the stack if we touch anything else first\n const frames = parseStackFrames(ex);\n\n const exception: Exception = {\n type: ex && ex.name,\n value: extractMessage(ex),\n };\n\n if (frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\n/**\n * @hidden\n */\nexport function eventFromPlainObject(\n exception: Record<string, unknown>,\n syntheticException?: Error,\n isUnhandledRejection?: boolean,\n): Event {\n const event: Event = {\n exception: {\n values: [\n {\n type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',\n value: `Non-Error ${\n isUnhandledRejection ? 'promise rejection' : 'exception'\n } captured with keys: ${extractExceptionKeysForMessage(exception)}`,\n },\n ],\n },\n extra: {\n __serialized__: normalizeToSize(exception),\n },\n };\n\n if (syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromError(ex: Error): Event {\n return {\n exception: {\n values: [exceptionFromError(ex)],\n },\n };\n}\n\n/** Parses stack frames from an error */\nexport function parseStackFrames(ex: Error & { framesToPop?: number; stacktrace?: string }): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || '';\n\n const popSize = getPopSize(ex);\n\n try {\n return createStackParser(\n opera10StackParser,\n opera11StackParser,\n chromeStackParser,\n winjsStackParser,\n geckoStackParser,\n )(stacktrace, popSize);\n } catch (e) {\n // no-empty\n }\n\n return [];\n}\n\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\nfunction getPopSize(ex: Error & { framesToPop?: number }): number {\n if (ex) {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n\n if (reactMinifiedRegexp.test(ex.message)) {\n return 1;\n }\n }\n\n return 0;\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\nfunction extractMessage(ex: Error & { message: { error?: Error } }): string {\n const message = ex && ex.message;\n if (!message) {\n return 'No error message';\n }\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message;\n }\n return message;\n}\n\n/**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n * @hidden\n */\nexport function eventFromException(\n exception: unknown,\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(exception, syntheticException, attachStacktrace);\n addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }\n event.level = Severity.Error;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nexport function eventFromMessage(\n message: string,\n level: Severity = Severity.Info,\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(message, syntheticException, attachStacktrace);\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * @hidden\n */\nexport function eventFromUnknownInput(\n exception: unknown,\n syntheticException?: Error,\n attachStacktrace?: boolean,\n isUnhandledRejection?: boolean,\n): Event {\n let event: Event;\n\n if (isErrorEvent(exception as ErrorEvent) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n return eventFromError(errorEvent.error as Error);\n }\n\n // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name\n // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be\n // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`.\n //\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n // https://webidl.spec.whatwg.org/#es-DOMException-specialness\n if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {\n const domException = exception as DOMException;\n\n if ('stack' in (exception as Error)) {\n event = eventFromError(exception as Error);\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n event = eventFromString(message, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, message);\n }\n if ('code' in domException) {\n event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };\n }\n\n return event;\n }\n if (isError(exception as Error)) {\n // we have a real Error object, do nothing\n return eventFromError(exception as Error);\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize\n // it manually. This will allow us to group events based on top-level keys which is much better than creating a new\n // group on any key/value change.\n const objectException = exception as Record<string, unknown>;\n event = eventFromPlainObject(objectException, syntheticException, isUnhandledRejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n event = eventFromString(exception as string, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, `${exception}`, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromString(input: string, syntheticException?: Error, attachStacktrace?: boolean): Event {\n const event: Event = {\n message: input,\n };\n\n if (attachStacktrace && syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n"]}
1
+ {"version":3,"file":"eventbuilder.js","sourceRoot":"","sources":["../../../src/eventbuilder.ts"],"names":[],"mappings":";AAAA,OAAO,EAA+B,QAAQ,EAAc,MAAM,eAAe,CAAC;AAClF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,8BAA8B,EAC9B,UAAU,EACV,cAAc,EACd,OAAO,EACP,YAAY,EACZ,OAAO,EACP,aAAa,EACb,eAAe,EACf,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAA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C,SAAS,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE;QAClD,kHAAkH;QAClH,mHAAmH;QACnH,iCAAiC;QACjC,IAAM,eAAe,GAAG,SAAoC,CAAC;QAC7D,KAAK,GAAG,oBAAoB,CAAC,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;QACxF,qBAAqB,CAAC,KAAK,EAAE;YAC3B,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;KACd;IAED,sEAAsE;IACtE,4BAA4B;IAC5B,gCAAgC;IAChC,yBAAyB;IACzB,yBAAyB;IACzB,oDAAoD;IACpD,mBAAmB;IACnB,EAAE;IACF,kDAAkD;IAClD,KAAK,GAAG,eAAe,CAAC,SAAmB,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;IACnF,qBAAqB,CAAC,KAAK,EAAE,KAAG,SAAW,EAAE,SAAS,CAAC,CAAC;IACxD,qBAAqB,CAAC,KAAK,EAAE;QAC3B,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,kBAA0B,EAAE,gBAA0B;IACnG,IAAM,KAAK,GAAU;QACnB,OAAO,EAAE,KAAK;KACf,CAAC;IAEF,IAAI,gBAAgB,IAAI,kBAAkB,EAAE;QAC1C,IAAM,QAAM,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;QACpD,IAAI,QAAM,CAAC,MAAM,EAAE;YACjB,KAAK,CAAC,UAAU,GAAG,EAAE,MAAM,UAAA,EAAE,CAAC;SAC/B;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { Event, EventHint, Exception, Severity, StackFrame } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n createStackParser,\n extractExceptionKeysForMessage,\n isDOMError,\n isDOMException,\n isError,\n isErrorEvent,\n isEvent,\n isPlainObject,\n normalizeToSize,\n resolvedSyncPromise,\n} from '@sentry/utils';\n\nimport {\n chromeStackParser,\n geckoStackParser,\n opera10StackParser,\n opera11StackParser,\n winjsStackParser,\n} from './stack-parsers';\n\n/**\n * This function creates an exception from an TraceKitStackTrace\n * @param stacktrace TraceKitStackTrace that will be converted to an exception\n * @hidden\n */\nexport function exceptionFromError(ex: Error): Exception {\n // Get the frames first since Opera can lose the stack if we touch anything else first\n const frames = parseStackFrames(ex);\n\n const exception: Exception = {\n type: ex && ex.name,\n value: extractMessage(ex),\n };\n\n if (frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\n/**\n * @hidden\n */\nexport function eventFromPlainObject(\n exception: Record<string, unknown>,\n syntheticException?: Error,\n isUnhandledRejection?: boolean,\n): Event {\n const event: Event = {\n exception: {\n values: [\n {\n type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',\n value: `Non-Error ${\n isUnhandledRejection ? 'promise rejection' : 'exception'\n } captured with keys: ${extractExceptionKeysForMessage(exception)}`,\n },\n ],\n },\n extra: {\n __serialized__: normalizeToSize(exception),\n },\n };\n\n if (syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromError(ex: Error): Event {\n return {\n exception: {\n values: [exceptionFromError(ex)],\n },\n };\n}\n\n/** Parses stack frames from an error */\nexport function parseStackFrames(ex: Error & { framesToPop?: number; stacktrace?: string }): StackFrame[] {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || '';\n\n const popSize = getPopSize(ex);\n\n try {\n return createStackParser(\n opera10StackParser,\n opera11StackParser,\n chromeStackParser,\n winjsStackParser,\n geckoStackParser,\n )(stacktrace, popSize);\n } catch (e) {\n // no-empty\n }\n\n return [];\n}\n\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\nfunction getPopSize(ex: Error & { framesToPop?: number }): number {\n if (ex) {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n\n if (reactMinifiedRegexp.test(ex.message)) {\n return 1;\n }\n }\n\n return 0;\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\nfunction extractMessage(ex: Error & { message: { error?: Error } }): string {\n const message = ex && ex.message;\n if (!message) {\n return 'No error message';\n }\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message;\n }\n return message;\n}\n\n/**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n * @hidden\n */\nexport function eventFromException(\n exception: unknown,\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(exception, syntheticException, attachStacktrace);\n addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }\n event.level = Severity.Error;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nexport function eventFromMessage(\n message: string,\n level: Severity = Severity.Info,\n hint?: EventHint,\n attachStacktrace?: boolean,\n): PromiseLike<Event> {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(message, syntheticException, attachStacktrace);\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * @hidden\n */\nexport function eventFromUnknownInput(\n exception: unknown,\n syntheticException?: Error,\n attachStacktrace?: boolean,\n isUnhandledRejection?: boolean,\n): Event {\n let event: Event;\n\n if (isErrorEvent(exception as ErrorEvent) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n return eventFromError(errorEvent.error as Error);\n }\n\n // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name\n // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be\n // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`.\n //\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n // https://webidl.spec.whatwg.org/#es-DOMException-specialness\n if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {\n const domException = exception as DOMException;\n\n if ('stack' in (exception as Error)) {\n event = eventFromError(exception as Error);\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n event = eventFromString(message, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, message);\n }\n if ('code' in domException) {\n event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };\n }\n\n return event;\n }\n if (isError(exception)) {\n // we have a real Error object, do nothing\n return eventFromError(exception);\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize\n // it manually. This will allow us to group events based on top-level keys which is much better than creating a new\n // group on any key/value change.\n const objectException = exception as Record<string, unknown>;\n event = eventFromPlainObject(objectException, syntheticException, isUnhandledRejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n event = eventFromString(exception as string, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, `${exception}`, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\n/**\n * @hidden\n */\nexport function eventFromString(input: string, syntheticException?: Error, attachStacktrace?: boolean): Event {\n const event: Event = {\n message: input,\n };\n\n if (attachStacktrace && syntheticException) {\n const frames = parseStackFrames(syntheticException);\n if (frames.length) {\n event.stacktrace = { frames };\n }\n }\n\n return event;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,GACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,GACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,QAAQ,GAKT,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAuB,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export {\n Breadcrumb,\n BreadcrumbHint,\n Request,\n SdkInfo,\n Event,\n EventHint,\n EventStatus,\n Exception,\n Response,\n Severity,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n} from '@sentry/types';\n\nexport { SeverityLevel } from '@sentry/utils';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n configureScope,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n makeMain,\n Scope,\n Session,\n startTransaction,\n SDK_VERSION,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n withScope,\n} from '@sentry/core';\n\nexport { BrowserOptions } from './backend';\nexport { BrowserClient } from './client';\nexport { injectReportDialog, ReportDialogOptions } from './helpers';\nexport { eventFromException, eventFromMessage } from './eventbuilder';\nexport { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close, wrap } from './sdk';\nexport { SDK_NAME } from './version';\n"]}
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,QAAQ,GAKT,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,GAAG,EACH,QAAQ,EACR,KAAK,EACL,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAuB,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export {\n Breadcrumb,\n BreadcrumbHint,\n Request,\n SdkInfo,\n Event,\n EventHint,\n EventStatus,\n Exception,\n Response,\n Severity,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n} from '@sentry/types';\n\nexport { SeverityLevel } from '@sentry/utils';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n configureScope,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n makeMain,\n Scope,\n Session,\n startTransaction,\n SDK_VERSION,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n withScope,\n} from '@sentry/core';\n\nexport { BrowserOptions } from './backend';\nexport { BrowserClient } from './client';\nexport { injectReportDialog, ReportDialogOptions } from './helpers';\nexport { eventFromException, eventFromMessage } from './eventbuilder';\nexport { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close, wrap } from './sdk';\nexport { SDK_NAME } from './version';\n"]}
package/esm/flags.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ /** Flag that is true for debug builds, false otherwise. */
2
+ export declare const IS_DEBUG_BUILD: boolean;
3
+ //# sourceMappingURL=flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../src/flags.ts"],"names":[],"mappings":"AAgBA,2DAA2D;AAC3D,eAAO,MAAM,cAAc,SAAoE,CAAC"}
package/esm/flags.js ADDED
@@ -0,0 +1,16 @@
1
+ /*
2
+ * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking
3
+ * for users.
4
+ *
5
+ * Debug flags need to be declared in each package individually and must not be imported across package boundaries,
6
+ * because some build tools have trouble tree-shaking imported guards.
7
+ *
8
+ * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.
9
+ *
10
+ * Debug flag files will contain "magic strings" like `__SENTRY_DEBUG__` that may get replaced with actual values during
11
+ * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not
12
+ * replaced.
13
+ */
14
+ /** Flag that is true for debug builds, false otherwise. */
15
+ export var IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;
16
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,2DAA2D;AAC3D,MAAM,CAAC,IAAM,cAAc,GAAG,OAAO,gBAAgB,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC","sourcesContent":["/*\n * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking\n * for users.\n *\n * Debug flags need to be declared in each package individually and must not be imported across package boundaries,\n * because some build tools have trouble tree-shaking imported guards.\n *\n * As a convention, we define debug flags in a `flags.ts` file in the root of a package's `src` folder.\n *\n * Debug flag files will contain \"magic strings\" like `__SENTRY_DEBUG__` that may get replaced with actual values during\n * our, or the user's build process. Take care when introducing new flags - they must not throw if they are not\n * replaced.\n */\n\ndeclare const __SENTRY_DEBUG__: boolean;\n\n/** Flag that is true for debug builds, false otherwise. */\nexport const IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAwB,SAAS,EAAS,eAAe,EAAE,MAAM,eAAe,CAAC;AAejG;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAClB,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,SAAS,CAAC;CAClB,EACN,MAAM,CAAC,EAAE,eAAe,GAEvB,GAAG,CAyGL;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAElC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAA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AC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,MAAM,CAAC,IAAI,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI,CA6B1E"}
package/esm/helpers.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { __assign } from "tslib";
2
2
  import { captureException, getReportDialogEndpoint, withScope } from '@sentry/core';
3
- import { addExceptionMechanism, addExceptionTypeValue, addNonEnumerableProperty, getGlobalObject, getOriginalFunction, isDebugBuild, logger, markFunctionWrapped, } from '@sentry/utils';
3
+ import { addExceptionMechanism, addExceptionTypeValue, addNonEnumerableProperty, getGlobalObject, getOriginalFunction, logger, markFunctionWrapped, } from '@sentry/utils';
4
+ import { IS_DEBUG_BUILD } from './flags';
4
5
  var global = getGlobalObject();
5
6
  var ignoreOnError = 0;
6
7
  /**
@@ -128,11 +129,11 @@ export function injectReportDialog(options) {
128
129
  return;
129
130
  }
130
131
  if (!options.eventId) {
131
- isDebugBuild() && logger.error('Missing eventId option in showReportDialog call');
132
+ IS_DEBUG_BUILD && logger.error('Missing eventId option in showReportDialog call');
132
133
  return;
133
134
  }
134
135
  if (!options.dsn) {
135
- isDebugBuild() && logger.error('Missing dsn option in showReportDialog call');
136
+ IS_DEBUG_BUILD && logger.error('Missing dsn option in showReportDialog call');
136
137
  return;
137
138
  }
138
139
  var script = global.document.createElement('script');
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,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,CAAC,MAAM,EAAE;QAClB,6DAA6D;QAC7D,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;KAChC;IAED,IAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAEpE,IAAI,cAAc,EAAE;QAClB,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KACpC;AACH,CAAC","sourcesContent":["import { captureException, getReportDialogEndpoint, withScope } from '@sentry/core';\nimport { DsnLike, Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n addNonEnumerableProperty,\n getGlobalObject,\n getOriginalFunction,\n isDebugBuild,\n logger,\n markFunctionWrapped,\n} from '@sentry/utils';\n\nconst global = getGlobalObject<Window>();\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError += 1;\n setTimeout(() => {\n ignoreOnError -= 1;\n });\n}\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap(\n fn: WrappedFunction,\n options: {\n mechanism?: Mechanism;\n } = {},\n before?: WrappedFunction,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n // for future readers what this does is wrap a function and then create\n // a bi-directional wrapping between them.\n //\n // example: wrapped = wrap(original);\n // original.__sentry_wrapped__ -> wrapped\n // wrapped.__sentry_original__ -> original\n\n if (typeof fn !== 'function') {\n return fn;\n }\n\n try {\n // if we're dealing with a function that was previously wrapped, return\n // the original wrapper.\n const wrapper = fn.__sentry_wrapped__;\n if (wrapper) {\n return wrapper;\n }\n\n // We don't wanna wrap it twice\n if (getOriginalFunction(fn)) {\n return fn;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n /* eslint-disable prefer-rest-params */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sentryWrapped: WrappedFunction = function (this: any): void {\n const args = Array.prototype.slice.call(arguments);\n\n try {\n if (before && typeof before === 'function') {\n before.apply(this, arguments);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const wrappedArguments = args.map((arg: any) => wrap(arg, options));\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope((scope: Scope) => {\n scope.addEventProcessor((event: SentryEvent) => {\n if (options.mechanism) {\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, options.mechanism);\n }\n\n event.extra = {\n ...event.extra,\n arguments: args,\n };\n\n return event;\n });\n\n captureException(ex);\n });\n\n throw ex;\n }\n };\n /* eslint-enable prefer-rest-params */\n\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property] = fn[property];\n }\n }\n } catch (_oO) {} // eslint-disable-line no-empty\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n markFunctionWrapped(sentryWrapped, fn);\n\n addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);\n\n // Restore original function name (not all browsers allow that)\n try {\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') as PropertyDescriptor;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n // eslint-disable-next-line no-empty\n } catch (_oO) {}\n\n return sentryWrapped;\n}\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * Injects the Report Dialog script\n * @hidden\n */\nexport function injectReportDialog(options: ReportDialogOptions = {}): void {\n if (!global.document) {\n return;\n }\n\n if (!options.eventId) {\n isDebugBuild() && logger.error('Missing eventId option in showReportDialog call');\n return;\n }\n\n if (!options.dsn) {\n isDebugBuild() && logger.error('Missing dsn option in showReportDialog call');\n return;\n }\n\n const script = global.document.createElement('script');\n script.async = true;\n script.src = getReportDialogEndpoint(options.dsn, options);\n\n if (options.onLoad) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n script.onload = options.onLoad;\n }\n\n const injectionPoint = global.document.head || global.document.body;\n\n if (injectionPoint) {\n injectionPoint.appendChild(script);\n }\n}\n"]}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/helpers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,IAAM,MAAM,GAAG,eAAe,EAAU,CAAC;AACzC,IAAI,aAAa,GAAW,CAAC,CAAC;A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AC","sourcesContent":["import { captureException, getReportDialogEndpoint, withScope } from '@sentry/core';\nimport { DsnLike, Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';\nimport {\n addExceptionMechanism,\n addExceptionTypeValue,\n addNonEnumerableProperty,\n getGlobalObject,\n getOriginalFunction,\n logger,\n markFunctionWrapped,\n} from '@sentry/utils';\n\nimport { IS_DEBUG_BUILD } from './flags';\n\nconst global = getGlobalObject<Window>();\nlet ignoreOnError: number = 0;\n\n/**\n * @hidden\n */\nexport function shouldIgnoreOnError(): boolean {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nexport function ignoreNextOnError(): void {\n // onerror should trigger before setTimeout\n ignoreOnError += 1;\n setTimeout(() => {\n ignoreOnError -= 1;\n });\n}\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap.\n * @returns The wrapped function.\n * @hidden\n */\nexport function wrap(\n fn: WrappedFunction,\n options: {\n mechanism?: Mechanism;\n } = {},\n before?: WrappedFunction,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n // for future readers what this does is wrap a function and then create\n // a bi-directional wrapping between them.\n //\n // example: wrapped = wrap(original);\n // original.__sentry_wrapped__ -> wrapped\n // wrapped.__sentry_original__ -> original\n\n if (typeof fn !== 'function') {\n return fn;\n }\n\n try {\n // if we're dealing with a function that was previously wrapped, return\n // the original wrapper.\n const wrapper = fn.__sentry_wrapped__;\n if (wrapper) {\n return wrapper;\n }\n\n // We don't wanna wrap it twice\n if (getOriginalFunction(fn)) {\n return fn;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n /* eslint-disable prefer-rest-params */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sentryWrapped: WrappedFunction = function (this: any): void {\n const args = Array.prototype.slice.call(arguments);\n\n try {\n if (before && typeof before === 'function') {\n before.apply(this, arguments);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const wrappedArguments = args.map((arg: any) => wrap(arg, options));\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope((scope: Scope) => {\n scope.addEventProcessor((event: SentryEvent) => {\n if (options.mechanism) {\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, options.mechanism);\n }\n\n event.extra = {\n ...event.extra,\n arguments: args,\n };\n\n return event;\n });\n\n captureException(ex);\n });\n\n throw ex;\n }\n };\n /* eslint-enable prefer-rest-params */\n\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property] = fn[property];\n }\n }\n } catch (_oO) {} // eslint-disable-line no-empty\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n markFunctionWrapped(sentryWrapped, fn);\n\n addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);\n\n // Restore original function name (not all browsers allow that)\n try {\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') as PropertyDescriptor;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get(): string {\n return fn.name;\n },\n });\n }\n // eslint-disable-next-line no-empty\n } catch (_oO) {}\n\n return sentryWrapped;\n}\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n /** Callback after reportDialog showed up */\n onLoad?(): void;\n}\n\n/**\n * Injects the Report Dialog script\n * @hidden\n */\nexport function injectReportDialog(options: ReportDialogOptions = {}): void {\n if (!global.document) {\n return;\n }\n\n if (!options.eventId) {\n IS_DEBUG_BUILD && logger.error('Missing eventId option in showReportDialog call');\n return;\n }\n\n if (!options.dsn) {\n IS_DEBUG_BUILD && logger.error('Missing dsn option in showReportDialog call');\n return;\n }\n\n const script = global.document.createElement('script');\n script.async = true;\n script.src = getReportDialogEndpoint(options.dsn, options);\n\n if (options.onLoad) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n script.onload = options.onLoad;\n }\n\n const injectionPoint = global.document.head || global.document.body;\n\n if (injectionPoint) {\n injectionPoint.appendChild(script);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,KAAK,mBAAmB,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAU3C,QAAA,MAAM,YAAY;;;;;;;;;CAIjB,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,YAAY,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,KAAK,mBAAmB,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAU3C,QAAA,MAAM,YAAY;;;;;;;;;CAIjB,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,YAAY,EAAE,UAAU,EAAE,CAAC"}
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,mBAAmB,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,IAAI,kBAAkB,GAAG,EAAE,CAAC;AAE5B,gGAAgG;AAChG,IAAM,OAAO,GAAG,eAAe,EAAU,CAAC;AAC1C,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE;IACjD,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;CAClD;AAED,IAAM,YAAY,kCACb,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,CACvB,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,YAAY,EAAE,UAAU,EAAE,CAAC","sourcesContent":["export * from './exports';\n\nimport { Integrations as CoreIntegrations } from '@sentry/core';\nimport { getGlobalObject } from '@sentry/utils';\n\nimport * as BrowserIntegrations from './integrations';\nimport * as Transports from './transports';\n\nlet windowIntegrations = {};\n\n// This block is needed to add compatibility with the integrations packages when used with a CDN\nconst _window = getGlobalObject<Window>();\nif (_window.Sentry && _window.Sentry.Integrations) {\n windowIntegrations = _window.Sentry.Integrations;\n}\n\nconst INTEGRATIONS = {\n ...windowIntegrations,\n ...CoreIntegrations,\n ...BrowserIntegrations,\n};\n\nexport { INTEGRATIONS as Integrations, Transports };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";AAAA,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,KAAK,mBAAmB,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,IAAI,kBAAkB,GAAG,EAAE,CAAC;AAE5B,gGAAgG;AAChG,IAAM,OAAO,GAAG,eAAe,EAAU,CAAC;AAC1C,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE;IACjD,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;CAClD;AAED,IAAM,YAAY,kCACb,kBAAkB,GAClB,gBAAgB,GAChB,mBAAmB,CACvB,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,YAAY,EAAE,UAAU,EAAE,CAAC","sourcesContent":["export * from './exports';\n\nimport { Integrations as CoreIntegrations } from '@sentry/core';\nimport { getGlobalObject } from '@sentry/utils';\n\nimport * as BrowserIntegrations from './integrations';\nimport * as Transports from './transports';\n\nlet windowIntegrations = {};\n\n// This block is needed to add compatibility with the integrations packages when used with a CDN\nconst _window = getGlobalObject<Window>();\nif (_window.Sentry && _window.Sentry.Integrations) {\n windowIntegrations = _window.Sentry.Integrations;\n}\n\nconst INTEGRATIONS = {\n ...windowIntegrations,\n ...CoreIntegrations,\n ...BrowserIntegrations,\n};\n\nexport { INTEGRATIONS as Integrations, Transports };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../../src/integrations/breadcrumbs.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAY,MAAM,eAAe,CAAC;AAW7D,YAAY;AACZ,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,GAAG;QAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,EAA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I,MAAA;YACJ,EAAE,IAAA;SACH;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable max-lines */\nimport { getCurrentHub } from '@sentry/core';\nimport { Event, Integration, Severity } from '@sentry/types';\nimport {\n addInstrumentationHandler,\n getEventDescription,\n getGlobalObject,\n htmlTreeAsString,\n parseUrl,\n safeJoin,\n severityFromString,\n} from '@sentry/utils';\n\n/** JSDoc */\ninterface BreadcrumbsOptions {\n console: boolean;\n dom: boolean | { serializeAttribute: string | string[] };\n fetch: boolean;\n history: boolean;\n sentry: boolean;\n xhr: boolean;\n}\n\n/**\n * Default Breadcrumbs instrumentations\n * TODO: Deprecated - with v6, this will be renamed to `Instrument`\n */\nexport class Breadcrumbs implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Breadcrumbs';\n\n /**\n * @inheritDoc\n */\n public name: string = Breadcrumbs.id;\n\n /** JSDoc */\n private readonly _options: BreadcrumbsOptions;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: Partial<BreadcrumbsOptions>) {\n this._options = {\n console: true,\n dom: true,\n fetch: true,\n history: true,\n sentry: true,\n xhr: true,\n ...options,\n };\n }\n\n /**\n * Create a breadcrumb of `sentry` from the events themselves\n */\n public addSentryBreadcrumb(event: Event): void {\n if (!this._options.sentry) {\n return;\n }\n getCurrentHub().addBreadcrumb(\n {\n category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,\n event_id: event.event_id,\n level: event.level,\n message: getEventDescription(event),\n },\n {\n event,\n },\n );\n }\n\n /**\n * Instrument browser built-ins w/ breadcrumb capturing\n * - Console API\n * - DOM API (click/typing)\n * - XMLHttpRequest API\n * - Fetch API\n * - History API\n */\n public setupOnce(): void {\n if (this._options.console) {\n addInstrumentationHandler('console', _consoleBreadcrumb);\n }\n if (this._options.dom) {\n addInstrumentationHandler('dom', _domBreadcrumb(this._options.dom));\n }\n if (this._options.xhr) {\n addInstrumentationHandler('xhr', _xhrBreadcrumb);\n }\n if (this._options.fetch) {\n addInstrumentationHandler('fetch', _fetchBreadcrumb);\n }\n if (this._options.history) {\n addInstrumentationHandler('history', _historyBreadcrumb);\n }\n }\n}\n\n/**\n * A HOC that creaes a function that creates breadcrumbs from DOM API calls.\n * This is a HOC so that we get access to dom options in the closure.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: { [key: string]: any }) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _innerDomBreadcrumb(handlerData: { [key: string]: any }): void {\n let target;\n let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;\n\n if (typeof keyAttrs === 'string') {\n keyAttrs = [keyAttrs];\n }\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n target = handlerData.event.target\n ? htmlTreeAsString(handlerData.event.target as Node, keyAttrs)\n : htmlTreeAsString(handlerData.event as unknown as Node, keyAttrs);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n getCurrentHub().addBreadcrumb(\n {\n category: `ui.${handlerData.name}`,\n message: target,\n },\n {\n event: handlerData.event,\n name: handlerData.name,\n global: handlerData.global,\n },\n );\n }\n\n return _innerDomBreadcrumb;\n}\n\n/**\n * Creates breadcrumbs from console API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _consoleBreadcrumb(handlerData: { [key: string]: any }): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: handlerData.args,\n logger: 'console',\n },\n level: severityFromString(handlerData.level),\n message: safeJoin(handlerData.args, ' '),\n };\n\n if (handlerData.level === 'assert') {\n if (handlerData.args[0] === false) {\n breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;\n breadcrumb.data.arguments = handlerData.args.slice(1);\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n getCurrentHub().addBreadcrumb(breadcrumb, {\n input: handlerData.args,\n level: handlerData.level,\n });\n}\n\n/**\n * Creates breadcrumbs from XHR API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _xhrBreadcrumb(handlerData: { [key: string]: any }): void {\n if (handlerData.endTimestamp) {\n // We only capture complete, non-sentry requests\n if (handlerData.xhr.__sentry_own_request__) {\n return;\n }\n\n const { method, url, status_code, body } = handlerData.xhr.__sentry_xhr__ || {};\n\n getCurrentHub().addBreadcrumb(\n {\n category: 'xhr',\n data: {\n method,\n url,\n status_code,\n },\n type: 'http',\n },\n {\n xhr: handlerData.xhr,\n input: body,\n },\n );\n\n return;\n }\n}\n\n/**\n * Creates breadcrumbs from fetch API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _fetchBreadcrumb(handlerData: { [key: string]: any }): void {\n // We only capture complete fetch requests\n if (!handlerData.endTimestamp) {\n return;\n }\n\n if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {\n // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)\n return;\n }\n\n if (handlerData.error) {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: handlerData.fetchData,\n level: Severity.Error,\n type: 'http',\n },\n {\n data: handlerData.error,\n input: handlerData.args,\n },\n );\n } else {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: {\n ...handlerData.fetchData,\n status_code: handlerData.response.status,\n },\n type: 'http',\n },\n {\n input: handlerData.args,\n response: handlerData.response,\n },\n );\n }\n}\n\n/**\n * Creates breadcrumbs from history API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _historyBreadcrumb(handlerData: { [key: string]: any }): void {\n const global = getGlobalObject<Window>();\n let from = handlerData.from;\n let to = handlerData.to;\n const parsedLoc = parseUrl(global.location.href);\n let parsedFrom = parseUrl(from);\n const parsedTo = parseUrl(to);\n\n // Initial pushState doesn't provide `from` information\n if (!parsedFrom.path) {\n parsedFrom = parsedLoc;\n }\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {\n to = parsedTo.relative;\n }\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {\n from = parsedFrom.relative;\n }\n\n getCurrentHub().addBreadcrumb({\n category: 'navigation',\n data: {\n from,\n to,\n },\n });\n}\n"]}
1
+ {"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../../../src/integrations/breadcrumbs.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,8BAA8B;AAC9B,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,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,aAAU,KAAK,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAE;YAC5E,QAAQ,EAAE,KAAK,C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AAI,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, Severity } from '@sentry/types';\nimport {\n addInstrumentationHandler,\n getEventDescription,\n getGlobalObject,\n htmlTreeAsString,\n parseUrl,\n safeJoin,\n severityFromString,\n} from '@sentry/utils';\n\n/** JSDoc */\ninterface BreadcrumbsOptions {\n console: boolean;\n dom: boolean | { serializeAttribute: string | string[] };\n fetch: boolean;\n history: boolean;\n sentry: boolean;\n xhr: boolean;\n}\n\n/**\n * Default Breadcrumbs instrumentations\n * TODO: Deprecated - with v6, this will be renamed to `Instrument`\n */\nexport class Breadcrumbs implements Integration {\n /**\n * @inheritDoc\n */\n public static id: string = 'Breadcrumbs';\n\n /**\n * @inheritDoc\n */\n public name: string = Breadcrumbs.id;\n\n /** JSDoc */\n private readonly _options: BreadcrumbsOptions;\n\n /**\n * @inheritDoc\n */\n public constructor(options?: Partial<BreadcrumbsOptions>) {\n this._options = {\n console: true,\n dom: true,\n fetch: true,\n history: true,\n sentry: true,\n xhr: true,\n ...options,\n };\n }\n\n /**\n * Create a breadcrumb of `sentry` from the events themselves\n */\n public addSentryBreadcrumb(event: Event): void {\n if (!this._options.sentry) {\n return;\n }\n getCurrentHub().addBreadcrumb(\n {\n category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,\n event_id: event.event_id,\n level: event.level,\n message: getEventDescription(event),\n },\n {\n event,\n },\n );\n }\n\n /**\n * Instrument browser built-ins w/ breadcrumb capturing\n * - Console API\n * - DOM API (click/typing)\n * - XMLHttpRequest API\n * - Fetch API\n * - History API\n */\n public setupOnce(): void {\n if (this._options.console) {\n addInstrumentationHandler('console', _consoleBreadcrumb);\n }\n if (this._options.dom) {\n addInstrumentationHandler('dom', _domBreadcrumb(this._options.dom));\n }\n if (this._options.xhr) {\n addInstrumentationHandler('xhr', _xhrBreadcrumb);\n }\n if (this._options.fetch) {\n addInstrumentationHandler('fetch', _fetchBreadcrumb);\n }\n if (this._options.history) {\n addInstrumentationHandler('history', _historyBreadcrumb);\n }\n }\n}\n\n/**\n * A HOC that creaes a function that creates breadcrumbs from DOM API calls.\n * This is a HOC so that we get access to dom options in the closure.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _domBreadcrumb(dom: BreadcrumbsOptions['dom']): (handlerData: { [key: string]: any }) => void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _innerDomBreadcrumb(handlerData: { [key: string]: any }): void {\n let target;\n let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;\n\n if (typeof keyAttrs === 'string') {\n keyAttrs = [keyAttrs];\n }\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n target = handlerData.event.target\n ? htmlTreeAsString(handlerData.event.target as Node, keyAttrs)\n : htmlTreeAsString(handlerData.event as unknown as Node, keyAttrs);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n getCurrentHub().addBreadcrumb(\n {\n category: `ui.${handlerData.name}`,\n message: target,\n },\n {\n event: handlerData.event,\n name: handlerData.name,\n global: handlerData.global,\n },\n );\n }\n\n return _innerDomBreadcrumb;\n}\n\n/**\n * Creates breadcrumbs from console API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _consoleBreadcrumb(handlerData: { [key: string]: any }): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: handlerData.args,\n logger: 'console',\n },\n level: severityFromString(handlerData.level),\n message: safeJoin(handlerData.args, ' '),\n };\n\n if (handlerData.level === 'assert') {\n if (handlerData.args[0] === false) {\n breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;\n breadcrumb.data.arguments = handlerData.args.slice(1);\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n getCurrentHub().addBreadcrumb(breadcrumb, {\n input: handlerData.args,\n level: handlerData.level,\n });\n}\n\n/**\n * Creates breadcrumbs from XHR API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _xhrBreadcrumb(handlerData: { [key: string]: any }): void {\n if (handlerData.endTimestamp) {\n // We only capture complete, non-sentry requests\n if (handlerData.xhr.__sentry_own_request__) {\n return;\n }\n\n const { method, url, status_code, body } = handlerData.xhr.__sentry_xhr__ || {};\n\n getCurrentHub().addBreadcrumb(\n {\n category: 'xhr',\n data: {\n method,\n url,\n status_code,\n },\n type: 'http',\n },\n {\n xhr: handlerData.xhr,\n input: body,\n },\n );\n\n return;\n }\n}\n\n/**\n * Creates breadcrumbs from fetch API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _fetchBreadcrumb(handlerData: { [key: string]: any }): void {\n // We only capture complete fetch requests\n if (!handlerData.endTimestamp) {\n return;\n }\n\n if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {\n // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)\n return;\n }\n\n if (handlerData.error) {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: handlerData.fetchData,\n level: Severity.Error,\n type: 'http',\n },\n {\n data: handlerData.error,\n input: handlerData.args,\n },\n );\n } else {\n getCurrentHub().addBreadcrumb(\n {\n category: 'fetch',\n data: {\n ...handlerData.fetchData,\n status_code: handlerData.response.status,\n },\n type: 'http',\n },\n {\n input: handlerData.args,\n response: handlerData.response,\n },\n );\n }\n}\n\n/**\n * Creates breadcrumbs from history API calls\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _historyBreadcrumb(handlerData: { [key: string]: any }): void {\n const global = getGlobalObject<Window>();\n let from = handlerData.from;\n let to = handlerData.to;\n const parsedLoc = parseUrl(global.location.href);\n let parsedFrom = parseUrl(from);\n const parsedTo = parseUrl(to);\n\n // Initial pushState doesn't provide `from` information\n if (!parsedFrom.path) {\n parsedFrom = parsedLoc;\n }\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {\n to = parsedTo.relative;\n }\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {\n from = parsedFrom.relative;\n }\n\n getCurrentHub().addBreadcrumb({\n category: 'navigation',\n data: {\n from,\n to,\n },\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dedupe.d.ts","sourceRoot":"","sources":["../../../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"}
1
+ {"version":3,"file":"dedupe.d.ts","sourceRoot":"","sources":["../../../../src/integrations/dedupe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,cAAc,EAAa,GAAG,EAAE,WAAW,EAAc,MAAM,eAAe,CAAC;AAK/F,2BAA2B;AAC3B,qBAAa,MAAO,YAAW,WAAW;IACxC;;OAEG;IACH,OAAc,EAAE,EAAE,MAAM,CAAY;IAEpC;;OAEG;IACI,IAAI,EAAE,MAAM,CAAa;IAEhC;;OAEG;IACH,OAAO,CAAC,cAAc,CAAC,CAAQ;IAE/B;;OAEG;IACI,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,IAAI;CAmB9G"}