API Reference
canonicalTopologyJson()
Serialize a topology to the canonical blueprint JSON string.
Import
import { canonicalTopologyJson } from "@graphrefly/ts/graph";
Signature
function canonicalTopologyJson(snapshot: GraphTopologySnapshot | NormalizedGraphTopologySnapshot): string
Parameters
| Parameter | Type | Description |
|---|---|---|
snapshot | GraphTopologySnapshot | NormalizedGraphTopologySnapshot | Graph topology snapshot or normalized topology. |
Returns
A deterministic JSON string for the normalized topology.
Example
import { canonicalTopologyJson } from "@graphrefly/ts/graph";
canonicalTopologyJson({
nodes: [{ id: "source", factory: "state", deps: [] }],
edges: [],
});
Source
packages/ts/src/graph/blueprint.ts