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

Function connectDAGNodes

packages/testing/src/factories/dag.factory.ts:174–192  ·  view source on GitHub ↗
(
  dag: DAG,
  sourceId: string,
  targetId: string,
  sourceHandle?: string
)

Source from the content-addressed store, hash-verified

172 * Connects two nodes in a DAG with an edge.
173 */
174export function connectDAGNodes(
175 dag: DAG,
176 sourceId: string,
177 targetId: string,
178 sourceHandle?: string
179): DAG {
180 const sourceNode = dag.nodes.get(sourceId)
181 const targetNode = dag.nodes.get(targetId)
182
183 if (sourceNode && targetNode) {
184 const edgeId = sourceHandle
185 ? `${sourceId}→${targetId}-${sourceHandle}`
186 : `${sourceId}→${targetId}`
187 sourceNode.outgoingEdges.set(edgeId, { target: targetId, sourceHandle })
188 targetNode.incomingEdges.add(sourceId)
189 }
190
191 return dag
192}

Callers

nothing calls this directly

Calls 3

getMethod · 0.65
setMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected