GraphReFlyTS

API Reference

withBlueprintProvenance()

Attach caller-supplied provenance data to a blueprint.

Import

import { withBlueprintProvenance } from "@graphrefly/ts/graph";

Signature

function withBlueprintProvenance(
	blueprint: GraphBlueprint,
	provenance: GraphBlueprintProvenance,
): GraphBlueprint

Parameters

ParameterTypeDescription
blueprintGraphBlueprintBlueprint to augment.
provenanceGraphBlueprintProvenanceStrict JSON provenance payload.

Returns

The blueprint with normalized provenance attached.

Example

import {
  GRAPH_BLUEPRINT_VERSION,
  normalizeTopology,
  withBlueprintProvenance,
} from "@graphrefly/ts/graph";

const blueprint = {
  version: GRAPH_BLUEPRINT_VERSION,
  topology: normalizeTopology({ nodes: [], edges: [] }),
};
withBlueprintProvenance(blueprint, { source: "snapshot" });

Source

packages/ts/src/graph/blueprint.ts