@tokens-studio/graph-engine-migration
Version:
A package to upgrade old graph engine files to the new format
35 lines • 1.12 kB
TypeScript
import { Edge, Graph, Node } from '@tokens-studio/graph-engine';
/**
* Finds all nodes of a specified type in the graph
* @param graph
* @param type
* @returns
*/
export declare const findNodesOfType: (graph: Graph, type: string) => Node[];
export declare const findOutEdges: (graph: Graph, id: string) => Edge[];
/**
* Converts the array of nodes in the graph to a lookup for O(1) performance
* @param graph
* @returns
*/
export declare const toNodeLookup: (graph: Graph) => Record<string, Node>;
/**
* Converts the array of edge in the graph to a lookup for O(1) performance
* @param graph
* @returns
*/
export declare const toEdgeLookup: (graph: Graph) => Record<string, Edge>;
export type SourceToTarget = {
source: Node;
edge: Edge;
target: Node;
};
/**
* Finds all nodes in the graph that have a specified source and have and edge connecting to the target
* @param graph
* @param sourceType
* @param target
* @returns
*/
export declare const findSourceToTargetOfType: (graph: Graph, sourceType: string, targetType: string) => SourceToTarget[];
//# sourceMappingURL=utils.d.ts.map