@demlik/tea 0.18.0 → 0.20.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/README.md +26 -19
- package/dist/agent/index.d.ts +44 -13
- package/dist/agent/index.js +10 -10
- package/dist/{chunk-PCJA2HTZ.js → chunk-2774I242.js} +7 -7
- package/dist/chunk-2774I242.js.map +1 -0
- package/dist/{chunk-YIMOFXST.js → chunk-2R62Q5UK.js} +3 -3
- package/dist/chunk-2R62Q5UK.js.map +1 -0
- package/dist/{chunk-PQSDUX6B.js → chunk-5HVKDHY6.js} +3 -3
- package/dist/{chunk-PQSDUX6B.js.map → chunk-5HVKDHY6.js.map} +1 -1
- package/dist/{chunk-WTSOW2MD.js → chunk-72CN3VPY.js} +5 -5
- package/dist/{chunk-WTSOW2MD.js.map → chunk-72CN3VPY.js.map} +1 -1
- package/dist/{chunk-JVE2LBFJ.js → chunk-A73IJ27X.js} +3 -3
- package/dist/{chunk-JVE2LBFJ.js.map → chunk-A73IJ27X.js.map} +1 -1
- package/dist/{chunk-I7E7AD2S.js → chunk-AIXC33SE.js} +4 -4
- package/dist/chunk-AIXC33SE.js.map +1 -0
- package/dist/{chunk-FNGZMVIT.js → chunk-DVNXEB7V.js} +3 -3
- package/dist/chunk-DVNXEB7V.js.map +1 -0
- package/dist/{chunk-XVIKSRCK.js → chunk-EA47MI5Q.js} +4 -4
- package/dist/{chunk-XVIKSRCK.js.map → chunk-EA47MI5Q.js.map} +1 -1
- package/dist/{chunk-IHUNKHDX.js → chunk-FTCYY2DO.js} +3 -3
- package/dist/{chunk-IHUNKHDX.js.map → chunk-FTCYY2DO.js.map} +1 -1
- package/dist/{chunk-JVKU2UQC.js → chunk-HX3C6LDK.js} +3 -3
- package/dist/{chunk-JVKU2UQC.js.map → chunk-HX3C6LDK.js.map} +1 -1
- package/dist/{chunk-H2ELKHI6.js → chunk-JAKM53JF.js} +4 -4
- package/dist/chunk-JAKM53JF.js.map +1 -0
- package/dist/{chunk-JYNYG5SF.js → chunk-NGYFBD5G.js} +3 -3
- package/dist/chunk-NGYFBD5G.js.map +1 -0
- package/dist/{chunk-AIIXV4XB.js → chunk-RKVUVALV.js} +2 -2
- package/dist/chunk-RKVUVALV.js.map +1 -0
- package/dist/{chunk-C3G2QFEZ.js → chunk-TAKPC6SD.js} +4 -4
- package/dist/{chunk-C3G2QFEZ.js.map → chunk-TAKPC6SD.js.map} +1 -1
- package/dist/{chunk-BRX3243I.js → chunk-TGJLXZAU.js} +3 -3
- package/dist/{chunk-BRX3243I.js.map → chunk-TGJLXZAU.js.map} +1 -1
- package/dist/{chunk-AHW2CLPT.js → chunk-UHAQ4PI6.js} +4 -4
- package/dist/{chunk-AHW2CLPT.js.map → chunk-UHAQ4PI6.js.map} +1 -1
- package/dist/{chunk-H3MWNH7A.js → chunk-XWIE5V7R.js} +4 -4
- package/dist/{chunk-H3MWNH7A.js.map → chunk-XWIE5V7R.js.map} +1 -1
- package/dist/{core-Ce9ncpuv.d.ts → core-CtvAyPpH.d.ts} +153 -1
- package/dist/devtools/index.d.ts +17 -0
- package/dist/devtools/index.js.map +1 -1
- package/dist/do/index.d.ts +12 -12
- package/dist/do/index.js +11 -11
- package/dist/{drive-loop-CsUsW3Wo.d.ts → drive-loop-Dw1sGSsW.d.ts} +1 -1
- package/dist/{durable-effects-BmUrRA-h.d.ts → durable-effects-Ump5lSdO.d.ts} +1 -1
- package/dist/effect/index.d.ts +124 -5
- package/dist/effect/index.js +33 -4
- package/dist/effect/index.js.map +1 -1
- package/dist/extension/index.d.ts +84 -3
- package/dist/extension/index.js +2 -2
- package/dist/extension/index.js.map +1 -1
- package/dist/flow/index.d.ts +29 -13
- package/dist/flow/index.js +11 -11
- package/dist/flow/index.js.map +1 -1
- package/dist/idempotency/index.d.ts +11 -3
- package/dist/idempotency/index.js +3 -3
- package/dist/{index-D8sYVzCI.d.ts → index-Bk2hBUdK.d.ts} +6 -1
- package/dist/{index-2kNxy6az.d.ts → index-CKtEKGyp.d.ts} +15 -3
- package/dist/{index-e36uEyl4.d.ts → index-CVU7SK3a.d.ts} +2 -2
- package/dist/{index-Dy3379ve.d.ts → index-CZZ3HI-Z.d.ts} +4 -4
- package/dist/{index-Ce5GYAuI.d.ts → index-CrcoVfd_.d.ts} +2 -2
- package/dist/{index-DWdg7R1l.d.ts → index-D3NY3VCN.d.ts} +5 -1
- package/dist/{index-B1Wzarkl.d.ts → index-Dl71V7kt.d.ts} +1 -1
- package/dist/{index-Bf9_bNql.d.ts → index-EIgfl83J.d.ts} +2 -2
- package/dist/index.d.ts +66 -5
- package/dist/index.js +2 -2
- package/dist/jev/index.d.ts +39 -27
- package/dist/jev/index.js +12 -8
- package/dist/jev/index.js.map +1 -1
- package/dist/{machine-CuojfZup.d.ts → machine-Dtre2TmN.d.ts} +9 -7
- package/dist/machine-viz/index.d.ts +2 -1
- package/dist/machine-viz/index.js +2 -2
- package/dist/machine-viz/index.js.map +1 -1
- package/dist/mem/index.d.ts +2 -2
- package/dist/mem/index.js +2 -2
- package/dist/node/index.d.ts +11 -2
- package/dist/node/index.js +2 -2
- package/dist/node/index.js.map +1 -1
- package/dist/otel/index.d.ts +10 -10
- package/dist/otel/index.js +10 -10
- package/dist/paginate/index.d.ts +5 -4
- package/dist/paginate/index.js +5 -5
- package/dist/parity/index.d.ts +3 -3
- package/dist/parity/index.js +3 -3
- package/dist/pbt/index.d.ts +1 -1
- package/dist/pbt/index.js +2 -2
- package/dist/persistence/index.d.ts +5 -5
- package/dist/persistence/index.js +4 -4
- package/dist/promise/index.d.ts +7 -2
- package/dist/promise/index.js +4 -4
- package/dist/react/index.d.ts +2 -2
- package/dist/resilience/index.d.ts +7 -6
- package/dist/resilience/index.js +5 -5
- package/dist/resilience/index.js.map +1 -1
- package/dist/{index-BnsAqn0-.d.ts → run-fiBe7pOG.d.ts} +8 -5
- package/dist/{runtime-types-BKg2CGMx.d.ts → runtime-types-DEluQgGO.d.ts} +74 -2
- package/dist/testing/effect/index.d.ts +5 -5
- package/dist/testing/effect/index.js +8 -8
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +3 -3
- package/dist/testing/promise/index.d.ts +4 -4
- package/dist/testing/promise/index.js +5 -5
- package/dist/timing/index.d.ts +4 -4
- package/dist/timing/index.js +4 -4
- package/dist/types-CXNzlbAg.d.ts +9 -0
- package/dist/work-queue/index.d.ts +4 -4
- package/dist/work-queue/index.js +2 -2
- package/dist/work-queue/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/chunk-AIIXV4XB.js.map +0 -1
- package/dist/chunk-FNGZMVIT.js.map +0 -1
- package/dist/chunk-H2ELKHI6.js.map +0 -1
- package/dist/chunk-I7E7AD2S.js.map +0 -1
- package/dist/chunk-JYNYG5SF.js.map +0 -1
- package/dist/chunk-PCJA2HTZ.js.map +0 -1
- package/dist/chunk-YIMOFXST.js.map +0 -1
- package/dist/types-SzNSHKlV.d.ts +0 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { I as IdempotencyStore } from '../index-Bc40JWVl.js';
|
|
2
2
|
export { a as IdempotencyEntry, e as evictExpired, i as initStore, r as recall, b as remember, s as seen } from '../index-Bc40JWVl.js';
|
|
3
|
-
import { a as CmdOf, b as CmdDef } from '../core-
|
|
4
|
-
import { Q as QueueItem } from '../index-
|
|
3
|
+
import { a as CmdOf, b as CmdDef } from '../core-CtvAyPpH.js';
|
|
4
|
+
import { Q as QueueItem } from '../index-D3NY3VCN.js';
|
|
5
5
|
import '@standard-schema/spec';
|
|
6
|
-
import '../runtime-types-
|
|
6
|
+
import '../runtime-types-DEluQgGO.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A cached intake entry: either a key whose work is still in flight
|
|
@@ -69,6 +69,10 @@ declare function intakeProcessDef<P>(): CmdDef<"intake:process", {
|
|
|
69
69
|
/** The original payload, for the worker to process. */
|
|
70
70
|
readonly payload: P;
|
|
71
71
|
}, undefined, never>;
|
|
72
|
+
/**
|
|
73
|
+
* The Cmd intake emits for a first-time request: process `payload` for the
|
|
74
|
+
* queue item `itemId`.
|
|
75
|
+
*/
|
|
72
76
|
type IntakeProcessCmd<P> = CmdOf<ReturnType<typeof intakeProcessDef<P>>>;
|
|
73
77
|
/**
|
|
74
78
|
* A duplicate of an already-completed key arrived — replay the cached result
|
|
@@ -80,6 +84,10 @@ declare function intakeReplayDef<R>(): CmdDef<"intake:replay", {
|
|
|
80
84
|
/** The result the ORIGINAL request produced, recalled from the cache. */
|
|
81
85
|
readonly result: R;
|
|
82
86
|
}, undefined, never>;
|
|
87
|
+
/**
|
|
88
|
+
* The Cmd intake emits for a duplicate of a completed request: hand back the
|
|
89
|
+
* cached `result` instead of redoing the work.
|
|
90
|
+
*/
|
|
83
91
|
type IntakeReplayCmd<R> = CmdOf<ReturnType<typeof intakeReplayDef<R>>>;
|
|
84
92
|
/** The Cmd union the intake verbs emit. */
|
|
85
93
|
type IntakeCmd<P, R> = IntakeProcessCmd<P> | IntakeReplayCmd<R>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { createIntake, intakeProcessDef, intakeReplayDef } from '../chunk-
|
|
1
|
+
export { createIntake, intakeProcessDef, intakeReplayDef } from '../chunk-NGYFBD5G.js';
|
|
2
2
|
export { evictExpired, initStore, recall, remember, seen } from '../chunk-PR6TB3BL.js';
|
|
3
3
|
import '../chunk-4LPY67E4.js';
|
|
4
4
|
import '../chunk-TXN2KFHF.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-DVNXEB7V.js';
|
|
6
|
+
import '../chunk-RKVUVALV.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CmdOf, b as CmdDef, d as SettledOk, e as SettledErr, f as TaggedError, C as Cmd } from './core-
|
|
1
|
+
import { a as CmdOf, b as CmdDef, d as SettledOk, e as SettledErr, f as TaggedError, C as Cmd } from './core-CtvAyPpH.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The snapshot knob.
|
|
@@ -79,6 +79,10 @@ declare function snapshotWriteDef<V>(): CmdDef<"snapshot_write", {
|
|
|
79
79
|
readonly [detail: string]: unknown;
|
|
80
80
|
readonly _tag: "snapshot_write_failed";
|
|
81
81
|
}>;
|
|
82
|
+
/**
|
|
83
|
+
* The Cmd a snapshot decision emits to write a checkpoint: `payload` under
|
|
84
|
+
* `key`, at sequence `seq`.
|
|
85
|
+
*/
|
|
82
86
|
type SnapshotWriteCmd<V> = CmdOf<ReturnType<typeof snapshotWriteDef<V>>>;
|
|
83
87
|
/**
|
|
84
88
|
* The checkpoint-READ Cmd a `requestLoad` decision emits — the recovery half of
|
|
@@ -98,6 +102,7 @@ declare function snapshotLoadDef<V>(): CmdDef<"snapshot_load", {
|
|
|
98
102
|
readonly [detail: string]: unknown;
|
|
99
103
|
readonly _tag: "snapshot_load_failed";
|
|
100
104
|
}>;
|
|
105
|
+
/** The Cmd `requestLoad` emits to read the checkpoint saved under `key`. */
|
|
101
106
|
type SnapshotLoadCmd<V = unknown> = CmdOf<ReturnType<typeof snapshotLoadDef<V>>>;
|
|
102
107
|
/**
|
|
103
108
|
* The Msg the engine mints when a write lands. Fold it through
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as CmdOf, b as CmdDef, f as TaggedError, n as MalformedResult, T as TimerDeps, C as Cmd } from './core-
|
|
1
|
+
import { a as CmdOf, b as CmdDef, f as TaggedError, n as MalformedResult, T as TimerDeps, C as Cmd } from './core-CtvAyPpH.js';
|
|
2
2
|
import { RetryState, AnyRetryPolicy } from './retry-backoff/index.js';
|
|
3
|
-
import { T as TtlCache, D as DeadlineExceeded, a as DeadlineSub } from './index-
|
|
3
|
+
import { T as TtlCache, D as DeadlineExceeded, a as DeadlineSub } from './index-CVU7SK3a.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @packageDocumentation
|
|
@@ -357,6 +357,10 @@ interface DeadlineConfig {
|
|
|
357
357
|
* stay the vocabulary of every knob that passes no name.
|
|
358
358
|
*/
|
|
359
359
|
declare const DEFAULT_RESILIENT_NAME = "resilient";
|
|
360
|
+
/**
|
|
361
|
+
* The Msg-name family a resilient call uses when it is given no name:
|
|
362
|
+
* `resilient`.
|
|
363
|
+
*/
|
|
360
364
|
type DefaultResilientName = typeof DEFAULT_RESILIENT_NAME;
|
|
361
365
|
/** The run Cmd's `type` for the `N` family. */
|
|
362
366
|
type ResilientRunType<N extends string> = `${N}_run`;
|
|
@@ -531,6 +535,10 @@ declare function runCmdDef<I, R, N extends string = DefaultResilientName>(name?:
|
|
|
531
535
|
readonly [detail: string]: unknown;
|
|
532
536
|
readonly _tag: "port_rejected";
|
|
533
537
|
}>;
|
|
538
|
+
/**
|
|
539
|
+
* The type of the `Cmd.define` definition that `runCmdDef` returns for a
|
|
540
|
+
* resilient call's run Cmd.
|
|
541
|
+
*/
|
|
534
542
|
type RunCmdDef<I, R, N extends string = DefaultResilientName> = ReturnType<typeof runCmdDef<I, R, N>>;
|
|
535
543
|
/**
|
|
536
544
|
* The run Cmd value. `R` is its settle value — `unknown` reads any knob's run
|
|
@@ -556,6 +564,10 @@ type SucceedMsg<R, N extends string = DefaultResilientName, I = unknown> = {
|
|
|
556
564
|
readonly value: R;
|
|
557
565
|
readonly at: number;
|
|
558
566
|
};
|
|
567
|
+
/**
|
|
568
|
+
* The Msg the engine mints when a resilient call's handler fails:
|
|
569
|
+
* `<name>_run_err`, carrying the Cmd and the error.
|
|
570
|
+
*/
|
|
559
571
|
type FailMsg<N extends string = DefaultResilientName, I = unknown, E = RunErr | MalformedResult> = {
|
|
560
572
|
readonly type: ResilientErrType<N>;
|
|
561
573
|
readonly cmd: RunCmd<I, N>;
|
|
@@ -694,4 +706,4 @@ declare function liftResilience<S extends {
|
|
|
694
706
|
resilience: ResilientState<I, R>;
|
|
695
707
|
}, I, R, C extends Cmd>(state: S, result: readonly [ResilientState<I, R>, readonly C[]]): readonly [S, readonly C[]];
|
|
696
708
|
|
|
697
|
-
export { initBucket as A, initCircuit as B, type CacheConfig as C,
|
|
709
|
+
export { initBucket as A, initCircuit as B, type CacheConfig as C, type DefaultResilientName as D, initWindow as E, type FailMsg as F, liftResilience as G, onFailure as H, onSuccess as I, record as J, refill as K, remaining as L, runCmdDef as M, tryConsume as N, type RunCmd as R, type SucceedMsg as S, type TokenBucket as T, type ResilientTimerMsg as a, type ResilientState as b, type DeadlineNameOf as c, type ResilientConfig as d, type CallBudget as e, type CallPhase as f, type CircuitConfig as g, type CircuitPolicy as h, type CircuitState as i, DEFAULT_RESILIENT_NAME as j, type DeadlineExceededError as k, type RateLimitConfig as l, type DeadlineConfig as m, type ResilientDeadlineType as n, type ResilientErrType as o, type ResilientOkType as p, type ResilientRunType as q, type RunCmdDef as r, type RunErr as s, type SettleMsg as t, type SettleOutcome as u, type SettleResult as v, type SlidingWindow as w, canPass as x, createResilientCall as y, defaultCircuitPolicy as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { k as SubId,
|
|
2
|
-
import { S as SubscribeHandler } from './types-
|
|
1
|
+
import { k as SubId, S as Sub, l as DepKeyedSub, D as Dispose, T as TimerDeps } from './core-CtvAyPpH.js';
|
|
2
|
+
import { S as SubscribeHandler } from './types-CXNzlbAg.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* internal/resilience/deadline — a one-shot Sub that fires when an ABSOLUTE wall-clock
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as CmdDef, T as TimerDeps, C as Cmd } from './core-
|
|
2
|
-
import { S as SnapshotWriteCmd, a as SnapshotState, b as SnapshotSavedMsg } from './index-
|
|
3
|
-
import { D as DeadlineExceeded, a as DeadlineSub } from './index-
|
|
4
|
-
import { Q as QueueItem } from './index-
|
|
1
|
+
import { b as CmdDef, T as TimerDeps, C as Cmd } from './core-CtvAyPpH.js';
|
|
2
|
+
import { S as SnapshotWriteCmd, a as SnapshotState, b as SnapshotSavedMsg } from './index-Bk2hBUdK.js';
|
|
3
|
+
import { D as DeadlineExceeded, a as DeadlineSub } from './index-CVU7SK3a.js';
|
|
4
|
+
import { Q as QueueItem } from './index-D3NY3VCN.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The monitored-run knob. EVERY field is optional:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Cmd, P as Port } from './core-
|
|
2
|
-
import { Q as QueueItem } from './index-
|
|
1
|
+
import { C as Cmd, P as Port } from './core-CtvAyPpH.js';
|
|
2
|
+
import { Q as QueueItem } from './index-D3NY3VCN.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* internal/flow/fan-out — scatter-gather over a bounded-concurrency work list.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Store } from './runtime-types-
|
|
1
|
+
import { S as Store } from './runtime-types-DEluQgGO.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* internal/work-queue — substrate-agnostic work-queue lifecycle on `Store<S>`.
|
|
@@ -20,6 +20,10 @@ import { S as Store } from './runtime-types-BKg2CGMx.js';
|
|
|
20
20
|
* their own store and put the foreign-key string in `output`.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Where a queue item is in its lifecycle: `pending`, `running`, `done`,
|
|
25
|
+
* `failed` or `cancelled`.
|
|
26
|
+
*/
|
|
23
27
|
type QueueItemStatus = "pending" | "running" | "done" | "failed" | "cancelled";
|
|
24
28
|
/**
|
|
25
29
|
* A single queue entry. Every field is `readonly`: a persisted slice is
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Cmd, T as TimerDeps,
|
|
2
|
-
import { D as DeadlineExceeded, a as DeadlineSub, b as DeadlinesSub } from './index-
|
|
1
|
+
import { C as Cmd, T as TimerDeps, c as Subscribe } from './core-CtvAyPpH.js';
|
|
2
|
+
import { D as DeadlineExceeded, a as DeadlineSub, b as DeadlinesSub } from './index-CVU7SK3a.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* internal/flow/batch-window — coalesce a stream of items into size- or
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { B as BootingRuntime, R as Runtime } from './runtime-types-
|
|
2
|
-
export { b as BootedRunHandle,
|
|
3
|
-
import { C as Cmd,
|
|
4
|
-
export { A as AnyCmdDef,
|
|
5
|
-
import { S as SubscribeHandler } from './types-
|
|
1
|
+
import { B as BootingRuntime, R as Runtime } from './runtime-types-DEluQgGO.js';
|
|
2
|
+
export { b as BootedRunHandle, e as Branded, C as CtxArg, D as DeletableStore, f as DispatchDiscardedError, c as DispatchSettle, g as DisposeTimeoutNotice, h as DriveFailedError, i as DriveStalledError, E as EngineRun, j as FencedRead, F as FencedStore, k as FoldRefusal, I as IdentityDropNotice, l as MachineTypes, M as Migrated, O as OnError, P as PortNameCollisionError, Q as QuiescenceTimeoutError, m as Refusal, d as RunHandle, n as RunOptions, o as RuntimeDiscardNotice, p as RuntimeDiscardedError, q as RuntimeErrorContext, r as RuntimeErrorPhase, s as RuntimeRef, t as Schema, S as Store, u as StoreConflictError, v as StoreRefusedError, a as Supervision, w as SupervisionStrategy, x as TelemetryEvent, T as TelemetrySink, _ as __resetPortRegistry, y as absurd, z as asReducer, A as defineMachine, G as definePort, H as isFencedStore, J as noop, K as refuse, L as replay, N as schemaMigrate, U as tryApplyCell, V as tryFoldMsgs, W as tryInterpret, X as wrapDetached } from './runtime-types-DEluQgGO.js';
|
|
3
|
+
import { C as Cmd, S as Sub, M as Machine, P as Port, l as DepKeyedSub, D as Dispose } from './core-CtvAyPpH.js';
|
|
4
|
+
export { A as AnyCmdDef, v as AsyncSchemaError, B as BuiltinSub, q as BuiltinSubType, b as CmdDef, w as CmdInput, a as CmdOf, u as CmdValue, p as DeclaredErrorsOf, t as ErrOf, E as ErrorsOf, x as ExhaustiveTransitions, y as Identity, I as Interpret, z as InterpretArg, F as InterpretCell, j as InterpretDetached, G as MachineShape, n as MalformedResult, N as NoCellError, J as NoCtx, s as OkOf, o as OkOfCmd, O as Outcome, K as OutcomeContractError, L as OutcomeHelpers, Q as PortEmitter, g as Reducer, R as RunHandlers, h as Settled, e as SettledErr, d as SettledOk, k as SubId, c as Subscribe, V as SubscribeArg, X as SyncReturn, r as Tagged, f as TaggedError, T as TimerDeps, m as TimerSub, i as Transitions, Y as UndeclaredFailureError, U as UpdateForm, W as Wired, Z as acceptedTypes, _ as acceptsOf, $ as applyCell, a0 as applyCellChecked, a1 as describeMachine, a2 as detectUpdateForm, a3 as foldMsgs, a4 as foldUpdates, a5 as formOf, a6 as msgKeysOf, a7 as structuralHash, a8 as subId, a9 as subIdOf } from './core-CtvAyPpH.js';
|
|
5
|
+
import { S as SubscribeHandler } from './types-CXNzlbAg.js';
|
|
6
6
|
import '@standard-schema/spec';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -69,6 +69,10 @@ interface ReadStep<In, Out> {
|
|
|
69
69
|
*/
|
|
70
70
|
declare function readInOrder<In, Out>(input: In, order: readonly ReadStep<In, Out>[], absent: Out): Out;
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* A bounded log of a runtime's recent `(msg, state)` transitions, returned by
|
|
74
|
+
* `historyTracker`. Use it to feed a debug inspector.
|
|
75
|
+
*/
|
|
72
76
|
interface HistoryTracker<S, M extends {
|
|
73
77
|
type: string;
|
|
74
78
|
}> {
|
|
@@ -317,44 +321,84 @@ interface MinimalWebSocket {
|
|
|
317
321
|
type BroadcastSubData = {
|
|
318
322
|
readonly channelName: string;
|
|
319
323
|
};
|
|
324
|
+
/**
|
|
325
|
+
* Build a Sub runner that listens on the `BroadcastChannel` named by
|
|
326
|
+
* `sub.deps.channelName` and dispatches `msgFn(event, sub)` for each message.
|
|
327
|
+
* Returning `null` from `msgFn` drops the event.
|
|
328
|
+
*/
|
|
320
329
|
declare function fromBroadcastChannel<S extends Sub<string, BroadcastSubData>, M>(msgFn: (event: MinimalMessageEvent, sub: S) => M | null): SubscribeHandler<S, M, unknown>;
|
|
321
330
|
|
|
322
331
|
type EventSourceSubData = {
|
|
323
332
|
readonly url: string;
|
|
324
333
|
};
|
|
334
|
+
/**
|
|
335
|
+
* Options for `fromEventSource`: map each server-sent message, error and open
|
|
336
|
+
* event to a Msg, or to `null` to drop it.
|
|
337
|
+
*/
|
|
325
338
|
interface EventSourceFactoryOpts<S, M> {
|
|
326
339
|
onMessage: (data: string, sub: S) => M | null;
|
|
327
340
|
onError?: (event: MinimalEvent, sub: S) => M | null;
|
|
328
341
|
onOpen?: (sub: S) => M | null;
|
|
329
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Build a Sub runner that opens an `EventSource` on `sub.deps.url` and
|
|
345
|
+
* dispatches a Msg for each server-sent event.
|
|
346
|
+
*/
|
|
330
347
|
declare function fromEventSource<S extends Sub<string, EventSourceSubData>, M>(opts: EventSourceFactoryOpts<S, M>): SubscribeHandler<S, M, unknown>;
|
|
331
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Build a Sub runner that listens for `eventName` on a DOM-style event target
|
|
351
|
+
* and dispatches `msgFn(event, sub)` for each event.
|
|
352
|
+
*/
|
|
332
353
|
declare function fromEventTarget<S extends Sub, M>(getTarget: () => MinimalEventTarget, eventName: string, msgFn: (event: MinimalEvent, sub: S) => M | null): SubscribeHandler<S, M, unknown>;
|
|
333
354
|
|
|
334
355
|
type IntervalSubData = {
|
|
335
356
|
readonly intervalMs: number;
|
|
336
357
|
};
|
|
358
|
+
/**
|
|
359
|
+
* Build a Sub runner that dispatches `msgFn(sub)` every `sub.deps.intervalMs`
|
|
360
|
+
* milliseconds while the Sub is on.
|
|
361
|
+
*/
|
|
337
362
|
declare function fromInterval<S extends Sub<string, IntervalSubData>, M>(msgFn: (sub: S) => M): SubscribeHandler<S, M, unknown>;
|
|
338
363
|
|
|
364
|
+
/**
|
|
365
|
+
* Build a Sub runner that listens to a `Port` on another runtime and dispatches
|
|
366
|
+
* `msgFn(value, sub)` for each value emitted. Use it to let one machine react
|
|
367
|
+
* to another's announcements.
|
|
368
|
+
*/
|
|
339
369
|
declare function fromPort<S extends Sub, M, Ctx, T, RS = unknown, RM extends {
|
|
340
370
|
type: string;
|
|
341
371
|
} = {
|
|
342
372
|
type: string;
|
|
343
373
|
}>(selectRuntime: (ctx: Ctx) => Runtime<RS, RM>, port: Port<T>, msgFn: (value: T, sub: S) => M | null): SubscribeHandler<S, M, Ctx>;
|
|
344
374
|
|
|
375
|
+
/** The `deps` a WebSocket Sub carries: the `wsUrl` to connect to. */
|
|
345
376
|
type WebSocketSubData = {
|
|
346
377
|
readonly wsUrl: string;
|
|
347
378
|
};
|
|
379
|
+
/**
|
|
380
|
+
* Options for `fromWebSocket`: map each message, open, error and close event to
|
|
381
|
+
* a Msg, or to `null` to drop it.
|
|
382
|
+
*/
|
|
348
383
|
interface WebSocketFactoryOpts<S, M> {
|
|
349
384
|
onMessage: (data: unknown, sub: S) => M | null;
|
|
350
385
|
onOpen?: (sub: S) => M | null;
|
|
351
386
|
onError?: (event: MinimalEvent, sub: S) => M | null;
|
|
352
387
|
onClose?: (code: number, reason: string, sub: S) => M | null;
|
|
353
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* Build a Sub runner that opens a WebSocket to `sub.deps.wsUrl` and dispatches
|
|
391
|
+
* a Msg for each socket event. It does not reconnect; use
|
|
392
|
+
* `fromReconnectingWebSocket` for that.
|
|
393
|
+
*/
|
|
354
394
|
declare function fromWebSocket<S extends Sub<string, WebSocketSubData>, M>(opts: WebSocketFactoryOpts<S, M>): SubscribeHandler<S, M, unknown>;
|
|
355
395
|
|
|
356
396
|
/** Cancels a scheduled reconnect timer (the inverse of `schedule`). */
|
|
357
397
|
type CancelTimer = () => void;
|
|
398
|
+
/**
|
|
399
|
+
* Options for `fromReconnectingWebSocket`: the event-to-Msg mappers, the
|
|
400
|
+
* backoff settings, and an injectable `connect` and `schedule` for tests.
|
|
401
|
+
*/
|
|
358
402
|
interface ReconnectingWebSocketFactoryOpts<S, M> {
|
|
359
403
|
onMessage: (data: unknown, sub: S) => M | null;
|
|
360
404
|
onOpen?: (sub: S) => M | null;
|
|
@@ -375,11 +419,19 @@ interface ReconnectingWebSocketFactoryOpts<S, M> {
|
|
|
375
419
|
/** Inject the timer (defaults to `setTimeout`/`clearTimeout`); the test seam. */
|
|
376
420
|
schedule?: (fn: () => void, ms: number) => CancelTimer;
|
|
377
421
|
}
|
|
422
|
+
/**
|
|
423
|
+
* Build a Sub runner that keeps a WebSocket to `sub.deps.wsUrl` open,
|
|
424
|
+
* reconnecting with backoff when it drops.
|
|
425
|
+
*/
|
|
378
426
|
declare function fromReconnectingWebSocket<S extends Sub<string, WebSocketSubData>, M>(opts: ReconnectingWebSocketFactoryOpts<S, M>): SubscribeHandler<S, M, unknown>;
|
|
379
427
|
|
|
380
428
|
type TimeoutSubData = {
|
|
381
429
|
readonly delayMs: number;
|
|
382
430
|
};
|
|
431
|
+
/**
|
|
432
|
+
* Build a Sub runner that dispatches `msgFn(sub)` once, `sub.deps.delayMs`
|
|
433
|
+
* milliseconds after the Sub turns on. Turning the Sub off first cancels it.
|
|
434
|
+
*/
|
|
383
435
|
declare function fromTimeout<S extends Sub<string, TimeoutSubData>, M>(msgFn: (sub: S) => M): SubscribeHandler<S, M, unknown>;
|
|
384
436
|
|
|
385
437
|
/**
|
|
@@ -387,6 +439,10 @@ declare function fromTimeout<S extends Sub<string, TimeoutSubData>, M>(msgFn: (s
|
|
|
387
439
|
* key. The consumer's Sub union (`types.sub`) includes it directly.
|
|
388
440
|
*/
|
|
389
441
|
type ManagedResourceSub<N extends string, TKey> = Sub<N, TKey>;
|
|
442
|
+
/**
|
|
443
|
+
* Options for `defineManagedResource`: the resource's `name`, how to `acquire`
|
|
444
|
+
* it for a key, and how to `release` the handle.
|
|
445
|
+
*/
|
|
390
446
|
interface DefineManagedResourceOpts<N extends string, TKey, Handle, Ctx> {
|
|
391
447
|
/**
|
|
392
448
|
* A short, stable name — and the resource's Sub `type`. The machine's
|
|
@@ -551,6 +607,11 @@ type TransportFactory<K> = (key: K) => Transport;
|
|
|
551
607
|
* consumer's Sub union (`types.sub`) includes it directly.
|
|
552
608
|
*/
|
|
553
609
|
type TransportSub<N extends string, TKey> = Sub<N, TKey>;
|
|
610
|
+
/**
|
|
611
|
+
* Options for `fromTransport`: the seam's `name`, how to open the transport,
|
|
612
|
+
* and how inbound values, outbound values and a dropped connection map to and
|
|
613
|
+
* from Msgs.
|
|
614
|
+
*/
|
|
554
615
|
interface FromTransportOpts<N extends string, TKey, Inbound, Outbound, M, Ctx> {
|
|
555
616
|
/**
|
|
556
617
|
* A short, stable name for this seam — and its Sub `type`. The machine's
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { NO_ACK, ack, defineListener, defineManagedResource, fromBroadcastChannel, fromEventSource, fromEventTarget, fromInterval, fromPort, fromReconnectingWebSocket, fromTimeout, fromTransport, fromWebSocket, historyTracker, initAck, liftSlice, nextSeq, partitionByAck, readInOrder, reconcile, tagSeq } from './chunk-
|
|
2
|
-
export { AsyncSchemaError, Cmd, DispatchDiscardedError, DisposeTimeoutNotice, DriveFailedError, DriveStalledError, IdentityDropNotice, NoCellError, Outcome, OutcomeContractError, PortNameCollisionError, QuiescenceTimeoutError, Refusal, RuntimeDiscardNotice, RuntimeDiscardedError, StoreConflictError, StoreRefusedError, UndeclaredFailureError, __resetPortRegistry, absurd, acceptedTypes, acceptsOf, applyCell, applyCellChecked, asReducer, defineMachine, definePort, describeMachine, detectUpdateForm, foldMsgs, foldUpdates, formOf, isFencedStore, msgKeysOf, noop, refuse, replay, schemaMigrate, structuralHash, subId, subIdOf, tryApplyCell, tryFoldMsgs, tryInterpret, wrapDetached } from './chunk-
|
|
1
|
+
export { NO_ACK, ack, defineListener, defineManagedResource, fromBroadcastChannel, fromEventSource, fromEventTarget, fromInterval, fromPort, fromReconnectingWebSocket, fromTimeout, fromTransport, fromWebSocket, historyTracker, initAck, liftSlice, nextSeq, partitionByAck, readInOrder, reconcile, tagSeq } from './chunk-DVNXEB7V.js';
|
|
2
|
+
export { AsyncSchemaError, Cmd, DispatchDiscardedError, DisposeTimeoutNotice, DriveFailedError, DriveStalledError, IdentityDropNotice, NoCellError, Outcome, OutcomeContractError, PortNameCollisionError, QuiescenceTimeoutError, Refusal, RuntimeDiscardNotice, RuntimeDiscardedError, StoreConflictError, StoreRefusedError, UndeclaredFailureError, __resetPortRegistry, absurd, acceptedTypes, acceptsOf, applyCell, applyCellChecked, asReducer, defineMachine, definePort, describeMachine, detectUpdateForm, foldMsgs, foldUpdates, formOf, isFencedStore, msgKeysOf, noop, refuse, replay, schemaMigrate, structuralHash, subId, subIdOf, tryApplyCell, tryFoldMsgs, tryInterpret, wrapDetached } from './chunk-RKVUVALV.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/jev/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { O as Outcome, b as CmdDef, T as TimerDeps, C as Cmd, l as DepKeyedSub, m as TimerSub } from '../core-Ce9ncpuv.js';
|
|
1
|
+
import { O as Outcome, b as CmdDef, T as TimerDeps, C as Cmd, l as DepKeyedSub, m as TimerSub } from '../core-CtvAyPpH.js';
|
|
3
2
|
import { RetryPolicy } from '../retry-backoff/index.js';
|
|
4
|
-
import {
|
|
5
|
-
import { S as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { a as DeadlineSub, T as TtlCache, C as CacheEvictionSub, c as CacheEvictMsg } from '../index-CVU7SK3a.js';
|
|
4
|
+
import { D as DefaultResilientName, R as RunCmd, F as FailMsg, S as SucceedMsg, a as ResilientTimerMsg, b as ResilientState, c as DeadlineNameOf } from '../index-CKtEKGyp.js';
|
|
5
|
+
import { S as SubscribeHandler } from '../types-CXNzlbAg.js';
|
|
6
|
+
import { B as BatchWindow, a as BatchWindowSub, b as BatchWindowExpired } from '../index-EIgfl83J.js';
|
|
7
|
+
import { F as FanOutState } from '../index-CrcoVfd_.js';
|
|
8
8
|
import '@standard-schema/spec';
|
|
9
|
-
import '../index-
|
|
10
|
-
import '../runtime-types-
|
|
9
|
+
import '../index-D3NY3VCN.js';
|
|
10
|
+
import '../runtime-types-DEluQgGO.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @packageDocumentation
|
|
@@ -400,9 +400,17 @@ declare const DEFAULT_JEV_MODEL = "jev-latest";
|
|
|
400
400
|
* sent on every request and the type that makes the answers narrow at the call
|
|
401
401
|
* site, so it belongs to the knob rather than to a call.
|
|
402
402
|
*/
|
|
403
|
-
interface JevAskConfig<Q extends JevQuestionMap> {
|
|
403
|
+
interface JevAskConfig<Q extends JevQuestionMap, N extends string = DefaultResilientName> {
|
|
404
404
|
/** The question map every request carries; its keys type the answers. */
|
|
405
405
|
readonly questions: Q;
|
|
406
|
+
/**
|
|
407
|
+
* What this knob's Cmd and Msgs are called: `<name>_run`, `<name>_run_ok`,
|
|
408
|
+
* `<name>_run_err` and the timer Msg `<name>_deadline`. Omit it and they are
|
|
409
|
+
* `resilient_run`, `resilient_run_ok`, `resilient_run_err` and
|
|
410
|
+
* `deadline_exceeded`. Name a knob when a machine holds more than one, so
|
|
411
|
+
* each settles into its own `update` cell with its own answer type.
|
|
412
|
+
*/
|
|
413
|
+
readonly name?: N;
|
|
406
414
|
/** The pure decider for the no-key and budget-spent paths. Absent → those settle as an error. */
|
|
407
415
|
readonly fallback?: JevFallback<Q>;
|
|
408
416
|
/** Backoff policy, composed into `../../resilience/resilient-call`. Omit → no backoff. */
|
|
@@ -455,9 +463,10 @@ declare function offlineJevAnswer<Q extends JevQuestionMap>(request: JevRequest<
|
|
|
455
463
|
* channels are types on the constructor rather than a convention). It is
|
|
456
464
|
* resilient-call's `runCmdDef` specialized to this door's input and result, the
|
|
457
465
|
* same way `../../idempotency/idempotent-intake` mints its defs per knob: `Q` is
|
|
458
|
-
* a type parameter, so the def is a factory and not a module constant.
|
|
466
|
+
* a type parameter, so the def is a factory and not a module constant. `name`
|
|
467
|
+
* is the knob's name; omit it for the `resilient` family.
|
|
459
468
|
*/
|
|
460
|
-
declare function jevAskCmdDef<Q extends JevQuestionMap>(): CmdDef
|
|
469
|
+
declare function jevAskCmdDef<Q extends JevQuestionMap, N extends string = DefaultResilientName>(name?: N): CmdDef<`${N}_run`, {
|
|
461
470
|
readonly key: string;
|
|
462
471
|
readonly input: JevRequest<Q>;
|
|
463
472
|
}, JevOk<Q>, {
|
|
@@ -467,18 +476,21 @@ declare function jevAskCmdDef<Q extends JevQuestionMap>(): CmdDef<"resilient_run
|
|
|
467
476
|
readonly [detail: string]: unknown;
|
|
468
477
|
readonly _tag: "port_rejected";
|
|
469
478
|
}>;
|
|
470
|
-
/** The Cmd the verbs emit — `
|
|
471
|
-
type JevAskCmd<Q extends JevQuestionMap> = RunCmd<JevRequest<Q>,
|
|
479
|
+
/** The Cmd the verbs emit — `<name>_run` carrying the request. */
|
|
480
|
+
type JevAskCmd<Q extends JevQuestionMap, N extends string = DefaultResilientName> = RunCmd<JevRequest<Q>, N, JevOk<Q>>;
|
|
472
481
|
/** The success settle Msg — resilient-call's, with `value` narrowed to {@link JevOk}. */
|
|
473
|
-
type JevSucceedMsg<Q extends JevQuestionMap> = SucceedMsg<JevOk<Q
|
|
482
|
+
type JevSucceedMsg<Q extends JevQuestionMap, N extends string = DefaultResilientName> = SucceedMsg<JevOk<Q>, N>;
|
|
474
483
|
/**
|
|
475
484
|
* The failure settle Msg the engine mints — resilient-call's. Its `error` is a
|
|
476
485
|
* {@link JevRejected} when your handler used this door's builders; `fail`
|
|
477
486
|
* reads it with {@link jevAskErrOf}.
|
|
478
487
|
*/
|
|
479
|
-
type JevFailMsg = FailMsg
|
|
480
|
-
/**
|
|
481
|
-
|
|
488
|
+
type JevFailMsg<N extends string = DefaultResilientName> = FailMsg<N>;
|
|
489
|
+
/**
|
|
490
|
+
* The retry / deadline timer Msg — resilient-call's. `deadline_exceeded` for an
|
|
491
|
+
* unnamed knob, `<name>_deadline` for a named one.
|
|
492
|
+
*/
|
|
493
|
+
type JevTimerMsg<N extends string = DefaultResilientName> = ResilientTimerMsg<N>;
|
|
482
494
|
/**
|
|
483
495
|
* Build a jev-ask knob from `config`. `rng` is injected for the inherited retry
|
|
484
496
|
* jitter (pass a fixed `() => 0` in tests to pin backoff; defaults to
|
|
@@ -489,10 +501,10 @@ type JevTimerMsg = DeadlineExceeded;
|
|
|
489
501
|
* routes on it (see its docblock); it reimplements no backoff. `decode`,
|
|
490
502
|
* `rejected` and `offline` are the pure outcome builders your handler returns.
|
|
491
503
|
*/
|
|
492
|
-
declare function createJevAsk<Q extends JevQuestionMap>(config: JevAskConfig<Q>, rng?: () => number): {
|
|
493
|
-
name:
|
|
504
|
+
declare function createJevAsk<Q extends JevQuestionMap, N extends string = DefaultResilientName>(config: JevAskConfig<Q, N>, rng?: () => number): {
|
|
505
|
+
name: N;
|
|
494
506
|
/** The `Cmd.define`d run Cmd — list it in the machine's `cmds`. */
|
|
495
|
-
run: CmdDef
|
|
507
|
+
run: CmdDef<`${N}_run`, {
|
|
496
508
|
readonly key: string;
|
|
497
509
|
readonly input: JevRequest<Q>;
|
|
498
510
|
}, JevOk<Q>, {
|
|
@@ -503,13 +515,13 @@ declare function createJevAsk<Q extends JevQuestionMap>(config: JevAskConfig<Q>,
|
|
|
503
515
|
readonly _tag: "port_rejected";
|
|
504
516
|
}>;
|
|
505
517
|
init: () => ResilientState<JevRequest<Q>, JevOk<Q>>;
|
|
506
|
-
attempt: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, key: string, content: JevState, at: number) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q>[]];
|
|
507
|
-
succeed: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, msg: JevSucceedMsg<Q>) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q>[]];
|
|
508
|
-
fail: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, msg: JevFailMsg) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q>[]];
|
|
509
|
-
onTimer: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, msg: JevTimerMsg) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q>[]];
|
|
510
|
-
deadlines: (s: ResilientState<JevRequest<Q>, JevOk<Q>>) => readonly DeadlineSub[];
|
|
518
|
+
attempt: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, key: string, content: JevState, at: number) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q, N>[]];
|
|
519
|
+
succeed: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, msg: JevSucceedMsg<Q, N>) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q, N>[]];
|
|
520
|
+
fail: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, msg: JevFailMsg<N>) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q, N>[]];
|
|
521
|
+
onTimer: (s: ResilientState<JevRequest<Q>, JevOk<Q>>, msg: JevTimerMsg<N>) => readonly [ResilientState<JevRequest<Q>, JevOk<Q>>, readonly JevAskCmd<Q, N>[]];
|
|
522
|
+
deadlines: (s: ResilientState<JevRequest<Q>, JevOk<Q>>) => readonly DeadlineSub<DeadlineNameOf<N>>[];
|
|
511
523
|
/** The built-in `timer` Sub's deps — resilient-call's `timer`. */
|
|
512
|
-
timer: (s: ResilientState<JevRequest<Q>, JevOk<Q>>) => TimerDeps<ResilientTimerMsg<
|
|
524
|
+
timer: (s: ResilientState<JevRequest<Q>, JevOk<Q>>) => TimerDeps<ResilientTimerMsg<N>> | null;
|
|
513
525
|
/** Your handler's outcome for an HTTP reply — {@link decodeJevReply}. */
|
|
514
526
|
decode: (request: JevRequest<Q>, reply: JevHttpReply) => Outcome<JevOk<Q>, JevRejected>;
|
|
515
527
|
/** Your handler's outcome when the call threw — {@link jevCallThrew}. */
|
|
@@ -523,7 +535,7 @@ declare function createJevAsk<Q extends JevQuestionMap>(config: JevAskConfig<Q>,
|
|
|
523
535
|
* block reads well with. It is stated here so a host writes `cmd: {} as
|
|
524
536
|
* JevCmd<Questions>` rather than deriving it from the knob's shape.
|
|
525
537
|
*/
|
|
526
|
-
type JevCmd<Q extends JevQuestionMap> = JevAskCmd<Q>;
|
|
538
|
+
type JevCmd<Q extends JevQuestionMap, N extends string = DefaultResilientName> = JevAskCmd<Q, N>;
|
|
527
539
|
/**
|
|
528
540
|
* Lift a knob result `[slice, cmds]` into a host `[State, cmds]` where the slice
|
|
529
541
|
* lives at `state.resilience` — resilient-call's convenience, re-typed for this
|
package/dist/jev/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createBatchWindow } from '../chunk-
|
|
1
|
+
import { createBatchWindow } from '../chunk-5HVKDHY6.js';
|
|
2
2
|
import '../chunk-LFZUK6J2.js';
|
|
3
3
|
import { createFanOut } from '../chunk-QNGYQMZB.js';
|
|
4
|
-
import { runCmdDef, createResilientCall } from '../chunk-
|
|
5
|
-
import { initCache, has, set, evictExpired, cacheEvictionSub, cacheEvictionSubscribe, get } from '../chunk-
|
|
4
|
+
import { runCmdDef, createResilientCall } from '../chunk-72CN3VPY.js';
|
|
5
|
+
import { initCache, has, set, evictExpired, cacheEvictionSub, cacheEvictionSubscribe, get } from '../chunk-TAKPC6SD.js';
|
|
6
6
|
import '../chunk-VBDU4JL6.js';
|
|
7
7
|
import '../chunk-4LPY67E4.js';
|
|
8
8
|
import '../chunk-TXN2KFHF.js';
|
|
9
|
-
import { liftSlice, readInOrder } from '../chunk-
|
|
10
|
-
import { describeError, Outcome } from '../chunk-
|
|
9
|
+
import { liftSlice, readInOrder } from '../chunk-DVNXEB7V.js';
|
|
10
|
+
import { describeError, Outcome } from '../chunk-RKVUVALV.js';
|
|
11
11
|
|
|
12
12
|
// src/internal/jev/protocol/index.ts
|
|
13
13
|
var jevQuestions = (questions) => questions;
|
|
@@ -257,14 +257,18 @@ function offlineJevAnswer(request, fallback) {
|
|
|
257
257
|
source: "fallback"
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
-
function jevAskCmdDef() {
|
|
261
|
-
return runCmdDef();
|
|
260
|
+
function jevAskCmdDef(name) {
|
|
261
|
+
return runCmdDef(name);
|
|
262
262
|
}
|
|
263
263
|
function createJevAsk(config, rng = Math.random) {
|
|
264
264
|
const resilientConfig = {
|
|
265
|
+
...config.name === void 0 ? {} : { name: config.name },
|
|
265
266
|
...config.retry === void 0 ? {} : { retry: config.retry }
|
|
266
267
|
};
|
|
267
|
-
const rc = createResilientCall(
|
|
268
|
+
const rc = createResilientCall(
|
|
269
|
+
resilientConfig,
|
|
270
|
+
rng
|
|
271
|
+
);
|
|
268
272
|
const model = config.model ?? DEFAULT_JEV_MODEL;
|
|
269
273
|
function liveRequest(s, key) {
|
|
270
274
|
const call = s.calls[key];
|