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