MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / collect

Function collect

packages/agentflow/src/core/utils/variableUtils.ts:44–63  ·  view source on GitHub ↗
(targetId: string)

Source from the content-addressed store, hash-verified

42 collected.add(nodeId)
43
44 function collect(targetId: string) {
45 // In AgentFlow V2, targetHandle === targetNodeId for node-level connections
46 const inputEdges = edges.filter((e) => e.target === targetId)
47
48 for (const edge of inputEdges) {
49 if (collected.has(edge.source)) continue
50
51 const parentNode = nodes.find((n) => n.id === edge.source)
52 if (!parentNode) continue
53
54 // Exclude startAgentflow unless explicitly requested
55 if (parentNode.data.name === 'startAgentflow' && !includeStart) {
56 continue
57 }
58
59 collected.add(parentNode.id)
60 // Recurse to collect the full ancestor chain
61 collect(parentNode.id)
62 }
63 }
64
65 collect(nodeId)
66

Callers 1

getUpstreamNodesFunction · 0.85

Calls 1

addMethod · 0.45

Tested by

no test coverage detected