@graphrefly/graphrefly 0.18.0 → 0.20.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-J7S54G7I.js → chunk-2L5J6RPM.js} +7 -2
- package/dist/chunk-2L5J6RPM.js.map +1 -0
- package/dist/{chunk-LB3RYLSC.js → chunk-3N2Y6PCR.js} +197 -42
- package/dist/chunk-3N2Y6PCR.js.map +1 -0
- package/dist/{chunk-KJGUP35I.js → chunk-5PSVTDNZ.js} +22 -9
- package/dist/chunk-5PSVTDNZ.js.map +1 -0
- package/dist/{chunk-76YPZQTW.js → chunk-BJAOEU4D.js} +34 -29
- package/dist/chunk-BJAOEU4D.js.map +1 -0
- package/dist/{chunk-UVWEKTYC.js → chunk-IAPLC4NR.js} +3 -3
- package/dist/{chunk-F6ORUNO7.js → chunk-OOA2UTXF.js} +58 -2
- package/dist/chunk-OOA2UTXF.js.map +1 -0
- package/dist/{chunk-TNKODJ6E.js → chunk-PGEU5MEH.js} +7 -3
- package/dist/{chunk-TNKODJ6E.js.map → chunk-PGEU5MEH.js.map} +1 -1
- package/dist/chunk-R2LPZIY2.js +111 -0
- package/dist/chunk-R2LPZIY2.js.map +1 -0
- package/dist/{chunk-BV3TPSBK.js → chunk-XYL3GLB3.js} +742 -757
- package/dist/chunk-XYL3GLB3.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +967 -811
- 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 -7
- package/dist/core/index.cjs +653 -666
- 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 -3
- package/dist/extra/index.cjs +728 -688
- 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 +9 -5
- package/dist/graph/index.cjs +836 -808
- 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-gISB9n3n.d.ts → graph-KsTe57nI.d.cts} +82 -8
- package/dist/{graph-BYFlyNpX.d.cts → graph-mILUUqW8.d.ts} +82 -8
- package/dist/{index-CgKPpiu8.d.ts → index-8a605sg9.d.ts} +2 -2
- package/dist/{index-DKaB2x0T.d.ts → index-B2SvPEbc.d.ts} +6 -65
- package/dist/{index-EmzYk-TG.d.cts → index-BHfg_Ez3.d.ts} +123 -77
- package/dist/{index-B80mMeuf.d.ts → index-Bc_diYYJ.d.cts} +123 -77
- package/dist/{index-B43mC7uY.d.cts → index-BjtlNirP.d.cts} +3 -3
- package/dist/{index-CEDaJaYE.d.ts → index-CgSiUouz.d.ts} +3 -3
- package/dist/{index-7WnwgjMu.d.ts → index-DuN3bhtm.d.ts} +82 -32
- package/dist/{index-D_tUMcpz.d.cts → index-SFzE_KTa.d.cts} +82 -32
- package/dist/{index-Ci_vPaVm.d.cts → index-UudxGnzc.d.cts} +6 -65
- package/dist/{index-BqOWSFhr.d.cts → index-VHA43cGP.d.cts} +2 -2
- package/dist/index.cjs +5936 -5522
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +644 -379
- package/dist/index.d.ts +644 -379
- package/dist/index.js +4388 -4058
- package/dist/index.js.map +1 -1
- package/dist/{meta-npl5b97j.d.cts → meta-BnG7XAaE.d.cts} +394 -236
- package/dist/{meta-npl5b97j.d.ts → meta-BnG7XAaE.d.ts} +394 -236
- package/dist/{observable-DFBCBELR.d.cts → observable-C8Kx_O6k.d.cts} +1 -1
- package/dist/{observable-oAGygKvc.d.ts → observable-DcBwQY7t.d.ts} +1 -1
- package/dist/patterns/reactive-layout/index.cjs +865 -718
- 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 +2 -2
- package/dist/chunk-76YPZQTW.js.map +0 -1
- package/dist/chunk-BV3TPSBK.js.map +0 -1
- package/dist/chunk-F6ORUNO7.js.map +0 -1
- package/dist/chunk-FCLROC4Q.js +0 -231
- package/dist/chunk-FCLROC4Q.js.map +0 -1
- package/dist/chunk-J7S54G7I.js.map +0 -1
- package/dist/chunk-KJGUP35I.js.map +0 -1
- package/dist/chunk-LB3RYLSC.js.map +0 -1
- /package/dist/{chunk-UVWEKTYC.js.map → chunk-IAPLC4NR.js.map} +0 -0
|
@@ -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.js';
|
|
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
|
/**
|
|
@@ -431,7 +475,7 @@ declare function derived<T = unknown>(deps: readonly Node[], fn: NodeFn<T>, opts
|
|
|
431
475
|
*
|
|
432
476
|
* @category core
|
|
433
477
|
*/
|
|
434
|
-
declare function effect(deps: readonly Node[], fn: NodeFn<unknown
|
|
478
|
+
declare function effect(deps: readonly Node[], fn: NodeFn<unknown>, opts?: NodeOptions): Node<unknown>;
|
|
435
479
|
/** Unary transform used by {@link pipe} (typically returns a new node wrapping `n`). */
|
|
436
480
|
type PipeOperator = (n: Node) => Node;
|
|
437
481
|
/**
|
|
@@ -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;
|
|
@@ -559,6 +604,7 @@ declare const index_dynamicNode: typeof dynamicNode;
|
|
|
559
604
|
declare const index_effect: typeof effect;
|
|
560
605
|
declare const index_isBatching: typeof isBatching;
|
|
561
606
|
declare const index_isKnownMessageType: typeof isKnownMessageType;
|
|
607
|
+
declare const index_isLocalOnly: typeof isLocalOnly;
|
|
562
608
|
declare const index_isPhase2Message: typeof isPhase2Message;
|
|
563
609
|
declare const index_isTerminalMessage: typeof isTerminalMessage;
|
|
564
610
|
declare const index_isV1: typeof isV1;
|
|
@@ -577,7 +623,7 @@ declare const index_resolveDescribeFields: typeof resolveDescribeFields;
|
|
|
577
623
|
declare const index_state: typeof state;
|
|
578
624
|
declare const index_wallClockNs: typeof wallClockNs;
|
|
579
625
|
declare namespace index {
|
|
580
|
-
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, index_downWithBatch as downWithBatch, index_dynamicNode as dynamicNode, index_effect as effect, index_isBatching as isBatching, index_isKnownMessageType as isKnownMessageType, 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 };
|
|
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 };
|
|
581
627
|
}
|
|
582
628
|
|
|
583
|
-
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 };
|
|
@@ -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
|
/**
|
|
@@ -431,7 +475,7 @@ declare function derived<T = unknown>(deps: readonly Node[], fn: NodeFn<T>, opts
|
|
|
431
475
|
*
|
|
432
476
|
* @category core
|
|
433
477
|
*/
|
|
434
|
-
declare function effect(deps: readonly Node[], fn: NodeFn<unknown
|
|
478
|
+
declare function effect(deps: readonly Node[], fn: NodeFn<unknown>, opts?: NodeOptions): Node<unknown>;
|
|
435
479
|
/** Unary transform used by {@link pipe} (typically returns a new node wrapping `n`). */
|
|
436
480
|
type PipeOperator = (n: Node) => Node;
|
|
437
481
|
/**
|
|
@@ -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;
|
|
@@ -559,6 +604,7 @@ declare const index_dynamicNode: typeof dynamicNode;
|
|
|
559
604
|
declare const index_effect: typeof effect;
|
|
560
605
|
declare const index_isBatching: typeof isBatching;
|
|
561
606
|
declare const index_isKnownMessageType: typeof isKnownMessageType;
|
|
607
|
+
declare const index_isLocalOnly: typeof isLocalOnly;
|
|
562
608
|
declare const index_isPhase2Message: typeof isPhase2Message;
|
|
563
609
|
declare const index_isTerminalMessage: typeof isTerminalMessage;
|
|
564
610
|
declare const index_isV1: typeof isV1;
|
|
@@ -577,7 +623,7 @@ declare const index_resolveDescribeFields: typeof resolveDescribeFields;
|
|
|
577
623
|
declare const index_state: typeof state;
|
|
578
624
|
declare const index_wallClockNs: typeof wallClockNs;
|
|
579
625
|
declare namespace index {
|
|
580
|
-
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, index_downWithBatch as downWithBatch, index_dynamicNode as dynamicNode, index_effect as effect, index_isBatching as isBatching, index_isKnownMessageType as isKnownMessageType, 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 };
|
|
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 };
|
|
581
627
|
}
|
|
582
628
|
|
|
583
|
-
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 };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as ToObservableOptions, t as toObservable } from './observable-
|
|
1
|
+
import { T as ToObservableOptions, t as toObservable } from './observable-C8Kx_O6k.cjs';
|
|
2
2
|
import { OnModuleInit, OnModuleDestroy, ExecutionContext, CanActivate, DynamicModule } from '@nestjs/common';
|
|
3
3
|
import { ModuleRef } from '@nestjs/core';
|
|
4
|
-
import { G as Graph, a as GraphOptions,
|
|
5
|
-
import { A as Actor, N as Node } from './meta-
|
|
4
|
+
import { G as Graph, a as GraphOptions, t as GraphPersistSnapshot } from './graph-KsTe57nI.cjs';
|
|
5
|
+
import { A as Actor, N as Node } from './meta-BnG7XAaE.cjs';
|
|
6
6
|
|
|
7
7
|
/** Class constructor key for decorator registries and Nest `ModuleRef.get()`. */
|
|
8
8
|
type DecoratorHostConstructor = abstract new (...args: unknown[]) => unknown;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as ToObservableOptions, t as toObservable } from './observable-
|
|
1
|
+
import { T as ToObservableOptions, t as toObservable } from './observable-DcBwQY7t.js';
|
|
2
2
|
import { OnModuleInit, OnModuleDestroy, ExecutionContext, CanActivate, DynamicModule } from '@nestjs/common';
|
|
3
3
|
import { ModuleRef } from '@nestjs/core';
|
|
4
|
-
import { G as Graph, a as GraphOptions,
|
|
5
|
-
import { A as Actor, N as Node } from './meta-
|
|
4
|
+
import { G as Graph, a as GraphOptions, t as GraphPersistSnapshot } from './graph-mILUUqW8.js';
|
|
5
|
+
import { A as Actor, N as Node } from './meta-BnG7XAaE.js';
|
|
6
6
|
|
|
7
7
|
/** Class constructor key for decorator registries and Nest `ModuleRef.get()`. */
|
|
8
8
|
type DecoratorHostConstructor = abstract new (...args: unknown[]) => unknown;
|