@celljs/retry 3.7.8 → 3.9.0

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.
Files changed (65) hide show
  1. package/esm/common/back-off/back-off-policy.d.ts +6 -0
  2. package/esm/common/back-off/back-off-policy.js +53 -0
  3. package/esm/common/back-off/back-off-policy.js.map +1 -0
  4. package/esm/common/back-off/back-off-protocol.d.ts +11 -0
  5. package/esm/common/back-off/back-off-protocol.js +2 -0
  6. package/esm/common/back-off/back-off-protocol.js.map +1 -0
  7. package/esm/common/back-off/index.d.ts +2 -0
  8. package/esm/common/back-off/index.js +3 -0
  9. package/esm/common/back-off/index.js.map +1 -0
  10. package/esm/common/error/index.d.ts +1 -0
  11. package/esm/common/error/index.js +2 -0
  12. package/esm/common/error/index.js.map +1 -0
  13. package/esm/common/error/retry-error.d.ts +3 -0
  14. package/esm/common/error/retry-error.js +4 -0
  15. package/esm/common/error/retry-error.js.map +1 -0
  16. package/esm/common/index.d.ts +4 -0
  17. package/esm/common/index.js +5 -0
  18. package/esm/common/index.js.map +1 -0
  19. package/esm/common/module.d.ts +3 -0
  20. package/esm/common/module.js +4 -0
  21. package/esm/common/module.js.map +1 -0
  22. package/esm/common/policy/index.d.ts +2 -0
  23. package/esm/common/policy/index.js +3 -0
  24. package/esm/common/policy/index.js.map +1 -0
  25. package/esm/common/policy/policy-protocol.d.ts +5 -0
  26. package/esm/common/policy/policy-protocol.js +2 -0
  27. package/esm/common/policy/policy-protocol.js.map +1 -0
  28. package/esm/common/policy/retry-policy.d.ts +5 -0
  29. package/esm/common/policy/retry-policy.js +46 -0
  30. package/esm/common/policy/retry-policy.js.map +1 -0
  31. package/esm/common/retry/index.d.ts +2 -0
  32. package/esm/common/retry/index.js +3 -0
  33. package/esm/common/retry/index.js.map +1 -0
  34. package/esm/common/retry/retry-operations.d.ts +14 -0
  35. package/esm/common/retry/retry-operations.js +91 -0
  36. package/esm/common/retry/retry-operations.js.map +1 -0
  37. package/esm/common/retry/retry-protocol.d.ts +122 -0
  38. package/esm/common/retry/retry-protocol.js +2 -0
  39. package/esm/common/retry/retry-protocol.js.map +1 -0
  40. package/esm/package.json +3 -0
  41. package/lib/common/back-off/back-off-policy.d.ts.map +1 -1
  42. package/lib/common/back-off/back-off-policy.js.map +1 -1
  43. package/lib/common/back-off/back-off-policy.spec.js +50 -16
  44. package/lib/common/back-off/back-off-policy.spec.js.map +1 -1
  45. package/lib/common/error/retry-error.js.map +1 -1
  46. package/lib/common/module.d.ts.map +1 -1
  47. package/lib/common/module.js.map +1 -1
  48. package/lib/common/policy/retry-policy.d.ts.map +1 -1
  49. package/lib/common/policy/retry-policy.js.map +1 -1
  50. package/lib/common/policy/retry-policy.spec.js +44 -10
  51. package/lib/common/policy/retry-policy.spec.js.map +1 -1
  52. package/lib/common/retry/retry-operations.d.ts.map +1 -1
  53. package/lib/common/retry/retry-operations.js.map +1 -1
  54. package/lib/common/retry/retry-operations.spec.d.ts.map +1 -1
  55. package/lib/common/retry/retry-operations.spec.js +18 -17
  56. package/lib/common/retry/retry-operations.spec.js.map +1 -1
  57. package/lib/package.spec.d.ts +1 -0
  58. package/lib/package.spec.js +5 -2
  59. package/lib/package.spec.js.map +1 -1
  60. package/package.json +55 -11
  61. package/src/common/back-off/back-off-policy.spec.ts +1 -0
  62. package/src/common/policy/retry-policy.spec.ts +1 -0
  63. package/src/common/retry/retry-operations.spec.ts +2 -1
  64. package/src/package.spec.ts +1 -0
  65. package/LICENSE +0 -21
