@graphrefly/graphrefly 0.25.0 → 0.27.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 (231) hide show
  1. package/README.md +8 -0
  2. package/dist/ai-CaR_912Q.d.cts +1033 -0
  3. package/dist/ai-WlRltJV7.d.ts +1033 -0
  4. package/dist/audit-ClmqGOCx.d.cts +245 -0
  5. package/dist/audit-DRlSzBu9.d.ts +245 -0
  6. package/dist/{chunk-QOWVNWOC.js → chunk-3ZWCKRHX.js} +27 -25
  7. package/dist/{chunk-QOWVNWOC.js.map → chunk-3ZWCKRHX.js.map} +1 -1
  8. package/dist/chunk-APFNLIRG.js +62 -0
  9. package/dist/chunk-APFNLIRG.js.map +1 -0
  10. package/dist/chunk-AT5LKYNL.js +395 -0
  11. package/dist/chunk-AT5LKYNL.js.map +1 -0
  12. package/dist/{chunk-IAHGTNOZ.js → chunk-BQ6RQQFF.js} +351 -2095
  13. package/dist/chunk-BQ6RQQFF.js.map +1 -0
  14. package/dist/{chunk-L2GLW2U7.js → chunk-BVZYTZ5H.js} +9 -103
  15. package/dist/chunk-BVZYTZ5H.js.map +1 -0
  16. package/dist/{chunk-EVR6UFUV.js → chunk-DST5DKZS.js} +19 -15
  17. package/dist/{chunk-EVR6UFUV.js.map → chunk-DST5DKZS.js.map} +1 -1
  18. package/dist/{chunk-TKE3JGOH.js → chunk-GTE6PWRZ.js} +5 -692
  19. package/dist/chunk-GTE6PWRZ.js.map +1 -0
  20. package/dist/chunk-HXZEYDUR.js +94 -0
  21. package/dist/chunk-HXZEYDUR.js.map +1 -0
  22. package/dist/chunk-J22W6HV3.js +107 -0
  23. package/dist/chunk-J22W6HV3.js.map +1 -0
  24. package/dist/{chunk-PY4XCDLR.js → chunk-J2VBW3DZ.js} +6 -95
  25. package/dist/chunk-J2VBW3DZ.js.map +1 -0
  26. package/dist/{chunk-HWPIFSW2.js → chunk-JSCT3CR4.js} +6 -4
  27. package/dist/{chunk-HWPIFSW2.js.map → chunk-JSCT3CR4.js.map} +1 -1
  28. package/dist/chunk-JWBCY4NC.js +330 -0
  29. package/dist/chunk-JWBCY4NC.js.map +1 -0
  30. package/dist/chunk-K2AUJHVP.js +2251 -0
  31. package/dist/chunk-K2AUJHVP.js.map +1 -0
  32. package/dist/chunk-MJ2NKQQL.js +119 -0
  33. package/dist/chunk-MJ2NKQQL.js.map +1 -0
  34. package/dist/chunk-N6UR7YVY.js +198 -0
  35. package/dist/chunk-N6UR7YVY.js.map +1 -0
  36. package/dist/chunk-NC6S43JJ.js +456 -0
  37. package/dist/chunk-NC6S43JJ.js.map +1 -0
  38. package/dist/chunk-OFVJBJXR.js +98 -0
  39. package/dist/chunk-OFVJBJXR.js.map +1 -0
  40. package/dist/chunk-OHISZPOJ.js +97 -0
  41. package/dist/chunk-OHISZPOJ.js.map +1 -0
  42. package/dist/chunk-OU5CQKNW.js +102 -0
  43. package/dist/chunk-OU5CQKNW.js.map +1 -0
  44. package/dist/{chunk-XOFWRC73.js → chunk-PF7GRZMW.js} +316 -21
  45. package/dist/chunk-PF7GRZMW.js.map +1 -0
  46. package/dist/{chunk-5DJTTKX3.js → chunk-PHOUUNK7.js} +74 -111
  47. package/dist/chunk-PHOUUNK7.js.map +1 -0
  48. package/dist/chunk-RNHBMHKA.js +1665 -0
  49. package/dist/chunk-RNHBMHKA.js.map +1 -0
  50. package/dist/chunk-SX52TAR4.js +110 -0
  51. package/dist/chunk-SX52TAR4.js.map +1 -0
  52. package/dist/{chunk-H4RVA4VE.js → chunk-VYPWMZ6H.js} +2 -2
  53. package/dist/chunk-WBZOVTYK.js +171 -0
  54. package/dist/chunk-WBZOVTYK.js.map +1 -0
  55. package/dist/chunk-WKNUIZOY.js +354 -0
  56. package/dist/chunk-WKNUIZOY.js.map +1 -0
  57. package/dist/chunk-X3VMZYBT.js +713 -0
  58. package/dist/chunk-X3VMZYBT.js.map +1 -0
  59. package/dist/chunk-X5R3GL6H.js +525 -0
  60. package/dist/chunk-X5R3GL6H.js.map +1 -0
  61. package/dist/chunk-XGPU467M.js +136 -0
  62. package/dist/chunk-XGPU467M.js.map +1 -0
  63. package/dist/compat/index.cjs +7656 -0
  64. package/dist/compat/index.cjs.map +1 -0
  65. package/dist/compat/index.d.cts +18 -0
  66. package/dist/compat/index.d.ts +18 -0
  67. package/dist/compat/index.js +50 -0
  68. package/dist/compat/index.js.map +1 -0
  69. package/dist/compat/jotai/index.cjs +2048 -0
  70. package/dist/compat/jotai/index.cjs.map +1 -0
  71. package/dist/compat/jotai/index.d.cts +2 -0
  72. package/dist/compat/jotai/index.d.ts +2 -0
  73. package/dist/compat/jotai/index.js +9 -0
  74. package/dist/compat/jotai/index.js.map +1 -0
  75. package/dist/compat/nanostores/index.cjs +2175 -0
  76. package/dist/compat/nanostores/index.cjs.map +1 -0
  77. package/dist/compat/nanostores/index.d.cts +2 -0
  78. package/dist/compat/nanostores/index.d.ts +2 -0
  79. package/dist/compat/nanostores/index.js +23 -0
  80. package/dist/compat/nanostores/index.js.map +1 -0
  81. package/dist/compat/nestjs/index.cjs +350 -16
  82. package/dist/compat/nestjs/index.cjs.map +1 -1
  83. package/dist/compat/nestjs/index.d.cts +6 -6
  84. package/dist/compat/nestjs/index.d.ts +6 -6
  85. package/dist/compat/nestjs/index.js +11 -9
  86. package/dist/compat/react/index.cjs +141 -0
  87. package/dist/compat/react/index.cjs.map +1 -0
  88. package/dist/compat/react/index.d.cts +2 -0
  89. package/dist/compat/react/index.d.ts +2 -0
  90. package/dist/compat/react/index.js +12 -0
  91. package/dist/compat/react/index.js.map +1 -0
  92. package/dist/compat/solid/index.cjs +128 -0
  93. package/dist/compat/solid/index.cjs.map +1 -0
  94. package/dist/compat/solid/index.d.cts +2 -0
  95. package/dist/compat/solid/index.d.ts +2 -0
  96. package/dist/compat/solid/index.js +12 -0
  97. package/dist/compat/solid/index.js.map +1 -0
  98. package/dist/compat/svelte/index.cjs +131 -0
  99. package/dist/compat/svelte/index.cjs.map +1 -0
  100. package/dist/compat/svelte/index.d.cts +2 -0
  101. package/dist/compat/svelte/index.d.ts +2 -0
  102. package/dist/compat/svelte/index.js +12 -0
  103. package/dist/compat/svelte/index.js.map +1 -0
  104. package/dist/compat/vue/index.cjs +146 -0
  105. package/dist/compat/vue/index.cjs.map +1 -0
  106. package/dist/compat/vue/index.d.cts +3 -0
  107. package/dist/compat/vue/index.d.ts +3 -0
  108. package/dist/compat/vue/index.js +12 -0
  109. package/dist/compat/vue/index.js.map +1 -0
  110. package/dist/compat/zustand/index.cjs +4931 -0
  111. package/dist/compat/zustand/index.cjs.map +1 -0
  112. package/dist/compat/zustand/index.d.cts +5 -0
  113. package/dist/compat/zustand/index.d.ts +5 -0
  114. package/dist/compat/zustand/index.js +12 -0
  115. package/dist/compat/zustand/index.js.map +1 -0
  116. package/dist/composite-C7PcQvcs.d.cts +303 -0
  117. package/dist/composite-aUCvjZVR.d.ts +303 -0
  118. package/dist/core/index.cjs +53 -4
  119. package/dist/core/index.cjs.map +1 -1
  120. package/dist/core/index.d.cts +4 -3
  121. package/dist/core/index.d.ts +4 -3
  122. package/dist/core/index.js +26 -24
  123. package/dist/demo-shell-BDkOptd6.d.ts +102 -0
  124. package/dist/demo-shell-Crid1WdR.d.cts +102 -0
  125. package/dist/extra/index.cjs +222 -110
  126. package/dist/extra/index.cjs.map +1 -1
  127. package/dist/extra/index.d.cts +6 -4
  128. package/dist/extra/index.d.ts +6 -4
  129. package/dist/extra/index.js +72 -65
  130. package/dist/extra/sources.cjs +2486 -0
  131. package/dist/extra/sources.cjs.map +1 -0
  132. package/dist/extra/sources.d.cts +465 -0
  133. package/dist/extra/sources.d.ts +465 -0
  134. package/dist/extra/sources.js +57 -0
  135. package/dist/extra/sources.js.map +1 -0
  136. package/dist/graph/index.cjs +408 -14
  137. package/dist/graph/index.cjs.map +1 -1
  138. package/dist/graph/index.d.cts +5 -5
  139. package/dist/graph/index.d.ts +5 -5
  140. package/dist/graph/index.js +13 -5
  141. package/dist/{graph-D-3JIQme.d.cts → graph-CCwGKLCm.d.ts} +195 -4
  142. package/dist/{graph-B6NFqv3z.d.ts → graph-DNCrvZSn.d.cts} +195 -4
  143. package/dist/index-3lsddbbS.d.ts +86 -0
  144. package/dist/index-B1tloyhO.d.cts +34 -0
  145. package/dist/{index-CYkjxu3s.d.ts → index-B6D3QNSA.d.ts} +33 -4
  146. package/dist/index-B6EhDnjH.d.cts +37 -0
  147. package/dist/index-B9B7_HEY.d.ts +37 -0
  148. package/dist/{index-Ds23Wvou.d.ts → index-BHlKbUwO.d.cts} +131 -883
  149. package/dist/{index-DiobMNwE.d.ts → index-BPVt8kqc.d.ts} +3 -3
  150. package/dist/index-BaSM3aYt.d.ts +195 -0
  151. package/dist/index-BuEoe-Qu.d.ts +121 -0
  152. package/dist/{index-Ch0IpIO0.d.cts → index-BwfLUNw4.d.ts} +131 -883
  153. package/dist/index-ByQxazQJ.d.cts +86 -0
  154. package/dist/index-C0svESO4.d.ts +127 -0
  155. package/dist/{index-OXImXMq6.d.ts → index-C8oil6M6.d.ts} +18 -196
  156. package/dist/{index-DKE1EATr.d.cts → index-CI3DprxP.d.cts} +18 -196
  157. package/dist/{index-AMWewNDe.d.cts → index-CO8uBlUh.d.cts} +33 -4
  158. package/dist/index-CxFrXH4m.d.ts +45 -0
  159. package/dist/index-D8wS_PeY.d.cts +121 -0
  160. package/dist/index-DO_6JN9Z.d.cts +127 -0
  161. package/dist/index-DVGiGFGT.d.cts +195 -0
  162. package/dist/index-DYme44FM.d.cts +44 -0
  163. package/dist/{index-J7Kc0oIQ.d.cts → index-DlLp-2Xn.d.cts} +3 -3
  164. package/dist/index-Dzk2hrlR.d.ts +44 -0
  165. package/dist/index-VHqptjhu.d.cts +45 -0
  166. package/dist/index-VdHQMPy1.d.ts +36 -0
  167. package/dist/index-Xi3u0HCQ.d.cts +36 -0
  168. package/dist/index-wEn0eFe8.d.ts +34 -0
  169. package/dist/index.cjs +1780 -176
  170. package/dist/index.cjs.map +1 -1
  171. package/dist/index.d.cts +784 -2082
  172. package/dist/index.d.ts +784 -2082
  173. package/dist/index.js +955 -4349
  174. package/dist/index.js.map +1 -1
  175. package/dist/memory-C6Z2tGpC.d.cts +139 -0
  176. package/dist/memory-li6FL5RM.d.ts +139 -0
  177. package/dist/messaging-Gt4LPbyA.d.cts +269 -0
  178. package/dist/messaging-XDoYablx.d.ts +269 -0
  179. package/dist/{meta-DWbkoq1s.d.cts → meta-BxCA7rcr.d.cts} +1 -1
  180. package/dist/{meta-CnkLA_43.d.ts → meta-CbznRPYJ.d.ts} +1 -1
  181. package/dist/{node-B-f-Lu-k.d.cts → node-BmerH3kS.d.cts} +26 -1
  182. package/dist/{node-B-f-Lu-k.d.ts → node-BmerH3kS.d.ts} +26 -1
  183. package/dist/{observable-uP-wy_uK.d.ts → observable-BgGUwcqp.d.ts} +1 -1
  184. package/dist/{observable-DBnrwcar.d.cts → observable-DJt_AxzQ.d.cts} +1 -1
  185. package/dist/patterns/ai.cjs +7930 -0
  186. package/dist/patterns/ai.cjs.map +1 -0
  187. package/dist/patterns/ai.d.cts +10 -0
  188. package/dist/patterns/ai.d.ts +10 -0
  189. package/dist/patterns/ai.js +71 -0
  190. package/dist/patterns/ai.js.map +1 -0
  191. package/dist/patterns/audit.cjs +5805 -0
  192. package/dist/patterns/audit.cjs.map +1 -0
  193. package/dist/patterns/audit.d.cts +6 -0
  194. package/dist/patterns/audit.d.ts +6 -0
  195. package/dist/patterns/audit.js +29 -0
  196. package/dist/patterns/audit.js.map +1 -0
  197. package/dist/patterns/demo-shell.cjs +5604 -0
  198. package/dist/patterns/demo-shell.cjs.map +1 -0
  199. package/dist/patterns/demo-shell.d.cts +6 -0
  200. package/dist/patterns/demo-shell.d.ts +6 -0
  201. package/dist/patterns/demo-shell.js +15 -0
  202. package/dist/patterns/demo-shell.js.map +1 -0
  203. package/dist/patterns/memory.cjs +5283 -0
  204. package/dist/patterns/memory.cjs.map +1 -0
  205. package/dist/patterns/memory.d.cts +5 -0
  206. package/dist/patterns/memory.d.ts +5 -0
  207. package/dist/patterns/memory.js +20 -0
  208. package/dist/patterns/memory.js.map +1 -0
  209. package/dist/patterns/reactive-layout/index.cjs +355 -13
  210. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  211. package/dist/patterns/reactive-layout/index.d.cts +6 -5
  212. package/dist/patterns/reactive-layout/index.d.ts +6 -5
  213. package/dist/patterns/reactive-layout/index.js +15 -12
  214. package/dist/reactive-layout-MQP--J3F.d.cts +183 -0
  215. package/dist/reactive-layout-u5Ulnqag.d.ts +183 -0
  216. package/dist/{storage-BuTdpCI1.d.cts → storage-CMjUUuxn.d.ts} +10 -2
  217. package/dist/{storage-F2X1U1x0.d.ts → storage-DdWlZo6U.d.cts} +10 -2
  218. package/dist/sugar-CCOxXK1e.d.ts +201 -0
  219. package/dist/sugar-D02n5JjF.d.cts +201 -0
  220. package/package.json +63 -3
  221. package/dist/chunk-5DJTTKX3.js.map +0 -1
  222. package/dist/chunk-IAHGTNOZ.js.map +0 -1
  223. package/dist/chunk-L2GLW2U7.js.map +0 -1
  224. package/dist/chunk-MW4VAKAO.js +0 -47
  225. package/dist/chunk-MW4VAKAO.js.map +0 -1
  226. package/dist/chunk-PY4XCDLR.js.map +0 -1
  227. package/dist/chunk-TKE3JGOH.js.map +0 -1
  228. package/dist/chunk-XOFWRC73.js.map +0 -1
  229. package/dist/index-BJB7t9gg.d.cts +0 -392
  230. package/dist/index-C-TXEa7C.d.ts +0 -392
  231. /package/dist/{chunk-H4RVA4VE.js.map → chunk-VYPWMZ6H.js.map} +0 -0
