import { GraphBuilder } from "./GraphBuilder"; import { Graph, GraphFunctions, GraphNode, GraphNodeID, GraphNodeInput, GraphNodeOutput, StringKeyOf } from "./GraphTypes"; export declare enum GraphExecutionNodeState { NotStarted = "NotStarted", Started = "Started", Finished = "Finished", Error = "Error" } export declare class GraphExecutionNode = StringKeyOf> { id: GraphNodeID; node: GraphNode; input?: GraphNodeInput; output?: GraphNodeOutput; error?: Error; state: GraphExecutionNodeState; dependents: Set>>; constructor(id: GraphNodeID, node: GraphNode); } export declare function equals(a: any, b: any): boolean; export declare class GraphExecutor { private readonly functions; readonly nodes: Map>>; constructor(functions: GFS, graph?: Graph); /** * @returns a new empty GraphBuilder with the same GraphFunctions type. */ builder(): GraphBuilder; /** * Updates the execution graph while retaining all previous calculations. * This allows a second execution to take place much more quickly. */ update(graph: Graph): void; getNode(id: GraphNodeID): GraphExecutionNode>; private areAllFinished; getNodesByState(state: GraphExecutionNodeState): GraphExecutionNode[]; getNodesByType>(type: Type): GraphExecutionNode[]; getOutputsByType>(type: Type): GraphNodeOutput[]; private getInputsIfFinished; private calculateDependents; /** * Returns a promise that will resolve when the entire graph is executed or reject if any node throws. */ execute(): Promise; /** * start execution of all operations which are not awaiting other operations. */ private executeFrame; }