@graphrefly/graphrefly 0.21.0 → 0.22.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.
Files changed (97) hide show
  1. package/README.md +7 -5
  2. package/dist/chunk-44HD4BTA.js +47 -0
  3. package/dist/chunk-44HD4BTA.js.map +1 -0
  4. package/dist/chunk-7TAQJHQV.js +103 -0
  5. package/dist/chunk-7TAQJHQV.js.map +1 -0
  6. package/dist/chunk-BLD3IFYF.js +6827 -0
  7. package/dist/chunk-BLD3IFYF.js.map +1 -0
  8. package/dist/{chunk-ZTCDY5NQ.js → chunk-EQUZ5NLD.js} +34 -45
  9. package/dist/chunk-EQUZ5NLD.js.map +1 -0
  10. package/dist/{chunk-VOQFK7YN.js → chunk-IR3KMOLX.js} +358 -128
  11. package/dist/chunk-IR3KMOLX.js.map +1 -0
  12. package/dist/{chunk-XWBVAO2R.js → chunk-MQBQOFDS.js} +20 -11
  13. package/dist/chunk-MQBQOFDS.js.map +1 -0
  14. package/dist/chunk-NXC35KC5.js +2417 -0
  15. package/dist/chunk-NXC35KC5.js.map +1 -0
  16. package/dist/chunk-QA3RP5NH.js +2234 -0
  17. package/dist/chunk-QA3RP5NH.js.map +1 -0
  18. package/dist/chunk-RHI3GHZW.js +115 -0
  19. package/dist/chunk-RHI3GHZW.js.map +1 -0
  20. package/dist/{chunk-7IGHIFTT.js → chunk-TH6COGOP.js} +15 -26
  21. package/dist/chunk-TH6COGOP.js.map +1 -0
  22. package/dist/compat/nestjs/index.cjs +3366 -2259
  23. package/dist/compat/nestjs/index.cjs.map +1 -1
  24. package/dist/compat/nestjs/index.d.cts +6 -4
  25. package/dist/compat/nestjs/index.d.ts +6 -4
  26. package/dist/compat/nestjs/index.js +8 -8
  27. package/dist/core/index.cjs +1611 -1218
  28. package/dist/core/index.cjs.map +1 -1
  29. package/dist/core/index.d.cts +3 -2
  30. package/dist/core/index.d.ts +3 -2
  31. package/dist/core/index.js +37 -34
  32. package/dist/extra/index.cjs +7387 -6089
  33. package/dist/extra/index.cjs.map +1 -1
  34. package/dist/extra/index.d.cts +4 -4
  35. package/dist/extra/index.d.ts +4 -4
  36. package/dist/extra/index.js +57 -30
  37. package/dist/graph/index.cjs +3107 -2216
  38. package/dist/graph/index.cjs.map +1 -1
  39. package/dist/graph/index.d.cts +5 -3
  40. package/dist/graph/index.d.ts +5 -3
  41. package/dist/graph/index.js +24 -11
  42. package/dist/graph-DFr0diXB.d.ts +1128 -0
  43. package/dist/graph-ab1yPwIB.d.cts +1128 -0
  44. package/dist/{index-8a605sg9.d.ts → index-BHm3Ba5q.d.ts} +2 -2
  45. package/dist/{index-DuN3bhtm.d.ts → index-BbYZma8G.d.ts} +1697 -586
  46. package/dist/{index-SFzE_KTa.d.cts → index-BvWfZCTt.d.cts} +1697 -586
  47. package/dist/index-C9z6rU9P.d.cts +388 -0
  48. package/dist/{index-BjtlNirP.d.cts → index-D36MAQ3f.d.ts} +4 -4
  49. package/dist/{index-VHA43cGP.d.cts → index-DLE1Sp-L.d.cts} +2 -2
  50. package/dist/{index-CgSiUouz.d.ts → index-DrJq9B1T.d.cts} +4 -4
  51. package/dist/index-DsGxLfwL.d.ts +315 -0
  52. package/dist/index-Dy04P4W3.d.cts +315 -0
  53. package/dist/index-HdJx_BjO.d.ts +388 -0
  54. package/dist/index.cjs +9781 -7878
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.cts +214 -37
  57. package/dist/index.d.ts +214 -37
  58. package/dist/index.js +905 -638
  59. package/dist/index.js.map +1 -1
  60. package/dist/meta--fr9sxRM.d.cts +41 -0
  61. package/dist/meta-n3FoVWML.d.ts +41 -0
  62. package/dist/node-C5UD5MGq.d.cts +1146 -0
  63. package/dist/node-C5UD5MGq.d.ts +1146 -0
  64. package/dist/{observable-DcBwQY7t.d.ts → observable-CQRBtEbq.d.ts} +1 -1
  65. package/dist/{observable-C8Kx_O6k.d.cts → observable-DWydVy5b.d.cts} +1 -1
  66. package/dist/patterns/reactive-layout/index.cjs +3102 -2132
  67. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  68. package/dist/patterns/reactive-layout/index.d.cts +5 -3
  69. package/dist/patterns/reactive-layout/index.d.ts +5 -3
  70. package/dist/patterns/reactive-layout/index.js +5 -4
  71. package/dist/storage-Bew05Xy6.d.cts +182 -0
  72. package/dist/storage-C9fZfMfM.d.ts +182 -0
  73. package/package.json +1 -1
  74. package/dist/chunk-2UDLYZHT.js +0 -2117
  75. package/dist/chunk-2UDLYZHT.js.map +0 -1
  76. package/dist/chunk-4MQ2J6IG.js +0 -1631
  77. package/dist/chunk-4MQ2J6IG.js.map +0 -1
  78. package/dist/chunk-7IGHIFTT.js.map +0 -1
  79. package/dist/chunk-DOSLSFKL.js +0 -162
  80. package/dist/chunk-DOSLSFKL.js.map +0 -1
  81. package/dist/chunk-ECN37NVS.js +0 -6227
  82. package/dist/chunk-ECN37NVS.js.map +0 -1
  83. package/dist/chunk-G66H6ZRK.js +0 -111
  84. package/dist/chunk-G66H6ZRK.js.map +0 -1
  85. package/dist/chunk-VOQFK7YN.js.map +0 -1
  86. package/dist/chunk-WZ2Z2CRV.js +0 -32
  87. package/dist/chunk-WZ2Z2CRV.js.map +0 -1
  88. package/dist/chunk-XWBVAO2R.js.map +0 -1
  89. package/dist/chunk-ZTCDY5NQ.js.map +0 -1
  90. package/dist/graph-KsTe57nI.d.cts +0 -750
  91. package/dist/graph-mILUUqW8.d.ts +0 -750
  92. package/dist/index-B2SvPEbc.d.ts +0 -257
  93. package/dist/index-BHfg_Ez3.d.ts +0 -629
  94. package/dist/index-Bc_diYYJ.d.cts +0 -629
  95. package/dist/index-UudxGnzc.d.cts +0 -257
  96. package/dist/meta-BnG7XAaE.d.cts +0 -778
  97. package/dist/meta-BnG7XAaE.d.ts +0 -778
@@ -1,6 +1,141 @@
1
- import { N as Node, a as NodeOptions, M as Message, l as Messages } from './meta-BnG7XAaE.js';
2
- import { G as Graph } from './graph-mILUUqW8.js';
3
- import { T as ToObservableOptions, t as toObservable } from './observable-DcBwQY7t.js';
1
+ import { a as NodeOptions, N as Node, M as Message, t as Messages, a6 as VersioningLevel } from './node-C5UD5MGq.js';
2
+ import { a as StorageTier, I as IndexedDbStorageSpec, S as StorageHandle, d as dictStorage, f as fileStorage, b as fromIDBRequest, c as fromIDBTransaction, i as indexedDbStorage, m as memoryStorage, s as sqliteStorage } from './storage-C9fZfMfM.js';
3
+ import { T as ToObservableOptions, t as toObservable } from './observable-CQRBtEbq.js';
4
+
5
+ /**
6
+ * External-register helpers — the common `register({emit, error, complete})`
7
+ * contract shared by webhook, MCP, syslog, StatsD, OTel and other callback-
8
+ * based integrations. Absorbs the `active` flag that every such adapter needs
9
+ * to guard against emits after teardown (§5.10 boundary pattern).
10
+ *
11
+ * Two shapes:
12
+ *
13
+ * - {@link externalProducer} — single channel. Lazy activation: the register
14
+ * fn runs when the node gains its first subscriber; its returned cleanup
15
+ * runs on deactivation.
16
+ *
17
+ * - {@link externalBundle} — multiple named channels. Eager activation: the
18
+ * register fn runs at bundle construction time so externally-owned servers
19
+ * (HTTP endpoints, UDP sockets) start accepting traffic immediately. A
20
+ * shared refcount fires the returned cleanup once every channel has fully
21
+ * torn down.
22
+ */
23
+
24
+ type ExtraOpts$3 = Omit<NodeOptions<unknown>, "describeKind">;
25
+ /**
26
+ * Standard emit-triad passed to a single-channel external registrar.
27
+ *
28
+ * Post-teardown calls on any of these are automatically no-ops — the
29
+ * registrar does not need its own guard flag.
30
+ *
31
+ * @category extra
32
+ */
33
+ type EmitTriad<T> = {
34
+ /** Emit a value as `DATA`. */
35
+ emit: (value: T) => void;
36
+ /** Terminate with `ERROR`. Subsequent `emit` / `error` / `complete` are ignored. */
37
+ error: (err: unknown) => void;
38
+ /** Terminate with `COMPLETE`. Subsequent `emit` / `error` / `complete` are ignored. */
39
+ complete: () => void;
40
+ };
41
+ /**
42
+ * Multi-channel emit bundle. Each declared channel name maps to an emit fn;
43
+ * `error` and `complete` terminate every channel atomically.
44
+ *
45
+ * @category extra
46
+ */
47
+ type BundleTriad<TChannels extends Record<string, unknown>> = {
48
+ [K in keyof TChannels]: (value: TChannels[K]) => void;
49
+ } & {
50
+ /** Terminate every channel with `ERROR`. */
51
+ error: (err: unknown) => void;
52
+ /** Terminate every channel with `COMPLETE`. */
53
+ complete: () => void;
54
+ };
55
+ /**
56
+ * Generic external registrator contract. The caller installs handlers into a
57
+ * third-party library / framework / server and optionally returns a cleanup
58
+ * callback. Returning `undefined` / `void` is equivalent to a no-op cleanup.
59
+ *
60
+ * @category extra
61
+ */
62
+ type ExternalRegister<H> = (handlers: H) => (() => void) | undefined;
63
+ /**
64
+ * Wraps a callback-style external integration as a reactive source.
65
+ *
66
+ * The registrar installs the supplied `emit` / `error` / `complete` handlers
67
+ * into the external SDK; post-teardown calls are silently dropped. Synchronous
68
+ * exceptions thrown by the registrar surface as terminal `ERROR`.
69
+ *
70
+ * @param register - Installs handlers. Optionally returns a cleanup fn.
71
+ * @param opts - Node options (name, equals, resubscribable, ...).
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { externalProducer } from "@graphrefly/graphrefly-ts";
76
+ *
77
+ * const hook$ = externalProducer<Payload>(({ emit, error }) => {
78
+ * const id = transport.onMessage((raw) => {
79
+ * try { emit(parse(raw)); } catch (e) { error(e); }
80
+ * });
81
+ * return () => transport.off(id);
82
+ * });
83
+ * ```
84
+ *
85
+ * @category extra
86
+ */
87
+ declare function externalProducer<T = unknown>(register: ExternalRegister<EmitTriad<T>>, opts?: ExtraOpts$3): Node<T>;
88
+ /**
89
+ * Options for {@link externalBundle}.
90
+ *
91
+ * @category extra
92
+ */
93
+ type ExternalBundleOptions<TChannels extends Record<string, unknown>> = {
94
+ /** Base name prefix for channel nodes; each node is named `${name}::${channel}`. */
95
+ name?: string;
96
+ /** Per-channel node options (equals, resubscribable, ...). */
97
+ channelOpts?: {
98
+ [K in keyof TChannels]?: ExtraOpts$3;
99
+ };
100
+ };
101
+ /**
102
+ * Multi-channel variant — one `Node<T>` per named channel, sharing a single
103
+ * registrar. Activation is eager: the registrar runs at construction time so
104
+ * externally-owned servers (HTTP, UDP, queue consumers) can start accepting
105
+ * traffic immediately. The returned cleanup fires once every channel has been
106
+ * subscribed and then fully deactivated (refcount-on-teardown).
107
+ *
108
+ * Any call to `error` or `complete` propagates to every channel atomically.
109
+ *
110
+ * @param register - Installs handlers for each channel plus shared error/complete.
111
+ * @param channels - Ordered channel names; determines the returned object shape.
112
+ * @param opts - Optional name prefix and per-channel node options.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * import { externalBundle } from "@graphrefly/graphrefly-ts";
117
+ *
118
+ * type OTelChannels = { traces: Span; metrics: Metric; logs: LogRec };
119
+ * const otel = externalBundle<OTelChannels>(
120
+ * ({ traces, metrics, logs, error }) => {
121
+ * app.post("/v1/traces", (req, res) => { traces(req.body); res.sendStatus(200); });
122
+ * app.post("/v1/metrics", (req, res) => { metrics(req.body); res.sendStatus(200); });
123
+ * app.post("/v1/logs", (req, res) => { logs(req.body); res.sendStatus(200); });
124
+ * server.on("error", error);
125
+ * return () => server.close();
126
+ * },
127
+ * ["traces", "metrics", "logs"],
128
+ * );
129
+ * otel.traces.subscribe(...);
130
+ * ```
131
+ *
132
+ * @category extra
133
+ */
134
+ declare function externalBundle<TChannels extends Record<string, unknown>>(register: ExternalRegister<BundleTriad<TChannels>>, channels: readonly (keyof TChannels & string)[], opts?: ExternalBundleOptions<TChannels>): {
135
+ [K in keyof TChannels]: Node<TChannels[K]>;
136
+ } & {
137
+ dispose(): void;
138
+ };
4
139
 
5
140
  /**
6
141
  * Backoff strategies for {@link retry} (roadmap §3.1). Delays are in **nanoseconds**.
@@ -155,6 +290,187 @@ declare function withMaxAttempts(strategy: BackoffStrategy, maxAttempts: number)
155
290
  */
156
291
  declare function resolveBackoffPreset(name: BackoffPreset): BackoffStrategy;
157
292
 
