@creejs/commons-retrier 2.0.2 → 2.1.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.
- package/package.json +4 -5
- package/types/alway-task.d.ts +2 -2
- package/types/index.d.ts +4 -4
- package/types/policy/factor-increase-policy.d.ts +2 -2
- package/types/policy/fixed-increase-policy.d.ts +2 -2
- package/types/policy/fixed-interval-policy.d.ts +2 -2
- package/types/policy/shuttle-policy.d.ts +2 -2
- package/types/policy.d.ts +1 -1
- package/types/retrier-factory.d.ts +1 -1
- package/types/retrier.d.ts +8 -8
- package/types/task.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creejs/commons-retrier",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Common Utils About Task Retrying",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commons",
|
|
@@ -48,17 +48,16 @@
|
|
|
48
48
|
"url": "git+https://github.com/frameworkee/commons.git"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
|
-
"dts": "tsc",
|
|
51
|
+
"dts": "npx tsc",
|
|
52
52
|
"generate-docs": "../../node_modules/.bin/jsdoc -c ./jsdoc.json",
|
|
53
53
|
"clean": "rm -rf dist && rm -rf types",
|
|
54
54
|
"build": "npm run clean && npm run dts && rollup -c",
|
|
55
|
-
"prepublishOnly": "npm run build",
|
|
56
55
|
"publish": "npm publish"
|
|
57
56
|
},
|
|
58
57
|
"author": "rodney.vin@gmail.com",
|
|
59
58
|
"license": "Apache-2.0",
|
|
60
59
|
"dependencies": {
|
|
61
|
-
"@creejs/commons-events": "^2.0
|
|
62
|
-
"@creejs/commons-lang": "^2.0
|
|
60
|
+
"@creejs/commons-events": "^2.1.0",
|
|
61
|
+
"@creejs/commons-lang": "^2.1.0"
|
|
63
62
|
}
|
|
64
63
|
}
|
package/types/alway-task.d.ts
CHANGED
|
@@ -26,5 +26,5 @@ export default class AlwaysTask extends Task {
|
|
|
26
26
|
execute(retries: number, latence: number, nextInterval: number): Promise<any>;
|
|
27
27
|
}
|
|
28
28
|
export { AlwaysTask as AlwaysTaskType };
|
|
29
|
-
export type Retrier = import(
|
|
30
|
-
import Task from
|
|
29
|
+
export type Retrier = import("./retrier.js").default;
|
|
30
|
+
import Task from './task.js';
|
package/types/index.d.ts
CHANGED
|
@@ -45,8 +45,8 @@ declare const _default: {
|
|
|
45
45
|
};
|
|
46
46
|
export default _default;
|
|
47
47
|
export * from "./retrier-factory.js";
|
|
48
|
-
import Policy from
|
|
49
|
-
import Retrier from
|
|
50
|
-
import Event from
|
|
51
|
-
import RetrierFactory from
|
|
48
|
+
import Policy from './policy.js';
|
|
49
|
+
import Retrier from './retrier.js';
|
|
50
|
+
import Event from './event.js';
|
|
51
|
+
import RetrierFactory from './retrier-factory.js';
|
|
52
52
|
export { Policy, Retrier, Event, RetrierFactory };
|
|
@@ -5,8 +5,8 @@ export default class FactoreIncreasePolicy extends Policy {
|
|
|
5
5
|
*/
|
|
6
6
|
constructor(factor: number);
|
|
7
7
|
_factor: number;
|
|
8
|
-
set factor(
|
|
8
|
+
set factor(factor: number);
|
|
9
9
|
get factor(): number;
|
|
10
10
|
}
|
|
11
11
|
export { FactoreIncreasePolicy as FactoreIncreasePolicyType };
|
|
12
|
-
import Policy from
|
|
12
|
+
import Policy from '../policy.js';
|
|
@@ -5,8 +5,8 @@ export default class FixedIncreasePolicy extends Policy {
|
|
|
5
5
|
*/
|
|
6
6
|
constructor(increasement: number);
|
|
7
7
|
_increasement: number;
|
|
8
|
-
set increasement(
|
|
8
|
+
set increasement(increasement: number);
|
|
9
9
|
get increasement(): number;
|
|
10
10
|
}
|
|
11
11
|
export { FixedIncreasePolicy as FixedIncreasePolicyType };
|
|
12
|
-
import Policy from
|
|
12
|
+
import Policy from '../policy.js';
|
|
@@ -5,8 +5,8 @@ export default class FixedIntervalPolicy extends Policy {
|
|
|
5
5
|
*/
|
|
6
6
|
constructor(interval: number);
|
|
7
7
|
_interval: number;
|
|
8
|
-
set interval(
|
|
8
|
+
set interval(interval: number);
|
|
9
9
|
get interval(): number;
|
|
10
10
|
}
|
|
11
11
|
export { FixedIntervalPolicy as FixedIntervalPolicyType };
|
|
12
|
-
import Policy from
|
|
12
|
+
import Policy from '../policy.js';
|
|
@@ -6,8 +6,8 @@ export default class ShuttlePolicy extends Policy {
|
|
|
6
6
|
constructor(stepLength: number);
|
|
7
7
|
_stepLength: number;
|
|
8
8
|
increasement: number;
|
|
9
|
-
set stepLength(
|
|
9
|
+
set stepLength(stepLength: number);
|
|
10
10
|
get stepLength(): number;
|
|
11
11
|
}
|
|
12
12
|
export { ShuttlePolicy as ShuttlePolicyType };
|
|
13
|
-
import Policy from
|
|
13
|
+
import Policy from '../policy.js';
|
package/types/policy.d.ts
CHANGED
|
@@ -99,4 +99,4 @@ export function taskTimeout(timeout: number): Retrier;
|
|
|
99
99
|
* @returns {Promise<*>} A promise that resolves when the retry process completes.
|
|
100
100
|
*/
|
|
101
101
|
export function start(task: Function): Promise<any>;
|
|
102
|
-
import Retrier from
|
|
102
|
+
import Retrier from './retrier.js';
|
package/types/retrier.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export default class Retrier {
|
|
|
6
6
|
* Creates a new Retrier instance with a fixed interval policy.
|
|
7
7
|
* @param {number} [fixedInterval=1000] - The fixed interval in milliseconds between retry attempts. Defaults to 1000ms if not provided.
|
|
8
8
|
*/
|
|
9
|
-
constructor(fixedInterval?: number
|
|
9
|
+
constructor(fixedInterval?: number);
|
|
10
10
|
/**
|
|
11
11
|
* @type {Policy}
|
|
12
12
|
*/
|
|
@@ -152,7 +152,7 @@ export default class Retrier {
|
|
|
152
152
|
* @param {boolean} [resetAfterSuccess=false] - Whether to reset retry counters after success.
|
|
153
153
|
* @returns {this} The Retrier instance for chaining.
|
|
154
154
|
*/
|
|
155
|
-
always(task: Function, resetAfterSuccess?: boolean
|
|
155
|
+
always(task: Function, resetAfterSuccess?: boolean): this;
|
|
156
156
|
/**
|
|
157
157
|
* Starts the retry process.
|
|
158
158
|
* @returns {Promise<*>}
|
|
@@ -163,7 +163,7 @@ export default class Retrier {
|
|
|
163
163
|
* @param {Error} [reason] - Optional reason for stopping (defaults to 'Manually Stop' error).
|
|
164
164
|
* @returns {Promise<void>} A promise that resolves when the retrier has fully stopped.
|
|
165
165
|
*/
|
|
166
|
-
stop(reason?: Error
|
|
166
|
+
stop(reason?: Error): Promise<void>;
|
|
167
167
|
/**
|
|
168
168
|
* Resets the retry policy to its initial state.
|
|
169
169
|
*/
|
|
@@ -208,7 +208,7 @@ export default class Retrier {
|
|
|
208
208
|
* Registers a listener for "timeout" events.
|
|
209
209
|
* @param {Function} listener - The callback function
|
|
210
210
|
*/
|
|
211
|
-
onTimeout(listener: Function):
|
|
211
|
+
onTimeout(listener: Function): this;
|
|
212
212
|
/**
|
|
213
213
|
* Registers a listener for "task-timeout" events.
|
|
214
214
|
* @param {Function} listener - The callback function
|
|
@@ -219,7 +219,7 @@ export default class Retrier {
|
|
|
219
219
|
* Registers a listener for "completed" events.
|
|
220
220
|
* @param {Function} listener - The callback function
|
|
221
221
|
*/
|
|
222
|
-
onCompleted(listener: Function):
|
|
222
|
+
onCompleted(listener: Function): this;
|
|
223
223
|
/**
|
|
224
224
|
* Registers a listener for the 'MaxRetries' event.
|
|
225
225
|
* @param {Function} listener - The callback function to be executed when max retries are reached.
|
|
@@ -228,6 +228,6 @@ export default class Retrier {
|
|
|
228
228
|
onMaxRetries(listener: Function): this;
|
|
229
229
|
}
|
|
230
230
|
export { Retrier as RetrierType };
|
|
231
|
-
import Policy from
|
|
232
|
-
import Task from
|
|
233
|
-
import AlwaysTask from
|
|
231
|
+
import Policy from './policy.js';
|
|
232
|
+
import Task from './task.js';
|
|
233
|
+
import AlwaysTask from './alway-task.js';
|
package/types/task.d.ts
CHANGED