@demlik/tea 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/LICENSE +21 -0
  2. package/dist/agent/index.d.ts +907 -0
  3. package/dist/agent/index.js +20 -0
  4. package/dist/agent/index.js.map +1 -0
  5. package/dist/authed-call/index.d.ts +119 -0
  6. package/dist/authed-call/index.js +148 -0
  7. package/dist/authed-call/index.js.map +1 -0
  8. package/dist/await-terminal/index.d.ts +99 -0
  9. package/dist/await-terminal/index.js +75 -0
  10. package/dist/await-terminal/index.js.map +1 -0
  11. package/dist/batch-window/index.d.ts +259 -0
  12. package/dist/batch-window/index.js +43 -0
  13. package/dist/batch-window/index.js.map +1 -0
  14. package/dist/cache/index.d.ts +2 -2
  15. package/dist/cache/index.js +2 -50
  16. package/dist/cache/index.js.map +1 -1
  17. package/dist/{chunk-CMG2KMWX.js → chunk-2WZHS4P2.js} +220 -177
  18. package/dist/chunk-2WZHS4P2.js.map +1 -0
  19. package/dist/chunk-2YOE5PIS.js +45 -0
  20. package/dist/chunk-2YOE5PIS.js.map +1 -0
  21. package/dist/chunk-3545BOYL.js +65 -0
  22. package/dist/chunk-3545BOYL.js.map +1 -0
  23. package/dist/chunk-5VNWZADP.js +49 -0
  24. package/dist/chunk-5VNWZADP.js.map +1 -0
  25. package/dist/{chunk-ZRUST6BK.js → chunk-7FYQGDMF.js} +2 -2
  26. package/dist/chunk-7FYQGDMF.js.map +1 -0
  27. package/dist/chunk-7VEG4KHB.js +202 -0
  28. package/dist/chunk-7VEG4KHB.js.map +1 -0
  29. package/dist/{chunk-PYBQREFU.js → chunk-A56GNPI7.js} +20 -6
  30. package/dist/chunk-A56GNPI7.js.map +1 -0
  31. package/dist/chunk-BNJYE4AU.js +157 -0
  32. package/dist/chunk-BNJYE4AU.js.map +1 -0
  33. package/dist/chunk-BYQUGDD3.js +16 -0
  34. package/dist/chunk-BYQUGDD3.js.map +1 -0
  35. package/dist/chunk-D5EQDLDV.js +186 -0
  36. package/dist/chunk-D5EQDLDV.js.map +1 -0
  37. package/dist/chunk-EDGDR5XX.js +60 -0
  38. package/dist/chunk-EDGDR5XX.js.map +1 -0
  39. package/dist/chunk-EIZJTYKR.js +93 -0
  40. package/dist/chunk-EIZJTYKR.js.map +1 -0
  41. package/dist/chunk-EQRUAP2A.js +56 -0
  42. package/dist/chunk-EQRUAP2A.js.map +1 -0
  43. package/dist/chunk-FH5RUIIL.js +61 -0
  44. package/dist/chunk-FH5RUIIL.js.map +1 -0
  45. package/dist/chunk-HJO6VNQI.js +15 -0
  46. package/dist/chunk-HJO6VNQI.js.map +1 -0
  47. package/dist/chunk-IFBQJYGI.js +132 -0
  48. package/dist/chunk-IFBQJYGI.js.map +1 -0
  49. package/dist/chunk-IN33Q4VJ.js +52 -0
  50. package/dist/chunk-IN33Q4VJ.js.map +1 -0
  51. package/dist/chunk-JELSZN25.js +47 -0
  52. package/dist/chunk-JELSZN25.js.map +1 -0
  53. package/dist/chunk-K575PT4S.js +58 -0
  54. package/dist/chunk-K575PT4S.js.map +1 -0
  55. package/dist/chunk-LEC4U6CX.js +91 -0
  56. package/dist/chunk-LEC4U6CX.js.map +1 -0
  57. package/dist/{chunk-Y5JM3UUH.js → chunk-NSDFA6M6.js} +75 -3
  58. package/dist/chunk-NSDFA6M6.js.map +1 -0
  59. package/dist/chunk-QGZW4W3E.js +20 -0
  60. package/dist/chunk-QGZW4W3E.js.map +1 -0
  61. package/dist/{chunk-PYOCUBQJ.js → chunk-RGTPPF4U.js} +22 -15
  62. package/dist/chunk-RGTPPF4U.js.map +1 -0
  63. package/dist/chunk-RVJFGRGK.js +222 -0
  64. package/dist/chunk-RVJFGRGK.js.map +1 -0
  65. package/dist/chunk-RVU3RBE6.js +31 -0
  66. package/dist/chunk-RVU3RBE6.js.map +1 -0
  67. package/dist/chunk-SC3FAFZN.js +53 -0
  68. package/dist/chunk-SC3FAFZN.js.map +1 -0
  69. package/dist/chunk-SINXE47Y.js +55 -0
  70. package/dist/chunk-SINXE47Y.js.map +1 -0
  71. package/dist/chunk-TAO4YOLO.js +87 -0
  72. package/dist/chunk-TAO4YOLO.js.map +1 -0
  73. package/dist/chunk-TC4HWABA.js +506 -0
  74. package/dist/chunk-TC4HWABA.js.map +1 -0
  75. package/dist/chunk-TGG26XMK.js +52 -0
  76. package/dist/chunk-TGG26XMK.js.map +1 -0
  77. package/dist/chunk-UV6UWGEO.js +147 -0
  78. package/dist/chunk-UV6UWGEO.js.map +1 -0
  79. package/dist/chunk-UYWUVEP6.js +158 -0
  80. package/dist/chunk-UYWUVEP6.js.map +1 -0
  81. package/dist/chunk-WUV3PSCZ.js +54 -0
  82. package/dist/chunk-WUV3PSCZ.js.map +1 -0
  83. package/dist/chunk-XRXKH7KA.js +268 -0
  84. package/dist/chunk-XRXKH7KA.js.map +1 -0
  85. package/dist/circuit-breaker/index.js +1 -51
  86. package/dist/circuit-breaker/index.js.map +1 -1
  87. package/dist/core-CymXZCeY.d.ts +178 -0
  88. package/dist/deadline/index.d.ts +24 -5
  89. package/dist/deadline/index.js +4 -18
  90. package/dist/deadline/index.js.map +1 -1
  91. package/dist/debounce/index.js +1 -54
  92. package/dist/debounce/index.js.map +1 -1
  93. package/dist/devtools/index.d.ts +1 -1
  94. package/dist/devtools/index.js +18 -6
  95. package/dist/devtools/index.js.map +1 -1
  96. package/dist/do/index.d.ts +1732 -92
  97. package/dist/do/index.js +677 -31
  98. package/dist/do/index.js.map +1 -1
  99. package/dist/durable-effects-2MDxDs45.d.ts +180 -0
  100. package/dist/extension/index.d.ts +31 -13
  101. package/dist/extension/index.js +5 -3
  102. package/dist/extension/index.js.map +1 -1
  103. package/dist/extension/react.js +8 -3
  104. package/dist/extension/react.js.map +1 -1
  105. package/dist/extension/subs/index.d.ts +2 -2
  106. package/dist/extension/subs/index.js.map +1 -1
  107. package/dist/extension/test-utils.js +11 -3
  108. package/dist/extension/test-utils.js.map +1 -1
  109. package/dist/fan-out/index.d.ts +239 -0
  110. package/dist/fan-out/index.js +5 -0
  111. package/dist/fan-out/index.js.map +1 -0
  112. package/dist/idempotency/adapter.d.ts +62 -0
  113. package/dist/idempotency/adapter.js +4 -0
  114. package/dist/idempotency/adapter.js.map +1 -0
  115. package/dist/idempotency/index.js +1 -56
  116. package/dist/idempotency/index.js.map +1 -1
  117. package/dist/idempotent-intake/index.d.ts +186 -0
  118. package/dist/idempotent-intake/index.js +7 -0
  119. package/dist/idempotent-intake/index.js.map +1 -0
  120. package/dist/index.d.ts +341 -191
  121. package/dist/index.js +2 -1
  122. package/dist/llm-call/index.d.ts +309 -0
  123. package/dist/llm-call/index.js +14 -0
  124. package/dist/llm-call/index.js.map +1 -0
  125. package/dist/machine-viz/index.d.ts +1 -1
  126. package/dist/machine-viz/index.js +1 -1
  127. package/dist/machine-viz/index.js.map +1 -1
  128. package/dist/mem/index.d.ts +1 -0
  129. package/dist/monitored-run/index.d.ts +253 -0
  130. package/dist/monitored-run/index.js +10 -0
  131. package/dist/monitored-run/index.js.map +1 -0
  132. package/dist/node/index.d.ts +5 -5
  133. package/dist/node/index.js.map +1 -1
  134. package/dist/paginated-walk/index.d.ts +234 -0
  135. package/dist/paginated-walk/index.js +15 -0
  136. package/dist/paginated-walk/index.js.map +1 -0
  137. package/dist/paginator/index.d.ts +271 -0
  138. package/dist/paginator/index.js +3 -0
  139. package/dist/paginator/index.js.map +1 -0
  140. package/dist/parity/index.d.ts +86 -0
  141. package/dist/parity/index.js +77 -0
  142. package/dist/parity/index.js.map +1 -0
  143. package/dist/pbt/arbitraries/index.d.ts +1 -1
  144. package/dist/pbt/arbitraries/index.js +1 -1
  145. package/dist/pbt/index.d.ts +1 -1
  146. package/dist/pbt/index.js +5 -4
  147. package/dist/pbt/index.js.map +1 -1
  148. package/dist/pbt/runners/index.d.ts +1 -1
  149. package/dist/pbt/runners/index.js +3 -2
  150. package/dist/poller/index.d.ts +288 -0
  151. package/dist/poller/index.js +79 -0
  152. package/dist/poller/index.js.map +1 -0
  153. package/dist/prediction/index.d.ts +109 -0
  154. package/dist/prediction/index.js +4 -0
  155. package/dist/prediction/index.js.map +1 -0
  156. package/dist/protocol-B5YmJr0d.d.ts +45 -0
  157. package/dist/pure/index.d.ts +2 -0
  158. package/dist/pure/index.js +4 -0
  159. package/dist/pure/index.js.map +1 -0
  160. package/dist/raft/demo.d.ts +105 -0
  161. package/dist/raft/demo.js +172 -0
  162. package/dist/raft/demo.js.map +1 -0
  163. package/dist/raft/index.d.ts +548 -0
  164. package/dist/raft/index.js +7 -0
  165. package/dist/raft/index.js.map +1 -0
  166. package/dist/raft/sim.d.ts +222 -0
  167. package/dist/raft/sim.js +8 -0
  168. package/dist/raft/sim.js.map +1 -0
  169. package/dist/raft/timeline.d.ts +46 -0
  170. package/dist/raft/timeline.js +62 -0
  171. package/dist/raft/timeline.js.map +1 -0
  172. package/dist/rate-limit/index.js +1 -43
  173. package/dist/rate-limit/index.js.map +1 -1
  174. package/dist/react/index.d.ts +2 -1
  175. package/dist/react/index.js +39 -20
  176. package/dist/react/index.js.map +1 -1
  177. package/dist/reconciler/index.d.ts +192 -0
  178. package/dist/reconciler/index.js +166 -0
  179. package/dist/reconciler/index.js.map +1 -0
  180. package/dist/recorder/index.d.ts +7 -3
  181. package/dist/recorder/index.js +1 -155
  182. package/dist/recorder/index.js.map +1 -1
  183. package/dist/resilient-call/index.d.ts +251 -0
  184. package/dist/resilient-call/index.js +13 -0
  185. package/dist/resilient-call/index.js.map +1 -0
  186. package/dist/retry-backoff/index.d.ts +42 -5
  187. package/dist/retry-backoff/index.js +1 -35
  188. package/dist/retry-backoff/index.js.map +1 -1
  189. package/dist/saga/index.d.ts +225 -0
  190. package/dist/saga/index.js +150 -0
  191. package/dist/saga/index.js.map +1 -0
  192. package/dist/snapshot/index.d.ts +334 -0
  193. package/dist/snapshot/index.js +5 -0
  194. package/dist/snapshot/index.js.map +1 -0
  195. package/dist/subs/index.d.ts +48 -10
  196. package/dist/subs/index.js +1 -1
  197. package/dist/testing/index.d.ts +107 -2
  198. package/dist/testing/index.js +204 -6
  199. package/dist/testing/index.js.map +1 -1
  200. package/dist/throttle/index.js +1 -52
  201. package/dist/throttle/index.js.map +1 -1
  202. package/dist/throttled-input/index.d.ts +372 -0
  203. package/dist/throttled-input/index.js +88 -0
  204. package/dist/throttled-input/index.js.map +1 -0
  205. package/dist/token-refresh/index.d.ts +215 -0
  206. package/dist/token-refresh/index.js +6 -0
  207. package/dist/token-refresh/index.js.map +1 -0
  208. package/dist/trace-replay/index.d.ts +11 -2
  209. package/dist/trace-replay/index.js +3 -55
  210. package/dist/trace-replay/index.js.map +1 -1
  211. package/dist/{types-CwBC5wMn.d.ts → types-N9LZbdnr.d.ts} +1 -1
  212. package/dist/with-deadline/index.d.ts +196 -0
  213. package/dist/with-deadline/index.js +130 -0
  214. package/dist/with-deadline/index.js.map +1 -0
  215. package/dist/with-resilience/index.d.ts +205 -0
  216. package/dist/with-resilience/index.js +274 -0
  217. package/dist/with-resilience/index.js.map +1 -0
  218. package/dist/with-telemetry/index.d.ts +149 -0
  219. package/dist/with-telemetry/index.js +95 -0
  220. package/dist/with-telemetry/index.js.map +1 -0
  221. package/dist/work-queue/adapter.d.ts +82 -0
  222. package/dist/work-queue/adapter.js +4 -0
  223. package/dist/work-queue/adapter.js.map +1 -0
  224. package/dist/work-queue/index.d.ts +25 -11
  225. package/dist/work-queue/index.js +1 -46
  226. package/dist/work-queue/index.js.map +1 -1
  227. package/dist/work-queue/ops.d.ts +69 -0
  228. package/dist/work-queue/ops.js +3 -0
  229. package/dist/work-queue/ops.js.map +1 -0
  230. package/dist/workflow/index.d.ts +444 -0
  231. package/dist/workflow/index.js +225 -0
  232. package/dist/workflow/index.js.map +1 -0
  233. package/package.json +162 -25
  234. package/dist/chunk-CMG2KMWX.js.map +0 -1
  235. package/dist/chunk-PYBQREFU.js.map +0 -1
  236. package/dist/chunk-PYOCUBQJ.js.map +0 -1
  237. package/dist/chunk-Y5JM3UUH.js.map +0 -1
  238. package/dist/chunk-ZRUST6BK.js.map +0 -1
