@graphrefly/graphrefly 0.25.0 → 0.26.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 (184) hide show
  1. package/README.md +8 -0
  2. package/dist/{chunk-QOWVNWOC.js → chunk-3ZWCKRHX.js} +27 -25
  3. package/dist/{chunk-QOWVNWOC.js.map → chunk-3ZWCKRHX.js.map} +1 -1
  4. package/dist/chunk-6LDQFTYS.js +102 -0
  5. package/dist/chunk-6LDQFTYS.js.map +1 -0
  6. package/dist/{chunk-IAHGTNOZ.js → chunk-AMCG74RZ.js} +193 -24
  7. package/dist/chunk-AMCG74RZ.js.map +1 -0
  8. package/dist/{chunk-L2GLW2U7.js → chunk-BVZYTZ5H.js} +9 -103
  9. package/dist/chunk-BVZYTZ5H.js.map +1 -0
  10. package/dist/chunk-FQMKGR6L.js +330 -0
  11. package/dist/chunk-FQMKGR6L.js.map +1 -0
  12. package/dist/chunk-HXZEYDUR.js +94 -0
  13. package/dist/chunk-HXZEYDUR.js.map +1 -0
  14. package/dist/{chunk-EVR6UFUV.js → chunk-IZYUSJC7.js} +16 -14
  15. package/dist/{chunk-EVR6UFUV.js.map → chunk-IZYUSJC7.js.map} +1 -1
  16. package/dist/chunk-J22W6HV3.js +107 -0
  17. package/dist/chunk-J22W6HV3.js.map +1 -0
  18. package/dist/{chunk-HWPIFSW2.js → chunk-JSCT3CR4.js} +6 -4
  19. package/dist/{chunk-HWPIFSW2.js.map → chunk-JSCT3CR4.js.map} +1 -1
  20. package/dist/chunk-JYXEWPH4.js +62 -0
  21. package/dist/chunk-JYXEWPH4.js.map +1 -0
  22. package/dist/{chunk-TKE3JGOH.js → chunk-LCE3GF5P.js} +5 -692
  23. package/dist/chunk-LCE3GF5P.js.map +1 -0
  24. package/dist/chunk-MJ2NKQQL.js +119 -0
  25. package/dist/chunk-MJ2NKQQL.js.map +1 -0
  26. package/dist/chunk-N6UR7YVY.js +198 -0
  27. package/dist/chunk-N6UR7YVY.js.map +1 -0
  28. package/dist/chunk-OHISZPOJ.js +97 -0
  29. package/dist/chunk-OHISZPOJ.js.map +1 -0
  30. package/dist/{chunk-5DJTTKX3.js → chunk-PHOUUNK7.js} +74 -111
  31. package/dist/chunk-PHOUUNK7.js.map +1 -0
  32. package/dist/{chunk-PY4XCDLR.js → chunk-RB6QPHJ7.js} +8 -6
  33. package/dist/{chunk-PY4XCDLR.js.map → chunk-RB6QPHJ7.js.map} +1 -1
  34. package/dist/chunk-SN4YWWYO.js +171 -0
  35. package/dist/chunk-SN4YWWYO.js.map +1 -0
  36. package/dist/chunk-SX52TAR4.js +110 -0
  37. package/dist/chunk-SX52TAR4.js.map +1 -0
  38. package/dist/{chunk-XOFWRC73.js → chunk-THTWHNU4.js} +319 -24
  39. package/dist/chunk-THTWHNU4.js.map +1 -0
  40. package/dist/{chunk-H4RVA4VE.js → chunk-VYPWMZ6H.js} +2 -2
  41. package/dist/chunk-XGPU467M.js +136 -0
  42. package/dist/chunk-XGPU467M.js.map +1 -0
  43. package/dist/chunk-ZQMEI34O.js +713 -0
  44. package/dist/chunk-ZQMEI34O.js.map +1 -0
  45. package/dist/compat/index.cjs +7656 -0
  46. package/dist/compat/index.cjs.map +1 -0
  47. package/dist/compat/index.d.cts +18 -0
  48. package/dist/compat/index.d.ts +18 -0
  49. package/dist/compat/index.js +49 -0
  50. package/dist/compat/index.js.map +1 -0
  51. package/dist/compat/jotai/index.cjs +2048 -0
  52. package/dist/compat/jotai/index.cjs.map +1 -0
  53. package/dist/compat/jotai/index.d.cts +2 -0
  54. package/dist/compat/jotai/index.d.ts +2 -0
  55. package/dist/compat/jotai/index.js +9 -0
  56. package/dist/compat/jotai/index.js.map +1 -0
  57. package/dist/compat/nanostores/index.cjs +2175 -0
  58. package/dist/compat/nanostores/index.cjs.map +1 -0
  59. package/dist/compat/nanostores/index.d.cts +2 -0
  60. package/dist/compat/nanostores/index.d.ts +2 -0
  61. package/dist/compat/nanostores/index.js +23 -0
  62. package/dist/compat/nanostores/index.js.map +1 -0
  63. package/dist/compat/nestjs/index.cjs +350 -16
  64. package/dist/compat/nestjs/index.cjs.map +1 -1
  65. package/dist/compat/nestjs/index.d.cts +6 -6
  66. package/dist/compat/nestjs/index.d.ts +6 -6
  67. package/dist/compat/nestjs/index.js +10 -9
  68. package/dist/compat/react/index.cjs +141 -0
  69. package/dist/compat/react/index.cjs.map +1 -0
  70. package/dist/compat/react/index.d.cts +2 -0
  71. package/dist/compat/react/index.d.ts +2 -0
  72. package/dist/compat/react/index.js +12 -0
  73. package/dist/compat/react/index.js.map +1 -0
  74. package/dist/compat/solid/index.cjs +128 -0
  75. package/dist/compat/solid/index.cjs.map +1 -0
  76. package/dist/compat/solid/index.d.cts +2 -0
  77. package/dist/compat/solid/index.d.ts +2 -0
  78. package/dist/compat/solid/index.js +12 -0
  79. package/dist/compat/solid/index.js.map +1 -0
  80. package/dist/compat/svelte/index.cjs +131 -0
  81. package/dist/compat/svelte/index.cjs.map +1 -0
  82. package/dist/compat/svelte/index.d.cts +2 -0
  83. package/dist/compat/svelte/index.d.ts +2 -0
  84. package/dist/compat/svelte/index.js +12 -0
  85. package/dist/compat/svelte/index.js.map +1 -0
  86. package/dist/compat/vue/index.cjs +146 -0
  87. package/dist/compat/vue/index.cjs.map +1 -0
  88. package/dist/compat/vue/index.d.cts +3 -0
  89. package/dist/compat/vue/index.d.ts +3 -0
  90. package/dist/compat/vue/index.js +12 -0
  91. package/dist/compat/vue/index.js.map +1 -0
  92. package/dist/compat/zustand/index.cjs +4931 -0
  93. package/dist/compat/zustand/index.cjs.map +1 -0
  94. package/dist/compat/zustand/index.d.cts +5 -0
  95. package/dist/compat/zustand/index.d.ts +5 -0
  96. package/dist/compat/zustand/index.js +12 -0
  97. package/dist/compat/zustand/index.js.map +1 -0
  98. package/dist/core/index.cjs +53 -4
  99. package/dist/core/index.cjs.map +1 -1
  100. package/dist/core/index.d.cts +3 -3
  101. package/dist/core/index.d.ts +3 -3
  102. package/dist/core/index.js +26 -24
  103. package/dist/demo-shell-26p5fVxn.d.cts +102 -0
  104. package/dist/demo-shell-DEp-nMTl.d.ts +102 -0
  105. package/dist/extra/index.cjs +222 -110
  106. package/dist/extra/index.cjs.map +1 -1
  107. package/dist/extra/index.d.cts +5 -4
  108. package/dist/extra/index.d.ts +5 -4
  109. package/dist/extra/index.js +6 -5
  110. package/dist/extra/sources.cjs +2486 -0
  111. package/dist/extra/sources.cjs.map +1 -0
  112. package/dist/extra/sources.d.cts +465 -0
  113. package/dist/extra/sources.d.ts +465 -0
  114. package/dist/extra/sources.js +57 -0
  115. package/dist/extra/sources.js.map +1 -0
  116. package/dist/graph/index.cjs +408 -14
  117. package/dist/graph/index.cjs.map +1 -1
  118. package/dist/graph/index.d.cts +5 -5
  119. package/dist/graph/index.d.ts +5 -5
  120. package/dist/graph/index.js +13 -5
  121. package/dist/{graph-B6NFqv3z.d.ts → graph-6tZ5jEzr.d.cts} +195 -4
  122. package/dist/{graph-D-3JIQme.d.cts → graph-DQ69XU0g.d.ts} +195 -4
  123. package/dist/index-B4MP_8V_.d.cts +37 -0
  124. package/dist/index-BEfE8H_G.d.cts +121 -0
  125. package/dist/{index-OXImXMq6.d.ts → index-BW1z3BN9.d.ts} +18 -196
  126. package/dist/index-BYOHF0zP.d.ts +34 -0
  127. package/dist/index-B_IP40nB.d.cts +36 -0
  128. package/dist/index-Bd_fwmLf.d.cts +45 -0
  129. package/dist/{index-Ds23Wvou.d.ts → index-BeIdBfcb.d.cts} +120 -573
  130. package/dist/index-BjI6ty9z.d.ts +121 -0
  131. package/dist/index-Bxb5ZYc9.d.cts +34 -0
  132. package/dist/{index-BJB7t9gg.d.cts → index-C0ZXMaXO.d.cts} +2 -2
  133. package/dist/{index-DKE1EATr.d.cts → index-C8mdwMXc.d.cts} +18 -196
  134. package/dist/index-CDAjUFIv.d.ts +36 -0
  135. package/dist/index-CPgZ5wRl.d.ts +44 -0
  136. package/dist/{index-AMWewNDe.d.cts → index-CUwyr1Kk.d.cts} +33 -4
  137. package/dist/index-CUyrtuOf.d.cts +127 -0
  138. package/dist/{index-C-TXEa7C.d.ts → index-CY2TljO4.d.ts} +2 -2
  139. package/dist/index-CmnuOibw.d.ts +37 -0
  140. package/dist/{index-DiobMNwE.d.ts → index-CuYwdKO-.d.ts} +3 -3
  141. package/dist/index-DFhjO4Gg.d.cts +44 -0
  142. package/dist/{index-Ch0IpIO0.d.cts → index-DdD5MVDL.d.ts} +120 -573
  143. package/dist/index-DrISNAOm.d.ts +45 -0
  144. package/dist/index-QBpffFW-.d.cts +86 -0
  145. package/dist/{index-J7Kc0oIQ.d.cts → index-_oMEWlDq.d.cts} +3 -3
  146. package/dist/{index-CYkjxu3s.d.ts → index-eJ6T_qGM.d.ts} +33 -4
  147. package/dist/index-qldRdbQw.d.ts +86 -0
  148. package/dist/index-xdGjv0nO.d.ts +127 -0
  149. package/dist/index.cjs +1780 -176
  150. package/dist/index.cjs.map +1 -1
  151. package/dist/index.d.cts +1007 -648
  152. package/dist/index.d.ts +1007 -648
  153. package/dist/index.js +1202 -1172
  154. package/dist/index.js.map +1 -1
  155. package/dist/{meta-CnkLA_43.d.ts → meta-BGqSZ7mt.d.ts} +1 -1
  156. package/dist/{meta-DWbkoq1s.d.cts → meta-C0-8XW6Q.d.cts} +1 -1
  157. package/dist/{node-B-f-Lu-k.d.cts → node-C_IBuvX2.d.cts} +26 -1
  158. package/dist/{node-B-f-Lu-k.d.ts → node-C_IBuvX2.d.ts} +26 -1
  159. package/dist/{observable-DBnrwcar.d.cts → observable-Crr1jgzx.d.cts} +1 -1
  160. package/dist/{observable-uP-wy_uK.d.ts → observable-DCk45RH5.d.ts} +1 -1
  161. package/dist/patterns/demo-shell.cjs +5604 -0
  162. package/dist/patterns/demo-shell.cjs.map +1 -0
  163. package/dist/patterns/demo-shell.d.cts +6 -0
  164. package/dist/patterns/demo-shell.d.ts +6 -0
  165. package/dist/patterns/demo-shell.js +15 -0
  166. package/dist/patterns/demo-shell.js.map +1 -0
  167. package/dist/patterns/reactive-layout/index.cjs +355 -13
  168. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  169. package/dist/patterns/reactive-layout/index.d.cts +6 -5
  170. package/dist/patterns/reactive-layout/index.d.ts +6 -5
  171. package/dist/patterns/reactive-layout/index.js +15 -12
  172. package/dist/reactive-layout-BaOQefHu.d.cts +183 -0
  173. package/dist/reactive-layout-D9gejYXE.d.ts +183 -0
  174. package/dist/{storage-BuTdpCI1.d.cts → storage-BMycWEh2.d.ts} +9 -1
  175. package/dist/{storage-F2X1U1x0.d.ts → storage-DiqWHzVI.d.cts} +9 -1
  176. package/package.json +32 -2
  177. package/dist/chunk-5DJTTKX3.js.map +0 -1
  178. package/dist/chunk-IAHGTNOZ.js.map +0 -1
  179. package/dist/chunk-L2GLW2U7.js.map +0 -1
  180. package/dist/chunk-MW4VAKAO.js +0 -47
  181. package/dist/chunk-MW4VAKAO.js.map +0 -1
  182. package/dist/chunk-TKE3JGOH.js.map +0 -1
  183. package/dist/chunk-XOFWRC73.js.map +0 -1
  184. /package/dist/{chunk-H4RVA4VE.js.map → chunk-VYPWMZ6H.js.map} +0 -0
