@sentry/browser 6.18.1-beta.0 → 6.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/bundles/bundle.debug.min.js +3 -0
  2. package/bundles/bundle.debug.min.js.map +1 -0
  3. package/bundles/bundle.es6.debug.min.js +3 -0
  4. package/bundles/bundle.es6.debug.min.js.map +1 -0
  5. package/{build → bundles}/bundle.es6.js +270 -278
  6. package/bundles/bundle.es6.js.map +1 -0
  7. package/bundles/bundle.es6.min.js +3 -0
  8. package/bundles/bundle.es6.min.js.map +1 -0
  9. package/{build → bundles}/bundle.js +305 -306
  10. package/bundles/bundle.js.map +1 -0
  11. package/bundles/bundle.min.js +3 -0
  12. package/bundles/bundle.min.js.map +1 -0
  13. package/dist/backend.d.ts.map +1 -1
  14. package/dist/backend.js +2 -2
  15. package/dist/backend.js.map +1 -1
  16. package/dist/client.d.ts.map +1 -1
  17. package/dist/client.js +1 -1
  18. package/dist/client.js.map +1 -1
  19. package/dist/eventbuilder.d.ts +24 -10
  20. package/dist/eventbuilder.d.ts.map +1 -1
  21. package/dist/eventbuilder.js +119 -23
  22. package/dist/eventbuilder.js.map +1 -1
  23. package/dist/exports.d.ts.map +1 -1
  24. package/dist/exports.js.map +1 -1
  25. package/dist/helpers.d.ts.map +1 -1
  26. package/dist/helpers.js +2 -6
  27. package/dist/helpers.js.map +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/integrations/breadcrumbs.d.ts.map +1 -1
  31. package/dist/integrations/breadcrumbs.js.map +1 -1
  32. package/dist/integrations/dedupe.d.ts.map +1 -1
  33. package/dist/integrations/dedupe.js +1 -1
  34. package/dist/integrations/dedupe.js.map +1 -1
  35. package/dist/integrations/globalhandlers.d.ts.map +1 -1
  36. package/dist/integrations/globalhandlers.js +3 -11
  37. package/dist/integrations/globalhandlers.js.map +1 -1
  38. package/dist/integrations/index.d.ts.map +1 -1
  39. package/dist/integrations/index.js.map +1 -1
  40. package/dist/integrations/linkederrors.d.ts.map +1 -1
  41. package/dist/integrations/linkederrors.js +2 -2
  42. package/dist/integrations/linkederrors.js.map +1 -1
  43. package/dist/integrations/trycatch.d.ts.map +1 -1
  44. package/dist/integrations/trycatch.js +26 -21
  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 +3 -9
  50. package/dist/sdk.js.map +1 -1
  51. package/dist/stack-parsers.d.ts +5 -5
  52. package/dist/stack-parsers.d.ts.map +1 -1
  53. package/dist/stack-parsers.js +16 -6
  54. package/dist/stack-parsers.js.map +1 -1
  55. package/dist/transports/base.d.ts +6 -6
  56. package/dist/transports/base.d.ts.map +1 -1
  57. package/dist/transports/base.js +17 -68
  58. package/dist/transports/base.js.map +1 -1
  59. package/dist/transports/fetch.d.ts.map +1 -1
  60. package/dist/transports/fetch.js +2 -0
  61. package/dist/transports/fetch.js.map +1 -1
  62. package/dist/transports/index.d.ts.map +1 -1
  63. package/dist/transports/index.js.map +1 -1
  64. package/dist/transports/utils.d.ts.map +1 -1
  65. package/dist/transports/utils.js +2 -3
  66. package/dist/transports/utils.js.map +1 -1
  67. package/dist/transports/xhr.d.ts.map +1 -1
  68. package/dist/transports/xhr.js +2 -0
  69. package/dist/transports/xhr.js.map +1 -1
  70. package/dist/version.d.ts.map +1 -1
  71. package/dist/version.js.map +1 -1
  72. package/esm/backend.d.ts.map +1 -1
  73. package/esm/backend.js +2 -2
  74. package/esm/backend.js.map +1 -1
  75. package/esm/client.d.ts.map +1 -1
  76. package/esm/client.js +2 -2
  77. package/esm/client.js.map +1 -1
  78. package/esm/eventbuilder.d.ts +24 -10
  79. package/esm/eventbuilder.d.ts.map +1 -1
  80. package/esm/eventbuilder.js +113 -21
  81. package/esm/eventbuilder.js.map +1 -1
  82. package/esm/exports.d.ts.map +1 -1
  83. package/esm/exports.js.map +1 -1
  84. package/esm/helpers.d.ts.map +1 -1
  85. package/esm/helpers.js +2 -6
  86. package/esm/helpers.js.map +1 -1
  87. package/esm/index.d.ts.map +1 -1
  88. package/esm/index.js.map +1 -1
  89. package/esm/integrations/breadcrumbs.d.ts.map +1 -1
  90. package/esm/integrations/breadcrumbs.js.map +1 -1
  91. package/esm/integrations/dedupe.d.ts.map +1 -1
  92. package/esm/integrations/dedupe.js +2 -2
  93. package/esm/integrations/dedupe.js.map +1 -1
  94. package/esm/integrations/globalhandlers.d.ts.map +1 -1
  95. package/esm/integrations/globalhandlers.js +3 -11
  96. package/esm/integrations/globalhandlers.js.map +1 -1
  97. package/esm/integrations/index.d.ts.map +1 -1
  98. package/esm/integrations/index.js.map +1 -1
  99. package/esm/integrations/linkederrors.d.ts.map +1 -1
  100. package/esm/integrations/linkederrors.js +1 -1
  101. package/esm/integrations/linkederrors.js.map +1 -1
  102. package/esm/integrations/trycatch.d.ts.map +1 -1
  103. package/esm/integrations/trycatch.js +26 -21
  104. package/esm/integrations/trycatch.js.map +1 -1
  105. package/esm/integrations/useragent.d.ts.map +1 -1
  106. package/esm/integrations/useragent.js.map +1 -1
  107. package/esm/sdk.d.ts.map +1 -1
  108. package/esm/sdk.js +3 -9
  109. package/esm/sdk.js.map +1 -1
  110. package/esm/stack-parsers.d.ts +5 -5
  111. package/esm/stack-parsers.d.ts.map +1 -1
  112. package/esm/stack-parsers.js +16 -6
  113. package/esm/stack-parsers.js.map +1 -1
  114. package/esm/transports/base.d.ts +6 -6
  115. package/esm/transports/base.d.ts.map +1 -1
  116. package/esm/transports/base.js +19 -70
  117. package/esm/transports/base.js.map +1 -1
  118. package/esm/transports/fetch.d.ts.map +1 -1
  119. package/esm/transports/fetch.js +2 -0
  120. package/esm/transports/fetch.js.map +1 -1
  121. package/esm/transports/index.d.ts.map +1 -1
  122. package/esm/transports/index.js.map +1 -1
  123. package/esm/transports/utils.d.ts.map +1 -1
  124. package/esm/transports/utils.js +2 -3
  125. package/esm/transports/utils.js.map +1 -1
  126. package/esm/transports/xhr.d.ts.map +1 -1
  127. package/esm/transports/xhr.js +2 -0
  128. package/esm/transports/xhr.js.map +1 -1
  129. package/esm/version.d.ts.map +1 -1
  130. package/esm/version.js.map +1 -1
  131. package/package.json +16 -14
  132. package/types/backend.d.ts +43 -0
  133. package/types/backend.d.ts.map +1 -0
  134. package/types/client.d.ts +33 -0
  135. package/types/client.d.ts.map +1 -0
  136. package/types/eventbuilder.d.ts +39 -0
  137. package/types/eventbuilder.d.ts.map +1 -0
  138. package/types/exports.d.ts +10 -0
  139. package/types/exports.d.ts.map +1 -0
  140. package/types/helpers.d.ts +52 -0
  141. package/types/helpers.d.ts.map +1 -0
  142. package/types/index.d.ts +16 -0
  143. package/types/index.d.ts.map +1 -0
  144. package/types/integrations/breadcrumbs.d.ts +47 -0
  145. package/types/integrations/breadcrumbs.d.ts.map +1 -0
  146. package/types/integrations/dedupe.d.ts +21 -0
  147. package/types/integrations/dedupe.d.ts.map +1 -0
  148. package/types/integrations/globalhandlers.d.ts +30 -0
  149. package/types/integrations/globalhandlers.d.ts.map +1 -0
  150. package/types/integrations/index.d.ts +7 -0
  151. package/types/integrations/index.d.ts.map +1 -0
  152. package/types/integrations/linkederrors.d.ts +42 -0
  153. package/types/integrations/linkederrors.d.ts.map +1 -0
  154. package/types/integrations/trycatch.d.ts +33 -0
  155. package/types/integrations/trycatch.d.ts.map +1 -0
  156. package/types/integrations/useragent.d.ts +17 -0
  157. package/types/integrations/useragent.d.ts.map +1 -0
  158. package/types/sdk.d.ts +112 -0
  159. package/types/sdk.d.ts.map +1 -0
  160. package/types/stack-parsers.d.ts +7 -0
  161. package/types/stack-parsers.d.ts.map +1 -0
  162. package/types/transports/base.d.ts +65 -0
  163. package/types/transports/base.d.ts.map +1 -0
  164. package/types/transports/fetch.d.ts +17 -0
  165. package/types/transports/fetch.d.ts.map +1 -0
  166. package/types/transports/index.d.ts +4 -0
  167. package/types/transports/index.d.ts.map +1 -0
  168. package/types/transports/utils.d.ts +48 -0
  169. package/types/transports/utils.d.ts.map +1 -0
  170. package/types/transports/xhr.d.ts +11 -0
  171. package/types/transports/xhr.d.ts.map +1 -0
  172. package/types/version.d.ts +2 -0
  173. package/types/version.d.ts.map +1 -0
  174. package/build/bundle.es6.js.map +0 -1
  175. package/build/bundle.es6.min.js +0 -3
  176. package/build/bundle.es6.min.js.map +0 -1
  177. package/build/bundle.js.map +0 -1
  178. package/build/bundle.min.js +0 -3
  179. package/build/bundle.min.js.map +0 -1
  180. package/dist/parsers.d.ts +0 -21
  181. package/dist/parsers.d.ts.map +0 -1
  182. package/dist/parsers.js +0 -108
  183. package/dist/parsers.js.map +0 -1
  184. package/esm/parsers.d.ts +0 -21
  185. package/esm/parsers.d.ts.map +0 -1
  186. package/esm/parsers.js +0 -103
  187. package/esm/parsers.js.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.18.1-beta.0 (8443996) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.19.0 (b93e8d4) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
 
