@demlik/tea 0.14.0 → 0.16.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 +30 -7
- package/dist/agent/index.d.ts +49 -36
- package/dist/agent/index.js +12 -8
- package/dist/chunk-4LPY67E4.js +18 -0
- package/dist/chunk-4LPY67E4.js.map +1 -0
- package/dist/chunk-5XU6ZJO2.js +533 -0
- package/dist/chunk-5XU6ZJO2.js.map +1 -0
- package/dist/{chunk-AQ6ZIMEA.js → chunk-6NG4V5SB.js} +89 -115
- package/dist/chunk-6NG4V5SB.js.map +1 -0
- package/dist/{chunk-HYDWG35Q.js → chunk-7MGXQZPW.js} +11 -9
- package/dist/chunk-7MGXQZPW.js.map +1 -0
- package/dist/{chunk-BLJ2JQSH.js → chunk-BCTEOVOU.js} +3 -3
- package/dist/{chunk-BLJ2JQSH.js.map → chunk-BCTEOVOU.js.map} +1 -1
- package/dist/chunk-CH5KTOEZ.js +710 -0
- package/dist/chunk-CH5KTOEZ.js.map +1 -0
- package/dist/chunk-CIHSHLQX.js +64 -0
- package/dist/chunk-CIHSHLQX.js.map +1 -0
- package/dist/{chunk-Z2L3LSNV.js → chunk-EHUDXAKC.js} +246 -210
- package/dist/chunk-EHUDXAKC.js.map +1 -0
- package/dist/chunk-GOX2CYIM.js +380 -0
- package/dist/chunk-GOX2CYIM.js.map +1 -0
- package/dist/chunk-IVJP3GKJ.js +104 -0
- package/dist/chunk-IVJP3GKJ.js.map +1 -0
- package/dist/{chunk-F7FMAWLA.js → chunk-MVZS5FDM.js} +13 -6
- package/dist/chunk-MVZS5FDM.js.map +1 -0
- package/dist/{chunk-LYLTKJWM.js → chunk-MYNLY3HP.js} +9 -8
- package/dist/chunk-MYNLY3HP.js.map +1 -0
- package/dist/{chunk-I5MQMJDW.js → chunk-NSIAORRY.js} +20 -30
- package/dist/chunk-NSIAORRY.js.map +1 -0
- package/dist/{chunk-MYXFNWAJ.js → chunk-QNGYQMZB.js} +4 -4
- package/dist/chunk-QNGYQMZB.js.map +1 -0
- package/dist/chunk-WT5PBPLB.js +98 -0
- package/dist/chunk-WT5PBPLB.js.map +1 -0
- package/dist/{core-CTzMJ82M.d.ts → core-BbgtiXdg.d.ts} +231 -139
- package/dist/do/index.d.ts +37 -32
- package/dist/do/index.js +21 -14
- package/dist/do/index.js.map +1 -1
- package/dist/{durable-effects-B0-qGQDy.d.ts → durable-effects-7MTK_jnj.d.ts} +1 -1
- package/dist/effect/index.d.ts +151 -0
- package/dist/effect/index.js +98 -0
- package/dist/effect/index.js.map +1 -0
- package/dist/extension/index.d.ts +6 -7
- package/dist/extension/index.js +3 -2
- package/dist/extension/index.js.map +1 -1
- package/dist/flow/index.d.ts +68 -70
- package/dist/flow/index.js +32 -27
- package/dist/flow/index.js.map +1 -1
- package/dist/idempotency/index.d.ts +6 -7
- package/dist/idempotency/index.js +4 -2
- package/dist/{index-DJWIER_3.d.ts → index-7vV8xmsD.d.ts} +1 -1
- package/dist/{index-NjrT3fL2.d.ts → index-Bz5Rh9Ga.d.ts} +19 -96
- package/dist/index-CjFDUBeq.d.ts +207 -0
- package/dist/{index-6A7dB8f6.d.ts → index-CkFYA9Y6.d.ts} +14 -16
- package/dist/{index-B5BZ-_cT.d.ts → index-Cou86-GX.d.ts} +189 -108
- package/dist/{index-TvRb1KVf.d.ts → index-DU6JpQ8G.d.ts} +1 -1
- package/dist/{index-q0hXFeZ0.d.ts → index-Xufl55W8.d.ts} +286 -215
- package/dist/{index-4vZzljCD.d.ts → index-_dOR3xqA.d.ts} +57 -45
- package/dist/index.d.ts +181 -385
- package/dist/index.js +2 -1
- package/dist/jev/index.d.ts +147 -99
- package/dist/jev/index.js +329 -233
- package/dist/jev/index.js.map +1 -1
- package/dist/{machine-CdIcN2Xm.d.ts → machine-BQzTV8On.d.ts} +171 -280
- package/dist/machine-viz/index.d.ts +5 -5
- package/dist/machine-viz/index.js +8 -4
- package/dist/machine-viz/index.js.map +1 -1
- package/dist/mem/index.d.ts +3 -4
- package/dist/mem/index.js +2 -1
- package/dist/mem/index.js.map +1 -1
- package/dist/node/index.d.ts +119 -78
- package/dist/node/index.js +52 -38
- package/dist/node/index.js.map +1 -1
- package/dist/paginate/index.d.ts +27 -33
- package/dist/paginate/index.js +6 -4
- package/dist/parity/index.d.ts +4 -5
- package/dist/parity/index.js +3 -2
- package/dist/parity/index.js.map +1 -1
- package/dist/pbt/index.d.ts +2 -2
- package/dist/pbt/index.js +2 -1
- package/dist/pbt/index.js.map +1 -1
- package/dist/persistence/index.d.ts +6 -7
- package/dist/persistence/index.js +5 -3
- package/dist/promise/index.d.ts +186 -0
- package/dist/promise/index.js +5 -0
- package/dist/promise/index.js.map +1 -0
- package/dist/protocol-ClRZBhHQ.d.ts +53 -0
- package/dist/react/index.d.ts +36 -17
- package/dist/react/index.js +27 -4
- package/dist/react/index.js.map +1 -1
- package/dist/resilience/index.d.ts +63 -455
- package/dist/resilience/index.js +37 -483
- package/dist/resilience/index.js.map +1 -1
- package/dist/{runtime-types-LWDoi943.d.ts → runtime-types-CiVpC0HN.d.ts} +131 -388
- package/dist/testing/index.d.ts +165 -15
- package/dist/testing/index.js +104 -3
- package/dist/testing/index.js.map +1 -1
- package/dist/timing/index.d.ts +25 -22
- package/dist/timing/index.js +4 -3
- package/dist/timing/index.js.map +1 -1
- package/dist/{types-DP3f5NIl.d.ts → types-LxZxGYda.d.ts} +2 -2
- package/dist/work-queue/index.d.ts +5 -6
- package/package.json +18 -5
- package/dist/chunk-AQ6ZIMEA.js.map +0 -1
- package/dist/chunk-F2US5BW6.js +0 -72
- package/dist/chunk-F2US5BW6.js.map +0 -1
- package/dist/chunk-F7FMAWLA.js.map +0 -1
- package/dist/chunk-HUKZQX6U.js +0 -97
- package/dist/chunk-HUKZQX6U.js.map +0 -1
- package/dist/chunk-HYDWG35Q.js.map +0 -1
- package/dist/chunk-I5MQMJDW.js.map +0 -1
- package/dist/chunk-LYLTKJWM.js.map +0 -1
- package/dist/chunk-MYXFNWAJ.js.map +0 -1
- package/dist/chunk-RQULHGYH.js +0 -1804
- package/dist/chunk-RQULHGYH.js.map +0 -1
- package/dist/chunk-Z2L3LSNV.js.map +0 -1
- package/dist/index-DMCeMPMJ.d.ts +0 -272
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { C as Cmd } from './core-
|
|
2
|
-
import {
|
|
3
|
-
import { D as DeadlineExceeded, a as DeadlineSub } from './index-q0hXFeZ0.js';
|
|
1
|
+
import { C as Cmd, T as TimerDeps, d as Subscribe } from './core-BbgtiXdg.js';
|
|
2
|
+
import { D as DeadlineExceeded, a as DeadlineSub, b as DeadlinesSub } from './index-Xufl55W8.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* internal/flow/batch-window — coalesce a stream of items into size- or
|
|
@@ -8,14 +7,13 @@ import { D as DeadlineExceeded, a as DeadlineSub } from './index-q0hXFeZ0.js';
|
|
|
8
7
|
*
|
|
9
8
|
* What this module actually DELEGATES to, vs. what it merely RE-EXPORTS:
|
|
10
9
|
*
|
|
11
|
-
* - `../deadline` — REAL delegation (the only one). The window timer
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* fires at the correct moment.
|
|
10
|
+
* - `../deadline` — REAL delegation (the only one). The window timer's Msg
|
|
11
|
+
* is `deadlineExceeded`, keyed on the window's identity. `timerFor` arms it
|
|
12
|
+
* through the engine's built-in `timer` Sub: `maxMs` counted from the
|
|
13
|
+
* transition that opened the window, so a machine needs no runner. The
|
|
14
|
+
* absolute-instant form is still here too — `subsFor` lists the same
|
|
15
|
+
* deadline for `deadlinesSub` + `subscribeDeadline`, which re-arms for the
|
|
16
|
+
* REMAINING time after a `Store` rehydrate rather than a fresh `maxMs`.
|
|
19
17
|
* - `../work-queue` — TYPE re-export only, NOT a sink this module calls. A
|
|
20
18
|
* flush emits a Cmd; the CONSUMER's interpret handler is what enqueues onto a
|
|
21
19
|
* `createQueue(store)`. This module never touches queue status — it has no
|
|
@@ -48,10 +46,10 @@ import { D as DeadlineExceeded, a as DeadlineSub } from './index-q0hXFeZ0.js';
|
|
|
48
46
|
* // Model: { batch: BatchWindow<LogLine>, ... }
|
|
49
47
|
* // init: (loaded) => [loaded ?? { batch: bw.init(), ... }, []]
|
|
50
48
|
* // update cells:
|
|
51
|
-
* // LogArrived:
|
|
52
|
-
* //
|
|
53
|
-
* //
|
|
54
|
-
* //
|
|
49
|
+
* // LogArrived: (s, m) => mapBatch(s, bw.add(s.batch, m.line, m.at))
|
|
50
|
+
* // deadline_exceeded: (s, m) => mapBatch(s, bw.onWindow(s.batch, m.atMs))
|
|
51
|
+
* // subs: [{ type: "timer", deps: (s: Model) => bw.timer(s.batch) }]
|
|
52
|
+
* // at run: run(machine, { interpret }) // `timer` is built in
|
|
55
53
|
*
|
|
56
54
|
* where `mapBatch(s, [batch, cmds]) => [{ ...s, batch }, cmds]` lifts the slice
|
|
57
55
|
* transition into the consumer's Model. The `FlushBatch` Cmd's interpret handler
|
|
@@ -118,26 +116,26 @@ interface BatchWindow<I> {
|
|
|
118
116
|
/** The starting slice: closed window, empty buffer. */
|
|
119
117
|
declare function initBatchWindow<I>(): BatchWindow<I>;
|
|
120
118
|
/**
|
|
121
|
-
* The
|
|
119
|
+
* The deadline a batch window's open timer lists: it IS `../deadline`'s
|
|
122
120
|
* `DeadlineSub`, not a re-tagged copy. `atMs` is the absolute flush-by instant
|
|
123
121
|
* (`openedAt + maxMs`). Aliasing the deadline type (rather than redeclaring an
|
|
124
122
|
* identical shape) is what lets `subsFor` return `deadlineSub(...)` with no
|
|
125
123
|
* cast — the value's static type already satisfies this name. Consumers running
|
|
126
|
-
* several windows route each one by the
|
|
124
|
+
* several windows route each one by the deadline's `id`, not by a distinct type.
|
|
127
125
|
*/
|
|
128
126
|
type BatchWindowSub = DeadlineSub;
|
|
129
127
|
/** The Msg a closed-by-time window dispatches. Alias of `deadline`'s Msg. */
|
|
130
128
|
type BatchWindowExpired = DeadlineExceeded;
|
|
131
129
|
/**
|
|
132
130
|
* Construct the window-expired Msg for the window identified by `id`, flushing
|
|
133
|
-
* by `atMs`. Re-exported alias of `deadlineExceeded` so the
|
|
131
|
+
* by `atMs`. Re-exported alias of `deadlineExceeded` so the runner and
|
|
134
132
|
* the consumer's reducer share one constructor rather than two literals that
|
|
135
133
|
* can drift. The consumer handles it in a reducer cell by calling `onWindow`.
|
|
136
134
|
*/
|
|
137
135
|
declare function batchWindowExpired(id: string, atMs: number): BatchWindowExpired;
|
|
138
136
|
/**
|
|
139
137
|
* The bound knob returned by `createBatchWindow`. `init` + the two pure verbs +
|
|
140
|
-
* `
|
|
138
|
+
* `timer` + `subs`, all closing over one `BatchWindowConfig`. The verbs
|
|
141
139
|
* return `readonly [BatchWindow<I>, readonly C[]]`: the next slice and the Cmds
|
|
142
140
|
* to emit (one `flush` Cmd when a window closes, none otherwise).
|
|
143
141
|
*/
|
|
@@ -154,18 +152,16 @@ interface BatchWindowKnob<I, C extends Cmd> {
|
|
|
154
152
|
*/
|
|
155
153
|
onWindow(state: BatchWindow<I>, at: number): readonly [BatchWindow<I>, readonly C[]];
|
|
156
154
|
/**
|
|
157
|
-
* The
|
|
158
|
-
* `id` keys the
|
|
155
|
+
* The built-in `timer` Sub's deps while a window is open, `null` while it is
|
|
156
|
+
* closed. See `timerFor`. `id` keys the Msg so several windows on one
|
|
157
|
+
* machine route distinctly.
|
|
159
158
|
*/
|
|
160
|
-
|
|
159
|
+
timer(state: BatchWindow<I>, id?: string): TimerDeps<BatchWindowExpired> | null;
|
|
161
160
|
/**
|
|
162
|
-
* The
|
|
163
|
-
*
|
|
164
|
-
* into the consumer's subscribe map: `subscribe: { ...bw.handlers() }`.
|
|
161
|
+
* The window timer as an absolute deadline, listed only while a window is
|
|
162
|
+
* open — for `deadlinesSub` + `subscribeBatchWindow`. See `subsFor`.
|
|
165
163
|
*/
|
|
166
|
-
|
|
167
|
-
deadline: SubscribeHandler<BatchWindowSub, BatchWindowExpired, unknown>;
|
|
168
|
-
};
|
|
164
|
+
subs(state: BatchWindow<I>, id?: string): readonly BatchWindowSub[];
|
|
169
165
|
}
|
|
170
166
|
/**
|
|
171
167
|
* Buffer `item` and decide whether the size trigger fires. PURE.
|
|
@@ -215,18 +211,18 @@ declare function addItem<I, C extends Cmd>(config: BatchWindowConfig<I, C>, stat
|
|
|
215
211
|
*/
|
|
216
212
|
declare function onWindow<I, C extends Cmd>(config: BatchWindowConfig<I, C>, state: BatchWindow<I>, _at: number): readonly [BatchWindow<I>, readonly C[]];
|
|
217
213
|
/**
|
|
218
|
-
* The window timer
|
|
214
|
+
* The window timer deadline, derived from the slice. PURE.
|
|
219
215
|
*
|
|
220
|
-
* Returns the single
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* (clearing the pending `setTimeout`) when the
|
|
224
|
-
* that empties the buffer auto-cancels the now-irrelevant time
|
|
225
|
-
* next transition.
|
|
216
|
+
* Returns the single deadline targeting `openedAt + maxMs` while a window is
|
|
217
|
+
* open (buffer non-empty), or `[]` while it is closed. Fed through
|
|
218
|
+
* `deadlinesSub`, the engine arms the timer when the list gains the deadline
|
|
219
|
+
* and disarms it (clearing the pending `setTimeout`) when the list loses it —
|
|
220
|
+
* so a size-flush that empties the buffer auto-cancels the now-irrelevant time
|
|
221
|
+
* trigger on the next transition.
|
|
226
222
|
*
|
|
227
223
|
* `id` defaults to `"batch-window"`; pass a distinct id per window when a
|
|
228
|
-
* machine runs several so the dispatched `BatchWindowExpired` Msg
|
|
229
|
-
*
|
|
224
|
+
* machine runs several so the dispatched `BatchWindowExpired` Msg routes to the
|
|
225
|
+
* right one.
|
|
230
226
|
*
|
|
231
227
|
* @param config the knob (maxMs)
|
|
232
228
|
* @param state the current slice
|
|
@@ -235,22 +231,38 @@ declare function onWindow<I, C extends Cmd>(config: BatchWindowConfig<I, C>, sta
|
|
|
235
231
|
*/
|
|
236
232
|
declare function subsFor<I, C extends Cmd>(config: BatchWindowConfig<I, C>, state: BatchWindow<I>, id?: string): readonly BatchWindowSub[];
|
|
237
233
|
/**
|
|
238
|
-
* The `
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
234
|
+
* The built-in `timer` Sub's deps for a batch window. PURE.
|
|
235
|
+
*
|
|
236
|
+
* While a window is open it counts `maxMs` down from the transition that
|
|
237
|
+
* opened it — the deps are fixed for the window's life (`openedAt` never moves
|
|
238
|
+
* while items append), so the engine starts the countdown exactly once — and
|
|
239
|
+
* fires `batchWindowExpired(id, openedAt + maxMs)`. A closed window is `null`,
|
|
240
|
+
* so a size-flush that empties the buffer cancels the countdown on the next
|
|
241
|
+
* transition.
|
|
242
|
+
*
|
|
243
|
+
* Relative by construction: a process that rehydrates an open window counts a
|
|
244
|
+
* fresh `maxMs`. Reach for `subsFor` + `subscribeBatchWindow` when the flush
|
|
245
|
+
* must land at the original absolute instant.
|
|
246
|
+
*/
|
|
247
|
+
declare function timerFor<I, C extends Cmd>(config: BatchWindowConfig<I, C>, state: BatchWindow<I>, id?: string): TimerDeps<BatchWindowExpired> | null;
|
|
248
|
+
/**
|
|
249
|
+
* The `deadline` runner for a batch window's absolute timer — the exact
|
|
250
|
+
* `../deadline` runner. Arms a one-shot timer per listed deadline for
|
|
251
|
+
* `max(0, atMs - now)` and dispatches `batchWindowExpired(...)`; returns a
|
|
252
|
+
* cleanup that clears them. Hand it to `run` as `subscribe.deadline` when the
|
|
253
|
+
* machine declares `deadlinesSub((s) => bw.subs(s.batch))`.
|
|
242
254
|
*/
|
|
243
|
-
declare const subscribeBatchWindow:
|
|
255
|
+
declare const subscribeBatchWindow: Subscribe<BatchWindowExpired, DeadlinesSub, unknown>["deadline"];
|
|
244
256
|
/**
|
|
245
257
|
* Build a batch window knob from a config. Combinator form (the default L2
|
|
246
258
|
* ergonomic): hand it the config, splice the ~4 returned hooks into your
|
|
247
259
|
* machine. The pure verbs (`add` / `onWindow`) close over the config so the
|
|
248
|
-
* consumer's reducer cells stay a uniform `(state, ...args)` shape; `
|
|
249
|
-
*
|
|
260
|
+
* consumer's reducer cells stay a uniform `(state, ...args)` shape; `timer`
|
|
261
|
+
* arms the window timer.
|
|
250
262
|
*
|
|
251
263
|
* @typeParam I the item type buffered into each batch
|
|
252
264
|
* @typeParam C the Cmd type `config.flush` returns
|
|
253
265
|
*/
|
|
254
266
|
declare function createBatchWindow<I, C extends Cmd>(config: BatchWindowConfig<I, C>): BatchWindowKnob<I, C>;
|
|
255
267
|
|
|
256
|
-
export { type BatchWindow as B, type BatchWindowSub as a, type
|
|
268
|
+
export { type BatchWindow as B, type BatchWindowSub as a, type BatchWindowExpired as b, type BatchWindowConfig as c, type BatchWindowKnob as d, addItem as e, batchWindowExpired as f, createBatchWindow as g, subscribeBatchWindow as h, initBatchWindow as i, onWindow as o, subsFor as s, timerFor as t };
|