@@ -0,0 +1,186 @@
1
+ import { IdempotencyStore } from '../idempotency/index.js';
2
+ import { C as Cmd } from '../core-CymXZCeY.js';
3
+ import { QueueItem } from '../work-queue/index.js';
4
+ import '../index.js';
5
+
6
+ /**
7
+ * @demlik/tea/idempotent-intake — receive-once intake for webhooks / queue
8
+ * messages: dedupe by key, enqueue the new ones, replay the cached result to
9
+ * the duplicates. The "process this payload exactly once even though it
10
+ * arrives N times" knob.
11
+ *
12
+ * **The recipe.** This is a Level-2 composition — it owns no primitive
13
+ * queue/cache logic of its own, it *splices two L1 bricks into one Model slice*
14
+ * and DELEGATES every transition to their VERB SEAMS — `IdempotencyMemory`
15
+ * (`../idempotency/adapter`) and `QueueAdapter` (`../work-queue/adapter`) —
16
+ * so the store ops and the `QueueItem` / `IdempotencyStore` shapes stay
17
+ * insulated behind verbs the intake calls:
18
+ *
19
+ * - `../idempotency/adapter` — the dedupe-by-key + last-result cache. The
20
+ * `seen` half of the slice is its `IdempotencyStore`, keyed by
21
+ * `keyOf(payload)`. A key is recorded once `receive` calls `memory.remember`;
22
+ * `complete` calls `memory.remember` again to swap its cached value from
23
+ * `pending` to the finished `result`. The cache write is the brick's, never
24
+ * re-rolled here.
25
+ * - `../work-queue/adapter` — the pending-work list. The `queue` half of the
26
+ * slice is its `QueueItem<P>[]`. Every status flip routes through the
27
+ * adapter verbs: `receive` enqueues via `queue.enqueue`, `claimNext` stamps
28
+ * the `running` claim via `queue.patch`, `boot` re-arms a dead worker's
29
+ * claim via `queue.patch`. Intake owns only the SELECTION (which item,
30
+ * gated on the done-cache reconcile below) — the array transition is the
31
+ * brick's. The consumer drains it (claim → process → `complete`) at its own
32
+ * pace.
33
+ *
34
+ * Both bricks are pure-state + pure-ops, host- and clock-agnostic by
35
+ * construction, so the combined slice inherits TEA's two non-negotiables:
36
+ *
37
+ * - **Durable** — the slice is a plain serializable value (a record-backed
38
+ * idempotency store + an array of queue items, no `Map`, no closures), so
39
+ * it survives a Durable-Object eviction / reload and rehydrates whole.
40
+ * - **Replayable** — every verb is a pure `(state, …) => [state, Cmd[]]`
41
+ * transition; no `Date.now()`, no `Math.random()`, no I/O inside a verb.
42
+ * `at` (the clock) and `id` (the queue-item id) are *injected* at the call
43
+ * site, so `trace-replay` reconstructs each transition exactly.
44
+ *
45
+ * **The decision lives in a Cmd, not in a return shape.** `receive` cannot
46
+ * "return" what it decided (the knob contract pins the shape to
47
+ * `[State, Cmd[]]`), so the decision is *reified as a Cmd* the runtime
48
+ * performs:
49
+ *
50
+ * - first sighting of a key → mark it `pending`, enqueue the payload, emit
51
+ * `IntakeProcess` (go run the work).
52
+ * - a key already `pending` → drop silently (the original is in flight);
53
+ * emit nothing.
54
+ * - a key already `done` → emit `IntakeReplay` carrying the cached
55
+ * result so the duplicate caller gets the SAME response the first one
56
+ * produced, with zero re-execution of the side effect.
57
+ *
58
+ * **Two crash-safety guarantees the verbs enforce (and the unit specs alone
59
+ * missed — see the wired-machine test):**
60
+ *
61
+ * - *A slow worker is never double-enqueued.* The TTL clock starts at
62
+ * `complete`, not at `receive`: a `pending` entry NEVER ages out, so a
63
+ * duplicate of an in-flight key is always dropped no matter how long the
64
+ * worker takes. Only a `done` entry expires (see `liveEntry`).
65
+ * - *A complete-then-crash never re-runs.* `boot` and `claimNext` reconcile
66
+ * the queue against the done cache: a queue item whose key already resolved
67
+ * to `done` in `seen` is skipped (never reset to pending, never claimed),
68
+ * so a worker that finished and cached its result before the DO evicted is
69
+ * not re-executed on resume.
70
+ *
71
+ * Typical wiring (the combinator form — splice ~3 hooks into a host machine):
72
+ *
73
+ * const intake = createIntake<StripeEvent, ChargeResult>({
74
+ * keyOf: (e) => e.id, // Stripe's idempotency key
75
+ * ttlMs: 24 * 60 * 60 * 1000, // a replayed webhook 24h after it COMPLETED is re-run
76
+ * });
77
+ *
78
+ * // in `init`:
79
+ * intake: intake.init(),
80
+ * // in `update`, on the inbound-webhook Msg:
81
+ * const [next, cmds] = intake.receive(state.intake, payload, at, id);
82
+ * // …route `IntakeProcess` to your worker, `IntakeReplay` to the responder.
83
+ * // on the worker's done Msg:
84
+ * const [next, _] = intake.complete(state.intake, key, result, at);
85
+ * // once, after boot (DO reload), before resuming the drain:
86
+ * const [next, _] = intake.boot(state.intake);
87
+ *
88
+ * Escape hatch: reach the raw L1 ops via `@demlik/tea/idempotency` and
89
+ * `@demlik/tea/work-queue` and thread them by hand.
90
+ */
91
+
92
+ /**
93
+ * A cached intake entry: either a key whose work is still in flight
94
+ * (`pending`) or one whose work has finished and whose `result` is held for
95
+ * replay to later duplicates (`done`). Discriminated on `phase` — `pending`
96
+ * carries no payload, `done` carries the result `R`.
97
+ *
98
+ * Lives inside the `seen` half of the slice (`IdempotencyStore<IntakeEntry<R>>`).
99
+ * It is the dedupe ledger's *value*; the ledger's *key* is `keyOf(payload)`.
100
+ */
101
+ type IntakeEntry<R> = {
102
+ readonly phase: "pending";
103
+ } | {
104
+ readonly phase: "done";
105
+ readonly result: R;
106
+ };
107
+ /**
108
+ * The intake knob's config — `keyOf` derives the idempotency key from a
109
+ * payload, `ttlMs` (optional) ages a *completed* cached key out so a webhook
110
+ * replayed long after the work finished is treated as new and re-processed.
111
+ *
112
+ * **The TTL clock starts at `complete`, not at `receive`.** A `pending` entry
113
+ * (work still in flight) NEVER ages out, no matter how slow the worker is —
114
+ * ageing a pending key would let the duplicate re-enqueue the in-flight
115
+ * payload and double-process it. Only a `done` entry expires, measured from
116
+ * the `at` passed to `complete` (the moment the result was cached). Inside the
117
+ * window a duplicate replays the cached result; at/after the window it is
118
+ * re-accepted and re-processed.
119
+ *
120
+ * Omit `ttlMs` for a cache whose `done` entries never expire by age (keys live
121
+ * forever — fine for a bounded universe of ids, unbounded growth otherwise).
122
+ *
123
+ * The TTL is owned HERE, not delegated to the composed `IdempotencyStore`: the
124
+ * store's uniform per-entry TTL cannot tell `pending` from `done`, so intake
125
+ * keeps the store TTL-free and applies the phase-aware rule itself (see
126
+ * `liveEntry`).
127
+ */
128
+ interface IntakeConfig<P> {
129
+ /** Derive the idempotency key from a payload. Must be pure + deterministic. */
130
+ readonly keyOf: (payload: P) => string;
131
+ /**
132
+ * Age a *completed* key out after this many ms, measured from the `at`
133
+ * passed to `complete`. Pending keys never age out.
134
+ */
135
+ readonly ttlMs?: number;
136
+ }
137
+ /**
138
+ * The Model slice this knob owns. `seen` is the dedupe + last-result cache
139
+ * (the `../idempotency` brick); `queue` is the pending-work list (the
140
+ * `../work-queue` brick). Both are plain serializable values — the whole slice
141
+ * round-trips through `JSON` so it survives eviction and replays exactly.
142
+ */
143
+ interface IntakeState<P, R> {
144
+ readonly seen: IdempotencyStore<IntakeEntry<R>>;
145
+ readonly queue: readonly QueueItem<P>[];
146
+ }
147
+ /** A genuinely-new payload was accepted and enqueued — go run the work. */
148
+ interface IntakeProcessCmd<P> extends Cmd<"intake:process"> {
149
+ /** The dedupe key the payload was filed under. */
150
+ readonly key: string;
151
+ /** The enqueued queue-item id (the same `id` passed to `receive`). */
152
+ readonly itemId: string;
153
+ /** The original payload, for the worker to process. */
154
+ readonly payload: P;
155
+ }
156
+ /**
157
+ * A duplicate of an already-completed key arrived — replay the cached result
158
+ * to the caller instead of re-running the side effect.
159
+ */
160
+ interface IntakeReplayCmd<R> extends Cmd<"intake:replay"> {
161
+ /** The dedupe key whose cached result is being replayed. */
162
+ readonly key: string;
163
+ /** The result the ORIGINAL request produced, recalled from the cache. */
164
+ readonly result: R;
165
+ }
166
+ /** The Cmd union the intake verbs emit. */
167
+ type IntakeCmd<P, R> = IntakeProcessCmd<P> | IntakeReplayCmd<R>;
168
+ /**
169
+ * Build an idempotent-intake knob from `config`. Returns the uniform L2
170
+ * contract — `init()` + the verbs (`receive`, `complete`, `boot`, `claimNext`).
171
+ * No `subs` / `handlers`: intake owns no timers and does no I/O of its own (the
172
+ * composed bricks are pure-ops; the worker that runs `IntakeProcess` and the
173
+ * responder that runs `IntakeReplay` live in the host's interpret map).
174
+ */
175
+ declare function createIntake<P, R>(config: IntakeConfig<P>): {
176
+ init: () => IntakeState<P, R>;
177
+ receive: (state: IntakeState<P, R>, payload: P, at: number, id: string) => readonly [IntakeState<P, R>, readonly IntakeCmd<P, R>[]];
178
+ complete: (state: IntakeState<P, R>, key: string, result: R, at: number) => readonly [IntakeState<P, R>, readonly IntakeCmd<P, R>[]];
179
+ boot: (state: IntakeState<P, R>) => readonly [IntakeState<P, R>, readonly IntakeCmd<P, R>[]];
180
+ claimNext: (state: IntakeState<P, R>, at: number) => {
181
+ readonly state: IntakeState<P, R>;
182
+ readonly claimed: QueueItem<P>;
183
+ } | null;
184
+ };
185
+
186
+ export { type IntakeCmd, type IntakeConfig, type IntakeEntry, type IntakeProcessCmd, type IntakeReplayCmd, type IntakeState, createIntake };
@@ -0,0 +1,7 @@
1
+ export { createIntake } from '../chunk-LEC4U6CX.js';
2
+ import '../chunk-BYQUGDD3.js';
3
+ import '../chunk-K575PT4S.js';
4
+ import '../chunk-HJO6VNQI.js';
5
+ import '../chunk-TGG26XMK.js';
6
+ //# sourceMappingURL=index.js.map
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}