@@ -1,392 +0,0 @@
1
- import { t as Messages, a as NodeOptions, F as FnCtx, N as Node, b as NodeActions, x as NodeFnCleanup, A as Actor, C as COMPLETE, c as COMPLETE_MSG, d as COMPLETE_ONLY_BATCH, D as DATA, e as DEFAULT_ACTOR, f as DIRTY, g as DIRTY_MSG, h as DIRTY_ONLY_BATCH, i as DepRecord, E as ERROR, G as GlobalInspectorEvent, j as GlobalInspectorHook, k as GraphReFlyConfig, l as GuardAction, m as GuardDenied, n as GuardDeniedDetails, H as HashFn, I as INVALIDATE, o as INVALIDATE_MSG, p as INVALIDATE_ONLY_BATCH, M as Message, q as MessageContext, r as MessageTypeRegistration, s as MessageTypeRegistrationInput, u as NodeCtx, v as NodeDescribeKind, w as NodeFn, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, P as NodeVersionInfo, Q as OnMessageHandler, R as OnSubscribeHandler, S as PAUSE, T as PolicyAllow, U as PolicyDeny, V as PolicyRuleData, W as RESOLVED, X as RESOLVED_MSG, Y as RESOLVED_ONLY_BATCH, Z as RESUME, _ as START, $ as START_MSG, a0 as SubscribeContext, a1 as TEARDOWN, a2 as TEARDOWN_MSG, a3 as TEARDOWN_ONLY_BATCH, a4 as V0, a5 as V1, a6 as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from './node-B-f-Lu-k.js';
2
- import { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from './meta-CnkLA_43.js';
3
-
4
- /**
5
- * Batch deferral for tier-3+ messages, plus per-node emit coalescing inside
6
- * explicit `batch()` scopes.
7
- *
8
- * **Canonical invariant:** GRAPHREFLY-SPEC.md §1.3.7 — inside a batch,
9
- * tier 0–2 signals propagate immediately; tier 3 (DATA/RESOLVED), tier 4
10
- * (COMPLETE/ERROR), and tier 5 (TEARDOWN) are queued and drained in ascending
11
- * phase order after the outermost `batch()` callback returns.
12
- *
13
- * **Per-node emit coalescing (Bug 2 fix, 2026-04-17).** Inside an explicit
14
- * `batch()` scope, consecutive emissions from the same node accumulate in
15
- * `NodeImpl._batchPendingMessages` (see JSDoc there) instead of each producing
16
- * a separate downstream wave. K `.emit()` calls to the same source collapse to
17
- * one coalesced `downWithBatch` call per child edge at batch end. Outside batch
18
- * (or during drain), coalescing does NOT apply — each emit produces its own wave.
19
- *
20
- * **Phase vocabulary:**
21
- * - Phase 1 = tiers 0–2 — immediate, never queued.
22
- * - Phase 2 = tier 3 — {@link drainPhase2}. Value settlements.
23
- * - Phase 3 = tier 4 — {@link drainPhase3}. Terminal signals.
24
- * - Phase 4 = tier 5 — {@link drainPhase4}. TEARDOWN (unified deferral).
25
- *
26
- * Drain rule: fire any pending flush hooks first, then the lowest non-empty
27
- * phase. Re-enqueues during drain (and hooks registered by reentrant batches
28
- * inside subscriber callbacks) bump the loop back to the top so newly-added
29
- * hooks and closures get processed.
30
- */
31
-
32
- /**
33
- * Returns whether the current call stack is inside a batch scope **or** while
34
- * a deferred drain is in progress. Nested `downWithBatch` calls during drain
35
- * still defer (they bump the drain loop).
36
- */
37
- declare function isBatching(): boolean;
38
- /**
39
- * Runs `fn` inside a batch scope. Nested `batch()` calls share one deferral
40
- * queue. If `fn` throws, deferred work for the outer frame is discarded
41
- * (unless a drain is already in progress — cross-language decision A4).
42
- */
43
- declare function batch(fn: () => void): void;
44
- /**
45
- * Deliver pre-sorted messages through `sink` with tier-based deferral applied.
46
- *
47
- * `messages` MUST be in ascending tier order (produced by `_frameBatch` in
48
- * `node.ts`); the walker exploits that invariant to find phase cuts in one
49
- * pass without re-sorting.
50
- *
51
- * Behavior:
52
- * - Tier 0–2 — delivered synchronously.
53
- * - Tier 3 — deferred to {@link drainPhase2} when batching, else synchronous.
54
- * - Tier 4 — deferred to {@link drainPhase3} when batching, else synchronous.
55
- * - Tier 5 — deferred to {@link drainPhase4} when batching, else synchronous.
56
- *
57
- * Tier-classification uses the caller-supplied `tierOf` so that batch stays
58
- * decoupled from `GraphReFlyConfig`. NodeImpl passes `config.tierOf` (a
59
- * pre-bound closure built once in the config constructor) at the emit site;
60
- * alternate configs can pass their own lookup.
61
- */
62
- declare function downWithBatch(sink: (messages: Messages) => void, messages: Messages, tierOf: (t: symbol) => number): void;
63
-
64
- /**
65
- * Centralised timestamp utilities.
66
- *
67
- * Convention: all graphrefly-ts timestamps use nanoseconds (`_ns` suffix).
68
- *
69
- * - {@link monotonicNs} — monotonic clock (ordering, durations, timeline events).
70
- * - {@link wallClockNs} — wall-clock (mutation attribution, cron emission).
71
- *
72
- * **Precision limits (JS platform):**
73
- *
74
- * - `monotonicNs`: effective ~microsecond precision. `performance.now()` returns
75
- * milliseconds with ~5µs resolution; the last 3 digits of the nanosecond value
76
- * are always zero. Python's `time.monotonic_ns()` gives true nanoseconds.
77
- *
78
- * - `wallClockNs`: ~256ns precision loss at current epoch. `Date.now() * 1e6`
79
- * produces values around 1.8×10¹⁸ which exceed IEEE 754's 2⁵³ safe integer
80
- * limit. Python's `time.time_ns()` (arbitrary-precision `int`) has no loss.
81
- * In practice this is irrelevant — JS is single-threaded, so sub-microsecond
82
- * timestamp collisions cannot occur.
83
- */
84
- /** Monotonic nanosecond timestamp via `performance.now()`. */
85
- declare function monotonicNs(): number;
86
- /** Wall-clock nanosecond timestamp via `Date.now()`. */
87
- declare function wallClockNs(): number;
88
-
89
- /**
90
- * Sugar constructors over the raw `node()` primitive.
91
- *
92
- * Each factory wraps a user-friendly function into the canonical
93
- * `NodeFn = (data, actions, ctx) => cleanup | void` shape, then calls
94
- * `node(...)`. This is the only place `actions.emit(...)` is invoked
95
- * on behalf of the user — if you need finer control (multi-emission,
96
- * raw `actions.down` / `actions.up`, cleanup return), use the raw
97
- * `node()` factory from `./node.js` directly.
98
- *
99
- * See SESSION-foundation-redesign.md §8.5 + §10.6 for the rewrite.
100
- */
101
-
102
- /**
103
- * Creates a manual source node. Drive it with `state.emit(v)` (framed,
104
- * diamond-safe) or `state.down([[DATA, v]])` (raw compat path).
105
- *
106
- * @param initial - Starting cached value. Pass `undefined` or `null`
107
- * explicitly to cache that value; omit to leave the node in `"sentinel"`.
108
- * @param opts - Optional {@link NodeOptions} (excluding `initial`).
109
- */
110
- declare function state<T>(initial: T, opts?: Omit<NodeOptions<T>, "initial">): Node<T>;
111
- /**
112
- * User-level producer compute: runs once on first-subscriber activation.
113
- * Receives `actions` for imperative emission and `ctx` for FnCtx (typically
114
- * only `store` is useful on a producer — no deps means `prevData` and
115
- * `terminalDeps` are empty).
116
- */
117
- type ProducerFn = (actions: NodeActions, ctx: FnCtx) => NodeFnCleanup | void;
118
- /**
119
- * Creates a producer node with no deps; `fn` runs once when the first
120
- * subscriber connects. Return a cleanup function (`() => void`) or
121
- * `{ deactivation: () => void }` to register teardown.
122
- *
123
- * @example
124
- * ```ts
125
- * const ticker = producer((actions) => {
126
- * const id = setInterval(() => actions.emit(Date.now()), 1000);
127
- * return () => clearInterval(id);
128
- * });
129
- * ```
130
- */
131
- declare function producer<T = unknown>(fn: ProducerFn, opts?: NodeOptions<T>): Node<T>;
132
- /**
133
- * User-level derived compute: receives the latest DATA from each dep and
134
- * returns the new value. The sugar wraps it with `actions.emit(fn(...))`
135
- * so the return value flows through the framed emit pipeline.
136
- *
137
- * For derived nodes that need to inspect `ctx.prevData` / `ctx.terminalDeps`
138
- * / `ctx.store`, accept the optional second parameter.
139
- */
140
- type DerivedFn<T> = (data: readonly unknown[], ctx: FnCtx) => T | undefined | null;
141
- /**
142
- * Creates a derived node that computes **one output per wave** from the latest
143
- * value of each dependency — **snapshot / combine semantics**.
144
- *
145
- * `fn` receives one scalar per dep (the last DATA value seen this wave, or the
146
- * prior-wave value as fallback). It is called once per settled wave and emits
147
- * a single value via `actions.emit`. The equals check then suppresses the
148
- * emission as `RESOLVED` if the output has not changed.
149
- *
150
- * **Not for streaming one-to-one transforms.** If each DATA value in a batch
151
- * must produce a corresponding output (e.g. transforming every item emitted by
152
- * `fromIter` individually), use {@link map} or raw `node()` with full batch
153
- * iteration instead. `derived` only sees the *last* value per dep when a batch
154
- * carries multiple DATAs.
155
- *
156
- * @example
157
- * ```ts
158
- * const a = state(1);
159
- * const b = derived([a], ([x]) => (x as number) * 2);
160
- * ```
161
- */
162
- declare function derived<T = unknown>(deps: readonly Node[], fn: DerivedFn<T>, opts?: NodeOptions<T> & {
163
- partial?: boolean;
164
- }): Node<T>;
165
- /**
166
- * User-level effect compute: fires when deps settle. Return value is NOT
167
- * auto-emitted — use `actions.emit(v)` / `actions.down(msgs)` explicitly if
168
- * the effect also wants to produce downstream messages. Return a cleanup
169
- * function or `{ deactivation }` to register teardown.
170
- */
171
- type EffectFn = (data: readonly unknown[], actions: NodeActions, ctx: FnCtx) => NodeFnCleanup | void;
172
- /**
173
- * Runs a side-effect when deps settle. Return value is not auto-emitted.
174
- *
175
- * @example
176
- * ```ts
177
- * effect([source], ([v]) => {
178
- * console.log(v);
179
- * });
180
- * ```
181
- */
182
- declare function effect(deps: readonly Node[], fn: EffectFn, opts?: NodeOptions<unknown> & {
183
- partial?: boolean;
184
- }): Node<unknown>;
185
- /**
186
- * Proxy handed to a {@link DynamicFn}. `track(dep)` returns the dep's
187
- * latest DATA payload, as delivered through the protocol. Reading from
188
- * `track` does NOT bypass the message protocol — it reads the internal
189
- * `DepRecord.prevData` (the stable end-of-previous-wave value) that
190
- * `_onDepMessage` already populated. If a dep has not yet sent DATA,
191
- * `track` returns `undefined`.
192
- */
193
- type TrackFn = (dep: Node) => unknown;
194
- /** User-level dynamicNode compute. */
195
- type DynamicFn<T> = (track: TrackFn, ctx: FnCtx) => T | undefined | null;
196
- /**
197
- * Sugar over `derived(...)` that exposes dep values via a `track(dep)`
198
- * proxy instead of positional `data[i]`. All declared `allDeps` participate
199
- * in wave tracking, so the first fn run waits for every dep to settle.
200
- * Unused deps that update just re-run fn; `equals` absorbs unchanged
201
- * outputs as RESOLVED.
202
- *
203
- * P3-compliant: `track(dep)` reads from the framework-managed
204
- * `DepRecord.prevData` populated by the protocol, never from
205
- * `dep.cache`.
206
- *
207
- * @example
208
- * ```ts
209
- * const a = state(1);
210
- * const b = state(10);
211
- * const sum = dynamicNode([a, b], (track) => (track(a) as number) + (track(b) as number));
212
- * ```
213
- */
214
- declare function dynamicNode<T = unknown>(allDeps: readonly Node[], fn: DynamicFn<T>, opts?: NodeOptions<T> & {
215
- partial?: boolean;
216
- }): Node<T>;
217
- /**
218
- * Like {@link dynamicNode} but deps are discovered at runtime via `track()`
219
- * calls — no upfront `allDeps` array needed. Designed for pull-based compat
220
- * layers (Jotai atoms, TC39 Signals) where deps are unknown until fn runs.
221
- *
222
- * **Two-phase discovery:**
223
- * 1. fn runs. Each `track(dep)` for an unknown dep: subscribes immediately
224
- * via `_addDep`, returns `dep.cache` as a stub (P3 boundary exception).
225
- * Result is discarded (discovery run).
226
- * 2. New deps settle (DATA from subscribe handshake). Wave machinery
227
- * re-triggers fn. `track(dep)` now returns protocol-delivered `data[i]`.
228
- * If MORE unknown deps appear, repeat step 1.
229
- * 3. Converges when no new deps found → real run → `actions.emit(result)`.
230
- *
231
- * P3 violation is limited to discovery runs. Once all deps are known,
232
- * subsequent waves use protocol-delivered values exclusively.
233
- *
234
- * Re-entrance safety: `_addDep` subscribes immediately. If the dep delivers
235
- * DATA synchronously during fn execution, `_execFn`'s re-entrance guard
236
- * defers the re-run to after the current fn returns.
237
- *
238
- * @param opts - Optional {@link AutoTrackOptions}. Pass `{ partial: true }` to
239
- * allow fn to run before all known deps have delivered their first value
240
- * (useful for optional/secondary deps).
241
- *
242
- * @example
243
- * ```ts
244
- * const a = state(1), b = state(2);
245
- * const sum = autoTrackNode((track) => track(a) + track(b));
246
- * // deps [a, b] discovered automatically on first run
247
- * ```
248
- */
249
- /**
250
- * Options for {@link autoTrackNode}.
251
- */
252
- interface AutoTrackOptions<T> extends NodeOptions<T> {
253
- /**
254
- * When `true`, fn may run before all known deps have delivered their first
255
- * DATA. Unknown deps return `undefined` via `track()`, which the fn must
256
- * handle explicitly. Useful when some deps are "nice-to-have" — e.g. a
257
- * primary computation should continue while a secondary dep is still
258
- * initialising.
259
- *
260
- * When `false` (default), fn is held until every known dep has delivered at
261
- * least one DATA value — a RESOLVED is emitted for the wave instead.
262
- * This matches `derived()` semantics and is the correct default for
263
- * pull-based compat layers (Signals, Jotai) where all deps must be
264
- * initialised before the computation is meaningful.
265
- *
266
- * @default false
267
- */
268
- partial?: boolean;
269
- }
270
- declare function autoTrackNode<T = unknown>(fn: (track: TrackFn, ctx: FnCtx) => T | undefined | null, opts?: AutoTrackOptions<T>): Node<T>;
271
- /** Unary operator used by {@link pipe}. */
272
- type PipeOperator = (n: Node) => Node;
273
- /**
274
- * Composes unary operators left-to-right; returns the final node.
275
- *
276
- * @example
277
- * ```ts
278
- * const out = pipe(
279
- * source,
280
- * (n) => map(n, (x) => x + 1),
281
- * (n) => filter(n, (x) => x > 0),
282
- * );
283
- * ```
284
- */
285
- declare function pipe(source: Node, ...ops: PipeOperator[]): Node;
286
-
287
- /**
288
- * Core layer: message protocol, node primitive, lifecycle (Phase 0).
289
- */
290
-
291
- declare const index_Actor: typeof Actor;
292
- type index_AutoTrackOptions<T> = AutoTrackOptions<T>;
293
- declare const index_COMPLETE: typeof COMPLETE;
294
- declare const index_COMPLETE_MSG: typeof COMPLETE_MSG;
295
- declare const index_COMPLETE_ONLY_BATCH: typeof COMPLETE_ONLY_BATCH;
296
- declare const index_DATA: typeof DATA;
297
- declare const index_DEFAULT_ACTOR: typeof DEFAULT_ACTOR;
298
- declare const index_DIRTY: typeof DIRTY;
299
- declare const index_DIRTY_MSG: typeof DIRTY_MSG;
300
- declare const index_DIRTY_ONLY_BATCH: typeof DIRTY_ONLY_BATCH;
301
- declare const index_DepRecord: typeof DepRecord;
302
- type index_DerivedFn<T> = DerivedFn<T>;
303
- declare const index_DescribeDetail: typeof DescribeDetail;
304
- declare const index_DescribeField: typeof DescribeField;
305
- declare const index_DescribeNodeOutput: typeof DescribeNodeOutput;
306
- type index_DynamicFn<T> = DynamicFn<T>;
307
- declare const index_ERROR: typeof ERROR;
308
- type index_EffectFn = EffectFn;
309
- declare const index_FnCtx: typeof FnCtx;
310
- declare const index_GlobalInspectorEvent: typeof GlobalInspectorEvent;
311
- declare const index_GlobalInspectorHook: typeof GlobalInspectorHook;
312
- declare const index_GraphReFlyConfig: typeof GraphReFlyConfig;
313
- declare const index_GuardAction: typeof GuardAction;
314
- declare const index_GuardDenied: typeof GuardDenied;
315
- declare const index_GuardDeniedDetails: typeof GuardDeniedDetails;
316
- declare const index_HashFn: typeof HashFn;
317
- declare const index_INVALIDATE: typeof INVALIDATE;
318
- declare const index_INVALIDATE_MSG: typeof INVALIDATE_MSG;
319
- declare const index_INVALIDATE_ONLY_BATCH: typeof INVALIDATE_ONLY_BATCH;
320
- declare const index_Message: typeof Message;
321
- declare const index_MessageContext: typeof MessageContext;
322
- declare const index_MessageTypeRegistration: typeof MessageTypeRegistration;
323
- declare const index_MessageTypeRegistrationInput: typeof MessageTypeRegistrationInput;
324
- declare const index_Messages: typeof Messages;
325
- declare const index_Node: typeof Node;
326
- declare const index_NodeActions: typeof NodeActions;
327
- declare const index_NodeCtx: typeof NodeCtx;
328
- declare const index_NodeDescribeKind: typeof NodeDescribeKind;
329
- declare const index_NodeFn: typeof NodeFn;
330
- declare const index_NodeFnCleanup: typeof NodeFnCleanup;
331
- declare const index_NodeGuard: typeof NodeGuard;
332
- declare const index_NodeImpl: typeof NodeImpl;
333
- declare const index_NodeInspectorHook: typeof NodeInspectorHook;
334
- declare const index_NodeInspectorHookEvent: typeof NodeInspectorHookEvent;
335
- declare const index_NodeOptions: typeof NodeOptions;
336
- declare const index_NodeSink: typeof NodeSink;
337
- declare const index_NodeStatus: typeof NodeStatus;
338
- declare const index_NodeTransportOptions: typeof NodeTransportOptions;
339
- declare const index_NodeVersionInfo: typeof NodeVersionInfo;
340
- declare const index_OnMessageHandler: typeof OnMessageHandler;
341
- declare const index_OnSubscribeHandler: typeof OnSubscribeHandler;
342
- declare const index_PAUSE: typeof PAUSE;
343
- type index_PipeOperator = PipeOperator;
344
- declare const index_PolicyAllow: typeof PolicyAllow;
345
- declare const index_PolicyDeny: typeof PolicyDeny;
346
- declare const index_PolicyRuleData: typeof PolicyRuleData;
347
- type index_ProducerFn = ProducerFn;
348
- declare const index_RESOLVED: typeof RESOLVED;
349
- declare const index_RESOLVED_MSG: typeof RESOLVED_MSG;
350
- declare const index_RESOLVED_ONLY_BATCH: typeof RESOLVED_ONLY_BATCH;
351
- declare const index_RESUME: typeof RESUME;
352
- declare const index_START: typeof START;
353
- declare const index_START_MSG: typeof START_MSG;
354
- declare const index_SubscribeContext: typeof SubscribeContext;
355
- declare const index_TEARDOWN: typeof TEARDOWN;
356
- declare const index_TEARDOWN_MSG: typeof TEARDOWN_MSG;
357
- declare const index_TEARDOWN_ONLY_BATCH: typeof TEARDOWN_ONLY_BATCH;
358
- type index_TrackFn = TrackFn;
359
- declare const index_V0: typeof V0;
360
- declare const index_V1: typeof V1;
361
- declare const index_VersioningLevel: typeof VersioningLevel;
362
- declare const index_VersioningOptions: typeof VersioningOptions;
363
- declare const index_accessHintForGuard: typeof accessHintForGuard;
364
- declare const index_advanceVersion: typeof advanceVersion;
365
- declare const index_autoTrackNode: typeof autoTrackNode;
366
- declare const index_batch: typeof batch;
367
- declare const index_configure: typeof configure;
368
- declare const index_createVersioning: typeof createVersioning;
369
- declare const index_defaultConfig: typeof defaultConfig;
370
- declare const index_defaultHash: typeof defaultHash;
371
- declare const index_derived: typeof derived;
372
- declare const index_downWithBatch: typeof downWithBatch;
373
- declare const index_dynamicNode: typeof dynamicNode;
374
- declare const index_effect: typeof effect;
375
- declare const index_isBatching: typeof isBatching;
376
- declare const index_isV1: typeof isV1;
377
- declare const index_monotonicNs: typeof monotonicNs;
378
- declare const index_node: typeof node;
379
- declare const index_normalizeActor: typeof normalizeActor;
380
- declare const index_pipe: typeof pipe;
381
- declare const index_policy: typeof policy;
382
- declare const index_policyFromRules: typeof policyFromRules;
383
- declare const index_producer: typeof producer;
384
- declare const index_registerBuiltins: typeof registerBuiltins;
385
- declare const index_resolveDescribeFields: typeof resolveDescribeFields;
386
- declare const index_state: typeof state;
387
- declare const index_wallClockNs: typeof wallClockNs;
388
- declare namespace index {
389
- export { index_Actor as Actor, type index_AutoTrackOptions as AutoTrackOptions, index_COMPLETE as COMPLETE, index_COMPLETE_MSG as COMPLETE_MSG, index_COMPLETE_ONLY_BATCH as COMPLETE_ONLY_BATCH, index_DATA as DATA, index_DEFAULT_ACTOR as DEFAULT_ACTOR, index_DIRTY as DIRTY, index_DIRTY_MSG as DIRTY_MSG, index_DIRTY_ONLY_BATCH as DIRTY_ONLY_BATCH, index_DepRecord as DepRecord, type index_DerivedFn as DerivedFn, index_DescribeDetail as DescribeDetail, index_DescribeField as DescribeField, index_DescribeNodeOutput as DescribeNodeOutput, type index_DynamicFn as DynamicFn, index_ERROR as ERROR, type index_EffectFn as EffectFn, index_FnCtx as FnCtx, index_GlobalInspectorEvent as GlobalInspectorEvent, index_GlobalInspectorHook as GlobalInspectorHook, index_GraphReFlyConfig as GraphReFlyConfig, index_GuardAction as GuardAction, index_GuardDenied as GuardDenied, index_GuardDeniedDetails as GuardDeniedDetails, index_HashFn as HashFn, index_INVALIDATE as INVALIDATE, index_INVALIDATE_MSG as INVALIDATE_MSG, index_INVALIDATE_ONLY_BATCH as INVALIDATE_ONLY_BATCH, index_Message as Message, index_MessageContext as MessageContext, index_MessageTypeRegistration as MessageTypeRegistration, index_MessageTypeRegistrationInput as MessageTypeRegistrationInput, index_Messages as Messages, index_Node as Node, index_NodeActions as NodeActions, index_NodeCtx as NodeCtx, index_NodeDescribeKind as NodeDescribeKind, index_NodeFn as NodeFn, index_NodeFnCleanup as NodeFnCleanup, index_NodeGuard as NodeGuard, index_NodeImpl as NodeImpl, index_NodeInspectorHook as NodeInspectorHook, index_NodeInspectorHookEvent as NodeInspectorHookEvent, index_NodeOptions as NodeOptions, index_NodeSink as NodeSink, index_NodeStatus as NodeStatus, index_NodeTransportOptions as NodeTransportOptions, index_NodeVersionInfo as NodeVersionInfo, index_OnMessageHandler as OnMessageHandler, index_OnSubscribeHandler as OnSubscribeHandler, index_PAUSE as PAUSE, type index_PipeOperator as PipeOperator, index_PolicyAllow as PolicyAllow, index_PolicyDeny as PolicyDeny, index_PolicyRuleData as PolicyRuleData, type index_ProducerFn as ProducerFn, index_RESOLVED as RESOLVED, index_RESOLVED_MSG as RESOLVED_MSG, index_RESOLVED_ONLY_BATCH as RESOLVED_ONLY_BATCH, index_RESUME as RESUME, index_START as START, index_START_MSG as START_MSG, index_SubscribeContext as SubscribeContext, index_TEARDOWN as TEARDOWN, index_TEARDOWN_MSG as TEARDOWN_MSG, index_TEARDOWN_ONLY_BATCH as TEARDOWN_ONLY_BATCH, type index_TrackFn as TrackFn, index_V0 as V0, index_V1 as V1, index_VersioningLevel as VersioningLevel, index_VersioningOptions as VersioningOptions, index_accessHintForGuard as accessHintForGuard, index_advanceVersion as advanceVersion, index_autoTrackNode as autoTrackNode, index_batch as batch, index_configure as configure, index_createVersioning as createVersioning, index_defaultConfig as defaultConfig, index_defaultHash as defaultHash, index_derived as derived, index_downWithBatch as downWithBatch, index_dynamicNode as dynamicNode, index_effect as effect, index_isBatching as isBatching, index_isV1 as isV1, index_monotonicNs as monotonicNs, index_node as node, index_normalizeActor as normalizeActor, index_pipe as pipe, index_policy as policy, index_policyFromRules as policyFromRules, index_producer as producer, index_registerBuiltins as registerBuiltins, index_resolveDescribeFields as resolveDescribeFields, index_state as state, index_wallClockNs as wallClockNs };
390
- }
391
-
392
- export { type AutoTrackOptions as A, type DerivedFn as D, type EffectFn as E, type PipeOperator as P, type TrackFn as T, type DynamicFn as a, type ProducerFn as b, autoTrackNode as c, batch as d, derived as e, downWithBatch as f, dynamicNode as g, effect as h, index as i, isBatching as j, producer as k, monotonicNs as m, pipe as p, state as s, wallClockNs as w };