( sourceId: string, edges: WFEdge[], nodeMap: Map<string, WFNode>, )
| 41 | * undefined if a passthrough has no incoming edge. |
| 42 | */ |
| 43 | export function resolveDataSource( |
| 44 | sourceId: string, |
| 45 | edges: WFEdge[], |
| 46 | nodeMap: Map<string, WFNode>, |
| 47 | ): string | undefined { |
| 48 | let cur = sourceId |
| 49 | const seen = new Set<string>() |
| 50 | while (isPassthrough(nodeMap.get(cur)?.type) && !seen.has(cur)) { |
| 51 | seen.add(cur) |
| 52 | const parent = edges.find((e) => e.target === cur) |
| 53 | if (!parent) return undefined |
| 54 | cur = parent.source |
| 55 | } |
| 56 | return cur |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Walks backwards from `nodeId` and returns the set of nearest upstream |
no test coverage detected