import { Connection, ConnectionId, NodeId, Port } from '../types/core'; /** * Result of connection cleanup operation */ export type ConnectionCleanupResult = { /** IDs of connections that were removed */ removedConnectionIds: ConnectionId[]; /** Updated connections map with orphaned connections removed */ updatedConnections: Record; }; /** * Detect and remove connections that reference non-existent ports * * This is useful when dynamic ports reduce their count and some * connected ports no longer exist. * * @param connections - Current connections map * @param nodeId - The node whose ports changed * @param validPortIds - Set of valid port IDs for the node * @returns Cleanup result with removed connection IDs and updated map */ export declare function cleanupOrphanedConnections(connections: Record, nodeId: NodeId, validPortIds: Set): ConnectionCleanupResult; /** * Detect orphaned connections for multiple nodes at once * * @param connections - Current connections map * @param nodePortMap - Map of nodeId to valid port IDs * @returns Cleanup result with removed connection IDs and updated map */ export declare function cleanupOrphanedConnectionsForNodes(connections: Record, nodePortMap: Map>): ConnectionCleanupResult; /** * Find connections that would become orphaned if ports were removed * * This is a non-destructive check that returns which connections * would be affected without modifying the connections map. * * @param connections - Current connections map * @param nodeId - The node to check * @param portsToRemove - Set of port IDs that would be removed * @returns Array of connection IDs that would become orphaned */ export declare function findOrphanedConnections(connections: Record, nodeId: NodeId, portsToRemove: Set): ConnectionId[]; /** * Create a set of valid port IDs from a ports array * * @param ports - Array of ports * @returns Set of port IDs */ export declare function createPortIdSet(ports: Port[]): Set; /** * Detect which ports were removed between two port arrays * * @param previousPorts - Previous ports array * @param currentPorts - Current ports array * @returns Set of port IDs that were removed */ export declare function detectRemovedPorts(previousPorts: Port[], currentPorts: Port[]): Set;