Skip to content
Shapemetry

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): GraphAssertResult

assertGraphClosed

function

assertGraphClosed(snapshot: GraphSnapshot, registry?: Registry): GraphAssertResult

assertNoCycle

function

(a) no cycle — DFS; fails naming a cycle path.

assertNoCycle(snapshot: GraphSnapshot): GraphAssertResult

assertReachableFromRoots

function

(c) every node reachable from a root (nodes with no inbound edge).

assertReachableFromRoots(snapshot: GraphSnapshot): GraphAssertResult

graphSnapshotOf

function

Build a snapshot from a Model-like source (nodes collection + optional registry). Edges come from live _dependents (dependOn / withEvaluating).

graphSnapshotOf(source: GraphSnapshotSource): GraphSnapshot

GraphSnapshotSource

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): string

snapshotToMermaid

function

snapshotToMermaid(snapshot: GraphSnapshot): string
Last updated: 📖 1 min readEdit on GitHub