@graphrefly/graphrefly 0.10.0 → 0.12.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-QTZSBQGJ.js → chunk-4F2ZFD5L.js} +19 -1
- package/dist/chunk-4F2ZFD5L.js.map +1 -0
- package/dist/{chunk-LR2CLSEF.js → chunk-6OLNYOGU.js} +2 -3
- package/dist/chunk-6OLNYOGU.js.map +1 -0
- package/dist/{chunk-TZLX4KIT.js → chunk-BRPCN2HJ.js} +46 -17
- package/dist/chunk-BRPCN2HJ.js.map +1 -0
- package/dist/{chunk-A2AJJOSJ.js → chunk-IXTW3BIO.js} +3 -3
- package/dist/{chunk-XCZPGOVP.js → chunk-JYRHO63K.js} +3 -3
- package/dist/{chunk-UCW3VWMN.js → chunk-NULSP7U4.js} +4 -4
- package/dist/{chunk-WYI7YW54.js → chunk-VQWLA6XQ.js} +3 -3
- package/dist/{chunk-YWTP2XRJ.js → chunk-X732W3QA.js} +2 -2
- package/dist/{chunk-E7OH6ZAZ.js → chunk-XWMTVV2D.js} +62 -3
- package/dist/chunk-XWMTVV2D.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +10 -1
- 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 +74 -1
- 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 +12 -3
- package/dist/extra/index.cjs +52 -14
- 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 -5
- package/dist/graph/index.cjs +10 -1
- 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 +4 -4
- package/dist/{graph-DqTICAY2.d.cts → graph-BE10ujU9.d.cts} +1 -1
- package/dist/{graph-X9uwnD_z.d.ts → graph-DXT95WZ3.d.ts} +1 -1
- package/dist/{index-DLO8wnYU.d.ts → index-53cDGX7F.d.ts} +3 -3
- package/dist/{index-DMv1Etbi.d.ts → index-B10Q0sQB.d.ts} +2 -2
- package/dist/{index-BPCeYDS4.d.ts → index-C0_7g9sj.d.ts} +1 -1
- package/dist/{index-3U0WxdD-.d.cts → index-CCvzN5GB.d.cts} +2 -2
- package/dist/{index-BP1t_38S.d.cts → index-CiAqgfFg.d.ts} +17 -13
- package/dist/{index-a5gHmH5b.d.ts → index-CthwPnHQ.d.cts} +17 -13
- package/dist/{index-BVG5pjin.d.ts → index-Dzdm20sx.d.ts} +88 -3
- package/dist/{index-BYEgosAX.d.cts → index-QfbXNW1N.d.cts} +88 -3
- package/dist/{index-BYa2YMat.d.cts → index-aBZ2RoP0.d.cts} +3 -3
- package/dist/{index-DbwgQ4Cw.d.cts → index-nRulwTr-.d.cts} +1 -1
- package/dist/index.cjs +1084 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +422 -22
- package/dist/index.d.ts +422 -22
- package/dist/index.js +988 -120
- package/dist/index.js.map +1 -1
- package/dist/{meta-BJEU8fYz.d.cts → meta-BcuDhtwu.d.cts} +33 -1
- package/dist/{meta-BJEU8fYz.d.ts → meta-BcuDhtwu.d.ts} +33 -1
- package/dist/patterns/reactive-layout/index.cjs +10 -1
- 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/dist/{reactive-log-RhgIog2Z.d.ts → reactive-log-Cu0VdqkT.d.ts} +2 -2
- package/dist/{reactive-log-BfX6bOSZ.d.cts → reactive-log-OULQssZg.d.cts} +2 -2
- package/package.json +7 -2
- package/dist/chunk-E7OH6ZAZ.js.map +0 -1
- package/dist/chunk-LR2CLSEF.js.map +0 -1
- package/dist/chunk-QTZSBQGJ.js.map +0 -1
- package/dist/chunk-TZLX4KIT.js.map +0 -1
- /package/dist/{chunk-A2AJJOSJ.js.map → chunk-IXTW3BIO.js.map} +0 -0
- /package/dist/{chunk-XCZPGOVP.js.map → chunk-JYRHO63K.js.map} +0 -0
- /package/dist/{chunk-UCW3VWMN.js.map → chunk-NULSP7U4.js.map} +0 -0
- /package/dist/{chunk-WYI7YW54.js.map → chunk-VQWLA6XQ.js.map} +0 -0
- /package/dist/{chunk-YWTP2XRJ.js.map → chunk-X732W3QA.js.map} +0 -0
|
@@ -345,6 +345,12 @@ declare function advanceVersion(info: NodeVersionInfo, newValue: unknown, hashFn
|
|
|
345
345
|
/** Type guard: is this V1 versioning info? */
|
|
346
346
|
declare function isV1(info: NodeVersionInfo): info is V1;
|
|
347
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Branded symbol that marks a {@link CleanupResult} wrapper.
|
|
350
|
+
* Used internally by {@link cleanupResult} — prevents duck-type collisions
|
|
351
|
+
* with domain objects that happen to have a `cleanup` property.
|
|
352
|
+
*/
|
|
353
|
+
declare const CLEANUP_RESULT: unique symbol;
|
|
348
354
|
/** Lifecycle status of a node. */
|
|
349
355
|
type NodeStatus = "disconnected" | "dirty" | "settled" | "resolved" | "completed" | "errored";
|
|
350
356
|
/** Callback that receives downstream message batches. */
|
|
@@ -513,6 +519,32 @@ interface Node<T = unknown> {
|
|
|
513
519
|
/** Versioning info (GRAPHREFLY-SPEC §7). `undefined` when versioning is not enabled. */
|
|
514
520
|
readonly v: Readonly<NodeVersionInfo> | undefined;
|
|
515
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* Explicit cleanup wrapper. When a node fn returns `{ cleanup, value? }`,
|
|
524
|
+
* `cleanup` is registered as the teardown/recompute cleanup and `value`
|
|
525
|
+
* (if present) is emitted as data. This avoids the ambiguity where returning
|
|
526
|
+
* a plain function is silently consumed as cleanup instead of emitted as data.
|
|
527
|
+
*
|
|
528
|
+
* Use the {@link cleanupResult} factory to create instances — it stamps the
|
|
529
|
+
* branded {@link CLEANUP_RESULT} symbol so that domain objects with a `cleanup`
|
|
530
|
+
* property are never misinterpreted.
|
|
531
|
+
*
|
|
532
|
+
* Plain function returns are still treated as cleanup for backward compatibility.
|
|
533
|
+
*/
|
|
534
|
+
type CleanupResult<T = unknown> = {
|
|
535
|
+
readonly [CLEANUP_RESULT]: true;
|
|
536
|
+
cleanup: () => void;
|
|
537
|
+
value?: T;
|
|
538
|
+
};
|
|
539
|
+
/**
|
|
540
|
+
* Create a branded {@link CleanupResult}.
|
|
541
|
+
*
|
|
542
|
+
* ```ts
|
|
543
|
+
* node([dep], () => cleanupResult(() => release(), computedValue))
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
546
|
+
declare function cleanupResult<T>(cleanup: () => void): CleanupResult<T>;
|
|
547
|
+
declare function cleanupResult<T>(cleanup: () => void, value: T): CleanupResult<T>;
|
|
516
548
|
/**
|
|
517
549
|
* Creates a reactive {@link Node} — the single GraphReFly primitive (GRAPHREFLY-SPEC §2).
|
|
518
550
|
*
|
|
@@ -631,4 +663,4 @@ declare function metaSnapshot(node: Node): Record<string, unknown>;
|
|
|
631
663
|
*/
|
|
632
664
|
declare function describeNode(node: Node, includeFields?: Set<string> | null): DescribeNodeOutput;
|
|
633
665
|
|
|
634
|
-
export {
|
|
666
|
+
export { metaSnapshot as $, type Actor as A, accessHintForGuard as B, CLEANUP_RESULT as C, DATA as D, ERROR as E, advanceVersion as F, type GuardAction as G, type HashFn as H, INVALIDATE as I, cleanupResult as J, createVersioning as K, defaultHash as L, type Message as M, type Node as N, type OnMessageHandler as O, PAUSE as P, describeNode as Q, RESOLVED as R, type SubscribeHints as S, TEARDOWN as T, isKnownMessageType as U, type V0 as V, isPhase2Message as W, isTerminalMessage as X, isV1 as Y, knownMessageTypes as Z, messageTier as _, type NodeOptions as a, node as a0, normalizeActor as a1, policy as a2, policyFromRules as a3, propagatesToMeta as a4, resolveDescribeFields as a5, type NodeInspectorHook as a6, type NodeActions as b, type NodeFn as c, COMPLETE as d, type CleanupResult as e, DEFAULT_ACTOR as f, DIRTY as g, type DescribeDetail as h, type DescribeField as i, type DescribeNodeOutput as j, GuardDenied as k, type GuardDeniedDetails as l, type Messages as m, type NodeDescribeKind as n, type NodeGuard as o, type NodeSink as p, type NodeStatus as q, type NodeTransportOptions as r, type NodeVersionInfo as s, type PolicyAllow as t, type PolicyDeny as u, type PolicyRuleData as v, RESUME as w, type V1 as x, type VersioningLevel as y, type VersioningOptions as z };
|
|
@@ -345,6 +345,12 @@ declare function advanceVersion(info: NodeVersionInfo, newValue: unknown, hashFn
|
|
|
345
345
|
/** Type guard: is this V1 versioning info? */
|
|
346
346
|
declare function isV1(info: NodeVersionInfo): info is V1;
|
|
347
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Branded symbol that marks a {@link CleanupResult} wrapper.
|
|
350
|
+
* Used internally by {@link cleanupResult} — prevents duck-type collisions
|
|
351
|
+
* with domain objects that happen to have a `cleanup` property.
|
|
352
|
+
*/
|
|
353
|
+
declare const CLEANUP_RESULT: unique symbol;
|
|
348
354
|
/** Lifecycle status of a node. */
|
|
349
355
|
type NodeStatus = "disconnected" | "dirty" | "settled" | "resolved" | "completed" | "errored";
|
|
350
356
|
/** Callback that receives downstream message batches. */
|
|
@@ -513,6 +519,32 @@ interface Node<T = unknown> {
|
|
|
513
519
|
/** Versioning info (GRAPHREFLY-SPEC §7). `undefined` when versioning is not enabled. */
|
|
514
520
|
readonly v: Readonly<NodeVersionInfo> | undefined;
|
|
515
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* Explicit cleanup wrapper. When a node fn returns `{ cleanup, value? }`,
|
|
524
|
+
* `cleanup` is registered as the teardown/recompute cleanup and `value`
|
|
525
|
+
* (if present) is emitted as data. This avoids the ambiguity where returning
|
|
526
|
+
* a plain function is silently consumed as cleanup instead of emitted as data.
|
|
527
|
+
*
|
|
528
|
+
* Use the {@link cleanupResult} factory to create instances — it stamps the
|
|
529
|
+
* branded {@link CLEANUP_RESULT} symbol so that domain objects with a `cleanup`
|
|
530
|
+
* property are never misinterpreted.
|
|
531
|
+
*
|
|
532
|
+
* Plain function returns are still treated as cleanup for backward compatibility.
|
|
533
|
+
*/
|
|
534
|
+
type CleanupResult<T = unknown> = {
|
|
535
|
+
readonly [CLEANUP_RESULT]: true;
|
|
536
|
+
cleanup: () => void;
|
|
537
|
+
value?: T;
|
|
538
|
+
};
|
|
539
|
+
/**
|
|
540
|
+
* Create a branded {@link CleanupResult}.
|
|
541
|
+
*
|
|
542
|
+
* ```ts
|
|
543
|
+
* node([dep], () => cleanupResult(() => release(), computedValue))
|
|
544
|
+
* ```
|
|
545
|
+
*/
|
|
546
|
+
declare function cleanupResult<T>(cleanup: () => void): CleanupResult<T>;
|
|
547
|
+
declare function cleanupResult<T>(cleanup: () => void, value: T): CleanupResult<T>;
|
|
516
548
|
/**
|
|
517
549
|
* Creates a reactive {@link Node} — the single GraphReFly primitive (GRAPHREFLY-SPEC §2).
|
|
518
550
|
*
|
|
@@ -631,4 +663,4 @@ declare function metaSnapshot(node: Node): Record<string, unknown>;
|
|
|
631
663
|
*/
|
|
632
664
|
declare function describeNode(node: Node, includeFields?: Set<string> | null): DescribeNodeOutput;
|
|
633
665
|
|
|
634
|
-
export {
|
|
666
|
+
export { metaSnapshot as $, type Actor as A, accessHintForGuard as B, CLEANUP_RESULT as C, DATA as D, ERROR as E, advanceVersion as F, type GuardAction as G, type HashFn as H, INVALIDATE as I, cleanupResult as J, createVersioning as K, defaultHash as L, type Message as M, type Node as N, type OnMessageHandler as O, PAUSE as P, describeNode as Q, RESOLVED as R, type SubscribeHints as S, TEARDOWN as T, isKnownMessageType as U, type V0 as V, isPhase2Message as W, isTerminalMessage as X, isV1 as Y, knownMessageTypes as Z, messageTier as _, type NodeOptions as a, node as a0, normalizeActor as a1, policy as a2, policyFromRules as a3, propagatesToMeta as a4, resolveDescribeFields as a5, type NodeInspectorHook as a6, type NodeActions as b, type NodeFn as c, COMPLETE as d, type CleanupResult as e, DEFAULT_ACTOR as f, DIRTY as g, type DescribeDetail as h, type DescribeField as i, type DescribeNodeOutput as j, GuardDenied as k, type GuardDeniedDetails as l, type Messages as m, type NodeDescribeKind as n, type NodeGuard as o, type NodeSink as p, type NodeStatus as q, type NodeTransportOptions as r, type NodeVersionInfo as s, type PolicyAllow as t, type PolicyDeny as u, type PolicyRuleData as v, RESUME as w, type V1 as x, type VersioningLevel as y, type VersioningOptions as z };
|
|
@@ -548,6 +548,7 @@ function advanceVersion(info, newValue, hashFn) {
|
|
|
548
548
|
|
|
549
549
|
// src/core/node.ts
|
|
550
550
|
var NO_VALUE = /* @__PURE__ */ Symbol.for("graphrefly/NO_VALUE");
|
|
551
|
+
var CLEANUP_RESULT = /* @__PURE__ */ Symbol.for("graphrefly/CLEANUP_RESULT");
|
|
551
552
|
function createIntBitSet() {
|
|
552
553
|
let bits = 0;
|
|
553
554
|
return {
|
|
@@ -610,6 +611,7 @@ function createBitSet(size) {
|
|
|
610
611
|
}
|
|
611
612
|
var isNodeArray = (value) => Array.isArray(value);
|
|
612
613
|
var isNodeOptions = (value) => typeof value === "object" && value != null && !Array.isArray(value);
|
|
614
|
+
var isCleanupResult = (value) => typeof value === "object" && value !== null && CLEANUP_RESULT in value;
|
|
613
615
|
var isCleanupFn = (value) => typeof value === "function";
|
|
614
616
|
var statusAfterMessage = (status, msg) => {
|
|
615
617
|
const t = msg[0];
|
|
@@ -1025,6 +1027,14 @@ var NodeImpl = class {
|
|
|
1025
1027
|
this._lastDepValues = depValues;
|
|
1026
1028
|
this._inspectorHook?.({ kind: "run", depValues });
|
|
1027
1029
|
const out = this._fn(depValues, this._actions);
|
|
1030
|
+
if (isCleanupResult(out)) {
|
|
1031
|
+
this._cleanup = out.cleanup;
|
|
1032
|
+
if (this._manualEmitUsed) return;
|
|
1033
|
+
if ("value" in out) {
|
|
1034
|
+
this._emitAutoValue(out.value);
|
|
1035
|
+
}
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1028
1038
|
if (isCleanupFn(out)) {
|
|
1029
1039
|
this._cleanup = out;
|
|
1030
1040
|
return;
|
|
@@ -1667,7 +1677,6 @@ function resolveDescribeFields(detail, fields) {
|
|
|
1667
1677
|
case "full":
|
|
1668
1678
|
return null;
|
|
1669
1679
|
// null = include everything
|
|
1670
|
-
case "minimal":
|
|
1671
1680
|
default:
|
|
1672
1681
|
return /* @__PURE__ */ new Set(["type", "deps"]);
|
|
1673
1682
|
}
|