@nlozgachev/pipelined 0.24.0 → 0.25.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/dist/{Task-GSGtQO1m.d.ts → Task-BbTMuIby.d.ts} +1 -39
- package/dist/{Task-CT8iwwuB.d.mts → Task-C7M6gLYu.d.mts} +1 -39
- package/dist/core.d.mts +117 -111
- package/dist/core.d.ts +117 -111
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
|
@@ -84,50 +84,18 @@ type TimeoutOptions<E> = {
|
|
|
84
84
|
readonly ms: number;
|
|
85
85
|
readonly onTimeout: () => E;
|
|
86
86
|
};
|
|
87
|
-
type WithRetry<E> = {
|
|
88
|
-
readonly retry: RetryOptions<E>;
|
|
89
|
-
};
|
|
90
87
|
type WithTimeout<E> = {
|
|
91
88
|
readonly timeout?: TimeoutOptions<E>;
|
|
92
89
|
};
|
|
93
90
|
type WithMs = {
|
|
94
91
|
readonly ms: number;
|
|
95
92
|
};
|
|
96
|
-
/** For `throttled`: also fire on the trailing edge after the cooldown. */
|
|
97
|
-
type WithTrailing = {
|
|
98
|
-
readonly trailing: true;
|
|
99
|
-
};
|
|
100
|
-
/** For `debounced`: also fire on the leading edge (first call). */
|
|
101
|
-
type WithLeading = {
|
|
102
|
-
readonly leading: true;
|
|
103
|
-
};
|
|
104
|
-
/** For `debounced`: maximum ms before the trailing call fires regardless of continued activity. */
|
|
105
|
-
type WithMaxWait = {
|
|
106
|
-
readonly maxWait: number;
|
|
107
|
-
};
|
|
108
93
|
type WithN = {
|
|
109
94
|
readonly n: number;
|
|
110
95
|
};
|
|
111
|
-
/**
|
|
112
|
-
* `O` is a string literal (or union of literals) representing the overflow value.
|
|
113
|
-
* The generic lets overload signatures discriminate on the specific value:
|
|
114
|
-
* `WithOverflow<"drop">` → `{ overflow: "drop" }`
|
|
115
|
-
* `WithOverflow<"replace-last">` → `{ overflow: "replace-last" }`
|
|
116
|
-
* Used by both `concurrent` (`"drop" | "queue"`) and `queue` (`"drop" | "replace-last"`).
|
|
117
|
-
* `extends string` prevents `WithOverflow<42>` from being valid.
|
|
118
|
-
*/
|
|
119
|
-
type WithOverflow<O extends string> = {
|
|
120
|
-
readonly overflow: O;
|
|
121
|
-
};
|
|
122
|
-
type WithMaxSize = {
|
|
123
|
-
readonly maxSize: number;
|
|
124
|
-
};
|
|
125
96
|
type WithConcurrency = {
|
|
126
97
|
readonly concurrency?: number;
|
|
127
98
|
};
|
|
128
|
-
type WithDedupe<I> = {
|
|
129
|
-
readonly dedupe: (a: I, b: I) => boolean;
|
|
130
|
-
};
|
|
131
99
|
type WithSize = {
|
|
132
100
|
readonly size?: number;
|
|
133
101
|
};
|
|
@@ -137,12 +105,6 @@ type WithCooldown = {
|
|
|
137
105
|
type WithMinInterval = {
|
|
138
106
|
readonly minInterval?: number;
|
|
139
107
|
};
|
|
140
|
-
type WithKey<I, K> = {
|
|
141
|
-
readonly key: (input: I) => K;
|
|
142
|
-
};
|
|
143
|
-
type WithPerKey<S extends string> = {
|
|
144
|
-
readonly perKey: S;
|
|
145
|
-
};
|
|
146
108
|
|
|
147
109
|
type Ok<A> = WithKind<"Ok"> & WithValue<A>;
|
|
148
110
|
type Err<E> = WithKind<"Error"> & WithError<E>;
|
|
@@ -777,4 +739,4 @@ declare namespace Task {
|
|
|
777
739
|
};
|
|
778
740
|
}
|
|
779
741
|
|
|
780
|
-
export { Deferred as D, type Err as E, Maybe as M, type None as N, type Ok as O, Result as R, type Some as S, Task as T, type WithValue as W, type WithLog as a, type WithKind as b, type WithError as c, type RetryOptions as d, type TimeoutOptions as e, type
|
|
742
|
+
export { Deferred as D, type Err as E, Maybe as M, type None as N, type Ok as O, Result as R, type Some as S, Task as T, type WithValue as W, type WithLog as a, type WithKind as b, type WithError as c, type RetryOptions as d, type TimeoutOptions as e, type WithTimeout as f, type WithMinInterval as g, type WithCooldown as h, type WithConcurrency as i, type WithSize as j, type WithMs as k, type WithN as l, type WithErrors as m, type WithFirst as n, type WithSecond as o };
|
|
@@ -84,50 +84,18 @@ type TimeoutOptions<E> = {
|
|
|
84
84
|
readonly ms: number;
|
|
85
85
|
readonly onTimeout: () => E;
|
|
86
86
|
};
|
|
87
|
-
type WithRetry<E> = {
|
|
88
|
-
readonly retry: RetryOptions<E>;
|
|
89
|
-
};
|
|
90
87
|
type WithTimeout<E> = {
|
|
91
88
|
readonly timeout?: TimeoutOptions<E>;
|
|
92
89
|
};
|
|
93
90
|
type WithMs = {
|
|
94
91
|
readonly ms: number;
|
|
95
92
|
};
|
|
96
|
-
/** For `throttled`: also fire on the trailing edge after the cooldown. */
|
|
97
|
-
type WithTrailing = {
|
|
98
|
-
readonly trailing: true;
|
|
99
|
-
};
|
|
100
|
-
/** For `debounced`: also fire on the leading edge (first call). */
|
|
101
|
-
type WithLeading = {
|
|
102
|
-
readonly leading: true;
|
|
103
|
-
};
|
|
104
|
-
/** For `debounced`: maximum ms before the trailing call fires regardless of continued activity. */
|
|
105
|
-
type WithMaxWait = {
|
|
106
|
-
readonly maxWait: number;
|
|
107
|
-
};
|
|
108
93
|
type WithN = {
|
|
109
94
|
readonly n: number;
|
|
110
95
|
};
|
|
111
|
-
/**
|
|
112
|
-
* `O` is a string literal (or union of literals) representing the overflow value.
|
|
113
|
-
* The generic lets overload signatures discriminate on the specific value:
|
|
114
|
-
* `WithOverflow<"drop">` → `{ overflow: "drop" }`
|
|
115
|
-
* `WithOverflow<"replace-last">` → `{ overflow: "replace-last" }`
|
|
116
|
-
* Used by both `concurrent` (`"drop" | "queue"`) and `queue` (`"drop" | "replace-last"`).
|
|
117
|
-
* `extends string` prevents `WithOverflow<42>` from being valid.
|
|
118
|
-
*/
|
|
119
|
-
type WithOverflow<O extends string> = {
|
|
120
|
-
readonly overflow: O;
|
|
121
|
-
};
|
|
122
|
-
type WithMaxSize = {
|
|
123
|
-
readonly maxSize: number;
|
|
124
|
-
};
|
|
125
96
|
type WithConcurrency = {
|
|
126
97
|
readonly concurrency?: number;
|
|
127
98
|
};
|
|
128
|
-
type WithDedupe<I> = {
|
|
129
|
-
readonly dedupe: (a: I, b: I) => boolean;
|
|
130
|
-
};
|
|
131
99
|
type WithSize = {
|
|
132
100
|
readonly size?: number;
|
|
133
101
|
};
|
|
@@ -137,12 +105,6 @@ type WithCooldown = {
|
|
|
137
105
|
type WithMinInterval = {
|
|
138
106
|
readonly minInterval?: number;
|
|
139
107
|
};
|
|
140
|
-
type WithKey<I, K> = {
|
|
141
|
-
readonly key: (input: I) => K;
|
|
142
|
-
};
|
|
143
|
-
type WithPerKey<S extends string> = {
|
|
144
|
-
readonly perKey: S;
|
|
145
|
-
};
|
|
146
108
|
|
|
147
109
|
type Ok<A> = WithKind<"Ok"> & WithValue<A>;
|
|
148
110
|
type Err<E> = WithKind<"Error"> & WithError<E>;
|
|
@@ -777,4 +739,4 @@ declare namespace Task {
|
|
|
777
739
|
};
|
|
778
740
|
}
|
|
779
741
|
|
|
780
|
-
export { Deferred as D, type Err as E, Maybe as M, type None as N, type Ok as O, Result as R, type Some as S, Task as T, type WithValue as W, type WithLog as a, type WithKind as b, type WithError as c, type RetryOptions as d, type TimeoutOptions as e, type
|
|
742
|
+
export { Deferred as D, type Err as E, Maybe as M, type None as N, type Ok as O, Result as R, type Some as S, Task as T, type WithValue as W, type WithLog as a, type WithKind as b, type WithError as c, type RetryOptions as d, type TimeoutOptions as e, type WithTimeout as f, type WithMinInterval as g, type WithCooldown as h, type WithConcurrency as i, type WithSize as j, type WithMs as k, type WithN as l, type WithErrors as m, type WithFirst as n, type WithSecond as o };
|
package/dist/core.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Maybe, W as WithValue, a as WithLog, D as Deferred, R as Result, b as WithKind, c as WithError, d as RetryOptions, e as TimeoutOptions, f as
|
|
2
|
-
export { E as Err, N as None, O as Ok, S as Some } from './Task-
|
|
1
|
+
import { M as Maybe, W as WithValue, a as WithLog, D as Deferred, R as Result, b as WithKind, c as WithError, d as RetryOptions, e as TimeoutOptions, f as WithTimeout, g as WithMinInterval, h as WithCooldown, i as WithConcurrency, j as WithSize, k as WithMs, l as WithN, T as Task, m as WithErrors, n as WithFirst, o as WithSecond } from './Task-C7M6gLYu.mjs';
|
|
2
|
+
export { E as Err, N as None, O as Ok, S as Some } from './Task-C7M6gLYu.mjs';
|
|
3
3
|
import { N as NonEmptyList } from './NonEmptyList-BlGFjor5.mjs';
|
|
4
4
|
|
|
5
5
|
/** Keys of T for which undefined is assignable (i.e. optional fields). */
|
|
@@ -399,6 +399,89 @@ declare namespace Logged {
|
|
|
399
399
|
const run: <W, A>(data: Logged<W, A>) => readonly [A, ReadonlyArray<W>];
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
+
type MaybeRetry<E, O> = O extends {
|
|
403
|
+
retry: RetryOptions<E>;
|
|
404
|
+
} ? Op.Retrying<E> : never;
|
|
405
|
+
type AllInterpretOptions<I, E> = ({
|
|
406
|
+
strategy: "once";
|
|
407
|
+
retry?: RetryOptions<E>;
|
|
408
|
+
} & WithTimeout<E>) | ({
|
|
409
|
+
strategy: "restartable";
|
|
410
|
+
retry?: RetryOptions<E>;
|
|
411
|
+
} & WithMinInterval & WithTimeout<E>) | ({
|
|
412
|
+
strategy: "exclusive";
|
|
413
|
+
retry?: RetryOptions<E>;
|
|
414
|
+
} & WithCooldown & WithTimeout<E>) | ({
|
|
415
|
+
strategy: "queue";
|
|
416
|
+
retry?: RetryOptions<E>;
|
|
417
|
+
maxSize?: number;
|
|
418
|
+
overflow?: "drop" | "replace-last";
|
|
419
|
+
dedupe?: (a: I, b: I) => boolean;
|
|
420
|
+
} & WithConcurrency & WithTimeout<E>) | ({
|
|
421
|
+
strategy: "buffered";
|
|
422
|
+
retry?: RetryOptions<E>;
|
|
423
|
+
} & WithSize & WithTimeout<E>) | ({
|
|
424
|
+
strategy: "debounced";
|
|
425
|
+
retry?: RetryOptions<E>;
|
|
426
|
+
leading?: true;
|
|
427
|
+
maxWait?: number;
|
|
428
|
+
} & WithMs & WithTimeout<E>) | ({
|
|
429
|
+
strategy: "throttled";
|
|
430
|
+
retry?: RetryOptions<E>;
|
|
431
|
+
trailing?: true;
|
|
432
|
+
} & WithMs & WithTimeout<E>) | ({
|
|
433
|
+
strategy: "concurrent";
|
|
434
|
+
retry?: RetryOptions<E>;
|
|
435
|
+
overflow?: "queue" | "drop";
|
|
436
|
+
} & WithN & WithTimeout<E>) | ({
|
|
437
|
+
strategy: "keyed";
|
|
438
|
+
perKey?: "exclusive" | "restartable";
|
|
439
|
+
key: (input: I) => unknown;
|
|
440
|
+
} & WithTimeout<E>);
|
|
441
|
+
type KeyType<I, O> = O extends {
|
|
442
|
+
key: (input: I) => infer K;
|
|
443
|
+
} ? K : unknown;
|
|
444
|
+
type InterpretResult<I, E, A, O> = [O] extends [{
|
|
445
|
+
strategy: "throttled";
|
|
446
|
+
trailing: true;
|
|
447
|
+
}] ? Op.Manager<I, E, A, Op.ThrottledTrailingState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
448
|
+
strategy: "throttled";
|
|
449
|
+
}] ? Op.Manager<I, E, A, Op.ThrottledState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
450
|
+
strategy: "debounced";
|
|
451
|
+
}] ? Op.Manager<I, E, A, Op.DebouncedState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
452
|
+
strategy: "concurrent";
|
|
453
|
+
overflow: "queue";
|
|
454
|
+
}] ? Op.Manager<I, E, A, Op.ConcurrentQueueState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
455
|
+
strategy: "concurrent";
|
|
456
|
+
}] ? Op.Manager<I, E, A, Op.ConcurrentDropState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
457
|
+
strategy: "keyed";
|
|
458
|
+
perKey: "restartable";
|
|
459
|
+
}] ? Op.KeyedManager<I, KeyType<I, O>, E, Op.KeyedRestartablePerKey<E, A>> : [O] extends [{
|
|
460
|
+
strategy: "keyed";
|
|
461
|
+
}] ? Op.KeyedManager<I, KeyType<I, O>, E, Op.KeyedExclusivePerKey<E, A>> : [O] extends [{
|
|
462
|
+
strategy: "once";
|
|
463
|
+
}] ? Op.Manager<I, E, A, Op.OnceState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
464
|
+
strategy: "restartable";
|
|
465
|
+
}] ? Op.Manager<I, E, A, Op.RestartableState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
466
|
+
strategy: "exclusive";
|
|
467
|
+
}] ? Op.Manager<I, E, A, Op.ExclusiveState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
468
|
+
strategy: "queue";
|
|
469
|
+
overflow: "replace-last";
|
|
470
|
+
dedupe: (a: I, b: I) => boolean;
|
|
471
|
+
}] ? Op.Manager<I, E, A, Op.QueueDropAndReplaceState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
472
|
+
strategy: "queue";
|
|
473
|
+
overflow: "replace-last";
|
|
474
|
+
}] ? Op.Manager<I, E, A, Op.QueueReplaceState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
475
|
+
strategy: "queue";
|
|
476
|
+
maxSize: number;
|
|
477
|
+
}] ? Op.Manager<I, E, A, Op.QueueDropState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
478
|
+
strategy: "queue";
|
|
479
|
+
dedupe: (a: I, b: I) => boolean;
|
|
480
|
+
}] ? Op.Manager<I, E, A, Op.QueueDropState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
481
|
+
strategy: "queue";
|
|
482
|
+
}] ? Op.Manager<I, E, A, Op.QueueState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
483
|
+
strategy: "buffered";
|
|
484
|
+
}] ? Op.Manager<I, E, A, Op.BufferedState<E, A> | MaybeRetry<E, O>> : never;
|
|
402
485
|
/**
|
|
403
486
|
* A reusable description of async work — decoupled from execution strategy and lifetime.
|
|
404
487
|
*
|
|
@@ -412,7 +495,11 @@ declare namespace Logged {
|
|
|
412
495
|
* @example
|
|
413
496
|
* ```ts
|
|
414
497
|
* const fetchUser = Op.create(
|
|
415
|
-
* (signal) => (id: string) =>
|
|
498
|
+
* (signal) => (id: string) =>
|
|
499
|
+
* fetch(`/users/${id}`, { signal }).then(r => {
|
|
500
|
+
* if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
|
|
501
|
+
* return r.json() as Promise<User>;
|
|
502
|
+
* }),
|
|
416
503
|
* (e) => new ApiError(e),
|
|
417
504
|
* );
|
|
418
505
|
*
|
|
@@ -655,22 +742,42 @@ declare namespace Op {
|
|
|
655
742
|
/**
|
|
656
743
|
* Creates an `Op` from an async factory and an error mapper.
|
|
657
744
|
*
|
|
658
|
-
* The factory receives an `AbortSignal` and returns a function that takes the input.
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
745
|
+
* The factory receives an `AbortSignal` and returns a function that takes the input. Capture
|
|
746
|
+
* the signal in the outer closure and pass it to cancellable APIs like `fetch`. The error
|
|
747
|
+
* mapper converts any thrown value into a typed error; it is never called for aborts.
|
|
748
|
+
*
|
|
749
|
+
* **If the factory ignores the signal**, cancellation silently stops working: the operation
|
|
750
|
+
* runs to completion and emits `Ok` even after the strategy has aborted it. This is harmless
|
|
751
|
+
* for `exclusive` and `once` (which do not abort in-flight work), but causes stale `Ok`
|
|
752
|
+
* emissions on `restartable`, `debounced`, `throttled`, `buffered`, and `queue` strategies
|
|
753
|
+
* where in-flight runs are regularly replaced or dropped.
|
|
662
754
|
*
|
|
663
755
|
* @example
|
|
664
756
|
* ```ts
|
|
757
|
+
* // With cancellation — fetch is aborted when the Op is replaced or aborted
|
|
665
758
|
* const saveProfile = Op.create(
|
|
666
759
|
* (signal) => (data: ProfileData) =>
|
|
667
760
|
* fetch("/profile", { method: "POST", body: JSON.stringify(data), signal })
|
|
668
|
-
* .then(r =>
|
|
761
|
+
* .then(r => {
|
|
762
|
+
* if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
|
|
763
|
+
* return r.json() as Promise<ProfileData>;
|
|
764
|
+
* }),
|
|
765
|
+
* (e) => new ApiError(e),
|
|
766
|
+
* );
|
|
767
|
+
*
|
|
768
|
+
* // No input — fetches the current user; manager.run() takes no arguments
|
|
769
|
+
* const fetchCurrentUser = Op.create(
|
|
770
|
+
* (signal) => () => fetch("/me", { signal }).then(r => {
|
|
771
|
+
* if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
|
|
772
|
+
* return r.json() as Promise<User>;
|
|
773
|
+
* }),
|
|
669
774
|
* (e) => new ApiError(e),
|
|
670
775
|
* );
|
|
776
|
+
* const manager = Op.interpret(fetchCurrentUser, { strategy: "once" });
|
|
777
|
+
* manager.run(); // no argument needed
|
|
671
778
|
* ```
|
|
672
779
|
*/
|
|
673
|
-
const create: <
|
|
780
|
+
const create: <E, A, I = void>(factory: (signal: AbortSignal) => (input: I) => Promise<A>, onError: (e: unknown) => E) => Op<I, E, A>;
|
|
674
781
|
/**
|
|
675
782
|
* Creates a successful Outcome.
|
|
676
783
|
*
|
|
@@ -890,108 +997,7 @@ declare namespace Op {
|
|
|
890
997
|
* const save = Op.interpret(saveOp, { strategy: "buffered" });
|
|
891
998
|
* ```
|
|
892
999
|
*/
|
|
893
|
-
function interpret<I, E, A
|
|
894
|
-
strategy: "throttled";
|
|
895
|
-
} & WithMs & WithTrailing & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableThrottledTrailingState<E, A>>;
|
|
896
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
897
|
-
strategy: "throttled";
|
|
898
|
-
} & WithMs & WithTrailing & WithTimeout<E>): Manager<I, E, A, ThrottledTrailingState<E, A>>;
|
|
899
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
900
|
-
strategy: "throttled";
|
|
901
|
-
} & WithMs & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableThrottledState<E, A>>;
|
|
902
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
903
|
-
strategy: "throttled";
|
|
904
|
-
} & WithMs & WithTimeout<E>): Manager<I, E, A, ThrottledState<E, A>>;
|
|
905
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
906
|
-
strategy: "debounced";
|
|
907
|
-
} & WithMs & WithLeading & WithMaxWait & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableDebouncedState<E, A>>;
|
|
908
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
909
|
-
strategy: "debounced";
|
|
910
|
-
} & WithMs & WithLeading & WithMaxWait & WithTimeout<E>): Manager<I, E, A, DebouncedState<E, A>>;
|
|
911
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
912
|
-
strategy: "debounced";
|
|
913
|
-
} & WithMs & WithLeading & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableDebouncedState<E, A>>;
|
|
914
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
915
|
-
strategy: "debounced";
|
|
916
|
-
} & WithMs & WithLeading & WithTimeout<E>): Manager<I, E, A, DebouncedState<E, A>>;
|
|
917
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
918
|
-
strategy: "debounced";
|
|
919
|
-
} & WithMs & WithMaxWait & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableDebouncedState<E, A>>;
|
|
920
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
921
|
-
strategy: "debounced";
|
|
922
|
-
} & WithMs & WithMaxWait & WithTimeout<E>): Manager<I, E, A, DebouncedState<E, A>>;
|
|
923
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
924
|
-
strategy: "debounced";
|
|
925
|
-
} & WithMs & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableDebouncedState<E, A>>;
|
|
926
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
927
|
-
strategy: "debounced";
|
|
928
|
-
} & WithMs & WithTimeout<E>): Manager<I, E, A, DebouncedState<E, A>>;
|
|
929
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
930
|
-
strategy: "concurrent";
|
|
931
|
-
} & WithN & WithOverflow<"queue"> & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableConcurrentQueueState<E, A>>;
|
|
932
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
933
|
-
strategy: "concurrent";
|
|
934
|
-
} & WithN & WithOverflow<"queue"> & WithTimeout<E>): Manager<I, E, A, ConcurrentQueueState<E, A>>;
|
|
935
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
936
|
-
strategy: "concurrent";
|
|
937
|
-
} & WithN & WithOverflow<"drop"> & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableConcurrentDropState<E, A>>;
|
|
938
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
939
|
-
strategy: "concurrent";
|
|
940
|
-
} & WithN & WithOverflow<"drop"> & WithTimeout<E>): Manager<I, E, A, ConcurrentDropState<E, A>>;
|
|
941
|
-
function interpret<I, K, E, A>(op: Op<I, E, A>, options: {
|
|
942
|
-
strategy: "keyed";
|
|
943
|
-
} & WithKey<I, K> & WithPerKey<"exclusive"> & WithTimeout<E>): KeyedManager<I, K, E, KeyedExclusivePerKey<E, A>>;
|
|
944
|
-
function interpret<I, K, E, A>(op: Op<I, E, A>, options: {
|
|
945
|
-
strategy: "keyed";
|
|
946
|
-
} & WithKey<I, K> & WithPerKey<"restartable"> & WithTimeout<E>): KeyedManager<I, K, E, KeyedRestartablePerKey<E, A>>;
|
|
947
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
948
|
-
strategy: "once";
|
|
949
|
-
} & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableOnceState<E, A>>;
|
|
950
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
951
|
-
strategy: "once";
|
|
952
|
-
} & WithTimeout<E>): Manager<I, E, A, OnceState<E, A>>;
|
|
953
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
954
|
-
strategy: "restartable";
|
|
955
|
-
} & WithMinInterval & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableRestartableState<E, A>>;
|
|
956
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
957
|
-
strategy: "restartable";
|
|
958
|
-
} & WithMinInterval & WithTimeout<E>): Manager<I, E, A, RestartableState<E, A>>;
|
|
959
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
960
|
-
strategy: "exclusive";
|
|
961
|
-
} & WithCooldown & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableExclusiveState<E, A>>;
|
|
962
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
963
|
-
strategy: "exclusive";
|
|
964
|
-
} & WithCooldown & WithTimeout<E>): Manager<I, E, A, ExclusiveState<E, A>>;
|
|
965
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
966
|
-
strategy: "queue";
|
|
967
|
-
} & WithMaxSize & WithOverflow<"replace-last"> & WithDedupe<I> & WithRetry<E> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, RetryableQueueDropAndReplaceState<E, A>>;
|
|
968
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
969
|
-
strategy: "queue";
|
|
970
|
-
} & WithMaxSize & WithOverflow<"replace-last"> & WithDedupe<I> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, QueueDropAndReplaceState<E, A>>;
|
|
971
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
972
|
-
strategy: "queue";
|
|
973
|
-
} & WithMaxSize & WithOverflow<"replace-last"> & WithRetry<E> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, RetryableQueueReplaceState<E, A>>;
|
|
974
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
975
|
-
strategy: "queue";
|
|
976
|
-
} & WithMaxSize & WithOverflow<"replace-last"> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, QueueReplaceState<E, A>>;
|
|
977
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
978
|
-
strategy: "queue";
|
|
979
|
-
} & (WithMaxSize | WithDedupe<I>) & WithRetry<E> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, RetryableQueueDropState<E, A>>;
|
|
980
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
981
|
-
strategy: "queue";
|
|
982
|
-
} & (WithMaxSize | WithDedupe<I>) & WithConcurrency & WithTimeout<E>): Manager<I, E, A, QueueDropState<E, A>>;
|
|
983
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
984
|
-
strategy: "queue";
|
|
985
|
-
} & WithRetry<E> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, RetryableQueueState<E, A>>;
|
|
986
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
987
|
-
strategy: "queue";
|
|
988
|
-
} & WithConcurrency & WithTimeout<E>): Manager<I, E, A, QueueState<E, A>>;
|
|
989
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
990
|
-
strategy: "buffered";
|
|
991
|
-
} & WithSize & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableBufferedState<E, A>>;
|
|
992
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
993
|
-
strategy: "buffered";
|
|
994
|
-
} & WithSize & WithTimeout<E>): Manager<I, E, A, BufferedState<E, A>>;
|
|
1000
|
+
function interpret<I, E, A, O extends AllInterpretOptions<I, E>>(op: Op<I, E, A>, options: O): InterpretResult<I, E, A, O>;
|
|
995
1001
|
}
|
|
996
1002
|
|
|
997
1003
|
/**
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Maybe, W as WithValue, a as WithLog, D as Deferred, R as Result, b as WithKind, c as WithError, d as RetryOptions, e as TimeoutOptions, f as
|
|
2
|
-
export { E as Err, N as None, O as Ok, S as Some } from './Task-
|
|
1
|
+
import { M as Maybe, W as WithValue, a as WithLog, D as Deferred, R as Result, b as WithKind, c as WithError, d as RetryOptions, e as TimeoutOptions, f as WithTimeout, g as WithMinInterval, h as WithCooldown, i as WithConcurrency, j as WithSize, k as WithMs, l as WithN, T as Task, m as WithErrors, n as WithFirst, o as WithSecond } from './Task-BbTMuIby.js';
|
|
2
|
+
export { E as Err, N as None, O as Ok, S as Some } from './Task-BbTMuIby.js';
|
|
3
3
|
import { N as NonEmptyList } from './NonEmptyList-BlGFjor5.js';
|
|
4
4
|
|
|
5
5
|
/** Keys of T for which undefined is assignable (i.e. optional fields). */
|
|
@@ -399,6 +399,89 @@ declare namespace Logged {
|
|
|
399
399
|
const run: <W, A>(data: Logged<W, A>) => readonly [A, ReadonlyArray<W>];
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
+
type MaybeRetry<E, O> = O extends {
|
|
403
|
+
retry: RetryOptions<E>;
|
|
404
|
+
} ? Op.Retrying<E> : never;
|
|
405
|
+
type AllInterpretOptions<I, E> = ({
|
|
406
|
+
strategy: "once";
|
|
407
|
+
retry?: RetryOptions<E>;
|
|
408
|
+
} & WithTimeout<E>) | ({
|
|
409
|
+
strategy: "restartable";
|
|
410
|
+
retry?: RetryOptions<E>;
|
|
411
|
+
} & WithMinInterval & WithTimeout<E>) | ({
|
|
412
|
+
strategy: "exclusive";
|
|
413
|
+
retry?: RetryOptions<E>;
|
|
414
|
+
} & WithCooldown & WithTimeout<E>) | ({
|
|
415
|
+
strategy: "queue";
|
|
416
|
+
retry?: RetryOptions<E>;
|
|
417
|
+
maxSize?: number;
|
|
418
|
+
overflow?: "drop" | "replace-last";
|
|
419
|
+
dedupe?: (a: I, b: I) => boolean;
|
|
420
|
+
} & WithConcurrency & WithTimeout<E>) | ({
|
|
421
|
+
strategy: "buffered";
|
|
422
|
+
retry?: RetryOptions<E>;
|
|
423
|
+
} & WithSize & WithTimeout<E>) | ({
|
|
424
|
+
strategy: "debounced";
|
|
425
|
+
retry?: RetryOptions<E>;
|
|
426
|
+
leading?: true;
|
|
427
|
+
maxWait?: number;
|
|
428
|
+
} & WithMs & WithTimeout<E>) | ({
|
|
429
|
+
strategy: "throttled";
|
|
430
|
+
retry?: RetryOptions<E>;
|
|
431
|
+
trailing?: true;
|
|
432
|
+
} & WithMs & WithTimeout<E>) | ({
|
|
433
|
+
strategy: "concurrent";
|
|
434
|
+
retry?: RetryOptions<E>;
|
|
435
|
+
overflow?: "queue" | "drop";
|
|
436
|
+
} & WithN & WithTimeout<E>) | ({
|
|
437
|
+
strategy: "keyed";
|
|
438
|
+
perKey?: "exclusive" | "restartable";
|
|
439
|
+
key: (input: I) => unknown;
|
|
440
|
+
} & WithTimeout<E>);
|
|
441
|
+
type KeyType<I, O> = O extends {
|
|
442
|
+
key: (input: I) => infer K;
|
|
443
|
+
} ? K : unknown;
|
|
444
|
+
type InterpretResult<I, E, A, O> = [O] extends [{
|
|
445
|
+
strategy: "throttled";
|
|
446
|
+
trailing: true;
|
|
447
|
+
}] ? Op.Manager<I, E, A, Op.ThrottledTrailingState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
448
|
+
strategy: "throttled";
|
|
449
|
+
}] ? Op.Manager<I, E, A, Op.ThrottledState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
450
|
+
strategy: "debounced";
|
|
451
|
+
}] ? Op.Manager<I, E, A, Op.DebouncedState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
452
|
+
strategy: "concurrent";
|
|
453
|
+
overflow: "queue";
|
|
454
|
+
}] ? Op.Manager<I, E, A, Op.ConcurrentQueueState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
455
|
+
strategy: "concurrent";
|
|
456
|
+
}] ? Op.Manager<I, E, A, Op.ConcurrentDropState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
457
|
+
strategy: "keyed";
|
|
458
|
+
perKey: "restartable";
|
|
459
|
+
}] ? Op.KeyedManager<I, KeyType<I, O>, E, Op.KeyedRestartablePerKey<E, A>> : [O] extends [{
|
|
460
|
+
strategy: "keyed";
|
|
461
|
+
}] ? Op.KeyedManager<I, KeyType<I, O>, E, Op.KeyedExclusivePerKey<E, A>> : [O] extends [{
|
|
462
|
+
strategy: "once";
|
|
463
|
+
}] ? Op.Manager<I, E, A, Op.OnceState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
464
|
+
strategy: "restartable";
|
|
465
|
+
}] ? Op.Manager<I, E, A, Op.RestartableState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
466
|
+
strategy: "exclusive";
|
|
467
|
+
}] ? Op.Manager<I, E, A, Op.ExclusiveState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
468
|
+
strategy: "queue";
|
|
469
|
+
overflow: "replace-last";
|
|
470
|
+
dedupe: (a: I, b: I) => boolean;
|
|
471
|
+
}] ? Op.Manager<I, E, A, Op.QueueDropAndReplaceState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
472
|
+
strategy: "queue";
|
|
473
|
+
overflow: "replace-last";
|
|
474
|
+
}] ? Op.Manager<I, E, A, Op.QueueReplaceState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
475
|
+
strategy: "queue";
|
|
476
|
+
maxSize: number;
|
|
477
|
+
}] ? Op.Manager<I, E, A, Op.QueueDropState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
478
|
+
strategy: "queue";
|
|
479
|
+
dedupe: (a: I, b: I) => boolean;
|
|
480
|
+
}] ? Op.Manager<I, E, A, Op.QueueDropState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
481
|
+
strategy: "queue";
|
|
482
|
+
}] ? Op.Manager<I, E, A, Op.QueueState<E, A> | MaybeRetry<E, O>> : [O] extends [{
|
|
483
|
+
strategy: "buffered";
|
|
484
|
+
}] ? Op.Manager<I, E, A, Op.BufferedState<E, A> | MaybeRetry<E, O>> : never;
|
|
402
485
|
/**
|
|
403
486
|
* A reusable description of async work — decoupled from execution strategy and lifetime.
|
|
404
487
|
*
|
|
@@ -412,7 +495,11 @@ declare namespace Logged {
|
|
|
412
495
|
* @example
|
|
413
496
|
* ```ts
|
|
414
497
|
* const fetchUser = Op.create(
|
|
415
|
-
* (signal) => (id: string) =>
|
|
498
|
+
* (signal) => (id: string) =>
|
|
499
|
+
* fetch(`/users/${id}`, { signal }).then(r => {
|
|
500
|
+
* if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
|
|
501
|
+
* return r.json() as Promise<User>;
|
|
502
|
+
* }),
|
|
416
503
|
* (e) => new ApiError(e),
|
|
417
504
|
* );
|
|
418
505
|
*
|
|
@@ -655,22 +742,42 @@ declare namespace Op {
|
|
|
655
742
|
/**
|
|
656
743
|
* Creates an `Op` from an async factory and an error mapper.
|
|
657
744
|
*
|
|
658
|
-
* The factory receives an `AbortSignal` and returns a function that takes the input.
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
745
|
+
* The factory receives an `AbortSignal` and returns a function that takes the input. Capture
|
|
746
|
+
* the signal in the outer closure and pass it to cancellable APIs like `fetch`. The error
|
|
747
|
+
* mapper converts any thrown value into a typed error; it is never called for aborts.
|
|
748
|
+
*
|
|
749
|
+
* **If the factory ignores the signal**, cancellation silently stops working: the operation
|
|
750
|
+
* runs to completion and emits `Ok` even after the strategy has aborted it. This is harmless
|
|
751
|
+
* for `exclusive` and `once` (which do not abort in-flight work), but causes stale `Ok`
|
|
752
|
+
* emissions on `restartable`, `debounced`, `throttled`, `buffered`, and `queue` strategies
|
|
753
|
+
* where in-flight runs are regularly replaced or dropped.
|
|
662
754
|
*
|
|
663
755
|
* @example
|
|
664
756
|
* ```ts
|
|
757
|
+
* // With cancellation — fetch is aborted when the Op is replaced or aborted
|
|
665
758
|
* const saveProfile = Op.create(
|
|
666
759
|
* (signal) => (data: ProfileData) =>
|
|
667
760
|
* fetch("/profile", { method: "POST", body: JSON.stringify(data), signal })
|
|
668
|
-
* .then(r =>
|
|
761
|
+
* .then(r => {
|
|
762
|
+
* if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
|
|
763
|
+
* return r.json() as Promise<ProfileData>;
|
|
764
|
+
* }),
|
|
765
|
+
* (e) => new ApiError(e),
|
|
766
|
+
* );
|
|
767
|
+
*
|
|
768
|
+
* // No input — fetches the current user; manager.run() takes no arguments
|
|
769
|
+
* const fetchCurrentUser = Op.create(
|
|
770
|
+
* (signal) => () => fetch("/me", { signal }).then(r => {
|
|
771
|
+
* if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
|
|
772
|
+
* return r.json() as Promise<User>;
|
|
773
|
+
* }),
|
|
669
774
|
* (e) => new ApiError(e),
|
|
670
775
|
* );
|
|
776
|
+
* const manager = Op.interpret(fetchCurrentUser, { strategy: "once" });
|
|
777
|
+
* manager.run(); // no argument needed
|
|
671
778
|
* ```
|
|
672
779
|
*/
|
|
673
|
-
const create: <
|
|
780
|
+
const create: <E, A, I = void>(factory: (signal: AbortSignal) => (input: I) => Promise<A>, onError: (e: unknown) => E) => Op<I, E, A>;
|
|
674
781
|
/**
|
|
675
782
|
* Creates a successful Outcome.
|
|
676
783
|
*
|
|
@@ -890,108 +997,7 @@ declare namespace Op {
|
|
|
890
997
|
* const save = Op.interpret(saveOp, { strategy: "buffered" });
|
|
891
998
|
* ```
|
|
892
999
|
*/
|
|
893
|
-
function interpret<I, E, A
|
|
894
|
-
strategy: "throttled";
|
|
895
|
-
} & WithMs & WithTrailing & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableThrottledTrailingState<E, A>>;
|
|
896
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
897
|
-
strategy: "throttled";
|
|
898
|
-
} & WithMs & WithTrailing & WithTimeout<E>): Manager<I, E, A, ThrottledTrailingState<E, A>>;
|
|
899
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
900
|
-
strategy: "throttled";
|
|
901
|
-
} & WithMs & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableThrottledState<E, A>>;
|
|
902
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
903
|
-
strategy: "throttled";
|
|
904
|
-
} & WithMs & WithTimeout<E>): Manager<I, E, A, ThrottledState<E, A>>;
|
|
905
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
906
|
-
strategy: "debounced";
|
|
907
|
-
} & WithMs & WithLeading & WithMaxWait & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableDebouncedState<E, A>>;
|
|
908
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
909
|
-
strategy: "debounced";
|
|
910
|
-
} & WithMs & WithLeading & WithMaxWait & WithTimeout<E>): Manager<I, E, A, DebouncedState<E, A>>;
|
|
911
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
912
|
-
strategy: "debounced";
|
|
913
|
-
} & WithMs & WithLeading & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableDebouncedState<E, A>>;
|
|
914
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
915
|
-
strategy: "debounced";
|
|
916
|
-
} & WithMs & WithLeading & WithTimeout<E>): Manager<I, E, A, DebouncedState<E, A>>;
|
|
917
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
918
|
-
strategy: "debounced";
|
|
919
|
-
} & WithMs & WithMaxWait & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableDebouncedState<E, A>>;
|
|
920
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
921
|
-
strategy: "debounced";
|
|
922
|
-
} & WithMs & WithMaxWait & WithTimeout<E>): Manager<I, E, A, DebouncedState<E, A>>;
|
|
923
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
924
|
-
strategy: "debounced";
|
|
925
|
-
} & WithMs & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableDebouncedState<E, A>>;
|
|
926
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
927
|
-
strategy: "debounced";
|
|
928
|
-
} & WithMs & WithTimeout<E>): Manager<I, E, A, DebouncedState<E, A>>;
|
|
929
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
930
|
-
strategy: "concurrent";
|
|
931
|
-
} & WithN & WithOverflow<"queue"> & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableConcurrentQueueState<E, A>>;
|
|
932
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
933
|
-
strategy: "concurrent";
|
|
934
|
-
} & WithN & WithOverflow<"queue"> & WithTimeout<E>): Manager<I, E, A, ConcurrentQueueState<E, A>>;
|
|
935
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
936
|
-
strategy: "concurrent";
|
|
937
|
-
} & WithN & WithOverflow<"drop"> & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableConcurrentDropState<E, A>>;
|
|
938
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
939
|
-
strategy: "concurrent";
|
|
940
|
-
} & WithN & WithOverflow<"drop"> & WithTimeout<E>): Manager<I, E, A, ConcurrentDropState<E, A>>;
|
|
941
|
-
function interpret<I, K, E, A>(op: Op<I, E, A>, options: {
|
|
942
|
-
strategy: "keyed";
|
|
943
|
-
} & WithKey<I, K> & WithPerKey<"exclusive"> & WithTimeout<E>): KeyedManager<I, K, E, KeyedExclusivePerKey<E, A>>;
|
|
944
|
-
function interpret<I, K, E, A>(op: Op<I, E, A>, options: {
|
|
945
|
-
strategy: "keyed";
|
|
946
|
-
} & WithKey<I, K> & WithPerKey<"restartable"> & WithTimeout<E>): KeyedManager<I, K, E, KeyedRestartablePerKey<E, A>>;
|
|
947
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
948
|
-
strategy: "once";
|
|
949
|
-
} & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableOnceState<E, A>>;
|
|
950
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
951
|
-
strategy: "once";
|
|
952
|
-
} & WithTimeout<E>): Manager<I, E, A, OnceState<E, A>>;
|
|
953
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
954
|
-
strategy: "restartable";
|
|
955
|
-
} & WithMinInterval & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableRestartableState<E, A>>;
|
|
956
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
957
|
-
strategy: "restartable";
|
|
958
|
-
} & WithMinInterval & WithTimeout<E>): Manager<I, E, A, RestartableState<E, A>>;
|
|
959
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
960
|
-
strategy: "exclusive";
|
|
961
|
-
} & WithCooldown & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableExclusiveState<E, A>>;
|
|
962
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
963
|
-
strategy: "exclusive";
|
|
964
|
-
} & WithCooldown & WithTimeout<E>): Manager<I, E, A, ExclusiveState<E, A>>;
|
|
965
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
966
|
-
strategy: "queue";
|
|
967
|
-
} & WithMaxSize & WithOverflow<"replace-last"> & WithDedupe<I> & WithRetry<E> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, RetryableQueueDropAndReplaceState<E, A>>;
|
|
968
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
969
|
-
strategy: "queue";
|
|
970
|
-
} & WithMaxSize & WithOverflow<"replace-last"> & WithDedupe<I> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, QueueDropAndReplaceState<E, A>>;
|
|
971
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
972
|
-
strategy: "queue";
|
|
973
|
-
} & WithMaxSize & WithOverflow<"replace-last"> & WithRetry<E> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, RetryableQueueReplaceState<E, A>>;
|
|
974
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
975
|
-
strategy: "queue";
|
|
976
|
-
} & WithMaxSize & WithOverflow<"replace-last"> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, QueueReplaceState<E, A>>;
|
|
977
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
978
|
-
strategy: "queue";
|
|
979
|
-
} & (WithMaxSize | WithDedupe<I>) & WithRetry<E> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, RetryableQueueDropState<E, A>>;
|
|
980
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
981
|
-
strategy: "queue";
|
|
982
|
-
} & (WithMaxSize | WithDedupe<I>) & WithConcurrency & WithTimeout<E>): Manager<I, E, A, QueueDropState<E, A>>;
|
|
983
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
984
|
-
strategy: "queue";
|
|
985
|
-
} & WithRetry<E> & WithConcurrency & WithTimeout<E>): Manager<I, E, A, RetryableQueueState<E, A>>;
|
|
986
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
987
|
-
strategy: "queue";
|
|
988
|
-
} & WithConcurrency & WithTimeout<E>): Manager<I, E, A, QueueState<E, A>>;
|
|
989
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
990
|
-
strategy: "buffered";
|
|
991
|
-
} & WithSize & WithRetry<E> & WithTimeout<E>): Manager<I, E, A, RetryableBufferedState<E, A>>;
|
|
992
|
-
function interpret<I, E, A>(op: Op<I, E, A>, options: {
|
|
993
|
-
strategy: "buffered";
|
|
994
|
-
} & WithSize & WithTimeout<E>): Manager<I, E, A, BufferedState<E, A>>;
|
|
1000
|
+
function interpret<I, E, A, O extends AllInterpretOptions<I, E>>(op: Op<I, E, A>, options: O): InterpretResult<I, E, A, O>;
|
|
995
1001
|
}
|
|
996
1002
|
|
|
997
1003
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { and, compose, constFalse, constNull, constTrue, constUndefined, constVoid, constant, converge, curry, curry3, curry4, flip, flow, identity, juxt, memoize, memoizeWeak, not, on, once, or, pipe, tap, uncurry, uncurry3, uncurry4 } from './composition.mjs';
|
|
2
|
-
export { D as Deferred, E as Err, M as Maybe, N as None, O as Ok, R as Result, S as Some, T as Task } from './Task-
|
|
2
|
+
export { D as Deferred, E as Err, M as Maybe, N as None, O as Ok, R as Result, S as Some, T as Task } from './Task-C7M6gLYu.mjs';
|
|
3
3
|
export { Failure, Invalid, Lens, Loading, Logged, NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, State, Success, TaskMaybe, TaskResult, TaskValidation, These, TheseBoth, TheseFirst, TheseSecond, Tuple, Valid, Validation } from './core.mjs';
|
|
4
4
|
export { Brand } from './types.mjs';
|
|
5
5
|
export { N as NonEmptyList, i as isNonEmptyList } from './NonEmptyList-BlGFjor5.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { and, compose, constFalse, constNull, constTrue, constUndefined, constVoid, constant, converge, curry, curry3, curry4, flip, flow, identity, juxt, memoize, memoizeWeak, not, on, once, or, pipe, tap, uncurry, uncurry3, uncurry4 } from './composition.js';
|
|
2
|
-
export { D as Deferred, E as Err, M as Maybe, N as None, O as Ok, R as Result, S as Some, T as Task } from './Task-
|
|
2
|
+
export { D as Deferred, E as Err, M as Maybe, N as None, O as Ok, R as Result, S as Some, T as Task } from './Task-BbTMuIby.js';
|
|
3
3
|
export { Failure, Invalid, Lens, Loading, Logged, NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, State, Success, TaskMaybe, TaskResult, TaskValidation, These, TheseBoth, TheseFirst, TheseSecond, Tuple, Valid, Validation } from './core.js';
|
|
4
4
|
export { Brand } from './types.js';
|
|
5
5
|
export { N as NonEmptyList, i as isNonEmptyList } from './NonEmptyList-BlGFjor5.js';
|
package/dist/utils.d.mts
CHANGED
package/dist/utils.d.ts
CHANGED