import { Port, Node, Connection } from '../../../types/core'; import { NodeDefinition } from '../../../types/NodeDefinition'; import { PortKey } from '../identity/key'; /** * Compute connectable port IDs for a given source port. * Uses actual resolved ports per node (via getNodePorts) and NodeDefinitions for validation. * canConnectPorts handles all validation including type/node checks internally. */ export declare function getConnectablePortIds(fromPort: Port, nodes: Record, getNodePorts: (nodeId: string) => Port[], connections: Record, getNodeDefinition: (type: string) => NodeDefinition | undefined): Set; /** * Parameters for computing connectable node types */ export type GetConnectableNodeTypesParams = { /** The source port to check connections from */ fromPort: Port; /** All nodes currently in the editor */ nodes: Record; /** All connections currently in the editor */ connections: Record; /** Function to get a node definition by type */ getNodeDefinition: (type: string) => NodeDefinition | undefined; /** Function to get all node definitions */ getAllNodeDefinitions: () => NodeDefinition[]; }; /** * Get all node types that have at least one port capable of connecting to the source port. * Used for filtering the node search menu when dragging a connection to empty space. * Supports dynamic ports by deriving actual ports from a temporary node instance. */ export declare const getConnectableNodeTypes: ({ fromPort, nodes, connections, getNodeDefinition, getAllNodeDefinitions, }: GetConnectableNodeTypesParams) => string[]; /** * Parameters for finding a connectable port definition */ export type FindConnectablePortDefinitionParams = { /** The source port to connect from */ fromPort: Port; /** Definition of the source port's node (optional) */ fromNodeDefinition?: NodeDefinition; /** Definition of the target node */ targetNodeDefinition: NodeDefinition; /** ID of the new target node */ targetNodeId: string; /** All connections currently in the editor */ connections: Record; /** All nodes currently in the editor */ nodes: Record; }; /** * Result of finding a connectable port */ export type ConnectablePortResult = { /** The resolved Port instance for the connection */ port: Port; } | null; /** * Find the first port on a target node that can connect to the source port. * Supports dynamic ports by deriving actual ports from the target node definition. * Used when creating a new node and auto-connecting to an existing port. */ export declare const findConnectablePortDefinition: ({ fromPort, fromNodeDefinition, targetNodeDefinition, targetNodeId, connections, nodes, }: FindConnectablePortDefinitionParams) => ConnectablePortResult;