Model - Graph snapshot
API reference for src/core/graphSnapshot, src/schema/graphSnapshot on @huukhanhnguyen/model, reachable from ..
See the Guide for the ModelJSON / evaluate pipeline.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
assertEdgeTypes
function
(b) every edge's type matches the consuming arg type — when registry is provided and consumer method is known. Edges without a matching arg are OK (structural dependents).
assertEdgeTypes(snapshot: GraphSnapshot, registry?: Registry): GraphAssertResultassertGraphClosed
function
assertGraphClosed(snapshot: GraphSnapshot, registry?: Registry): GraphAssertResultassertNoCycle
function
(a) no cycle — DFS; fails naming a cycle path.
assertNoCycle(snapshot: GraphSnapshot): GraphAssertResultassertReachableFromRoots
function
(c) every node reachable from a root (nodes with no inbound edge).
assertReachableFromRoots(snapshot: GraphSnapshot): GraphAssertResultgraphSnapshotOf
function
Build a snapshot from a Model-like source (nodes collection + optional registry). Edges come from live _dependents (dependOn / withEvaluating).
graphSnapshotOf(source: GraphSnapshotSource): GraphSnapshotGraphSnapshotSource
type
type GraphSnapshotSource
// = {
nodes: {
elements: SnapshotSourceNode[];
};
registry?: RegistryHost;
}SnapshotSourceNode
type
Minimal node surface the snapshot reader needs (BaseNode + keyed).
type SnapshotSourceNode
// = {
id: string;
key?: string;
method?: string;
return?: string | null;
isDirty?: boolean;
lastEvalMs?: number;
lane?: string;
_dependents?: Set<unknown>;
definition?: OperationDefinition | null;
children?: {
elements?: SnapshotSourceNode[];
};
elements?: SnapshotSourceNode[];
}snapshotToDot
function
snapshotToDot(snapshot: GraphSnapshot): stringsnapshotToMermaid
function
snapshotToMermaid(snapshot: GraphSnapshot): string