( nodeId: string, edges: WFEdge[], nodeMap: Map<string, WFNode>, )
| 63 | * merges two distinct branches. |
| 64 | */ |
| 65 | export function nearestUpstreamWaits( |
| 66 | nodeId: string, |
| 67 | edges: WFEdge[], |
| 68 | nodeMap: Map<string, WFNode>, |
| 69 | ): Set<string> { |
| 70 | const result = new Set<string>() |
| 71 | const seen = new Set<string>() |
| 72 | const stack = edges.filter((e) => e.target === nodeId).map((e) => e.source) |
| 73 | while (stack.length > 0) { |
| 74 | const id = stack.pop()! |
| 75 | if (seen.has(id)) continue |
| 76 | seen.add(id) |
| 77 | if (isBranchStarter(nodeMap.get(id)?.type)) { result.add(id); continue } |
| 78 | for (const e of edges) if (e.target === id) stack.push(e.source) |
| 79 | } |
| 80 | return result |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * True if any forward path from `sourceId` reaches a sceneOutput node, walking |
no test coverage detected