@tokens-studio/graph-engine
Version:
An execution engine to handle Token Studios generators and resolvers
45 lines • 1.05 kB
TypeScript
import { GraphSchema } from '../schemas/index.js';
import { Input } from './input.js';
import { Node } from './node.js';
import { Port } from './port.js';
export interface IOutputProps<T = any> {
name: string;
type: GraphSchema;
value: T;
visible: boolean;
node: Node;
}
export interface ConnectionStatus {
/**
* Whether the connection is valid
*/
valid: boolean;
}
export declare class Output<T = any> extends Port<T> {
constructor(props: IOutputProps<T>);
set(value: T, type?: GraphSchema): void;
connect(target: Input): import("./edge.js").Edge | {
valid: boolean;
};
/**
* Returns the underlying class of the input.
* @returns
*/
get factory(): typeof Output;
clone(): Output<T>;
}
/**
* Converts a type definition to a map of inputs
* @example
* ```ts
* type myType = {
* a: number,
* b: string
* }
* type myInputs = ToInput<myType>
* ```
*/
export type ToOutput<T> = {
[P in keyof T]: Output<T[P]>;
};
//# sourceMappingURL=output.d.ts.map