@wandzai/utils 1.0.71-wandz-5154-sentry-skip-errors-1 → 1.0.71-wandz-5154-sentry-skip-errors-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandzai/utils",
3
- "version": "1.0.71-wandz-5154-sentry-skip-errors-1",
3
+ "version": "1.0.71-wandz-5154-sentry-skip-errors-3",
4
4
  "description": "Common used utilities library",
5
5
  "main": "src/index",
6
6
  "scripts": {
package/src/common.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare const upperCaseFirstCharOfEachWord: (str: string) => string;
11
11
  export declare const upperCaseFirstCharOfEachWordSplitBySpace: (str: string) => string;
12
12
  export declare const jsonToConsistentString: (jsonObj: any) => string;
13
13
  export declare const booleanStringToBoolean: (value: string) => value is "true";
14
- export declare const booleanStringToNumber: (value: string) => 1 | 0;
14
+ export declare const booleanStringToNumber: (value: string) => 0 | 1;
15
15
  export declare const normalizeSfResponseObjKeys: (obj: Record<string, any>) => {
16
16
  [k: string]: any;
17
17
  };
package/src/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from './schedule';
12
12
  export * from './cache';
13
13
  export * from './interactions';
14
14
  export * from './slack';
15
+ export * from './sentry';
package/src/index.js CHANGED
@@ -28,4 +28,5 @@ __exportStar(require("./schedule"), exports);
28
28
  __exportStar(require("./cache"), exports);
29
29
  __exportStar(require("./interactions"), exports);
30
30
  __exportStar(require("./slack"), exports);
31
+ __exportStar(require("./sentry"), exports);
31
32
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/utils/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AACvB,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,oDAAkC;AAClC,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B;AAC3B,0CAAwB;AACxB,iDAA+B;AAC/B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/utils/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB;AACvB,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,oDAAkC;AAClC,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B;AAC3B,0CAAwB;AACxB,iDAA+B;AAC/B,0CAAwB;AACxB,2CAAwB"}
package/src/sentry.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { ISentrySkippedErrors } from '@wandzai/wandz-interfaces';
2
2
  import { WandzRepos } from '@wandzai/common-interfaces';
3
- export declare const shouldSkipSentryError: (err: unknown, sentrySkipErrors: ISentrySkippedErrors[], currentRoute: any, currentRepo: WandzRepos, componentName?: string) => boolean;
3
+ export declare const shouldSkipSentryError: (err: unknown, sentrySkipErrors: ISentrySkippedErrors[], currentRoute: string, currentRepo: WandzRepos, componentName?: string, info?: string) => boolean;
package/src/sentry.js CHANGED
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shouldSkipSentryError = void 0;
4
- const shouldSkipSentryError = (err, sentrySkipErrors, currentRoute, currentRepo, componentName) => {
4
+ const shouldSkipSentryError = (err, sentrySkipErrors, currentRoute, currentRepo, componentName, info) => {
5
5
  if (!Array.isArray(sentrySkipErrors) || !(err instanceof Error))
6
6
  return false;
7
7
  const message = err.message;
8
8
  return sentrySkipErrors.some((skippedError) => {
9
9
  const originMatch = skippedError.origin === currentRepo;
10
- const exactMatch = skippedError.errorExactText ? message === skippedError.errorExactText : false;
11
- const containedMatch = skippedError.errorContainedText
10
+ const textExactMatch = skippedError.errorExactText ? message === skippedError.errorExactText : false;
11
+ const textContainedMatch = skippedError.errorContainedText
12
12
  ? message.includes(skippedError.errorContainedText)
13
13
  : false;
14
14
  const componentMatch = skippedError.componentName ? skippedError.componentName === componentName : true;
15
15
  const urlMatch = skippedError.url ? skippedError.url === currentRoute : true;
16
- return originMatch && (exactMatch || containedMatch) && componentMatch && urlMatch;
16
+ const infoMatch = skippedError.info ? skippedError.info === info : true;
17
+ return originMatch && (textExactMatch || textContainedMatch) && componentMatch && urlMatch && infoMatch;
17
18
  });
18
19
  };
19
20
  exports.shouldSkipSentryError = shouldSkipSentryError;
package/src/sentry.js.map CHANGED
@@ -1 +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,YAAY,EAAC,WAAuB,EAAE,aAAsB,EAAW,EAAE;IACrK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9E,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAE5B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE;QAC5C,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,KAAK,WAAW,CAAC;QAExD,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,KAAK,YAAY,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC;QAEjG,MAAM,cAAc,GAAG,YAAY,CAAC,kBAAkB;YACpD,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,kBAAkB,CAAC;YACnD,CAAC,CAAC,KAAK,CAAC;QAEV,MAAM,cAAc,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,KAAK,aAAa,CAAC,CAAC,C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