@@ -0,0 +1,465 @@
1
+ import { a as NodeOptions, N as Node } from '../node-C_IBuvX2.js';
2
+
3
+ /**
4
+ * Core reactive sources, sinks, and utilities (roadmap §2.3).
5
+ *
6
+ * Each API returns a {@link Node} built with {@link node}, {@link producer},
7
+ * {@link derived}, or {@link effect} — no second protocol.
8
+ *
9
+ * Protocol/system/ingest adapters (fromHTTP, fromWebSocket, fromKafka, etc.)
10
+ * live in {@link ./adapters.ts}.
11
+ */
12
+
13
+ type ExtraOpts = Omit<NodeOptions<unknown>, "describeKind">;
14
+ /** Options for {@link fromTimer} / {@link fromPromise} / {@link fromAsyncIter}. */
15
+ type AsyncSourceOpts = ExtraOpts & {
16
+ signal?: AbortSignal;
17
+ };
18
+ /**
19
+ * Values accepted by {@link fromAny}.
20
+ *
21
+ * @category extra
22
+ */
23
+ type NodeInput<T> = Node<T> | PromiseLike<T> | AsyncIterable<T> | Iterable<T> | T;
24
+ /** Options for {@link fromCron}. */
25
+ type FromCronOptions = ExtraOpts & {
26
+ /** Polling interval in ms. Default `60_000`. */
27
+ tickMs?: number;
28
+ /** Output format: `"timestamp_ns"` (default) emits wall-clock nanoseconds; `"date"` emits a `Date` object. */
29
+ output?: "timestamp_ns" | "date";
30
+ };
31
+ /** DOM-style event target (browser or `node:events`). */
32
+ type EventTargetLike = {
33
+ addEventListener(type: string, listener: (ev: unknown) => void, options?: boolean | {
34
+ capture?: boolean;
35
+ passive?: boolean;
36
+ once?: boolean;
37
+ }): void;
38
+ removeEventListener(type: string, listener: (ev: unknown) => void, options?: boolean | {
39
+ capture?: boolean;
40
+ passive?: boolean;
41
+ once?: boolean;
42
+ }): void;
43
+ };
44
+ /** @internal Shared with adapters.ts and sources-fs.ts for glob matching. */
45
+ declare function escapeRegexChar(ch: string): string;
46
+ /** @internal */
47
+ declare function globToRegExp(glob: string): RegExp;
48
+ /** @internal */
49
+ declare function matchesAnyPattern(path: string, patterns: RegExp[]): boolean;
50
+ /**
51
+ * Builds a timer-driven source: one-shot (first tick then `COMPLETE`) or periodic (`0`, `1`, `2`, …).
52
+ *
53
+ * @param ms - Milliseconds before the first emission.
54
+ * @param opts - Producer options plus optional `period` for repeating ticks and optional `signal` (`AbortSignal`) to cancel with `ERROR`.
55
+ * @returns `Node<number>` — tick counter from `0`; teardown clears timers.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * import { fromTimer } from "@graphrefly/graphrefly-ts";
60
+ *
61
+ * fromTimer(250, { period: 1_000 });
62
+ * ```
63
+ *
64
+ * @category extra
65
+ */
66
+ declare function fromTimer(ms: number, opts?: AsyncSourceOpts & {
67
+ period?: number;
68
+ }): Node<number>;
69
+ /**
70
+ * Animation-frame-driven source. Emits on every `requestAnimationFrame` tick,
71
+ * yielding the frame timestamp (DOMHighResTimeStamp, ms since navigation).
72
+ *
73
+ * Use instead of `fromTimer({ period: 16 })` when animation smoothness matters.
74
+ * In a real browser, `requestAnimationFrame` synchronizes with the display
75
+ * refresh. The source keeps ticking even when the tab is hidden — it
76
+ * transparently switches to `setTimeout` while the tab is backgrounded (so
77
+ * downstream state updates continue) and returns to `requestAnimationFrame`
78
+ * when the tab regains focus.
79
+ *
80
+ * When `requestAnimationFrame` is unavailable (Node test environments, SSR),
81
+ * this falls back to `setTimeout(~16ms)` unconditionally. Abortable via
82
+ * `signal` (emits `ERROR`).
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * import { fromRaf, derived } from "@graphrefly/graphrefly-ts";
87
+ *
88
+ * const frame = fromRaf();
89
+ * const bouncingX = derived([frame], ([t]) => 50 + 40 * Math.sin((t as number) * 0.001));
90
+ * ```
91
+ *
92
+ * @category extra
93
+ */
94
+ declare function fromRaf(opts?: AsyncSourceOpts): Node<number>;
95
+ /**
96
+ * Polls on an interval; when the current minute matches a 5-field cron expression, emits once (see {@link parseCron}).
97
+ *
98
+ * @param expr - Cron string (`min hour dom month dow`).
99
+ * @param opts - Producer options plus `tickMs` (default `60_000`) and `output` (`timestamp_ns` default, or `date` for `Date` values).
100
+ * @returns `Node<number>` (nanosecond timestamp) or `Node<Date>` when `output: "date"`.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { fromCron } from "@graphrefly/graphrefly-ts";
105
+ *
106
+ * fromCron("0 9 * * 1");
107
+ * ```
108
+ *
109
+ * @category extra
110
+ */
111
+ declare function fromCron(expr: string, opts?: FromCronOptions & {
112
+ output: "date";
113
+ }): Node<Date>;
114
+ declare function fromCron(expr: string, opts?: FromCronOptions): Node<number>;
115
+ /**
116
+ * Wraps a DOM-style `addEventListener` target; each event becomes a `DATA` emission.
117
+ *
118
+ * @param target - Object with `addEventListener` / `removeEventListener`.
119
+ * @param type - Event name (e.g. `"click"`).
120
+ * @param opts - Producer options plus listener options (`capture`, `passive`, `once`).
121
+ * @returns `Node<T>` — event payloads; teardown removes the listener.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * import { fromEvent } from "@graphrefly/graphrefly-ts";
126
+ *
127
+ * fromEvent(document.body, "click");
128
+ * ```
129
+ *
130
+ * @category extra
131
+ */
132
+ declare function fromEvent<T = unknown>(target: EventTargetLike, type: string, opts?: ExtraOpts & {
133
+ capture?: boolean;
134
+ passive?: boolean;
135
+ once?: boolean;
136
+ }): Node<T>;
137
+ /**
138
+ * Drains a synchronous iterable; each item is `DATA`, then `COMPLETE`, or `ERROR` if iteration throws.
139
+ *
140
+ * @param iterable - Values to emit in order.
141
+ * @param opts - Optional producer options.
142
+ * @returns `Node<T>` — one emission per element.
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * import { fromIter } from "@graphrefly/graphrefly-ts";
147
+ *
148
+ * fromIter([1, 2, 3]);
149
+ * ```
150
+ *
151
+ * @category extra
152
+ */
153
+ declare function fromIter<T>(iterable: Iterable<T>, opts?: ExtraOpts): Node<T>;
154
+ /**
155
+ * Lifts a Promise (or thenable) to a single-value stream: one `DATA` then `COMPLETE`, or `ERROR` on rejection.
156
+ *
157
+ * @param p - Promise to await.
158
+ * @param opts - Producer options plus optional `signal` for abort → `ERROR` with reason.
159
+ * @returns `Node<T>` — settles once.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * import { fromPromise } from "@graphrefly/graphrefly-ts";
164
+ *
165
+ * fromPromise(Promise.resolve(42));
166
+ * ```
167
+ *
168
+ * @category extra
169
+ */
170
+ declare function fromPromise<T>(p: Promise<T> | PromiseLike<T>, opts?: AsyncSourceOpts): Node<T>;
171
+ /**
172
+ * Reads an async iterable; each `next()` value becomes `DATA`; `COMPLETE` when done; `ERROR` on failure.
173
+ *
174
+ * @param iterable - Async source (`for await` shape).
175
+ * @param opts - Producer options plus optional `signal` to abort the pump.
176
+ * @returns `Node<T>` — async pull stream.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * import { fromAsyncIter } from "@graphrefly/graphrefly-ts";
181
+ *
182
+ * async function* gen() {
183
+ * yield 1;
184
+ * }
185
+ * fromAsyncIter(gen());
186
+ * ```
187
+ *
188
+ * @category extra
189
+ */
190
+ declare function fromAsyncIter<T>(iterable: AsyncIterable<T>, opts?: AsyncSourceOpts): Node<T>;
191
+ /**
192
+ * Coerces a value to a `Node` by shape: existing `Node` passthrough, thenable → {@link fromPromise},
193
+ * async iterable → {@link fromAsyncIter}, sync iterable → {@link fromIter}, else scalar → {@link of}.
194
+ *
195
+ * @param input - Any value to wrap.
196
+ * @param opts - Passed through when a Promise/async path is chosen.
197
+ * @returns `Node` of the inferred element type.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * import { fromAny, state } from "@graphrefly/graphrefly-ts";
202
+ *
203
+ * fromAny(state(1));
204
+ * fromAny(Promise.resolve(2));
205
+ * ```
206
+ *
207
+ * @category extra
208
+ */
209
+ declare function fromAny<T>(input: NodeInput<T>, opts?: AsyncSourceOpts): Node<T>;
210
+ /**
211
+ * Emits each argument as `DATA` in order, then `COMPLETE` (implemented via {@link fromIter}).
212
+ *
213
+ * @param values - Values to emit.
214
+ * @returns `Node<T>` — finite sequence.
215
+ *
216
+ * @example
217
+ * ```ts
218
+ * import { of } from "@graphrefly/graphrefly-ts";
219
+ *
220
+ * of(1, 2, 3);
221
+ * ```
222
+ *
223
+ * @category extra
224
+ */
225
+ declare function of<T>(...values: T[]): Node<T>;
226
+ /**
227
+ * Completes immediately with no `DATA` (cold `EMPTY` analogue).
228
+ *
229
+ * @param opts - Optional producer options.
230
+ * @returns `Node<T>` — terminal `COMPLETE` only.
231
+ *
232
+ * @example
233
+ * ```ts
234
+ * import { empty } from "@graphrefly/graphrefly-ts";
235
+ *
236
+ * empty();
237
+ * ```
238
+ *
239
+ * @category extra
240
+ */
241
+ declare function empty<T = never>(opts?: ExtraOpts): Node<T>;
242
+ /**
243
+ * Never emits and never completes until teardown (cold `NEVER` analogue).
244
+ *
245
+ * @param opts - Optional producer options.
246
+ * @returns `Node<T>` — silent until unsubscribed.
247
+ *
248
+ * @example
249
+ * ```ts
250
+ * import { never } from "@graphrefly/graphrefly-ts";
251
+ *
252
+ * never();
253
+ * ```
254
+ *
255
+ * @category extra
256
+ */
257
+ declare function never<T = never>(opts?: ExtraOpts): Node<T>;
258
+ /**
259
+ * Emits `ERROR` as soon as the producer starts (cold error source).
260
+ *
261
+ * @param err - Error payload forwarded as `ERROR` data.
262
+ * @param opts - Optional producer options.
263
+ * @returns `Node<never>` — terminates with `ERROR`.
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * import { throwError } from "@graphrefly/graphrefly-ts";
268
+ *
269
+ * throwError(new Error("fail"));
270
+ * ```
271
+ *
272
+ * @category extra
273
+ */
274
+ declare function throwError(err: unknown, opts?: ExtraOpts): Node<never>;
275
+ /**
276
+ * Subscribes immediately and runs `fn` for each upstream `DATA`; returns unsubscribe.
277
+ *
278
+ * @param source - Upstream node.
279
+ * @param fn - Side effect per value.
280
+ * @param opts - Effect node options.
281
+ * @returns Unsubscribe function (idempotent).
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * import { forEach, state } from "@graphrefly/graphrefly-ts";
286
+ *
287
+ * const u = forEach(state(1), (v) => console.log(v));
288
+ * u();
289
+ * ```
290
+ *
291
+ * @category extra
292
+ */
293
+ declare function forEach<T>(source: Node<T>, fn: (value: T) => void, opts?: ExtraOpts): () => void;
294
+ /**
295
+ * Buffers every `DATA`; on upstream `COMPLETE` emits one `DATA` with the full array then `COMPLETE`.
296
+ *
297
+ * @param source - Upstream node.
298
+ * @param opts - Optional node options (derived describe kind).
299
+ * @returns `Node<T[]>` — single array emission before completion.
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * import { of, toArray } from "@graphrefly/graphrefly-ts";
304
+ *
305
+ * toArray(of(1, 2, 3));
306
+ * ```
307
+ *
308
+ * @category extra
309
+ */
310
+ declare function toArray<T>(source: Node<T>, opts?: ExtraOpts): Node<T[]>;
311
+ /**
312
+ * Multicasts upstream: one subscription to `source` while this wrapper has subscribers (via {@link producer}).
313
+ *
314
+ * @param source - Upstream node to share.
315
+ * @param opts - Producer options; `initial` seeds from `source.cache` when set by factory.
316
+ * @returns `Node<T>` — hot ref-counted bridge.
317
+ *
318
+ * @example
319
+ * ```ts
320
+ * import { share, state } from "@graphrefly/graphrefly-ts";
321
+ *
322
+ * share(state(0));
323
+ * ```
324
+ *
325
+ * @category extra
326
+ */
327
+ declare function share<T>(source: Node<T>, opts?: ExtraOpts): Node<T>;
328
+ /**
329
+ * Like {@link share} with a bounded replay buffer: new subscribers receive the last `bufferSize`
330
+ * `DATA` payloads (as separate batches) before live updates.
331
+ *
332
+ * @param source - Upstream node.
333
+ * @param bufferSize - Maximum past values to replay (≥ 1).
334
+ * @param opts - Producer options.
335
+ * @returns `Node<T>` — multicast with replay on subscribe.
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * import { replay, state } from "@graphrefly/graphrefly-ts";
340
+ *
341
+ * replay(state(0), 3);
342
+ * ```
343
+ *
344
+ * @category extra
345
+ */
346
+ declare function replay<T>(source: Node<T>, bufferSize: number, opts?: ExtraOpts): Node<T>;
347
+ /**
348
+ * {@link replay} with `bufferSize === 1` — replays the latest `DATA` to new subscribers.
349
+ *
350
+ * @param source - Upstream node.
351
+ * @param opts - Producer options.
352
+ * @returns `Node<T>` — share + last-value replay.
353
+ *
354
+ * @example
355
+ * ```ts
356
+ * import { cached, state } from "@graphrefly/graphrefly-ts";
357
+ *
358
+ * cached(state(0));
359
+ * ```
360
+ *
361
+ * @category extra
362
+ */
363
+ declare function cached<T>(source: Node<T>, opts?: ExtraOpts): Node<T>;
364
+ /**
365
+ * Converts the first `DATA` on `source` into a Promise; rejects on `ERROR` or `COMPLETE` without data.
366
+ *
367
+ * **Important:** This subscribes and waits for a **future** emission. Data that
368
+ * has already flowed is gone and will not be seen. Call this *before* the upstream
369
+ * emits, or use `source.cache` / `source.status` for already-cached state.
370
+ * See COMPOSITION-GUIDE §2 (subscription ordering).
371
+ *
372
+ * @param source - Node to read once.
373
+ * @returns Promise of the first value.
374
+ *
375
+ * @example
376
+ * ```ts
377
+ * import { firstValueFrom, of } from "@graphrefly/graphrefly-ts";
378
+ *
379
+ * await firstValueFrom(of(42));
380
+ * ```
381
+ *
382
+ * @category extra
383
+ */
384
+ declare function firstValueFrom<T>(source: Node<T>): Promise<T>;
385
+ /**
386
+ * Wait for the first DATA value from `source` that satisfies `predicate`.
387
+ *
388
+ * Subscribes directly and resolves on the first DATA value where
389
+ * `predicate` returns true. Reactive, no polling. Use in tests and
390
+ * bridging code where you need a single matching value as a Promise.
391
+ *
392
+ * **Important:** This only captures **future** emissions — data that has
393
+ * already flowed through the node is gone. Call this *before* the upstream
394
+ * emits. For already-cached values, use `source.cache` / `source.status`.
395
+ * See COMPOSITION-GUIDE §2 (subscription ordering).
396
+ *
397
+ * ```ts
398
+ * const val = await firstWhere(strategy.node, snap => snap.size > 0);
399
+ * ```
400
+ *
401
+ * @category extra
402
+ */
403
+ declare function firstWhere<T>(source: Node<T>, predicate: (value: T) => boolean): Promise<T>;
404
+ /**
405
+ * RxJS-named alias for {@link replay} — multicast with a replay buffer of size `bufferSize`.
406
+ *
407
+ * @param source - Upstream node.
408
+ * @param bufferSize - Replay depth (≥ 1).
409
+ * @param opts - Producer options.
410
+ * @returns Same behavior as `replay`.
411
+ *
412
+ * @example
413
+ * ```ts
414
+ * import { shareReplay, state } from "@graphrefly/graphrefly-ts";
415
+ *
416
+ * shareReplay(state(0), 5);
417
+ * ```
418
+ *
419
+ * @category extra
420
+ */
421
+ declare const shareReplay: typeof replay;
422
+ /**
423
+ * Activate a compute node's upstream wiring without a real sink.
424
+ *
425
+ * Derived/effect nodes are lazy — they don't compute until at least one
426
+ * subscriber exists (COMPOSITION-GUIDE §5). `keepalive` subscribes with an
427
+ * empty sink so the node stays wired for `.cache` and upstream propagation.
428
+ *
429
+ * Returns the unsubscribe handle. Common usage:
430
+ * `graph.addDisposer(keepalive(node))`.
431
+ *
432
+ * @category extra
433
+ */
434
+ declare function keepalive(n: Node<unknown>): () => void;
435
+ /** Bundle returned by {@link reactiveCounter}. */
436
+ type ReactiveCounterBundle = {
437
+ /** Reactive node holding the current count. */
438
+ readonly node: Node<number>;
439
+ /** Increment by 1. Returns `false` if cap would be exceeded. */
440
+ increment(): boolean;
441
+ /** Current count (synchronous read). */
442
+ get(): number;
443
+ /** Whether the counter has reached its cap. */
444
+ atCap(): boolean;
445
+ };
446
+ /**
447
+ * Reactive counter with a cap — the building block for circuit breakers.
448
+ *
449
+ * Wraps a `state(0)` node with `increment()` that respects a maximum.
450
+ * The `node` is subscribable and composable like any reactive node. When
451
+ * the cap is reached, `increment()` returns `false`.
452
+ *
453
+ * ```ts
454
+ * const retries = reactiveCounter(10);
455
+ * retries.increment(); // true — count is now 1
456
+ * retries.node.subscribe(...); // reactive updates
457
+ * retries.atCap(); // false
458
+ * ```
459
+ *
460
+ * @param cap - Maximum value (inclusive). 0 = no increments allowed.
461
+ * @category extra
462
+ */
463
+ declare function reactiveCounter(cap: number): ReactiveCounterBundle;
464
+
465
+ export { type AsyncSourceOpts, type EventTargetLike, type FromCronOptions, type NodeInput, type ReactiveCounterBundle, cached, empty, escapeRegexChar, firstValueFrom, firstWhere, forEach, fromAny, fromAsyncIter, fromCron, fromEvent, fromIter, fromPromise, fromRaf, fromTimer, globToRegExp, keepalive, matchesAnyPattern, never, of, reactiveCounter, replay, share, shareReplay, throwError, toArray };
@@ -0,0 +1,57 @@
1
+ import {
2
+ cached,
3
+ empty,
4
+ escapeRegexChar,
5
+ firstValueFrom,
6
+ firstWhere,
7
+ forEach,
8
+ fromAny,
9
+ fromAsyncIter,
10
+ fromCron,
11
+ fromEvent,
12
+ fromIter,
13
+ fromPromise,
14
+ fromRaf,
15
+ fromTimer,
16
+ globToRegExp,
17
+ keepalive,
18
+ matchesAnyPattern,
19
+ never,
20
+ of,
21
+ reactiveCounter,
22
+ replay,
23
+ share,
24
+ shareReplay,
25
+ throwError,
26
+ toArray
27
+ } from "../chunk-BVZYTZ5H.js";
28
+ import "../chunk-PHOUUNK7.js";
29
+ import "../chunk-SX52TAR4.js";
30
+ export {
31
+ cached,
32
+ empty,
33
+ escapeRegexChar,
34
+ firstValueFrom,
35
+ firstWhere,
36
+ forEach,
37
+ fromAny,
38
+ fromAsyncIter,
39
+ fromCron,
40
+ fromEvent,
41
+ fromIter,
42
+ fromPromise,
43
+ fromRaf,
44
+ fromTimer,
45
+ globToRegExp,
46
+ keepalive,
47
+ matchesAnyPattern,
48
+ never,
49
+ of,
50
+ reactiveCounter,
51
+ replay,
52
+ share,
53
+ shareReplay,
54
+ throwError,
55
+ toArray
56
+ };
57
+ //# sourceMappingURL=sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}