293
+ /**
294
+ * {@link reactiveSink} — canonical sink factory for Wave 5 adapters.
295
+ *
296
+ * Every `to*` adapter in {@link ./adapters.ts} can be expressed as a thin
297
+ * config wrapper around this one factory. It centralizes:
298
+ *
299
+ * - **Transport boundary** — the sole place in the sink layer where a raw
300
+ * Promise / `.then` / `.catch` sits (§5.10 boundary documented here).
301
+ * - **Retry** — delegates to {@link BackoffStrategy} from `backoff.ts`.
302
+ * - **Buffering** — `batchSize` / `flushIntervalMs` with tier-3 flush-on-
303
+ * terminal per spec §5.11. Buffered mode activates when `sendBatch` is
304
+ * supplied or a batching knob is set.
305
+ * - **Backpressure** — bounded internal queue with `drop-oldest` /
306
+ * `drop-newest` / `error` strategies. The `"wait"` strategy is deferred
307
+ * to external composition (`source | valve(...) | reactiveSink(...)`).
308
+ * - **Companions** — `sent` / `failed` / `inFlight` / `errors` (+ `buffered`
309
+ * / `paused` when buffering or backpressure is active). These surface
310
+ * every transport outcome as reactive nodes so downstream operators can
311
+ * build retry fallbacks, dead-letter queues, or SLO gauges without
312
+ * touching callback soup.
313
+ */
314
+
315
+ /**
316
+ * Structured transport-failure record. Every sink routes both recoverable
317
+ * (pre-retry) and terminal (post-exhaustion) failures through this shape.
318
+ *
319
+ * @category extra
320
+ */
321
+ type SinkTransportError = {
322
+ /**
323
+ * Failure stage. Known values: `"serialize"`, `"send"`, `"close"`,
324
+ * `"routing_key"`, `"ack"`, `"retry_exhausted"`. Open to extension for
325
+ * protocol-specific stages.
326
+ */
327
+ stage: string;
328
+ /** The error. */
329
+ error: Error;
330
+ /** Unwrapped DATA value (present for per-record failures). */
331
+ value: unknown;
332
+ /** Full message tuple (present for non-DATA stages like `"close"`). */
333
+ message?: Message;
334
+ /** Attempt number when `retry` is active — `1` = initial send. */
335
+ attempt?: number;
336
+ };
337
+ /**
338
+ * Terminal failure record delivered on the `failed` companion after retries
339
+ * are exhausted (or `shouldRetry` returned `false`).
340
+ *
341
+ * @category extra
342
+ */
343
+ type SinkFailure<T> = {
344
+ value: T;
345
+ error: Error;
346
+ /** Total attempts made, including the initial send. */
347
+ attempts: number;
348
+ };
349
+ /**
350
+ * Handle returned by every Wave 5 sink.
351
+ *
352
+ * @category extra
353
+ */
354
+ type ReactiveSinkHandle<T> = {
355
+ /** Unsubscribe from source, cancel timers, fire `TEARDOWN` on companions. */
356
+ dispose(): void;
357
+ /** Drain buffer + await in-flight sends (buffered mode only). */
358
+ flush?(): Promise<void>;
359
+ /** DATA values that successfully reached the transport. */
360
+ sent: Node<T>;
361
+ /** Values that permanently failed (after any retries). */
362
+ failed: Node<SinkFailure<T> | null>;
363
+ /** Number of pending transport operations. */
364
+ inFlight: Node<number>;
365
+ /** Every transient transport error (pre-retry). Latest-only. */
366
+ errors: Node<SinkTransportError | null>;
367
+ /** Items currently buffered (buffered mode / backpressure only). */
368
+ buffered?: Node<number>;
369
+ /** `true` when a backpressure strategy has dropped / rejected items. */
370
+ paused?: Node<boolean>;
371
+ };
372
+ /**
373
+ * Retry configuration for {@link reactiveSink}.
374
+ *
375
+ * @category extra
376
+ */
377
+ type ReactiveSinkRetryOptions = {
378
+ /** Total attempts including the initial send. Default: `1` (no retry). */
379
+ maxAttempts?: number;
380
+ /** Backoff strategy (ns) or preset name. Default: `"exponential"` when `maxAttempts > 1`. */
381
+ backoff?: BackoffStrategy | BackoffPreset;
382
+ /** Predicate — return `false` to short-circuit retry for a given error. */
383
+ shouldRetry?: (err: Error, attempt: number) => boolean;
384
+ };
385
+ /**
386
+ * Backpressure configuration for {@link reactiveSink}. When omitted, the
387
+ * sink has no internal buffer cap beyond the natural `batchSize` /
388
+ * `flushIntervalMs` limits.
389
+ *
390
+ * @category extra
391
+ */
392
+ type ReactiveSinkBackpressureOptions = {
393
+ /** Hard cap on buffered items; further items trigger `strategy`. Default: `Infinity`. */
394
+ maxBuffer?: number;
395
+ /** Policy when the buffer is full. Default: `"drop-oldest"`. */
396
+ strategy?: "drop-oldest" | "drop-newest" | "error";
397
+ };
398
+ /**
399
+ * Base options shared by every sink built on {@link reactiveSink}.
400
+ *
401
+ * @category extra
402
+ */
403
+ type ReactiveSinkOptions<T> = {
404
+ /** Optional name used for companion node naming. */
405
+ name?: string;
406
+ /** Invoked synchronously for every transient transport error. */
407
+ onTransportError?: (err: SinkTransportError) => void;
408
+ /** Retry configuration. */
409
+ retry?: ReactiveSinkRetryOptions;
410
+ /** Backpressure configuration. */
411
+ backpressure?: ReactiveSinkBackpressureOptions;
412
+ /** Batch size before auto-flush (buffered mode). */
413
+ batchSize?: number;
414
+ /** Flush interval in ms; `0` = write-through (buffered mode). */
415
+ flushIntervalMs?: number;
416
+ /** Optional transform applied before `send` / `sendBatch`. */
417
+ serialize?: (value: T) => unknown;
418
+ /**
419
+ * Reactive stop signal — when this node emits any DATA or terminal, the
420
+ * sink tears down. Gives callers a reactive alternative to the imperative
421
+ * `handle.dispose()` call so teardown can be wired through the graph.
422
+ */
423
+ stopOn?: Node<unknown>;
424
+ /**
425
+ * Optional hook invoked for each upstream non-DATA message (COMPLETE /
426
+ * ERROR / etc.) observed by the sink. Used by adapters like
427
+ * {@link toWebSocket} to close the underlying resource when the source
428
+ * terminates, without the caller having to subscribe twice.
429
+ */
430
+ onUpstreamMessage?: (msg: Message) => void;
431
+ /**
432
+ * Invoked once during `dispose()` after the sink's own cleanup (unsub,
433
+ * final drain, TEARDOWN on companions). Adapters wrap external resources
434
+ * (socket listeners, file handles) by passing their cleanup here —
435
+ * avoids hand-rolling a wrapper around `handle.dispose`.
436
+ */
437
+ onDispose?: () => void;
438
+ /**
439
+ * Ignored — reserved for future parity with `source.pipe(...)` style.
440
+ *
441
+ * @internal
442
+ */
443
+ _reserved?: never;
444
+ };
445
+ /**
446
+ * Full config accepted by {@link reactiveSink}. One of `send` / `sendBatch`
447
+ * is required.
448
+ *
449
+ * @category extra
450
+ */
451
+ type ReactiveSinkConfig<T, Ctx = unknown> = ReactiveSinkOptions<T> & {
452
+ /** Per-record transport call. */
453
+ send?: (value: T, ctx: Ctx) => Promise<void> | void;
454
+ /** Batched transport call. When supplied, buffering activates automatically. */
455
+ sendBatch?: (batch: T[], ctx: Ctx) => Promise<void> | void;
456
+ /** Context object threaded into every `send` / `sendBatch` call. */
457
+ ctx?: Ctx;
458
+ };
459
+ /**
460
+ * Build a reactive sink with retry / buffering / backpressure / observability
461
+ * companions. Every Wave 5 `to*` adapter is a thin config wrapper around
462
+ * this factory.
463
+ *
464
+ * **Modes:**
465
+ * - `send` only, no batching knobs → **per-record write-through**
466
+ * - `send` + `batchSize` or `flushIntervalMs` → **per-record buffered**
467
+ * (buffer drains via repeated `send` calls — one-by-one in order)
468
+ * - `sendBatch` → **batched** (whole chunks handed to the transport)
469
+ *
470
+ * @category extra
471
+ */
472
+ declare function reactiveSink<T, Ctx = unknown>(source: Node<T>, config: ReactiveSinkConfig<T, Ctx>): ReactiveSinkHandle<T>;
473
+
158
474
  type RetryOptions = {
159
475
  /** Max retry attempts after each terminal `ERROR` (not counting the first failure). */
160
476
  count?: number;
@@ -177,7 +493,7 @@ type RetryOptions = {
177
493
  * import { ERROR, NS_PER_SEC, pipe, producer, retry, constant } from "@graphrefly/graphrefly-ts";
178
494
  *
179
495
  * const src = producer(
180
- * (_d, a) => {
496
+ * (a) => {
181
497
  * a.down([[ERROR, new Error("x")]]);
182
498
  * },
183
499
  * { resubscribable: true },
@@ -188,6 +504,45 @@ type RetryOptions = {
188
504
  * @category extra
189
505
  */
190
506
  declare function retry<T>(source: Node<T>, opts?: RetryOptions): Node<T>;
507
+ /**
508
+ * Options for {@link retrySource}. Superset of {@link RetryOptions} with an
509
+ * optional `initial` forwarded to the outer node cache.
510
+ *
511
+ * @category extra
512
+ */
513
+ type RetrySourceOptions<T> = RetryOptions & {
514
+ /** Initial cache value for the outer node (forwarded to `NodeOptions.initial`). */
515
+ initial?: T;
516
+ };
517
+ /**
518
+ * Fresh-instance variant of {@link retry}: invokes the `factory` to build a
519
+ * new `Node<T>` on every connect / reconnect. Unlike {@link retry}, which
520
+ * re-subscribes to the same node (requiring `resubscribable: true`), this
521
+ * creates a new source per attempt — ideal for producers that capture
522
+ * per-attempt resources (sockets, clients, file handles) that become unusable
523
+ * after an error.
524
+ *
525
+ * Synchronous exceptions thrown by `factory` are treated as terminal ERROR
526
+ * and run through the same retry pipeline as inner-node ERROR.
527
+ *
528
+ * @param factory - Called to build a fresh source per attempt.
529
+ * @param opts - `count` caps attempts; `backoff` supplies delay (ns) or preset.
530
+ * @returns Node that retries by rebuilding the source.
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * import { NS_PER_SEC, exponential, retrySource, fromWebSocket } from "@graphrefly/graphrefly-ts";
535
+ *
536
+ * // Each reconnect opens a fresh WebSocket:
537
+ * const connected$ = retrySource(
538
+ * () => fromWebSocket(new WebSocket("wss://example/stream")),
539
+ * { count: 10, backoff: exponential({ baseNs: 1 * NS_PER_SEC }) },
540
+ * );
541
+ * ```
542
+ *
543
+ * @category extra
544
+ */
545
+ declare function retrySource<T>(factory: () => Node<T>, opts?: RetrySourceOptions<T>): Node<T>;
191
546
  type CircuitState = "closed" | "open" | "half-open";
192
547
  /**
193
548
  * Thrown when {@link withBreaker} is configured with `onOpen: "error"` and the breaker rejects work.
@@ -302,48 +657,52 @@ interface TokenBucket {
302
657
  * @category extra
303
658
  */
304
659
  declare function tokenBucket(capacity: number, refillPerSecond: number): TokenBucket;
660
+ type RateLimiterOverflowPolicy = "drop-oldest" | "drop-newest" | "error";
661
+ type RateLimiterOptions = {
662
+ /** Maximum `DATA` emissions per window (must be > 0). */
663
+ maxEvents: number;
664
+ /** Window length in nanoseconds (must be > 0). */
665
+ windowNs: number;
666
+ /** Cap on items queued while waiting for token refill (must be >= 1). Unbounded if omitted. */
667
+ maxBuffer?: number;
668
+ /** Overflow policy when `maxBuffer` is exceeded. Default: `"drop-newest"`. */
669
+ onOverflow?: RateLimiterOverflowPolicy;
670
+ };
305
671
  /**
306
- * Same behavior as {@link tokenBucket}. Exposed for naming parity with graphrefly-py (`token_tracker`).
307
- *
308
- * @param capacity - Maximum tokens (must be positive).
309
- * @param refillPerSecond - Tokens added per elapsed second (non-negative).
310
- * @returns A {@link TokenBucket} instance.
311
- *
312
- * @example
313
- * ```ts
314
- * import { tokenTracker } from "@graphrefly/graphrefly-ts";
315
- *
316
- * const tracker = tokenTracker(100, 10); // 100-token capacity, 10/sec refill
317
- * tracker.tryConsume(5); // true
318
- * ```
672
+ * Thrown by {@link rateLimiter} when `onOverflow: "error"` and the pending buffer is full.
319
673
  *
320
674
  * @category extra
321
675
  */
322
- declare function tokenTracker(capacity: number, refillPerSecond: number): TokenBucket;
676
+ declare class RateLimiterOverflowError extends Error {
677
+ name: string;
678
+ constructor(maxBuffer: number);
679
+ }
323
680
  /**
324
- * Enforces a sliding window: at most `maxEvents` `DATA` values per `windowNs`.
681
+ * Token-bucket rate limiter: at most `maxEvents` `DATA` values per `windowNs`.
682
+ *
683
+ * Uses {@link tokenBucket} internally (capacity = `maxEvents`, refill = `maxEvents / windowSeconds`).
684
+ * Excess items are queued FIFO until a token is available. The queue may be bounded via
685
+ * `maxBuffer` with a configurable overflow policy.
325
686
  *
326
687
  * @param source - Upstream node.
327
- * @param maxEvents - Maximum `DATA` emissions per window (must be positive).
328
- * @param windowNs - Window length in nanoseconds (must be positive).
329
- * @returns Node that queues excess values FIFO until a slot frees.
688
+ * @param opts - Rate + optional bounded-buffer configuration.
689
+ * @returns Node that emits DATA at most `maxEvents` per `windowNs`.
330
690
  *
331
691
  * @remarks
332
- * **Terminal:** `COMPLETE` / `ERROR` cancel timers, drop pending queue, and clear window state.
692
+ * **Terminal:** `COMPLETE` / `ERROR` cancel the refill timer, drop the pending queue, and propagate.
333
693
  *
334
694
  * @example
335
695
  * ```ts
336
696
  * import { rateLimiter, state, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
337
697
  *
338
698
  * const src = state(0);
339
- * // Allow at most 5 DATA values per second
340
- * const limited = rateLimiter(src, 5, NS_PER_SEC);
341
- * limited.subscribe((msgs) => console.log(msgs));
699
+ * // Allow at most 5 DATA values per second; queue up to 100 excess items, drop newest beyond.
700
+ * const limited = rateLimiter(src, { maxEvents: 5, windowNs: NS_PER_SEC, maxBuffer: 100 });
342
701
  * ```
343
702
  *
344
703
  * @category extra
345
704
  */
346
- declare function rateLimiter<T>(source: Node<T>, maxEvents: number, windowNs: number): Node<T>;
705
+ declare function rateLimiter<T>(source: Node<T>, opts: RateLimiterOptions): Node<T>;
347
706
  type StatusValue = "pending" | "active" | "completed" | "errored";
348
707
  type WithStatusBundle<T> = {
349
708
  node: Node<T>;
@@ -385,17 +744,27 @@ declare class TimeoutError extends Error {
385
744
  name: string;
386
745
  constructor(ns: number);
387
746
  }
747
+ /** Inputs accepted by {@link fallback}. */
748
+ type FallbackInput<T> = T | Node<T> | PromiseLike<T> | AsyncIterable<T>;
388
749
  /**
389
- * On upstream terminal `ERROR`, emit a fallback value instead of propagating the error.
750
+ * On upstream terminal `ERROR`, switch to a fallback source instead of propagating the error.
751
+ *
752
+ * Accepts any of:
753
+ * - **scalar value** — emits `[[DATA, fb], [COMPLETE]]`
754
+ * - **`Node<T>`** — subscribes and forwards all messages (push-on-subscribe delivers current cache)
755
+ * - **`Promise<T>` / thenable** — resolves into a one-shot `DATA` then `COMPLETE` (via {@link fromAny})
756
+ * - **`AsyncIterable<T>`** — streams each yielded value as `DATA`, then `COMPLETE` (via {@link fromAny})
390
757
  *
391
- * If `fb` is a plain value, emits `[[DATA, fb], [COMPLETE]]` on error.
392
- * If `fb` is a `Node`, switches to that node's stream on error (all further messages
393
- * from the fallback node are forwarded).
758
+ * Non-`Node` inputs are routed through {@link fromAny} so the fallback participates in the
759
+ * reactive protocol uniformly. Bare strings, arrays, and other synchronous scalars are treated
760
+ * as single values (NOT split into characters / elements) to avoid the `fromAny`-on-string
761
+ * iteration gotcha.
394
762
  *
395
- * Composes naturally with {@link retry}: `pipe(source, retry({count:3}), fallback("default"))`.
763
+ * Composes naturally with {@link retry}:
764
+ * `pipe(source, retry({count:3}), fallback("default"))`.
396
765
  *
397
766
  * @param source - Upstream node.
398
- * @param fb - Fallback value or fallback node to switch to on error.
767
+ * @param fb - Fallback value, node, promise, or async iterable.
399
768
  * @returns Node that replaces errors with the fallback.
400
769
  *
401
770
  * @example
@@ -403,12 +772,12 @@ declare class TimeoutError extends Error {
403
772
  * import { fallback, throwError } from "@graphrefly/graphrefly-ts";
404
773
  *
405
774
  * const safe = fallback(throwError(new Error("boom")), "default");
406
- * safe.get(); // "default" after subscribe
775
+ * safe.cache; // "default" after subscribe
407
776
  * ```
408
777
  *
409
778
  * @category extra
410
779
  */
411
- declare function fallback<T>(source: Node<T>, fb: T | Node<T>): Node<T>;
780
+ declare function fallback<T>(source: Node<T>, fb: FallbackInput<T>): Node<T>;
412
781
  /**
413
782
  * Emits `ERROR` with {@link TimeoutError} if no `DATA` arrives within the deadline.
414
783
  *
@@ -430,29 +799,6 @@ declare function fallback<T>(source: Node<T>, fb: T | Node<T>): Node<T>;
430
799
  * @category extra
431
800
  */
432
801
  declare function timeout<T>(source: Node<T>, timeoutNs: number): Node<T>;
433
- /**
434
- * Memoize the last `DATA` value with a TTL. On resubscription (or new subscriber),
435
- * if a cached value exists within `ttlNs`, emit it immediately then forward live
436
- * upstream messages.
437
- *
438
- * Stale-while-revalidate pattern: subscribers always get the cached value first
439
- * (if within TTL), then see live updates as they arrive.
440
- *
441
- * @param source - Upstream node.
442
- * @param ttlNs - Time-to-live in nanoseconds.
443
- * @returns Node with TTL-based caching.
444
- *
445
- * @example
446
- * ```ts
447
- * import { cache, state, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
448
- *
449
- * const src = state(42);
450
- * const c = cache(src, 10 * NS_PER_SEC);
451
- * ```
452
- *
453
- * @category extra
454
- */
455
- declare function cache<T>(source: Node<T>, ttlNs: number): Node<T>;
456
802
 
457
803
  /**
458
804
  * Core reactive sources, sinks, and utilities (roadmap §2.3).
@@ -464,7 +810,7 @@ declare function cache<T>(source: Node<T>, ttlNs: number): Node<T>;
464
810
  * live in {@link ./adapters.ts}.
465
811
  */
466
812
 
467
- type ExtraOpts$2 = Omit<NodeOptions, "describeKind">;
813
+ type ExtraOpts$2 = Omit<NodeOptions<unknown>, "describeKind">;
468
814
  /** Options for {@link fromTimer} / {@link fromPromise} / {@link fromAsyncIter}. */
469
815
  type AsyncSourceOpts = ExtraOpts$2 & {
470
816
  signal?: AbortSignal;
@@ -747,7 +1093,7 @@ declare function forEach<T>(source: Node<T>, fn: (value: T) => void, opts?: Extr
747
1093
  * Buffers every `DATA`; on upstream `COMPLETE` emits one `DATA` with the full array then `COMPLETE`.
748
1094
  *
749
1095
  * @param source - Upstream node.
750
- * @param opts - Optional node options (operator describe kind).
1096
+ * @param opts - Optional node options (derived describe kind).
751
1097
  * @returns `Node<T[]>` — single array emission before completion.
752
1098
  *
753
1099
  * @example
@@ -764,7 +1110,7 @@ declare function toArray<T>(source: Node<T>, opts?: ExtraOpts$2): Node<T[]>;
764
1110
  * Multicasts upstream: one subscription to `source` while this wrapper has subscribers (via {@link producer}).
765
1111
  *
766
1112
  * @param source - Upstream node to share.
767
- * @param opts - Producer options; `initial` seeds from `source.get()` when set by factory.
1113
+ * @param opts - Producer options; `initial` seeds from `source.cache` when set by factory.
768
1114
  * @returns `Node<T>` — hot ref-counted bridge.
769
1115
  *
770
1116
  * @example
@@ -818,7 +1164,7 @@ declare function cached<T>(source: Node<T>, opts?: ExtraOpts$2): Node<T>;
818
1164
  *
819
1165
  * **Important:** This subscribes and waits for a **future** emission. Data that
820
1166
  * has already flowed is gone and will not be seen. Call this *before* the upstream
821
- * emits, or use `source.get()` / `source.status` for already-cached state.
1167
+ * emits, or use `source.cache` / `source.status` for already-cached state.
822
1168
  * See COMPOSITION-GUIDE §2 (subscription ordering).
823
1169
  *
824
1170
  * @param source - Node to read once.
@@ -843,7 +1189,7 @@ declare function firstValueFrom<T>(source: Node<T>): Promise<T>;
843
1189
  *
844
1190
  * **Important:** This only captures **future** emissions — data that has
845
1191
  * already flowed through the node is gone. Call this *before* the upstream
846
- * emits. For already-cached values, use `source.get()` / `source.status`.
1192
+ * emits. For already-cached values, use `source.cache` / `source.status`.
847
1193
  * See COMPOSITION-GUIDE §2 (subscription ordering).
848
1194
  *
849
1195
  * ```ts
@@ -876,7 +1222,7 @@ declare const shareReplay: typeof replay;
876
1222
  *
877
1223
  * Derived/effect nodes are lazy — they don't compute until at least one
878
1224
  * subscriber exists (COMPOSITION-GUIDE §5). `keepalive` subscribes with an
879
- * empty sink so the node stays wired for `.get()` and upstream propagation.
1225
+ * empty sink so the node stays wired for `.cache` and upstream propagation.
880
1226
  *
881
1227
  * Returns the unsubscribe handle. Common usage:
882
1228
  * `graph.addDisposer(keepalive(node))`.
@@ -929,12 +1275,6 @@ declare function reactiveCounter(cap: number): ReactiveCounterBundle;
929
1275
  * fromRabbitMQ/toRabbitMQ.
930
1276
  */
931
1277
 
932
- /** Structured callback for sink transport failures (Kafka, Redis, etc.). */
933
- type SinkTransportError = {
934
- stage: "serialize" | "send" | "routing_key";
935
- error: Error;
936
- value: unknown;
937
- };
938
1278
  /** Handle returned by per-record and buffered sinks. */
939
1279
  type SinkHandle = {
940
1280
  /** Stop the sink (unsubscribe from source). */
@@ -972,15 +1312,8 @@ declare function fromWebSocket<T = unknown>(register: WebSocketRegister<T>, opts
972
1312
  parse?: (payload: unknown, event: unknown) => T;
973
1313
  closeOnTeardown?: boolean;
974
1314
  }): Node<T>;
975
- /** Registration callback for {@link fromWebhook}. */
976
- type WebhookRegister<T> = (handlers: {
977
- /** Push one webhook payload downstream as `[[DATA, payload]]`. */
978
- emit: (payload: T) => void;
979
- /** Push terminal error as `[[ERROR, err]]`. */
980
- error: (err: unknown) => void;
981
- /** Push terminal completion as `[[COMPLETE]]`. */
982
- complete: () => void;
983
- }) => (() => void) | undefined;
1315
+ /** Registration callback for {@link fromWebhook}. Alias of {@link ExternalRegister} over {@link EmitTriad}. */
1316
+ type WebhookRegister<T> = ExternalRegister<EmitTriad<T>>;
984
1317
  /**
985
1318
  * Bridges HTTP webhook callbacks into a GraphReFly source.
986
1319
  *
@@ -1058,6 +1391,19 @@ interface FromHTTPOptions extends AsyncSourceOpts {
1058
1391
  transform?: (response: Response) => any | Promise<any>;
1059
1392
  /** Request timeout in **nanoseconds**. Default: `30s` (30 * NS_PER_SEC). */
1060
1393
  timeoutNs?: number;
1394
+ /**
1395
+ * When `true`, emit `COMPLETE` after the first successful fetch. Useful for
1396
+ * one-shot semantics where downstream wants to know "no more values ever."
1397
+ * Default: `false` — the node stays live and replays cached DATA to late
1398
+ * subscribers via push-on-subscribe (spec §2.2).
1399
+ */
1400
+ completeAfterFetch?: boolean;
1401
+ /**
1402
+ * When `true`, trigger a fresh fetch on each new subscriber instead of
1403
+ * sharing one cached result. Default: `false` — one shared fetch whose
1404
+ * result is cached and replayed to every subscriber.
1405
+ */
1406
+ refetchOnSubscribe?: boolean;
1061
1407
  }
1062
1408
  /**
1063
1409
  * Result of {@link fromHTTP}: main source plus status, error, and fetch count companions.
@@ -1069,6 +1415,14 @@ type HTTPBundle<T> = WithStatusBundle<T> & {
1069
1415
  fetchCount: Node<number>;
1070
1416
  /** Nanosecond wall-clock timestamp of the last successful fetch. */
1071
1417
  lastUpdated: Node<number>;
1418
+ /**
1419
+ * `true` after at least one successful fetch; stays `true` across
1420
+ * resubscribes. Orthogonal to {@link withStatus}'s `active`/`completed`
1421
+ * lifecycle — use this as the "fetch done" signal under the default
1422
+ * (cached, stays-live) behavior where `withStatus` never transitions to
1423
+ * `"completed"` unless `completeAfterFetch: true` is set.
1424
+ */
1425
+ fetched: Node<boolean>;
1072
1426
  };
1073
1427
  /**
1074
1428
  * Creates a one-shot fetch-based HTTP source with lifecycle tracking.
@@ -1076,6 +1430,46 @@ type HTTPBundle<T> = WithStatusBundle<T> & {
1076
1430
  * @category extra
1077
1431
  */
1078
1432
  declare function fromHTTP<T = any>(url: string, opts?: FromHTTPOptions): HTTPBundle<T>;
1433
+ /** Options for {@link toHTTP}. */
1434
+ type ToHTTPOptions<T> = ExtraOpts$1 & {
1435
+ /** HTTP method. Default: `"POST"`. */
1436
+ method?: string;
1437
+ /** Request headers applied to every call. Caller sets Content-Type. */
1438
+ headers?: Record<string, string>;
1439
+ /** Serialize a value to a request body. Default: `JSON.stringify`. */
1440
+ serialize?: (value: T) => string | Uint8Array;
1441
+ /** Optional request timeout in nanoseconds. */
1442
+ timeoutNs?: number;
1443
+ /**
1444
+ * Format used when `batchSize` / `flushIntervalMs` is set:
1445
+ * - `"json-array"` — body is `JSON.stringify(batch)`
1446
+ * - `"ndjson"` — body is newline-delimited JSON.
1447
+ * Default: `"json-array"`.
1448
+ */
1449
+ batchFormat?: "json-array" | "ndjson";
1450
+ /** Batch size before auto-flush (buffered mode). */
1451
+ batchSize?: number;
1452
+ /** Flush interval in ms (buffered mode). */
1453
+ flushIntervalMs?: number;
1454
+ /** Retry configuration — same shape as {@link ReactiveSinkRetryOptions}. */
1455
+ retry?: Parameters<typeof reactiveSink<T>>[1]["retry"];
1456
+ onTransportError?: (err: SinkTransportError) => void;
1457
+ };
1458
+ /**
1459
+ * HTTP sink — forwards upstream `DATA` values as HTTP requests.
1460
+ *
1461
+ * Per-record mode (default, no batching knobs): one request per DATA.
1462
+ * Buffered mode (`batchSize` / `flushIntervalMs`): one request per chunk,
1463
+ * body is JSON-array or NDJSON depending on `batchFormat`.
1464
+ *
1465
+ * @param source - Upstream node.
1466
+ * @param url - Request URL.
1467
+ * @param opts - Serialization, batching, retry options.
1468
+ * @returns {@link ReactiveSinkHandle}.
1469
+ *
1470
+ * @category extra
1471
+ */
1472
+ declare function toHTTP<T>(source: Node<T>, url: string, opts?: ToHTTPOptions<T>): ReactiveSinkHandle<T>;
1079
1473
  /** Options for {@link toSSE}. */
1080
1474
  type ToSSEOptions = {
1081
1475
  /** Custom payload serializer for non-string payloads. Default: `JSON.stringify` fallback to `String(value)`. */
@@ -1103,6 +1497,83 @@ type ToSSEOptions = {
1103
1497
  * @category extra
1104
1498
  */
1105
1499
  declare function toSSE<T>(source: Node<T>, opts?: ToSSEOptions): ReadableStream<Uint8Array>;
1500
+ /**
1501
+ * Composable variant of {@link toSSE} — emits encoded SSE frames as
1502
+ * `Uint8Array` through a reactive `Node`. Use this when you want to pipe SSE
1503
+ * bytes through the reactive graph (persist to file, tee to multiple streams,
1504
+ * etc.). Wrap with {@link toReadableStream} to expose a `ReadableStream` for
1505
+ * `new Response(...)` use cases.
1506
+ *
1507
+ * @category extra
1508
+ */
1509
+ declare function toSSEBytes<T>(source: Node<T>, opts?: ToSSEOptions): Node<Uint8Array>;
1510
+ /**
1511
+ * Converts a `Node<Uint8Array>` into a WHATWG `ReadableStream<Uint8Array>`.
1512
+ * Useful for composing with `new Response(...)` / `fetch` bodies.
1513
+ *
1514
+ * @category extra
1515
+ */
1516
+ declare function toReadableStream(bytes: Node<Uint8Array>): ReadableStream<Uint8Array>;
1517
+ /** Parsed Server-Sent Event. */
1518
+ type SSEEvent<T = string> = {
1519
+ event: string;
1520
+ data: T;
1521
+ id?: string;
1522
+ retry?: number;
1523
+ };
1524
+ /** Options for {@link fromSSE}. */
1525
+ type FromSSEOptions<T = string> = ExtraOpts$1 & {
1526
+ /** Parse the raw `data:` payload. Default: identity (string). */
1527
+ parse?: (raw: string) => T;
1528
+ };
1529
+ /**
1530
+ * Parses a Server-Sent Events stream into structured `{event, data, id}` records.
1531
+ *
1532
+ * @param source - SSE byte source (`ReadableStream`, `Response`, or `AsyncIterable<Uint8Array>`).
1533
+ * @param opts - Parse function and node options.
1534
+ * @returns `Node<SSEEvent<T>>` — one `DATA` per SSE event; `COMPLETE` on stream end.
1535
+ *
1536
+ * @category extra
1537
+ */
1538
+ declare function fromSSE<T = string>(source: ReadableStream<Uint8Array> | Response | AsyncIterable<Uint8Array>, opts?: FromSSEOptions<T>): Node<SSEEvent<T>>;
1539
+ /** Options for {@link fromHTTPStream}. */
1540
+ type FromHTTPStreamOptions = ExtraOpts$1 & {
1541
+ method?: string;
1542
+ headers?: Record<string, string>;
1543
+ body?: unknown;
1544
+ signal?: AbortSignal;
1545
+ };
1546
+ /**
1547
+ * Streaming HTTP source — emits each chunk from the response body as a
1548
+ * `Uint8Array` `DATA`. `COMPLETE` when the stream ends; `ERROR` on non-ok
1549
+ * response or fetch failure.
1550
+ *
1551
+ * Useful for ingesting server-push APIs (LLM streaming, SSE endpoints — pair
1552
+ * with {@link fromSSE}, NDJSON endpoints — pair with {@link fromNDJSON}).
1553
+ *
1554
+ * @category extra
1555
+ */
1556
+ declare function fromHTTPStream(url: string, opts?: FromHTTPStreamOptions): Node<Uint8Array>;
1557
+ /** Options for {@link fromHTTPPoll}. */
1558
+ type FromHTTPPollOptions = FromHTTPOptions & {
1559
+ /** Poll interval in milliseconds. Default: `5000`. */
1560
+ intervalMs?: number;
1561
+ };
1562
+ /**
1563
+ * Repeatedly-fetching HTTP source — a reactive composition of
1564
+ * {@link fromTimer} + {@link switchMap} + {@link fromHTTP} that fetches on an
1565
+ * interval and emits the latest response. Previous in-flight fetches are
1566
+ * cancelled when a new tick arrives (switch semantics).
1567
+ *
1568
+ * @example
1569
+ * ```ts
1570
+ * import { fromHTTPPoll } from "@graphrefly/graphrefly-ts";
1571
+ * const health$ = fromHTTPPoll<{ ok: boolean }>("https://example.com/health", { intervalMs: 10_000 });
1572
+ * ```
1573
+ *
1574
+ * @category extra
1575
+ */
1576
+ declare function fromHTTPPoll<T = unknown>(url: string, opts?: FromHTTPPollOptions): Node<T>;
1106
1577
  /** Options for {@link toWebSocket}. */
1107
1578
  type ToWebSocketOptions<T> = {
1108
1579
  /** Serialize DATA payloads before `socket.send(...)`. */
@@ -1115,20 +1586,61 @@ type ToWebSocketOptions<T> = {
1115
1586
  closeCode?: number;
1116
1587
  /** Optional close reason used when close is triggered by terminal tuples. */
1117
1588
  closeReason?: string;
1118
- /** Structured callback for serialize/send/close transport failures. */
1119
- onTransportError?: (event: ToWebSocketTransportError) => void;
1120
- };
1121
- type ToWebSocketTransportError = {
1122
- stage: "serialize" | "send" | "close";
1123
- error: Error;
1124
- message: Message | undefined;
1589
+ /** Structured callback uses the unified {@link SinkTransportError} shape. */
1590
+ onTransportError?: (event: SinkTransportError) => void;
1591
+ /** Retry configuration — passed through to {@link reactiveSink}. */
1592
+ retry?: ReactiveSinkHandle<T> extends infer _ ? Parameters<typeof reactiveSink<T>>[1]["retry"] : never;
1593
+ /** Backpressure configuration passed through to {@link reactiveSink}. */
1594
+ backpressure?: Parameters<typeof reactiveSink<T>>[1]["backpressure"];
1595
+ /** Reactive stop signal — when it emits any DATA / terminal, the sink tears down. */
1596
+ stopOn?: Node<unknown>;
1125
1597
  };
1126
1598
  /**
1127
1599
  * Forwards upstream `DATA` payloads to a WebSocket via `send`.
1128
1600
  *
1601
+ * Returns a {@link ReactiveSinkHandle} — every transport outcome (including
1602
+ * socket `close` events) surfaces on the `errors` / `failed` / `sent` /
1603
+ * `inFlight` companions.
1604
+ *
1129
1605
  * @category extra
1130
1606
  */
1131
- declare function toWebSocket<T>(source: Node<T>, socket: WebSocketLike, opts?: ToWebSocketOptions<T>): () => void;
1607
+ declare function toWebSocket<T>(source: Node<T>, socket: WebSocketLike, opts?: ToWebSocketOptions<T>): ReactiveSinkHandle<T>;
1608
+ /** Options for {@link fromWebSocketReconnect}. */
1609
+ type FromWebSocketReconnectOptions<T> = ExtraOpts$1 & {
1610
+ /** Optional parser applied to incoming messages. */
1611
+ parse?: (payload: unknown, event: unknown) => T;
1612
+ /** Max reconnect attempts. Default: `Infinity` (implied when `backoff` is set). */
1613
+ maxRetries?: number;
1614
+ /** Backoff strategy (ns) or preset name. Default: `"exponential"`. */
1615
+ backoff?: Parameters<typeof retrySource>[1] extends infer O ? O extends {
1616
+ backoff?: infer B;
1617
+ } ? B : never : never;
1618
+ /** Close the socket on teardown. Default: `true`. */
1619
+ closeOnTeardown?: boolean;
1620
+ };
1621
+ /**
1622
+ * Reconnecting WebSocket source — each connection attempt calls `factory` to
1623
+ * obtain a fresh {@link WebSocketLike}; on `close` (treated as terminal
1624
+ * `COMPLETE`), {@link retrySource} rebuilds the inner source and reconnects.
1625
+ *
1626
+ * For transient errors, {@link retrySource} retries with the configured
1627
+ * backoff. On `maxRetries` exhaustion, terminal `ERROR` propagates.
1628
+ *
1629
+ * @param factory - Invoked per reconnect to create a fresh WebSocket.
1630
+ * @param opts - Parse, retry, and close options.
1631
+ *
1632
+ * @example
1633
+ * ```ts
1634
+ * import { fromWebSocketReconnect } from "@graphrefly/graphrefly-ts";
1635
+ * const ws$ = fromWebSocketReconnect(
1636
+ * () => new WebSocket("wss://example/stream"),
1637
+ * { backoff: "exponential", maxRetries: 10 },
1638
+ * );
1639
+ * ```
1640
+ *
1641
+ * @category extra
1642
+ */
1643
+ declare function fromWebSocketReconnect<T = unknown>(factory: () => WebSocketLike, opts?: FromWebSocketReconnectOptions<T>): Node<T>;
1132
1644
  /**
1133
1645
  * Duck-typed MCP (Model Context Protocol) client — only the notification
1134
1646
  * registration surface is required so callers are not coupled to a specific SDK.
@@ -1164,6 +1676,13 @@ type FromGitHookOptions = ExtraOpts$1 & {
1164
1676
  pollMs?: number;
1165
1677
  include?: string[];
1166
1678
  exclude?: string[];
1679
+ /**
1680
+ * Maximum consecutive poll errors before terminating the source. Prevents
1681
+ * error storms when the repository is unavailable (e.g. deleted, corrupt,
1682
+ * permissions lost). Default: `1` (terminate on first error — preserves pre-switchMap back-compat). Raise it (or set `Infinity`) to keep retrying
1683
+ * indefinitely (legacy behavior).
1684
+ */
1685
+ maxConsecutiveErrors?: number;
1167
1686
  };
1168
1687
  /**
1169
1688
  * Git change detection as a reactive source.
@@ -1171,11 +1690,58 @@ type FromGitHookOptions = ExtraOpts$1 & {
1171
1690
  * @category extra
1172
1691
  */
1173
1692
  declare function fromGitHook(repoPath: string, opts?: FromGitHookOptions): Node<GitEvent>;
1174
- /** Standard handler triple for adapters that accept injected registrations. */
1175
- type AdapterHandlers<T> = {
1176
- emit: (payload: T) => void;
1177
- error: (err: unknown) => void;
1178
- complete: () => void;
1693
+ /** Standard handler triple for adapters that accept injected registrations. Alias of {@link EmitTriad}. */
1694
+ type AdapterHandlers<T> = EmitTriad<T>;
1695
+ /**
1696
+ * Message envelope emitted by queue consumers when `autoAck: false`. The
1697
+ * caller is responsible for calling `ack()` after successful processing or
1698
+ * `nack()` to re-queue / dead-letter. Pairs cleanly with reactive pipelines:
1699
+ *
1700
+ * ```ts
1701
+ * const messages$ = fromPulsar(consumer, { autoAck: false });
1702
+ * effect([messages$], ([m]) => {
1703
+ * try {
1704
+ * process(m.value);
1705
+ * m.ack();
1706
+ * } catch (err) {
1707
+ * m.nack({ requeue: true });
1708
+ * }
1709
+ * });
1710
+ * ```
1711
+ *
1712
+ * Ack/nack are imperative callbacks (§5.10 boundary) because the underlying
1713
+ * SDKs expose them as such. Reactive-all-the-way ack flows can be built by
1714
+ * piping `msg.ack` calls into a `reactiveSink` if desired.
1715
+ *
1716
+ * **Caller contract — must settle every emitted message.** The envelope holds
1717
+ * a closure reference to the raw SDK message; unsettled envelopes keep the
1718
+ * broker's in-flight window full and leak memory proportional to consumer
1719
+ * throughput. Patterns that drop messages (filter, take-first, switchMap
1720
+ * discard) must explicitly `nack({ requeue: true })` the discarded ones, or
1721
+ * wrap the source to force-settle on teardown.
1722
+ *
1723
+ * **Ack/nack transport failures.** Both methods route exceptions through
1724
+ * the source's `onAckError` option (when provided) — SDK rejections from
1725
+ * `acknowledge()`/`negativeAcknowledge()` don't escape as unhandled
1726
+ * rejections. Default (no `onAckError`): swallow. The broker handles
1727
+ * redelivery on its own timeline.
1728
+ *
1729
+ * @category extra
1730
+ */
1731
+ type AckableMessage<T> = {
1732
+ /** The wrapped message body. */
1733
+ value: T;
1734
+ /** Acknowledge successful processing. Safe to call more than once — idempotent. */
1735
+ ack(): void;
1736
+ /**
1737
+ * Negative-acknowledge — signals the broker the message was not processed
1738
+ * successfully. `requeue: true` asks the broker to redeliver; `requeue: false`
1739
+ * may route to a dead-letter queue (SDK-specific). Omit `requeue` to
1740
+ * defer to the SDK's own default.
1741
+ */
1742
+ nack(opts?: {
1743
+ requeue?: boolean;
1744
+ }): void;
1179
1745
  };
1180
1746
  /** Structured OTel span. */
1181
1747
  type OTelSpan = {
@@ -1227,6 +1793,8 @@ type OTelBundle = {
1227
1793
  traces: Node<OTelSpan>;
1228
1794
  metrics: Node<OTelMetric>;
1229
1795
  logs: Node<OTelLog>;
1796
+ /** Unconditional teardown — calls the registrar's cleanup and fires COMPLETE on every channel. */
1797
+ dispose(): void;
1230
1798
  };
1231
1799
  /**
1232
1800
  * OTLP/HTTP receiver — accepts traces, metrics, and logs as separate reactive nodes.
@@ -1270,8 +1838,8 @@ type SyslogMessage = {
1270
1838
  message: string;
1271
1839
  timestampNs: number;
1272
1840
  };
1273
- /** Registration callback for syslog receiver. */
1274
- type SyslogRegister = (handlers: AdapterHandlers<SyslogMessage>) => (() => void) | undefined;
1841
+ /** Registration callback for syslog receiver. Alias of {@link ExternalRegister} over {@link EmitTriad}. */
1842
+ type SyslogRegister = ExternalRegister<EmitTriad<SyslogMessage>>;
1275
1843
  /** Options for {@link fromSyslog}. */
1276
1844
  type FromSyslogOptions = ExtraOpts$1 & {};
1277
1845
  /**
@@ -1320,8 +1888,8 @@ type StatsDMetric = {
1320
1888
  tags: Record<string, string>;
1321
1889
  timestampNs: number;
1322
1890
  };
1323
- /** Registration callback for StatsD receiver. */
1324
- type StatsDRegister = (handlers: AdapterHandlers<StatsDMetric>) => (() => void) | undefined;
1891
+ /** Registration callback for StatsD receiver. Alias of {@link ExternalRegister} over {@link EmitTriad}. */
1892
+ type StatsDRegister = ExternalRegister<EmitTriad<StatsDMetric>>;
1325
1893
  /** Options for {@link fromStatsD}. */
1326
1894
  type FromStatsDOptions = ExtraOpts$1 & {};
1327
1895
  /**
@@ -1383,6 +1951,12 @@ type FromPrometheusOptions = AsyncSourceOpts & {
1383
1951
  headers?: Record<string, string>;
1384
1952
  /** Request timeout in nanoseconds. Default `10 * NS_PER_SEC` (10s). */
1385
1953
  timeoutNs?: number;
1954
+ /**
1955
+ * Maximum consecutive scrape errors before terminating the source. Prevents
1956
+ * error storms when the endpoint is down. Default: `1` (terminate on first error — preserves pre-switchMap back-compat). Raise it (or set `Infinity`)
1957
+ * to keep retrying indefinitely.
1958
+ */
1959
+ maxConsecutiveErrors?: number;
1386
1960
  };
1387
1961
  /**
1388
1962
  * Scrapes a Prometheus `/metrics` endpoint on a reactive timer interval.
@@ -1507,7 +2081,7 @@ type ToKafkaOptions<T> = ExtraOpts$1 & {
1507
2081
  *
1508
2082
  * @category extra
1509
2083
  */
1510
- declare function toKafka<T>(source: Node<T>, kafkaProducer: KafkaProducerLike, topic: string, opts?: ToKafkaOptions<T>): SinkHandle;
2084
+ declare function toKafka<T>(source: Node<T>, kafkaProducer: KafkaProducerLike, topic: string, opts?: ToKafkaOptions<T>): ReactiveSinkHandle<T>;
1511
2085
  /** Duck-typed Redis client (compatible with ioredis, redis). */
1512
2086
  type RedisClientLike = {
1513
2087
  xadd(key: string, id: string, ...fieldsAndValues: string[]): Promise<string>;
@@ -1573,7 +2147,7 @@ type ToRedisStreamOptions<T> = ExtraOpts$1 & {
1573
2147
  *
1574
2148
  * @category extra
1575
2149
  */
1576
- declare function toRedisStream<T>(source: Node<T>, client: RedisClientLike, key: string, opts?: ToRedisStreamOptions<T>): SinkHandle;
2150
+ declare function toRedisStream<T>(source: Node<T>, client: RedisClientLike, key: string, opts?: ToRedisStreamOptions<T>): ReactiveSinkHandle<T>;
1577
2151
  /** Parsed CSV row. */
1578
2152
  type CSVRow = Record<string, string>;
1579
2153
  /** Options for {@link fromCSV}. */
@@ -1608,6 +2182,33 @@ type FromCSVOptions = ExtraOpts$1 & {
1608
2182
  * @category extra
1609
2183
  */
1610
2184
  declare function fromCSV(source: AsyncIterable<string>, opts?: FromCSVOptions): Node<CSVRow>;
2185
+ /**
2186
+ * Stateful CSV parser operator — takes a `Node<string>` emitting raw text
2187
+ * chunks (from any source: {@link fromAsyncIter}, {@link fromHTTPStream},
2188
+ * WebSocket, file watcher, etc.) and emits one `DATA` per parsed row.
2189
+ *
2190
+ * Buffers incomplete lines across chunks. Mirrors {@link fromCSV}'s parsing
2191
+ * logic without committing to an async-iterable-only input.
2192
+ *
2193
+ * @example
2194
+ * ```ts
2195
+ * import { fromHTTPStream, csvRows } from "@graphrefly/graphrefly-ts";
2196
+ * const bytes$ = fromHTTPStream("https://example.com/data.csv");
2197
+ * const text$ = decodeText(bytes$); // caller-provided byte→string decoder
2198
+ * const rows$ = csvRows(text$, { columns: ["name", "age"] });
2199
+ * ```
2200
+ *
2201
+ * @category extra
2202
+ */
2203
+ declare function csvRows(source: Node<string>, opts?: FromCSVOptions): Node<CSVRow>;
2204
+ /**
2205
+ * Stateful NDJSON parser operator — takes a `Node<string>` of raw text chunks
2206
+ * and emits one `DATA` per parsed JSON object. Buffers partial lines across
2207
+ * chunks.
2208
+ *
2209
+ * @category extra
2210
+ */
2211
+ declare function ndjsonRows<T = unknown>(source: Node<string>, opts?: ExtraOpts$1): Node<T>;
1611
2212
  /** Options for {@link fromNDJSON}. */
1612
2213
  type FromNDJSONOptions = ExtraOpts$1 & {};
1613
2214
  /**
@@ -1648,6 +2249,12 @@ type FromClickHouseWatchOptions = AsyncSourceOpts & {
1648
2249
  intervalNs?: number;
1649
2250
  /** JSON format to request. Default: `"JSONEachRow"`. */
1650
2251
  format?: string;
2252
+ /**
2253
+ * Maximum consecutive query errors before terminating the source. Prevents
2254
+ * error storms when the database is unavailable. Default: `5`. Set to
2255
+ * `Infinity` to keep retrying indefinitely.
2256
+ */
2257
+ maxConsecutiveErrors?: number;
1651
2258
  };
1652
2259
  /**
1653
2260
  * ClickHouse live materialized view as a reactive source.
@@ -1714,6 +2321,13 @@ type FromPulsarOptions = ExtraOpts$1 & {
1714
2321
  deserialize?: (data: Buffer) => unknown;
1715
2322
  /** Acknowledge messages automatically. Default: `true`. */
1716
2323
  autoAck?: boolean;
2324
+ /**
2325
+ * Routes ack/nack transport failures to the caller. Covers:
2326
+ * - `autoAck: true` — post-emit `acknowledge()` promise rejections.
2327
+ * - `autoAck: false` — envelope `ack()` / `nack()` promise rejections.
2328
+ * Default: swallow (SDK handles redelivery on its own).
2329
+ */
2330
+ onAckError?: (err: Error) => void;
1717
2331
  };
1718
2332
  /**
1719
2333
  * Apache Pulsar consumer as a reactive source (native client).
@@ -1742,7 +2356,12 @@ type FromPulsarOptions = ExtraOpts$1 & {
1742
2356
  *
1743
2357
  * @category extra
1744
2358
  */
1745
- declare function fromPulsar<T = unknown>(consumer: PulsarConsumerLike, opts?: FromPulsarOptions): Node<PulsarMessage<T>>;
2359
+ declare function fromPulsar<T = unknown>(consumer: PulsarConsumerLike, opts?: FromPulsarOptions & {
2360
+ autoAck?: true;
2361
+ }): Node<PulsarMessage<T>>;
2362
+ declare function fromPulsar<T = unknown>(consumer: PulsarConsumerLike, opts: FromPulsarOptions & {
2363
+ autoAck: false;
2364
+ }): Node<AckableMessage<PulsarMessage<T>>>;
1746
2365
  /** Options for {@link toPulsar}. */
1747
2366
  type ToPulsarOptions<T> = ExtraOpts$1 & {
1748
2367
  /** Serialize value for Pulsar. Default: `JSON.stringify` → Buffer. */
@@ -1764,7 +2383,7 @@ type ToPulsarOptions<T> = ExtraOpts$1 & {
1764
2383
  *
1765
2384
  * @category extra
1766
2385
  */
1767
- declare function toPulsar<T>(source: Node<T>, pulsarProducer: PulsarProducerLike, opts?: ToPulsarOptions<T>): SinkHandle;
2386
+ declare function toPulsar<T>(source: Node<T>, pulsarProducer: PulsarProducerLike, opts?: ToPulsarOptions<T>): ReactiveSinkHandle<T>;
1768
2387
  /** Duck-typed NATS subscription (compatible with nats.js). */
1769
2388
  type NATSSubscriptionLike = AsyncIterable<{
1770
2389
  subject: string;
@@ -1848,7 +2467,7 @@ type ToNATSOptions<T> = ExtraOpts$1 & {
1848
2467
  *
1849
2468
  * @category extra
1850
2469
  */
1851
- declare function toNATS<T>(source: Node<T>, client: NATSClientLike, subject: string, opts?: ToNATSOptions<T>): SinkHandle;
2470
+ declare function toNATS<T>(source: Node<T>, client: NATSClientLike, subject: string, opts?: ToNATSOptions<T>): ReactiveSinkHandle<T>;
1852
2471
  /** Duck-typed RabbitMQ channel (compatible with amqplib). */
1853
2472
  type RabbitMQChannelLike = {
1854
2473
  consume(queue: string, onMessage: (msg: {
@@ -1887,6 +2506,11 @@ type FromRabbitMQOptions = ExtraOpts$1 & {
1887
2506
  deserialize?: (content: Buffer) => unknown;
1888
2507
  /** Auto-acknowledge messages. Default: `true`. */
1889
2508
  autoAck?: boolean;
2509
+ /**
2510
+ * Routes envelope ack/nack transport failures (including "SDK exposes no
2511
+ * `nack` method") to the caller. Default: swallow.
2512
+ */
2513
+ onAckError?: (err: Error) => void;
1890
2514
  };
1891
2515
  /**
1892
2516
  * RabbitMQ consumer as a reactive source.
@@ -1919,7 +2543,12 @@ type FromRabbitMQOptions = ExtraOpts$1 & {
1919
2543
  *
1920
2544
  * @category extra
1921
2545
  */
1922
- declare function fromRabbitMQ<T = unknown>(channel: RabbitMQChannelLike, queue: string, opts?: FromRabbitMQOptions): Node<RabbitMQMessage<T>>;
2546
+ declare function fromRabbitMQ<T = unknown>(channel: RabbitMQChannelLike, queue: string, opts?: FromRabbitMQOptions & {
2547
+ autoAck?: true;
2548
+ }): Node<RabbitMQMessage<T>>;
2549
+ declare function fromRabbitMQ<T = unknown>(channel: RabbitMQChannelLike, queue: string, opts: FromRabbitMQOptions & {
2550
+ autoAck: false;
2551
+ }): Node<AckableMessage<RabbitMQMessage<T>>>;
1923
2552
  /** Options for {@link toRabbitMQ}. */
1924
2553
  type ToRabbitMQOptions<T> = ExtraOpts$1 & {
1925
2554
  /** Serialize value for RabbitMQ. Default: `Buffer.from(JSON.stringify(value))`. */
@@ -1940,7 +2569,7 @@ type ToRabbitMQOptions<T> = ExtraOpts$1 & {
1940
2569
  *
1941
2570
  * @category extra
1942
2571
  */
1943
- declare function toRabbitMQ<T>(source: Node<T>, channel: RabbitMQChannelLike, exchange: string, opts?: ToRabbitMQOptions<T>): SinkHandle;
2572
+ declare function toRabbitMQ<T>(source: Node<T>, channel: RabbitMQChannelLike, exchange: string, opts?: ToRabbitMQOptions<T>): ReactiveSinkHandle<T>;
1944
2573
  /** Handle returned by buffered sinks. `flush()` drains remaining buffer. */
1945
2574
  type BufferedSinkHandle = SinkHandle & {
1946
2575
  /** Manually drain the internal buffer. */
@@ -1976,7 +2605,7 @@ type ToFileOptions<T> = ExtraOpts$1 & {
1976
2605
  *
1977
2606
  * @category extra
1978
2607
  */
1979
- declare function toFile<T>(source: Node<T>, writer: FileWriterLike, opts?: ToFileOptions<T>): BufferedSinkHandle;
2608
+ declare function toFile<T>(source: Node<T>, writer: FileWriterLike, opts?: ToFileOptions<T>): ReactiveSinkHandle<T>;
1980
2609
  /** Options for {@link toCSV}. */
1981
2610
  type ToCSVOptions<T> = ExtraOpts$1 & {
1982
2611
  /** Column names. Required — determines header row and field order. */
@@ -2003,7 +2632,7 @@ type ToCSVOptions<T> = ExtraOpts$1 & {
2003
2632
  *
2004
2633
  * @category extra
2005
2634
  */
2006
- declare function toCSV<T>(source: Node<T>, writer: FileWriterLike, opts: ToCSVOptions<T>): BufferedSinkHandle;
2635
+ declare function toCSV<T>(source: Node<T>, writer: FileWriterLike, opts: ToCSVOptions<T>): ReactiveSinkHandle<T>;
2007
2636
  /** Duck-typed ClickHouse client for batch inserts. */
2008
2637
  type ClickHouseInsertClientLike = {
2009
2638
  insert(params: {
@@ -2037,7 +2666,7 @@ type ToClickHouseOptions<T> = ExtraOpts$1 & {
2037
2666
  *
2038
2667
  * @category extra
2039
2668
  */
2040
- declare function toClickHouse<T>(source: Node<T>, client: ClickHouseInsertClientLike, table: string, opts?: ToClickHouseOptions<T>): BufferedSinkHandle;
2669
+ declare function toClickHouse<T>(source: Node<T>, client: ClickHouseInsertClientLike, table: string, opts?: ToClickHouseOptions<T>): ReactiveSinkHandle<T>;
2041
2670
  /** Duck-typed S3 client (compatible with AWS SDK v3 `S3Client.send(PutObjectCommand(...))`). */
2042
2671
  type S3ClientLike = {
2043
2672
  putObject(params: {
@@ -2072,7 +2701,7 @@ type ToS3Options<T> = ExtraOpts$1 & {
2072
2701
  *
2073
2702
  * @category extra
2074
2703
  */
2075
- declare function toS3<T>(source: Node<T>, client: S3ClientLike, bucket: string, opts?: ToS3Options<T>): BufferedSinkHandle;
2704
+ declare function toS3<T>(source: Node<T>, client: S3ClientLike, bucket: string, opts?: ToS3Options<T>): ReactiveSinkHandle<T>;
2076
2705
  /** Duck-typed Postgres client (compatible with `pg.Client` / `pg.Pool`). */
2077
2706
  type PostgresClientLike = {
2078
2707
  query(sql: string, params?: unknown[]): Promise<unknown>;
@@ -2097,7 +2726,7 @@ type ToPostgresOptions<T> = ExtraOpts$1 & {
2097
2726
  *
2098
2727
  * @category extra
2099
2728
  */
2100
- declare function toPostgres<T>(source: Node<T>, client: PostgresClientLike, table: string, opts?: ToPostgresOptions<T>): SinkHandle;
2729
+ declare function toPostgres<T>(source: Node<T>, client: PostgresClientLike, table: string, opts?: ToPostgresOptions<T>): ReactiveSinkHandle<T>;
2101
2730
  /** Duck-typed MongoDB collection (compatible with `mongodb` driver). */
2102
2731
  type MongoCollectionLike = {
2103
2732
  insertOne(doc: unknown): Promise<unknown>;
@@ -2118,7 +2747,7 @@ type ToMongoOptions<T> = ExtraOpts$1 & {
2118
2747
  *
2119
2748
  * @category extra
2120
2749
  */
2121
- declare function toMongo<T>(source: Node<T>, collection: MongoCollectionLike, opts?: ToMongoOptions<T>): SinkHandle;
2750
+ declare function toMongo<T>(source: Node<T>, collection: MongoCollectionLike, opts?: ToMongoOptions<T>): ReactiveSinkHandle<T>;
2122
2751
  /** Loki log stream entry. */
2123
2752
  type LokiStream = {
2124
2753
  stream: Record<string, string>;
@@ -2150,7 +2779,7 @@ type ToLokiOptions<T> = ExtraOpts$1 & {
2150
2779
  *
2151
2780
  * @category extra
2152
2781
  */
2153
- declare function toLoki<T>(source: Node<T>, client: LokiClientLike, opts?: ToLokiOptions<T>): SinkHandle;
2782
+ declare function toLoki<T>(source: Node<T>, client: LokiClientLike, opts?: ToLokiOptions<T>): ReactiveSinkHandle<T>;
2154
2783
  /** Duck-typed Tempo span push client (OTLP/HTTP shape). */
2155
2784
  type TempoClientLike = {
2156
2785
  push(payload: {
@@ -2173,19 +2802,32 @@ type ToTempoOptions<T> = ExtraOpts$1 & {
2173
2802
  *
2174
2803
  * @category extra
2175
2804
  */
2176
- declare function toTempo<T>(source: Node<T>, client: TempoClientLike, opts?: ToTempoOptions<T>): SinkHandle;
2805
+ declare function toTempo<T>(source: Node<T>, client: TempoClientLike, opts?: ToTempoOptions<T>): ReactiveSinkHandle<T>;
2177
2806
  /** Options for {@link checkpointToS3}. */
2178
2807
  type CheckpointToS3Options = {
2179
2808
  /** S3 key prefix. Default: `"checkpoints/"`. */
2180
2809
  prefix?: string;
2181
- /** Debounce ms for autoCheckpoint. Default: `500`. */
2810
+ /** Debounce ms on the S3 tier. Default: `500`. */
2182
2811
  debounceMs?: number;
2183
2812
  /** Full snapshot compaction interval. Default: `10`. */
2184
2813
  compactEvery?: number;
2185
2814
  onError?: (error: unknown) => void;
2186
2815
  };
2816
+ type StorageTierLike = {
2817
+ load(key: string): unknown | Promise<unknown>;
2818
+ save(key: string, data: unknown): void | Promise<void>;
2819
+ clear?(key: string): void | Promise<void>;
2820
+ debounceMs?: number;
2821
+ compactEvery?: number;
2822
+ };
2823
+ type AttachStorageGraphLike = {
2824
+ attachStorage: (tiers: readonly StorageTierLike[], opts?: unknown) => {
2825
+ dispose(): void;
2826
+ };
2827
+ name: string;
2828
+ };
2187
2829
  /**
2188
- * Wires `graph.autoCheckpoint()` to persist snapshots to S3.
2830
+ * Wires `graph.attachStorage()` with an S3-backed tier.
2189
2831
  *
2190
2832
  * @param graph - Graph instance to checkpoint.
2191
2833
  * @param client - S3-compatible client with `putObject()`.
@@ -2195,14 +2837,7 @@ type CheckpointToS3Options = {
2195
2837
  *
2196
2838
  * @category extra
2197
2839
  */
2198
- declare function checkpointToS3(graph: {
2199
- autoCheckpoint: (adapter: {
2200
- save(key: string, data: unknown): void;
2201
- }, opts?: unknown) => {
2202
- dispose(): void;
2203
- };
2204
- name: string;
2205
- }, client: S3ClientLike, bucket: string, opts?: CheckpointToS3Options): {
2840
+ declare function checkpointToS3(graph: AttachStorageGraphLike, client: S3ClientLike, bucket: string, opts?: CheckpointToS3Options): {
2206
2841
  dispose(): void;
2207
2842
  };
2208
2843
  /** Duck-typed Redis client for checkpoint storage. */
@@ -2214,14 +2849,14 @@ type RedisCheckpointClientLike = {
2214
2849
  type CheckpointToRedisOptions = {
2215
2850
  /** Key prefix. Default: `"graphrefly:checkpoint:"`. */
2216
2851
  prefix?: string;
2217
- /** Debounce ms for autoCheckpoint. Default: `500`. */
2852
+ /** Debounce ms on the Redis tier. Default: `500`. */
2218
2853
  debounceMs?: number;
2219
2854
  /** Full snapshot compaction interval. Default: `10`. */
2220
2855
  compactEvery?: number;
2221
2856
  onError?: (error: unknown) => void;
2222
2857
  };
2223
2858
  /**
2224
- * Wires `graph.autoCheckpoint()` to persist snapshots to Redis.
2859
+ * Wires `graph.attachStorage()` with a Redis-backed tier.
2225
2860
  *
2226
2861
  * @param graph - Graph instance to checkpoint.
2227
2862
  * @param client - Redis client with `set()`/`get()`.
@@ -2230,14 +2865,7 @@ type CheckpointToRedisOptions = {
2230
2865
  *
2231
2866
  * @category extra
2232
2867
  */
2233
- declare function checkpointToRedis(graph: {
2234
- autoCheckpoint: (adapter: {
2235
- save(key: string, data: unknown): void;
2236
- }, opts?: unknown) => {
2237
- dispose(): void;
2238
- };
2239
- name: string;
2240
- }, client: RedisCheckpointClientLike, opts?: CheckpointToRedisOptions): {
2868
+ declare function checkpointToRedis(graph: AttachStorageGraphLike, client: RedisCheckpointClientLike, opts?: CheckpointToRedisOptions): {
2241
2869
  dispose(): void;
2242
2870
  };
2243
2871
  /**
@@ -2261,14 +2889,16 @@ type FromSqliteOptions<T> = ExtraOpts$1 & {
2261
2889
  /**
2262
2890
  * One-shot SQLite query as a reactive source.
2263
2891
  *
2264
- * Executes `query` synchronously via `db.query()`, emits one `DATA` per result
2265
- * row, then `COMPLETE`. Compose with `switchMap` + `fromTimer` / `fromFSWatch`
2266
- * for periodic or change-driven re-query.
2892
+ * Executes `query` synchronously via `db.query()`, emits **one `DATA` containing
2893
+ * the full result array**, then `COMPLETE`. Downstream flattens with
2894
+ * `mergeAll` / a custom operator if per-row semantics are required — the
2895
+ * array shape is the simpler default and matches how every SQL driver returns
2896
+ * results natively. Use {@link fromSqliteCursor} for streaming row-by-row.
2267
2897
  *
2268
2898
  * @param db - SQLite database (caller owns connection).
2269
2899
  * @param query - SQL string to execute.
2270
2900
  * @param opts - Row mapper, params, and node options.
2271
- * @returns `Node<T>` — one `DATA` per row, then `COMPLETE`.
2901
+ * @returns `Node<T[]>` — one `DATA` with the full row array, then `COMPLETE`.
2272
2902
  *
2273
2903
  * @example
2274
2904
  * ```ts
@@ -2282,7 +2912,25 @@ type FromSqliteOptions<T> = ExtraOpts$1 & {
2282
2912
  *
2283
2913
  * @category extra
2284
2914
  */
2285
- declare function fromSqlite<T = unknown>(db: SqliteDbLike, query: string, opts?: FromSqliteOptions<T>): Node<T>;
2915
+ declare function fromSqlite<T = unknown>(db: SqliteDbLike, query: string, opts?: FromSqliteOptions<T>): Node<T[]>;
2916
+ /**
2917
+ * Duck-typed iterable-capable SQLite database — `iterate(sql, params)` returns
2918
+ * a synchronous iterator over rows, avoiding the "all-rows-in-memory" cost of
2919
+ * `db.query`. Compatible with `better-sqlite3`'s `.prepare().iterate()`.
2920
+ *
2921
+ * @category extra
2922
+ */
2923
+ type SqliteIterableDbLike = {
2924
+ iterate(sql: string, params?: unknown[]): Iterable<unknown>;
2925
+ };
2926
+ /**
2927
+ * Cursor-streaming SQLite query — emits one `DATA` per row from a synchronous
2928
+ * row iterator, then `COMPLETE`. Use when result sets are too large to
2929
+ * materialize fully into an array.
2930
+ *
2931
+ * @category extra
2932
+ */
2933
+ declare function fromSqliteCursor<T = unknown>(db: SqliteIterableDbLike, query: string, opts?: FromSqliteOptions<T>): Node<T>;
2286
2934
  /** Options for {@link toSqlite}. */
2287
2935
  type ToSqliteOptions<T> = ExtraOpts$1 & {
2288
2936
  /** Build SQL + params for an insert. Default: JSON insert into `(data)` column. */
@@ -2329,7 +2977,7 @@ type ToSqliteOptions<T> = ExtraOpts$1 & {
2329
2977
  *
2330
2978
  * @category extra
2331
2979
  */
2332
- declare function toSqlite<T>(source: Node<T>, db: SqliteDbLike, table: string, opts?: ToSqliteOptions<T>): SinkHandle;
2980
+ declare function toSqlite<T>(source: Node<T>, db: SqliteDbLike, table: string, opts?: ToSqliteOptions<T>): ReactiveSinkHandle<T>;
2333
2981
  /**
2334
2982
  * Duck-typed Prisma model delegate.
2335
2983
  *
@@ -2369,7 +3017,7 @@ type FromPrismaOptions<T, U = T> = ExtraOpts$1 & {
2369
3017
  *
2370
3018
  * @category extra
2371
3019
  */
2372
- declare function fromPrisma<T = unknown, U = T>(model: PrismaModelLike<T>, opts?: FromPrismaOptions<T, U>): Node<U>;
3020
+ declare function fromPrisma<T = unknown, U = T>(model: PrismaModelLike<T>, opts?: FromPrismaOptions<T, U>): Node<U[]>;
2373
3021
  /**
2374
3022
  * Duck-typed Drizzle query builder result.
2375
3023
  *
@@ -2406,7 +3054,7 @@ type FromDrizzleOptions<T, U = T> = ExtraOpts$1 & {
2406
3054
  *
2407
3055
  * @category extra
2408
3056
  */
2409
- declare function fromDrizzle<T = unknown, U = T>(query: DrizzleQueryLike<T>, opts?: FromDrizzleOptions<T, U>): Node<U>;
3057
+ declare function fromDrizzle<T = unknown, U = T>(query: DrizzleQueryLike<T>, opts?: FromDrizzleOptions<T, U>): Node<U[]>;
2410
3058
  /**
2411
3059
  * Duck-typed Kysely query builder result.
2412
3060
  *
@@ -2442,7 +3090,7 @@ type FromKyselyOptions<T, U = T> = ExtraOpts$1 & {
2442
3090
  *
2443
3091
  * @category extra
2444
3092
  */
2445
- declare function fromKysely<T = unknown, U = T>(query: KyselyQueryLike<T>, opts?: FromKyselyOptions<T, U>): Node<U>;
3093
+ declare function fromKysely<T = unknown, U = T>(query: KyselyQueryLike<T>, opts?: FromKyselyOptions<T, U>): Node<U[]>;
2446
3094
 
2447
3095
  /**
2448
3096
  * Watermark-based backpressure controller — reactive PAUSE/RESUME flow control.
@@ -2451,292 +3099,60 @@ declare function fromKysely<T = unknown, U = T>(query: KyselyQueryLike<T>, opts?
2451
3099
  * Each controller instance uses a unique lockId so multiple controllers
2452
3100
  * on the same upstream node do not collide.
2453
3101
  *
2454
- * @module
2455
- */
2456
-
2457
- type WatermarkOptions = {
2458
- /** Pending count at which PAUSE is sent upstream. */
2459
- highWaterMark: number;
2460
- /** Pending count at which RESUME is sent upstream (after being paused). */
2461
- lowWaterMark: number;
2462
- };
2463
- type WatermarkController = {
2464
- /** Call when a DATA message is buffered/enqueued. Returns `true` if PAUSE was just sent. */
2465
- onEnqueue(): boolean;
2466
- /** Call when a buffered item is consumed. Returns `true` if RESUME was just sent. */
2467
- onDequeue(): boolean;
2468
- /** Current un-consumed item count. */
2469
- readonly pending: number;
2470
- /** Whether upstream is currently paused by this controller. */
2471
- readonly paused: boolean;
2472
- /** Dispose: if paused, sends RESUME to unblock upstream. */
2473
- dispose(): void;
2474
- };
2475
- /**
2476
- * Creates a watermark-based backpressure controller.
2477
- *
2478
- * @param sendUp - Callback that delivers messages upstream (typically `handle.up`).
2479
- * @param opts - High/low watermark thresholds (item counts).
2480
- * @returns A {@link WatermarkController}.
2481
- *
2482
- * @example
2483
- * ```ts
2484
- * const handle = graph.observe("fast-source");
2485
- * const wm = createWatermarkController(
2486
- * (msgs) => handle.up(msgs),
2487
- * { highWaterMark: 64, lowWaterMark: 16 },
2488
- * );
2489
- *
2490
- * // In sink callback:
2491
- * handle.subscribe((msgs) => {
2492
- * for (const msg of msgs) {
2493
- * if (msg[0] === DATA) {
2494
- * buffer.push(msg[1]);
2495
- * wm.onEnqueue();
2496
- * }
2497
- * }
2498
- * });
2499
- *
2500
- * // When consumer drains:
2501
- * const item = buffer.shift();
2502
- * wm.onDequeue();
2503
- * ```
2504
- *
2505
- * @category extra
2506
- */
2507
- declare function createWatermarkController(sendUp: (messages: Messages) => void, opts: WatermarkOptions): WatermarkController;
2508
-
2509
- /**
2510
- * Checkpoint adapters and {@link Graph} save/restore helpers (roadmap §3.1).
2511
- */
2512
-
2513
- /**
2514
- * Key-value persistence contract (roadmap §3.1 + §3.1c).
2515
- *
2516
- * Each adapter stores opaque JSON-serializable blobs under caller-provided string keys.
2517
- * Used by {@link saveGraphCheckpoint}/{@link restoreGraphCheckpoint} (key = graph name),
2518
- * {@link Graph.autoCheckpoint} (key = graph name), and {@link cascadingCache}/{@link tieredStorage}
2519
- * (key = cache entry key).
2520
- */
2521
- interface CheckpointAdapter {
2522
- save(key: string, data: unknown): void;
2523
- load(key: string): unknown | null;
2524
- clear(key: string): void;
2525
- }
2526
- /**
2527
- * In-memory adapter (process-local; useful for tests).
2528
- *
2529
- * @category extra
2530
- */
2531
- declare class MemoryCheckpointAdapter implements CheckpointAdapter {
2532
- #private;
2533
- save(key: string, data: unknown): void;
2534
- load(key: string): unknown | null;
2535
- clear(key: string): void;
2536
- }
2537
- /**
2538
- * Stores JSON-cloned values under caller keys inside a caller-owned record (tests / embedding).
2539
- *
2540
- * @category extra
2541
- */
2542
- declare class DictCheckpointAdapter implements CheckpointAdapter {
2543
- #private;
2544
- constructor(storage: Record<string, unknown>);
2545
- save(key: string, data: unknown): void;
2546
- load(key: string): unknown | null;
2547
- clear(key: string): void;
2548
- }
2549
- /**
2550
- * Atomic JSON file persistence (one file per key in a directory, temp + rename).
2551
- *
2552
- * @remarks
2553
- * **Key mapping:** keys are sanitized to filesystem-safe names (`[^a-zA-Z0-9_-]` → `_`).
2554
- * **Errors:** `load()` returns `null` for missing files, empty files, or invalid JSON (no throw).
2555
- *
2556
- * @category extra
2557
- */
2558
- declare class FileCheckpointAdapter implements CheckpointAdapter {
2559
- #private;
2560
- constructor(dir: string);
2561
- save(key: string, data: unknown): void;
2562
- load(key: string): unknown | null;
2563
- clear(key: string): void;
2564
- }
2565
- /**
2566
- * Key-value persistence using Node.js `node:sqlite` ({@link DatabaseSync}).
2567
- *
2568
- * @remarks
2569
- * **Runtime:** Requires Node 22.5+ with `node:sqlite` enabled (experimental in some releases). Call `close()` when discarding the adapter.
2570
- *
2571
- * @category extra
2572
- */
2573
- declare class SqliteCheckpointAdapter implements CheckpointAdapter {
2574
- #private;
2575
- constructor(path: string);
2576
- save(key: string, data: unknown): void;
2577
- load(key: string): unknown | null;
2578
- clear(key: string): void;
2579
- /** Close the underlying SQLite connection (safe to call more than once). */
2580
- close(): void;
2581
- }
2582
- /**
2583
- * Writes {@link Graph.snapshot} through `adapter.save` using `graph.name` as key.
2584
- *
2585
- * @param graph - Target graph instance.
2586
- * @param adapter - Sync key-value persistence backend.
2587
- * @returns `void` — side-effect only; the snapshot is written to `adapter`.
2588
- *
2589
- * @example
2590
- * ```ts
2591
- * import { saveGraphCheckpoint, MemoryCheckpointAdapter, Graph } from "@graphrefly/graphrefly-ts";
2592
- *
2593
- * const g = new Graph("app");
2594
- * const adapter = new MemoryCheckpointAdapter();
2595
- * saveGraphCheckpoint(g, adapter);
2596
- * ```
2597
- *
2598
- * @category extra
2599
- */
2600
- declare function saveGraphCheckpoint(graph: Graph, adapter: CheckpointAdapter): void;
2601
- /**
2602
- * Loads a snapshot via `adapter.load(graph.name)` and applies {@link Graph.restore} when data exists.
2603
- *
2604
- * @param graph - Graph whose topology matches the snapshot.
2605
- * @param adapter - Sync key-value persistence backend.
2606
- * @returns `true` if data was present and `restore` ran; `false` if `load()` returned `null`.
2607
- *
2608
- * @example
2609
- * ```ts
2610
- * import {
2611
- * saveGraphCheckpoint,
2612
- * restoreGraphCheckpoint,
2613
- * MemoryCheckpointAdapter,
2614
- * Graph,
2615
- * } from "@graphrefly/graphrefly-ts";
2616
- *
2617
- * const g = new Graph("app");
2618
- * const adapter = new MemoryCheckpointAdapter();
2619
- * saveGraphCheckpoint(g, adapter);
2620
- *
2621
- * const g2 = new Graph("app");
2622
- * restoreGraphCheckpoint(g2, adapter); // true
2623
- * ```
2624
- *
2625
- * @category extra
2626
- */
2627
- declare function restoreGraphCheckpoint(graph: Graph, adapter: CheckpointAdapter): boolean;
2628
- /**
2629
- * Minimal JSON-shaped payload for a single node's cached value (custom adapters).
2630
- *
2631
- * @param n - Any {@link Node}.
2632
- * @returns `{ version: 1, value }` from {@link Node.get}.
2633
- *
2634
- * @example
2635
- * ```ts
2636
- * import { checkpointNodeValue, state } from "@graphrefly/graphrefly-ts";
2637
- *
2638
- * const s = state(42);
2639
- * checkpointNodeValue(s); // { version: 1, value: 42 }
2640
- * ```
2641
- *
2642
- * @category extra
2643
- */
2644
- declare function checkpointNodeValue<T>(n: Node<T>): {
2645
- version: number;
2646
- value: T | undefined;
2647
- };
2648
- type IndexedDbCheckpointSpec = {
2649
- dbName: string;
2650
- storeName: string;
2651
- /** @default "graphrefly_checkpoint" */
2652
- key?: string;
2653
- version?: number;
2654
- };
2655
- /**
2656
- * Wraps an `IDBRequest` as a one-shot reactive source.
2657
- *
2658
- * @param req - Request whose callbacks are converted to protocol messages.
2659
- * @returns `Node<T>` that emits `DATA` once on success, then `COMPLETE`; emits `ERROR` on failure.
2660
- *
2661
- * @example
2662
- * ```ts
2663
- * import { fromIDBRequest } from "@graphrefly/graphrefly-ts";
2664
- *
2665
- * const req = indexedDB.open("myDb", 1);
2666
- * fromIDBRequest(req).subscribe((msgs) => console.log(msgs));
2667
- * // Emits [[DATA, IDBDatabase], [COMPLETE]] on success
2668
- * ```
2669
- *
2670
- * @category extra
2671
- */
2672
- declare function fromIDBRequest<T>(req: IDBRequest<T>): Node<T>;
2673
- /**
2674
- * Wraps an `IDBTransaction` terminal lifecycle as a one-shot reactive source.
2675
- *
2676
- * @param tx - Transaction to observe.
2677
- * @returns `Node<void>` that emits `DATA` (`undefined`) then `COMPLETE` on success; emits `ERROR` on `error`/`abort`.
2678
- *
2679
- * @example
2680
- * ```ts
2681
- * import { fromIDBTransaction } from "@graphrefly/graphrefly-ts";
2682
- *
2683
- * const db: IDBDatabase = ...; // obtained from indexedDB.open
2684
- * const tx = db.transaction("store", "readwrite");
2685
- * fromIDBTransaction(tx).subscribe((msgs) => console.log(msgs));
2686
- * // Emits [[DATA, undefined], [COMPLETE]] when the transaction commits
2687
- * ```
2688
- *
2689
- * @category extra
2690
- */
2691
- declare function fromIDBTransaction(tx: IDBTransaction): Node<void>;
2692
- /**
2693
- * Persists {@link Graph.snapshot} under `spec.key` (browser IndexedDB).
2694
- *
2695
- * @param graph - Graph to snapshot.
2696
- * @param spec - Database name, object store name, optional `key` and schema `version`.
2697
- * @returns A reactive `Node<void>` that emits `DATA` (`undefined`) then `COMPLETE` on success, or `ERROR` on failure.
2698
- *
2699
- * @remarks
2700
- * **Environment:** Emits `ERROR` if `indexedDB` is undefined (e.g. Node without a polyfill).
2701
- *
2702
- * @example
2703
- * ```ts
2704
- * import { saveGraphCheckpointIndexedDb, Graph } from "@graphrefly/graphrefly-ts";
2705
- *
2706
- * const g = new Graph("app");
2707
- * const save$ = saveGraphCheckpointIndexedDb(g, {
2708
- * dbName: "myApp",
2709
- * storeName: "checkpoints",
2710
- * });
2711
- * save$.subscribe((msgs) => console.log("saved:", msgs));
2712
- * ```
2713
- *
2714
- * @category extra
3102
+ * @module
2715
3103
  */
2716
- declare function saveGraphCheckpointIndexedDb(graph: Graph, spec: IndexedDbCheckpointSpec): Node<void>;
3104
+
3105
+ type WatermarkOptions = {
3106
+ /** Pending count at which PAUSE is sent upstream. */
3107
+ highWaterMark: number;
3108
+ /** Pending count at which RESUME is sent upstream (after being paused). */
3109
+ lowWaterMark: number;
3110
+ };
3111
+ type WatermarkController = {
3112
+ /** Call when a DATA message is buffered/enqueued. Returns `true` if PAUSE was just sent. */
3113
+ onEnqueue(): boolean;
3114
+ /** Call when a buffered item is consumed. Returns `true` if RESUME was just sent. */
3115
+ onDequeue(): boolean;
3116
+ /** Current un-consumed item count. */
3117
+ readonly pending: number;
3118
+ /** Whether upstream is currently paused by this controller. */
3119
+ readonly paused: boolean;
3120
+ /** Dispose: if paused, sends RESUME to unblock upstream. */
3121
+ dispose(): void;
3122
+ };
2717
3123
  /**
2718
- * Loads a snapshot from IndexedDB and applies {@link Graph.restore} when present.
3124
+ * Creates a watermark-based backpressure controller.
2719
3125
  *
2720
- * @param graph - Graph whose topology matches the stored snapshot.
2721
- * @param spec - Same `dbName` / `storeName` / `key` / `version` as save.
2722
- * @returns A reactive `Node<boolean>`: emits `true` if a snapshot was restored, `false` if missing or not a plain object, then `COMPLETE`; or `ERROR` on I/O failure.
3126
+ * @param sendUp - Callback that delivers messages upstream (typically `handle.up`).
3127
+ * @param opts - High/low watermark thresholds (item counts).
3128
+ * @returns A {@link WatermarkController}.
2723
3129
  *
2724
3130
  * @example
2725
3131
  * ```ts
2726
- * import { restoreGraphCheckpointIndexedDb, Graph } from "@graphrefly/graphrefly-ts";
3132
+ * const handle = graph.observe("fast-source");
3133
+ * const wm = createWatermarkController(
3134
+ * (msgs) => handle.up(msgs),
3135
+ * { highWaterMark: 64, lowWaterMark: 16 },
3136
+ * );
2727
3137
  *
2728
- * const g = new Graph("app");
2729
- * const restore$ = restoreGraphCheckpointIndexedDb(g, {
2730
- * dbName: "myApp",
2731
- * storeName: "checkpoints",
3138
+ * // In sink callback:
3139
+ * handle.subscribe((msgs) => {
3140
+ * for (const msg of msgs) {
3141
+ * if (msg[0] === DATA) {
3142
+ * buffer.push(msg[1]);
3143
+ * wm.onEnqueue();
3144
+ * }
3145
+ * }
2732
3146
  * });
2733
- * restore$.subscribe((msgs) => console.log("restored:", msgs));
2734
- * // Emits [[DATA, true], [COMPLETE]] if a snapshot was found and applied
3147
+ *
3148
+ * // When consumer drains:
3149
+ * const item = buffer.shift();
3150
+ * wm.onDequeue();
2735
3151
  * ```
2736
3152
  *
2737
3153
  * @category extra
2738
3154
  */
2739
- declare function restoreGraphCheckpointIndexedDb(graph: Graph, spec: IndexedDbCheckpointSpec): Node<boolean>;
3155
+ declare function createWatermarkController(sendUp: (messages: Messages) => void, opts: WatermarkOptions): WatermarkController;
2740
3156
 
2741
3157
  /** Pluggable eviction policy for {@link cascadingCache}. */
2742
3158
  interface CacheEvictionPolicy<K> {
@@ -2754,15 +3170,6 @@ interface CacheEvictionPolicy<K> {
2754
3170
  * @category extra
2755
3171
  */
2756
3172
  declare function lru<K>(): CacheEvictionPolicy<K>;
2757
- /** A single lookup/storage tier for {@link cascadingCache}. */
2758
- interface CacheTier<V> {
2759
- /** Read a value. `undefined` / `null` = miss. */
2760
- load(key: string): V | undefined | null;
2761
- /** Write a value. Optional — tiers without save are read-only. */
2762
- save?(key: string, value: V): void;
2763
- /** Delete a value. Optional. */
2764
- clear?(key: string): void;
2765
- }
2766
3173
  interface CascadingCacheOptions {
2767
3174
  /** Max entries before eviction. 0 = unlimited (default). */
2768
3175
  maxSize?: number;
@@ -2790,11 +3197,15 @@ interface CascadingCache<V> {
2790
3197
  *
2791
3198
  * Each cached entry is a `state()` node. On cache miss, tiers are tried in order
2792
3199
  * (index 0 = hottest/fastest). When a lower tier hits, the value is auto-promoted
2793
- * to all faster tiers. Concurrent lookups for the same key share the same state
3200
+ * to all faster tiers. Concurrent loads for the same key share the same state
2794
3201
  * instance — natural dedup.
2795
3202
  *
2796
- * **Note:** `undefined` is the "not yet loaded" sentinel. Tiers that return
2797
- * `undefined` or `null` are treated as misses.
3203
+ * **Sync vs async tiers:** if `tier.load` returns a plain value, the cache node
3204
+ * cache is populated synchronously (`c.load("k").cache` is readable immediately).
3205
+ * If it returns a `Promise`, the node emits `DATA` when the promise resolves.
3206
+ *
3207
+ * **Miss sentinel:** `undefined` and `null` are both treated as misses — the
3208
+ * cascade continues to the next tier.
2798
3209
  *
2799
3210
  * @param tiers - Ordered lookup tiers, hottest first.
2800
3211
  * @param opts - Optional configuration (maxSize, eviction policy, writeThrough).
@@ -2802,101 +3213,237 @@ interface CascadingCache<V> {
2802
3213
  *
2803
3214
  * @example
2804
3215
  * ```ts
2805
- * import { cascadingCache } from "@graphrefly/graphrefly-ts";
3216
+ * import { cascadingCache, memoryStorage, fileStorage } from "@graphrefly/graphrefly-ts";
2806
3217
  *
2807
- * const cache = cascadingCache([
2808
- * { load: k => memMap.get(k), save: (k, v) => memMap.set(k, v) },
2809
- * { load: k => JSON.parse(fs.readFileSync(`cache/${k}`, "utf8")) },
2810
- * ]);
3218
+ * const cache = cascadingCache<User>([memoryStorage(), fileStorage("./cache")]);
2811
3219
  * const user = cache.load("user:42"); // Node<User | undefined>
2812
3220
  * user.subscribe(msgs => console.log(msgs));
2813
3221
  * ```
2814
3222
  *
2815
3223
  * @category extra
2816
3224
  */
2817
- declare function cascadingCache<V>(tiers: CacheTier<V>[], opts?: CascadingCacheOptions): CascadingCache<V>;
2818
- interface TieredStorageOptions {
2819
- /** Max entries before eviction. 0 = no limit (default). */
2820
- maxSize?: number;
2821
- /** Eviction policy. Default: LRU. Only used when maxSize > 0. */
2822
- eviction?: CacheEvictionPolicy<string>;
2823
- }
2824
- interface TieredStorage {
2825
- /** Get or create a singleton state node for this key. Cascades tiers on miss. */
2826
- load(key: string): Node<unknown | undefined>;
2827
- /** Write value to tier 0 (hottest) and update cache node in-place. */
2828
- save(key: string, value: unknown): void;
2829
- /** Re-cascade tiers into the existing cache node. */
2830
- invalidate(key: string): void;
2831
- /** Remove from all tiers and delete cache entry. */
2832
- delete(key: string): void;
2833
- /** Check if key exists in cache. */
2834
- has(key: string): boolean;
2835
- /** Number of cached entries. */
2836
- readonly size: number;
2837
- /** The underlying cascading cache (for advanced use). */
2838
- readonly cache: CascadingCache<unknown>;
2839
- }
2840
- /**
2841
- * Creates a reactive tiered storage cache backed by {@link CheckpointAdapter}s.
2842
- *
2843
- * Each cached key is a `state()` node. On cache miss, adapters are tried in order
2844
- * (index 0 = hottest). Hits auto-promote to faster adapters.
2845
- *
2846
- * @param adapters - Ordered `CheckpointAdapter`s, hottest first.
2847
- * @param opts - Optional configuration (maxSize, eviction policy).
2848
- * @returns A reactive tiered storage where each entry is a `Node<unknown | undefined>`.
2849
- *
2850
- * @example
2851
- * ```ts
2852
- * import { tieredStorage, MemoryCheckpointAdapter } from "@graphrefly/graphrefly-ts";
2853
- *
2854
- * const storage = tieredStorage([new MemoryCheckpointAdapter()], { maxSize: 100 });
2855
- * const val = storage.load("key"); // Node<unknown | undefined>
2856
- * ```
2857
- *
2858
- * @category extra
2859
- */
2860
- declare function tieredStorage(adapters: CheckpointAdapter[], opts?: TieredStorageOptions): TieredStorage;
3225
+ declare function cascadingCache<V = unknown>(tiers: readonly StorageTier[], opts?: CascadingCacheOptions): CascadingCache<V>;
2861
3226
 
2862
- type ReactiveMapOptions = {
3227
+ type ReactiveMapOptions<K, V> = {
2863
3228
  /** Optional registry name for `describe()` / debugging. */
2864
3229
  name?: string;
2865
- /** When set, evicts least-recently-used keys after inserts that exceed this size. */
3230
+ /**
3231
+ * LRU cap. When set, evicts least-recently-used keys after inserts that exceed this size.
3232
+ * Forwarded to the default `NativeMapBackend`. Ignored if a custom `backend` is provided.
3233
+ */
2866
3234
  maxSize?: number;
2867
- /** Default TTL in seconds. Used when `set` omits per-call `ttl`. */
3235
+ /**
3236
+ * Default TTL in seconds. Used when `set`/`setMany` omits per-call `ttl`.
3237
+ * Forwarded to the default `NativeMapBackend`. Ignored if a custom `backend` is provided.
3238
+ */
2868
3239
  defaultTtl?: number;
2869
- } & Omit<NodeOptions, "initial" | "describeKind" | "equals">;
3240
+ /**
3241
+ * Storage backend. Defaults to `NativeMapBackend`. Users can plug in persistent
3242
+ * (HAMT / Immutable.js) or shared-state backends via the {@link MapBackend} interface.
3243
+ */
3244
+ backend?: MapBackend<K, V>;
3245
+ /**
3246
+ * Optional versioning level for the underlying `entries` state node. Set at
3247
+ * construction time; cannot be changed later. Pass `0` for V0 identity +
3248
+ * monotonic version counter, or `1` for V1 + content-addressed cid.
3249
+ */
3250
+ versioning?: VersioningLevel;
3251
+ } & Omit<NodeOptions, "initial" | "describeKind" | "equals" | "versioning">;
2870
3252
  type ReactiveMapBundle<K, V> = {
2871
3253
  /** Emits `ReadonlyMap<K, V>` on each structural change (two-phase). */
2872
3254
  entries: Node<ReadonlyMap<K, V>>;
3255
+ /**
3256
+ * Checks existence. O(1) for live keys. If the key is expired, prunes it AND
3257
+ * emits a snapshot so the reactive surface stays consistent with the return
3258
+ * value. Reads on expired keys are therefore **observable side effects**.
3259
+ *
3260
+ * **LRU touch (F4):** When `maxSize` is configured, a live-key `has` also
3261
+ * marks the entry as most-recently-used — which rearranges internal insertion
3262
+ * order without bumping `version` or emitting. If you care about iteration
3263
+ * order in a downstream subscriber, rely on the `entries` snapshot (a fresh
3264
+ * `ReadonlyMap` per mutation) rather than iterating the backend directly.
3265
+ */
3266
+ has: (key: K) => boolean;
3267
+ /**
3268
+ * Gets value. O(1) for live keys. If the key is expired, prunes it AND emits
3269
+ * a snapshot. Reads on expired keys are therefore **observable side effects**.
3270
+ *
3271
+ * **LRU touch (F4):** When `maxSize` is configured, a live-key `get` also
3272
+ * marks the entry as most-recently-used (no version bump, no emission). See
3273
+ * `has` for the full note on iteration order.
3274
+ */
2873
3275
  get: (key: K) => V | undefined;
3276
+ /**
3277
+ * Sets value with optional TTL (seconds). Throws on `ttl <= 0`. Applies LRU eviction
3278
+ * if `maxSize` is set. Always emits.
3279
+ */
2874
3280
  set: (key: K, value: V, opts?: {
2875
3281
  ttl?: number;
2876
3282
  }) => void;
3283
+ /**
3284
+ * Bulk set — emits one snapshot for the whole batch. Applies `opts.ttl` (falls back
3285
+ * to `defaultTtl`) to every entry. No-op if `entries` is empty.
3286
+ *
3287
+ * **Iterable consumption:** Consumes `entries` once (single-pass). Pass an array
3288
+ * or `Set` for multi-shot consumers. If the iterator throws mid-iteration,
3289
+ * entries already applied remain committed and a snapshot IS emitted (via the
3290
+ * wrapper's finally-block).
3291
+ */
3292
+ setMany: (entries: Iterable<readonly [K, V]>, opts?: {
3293
+ ttl?: number;
3294
+ }) => void;
2877
3295
  delete: (key: K) => void;
3296
+ /**
3297
+ * Bulk delete — emits one snapshot. No-op if no keys were present.
3298
+ *
3299
+ * **Iterable consumption:** Consumes `keys` once (single-pass).
3300
+ */
3301
+ deleteMany: (keys: Iterable<K>) => void;
2878
3302
  clear: () => void;
2879
- has: (key: K) => boolean;
3303
+ /**
3304
+ * Current entry count — O(1), **pure read** (no emission). May include
3305
+ * expired entries on TTL maps until a mutation or explicit
3306
+ * `pruneExpired()` / `has(key)` / `get(key)` prunes them. Call
3307
+ * `pruneExpired()` first if you need a live count.
3308
+ */
2880
3309
  readonly size: number;
2881
- /** Removes expired entries (monotonic clock), emitting if the visible map changes. */
3310
+ /** Explicitly prunes all expired entries. Emits if any were removed. */
2882
3311
  pruneExpired: () => void;
3312
+ /**
3313
+ * Releases any internal keepalive subscriptions so the bundle can be
3314
+ * GC'd. `reactiveMap` currently holds none (the `entries` node lives only
3315
+ * as long as external subscribers keep it alive), so `dispose()` is a
3316
+ * no-op today — exposed for API parity with `reactiveIndex.dispose` /
3317
+ * `reactiveList.dispose` / `reactiveLog.dispose`. Idempotent. D6(a).
3318
+ */
3319
+ dispose: () => void;
3320
+ };
3321
+ /**
3322
+ * Storage contract for {@link reactiveMap}. Implementations own the mutable state,
3323
+ * including optional TTL and LRU semantics, and expose a monotonic `version` counter
3324
+ * that increments on every change to visible state.
3325
+ *
3326
+ * The reactive layer reads `version` before and after each backend call; when it
3327
+ * advances, a snapshot is emitted. Reads (`has`, `get`) may internally prune the
3328
+ * target key if expired and advance `version` — in which case the layer emits so
3329
+ * subscribers see state consistent with the read's return value.
3330
+ *
3331
+ * @remarks Post-1.0 op-log changesets will extend this interface with a
3332
+ * `changesSince(version: number): Iterable<Change>` method. Current consumers
3333
+ * should treat all methods here as stable.
3334
+ *
3335
+ * @category extra
3336
+ */
3337
+ interface MapBackend<K, V> {
3338
+ /** Monotonic mutation counter; increments on every visible state change. */
3339
+ readonly version: number;
3340
+ /** Raw entry count (may include expired entries until a read / prune removes them). */
3341
+ readonly size: number;
3342
+ /** Checks existence. May prune target key if expired; advances `version` if pruned. */
3343
+ has(key: K): boolean;
3344
+ /** Gets value. May prune target key if expired; advances `version` if pruned. */
3345
+ get(key: K): V | undefined;
3346
+ /**
3347
+ * Sets a value with optional TTL (seconds). Throws `RangeError` if `ttl <= 0`.
3348
+ * Applies LRU eviction if `maxSize` is configured. Advances `version`.
3349
+ *
3350
+ * **Atomicity contract:** Either fully succeeds or throws before any state
3351
+ * change; `version` advances only on success.
3352
+ */
3353
+ set(key: K, value: V, ttl?: number): void;
3354
+ /**
3355
+ * Atomic bulk set. Pre-validates TTL once, then applies all entries. Advances
3356
+ * `version` at most once (even for N entries). No-op if iterable is empty.
3357
+ *
3358
+ * **Consumes `entries` once** — pass an array if you want repeatability.
3359
+ *
3360
+ * **Atomicity contract:** TTL validation throws before any mutation. If the
3361
+ * iterable itself throws mid-iteration, entries committed before the throw
3362
+ * remain persisted AND `version` is bumped once (surfaced via finally) so
3363
+ * the reactive wrapper emits a snapshot reflecting the partial state. "At
3364
+ * most once" invariant is preserved.
3365
+ */
3366
+ setMany(entries: Iterable<readonly [K, V]>, ttl?: number): void;
3367
+ /** Removes a key. Returns `true` if the key existed. Advances `version` only if true. */
3368
+ delete(key: K): boolean;
3369
+ /**
3370
+ * Atomic bulk delete. Returns count removed. Advances `version` at most once
3371
+ * (even for N keys). No-op if no keys were present. Consumes `keys` once.
3372
+ */
3373
+ deleteMany(keys: Iterable<K>): number;
3374
+ /** Removes all entries. Returns count removed. Advances `version` only if non-zero. */
3375
+ clear(): number;
3376
+ /** Removes all expired entries. Returns count removed. Advances `version` only if non-zero. */
3377
+ pruneExpired(): number;
3378
+ /** Fresh snapshot of non-expired entries (does NOT mutate state). */
3379
+ toMap(): ReadonlyMap<K, V>;
3380
+ }
3381
+ type NativeMapBackendOptions = {
3382
+ maxSize?: number;
3383
+ /** Default TTL in seconds. */
3384
+ defaultTtl?: number;
2883
3385
  };
3386
+ /**
3387
+ * Default `Map<K, {value, expiresAt}>` backend with optional per-key TTL and LRU cap.
3388
+ *
3389
+ * **Complexity:**
3390
+ * - `has`, `get`, `delete`, `size`: O(1)
3391
+ * - `set`: O(1) amortized (LRU touch + eviction)
3392
+ * - `pruneExpired`, `toMap`: O(n)
3393
+ *
3394
+ * LRU order uses native `Map` insertion order. `get` / `has` on a live key "touches"
3395
+ * it by delete-then-reinsert (moving it to the end). This touch does NOT advance
3396
+ * `version` — it's an internal optimization; the externally visible snapshot
3397
+ * preserves iteration order as of the last mutation. **Note:** because touch
3398
+ * reorders the internal `_store` without emitting, an in-process consumer iterating
3399
+ * `_store` directly (custom subclasses) could observe changing order; external
3400
+ * subscribers only see `toMap()` snapshots which are defensively copied and stable.
3401
+ *
3402
+ * @category extra
3403
+ */
3404
+ declare class NativeMapBackend<K, V> implements MapBackend<K, V> {
3405
+ private _version;
3406
+ private readonly _store;
3407
+ private readonly _maxSize?;
3408
+ private readonly _defaultTtl?;
3409
+ constructor(options?: NativeMapBackendOptions);
3410
+ get version(): number;
3411
+ get size(): number;
3412
+ has(key: K): boolean;
3413
+ get(key: K): V | undefined;
3414
+ set(key: K, value: V, ttl?: number): void;
3415
+ setMany(entries: Iterable<readonly [K, V]>, ttl?: number): void;
3416
+ delete(key: K): boolean;
3417
+ deleteMany(keys: Iterable<K>): number;
3418
+ clear(): number;
3419
+ pruneExpired(): number;
3420
+ toMap(): ReadonlyMap<K, V>;
3421
+ private _resolveExpiresAt;
3422
+ private _isExpired;
3423
+ private _touchLru;
3424
+ private _evictLruWhileOver;
3425
+ }
2884
3426
  /**
2885
3427
  * Creates a reactive `Map` with optional per-key TTL and optional LRU max size.
2886
3428
  *
2887
- * @param options - Node options plus `maxSize` / `defaultTtl` (seconds).
2888
- * @returns `ReactiveMapBundle` — imperative `get` / `set` / `delete` / `clear` / `pruneExpired` and an `entries` node emitting `ReadonlyMap` snapshots.
3429
+ * @param options - `name`, `maxSize`, `defaultTtl` (seconds), or custom `backend`.
3430
+ * @returns `ReactiveMapBundle` — imperative methods (`has`/`get`/`set`/`setMany`/`delete`/
3431
+ * `deleteMany`/`clear`/`pruneExpired`), reactive `entries` node, and O(1)-ish `size`.
2889
3432
  *
2890
3433
  * @remarks
2891
3434
  * **TTL:** Expiry is checked on `get`, `has`, `size`, `pruneExpired`, and before each
2892
- * snapshot emission (expired keys are pruned first). There is no
2893
- * background timer; monotonic-clock–expired keys may still appear in the last-emitted
2894
- * snapshot on `node` until a read or `pruneExpired` removes them.
2895
- * Uses `monotonicNs()` — immune to wall-clock adjustments.
3435
+ * snapshot emission (expired keys are pruned first). Reads that discover expired keys
3436
+ * emit a snapshot so subscribers see state consistent with the read's return value.
3437
+ * There is no background timer; monotonic-clock expiry is immune to wall-clock changes.
3438
+ *
3439
+ * **LRU:** Uses native `Map` insertion order — `get` / `has` refreshes position via
3440
+ * delete-then-reinsert; under `maxSize` pressure the first key in iteration order is
3441
+ * evicted. LRU touching does NOT trigger emission (internal optimization).
2896
3442
  *
2897
- * **LRU:** Uses native `Map` insertion order — `get` / `has` refreshes position; under
2898
- * `maxSize` pressure the first key in iteration order is evicted. When `maxSize` is
2899
- * omitted or is less than 1, no size-based eviction runs.
3443
+ * **Backend:** The default {@link NativeMapBackend} owns LRU/TTL. For persistent /
3444
+ * HAMT / shared-state semantics plug in a custom {@link MapBackend}. `maxSize` and
3445
+ * `defaultTtl` on the options object are only applied to the default backend — if
3446
+ * you supply `backend`, configure those on your backend directly.
2900
3447
  *
2901
3448
  * @example
2902
3449
  * ```ts
@@ -2904,14 +3451,13 @@ type ReactiveMapBundle<K, V> = {
2904
3451
  *
2905
3452
  * const m = reactiveMap<string, number>({ name: "cache", maxSize: 100, defaultTtl: 60 });
2906
3453
  * m.set("x", 1);
2907
- * m.entries.subscribe((msgs) => {
2908
- * console.log(msgs);
2909
- * });
3454
+ * m.setMany([["y", 2], ["z", 3]]);
3455
+ * m.entries.subscribe((msgs) => { console.log(msgs); });
2910
3456
  * ```
2911
3457
  *
2912
3458
  * @category extra
2913
3459
  */
2914
- declare function reactiveMap<K, V>(options?: ReactiveMapOptions): ReactiveMapBundle<K, V>;
3460
+ declare function reactiveMap<K, V>(options?: ReactiveMapOptions<K, V>): ReactiveMapBundle<K, V>;
2915
3461
 
2916
3462
  /**
2917
3463
  * Composite data patterns (roadmap §3.2b).
@@ -2961,7 +3507,7 @@ type DistillOptions<TMem> = {
2961
3507
  consolidate?: (entries: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
2962
3508
  consolidateTrigger?: NodeInput<unknown>;
2963
3509
  context?: NodeInput<unknown>;
2964
- mapOptions?: ReactiveMapOptions;
3510
+ mapOptions?: ReactiveMapOptions<string, TMem>;
2965
3511
  };
2966
3512
  type DistillBundle<TMem> = {
2967
3513
  store: ReactiveMapBundle<string, TMem>;
@@ -3031,9 +3577,14 @@ declare function matchesCron(schedule: CronSchedule, date: Date): boolean;
3031
3577
  /**
3032
3578
  * Tier 1 sync operators (roadmap §2.1) and Tier 2 async/dynamic operators (roadmap §2.2) —
3033
3579
  * each returns a {@link Node} built with {@link node} (or {@link producer} for cold sources).
3580
+ *
3581
+ * v5 foundation redesign: all operators use `actions.emit()` for value emission,
3582
+ * `ctx.store` for persistent state, `ctx.terminalDeps` for terminal handling,
3583
+ * and `data[i]` batch shape for DATA vs RESOLVED discrimination. `onMessage`
3584
+ * and `onResubscribe` are removed.
3034
3585
  */
3035
3586
 
3036
- type ExtraOpts = Omit<NodeOptions, "describeKind">;
3587
+ type ExtraOpts = Omit<NodeOptions<unknown>, "describeKind">;
3037
3588
  /**
3038
3589
  * Maps each settled value from `source` through `project`.
3039
3590
  *
@@ -3607,9 +4158,8 @@ declare function throttle<T>(source: Node<T>, ms: number, opts?: ExtraOpts & Thr
3607
4158
  * Emits the most recent source value whenever `notifier` emits `DATA` (`sample`).
3608
4159
  *
3609
4160
  * Source `COMPLETE` stops sampling (clears held value); notifier `COMPLETE` terminates the
3610
- * operator. `ERROR` from either dep terminates immediately. Unknown message types from
3611
- * either dep are forwarded per spec §1.3.6. At most one terminal message is emitted
3612
- * downstream (latch). Supports `resubscribable` — closure state resets on resubscribe.
4161
+ * operator. `ERROR` from either dep terminates immediately. At most one terminal message is
4162
+ * emitted downstream (latch). Supports `resubscribable` `ctx.store` resets automatically.
3613
4163
  *
3614
4164
  * @param source - Node whose latest value is sampled.
3615
4165
  * @param notifier - When this node emits `DATA`, a sample is taken.
@@ -3781,19 +4331,21 @@ declare function interval(periodMs: number, opts?: ExtraOpts): Node<number>;
3781
4331
  */
3782
4332
  declare function repeat<T>(source: Node<T>, count: number, opts?: ExtraOpts): Node<T>;
3783
4333
  /**
3784
- * While `PAUSE` is in effect, buffers `DIRTY` / `DATA` / `RESOLVED`; flushes on `RESUME`.
4334
+ * Identity passthrough — `pausable()` has been promoted to default node behavior in v5 (§4).
4335
+ *
4336
+ * @deprecated Default node behavior now handles PAUSE/RESUME. This operator is a no-op
4337
+ * identity passthrough kept only for migration compatibility.
3785
4338
  *
3786
4339
  * @param source - Upstream node.
3787
4340
  * @param opts - Optional {@link NodeOptions} (excluding `describeKind`).
3788
- * @returns `Node<T>` - Pass-through with pause buffering.
4341
+ * @returns `Node<T>` - Pass-through (identity).
3789
4342
  * @example
3790
4343
  * ```ts
3791
- * import { pausable, state, PAUSE, RESUME } from "@graphrefly/graphrefly-ts";
4344
+ * import { pausable, state } from "@graphrefly/graphrefly-ts";
3792
4345
  *
4346
+ * // No longer needed — default nodes handle PAUSE/RESUME.
3793
4347
  * const s = state(0);
3794
- * pausable(s);
3795
- * s.down([[PAUSE]]);
3796
- * s.down([[RESUME]]);
4348
+ * pausable(s); // identity passthrough
3797
4349
  * ```
3798
4350
  *
3799
4351
  * @category extra
@@ -3818,16 +4370,17 @@ declare function pausable<T>(source: Node<T>, opts?: ExtraOpts): Node<T>;
3818
4370
  declare function rescue<T>(source: Node<T>, recover: (err: unknown) => T, opts?: ExtraOpts): Node<T>;
3819
4371
  /**
3820
4372
  * Forwards upstream `DATA` only while `control.get()` is truthy; when closed, emits `RESOLVED`
3821
- * instead of repeating the last value (value-level valve). For protocol pause/resume, use {@link pausable}.
4373
+ * instead of repeating the last value (value-level valve). For protocol pause/resume, use default
4374
+ * node PAUSE/RESUME behavior.
3822
4375
  *
3823
4376
  * @param source - Upstream value node.
3824
- * @param control - Boolean node; when falsy, output stays closed for that tick.
4377
+ * @param control - Boolean node; when falsy, output stays "closed" for that tick.
3825
4378
  * @param opts - Optional node options (excluding `describeKind`).
3826
4379
  * @returns `Node<T>` gated by `control`.
3827
4380
  *
3828
4381
  * @example
3829
4382
  * ```ts
3830
- * import { valve, state } from “@graphrefly/graphrefly-ts”;
4383
+ * import { valve, state } from "@graphrefly/graphrefly-ts";
3831
4384
  *
3832
4385
  * const data = state(1);
3833
4386
  * const open = state(true);
@@ -3909,11 +4462,71 @@ declare const throttleTime: typeof throttle;
3909
4462
  declare const catchError: typeof rescue;
3910
4463
 
3911
4464
  /**
3912
- * Lazy per-topic manual nodes (roadmap §3.2) — create topics on first access, publish with two-phase push.
4465
+ * Lazy per-topic state hub (roadmap §3.2) — lightweight last-value broadcasts.
4466
+ *
4467
+ * Each topic is a sentinel `node<unknown>()` with push-on-subscribe replay of
4468
+ * the most recent published value (no push until the first `publish`). For
4469
+ * Pulsar-inspired retained message logs,
4470
+ * cursor-based subscriptions, and job-queue semantics, use `messagingHub()` in
4471
+ * `patterns/messaging.ts` — built on `TopicGraph` / `SubscriptionGraph` with
4472
+ * retention policies, absolute cursor tracking, and per-subscriber state.
4473
+ *
4474
+ * **Wave 4 refactor (2026-04-15):** Introduces `PubSubBackend` (thin registry
4475
+ * with version counter). Converts class-based hub to closure factory for
4476
+ * consistency with other `extra/` factories. New bundle APIs: `has(name)`,
4477
+ * `size`, `topicNames()`, `publishMany(entries)`. `removeTopic` → `TEARDOWN`
4478
+ * semantics preserved.
3913
4479
  */
3914
4480
 
3915
4481
  /**
3916
- * In-memory lazy topic registry: each topic is an independent {@link state} node.
4482
+ * Storage contract for {@link pubsub} — registry only.
4483
+ *
4484
+ * Tracks the set of topic names plus a monotonic `version` counter that
4485
+ * advances on topic create/remove. Does NOT own per-topic message storage —
4486
+ * per-topic cached last values live in the topic nodes themselves (sentinel
4487
+ * until the first publish).
4488
+ *
4489
+ * For distributed / persistent per-topic storage, use `messagingHub()` in
4490
+ * `patterns/messaging.ts`, which composes `TopicGraph` under a lazy registry.
4491
+ *
4492
+ * @category extra
4493
+ */
4494
+ interface PubSubBackend {
4495
+ /** Monotonic counter; advances on topic create/remove. */
4496
+ readonly version: number;
4497
+ readonly topicCount: number;
4498
+ hasTopic(name: string): boolean;
4499
+ topicNames(): IterableIterator<string>;
4500
+ /** Records topic creation. Returns `true` if newly added (advances `version`). */
4501
+ createTopic(name: string): boolean;
4502
+ /** Records topic removal. Returns `true` if it existed (advances `version`). */
4503
+ removeTopic(name: string): boolean;
4504
+ }
4505
+ /**
4506
+ * Default in-memory registry backend.
4507
+ *
4508
+ * @category extra
4509
+ */
4510
+ declare class NativePubSubBackend implements PubSubBackend {
4511
+ private _version;
4512
+ private readonly _topics;
4513
+ get version(): number;
4514
+ get topicCount(): number;
4515
+ hasTopic(name: string): boolean;
4516
+ topicNames(): IterableIterator<string>;
4517
+ createTopic(name: string): boolean;
4518
+ removeTopic(name: string): boolean;
4519
+ }
4520
+ type PubSubHubOptions = {
4521
+ /**
4522
+ * Storage backend. Defaults to `NativePubSubBackend`. Pluggable for audit /
4523
+ * monitoring / mirror-to-external-broker use cases.
4524
+ */
4525
+ backend?: PubSubBackend;
4526
+ };
4527
+ /**
4528
+ * Lazy per-topic state hub. Topics are single-value sentinel nodes
4529
+ * with push-on-subscribe replay of the most recent publish.
3917
4530
  *
3918
4531
  * @category extra
3919
4532
  */
@@ -3922,27 +4535,47 @@ interface PubSubHub {
3922
4535
  * Returns the topic node, creating it on first use.
3923
4536
  *
3924
4537
  * @param name - Topic key.
3925
- * @returns `Node` whose value is the last published payload (initially `undefined`).
4538
+ * @returns `Node` whose value is the last published payload. Starts in
4539
+ * sentinel state — no push-on-subscribe until the first publish.
3926
4540
  */
3927
4541
  topic(name: string): Node<unknown>;
3928
- /**
3929
- * Pushes a value to the topic (two-phase `DIRTY` then `DATA`, matching other manual sources here).
3930
- *
3931
- * @param name - Topic key.
3932
- * @param value - Payload.
3933
- */
4542
+ /** Publishes a value to the topic (lazily creating the topic if missing). */
3934
4543
  publish(name: string, value: unknown): void;
3935
4544
  /**
3936
- * Removes a topic and tears down its node. Returns `true` if the topic existed.
4545
+ * Bulk publish single outer batch for all entries. No-op if empty.
3937
4546
  *
3938
- * @param name - Topic key.
4547
+ * **Iterable consumption (F6):** `entries` is consumed once (single-pass).
4548
+ * Pass an array or `Set` for multi-shot callers. Iteration happens INSIDE
4549
+ * the batch frame — if the iterator throws mid-way, the batch is discarded
4550
+ * and NO publishes are visible to subscribers (all-or-nothing within one
4551
+ * call).
3939
4552
  */
4553
+ publishMany(entries: Iterable<[string, unknown]>): void;
4554
+ /** Removes a topic; sends `TEARDOWN` to its node. Returns `true` if it existed. */
3940
4555
  removeTopic(name: string): boolean;
4556
+ /** Checks topic existence without creating. O(1). */
4557
+ has(name: string): boolean;
4558
+ /** Number of topics currently registered. O(1). */
4559
+ readonly size: number;
4560
+ /** Iterator over topic names. */
4561
+ topicNames(): IterableIterator<string>;
3941
4562
  }
3942
4563
  /**
3943
- * Creates an empty {@link PubSubHub} for lazy topic nodes.
4564
+ * Creates a lazy per-topic state hub.
3944
4565
  *
3945
- * @returns A new hub with no topics until {@link PubSubHub.topic} or {@link PubSubHub.publish} runs.
4566
+ * @param options - Optional pluggable `backend` (defaults to `NativePubSubBackend`).
4567
+ * @returns Hub with lazy `topic()` / `publish()` / `publishMany()` / `removeTopic()` /
4568
+ * `has()` / `size` / `topicNames()`.
4569
+ *
4570
+ * @remarks
4571
+ * **Scope:** Each topic is a sentinel node — retains only the last published
4572
+ * value (no push-on-subscribe before the first publish). For Pulsar-inspired
4573
+ * retention + cursor reading, use
4574
+ * `messagingHub()` in `patterns/messaging.ts`.
4575
+ *
4576
+ * **`removeTopic`:** Sends `TEARDOWN` to the topic node; all subscribers receive
4577
+ * the TEARDOWN message. Subsequent `publish(name, value)` silently recreates the
4578
+ * topic with a fresh node — existing subscribers to the old node do NOT reconnect.
3946
4579
  *
3947
4580
  * @example
3948
4581
  * ```ts
@@ -3952,41 +4585,213 @@ interface PubSubHub {
3952
4585
  * const t = hub.topic("events");
3953
4586
  * t.subscribe((msgs) => console.log(msgs));
3954
4587
  * hub.publish("events", { ok: true });
3955
- * hub.removeTopic("events"); // tears down the node
4588
+ * hub.publishMany([["events", 1], ["status", "ready"]]);
3956
4589
  * ```
3957
4590
  *
3958
4591
  * @category extra
3959
4592
  */
3960
- declare function pubsub(): PubSubHub;
4593
+ declare function pubsub(options?: PubSubHubOptions): PubSubHub;
3961
4594
 
3962
4595
  type IndexRow<K, V = unknown> = {
3963
4596
  readonly primary: K;
3964
4597
  readonly secondary: unknown;
3965
4598
  readonly value: V;
3966
4599
  };
3967
- type ReactiveIndexOptions = {
4600
+ type ReactiveIndexOptions<K, V = unknown> = {
4601
+ /** Optional registry name for `describe()` / debugging. */
3968
4602
  name?: string;
4603
+ /**
4604
+ * Storage backend. Defaults to `NativeIndexBackend` (flat array + parallel `Map<K,IndexRow>`).
4605
+ * Users can plug in persistent / B-tree backends via the {@link IndexBackend} interface.
4606
+ */
4607
+ backend?: IndexBackend<K, V>;
4608
+ /**
4609
+ * Optional versioning level for the underlying `ordered` state node. Set at
4610
+ * construction time; cannot be changed later. Pass `0` for V0 identity +
4611
+ * monotonic version counter, or `1` for V1 + content-addressed cid.
4612
+ * (The `byPrimary` derived node inherits through the dep graph.)
4613
+ */
4614
+ versioning?: VersioningLevel;
4615
+ /**
4616
+ * Default row-equality used to short-circuit idempotent upserts. When
4617
+ * provided, every `upsert` / `upsertMany` that finds an existing primary
4618
+ * compares the stored and candidate rows via `equals(existing, next)` —
4619
+ * on `true` the call is a no-op (no version bump, no emission). Per-call
4620
+ * `UpsertOptions.equals` overrides this default. Analogous to
4621
+ * `NodeOptions.equals` on the core `node()` primitive.
4622
+ */
4623
+ equals?: (existing: IndexRow<K, V>, next: IndexRow<K, V>) => boolean;
3969
4624
  };
3970
4625
  type ReactiveIndexBundle<K, V = unknown> = {
3971
4626
  /** Rows sorted by `(secondary, primary)`. */
3972
4627
  readonly ordered: Node<readonly IndexRow<K, V>[]>;
3973
4628
  /** Map from primary key to stored value. */
3974
4629
  readonly byPrimary: Node<ReadonlyMap<K, V>>;
3975
- upsert: (primary: K, secondary: unknown, value: V) => void;
4630
+ /** O(1) primary-key existence check. */
4631
+ has: (primary: K) => boolean;
4632
+ /** O(1) value lookup by primary key. */
4633
+ get: (primary: K) => V | undefined;
4634
+ /** Number of rows currently in the index (O(1)). */
4635
+ readonly size: number;
4636
+ /**
4637
+ * Upserts a row. When `opts.equals(existing, next)` returns `true` for an
4638
+ * existing primary key, the upsert is a no-op (no version bump, no emission).
4639
+ * Useful for idempotent writes.
4640
+ *
4641
+ * @returns `true` if a new row was inserted (primary key was absent),
4642
+ * `false` if the primary key was already present (updated in place OR
4643
+ * skipped idempotently via `opts.equals`). D5(a).
4644
+ */
4645
+ upsert: (primary: K, secondary: unknown, value: V, opts?: UpsertOptions<K, V>) => boolean;
4646
+ /**
4647
+ * Bulk upsert — emits one snapshot for the whole batch. `opts.equals` applied
4648
+ * per-row. No-op if empty or all rows skipped.
4649
+ *
4650
+ * **Iterable consumption:** Consumes `rows` once (single-pass).
4651
+ */
4652
+ upsertMany: (rows: Iterable<{
4653
+ primary: K;
4654
+ secondary: unknown;
4655
+ value: V;
4656
+ }>, opts?: UpsertOptions<K, V>) => void;
3976
4657
  delete: (primary: K) => void;
4658
+ /**
4659
+ * Bulk delete — emits one snapshot for the whole batch. No-op if nothing was removed.
4660
+ *
4661
+ * **Iterable consumption:** Consumes `primaries` once (single-pass).
4662
+ */
4663
+ deleteMany: (primaries: Iterable<K>) => void;
3977
4664
  clear: () => void;
4665
+ /**
4666
+ * Releases internal keepalive subscriptions (on `byPrimary`) so the bundle
4667
+ * can be GC'd. Safe to call more than once (subsequent calls are no-ops).
4668
+ * Subsequent mutations after `dispose()` still execute on the backend but
4669
+ * `byPrimary` may stop updating if no external subscriber is attached.
4670
+ * D6(a).
4671
+ */
4672
+ dispose: () => void;
4673
+ };
4674
+ /**
4675
+ * Storage contract for {@link reactiveIndex}. Implementations own the mutable state and
4676
+ * expose a monotonic `version` counter that increments on every structural change.
4677
+ *
4678
+ * The reactive layer reads `version` to decide when to emit; it does not inspect
4679
+ * internal representation. Users can plug in B-tree / skip-list / persistent backends
4680
+ * without touching the reactive emission logic.
4681
+ *
4682
+ * @remarks Post-1.0 op-log changesets will extend this interface with a
4683
+ * `changesSince(version: number): Iterable<Change>` method. Current consumers
4684
+ * should treat all methods here as stable.
4685
+ *
4686
+ * @category extra
4687
+ */
4688
+ /**
4689
+ * Optional per-call options for {@link IndexBackend.upsert} and bulk upsert.
4690
+ *
4691
+ * @category extra
4692
+ */
4693
+ type UpsertOptions<K, V> = {
4694
+ /**
4695
+ * Skip the upsert if an existing row is considered equal to the proposed row.
4696
+ * Default: no skip — every upsert advances `version`. Provide for idempotent
4697
+ * keys (e.g., `(a, b) => a.secondary === b.secondary && a.value === b.value`).
4698
+ */
4699
+ equals?: (existing: IndexRow<K, V>, next: IndexRow<K, V>) => boolean;
3978
4700
  };
4701
+ interface IndexBackend<K, V = unknown> {
4702
+ /** Monotonic mutation counter; increments on every upsert/delete/clear that changes state. */
4703
+ readonly version: number;
4704
+ /** Number of rows currently stored. */
4705
+ readonly size: number;
4706
+ /** O(1) primary-key existence check. */
4707
+ has(primary: K): boolean;
4708
+ /** Value lookup by primary key. */
4709
+ get(primary: K): V | undefined;
4710
+ /**
4711
+ * Insert or replace a row. Returns `true` if a row was inserted (primary
4712
+ * didn't exist), `false` otherwise (updated OR skipped via `opts.equals`).
4713
+ *
4714
+ * **Atomicity contract:** Either fully succeeds or throws before any state
4715
+ * change; `version` advances only on state change.
4716
+ */
4717
+ upsert(primary: K, secondary: unknown, value: V, opts?: UpsertOptions<K, V>): boolean;
4718
+ /**
4719
+ * Atomic bulk upsert. Returns the number of rows that caused a state change
4720
+ * (inserts + non-skipped updates). Advances `version` at most once.
4721
+ * No-op if iterable is empty or all rows skipped by `opts.equals`.
4722
+ *
4723
+ * **Consumes `rows` once** — pass an array for multi-shot consumers.
4724
+ */
4725
+ upsertMany(rows: Iterable<{
4726
+ primary: K;
4727
+ secondary: unknown;
4728
+ value: V;
4729
+ }>, opts?: UpsertOptions<K, V>): number;
4730
+ /** Remove a row by primary key. Returns `true` if the row existed. Advances `version` only if true. */
4731
+ delete(primary: K): boolean;
4732
+ /**
4733
+ * Atomic bulk delete. Returns count removed. Advances `version` at most once.
4734
+ * No-op if no keys were present. Consumes `primaries` once.
4735
+ */
4736
+ deleteMany(primaries: Iterable<K>): number;
4737
+ /** Remove all rows. Returns the number removed. Advances `version` only if non-zero. */
4738
+ clear(): number;
4739
+ /** Rows in sorted `(secondary, primary)` order — fresh snapshot suitable for emission. */
4740
+ toArray(): readonly IndexRow<K, V>[];
4741
+ /** Primary-key → value map — fresh snapshot. */
4742
+ toPrimaryMap(): ReadonlyMap<K, V>;
4743
+ }
4744
+ /**
4745
+ * Default flat-array backend. Maintains `buf: IndexRow[]` sorted by `(secondary, primary)`
4746
+ * and a parallel `Map<K, IndexRow>` for O(1) primary-key lookup.
4747
+ *
4748
+ * **Complexity:**
4749
+ * - `has`, `get`: O(1)
4750
+ * - `upsert`: up to 2× O(log n) bisect (locate old + locate new) + up to 2× O(n) splice (remove-old + insert-new) = O(n)
4751
+ * - `upsertMany(k rows)`: O(k log n) bisect + O(k·n) splice worst case; single version bump
4752
+ * - `delete`: O(log n) bisect + O(n) splice = O(n)
4753
+ * - `deleteMany(k keys)`: O(k log n) + O(k·n) splice worst case; single version bump
4754
+ * - `clear`: O(1)
4755
+ * - `toArray`, `toPrimaryMap`: O(n)
4756
+ *
4757
+ * @category extra
4758
+ */
4759
+ declare class NativeIndexBackend<K, V = unknown> implements IndexBackend<K, V> {
4760
+ private _version;
4761
+ private readonly _buf;
4762
+ private readonly _byPrimary;
4763
+ get version(): number;
4764
+ get size(): number;
4765
+ has(primary: K): boolean;
4766
+ get(primary: K): V | undefined;
4767
+ upsert(primary: K, secondary: unknown, value: V, opts?: UpsertOptions<K, V>): boolean;
4768
+ upsertMany(rows: Iterable<{
4769
+ primary: K;
4770
+ secondary: unknown;
4771
+ value: V;
4772
+ }>, opts?: UpsertOptions<K, V>): number;
4773
+ delete(primary: K): boolean;
4774
+ deleteMany(primaries: Iterable<K>): number;
4775
+ clear(): number;
4776
+ toArray(): readonly IndexRow<K, V>[];
4777
+ toPrimaryMap(): ReadonlyMap<K, V>;
4778
+ }
3979
4779
  /**
3980
4780
  * Creates a reactive index: unique primary key per row, rows sorted by `(secondary, primary)` for ordered scans.
3981
4781
  *
3982
- * @param options - Optional `name` for `describe()` / debugging.
3983
- * @returns Bundle with `ordered` (sorted rows), `byPrimary` (map), and imperative `upsert` / `delete` / `clear`.
4782
+ * @param options - Optional `name` for `describe()` / debugging, and optional `backend` (see {@link IndexBackend}).
4783
+ * @returns Bundle with `ordered` (sorted rows), `byPrimary` (map), O(1) `has` / `get` / `size`,
4784
+ * imperative `upsert` / `upsertMany` / `delete` / `deleteMany` / `clear`.
3984
4785
  *
3985
4786
  * @remarks
3986
4787
  * **Ordering:** `secondary` and `primary` are compared via a small total order: same primitive `typeof` uses
3987
4788
  * numeric/string/boolean/bigint comparison; mixed or object keys fall back to `String(a).localeCompare(String(b))`
3988
4789
  * (not identical to Python's rich comparison for exotic types).
3989
4790
  *
4791
+ * **Backend:** The default {@link NativeIndexBackend} offers O(1) primary-key lookups and O(n) upserts.
4792
+ * For scale beyond a few thousand rows, supply a user-pluggable persistent/B-tree backend via the
4793
+ * `backend` option — reactive emission semantics are unchanged.
4794
+ *
3990
4795
  * @example
3991
4796
  * ```ts
3992
4797
  * import { reactiveIndex } from "@graphrefly/graphrefly-ts";
@@ -3998,25 +4803,128 @@ type ReactiveIndexBundle<K, V = unknown> = {
3998
4803
  *
3999
4804
  * @category extra
4000
4805
  */
4001
- declare function reactiveIndex<K, V = unknown>(options?: ReactiveIndexOptions): ReactiveIndexBundle<K, V>;
4806
+ declare function reactiveIndex<K, V = unknown>(options?: ReactiveIndexOptions<K, V>): ReactiveIndexBundle<K, V>;
4002
4807
 
4003
- type ReactiveListOptions = {
4808
+ type ReactiveListOptions<T> = {
4004
4809
  name?: string;
4810
+ /**
4811
+ * Storage backend. Defaults to `NativeListBackend` (flat mutable array).
4812
+ * Users can plug in persistent / RRB-tree backends via the {@link ListBackend} interface.
4813
+ */
4814
+ backend?: ListBackend<T>;
4815
+ /**
4816
+ * Optional versioning level for the underlying `items` state node. Set at
4817
+ * construction time; cannot be changed later. Pass `0` for V0 identity +
4818
+ * monotonic version counter, or `1` for V1 + content-addressed cid.
4819
+ */
4820
+ versioning?: VersioningLevel;
4005
4821
  };
4006
4822
  type ReactiveListBundle<T> = {
4007
4823
  /** Emits `readonly T[]` on each structural change (two-phase). */
4008
4824
  readonly items: Node<readonly T[]>;
4825
+ /** Current entry count (O(1)). */
4826
+ readonly size: number;
4827
+ /** Positional access (O(1)); supports negative indices (Python-style). Returns `undefined` on out-of-range. */
4828
+ at: (index: number) => T | undefined;
4009
4829
  append: (value: T) => void;
4830
+ /** Push all values, emit one snapshot. No-op if `values` is empty. */
4831
+ appendMany: (values: readonly T[]) => void;
4832
+ /** Insert a value at `index`. Throws `RangeError` on out-of-range. */
4010
4833
  insert: (index: number, value: T) => void;
4834
+ /** Insert all values at `index` as one bulk op; emits one snapshot. No-op if `values` is empty. */
4835
+ insertMany: (index: number, values: readonly T[]) => void;
4836
+ /** Remove and return the value at `index` (default: last). Negative indices Python-style. Throws on empty / out-of-range. */
4011
4837
  pop: (index?: number) => T;
4012
4838
  clear: () => void;
4839
+ /**
4840
+ * Releases any internal keepalive subscriptions so the bundle can be
4841
+ * GC'd. `reactiveList` currently holds none (no internal derived nodes),
4842
+ * so `dispose()` is a no-op today — exposed for API parity with
4843
+ * `reactiveIndex.dispose` / `reactiveMap.dispose` / `reactiveLog.dispose`.
4844
+ * Idempotent. D6(a).
4845
+ */
4846
+ dispose: () => void;
4013
4847
  };
4848
+ /**
4849
+ * Storage contract for {@link reactiveList}. Implementations own the mutable state
4850
+ * and expose a monotonic `version` counter that increments on every structural change.
4851
+ *
4852
+ * The reactive layer reads `version` before and after each backend call; when it
4853
+ * advances, a snapshot is emitted.
4854
+ *
4855
+ * @remarks Post-1.0 op-log changesets will extend this interface with a
4856
+ * `changesSince(version: number): Iterable<Change>` method. Current consumers
4857
+ * should treat all methods here as stable.
4858
+ *
4859
+ * @category extra
4860
+ */
4861
+ interface ListBackend<T> {
4862
+ /** Monotonic mutation counter; increments on every structural change. */
4863
+ readonly version: number;
4864
+ /** Number of items currently stored. */
4865
+ readonly size: number;
4866
+ /** Positional access; `undefined` on out-of-range. */
4867
+ at(index: number): T | undefined;
4868
+ /** Append a single value. Advances `version`. */
4869
+ append(value: T): void;
4870
+ /** Append a batch. Advances `version` once. No-op if empty. */
4871
+ appendMany(values: readonly T[]): void;
4872
+ /** Insert at index; throws `RangeError` on out-of-range `0 <= index <= size`. Advances `version`. */
4873
+ insert(index: number, value: T): void;
4874
+ /** Bulk insert at index; throws on out-of-range. Advances `version` once. No-op if `values` empty. */
4875
+ insertMany(index: number, values: readonly T[]): void;
4876
+ /** Remove and return value at index; throws on empty / out-of-range. Advances `version`. */
4877
+ pop(index: number): T;
4878
+ /** Clear all entries. Returns count removed. Advances `version` only if non-zero. */
4879
+ clear(): number;
4880
+ /** Full snapshot as a fresh array. */
4881
+ toArray(): readonly T[];
4882
+ }
4883
+ /**
4884
+ * Default mutable-array backend.
4885
+ *
4886
+ * **Complexity:**
4887
+ * - `at`, `size`: O(1)
4888
+ * - `append`: O(1) amortized
4889
+ * - `appendMany(values)`, `insertMany(index, values)`: O(n + k) where k = values.length
4890
+ * - `insert`, `pop` (middle): O(n) due to splice
4891
+ * - `pop` (last): O(1)
4892
+ * - `clear`: O(1)
4893
+ * - `toArray`: O(n)
4894
+ *
4895
+ * @category extra
4896
+ */
4897
+ declare class NativeListBackend<T> implements ListBackend<T> {
4898
+ private _version;
4899
+ private readonly _buf;
4900
+ constructor(initial?: readonly T[]);
4901
+ get version(): number;
4902
+ get size(): number;
4903
+ at(index: number): T | undefined;
4904
+ append(value: T): void;
4905
+ appendMany(values: readonly T[]): void;
4906
+ insert(index: number, value: T): void;
4907
+ insertMany(index: number, values: readonly T[]): void;
4908
+ pop(index: number): T;
4909
+ clear(): number;
4910
+ toArray(): readonly T[];
4911
+ }
4014
4912
  /**
4015
4913
  * Creates a reactive list with immutable array snapshots.
4016
4914
  *
4017
4915
  * @param initial - Optional initial items (copied).
4018
- * @param options - Optional `name` for `describe()` / debugging.
4019
- * @returns Bundle with `items` (state node) and `append` / `insert` / `pop` / `clear`.
4916
+ * @param options - Optional `name` for `describe()` / debugging, or pluggable `backend`.
4917
+ * @returns Bundle with `items` (state node), `size` / `at`, `append` / `appendMany` / `insert` /
4918
+ * `insertMany` / `pop` / `clear`.
4919
+ *
4920
+ * @remarks
4921
+ * **No `maxSize`:** insert/pop-anywhere semantics make eviction-under-cap ambiguous.
4922
+ * For bounded append-heavy workloads use `reactiveLog` (head-trim is well-defined for
4923
+ * append-only).
4924
+ *
4925
+ * **Backend:** Default {@link NativeListBackend}. For persistent / RRB-tree semantics
4926
+ * supply a custom {@link ListBackend}. If you provide a `backend`, `initial` is ignored
4927
+ * — seed the backend directly.
4020
4928
  *
4021
4929
  * @example
4022
4930
  * ```ts
@@ -4024,74 +4932,234 @@ type ReactiveListBundle<T> = {
4024
4932
  *
4025
4933
  * const list = reactiveList<string>(["a"], { name: "queue" });
4026
4934
  * list.append("b");
4935
+ * list.insertMany(1, ["x", "y"]);
4027
4936
  * ```
4028
4937
  *
4029
4938
  * @category extra
4030
4939
  */
4031
- declare function reactiveList<T>(initial?: readonly T[], options?: ReactiveListOptions): ReactiveListBundle<T>;
4940
+ declare function reactiveList<T>(initial?: readonly T[], options?: ReactiveListOptions<T>): ReactiveListBundle<T>;
4032
4941
 
4033
- type ReactiveLogOptions = {
4942
+ type ReactiveLogOptions<T> = {
4034
4943
  name?: string;
4035
4944
  maxSize?: number;
4945
+ /**
4946
+ * Optional versioning level for the underlying `entries` state node. Set
4947
+ * at construction time; cannot be changed later. Pass `0` for V0 identity
4948
+ * + monotonic version counter, or `1` for V1 + content-addressed cid.
4949
+ */
4950
+ versioning?: VersioningLevel;
4951
+ /**
4952
+ * Storage backend. Defaults to `NativeLogBackend` (ring buffer if `maxSize` is set,
4953
+ * flat array otherwise). Users can plug in persistent / RRB-tree backends via
4954
+ * the {@link LogBackend} interface.
4955
+ */
4956
+ backend?: LogBackend<T>;
4036
4957
  };
4037
4958
  type ReactiveLogBundle<T> = {
4038
- /** Emits `readonly T[]` on each append/clear (two-phase). */
4959
+ /** Emits `readonly T[]` on each append/clear/trim (two-phase). */
4039
4960
  readonly entries: Node<readonly T[]>;
4961
+ /** Current entry count (O(1)). */
4962
+ readonly size: number;
4963
+ /** Positional access (O(1)); returns `undefined` on out-of-range. Supports negative indices (Python-style). */
4964
+ at: (index: number) => T | undefined;
4040
4965
  append: (value: T) => void;
4041
- /** Push all values, trim once, emit one snapshot. */
4966
+ /**
4967
+ * Push all values, emit one snapshot. No-op if `values` is empty.
4968
+ * **Iterable consumption:** `values` is a `readonly T[]` — safe to pass arrays.
4969
+ */
4042
4970
  appendMany: (values: readonly T[]) => void;
4043
4971
  clear: () => void;
4044
- /** Remove the first `n` entries; emits snapshot. */
4972
+ /** Remove the first `n` entries (clamped to `size`). Throws on non-integer or negative `n`. */
4045
4973
  trimHead: (n: number) => void;
4046
- /** Last `n` entries (or fewer); updates when the log changes. */
4974
+ /**
4975
+ * Last `n` entries (or fewer) as a derived reactive view. Memoized with
4976
+ * an LRU cache (default cap 64) — repeat calls with the same `n` return
4977
+ * the same node. Throws on non-integer or negative `n`.
4978
+ *
4979
+ * **LRU eviction contract (D3(b)):** when a 65th distinct `n` is passed,
4980
+ * the least-recently-used cached view is evicted and its keepalive is
4981
+ * disposed. External holders of the evicted node will NOT receive further
4982
+ * updates — re-call `tail(n)` for a fresh node, or dispose proactively
4983
+ * via {@link disposeTail} / {@link disposeAllViews}. To avoid surprise:
4984
+ * resolve `tail(n)` at the point of use rather than caching the returned
4985
+ * node across many distinct `n`s.
4986
+ */
4047
4987
  tail: (n: number) => Node<readonly T[]>;
4988
+ /**
4989
+ * Reactive view of `entries.slice(start, stop)` — non-negative integer
4990
+ * `start`, non-negative integer `stop` (exclusive) or `undefined` (to end).
4991
+ * Memoized with an LRU cache (default cap 64) — repeat calls with the
4992
+ * same `(start, stop)` return the same node.
4993
+ *
4994
+ * Throws on non-integer `start`, negative `start`, non-integer `stop`, or
4995
+ * negative `stop` (P4 — the backend cannot cheaply honor JS-style
4996
+ * negative `stop` without scanning length; disallowed for a consistent
4997
+ * contract between backend, derived recomputation, and cached initial).
4998
+ *
4999
+ * **LRU eviction contract (D3(b)):** same as {@link tail} — past 64
5000
+ * distinct `(start, stop)` pairs, the oldest cached view is evicted and
5001
+ * its keepalive disposed. External holders stop receiving updates.
5002
+ */
5003
+ slice: (start: number, stop?: number) => Node<readonly T[]>;
5004
+ /**
5005
+ * Releases the cached `tail(n)` view if present (disposes its keepalive
5006
+ * subscription). Subsequent `tail(n)` calls create a fresh node. No-op if
5007
+ * `n` was not cached. Returns `true` if a view was disposed.
5008
+ */
5009
+ disposeTail: (n: number) => boolean;
5010
+ /**
5011
+ * Releases the cached `slice(start, stop?)` view if present. No-op if not cached.
5012
+ */
5013
+ disposeSlice: (start: number, stop?: number) => boolean;
5014
+ /** Releases all cached tail/slice views and their keepalive subscriptions. */
5015
+ disposeAllViews: () => void;
5016
+ /**
5017
+ * Releases all internal keepalive subscriptions so the bundle can be
5018
+ * GC'd — currently equivalent to {@link disposeAllViews}, but exposed as
5019
+ * a uniform API across all reactive data structures for lifecycle
5020
+ * symmetry (mirrors `reactiveMap.dispose` / `reactiveList.dispose` /
5021
+ * `reactiveIndex.dispose`). Idempotent. D6(a).
5022
+ */
5023
+ dispose: () => void;
4048
5024
  };
5025
+ /**
5026
+ * Storage contract for {@link reactiveLog}. Implementations own the mutable state and
5027
+ * expose a monotonic `version` counter that increments on every structural change.
5028
+ *
5029
+ * The reactive layer reads `version` to decide when to emit; it does not inspect
5030
+ * internal representation. Users can plug in persistent / ring-buffer / skip-list
5031
+ * backends without touching the reactive emission logic.
5032
+ *
5033
+ * @remarks Post-1.0 op-log changesets will extend this interface with a
5034
+ * `changesSince(version: number): Iterable<Change>` method. Current consumers
5035
+ * should treat all methods here as stable.
5036
+ *
5037
+ * @category extra
5038
+ */
5039
+ interface LogBackend<T> {
5040
+ /** Monotonic mutation counter; increments on every append/trim/clear that changes state. */
5041
+ readonly version: number;
5042
+ /** Number of entries currently stored. */
5043
+ readonly size: number;
5044
+ /** O(1) positional access; returns `undefined` on out-of-range. */
5045
+ at(index: number): T | undefined;
5046
+ /** Append a value. Applies `maxSize` head-drop if configured. Advances `version`. */
5047
+ append(value: T): void;
5048
+ /** Append a batch; advances `version` once. No-op if `values.length === 0`. */
5049
+ appendMany(values: readonly T[]): void;
5050
+ /** Remove all entries. Returns count removed. Advances `version` only if non-zero. */
5051
+ clear(): number;
5052
+ /** Remove the first `n` entries (clamped). Returns count removed. Throws on negative `n`. */
5053
+ trimHead(n: number): number;
5054
+ /** Fresh snapshot array for `[start, stop)`. Throws on negative `start`. */
5055
+ slice(start: number, stop?: number): readonly T[];
5056
+ /** Last `n` entries as a fresh array. Throws on negative `n`. */
5057
+ tail(n: number): readonly T[];
5058
+ /** Full snapshot as a fresh array. */
5059
+ toArray(): readonly T[];
5060
+ }
5061
+ /**
5062
+ * Default append-only log backend.
5063
+ *
5064
+ * - When `maxSize` is set: uses a **ring buffer** with `_head` index and circular
5065
+ * modular arithmetic. Append and trim become O(1); snapshot is O(size) unrolling.
5066
+ * - When `maxSize` is unset: uses a flat array with standard push/splice.
5067
+ *
5068
+ * `appendMany` pre-trims oversize input: if `values.length > maxSize`, only the
5069
+ * tail of `values` is pushed (the rest would be immediately evicted).
5070
+ *
5071
+ * @category extra
5072
+ */
5073
+ declare class NativeLogBackend<T> implements LogBackend<T> {
5074
+ private _version;
5075
+ private readonly _maxSize?;
5076
+ private readonly _buf;
5077
+ private _head;
5078
+ private _size;
5079
+ constructor(initial?: readonly T[], maxSize?: number);
5080
+ get version(): number;
5081
+ get size(): number;
5082
+ at(index: number): T | undefined;
5083
+ append(value: T): void;
5084
+ appendMany(values: readonly T[]): void;
5085
+ clear(): number;
5086
+ trimHead(n: number): number;
5087
+ slice(start: number, stop?: number): readonly T[];
5088
+ tail(n: number): readonly T[];
5089
+ toArray(): readonly T[];
5090
+ /** Internal append without version bump — used by `appendMany`. */
5091
+ private _rawAppend;
5092
+ }
4049
5093
  /**
4050
5094
  * Creates an append-only reactive log with immutable array snapshots.
4051
5095
  *
4052
- * @param initial - Optional seed entries (copied).
4053
- * @param options - Optional `name` for `describe()` / debugging.
4054
- * @returns Bundle with `entries` (state node), `append`, `clear`, and {@link ReactiveLogBundle.tail}.
5096
+ * @param initial - Optional seed entries (copied; pre-trimmed to `maxSize` if set).
5097
+ * @param options - `name`, `maxSize`, and optional pluggable `backend`.
5098
+ * @returns Bundle with `entries` (state node), `append`/`appendMany`/`clear`/`trimHead`,
5099
+ * `size` / `at`, and memoized derived views `tail(n)` / `slice(start, stop?)`.
4055
5100
  *
4056
5101
  * @remarks
4057
- * **Derived views:** {@link tail} and {@link logSlice} install an internal noop subscription so
4058
- * `get()` stays wired without an external sink; creating very many disposable derived nodes can
4059
- * retain subscriptions until the log bundle is unreachable.
5102
+ * **Backend:** The default {@link NativeLogBackend} uses a ring buffer when `maxSize`
5103
+ * is set (O(1) append + trim) and a flat array otherwise. For persistent/structural-
5104
+ * sharing semantics plug in a custom {@link LogBackend}.
5105
+ *
5106
+ * **`initial` + custom `backend` (F5):** When you supply `options.backend`, the
5107
+ * `initial` argument is IGNORED — seed the backend yourself before passing it in.
5108
+ * The `initial` seed only applies to the default `NativeLogBackend`.
5109
+ *
5110
+ * **Memoized views:** {@link ReactiveLogBundle.tail} and {@link ReactiveLogBundle.slice}
5111
+ * cache derived nodes per-argument. Repeat calls with the same `n` / `(start, stop)`
5112
+ * return the same node, bounding keepalive-subscription count to one per unique argument.
4060
5113
  *
4061
5114
  * @example
4062
5115
  * ```ts
4063
5116
  * import { reactiveLog } from "@graphrefly/graphrefly-ts";
4064
5117
  *
4065
- * const lg = reactiveLog<number>([1, 2], { name: "audit" });
5118
+ * const lg = reactiveLog<number>([1, 2], { name: "audit", maxSize: 100 });
4066
5119
  * lg.append(3);
4067
5120
  * lg.entries.subscribe((msgs) => console.log(msgs));
5121
+ * const last5 = lg.tail(5); // derived node
5122
+ * const window = lg.slice(10, 20); // derived node
4068
5123
  * ```
4069
5124
  *
4070
5125
  * @category extra
4071
5126
  */
4072
- declare function reactiveLog<T>(initial?: readonly T[], options?: ReactiveLogOptions): ReactiveLogBundle<T>;
5127
+ declare function reactiveLog<T>(initial?: readonly T[], options?: ReactiveLogOptions<T>): ReactiveLogBundle<T>;
5128
+
4073
5129
  /**
4074
- * Builds a derived node for `entries.slice(start, stop)` (same semantics as `Array.prototype.slice`; `stop` exclusive).
5130
+ * Creates a resettable deadline timer for internal timeout, retry, and rate-limiting use.
5131
+ *
5132
+ * @remarks **Centralised primitive:** wraps `setTimeout`/`clearTimeout` with a generation guard
5133
+ * so that stale callbacks never fire after `cancel()` or a new `start()`.
4075
5134
  *
4076
- * @param log - Log from {@link reactiveLog}.
4077
- * @param start - Start index (must be `>= 0`).
4078
- * @param stop - End index (exclusive); omit to slice to the end.
4079
- * @returns Derived node emitting the sliced readonly array.
5135
+ * @remarks **Spec §5.10 exception:** resilience operators (`timeout`, `retry`, `rateLimiter`)
5136
+ * need raw timers `fromTimer` creates a new Node per reset, which is too heavy here.
5137
+ * Lives in `src/extra/` (not `src/core/`) because it is a documented escape hatch from
5138
+ * the protocol-pure core layer.
4080
5139
  *
4081
5140
  * @example
4082
5141
  * ```ts
4083
- * import { reactiveLog, logSlice } from "@graphrefly/graphrefly-ts";
5142
+ * import { ResettableTimer } from "@graphrefly/graphrefly-ts";
4084
5143
  *
4085
- * const lg = reactiveLog<number>([10, 20, 30, 40, 50]);
4086
- * const slice$ = logSlice(lg, 1, 4); // reactive view of [20, 30, 40]
4087
- * slice$.subscribe((msgs) => console.log(msgs));
4088
- *
4089
- * lg.append(60); // slice$ now reflects [20, 30, 40] (indices 1–3 of updated log)
5144
+ * const timer = new ResettableTimer();
5145
+ * timer.start(1000, () => console.log("fired"));
5146
+ * timer.cancel(); // cancels before firing
5147
+ * timer.start(500, () => console.log("new deadline"));
5148
+ * console.log(timer.pending); // true
4090
5149
  * ```
4091
5150
  *
4092
5151
  * @category extra
4093
5152
  */
4094
- declare function logSlice<T>(log: ReactiveLogBundle<T>, start: number, stop?: number): Node<readonly T[]>;
5153
+ declare class ResettableTimer {
5154
+ private _timer;
5155
+ private _gen;
5156
+ /** Schedule callback after delayMs. Cancels any pending timer. */
5157
+ start(delayMs: number, callback: () => void): void;
5158
+ /** Cancel the pending timer (if any). */
5159
+ cancel(): void;
5160
+ /** Whether a timer is currently pending. */
5161
+ get pending(): boolean;
5162
+ }
4095
5163
 
4096
5164
  /**
4097
5165
  * WorkerTransport — normalized message channel for all worker types.
@@ -4301,6 +5369,7 @@ declare function workerSelf<TImport extends readonly string[]>(target: unknown |
4301
5369
  * Extra layer: operators, sources, sinks (Phase 2+).
4302
5370
  */
4303
5371
 
5372
+ type index_AckableMessage<T> = AckableMessage<T>;
4304
5373
  type index_AdapterHandlers<T> = AdapterHandlers<T>;
4305
5374
  type index_AsyncSourceOpts = AsyncSourceOpts;
4306
5375
  type index_BackoffPreset = BackoffPreset;
@@ -4308,12 +5377,11 @@ type index_BackoffStrategy = BackoffStrategy;
4308
5377
  type index_BatchMessage = BatchMessage;
4309
5378
  type index_BridgeMessage = BridgeMessage;
4310
5379
  type index_BufferedSinkHandle = BufferedSinkHandle;
5380
+ type index_BundleTriad<TChannels extends Record<string, unknown>> = BundleTriad<TChannels>;
4311
5381
  type index_CSVRow = CSVRow;
4312
5382
  type index_CacheEvictionPolicy<K> = CacheEvictionPolicy<K>;
4313
- type index_CacheTier<V> = CacheTier<V>;
4314
5383
  type index_CascadingCache<V> = CascadingCache<V>;
4315
5384
  type index_CascadingCacheOptions = CascadingCacheOptions;
4316
- type index_CheckpointAdapter = CheckpointAdapter;
4317
5385
  type index_CheckpointToRedisOptions = CheckpointToRedisOptions;
4318
5386
  type index_CheckpointToS3Options = CheckpointToS3Options;
4319
5387
  type index_CircuitBreaker = CircuitBreaker;
@@ -4325,19 +5393,19 @@ type index_ClickHouseClientLike = ClickHouseClientLike;
4325
5393
  type index_ClickHouseInsertClientLike = ClickHouseInsertClientLike;
4326
5394
  type index_ClickHouseRow = ClickHouseRow;
4327
5395
  type index_CronSchedule = CronSchedule;
4328
- type index_DictCheckpointAdapter = DictCheckpointAdapter;
4329
- declare const index_DictCheckpointAdapter: typeof DictCheckpointAdapter;
4330
5396
  type index_DistillBundle<TMem> = DistillBundle<TMem>;
4331
5397
  type index_DistillOptions<TMem> = DistillOptions<TMem>;
4332
5398
  type index_DrizzleQueryLike<T = unknown> = DrizzleQueryLike<T>;
5399
+ type index_EmitTriad<T> = EmitTriad<T>;
4333
5400
  type index_ErrorMessage = ErrorMessage;
4334
5401
  type index_EventTargetLike = EventTargetLike;
4335
5402
  type index_ExponentialBackoffOptions = ExponentialBackoffOptions;
5403
+ type index_ExternalBundleOptions<TChannels extends Record<string, unknown>> = ExternalBundleOptions<TChannels>;
5404
+ type index_ExternalRegister<H> = ExternalRegister<H>;
4336
5405
  type index_Extraction<TMem> = Extraction<TMem>;
4337
5406
  type index_FSEvent = FSEvent;
4338
5407
  type index_FSEventType = FSEventType;
4339
- type index_FileCheckpointAdapter = FileCheckpointAdapter;
4340
- declare const index_FileCheckpointAdapter: typeof FileCheckpointAdapter;
5408
+ type index_FallbackInput<T> = FallbackInput<T>;
4341
5409
  type index_FileWriterLike = FileWriterLike;
4342
5410
  type index_FromCSVOptions = FromCSVOptions;
4343
5411
  type index_FromClickHouseWatchOptions = FromClickHouseWatchOptions;
@@ -4346,6 +5414,8 @@ type index_FromDrizzleOptions<T, U = T> = FromDrizzleOptions<T, U>;
4346
5414
  type index_FromFSWatchOptions = FromFSWatchOptions;
4347
5415
  type index_FromGitHookOptions = FromGitHookOptions;
4348
5416
  type index_FromHTTPOptions = FromHTTPOptions;
5417
+ type index_FromHTTPPollOptions = FromHTTPPollOptions;
5418
+ type index_FromHTTPStreamOptions = FromHTTPStreamOptions;
4349
5419
  type index_FromKafkaOptions = FromKafkaOptions;
4350
5420
  type index_FromKyselyOptions<T, U = T> = FromKyselyOptions<T, U>;
4351
5421
  type index_FromMCPOptions = FromMCPOptions;
@@ -4357,25 +5427,29 @@ type index_FromPrometheusOptions = FromPrometheusOptions;
4357
5427
  type index_FromPulsarOptions = FromPulsarOptions;
4358
5428
  type index_FromRabbitMQOptions = FromRabbitMQOptions;
4359
5429
  type index_FromRedisStreamOptions = FromRedisStreamOptions;
5430
+ type index_FromSSEOptions<T = string> = FromSSEOptions<T>;
4360
5431
  type index_FromSqliteOptions<T> = FromSqliteOptions<T>;
4361
5432
  type index_FromStatsDOptions = FromStatsDOptions;
4362
5433
  type index_FromSyslogOptions = FromSyslogOptions;
5434
+ type index_FromWebSocketReconnectOptions<T> = FromWebSocketReconnectOptions<T>;
4363
5435
  type index_GitEvent = GitEvent;
4364
5436
  type index_GitHookType = GitHookType;
4365
5437
  type index_HTTPBundle<T> = HTTPBundle<T>;
5438
+ type index_IndexBackend<K, V = unknown> = IndexBackend<K, V>;
4366
5439
  type index_IndexRow<K, V = unknown> = IndexRow<K, V>;
4367
- type index_IndexedDbCheckpointSpec = IndexedDbCheckpointSpec;
5440
+ declare const index_IndexedDbStorageSpec: typeof IndexedDbStorageSpec;
4368
5441
  type index_InitMessage = InitMessage;
4369
5442
  type index_JitterMode = JitterMode;
4370
5443
  type index_KafkaConsumerLike = KafkaConsumerLike;
4371
5444
  type index_KafkaMessage<T = unknown> = KafkaMessage<T>;
4372
5445
  type index_KafkaProducerLike = KafkaProducerLike;
4373
5446
  type index_KyselyQueryLike<T = unknown> = KyselyQueryLike<T>;
5447
+ type index_ListBackend<T> = ListBackend<T>;
5448
+ type index_LogBackend<T> = LogBackend<T>;
4374
5449
  type index_LokiClientLike = LokiClientLike;
4375
5450
  type index_LokiStream = LokiStream;
4376
5451
  type index_MCPClientLike = MCPClientLike;
4377
- type index_MemoryCheckpointAdapter = MemoryCheckpointAdapter;
4378
- declare const index_MemoryCheckpointAdapter: typeof MemoryCheckpointAdapter;
5452
+ type index_MapBackend<K, V> = MapBackend<K, V>;
4379
5453
  type index_MergeMapOptions = MergeMapOptions;
4380
5454
  type index_MongoCollectionLike = MongoCollectionLike;
4381
5455
  type index_NATSClientLike = NATSClientLike;
@@ -4383,6 +5457,17 @@ type index_NATSMessage<T = unknown> = NATSMessage<T>;
4383
5457
  type index_NATSSubscriptionLike = NATSSubscriptionLike;
4384
5458
  declare const index_NS_PER_MS: typeof NS_PER_MS;
4385
5459
  declare const index_NS_PER_SEC: typeof NS_PER_SEC;
5460
+ type index_NativeIndexBackend<K, V = unknown> = NativeIndexBackend<K, V>;
5461
+ declare const index_NativeIndexBackend: typeof NativeIndexBackend;
5462
+ type index_NativeListBackend<T> = NativeListBackend<T>;
5463
+ declare const index_NativeListBackend: typeof NativeListBackend;
5464
+ type index_NativeLogBackend<T> = NativeLogBackend<T>;
5465
+ declare const index_NativeLogBackend: typeof NativeLogBackend;
5466
+ type index_NativeMapBackend<K, V> = NativeMapBackend<K, V>;
5467
+ declare const index_NativeMapBackend: typeof NativeMapBackend;
5468
+ type index_NativeMapBackendOptions = NativeMapBackendOptions;
5469
+ type index_NativePubSubBackend = NativePubSubBackend;
5470
+ declare const index_NativePubSubBackend: typeof NativePubSubBackend;
4386
5471
  type index_NodeInput<T> = NodeInput<T>;
4387
5472
  type index_OTelBundle = OTelBundle;
4388
5473
  type index_OTelLog = OTelLog;
@@ -4392,48 +5477,64 @@ type index_OTelSpan = OTelSpan;
4392
5477
  type index_PostgresClientLike = PostgresClientLike;
4393
5478
  type index_PrismaModelLike<T = unknown> = PrismaModelLike<T>;
4394
5479
  type index_PrometheusMetric = PrometheusMetric;
5480
+ type index_PubSubBackend = PubSubBackend;
4395
5481
  type index_PubSubHub = PubSubHub;
5482
+ type index_PubSubHubOptions = PubSubHubOptions;
4396
5483
  type index_PulsarConsumerLike = PulsarConsumerLike;
4397
5484
  type index_PulsarMessage<T = unknown> = PulsarMessage<T>;
4398
5485
  type index_PulsarProducerLike = PulsarProducerLike;
4399
5486
  type index_RabbitMQChannelLike = RabbitMQChannelLike;
4400
5487
  type index_RabbitMQMessage<T = unknown> = RabbitMQMessage<T>;
5488
+ type index_RateLimiterOptions = RateLimiterOptions;
5489
+ type index_RateLimiterOverflowError = RateLimiterOverflowError;
5490
+ declare const index_RateLimiterOverflowError: typeof RateLimiterOverflowError;
5491
+ type index_RateLimiterOverflowPolicy = RateLimiterOverflowPolicy;
4401
5492
  type index_ReactiveCounterBundle = ReactiveCounterBundle;
4402
5493
  type index_ReactiveIndexBundle<K, V = unknown> = ReactiveIndexBundle<K, V>;
4403
- type index_ReactiveIndexOptions = ReactiveIndexOptions;
5494
+ type index_ReactiveIndexOptions<K, V = unknown> = ReactiveIndexOptions<K, V>;
4404
5495
  type index_ReactiveListBundle<T> = ReactiveListBundle<T>;
4405
- type index_ReactiveListOptions = ReactiveListOptions;
5496
+ type index_ReactiveListOptions<T> = ReactiveListOptions<T>;
4406
5497
  type index_ReactiveLogBundle<T> = ReactiveLogBundle<T>;
4407
- type index_ReactiveLogOptions = ReactiveLogOptions;
5498
+ type index_ReactiveLogOptions<T> = ReactiveLogOptions<T>;
4408
5499
  type index_ReactiveMapBundle<K, V> = ReactiveMapBundle<K, V>;
4409
- type index_ReactiveMapOptions = ReactiveMapOptions;
5500
+ type index_ReactiveMapOptions<K, V> = ReactiveMapOptions<K, V>;
5501
+ type index_ReactiveSinkBackpressureOptions = ReactiveSinkBackpressureOptions;
5502
+ type index_ReactiveSinkConfig<T, Ctx = unknown> = ReactiveSinkConfig<T, Ctx>;
5503
+ type index_ReactiveSinkHandle<T> = ReactiveSinkHandle<T>;
5504
+ type index_ReactiveSinkOptions<T> = ReactiveSinkOptions<T>;
5505
+ type index_ReactiveSinkRetryOptions = ReactiveSinkRetryOptions;
4410
5506
  type index_ReadyMessage = ReadyMessage;
4411
5507
  type index_RedisCheckpointClientLike = RedisCheckpointClientLike;
4412
5508
  type index_RedisClientLike = RedisClientLike;
4413
5509
  type index_RedisStreamEntry<T = unknown> = RedisStreamEntry<T>;
5510
+ type index_ResettableTimer = ResettableTimer;
5511
+ declare const index_ResettableTimer: typeof ResettableTimer;
4414
5512
  type index_RetryOptions = RetryOptions;
5513
+ type index_RetrySourceOptions<T> = RetrySourceOptions<T>;
4415
5514
  type index_S3ClientLike = S3ClientLike;
5515
+ type index_SSEEvent<T = string> = SSEEvent<T>;
4416
5516
  type index_SignalMessage = SignalMessage;
5517
+ type index_SinkFailure<T> = SinkFailure<T>;
4417
5518
  type index_SinkHandle = SinkHandle;
4418
5519
  type index_SinkTransportError = SinkTransportError;
4419
- type index_SqliteCheckpointAdapter = SqliteCheckpointAdapter;
4420
- declare const index_SqliteCheckpointAdapter: typeof SqliteCheckpointAdapter;
4421
5520
  type index_SqliteDbLike = SqliteDbLike;
5521
+ type index_SqliteIterableDbLike = SqliteIterableDbLike;
4422
5522
  type index_StatsDMetric = StatsDMetric;
4423
5523
  type index_StatsDRegister = StatsDRegister;
4424
5524
  type index_StatusValue = StatusValue;
5525
+ declare const index_StorageHandle: typeof StorageHandle;
5526
+ declare const index_StorageTier: typeof StorageTier;
4425
5527
  type index_SyslogMessage = SyslogMessage;
4426
5528
  type index_SyslogRegister = SyslogRegister;
4427
5529
  type index_TapObserver<T> = TapObserver<T>;
4428
5530
  type index_TempoClientLike = TempoClientLike;
4429
5531
  type index_ThrottleOptions = ThrottleOptions;
4430
- type index_TieredStorage = TieredStorage;
4431
- type index_TieredStorageOptions = TieredStorageOptions;
4432
5532
  type index_TimeoutError = TimeoutError;
4433
5533
  declare const index_TimeoutError: typeof TimeoutError;
4434
5534
  type index_ToCSVOptions<T> = ToCSVOptions<T>;
4435
5535
  type index_ToClickHouseOptions<T> = ToClickHouseOptions<T>;
4436
5536
  type index_ToFileOptions<T> = ToFileOptions<T>;
5537
+ type index_ToHTTPOptions<T> = ToHTTPOptions<T>;
4437
5538
  type index_ToKafkaOptions<T> = ToKafkaOptions<T>;
4438
5539
  type index_ToLokiOptions<T> = ToLokiOptions<T>;
4439
5540
  type index_ToMongoOptions<T> = ToMongoOptions<T>;
@@ -4448,8 +5549,8 @@ type index_ToSSEOptions = ToSSEOptions;
4448
5549
  type index_ToSqliteOptions<T> = ToSqliteOptions<T>;
4449
5550
  type index_ToTempoOptions<T> = ToTempoOptions<T>;
4450
5551
  type index_ToWebSocketOptions<T> = ToWebSocketOptions<T>;
4451
- type index_ToWebSocketTransportError = ToWebSocketTransportError;
4452
5552
  type index_TokenBucket = TokenBucket;
5553
+ type index_UpsertOptions<K, V> = UpsertOptions<K, V>;
4453
5554
  type index_ValueMessage = ValueMessage;
4454
5555
  type index_VerifiableBundle<T, TVerify = VerifyValue> = VerifiableBundle<T, TVerify>;
4455
5556
  type index_VerifiableOptions<TVerify = VerifyValue> = VerifiableOptions<TVerify>;
@@ -4471,11 +5572,9 @@ declare const index_audit: typeof audit;
4471
5572
  declare const index_buffer: typeof buffer;
4472
5573
  declare const index_bufferCount: typeof bufferCount;
4473
5574
  declare const index_bufferTime: typeof bufferTime;
4474
- declare const index_cache: typeof cache;
4475
5575
  declare const index_cached: typeof cached;
4476
5576
  declare const index_cascadingCache: typeof cascadingCache;
4477
5577
  declare const index_catchError: typeof catchError;
4478
- declare const index_checkpointNodeValue: typeof checkpointNodeValue;
4479
5578
  declare const index_checkpointToRedis: typeof checkpointToRedis;
4480
5579
  declare const index_checkpointToS3: typeof checkpointToS3;
4481
5580
  declare const index_circuitBreaker: typeof circuitBreaker;
@@ -4486,11 +5585,13 @@ declare const index_concatMap: typeof concatMap;
4486
5585
  declare const index_constant: typeof constant;
4487
5586
  declare const index_createTransport: typeof createTransport;
4488
5587
  declare const index_createWatermarkController: typeof createWatermarkController;
5588
+ declare const index_csvRows: typeof csvRows;
4489
5589
  declare const index_debounce: typeof debounce;
4490
5590
  declare const index_debounceTime: typeof debounceTime;
4491
5591
  declare const index_decorrelatedJitter: typeof decorrelatedJitter;
4492
5592
  declare const index_delay: typeof delay;
4493
5593
  declare const index_deserializeError: typeof deserializeError;
5594
+ declare const index_dictStorage: typeof dictStorage;
4494
5595
  declare const index_distill: typeof distill;
4495
5596
  declare const index_distinctUntilChanged: typeof distinctUntilChanged;
4496
5597
  declare const index_elementAt: typeof elementAt;
@@ -4498,8 +5599,11 @@ declare const index_empty: typeof empty;
4498
5599
  declare const index_escapeRegexChar: typeof escapeRegexChar;
4499
5600
  declare const index_exhaustMap: typeof exhaustMap;
4500
5601
  declare const index_exponential: typeof exponential;
5602
+ declare const index_externalBundle: typeof externalBundle;
5603
+ declare const index_externalProducer: typeof externalProducer;
4501
5604
  declare const index_fallback: typeof fallback;
4502
5605
  declare const index_fibonacci: typeof fibonacci;
5606
+ declare const index_fileStorage: typeof fileStorage;
4503
5607
  declare const index_filter: typeof filter;
4504
5608
  declare const index_find: typeof find;
4505
5609
  declare const index_first: typeof first;
@@ -4517,6 +5621,8 @@ declare const index_fromEvent: typeof fromEvent;
4517
5621
  declare const index_fromFSWatch: typeof fromFSWatch;
4518
5622
  declare const index_fromGitHook: typeof fromGitHook;
4519
5623
  declare const index_fromHTTP: typeof fromHTTP;
5624
+ declare const index_fromHTTPPoll: typeof fromHTTPPoll;
5625
+ declare const index_fromHTTPStream: typeof fromHTTPStream;
4520
5626
  declare const index_fromIDBRequest: typeof fromIDBRequest;
4521
5627
  declare const index_fromIDBTransaction: typeof fromIDBTransaction;
4522
5628
  declare const index_fromIter: typeof fromIter;
@@ -4532,25 +5638,30 @@ declare const index_fromPromise: typeof fromPromise;
4532
5638
  declare const index_fromPulsar: typeof fromPulsar;
4533
5639
  declare const index_fromRabbitMQ: typeof fromRabbitMQ;
4534
5640
  declare const index_fromRedisStream: typeof fromRedisStream;
5641
+ declare const index_fromSSE: typeof fromSSE;
4535
5642
  declare const index_fromSqlite: typeof fromSqlite;
5643
+ declare const index_fromSqliteCursor: typeof fromSqliteCursor;
4536
5644
  declare const index_fromStatsD: typeof fromStatsD;
4537
5645
  declare const index_fromSyslog: typeof fromSyslog;
4538
5646
  declare const index_fromTimer: typeof fromTimer;
4539
5647
  declare const index_fromWebSocket: typeof fromWebSocket;
5648
+ declare const index_fromWebSocketReconnect: typeof fromWebSocketReconnect;
4540
5649
  declare const index_fromWebhook: typeof fromWebhook;
4541
5650
  declare const index_globToRegExp: typeof globToRegExp;
5651
+ declare const index_indexedDbStorage: typeof indexedDbStorage;
4542
5652
  declare const index_interval: typeof interval;
4543
5653
  declare const index_keepalive: typeof keepalive;
4544
5654
  declare const index_last: typeof last;
4545
5655
  declare const index_linear: typeof linear;
4546
- declare const index_logSlice: typeof logSlice;
4547
5656
  declare const index_lru: typeof lru;
4548
5657
  declare const index_map: typeof map;
4549
5658
  declare const index_matchesAnyPattern: typeof matchesAnyPattern;
4550
5659
  declare const index_matchesCron: typeof matchesCron;
5660
+ declare const index_memoryStorage: typeof memoryStorage;
4551
5661
  declare const index_merge: typeof merge;
4552
5662
  declare const index_mergeMap: typeof mergeMap;
4553
5663
  declare const index_nameToSignal: typeof nameToSignal;
5664
+ declare const index_ndjsonRows: typeof ndjsonRows;
4554
5665
  declare const index_never: typeof never;
4555
5666
  declare const index_of: typeof of;
4556
5667
  declare const index_pairwise: typeof pairwise;
@@ -4567,23 +5678,22 @@ declare const index_reactiveIndex: typeof reactiveIndex;
4567
5678
  declare const index_reactiveList: typeof reactiveList;
4568
5679
  declare const index_reactiveLog: typeof reactiveLog;
4569
5680
  declare const index_reactiveMap: typeof reactiveMap;
5681
+ declare const index_reactiveSink: typeof reactiveSink;
4570
5682
  declare const index_reduce: typeof reduce;
4571
5683
  declare const index_repeat: typeof repeat;
4572
5684
  declare const index_replay: typeof replay;
4573
5685
  declare const index_rescue: typeof rescue;
4574
5686
  declare const index_resolveBackoffPreset: typeof resolveBackoffPreset;
4575
- declare const index_restoreGraphCheckpoint: typeof restoreGraphCheckpoint;
4576
- declare const index_restoreGraphCheckpointIndexedDb: typeof restoreGraphCheckpointIndexedDb;
4577
5687
  declare const index_retry: typeof retry;
5688
+ declare const index_retrySource: typeof retrySource;
4578
5689
  declare const index_sample: typeof sample;
4579
- declare const index_saveGraphCheckpoint: typeof saveGraphCheckpoint;
4580
- declare const index_saveGraphCheckpointIndexedDb: typeof saveGraphCheckpointIndexedDb;
4581
5690
  declare const index_scan: typeof scan;
4582
5691
  declare const index_serializeError: typeof serializeError;
4583
5692
  declare const index_share: typeof share;
4584
5693
  declare const index_shareReplay: typeof shareReplay;
4585
5694
  declare const index_signalToName: typeof signalToName;
4586
5695
  declare const index_skip: typeof skip;
5696
+ declare const index_sqliteStorage: typeof sqliteStorage;
4587
5697
  declare const index_switchMap: typeof switchMap;
4588
5698
  declare const index_take: typeof take;
4589
5699
  declare const index_takeUntil: typeof takeUntil;
@@ -4592,12 +5702,12 @@ declare const index_tap: typeof tap;
4592
5702
  declare const index_throttle: typeof throttle;
4593
5703
  declare const index_throttleTime: typeof throttleTime;
4594
5704
  declare const index_throwError: typeof throwError;
4595
- declare const index_tieredStorage: typeof tieredStorage;
4596
5705
  declare const index_timeout: typeof timeout;
4597
5706
  declare const index_toArray: typeof toArray;
4598
5707
  declare const index_toCSV: typeof toCSV;
4599
5708
  declare const index_toClickHouse: typeof toClickHouse;
4600
5709
  declare const index_toFile: typeof toFile;
5710
+ declare const index_toHTTP: typeof toHTTP;
4601
5711
  declare const index_toKafka: typeof toKafka;
4602
5712
  declare const index_toLoki: typeof toLoki;
4603
5713
  declare const index_toMongo: typeof toMongo;
@@ -4606,14 +5716,15 @@ declare const index_toObservable: typeof toObservable;
4606
5716
  declare const index_toPostgres: typeof toPostgres;
4607
5717
  declare const index_toPulsar: typeof toPulsar;
4608
5718
  declare const index_toRabbitMQ: typeof toRabbitMQ;
5719
+ declare const index_toReadableStream: typeof toReadableStream;
4609
5720
  declare const index_toRedisStream: typeof toRedisStream;
4610
5721
  declare const index_toS3: typeof toS3;
4611
5722
  declare const index_toSSE: typeof toSSE;
5723
+ declare const index_toSSEBytes: typeof toSSEBytes;
4612
5724
  declare const index_toSqlite: typeof toSqlite;
4613
5725
  declare const index_toTempo: typeof toTempo;
4614
5726
  declare const index_toWebSocket: typeof toWebSocket;
4615
5727
  declare const index_tokenBucket: typeof tokenBucket;
4616
- declare const index_tokenTracker: typeof tokenTracker;
4617
5728
  declare const index_valve: typeof valve;
4618
5729
  declare const index_verifiable: typeof verifiable;
4619
5730
  declare const index_window: typeof window;
@@ -4627,7 +5738,7 @@ declare const index_workerBridge: typeof workerBridge;
4627
5738
  declare const index_workerSelf: typeof workerSelf;
4628
5739
  declare const index_zip: typeof zip;
4629
5740
  declare namespace index {
4630
- export { type index_AdapterHandlers as AdapterHandlers, type index_AsyncSourceOpts as AsyncSourceOpts, type index_BackoffPreset as BackoffPreset, type index_BackoffStrategy as BackoffStrategy, type index_BatchMessage as BatchMessage, type index_BridgeMessage as BridgeMessage, type index_BufferedSinkHandle as BufferedSinkHandle, type index_CSVRow as CSVRow, type index_CacheEvictionPolicy as CacheEvictionPolicy, type index_CacheTier as CacheTier, type index_CascadingCache as CascadingCache, type index_CascadingCacheOptions as CascadingCacheOptions, type index_CheckpointAdapter as CheckpointAdapter, type index_CheckpointToRedisOptions as CheckpointToRedisOptions, type index_CheckpointToS3Options as CheckpointToS3Options, type index_CircuitBreaker as CircuitBreaker, type index_CircuitBreakerOptions as CircuitBreakerOptions, index_CircuitOpenError as CircuitOpenError, type index_CircuitState as CircuitState, type index_ClickHouseClientLike as ClickHouseClientLike, type index_ClickHouseInsertClientLike as ClickHouseInsertClientLike, type index_ClickHouseRow as ClickHouseRow, type index_CronSchedule as CronSchedule, index_DictCheckpointAdapter as DictCheckpointAdapter, type index_DistillBundle as DistillBundle, type index_DistillOptions as DistillOptions, type index_DrizzleQueryLike as DrizzleQueryLike, type index_ErrorMessage as ErrorMessage, type index_EventTargetLike as EventTargetLike, type index_ExponentialBackoffOptions as ExponentialBackoffOptions, type index_Extraction as Extraction, type index_FSEvent as FSEvent, type index_FSEventType as FSEventType, index_FileCheckpointAdapter as FileCheckpointAdapter, type index_FileWriterLike as FileWriterLike, type index_FromCSVOptions as FromCSVOptions, type index_FromClickHouseWatchOptions as FromClickHouseWatchOptions, type index_FromCronOptions as FromCronOptions, type index_FromDrizzleOptions as FromDrizzleOptions, type index_FromFSWatchOptions as FromFSWatchOptions, type index_FromGitHookOptions as FromGitHookOptions, type index_FromHTTPOptions as FromHTTPOptions, type index_FromKafkaOptions as FromKafkaOptions, type index_FromKyselyOptions as FromKyselyOptions, type index_FromMCPOptions as FromMCPOptions, type index_FromNATSOptions as FromNATSOptions, type index_FromNDJSONOptions as FromNDJSONOptions, type index_FromOTelOptions as FromOTelOptions, type index_FromPrismaOptions as FromPrismaOptions, type index_FromPrometheusOptions as FromPrometheusOptions, type index_FromPulsarOptions as FromPulsarOptions, type index_FromRabbitMQOptions as FromRabbitMQOptions, type index_FromRedisStreamOptions as FromRedisStreamOptions, type index_FromSqliteOptions as FromSqliteOptions, type index_FromStatsDOptions as FromStatsDOptions, type index_FromSyslogOptions as FromSyslogOptions, type index_GitEvent as GitEvent, type index_GitHookType as GitHookType, type index_HTTPBundle as HTTPBundle, type index_IndexRow as IndexRow, type index_IndexedDbCheckpointSpec as IndexedDbCheckpointSpec, type index_InitMessage as InitMessage, type index_JitterMode as JitterMode, type index_KafkaConsumerLike as KafkaConsumerLike, type index_KafkaMessage as KafkaMessage, type index_KafkaProducerLike as KafkaProducerLike, type index_KyselyQueryLike as KyselyQueryLike, type index_LokiClientLike as LokiClientLike, type index_LokiStream as LokiStream, type index_MCPClientLike as MCPClientLike, index_MemoryCheckpointAdapter as MemoryCheckpointAdapter, type index_MergeMapOptions as MergeMapOptions, type index_MongoCollectionLike as MongoCollectionLike, type index_NATSClientLike as NATSClientLike, type index_NATSMessage as NATSMessage, type index_NATSSubscriptionLike as NATSSubscriptionLike, index_NS_PER_MS as NS_PER_MS, index_NS_PER_SEC as NS_PER_SEC, type index_NodeInput as NodeInput, type index_OTelBundle as OTelBundle, type index_OTelLog as OTelLog, type index_OTelMetric as OTelMetric, type index_OTelRegister as OTelRegister, type index_OTelSpan as OTelSpan, type index_PostgresClientLike as PostgresClientLike, type index_PrismaModelLike as PrismaModelLike, type index_PrometheusMetric as PrometheusMetric, type index_PubSubHub as PubSubHub, type index_PulsarConsumerLike as PulsarConsumerLike, type index_PulsarMessage as PulsarMessage, type index_PulsarProducerLike as PulsarProducerLike, type index_RabbitMQChannelLike as RabbitMQChannelLike, type index_RabbitMQMessage as RabbitMQMessage, type index_ReactiveCounterBundle as ReactiveCounterBundle, type index_ReactiveIndexBundle as ReactiveIndexBundle, type index_ReactiveIndexOptions as ReactiveIndexOptions, type index_ReactiveListBundle as ReactiveListBundle, type index_ReactiveListOptions as ReactiveListOptions, type index_ReactiveLogBundle as ReactiveLogBundle, type index_ReactiveLogOptions as ReactiveLogOptions, type index_ReactiveMapBundle as ReactiveMapBundle, type index_ReactiveMapOptions as ReactiveMapOptions, type index_ReadyMessage as ReadyMessage, type index_RedisCheckpointClientLike as RedisCheckpointClientLike, type index_RedisClientLike as RedisClientLike, type index_RedisStreamEntry as RedisStreamEntry, type index_RetryOptions as RetryOptions, type index_S3ClientLike as S3ClientLike, type index_SignalMessage as SignalMessage, type index_SinkHandle as SinkHandle, type index_SinkTransportError as SinkTransportError, index_SqliteCheckpointAdapter as SqliteCheckpointAdapter, type index_SqliteDbLike as SqliteDbLike, type index_StatsDMetric as StatsDMetric, type index_StatsDRegister as StatsDRegister, type index_StatusValue as StatusValue, type index_SyslogMessage as SyslogMessage, type index_SyslogRegister as SyslogRegister, type index_TapObserver as TapObserver, type index_TempoClientLike as TempoClientLike, type index_ThrottleOptions as ThrottleOptions, type index_TieredStorage as TieredStorage, type index_TieredStorageOptions as TieredStorageOptions, index_TimeoutError as TimeoutError, type index_ToCSVOptions as ToCSVOptions, type index_ToClickHouseOptions as ToClickHouseOptions, type index_ToFileOptions as ToFileOptions, type index_ToKafkaOptions as ToKafkaOptions, type index_ToLokiOptions as ToLokiOptions, type index_ToMongoOptions as ToMongoOptions, type index_ToNATSOptions as ToNATSOptions, index_ToObservableOptions as ToObservableOptions, type index_ToPostgresOptions as ToPostgresOptions, type index_ToPulsarOptions as ToPulsarOptions, type index_ToRabbitMQOptions as ToRabbitMQOptions, type index_ToRedisStreamOptions as ToRedisStreamOptions, type index_ToS3Options as ToS3Options, type index_ToSSEOptions as ToSSEOptions, type index_ToSqliteOptions as ToSqliteOptions, type index_ToTempoOptions as ToTempoOptions, type index_ToWebSocketOptions as ToWebSocketOptions, type index_ToWebSocketTransportError as ToWebSocketTransportError, type index_TokenBucket as TokenBucket, type index_ValueMessage as ValueMessage, type index_VerifiableBundle as VerifiableBundle, type index_VerifiableOptions as VerifiableOptions, type index_VerifyValue as VerifyValue, type index_WatermarkController as WatermarkController, type index_WatermarkOptions as WatermarkOptions, type index_WebSocketLike as WebSocketLike, type index_WebSocketMessageEventLike as WebSocketMessageEventLike, type index_WebSocketRegister as WebSocketRegister, type index_WebhookRegister as WebhookRegister, type index_WithBreakerBundle as WithBreakerBundle, type index_WithStatusBundle as WithStatusBundle, type index_WorkerBridge as WorkerBridge, type index_WorkerBridgeOptions as WorkerBridgeOptions, type index_WorkerSelfHandle as WorkerSelfHandle, type index_WorkerSelfOptions as WorkerSelfOptions, type index_WorkerTransport as WorkerTransport, index_audit as audit, index_buffer as buffer, index_bufferCount as bufferCount, index_bufferTime as bufferTime, index_cache as cache, index_cached as cached, index_cascadingCache as cascadingCache, index_catchError as catchError, index_checkpointNodeValue as checkpointNodeValue, index_checkpointToRedis as checkpointToRedis, index_checkpointToS3 as checkpointToS3, index_circuitBreaker as circuitBreaker, index_combine as combine, index_combineLatest as combineLatest, index_concat as concat, index_concatMap as concatMap, index_constant as constant, index_createTransport as createTransport, index_createWatermarkController as createWatermarkController, index_debounce as debounce, index_debounceTime as debounceTime, index_decorrelatedJitter as decorrelatedJitter, index_delay as delay, index_deserializeError as deserializeError, index_distill as distill, index_distinctUntilChanged as distinctUntilChanged, index_elementAt as elementAt, index_empty as empty, index_escapeRegexChar as escapeRegexChar, index_exhaustMap as exhaustMap, index_exponential as exponential, index_fallback as fallback, index_fibonacci as fibonacci, index_filter as filter, index_find as find, index_first as first, index_firstValueFrom as firstValueFrom, index_firstWhere as firstWhere, index_flatMap as flatMap, index_forEach as forEach, index_fromAny as fromAny, index_fromAsyncIter as fromAsyncIter, index_fromCSV as fromCSV, index_fromClickHouseWatch as fromClickHouseWatch, index_fromCron as fromCron, index_fromDrizzle as fromDrizzle, index_fromEvent as fromEvent, index_fromFSWatch as fromFSWatch, index_fromGitHook as fromGitHook, index_fromHTTP as fromHTTP, index_fromIDBRequest as fromIDBRequest, index_fromIDBTransaction as fromIDBTransaction, index_fromIter as fromIter, index_fromKafka as fromKafka, index_fromKysely as fromKysely, index_fromMCP as fromMCP, index_fromNATS as fromNATS, index_fromNDJSON as fromNDJSON, index_fromOTel as fromOTel, index_fromPrisma as fromPrisma, index_fromPrometheus as fromPrometheus, index_fromPromise as fromPromise, index_fromPulsar as fromPulsar, index_fromRabbitMQ as fromRabbitMQ, index_fromRedisStream as fromRedisStream, index_fromSqlite as fromSqlite, index_fromStatsD as fromStatsD, index_fromSyslog as fromSyslog, index_fromTimer as fromTimer, index_fromWebSocket as fromWebSocket, index_fromWebhook as fromWebhook, index_globToRegExp as globToRegExp, index_interval as interval, index_keepalive as keepalive, index_last as last, index_linear as linear, index_logSlice as logSlice, index_lru as lru, index_map as map, index_matchesAnyPattern as matchesAnyPattern, index_matchesCron as matchesCron, index_merge as merge, index_mergeMap as mergeMap, index_nameToSignal as nameToSignal, index_never as never, index_of as of, index_pairwise as pairwise, index_parseCron as parseCron, index_parsePrometheusText as parsePrometheusText, index_parseStatsD as parseStatsD, index_parseSyslog as parseSyslog, index_pausable as pausable, index_pubsub as pubsub, index_race as race, index_rateLimiter as rateLimiter, index_reactiveCounter as reactiveCounter, index_reactiveIndex as reactiveIndex, index_reactiveList as reactiveList, index_reactiveLog as reactiveLog, index_reactiveMap as reactiveMap, index_reduce as reduce, index_repeat as repeat, index_replay as replay, index_rescue as rescue, index_resolveBackoffPreset as resolveBackoffPreset, index_restoreGraphCheckpoint as restoreGraphCheckpoint, index_restoreGraphCheckpointIndexedDb as restoreGraphCheckpointIndexedDb, index_retry as retry, index_sample as sample, index_saveGraphCheckpoint as saveGraphCheckpoint, index_saveGraphCheckpointIndexedDb as saveGraphCheckpointIndexedDb, index_scan as scan, index_serializeError as serializeError, index_share as share, index_shareReplay as shareReplay, index_signalToName as signalToName, index_skip as skip, index_switchMap as switchMap, index_take as take, index_takeUntil as takeUntil, index_takeWhile as takeWhile, index_tap as tap, index_throttle as throttle, index_throttleTime as throttleTime, index_throwError as throwError, index_tieredStorage as tieredStorage, index_timeout as timeout, index_toArray as toArray, index_toCSV as toCSV, index_toClickHouse as toClickHouse, index_toFile as toFile, index_toKafka as toKafka, index_toLoki as toLoki, index_toMongo as toMongo, index_toNATS as toNATS, index_toObservable as toObservable, index_toPostgres as toPostgres, index_toPulsar as toPulsar, index_toRabbitMQ as toRabbitMQ, index_toRedisStream as toRedisStream, index_toS3 as toS3, index_toSSE as toSSE, index_toSqlite as toSqlite, index_toTempo as toTempo, index_toWebSocket as toWebSocket, index_tokenBucket as tokenBucket, index_tokenTracker as tokenTracker, index_valve as valve, index_verifiable as verifiable, index_window as window, index_windowCount as windowCount, index_windowTime as windowTime, index_withBreaker as withBreaker, index_withLatestFrom as withLatestFrom, index_withMaxAttempts as withMaxAttempts, index_withStatus as withStatus, index_workerBridge as workerBridge, index_workerSelf as workerSelf, index_zip as zip };
5741
+ export { type index_AckableMessage as AckableMessage, type index_AdapterHandlers as AdapterHandlers, type index_AsyncSourceOpts as AsyncSourceOpts, type index_BackoffPreset as BackoffPreset, type index_BackoffStrategy as BackoffStrategy, type index_BatchMessage as BatchMessage, type index_BridgeMessage as BridgeMessage, type index_BufferedSinkHandle as BufferedSinkHandle, type index_BundleTriad as BundleTriad, type index_CSVRow as CSVRow, type index_CacheEvictionPolicy as CacheEvictionPolicy, type index_CascadingCache as CascadingCache, type index_CascadingCacheOptions as CascadingCacheOptions, type index_CheckpointToRedisOptions as CheckpointToRedisOptions, type index_CheckpointToS3Options as CheckpointToS3Options, type index_CircuitBreaker as CircuitBreaker, type index_CircuitBreakerOptions as CircuitBreakerOptions, index_CircuitOpenError as CircuitOpenError, type index_CircuitState as CircuitState, type index_ClickHouseClientLike as ClickHouseClientLike, type index_ClickHouseInsertClientLike as ClickHouseInsertClientLike, type index_ClickHouseRow as ClickHouseRow, type index_CronSchedule as CronSchedule, type index_DistillBundle as DistillBundle, type index_DistillOptions as DistillOptions, type index_DrizzleQueryLike as DrizzleQueryLike, type index_EmitTriad as EmitTriad, type index_ErrorMessage as ErrorMessage, type index_EventTargetLike as EventTargetLike, type index_ExponentialBackoffOptions as ExponentialBackoffOptions, type index_ExternalBundleOptions as ExternalBundleOptions, type index_ExternalRegister as ExternalRegister, type index_Extraction as Extraction, type index_FSEvent as FSEvent, type index_FSEventType as FSEventType, type index_FallbackInput as FallbackInput, type index_FileWriterLike as FileWriterLike, type index_FromCSVOptions as FromCSVOptions, type index_FromClickHouseWatchOptions as FromClickHouseWatchOptions, type index_FromCronOptions as FromCronOptions, type index_FromDrizzleOptions as FromDrizzleOptions, type index_FromFSWatchOptions as FromFSWatchOptions, type index_FromGitHookOptions as FromGitHookOptions, type index_FromHTTPOptions as FromHTTPOptions, type index_FromHTTPPollOptions as FromHTTPPollOptions, type index_FromHTTPStreamOptions as FromHTTPStreamOptions, type index_FromKafkaOptions as FromKafkaOptions, type index_FromKyselyOptions as FromKyselyOptions, type index_FromMCPOptions as FromMCPOptions, type index_FromNATSOptions as FromNATSOptions, type index_FromNDJSONOptions as FromNDJSONOptions, type index_FromOTelOptions as FromOTelOptions, type index_FromPrismaOptions as FromPrismaOptions, type index_FromPrometheusOptions as FromPrometheusOptions, type index_FromPulsarOptions as FromPulsarOptions, type index_FromRabbitMQOptions as FromRabbitMQOptions, type index_FromRedisStreamOptions as FromRedisStreamOptions, type index_FromSSEOptions as FromSSEOptions, type index_FromSqliteOptions as FromSqliteOptions, type index_FromStatsDOptions as FromStatsDOptions, type index_FromSyslogOptions as FromSyslogOptions, type index_FromWebSocketReconnectOptions as FromWebSocketReconnectOptions, type index_GitEvent as GitEvent, type index_GitHookType as GitHookType, type index_HTTPBundle as HTTPBundle, type index_IndexBackend as IndexBackend, type index_IndexRow as IndexRow, index_IndexedDbStorageSpec as IndexedDbStorageSpec, type index_InitMessage as InitMessage, type index_JitterMode as JitterMode, type index_KafkaConsumerLike as KafkaConsumerLike, type index_KafkaMessage as KafkaMessage, type index_KafkaProducerLike as KafkaProducerLike, type index_KyselyQueryLike as KyselyQueryLike, type index_ListBackend as ListBackend, type index_LogBackend as LogBackend, type index_LokiClientLike as LokiClientLike, type index_LokiStream as LokiStream, type index_MCPClientLike as MCPClientLike, type index_MapBackend as MapBackend, type index_MergeMapOptions as MergeMapOptions, type index_MongoCollectionLike as MongoCollectionLike, type index_NATSClientLike as NATSClientLike, type index_NATSMessage as NATSMessage, type index_NATSSubscriptionLike as NATSSubscriptionLike, index_NS_PER_MS as NS_PER_MS, index_NS_PER_SEC as NS_PER_SEC, index_NativeIndexBackend as NativeIndexBackend, index_NativeListBackend as NativeListBackend, index_NativeLogBackend as NativeLogBackend, index_NativeMapBackend as NativeMapBackend, type index_NativeMapBackendOptions as NativeMapBackendOptions, index_NativePubSubBackend as NativePubSubBackend, type index_NodeInput as NodeInput, type index_OTelBundle as OTelBundle, type index_OTelLog as OTelLog, type index_OTelMetric as OTelMetric, type index_OTelRegister as OTelRegister, type index_OTelSpan as OTelSpan, type index_PostgresClientLike as PostgresClientLike, type index_PrismaModelLike as PrismaModelLike, type index_PrometheusMetric as PrometheusMetric, type index_PubSubBackend as PubSubBackend, type index_PubSubHub as PubSubHub, type index_PubSubHubOptions as PubSubHubOptions, type index_PulsarConsumerLike as PulsarConsumerLike, type index_PulsarMessage as PulsarMessage, type index_PulsarProducerLike as PulsarProducerLike, type index_RabbitMQChannelLike as RabbitMQChannelLike, type index_RabbitMQMessage as RabbitMQMessage, type index_RateLimiterOptions as RateLimiterOptions, index_RateLimiterOverflowError as RateLimiterOverflowError, type index_RateLimiterOverflowPolicy as RateLimiterOverflowPolicy, type index_ReactiveCounterBundle as ReactiveCounterBundle, type index_ReactiveIndexBundle as ReactiveIndexBundle, type index_ReactiveIndexOptions as ReactiveIndexOptions, type index_ReactiveListBundle as ReactiveListBundle, type index_ReactiveListOptions as ReactiveListOptions, type index_ReactiveLogBundle as ReactiveLogBundle, type index_ReactiveLogOptions as ReactiveLogOptions, type index_ReactiveMapBundle as ReactiveMapBundle, type index_ReactiveMapOptions as ReactiveMapOptions, type index_ReactiveSinkBackpressureOptions as ReactiveSinkBackpressureOptions, type index_ReactiveSinkConfig as ReactiveSinkConfig, type index_ReactiveSinkHandle as ReactiveSinkHandle, type index_ReactiveSinkOptions as ReactiveSinkOptions, type index_ReactiveSinkRetryOptions as ReactiveSinkRetryOptions, type index_ReadyMessage as ReadyMessage, type index_RedisCheckpointClientLike as RedisCheckpointClientLike, type index_RedisClientLike as RedisClientLike, type index_RedisStreamEntry as RedisStreamEntry, index_ResettableTimer as ResettableTimer, type index_RetryOptions as RetryOptions, type index_RetrySourceOptions as RetrySourceOptions, type index_S3ClientLike as S3ClientLike, type index_SSEEvent as SSEEvent, type index_SignalMessage as SignalMessage, type index_SinkFailure as SinkFailure, type index_SinkHandle as SinkHandle, type index_SinkTransportError as SinkTransportError, type index_SqliteDbLike as SqliteDbLike, type index_SqliteIterableDbLike as SqliteIterableDbLike, type index_StatsDMetric as StatsDMetric, type index_StatsDRegister as StatsDRegister, type index_StatusValue as StatusValue, index_StorageHandle as StorageHandle, index_StorageTier as StorageTier, type index_SyslogMessage as SyslogMessage, type index_SyslogRegister as SyslogRegister, type index_TapObserver as TapObserver, type index_TempoClientLike as TempoClientLike, type index_ThrottleOptions as ThrottleOptions, index_TimeoutError as TimeoutError, type index_ToCSVOptions as ToCSVOptions, type index_ToClickHouseOptions as ToClickHouseOptions, type index_ToFileOptions as ToFileOptions, type index_ToHTTPOptions as ToHTTPOptions, type index_ToKafkaOptions as ToKafkaOptions, type index_ToLokiOptions as ToLokiOptions, type index_ToMongoOptions as ToMongoOptions, type index_ToNATSOptions as ToNATSOptions, index_ToObservableOptions as ToObservableOptions, type index_ToPostgresOptions as ToPostgresOptions, type index_ToPulsarOptions as ToPulsarOptions, type index_ToRabbitMQOptions as ToRabbitMQOptions, type index_ToRedisStreamOptions as ToRedisStreamOptions, type index_ToS3Options as ToS3Options, type index_ToSSEOptions as ToSSEOptions, type index_ToSqliteOptions as ToSqliteOptions, type index_ToTempoOptions as ToTempoOptions, type index_ToWebSocketOptions as ToWebSocketOptions, type index_TokenBucket as TokenBucket, type index_UpsertOptions as UpsertOptions, type index_ValueMessage as ValueMessage, type index_VerifiableBundle as VerifiableBundle, type index_VerifiableOptions as VerifiableOptions, type index_VerifyValue as VerifyValue, type index_WatermarkController as WatermarkController, type index_WatermarkOptions as WatermarkOptions, type index_WebSocketLike as WebSocketLike, type index_WebSocketMessageEventLike as WebSocketMessageEventLike, type index_WebSocketRegister as WebSocketRegister, type index_WebhookRegister as WebhookRegister, type index_WithBreakerBundle as WithBreakerBundle, type index_WithStatusBundle as WithStatusBundle, type index_WorkerBridge as WorkerBridge, type index_WorkerBridgeOptions as WorkerBridgeOptions, type index_WorkerSelfHandle as WorkerSelfHandle, type index_WorkerSelfOptions as WorkerSelfOptions, type index_WorkerTransport as WorkerTransport, index_audit as audit, index_buffer as buffer, index_bufferCount as bufferCount, index_bufferTime as bufferTime, index_cached as cached, index_cascadingCache as cascadingCache, index_catchError as catchError, index_checkpointToRedis as checkpointToRedis, index_checkpointToS3 as checkpointToS3, index_circuitBreaker as circuitBreaker, index_combine as combine, index_combineLatest as combineLatest, index_concat as concat, index_concatMap as concatMap, index_constant as constant, index_createTransport as createTransport, index_createWatermarkController as createWatermarkController, index_csvRows as csvRows, index_debounce as debounce, index_debounceTime as debounceTime, index_decorrelatedJitter as decorrelatedJitter, index_delay as delay, index_deserializeError as deserializeError, index_dictStorage as dictStorage, index_distill as distill, index_distinctUntilChanged as distinctUntilChanged, index_elementAt as elementAt, index_empty as empty, index_escapeRegexChar as escapeRegexChar, index_exhaustMap as exhaustMap, index_exponential as exponential, index_externalBundle as externalBundle, index_externalProducer as externalProducer, index_fallback as fallback, index_fibonacci as fibonacci, index_fileStorage as fileStorage, index_filter as filter, index_find as find, index_first as first, index_firstValueFrom as firstValueFrom, index_firstWhere as firstWhere, index_flatMap as flatMap, index_forEach as forEach, index_fromAny as fromAny, index_fromAsyncIter as fromAsyncIter, index_fromCSV as fromCSV, index_fromClickHouseWatch as fromClickHouseWatch, index_fromCron as fromCron, index_fromDrizzle as fromDrizzle, index_fromEvent as fromEvent, index_fromFSWatch as fromFSWatch, index_fromGitHook as fromGitHook, index_fromHTTP as fromHTTP, index_fromHTTPPoll as fromHTTPPoll, index_fromHTTPStream as fromHTTPStream, index_fromIDBRequest as fromIDBRequest, index_fromIDBTransaction as fromIDBTransaction, index_fromIter as fromIter, index_fromKafka as fromKafka, index_fromKysely as fromKysely, index_fromMCP as fromMCP, index_fromNATS as fromNATS, index_fromNDJSON as fromNDJSON, index_fromOTel as fromOTel, index_fromPrisma as fromPrisma, index_fromPrometheus as fromPrometheus, index_fromPromise as fromPromise, index_fromPulsar as fromPulsar, index_fromRabbitMQ as fromRabbitMQ, index_fromRedisStream as fromRedisStream, index_fromSSE as fromSSE, index_fromSqlite as fromSqlite, index_fromSqliteCursor as fromSqliteCursor, index_fromStatsD as fromStatsD, index_fromSyslog as fromSyslog, index_fromTimer as fromTimer, index_fromWebSocket as fromWebSocket, index_fromWebSocketReconnect as fromWebSocketReconnect, index_fromWebhook as fromWebhook, index_globToRegExp as globToRegExp, index_indexedDbStorage as indexedDbStorage, index_interval as interval, index_keepalive as keepalive, index_last as last, index_linear as linear, index_lru as lru, index_map as map, index_matchesAnyPattern as matchesAnyPattern, index_matchesCron as matchesCron, index_memoryStorage as memoryStorage, index_merge as merge, index_mergeMap as mergeMap, index_nameToSignal as nameToSignal, index_ndjsonRows as ndjsonRows, index_never as never, index_of as of, index_pairwise as pairwise, index_parseCron as parseCron, index_parsePrometheusText as parsePrometheusText, index_parseStatsD as parseStatsD, index_parseSyslog as parseSyslog, index_pausable as pausable, index_pubsub as pubsub, index_race as race, index_rateLimiter as rateLimiter, index_reactiveCounter as reactiveCounter, index_reactiveIndex as reactiveIndex, index_reactiveList as reactiveList, index_reactiveLog as reactiveLog, index_reactiveMap as reactiveMap, index_reactiveSink as reactiveSink, index_reduce as reduce, index_repeat as repeat, index_replay as replay, index_rescue as rescue, index_resolveBackoffPreset as resolveBackoffPreset, index_retry as retry, index_retrySource as retrySource, index_sample as sample, index_scan as scan, index_serializeError as serializeError, index_share as share, index_shareReplay as shareReplay, index_signalToName as signalToName, index_skip as skip, index_sqliteStorage as sqliteStorage, index_switchMap as switchMap, index_take as take, index_takeUntil as takeUntil, index_takeWhile as takeWhile, index_tap as tap, index_throttle as throttle, index_throttleTime as throttleTime, index_throwError as throwError, index_timeout as timeout, index_toArray as toArray, index_toCSV as toCSV, index_toClickHouse as toClickHouse, index_toFile as toFile, index_toHTTP as toHTTP, index_toKafka as toKafka, index_toLoki as toLoki, index_toMongo as toMongo, index_toNATS as toNATS, index_toObservable as toObservable, index_toPostgres as toPostgres, index_toPulsar as toPulsar, index_toRabbitMQ as toRabbitMQ, index_toReadableStream as toReadableStream, index_toRedisStream as toRedisStream, index_toS3 as toS3, index_toSSE as toSSE, index_toSSEBytes as toSSEBytes, index_toSqlite as toSqlite, index_toTempo as toTempo, index_toWebSocket as toWebSocket, index_tokenBucket as tokenBucket, index_valve as valve, index_verifiable as verifiable, index_window as window, index_windowCount as windowCount, index_windowTime as windowTime, index_withBreaker as withBreaker, index_withLatestFrom as withLatestFrom, index_withMaxAttempts as withMaxAttempts, index_withStatus as withStatus, index_workerBridge as workerBridge, index_workerSelf as workerSelf, index_zip as zip };
4631
5742
  }
4632
5743
 
4633
- export { type FromRedisStreamOptions as $, type AdapterHandlers as A, type BackoffPreset as B, type CSVRow as C, type DistillBundle as D, type Extraction as E, type FSEvent as F, type FSEventType as G, FileCheckpointAdapter as H, type FileWriterLike as I, type FromCSVOptions as J, type FromClickHouseWatchOptions as K, type FromCronOptions as L, type FromDrizzleOptions as M, type NodeInput as N, type FromFSWatchOptions as O, type FromGitHookOptions as P, type FromHTTPOptions as Q, type FromKafkaOptions as R, type FromKyselyOptions as S, type FromMCPOptions as T, type FromNATSOptions as U, type FromNDJSONOptions as V, type FromOTelOptions as W, type FromPrismaOptions as X, type FromPrometheusOptions as Y, type FromPulsarOptions as Z, type FromRabbitMQOptions as _, type AsyncSourceOpts as a, type SyslogRegister as a$, type FromSqliteOptions as a0, type FromStatsDOptions as a1, type FromSyslogOptions as a2, type GitEvent as a3, type GitHookType as a4, type HTTPBundle as a5, type IndexRow as a6, type IndexedDbCheckpointSpec as a7, type InitMessage as a8, type JitterMode as a9, type PulsarProducerLike as aA, type RabbitMQChannelLike as aB, type RabbitMQMessage as aC, type ReactiveCounterBundle as aD, type ReactiveIndexBundle as aE, type ReactiveIndexOptions as aF, type ReactiveListBundle as aG, type ReactiveListOptions as aH, type ReactiveLogBundle as aI, type ReactiveLogOptions as aJ, type ReactiveMapBundle as aK, type ReactiveMapOptions as aL, type ReadyMessage as aM, type RedisCheckpointClientLike as aN, type RedisClientLike as aO, type RedisStreamEntry as aP, type RetryOptions as aQ, type S3ClientLike as aR, type SignalMessage as aS, type SinkHandle as aT, type SinkTransportError as aU, SqliteCheckpointAdapter as aV, type SqliteDbLike as aW, type StatsDMetric as aX, type StatsDRegister as aY, type StatusValue as aZ, type SyslogMessage as a_, type KafkaConsumerLike as aa, type KafkaMessage as ab, type KafkaProducerLike as ac, type KyselyQueryLike as ad, type LokiClientLike as ae, type LokiStream as af, type MCPClientLike as ag, MemoryCheckpointAdapter as ah, type MergeMapOptions as ai, type MongoCollectionLike as aj, type NATSClientLike as ak, type NATSMessage as al, type NATSSubscriptionLike as am, NS_PER_MS as an, NS_PER_SEC as ao, type OTelBundle as ap, type OTelLog as aq, type OTelMetric as ar, type OTelRegister as as, type OTelSpan as at, type PostgresClientLike as au, type PrismaModelLike as av, type PrometheusMetric as aw, type PubSubHub as ax, type PulsarConsumerLike as ay, type PulsarMessage as az, type BackoffStrategy as b, delay as b$, type TapObserver as b0, type TempoClientLike as b1, type ThrottleOptions as b2, type TieredStorage as b3, type TieredStorageOptions as b4, TimeoutError as b5, type ToCSVOptions as b6, type ToClickHouseOptions as b7, type ToFileOptions as b8, type ToKafkaOptions as b9, type WorkerBridge as bA, type WorkerBridgeOptions as bB, type WorkerSelfHandle as bC, type WorkerSelfOptions as bD, type WorkerTransport as bE, audit as bF, buffer as bG, bufferCount as bH, bufferTime as bI, cache as bJ, cached as bK, cascadingCache as bL, catchError as bM, checkpointNodeValue as bN, checkpointToRedis as bO, checkpointToS3 as bP, circuitBreaker as bQ, combine as bR, combineLatest as bS, concat as bT, concatMap as bU, constant as bV, createTransport as bW, createWatermarkController as bX, debounce as bY, debounceTime as bZ, decorrelatedJitter as b_, type ToLokiOptions as ba, type ToMongoOptions as bb, type ToNATSOptions as bc, type ToPostgresOptions as bd, type ToPulsarOptions as be, type ToRabbitMQOptions as bf, type ToRedisStreamOptions as bg, type ToS3Options as bh, type ToSSEOptions as bi, type ToSqliteOptions as bj, type ToTempoOptions as bk, type ToWebSocketOptions as bl, type ToWebSocketTransportError as bm, type TokenBucket as bn, type ValueMessage as bo, type VerifiableBundle as bp, type VerifiableOptions as bq, type VerifyValue as br, type WatermarkController as bs, type WatermarkOptions as bt, type WebSocketLike as bu, type WebSocketMessageEventLike as bv, type WebSocketRegister as bw, type WebhookRegister as bx, type WithBreakerBundle as by, type WithStatusBundle as bz, type BatchMessage as c, of as c$, deserializeError as c0, distill as c1, distinctUntilChanged as c2, elementAt as c3, empty as c4, escapeRegexChar as c5, exhaustMap as c6, exponential as c7, index as c8, fallback as c9, fromOTel as cA, fromPrisma as cB, fromPrometheus as cC, fromPromise as cD, fromPulsar as cE, fromRabbitMQ as cF, fromRedisStream as cG, fromSqlite as cH, fromStatsD as cI, fromSyslog as cJ, fromTimer as cK, fromWebSocket as cL, fromWebhook as cM, globToRegExp as cN, interval as cO, keepalive as cP, last as cQ, linear as cR, logSlice as cS, lru as cT, map as cU, matchesAnyPattern as cV, matchesCron as cW, merge as cX, mergeMap as cY, nameToSignal as cZ, never as c_, fibonacci as ca, filter as cb, find as cc, first as cd, firstValueFrom as ce, firstWhere as cf, flatMap as cg, forEach as ch, fromAny as ci, fromAsyncIter as cj, fromCSV as ck, fromClickHouseWatch as cl, fromCron as cm, fromDrizzle as cn, fromEvent as co, fromFSWatch as cp, fromGitHook as cq, fromHTTP as cr, fromIDBRequest as cs, fromIDBTransaction as ct, fromIter as cu, fromKafka as cv, fromKysely as cw, fromMCP as cx, fromNATS as cy, fromNDJSON as cz, type BridgeMessage as d, window as d$, pairwise as d0, parseCron as d1, parsePrometheusText as d2, parseStatsD as d3, parseSyslog as d4, pausable as d5, pubsub as d6, race as d7, rateLimiter as d8, reactiveCounter as d9, tap as dA, throttle as dB, throttleTime as dC, throwError as dD, tieredStorage as dE, timeout as dF, toArray as dG, toCSV as dH, toClickHouse as dI, toFile as dJ, toKafka as dK, toLoki as dL, toMongo as dM, toNATS as dN, toPostgres as dO, toPulsar as dP, toRabbitMQ as dQ, toRedisStream as dR, toS3 as dS, toSSE as dT, toSqlite as dU, toTempo as dV, toWebSocket as dW, tokenBucket as dX, tokenTracker as dY, valve as dZ, verifiable as d_, reactiveIndex as da, reactiveList as db, reactiveLog as dc, reactiveMap as dd, reduce as de, repeat as df, replay as dg, rescue as dh, resolveBackoffPreset as di, restoreGraphCheckpoint as dj, restoreGraphCheckpointIndexedDb as dk, retry as dl, sample as dm, saveGraphCheckpoint as dn, saveGraphCheckpointIndexedDb as dp, scan as dq, serializeError as dr, share as ds, shareReplay as dt, signalToName as du, skip as dv, switchMap as dw, take as dx, takeUntil as dy, takeWhile as dz, type BufferedSinkHandle as e, windowCount as e0, windowTime as e1, withBreaker as e2, withLatestFrom as e3, withMaxAttempts as e4, withStatus as e5, workerBridge as e6, workerSelf as e7, zip as e8, type CacheEvictionPolicy as f, type CacheTier as g, type CascadingCache as h, type CascadingCacheOptions as i, type CheckpointAdapter as j, type CheckpointToRedisOptions as k, type CheckpointToS3Options as l, type CircuitBreaker as m, type CircuitBreakerOptions as n, CircuitOpenError as o, type CircuitState as p, type ClickHouseClientLike as q, type ClickHouseInsertClientLike as r, type ClickHouseRow as s, type CronSchedule as t, DictCheckpointAdapter as u, type DistillOptions as v, type DrizzleQueryLike as w, type ErrorMessage as x, type EventTargetLike as y, type ExponentialBackoffOptions as z };
5744
+ export { type FromPrismaOptions as $, type AckableMessage as A, type BackoffPreset as B, type CSVRow as C, type DistillBundle as D, type Extraction as E, type ExternalBundleOptions as F, type ExternalRegister as G, type FSEvent as H, type FSEventType as I, type FallbackInput as J, type FileWriterLike as K, type FromCSVOptions as L, type FromClickHouseWatchOptions as M, type NodeInput as N, type FromCronOptions as O, type FromDrizzleOptions as P, type FromFSWatchOptions as Q, type FromGitHookOptions as R, type FromHTTPOptions as S, type FromHTTPPollOptions as T, type FromHTTPStreamOptions as U, type FromKafkaOptions as V, type FromKyselyOptions as W, type FromMCPOptions as X, type FromNATSOptions as Y, type FromNDJSONOptions as Z, type FromOTelOptions as _, type AdapterHandlers as a, type ReactiveLogBundle as a$, type FromPrometheusOptions as a0, type FromPulsarOptions as a1, type FromRabbitMQOptions as a2, type FromRedisStreamOptions as a3, type FromSSEOptions as a4, type FromSqliteOptions as a5, type FromStatsDOptions as a6, type FromSyslogOptions as a7, type FromWebSocketReconnectOptions as a8, type GitEvent as a9, NativeMapBackend as aA, type NativeMapBackendOptions as aB, NativePubSubBackend as aC, type OTelBundle as aD, type OTelLog as aE, type OTelMetric as aF, type OTelRegister as aG, type OTelSpan as aH, type PostgresClientLike as aI, type PrismaModelLike as aJ, type PrometheusMetric as aK, type PubSubBackend as aL, type PubSubHub as aM, type PubSubHubOptions as aN, type PulsarConsumerLike as aO, type PulsarMessage as aP, type PulsarProducerLike as aQ, type RabbitMQChannelLike as aR, type RabbitMQMessage as aS, type RateLimiterOptions as aT, RateLimiterOverflowError as aU, type RateLimiterOverflowPolicy as aV, type ReactiveCounterBundle as aW, type ReactiveIndexBundle as aX, type ReactiveIndexOptions as aY, type ReactiveListBundle as aZ, type ReactiveListOptions as a_, type GitHookType as aa, type HTTPBundle as ab, type IndexBackend as ac, type IndexRow as ad, type InitMessage as ae, type JitterMode as af, type KafkaConsumerLike as ag, type KafkaMessage as ah, type KafkaProducerLike as ai, type KyselyQueryLike as aj, type ListBackend as ak, type LogBackend as al, type LokiClientLike as am, type LokiStream as an, type MCPClientLike as ao, type MapBackend as ap, type MergeMapOptions as aq, type MongoCollectionLike as ar, type NATSClientLike as as, type NATSMessage as at, type NATSSubscriptionLike as au, NS_PER_MS as av, NS_PER_SEC as aw, NativeIndexBackend as ax, NativeListBackend as ay, NativeLogBackend as az, type AsyncSourceOpts as b, type WorkerBridge as b$, type ReactiveLogOptions as b0, type ReactiveMapBundle as b1, type ReactiveMapOptions as b2, type ReactiveSinkBackpressureOptions as b3, type ReactiveSinkConfig as b4, type ReactiveSinkHandle as b5, type ReactiveSinkOptions as b6, type ReactiveSinkRetryOptions as b7, type ReadyMessage as b8, type RedisCheckpointClientLike as b9, type ToKafkaOptions as bA, type ToLokiOptions as bB, type ToMongoOptions as bC, type ToNATSOptions as bD, type ToPostgresOptions as bE, type ToPulsarOptions as bF, type ToRabbitMQOptions as bG, type ToRedisStreamOptions as bH, type ToS3Options as bI, type ToSSEOptions as bJ, type ToSqliteOptions as bK, type ToTempoOptions as bL, type ToWebSocketOptions as bM, type TokenBucket as bN, type UpsertOptions as bO, type ValueMessage as bP, type VerifiableBundle as bQ, type VerifiableOptions as bR, type VerifyValue as bS, type WatermarkController as bT, type WatermarkOptions as bU, type WebSocketLike as bV, type WebSocketMessageEventLike as bW, type WebSocketRegister as bX, type WebhookRegister as bY, type WithBreakerBundle as bZ, type WithStatusBundle as b_, type RedisClientLike as ba, type RedisStreamEntry as bb, ResettableTimer as bc, type RetryOptions as bd, type RetrySourceOptions as be, type S3ClientLike as bf, type SSEEvent as bg, type SignalMessage as bh, type SinkFailure as bi, type SinkHandle as bj, type SinkTransportError as bk, type SqliteDbLike as bl, type SqliteIterableDbLike as bm, type StatsDMetric as bn, type StatsDRegister as bo, type StatusValue as bp, type SyslogMessage as bq, type SyslogRegister as br, type TapObserver as bs, type TempoClientLike as bt, type ThrottleOptions as bu, TimeoutError as bv, type ToCSVOptions as bw, type ToClickHouseOptions as bx, type ToFileOptions as by, type ToHTTPOptions as bz, type BackoffStrategy as c, fromNDJSON as c$, type WorkerBridgeOptions as c0, type WorkerSelfHandle as c1, type WorkerSelfOptions as c2, type WorkerTransport as c3, audit as c4, buffer as c5, bufferCount as c6, bufferTime as c7, cached as c8, cascadingCache as c9, index as cA, fallback as cB, fibonacci as cC, filter as cD, find as cE, first as cF, firstValueFrom as cG, firstWhere as cH, flatMap as cI, forEach as cJ, fromAny as cK, fromAsyncIter as cL, fromCSV as cM, fromClickHouseWatch as cN, fromCron as cO, fromDrizzle as cP, fromEvent as cQ, fromFSWatch as cR, fromGitHook as cS, fromHTTP as cT, fromHTTPPoll as cU, fromHTTPStream as cV, fromIter as cW, fromKafka as cX, fromKysely as cY, fromMCP as cZ, fromNATS as c_, catchError as ca, checkpointToRedis as cb, checkpointToS3 as cc, circuitBreaker as cd, combine as ce, combineLatest as cf, concat as cg, concatMap as ch, constant as ci, createTransport as cj, createWatermarkController as ck, csvRows as cl, debounce as cm, debounceTime as cn, decorrelatedJitter as co, delay as cp, deserializeError as cq, distill as cr, distinctUntilChanged as cs, elementAt as ct, empty as cu, escapeRegexChar as cv, exhaustMap as cw, exponential as cx, externalBundle as cy, externalProducer as cz, type BatchMessage as d, takeUntil as d$, fromOTel as d0, fromPrisma as d1, fromPrometheus as d2, fromPromise as d3, fromPulsar as d4, fromRabbitMQ as d5, fromRedisStream as d6, fromSSE as d7, fromSqlite as d8, fromSqliteCursor as d9, parseSyslog as dA, pausable as dB, pubsub as dC, race as dD, rateLimiter as dE, reactiveCounter as dF, reactiveIndex as dG, reactiveList as dH, reactiveLog as dI, reactiveMap as dJ, reactiveSink as dK, reduce as dL, repeat as dM, replay as dN, rescue as dO, resolveBackoffPreset as dP, retry as dQ, retrySource as dR, sample as dS, scan as dT, serializeError as dU, share as dV, shareReplay as dW, signalToName as dX, skip as dY, switchMap as dZ, take as d_, fromStatsD as da, fromSyslog as db, fromTimer as dc, fromWebSocket as dd, fromWebSocketReconnect as de, fromWebhook as df, globToRegExp as dg, interval as dh, keepalive as di, last as dj, linear as dk, lru as dl, map as dm, matchesAnyPattern as dn, matchesCron as dp, merge as dq, mergeMap as dr, nameToSignal as ds, ndjsonRows as dt, never as du, of as dv, pairwise as dw, parseCron as dx, parsePrometheusText as dy, parseStatsD as dz, type BridgeMessage as e, takeWhile as e0, tap as e1, throttle as e2, throttleTime as e3, throwError as e4, timeout as e5, toArray as e6, toCSV as e7, toClickHouse as e8, toFile as e9, workerBridge as eA, workerSelf as eB, zip as eC, toHTTP as ea, toKafka as eb, toLoki as ec, toMongo as ed, toNATS as ee, toPostgres as ef, toPulsar as eg, toRabbitMQ as eh, toReadableStream as ei, toRedisStream as ej, toS3 as ek, toSSE as el, toSSEBytes as em, toSqlite as en, toTempo as eo, toWebSocket as ep, tokenBucket as eq, valve as er, verifiable as es, window as et, windowCount as eu, windowTime as ev, withBreaker as ew, withLatestFrom as ex, withMaxAttempts as ey, withStatus as ez, type BufferedSinkHandle as f, type BundleTriad as g, type CacheEvictionPolicy as h, type CascadingCache as i, type CascadingCacheOptions as j, type CheckpointToRedisOptions as k, type CheckpointToS3Options as l, type CircuitBreaker as m, type CircuitBreakerOptions as n, CircuitOpenError as o, type CircuitState as p, type ClickHouseClientLike as q, type ClickHouseInsertClientLike as r, type ClickHouseRow as s, type CronSchedule as t, type DistillOptions as u, type DrizzleQueryLike as v, type EmitTriad as w, type ErrorMessage as x, type EventTargetLike as y, type ExponentialBackoffOptions as z };