MCPcopy
hub / github.com/FlowiseAI/Flowise / getNodeInputConnections

Function getNodeInputConnections

packages/server/src/utils/buildAgentflow.ts:653–667  ·  view source on GitHub ↗
(edges: IReactFlowEdge[], nodeId: string)

Source from the content-addressed store, hash-verified

651 * // Returns array of two edge objects connecting to llmAgentflow_2
652 */
653function getNodeInputConnections(edges: IReactFlowEdge[], nodeId: string): IReactFlowEdge[] {
654 // Filter edges where target matches the nodeId
655 const inputConnections = edges.filter((edge) => edge.target === nodeId)
656
657 // Sort connections by sourceHandle to maintain consistent order
658 // This is important for nodes that have multiple inputs that need to be processed in order
659 inputConnections.sort((a, b) => {
660 // Extract index from sourceHandle (e.g., "output-0" vs "output-1")
661 const indexA = parseInt(a.sourceHandle.split('-').find((part) => !isNaN(parseInt(part))) || '0')
662 const indexB = parseInt(b.sourceHandle.split('-').find((part) => !isNaN(parseInt(part))) || '0')
663 return indexA - indexB
664 })
665
666 return inputConnections
667}
668
669/**
670 * Analyzes node dependencies and sets up expected inputs

Callers 1

setupNodeDependenciesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected