@wandzai/utils 1.0.71-wandz-5005-abtest-analytics-1 → 1.0.71-wandz-5154-sentry-skip-errors-1
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/package.json +1 -1
- package/src/numeric.d.ts +0 -1
- package/src/numeric.js +1 -6
- package/src/numeric.js.map +1 -1
- package/src/sentry.d.ts +3 -0
- package/src/sentry.js +20 -0
- package/src/sentry.js.map +1 -0
package/package.json
CHANGED
package/src/numeric.d.ts
CHANGED
package/src/numeric.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getRandomFloatInclusive = exports.getRandomIntInclusive = void 0;
|
|
4
4
|
const getRandomIntInclusive = (minVal, maxVal) => {
|
|
5
5
|
const min = Math.ceil(minVal);
|
|
6
6
|
const max = Math.floor(maxVal);
|
|
@@ -11,9 +11,4 @@ const getRandomFloatInclusive = (minVal, maxVal) => {
|
|
|
11
11
|
return Number((Math.random() * (minVal - maxVal + 1) + minVal).toFixed(2));
|
|
12
12
|
};
|
|
13
13
|
exports.getRandomFloatInclusive = getRandomFloatInclusive;
|
|
14
|
-
const fractionToPercentageNumber = (value, decimal = 0) => {
|
|
15
|
-
const formattedValue = (value * 100).toFixed(decimal);
|
|
16
|
-
return parseFloat(formattedValue);
|
|
17
|
-
};
|
|
18
|
-
exports.fractionToPercentageNumber = fractionToPercentageNumber;
|
|
19
14
|
//# sourceMappingURL=numeric.js.map
|
package/src/numeric.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numeric.js","sourceRoot":"","sources":["../../../../libs/utils/src/numeric.ts"],"names":[],"mappings":";;;AAAO,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,EAAE;IACtE,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MA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,CAAC,CAAC;AAFW,QAAA,uBAAuB,2BAElC"}
|
package/src/sentry.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ISentrySkippedErrors } from '@wandzai/wandz-interfaces';
|
|
2
|
+
import { WandzRepos } from '@wandzai/common-interfaces';
|
|
3
|
+
export declare const shouldSkipSentryError: (err: unknown, sentrySkipErrors: ISentrySkippedErrors[], currentRoute: any, currentRepo: WandzRepos, componentName?: string) => boolean;
|
package/src/sentry.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldSkipSentryError = void 0;
|
|
4
|
+
const shouldSkipSentryError = (err, sentrySkipErrors, currentRoute, currentRepo, componentName) => {
|
|
5
|
+
if (!Array.isArray(sentrySkipErrors) || !(err instanceof Error))
|
|
6
|
+
return false;
|
|
7
|
+
const message = err.message;
|
|
8
|
+
return sentrySkipErrors.some((skippedError) => {
|
|
9
|
+
const originMatch = skippedError.origin === currentRepo;
|
|
10
|
+
const exactMatch = skippedError.errorExactText ? message === skippedError.errorExactText : false;
|
|
11
|
+
const containedMatch = skippedError.errorContainedText
|
|
12
|
+
? message.includes(skippedError.errorContainedText)
|
|
13
|
+
: false;
|
|
14
|
+
const componentMatch = skippedError.componentName ? skippedError.componentName === componentName : true;
|
|
15
|
+
const urlMatch = skippedError.url ? skippedError.url === currentRoute : true;
|
|
16
|
+
return originMatch && (exactMatch || containedMatch) && componentMatch && urlMatch;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
exports.shouldSkipSentryError = shouldSkipSentryError;
|
|
20
|
+
//# sourceMappingURL=sentry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.js","sourceRoot":"","sources":["../../../../libs/utils/src/sentry.ts"],"names":[],"mappings":";;;AAGO,MAAM,qBAAqB,GAAG,CAAC,GAAY,EAAE,gBAAwC,EAAE,YA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