@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
31 lines • 1.57 kB
TypeScript
import { Graph } from '../../graph/graph.js';
import { INodeDefinition, ISubgraphContainer, Node } from '../../programmatic/node.js';
import { ToInput, ToOutput } from '../../programmatic/index.js';
export interface IArraySubgraph extends INodeDefinition {
innerGraph?: Graph;
}
export default class ArraySubgraph<T, V> extends Node implements ISubgraphContainer {
static readonly title = "Array Map";
static readonly type = "tokens.studio.array.map";
static readonly description = "Execute a graph for every item in an Array (list of items). The output is an array of the same length as the input array. The inner graph is executed for each item in the array (list). The inner graph automatically has an input node with the name 'value' and an output node with the name 'value' as well. The inner graph also has an input node with the name 'index' and an input node with the name 'length' to get the current index and length of the array.";
_innerGraph: Graph;
inputs: ToInput<{
array: T[];
}>;
outputs: ToOutput<{
value: V;
}>;
constructor(props: IArraySubgraph);
execute(): Promise<void>;
serialize(): {
innergraph: import("../../index.js").SerializedGraph;
id: string;
annotations?: Record<string, any>;
type: string;
inputs: import("../../index.js").SerializedInput[];
};
static deserialize(opts: any): Promise<Node>;
getSubgraphs(): Graph[];
getGraphProperties(): Record<string, Graph | undefined>;
}
//# sourceMappingURL=arraySubgraph.d.ts.map