@sentry/browser 6.13.3 → 6.14.3

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.
package/build/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.13.3 (cbb01ba) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.14.3 (3807d99) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
  /*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -241,6 +241,49 @@ var Sentry = (function (exports) {
241
241
  });
242
242
  }
243
243
 
244
+ /**
245
+ * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
246
+ * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
247
+ */
248
+ /**
249
+ * Checks whether we're in the Node.js or Browser environment
250
+ *
251
+ * @returns Answer to given question
252
+ */
253
+ function isNodeEnv() {
254
+ return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
255
+ }
256
+ /**
257
+ * Requires a module which is protected against bundler minification.
258
+ *
259
+ * @param request The module path to resolve
260
+ */
261
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
262
+ function dynamicRequire(mod, request) {
263
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
264
+ return mod.require(request);
265
+ }
266
+
267
+ /**
268
+ * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
269
+ * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
270
+ */
271
+ var fallbackGlobalObject = {};
272
+ /**
273
+ * Safely get global scope object
274
+ *
275
+ * @returns Global scope object
276
+ */
277
+ function getGlobalObject() {
278
+ return (isNodeEnv()
279
+ ? global
280
+ : typeof window !== 'undefined' // eslint-disable-line no-restricted-globals
281
+ ? window // eslint-disable-line no-restricted-globals
282
+ : typeof self !== 'undefined'
283
+ ? self
284
+ : fallbackGlobalObject);
285
+ }
286
+
244
287
  /* eslint-disable @typescript-eslint/no-explicit-any */
245
288
  /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
246
289
  /**
@@ -476,6 +519,18 @@ var Sentry = (function (exports) {
476
519
  }
477
520
  }
478
521
  return out.join('');
522
+ }
523
+ /**
524
+ * A safe form of location.href
525
+ */
526
+ function getLocationHref() {
527
+ var global = getGlobalObject();
528
+ try {
529
+ return global.document.location.href;
530
+ }
531
+ catch (oO) {
532
+ return '';
533
+ }
479
534
  }
480
535
 
481
536
  var setPrototypeOf = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties);