4
4
  /*! *****************************************************************************
@@ -114,14 +114,11 @@ var Sentry = (function (exports) {
114
114
  }
115
115
 
116
116
  /**
117
- * This module mostly exists for optimizations in the build process
118
- * through rollup and terser. We define some global constants which
119
- * are normally undefined. However terser overrides these with global
120
- * definitions which can be evaluated by the static analyzer when
121
- * creating a bundle.
122
- *
123
- * In turn the `isDebugBuild` and `isBrowserBundle` functions are pure
124
- * and can help us remove unused code from the bundles.
117
+ * This module exists for optimizations in the build process through rollup and terser. We define some global
118
+ * constants, which can be overridden during build. By guarding certain pieces of code with functions that return these
119
+ * constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will
120
+ * never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to
121
+ * `logger` and preventing node-related code from appearing in browser bundles.
125
122
  */
126
123
  /**
127
124
  * Figures out if we're building with debug functionality.
@@ -129,7 +126,7 @@ var Sentry = (function (exports) {
129
126
  * @returns true if this is a debug build
130
127
  */
131
128
  function isDebugBuild() {
132
- return typeof __SENTRY_NO_DEBUG__ !== 'undefined' && !true;
129
+ return true;
133
130
  }
134
131
 
135
132
  /**
@@ -498,9 +495,6 @@ var Sentry = (function (exports) {
498
495
  };
499
496
  }
500
497
  function validateDsn(dsn) {
501
- if (!isDebugBuild()) {
502
- return;
503
- }
504
498
  var port = dsn.port, projectId = dsn.projectId, protocol = dsn.protocol;
505
499
  var requiredComponents = ['protocol', 'publicKey', 'host', 'projectId'];
506
500
  requiredComponents.forEach(function (component) {
@@ -532,6 +526,7 @@ var Sentry = (function (exports) {
532
526
  var global$6 = getGlobalObject();
533
527
  /** Prefix for logging strings */
534
528
  var PREFIX = 'Sentry Logger ';
529
+ var CONSOLE_LEVELS = ['debug', 'info', 'warn', 'error', 'log', 'assert'];
535
530
  /**
536
531
  * Temporarily unwrap `console.log` and friends in order to perform the given callback using the original methods.
537
532
  * Restores wrapping after the callback completes.
@@ -541,7 +536,6 @@ var Sentry = (function (exports) {
541
536
  */
