MCPcopy Index your code
hub / github.com/simstudioai/sim / validateSubflow

Method validateSubflow

apps/sim/executor/dag/builder.ts:146–171  ·  view source on GitHub ↗
(
    dag: DAG,
    id: string,
    nodes: string[] | undefined,
    type: 'Loop' | 'Parallel'
  )

Source from the content-addressed store, hash-verified

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}

Callers 1

Calls 4

buildSentinelStartIdFunction · 0.90
normalizeNodeIdFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected