@sentry/browser 6.19.1 → 6.19.2
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/bundles/bundle.debug.min.js +2 -2
- package/bundles/bundle.debug.min.js.map +1 -1
- package/bundles/bundle.es6.debug.min.js +2 -2
- package/bundles/bundle.es6.debug.min.js.map +1 -1
- package/bundles/bundle.es6.js +658 -628
- package/bundles/bundle.es6.js.map +1 -1
- package/bundles/bundle.es6.min.js +2 -2
- package/bundles/bundle.es6.min.js.map +1 -1
- package/bundles/bundle.js +668 -636
- package/bundles/bundle.js.map +1 -1
- package/bundles/bundle.min.js +2 -2
- package/bundles/bundle.min.js.map +1 -1
- package/package.json +5 -5
package/bundles/bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @sentry/browser 6.19.
|
|
1
|
+
/*! @sentry/browser 6.19.2 (f49c509) | https://github.com/getsentry/sentry-javascript */
|
|
2
2
|
var Sentry = (function (exports) {
|
|
3
3
|
|
|
4
4
|
/*! *****************************************************************************
|
|
@@ -624,140 +624,6 @@ var Sentry = (function (exports) {
|
|
|
624
624
|
global$6.__SENTRY__ = sentryGlobal;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
628
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
629
|
-
/**
|
|
630
|
-
* Helper to decycle json objects
|
|
631
|
-
*/
|
|
632
|
-
function memoBuilder() {
|
|
633
|
-
var hasWeakSet = typeof WeakSet === 'function';
|
|
634
|
-
var inner = hasWeakSet ? new WeakSet() : [];
|
|
635
|
-
function memoize(obj) {
|
|
636
|
-
if (hasWeakSet) {
|
|
637
|
-
if (inner.has(obj)) {
|
|
638
|
-
return true;
|
|
639
|
-
}
|
|
640
|
-
inner.add(obj);
|
|
641
|
-
return false;
|
|
642
|
-
}
|
|
643
|
-
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
644
|
-
for (var i = 0; i < inner.length; i++) {
|
|
645
|
-
var value = inner[i];
|
|
646
|
-
if (value === obj) {
|
|
647
|
-
return true;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
inner.push(obj);
|
|
651
|
-
return false;
|
|
652
|
-
}
|
|
653
|
-
function unmemoize(obj) {
|
|
654
|
-
if (hasWeakSet) {
|
|
655
|
-
inner.delete(obj);
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
for (var i = 0; i < inner.length; i++) {
|
|
659
|
-
if (inner[i] === obj) {
|
|
660
|
-
inner.splice(i, 1);
|
|
661
|
-
break;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
return [memoize, unmemoize];
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
var STACKTRACE_LIMIT = 50;
|
|
670
|
-
/**
|
|
671
|
-
* Creates a stack parser with the supplied line parsers
|
|
672
|
-
*
|
|
673
|
-
* StackFrames are returned in the correct order for Sentry Exception
|
|
674
|
-
* frames and with Sentry SDK internal frames removed from the top and bottom
|
|
675
|
-
*
|
|
676
|
-
*/
|
|
677
|
-
function createStackParser() {
|
|
678
|
-
var parsers = [];
|
|
679
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
680
|
-
parsers[_i] = arguments[_i];
|
|
681
|
-
}
|
|
682
|
-
var sortedParsers = parsers.sort(function (a, b) { return a[0] - b[0]; }).map(function (p) { return p[1]; });
|
|
683
|
-
return function (stack, skipFirst) {
|
|
684
|
-
var e_1, _a, e_2, _b;
|
|
685
|
-
if (skipFirst === void 0) { skipFirst = 0; }
|
|
686
|
-
var frames = [];
|
|
687
|
-
try {
|
|
688
|
-
for (var _c = __values(stack.split('\n').slice(skipFirst)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
689
|
-
var line = _d.value;
|
|
690
|
-
try {
|
|
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;
|
|
693
|
-
var frame = parser(line);
|
|
694
|
-
if (frame) {
|
|
695
|
-
frames.push(frame);
|
|
696
|
-
break;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
701
|
-
finally {
|
|
702
|
-
try {
|
|
703
|
-
if (sortedParsers_1_1 && !sortedParsers_1_1.done && (_b = sortedParsers_1.return)) _b.call(sortedParsers_1);
|
|
704
|
-
}
|
|
705
|
-
finally { if (e_2) throw e_2.error; }
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
710
|
-
finally {
|
|
711
|
-
try {
|
|
712
|
-
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
713
|
-
}
|
|
714
|
-
finally { if (e_1) throw e_1.error; }
|
|
715
|
-
}
|
|
716
|
-
return stripSentryFramesAndReverse(frames);
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* @hidden
|
|
721
|
-
*/
|
|
722
|
-
function stripSentryFramesAndReverse(stack) {
|
|
723
|
-
if (!stack.length) {
|
|
724
|
-
return [];
|
|
725
|
-
}
|
|
726
|
-
var localStack = stack;
|
|
727
|
-
var firstFrameFunction = localStack[0].function || '';
|
|
728
|
-
var lastFrameFunction = localStack[localStack.length - 1].function || '';
|
|
729
|
-
// If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
|
|
730
|
-
if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {
|
|
731
|
-
localStack = localStack.slice(1);
|
|
732
|
-
}
|
|
733
|
-
// If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)
|
|
734
|
-
if (lastFrameFunction.indexOf('sentryWrapped') !== -1) {
|
|
735
|
-
localStack = localStack.slice(0, -1);
|
|
736
|
-
}
|
|
737
|
-
// The frame where the crash happened, should be the last entry in the array
|
|
738
|
-
return localStack
|
|
739
|
-
.slice(0, STACKTRACE_LIMIT)
|
|
740
|
-
.map(function (frame) { return (__assign(__assign({}, frame), { filename: frame.filename || localStack[0].filename, function: frame.function || '?' })); })
|
|
741
|
-
.reverse();
|
|
742
|
-
}
|
|
743
|
-
var defaultFunctionName = '<anonymous>';
|
|
744
|
-
/**
|
|
745
|
-
* Safely extract function name from itself
|
|
746
|
-
*/
|
|
747
|
-
function getFunctionName(fn) {
|
|
748
|
-
try {
|
|
749
|
-
if (!fn || typeof fn !== 'function') {
|
|
750
|
-
return defaultFunctionName;
|
|
751
|
-
}
|
|
752
|
-
return fn.name || defaultFunctionName;
|
|
753
|
-
}
|
|
754
|
-
catch (e) {
|
|
755
|
-
// Just accessing custom props in some Selenium environments
|
|
756
|
-
// can cause a "Permission denied" exception (see raven-js#495).
|
|
757
|
-
return defaultFunctionName;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
|
|
761
627
|
/**
|
|
762
628
|
* Truncates given string to the maximum characters count
|
|
763
629
|
*
|
|
@@ -948,193 +814,6 @@ var Sentry = (function (exports) {
|
|
|
948
814
|
}
|
|
949
815
|
return value;
|
|
950
816
|
}
|
|
951
|
-
/** Calculates bytes size of input string */
|
|
952
|
-
function utf8Length(value) {
|
|
953
|
-
// eslint-disable-next-line no-bitwise
|
|
954
|
-
return ~-encodeURI(value).split(/%..|./).length;
|
|
955
|
-
}
|
|
956
|
-
/** Calculates bytes size of input object */
|
|
957
|
-
function jsonSize(value) {
|
|
958
|
-
return utf8Length(JSON.stringify(value));
|
|
959
|
-
}
|
|
960
|
-
/** JSDoc */
|
|
961
|
-
function normalizeToSize(object,
|
|
962
|
-
// Default Node.js REPL depth
|
|
963
|
-
depth,
|
|
964
|
-
// 100kB, as 200kB is max payload size, so half sounds reasonable
|
|
965
|
-
maxSize) {
|
|
966
|
-
if (depth === void 0) { depth = 3; }
|
|
967
|
-
if (maxSize === void 0) { maxSize = 100 * 1024; }
|
|
968
|
-
var serialized = normalize(object, depth);
|
|
969
|
-
if (jsonSize(serialized) > maxSize) {
|
|
970
|
-
return normalizeToSize(object, depth - 1, maxSize);
|
|
971
|
-
}
|
|
972
|
-
return serialized;
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
* Transform any non-primitive, BigInt, or Symbol-type value into a string. Acts as a no-op on strings, numbers,
|
|
976
|
-
* booleans, null, and undefined.
|
|
977
|
-
*
|
|
978
|
-
* @param value The value to stringify
|
|
979
|
-
* @returns For non-primitive, BigInt, and Symbol-type values, a string denoting the value's type, type and value, or
|
|
980
|
-
* type and `description` property, respectively. For non-BigInt, non-Symbol primitives, returns the original value,
|
|
981
|
-
* unchanged.
|
|
982
|
-
*/
|
|
983
|
-
function serializeValue(value) {
|
|
984
|
-
// Node.js REPL notation
|
|
985
|
-
if (typeof value === 'string') {
|
|
986
|
-
return value;
|
|
987
|
-
}
|
|
988
|
-
var type = Object.prototype.toString.call(value);
|
|
989
|
-
if (type === '[object Object]') {
|
|
990
|
-
return '[Object]';
|
|
991
|
-
}
|
|
992
|
-
if (type === '[object Array]') {
|
|
993
|
-
return '[Array]';
|
|
994
|
-
}
|
|
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;
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* makeSerializable()
|
|
1002
|
-
*
|
|
1003
|
-
* Takes unserializable input and make it serializer-friendly.
|
|
1004
|
-
*
|
|
1005
|
-
* Handles globals, functions, `undefined`, `NaN`, and other non-serializable values.
|
|
1006
|
-
*/
|
|
1007
|
-
function makeSerializable(value, key) {
|
|
1008
|
-
if (key === 'domain' && value && typeof value === 'object' && value._events) {
|
|
1009
|
-
return '[Domain]';
|
|
1010
|
-
}
|
|
1011
|
-
if (key === 'domainEmitter') {
|
|
1012
|
-
return '[DomainEmitter]';
|
|
1013
|
-
}
|
|
1014
|
-
if (typeof global !== 'undefined' && value === global) {
|
|
1015
|
-
return '[Global]';
|
|
1016
|
-
}
|
|
1017
|
-
// It's safe to use `window` and `document` here in this manner, as we are asserting using `typeof` first
|
|
1018
|
-
// which won't throw if they are not present.
|
|
1019
|
-
// eslint-disable-next-line no-restricted-globals
|
|
1020
|
-
if (typeof window !== 'undefined' && value === window) {
|
|
1021
|
-
return '[Window]';
|
|
1022
|
-
}
|
|
1023
|
-
// eslint-disable-next-line no-restricted-globals
|
|
1024
|
-
if (typeof document !== 'undefined' && value === document) {
|
|
1025
|
-
return '[Document]';
|
|
1026
|
-
}
|
|
1027
|
-
// React's SyntheticEvent thingy
|
|
1028
|
-
if (isSyntheticEvent(value)) {
|
|
1029
|
-
return '[SyntheticEvent]';
|
|
1030
|
-
}
|
|
1031
|
-
if (typeof value === 'number' && value !== value) {
|
|
1032
|
-
return '[NaN]';
|
|
1033
|
-
}
|
|
1034
|
-
if (value === void 0) {
|
|
1035
|
-
return '[undefined]';
|
|
1036
|
-
}
|
|
1037
|
-
if (typeof value === 'function') {
|
|
1038
|
-
return "[Function: " + getFunctionName(value) + "]";
|
|
1039
|
-
}
|
|
1040
|
-
// symbols and bigints are considered primitives by TS, but aren't natively JSON-serilaizable
|
|
1041
|
-
if (typeof value === 'symbol') {
|
|
1042
|
-
return "[" + String(value) + "]";
|
|
1043
|
-
}
|
|
1044
|
-
if (typeof value === 'bigint') {
|
|
1045
|
-
return "[BigInt: " + String(value) + "]";
|
|
1046
|
-
}
|
|
1047
|
-
return value;
|
|
1048
|
-
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Walks an object to perform a normalization on it
|
|
1051
|
-
*
|
|
1052
|
-
* @param key of object that's walked in current iteration
|
|
1053
|
-
* @param value object to be walked
|
|
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
|
|
1056
|
-
* @param memo Optional Memo class handling decycling
|
|
1057
|
-
*/
|
|
1058
|
-
function walk(key, value, depth, maxProperties, memo) {
|
|
1059
|
-
if (depth === void 0) { depth = +Infinity; }
|
|
1060
|
-
if (maxProperties === void 0) { maxProperties = +Infinity; }
|
|
1061
|
-
if (memo === void 0) { memo = memoBuilder(); }
|
|
1062
|
-
var _a = __read(memo, 2), memoize = _a[0], unmemoize = _a[1];
|
|
1063
|
-
// If we reach the maximum depth, serialize whatever is left
|
|
1064
|
-
if (depth === 0) {
|
|
1065
|
-
return serializeValue(value);
|
|
1066
|
-
}
|
|
1067
|
-
// If value implements `toJSON` method, call it and return early
|
|
1068
|
-
if (value !== null && value !== undefined && typeof value.toJSON === 'function') {
|
|
1069
|
-
return value.toJSON();
|
|
1070
|
-
}
|
|
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;
|
|
1077
|
-
}
|
|
1078
|
-
// Create source that we will use for the next iteration. It will either be an objectified error object (`Error` type
|
|
1079
|
-
// with extracted key:value pairs) or the input itself.
|
|
1080
|
-
var source = getWalkSource(value);
|
|
1081
|
-
// Create an accumulator that will act as a parent for all future itterations of that branch
|
|
1082
|
-
var acc = Array.isArray(value) ? [] : {};
|
|
1083
|
-
// If we already walked that branch, bail out, as it's circular reference
|
|
1084
|
-
if (memoize(value)) {
|
|
1085
|
-
return '[Circular ~]';
|
|
1086
|
-
}
|
|
1087
|
-
var propertyCount = 0;
|
|
1088
|
-
// Walk all keys of the source
|
|
1089
|
-
for (var innerKey in source) {
|
|
1090
|
-
// Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.
|
|
1091
|
-
if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {
|
|
1092
|
-
continue;
|
|
1093
|
-
}
|
|
1094
|
-
if (propertyCount >= maxProperties) {
|
|
1095
|
-
acc[innerKey] = '[MaxProperties ~]';
|
|
1096
|
-
break;
|
|
1097
|
-
}
|
|
1098
|
-
propertyCount += 1;
|
|
1099
|
-
// Recursively walk through all the child nodes
|
|
1100
|
-
var innerValue = source[innerKey];
|
|
1101
|
-
acc[innerKey] = walk(innerKey, innerValue, depth - 1, maxProperties, memo);
|
|
1102
|
-
}
|
|
1103
|
-
// Once walked through all the branches, remove the parent from memo storage
|
|
1104
|
-
unmemoize(value);
|
|
1105
|
-
// Return accumulated values
|
|
1106
|
-
return acc;
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Recursively normalizes the given object.
|
|
1110
|
-
*
|
|
1111
|
-
* - Creates a copy to prevent original input mutation
|
|
1112
|
-
* - Skips non-enumerable properties
|
|
1113
|
-
* - When stringifying, calls `toJSON` if implemented
|
|
1114
|
-
* - Removes circular references
|
|
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.
|
|
1126
|
-
*/
|
|
1127
|
-
function normalize(input, depth, maxProperties) {
|
|
1128
|
-
if (depth === void 0) { depth = +Infinity; }
|
|
1129
|
-
if (maxProperties === void 0) { maxProperties = +Infinity; }
|
|
1130
|
-
try {
|
|
1131
|
-
// since we're at the outermost level, there is no key
|
|
1132
|
-
return walk('', input, depth, maxProperties);
|
|
1133
|
-
}
|
|
1134
|
-
catch (_oO) {
|
|
1135
|
-
return '**non-serializable**';
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
817
|
/**
|
|
1139
818
|
* Given any captured exception, extract its keys and create a sorted
|
|
1140
819
|
* and truncated list that will be used inside the event message.
|
|
@@ -1167,32 +846,124 @@ var Sentry = (function (exports) {
|
|
|
1167
846
|
* Given any object, return the new object with removed keys that value was `undefined`.
|
|
1168
847
|
* Works recursively on objects and arrays.
|
|
1169
848
|
*/
|
|
1170
|
-
function dropUndefinedKeys(val) {
|
|
1171
|
-
var e_1, _a;
|
|
1172
|
-
if (isPlainObject(val)) {
|
|
1173
|
-
var obj = val;
|
|
1174
|
-
var rv = {};
|
|
849
|
+
function dropUndefinedKeys(val) {
|
|
850
|
+
var e_1, _a;
|
|
851
|
+
if (isPlainObject(val)) {
|
|
852
|
+
var obj = val;
|
|
853
|
+
var rv = {};
|
|
854
|
+
try {
|
|
855
|
+
for (var _b = __values(Object.keys(obj)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
856
|
+
var key = _c.value;
|
|
857
|
+
if (typeof obj[key] !== 'undefined') {
|
|
858
|
+
rv[key] = dropUndefinedKeys(obj[key]);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
863
|
+
finally {
|
|
864
|
+
try {
|
|
865
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
866
|
+
}
|
|
867
|
+
finally { if (e_1) throw e_1.error; }
|
|
868
|
+
}
|
|
869
|
+
return rv;
|
|
870
|
+
}
|
|
871
|
+
if (Array.isArray(val)) {
|
|
872
|
+
return val.map(dropUndefinedKeys);
|
|
873
|
+
}
|
|
874
|
+
return val;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
var STACKTRACE_LIMIT = 50;
|
|
878
|
+
/**
|
|
879
|
+
* Creates a stack parser with the supplied line parsers
|
|
880
|
+
*
|
|
881
|
+
* StackFrames are returned in the correct order for Sentry Exception
|
|
882
|
+
* frames and with Sentry SDK internal frames removed from the top and bottom
|
|
883
|
+
*
|
|
884
|
+
*/
|
|
885
|
+
function createStackParser() {
|
|
886
|
+
var parsers = [];
|
|
887
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
888
|
+
parsers[_i] = arguments[_i];
|
|
889
|
+
}
|
|
890
|
+
var sortedParsers = parsers.sort(function (a, b) { return a[0] - b[0]; }).map(function (p) { return p[1]; });
|
|
891
|
+
return function (stack, skipFirst) {
|
|
892
|
+
var e_1, _a, e_2, _b;
|
|
893
|
+
if (skipFirst === void 0) { skipFirst = 0; }
|
|
894
|
+
var frames = [];
|
|
1175
895
|
try {
|
|
1176
|
-
for (var
|
|
1177
|
-
var
|
|
1178
|
-
|
|
1179
|
-
|
|
896
|
+
for (var _c = __values(stack.split('\n').slice(skipFirst)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
897
|
+
var line = _d.value;
|
|
898
|
+
try {
|
|
899
|
+
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()) {
|
|
900
|
+
var parser = sortedParsers_1_1.value;
|
|
901
|
+
var frame = parser(line);
|
|
902
|
+
if (frame) {
|
|
903
|
+
frames.push(frame);
|
|
904
|
+
break;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
909
|
+
finally {
|
|
910
|
+
try {
|
|
911
|
+
if (sortedParsers_1_1 && !sortedParsers_1_1.done && (_b = sortedParsers_1.return)) _b.call(sortedParsers_1);
|
|
912
|
+
}
|
|
913
|
+
finally { if (e_2) throw e_2.error; }
|
|
1180
914
|
}
|
|
1181
915
|
}
|
|
1182
916
|
}
|
|
1183
917
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1184
918
|
finally {
|
|
1185
919
|
try {
|
|
1186
|
-
if (
|
|
920
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1187
921
|
}
|
|
1188
922
|
finally { if (e_1) throw e_1.error; }
|
|
1189
923
|
}
|
|
1190
|
-
return
|
|
924
|
+
return stripSentryFramesAndReverse(frames);
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* @hidden
|
|
929
|
+
*/
|
|
930
|
+
function stripSentryFramesAndReverse(stack) {
|
|
931
|
+
if (!stack.length) {
|
|
932
|
+
return [];
|
|
1191
933
|
}
|
|
1192
|
-
|
|
1193
|
-
|
|
934
|
+
var localStack = stack;
|
|
935
|
+
var firstFrameFunction = localStack[0].function || '';
|
|
936
|
+
var lastFrameFunction = localStack[localStack.length - 1].function || '';
|
|
937
|
+
// If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)
|
|
938
|
+
if (firstFrameFunction.indexOf('captureMessage') !== -1 || firstFrameFunction.indexOf('captureException') !== -1) {
|
|
939
|
+
localStack = localStack.slice(1);
|
|
940
|
+
}
|
|
941
|
+
// If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)
|
|
942
|
+
if (lastFrameFunction.indexOf('sentryWrapped') !== -1) {
|
|
943
|
+
localStack = localStack.slice(0, -1);
|
|
944
|
+
}
|
|
945
|
+
// The frame where the crash happened, should be the last entry in the array
|
|
946
|
+
return localStack
|
|
947
|
+
.slice(0, STACKTRACE_LIMIT)
|
|
948
|
+
.map(function (frame) { return (__assign(__assign({}, frame), { filename: frame.filename || localStack[0].filename, function: frame.function || '?' })); })
|
|
949
|
+
.reverse();
|
|
950
|
+
}
|
|
951
|
+
var defaultFunctionName = '<anonymous>';
|
|
952
|
+
/**
|
|
953
|
+
* Safely extract function name from itself
|
|
954
|
+
*/
|
|
955
|
+
function getFunctionName(fn) {
|
|
956
|
+
try {
|
|
957
|
+
if (!fn || typeof fn !== 'function') {
|
|
958
|
+
return defaultFunctionName;
|
|
959
|
+
}
|
|
960
|
+
return fn.name || defaultFunctionName;
|
|
961
|
+
}
|
|
962
|
+
catch (e) {
|
|
963
|
+
// Just accessing custom props in some Selenium environments
|
|
964
|
+
// can cause a "Permission denied" exception (see raven-js#495).
|
|
965
|
+
return defaultFunctionName;
|
|
1194
966
|
}
|
|
1195
|
-
return val;
|
|
1196
967
|
}
|
|
1197
968
|
|
|
1198
969
|
/**
|
|
@@ -1819,6 +1590,48 @@ var Sentry = (function (exports) {
|
|
|
1819
1590
|
};
|
|
1820
1591
|
}
|
|
1821
1592
|
|
|
1593
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
1594
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1595
|
+
/**
|
|
1596
|
+
* Helper to decycle json objects
|
|
1597
|
+
*/
|
|
1598
|
+
function memoBuilder() {
|
|
1599
|
+
var hasWeakSet = typeof WeakSet === 'function';
|
|
1600
|
+
var inner = hasWeakSet ? new WeakSet() : [];
|
|
1601
|
+
function memoize(obj) {
|
|
1602
|
+
if (hasWeakSet) {
|
|
1603
|
+
if (inner.has(obj)) {
|
|
1604
|
+
return true;
|
|
1605
|
+
}
|
|
1606
|
+
inner.add(obj);
|
|
1607
|
+
return false;
|
|
1608
|
+
}
|
|
1609
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
1610
|
+
for (var i = 0; i < inner.length; i++) {
|
|
1611
|
+
var value = inner[i];
|
|
1612
|
+
if (value === obj) {
|
|
1613
|
+
return true;
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
inner.push(obj);
|
|
1617
|
+
return false;
|
|
1618
|
+
}
|
|
1619
|
+
function unmemoize(obj) {
|
|
1620
|
+
if (hasWeakSet) {
|
|
1621
|
+
inner.delete(obj);
|
|
1622
|
+
}
|
|
1623
|
+
else {
|
|
1624
|
+
for (var i = 0; i < inner.length; i++) {
|
|
1625
|
+
if (inner[i] === obj) {
|
|
1626
|
+
inner.splice(i, 1);
|
|
1627
|
+
break;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
return [memoize, unmemoize];
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1822
1635
|
/**
|
|
1823
1636
|
* UUID4 generator
|
|
1824
1637
|
*
|
|
@@ -1915,65 +1728,253 @@ var Sentry = (function (exports) {
|
|
|
1915
1728
|
if (!firstException.value) {
|
|
1916
1729
|
firstException.value = value || '';
|
|
1917
1730
|
}
|
|
1918
|
-
if (!firstException.type) {
|
|
1919
|
-
firstException.type = type || 'Error';
|
|
1731
|
+
if (!firstException.type) {
|
|
1732
|
+
firstException.type = type || 'Error';
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
/**
|
|
1736
|
+
* Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed.
|
|
1737
|
+
*
|
|
1738
|
+
* @param event The event to modify.
|
|
1739
|
+
* @param newMechanism Mechanism data to add to the event.
|
|
1740
|
+
* @hidden
|
|
1741
|
+
*/
|
|
1742
|
+
function addExceptionMechanism(event, newMechanism) {
|
|
1743
|
+
var firstException = getFirstException(event);
|
|
1744
|
+
if (!firstException) {
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1747
|
+
var defaultMechanism = { type: 'generic', handled: true };
|
|
1748
|
+
var currentMechanism = firstException.mechanism;
|
|
1749
|
+
firstException.mechanism = __assign(__assign(__assign({}, defaultMechanism), currentMechanism), newMechanism);
|
|
1750
|
+
if (newMechanism && 'data' in newMechanism) {
|
|
1751
|
+
var mergedData = __assign(__assign({}, (currentMechanism && currentMechanism.data)), newMechanism.data);
|
|
1752
|
+
firstException.mechanism.data = mergedData;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
/**
|
|
1756
|
+
* Checks whether or not we've already captured the given exception (note: not an identical exception - the very object
|
|
1757
|
+
* in question), and marks it captured if not.
|
|
1758
|
+
*
|
|
1759
|
+
* This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and
|
|
1760
|
+
* record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so
|
|
1761
|
+
* that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because
|
|
1762
|
+
* the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not
|
|
1763
|
+
* caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This
|
|
1764
|
+
* function helps us ensure that even if we encounter the same error more than once, we only record it the first time we
|
|
1765
|
+
* see it.
|
|
1766
|
+
*
|
|
1767
|
+
* Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on
|
|
1768
|
+
* them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent
|
|
1769
|
+
* object wrapper forms so that this check will always work. However, because we need to flag the exact object which
|
|
1770
|
+
* will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification
|
|
1771
|
+
* must be done before the exception captured.
|
|
1772
|
+
*
|
|
1773
|
+
* @param A thrown exception to check or flag as having been seen
|
|
1774
|
+
* @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)
|
|
1775
|
+
*/
|
|
1776
|
+
function checkOrSetAlreadyCaught(exception) {
|
|
1777
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1778
|
+
if (exception && exception.__sentry_captured__) {
|
|
1779
|
+
return true;
|
|
1780
|
+
}
|
|
1781
|
+
try {
|
|
1782
|
+
// set it this way rather than by assignment so that it's not ennumerable and therefore isn't recorded by the
|
|
1783
|
+
// `ExtraErrorData` integration
|
|
1784
|
+
addNonEnumerableProperty(exception, '__sentry_captured__', true);
|
|
1785
|
+
}
|
|
1786
|
+
catch (err) {
|
|
1787
|
+
// `exception` is a primitive, so we can't mark it seen
|
|
1788
|
+
}
|
|
1789
|
+
return false;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
/**
|
|
1793
|
+
* Recursively normalizes the given object.
|
|
1794
|
+
*
|
|
1795
|
+
* - Creates a copy to prevent original input mutation
|
|
1796
|
+
* - Skips non-enumerable properties
|
|
1797
|
+
* - When stringifying, calls `toJSON` if implemented
|
|
1798
|
+
* - Removes circular references
|
|
1799
|
+
* - Translates non-serializable values (`undefined`/`NaN`/functions) to serializable format
|
|
1800
|
+
* - Translates known global objects/classes to a string representations
|
|
1801
|
+
* - Takes care of `Error` object serialization
|
|
1802
|
+
* - Optionally limits depth of final output
|
|
1803
|
+
* - Optionally limits number of properties/elements included in any single object/array
|
|
1804
|
+
*
|
|
1805
|
+
* @param input The object to be normalized.
|
|
1806
|
+
* @param depth The max depth to which to normalize the object. (Anything deeper stringified whole.)
|
|
1807
|
+
* @param maxProperties The max number of elements or properties to be included in any single array or
|
|
1808
|
+
* object in the normallized output..
|
|
1809
|
+
* @returns A normalized version of the object, or `"**non-serializable**"` if any errors are thrown during normalization.
|
|
1810
|
+
*/
|
|
1811
|
+
function normalize(input, depth, maxProperties) {
|
|
1812
|
+
if (depth === void 0) { depth = +Infinity; }
|
|
1813
|
+
if (maxProperties === void 0) { maxProperties = +Infinity; }
|
|
1814
|
+
try {
|
|
1815
|
+
// since we're at the outermost level, there is no key
|
|
1816
|
+
return walk('', input, depth, maxProperties);
|
|
1817
|
+
}
|
|
1818
|
+
catch (_oO) {
|
|
1819
|
+
return '**non-serializable**';
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
/** JSDoc */
|
|
1823
|
+
function normalizeToSize(object,
|
|
1824
|
+
// Default Node.js REPL depth
|
|
1825
|
+
depth,
|
|
1826
|
+
// 100kB, as 200kB is max payload size, so half sounds reasonable
|
|
1827
|
+
maxSize) {
|
|
1828
|
+
if (depth === void 0) { depth = 3; }
|
|
1829
|
+
if (maxSize === void 0) { maxSize = 100 * 1024; }
|
|
1830
|
+
var serialized = normalize(object, depth);
|
|
1831
|
+
if (jsonSize(serialized) > maxSize) {
|
|
1832
|
+
return normalizeToSize(object, depth - 1, maxSize);
|
|
1833
|
+
}
|
|
1834
|
+
return serialized;
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Walks an object to perform a normalization on it
|
|
1838
|
+
*
|
|
1839
|
+
* @param key of object that's walked in current iteration
|
|
1840
|
+
* @param value object to be walked
|
|
1841
|
+
* @param depth Optional number indicating how deep should walking be performed
|
|
1842
|
+
* @param maxProperties Optional maximum number of properties/elements included in any single object/array
|
|
1843
|
+
* @param memo Optional Memo class handling decycling
|
|
1844
|
+
*/
|
|
1845
|
+
function walk(key, value, depth, maxProperties, memo) {
|
|
1846
|
+
if (depth === void 0) { depth = +Infinity; }
|
|
1847
|
+
if (maxProperties === void 0) { maxProperties = +Infinity; }
|
|
1848
|
+
if (memo === void 0) { memo = memoBuilder(); }
|
|
1849
|
+
var _a = __read(memo, 2), memoize = _a[0], unmemoize = _a[1];
|
|
1850
|
+
// If we reach the maximum depth, serialize whatever is left
|
|
1851
|
+
if (depth === 0) {
|
|
1852
|
+
return serializeValue(value);
|
|
1853
|
+
}
|
|
1854
|
+
// If value implements `toJSON` method, call it and return early
|
|
1855
|
+
if (value !== null && value !== undefined && typeof value.toJSON === 'function') {
|
|
1856
|
+
return value.toJSON();
|
|
1857
|
+
}
|
|
1858
|
+
// `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
|
|
1859
|
+
// pass-through. If what comes back is a primitive (either because it's been stringified or because it was primitive
|
|
1860
|
+
// all along), we're done.
|
|
1861
|
+
var serializable = makeSerializable(value, key);
|
|
1862
|
+
if (isPrimitive(serializable)) {
|
|
1863
|
+
return serializable;
|
|
1864
|
+
}
|
|
1865
|
+
// Create source that we will use for the next iteration. It will either be an objectified error object (`Error` type
|
|
1866
|
+
// with extracted key:value pairs) or the input itself.
|
|
1867
|
+
var source = getWalkSource(value);
|
|
1868
|
+
// Create an accumulator that will act as a parent for all future itterations of that branch
|
|
1869
|
+
var acc = Array.isArray(value) ? [] : {};
|
|
1870
|
+
// If we already walked that branch, bail out, as it's circular reference
|
|
1871
|
+
if (memoize(value)) {
|
|
1872
|
+
return '[Circular ~]';
|
|
1873
|
+
}
|
|
1874
|
+
var propertyCount = 0;
|
|
1875
|
+
// Walk all keys of the source
|
|
1876
|
+
for (var innerKey in source) {
|
|
1877
|
+
// Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.
|
|
1878
|
+
if (!Object.prototype.hasOwnProperty.call(source, innerKey)) {
|
|
1879
|
+
continue;
|
|
1880
|
+
}
|
|
1881
|
+
if (propertyCount >= maxProperties) {
|
|
1882
|
+
acc[innerKey] = '[MaxProperties ~]';
|
|
1883
|
+
break;
|
|
1884
|
+
}
|
|
1885
|
+
propertyCount += 1;
|
|
1886
|
+
// Recursively walk through all the child nodes
|
|
1887
|
+
var innerValue = source[innerKey];
|
|
1888
|
+
acc[innerKey] = walk(innerKey, innerValue, depth - 1, maxProperties, memo);
|
|
1920
1889
|
}
|
|
1890
|
+
// Once walked through all the branches, remove the parent from memo storage
|
|
1891
|
+
unmemoize(value);
|
|
1892
|
+
// Return accumulated values
|
|
1893
|
+
return acc;
|
|
1921
1894
|
}
|
|
1922
1895
|
/**
|
|
1923
|
-
*
|
|
1896
|
+
* Transform any non-primitive, BigInt, or Symbol-type value into a string. Acts as a no-op on strings, numbers,
|
|
1897
|
+
* booleans, null, and undefined.
|
|
1924
1898
|
*
|
|
1925
|
-
* @param
|
|
1926
|
-
* @
|
|
1927
|
-
*
|
|
1899
|
+
* @param value The value to stringify
|
|
1900
|
+
* @returns For non-primitive, BigInt, and Symbol-type values, a string denoting the value's type, type and value, or
|
|
1901
|
+
* type and `description` property, respectively. For non-BigInt, non-Symbol primitives, returns the original value,
|
|
1902
|
+
* unchanged.
|
|
1928
1903
|
*/
|
|
1929
|
-
function
|
|
1930
|
-
|
|
1931
|
-
if (
|
|
1932
|
-
return;
|
|
1904
|
+
function serializeValue(value) {
|
|
1905
|
+
// Node.js REPL notation
|
|
1906
|
+
if (typeof value === 'string') {
|
|
1907
|
+
return value;
|
|
1933
1908
|
}
|
|
1934
|
-
var
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1909
|
+
var type = Object.prototype.toString.call(value);
|
|
1910
|
+
if (type === '[object Object]') {
|
|
1911
|
+
return '[Object]';
|
|
1912
|
+
}
|
|
1913
|
+
if (type === '[object Array]') {
|
|
1914
|
+
return '[Array]';
|
|
1940
1915
|
}
|
|
1916
|
+
// `makeSerializable` provides a string representation of certain non-serializable values. For all others, it's a
|
|
1917
|
+
// pass-through.
|
|
1918
|
+
var serializable = makeSerializable(value);
|
|
1919
|
+
return isPrimitive(serializable) ? serializable : type;
|
|
1941
1920
|
}
|
|
1942
1921
|
/**
|
|
1943
|
-
*
|
|
1944
|
-
* in question), and marks it captured if not.
|
|
1945
|
-
*
|
|
1946
|
-
* This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and
|
|
1947
|
-
* record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so
|
|
1948
|
-
* that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because
|
|
1949
|
-
* the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not
|
|
1950
|
-
* caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This
|
|
1951
|
-
* function helps us ensure that even if we encounter the same error more than once, we only record it the first time we
|
|
1952
|
-
* see it.
|
|
1922
|
+
* makeSerializable()
|
|
1953
1923
|
*
|
|
1954
|
-
*
|
|
1955
|
-
* them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent
|
|
1956
|
-
* object wrapper forms so that this check will always work. However, because we need to flag the exact object which
|
|
1957
|
-
* will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification
|
|
1958
|
-
* must be done before the exception captured.
|
|
1924
|
+
* Takes unserializable input and make it serializer-friendly.
|
|
1959
1925
|
*
|
|
1960
|
-
*
|
|
1961
|
-
* @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)
|
|
1926
|
+
* Handles globals, functions, `undefined`, `NaN`, and other non-serializable values.
|
|
1962
1927
|
*/
|
|
1963
|
-
function
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
return true;
|
|
1928
|
+
function makeSerializable(value, key) {
|
|
1929
|
+
if (key === 'domain' && value && typeof value === 'object' && value._events) {
|
|
1930
|
+
return '[Domain]';
|
|
1967
1931
|
}
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
// `ExtraErrorData` integration
|
|
1971
|
-
addNonEnumerableProperty(exception, '__sentry_captured__', true);
|
|
1932
|
+
if (key === 'domainEmitter') {
|
|
1933
|
+
return '[DomainEmitter]';
|
|
1972
1934
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1935
|
+
if (typeof global !== 'undefined' && value === global) {
|
|
1936
|
+
return '[Global]';
|
|
1975
1937
|
}
|
|
1976
|
-
|
|
1938
|
+
// It's safe to use `window` and `document` here in this manner, as we are asserting using `typeof` first
|
|
1939
|
+
// which won't throw if they are not present.
|
|
1940
|
+
// eslint-disable-next-line no-restricted-globals
|
|
1941
|
+
if (typeof window !== 'undefined' && value === window) {
|
|
1942
|
+
return '[Window]';
|
|
1943
|
+
}
|
|
1944
|
+
// eslint-disable-next-line no-restricted-globals
|
|
1945
|
+
if (typeof document !== 'undefined' && value === document) {
|
|
1946
|
+
return '[Document]';
|
|
1947
|
+
}
|
|
1948
|
+
// React's SyntheticEvent thingy
|
|
1949
|
+
if (isSyntheticEvent(value)) {
|
|
1950
|
+
return '[SyntheticEvent]';
|
|
1951
|
+
}
|
|
1952
|
+
if (typeof value === 'number' && value !== value) {
|
|
1953
|
+
return '[NaN]';
|
|
1954
|
+
}
|
|
1955
|
+
if (value === void 0) {
|
|
1956
|
+
return '[undefined]';
|
|
1957
|
+
}
|
|
1958
|
+
if (typeof value === 'function') {
|
|
1959
|
+
return "[Function: " + getFunctionName(value) + "]";
|
|
1960
|
+
}
|
|
1961
|
+
// symbols and bigints are considered primitives by TS, but aren't natively JSON-serilaizable
|
|
1962
|
+
if (typeof value === 'symbol') {
|
|
1963
|
+
return "[" + String(value) + "]";
|
|
1964
|
+
}
|
|
1965
|
+
if (typeof value === 'bigint') {
|
|
1966
|
+
return "[BigInt: " + String(value) + "]";
|
|
1967
|
+
}
|
|
1968
|
+
return value;
|
|
1969
|
+
}
|
|
1970
|
+
/** Calculates bytes size of input string */
|
|
1971
|
+
function utf8Length(value) {
|
|
1972
|
+
// eslint-disable-next-line no-bitwise
|
|
1973
|
+
return ~-encodeURI(value).split(/%..|./).length;
|
|
1974
|
+
}
|
|
1975
|
+
/** Calculates bytes size of input object */
|
|
1976
|
+
function jsonSize(value) {
|
|
1977
|
+
return utf8Length(JSON.stringify(value));
|
|
1977
1978
|
}
|
|
1978
1979
|
|
|
1979
1980
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
@@ -4323,128 +4324,45 @@ var Sentry = (function (exports) {
|
|
|
4323
4324
|
},
|
|
4324
4325
|
originalException: reason,
|
|
4325
4326
|
});
|
|
4326
|
-
throw new SentryError("Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: " + reason);
|
|
4327
|
-
});
|
|
4328
|
-
};
|
|
4329
|
-
/**
|
|
4330
|
-
* Occupies the client with processing and event
|
|
4331
|
-
*/
|
|
4332
|
-
BaseClient.prototype._process = function (promise) {
|
|
4333
|
-
var _this = this;
|
|
4334
|
-
this._numProcessing += 1;
|
|
4335
|
-
void promise.then(function (value) {
|
|
4336
|
-
_this._numProcessing -= 1;
|
|
4337
|
-
return value;
|
|
4338
|
-
}, function (reason) {
|
|
4339
|
-
_this._numProcessing -= 1;
|
|
4340
|
-
return reason;
|
|
4341
|
-
});
|
|
4342
|
-
};
|
|
4343
|
-
return BaseClient;
|
|
4344
|
-
}());
|
|
4345
|
-
/**
|
|
4346
|
-
* Verifies that return value of configured `beforeSend` is of expected type.
|
|
4347
|
-
*/
|
|
4348
|
-
function _ensureBeforeSendRv(rv) {
|
|
4349
|
-
var nullErr = '`beforeSend` method has to return `null` or a valid event.';
|
|
4350
|
-
if (isThenable(rv)) {
|
|
4351
|
-
return rv.then(function (event) {
|
|
4352
|
-
if (!(isPlainObject(event) || event === null)) {
|
|
4353
|
-
throw new SentryError(nullErr);
|
|
4354
|
-
}
|
|
4355
|
-
return event;
|
|
4356
|
-
}, function (e) {
|
|
4357
|
-
throw new SentryError("beforeSend rejected with " + e);
|
|
4358
|
-
});
|
|
4359
|
-
}
|
|
4360
|
-
else if (!(isPlainObject(rv) || rv === null)) {
|
|
4361
|
-
throw new SentryError(nullErr);
|
|
4362
|
-
}
|
|
4363
|
-
return rv;
|
|
4364
|
-
}
|
|
4365
|
-
|
|
4366
|
-
/** Noop transport */
|
|
4367
|
-
var NoopTransport = /** @class */ (function () {
|
|
4368
|
-
function NoopTransport() {
|
|
4369
|
-
}
|
|
4370
|
-
/**
|
|
4371
|
-
* @inheritDoc
|
|
4372
|
-
*/
|
|
4373
|
-
NoopTransport.prototype.sendEvent = function (_) {
|
|
4374
|
-
return resolvedSyncPromise({
|
|
4375
|
-
reason: 'NoopTransport: Event has been skipped because no Dsn is configured.',
|
|
4376
|
-
status: 'skipped',
|
|
4377
|
-
});
|
|
4378
|
-
};
|
|
4379
|
-
/**
|
|
4380
|
-
* @inheritDoc
|
|
4381
|
-
*/
|
|
4382
|
-
NoopTransport.prototype.close = function (_) {
|
|
4383
|
-
return resolvedSyncPromise(true);
|
|
4384
|
-
};
|
|
4385
|
-
return NoopTransport;
|
|
4386
|
-
}());
|
|
4387
|
-
|
|
4388
|
-
/**
|
|
4389
|
-
* This is the base implemention of a Backend.
|
|
4390
|
-
* @hidden
|
|
4391
|
-
*/
|
|
4392
|
-
var BaseBackend = /** @class */ (function () {
|
|
4393
|
-
/** Creates a new backend instance. */
|
|
4394
|
-
function BaseBackend(options) {
|
|
4395
|
-
this._options = options;
|
|
4396
|
-
if (!this._options.dsn) {
|
|
4397
|
-
logger.warn('No DSN provided, backend will not do anything.');
|
|
4398
|
-
}
|
|
4399
|
-
this._transport = this._setupTransport();
|
|
4400
|
-
}
|
|
4401
|
-
/**
|
|
4402
|
-
* @inheritDoc
|
|
4403
|
-
*/
|
|
4404
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
4405
|
-
BaseBackend.prototype.eventFromException = function (_exception, _hint) {
|
|
4406
|
-
throw new SentryError('Backend has to implement `eventFromException` method');
|
|
4407
|
-
};
|
|
4408
|
-
/**
|
|
4409
|
-
* @inheritDoc
|
|
4410
|
-
*/
|
|
4411
|
-
BaseBackend.prototype.eventFromMessage = function (_message, _level, _hint) {
|
|
4412
|
-
throw new SentryError('Backend has to implement `eventFromMessage` method');
|
|
4413
|
-
};
|
|
4414
|
-
/**
|
|
4415
|
-
* @inheritDoc
|
|
4416
|
-
*/
|
|
4417
|
-
BaseBackend.prototype.sendEvent = function (event) {
|
|
4418
|
-
void this._transport.sendEvent(event).then(null, function (reason) {
|
|
4419
|
-
logger.error('Error while sending event:', reason);
|
|
4420
|
-
});
|
|
4421
|
-
};
|
|
4422
|
-
/**
|
|
4423
|
-
* @inheritDoc
|
|
4424
|
-
*/
|
|
4425
|
-
BaseBackend.prototype.sendSession = function (session) {
|
|
4426
|
-
if (!this._transport.sendSession) {
|
|
4427
|
-
logger.warn("Dropping session because custom transport doesn't implement sendSession");
|
|
4428
|
-
return;
|
|
4429
|
-
}
|
|
4430
|
-
void this._transport.sendSession(session).then(null, function (reason) {
|
|
4431
|
-
logger.error('Error while sending session:', reason);
|
|
4432
|
-
});
|
|
4433
|
-
};
|
|
4434
|
-
/**
|
|
4435
|
-
* @inheritDoc
|
|
4436
|
-
*/
|
|
4437
|
-
BaseBackend.prototype.getTransport = function () {
|
|
4438
|
-
return this._transport;
|
|
4327
|
+
throw new SentryError("Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: " + reason);
|
|
4328
|
+
});
|
|
4439
4329
|
};
|
|
4440
4330
|
/**
|
|
4441
|
-
*
|
|
4331
|
+
* Occupies the client with processing and event
|
|
4442
4332
|
*/
|
|
4443
|
-
|
|
4444
|
-
|
|
4333
|
+
BaseClient.prototype._process = function (promise) {
|
|
4334
|
+
var _this = this;
|
|
4335
|
+
this._numProcessing += 1;
|
|
4336
|
+
void promise.then(function (value) {
|
|
4337
|
+
_this._numProcessing -= 1;
|
|
4338
|
+
return value;
|
|
4339
|
+
}, function (reason) {
|
|
4340
|
+
_this._numProcessing -= 1;
|
|
4341
|
+
return reason;
|
|
4342
|
+
});
|
|
4445
4343
|
};
|
|
4446
|
-
return
|
|
4447
|
-
}());
|
|
4344
|
+
return BaseClient;
|
|
4345
|
+
}());
|
|
4346
|
+
/**
|
|
4347
|
+
* Verifies that return value of configured `beforeSend` is of expected type.
|
|
4348
|
+
*/
|
|
4349
|
+
function _ensureBeforeSendRv(rv) {
|
|
4350
|
+
var nullErr = '`beforeSend` method has to return `null` or a valid event.';
|
|
4351
|
+
if (isThenable(rv)) {
|
|
4352
|
+
return rv.then(function (event) {
|
|
4353
|
+
if (!(isPlainObject(event) || event === null)) {
|
|
4354
|
+
throw new SentryError(nullErr);
|
|
4355
|
+
}
|
|
4356
|
+
return event;
|
|
4357
|
+
}, function (e) {
|
|
4358
|
+
throw new SentryError("beforeSend rejected with " + e);
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4361
|
+
else if (!(isPlainObject(rv) || rv === null)) {
|
|
4362
|
+
throw new SentryError(nullErr);
|
|
4363
|
+
}
|
|
4364
|
+
return rv;
|
|
4365
|
+
}
|
|
4448
4366
|
|
|
4449
4367
|
/** Extract sdk info from from the API metadata */
|
|
4450
4368
|
function getSdkMetadataForEnvelopeHeader(api) {
|
|
@@ -4469,8 +4387,8 @@ var Sentry = (function (exports) {
|
|
|
4469
4387
|
event.sdk.packages = __spread((event.sdk.packages || []), (sdkInfo.packages || []));
|
|
4470
4388
|
return event;
|
|
4471
4389
|
}
|
|
4472
|
-
/** Creates
|
|
4473
|
-
function
|
|
4390
|
+
/** Creates an envelope from a Session */
|
|
4391
|
+
function createSessionEnvelope(session, api) {
|
|
4474
4392
|
var sdkInfo = getSdkMetadataForEnvelopeHeader(api);
|
|
4475
4393
|
var envelopeHeaders = __assign(__assign({ sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
|
|
4476
4394
|
// I know this is hacky but we don't want to add `sessions` to request type since it's never rate limited
|
|
@@ -4478,12 +4396,36 @@ var Sentry = (function (exports) {
|
|
|
4478
4396
|
// TODO (v7) Have to cast type because envelope items do not accept a `SentryRequestType`
|
|
4479
4397
|
var envelopeItem = [{ type: type }, session];
|
|
4480
4398
|
var envelope = createEnvelope(envelopeHeaders, [envelopeItem]);
|
|
4399
|
+
return [envelope, type];
|
|
4400
|
+
}
|
|
4401
|
+
/** Creates a SentryRequest from a Session. */
|
|
4402
|
+
function sessionToSentryRequest(session, api) {
|
|
4403
|
+
var _a = __read(createSessionEnvelope(session, api), 2), envelope = _a[0], type = _a[1];
|
|
4481
4404
|
return {
|
|
4482
4405
|
body: serializeEnvelope(envelope),
|
|
4483
4406
|
type: type,
|
|
4484
4407
|
url: getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel),
|
|
4485
4408
|
};
|
|
4486
4409
|
}
|
|
4410
|
+
/**
|
|
4411
|
+
* Create an Envelope from an event. Note that this is duplicated from below,
|
|
4412
|
+
* but on purpose as this will be refactored in v7.
|
|
4413
|
+
*/
|
|
4414
|
+
function createEventEnvelope(event, api) {
|
|
4415
|
+
var sdkInfo = getSdkMetadataForEnvelopeHeader(api);
|
|
4416
|
+
var eventType = event.type || 'event';
|
|
4417
|
+
var transactionSampling = (event.sdkProcessingMetadata || {}).transactionSampling;
|
|
4418
|
+
var _a = transactionSampling || {}, samplingMethod = _a.method, sampleRate = _a.rate;
|
|
4419
|
+
var envelopeHeaders = __assign(__assign({ event_id: event.event_id, sent_at: new Date().toISOString() }, (sdkInfo && { sdk: sdkInfo })), (!!api.tunnel && { dsn: dsnToString(api.dsn) }));
|
|
4420
|
+
var eventItem = [
|
|
4421
|
+
{
|
|
4422
|
+
type: eventType,
|
|
4423
|
+
sample_rates: [{ id: samplingMethod, rate: sampleRate }],
|
|
4424
|
+
},
|
|
4425
|
+
event,
|
|
4426
|
+
];
|
|
4427
|
+
return createEnvelope(envelopeHeaders, [eventItem]);
|
|
4428
|
+
}
|
|
4487
4429
|
/** Creates a SentryRequest from an event. */
|
|
4488
4430
|
function eventToSentryRequest(event, api) {
|
|
4489
4431
|
var sdkInfo = getSdkMetadataForEnvelopeHeader(api);
|
|
@@ -4571,6 +4513,115 @@ var Sentry = (function (exports) {
|
|
|
4571
4513
|
return req;
|
|
4572
4514
|
}
|
|
4573
4515
|
|
|
4516
|
+
/** Noop transport */
|
|
4517
|
+
var NoopTransport = /** @class */ (function () {
|
|
4518
|
+
function NoopTransport() {
|
|
4519
|
+
}
|
|
4520
|
+
/**
|
|
4521
|
+
* @inheritDoc
|
|
4522
|
+
*/
|
|
4523
|
+
NoopTransport.prototype.sendEvent = function (_) {
|
|
4524
|
+
return resolvedSyncPromise({
|
|
4525
|
+
reason: 'NoopTransport: Event has been skipped because no Dsn is configured.',
|
|
4526
|
+
status: 'skipped',
|
|
4527
|
+
});
|
|
4528
|
+
};
|
|
4529
|
+
/**
|
|
4530
|
+
* @inheritDoc
|
|
4531
|
+
*/
|
|
4532
|
+
NoopTransport.prototype.close = function (_) {
|
|
4533
|
+
return resolvedSyncPromise(true);
|
|
4534
|
+
};
|
|
4535
|
+
return NoopTransport;
|
|
4536
|
+
}());
|
|
4537
|
+
|
|
4538
|
+
/**
|
|
4539
|
+
* This is the base implemention of a Backend.
|
|
4540
|
+
* @hidden
|
|
4541
|
+
*/
|
|
4542
|
+
var BaseBackend = /** @class */ (function () {
|
|
4543
|
+
/** Creates a new backend instance. */
|
|
4544
|
+
function BaseBackend(options) {
|
|
4545
|
+
this._options = options;
|
|
4546
|
+
if (!this._options.dsn) {
|
|
4547
|
+
logger.warn('No DSN provided, backend will not do anything.');
|
|
4548
|
+
}
|
|
4549
|
+
this._transport = this._setupTransport();
|
|
4550
|
+
}
|
|
4551
|
+
/**
|
|
4552
|
+
* @inheritDoc
|
|
4553
|
+
*/
|
|
4554
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
4555
|
+
BaseBackend.prototype.eventFromException = function (_exception, _hint) {
|
|
4556
|
+
throw new SentryError('Backend has to implement `eventFromException` method');
|
|
4557
|
+
};
|
|
4558
|
+
/**
|
|
4559
|
+
* @inheritDoc
|
|
4560
|
+
*/
|
|
4561
|
+
BaseBackend.prototype.eventFromMessage = function (_message, _level, _hint) {
|
|
4562
|
+
throw new SentryError('Backend has to implement `eventFromMessage` method');
|
|
4563
|
+
};
|
|
4564
|
+
/**
|
|
4565
|
+
* @inheritDoc
|
|
4566
|
+
*/
|
|
4567
|
+
BaseBackend.prototype.sendEvent = function (event) {
|
|
4568
|
+
// TODO(v7): Remove the if-else
|
|
4569
|
+
if (this._newTransport &&
|
|
4570
|
+
this._options.dsn &&
|
|
4571
|
+
this._options._experiments &&
|
|
4572
|
+
this._options._experiments.newTransport) {
|
|
4573
|
+
var api = initAPIDetails(this._options.dsn, this._options._metadata, this._options.tunnel);
|
|
4574
|
+
var env = createEventEnvelope(event, api);
|
|
4575
|
+
void this._newTransport.send(env).then(null, function (reason) {
|
|
4576
|
+
logger.error('Error while sending event:', reason);
|
|
4577
|
+
});
|
|
4578
|
+
}
|
|
4579
|
+
else {
|
|
4580
|
+
void this._transport.sendEvent(event).then(null, function (reason) {
|
|
4581
|
+
logger.error('Error while sending event:', reason);
|
|
4582
|
+
});
|
|
4583
|
+
}
|
|
4584
|
+
};
|
|
4585
|
+
/**
|
|
4586
|
+
* @inheritDoc
|
|
4587
|
+
*/
|
|
4588
|
+
BaseBackend.prototype.sendSession = function (session) {
|
|
4589
|
+
if (!this._transport.sendSession) {
|
|
4590
|
+
logger.warn("Dropping session because custom transport doesn't implement sendSession");
|
|
4591
|
+
return;
|
|
4592
|
+
}
|
|
4593
|
+
// TODO(v7): Remove the if-else
|
|
4594
|
+
if (this._newTransport &&
|
|
4595
|
+
this._options.dsn &&
|
|
4596
|
+
this._options._experiments &&
|
|
4597
|
+
this._options._experiments.newTransport) {
|
|
4598
|
+
var api = initAPIDetails(this._options.dsn, this._options._metadata, this._options.tunnel);
|
|
4599
|
+
var _a = __read(createSessionEnvelope(session, api), 1), env = _a[0];
|
|
4600
|
+
void this._newTransport.send(env).then(null, function (reason) {
|
|
4601
|
+
logger.error('Error while sending session:', reason);
|
|
4602
|
+
});
|
|
4603
|
+
}
|
|
4604
|
+
else {
|
|
4605
|
+
void this._transport.sendSession(session).then(null, function (reason) {
|
|
4606
|
+
logger.error('Error while sending session:', reason);
|
|
4607
|
+
});
|
|
4608
|
+
}
|
|
4609
|
+
};
|
|
4610
|
+
/**
|
|
4611
|
+
* @inheritDoc
|
|
4612
|
+
*/
|
|
4613
|
+
BaseBackend.prototype.getTransport = function () {
|
|
4614
|
+
return this._transport;
|
|
4615
|
+
};
|
|
4616
|
+
/**
|
|
4617
|
+
* Sets up the transport so it can be used later to send requests.
|
|
4618
|
+
*/
|
|
4619
|
+
BaseBackend.prototype._setupTransport = function () {
|
|
4620
|
+
return new NoopTransport();
|
|
4621
|
+
};
|
|
4622
|
+
return BaseBackend;
|
|
4623
|
+
}());
|
|
4624
|
+
|
|
4574
4625
|
/**
|
|
4575
4626
|
* Internal function to create a new SDK client instance. The client is
|
|
4576
4627
|
* installed and then bound to the current scope.
|
|
@@ -4593,7 +4644,7 @@ var Sentry = (function (exports) {
|
|
|
4593
4644
|
hub.bindClient(client);
|
|
4594
4645
|
}
|
|
4595
4646
|
|
|
4596
|
-
var SDK_VERSION = '6.19.
|
|
4647
|
+
var SDK_VERSION = '6.19.2';
|
|
4597
4648
|
|
|
4598
4649
|
var originalFunctionToString;
|
|
4599
4650
|
/** Patch toString calls to return proper name for wrapped functions */
|
|
@@ -4643,158 +4694,139 @@ var Sentry = (function (exports) {
|
|
|
4643
4694
|
/**
|
|
4644
4695
|
* @inheritDoc
|
|
4645
4696
|
*/
|
|
4646
|
-
InboundFilters.prototype.setupOnce = function () {
|
|
4697
|
+
InboundFilters.prototype.setupOnce = function (addGlobalEventProcessor, getCurrentHub) {
|
|
4647
4698
|
addGlobalEventProcessor(function (event) {
|
|
4648
4699
|
var hub = getCurrentHub();
|
|
4649
|
-
if (
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
// This checks prevents most of the occurrences of the bug linked below:
|
|
4657
|
-
// https://github.com/getsentry/sentry-javascript/issues/2622
|
|
4658
|
-
// The bug is caused by multiple SDK instances, where one is minified and one is using non-mangled code.
|
|
4659
|
-
// Unfortunatelly we cannot fix it reliably (thus reserved property in rollup's terser config),
|
|
4660
|
-
// as we cannot force people using multiple instances in their apps to sync SDK versions.
|
|
4661
|
-
var options = typeof self._mergeOptions === 'function' ? self._mergeOptions(clientOptions) : {};
|
|
4662
|
-
if (typeof self._shouldDropEvent !== 'function') {
|
|
4663
|
-
return event;
|
|
4700
|
+
if (hub) {
|
|
4701
|
+
var self_1 = hub.getIntegration(InboundFilters);
|
|
4702
|
+
if (self_1) {
|
|
4703
|
+
var client = hub.getClient();
|
|
4704
|
+
var clientOptions = client ? client.getOptions() : {};
|
|
4705
|
+
var options = _mergeOptions(self_1._options, clientOptions);
|
|
4706
|
+
return _shouldDropEvent$1(event, options) ? null : event;
|
|
4664
4707
|
}
|
|
4665
|
-
return self._shouldDropEvent(event, options) ? null : event;
|
|
4666
4708
|
}
|
|
4667
4709
|
return event;
|
|
4668
4710
|
});
|
|
4669
4711
|
};
|
|
4670
|
-
/**
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4712
|
+
/**
|
|
4713
|
+
* @inheritDoc
|
|
4714
|
+
*/
|
|
4715
|
+
InboundFilters.id = 'InboundFilters';
|
|
4716
|
+
return InboundFilters;
|
|
4717
|
+
}());
|
|
4718
|
+
/** JSDoc */
|
|
4719
|
+
function _mergeOptions(internalOptions, clientOptions) {
|
|
4720
|
+
if (internalOptions === void 0) { internalOptions = {}; }
|
|
4721
|
+
if (clientOptions === void 0) { clientOptions = {}; }
|
|
4722
|
+
return {
|
|
4723
|
+
allowUrls: __spread((internalOptions.whitelistUrls || []), (internalOptions.allowUrls || []), (clientOptions.whitelistUrls || []), (clientOptions.allowUrls || [])),
|
|
4724
|
+
denyUrls: __spread((internalOptions.blacklistUrls || []), (internalOptions.denyUrls || []), (clientOptions.blacklistUrls || []), (clientOptions.denyUrls || [])),
|
|
4725
|
+
ignoreErrors: __spread((internalOptions.ignoreErrors || []), (clientOptions.ignoreErrors || []), DEFAULT_IGNORE_ERRORS),
|
|
4726
|
+
ignoreInternal: internalOptions.ignoreInternal !== undefined ? internalOptions.ignoreInternal : true,
|
|
4727
|
+
};
|
|
4728
|
+
}
|
|
4729
|
+
/** JSDoc */
|
|
4730
|
+
function _shouldDropEvent$1(event, options) {
|
|
4731
|
+
if (options.ignoreInternal && _isSentryError(event)) {
|
|
4732
|
+
logger.warn("Event dropped due to being internal Sentry Error.\nEvent: " + getEventDescription(event));
|
|
4733
|
+
return true;
|
|
4734
|
+
}
|
|
4735
|
+
if (_isIgnoredError(event, options.ignoreErrors)) {
|
|
4736
|
+
logger.warn("Event dropped due to being matched by `ignoreErrors` option.\nEvent: " + getEventDescription(event));
|
|
4737
|
+
return true;
|
|
4738
|
+
}
|
|
4739
|
+
if (_isDeniedUrl(event, options.denyUrls)) {
|
|
4740
|
+
logger.warn("Event dropped due to being matched by `denyUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + _getEventFilterUrl(event));
|
|
4741
|
+
return true;
|
|
4742
|
+
}
|
|
4743
|
+
if (!_isAllowedUrl(event, options.allowUrls)) {
|
|
4744
|
+
logger.warn("Event dropped due to not being matched by `allowUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + _getEventFilterUrl(event));
|
|
4745
|
+
return true;
|
|
4746
|
+
}
|
|
4747
|
+
return false;
|
|
4748
|
+
}
|
|
4749
|
+
function _isIgnoredError(event, ignoreErrors) {
|
|
4750
|
+
if (!ignoreErrors || !ignoreErrors.length) {
|
|
4751
|
+
return false;
|
|
4752
|
+
}
|
|
4753
|
+
return _getPossibleEventMessages(event).some(function (message) {
|
|
4754
|
+
return ignoreErrors.some(function (pattern) { return isMatchingPattern(message, pattern); });
|
|
4755
|
+
});
|
|
4756
|
+
}
|
|
4757
|
+
function _isDeniedUrl(event, denyUrls) {
|
|
4758
|
+
// TODO: Use Glob instead?
|
|
4759
|
+
if (!denyUrls || !denyUrls.length) {
|
|
4760
|
+
return false;
|
|
4761
|
+
}
|
|
4762
|
+
var url = _getEventFilterUrl(event);
|
|
4763
|
+
return !url ? false : denyUrls.some(function (pattern) { return isMatchingPattern(url, pattern); });
|
|
4764
|
+
}
|
|
4765
|
+
function _isAllowedUrl(event, allowUrls) {
|
|
4766
|
+
// TODO: Use Glob instead?
|
|
4767
|
+
if (!allowUrls || !allowUrls.length) {
|
|
4768
|
+
return true;
|
|
4769
|
+
}
|
|
4770
|
+
var url = _getEventFilterUrl(event);
|
|
4771
|
+
return !url ? true : allowUrls.some(function (pattern) { return isMatchingPattern(url, pattern); });
|
|
4772
|
+
}
|
|
4773
|
+
function _getPossibleEventMessages(event) {
|
|
4774
|
+
if (event.message) {
|
|
4775
|
+
return [event.message];
|
|
4776
|
+
}
|
|
4777
|
+
if (event.exception) {
|
|
4778
|
+
try {
|
|
4779
|
+
var _a = (event.exception.values && event.exception.values[0]) || {}, _b = _a.type, type = _b === void 0 ? '' : _b, _c = _a.value, value = _c === void 0 ? '' : _c;
|
|
4780
|
+
return ["" + value, type + ": " + value];
|
|
4679
4781
|
}
|
|
4680
|
-
|
|
4681
|
-
logger.
|
|
4682
|
-
return
|
|
4782
|
+
catch (oO) {
|
|
4783
|
+
logger.error("Cannot extract message for event " + getEventDescription(event));
|
|
4784
|
+
return [];
|
|
4683
4785
|
}
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4786
|
+
}
|
|
4787
|
+
return [];
|
|
4788
|
+
}
|
|
4789
|
+
function _isSentryError(event) {
|
|
4790
|
+
try {
|
|
4791
|
+
// @ts-ignore can't be a sentry error if undefined
|
|
4792
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
4793
|
+
return event.exception.values[0].type === 'SentryError';
|
|
4794
|
+
}
|
|
4795
|
+
catch (e) {
|
|
4796
|
+
// ignore
|
|
4797
|
+
}
|
|
4798
|
+
return false;
|
|
4799
|
+
}
|
|
4800
|
+
function _getLastValidUrl(frames) {
|
|
4801
|
+
if (frames === void 0) { frames = []; }
|
|
4802
|
+
for (var i = frames.length - 1; i >= 0; i--) {
|
|
4803
|
+
var frame = frames[i];
|
|
4804
|
+
if (frame && frame.filename !== '<anonymous>' && frame.filename !== '[native code]') {
|
|
4805
|
+
return frame.filename || null;
|
|
4687
4806
|
}
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4807
|
+
}
|
|
4808
|
+
return null;
|
|
4809
|
+
}
|
|
4810
|
+
function _getEventFilterUrl(event) {
|
|
4811
|
+
try {
|
|
4812
|
+
if (event.stacktrace) {
|
|
4813
|
+
return _getLastValidUrl(event.stacktrace.frames);
|
|
4694
4814
|
}
|
|
4815
|
+
var frames_1;
|
|
4695
4816
|
try {
|
|
4696
|
-
// @ts-ignore
|
|
4697
|
-
|
|
4698
|
-
return event.exception.values[0].type === 'SentryError';
|
|
4817
|
+
// @ts-ignore we only care about frames if the whole thing here is defined
|
|
4818
|
+
frames_1 = event.exception.values[0].stacktrace.frames;
|
|
4699
4819
|
}
|
|
4700
4820
|
catch (e) {
|
|
4701
4821
|
// ignore
|
|
4702
4822
|
}
|
|
4703
|
-
return
|
|
4704
|
-
}
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
if (!options.ignoreErrors || !options.ignoreErrors.length) {
|
|
4708
|
-
return false;
|
|
4709
|
-
}
|
|
4710
|
-
return this._getPossibleEventMessages(event).some(function (message) {
|
|
4711
|
-
// Not sure why TypeScript complains here...
|
|
4712
|
-
return options.ignoreErrors.some(function (pattern) { return isMatchingPattern(message, pattern); });
|
|
4713
|
-
});
|
|
4714
|
-
};
|
|
4715
|
-
/** JSDoc */
|
|
4716
|
-
InboundFilters.prototype._isDeniedUrl = function (event, options) {
|
|
4717
|
-
// TODO: Use Glob instead?
|
|
4718
|
-
if (!options.denyUrls || !options.denyUrls.length) {
|
|
4719
|
-
return false;
|
|
4720
|
-
}
|
|
4721
|
-
var url = this._getEventFilterUrl(event);
|
|
4722
|
-
return !url ? false : options.denyUrls.some(function (pattern) { return isMatchingPattern(url, pattern); });
|
|
4723
|
-
};
|
|
4724
|
-
/** JSDoc */
|
|
4725
|
-
InboundFilters.prototype._isAllowedUrl = function (event, options) {
|
|
4726
|
-
// TODO: Use Glob instead?
|
|
4727
|
-
if (!options.allowUrls || !options.allowUrls.length) {
|
|
4728
|
-
return true;
|
|
4729
|
-
}
|
|
4730
|
-
var url = this._getEventFilterUrl(event);
|
|
4731
|
-
return !url ? true : options.allowUrls.some(function (pattern) { return isMatchingPattern(url, pattern); });
|
|
4732
|
-
};
|
|
4733
|
-
/** JSDoc */
|
|
4734
|
-
InboundFilters.prototype._mergeOptions = function (clientOptions) {
|
|
4735
|
-
if (clientOptions === void 0) { clientOptions = {}; }
|
|
4736
|
-
return {
|
|
4737
|
-
allowUrls: __spread((this._options.whitelistUrls || []), (this._options.allowUrls || []), (clientOptions.whitelistUrls || []), (clientOptions.allowUrls || [])),
|
|
4738
|
-
denyUrls: __spread((this._options.blacklistUrls || []), (this._options.denyUrls || []), (clientOptions.blacklistUrls || []), (clientOptions.denyUrls || [])),
|
|
4739
|
-
ignoreErrors: __spread((this._options.ignoreErrors || []), (clientOptions.ignoreErrors || []), DEFAULT_IGNORE_ERRORS),
|
|
4740
|
-
ignoreInternal: typeof this._options.ignoreInternal !== 'undefined' ? this._options.ignoreInternal : true,
|
|
4741
|
-
};
|
|
4742
|
-
};
|
|
4743
|
-
/** JSDoc */
|
|
4744
|
-
InboundFilters.prototype._getPossibleEventMessages = function (event) {
|
|
4745
|
-
if (event.message) {
|
|
4746
|
-
return [event.message];
|
|
4747
|
-
}
|
|
4748
|
-
if (event.exception) {
|
|
4749
|
-
try {
|
|
4750
|
-
var _a = (event.exception.values && event.exception.values[0]) || {}, _b = _a.type, type = _b === void 0 ? '' : _b, _c = _a.value, value = _c === void 0 ? '' : _c;
|
|
4751
|
-
return ["" + value, type + ": " + value];
|
|
4752
|
-
}
|
|
4753
|
-
catch (oO) {
|
|
4754
|
-
logger.error("Cannot extract message for event " + getEventDescription(event));
|
|
4755
|
-
return [];
|
|
4756
|
-
}
|
|
4757
|
-
}
|
|
4758
|
-
return [];
|
|
4759
|
-
};
|
|
4760
|
-
/** JSDoc */
|
|
4761
|
-
InboundFilters.prototype._getLastValidUrl = function (frames) {
|
|
4762
|
-
if (frames === void 0) { frames = []; }
|
|
4763
|
-
for (var i = frames.length - 1; i >= 0; i--) {
|
|
4764
|
-
var frame = frames[i];
|
|
4765
|
-
if (frame && frame.filename !== '<anonymous>' && frame.filename !== '[native code]') {
|
|
4766
|
-
return frame.filename || null;
|
|
4767
|
-
}
|
|
4768
|
-
}
|
|
4823
|
+
return frames_1 ? _getLastValidUrl(frames_1) : null;
|
|
4824
|
+
}
|
|
4825
|
+
catch (oO) {
|
|
4826
|
+
logger.error("Cannot extract url for event " + getEventDescription(event));
|
|
4769
4827
|
return null;
|
|
4770
|
-
}
|
|
4771
|
-
|
|
4772
|
-
InboundFilters.prototype._getEventFilterUrl = function (event) {
|
|
4773
|
-
try {
|
|
4774
|
-
if (event.stacktrace) {
|
|
4775
|
-
return this._getLastValidUrl(event.stacktrace.frames);
|
|
4776
|
-
}
|
|
4777
|
-
var frames_1;
|
|
4778
|
-
try {
|
|
4779
|
-
// @ts-ignore we only care about frames if the whole thing here is defined
|
|
4780
|
-
frames_1 = event.exception.values[0].stacktrace.frames;
|
|
4781
|
-
}
|
|
4782
|
-
catch (e) {
|
|
4783
|
-
// ignore
|
|
4784
|
-
}
|
|
4785
|
-
return frames_1 ? this._getLastValidUrl(frames_1) : null;
|
|
4786
|
-
}
|
|
4787
|
-
catch (oO) {
|
|
4788
|
-
logger.error("Cannot extract url for event " + getEventDescription(event));
|
|
4789
|
-
return null;
|
|
4790
|
-
}
|
|
4791
|
-
};
|
|
4792
|
-
/**
|
|
4793
|
-
* @inheritDoc
|
|
4794
|
-
*/
|
|
4795
|
-
InboundFilters.id = 'InboundFilters';
|
|
4796
|
-
return InboundFilters;
|
|
4797
|
-
}());
|
|
4828
|
+
}
|
|
4829
|
+
}
|
|
4798
4830
|
|
|
4799
4831
|
var CoreIntegrations = /*#__PURE__*/Object.freeze({
|
|
4800
4832
|
__proto__: null,
|