@daiso-tech/core 0.35.2 → 0.35.3
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/dist/async/middlewares/_shared.d.ts +1 -1
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.d.ts +5 -5
- package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +1 -1
- package/dist/async/middlewares/dynamic/dynamic.middleware.d.ts +1 -1
- package/dist/async/middlewares/dynamic/dynamic.middleware.js +1 -1
- package/dist/async/middlewares/fallback/fallback.middleware.d.ts +5 -5
- package/dist/async/middlewares/fallback/fallback.middleware.js +1 -1
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.d.ts +1 -1
- package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js +1 -1
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.d.ts +1 -1
- package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js +1 -1
- package/dist/async/middlewares/observe/observe.middleware.d.ts +10 -10
- package/dist/async/middlewares/observe/observe.middleware.js +1 -1
- package/dist/async/middlewares/timeout/timeout.middleware.d.ts +5 -5
- package/dist/async/middlewares/timeout/timeout.middleware.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { TimeSpan, type AsyncMiddlewareFn, type HookContext, type Invokable } fr
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
8
|
-
* @group
|
|
8
|
+
* @group Middlewares
|
|
9
9
|
*/
|
|
10
10
|
export type OnProcessingData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
11
11
|
args: TParameters;
|
|
@@ -14,13 +14,13 @@ export type OnProcessingData<TParameters extends unknown[] = unknown[], TContext
|
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
16
16
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
17
|
-
* @group
|
|
17
|
+
* @group Middlewares
|
|
18
18
|
*/
|
|
19
19
|
export type OnProcessing<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnProcessingData<TParameters, TContext>]>;
|
|
20
20
|
/**
|
|
21
21
|
*
|
|
22
22
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
23
|
-
* @group
|
|
23
|
+
* @group Middlewares
|
|
24
24
|
*/
|
|
25
25
|
export type BulkheadCallbacks<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
26
26
|
onProcessing?: OnProcessing<TParameters, TContext>;
|
|
@@ -28,7 +28,7 @@ export type BulkheadCallbacks<TParameters extends unknown[] = unknown[], TContex
|
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
30
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
31
|
-
* @group
|
|
31
|
+
* @group Middlewares
|
|
32
32
|
*/
|
|
33
33
|
export type BulkheadSettings<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = BulkheadCallbacks<TParameters, TContext> & {
|
|
34
34
|
/**
|
|
@@ -59,7 +59,7 @@ export type BulkheadSettings<TParameters extends unknown[] = unknown[], TContext
|
|
|
59
59
|
* You can provide {@link BulkheadSettings | `settings.maxCapacity`}
|
|
60
60
|
*
|
|
61
61
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
62
|
-
* @group
|
|
62
|
+
* @group Middlewares
|
|
63
63
|
* @throws {CapacityFullAsyncError} {@link CapacityFullAsyncError}
|
|
64
64
|
* ```ts
|
|
65
65
|
* import { bulkhead } from "@daiso-tech/core/async";
|
|
@@ -8,7 +8,7 @@ import { PromiseQueue } from "../../../async/utilities/_module.js";
|
|
|
8
8
|
* You can provide {@link BulkheadSettings | `settings.maxCapacity`}
|
|
9
9
|
*
|
|
10
10
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
11
|
-
* @group
|
|
11
|
+
* @group Middlewares
|
|
12
12
|
* @throws {CapacityFullAsyncError} {@link CapacityFullAsyncError}
|
|
13
13
|
* ```ts
|
|
14
14
|
* import { bulkhead } from "@daiso-tech/core/async";
|
|
@@ -7,7 +7,7 @@ import { type AsyncMiddlewareFn, type Invokable } from "../../../utilities/_modu
|
|
|
7
7
|
* The `dynamic` is wrapper middleware that allows configuration of other middlewares dynamically based on the function arguments and context.
|
|
8
8
|
*
|
|
9
9
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
10
|
-
* @group
|
|
10
|
+
* @group Middlewares
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
@@ -6,7 +6,7 @@ import { callInvokable, } from "../../../utilities/_module-exports.js";
|
|
|
6
6
|
* The `dynamic` is wrapper middleware that allows configuration of other middlewares dynamically based on the function arguments and context.
|
|
7
7
|
*
|
|
8
8
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
9
|
-
* @group
|
|
9
|
+
* @group Middlewares
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
@@ -7,7 +7,7 @@ import type { ErrorPolicy } from "../../../async/middlewares/_shared.js";
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
10
|
-
* @group
|
|
10
|
+
* @group Middlewares
|
|
11
11
|
*/
|
|
12
12
|
export type OnFallbackData<TParameters extends unknown[] = unknown[], TFallbackValue = unknown, TContext extends HookContext = HookContext> = {
|
|
13
13
|
error: unknown;
|
|
@@ -18,13 +18,13 @@ export type OnFallbackData<TParameters extends unknown[] = unknown[], TFallbackV
|
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
21
|
-
* @group
|
|
21
|
+
* @group Middlewares
|
|
22
22
|
*/
|
|
23
23
|
export type OnFallback<TParameters extends unknown[] = unknown[], TFallbackValue = unknown, TContext extends HookContext = HookContext> = Invokable<[data: OnFallbackData<TParameters, TFallbackValue, TContext>]>;
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
27
|
-
* @group
|
|
27
|
+
* @group Middlewares
|
|
28
28
|
*/
|
|
29
29
|
export type FallbackCallbacks<TParameters extends unknown[] = unknown[], TReturn = unknown, TContext extends HookContext = HookContext> = {
|
|
30
30
|
/**
|
|
@@ -35,7 +35,7 @@ export type FallbackCallbacks<TParameters extends unknown[] = unknown[], TReturn
|
|
|
35
35
|
/**
|
|
36
36
|
*
|
|
37
37
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
38
|
-
* @group
|
|
38
|
+
* @group Middlewares
|
|
39
39
|
*/
|
|
40
40
|
export type FallbackSettings<TParameters extends unknown[] = unknown[], TReturn = unknown, TContext extends HookContext = HookContext> = FallbackCallbacks<TParameters, TReturn, TContext> & {
|
|
41
41
|
fallbackValue: AsyncLazyable<TReturn>;
|
|
@@ -53,7 +53,7 @@ export type FallbackSettings<TParameters extends unknown[] = unknown[], TReturn
|
|
|
53
53
|
* The `fallback` middleware adds fallback value when an error occurs.
|
|
54
54
|
*
|
|
55
55
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
56
|
-
* @group
|
|
56
|
+
* @group Middlewares
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
59
|
* ```ts
|
|
@@ -6,7 +6,7 @@ import { callInvokable, resolveAsyncLazyable, } from "../../../utilities/_module
|
|
|
6
6
|
* The `fallback` middleware adds fallback value when an error occurs.
|
|
7
7
|
*
|
|
8
8
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
9
|
-
* @group
|
|
9
|
+
* @group Middlewares
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { HedgingSettings } from "../../../../async/middlewares/hedging/_sha
|
|
|
9
9
|
* If all function fail than error is thrown.
|
|
10
10
|
*
|
|
11
11
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
12
|
-
* @group
|
|
12
|
+
* @group Middlewares
|
|
13
13
|
* @throws {HedgingAsyncError} {@link HedgingAsyncError}
|
|
14
14
|
*
|
|
15
15
|
* @example
|
package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { HedgingSettings } from "../../../../async/middlewares/hedging/_sha
|
|
|
9
9
|
* If all function fail than error is thrown.
|
|
10
10
|
*
|
|
11
11
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
12
|
-
* @group
|
|
12
|
+
* @group Middlewares
|
|
13
13
|
* @throws {HedgingAsyncError} {@link HedgingAsyncError}
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
@@ -10,7 +10,7 @@ import { timeoutAndFail } from "../../../../async/utilities/_module.js";
|
|
|
10
10
|
* If all function fail than error is thrown.
|
|
11
11
|
*
|
|
12
12
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
13
|
-
* @group
|
|
13
|
+
* @group Middlewares
|
|
14
14
|
* @throws {HedgingAsyncError} {@link HedgingAsyncError}
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
@@ -6,7 +6,7 @@ import { type AsyncMiddlewareFn, type Invokable } from "../../../utilities/_modu
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
9
|
-
* @group
|
|
9
|
+
* @group Middlewares
|
|
10
10
|
*/
|
|
11
11
|
export type OnObserveStartData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
12
12
|
args: TParameters;
|
|
@@ -15,13 +15,13 @@ export type OnObserveStartData<TParameters extends unknown[] = unknown[], TConte
|
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
17
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
18
|
-
* @group
|
|
18
|
+
* @group Middlewares
|
|
19
19
|
*/
|
|
20
20
|
export type OnObserveStart<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnObserveStartData<TParameters, TContext>]>;
|
|
21
21
|
/**
|
|
22
22
|
*
|
|
23
23
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
24
|
-
* @group
|
|
24
|
+
* @group Middlewares
|
|
25
25
|
*/
|
|
26
26
|
export type OnObserveSuccessData<TParameters extends unknown[] = unknown[], TReturn = unknown, TContext extends HookContext = HookContext> = {
|
|
27
27
|
returnValue: TReturn;
|
|
@@ -31,13 +31,13 @@ export type OnObserveSuccessData<TParameters extends unknown[] = unknown[], TRet
|
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
33
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
34
|
-
* @group
|
|
34
|
+
* @group Middlewares
|
|
35
35
|
*/
|
|
36
36
|
export type OnObserveSuccess<TParameters extends unknown[] = unknown[], TReturn = unknown, TContext extends HookContext = HookContext> = Invokable<[data: OnObserveSuccessData<TParameters, TReturn, TContext>]>;
|
|
37
37
|
/**
|
|
38
38
|
*
|
|
39
39
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
40
|
-
* @group
|
|
40
|
+
* @group Middlewares
|
|
41
41
|
*/
|
|
42
42
|
export type OnObserveErrorData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
43
43
|
error: unknown;
|
|
@@ -47,7 +47,7 @@ export type OnObserveErrorData<TParameters extends unknown[] = unknown[], TConte
|
|
|
47
47
|
/**
|
|
48
48
|
*
|
|
49
49
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
50
|
-
* @group
|
|
50
|
+
* @group Middlewares
|
|
51
51
|
*/
|
|
52
52
|
export type OnObserveFinallyData<TContext extends HookContext = HookContext> = {
|
|
53
53
|
executionTime: TimeSpan;
|
|
@@ -56,19 +56,19 @@ export type OnObserveFinallyData<TContext extends HookContext = HookContext> = {
|
|
|
56
56
|
/**
|
|
57
57
|
*
|
|
58
58
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
59
|
-
* @group
|
|
59
|
+
* @group Middlewares
|
|
60
60
|
*/
|
|
61
61
|
export type OnObserveError<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnObserveErrorData<TParameters, TContext>]>;
|
|
62
62
|
/**
|
|
63
63
|
*
|
|
64
64
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
65
|
-
* @group
|
|
65
|
+
* @group Middlewares
|
|
66
66
|
*/
|
|
67
67
|
export type OnObserveFinally<TContext extends HookContext = HookContext> = Invokable<[data: OnObserveFinallyData<TContext>]>;
|
|
68
68
|
/**
|
|
69
69
|
*
|
|
70
70
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
71
|
-
* @group
|
|
71
|
+
* @group Middlewares
|
|
72
72
|
*/
|
|
73
73
|
export type ObserveCallbacks<TParameters extends unknown[] = unknown[], TReturn = unknown, TContext extends HookContext = HookContext> = {
|
|
74
74
|
/**
|
|
@@ -92,7 +92,7 @@ export type ObserveCallbacks<TParameters extends unknown[] = unknown[], TReturn
|
|
|
92
92
|
* The `observe` middleware tracks an async function's state and runs callbacks when it fails with an error or succeeds.
|
|
93
93
|
*
|
|
94
94
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
95
|
-
* @group
|
|
95
|
+
* @group Middlewares
|
|
96
96
|
*
|
|
97
97
|
* @example
|
|
98
98
|
* ```ts
|
|
@@ -7,7 +7,7 @@ import { callInvokable, } from "../../../utilities/_module-exports.js";
|
|
|
7
7
|
* The `observe` middleware tracks an async function's state and runs callbacks when it fails with an error or succeeds.
|
|
8
8
|
*
|
|
9
9
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
10
|
-
* @group
|
|
10
|
+
* @group Middlewares
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
@@ -7,7 +7,7 @@ import { type Invokable } from "../../../utilities/_module-exports.js";
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
9
9
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
10
|
-
* @group
|
|
10
|
+
* @group Middlewares
|
|
11
11
|
*/
|
|
12
12
|
export type OnTimeoutData<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
13
13
|
waitTime: TimeSpan;
|
|
@@ -17,13 +17,13 @@ export type OnTimeoutData<TParameters extends unknown[] = unknown[], TContext ex
|
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
19
19
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
20
|
-
* @group
|
|
20
|
+
* @group Middlewares
|
|
21
21
|
*/
|
|
22
22
|
export type OnTimeout<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = Invokable<[data: OnTimeoutData<TParameters, TContext>]>;
|
|
23
23
|
/**
|
|
24
24
|
*
|
|
25
25
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
26
|
-
* @group
|
|
26
|
+
* @group Middlewares
|
|
27
27
|
*/
|
|
28
28
|
export type TimeoutCallbacks<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = {
|
|
29
29
|
/**
|
|
@@ -34,7 +34,7 @@ export type TimeoutCallbacks<TParameters extends unknown[] = unknown[], TContext
|
|
|
34
34
|
/**
|
|
35
35
|
*
|
|
36
36
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
37
|
-
* @group
|
|
37
|
+
* @group Middlewares
|
|
38
38
|
*/
|
|
39
39
|
export type TimeoutSettings<TParameters extends unknown[] = unknown[], TContext extends HookContext = HookContext> = TimeoutCallbacks<TParameters, TContext> & {
|
|
40
40
|
/**
|
|
@@ -54,7 +54,7 @@ export type TimeoutSettings<TParameters extends unknown[] = unknown[], TContext
|
|
|
54
54
|
* Note the original function continues executing (even if the promise fails), you'll need to provide a settings.signalBinder to forward the `AbortSignal`.
|
|
55
55
|
*
|
|
56
56
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
57
|
-
* @group
|
|
57
|
+
* @group Middlewares
|
|
58
58
|
* @throws {TimeoutAsyncError} {@link TimeoutAsyncError}
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
@@ -11,7 +11,7 @@ import { timeoutAndFail } from "../../../async/utilities/_module.js";
|
|
|
11
11
|
* Note the original function continues executing (even if the promise fails), you'll need to provide a settings.signalBinder to forward the `AbortSignal`.
|
|
12
12
|
*
|
|
13
13
|
* IMPORT_PATH: `"@daiso-tech/core/async"`
|
|
14
|
-
* @group
|
|
14
|
+
* @group Middlewares
|
|
15
15
|
* @throws {TimeoutAsyncError} {@link TimeoutAsyncError}
|
|
16
16
|
*
|
|
17
17
|
* @example
|