@graphrefly/graphrefly 0.22.0 → 0.24.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-QA3RP5NH.js → chunk-5DJTTKX3.js} +111 -17
- package/dist/chunk-5DJTTKX3.js.map +1 -0
- package/dist/{chunk-BLD3IFYF.js → chunk-5WGT55R4.js} +9 -7
- package/dist/{chunk-BLD3IFYF.js.map → chunk-5WGT55R4.js.map} +1 -1
- package/dist/{chunk-IR3KMOLX.js → chunk-AOCBDH4T.js} +3 -383
- package/dist/chunk-AOCBDH4T.js.map +1 -0
- package/dist/{chunk-TH6COGOP.js → chunk-H4RVA4VE.js} +2 -2
- package/dist/chunk-HWPIFSW2.js +36 -0
- package/dist/chunk-HWPIFSW2.js.map +1 -0
- package/dist/{chunk-MQBQOFDS.js → chunk-IPLKX3L2.js} +12 -31
- package/dist/chunk-IPLKX3L2.js.map +1 -0
- package/dist/{chunk-44HD4BTA.js → chunk-MW4VAKAO.js} +3 -3
- package/dist/chunk-PY4XCDLR.js +391 -0
- package/dist/chunk-PY4XCDLR.js.map +1 -0
- package/dist/{chunk-RHI3GHZW.js → chunk-QOWVNWOC.js} +3 -3
- package/dist/{chunk-EQUZ5NLD.js → chunk-TDEXAMGO.js} +11 -16
- package/dist/chunk-TDEXAMGO.js.map +1 -0
- package/dist/{chunk-NXC35KC5.js → chunk-XOFWRC73.js} +3 -3
- package/dist/compat/nestjs/index.cjs +110 -16
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +6 -6
- package/dist/compat/nestjs/index.d.ts +6 -6
- package/dist/compat/nestjs/index.js +9 -7
- package/dist/core/index.cjs +110 -16
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +3 -3
- package/dist/extra/index.cjs +110 -16
- 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 -7
- package/dist/graph/index.cjs +110 -16
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +5 -5
- package/dist/graph/index.d.ts +5 -5
- package/dist/graph/index.js +4 -4
- package/dist/{graph-DFr0diXB.d.ts → graph-B6NFqv3z.d.ts} +3 -3
- package/dist/{graph-ab1yPwIB.d.cts → graph-D-3JIQme.d.cts} +3 -3
- package/dist/{index-BvWfZCTt.d.cts → index-1z8vRTCt.d.cts} +3 -3
- package/dist/{index-Dy04P4W3.d.cts → index-AMWewNDe.d.cts} +2 -2
- package/dist/{index-C9z6rU9P.d.cts → index-BJB7t9gg.d.cts} +19 -15
- package/dist/{index-BbYZma8G.d.ts → index-BysCTzJz.d.ts} +3 -3
- package/dist/{index-HdJx_BjO.d.ts → index-C-TXEa7C.d.ts} +19 -15
- package/dist/{index-DsGxLfwL.d.ts → index-CYkjxu3s.d.ts} +2 -2
- package/dist/{index-BHm3Ba5q.d.ts → index-D7XgsUt7.d.ts} +2 -2
- package/dist/{index-D36MAQ3f.d.ts → index-DiobMNwE.d.ts} +3 -3
- package/dist/{index-DrJq9B1T.d.cts → index-J7Kc0oIQ.d.cts} +3 -3
- package/dist/{index-DLE1Sp-L.d.cts → index-b5BYtczN.d.cts} +2 -2
- package/dist/index.cjs +129 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +36 -42
- package/dist/index.js.map +1 -1
- package/dist/{meta-n3FoVWML.d.ts → meta-CnkLA_43.d.ts} +1 -1
- package/dist/{meta--fr9sxRM.d.cts → meta-DWbkoq1s.d.cts} +1 -1
- package/dist/{node-C5UD5MGq.d.cts → node-B-f-Lu-k.d.cts} +57 -13
- package/dist/{node-C5UD5MGq.d.ts → node-B-f-Lu-k.d.ts} +57 -13
- package/dist/{observable-DWydVy5b.d.cts → observable-DBnrwcar.d.cts} +1 -1
- package/dist/{observable-CQRBtEbq.d.ts → observable-uP-wy_uK.d.ts} +1 -1
- package/dist/patterns/reactive-layout/index.cjs +224 -129
- package/dist/patterns/reactive-layout/index.cjs.map +1 -1
- package/dist/patterns/reactive-layout/index.d.cts +5 -5
- package/dist/patterns/reactive-layout/index.d.ts +5 -5
- package/dist/patterns/reactive-layout/index.js +6 -4
- package/dist/{storage-Bew05Xy6.d.cts → storage-BuTdpCI1.d.cts} +1 -1
- package/dist/{storage-C9fZfMfM.d.ts → storage-F2X1U1x0.d.ts} +1 -1
- package/package.json +3 -2
- package/dist/chunk-EQUZ5NLD.js.map +0 -1
- package/dist/chunk-IR3KMOLX.js.map +0 -1
- package/dist/chunk-MQBQOFDS.js.map +0 -1
- package/dist/chunk-QA3RP5NH.js.map +0 -1
- /package/dist/{chunk-TH6COGOP.js.map → chunk-H4RVA4VE.js.map} +0 -0
- /package/dist/{chunk-44HD4BTA.js.map → chunk-MW4VAKAO.js.map} +0 -0
- /package/dist/{chunk-RHI3GHZW.js.map → chunk-QOWVNWOC.js.map} +0 -0
- /package/dist/{chunk-NXC35KC5.js.map → chunk-XOFWRC73.js.map} +0 -0
|
@@ -559,7 +559,11 @@ declare function accessHintForGuard(guard: NodeGuard): string;
|
|
|
559
559
|
* contract. See SESSION-foundation-redesign.md §§1–10 for design history.
|
|
560
560
|
*/
|
|
561
561
|
|
|
562
|
-
/**
|
|
562
|
+
/**
|
|
563
|
+
* Lifecycle status of a node.
|
|
564
|
+
*
|
|
565
|
+
* @see GRAPHREFLY-SPEC.md §2.2
|
|
566
|
+
*/
|
|
563
567
|
type NodeStatus = "sentinel" | "pending" | "dirty" | "settled" | "resolved" | "completed" | "errored";
|
|
564
568
|
/** Callback that receives downstream message batches. */
|
|
565
569
|
type NodeSink = (messages: Messages) => void;
|
|
@@ -843,6 +847,21 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
843
847
|
* treats `0` as "wave settled" — O(1) check for full dep settlement.
|
|
844
848
|
*/
|
|
845
849
|
_dirtyDepCount: number;
|
|
850
|
+
/**
|
|
851
|
+
* Inside an explicit `batch(() => ...)` scope, every `_emit` accumulates
|
|
852
|
+
* its already-framed messages here instead of dispatching synchronously.
|
|
853
|
+
* At batch end, `_flushBatchPending` runs (registered via
|
|
854
|
+
* `registerBatchFlushHook`) and delivers the whole accumulated batch as
|
|
855
|
+
* one `downWithBatch` call — collapsing what would otherwise be K
|
|
856
|
+
* separate sink invocations into one. This is the fix for the diamond
|
|
857
|
+
* fan-in K+1 over-fire.
|
|
858
|
+
*
|
|
859
|
+
* `null` outside batch (or after flush). Only ever appended to within
|
|
860
|
+
* a single explicit batch lifetime; reset to `null` on flush. State
|
|
861
|
+
* updates (cache, version, status) still happen per-emit via
|
|
862
|
+
* `_updateState` — only the downstream delivery is coalesced.
|
|
863
|
+
*/
|
|
864
|
+
_batchPendingMessages: Message[] | null;
|
|
846
865
|
/**
|
|
847
866
|
* Set of active pause locks held against this node. Every `[PAUSE, lockId]`
|
|
848
867
|
* adds its `lockId` to the set; every `[RESUME, lockId]` removes it.
|
|
@@ -1068,37 +1087,35 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
1068
1087
|
private _frameBatch;
|
|
1069
1088
|
/**
|
|
1070
1089
|
* @internal The unified dispatch waist — one call = one wave.
|
|
1090
|
+
* See `GRAPHREFLY-SPEC.md` §1.3.1 for protocol context — the stages
|
|
1091
|
+
* below are the implementation order.
|
|
1071
1092
|
*
|
|
1072
1093
|
* Pipeline stages, in order:
|
|
1073
1094
|
*
|
|
1074
|
-
* 1.
|
|
1075
|
-
* 2. Terminal filter — post-COMPLETE/ERROR only TEARDOWN/INVALIDATE
|
|
1095
|
+
* 1. Terminal filter — post-COMPLETE/ERROR only TEARDOWN/INVALIDATE
|
|
1076
1096
|
* still propagate so graph teardown and cache-clear still work.
|
|
1077
|
-
*
|
|
1097
|
+
* 2. Tier sort (stable) — the batch can be in any order when it
|
|
1078
1098
|
* arrives; the walker downstream (`downWithBatch`) assumes
|
|
1079
1099
|
* ascending tier monotone, and so does `_updateState`'s tier-3
|
|
1080
1100
|
* slice walk. This is the single source of truth for ordering.
|
|
1081
|
-
*
|
|
1101
|
+
* 3. Synthetic DIRTY prefix — if a tier-3 payload is present, no
|
|
1082
1102
|
* DIRTY is already in the batch, and the node isn't already in
|
|
1083
1103
|
* `"dirty"` status, prepend `[DIRTY]` after any tier-0 START
|
|
1084
1104
|
* entries. Guarantees spec §1.3.1 (DIRTY precedes DATA within
|
|
1085
1105
|
* the same batch) uniformly across every entry point.
|
|
1086
|
-
*
|
|
1106
|
+
* 4. PAUSE/RESUME lock bookkeeping (C0) — update `_pauseLocks`,
|
|
1087
1107
|
* derive `_paused`, filter unknown-lockId RESUME, replay
|
|
1088
1108
|
* bufferAll buffer on final lock release.
|
|
1089
|
-
*
|
|
1109
|
+
* 5. Meta TEARDOWN fan-out — notify meta children before
|
|
1090
1110
|
* `_updateState`'s TEARDOWN branch calls `_deactivate`. Hoisted
|
|
1091
1111
|
* out of the walk to keep `_updateState` re-entrance-free.
|
|
1092
|
-
*
|
|
1112
|
+
* 6. `_updateState` — walk the batch in tier order, advancing
|
|
1093
1113
|
* `_cached` / `_status` / `_versioning` and running equals
|
|
1094
1114
|
* substitution on tier-3 DATA (§3.5.1). Returns
|
|
1095
1115
|
* `{finalMessages, equalsError?}`.
|
|
1096
|
-
*
|
|
1116
|
+
* 7. `downWithBatch` dispatch (or bufferAll capture if paused with
|
|
1097
1117
|
* `pausable: "resumeAll"`).
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
* `node.down` / `node.emit` / `actions.down` / `actions.emit` all
|
|
1101
|
-
* converge here — the unified `_emit` waist (spec §1.3.1).
|
|
1118
|
+
* 8. Recursive ERROR emission if equals threw mid-walk.
|
|
1102
1119
|
*/
|
|
1103
1120
|
_emit(messages: Messages): void;
|
|
1104
1121
|
/**
|
|
@@ -1127,6 +1144,33 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
1127
1144
|
*/
|
|
1128
1145
|
private _updateState;
|
|
1129
1146
|
private _deliverToSinks;
|
|
1147
|
+
/**
|
|
1148
|
+
* @internal Dispatch entry point that respects the per-batch emit
|
|
1149
|
+
* accumulator (Bug 2). Inside an explicit `batch()` scope, append to
|
|
1150
|
+
* `_batchPendingMessages` and register a flush hook on first append.
|
|
1151
|
+
* Outside batch — or during a drain (where `flushInProgress` is true
|
|
1152
|
+
* but `batchDepth` is 0) — dispatch synchronously through `downWithBatch`.
|
|
1153
|
+
*
|
|
1154
|
+
* Per-emit state updates (`_frameBatch`, `_updateState`) have already
|
|
1155
|
+
* happened by the time we reach here; only the **downstream delivery**
|
|
1156
|
+
* is coalesced. Cache, version, and status are visible mid-batch on
|
|
1157
|
+
* the emitting node itself.
|
|
1158
|
+
*/
|
|
1159
|
+
private _dispatchOrAccumulate;
|
|
1160
|
+
/**
|
|
1161
|
+
* @internal Flushes the accumulated batch through `downWithBatch` and
|
|
1162
|
+
* clears the pending state. Idempotent — safe to call when pending is
|
|
1163
|
+
* already null or empty (e.g. on a `batch()` throw, where the hook
|
|
1164
|
+
* fires for cleanup but the drainPhase queues are wiped after).
|
|
1165
|
+
*
|
|
1166
|
+
* Critical: the accumulated batch is interleaved per-emit framings like
|
|
1167
|
+
* `[DIRTY, DATA(1), DIRTY, DATA(2)]` — non-monotone tier order. We must
|
|
1168
|
+
* re-frame to sort by tier before handing to `downWithBatch`, which
|
|
1169
|
+
* assumes pre-sorted input. `_frameBatch` also handles the synthetic
|
|
1170
|
+
* DIRTY prepend rule (no-op here — `hasDirty` is true since each
|
|
1171
|
+
* accumulated emit already carries its own DIRTY prefix).
|
|
1172
|
+
*/
|
|
1173
|
+
private _flushBatchPending;
|
|
1130
1174
|
}
|
|
1131
1175
|
/**
|
|
1132
1176
|
* Creates a reactive {@link Node} — the single GraphReFly primitive (§2).
|
|
@@ -559,7 +559,11 @@ declare function accessHintForGuard(guard: NodeGuard): string;
|
|
|
559
559
|
* contract. See SESSION-foundation-redesign.md §§1–10 for design history.
|
|
560
560
|
*/
|
|
561
561
|
|
|
562
|
-
/**
|
|
562
|
+
/**
|
|
563
|
+
* Lifecycle status of a node.
|
|
564
|
+
*
|
|
565
|
+
* @see GRAPHREFLY-SPEC.md §2.2
|
|
566
|
+
*/
|
|
563
567
|
type NodeStatus = "sentinel" | "pending" | "dirty" | "settled" | "resolved" | "completed" | "errored";
|
|
564
568
|
/** Callback that receives downstream message batches. */
|
|
565
569
|
type NodeSink = (messages: Messages) => void;
|
|
@@ -843,6 +847,21 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
843
847
|
* treats `0` as "wave settled" — O(1) check for full dep settlement.
|
|
844
848
|
*/
|
|
845
849
|
_dirtyDepCount: number;
|
|
850
|
+
/**
|
|
851
|
+
* Inside an explicit `batch(() => ...)` scope, every `_emit` accumulates
|
|
852
|
+
* its already-framed messages here instead of dispatching synchronously.
|
|
853
|
+
* At batch end, `_flushBatchPending` runs (registered via
|
|
854
|
+
* `registerBatchFlushHook`) and delivers the whole accumulated batch as
|
|
855
|
+
* one `downWithBatch` call — collapsing what would otherwise be K
|
|
856
|
+
* separate sink invocations into one. This is the fix for the diamond
|
|
857
|
+
* fan-in K+1 over-fire.
|
|
858
|
+
*
|
|
859
|
+
* `null` outside batch (or after flush). Only ever appended to within
|
|
860
|
+
* a single explicit batch lifetime; reset to `null` on flush. State
|
|
861
|
+
* updates (cache, version, status) still happen per-emit via
|
|
862
|
+
* `_updateState` — only the downstream delivery is coalesced.
|
|
863
|
+
*/
|
|
864
|
+
_batchPendingMessages: Message[] | null;
|
|
846
865
|
/**
|
|
847
866
|
* Set of active pause locks held against this node. Every `[PAUSE, lockId]`
|
|
848
867
|
* adds its `lockId` to the set; every `[RESUME, lockId]` removes it.
|
|
@@ -1068,37 +1087,35 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
1068
1087
|
private _frameBatch;
|
|
1069
1088
|
/**
|
|
1070
1089
|
* @internal The unified dispatch waist — one call = one wave.
|
|
1090
|
+
* See `GRAPHREFLY-SPEC.md` §1.3.1 for protocol context — the stages
|
|
1091
|
+
* below are the implementation order.
|
|
1071
1092
|
*
|
|
1072
1093
|
* Pipeline stages, in order:
|
|
1073
1094
|
*
|
|
1074
|
-
* 1.
|
|
1075
|
-
* 2. Terminal filter — post-COMPLETE/ERROR only TEARDOWN/INVALIDATE
|
|
1095
|
+
* 1. Terminal filter — post-COMPLETE/ERROR only TEARDOWN/INVALIDATE
|
|
1076
1096
|
* still propagate so graph teardown and cache-clear still work.
|
|
1077
|
-
*
|
|
1097
|
+
* 2. Tier sort (stable) — the batch can be in any order when it
|
|
1078
1098
|
* arrives; the walker downstream (`downWithBatch`) assumes
|
|
1079
1099
|
* ascending tier monotone, and so does `_updateState`'s tier-3
|
|
1080
1100
|
* slice walk. This is the single source of truth for ordering.
|
|
1081
|
-
*
|
|
1101
|
+
* 3. Synthetic DIRTY prefix — if a tier-3 payload is present, no
|
|
1082
1102
|
* DIRTY is already in the batch, and the node isn't already in
|
|
1083
1103
|
* `"dirty"` status, prepend `[DIRTY]` after any tier-0 START
|
|
1084
1104
|
* entries. Guarantees spec §1.3.1 (DIRTY precedes DATA within
|
|
1085
1105
|
* the same batch) uniformly across every entry point.
|
|
1086
|
-
*
|
|
1106
|
+
* 4. PAUSE/RESUME lock bookkeeping (C0) — update `_pauseLocks`,
|
|
1087
1107
|
* derive `_paused`, filter unknown-lockId RESUME, replay
|
|
1088
1108
|
* bufferAll buffer on final lock release.
|
|
1089
|
-
*
|
|
1109
|
+
* 5. Meta TEARDOWN fan-out — notify meta children before
|
|
1090
1110
|
* `_updateState`'s TEARDOWN branch calls `_deactivate`. Hoisted
|
|
1091
1111
|
* out of the walk to keep `_updateState` re-entrance-free.
|
|
1092
|
-
*
|
|
1112
|
+
* 6. `_updateState` — walk the batch in tier order, advancing
|
|
1093
1113
|
* `_cached` / `_status` / `_versioning` and running equals
|
|
1094
1114
|
* substitution on tier-3 DATA (§3.5.1). Returns
|
|
1095
1115
|
* `{finalMessages, equalsError?}`.
|
|
1096
|
-
*
|
|
1116
|
+
* 7. `downWithBatch` dispatch (or bufferAll capture if paused with
|
|
1097
1117
|
* `pausable: "resumeAll"`).
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
* `node.down` / `node.emit` / `actions.down` / `actions.emit` all
|
|
1101
|
-
* converge here — the unified `_emit` waist (spec §1.3.1).
|
|
1118
|
+
* 8. Recursive ERROR emission if equals threw mid-walk.
|
|
1102
1119
|
*/
|
|
1103
1120
|
_emit(messages: Messages): void;
|
|
1104
1121
|
/**
|
|
@@ -1127,6 +1144,33 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
1127
1144
|
*/
|
|
1128
1145
|
private _updateState;
|
|
1129
1146
|
private _deliverToSinks;
|
|
1147
|
+
/**
|
|
1148
|
+
* @internal Dispatch entry point that respects the per-batch emit
|
|
1149
|
+
* accumulator (Bug 2). Inside an explicit `batch()` scope, append to
|
|
1150
|
+
* `_batchPendingMessages` and register a flush hook on first append.
|
|
1151
|
+
* Outside batch — or during a drain (where `flushInProgress` is true
|
|
1152
|
+
* but `batchDepth` is 0) — dispatch synchronously through `downWithBatch`.
|
|
1153
|
+
*
|
|
1154
|
+
* Per-emit state updates (`_frameBatch`, `_updateState`) have already
|
|
1155
|
+
* happened by the time we reach here; only the **downstream delivery**
|
|
1156
|
+
* is coalesced. Cache, version, and status are visible mid-batch on
|
|
1157
|
+
* the emitting node itself.
|
|
1158
|
+
*/
|
|
1159
|
+
private _dispatchOrAccumulate;
|
|
1160
|
+
/**
|
|
1161
|
+
* @internal Flushes the accumulated batch through `downWithBatch` and
|
|
1162
|
+
* clears the pending state. Idempotent — safe to call when pending is
|
|
1163
|
+
* already null or empty (e.g. on a `batch()` throw, where the hook
|
|
1164
|
+
* fires for cleanup but the drainPhase queues are wiped after).
|
|
1165
|
+
*
|
|
1166
|
+
* Critical: the accumulated batch is interleaved per-emit framings like
|
|
1167
|
+
* `[DIRTY, DATA(1), DIRTY, DATA(2)]` — non-monotone tier order. We must
|
|
1168
|
+
* re-frame to sort by tier before handing to `downWithBatch`, which
|
|
1169
|
+
* assumes pre-sorted input. `_frameBatch` also handles the synthetic
|
|
1170
|
+
* DIRTY prepend rule (no-op here — `hasDirty` is true since each
|
|
1171
|
+
* accumulated emit already carries its own DIRTY prefix).
|
|
1172
|
+
*/
|
|
1173
|
+
private _flushBatchPending;
|
|
1130
1174
|
}
|
|
1131
1175
|
/**
|
|
1132
1176
|
* Creates a reactive {@link Node} — the single GraphReFly primitive (§2).
|