@thisisagile/easy 10.10.2 → 10.10.5

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.
@@ -4,7 +4,6 @@ export * from './Log';
4
4
  export * from './Mapper';
5
5
  export * from './Promise';
6
6
  export * from './Property';
7
- export * from './Retry';
8
7
  export * from './State';
9
8
  export * from './Sentence';
10
9
  export * from './Traverse';
@@ -20,7 +20,6 @@ __exportStar(require("./Log"), exports);
20
20
  __exportStar(require("./Mapper"), exports);
21
21
  __exportStar(require("./Promise"), exports);
22
22
  __exportStar(require("./Property"), exports);
23
- __exportStar(require("./Retry"), exports);
24
23
  __exportStar(require("./State"), exports);
25
24
  __exportStar(require("./Sentence"), exports);
26
25
  __exportStar(require("./Traverse"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,uCAAqB;AACrB,wCAAsB;AACtB,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,6CAA2B;AAC3B,yCAAuB;AACvB,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,uCAAqB;AACrB,wCAAsB;AACtB,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,0CAAwB;AACxB,6CAA2B;AAC3B,6CAA2B;AAC3B,yCAAuB;AACvB,yCAAuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy",
3
- "version": "10.10.2",
3
+ "version": "10.10.5",
4
4
  "description": "Straightforward library for building domain-driven microservice architectures",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "devDependencies": {
34
- "@thisisagile/easy-test": "10.10.2",
34
+ "@thisisagile/easy-test": "10.10.5",
35
35
  "@types/form-urlencoded": "^4.4.0",
36
36
  "@types/jsonwebtoken": "^8.5.8",
37
37
  "@types/validator": "^13.7.2"
@@ -4,7 +4,6 @@ export * from './Log';
4
4
  export * from './Mapper';
5
5
  export * from './Promise';
6
6
  export * from './Property';
7
- export * from './Retry';
8
7
  export * from './State';
9
8
  export * from './Sentence';
10
9
  export * from './Traverse';
@@ -1,10 +0,0 @@
1
- import { ErrorOrigin } from '../types';
2
- export declare class Retry<T = any> {
3
- readonly subject: () => Promise<T>;
4
- readonly times: number;
5
- readonly interval: number;
6
- readonly prevError?: ErrorOrigin | undefined;
7
- constructor(subject: () => Promise<T>, times?: number, interval?: number, prevError?: ErrorOrigin | undefined);
8
- run: () => Promise<T>;
9
- }
10
- export declare const retry: <T>(subject: () => Promise<T>, times?: number | undefined, interval?: number | undefined, prevError?: ErrorOrigin | undefined) => Promise<T>;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.retry = exports.Retry = void 0;
4
- const types_1 = require("../types");
5
- const validation_1 = require("../validation");
6
- const Wait_1 = require("./Wait");
7
- class Retry {
8
- constructor(subject, times = 3, interval = 1000, prevError) {
9
- this.subject = subject;
10
- this.times = times;
11
- this.interval = interval;
12
- this.prevError = prevError;
13
- this.run = () => (0, validation_1.when)(this.times)
14
- .not.isTrue.reject(this.prevError ?? types_1.Exception.CouldNotExecute)
15
- .then(() => this.subject().catch(async (e) => {
16
- await (0, Wait_1.wait)(this.interval);
17
- return (0, exports.retry)(this.subject, this.times - 1, this.interval, e);
18
- }));
19
- }
20
- }
21
- exports.Retry = Retry;
22
- const retry = (subject, times, interval, prevError) => new Retry(subject, times, interval, prevError).run();
23
- exports.retry = retry;
24
- //# sourceMappingURL=Retry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Retry.js","sourceRoot":"","sources":["../../src/utils/Retry.ts"],"names":[],"mappings":";;;AAAA,oCAAkD;AAClD,8CAAqC;AACrC,iCAA8B;AAE9B,MAAa,KAAK;IAChB,YAAqB,OAAyB,EAAW,QAAQ,CAAC,EAAW,WAAW,IAAI,EAAW,SAAuB;QAAzG,YAAO,GAAP,OAAO,CAAkB;QAAW,UAAK,GAAL,KAAK,CAAI;QAAW,aAAQ,GAAR,QAAQ,CAAO;QAAW,cAAS,GAAT,SAAS,CAAc;QAE9H,QAAG,GAAG,GAAe,EAAE,CACrB,IAAA,iBAAI,EAAC,IAAI,CAAC,KAAK,CAAC;aACb,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,iBAAS,CAAC,eAAe,CAAC;aAC9D,IAAI,CAAC,GAAG,EAAE,CACT,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;YAC7B,MAAM,IAAA,WAAI,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC1B,OAAO,IAAA,aAAK,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CACH,CAAC;IAV2H,CAAC;CAWnI;AAZD,sBAYC;AAEM,MAAM,KAAK,GAAG,CAAI,OAAyB,EAAE,KAAc,EAAE,QAAiB,EAAE,SAAuB,EAAc,EAAE,CAC5H,IAAI,KAAK,CAAI,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;AAD7C,QAAA,KAAK,SACwC"}
@@ -1,20 +0,0 @@
1
- import { ErrorOrigin, Exception } from '../types';
2
- import { when } from '../validation';
3
- import { wait } from './Wait';
4
-
5
- export class Retry<T = any> {
6
- constructor(readonly subject: () => Promise<T>, readonly times = 3, readonly interval = 1000, readonly prevError?: ErrorOrigin) {}
7
-
8
- run = (): Promise<T> =>
9
- when(this.times)
10
- .not.isTrue.reject(this.prevError ?? Exception.CouldNotExecute)
11
- .then(() =>
12
- this.subject().catch(async e => {
13
- await wait(this.interval);
14
- return retry(this.subject, this.times - 1, this.interval, e);
15
- })
16
- );
17
- }
18
-
19
- export const retry = <T>(subject: () => Promise<T>, times?: number, interval?: number, prevError?: ErrorOrigin): Promise<T> =>
20
- new Retry<T>(subject, times, interval, prevError).run();