@daiso-tech/core 0.27.0 → 0.28.1
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/README.md +10 -10
- package/dist/async/utilities/lazy-promise/lazy-promise.d.ts +57 -19
- package/dist/async/utilities/lazy-promise/lazy-promise.js +93 -52
- package/dist/async/utilities/lazy-promise/lazy-promise.js.map +1 -1
- package/dist/async/utilities/retry/retry-or-fail.d.ts +2 -0
- package/dist/async/utilities/retry/retry-or-fail.js.map +1 -1
- package/dist/cache/contracts/cache.contract.d.ts +98 -14
- package/dist/cache/implementations/adapters/_module-exports.d.ts +1 -0
- package/dist/cache/implementations/adapters/_module-exports.js +1 -0
- package/dist/cache/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.d.ts +1 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js +2 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/_module.js.map +1 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.d.ts +23 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js +41 -0
- package/dist/cache/implementations/adapters/no-op-cache-adapter/no-op-cache-adapter.js.map +1 -0
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.d.ts +2 -3
- package/dist/cache/implementations/adapters/sqlite-cache-adapter/sqlite-cache-adapter.js.map +1 -1
- package/dist/cache/implementations/derivables/cache/cache.d.ts +250 -45
- package/dist/cache/implementations/derivables/cache/cache.js +256 -28
- package/dist/cache/implementations/derivables/cache/cache.js.map +1 -1
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.d.ts +57 -18
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js +70 -20
- package/dist/cache/implementations/derivables/cache-factory/cache-factory.js.map +1 -1
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.d.ts +4 -20
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js +7 -4
- package/dist/collection/implementations/async-iterable-collection/async-iterable-collection.js.map +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.d.ts +1 -1
- package/dist/event-bus/implementations/adapters/no-op-event-bus-adapter/no-op-event-bus-adapter.js +1 -1
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.d.ts +21 -36
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +24 -17
- package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.d.ts +57 -14
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js +61 -13
- package/dist/event-bus/implementations/derivables/event-bus-factory/event-bus-factory.js.map +1 -1
- package/dist/lock/contracts/lock-provider.contract.d.ts +19 -5
- package/dist/lock/contracts/lock.contract.d.ts +37 -8
- package/dist/lock/implementations/adapters/_module-exports.d.ts +1 -0
- package/dist/lock/implementations/adapters/_module-exports.js +1 -0
- package/dist/lock/implementations/adapters/_module-exports.js.map +1 -1
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.d.ts +1 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js +2 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/_module.js.map +1 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.d.ts +17 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js +24 -0
- package/dist/lock/implementations/adapters/no-op-lock-adapter/no-op-lock-adapter.js.map +1 -0
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.d.ts +2 -3
- package/dist/lock/implementations/adapters/sqlite-lock-adapter/sqlite-lock-adapter.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.d.ts +134 -62
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js +139 -47
- package/dist/lock/implementations/derivables/lock-provider/lock-provider.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.d.ts +2 -0
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js +8 -2
- package/dist/lock/implementations/derivables/lock-provider/lock-serde-transformer.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider/lock.d.ts +238 -0
- package/dist/lock/implementations/derivables/lock-provider/lock.js +258 -0
- package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.d.ts +75 -9
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js +86 -7
- package/dist/lock/implementations/derivables/lock-provider-factory/lock-provider-factory.js.map +1 -1
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +162 -8
- package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.d.ts +1 -0
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js +1 -0
- package/dist/serde/implementations/adapters/no-op-serde-adapter/no-op-serde-adapter.js.map +1 -1
- package/dist/utilities/_module-exports.d.ts +1 -1
- package/dist/utilities/_module-exports.js +1 -1
- package/dist/utilities/_module-exports.js.map +1 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.js +1 -1
- package/dist/utilities/classes/key-prefixer/key-prefixer.js.map +1 -1
- package/dist/utilities/{_constants.d.ts → constants.d.ts} +0 -3
- package/dist/utilities/constants.js +5 -0
- package/dist/utilities/constants.js.map +1 -0
- package/dist/utilities/contracts/_module.d.ts +2 -1
- package/dist/utilities/contracts/_module.js +2 -1
- package/dist/utilities/contracts/_module.js.map +1 -1
- package/dist/utilities/contracts/sqlite-database.contract.d.ts +26 -0
- package/dist/utilities/contracts/sqlite-database.contract.js +5 -0
- package/dist/utilities/contracts/sqlite-database.contract.js.map +1 -0
- package/dist/utilities/functions.d.ts +4 -0
- package/dist/utilities/functions.js +10 -4
- package/dist/utilities/functions.js.map +1 -1
- package/dist/utilities/types.d.ts +4 -4
- package/package.json +1 -1
- package/dist/utilities/_constants.js +0 -8
- package/dist/utilities/_constants.js.map +0 -1
package/README.md
CHANGED
|
@@ -28,18 +28,18 @@ The library provides modular solutions for the essential features needed in mode
|
|
|
28
28
|
- Notification component
|
|
29
29
|
- Abstract file system component
|
|
30
30
|
|
|
31
|
-
This library is heavily inspired laravel but built in modular way where you can choose which part to use.
|
|
32
|
-
|
|
33
31
|
#### NOTE: This library only supports ESM (ecmascript) module.
|
|
34
32
|
|
|
35
|
-
###
|
|
36
|
-
|
|
37
|
-
@daiso-tech/core/cache/implementations/adapters
|
|
38
|
-
@daiso-tech/core/cache/adapters
|
|
33
|
+
### Inspiration
|
|
34
|
+
This library is inspired by [Laravel](https://laravel.com/docs/11.x/readme) and built with a modular design, so you can use only the parts you need.
|
|
39
35
|
|
|
36
|
+
It also integrates ideas from other libraries:
|
|
37
|
+
- [Symfony components](https://symfony.com/components), PHP
|
|
38
|
+
- [Verrou](https://verrou.dev/docs/introduction), TypeScript
|
|
39
|
+
- [Distributed lock](https://github.com/ZiggyCreatures/FusionCache), C#
|
|
40
|
+
- [Bento cache](https://bentocache.dev/docs/introduction), TypeScript
|
|
41
|
+
- [Fusion cache](https://github.com/ZiggyCreatures/FusionCache), C#
|
|
42
|
+
- [Polly](https://www.pollydocs.org/), C#
|
|
40
43
|
|
|
41
|
-
@daiso-tech/core/cache/implementations/test-utilities
|
|
42
|
-
@daiso-tech/core/cache/test-utilities
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
@daiso-tech/core/cache
|
|
45
|
+
### Visit the [docs](https://yousif-khalil-abdulkarim.github.io/daiso-core/) for more information!
|
|
@@ -6,34 +6,53 @@ import type { LazyPromiseable, Promisable, TimeSpan } from "../../../utilities/_
|
|
|
6
6
|
import type { RetryPolicy } from "../../../async/utilities/retry/_module.js";
|
|
7
7
|
import { type Func } from "../../../utilities/_module-exports.js";
|
|
8
8
|
/**
|
|
9
|
+
*
|
|
9
10
|
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
10
11
|
* @group Utilities
|
|
11
12
|
*/
|
|
12
13
|
export type LazyPromiseOnFinally = () => Promisable<void>;
|
|
13
14
|
/**
|
|
15
|
+
*
|
|
14
16
|
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
15
17
|
* @group Utilities
|
|
16
18
|
*/
|
|
17
19
|
export type LazyPromiseOnSuccess<TValue> = (value: TValue) => Promisable<void>;
|
|
18
20
|
/**
|
|
21
|
+
*
|
|
19
22
|
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
20
23
|
* @group Utilities
|
|
21
24
|
*/
|
|
22
25
|
export type LazyPromiseOnError = (error: unknown) => Promisable<void>;
|
|
23
26
|
/**
|
|
27
|
+
*
|
|
24
28
|
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
25
29
|
* @group Utilities
|
|
26
30
|
*/
|
|
27
|
-
export type
|
|
28
|
-
retryAttempts?: number | null;
|
|
29
|
-
backoffPolicy?: BackoffPolicy | null;
|
|
30
|
-
retryPolicy?: RetryPolicy | null;
|
|
31
|
-
abortSignal?: AbortSignal | null;
|
|
32
|
-
timeout?: TimeSpan | null;
|
|
31
|
+
export type LazyPromiseCallbacks<TValue = unknown> = {
|
|
33
32
|
onFinally?: LazyPromiseOnFinally;
|
|
34
33
|
onSuccess?: LazyPromiseOnSuccess<TValue>;
|
|
35
34
|
onError?: LazyPromiseOnError;
|
|
36
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
39
|
+
* @group Utilities
|
|
40
|
+
*/
|
|
41
|
+
export type LazyPromiseSettingsBase = {
|
|
42
|
+
backoffPolicy?: BackoffPolicy | null;
|
|
43
|
+
retryAttempts?: number | null;
|
|
44
|
+
retryPolicy?: RetryPolicy | null;
|
|
45
|
+
retryTimeout?: TimeSpan | null;
|
|
46
|
+
totalTimeout?: TimeSpan | null;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* IMPORT_PATH: ```"@daiso-tech/core/async"```
|
|
51
|
+
* @group Utilities
|
|
52
|
+
*/
|
|
53
|
+
export type LazyPromiseSettings<TValue = unknown> = LazyPromiseCallbacks<TValue> & LazyPromiseSettingsBase & {
|
|
54
|
+
abortSignal?: AbortSignal | null;
|
|
55
|
+
};
|
|
37
56
|
/**
|
|
38
57
|
* The <i>LazyPromise</i> class is used for creating lazy <i>{@link PromiseLike}<i> object that will only execute when awaited or when then method is called.
|
|
39
58
|
* The class includes helpful methods
|
|
@@ -119,8 +138,9 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
119
138
|
* await promise;
|
|
120
139
|
*/
|
|
121
140
|
constructor(asyncFn: LazyPromiseable<TValue>, settings?: LazyPromiseSettings<TValue>);
|
|
122
|
-
private
|
|
141
|
+
private applyRetryTimeout;
|
|
123
142
|
private applyRetry;
|
|
143
|
+
private applyTotalTimeout;
|
|
124
144
|
private applyAbort;
|
|
125
145
|
private applySettings;
|
|
126
146
|
/**
|
|
@@ -130,10 +150,10 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
130
150
|
*/
|
|
131
151
|
then<TResult1 = TValue, TResult2 = never>(onfulfilled?: ((value: TValue) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
132
152
|
/**
|
|
133
|
-
* The <i>
|
|
134
|
-
* @example
|
|
153
|
+
* The <i>setBackoffPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
135
154
|
* ```ts
|
|
136
|
-
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
155
|
+
* import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core/async";
|
|
156
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
137
157
|
*
|
|
138
158
|
* const promise =
|
|
139
159
|
* new LazyPromise(async () => {
|
|
@@ -141,17 +161,18 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
141
161
|
* throw new Error("Error occured!");
|
|
142
162
|
* })
|
|
143
163
|
* .setRetryAttempts(3)
|
|
164
|
+
* .setBackoffPolicy(linearBackoffPolicy())
|
|
144
165
|
*
|
|
145
166
|
* // Will log "A" 3 times and then retry error will be thrown.
|
|
146
167
|
* await promise;
|
|
147
168
|
* ```
|
|
148
169
|
*/
|
|
149
|
-
|
|
170
|
+
setBackoffPolicy(policy: BackoffPolicy | null): LazyPromise<TValue>;
|
|
150
171
|
/**
|
|
151
|
-
* The <i>
|
|
172
|
+
* The <i>setRetryAttempts</i> method is used for setting max retry attempts.
|
|
173
|
+
* @example
|
|
152
174
|
* ```ts
|
|
153
|
-
* import { LazyPromise
|
|
154
|
-
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
175
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
155
176
|
*
|
|
156
177
|
* const promise =
|
|
157
178
|
* new LazyPromise(async () => {
|
|
@@ -159,13 +180,12 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
159
180
|
* throw new Error("Error occured!");
|
|
160
181
|
* })
|
|
161
182
|
* .setRetryAttempts(3)
|
|
162
|
-
* .setBackoffPolicy(linearBackoffPolicy())
|
|
163
183
|
*
|
|
164
184
|
* // Will log "A" 3 times and then retry error will be thrown.
|
|
165
185
|
* await promise;
|
|
166
186
|
* ```
|
|
167
187
|
*/
|
|
168
|
-
|
|
188
|
+
setRetryAttempts(attempts: number | null): LazyPromise<TValue>;
|
|
169
189
|
/**
|
|
170
190
|
* The <i>setRetryPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
171
191
|
* @example
|
|
@@ -189,7 +209,25 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
189
209
|
*/
|
|
190
210
|
setRetryPolicy(policy: RetryPolicy | null): LazyPromise<TValue>;
|
|
191
211
|
/**
|
|
192
|
-
* The <i>
|
|
212
|
+
* The <i>setRetryTimeout</i> method aborts the each retry if it exceeds the given <i>time</i>.
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
216
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
217
|
+
*
|
|
218
|
+
* const promise =
|
|
219
|
+
* new LazyPromise(async () => {
|
|
220
|
+
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
221
|
+
* })
|
|
222
|
+
* .setRetryTimeout(TimeSpan.fromSeconds(1));
|
|
223
|
+
*
|
|
224
|
+
* // An timeout error will be thrown.
|
|
225
|
+
* await promise;
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
setRetryTimeout(time: TimeSpan | null): LazyPromise<TValue>;
|
|
229
|
+
/**
|
|
230
|
+
* The <i>setTotalTimeout</i> method aborts the <i>LazyPromise</i> if it exceeds the given <i>time</i> by throwning an error.
|
|
193
231
|
* @example
|
|
194
232
|
* ```ts
|
|
195
233
|
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
@@ -199,13 +237,13 @@ export declare class LazyPromise<TValue> implements PromiseLike<TValue> {
|
|
|
199
237
|
* new LazyPromise(async () => {
|
|
200
238
|
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
201
239
|
* })
|
|
202
|
-
* .
|
|
240
|
+
* .setRetryTimeout(TimeSpan.fromSeconds(1));
|
|
203
241
|
*
|
|
204
242
|
* // An timeout error will be thrown.
|
|
205
243
|
* await promise;
|
|
206
244
|
* ```
|
|
207
245
|
*/
|
|
208
|
-
|
|
246
|
+
setTotalTimeout(time: TimeSpan | null): LazyPromise<TValue>;
|
|
209
247
|
/**
|
|
210
248
|
* The <i>setAbortSignal</i> method aborts the <i>LazyPromise</i> by the passed in <i>abortSignal</i>.
|
|
211
249
|
* @example
|
|
@@ -11,7 +11,7 @@ AbortAsyncError,
|
|
|
11
11
|
TimeoutAsyncError,
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
13
|
RetryAsyncError, } from "../../../async/async.errors.js";
|
|
14
|
-
import { resolveAsyncLazyable, } from "../../../utilities/_module-exports.js";
|
|
14
|
+
import { removeUndefinedProperties, resolveAsyncLazyable, } from "../../../utilities/_module-exports.js";
|
|
15
15
|
import { delay } from "../../../async/utilities/_module.js";
|
|
16
16
|
/**
|
|
17
17
|
* The <i>LazyPromise</i> class is used for creating lazy <i>{@link PromiseLike}<i> object that will only execute when awaited or when then method is called.
|
|
@@ -113,61 +113,79 @@ export class LazyPromise {
|
|
|
113
113
|
*/
|
|
114
114
|
constructor(asyncFn, settings = {}) {
|
|
115
115
|
this.asyncFn = () => resolveAsyncLazyable(asyncFn);
|
|
116
|
-
this.settings = {
|
|
116
|
+
this.settings = removeUndefinedProperties({
|
|
117
117
|
retryAttempts: null,
|
|
118
118
|
backoffPolicy: null,
|
|
119
119
|
retryPolicy: null,
|
|
120
|
+
retryTimeout: null,
|
|
121
|
+
totalTimeout: null,
|
|
120
122
|
abortSignal: null,
|
|
121
|
-
timeout: null,
|
|
122
123
|
onFinally: () => { },
|
|
123
124
|
onSuccess: (_value) => { },
|
|
124
125
|
onError: () => { },
|
|
125
126
|
...settings,
|
|
126
|
-
};
|
|
127
|
+
});
|
|
127
128
|
}
|
|
128
|
-
|
|
129
|
-
if (this.settings.
|
|
130
|
-
|
|
131
|
-
const newAsyncFn = () => {
|
|
132
|
-
if (this.settings.timeout === null) {
|
|
133
|
-
throw new Error(`LazyPromise["time"] field is null`);
|
|
134
|
-
}
|
|
135
|
-
return timeoutAndFail(oldAsyncFn, this.settings.timeout);
|
|
136
|
-
};
|
|
137
|
-
this.asyncFn = newAsyncFn;
|
|
129
|
+
applyRetryTimeout() {
|
|
130
|
+
if (this.settings.retryTimeout === null) {
|
|
131
|
+
return;
|
|
138
132
|
}
|
|
133
|
+
const oldAsyncFn = this.asyncFn;
|
|
134
|
+
const newAsyncFn = () => {
|
|
135
|
+
if (this.settings.retryTimeout === null) {
|
|
136
|
+
throw new Error(`LazyPromise["time"] field is null`);
|
|
137
|
+
}
|
|
138
|
+
return timeoutAndFail(oldAsyncFn, this.settings.retryTimeout);
|
|
139
|
+
};
|
|
140
|
+
this.asyncFn = newAsyncFn;
|
|
139
141
|
}
|
|
140
142
|
applyRetry() {
|
|
141
|
-
if (this.settings.retryAttempts
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
143
|
+
if (this.settings.retryAttempts === null) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.applyRetryTimeout();
|
|
147
|
+
const oldAsyncFn = this.asyncFn;
|
|
148
|
+
const newAsyncFn = () => {
|
|
149
|
+
if (this.settings.retryAttempts === null) {
|
|
150
|
+
throw new Error(`LazyPromise["attempts"] field is null`);
|
|
151
|
+
}
|
|
152
|
+
return retryOrFail(oldAsyncFn, {
|
|
153
|
+
backoffPolicy: this.settings.backoffPolicy ?? undefined,
|
|
154
|
+
retryPolicy: this.settings.retryPolicy ?? undefined,
|
|
155
|
+
maxAttempts: this.settings.retryAttempts,
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
this.asyncFn = newAsyncFn;
|
|
159
|
+
}
|
|
160
|
+
applyTotalTimeout() {
|
|
161
|
+
if (this.settings.totalTimeout === null) {
|
|
162
|
+
return;
|
|
154
163
|
}
|
|
164
|
+
const oldAsyncFn = this.asyncFn;
|
|
165
|
+
const newAsyncFn = () => {
|
|
166
|
+
if (this.settings.totalTimeout === null) {
|
|
167
|
+
throw new Error(`LazyPromise["time"] field is null`);
|
|
168
|
+
}
|
|
169
|
+
return timeoutAndFail(oldAsyncFn, this.settings.totalTimeout);
|
|
170
|
+
};
|
|
171
|
+
this.asyncFn = newAsyncFn;
|
|
155
172
|
}
|
|
156
173
|
applyAbort() {
|
|
157
|
-
if (this.settings.abortSignal
|
|
158
|
-
|
|
159
|
-
const newAsyncFn = () => {
|
|
160
|
-
if (this.settings.abortSignal === null) {
|
|
161
|
-
throw new Error(`LazyPromise["abortSignal"] field is null`);
|
|
162
|
-
}
|
|
163
|
-
return abortAndFail(oldAsyncFn, this.settings.abortSignal);
|
|
164
|
-
};
|
|
165
|
-
this.asyncFn = newAsyncFn;
|
|
174
|
+
if (this.settings.abortSignal === null) {
|
|
175
|
+
return;
|
|
166
176
|
}
|
|
177
|
+
const oldAsyncFn = this.asyncFn;
|
|
178
|
+
const newAsyncFn = () => {
|
|
179
|
+
if (this.settings.abortSignal === null) {
|
|
180
|
+
throw new Error(`LazyPromise["abortSignal"] field is null`);
|
|
181
|
+
}
|
|
182
|
+
return abortAndFail(oldAsyncFn, this.settings.abortSignal);
|
|
183
|
+
};
|
|
184
|
+
this.asyncFn = newAsyncFn;
|
|
167
185
|
}
|
|
168
186
|
applySettings() {
|
|
169
|
-
this.applyTimeout();
|
|
170
187
|
this.applyRetry();
|
|
188
|
+
this.applyTotalTimeout();
|
|
171
189
|
this.applyAbort();
|
|
172
190
|
}
|
|
173
191
|
/**
|
|
@@ -186,10 +204,10 @@ export class LazyPromise {
|
|
|
186
204
|
return this.promise.then(onfulfilled, onrejected);
|
|
187
205
|
}
|
|
188
206
|
/**
|
|
189
|
-
* The <i>
|
|
190
|
-
* @example
|
|
207
|
+
* The <i>setBackoffPolicy</i> method is used for setting a custom <i>{@link BackoffPolicy}</i>.
|
|
191
208
|
* ```ts
|
|
192
|
-
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
209
|
+
* import { LazyPromise, linearBackoffPolicy } from "@daiso-tech/core/async";
|
|
210
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
193
211
|
*
|
|
194
212
|
* const promise =
|
|
195
213
|
* new LazyPromise(async () => {
|
|
@@ -197,22 +215,23 @@ export class LazyPromise {
|
|
|
197
215
|
* throw new Error("Error occured!");
|
|
198
216
|
* })
|
|
199
217
|
* .setRetryAttempts(3)
|
|
218
|
+
* .setBackoffPolicy(linearBackoffPolicy())
|
|
200
219
|
*
|
|
201
220
|
* // Will log "A" 3 times and then retry error will be thrown.
|
|
202
221
|
* await promise;
|
|
203
222
|
* ```
|
|
204
223
|
*/
|
|
205
|
-
|
|
224
|
+
setBackoffPolicy(policy) {
|
|
206
225
|
return new LazyPromise(this.asyncFn, {
|
|
207
226
|
...this.settings,
|
|
208
|
-
|
|
227
|
+
backoffPolicy: policy,
|
|
209
228
|
});
|
|
210
229
|
}
|
|
211
230
|
/**
|
|
212
|
-
* The <i>
|
|
231
|
+
* The <i>setRetryAttempts</i> method is used for setting max retry attempts.
|
|
232
|
+
* @example
|
|
213
233
|
* ```ts
|
|
214
|
-
* import { LazyPromise
|
|
215
|
-
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
234
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
216
235
|
*
|
|
217
236
|
* const promise =
|
|
218
237
|
* new LazyPromise(async () => {
|
|
@@ -220,16 +239,15 @@ export class LazyPromise {
|
|
|
220
239
|
* throw new Error("Error occured!");
|
|
221
240
|
* })
|
|
222
241
|
* .setRetryAttempts(3)
|
|
223
|
-
* .setBackoffPolicy(linearBackoffPolicy())
|
|
224
242
|
*
|
|
225
243
|
* // Will log "A" 3 times and then retry error will be thrown.
|
|
226
244
|
* await promise;
|
|
227
245
|
* ```
|
|
228
246
|
*/
|
|
229
|
-
|
|
247
|
+
setRetryAttempts(attempts) {
|
|
230
248
|
return new LazyPromise(this.asyncFn, {
|
|
231
249
|
...this.settings,
|
|
232
|
-
|
|
250
|
+
retryAttempts: attempts,
|
|
233
251
|
});
|
|
234
252
|
}
|
|
235
253
|
/**
|
|
@@ -260,7 +278,30 @@ export class LazyPromise {
|
|
|
260
278
|
});
|
|
261
279
|
}
|
|
262
280
|
/**
|
|
263
|
-
* The <i>
|
|
281
|
+
* The <i>setRetryTimeout</i> method aborts the each retry if it exceeds the given <i>time</i>.
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
285
|
+
* import { TimeSpan } from "@daiso-tech/core/utilities";
|
|
286
|
+
*
|
|
287
|
+
* const promise =
|
|
288
|
+
* new LazyPromise(async () => {
|
|
289
|
+
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
290
|
+
* })
|
|
291
|
+
* .setRetryTimeout(TimeSpan.fromSeconds(1));
|
|
292
|
+
*
|
|
293
|
+
* // An timeout error will be thrown.
|
|
294
|
+
* await promise;
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
setRetryTimeout(time) {
|
|
298
|
+
return new LazyPromise(this.asyncFn, {
|
|
299
|
+
...this.settings,
|
|
300
|
+
retryTimeout: time,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* The <i>setTotalTimeout</i> method aborts the <i>LazyPromise</i> if it exceeds the given <i>time</i> by throwning an error.
|
|
264
305
|
* @example
|
|
265
306
|
* ```ts
|
|
266
307
|
* import { LazyPromise } from "@daiso-tech/core/async";
|
|
@@ -270,16 +311,16 @@ export class LazyPromise {
|
|
|
270
311
|
* new LazyPromise(async () => {
|
|
271
312
|
* await LazyPromise.delay(TimeSpan.fromMinutes(1));
|
|
272
313
|
* })
|
|
273
|
-
* .
|
|
314
|
+
* .setRetryTimeout(TimeSpan.fromSeconds(1));
|
|
274
315
|
*
|
|
275
316
|
* // An timeout error will be thrown.
|
|
276
317
|
* await promise;
|
|
277
318
|
* ```
|
|
278
319
|
*/
|
|
279
|
-
|
|
320
|
+
setTotalTimeout(time) {
|
|
280
321
|
return new LazyPromise(this.asyncFn, {
|
|
281
322
|
...this.settings,
|
|
282
|
-
|
|
323
|
+
totalTimeout: time,
|
|
283
324
|
});
|
|
284
325
|
}
|
|
285
326
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-promise.js","sourceRoot":"","sources":["../../../../src/async/utilities/lazy-promise/lazy-promise.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO;AACH,6DAA6D;AAC7D,eAAe;AACf,6DAA6D;AAC7D,iBAAiB;AACjB,6DAA6D;AAC7D,eAAe,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,oBAAoB,GAEvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"lazy-promise.js","sourceRoot":"","sources":["../../../../src/async/utilities/lazy-promise/lazy-promise.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO;AACH,6DAA6D;AAC7D,eAAe;AACf,6DAA6D;AAC7D,iBAAiB;AACjB,6DAA6D;AAC7D,eAAe,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,yBAAyB,EACzB,oBAAoB,GAEvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AA0DrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,WAAW;IACpB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,MAAM,CACT,EAA2C,EAC3C,QAAuC;QAEvC,OAAO,CAAC,GAAG,UAAU,EAAE,EAAE,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AC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACnC,OAAO,KAAK,CAAC;YACjB,CAAC;oBAAS,CAAC;gBACP,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YACpC,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IAC/C,CAAC;CACJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Async
|
|
3
3
|
*/
|
|
4
|
+
import { TimeSpan } from "../../../utilities/_module-exports.js";
|
|
4
5
|
import type { BackoffPolicy } from "../../../async/backof-policies/_module.js";
|
|
5
6
|
/**
|
|
6
7
|
*
|
|
@@ -20,6 +21,7 @@ export type RetrySettings = {
|
|
|
20
21
|
maxAttempts?: number;
|
|
21
22
|
backoffPolicy?: BackoffPolicy;
|
|
22
23
|
retryPolicy?: RetryPolicy;
|
|
24
|
+
timeout?: TimeSpan | null;
|
|
23
25
|
};
|
|
24
26
|
/**
|
|
25
27
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-or-fail.js","sourceRoot":"","sources":["../../../../src/async/utilities/retry/retry-or-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"retry-or-fail.js","sourceRoot":"","sources":["../../../../src/async/utilities/retry/retry-or-fail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB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