@creejs/commons-retrier 2.1.20 → 2.1.22

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": "@creejs/commons-retrier",
3
- "version": "2.1.20",
3
+ "version": "2.1.22",
4
4
  "description": "Common Utils About Task Retrying",
5
5
  "keywords": [
6
6
  "commons",
package/types/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  declare const _default: {
2
+ retry: (task: Function) => Retrier;
3
+ always: (task: Function) => Retrier;
4
+ forever: (task: Function) => Retrier;
2
5
  name: typeof import("./retrier-factory.js").name;
3
6
  infinite: typeof import("./retrier-factory.js").infinite;
4
7
  times: typeof import("./retrier-factory.js").times;
@@ -30,6 +33,9 @@ declare const _default: {
30
33
  MaxRetries: string;
31
34
  };
32
35
  RetrierFactory: {
36
+ retry: (task: Function) => Retrier;
37
+ always: (task: Function) => Retrier;
38
+ forever: (task: Function) => Retrier;
33
39
  name: typeof import("./retrier-factory.js").name;
34
40
  infinite: typeof import("./retrier-factory.js").infinite;
35
41
  times: typeof import("./retrier-factory.js").times;
@@ -51,8 +57,8 @@ declare const _default: {
51
57
  };
52
58
  export default _default;
53
59
  export * from "./retrier-factory.js";
54
- import Policy from './policy.js';
55
60
  import Retrier from './retrier.js';
61
+ import Policy from './policy.js';
56
62
  import Event from './event.js';
57
63
  import RetrierFactory from './retrier-factory.js';
58
64
  export { Policy, Retrier, Event, RetrierFactory };
@@ -1,4 +1,7 @@
1
1
  declare namespace _default {
2
+ export { retry };
3
+ export { always };
4
+ export { forever };
2
5
  export { name };
3
6
  export { infinite };
4
7
  export { times };
@@ -18,6 +21,24 @@ declare namespace _default {
18
21
  export { start };
19
22
  }
20
23
  export default _default;
24
+ /**
25
+ *
26
+ * @param {Function} task
27
+ * @returns {Retrier}
28
+ */
29
+ declare function retry(task: Function): Retrier;
30
+ /**
31
+ *
32
+ * @param {Function} task
33
+ * @returns {Retrier}
34
+ */
35
+ declare function always(task: Function): Retrier;
36
+ /**
37
+ *
38
+ * @param {Function} task
39
+ * @returns {Retrier}
40
+ */
41
+ declare function forever(task: Function): Retrier;
21
42
  /**
22
43
  * Creates a new Retrier instance with the specified name.
23
44
  * @param {string} name - The name to assign to the retrier.