@@ -494,8 +549,7 @@ var Sentry = (function (exports) {
494
549
  // eslint-disable-next-line @typescript-eslint/ban-types
495
550
  function mixinProperties(obj, proto) {
496
551
  for (var prop in proto) {
497
- // eslint-disable-next-line no-prototype-builtins
498
- if (!obj.hasOwnProperty(prop)) {
552
+ if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
499
553
  // @ts-ignore typescript complains about indexing so we remove
500
554
  obj[prop] = proto[prop];
501
555
  }
@@ -606,175 +660,17 @@ var Sentry = (function (exports) {
606
660
  return Dsn;
607
661
  }());
608
662
 
663
+ // TODO: Implement different loggers for different environments
664
+ var global$1 = getGlobalObject();
665
+ /** Prefix for logging strings */
666
+ var PREFIX = 'Sentry Logger ';
609
667
  /**
610
- * Checks whether we're in the Node.js or Browser environment
611
- *
612
- * @returns Answer to given question
613
- */
614
- function isNodeEnv() {
615
- return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
616
- }
617
- /**
618
- * Requires a module which is protected against bundler minification.
619
- *
620
- * @param request The module path to resolve
621
- */
622
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
623
- function dynamicRequire(mod, request) {
624
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
625
- return mod.require(request);
626
- }
627
-
628
- /**
629
- * Truncates given string to the maximum characters count
630
- *
631
- * @param str An object that contains serializable values
632
- * @param max Maximum number of characters in truncated string (0 = unlimited)
633
- * @returns string Encoded
634
- */
635
- function truncate(str, max) {
636
- if (max === void 0) { max = 0; }
637
- if (typeof str !== 'string' || max === 0) {
638
- return str;
639
- }
640
- return str.length <= max ? str : str.substr(0, max) + "...";
641
- }
642
- /**
643
- * Join values in array
644
- * @param input array of values to be joined together
645
- * @param delimiter string to be placed in-between values
646
- * @returns Joined values
647
- */
648
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
649
- function safeJoin(input, delimiter) {
650
- if (!Array.isArray(input)) {
651
- return '';
652
- }
653
- var output = [];
654
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
655
- for (var i = 0; i < input.length; i++) {
656
- var value = input[i];
657
- try {
658
- output.push(String(value));
659
- }
660
- catch (e) {
661
- output.push('[value cannot be serialized]');
662
- }
663
- }
664
- return output.join(delimiter);
665
- }
666
- /**
667
- * Checks if the value matches a regex or includes the string
668
- * @param value The string value to be checked against
669
- * @param pattern Either a regex or a string that must be contained in value
670
- */
671
- function isMatchingPattern(value, pattern) {
672
- if (!isString(value)) {
673
- return false;
674
- }
675
- if (isRegExp(pattern)) {
676
- return pattern.test(value);
677
- }
678
- if (typeof pattern === 'string') {
679
- return value.indexOf(pattern) !== -1;
680
- }
681
- return false;
682
- }
683
-
684
- var fallbackGlobalObject = {};
685
- /**
686
- * Safely get global scope object
687
- *
688
- * @returns Global scope object
689
- */
690
- function getGlobalObject() {
691
- return (isNodeEnv()
692
- ? global
693
- : typeof window !== 'undefined' // eslint-disable-line no-restricted-globals
694
- ? window // eslint-disable-line no-restricted-globals
695
- : typeof self !== 'undefined'
696
- ? self
697
- : fallbackGlobalObject);
698
- }
699
- /**
700
- * UUID4 generator
668
+ * Temporarily unwrap `console.log` and friends in order to perform the given callback using the original methods.
669
+ * Restores wrapping after the callback completes.
701
670
  *
702
- * @returns string Generated UUID4.
703
- */
704
- function uuid4() {
705
- var global = getGlobalObject();
706
- var crypto = global.crypto || global.msCrypto;
707
- if (!(crypto === void 0) && crypto.getRandomValues) {
708
- // Use window.crypto API if available
709
- var arr = new Uint16Array(8);
710
- crypto.getRandomValues(arr);
711
- // set 4 in byte 7
712
- // eslint-disable-next-line no-bitwise
713
- arr[3] = (arr[3] & 0xfff) | 0x4000;
714
- // set 2 most significant bits of byte 9 to '10'
715
- // eslint-disable-next-line no-bitwise
716
- arr[4] = (arr[4] & 0x3fff) | 0x8000;
717
- var pad = function (num) {
718
- var v = num.toString(16);
719
- while (v.length < 4) {
720
- v = "0" + v;
721
- }
722
- return v;
723
- };
724
- return (pad(arr[0]) + pad(arr[1]) + pad(arr[2]) + pad(arr[3]) + pad(arr[4]) + pad(arr[5]) + pad(arr[6]) + pad(arr[7]));
725
- }
726
- // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
727
- return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
728
- // eslint-disable-next-line no-bitwise
729
- var r = (Math.random() * 16) | 0;
730
- // eslint-disable-next-line no-bitwise
731
- var v = c === 'x' ? r : (r & 0x3) | 0x8;
732
- return v.toString(16);
733
- });
734
- }
735
- /**
736
- * Parses string form of URL into an object
737
- * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B
738
- * // intentionally using regex and not <a/> href parsing trick because React Native and other
739
- * // environments where DOM might not be available
740
- * @returns parsed URL object
671
+ * @param callback The function to run against the original `console` messages
672
+ * @returns The results of the callback
741
673
  */
742
- function parseUrl(url) {
743
- if (!url) {
744
- return {};
745
- }
746
- var match = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
747
- if (!match) {
748
- return {};
749
- }
750
- // coerce to undefined values to empty string so we don't get 'undefined'
751
- var query = match[6] || '';
752
- var fragment = match[8] || '';
753
- return {
754
- host: match[4],
755
- path: match[5],
756
- protocol: match[2],
757
- relative: match[5] + query + fragment,
758
- };
759
- }
760
- /**
761
- * Extracts either message or type+value from an event that can be used for user-facing logs
762
- * @returns event's description
763
- */
764
- function getEventDescription(event) {
765
- if (event.message) {
766
- return event.message;
767
- }
768
- if (event.exception && event.exception.values && event.exception.values[0]) {
769
- var exception = event.exception.values[0];
770
- if (exception.type && exception.value) {
771
- return exception.type + ": " + exception.value;
772
- }
773
- return exception.type || exception.value || event.event_id || '<unknown>';
774
- }
775
- return event.event_id || '<unknown>';
776
- }
777
- /** JSDoc */
778
674
  function consoleSandbox(callback) {
779
675
  var global = getGlobalObject();
780
676
  var levels = ['debug', 'info', 'warn', 'error', 'log', 'assert'];
@@ -800,81 +696,6 @@ var Sentry = (function (exports) {
800
696
  });
801
697
  return result;
802
698
  }
803
- /**
804
- * Adds exception values, type and value to an synthetic Exception.
805
- * @param event The event to modify.
806
- * @param value Value of the exception.
807
- * @param type Type of the exception.
808
- * @hidden
809
- */
810
- function addExceptionTypeValue(event, value, type) {
811
- event.exception = event.exception || {};
812
- event.exception.values = event.exception.values || [];
813
- event.exception.values[0] = event.exception.values[0] || {};
814
- event.exception.values[0].value = event.exception.values[0].value || value || '';
815
- event.exception.values[0].type = event.exception.values[0].type || type || 'Error';
816
- }
817
- /**
818
- * Adds exception mechanism to a given event.
819
- * @param event The event to modify.
820
- * @param mechanism Mechanism of the mechanism.
821
- * @hidden
822
- */
823
- function addExceptionMechanism(event, mechanism) {
824
- if (mechanism === void 0) { mechanism = {}; }
825
- // TODO: Use real type with `keyof Mechanism` thingy and maybe make it better?
826
- try {
827
- // @ts-ignore Type 'Mechanism | {}' is not assignable to type 'Mechanism | undefined'
828
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
829
- event.exception.values[0].mechanism = event.exception.values[0].mechanism || {};
830
- Object.keys(mechanism).forEach(function (key) {
831
- // @ts-ignore Mechanism has no index signature
832
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
833
- event.exception.values[0].mechanism[key] = mechanism[key];
834
- });
835
- }
836
- catch (_oO) {
837
- // no-empty
838
- }
839
- }
840
- /**
841
- * A safe form of location.href
842
- */
843
- function getLocationHref() {
844
- var global = getGlobalObject();
845
- try {
846
- return global.document.location.href;
847
- }
848
- catch (oO) {
849
- return '';
850
- }
851
- }
852
- var defaultRetryAfter = 60 * 1000; // 60 seconds
853
- /**
854
- * Extracts Retry-After value from the request header or returns default value
855
- * @param now current unix timestamp
856
- * @param header string representation of 'Retry-After' header
857
- */
858
- function parseRetryAfterHeader(now, header) {
859
- if (!header) {
860
- return defaultRetryAfter;
861
- }
862
- var headerDelay = parseInt("" + header, 10);
863
- if (!isNaN(headerDelay)) {
864
- return headerDelay * 1000;
865
- }
866
- var headerDate = Date.parse("" + header);
867
- if (!isNaN(headerDate)) {
868
- return headerDate - now;
869
- }
870
- return defaultRetryAfter;
871
- }
872
-
873
- /* eslint-disable @typescript-eslint/no-explicit-any */
874
- // TODO: Implement different loggers for different environments
875
- var global$1 = getGlobalObject();
876
- /** Prefix for logging strings */
877
- var PREFIX = 'Sentry Logger ';
878
699
  /** JSDoc */
879
700
  var Logger = /** @class */ (function () {
880
701
  /** JSDoc */
@@ -1005,6 +826,62 @@ var Sentry = (function (exports) {
1005
826
  }
1006
827
  }
1007
828
 
829
+ /**
830
+ * Truncates given string to the maximum characters count
831
+ *
832
+ * @param str An object that contains serializable values
833
+ * @param max Maximum number of characters in truncated string (0 = unlimited)
834
+ * @returns string Encoded
835
+ */
836
+ function truncate(str, max) {
837
+ if (max === void 0) { max = 0; }
838
+ if (typeof str !== 'string' || max === 0) {
839
+ return str;
840
+ }
841
+ return str.length <= max ? str : str.substr(0, max) + "...";
842
+ }
843
+ /**
844
+ * Join values in array
845
+ * @param input array of values to be joined together
846
+ * @param delimiter string to be placed in-between values
847
+ * @returns Joined values
848
+ */
849
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
850
+ function safeJoin(input, delimiter) {
851
+ if (!Array.isArray(input)) {
852
+ return '';
853
+ }
854
+ var output = [];
855
+ // eslint-disable-next-line @typescript-eslint/prefer-for-of
856
+ for (var i = 0; i < input.length; i++) {
857
+ var value = input[i];
858
+ try {
859
+ output.push(String(value));
860
+ }
861
+ catch (e) {
862
+ output.push('[value cannot be serialized]');
863
+ }
864
+ }
865
+ return output.join(delimiter);
866
+ }
867
+ /**
868
+ * Checks if the value matches a regex or includes the string
869
+ * @param value The string value to be checked against
870
+ * @param pattern Either a regex or a string that must be contained in value
871
+ */
872
+ function isMatchingPattern(value, pattern) {
873
+ if (!isString(value)) {
874
+ return false;
875
+ }
876
+ if (isRegExp(pattern)) {
877
+ return pattern.test(value);
878
+ }
879
+ if (typeof pattern === 'string') {
880
+ return value.indexOf(pattern) !== -1;
881
+ }
882
+ return false;
883
+ }
884
+
1008
885
  /**
1009
886
  * Replace a method in an object with a wrapped version of itself.
1010
887
  *
@@ -1980,6 +1857,179 @@ var Sentry = (function (exports) {
1980
1857
  };
1981
1858
  }
1982
1859
 
1860
+ /**
1861
+ * UUID4 generator
1862
+ *
1863
+ * @returns string Generated UUID4.
1864
+ */
1865
+ function uuid4() {
1866
+ var global = getGlobalObject();
1867
+ var crypto = global.crypto || global.msCrypto;
1868
+ if (!(crypto === void 0) && crypto.getRandomValues) {
1869
+ // Use window.crypto API if available
1870
+ var arr = new Uint16Array(8);
1871
+ crypto.getRandomValues(arr);
1872
+ // set 4 in byte 7
1873
+ // eslint-disable-next-line no-bitwise
1874
+ arr[3] = (arr[3] & 0xfff) | 0x4000;
1875
+ // set 2 most significant bits of byte 9 to '10'
1876
+ // eslint-disable-next-line no-bitwise
1877
+ arr[4] = (arr[4] & 0x3fff) | 0x8000;
1878
+ var pad = function (num) {
1879
+ var v = num.toString(16);
1880
+ while (v.length < 4) {
1881
+ v = "0" + v;
1882
+ }
1883
+ return v;
1884
+ };
1885
+ return (pad(arr[0]) + pad(arr[1]) + pad(arr[2]) + pad(arr[3]) + pad(arr[4]) + pad(arr[5]) + pad(arr[6]) + pad(arr[7]));
1886
+ }
1887
+ // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
1888
+ return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
1889
+ // eslint-disable-next-line no-bitwise
1890
+ var r = (Math.random() * 16) | 0;
1891
+ // eslint-disable-next-line no-bitwise
1892
+ var v = c === 'x' ? r : (r & 0x3) | 0x8;
1893
+ return v.toString(16);
1894
+ });
1895
+ }
1896
+ /**
1897
+ * Parses string form of URL into an object
1898
+ * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B
1899
+ * // intentionally using regex and not <a/> href parsing trick because React Native and other
1900
+ * // environments where DOM might not be available
1901
+ * @returns parsed URL object
1902
+ */
1903
+ function parseUrl(url) {
1904
+ if (!url) {
1905
+ return {};
1906
+ }
1907
+ var match = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
1908
+ if (!match) {
1909
+ return {};
1910
+ }
1911
+ // coerce to undefined values to empty string so we don't get 'undefined'
1912
+ var query = match[6] || '';
1913
+ var fragment = match[8] || '';
1914
+ return {
1915
+ host: match[4],
1916
+ path: match[5],
1917
+ protocol: match[2],
1918
+ relative: match[5] + query + fragment,
1919
+ };
1920
+ }
1921
+ /**
1922
+ * Extracts either message or type+value from an event that can be used for user-facing logs
1923
+ * @returns event's description
1924
+ */
1925
+ function getEventDescription(event) {
1926
+ if (event.message) {
1927
+ return event.message;
1928
+ }
1929
+ if (event.exception && event.exception.values && event.exception.values[0]) {
1930
+ var exception = event.exception.values[0];
1931
+ if (exception.type && exception.value) {
1932
+ return exception.type + ": " + exception.value;
1933
+ }
1934
+ return exception.type || exception.value || event.event_id || '<unknown>';
1935
+ }
1936
+ return event.event_id || '<unknown>';
1937
+ }
1938
+ /**
1939
+ * Adds exception values, type and value to an synthetic Exception.
1940
+ * @param event The event to modify.
1941
+ * @param value Value of the exception.
1942
+ * @param type Type of the exception.
1943
+ * @hidden
1944
+ */
1945
+ function addExceptionTypeValue(event, value, type) {
1946
+ event.exception = event.exception || {};
1947
+ event.exception.values = event.exception.values || [];
1948
+ event.exception.values[0] = event.exception.values[0] || {};
1949
+ event.exception.values[0].value = event.exception.values[0].value || value || '';
1950
+ event.exception.values[0].type = event.exception.values[0].type || type || 'Error';
1951
+ }
1952
+ /**
1953
+ * Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed.
1954
+ *
1955
+ * @param event The event to modify.
1956
+ * @param newMechanism Mechanism data to add to the event.
1957
+ * @hidden
1958
+ */
1959
+ function addExceptionMechanism(event, newMechanism) {
1960
+ var _a;
1961
+ if (!event.exception || !event.exception.values) {
1962
+ return;
1963
+ }
1964
+ var exceptionValue0 = event.exception.values[0];
1965
+ var defaultMechanism = { type: 'generic', handled: true };
1966
+ var currentMechanism = exceptionValue0.mechanism;
1967
+ exceptionValue0.mechanism = __assign(__assign(__assign({}, defaultMechanism), currentMechanism), newMechanism);
1968
+ if (newMechanism && 'data' in newMechanism) {
1969
+ var mergedData = __assign(__assign({}, (_a = currentMechanism) === null || _a === void 0 ? void 0 : _a.data), newMechanism.data);
1970
+ exceptionValue0.mechanism.data = mergedData;
1971
+ }
1972
+ }
1973
+ var defaultRetryAfter = 60 * 1000; // 60 seconds
1974
+ /**
1975
+ * Extracts Retry-After value from the request header or returns default value
1976
+ * @param now current unix timestamp
1977
+ * @param header string representation of 'Retry-After' header
1978
+ */
1979
+ function parseRetryAfterHeader(now, header) {
1980
+ if (!header) {
1981
+ return defaultRetryAfter;
1982
+ }
1983
+ var headerDelay = parseInt("" + header, 10);
1984
+ if (!isNaN(headerDelay)) {
1985
+ return headerDelay * 1000;
1986
+ }
1987
+ var headerDate = Date.parse("" + header);
1988
+ if (!isNaN(headerDate)) {
1989
+ return headerDate - now;
1990
+ }
1991
+ return defaultRetryAfter;
1992
+ }
1993
+ /**
1994
+ * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
1995
+ * in question), and marks it captured if not.
1996
+ *
1997
+ * This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and
1998
+ * record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so
1999
+ * that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because
2000
+ * the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not
2001
+ * caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This
2002
+ * function helps us ensure that even if we encounter the same error more than once, we only record it the first time we
2003
+ * see it.
2004
+ *
2005
+ * Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on
2006
+ * them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent
2007
+ * object wrapper forms so that this check will always work. However, because we need to flag the exact object which
2008
+ * will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification
2009
+ * must be done before the exception captured.
2010
+ *
2011
+ * @param A thrown exception to check or flag as having been seen
2012
+ * @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)
2013
+ */
2014
+ function checkOrSetAlreadyCaught(exception) {
2015
+ var _a;
2016
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2017
+ if ((_a = exception) === null || _a === void 0 ? void 0 : _a.__sentry_captured__) {
2018
+ return true;
2019
+ }
2020
+ try {
2021
+ // set it this way rather than by assignment so that it's not ennumerable and therefore isn't recorded by the
2022
+ // `ExtraErrorData` integration
2023
+ Object.defineProperty(exception, '__sentry_captured__', {
2024
+ value: true,
2025
+ });
2026
+ }
2027
+ catch (err) {
2028
+ // `exception` is a primitive, so we can't mark it seen
2029
+ }
2030
+ return false;
2031
+ }
2032
+
1983
2033
  /* eslint-disable @typescript-eslint/explicit-function-return-type */
1984
2034
  /** SyncPromise internal states */
1985
2035
  var States;
@@ -3819,6 +3869,7 @@ var Sentry = (function (exports) {
3819
3869
  return integrations;
3820
3870
  }
3821
3871
 
3872
+ var ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
3822
3873
  /**
3823
3874
  * Base implementation for all JavaScript SDK clients.
3824
3875
  *
@@ -3875,6 +3926,11 @@ var Sentry = (function (exports) {
3875
3926
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
3876
3927
  BaseClient.prototype.captureException = function (exception, hint, scope) {
3877
3928
  var _this = this;
3929
+ // ensure we haven't captured this very object before
3930
+ if (checkOrSetAlreadyCaught(exception)) {
3931
+ logger.log(ALREADY_SEEN_ERROR);
3932
+ return;
3933
+ }
3878
3934
  var eventId = hint && hint.event_id;
3879
3935
  this._process(this._getBackend()
3880
3936
  .eventFromException(exception, hint)
@@ -3904,6 +3960,12 @@ var Sentry = (function (exports) {
3904
3960
  * @inheritDoc
3905
3961
  */
3906
3962
  BaseClient.prototype.captureEvent = function (event, hint, scope) {
3963
+ var _a;
3964
+ // ensure we haven't captured this very object before
3965
+ if (((_a = hint) === null || _a === void 0 ? void 0 : _a.originalException) && checkOrSetAlreadyCaught(hint.originalException)) {
3966
+ logger.log(ALREADY_SEEN_ERROR);
3967
+ return;
3968
+ }
3907
3969
  var eventId = hint && hint.event_id;
3908
3970
  this._process(this._captureEvent(event, hint, scope).then(function (result) {
3909
3971
  eventId = result;
@@ -4496,7 +4558,7 @@ var Sentry = (function (exports) {
4496
4558
  hub.bindClient(client);
4497
4559
  }
4498
4560
 
4499
- var SDK_VERSION = '6.13.3';
4561
+ var SDK_VERSION = '6.14.3';
4500
4562
 
4501
4563
  var originalFunctionToString;
4502
4564
  /** Patch toString calls to return proper name for wrapped functions */
@@ -5060,10 +5122,7 @@ var Sentry = (function (exports) {
5060
5122
  var event = eventFromUnknownInput(exception, syntheticException, {
5061
5123
  attachStacktrace: options.attachStacktrace,
5062
5124
  });
5063
- addExceptionMechanism(event, {
5064
- handled: true,
5065
- type: 'generic',
5066
- });
5125
+ addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }
5067
5126
  event.level = exports.Severity.Error;
5068
5127
  if (hint && hint.event_id) {
5069
5128
  event.event_id = hint.event_id;
@@ -5334,7 +5393,7 @@ var Sentry = (function (exports) {
5334
5393
  logger.log("Flushing outcomes:\n" + JSON.stringify(outcomes, null, 2));
5335
5394
  var url = this._api.getEnvelopeEndpointWithUrlEncodedAuth();
5336
5395
  // Envelope header is required to be at least an empty object
5337
- var envelopeHeader = JSON.stringify({});
5396
+ var envelopeHeader = JSON.stringify(__assign({}, (this.options.tunnel && { dsn: this._api.getDsn().toString() })));
5338
5397
  var itemHeaders = JSON.stringify({
5339
5398
  type: 'client_report',
5340
5399
  });
@@ -5580,7 +5639,7 @@ var Sentry = (function (exports) {
5580
5639
  };
5581
5640
  request.open('POST', sentryRequest.url);
5582
5641
  for (var header in _this.options.headers) {
5583
- if (_this.options.headers.hasOwnProperty(header)) {
5642
+ if (Object.prototype.hasOwnProperty.call(_this.options.headers, header)) {
5584
5643
  request.setRequestHeader(header, _this.options.headers[header]);
5585
5644
  }
5586
5645
  }
@@ -6116,7 +6175,7 @@ var Sentry = (function (exports) {
6116
6175
  var global = getGlobalObject();
6117
6176
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
6118
6177
  var proto = global[target] && global[target].prototype;
6119
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
6178
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-prototype-builtins
6120
6179
  if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {
6121
6180
  return;
6122
6181
  }