import { SubgraphNode } from './SubgraphNode'; import { CallbackParams, CallbackReturn, ISlotType } from '../interfaces'; import { LGraph } from '../LGraph'; import { LGraphNode, NodeId } from '../LGraphNode'; import { LGraphEventMode } from '../litegraph'; import { Subgraph } from './Subgraph'; export type ExecutionId = string; /** * Interface describing the data transfer objects used when compiling a graph for execution. */ export type ExecutableLGraphNode = Omit; /** * The end result of resolving a DTO input. * When a widget value is returned, {@link widgetInfo} is present and {@link origin_slot} is `-1`. */ type ResolvedInput = { /** DTO for the node that the link originates from. */ node: ExecutableLGraphNode; /** Full unique execution ID of the node that the link originates from. In the case of a widget value, this is the ID of the subgraph node. */ origin_id: ExecutionId; /** The slot index of the output on the node that the link originates from. `-1` when widget value is set. */ origin_slot: number; /** Boxed widget value (e.g. for widgets). If this box is `undefined`, then an input link is connected, and widget values from the subgraph node are ignored. */ widgetInfo?: { value: unknown; }; }; /** * Concrete implementation of {@link ExecutableLGraphNode}. * @remarks This is the class that is used to create the data transfer objects for executable nodes. */ export declare class ExecutableNodeDTO implements ExecutableLGraphNode { #private; /** The actual node that this DTO wraps. */ readonly node: LGraphNode | SubgraphNode; /** A list of subgraph instance node IDs from the root graph to the containing instance. @see {@link id} */ readonly subgraphNodePath: readonly NodeId[]; /** A flattened map of all DTOs in this node network. Subgraph instances have been expanded into their inner nodes. */ readonly nodesByExecutionId: Map; /** The actual subgraph instance that contains this node, otherise undefined. */ readonly subgraphNode?: SubgraphNode | undefined; applyToGraph?(...args: CallbackParams): CallbackReturn; /** The graph that this node is a part of. */ readonly graph: LGraph | Subgraph; inputs: { linkId: number | null; name: string; type: ISlotType; }[]; /** * The path to the acutal node through subgraph instances, represented as a list of all subgraph node IDs (instances), * followed by the actual original node ID within the subgraph. Each segment is separated by `:`. * * e.g. `1:2:3`: * - `1` is the node ID of the first subgraph node in the parent workflow * - `2` is the node ID of the second subgraph node in the first subgraph * - `3` is the node ID of the actual node in the subgraph definition */ get id(): string; get type(): string; get title(): string; get mode(): LGraphEventMode; get comfyClass(): string | undefined; get isVirtualNode(): boolean | undefined; get widgets(): import('../types/widgets').IBaseWidget>[] | undefined; get subgraphId(): string | undefined; constructor( /** The actual node that this DTO wraps. */ node: LGraphNode | SubgraphNode, /** A list of subgraph instance node IDs from the root graph to the containing instance. @see {@link id} */ subgraphNodePath: readonly NodeId[], /** A flattened map of all DTOs in this node network. Subgraph instances have been expanded into their inner nodes. */ nodesByExecutionId: Map, /** The actual subgraph instance that contains this node, otherise undefined. */ subgraphNode?: SubgraphNode | undefined); /** Returns either the DTO itself, or the DTOs of the inner nodes of the subgraph. */ getInnerNodes(): ExecutableLGraphNode[]; /** * Resolves the executable node & link IDs for a given input slot. * @param slot The slot index of the input. * @param visited Leave empty unless overriding this method. * A set of unique IDs, used to guard against infinite recursion. * If overriding, ensure that the set is passed on all recursive calls. * @returns The node and the origin ID / slot index of the output. */ resolveInput(slot: number, visited?: Set): ResolvedInput | undefined; /** * Determines whether this output is a valid endpoint for a link (non-virtual, non-bypass). * @param slot The slot index of the output. * @param type The type of the input * @param visited A set of unique IDs to guard against infinite recursion. See {@link resolveInput}. * @returns The node and the origin ID / slot index of the output. */ resolveOutput(slot: number, type: ISlotType, visited: Set): ResolvedInput | undefined; } export {};