542
537
  function consoleSandbox(callback) {
543
538
  var global = getGlobalObject();
544
- var levels = ['debug', 'info', 'warn', 'error', 'log', 'assert'];
545
539
  if (!('console' in global)) {
546
540
  return callback();
547
541
  }
@@ -549,7 +543,7 @@ var Sentry = (function (exports) {
549
543
  var originalConsole = global.console;
550
544
  var wrappedLevels = {};
551
545
  // Restore all wrapped console methods
552
- levels.forEach(function (level) {
546
+ CONSOLE_LEVELS.forEach(function (level) {
553
547
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
554
548
  if (level in global.console && originalConsole[level].__sentry_original__) {
555
549
  wrappedLevels[level] = originalConsole[level];
@@ -588,7 +582,8 @@ var Sentry = (function (exports) {
588
582
  return;
589
583
  }
590
584
  consoleSandbox(function () {
591
- global$6.console.log(PREFIX + "[Log]: " + args.join(' '));
585
+ var _a;
586
+ (_a = global$6.console).log.apply(_a, __spread([PREFIX + "[Log]:"], args));
592
587
  });
593
588
  };
594
589
  /** JSDoc */
@@ -601,7 +596,8 @@ var Sentry = (function (exports) {
601
596
  return;
602
597
  }
603
598
  consoleSandbox(function () {
604
- global$6.console.warn(PREFIX + "[Warn]: " + args.join(' '));
599
+ var _a;
600
+ (_a = global$6.console).warn.apply(_a, __spread([PREFIX + "[Warn]:"], args));
605
601
  });
606
602
  };
607
603
  /** JSDoc */
@@ -614,14 +610,19 @@ var Sentry = (function (exports) {
614
610
  return;
615
611
  }
616
612
  consoleSandbox(function () {
617
- global$6.console.error(PREFIX + "[Error]: " + args.join(' '));
613
+ var _a;
614
+ (_a = global$6.console).error.apply(_a, __spread([PREFIX + "[Error]:"], args));
618
615
  });
619
616
  };
620
617
  return Logger;
621
618
  }());
622
- // Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used
623
- global$6.__SENTRY__ = global$6.__SENTRY__ || {};
624
- var logger = global$6.__SENTRY__.logger || (global$6.__SENTRY__.logger = new Logger());
619
+ var sentryGlobal = global$6.__SENTRY__ || {};
620
+ var logger = sentryGlobal.logger || new Logger();
621
+ {
622
+ // Ensure we only have a single logger instance, even if multiple versions of @sentry/utils are being used
623
+ sentryGlobal.logger = logger;
624
+ global$6.__SENTRY__ = sentryGlobal;
625
+ }
625
626
 
626
627
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
627
628
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -672,12 +673,13 @@ var Sentry = (function (exports) {
672
673
  * StackFrames are returned in the correct order for Sentry Exception
673
674
  * frames and with Sentry SDK internal frames removed from the top and bottom
674
675
  *
675
- * */
676
+ */
676
677
  function createStackParser() {
677
678
  var parsers = [];
678
679
  for (var _i = 0; _i < arguments.length; _i++) {
679
680
  parsers[_i] = arguments[_i];
680
681
  }
682
+ var sortedParsers = parsers.sort(function (a, b) { return a[0] - b[0]; }).map(function (p) { return p[1]; });
681
683
  return function (stack, skipFirst) {
682
684
  var e_1, _a, e_2, _b;
683
685
  if (skipFirst === void 0) { skipFirst = 0; }
@@ -686,8 +688,8 @@ var Sentry = (function (exports) {
686
688
  for (var _c = __values(stack.split('\n').slice(skipFirst)), _d = _c.next(); !_d.done; _d = _c.next()) {
687
689
  var line = _d.value;
688
690
  try {
689
- for (var parsers_1 = (e_2 = void 0, __values(parsers)), parsers_1_1 = parsers_1.next(); !parsers_1_1.done; parsers_1_1 = parsers_1.next()) {
690
- var parser = parsers_1_1.value;
691
+ for (var sortedParsers_1 = (e_2 = void 0, __values(sortedParsers)), sortedParsers_1_1 = sortedParsers_1.next(); !sortedParsers_1_1.done; sortedParsers_1_1 = sortedParsers_1.next()) {
692
+ var parser = sortedParsers_1_1.value;
691
693
  var frame = parser(line);
692
694
  if (frame) {
693
695
  frames.push(frame);
@@ -698,7 +700,7 @@ var Sentry = (function (exports) {
698
700
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
699
701
  finally {
700
702
  try {
701
- if (parsers_1_1 && !parsers_1_1.done && (_b = parsers_1.return)) _b.call(parsers_1);
703
+ if (sortedParsers_1_1 && !sortedParsers_1_1.done && (_b = sortedParsers_1.return)) _b.call(sortedParsers_1);
702
704
  }
703
705
  finally { if (e_2) throw e_2.error; }
704
706
  }
@@ -990,19 +992,19 @@ var Sentry = (function (exports) {
990
992
  if (type === '[object Array]') {
991
993
  return '[Array]';
992
994
  }
993
- var normalized = normalizeValue(value);
994
- return isPrimitive(normalized) ? normalized : type;
995
+ // `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
996
+ // pass-through.
997
+ var serializable = makeSerializable(value);
998
+ return isPrimitive(serializable) ? serializable : type;
995
999
  }
996
1000
  /**
997
- * normalizeValue()
1001
+ * makeSerializable()
998
1002
  *
999
- * Takes unserializable input and make it serializable friendly
1003
+ * Takes unserializable input and make it serializer-friendly.
1000
1004
  *
1001
- * - translates undefined/NaN values to "[undefined]"/"[NaN]" respectively,
1002
- * - serializes Error objects
1003
- * - filter global objects
1005
+ * Handles globals, functions, `undefined`, `NaN`, and other non-serializable values.
1004
1006
  */
1005
- function normalizeValue(value, key) {
1007
+ function makeSerializable(value, key) {
1006
1008
  if (key === 'domain' && value && typeof value === 'object' && value._events) {
1007
1009
  return '[Domain]';
1008
1010
  }
@@ -1050,26 +1052,28 @@ var Sentry = (function (exports) {
1050
1052
  * @param key of object that's walked in current iteration
1051
1053
  * @param value object to be walked
1052
1054
  * @param depth Optional number indicating how deep should walking be performed
1055
+ * @param maxProperties Optional maximum number of properties/elements included in any single object/array
1053
1056
  * @param memo Optional Memo class handling decycling
1054
1057
  */
1055
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1056
- function walk(key, value, depth, memo) {
1058
+ function walk(key, value, depth, maxProperties, memo) {
1057
1059
  if (depth === void 0) { depth = +Infinity; }
1060
+ if (maxProperties === void 0) { maxProperties = +Infinity; }
1058
1061
  if (memo === void 0) { memo = memoBuilder(); }
1062
+ var _a = __read(memo, 2), memoize = _a[0], unmemoize = _a[1];
1059
1063
  // If we reach the maximum depth, serialize whatever is left
1060
1064
  if (depth === 0) {
1061
1065
  return serializeValue(value);
1062
1066
  }
1063
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
1064
1067
  // If value implements `toJSON` method, call it and return early
1065
1068
  if (value !== null && value !== undefined && typeof value.toJSON === 'function') {
1066
1069
  return value.toJSON();
1067
1070
  }
1068
- /* eslint-enable @typescript-eslint/no-unsafe-member-access */
1069
- // If normalized value is a primitive, there are no branches left to walk, so bail out
1070
- var normalized = normalizeValue(value, key);
1071
- if (isPrimitive(normalized)) {
1072
- return normalized;
1071
+ // `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
1072
+ // pass-through. If what comes back is a primitive (either because it's been stringified or because it was primitive
1073
+ // all along), we're done.
1074
+ var serializable = makeSerializable(value, key);
1075
+ if (isPrimitive(serializable)) {
1076
+ return serializable;
1073
1077
  }
1074
1078
  // Create source that we will use for the next iteration. It will either be an objectified error object (`Error` type
1075
1079
  // with extracted key:value pairs) or the input itself.
@@ -1077,39 +1081,55 @@ var Sentry = (function (exports) {
1077
1081
  // Create an accumulator that will act as a parent for all future itterations of that branch
1078
1082
  var acc = Array.isArray(value) ? [] : {};
1079
1083
  // If we already walked that branch, bail out, as it's circular reference
1080
- if (memo[0](value)) {
1084
+ if (memoize(value)) {
1081
1085
  return '[Circular ~]';
1082
1086
  }
1087
+ var propertyCount = 0;
1083
1088
  // Walk all keys of the source
1084
1089
  for (var innerKey in source) {
1085
1090
  // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.
1086
1091
  if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {
1087
1092
  continue;
1088
1093
  }
1094
+ if (propertyCount >= maxProperties) {
1095
+ acc[innerKey] = '[MaxProperties ~]';
1096
+ break;
1097
+ }
1098
+ propertyCount += 1;
1089
1099
  // Recursively walk through all the child nodes
1090
- acc[innerKey] = walk(innerKey, source[innerKey], depth - 1, memo);
1100
+ var innerValue = source[innerKey];
1101
+ acc[innerKey] = walk(innerKey, innerValue, depth - 1, maxProperties, memo);
1091
1102
  }
1092
1103
  // Once walked through all the branches, remove the parent from memo storage
1093
- memo[1](value);
1104
+ unmemoize(value);
1094
1105
  // Return accumulated values
1095
1106
  return acc;
1096
1107
  }
1097
1108
  /**
1098
- * normalize()
1109
+ * Recursively normalizes the given object.
1099
1110
  *
1100
1111
  * - Creates a copy to prevent original input mutation
1101
- * - Skip non-enumerablers
1102
- * - Calls `toJSON` if implemented
1112
+ * - Skips non-enumerable properties
1113
+ * - When stringifying, calls `toJSON` if implemented
1103
1114
  * - Removes circular references
1104
- * - Translates non-serializeable values (undefined/NaN/Functions) to serializable format
1105
- * - Translates known global objects/Classes to a string representations
1106
- * - Takes care of Error objects serialization
1107
- * - Optionally limit depth of final output
1115
+ * - Translates non-serializable values (`undefined`/`NaN`/functions) to serializable format
1116
+ * - Translates known global objects/classes to a string representations
1117
+ * - Takes care of `Error` object serialization
1118
+ * - Optionally limits depth of final output
1119
+ * - Optionally limits number of properties/elements included in any single object/array
1120
+ *
1121
+ * @param input The object to be normalized.
1122
+ * @param depth The max depth to which to normalize the object. (Anything deeper stringified whole.)
1123
+ * @param maxProperties The max number of elements or properties to be included in any single array or
1124
+ * object in the normallized output..
1125
+ * @returns A normalized version of the object, or `"**non-serializable**"` if any errors are thrown during normalization.
1108
1126
  */
1109
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1110
- function normalize(input, depth) {
1127
+ function normalize(input, depth, maxProperties) {
1128
+ if (depth === void 0) { depth = +Infinity; }
1129
+ if (maxProperties === void 0) { maxProperties = +Infinity; }
1111
1130
  try {
1112
- return JSON.parse(JSON.stringify(input, function (key, value) { return walk(key, value, depth); }));
1131
+ // since we're at the outermost level, there is no key
1132
+ return walk('', input, depth, maxProperties);
1113
1133
  }
1114
1134
  catch (_oO) {
1115
1135
  return '**non-serializable**';
@@ -1223,7 +1243,7 @@ var Sentry = (function (exports) {
1223
1243
  var result = false;
1224
1244
  var doc = global.document;
1225
1245
  // eslint-disable-next-line deprecation/deprecation
1226
- if (doc && typeof doc.createElement === "function") {
1246
+ if (doc && typeof doc.createElement === 'function') {
1227
1247
  try {
1228
1248
  var sandbox = doc.createElement('iframe');
1229
1249
  sandbox.hidden = true;
@@ -1235,9 +1255,7 @@ var Sentry = (function (exports) {
1235
1255
  doc.head.removeChild(sandbox);
1236
1256
  }
1237
1257
  catch (err) {
1238
- if (isDebugBuild()) {
1239
- logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);
1240
- }
1258
+ logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);
1241
1259
  }
1242
1260
  }
1243
1261
  return result;
@@ -1329,6 +1347,7 @@ var Sentry = (function (exports) {
1329
1347
  break;
1330
1348
  default:
1331
1349
  logger.warn('unknown instrumentation type:', type);
1350
+ return;
1332
1351
  }
1333
1352
  }
1334
1353
  /**
@@ -1354,9 +1373,7 @@ var Sentry = (function (exports) {
1354
1373
  handler(data);
1355
1374
  }
1356
1375
  catch (e) {
1357
- if (isDebugBuild()) {
1358
- logger.error("Error while triggering instrumentation handler.\nType: " + type + "\nName: " + getFunctionName(handler) + "\nError: " + e);
1359
- }
1376
+ logger.error("Error while triggering instrumentation handler.\nType: " + type + "\nName: " + getFunctionName(handler) + "\nError:", e);
1360
1377
  }
1361
1378
  }
1362
1379
  }
@@ -1373,7 +1390,7 @@ var Sentry = (function (exports) {
1373
1390
  if (!('console' in global$5)) {
1374
1391
  return;
1375
1392
  }
1376
- ['debug', 'info', 'warn', 'error', 'log', 'assert'].forEach(function (level) {
1393
+ CONSOLE_LEVELS.forEach(function (level) {
1377
1394
  if (!(level in global$5.console)) {
1378
1395
  return;
1379
1396
  }
@@ -1922,26 +1939,6 @@ var Sentry = (function (exports) {
1922
1939
  firstException.mechanism.data = mergedData;
1923
1940
  }
1924
1941
  }
1925
- var defaultRetryAfter = 60 * 1000; // 60 seconds
1926
- /**
1927
- * Extracts Retry-After value from the request header or returns default value
1928
- * @param now current unix timestamp
1929
- * @param header string representation of 'Retry-After' header
1930
- */
1931
- function parseRetryAfterHeader(now, header) {
1932
- if (!header) {
1933
- return defaultRetryAfter;
1934
- }
1935
- var headerDelay = parseInt("" + header, 10);
1936
- if (!isNaN(headerDelay)) {
1937
- return headerDelay * 1000;
1938
- }
1939
- var headerDate = Date.parse("" + header);
1940
- if (!isNaN(headerDate)) {
1941
- return headerDate - now;
1942
- }
1943
- return defaultRetryAfter;
1944
- }
1945
1942
  /**
1946
1943
  * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
1947
1944
  * in question), and marks it captured if not.
@@ -2399,7 +2396,9 @@ var Sentry = (function (exports) {
2399
2396
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2400
2397
  return items.reduce(function (acc, item) {
2401
2398
  var _a = __read(item, 2), itemHeaders = _a[0], payload = _a[1];
2402
- return acc + "\n" + JSON.stringify(itemHeaders) + "\n" + JSON.stringify(payload);
2399
+ // We do not serialize payloads that are primitives
2400
+ var serializedPayload = isPrimitive(payload) ? String(payload) : JSON.stringify(payload);
2401
+ return acc + "\n" + JSON.stringify(itemHeaders) + "\n" + serializedPayload;
2403
2402
  }, serializedHeaders);
2404
2403
  }
2405
2404
 
@@ -2419,6 +2418,103 @@ var Sentry = (function (exports) {
2419
2418
  return createEnvelope(dsn ? { dsn: dsn } : {}, [clientReportItem]);
2420
2419
  }
2421
2420
 
2421
+ var DEFAULT_RETRY_AFTER = 60 * 1000; // 60 seconds
2422
+ /**
2423
+ * Extracts Retry-After value from the request header or returns default value
2424
+ * @param header string representation of 'Retry-After' header
2425
+ * @param now current unix timestamp
2426
+ *
2427
+ */
2428
+ function parseRetryAfterHeader(header, now) {
2429
+ if (now === void 0) { now = Date.now(); }
2430
+ var headerDelay = parseInt("" + header, 10);
2431
+ if (!isNaN(headerDelay)) {
2432
+ return headerDelay * 1000;
2433
+ }
2434
+ var headerDate = Date.parse("" + header);
2435
+ if (!isNaN(headerDate)) {
2436
+ return headerDate - now;
2437
+ }
2438
+ return DEFAULT_RETRY_AFTER;
2439
+ }
2440
+ /**
2441
+ * Gets the time that given category is disabled until for rate limiting
2442
+ */
2443
+ function disabledUntil(limits, category) {
2444
+ return limits[category] || limits.all || 0;
2445
+ }
2446
+ /**
2447
+ * Checks if a category is rate limited
2448
+ */
2449
+ function isRateLimited(limits, category, now) {
2450
+ if (now === void 0) { now = Date.now(); }
2451
+ return disabledUntil(limits, category) > now;
2452
+ }
2453
+ /**
2454
+ * Update ratelimits from incoming headers.
2455
+ * Returns true if headers contains a non-empty rate limiting header.
2456
+ */
2457
+ function updateRateLimits(limits, headers, now) {
2458
+ var e_1, _a, e_2, _b;
2459
+ if (now === void 0) { now = Date.now(); }
2460
+ var updatedRateLimits = __assign({}, limits);
2461
+ // "The name is case-insensitive."
2462
+ // https://developer.mozilla.org/en-US/docs/Web/API/Headers/get
2463
+ var rateLimitHeader = headers['x-sentry-rate-limits'];
2464
+ var retryAfterHeader = headers['retry-after'];
2465
+ if (rateLimitHeader) {
2466
+ try {
2467
+ /**
2468
+ * rate limit headers are of the form
2469
+ * <header>,<header>,..
2470
+ * where each <header> is of the form
2471
+ * <retry_after>: <categories>: <scope>: <reason_code>
2472
+ * where
2473
+ * <retry_after> is a delay in seconds
2474
+ * <categories> is the event type(s) (error, transaction, etc) being rate limited and is of the form
2475
+ * <category>;<category>;...
2476
+ * <scope> is what's being limited (org, project, or key) - ignored by SDK
2477
+ * <reason_code> is an arbitrary string like "org_quota" - ignored by SDK
2478
+ */
2479
+ for (var _c = __values(rateLimitHeader.trim().split(',')), _d = _c.next(); !_d.done; _d = _c.next()) {
2480
+ var limit = _d.value;
2481
+ var parameters = limit.split(':', 2);
2482
+ var headerDelay = parseInt(parameters[0], 10);
2483
+ var delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default
2484
+ if (!parameters[1]) {
2485
+ updatedRateLimits.all = now + delay;
2486
+ }
2487
+ else {
2488
+ try {
2489
+ for (var _e = (e_2 = void 0, __values(parameters[1].split(';'))), _f = _e.next(); !_f.done; _f = _e.next()) {
2490
+ var category = _f.value;
2491
+ updatedRateLimits[category] = now + delay;
2492
+ }
2493
+ }
2494
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2495
+ finally {
2496
+ try {
2497
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
2498
+ }
2499
+ finally { if (e_2) throw e_2.error; }
2500
+ }
2501
+ }
2502
+ }
2503
+ }
2504
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2505
+ finally {
2506
+ try {
2507
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
2508
+ }
2509
+ finally { if (e_1) throw e_1.error; }
2510
+ }
2511
+ }
2512
+ else if (retryAfterHeader) {
2513
+ updatedRateLimits.all = now + parseRetryAfterHeader(retryAfterHeader, now);
2514
+ }
2515
+ return updatedRateLimits;
2516
+ }
2517
+
2422
2518
  /**
2423
2519
  * Absolute maximum number of breadcrumbs added to an event.
2424
2520
  * The `maxBreadcrumbs` option cannot be higher than this value.
@@ -3476,13 +3572,7 @@ var Sentry = (function (exports) {
3476
3572
  */
3477
3573
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
3478
3574
  function captureException(exception, captureContext) {
3479
- var syntheticException;
3480
- try {
3481
- throw new Error('Sentry syntheticException');
3482
- }
3483
- catch (exception) {
3484
- syntheticException = exception;
3485
- }
3575
+ var syntheticException = new Error('Sentry syntheticException');
3486
3576
  return callOnHub('captureException', exception, {
3487
3577
  captureContext: captureContext,
3488
3578
  originalException: exception,
@@ -3497,13 +3587,7 @@ var Sentry = (function (exports) {
3497
3587
  * @returns The generated eventId.
3498
3588
  */
3499
3589
  function captureMessage(message, captureContext) {
3500
- var syntheticException;
3501
- try {
3502
- throw new Error(message);
3503
- }
3504
- catch (exception) {
3505
- syntheticException = exception;
3506
- }
3590
+ var syntheticException = new Error(message);
3507
3591
  // This is necessary to provide explicit scopes upgrade, without changing the original
3508
3592
  // arity of the `captureMessage(message, level)` method.
3509
3593
  var level = typeof captureContext === 'string' ? captureContext : undefined;
@@ -3874,15 +3958,11 @@ var Sentry = (function (exports) {
3874
3958
  */
3875
3959
  BaseClient.prototype.captureSession = function (session) {
3876
3960
  if (!this._isEnabled()) {
3877
- if (isDebugBuild()) {
3878
- logger.warn('SDK not enabled, will not capture session.');
3879
- }
3961
+ logger.warn('SDK not enabled, will not capture session.');
3880
3962
  return;
3881
3963
  }
3882
3964
  if (!(typeof session.release === 'string')) {
3883
- if (isDebugBuild()) {
3884
- logger.warn('Discarded session because of missing or non-string release');
3885
- }
3965
+ logger.warn('Discarded session because of missing or non-string release');
3886
3966
  }
3887
3967
  else {
3888
3968
  this._sendSession(session);
@@ -4043,7 +4123,7 @@ var Sentry = (function (exports) {
4043
4123
  */
4044
4124
  BaseClient.prototype._prepareEvent = function (event, scope, hint) {
4045
4125
  var _this = this;
4046
- var _a = this.getOptions().normalizeDepth, normalizeDepth = _a === void 0 ? 3 : _a;
4126
+ var _a = this.getOptions(), _b = _a.normalizeDepth, normalizeDepth = _b === void 0 ? 3 : _b, _c = _a.normalizeMaxBreadth, normalizeMaxBreadth = _c === void 0 ? 1000 : _c;
4047
4127
  var prepared = __assign(__assign({}, event), { event_id: event.event_id || (hint && hint.event_id ? hint.event_id : uuid4()), timestamp: event.timestamp || dateTimestampInSeconds() });
4048
4128
  this._applyClientOptions(prepared);
4049
4129
  this._applyIntegrationsMetadata(prepared);
@@ -4068,7 +4148,7 @@ var Sentry = (function (exports) {
4068
4148
  evt.sdkProcessingMetadata = __assign(__assign({}, evt.sdkProcessingMetadata), { normalizeDepth: normalize(normalizeDepth) });
4069
4149
  }
4070
4150
  if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
4071
- return _this._normalizeEvent(evt, normalizeDepth);
4151
+ return _this._normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
4072
4152
  }
4073
4153
  return evt;
4074
4154
  });
@@ -4083,20 +4163,20 @@ var Sentry = (function (exports) {
4083
4163
  * @param event Event
4084
4164
  * @returns Normalized event
4085
4165
  */
4086
- BaseClient.prototype._normalizeEvent = function (event, depth) {
4166
+ BaseClient.prototype._normalizeEvent = function (event, depth, maxBreadth) {
4087
4167
  if (!event) {
4088
4168
  return null;
4089
4169
  }
4090
4170
  var normalized = __assign(__assign(__assign(__assign(__assign({}, event), (event.breadcrumbs && {
4091
4171
  breadcrumbs: event.breadcrumbs.map(function (b) { return (__assign(__assign({}, b), (b.data && {
4092
- data: normalize(b.data, depth),
4172
+ data: normalize(b.data, depth, maxBreadth),
4093
4173
  }))); }),
4094
4174
  })), (event.user && {
4095
- user: normalize(event.user, depth),
4175
+ user: normalize(event.user, depth, maxBreadth),
4096
4176
  })), (event.contexts && {
4097
- contexts: normalize(event.contexts, depth),
4177
+ contexts: normalize(event.contexts, depth, maxBreadth),
4098
4178
  })), (event.extra && {
4099
- extra: normalize(event.extra, depth),
4179
+ extra: normalize(event.extra, depth, maxBreadth),
4100
4180
  }));
4101
4181
  // event.contexts.trace stores information about a Transaction. Similarly,
4102
4182
  // event.spans[] stores information about child Spans. Given that a
@@ -4292,7 +4372,7 @@ var Sentry = (function (exports) {
4292
4372
  */
4293
4373
  NoopTransport.prototype.sendEvent = function (_) {
4294
4374
  return resolvedSyncPromise({
4295
- reason: "NoopTransport: Event has been skipped because no Dsn is configured.",
4375
+ reason: 'NoopTransport: Event has been skipped because no Dsn is configured.',
4296
4376
  status: 'skipped',
4297
4377
  });
4298
4378
  };
@@ -4336,9 +4416,7 @@ var Sentry = (function (exports) {
4336
4416
  */
4337
4417
  BaseBackend.prototype.sendEvent = function (event) {
4338
4418
  void this._transport.sendEvent(event).then(null, function (reason) {
4339
- if (isDebugBuild()) {
4340
- logger.error("Error while sending event: " + reason);
4341
- }
4419
+ logger.error('Error while sending event:', reason);
4342
4420
  });
4343
4421
  };
4344
4422
  /**
@@ -4346,15 +4424,11 @@ var Sentry = (function (exports) {
4346
4424
  */
4347
4425
  BaseBackend.prototype.sendSession = function (session) {
4348
4426
  if (!this._transport.sendSession) {
4349
- if (isDebugBuild()) {
4350
- logger.warn("Dropping session because custom transport doesn't implement sendSession");
4351
- }
4427
+ logger.warn("Dropping session because custom transport doesn't implement sendSession");
4352
4428
  return;
4353
4429
  }
4354
4430
  void this._transport.sendSession(session).then(null, function (reason) {
4355
- if (isDebugBuild()) {
4356
- logger.error("Error while sending session: " + reason);
4357
- }
4431
+ logger.error('Error while sending session:', reason);
4358
4432
  });
4359
4433
  };
4360
4434
  /**
@@ -4398,14 +4472,14 @@ var Sentry = (function (exports) {
4398
4472
  /** Creates a SentryRequest from a Session. */
4399
4473
  function sessionToSentryRequest(session, api) {
4400
4474
  var sdkInfo = getSdkMetadataForEnvelopeHeader(api);
4401
- var envelopeHeaders = JSON.stringify(__assign(__assign({ sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) })));
4402
- // I know this is hacky but we don't want to add `session` to request type since it's never rate limited
4475
+ var envelopeHeaders = __assign(__assign({ sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
4476
+ // I know this is hacky but we don't want to add `sessions` to request type since it's never rate limited
4403
4477
  var type = 'aggregates' in session ? 'sessions' : 'session';
4404
- var itemHeaders = JSON.stringify({
4405
- type: type,
4406
- });
4478
+ // TODO (v7) Have to cast type because envelope items do not accept a `SentryRequestType`
4479
+ var envelopeItem = [{ type: type }, session];
4480
+ var envelope = createEnvelope(envelopeHeaders, [envelopeItem]);
4407
4481
  return {
4408
- body: envelopeHeaders + "\n" + itemHeaders + "\n" + JSON.stringify(session),
4482
+ body: serializeEnvelope(envelope),
4409
4483
  type: type,
4410
4484
  url: getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel),
4411
4485
  };
@@ -4483,19 +4557,16 @@ var Sentry = (function (exports) {
4483
4557
  // deserialization. Instead, we only implement a minimal subset of the spec to
4484
4558
  // serialize events inline here.
4485
4559
  if (useEnvelope) {
4486
- var envelopeHeaders = JSON.stringify(__assign(__assign({ event_id: event.event_id, sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) })));
4487
- var itemHeaders = JSON.stringify({
4488
- type: eventType,
4489
- // TODO: Right now, sampleRate may or may not be defined (it won't be in the cases of inheritance and
4490
- // explicitly-set sampling decisions). Are we good with that?
4491
- sample_rates: [{ id: samplingMethod, rate: sampleRate }],
4492
- });
4493
- // The trailing newline is optional. We intentionally don't send it to avoid
4494
- // sending unnecessary bytes.
4495
- //
4496
- // const envelope = `${envelopeHeaders}\n${itemHeaders}\n${req.body}\n`;
4497
- var envelope = envelopeHeaders + "\n" + itemHeaders + "\n" + req.body;
4498
- req.body = envelope;
4560
+ var envelopeHeaders = __assign(__assign({ event_id: event.event_id, sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
4561
+ var eventItem = [
4562
+ {
4563
+ type: eventType,
4564
+ sample_rates: [{ id: samplingMethod, rate: sampleRate }],
4565
+ },
4566
+ req.body,
4567
+ ];
4568
+ var envelope = createEnvelope(envelopeHeaders, [eventItem]);
4569
+ req.body = serializeEnvelope(envelope);
4499
4570
  }
4500
4571
  return req;
4501
4572
  }
@@ -4509,7 +4580,9 @@ var Sentry = (function (exports) {
4509
4580
  */
4510
4581
  function initAndBind(clientClass, options) {
4511
4582
  if (options.debug === true) {
4512
- logger.enable();
4583
+ {
4584
+ logger.enable();
4585
+ }
4513
4586
  }
4514
4587
  var hub = getCurrentHub();
4515
4588
  var scope = hub.getScope();
@@ -4520,7 +4593,7 @@ var Sentry = (function (exports) {
4520
4593
  hub.bindClient(client);
4521
4594
  }
4522
4595
 
4523
- var SDK_VERSION = '6.18.1-beta.0';
4596
+ var SDK_VERSION = '6.19.0';
4524
4597
 
4525
4598
  var originalFunctionToString;
4526
4599
  /** Patch toString calls to return proper name for wrapped functions */
@@ -4597,27 +4670,19 @@ var Sentry = (function (exports) {
4597
4670
  /** JSDoc */
4598
4671
  InboundFilters.prototype._shouldDropEvent = function (event, options) {
4599
4672
  if (this._isSentryError(event, options)) {
4600
- if (isDebugBuild()) {
4601
- logger.warn("Event dropped due to being internal Sentry Error.\nEvent: " + getEventDescription(event));
4602
- }
4673
+ logger.warn("Event dropped due to being internal Sentry Error.\nEvent: " + getEventDescription(event));
4603
4674
  return true;
4604
4675
  }
4605
4676
  if (this._isIgnoredError(event, options)) {
4606
- if (isDebugBuild()) {
4607
- logger.warn("Event dropped due to being matched by `ignoreErrors` option.\nEvent: " + getEventDescription(event));
4608
- }
4677
+ logger.warn("Event dropped due to being matched by `ignoreErrors` option.\nEvent: " + getEventDescription(event));
4609
4678
  return true;
4610
4679
  }
4611
4680
  if (this._isDeniedUrl(event, options)) {
4612
- if (isDebugBuild()) {
4613
- logger.warn("Event dropped due to being matched by `denyUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + this._getEventFilterUrl(event));
4614
- }
4681
+ logger.warn("Event dropped due to being matched by `denyUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + this._getEventFilterUrl(event));
4615
4682
  return true;
4616
4683
  }
4617
4684
  if (!this._isAllowedUrl(event, options)) {
4618
- if (isDebugBuild()) {
4619
- logger.warn("Event dropped due to not being matched by `allowUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + this._getEventFilterUrl(event));
4620
- }
4685
+ logger.warn("Event dropped due to not being matched by `allowUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + this._getEventFilterUrl(event));
4621
4686
  return true;
4622
4687
  }
4623
4688
  return false;
@@ -4686,9 +4751,7 @@ var Sentry = (function (exports) {
4686
4751
  return ["" + value, type + ": " + value];
4687
4752
  }
4688
4753
  catch (oO) {
4689
- if (isDebugBuild()) {
4690
- logger.error("Cannot extract message for event " + getEventDescription(event));
4691
- }
4754
+ logger.error("Cannot extract message for event " + getEventDescription(event));
4692
4755
  return [];
4693
4756
  }
4694
4757
  }
@@ -4722,9 +4785,7 @@ var Sentry = (function (exports) {
4722
4785
  return frames_1 ? this._getLastValidUrl(frames_1) : null;
4723
4786
  }
4724
4787
  catch (oO) {
4725
- if (isDebugBuild()) {
4726
- logger.error("Cannot extract url for event " + getEventDescription(event));
4727
- }
4788
+ logger.error("Cannot extract url for event " + getEventDescription(event));
4728
4789
  return null;
4729
4790
  }
4730
4791
  };
@@ -4743,6 +4804,11 @@ var Sentry = (function (exports) {
4743
4804
 
4744
4805
  // global reference to slice
4745
4806
  var UNKNOWN_FUNCTION = '?';
4807
+ var OPERA10_PRIORITY = 10;
4808
+ var OPERA11_PRIORITY = 20;
4809
+ var CHROME_PRIORITY = 30;
4810
+ var WINJS_PRIORITY = 40;
4811
+ var GECKO_PRIORITY = 50;
4746
4812
  function createFrame(filename, func, lineno, colno) {
4747
4813
  var frame = {
4748
4814
  filename: filename,
@@ -4781,6 +4847,7 @@ var Sentry = (function (exports) {
4781
4847
  }
4782
4848
  return;
4783
4849
  };
4850
+ var chromeStackParser = [CHROME_PRIORITY, chrome];
4784
4851
  // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
4785
4852
  // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
4786
4853
  // We need this specific case for now because we want no other regex to match.
@@ -4795,7 +4862,7 @@ var Sentry = (function (exports) {
4795
4862
  var subMatch = geckoEvalRegex.exec(parts[3]);
4796
4863
  if (subMatch) {
4797
4864
  // throw out eval line/column and use top-most line number
4798
- parts[1] = parts[1] || "eval";
4865
+ parts[1] = parts[1] || 'eval';
4799
4866
  parts[3] = subMatch[1];
4800
4867
  parts[4] = subMatch[2];
4801
4868
  parts[5] = ''; // no column when eval
@@ -4808,6 +4875,7 @@ var Sentry = (function (exports) {
4808
4875
  }
4809
4876
  return;
4810
4877
  };
4878
+ var geckoStackParser = [GECKO_PRIORITY, gecko];
4811
4879
  var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
4812
4880
  var winjs = function (line) {
4813
4881
  var parts = winjsRegex.exec(line);
@@ -4815,16 +4883,19 @@ var Sentry = (function (exports) {
4815
4883
  ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)
4816
4884
  : undefined;
4817
4885
  };
4886
+ var winjsStackParser = [WINJS_PRIORITY, winjs];
4818
4887
  var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
4819
4888
  var opera10 = function (line) {
4820
4889
  var parts = opera10Regex.exec(line);
4821
4890
  return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;
4822
4891
  };
4892
+ var opera10StackParser = [OPERA10_PRIORITY, opera10];
4823
4893
  var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i;
4824
4894
  var opera11 = function (line) {
4825
4895
  var parts = opera11Regex.exec(line);
4826
4896
  return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;
4827
4897
  };
4898
+ var opera11StackParser = [OPERA11_PRIORITY, opera11];
4828
4899
  /**
4829
4900
  * Safari web extensions, starting version unknown, can produce "frames-only" stacktraces.
4830
4901
  * What it means, is that instead of format like:
@@ -4868,7 +4939,7 @@ var Sentry = (function (exports) {
4868
4939
  type: ex && ex.name,
4869
4940
  value: extractMessage(ex),
4870
4941
  };
4871
- if (frames && frames.length) {
4942
+ if (frames.length) {
4872
4943
  exception.stacktrace = { frames: frames };
4873
4944
  }
4874
4945
  if (exception.type === undefined && exception.value === '') {
@@ -4879,13 +4950,13 @@ var Sentry = (function (exports) {
4879
4950
  /**
4880
4951
  * @hidden
4881
4952
  */
4882
- function eventFromPlainObject(exception, syntheticException, rejection) {
4953
+ function eventFromPlainObject(exception, syntheticException, isUnhandledRejection) {
4883
4954
  var event = {
4884
4955
  exception: {
4885
4956
  values: [
4886
4957
  {
4887
- type: isEvent(exception) ? exception.constructor.name : rejection ? 'UnhandledRejection' : 'Error',
4888
- value: "Non-Error " + (rejection ? 'promise rejection' : 'exception') + " captured with keys: " + extractExceptionKeysForMessage(exception),
4958
+ type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',
4959
+ value: "Non-Error " + (isUnhandledRejection ? 'promise rejection' : 'exception') + " captured with keys: " + extractExceptionKeysForMessage(exception),
4889
4960
  },
4890
4961
  ],
4891
4962
  },
@@ -4919,8 +4990,7 @@ var Sentry = (function (exports) {
4919
4990
  var stacktrace = ex.stacktrace || ex.stack || '';
4920
4991
  var popSize = getPopSize(ex);
4921
4992
  try {
4922
- // The order of the parsers in important
4923
- return createStackParser(opera10, opera11, chrome, winjs, gecko)(stacktrace, popSize);
4993
+ return createStackParser(opera10StackParser, opera11StackParser, chromeStackParser, winjsStackParser, geckoStackParser)(stacktrace, popSize);
4924
4994
  }
4925
4995
  catch (e) {
4926
4996
  // no-empty
@@ -4945,7 +5015,6 @@ var Sentry = (function (exports) {
4945
5015
  * https://github.com/getsentry/sentry-javascript/issues/1949
4946
5016
  * In this specific case we try to extract stacktrace.message.error.message
4947
5017
  */
4948
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4949
5018
  function extractMessage(ex) {
4950
5019
  var message = ex && ex.message;
4951
5020
  if (!message) {
@@ -4955,17 +5024,14 @@ var Sentry = (function (exports) {
4955
5024
  return message.error.message;
4956
5025
  }
4957
5026
  return message;
4958
- }
4959
-
5027
+ }
4960
5028
  /**
4961
5029
  * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
4962
5030
  * @hidden
4963
5031
  */
4964
- function eventFromException(options, exception, hint) {
5032
+ function eventFromException(exception, hint, attachStacktrace) {
4965
5033
  var syntheticException = (hint && hint.syntheticException) || undefined;
4966
- var event = eventFromUnknownInput(exception, syntheticException, {
4967
- attachStacktrace: options.attachStacktrace,
4968
- });
5034
+ var event = eventFromUnknownInput(exception, syntheticException, attachStacktrace);
4969
5035
  addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }
4970
5036
  event.level = exports.Severity.Error;
4971
5037
  if (hint && hint.event_id) {
@@ -4977,12 +5043,10 @@ var Sentry = (function (exports) {
4977
5043
  * Builds and Event from a Message
4978
5044
  * @hidden
4979
5045
  */
4980
- function eventFromMessage(options, message, level, hint) {
5046
+ function eventFromMessage(message, level, hint, attachStacktrace) {
4981
5047
  if (level === void 0) { level = exports.Severity.Info; }
4982
5048
  var syntheticException = (hint && hint.syntheticException) || undefined;
4983
- var event = eventFromString(message, syntheticException, {
4984
- attachStacktrace: options.attachStacktrace,
4985
- });
5049
+ var event = eventFromString(message, syntheticException, attachStacktrace);
4986
5050
  event.level = level;
4987
5051
  if (hint && hint.event_id) {
4988
5052
  event.event_id = hint.event_id;
@@ -4992,8 +5056,7 @@ var Sentry = (function (exports) {
4992
5056
  /**
4993
5057
  * @hidden
4994
5058
  */
4995
- function eventFromUnknownInput(exception, syntheticException, options) {
4996
- if (options === void 0) { options = {}; }
5059
+ function eventFromUnknownInput(exception, syntheticException, attachStacktrace, isUnhandledRejection) {
4997
5060
  var event;
4998
5061
  if (isErrorEvent(exception) && exception.error) {
4999
5062
  // If it is an ErrorEvent with `error` property, extract it to get actual Error
@@ -5015,7 +5078,7 @@ var Sentry = (function (exports) {
5015
5078
  else {
5016
5079
  var name_1 = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');
5017
5080
  var message = domException.message ? name_1 + ": " + domException.message : name_1;
5018
- event = eventFromString(message, syntheticException, options);
5081
+ event = eventFromString(message, syntheticException, attachStacktrace);
5019
5082
  addExceptionTypeValue(event, message);
5020
5083
  }
5021
5084
  if ('code' in domException) {
@@ -5032,7 +5095,7 @@ var Sentry = (function (exports) {
5032
5095
  // it manually. This will allow us to group events based on top-level keys which is much better than creating a new
5033
5096
  // group on any key/value change.
5034
5097
  var objectException = exception;
5035
- event = eventFromPlainObject(objectException, syntheticException, options.isRejection);
5098
+ event = eventFromPlainObject(objectException, syntheticException, isUnhandledRejection);
5036
5099
  addExceptionMechanism(event, {
5037
5100
  synthetic: true,
5038
5101
  });
@@ -5047,7 +5110,7 @@ var Sentry = (function (exports) {
5047
5110
  // - a plain Object
5048
5111
  //
5049
5112
  // So bail out and capture it as a simple message:
5050
- event = eventFromString(exception, syntheticException, options);
5113
+ event = eventFromString(exception, syntheticException, attachStacktrace);
5051
5114
  addExceptionTypeValue(event, "" + exception, undefined);
5052
5115
  addExceptionMechanism(event, {
5053
5116
  synthetic: true,
@@ -5057,15 +5120,14 @@ var Sentry = (function (exports) {
5057
5120
  /**
5058
5121
  * @hidden
5059
5122
  */
5060
- function eventFromString(input, syntheticException, options) {
5061
- if (options === void 0) { options = {}; }
5123
+ function eventFromString(input, syntheticException, attachStacktrace) {
5062
5124
  var event = {
5063
5125
  message: input,
5064
5126
  };
5065
- if (options.attachStacktrace && syntheticException) {
5066
- var frames_1 = parseStackFrames(syntheticException);
5067
- if (frames_1.length) {
5068
- event.stacktrace = { frames: frames_1 };
5127
+ if (attachStacktrace && syntheticException) {
5128
+ var frames_2 = parseStackFrames(syntheticException);
5129
+ if (frames_2.length) {
5130
+ event.stacktrace = { frames: frames_2 };
5069
5131
  }
5070
5132
  }
5071
5133
  return event;
@@ -5123,7 +5185,7 @@ var Sentry = (function (exports) {
5123
5185
  var document = global$4.document;
5124
5186
  var fetchImpl = global$4.fetch;
5125
5187
  // eslint-disable-next-line deprecation/deprecation
5126
- if (document && typeof document.createElement === "function") {
5188
+ if (document && typeof document.createElement === 'function') {
5127
5189
  try {
5128
5190
  var sandbox = document.createElement('iframe');
5129
5191
  sandbox.hidden = true;
@@ -5135,9 +5197,7 @@ var Sentry = (function (exports) {
5135
5197
  document.head.removeChild(sandbox);
5136
5198
  }
5137
5199
  catch (e) {
5138
- if (isDebugBuild()) {
5139
- logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);
5140
- }
5200
+ logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);
5141
5201
  }
5142
5202
  }
5143
5203
  return (cachedFetchImpl = fetchImpl.bind(global$4));
@@ -5268,13 +5328,11 @@ var Sentry = (function (exports) {
5268
5328
  BaseTransport.prototype._handleResponse = function (_a) {
5269
5329
  var requestType = _a.requestType, response = _a.response, headers = _a.headers, resolve = _a.resolve, reject = _a.reject;
5270
5330
  var status = eventStatusFromHttpCode(response.status);
5271
- /**
5272
- * "The name is case-insensitive."
5273
- * https://developer.mozilla.org/en-US/docs/Web/API/Headers/get
5274
- */
5275
- var limited = this._handleRateLimit(headers);
5276
- if (limited && isDebugBuild()) {
5277
- logger.warn("Too many " + requestType + " requests, backing off until: " + this._disabledUntil(requestType));
5331
+ this._rateLimits = updateRateLimits(this._rateLimits, headers);
5332
+ // eslint-disable-next-line deprecation/deprecation
5333
+ if (this._isRateLimited(requestType) && isDebugBuild()) {
5334
+ // eslint-disable-next-line deprecation/deprecation
5335
+ logger.warn("Too many " + requestType + " requests, backing off until: " + this._disabledUntil(requestType));
5278
5336
  }
5279
5337
  if (status === 'success') {
5280
5338
  resolve({ status: status });
@@ -5284,71 +5342,21 @@ var Sentry = (function (exports) {
5284
5342
  };
5285
5343
  /**
5286
5344
  * Gets the time that given category is disabled until for rate limiting
5345
+ *
5346
+ * @deprecated Please use `disabledUntil` from @sentry/utils
5287
5347
  */
5288
5348
  BaseTransport.prototype._disabledUntil = function (requestType) {
5289
5349
  var category = requestTypeToCategory(requestType);
5290
- return this._rateLimits[category] || this._rateLimits.all;
5350
+ return new Date(disabledUntil(this._rateLimits, category));
5291
5351
  };
5292
5352
  /**
5293
5353
  * Checks if a category is rate limited
5354
+ *
5355
+ * @deprecated Please use `isRateLimited` from @sentry/utils
5294
5356
  */
5295
5357
  BaseTransport.prototype._isRateLimited = function (requestType) {
5296
- return this._disabledUntil(requestType) > new Date(Date.now());
5297
- };
5298
- /**
5299
- * Sets internal _rateLimits from incoming headers. Returns true if headers contains a non-empty rate limiting header.
5300
- */
5301
- BaseTransport.prototype._handleRateLimit = function (headers) {
5302
- var e_1, _a, e_2, _b;
5303
- var now = Date.now();
5304
- var rlHeader = headers['x-sentry-rate-limits'];
5305
- var raHeader = headers['retry-after'];
5306
- if (rlHeader) {
5307
- try {
5308
- // rate limit headers are of the form
5309
- // <header>,<header>,..
5310
- // where each <header> is of the form
5311
- // <retry_after>: <categories>: <scope>: <reason_code>
5312
- // where
5313
- // <retry_after> is a delay in ms
5314
- // <categories> is the event type(s) (error, transaction, etc) being rate limited and is of the form
5315
- // <category>;<category>;...
5316
- // <scope> is what's being limited (org, project, or key) - ignored by SDK
5317
- // <reason_code> is an arbitrary string like "org_quota" - ignored by SDK
5318
- for (var _c = __values(rlHeader.trim().split(',')), _d = _c.next(); !_d.done; _d = _c.next()) {
5319
- var limit = _d.value;
5320
- var parameters = limit.split(':', 2);
5321
- var headerDelay = parseInt(parameters[0], 10);
5322
- var delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default
5323
- try {
5324
- for (var _e = (e_2 = void 0, __values(parameters[1].split(';'))), _f = _e.next(); !_f.done; _f = _e.next()) {
5325
- var category = _f.value;
5326
- this._rateLimits[category || 'all'] = new Date(now + delay);
5327
- }
5328
- }
5329
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
5330
- finally {
5331
- try {
5332
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
5333
- }
5334
- finally { if (e_2) throw e_2.error; }
5335
- }
5336
- }
5337
- }
5338
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
5339
- finally {
5340
- try {
5341
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
5342
- }
5343
- finally { if (e_1) throw e_1.error; }
5344
- }
5345
- return true;
5346
- }
5347
- else if (raHeader) {
5348
- this._rateLimits.all = new Date(now + parseRetryAfterHeader(now, raHeader));
5349
- return true;
5350
- }
5351
- return false;
5358
+ var category = requestTypeToCategory(requestType);
5359
+ return isRateLimited(this._rateLimits, category);
5352
5360
  };
5353
5361
  return BaseTransport;
5354
5362
  }());
@@ -5368,11 +5376,13 @@ var Sentry = (function (exports) {
5368
5376
  */
5369
5377
  FetchTransport.prototype._sendRequest = function (sentryRequest, originalPayload) {
5370
5378
  var _this = this;
5379
+ // eslint-disable-next-line deprecation/deprecation
5371
5380
  if (this._isRateLimited(sentryRequest.type)) {
5372
5381
  this.recordLostEvent('ratelimit_backoff', sentryRequest.type);
5373
5382
  return Promise.reject({
5374
5383
  event: originalPayload,
5375
5384
  type: sentryRequest.type,
5385
+ // eslint-disable-next-line deprecation/deprecation
5376
5386
  reason: "Transport for " + sentryRequest.type + " requests locked till " + this._disabledUntil(sentryRequest.type) + " due to too many requests.",
5377
5387
  status: 429,
5378
5388
  });
@@ -5438,11 +5448,13 @@ var Sentry = (function (exports) {
5438
5448
  */
5439
5449
  XHRTransport.prototype._sendRequest = function (sentryRequest, originalPayload) {
5440
5450
  var _this = this;
5451
+ // eslint-disable-next-line deprecation/deprecation
5441
5452
  if (this._isRateLimited(sentryRequest.type)) {
5442
5453
  this.recordLostEvent('ratelimit_backoff', sentryRequest.type);
5443
5454
  return Promise.reject({
5444
5455
  event: originalPayload,
5445
5456
  type: sentryRequest.type,
5457
+ // eslint-disable-next-line deprecation/deprecation
5446
5458
  reason: "Transport for " + sentryRequest.type + " requests locked till " + this._disabledUntil(sentryRequest.type) + " due to too many requests.",
5447
5459
  status: 429,
5448
5460
  });
@@ -5503,14 +5515,14 @@ var Sentry = (function (exports) {
5503
5515
  * @inheritDoc
5504
5516
  */
5505
5517
  BrowserBackend.prototype.eventFromException = function (exception, hint) {
5506
- return eventFromException(this._options, exception, hint);
5518
+ return eventFromException(exception, hint, this._options.attachStacktrace);
5507
5519
  };
5508
5520
  /**
5509
5521
  * @inheritDoc
5510
5522
  */
5511
5523
  BrowserBackend.prototype.eventFromMessage = function (message, level, hint) {
5512
5524
  if (level === void 0) { level = exports.Severity.Info; }
5513
- return eventFromMessage(this._options, message, level, hint);
5525
+ return eventFromMessage(message, level, hint, this._options.attachStacktrace);
5514
5526
  };
5515
5527
  /**
5516
5528
  * @inheritDoc
@@ -5659,15 +5671,11 @@ var Sentry = (function (exports) {
5659
5671
  return;
5660
5672
  }
5661
5673
  if (!options.eventId) {
5662
- if (isDebugBuild()) {
5663
- logger.error("Missing eventId option in showReportDialog call");
5664
- }
5674
+ logger.error('Missing eventId option in showReportDialog call');
5665
5675
  return;
5666
5676
  }
5667
5677
  if (!options.dsn) {
5668
- if (isDebugBuild()) {
5669
- logger.error("Missing dsn option in showReportDialog call");
5670
- }
5678
+ logger.error('Missing dsn option in showReportDialog call');
5671
5679
  return;
5672
5680
  }
5673
5681
  var script = global$2.document.createElement('script');
@@ -5740,10 +5748,7 @@ var Sentry = (function (exports) {
5740
5748
  }
5741
5749
  var event = error === undefined && isString(msg)
5742
5750
  ? _eventFromIncompleteOnError(msg, url, line, column)
5743
- : _enhanceEventWithInitialFrame(eventFromUnknownInput(error || msg, undefined, {
5744
- attachStacktrace: attachStacktrace,
5745
- isRejection: false,
5746
- }), url, line, column);
5751
+ : _enhanceEventWithInitialFrame(eventFromUnknownInput(error || msg, undefined, attachStacktrace, false), url, line, column);
5747
5752
  event.level = exports.Severity.Error;
5748
5753
  addMechanismAndCapture(hub, error, event, 'onerror');
5749
5754
  });
@@ -5782,10 +5787,7 @@ var Sentry = (function (exports) {
5782
5787
  }
5783
5788
  var event = isPrimitive(error)
5784
5789
  ? _eventFromRejectionWithPrimitive(error)
5785
- : eventFromUnknownInput(error, undefined, {
5786
- attachStacktrace: attachStacktrace,
5787
- isRejection: true,
5788
- });
5790
+ : eventFromUnknownInput(error, undefined, attachStacktrace, true);
5789
5791
  event.level = exports.Severity.Error;
5790
5792
  addMechanismAndCapture(hub, error, event, 'onunhandledrejection');
5791
5793
  return;
@@ -5865,9 +5867,7 @@ var Sentry = (function (exports) {
5865
5867
  return event;
5866
5868
  }
5867
5869
  function globalHandlerLog(type) {
5868
- if (isDebugBuild()) {
5869
- logger.log("Global Handler attached: " + type);
5870
- }
5870
+ logger.log("Global Handler attached: " + type);
5871
5871
  }
5872
5872
  function addMechanismAndCapture(hub, error, event, type) {
5873
5873
  addExceptionMechanism(event, {
@@ -5983,16 +5983,18 @@ var Sentry = (function (exports) {
5983
5983
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5984
5984
  return function (callback) {
5985
5985
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
5986
- return original.call(this, wrap$1(callback, {
5987
- mechanism: {
5988
- data: {
5989
- function: 'requestAnimationFrame',
5990
- handler: getFunctionName(original),
5986
+ return original.apply(this, [
5987
+ wrap$1(callback, {
5988
+ mechanism: {
5989
+ data: {
5990
+ function: 'requestAnimationFrame',
5991
+ handler: getFunctionName(original),
5992
+ },
5993
+ handled: true,
5994
+ type: 'instrument',
5991
5995
  },
5992
- handled: true,
5993
- type: 'instrument',
5994
- },
5995
- }));
5996
+ }),
5997
+ ]);
5996
5998
  };
5997
5999
  }
5998
6000
  /** JSDoc */
@@ -6063,19 +6065,22 @@ var Sentry = (function (exports) {
6063
6065
  catch (err) {
6064
6066
  // can sometimes get 'Permission denied to access property "handle Event'
6065
6067
  }
6066
- return original.call(this, eventName,
6067
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6068
- wrap$1(fn, {
6069
- mechanism: {
6070
- data: {
6071
- function: 'addEventListener',
6072
- handler: getFunctionName(fn),
6073
- target: target,
6068
+ return original.apply(this, [
6069
+ eventName,
6070
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6071
+ wrap$1(fn, {
6072
+ mechanism: {
6073
+ data: {
6074
+ function: 'addEventListener',
6075
+ handler: getFunctionName(fn),
6076
+ target: target,
6077
+ },
6078
+ handled: true,
6079
+ type: 'instrument',
6074
6080
  },
6075
- handled: true,
6076
- type: 'instrument',
6077
- },
6078
- }), options);
6081
+ }),
6082
+ options,
6083
+ ]);
6079
6084
  };
6080
6085
  });
6081
6086
  fill(proto, 'removeEventListener', function (originalRemoveEventListener) {
@@ -6441,7 +6446,7 @@ var Sentry = (function (exports) {
6441
6446
  // Juuust in case something goes wrong
6442
6447
  try {
6443
6448
  if (_shouldDropEvent(currentEvent, self._previousEvent)) {
6444
- logger.warn("Event dropped due to being a duplicate of previously captured event.");
6449
+ logger.warn('Event dropped due to being a duplicate of previously captured event.');
6445
6450
  return null;
6446
6451
  }
6447
6452
  }
@@ -6811,9 +6816,7 @@ var Sentry = (function (exports) {
6811
6816
  if (client) {
6812
6817
  return client.flush(timeout);
6813
6818
  }
6814
- if (isDebugBuild()) {
6815
- logger.warn('Cannot flush events. No client defined.');
6816
- }
6819
+ logger.warn('Cannot flush events. No client defined.');
6817
6820
  return resolvedSyncPromise(false);
6818
6821
  }
6819
6822
  /**
@@ -6829,9 +6832,7 @@ var Sentry = (function (exports) {
6829
6832
  if (client) {
6830
6833
  return client.close(timeout);
6831
6834
  }
6832
- if (isDebugBuild()) {
6833
- logger.warn('Cannot flush events and disable SDK. No client defined.');
6834
- }
6835
+ logger.warn('Cannot flush events and disable SDK. No client defined.');
6835
6836
  return resolvedSyncPromise(false);
6836
6837
  }
6837
6838
  /**
@@ -6856,9 +6857,7 @@ var Sentry = (function (exports) {
6856
6857
  var window = getGlobalObject();
6857
6858
  var document = window.document;
6858
6859
  if (typeof document === 'undefined') {
6859
- if (isDebugBuild()) {
6860
- logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.');
6861
- }
6860
+ logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.');
6862
6861
  return;
6863
6862
  }
6864
6863
  var hub = getCurrentHub();