withBlueprintHash()
Attach a content hash to a graph blueprint.
Import
Section titled “Import”import { withBlueprintHash } from "@graphrefly/ts/graph";Signature
Section titled “Signature”function withBlueprintHash( blueprint: GraphBlueprint, options: GraphBlueprintHashOptions,): GraphBlueprint | Promise<GraphBlueprint>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
blueprint | GraphBlueprint | Blueprint to augment. |
options | GraphBlueprintHashOptions | Hash algorithm and hashing function. |
Returns
Section titled “Returns”The blueprint with a computed hash field, or a Promise for one.
Example
Section titled “Example”import { GRAPH_BLUEPRINT_VERSION, normalizeTopology, withBlueprintHash } from "@graphrefly/ts/graph";
const blueprint = { version: GRAPH_BLUEPRINT_VERSION, topology: normalizeTopology({ nodes: [], edges: [] }),};await withBlueprintHash(blueprint, { algorithm: "sha256", hash: async () => "abc123",});Source
Section titled “Source”packages/ts/src/graph/blueprint.ts