UNPKG

@tokens-studio/graph-engine

Version:

An execution engine to handle Token Studios generators and resolvers

61 lines 1.57 kB
import { GraphSchema } from '../schemas/index.js'; import { Node } from './node.js'; import { Port } from './port.js'; import { SerializedInput } from '../graph/types.js'; import { TypeDefinition } from './node.js'; export interface IInputProps<T = any> { name: string; type: GraphSchema; value: T; visible: boolean; node: Node; variadic?: boolean; annotations?: Record<string, any>; } export interface ISetValue { noPropagate?: boolean; type?: GraphSchema; forceStore?: boolean; } export declare class Input<T = any> extends Port<T> { /** * Expects to have connections to this node done by enqueing the edge */ readonly variadic: boolean; constructor(props: IInputProps<T>); /** * Sets the value without a side effect. This should only be used internally * @param value */ setValue(value: T, opts?: ISetValue): void; private handleTypeUpdate; /** * Resets the value of the input to the default value */ reset(): T; /** * Returns the underlying class of the input. * @returns */ get factory(): typeof Input; clone(): Input<T>; fullType(): TypeDefinition; serialize(): SerializedInput; deserialize(serialized: SerializedInput): void; get value(): T; } /** * Converts a type definition to a map of inputs * @example * ```ts * type myType = { * a: number, * b: string * } * type myInputs = ToInput<myType> * ``` */ export type ToInput<T> = { [P in keyof T]: Input<T[P]>; }; //# sourceMappingURL=input.d.ts.map