(
dag: DAG,
id: string,
nodes: string[] | undefined,
type: 'Loop' | 'Parallel'
)
| 144 | } |
| 145 | |
| 146 | private validateSubflow( |
| 147 | dag: DAG, |
| 148 | id: string, |
| 149 | nodes: string[] | undefined, |
| 150 | type: 'Loop' | 'Parallel' |
| 151 | ): void { |
| 152 | const sentinelStartId = |
| 153 | type === 'Loop' ? buildSentinelStartId(id) : buildParallelSentinelStartId(id) |
| 154 | const sentinelStartNode = dag.nodes.get(sentinelStartId) |
| 155 | |
| 156 | if (!sentinelStartNode) return |
| 157 | |
| 158 | if (!nodes || nodes.length === 0) { |
| 159 | return |
| 160 | } |
| 161 | |
| 162 | const hasConnections = Array.from(sentinelStartNode.outgoingEdges.values()).some((edge) => |
| 163 | nodes.includes(normalizeNodeId(edge.target)) |
| 164 | ) |
| 165 | |
| 166 | if (!hasConnections) { |
| 167 | throw new Error( |
| 168 | `${type} start is not connected to any blocks. Connect a block to the ${type.toLowerCase()} start.` |
| 169 | ) |
| 170 | } |
| 171 | } |
| 172 | } |
no test coverage detected