@graphrefly/graphrefly 0.17.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-R6OHUUYB.js → chunk-AHRKWMNI.js} +7 -7
- package/dist/chunk-AHRKWMNI.js.map +1 -0
- package/dist/{chunk-2PORF4RP.js → chunk-BER7UYLM.js} +27 -32
- package/dist/chunk-BER7UYLM.js.map +1 -0
- package/dist/{chunk-646OG3PO.js → chunk-IRZAGZUB.js} +51 -52
- package/dist/chunk-IRZAGZUB.js.map +1 -0
- package/dist/{chunk-IHJHBADD.js → chunk-JC2SN46B.js} +385 -197
- package/dist/chunk-JC2SN46B.js.map +1 -0
- package/dist/{chunk-XJ6EMQ22.js → chunk-OO5QOAXI.js} +4 -10
- package/dist/chunk-OO5QOAXI.js.map +1 -0
- package/dist/{chunk-YXROQFXZ.js → chunk-UW77D7SP.js} +3 -3
- package/dist/{chunk-F2ULI3Q3.js → chunk-XUOY3YKN.js} +7 -3
- package/dist/chunk-XUOY3YKN.js.map +1 -0
- package/dist/chunk-YLR5JUJZ.js +111 -0
- package/dist/chunk-YLR5JUJZ.js.map +1 -0
- package/dist/{chunk-BV3TPSBK.js → chunk-YXR3WW3Q.js} +740 -755
- package/dist/chunk-YXR3WW3Q.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +1127 -983
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +4 -4
- package/dist/compat/nestjs/index.d.ts +4 -4
- package/dist/compat/nestjs/index.js +7 -13
- package/dist/core/index.cjs +653 -749
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +7 -7
- package/dist/extra/index.cjs +773 -795
- package/dist/extra/index.cjs.map +1 -1
- package/dist/extra/index.d.cts +4 -4
- package/dist/extra/index.d.ts +4 -4
- package/dist/extra/index.js +5 -11
- package/dist/graph/index.cjs +1036 -975
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +3 -3
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +8 -8
- package/dist/{graph-fCsaaVIa.d.cts → graph-KsTe57nI.d.cts} +127 -51
- package/dist/{graph-Dc-P9BVm.d.ts → graph-mILUUqW8.d.ts} +127 -51
- package/dist/{index-DhXznWyH.d.ts → index-8a605sg9.d.ts} +2 -2
- package/dist/{index-D7y9Q8W4.d.ts → index-B2SvPEbc.d.ts} +8 -69
- package/dist/{index-YlOH1Gw6.d.cts → index-BBUYZfJ1.d.cts} +122 -78
- package/dist/{index-ClaKZFPl.d.cts → index-Bjh5C1Tp.d.cts} +38 -35
- package/dist/{index-DWq0P9T6.d.ts → index-BjtlNirP.d.cts} +5 -7
- package/dist/{index-N704txAA.d.ts → index-BnkMgNNa.d.ts} +38 -35
- package/dist/{index-BBVBYPxr.d.cts → index-CgSiUouz.d.ts} +5 -7
- package/dist/{index-BmoUvOGN.d.ts → index-CvKzv0AW.d.ts} +122 -78
- package/dist/{index-4OIX-q0C.d.cts → index-UudxGnzc.d.cts} +8 -69
- package/dist/{index-DlGMf_Qe.d.cts → index-VHA43cGP.d.cts} +2 -2
- package/dist/index.cjs +6146 -5725
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +617 -383
- package/dist/index.d.ts +617 -383
- package/dist/index.js +4401 -4028
- package/dist/index.js.map +1 -1
- package/dist/{meta-BV4pj9ML.d.cts → meta-BnG7XAaE.d.cts} +395 -289
- package/dist/{meta-BV4pj9ML.d.ts → meta-BnG7XAaE.d.ts} +395 -289
- package/dist/observable-C8Kx_O6k.d.cts +36 -0
- package/dist/observable-DcBwQY7t.d.ts +36 -0
- package/dist/patterns/reactive-layout/index.cjs +1037 -857
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +3 -3
- package/dist/patterns/reactive-layout/index.d.ts +3 -3
- package/dist/patterns/reactive-layout/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-2PORF4RP.js.map +0 -1
- package/dist/chunk-646OG3PO.js.map +0 -1
- package/dist/chunk-BV3TPSBK.js.map +0 -1
- package/dist/chunk-EBNKJULL.js +0 -231
- package/dist/chunk-EBNKJULL.js.map +0 -1
- package/dist/chunk-F2ULI3Q3.js.map +0 -1
- package/dist/chunk-IHJHBADD.js.map +0 -1
- package/dist/chunk-R6OHUUYB.js.map +0 -1
- package/dist/chunk-XJ6EMQ22.js.map +0 -1
- package/dist/observable-Cz-AWhwR.d.cts +0 -42
- package/dist/observable-DCqlwGyl.d.ts +0 -42
- /package/dist/{chunk-YXROQFXZ.js.map → chunk-UW77D7SP.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as GraphPersistSnapshot, A as AutoCheckpointAdapter, D as DescribeFilter, f as GRAPH_META_SEGMENT, G as Graph, g as GraphActorOptions, b as GraphAutoCheckpointHandle, c as GraphAutoCheckpointOptions, h as GraphCheckpointRecord, i as GraphDescribeOptions, j as GraphDescribeOutput, k as GraphDiagramDirection, l as GraphDiagramOptions, m as GraphDiffChange, n as GraphDiffResult, o as GraphDumpOptions, p as GraphFactoryContext, q as GraphNodeFactory, r as GraphObserveAll, s as GraphObserveOne, a as GraphOptions, e as GraphProfileOptions, d as GraphProfileResult, N as NodeProfile, O as ObserveDetail, u as ObserveEvent, v as ObserveOptions, w as ObserveResult, x as ObserveTheme, y as ObserveThemeName, R as ReachableDirection, z as ReachableOptions, T as TraceEntry, B as graphProfile, C as reachable } from './graph-mILUUqW8.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* GraphCodec — pluggable serialization for graph snapshots (Phase 8.6).
|
|
@@ -178,65 +178,6 @@ declare function negotiateCodec(localPreference: readonly GraphCodec[], remoteCo
|
|
|
178
178
|
*/
|
|
179
179
|
declare function replayWAL(entries: readonly WALEntry[]): GraphPersistSnapshot;
|
|
180
180
|
|
|
181
|
-
/**
|
|
182
|
-
* Graph profiling and inspection utilities.
|
|
183
|
-
*
|
|
184
|
-
* Provides per-node memory estimation, connectivity stats, and hotspot
|
|
185
|
-
* detection. Non-invasive — reads from `describe()` and node internals
|
|
186
|
-
* without modifying state.
|
|
187
|
-
*
|
|
188
|
-
* @module
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
/** Per-node profile entry. */
|
|
192
|
-
interface NodeProfile {
|
|
193
|
-
/** Qualified path within the graph. */
|
|
194
|
-
path: string;
|
|
195
|
-
/** Node type (state, derived, producer, effect). */
|
|
196
|
-
type: string;
|
|
197
|
-
/** Node status (disconnected, dirty, settled, errored, completed). */
|
|
198
|
-
status: string;
|
|
199
|
-
/** Approximate retained bytes for the node's cached value. */
|
|
200
|
-
valueSizeBytes: number;
|
|
201
|
-
/** Number of downstream subscribers (sinks). */
|
|
202
|
-
subscriberCount: number;
|
|
203
|
-
/** Number of upstream dependencies. */
|
|
204
|
-
depCount: number;
|
|
205
|
-
}
|
|
206
|
-
/** Aggregate graph profile. */
|
|
207
|
-
interface GraphProfileResult {
|
|
208
|
-
/** Total node count. */
|
|
209
|
-
nodeCount: number;
|
|
210
|
-
/** Total edge count. */
|
|
211
|
-
edgeCount: number;
|
|
212
|
-
/** Subgraph count. */
|
|
213
|
-
subgraphCount: number;
|
|
214
|
-
/** All node profiles. */
|
|
215
|
-
nodes: NodeProfile[];
|
|
216
|
-
/** Total approximate value memory across all nodes. */
|
|
217
|
-
totalValueSizeBytes: number;
|
|
218
|
-
/** Nodes sorted by valueSizeBytes descending (top N). */
|
|
219
|
-
hotspots: NodeProfile[];
|
|
220
|
-
}
|
|
221
|
-
/** Options for {@link graphProfile}. */
|
|
222
|
-
interface GraphProfileOptions {
|
|
223
|
-
/** Limit hotspot list (default 10). */
|
|
224
|
-
topN?: number;
|
|
225
|
-
/** Include subgraph nodes recursively (default true). */
|
|
226
|
-
recursive?: boolean;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Profile a graph's memory and connectivity characteristics.
|
|
230
|
-
*
|
|
231
|
-
* Uses `describe({ detail: "standard" })` for node metadata and direct
|
|
232
|
-
* `NodeImpl` access for subscriber counts and cached values.
|
|
233
|
-
*
|
|
234
|
-
* @param graph - The graph to profile.
|
|
235
|
-
* @param opts - Optional configuration.
|
|
236
|
-
* @returns Aggregate profile with per-node details and hotspots.
|
|
237
|
-
*/
|
|
238
|
-
declare function graphProfile(graph: Graph, opts?: GraphProfileOptions): GraphProfileResult;
|
|
239
|
-
|
|
240
181
|
/**
|
|
241
182
|
* Approximate in-memory size estimation for arbitrary JS values.
|
|
242
183
|
*
|
|
@@ -287,19 +228,17 @@ declare const index_GraphObserveAll: typeof GraphObserveAll;
|
|
|
287
228
|
declare const index_GraphObserveOne: typeof GraphObserveOne;
|
|
288
229
|
declare const index_GraphOptions: typeof GraphOptions;
|
|
289
230
|
declare const index_GraphPersistSnapshot: typeof GraphPersistSnapshot;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
declare const index_GraphSpyHandle: typeof GraphSpyHandle;
|
|
293
|
-
declare const index_GraphSpyOptions: typeof GraphSpyOptions;
|
|
294
|
-
declare const index_GraphSpyTheme: typeof GraphSpyTheme;
|
|
295
|
-
declare const index_GraphSpyThemeName: typeof GraphSpyThemeName;
|
|
231
|
+
declare const index_GraphProfileOptions: typeof GraphProfileOptions;
|
|
232
|
+
declare const index_GraphProfileResult: typeof GraphProfileResult;
|
|
296
233
|
declare const index_JsonCodec: typeof JsonCodec;
|
|
297
234
|
type index_LazyGraphCodec = LazyGraphCodec;
|
|
298
|
-
|
|
235
|
+
declare const index_NodeProfile: typeof NodeProfile;
|
|
299
236
|
declare const index_ObserveDetail: typeof ObserveDetail;
|
|
300
237
|
declare const index_ObserveEvent: typeof ObserveEvent;
|
|
301
238
|
declare const index_ObserveOptions: typeof ObserveOptions;
|
|
302
239
|
declare const index_ObserveResult: typeof ObserveResult;
|
|
240
|
+
declare const index_ObserveTheme: typeof ObserveTheme;
|
|
241
|
+
declare const index_ObserveThemeName: typeof ObserveThemeName;
|
|
303
242
|
declare const index_ReachableDirection: typeof ReachableDirection;
|
|
304
243
|
declare const index_ReachableOptions: typeof ReachableOptions;
|
|
305
244
|
declare const index_TraceEntry: typeof TraceEntry;
|
|
@@ -312,7 +251,7 @@ declare const index_reachable: typeof reachable;
|
|
|
312
251
|
declare const index_replayWAL: typeof replayWAL;
|
|
313
252
|
declare const index_sizeof: typeof sizeof;
|
|
314
253
|
declare namespace index {
|
|
315
|
-
export { index_AutoCheckpointAdapter as AutoCheckpointAdapter, type index_DeltaCheckpoint as DeltaCheckpoint, index_DescribeFilter as DescribeFilter, type index_EvictedSubgraphInfo as EvictedSubgraphInfo, type index_EvictionPolicy as EvictionPolicy, index_GRAPH_META_SEGMENT as GRAPH_META_SEGMENT, index_Graph as Graph, index_GraphActorOptions as GraphActorOptions, index_GraphAutoCheckpointHandle as GraphAutoCheckpointHandle, index_GraphAutoCheckpointOptions as GraphAutoCheckpointOptions, index_GraphCheckpointRecord as GraphCheckpointRecord, type index_GraphCodec as GraphCodec, index_GraphDescribeOptions as GraphDescribeOptions, index_GraphDescribeOutput as GraphDescribeOutput, index_GraphDiagramDirection as GraphDiagramDirection, index_GraphDiagramOptions as GraphDiagramOptions, index_GraphDiffChange as GraphDiffChange, index_GraphDiffResult as GraphDiffResult, index_GraphDumpOptions as GraphDumpOptions, index_GraphFactoryContext as GraphFactoryContext, index_GraphNodeFactory as GraphNodeFactory, index_GraphObserveAll as GraphObserveAll, index_GraphObserveOne as GraphObserveOne, index_GraphOptions as GraphOptions, index_GraphPersistSnapshot as GraphPersistSnapshot,
|
|
254
|
+
export { index_AutoCheckpointAdapter as AutoCheckpointAdapter, type index_DeltaCheckpoint as DeltaCheckpoint, index_DescribeFilter as DescribeFilter, type index_EvictedSubgraphInfo as EvictedSubgraphInfo, type index_EvictionPolicy as EvictionPolicy, index_GRAPH_META_SEGMENT as GRAPH_META_SEGMENT, index_Graph as Graph, index_GraphActorOptions as GraphActorOptions, index_GraphAutoCheckpointHandle as GraphAutoCheckpointHandle, index_GraphAutoCheckpointOptions as GraphAutoCheckpointOptions, index_GraphCheckpointRecord as GraphCheckpointRecord, type index_GraphCodec as GraphCodec, index_GraphDescribeOptions as GraphDescribeOptions, index_GraphDescribeOutput as GraphDescribeOutput, index_GraphDiagramDirection as GraphDiagramDirection, index_GraphDiagramOptions as GraphDiagramOptions, index_GraphDiffChange as GraphDiffChange, index_GraphDiffResult as GraphDiffResult, index_GraphDumpOptions as GraphDumpOptions, index_GraphFactoryContext as GraphFactoryContext, index_GraphNodeFactory as GraphNodeFactory, index_GraphObserveAll as GraphObserveAll, index_GraphObserveOne as GraphObserveOne, index_GraphOptions as GraphOptions, index_GraphPersistSnapshot as GraphPersistSnapshot, index_GraphProfileOptions as GraphProfileOptions, index_GraphProfileResult as GraphProfileResult, index_JsonCodec as JsonCodec, type index_LazyGraphCodec as LazyGraphCodec, index_NodeProfile as NodeProfile, index_ObserveDetail as ObserveDetail, index_ObserveEvent as ObserveEvent, index_ObserveOptions as ObserveOptions, index_ObserveResult as ObserveResult, index_ObserveTheme as ObserveTheme, index_ObserveThemeName as ObserveThemeName, index_ReachableDirection as ReachableDirection, index_ReachableOptions as ReachableOptions, index_TraceEntry as TraceEntry, type index_WALEntry as WALEntry, index_createDagCborCodec as createDagCborCodec, index_createDagCborZstdCodec as createDagCborZstdCodec, index_graphProfile as graphProfile, index_negotiateCodec as negotiateCodec, index_reachable as reachable, index_replayWAL as replayWAL, index_sizeof as sizeof };
|
|
316
255
|
}
|
|
317
256
|
|
|
318
|
-
export { type DeltaCheckpoint as D, type EvictedSubgraphInfo as E, type
|
|
257
|
+
export { type DeltaCheckpoint as D, type EvictedSubgraphInfo as E, type GraphCodec as G, JsonCodec as J, type LazyGraphCodec as L, type WALEntry as W, type EvictionPolicy as a, createDagCborZstdCodec as b, createDagCborCodec as c, index as i, negotiateCodec as n, replayWAL as r, sizeof as s };
|
|
@@ -1,4 +1,65 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as NodeActions, N as Node, a as NodeOptions, l as Messages, a4 as NodeBase, q as NodeTransportOptions, A as Actor, C as CLEANUP_RESULT, c as COMPLETE, d as CleanupResult, D as DATA, e as DEFAULT_ACTOR, f as DIRTY, g as DescribeDetail, h as DescribeField, i as DescribeNodeOutput, E as ERROR, G as GuardAction, j as GuardDenied, k as GuardDeniedDetails, H as HashFn, I as INVALIDATE, M as Message, m as NodeDescribeKind, n as NodeGuard, o as NodeSink, p as NodeStatus, r as NodeVersionInfo, O as OnMessageHandler, P as PAUSE, s as PolicyAllow, t as PolicyDeny, u as PolicyRuleData, R as RESOLVED, v as RESUME, S as START, w as SubscribeHints, T as TEARDOWN, V as V0, x as V1, y as VersioningLevel, z as VersioningOptions, B as accessHintForGuard, F as advanceVersion, J as cleanupResult, K as createVersioning, L as defaultHash, Q as isKnownMessageType, U as isLocalOnly, W as isPhase2Message, X as isTerminalMessage, Y as isV1, Z as knownMessageTypes, _ as messageTier, $ as normalizeActor, a0 as policy, a1 as policyFromRules, a2 as propagatesToMeta, a3 as resolveDescribeFields } from './meta-BnG7XAaE.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `NodeImpl` — the canonical node primitive for static (compile-time known)
|
|
5
|
+
* dependency graphs. Covers state, producer, derived, effect, operator, and
|
|
6
|
+
* passthrough shapes from a single class.
|
|
7
|
+
*
|
|
8
|
+
* Lifecycle machinery (subscribe + START handshake + `_downInternal` pipeline)
|
|
9
|
+
* lives in {@link NodeBase}. This file only adds:
|
|
10
|
+
* - Dep-wave tracking via pre-set dirty masks (first run and subsequent waves
|
|
11
|
+
* share the same code path — see `_connectUpstream` + `_handleDepMessages`)
|
|
12
|
+
* - `_runFn` with identity-skip optimization on `_lastDepValues`
|
|
13
|
+
* - Producer start/stop tied to sink count
|
|
14
|
+
* - ROM/RAM cache semantics: compute nodes clear `_cached` on disconnect,
|
|
15
|
+
* state sources preserve it (see `_onDeactivate`).
|
|
16
|
+
*
|
|
17
|
+
* See GRAPHREFLY-SPEC §§2.1–2.8 and COMPOSITION-GUIDE §§1, 9.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Compute function passed to `node(deps, fn, opts?)`.
|
|
22
|
+
*
|
|
23
|
+
* @returns A value to emit, `undefined` to skip emission, or a cleanup
|
|
24
|
+
* function invoked before the next run or on teardown.
|
|
25
|
+
*/
|
|
26
|
+
type NodeFn<T = unknown> = (deps: readonly unknown[], actions: NodeActions) => T | undefined | (() => void);
|
|
27
|
+
/**
|
|
28
|
+
* Creates a reactive {@link Node} — the single GraphReFly primitive (§2).
|
|
29
|
+
*
|
|
30
|
+
* Typical shapes: `node([])` / `node([], opts)` for a manual source;
|
|
31
|
+
* `node(producerFn, opts)` for a producer; `node(deps, computeFn, opts)` for
|
|
32
|
+
* derived nodes and operators.
|
|
33
|
+
*
|
|
34
|
+
* @param depsOrFn - Dependency nodes, a {@link NodeFn} (producer), or {@link NodeOptions} alone.
|
|
35
|
+
* @param fnOrOpts - With deps: compute function or options. Omitted for producer-only form.
|
|
36
|
+
* @param optsArg - Options when both `deps` and `fn` are provided.
|
|
37
|
+
* @returns `Node<T>` — lazy until subscribed.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* **Protocol:** START handshake, DIRTY / DATA / RESOLVED ordering, completion,
|
|
41
|
+
* and batch deferral follow `~/src/graphrefly/GRAPHREFLY-SPEC.md`.
|
|
42
|
+
*
|
|
43
|
+
* **`equals` and mutable values:** The default `Object.is` identity check is
|
|
44
|
+
* correct for the common immutable-value case. If your node produces mutable
|
|
45
|
+
* objects, provide a custom `equals` — otherwise `Object.is` always returns
|
|
46
|
+
* `true` for the same reference and the node emits `RESOLVED` instead of `DATA`.
|
|
47
|
+
*
|
|
48
|
+
* **ROM/RAM (§2.2):** State nodes (no fn) preserve their cache across
|
|
49
|
+
* disconnect — runtime writes survive. Compute nodes (derived, producer)
|
|
50
|
+
* clear their cache on disconnect; reconnect re-runs fn.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { node, state } from "@graphrefly/graphrefly-ts";
|
|
55
|
+
*
|
|
56
|
+
* const a = state(1);
|
|
57
|
+
* const b = node([a], ([x]) => (x as number) + 1);
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @category core
|
|
61
|
+
*/
|
|
62
|
+
declare function node<T = unknown>(depsOrFn?: readonly Node[] | NodeFn<T> | NodeOptions, fnOrOpts?: NodeFn<T> | NodeOptions, optsArg?: NodeOptions): Node<T>;
|
|
2
63
|
|
|
3
64
|
/**
|
|
4
65
|
* Returns whether the current call stack is inside a batch scope **or** while
|
|
@@ -55,9 +116,9 @@ declare function batch(fn: () => void): void;
|
|
|
55
116
|
/**
|
|
56
117
|
* Splits a message array into three groups by signal tier (see `messages.ts`):
|
|
57
118
|
*
|
|
58
|
-
* - **immediate** — tier 0–
|
|
59
|
-
* - **deferred** — tier
|
|
60
|
-
* - **terminal** — tier
|
|
119
|
+
* - **immediate** — tier 0–2, 5: START, DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN, unknown
|
|
120
|
+
* - **deferred** — tier 3: DATA, RESOLVED (phase-2, deferred inside `batch()`)
|
|
121
|
+
* - **terminal** — tier 4: COMPLETE, ERROR (delivered after phase-2)
|
|
61
122
|
*
|
|
62
123
|
* Order within each group is preserved.
|
|
63
124
|
*
|
|
@@ -83,10 +144,10 @@ declare function partitionForBatch(messages: Messages): {
|
|
|
83
144
|
* Delivers messages downstream through `sink`, applying batch semantics and
|
|
84
145
|
* canonical tier-based ordering (see `messages.ts`):
|
|
85
146
|
*
|
|
86
|
-
* 1. **Immediate** (tier 0–
|
|
147
|
+
* 1. **Immediate** (tier 0–2, 5): START, DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN,
|
|
87
148
|
* unknown — delivered synchronously.
|
|
88
|
-
* 2. **Phase-2** (tier
|
|
89
|
-
* 3. **Terminal** (tier
|
|
149
|
+
* 2. **Phase-2** (tier 3): DATA, RESOLVED — deferred while `isBatching()`.
|
|
150
|
+
* 3. **Terminal** (tier 4): COMPLETE, ERROR — always delivered after phase-2.
|
|
90
151
|
* When batching, terminal is queued after deferred phase-2 in the pending list.
|
|
91
152
|
* When not batching, terminal is delivered after phase-2 synchronously.
|
|
92
153
|
*
|
|
@@ -225,12 +286,19 @@ declare function wallClockNs(): number;
|
|
|
225
286
|
/**
|
|
226
287
|
* `dynamicNode` — runtime dep tracking with diamond resolution (Phase 0.3b).
|
|
227
288
|
*
|
|
228
|
-
* Unlike `node()` where deps are fixed at construction, `dynamicNode`
|
|
229
|
-
* deps at runtime via a tracking `get()` proxy. After each
|
|
230
|
-
* diffed: new deps are connected, removed deps are
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
289
|
+
* Unlike `node()` where deps are fixed at construction, `dynamicNode`
|
|
290
|
+
* discovers deps at runtime via a tracking `get()` proxy. After each
|
|
291
|
+
* recompute, deps are diffed: new deps are connected, removed deps are
|
|
292
|
+
* disconnected, and bitmasks are rebuilt.
|
|
293
|
+
*
|
|
294
|
+
* Shares subscribe / sink / lifecycle machinery with {@link NodeImpl} via
|
|
295
|
+
* {@link NodeBase}. The only things that diverge from static nodes:
|
|
296
|
+
* - deps are discovered inside `_runFn` via a tracking `get` proxy
|
|
297
|
+
* - `_rewire` installs subscriptions lazily during `_runFn`
|
|
298
|
+
* - during rewire, new dep messages are **buffered** (option C from the
|
|
299
|
+
* Apr-2026 refactor); after rewire we scan the buffer for DATA values
|
|
300
|
+
* that differ from what fn tracked, and re-run fn if any found
|
|
301
|
+
* (bounded by `MAX_RERUN`)
|
|
234
302
|
*/
|
|
235
303
|
|
|
236
304
|
/**
|
|
@@ -253,10 +321,14 @@ type DynamicNodeOptions = Pick<NodeOptions, "name" | "equals" | "meta" | "resubs
|
|
|
253
321
|
* - New deps (not in previous set) are subscribed
|
|
254
322
|
* - Removed deps (not in current set) are unsubscribed
|
|
255
323
|
* - Kept deps retain their existing subscriptions
|
|
256
|
-
* - Bitmasks are rebuilt to match the new dep set
|
|
257
324
|
*
|
|
258
|
-
* The node participates
|
|
259
|
-
*
|
|
325
|
+
* The node participates in diamond resolution via the pre-set dirty mask
|
|
326
|
+
* (shared with {@link NodeImpl}).
|
|
327
|
+
*
|
|
328
|
+
* **Lazy-dep composition:** when a tracked dep is itself a lazy compute node
|
|
329
|
+
* whose first subscribe causes a fresh value to arrive, the rewire buffer
|
|
330
|
+
* detects the discrepancy and re-runs fn once so it observes the real value.
|
|
331
|
+
* Capped at {@link MAX_RERUN} iterations.
|
|
260
332
|
*
|
|
261
333
|
* @param fn - Compute function receiving a tracking `get` proxy.
|
|
262
334
|
* @param opts - Optional configuration.
|
|
@@ -270,7 +342,6 @@ type DynamicNodeOptions = Pick<NodeOptions, "name" | "equals" | "meta" | "resubs
|
|
|
270
342
|
* const a = state(1);
|
|
271
343
|
* const b = state(2);
|
|
272
344
|
*
|
|
273
|
-
* // Deps change based on cond's value
|
|
274
345
|
* const d = dynamicNode((get) => {
|
|
275
346
|
* const useA = get(cond);
|
|
276
347
|
* return useA ? get(a) : get(b);
|
|
@@ -281,75 +352,48 @@ type DynamicNodeOptions = Pick<NodeOptions, "name" | "equals" | "meta" | "resubs
|
|
|
281
352
|
*/
|
|
282
353
|
declare function dynamicNode<T = unknown>(fn: DynamicNodeFn<T>, opts?: DynamicNodeOptions): Node<T>;
|
|
283
354
|
/** @internal — exported for {@link describeNode} `instanceof` check. */
|
|
284
|
-
declare class DynamicNodeImpl<T = unknown>
|
|
285
|
-
private readonly _optsName;
|
|
286
|
-
private _registryName;
|
|
287
|
-
readonly _describeKind: NodeDescribeKind | undefined;
|
|
288
|
-
readonly meta: Record<string, Node>;
|
|
355
|
+
declare class DynamicNodeImpl<T = unknown> extends NodeBase<T> {
|
|
289
356
|
private readonly _fn;
|
|
290
|
-
private readonly _equals;
|
|
291
|
-
private readonly _resubscribable;
|
|
292
|
-
private readonly _resetOnTeardown;
|
|
293
357
|
private readonly _autoComplete;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
/** @internal — read by {@link describeNode} for `accessHintForGuard`. */
|
|
297
|
-
readonly _guard: NodeGuard | undefined;
|
|
298
|
-
private _lastMutation;
|
|
299
|
-
private _inspectorHook;
|
|
300
|
-
private _sinkCount;
|
|
301
|
-
private _singleDepSinkCount;
|
|
302
|
-
private _singleDepSinks;
|
|
303
|
-
private readonly _actions;
|
|
304
|
-
private readonly _boundDownToSinks;
|
|
305
|
-
private _cached;
|
|
306
|
-
private _status;
|
|
307
|
-
private _terminal;
|
|
308
|
-
private _connected;
|
|
309
|
-
private _rewiring;
|
|
310
|
-
private _deps;
|
|
358
|
+
/** @internal Read by `describeNode`. */
|
|
359
|
+
_deps: Node[];
|
|
311
360
|
private _depUnsubs;
|
|
312
361
|
private _depIndexMap;
|
|
313
|
-
private
|
|
314
|
-
private
|
|
315
|
-
private
|
|
316
|
-
private
|
|
362
|
+
private _depDirtyBits;
|
|
363
|
+
private _depSettledBits;
|
|
364
|
+
private _depCompleteBits;
|
|
365
|
+
private _running;
|
|
366
|
+
private _rewiring;
|
|
367
|
+
private _bufferedDepMessages;
|
|
368
|
+
private _trackedValues;
|
|
369
|
+
private _rerunCount;
|
|
317
370
|
constructor(fn: DynamicNodeFn<T>, opts: DynamicNodeOptions);
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
_assignRegistryName(localName: string): void;
|
|
321
|
-
/**
|
|
322
|
-
* @internal Attach/remove inspector hook for graph-level observability.
|
|
323
|
-
* Returns a disposer that restores the previous hook.
|
|
324
|
-
*/
|
|
325
|
-
_setInspectorHook(hook?: NodeInspectorHook): () => void;
|
|
326
|
-
get status(): NodeStatus;
|
|
327
|
-
get lastMutation(): Readonly<{
|
|
328
|
-
actor: Actor;
|
|
329
|
-
timestamp_ns: number;
|
|
330
|
-
}> | undefined;
|
|
331
|
-
/** Versioning not yet supported on DynamicNodeImpl. */
|
|
371
|
+
protected _createMetaNode(key: string, initialValue: unknown, opts: NodeOptions): Node;
|
|
372
|
+
/** Versioning not supported on DynamicNodeImpl (override base). */
|
|
332
373
|
get v(): undefined;
|
|
333
|
-
hasGuard(): boolean;
|
|
334
|
-
allowsObserve(actor: Actor): boolean;
|
|
335
|
-
get(): T | undefined;
|
|
336
|
-
down(messages: Messages, options?: NodeTransportOptions): void;
|
|
337
|
-
private _downInternal;
|
|
338
|
-
private _canSkipDirty;
|
|
339
|
-
subscribe(sink: NodeSink, hints?: SubscribeHints): () => void;
|
|
340
374
|
up(messages: Messages, options?: NodeTransportOptions): void;
|
|
375
|
+
protected _upInternal(messages: Messages): void;
|
|
341
376
|
unsubscribe(): void;
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
/** Propagate a signal to all companion meta nodes (best-effort). */
|
|
345
|
-
private _propagateToMeta;
|
|
346
|
-
private _downAutoValue;
|
|
347
|
-
private _connect;
|
|
377
|
+
protected _onActivate(): void;
|
|
378
|
+
protected _doDeactivate(): void;
|
|
348
379
|
private _disconnect;
|
|
349
380
|
private _runFn;
|
|
350
381
|
private _rewire;
|
|
351
382
|
private _handleDepMessages;
|
|
383
|
+
/**
|
|
384
|
+
* Update dep masks for a message without triggering `_runFn` — used
|
|
385
|
+
* during post-rewire drain so the wave state is consistent with the
|
|
386
|
+
* buffered activation cascade without recursing.
|
|
387
|
+
*/
|
|
388
|
+
private _updateMasksForMessage;
|
|
352
389
|
private _allDirtySettled;
|
|
390
|
+
/**
|
|
391
|
+
* True if any current dep value differs from what the last `_runFn`
|
|
392
|
+
* saw via `get()`. Used to suppress redundant re-runs when deferred
|
|
393
|
+
* handshake messages arrive after `_rewire` for a dep whose value
|
|
394
|
+
* already matches `_trackedValues`.
|
|
395
|
+
*/
|
|
396
|
+
private _depValuesDifferFromTracked;
|
|
353
397
|
}
|
|
354
398
|
|
|
355
399
|
/**
|
|
@@ -523,7 +567,7 @@ declare const index_Messages: typeof Messages;
|
|
|
523
567
|
declare const index_Node: typeof Node;
|
|
524
568
|
declare const index_NodeActions: typeof NodeActions;
|
|
525
569
|
declare const index_NodeDescribeKind: typeof NodeDescribeKind;
|
|
526
|
-
|
|
570
|
+
type index_NodeFn<T = unknown> = NodeFn<T>;
|
|
527
571
|
declare const index_NodeGuard: typeof NodeGuard;
|
|
528
572
|
declare const index_NodeOptions: typeof NodeOptions;
|
|
529
573
|
declare const index_NodeSink: typeof NodeSink;
|
|
@@ -540,6 +584,7 @@ declare const index_RESOLVED: typeof RESOLVED;
|
|
|
540
584
|
declare const index_RESUME: typeof RESUME;
|
|
541
585
|
type index_ResettableTimer = ResettableTimer;
|
|
542
586
|
declare const index_ResettableTimer: typeof ResettableTimer;
|
|
587
|
+
declare const index_START: typeof START;
|
|
543
588
|
declare const index_SubscribeHints: typeof SubscribeHints;
|
|
544
589
|
declare const index_TEARDOWN: typeof TEARDOWN;
|
|
545
590
|
declare const index_V0: typeof V0;
|
|
@@ -554,18 +599,17 @@ declare const index_cleanupResult: typeof cleanupResult;
|
|
|
554
599
|
declare const index_createVersioning: typeof createVersioning;
|
|
555
600
|
declare const index_defaultHash: typeof defaultHash;
|
|
556
601
|
declare const index_derived: typeof derived;
|
|
557
|
-
declare const index_describeNode: typeof describeNode;
|
|
558
602
|
declare const index_downWithBatch: typeof downWithBatch;
|
|
559
603
|
declare const index_dynamicNode: typeof dynamicNode;
|
|
560
604
|
declare const index_effect: typeof effect;
|
|
561
605
|
declare const index_isBatching: typeof isBatching;
|
|
562
606
|
declare const index_isKnownMessageType: typeof isKnownMessageType;
|
|
607
|
+
declare const index_isLocalOnly: typeof isLocalOnly;
|
|
563
608
|
declare const index_isPhase2Message: typeof isPhase2Message;
|
|
564
609
|
declare const index_isTerminalMessage: typeof isTerminalMessage;
|
|
565
610
|
declare const index_isV1: typeof isV1;
|
|
566
611
|
declare const index_knownMessageTypes: typeof knownMessageTypes;
|
|
567
612
|
declare const index_messageTier: typeof messageTier;
|
|
568
|
-
declare const index_metaSnapshot: typeof metaSnapshot;
|
|
569
613
|
declare const index_monotonicNs: typeof monotonicNs;
|
|
570
614
|
declare const index_node: typeof node;
|
|
571
615
|
declare const index_normalizeActor: typeof normalizeActor;
|
|
@@ -579,7 +623,7 @@ declare const index_resolveDescribeFields: typeof resolveDescribeFields;
|
|
|
579
623
|
declare const index_state: typeof state;
|
|
580
624
|
declare const index_wallClockNs: typeof wallClockNs;
|
|
581
625
|
declare namespace index {
|
|
582
|
-
export { index_Actor as Actor, type index_BridgeOptions as BridgeOptions, index_CLEANUP_RESULT as CLEANUP_RESULT, index_COMPLETE as COMPLETE, index_CleanupResult as CleanupResult, index_DATA as DATA, index_DEFAULT_ACTOR as DEFAULT_ACTOR, index_DEFAULT_DOWN as DEFAULT_DOWN, index_DIRTY as DIRTY, index_DescribeDetail as DescribeDetail, index_DescribeField as DescribeField, index_DescribeNodeOutput as DescribeNodeOutput, type index_DownStrategy as DownStrategy, type index_DynGet as DynGet, type index_DynamicNodeFn as DynamicNodeFn, index_DynamicNodeImpl as DynamicNodeImpl, type index_DynamicNodeOptions as DynamicNodeOptions, index_ERROR as ERROR, index_GuardAction as GuardAction, index_GuardDenied as GuardDenied, index_GuardDeniedDetails as GuardDeniedDetails, index_HashFn as HashFn, index_INVALIDATE as INVALIDATE, index_Message as Message, index_Messages as Messages, index_Node as Node, index_NodeActions as NodeActions, index_NodeDescribeKind as NodeDescribeKind, index_NodeFn as NodeFn, index_NodeGuard as NodeGuard, 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_PAUSE as PAUSE, type index_PipeOperator as PipeOperator, index_PolicyAllow as PolicyAllow, index_PolicyDeny as PolicyDeny, index_PolicyRuleData as PolicyRuleData, index_RESOLVED as RESOLVED, index_RESUME as RESUME, index_ResettableTimer as ResettableTimer, index_SubscribeHints as SubscribeHints, index_TEARDOWN as TEARDOWN, 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_batch as batch, index_bridge as bridge, index_cleanupResult as cleanupResult, index_createVersioning as createVersioning, index_defaultHash as defaultHash, index_derived as derived,
|
|
626
|
+
export { index_Actor as Actor, type index_BridgeOptions as BridgeOptions, index_CLEANUP_RESULT as CLEANUP_RESULT, index_COMPLETE as COMPLETE, index_CleanupResult as CleanupResult, index_DATA as DATA, index_DEFAULT_ACTOR as DEFAULT_ACTOR, index_DEFAULT_DOWN as DEFAULT_DOWN, index_DIRTY as DIRTY, index_DescribeDetail as DescribeDetail, index_DescribeField as DescribeField, index_DescribeNodeOutput as DescribeNodeOutput, type index_DownStrategy as DownStrategy, type index_DynGet as DynGet, type index_DynamicNodeFn as DynamicNodeFn, index_DynamicNodeImpl as DynamicNodeImpl, type index_DynamicNodeOptions as DynamicNodeOptions, index_ERROR as ERROR, index_GuardAction as GuardAction, index_GuardDenied as GuardDenied, index_GuardDeniedDetails as GuardDeniedDetails, index_HashFn as HashFn, index_INVALIDATE as INVALIDATE, index_Message as Message, index_Messages as Messages, index_Node as Node, index_NodeActions as NodeActions, index_NodeDescribeKind as NodeDescribeKind, type index_NodeFn as NodeFn, index_NodeGuard as NodeGuard, 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_PAUSE as PAUSE, type index_PipeOperator as PipeOperator, index_PolicyAllow as PolicyAllow, index_PolicyDeny as PolicyDeny, index_PolicyRuleData as PolicyRuleData, index_RESOLVED as RESOLVED, index_RESUME as RESUME, index_ResettableTimer as ResettableTimer, index_START as START, index_SubscribeHints as SubscribeHints, index_TEARDOWN as TEARDOWN, 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_batch as batch, index_bridge as bridge, index_cleanupResult as cleanupResult, index_createVersioning as createVersioning, 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_isKnownMessageType as isKnownMessageType, index_isLocalOnly as isLocalOnly, index_isPhase2Message as isPhase2Message, index_isTerminalMessage as isTerminalMessage, index_isV1 as isV1, index_knownMessageTypes as knownMessageTypes, index_messageTier as messageTier, index_monotonicNs as monotonicNs, index_node as node, index_normalizeActor as normalizeActor, index_partitionForBatch as partitionForBatch, index_pipe as pipe, index_policy as policy, index_policyFromRules as policyFromRules, index_producer as producer, index_propagatesToMeta as propagatesToMeta, index_resolveDescribeFields as resolveDescribeFields, index_state as state, index_wallClockNs as wallClockNs };
|
|
583
627
|
}
|
|
584
628
|
|
|
585
|
-
export { type BridgeOptions as B, DEFAULT_DOWN as D, type PipeOperator as P, ResettableTimer as R, type DownStrategy as a, type DynGet as b, type DynamicNodeFn as c, DynamicNodeImpl as d, type DynamicNodeOptions as e, batch as f, bridge as g, derived as h, index as i, downWithBatch as j, dynamicNode as k, effect as l, isBatching as m, monotonicNs as n,
|
|
629
|
+
export { type BridgeOptions as B, DEFAULT_DOWN as D, type NodeFn as N, type PipeOperator as P, ResettableTimer as R, type DownStrategy as a, type DynGet as b, type DynamicNodeFn as c, DynamicNodeImpl as d, type DynamicNodeOptions as e, batch as f, bridge as g, derived as h, index as i, downWithBatch as j, dynamicNode as k, effect as l, isBatching as m, monotonicNs as n, node as o, partitionForBatch as p, pipe as q, producer as r, state as s, wallClockNs as w };
|