@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
31 lines • 1.56 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> extends Node implements ISubgraphContainer {
static readonly title = "Array filter";
static readonly type = "tokens.studio.array.filter";
static readonly description = "Execute a graph for every item in an Array (list of items). The output is equal to or smaller than the input graph. 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 'match' 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: T[];
}>;
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=filter.d.ts.map