@@ -0,0 +1,6 @@
1
+ import { BackOffContext, BackOffPolicy } from './back-off-protocol.js';
2
+ import { RetryContext } from '../retry/index.js';
3
+ export declare class DefaultBackOffPolicyImpl implements BackOffPolicy {
4
+ start(ctx: RetryContext): Promise<BackOffContext>;
5
+ backOff(ctx: BackOffContext): Promise<void>;
6
+ }
@@ -0,0 +1,53 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Component, timeout } from '@celljs/core';
8
+ import { BackOffPolicy } from './back-off-protocol.js';
9
+ let DefaultBackOffPolicyImpl = class DefaultBackOffPolicyImpl {
10
+ async start(ctx) {
11
+ const { backOffOptions } = ctx;
12
+ const delay = typeof (backOffOptions === null || backOffOptions === void 0 ? void 0 : backOffOptions.delay) === 'function' ? await backOffOptions.delay() : backOffOptions === null || backOffOptions === void 0 ? void 0 : backOffOptions.delay;
13
+ return {
14
+ delay: delay !== null && delay !== void 0 ? delay : 100,
15
+ startTime: Date.now(),
16
+ retryContext: ctx
17
+ };
18
+ }
19
+ async backOff(ctx) {
20
+ var _a;
21
+ const { retryContext, delay } = ctx;
22
+ const { backOffOptions } = retryContext;
23
+ if (!backOffOptions) {
24
+ return;
25
+ }
26
+ const minDelay = typeof backOffOptions.delay === 'function' ? await backOffOptions.delay() : ((_a = backOffOptions.delay) !== null && _a !== void 0 ? _a : 100);
27
+ const maxDelay = typeof backOffOptions.maxDelay === 'function' ? await backOffOptions.maxDelay() : backOffOptions.maxDelay;
28
+ const multiplier = backOffOptions === null || backOffOptions === void 0 ? void 0 : backOffOptions.multiplier;
29
+ const random = backOffOptions === null || backOffOptions === void 0 ? void 0 : backOffOptions.random;
30
+ let nextDelay = delay;
31
+ if (maxDelay) {
32
+ if (multiplier) {
33
+ if (random) {
34
+ nextDelay = Math.floor(nextDelay * (1 + Math.random() * (multiplier - 1)));
35
+ }
36
+ else {
37
+ nextDelay = nextDelay * multiplier;
38
+ }
39
+ }
40
+ else {
41
+ nextDelay = minDelay + Math.floor(Math.random() * (maxDelay - minDelay));
42
+ }
43
+ nextDelay = Math.min(maxDelay, nextDelay);
44
+ }
45
+ ctx.delay = nextDelay;
46
+ await timeout(nextDelay);
47
+ }
48
+ };
49
+ DefaultBackOffPolicyImpl = __decorate([
50
+ Component(BackOffPolicy)
51
+ ], DefaultBackOffPolicyImpl);
52
+ export { DefaultBackOffPolicyImpl };
53
+ //# sourceMappingURL=back-off-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"back-off-policy.js","sourceRoot":"","sources":["../../../src/common/back-off/back-off-policy.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAkB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI7D,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACjC,KAAK,CAAC,KAAK,CAAC,GAAiB;QACzB,MAAM,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC;QAC/B,MAAM,KAAK,GAAG,QAAO,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,CAAA,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,CAAC;QACjH,OAAO;YACH,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG;YACnB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,YAAY,EAAE,GAAG;SACpB,CAAC;IACN,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,GAAmB;;QAC7B,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;QACpC,MAAM,EAAE,cAAc,EAAE,GAAG,YAAY,CAAC;QACxC,IAAI,CAAC,cAAc,EAAE,CAAC;YAClB,OAAO;QACX,CAAC;QACD,MAAM,QAAQ,GAAG,OAAO,cAAc,CAAC,KAAK,KAAK,UAAU,CAAC,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import { RetryContext } from '../retry/retry-protocol.js';
2
+ export declare const BackOffPolicy: unique symbol;
3
+ export interface BackOffPolicy {
4
+ start(ctx: RetryContext): Promise<BackOffContext>;
5
+ backOff(ctx: BackOffContext): Promise<void>;
6
+ }
7
+ export interface BackOffContext {
8
+ delay: number;
9
+ startTime: number;
10
+ retryContext: RetryContext;
11
+ }
@@ -0,0 +1,2 @@
1
+ export const BackOffPolicy = Symbol('BackOffPolicy');
2
+ //# sourceMappingURL=back-off-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"back-off-protocol.js","sourceRoot":"","sources":["../../../src/common/back-off/back-off-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './back-off-protocol.js';
2
+ export * from './back-off-policy.js';
@@ -0,0 +1,3 @@
1
+ export * from './back-off-protocol.js';
2
+ export * from './back-off-policy.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/back-off/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './retry-error.js';
@@ -0,0 +1,2 @@
1
+ export * from './retry-error.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/error/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CustomError } from '@celljs/core';
2
+ export declare class RetryError extends CustomError {
3
+ }
@@ -0,0 +1,4 @@
1
+ import { CustomError } from '@celljs/core';
2
+ export class RetryError extends CustomError {
3
+ }
4
+ //# sourceMappingURL=retry-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-error.js","sourceRoot":"","sources":["../../../src/common/error/retry-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,OAAO,UAAW,SAAQ,WAAW;CAE1C"}
@@ -0,0 +1,4 @@
1
+ export * from './retry/index.js';
2
+ export * from './policy/index.js';
3
+ export * from './back-off/index.js';
4
+ export * from './error/index.js';
@@ -0,0 +1,5 @@
1
+ export * from './retry/index.js';
2
+ export * from './policy/index.js';
3
+ export * from './back-off/index.js';
4
+ export * from './error/index.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import './index.js';
2
+ declare const _default: import("inversify").interfaces.ContainerModule;
3
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { autoBind } from '@celljs/core';
2
+ import './index.js';
3
+ export default autoBind();
4
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/common/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,CAAC;AAEjB,eAAe,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './policy-protocol.js';
2
+ export * from './retry-policy.js';
@@ -0,0 +1,3 @@
1
+ export * from './policy-protocol.js';
2
+ export * from './retry-policy.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/policy/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { RetryContext } from '../retry/retry-protocol.js';
2
+ export declare const RetryPolicy: unique symbol;
3
+ export interface RetryPolicy {
4
+ canRetry(ctx: RetryContext): Promise<boolean>;
5
+ }
@@ -0,0 +1,2 @@
1
+ export const RetryPolicy = Symbol('RetryPolicy');
2
+ //# sourceMappingURL=policy-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-protocol.js","sourceRoot":"","sources":["../../../src/common/policy/policy-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { RetryContext } from '../retry/retry-protocol.js';
2
+ import { RetryPolicy } from './policy-protocol.js';
3
+ export declare class DefaultRetryPolicy implements RetryPolicy {
4
+ canRetry(ctx: RetryContext): Promise<boolean>;
5
+ }
@@ -0,0 +1,46 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Component } from '@celljs/core';
8
+ import { RetryPolicy } from './policy-protocol.js';
9
+ let DefaultRetryPolicy = class DefaultRetryPolicy {
10
+ async canRetry(ctx) {
11
+ const { startTime, timeout, maxAttempts, retryCount, lastError, retryErrors, notRetryErrors } = ctx;
12
+ if (timeout !== undefined && timeout < Date.now() - startTime) {
13
+ return false;
14
+ }
15
+ if (maxAttempts !== undefined && maxAttempts < retryCount) {
16
+ return false;
17
+ }
18
+ if (lastError) {
19
+ if (notRetryErrors.length) {
20
+ for (const item of notRetryErrors) {
21
+ if (lastError instanceof item) {
22
+ return false;
23
+ }
24
+ }
25
+ }
26
+ if (retryErrors.length) {
27
+ let includes = false;
28
+ for (const item of retryErrors) {
29
+ if (lastError instanceof item) {
30
+ includes = true;
31
+ break;
32
+ }
33
+ }
34
+ if (!includes) {
35
+ return false;
36
+ }
37
+ }
38
+ }
39
+ return true;
40
+ }
41
+ };
42
+ DefaultRetryPolicy = __decorate([
43
+ Component(RetryPolicy)
44
+ ], DefaultRetryPolicy);
45
+ export { DefaultRetryPolicy };
46
+ //# sourceMappingURL=retry-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-policy.js","sourceRoot":"","sources":["../../../src/common/policy/retry-policy.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGzC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAE3B,KAAK,CAAC,QAAQ,CAAC,GAAiB;QAC5B,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC;QACpG,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC;YAC5D,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;YACxD,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;gBACxB,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;oBAChC,IAAI,SAAS,YAAY,IAAI,EAAE,CAAC;wBAC5B,OAAO,KAAK,CAAC;oBACjB,CAAC;gBACL,CAAC;YACL,CAAC;YACD,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;gBACrB,IAAI,QAAQ,GAAG,KAAK,CAAC;gBACrB,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;oBAC7B,IAAI,SAAS,YAAY,IAAI,EAAE,CAAC;wBAC5B,QAAQ,GAAG,IAAI,CAAC;wBAChB,MAAM;oBACV,CAAC;gBACL,CAAC;gBACD,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACZ,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAjCY,kBAAkB;IAD9B,SAAS,CAAC,WAAW,CAAC;GACV,kBAAkB,CAiC9B"}
@@ -0,0 +1,2 @@
1
+ export * from './retry-protocol.js';
2
+ export * from './retry-operations.js';
@@ -0,0 +1,3 @@
1
+ export * from './retry-protocol.js';
2
+ export * from './retry-operations.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/retry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Logger } from '@celljs/core';
2
+ import { RecoveryCallback, RetryCallback, RetryContext, RetryOperations, RetryOptions } from './retry-protocol.js';
3
+ import { RetryError } from '../error/index.js';
4
+ import { BackOffPolicy } from '../back-off/back-off-protocol.js';
5
+ import { RetryPolicy } from '../policy/policy-protocol.js';
6
+ export declare class RetryOperationsImpl implements RetryOperations {
7
+ protected readonly retryPolicy: RetryPolicy;
8
+ protected readonly backOffPolicy: BackOffPolicy;
9
+ protected readonly logger: Logger;
10
+ protected initRetryContext(options: RetryOptions<any>): RetryContext;
11
+ protected handleRetryExhausted<T>(ctx: RetryContext, recoveryCallback?: RecoveryCallback<T>): Promise<T>;
12
+ protected wrapError(error?: Error): RetryError;
13
+ execute<T>(callback: RetryCallback<T>, options?: RetryOptions<T>): Promise<T>;
14
+ }
@@ -0,0 +1,91 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Autowired, Component, Logger } from '@celljs/core';
11
+ import { RetryOperations } from './retry-protocol.js';
12
+ import { RetryError } from '../error/index.js';
13
+ import { BackOffPolicy } from '../back-off/back-off-protocol.js';
14
+ import { RetryPolicy } from '../policy/policy-protocol.js';
15
+ let RetryOperationsImpl = class RetryOperationsImpl {
16
+ initRetryContext(options) {
17
+ var _a, _b;
18
+ return {
19
+ timeout: options.timeout,
20
+ maxAttempts: options.maxAttempts,
21
+ backOffOptions: options.backOffOptions,
22
+ rollbackError: options.rollbackError,
23
+ retryCount: 0,
24
+ lastError: undefined,
25
+ exhaustedOnly: options.exhaustedOnly,
26
+ startTime: Date.now(),
27
+ retryErrors: (_a = options.retryErrors) !== null && _a !== void 0 ? _a : [],
28
+ notRetryErrors: (_b = options.notRetryErrors) !== null && _b !== void 0 ? _b : []
29
+ };
30
+ }
31
+ async handleRetryExhausted(ctx, recoveryCallback) {
32
+ if (recoveryCallback && !ctx.noRecovery) {
33
+ try {
34
+ return recoveryCallback(ctx);
35
+ }
36
+ catch (error) {
37
+ throw this.wrapError(ctx.lastError);
38
+ }
39
+ }
40
+ throw this.wrapError(ctx.lastError);
41
+ }
42
+ wrapError(error) {
43
+ return new RetryError('Error occurred during retry: ' + (error === null || error === void 0 ? void 0 : error.message));
44
+ }
45
+ async execute(callback, options = {}) {
46
+ const retryContext = this.initRetryContext(options);
47
+ const backOffContext = await this.backOffPolicy.start(retryContext);
48
+ const retryPolicy = this.retryPolicy;
49
+ try {
50
+ while (await retryPolicy.canRetry(retryContext)) {
51
+ try {
52
+ return await callback(retryContext);
53
+ }
54
+ catch (error) {
55
+ retryContext.lastError = error;
56
+ retryContext.retryCount++;
57
+ if (await retryPolicy.canRetry(retryContext) && !retryContext.exhaustedOnly) {
58
+ await this.backOffPolicy.backOff(backOffContext);
59
+ }
60
+ this.logger.debug('Checking for rethrow: count=' + retryContext.retryCount);
61
+ if (retryContext.rollbackError && error instanceof retryContext.rollbackError) {
62
+ this.logger.debug('Rethrow in retry for policy: count=' + retryContext.retryCount);
63
+ throw error;
64
+ }
65
+ }
66
+ }
67
+ this.logger.debug('Retry failed last attempt: count=' + retryContext.retryCount);
68
+ return this.handleRetryExhausted(retryContext, options.recoveryCallback);
69
+ }
70
+ catch (error) {
71
+ throw this.wrapError(error);
72
+ }
73
+ }
74
+ };
75
+ __decorate([
76
+ Autowired(RetryPolicy),
77
+ __metadata("design:type", Object)
78
+ ], RetryOperationsImpl.prototype, "retryPolicy", void 0);
79
+ __decorate([
80
+ Autowired(BackOffPolicy),
81
+ __metadata("design:type", Object)
82
+ ], RetryOperationsImpl.prototype, "backOffPolicy", void 0);
83
+ __decorate([
84
+ Autowired(Logger),
85
+ __metadata("design:type", Object)
86
+ ], RetryOperationsImpl.prototype, "logger", void 0);
87
+ RetryOperationsImpl = __decorate([
88
+ Component(RetryOperations)
89
+ ], RetryOperationsImpl);
90
+ export { RetryOperationsImpl };
91
+ //# sourceMappingURL=retry-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-operations.js","sourceRoot":"","sources":["../../../src/common/retry/retry-operations.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAiD,eAAe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S,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACL,CAAC;CAEJ,CAAA;AAnEsB;IADlB,SAAS,CAAC,WAAW,CAAC;;wDACqB;AAGzB;IADlB,SAAS,CAAC,aAAa,CAAC;;0DACuB;AAG7B;IADlB,SAAS,CAAC,MAAM,CAAC;;mDACgB;AATzB,mBAAmB;IAD/B,SAAS,CAAC,eAAe,CAAC;GACd,mBAAmB,CAsE/B"}
@@ -0,0 +1,122 @@
1
+ import { CustomError } from '@celljs/core';
2
+ export declare const RetryOperations: unique symbol;
3
+ /**
4
+ * Represents the context for retrying an operation.
5
+ */
6
+ export interface RetryContext {
7
+ startTime: number;
8
+ maxAttempts?: number;
9
+ timeout?: number;
10
+ backOffOptions?: BackOffOptions;
11
+ rollbackError?: typeof CustomError;
12
+ retryCount: number;
13
+ lastError?: Error;
14
+ exhaustedOnly?: boolean;
15
+ noRecovery?: boolean;
16
+ retryErrors: (typeof CustomError)[];
17
+ notRetryErrors: (typeof CustomError)[];
18
+ }
19
+ export interface RetryCallback<T> {
20
+ (): Promise<T>;
21
+ }
22
+ export interface RetryCallback<T> {
23
+ (ctx: RetryContext): Promise<T>;
24
+ }
25
+ export interface RecoveryCallback<T> {
26
+ (ctx: RetryContext): Promise<T>;
27
+ }
28
+ export interface FixedBackoffOptions {
29
+ /**
30
+ * Set the back off period in milliseconds. Cannot be < 1. Default value is 1000ms.
31
+ */
32
+ period: number;
33
+ }
34
+ export interface BackOffOptions {
35
+ /**
36
+ * A canonical backoff period. Used as an initial value in the exponential case, and
37
+ * as a minimum value in the uniform case.
38
+ * The initial or canonical backoff period in milliseconds.
39
+ */
40
+ delay?: number | (() => Promise<number>);
41
+ /**
42
+ * If positive, then used as a multiplier for generating the next delay for backoff.
43
+ * A multiplier to use to calculate the next backoff delay.
44
+ */
45
+ multiplier?: number;
46
+ /**
47
+ * The maximum wait in milliseconds between retries. If less than {@link delay}
48
+ * then a default value is applied depending on the resulting policy.
49
+ * The maximum wait between retries in milliseconds.
50
+ */
51
+ maxDelay?: number | (() => Promise<number>);
52
+ /**
53
+ * In the exponential case ({@link multiplier} > 0) set this to true to have the
54
+ * backoff delays randomized, so that the maximum delay is multiplier times the
55
+ * previous delay and the distribution is uniform between the two values.
56
+ * The flag to signal randomization is required.
57
+ */
58
+ random?: boolean;
59
+ }
60
+ /**
61
+ * RetryOptions interface represents the options for retrying a task.
62
+ *
63
+ * @template T - The type of the recovery callback parameter.
64
+ * @property {RecoveryCallback<T>} recoveryCallback - The callback function to recover from an error.
65
+ * @property {typeof CustomError} rollbackError - The custom error class to rollback the operation.
66
+ * @property {number} maxAttempts - The maximum number of attempts to retry the task.
67
+ * @property {number} timeout - The timeout duration in milliseconds for each attempt.
68
+ * @property {boolean} exhaustedOnly - Indicates whether to retry only when all attempts are exhausted.
69
+ * @property {BackOffOptions} backOffOptions - The options for exponential backoff strategy.
70
+ * @property {(typeof CustomError)[]} retryErrors - The list of custom error classes to retry on.
71
+ * @property {(typeof CustomError)[]} notRetryErrors - The list of custom error classes to not retry on.
72
+ */
73
+ export interface RetryOptions<T = any> {
74
+ recoveryCallback?: RecoveryCallback<T>;
75
+ rollbackError?: typeof CustomError;
76
+ maxAttempts?: number;
77
+ timeout?: number;
78
+ exhaustedOnly?: boolean;
79
+ backOffOptions?: BackOffOptions;
80
+ retryErrors?: (typeof CustomError)[];
81
+ notRetryErrors?: (typeof CustomError)[];
82
+ }
83
+ /**
84
+ * RetryOperations interface represents the operations for retrying a task with different options.
85
+ */
86
+ export interface RetryOperations {
87
+ /**
88
+ * Execute the callback function with the given options.
89
+ *
90
+ * @template T - The type of the return value of the callback function.
91
+ * @param {RetryCallback<T>} callback - The callback function to execute.
92
+ * @param {RetryOptions<T>} options - The options for retrying the task.
93
+ * @returns {Promise<T>} - The result of the callback function
94
+ * @throws {RetryError} - If an error occurred during retry.
95
+ * @example
96
+ * const result = await retryOperations.execute(async () => {
97
+ * // do something
98
+ * }, { maxAttempts: 3, timeout: 1000 });
99
+ * console.log(result);
100
+ * @example
101
+ * const result = await retryOperations.execute(async () => {
102
+ * // do something
103
+ * }, { maxAttempts: 3, timeout: 1000, backOffOptions: { delay: 1000 } });
104
+ * console.log(result);
105
+ * @example
106
+ * const result = await retryOperations.execute(async () => {
107
+ * // do something
108
+ * }, { maxAttempts: 3, timeout: 1000, backOffOptions: { delay: 1000, multiplier: 2 } });
109
+ * console.log(result);
110
+ * @example
111
+ * const result = await retryOperations.execute(async () => {
112
+ * // do something
113
+ * }, { maxAttempts: 3, timeout: 1000, backOffOptions: { delay: 1000, multiplier: 2, random: true } });
114
+ * console.log(result);
115
+ * @example
116
+ * const result = await retryOperations.execute(async () => {
117
+ * // do something
118
+ * }, { maxAttempts: 3, timeout: 1000, backOffOptions: { delay: 1000, multiplier: 2, random: true, maxDelay: 5000 } });
119
+ * console.log(result);
120
+ */
121
+ execute<T>(callback: RetryCallback<T>, options?: RetryOptions<T>): Promise<T>;
122
+ }
@@ -0,0 +1,2 @@
1
+ export const RetryOperations = Symbol('RetryOperations');
2
+ //# sourceMappingURL=retry-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-protocol.js","sourceRoot":"","sources":["../../../src/common/retry/retry-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"back-off-policy.d.ts","sourceRoot":"","sources":["../../../src/common/back-off/back-off-policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBACa,wBAAyB,YAAW,aAAa;IACpD,KAAK,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IASjD,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA2BpD"}
1
+ {"version":3,"file":"back-off-policy.d.ts","sourceRoot":"","sources":["../../../src/common/back-off/back-off-policy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBACa,wBAAyB,YAAW,aAAa;IACpD,KAAK,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAQtD;IACK,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBhD;CAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"back-off-policy.js","sourceRoot":"","sources":["../../../src/common/back-off/back-off-policy.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAkD;AAClD,2DAAoE;AAI7D,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACjC,KAAK,CAAC,KAAK,CAAC,GAAiB;QACzB,MAAM,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,CAAA,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,KAAK,CAAC;QACjH,OAAO;YACH,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,GAAG;YACnB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,YAAY,EAAE,GAAG;SACpB,CAAC;IACN,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,GAAmB;;QAC7B,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;QACpC,MAAM,EAAE,cAAc,EAAE,GAAG,YAAY,CAAC;QACxC,IAAI,CAAC,cAAc,EAA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