MCPcopy
hub / github.com/simstudioai/sim / remapConditionEdgeHandle

Function remapConditionEdgeHandle

apps/sim/lib/workflows/condition-ids.ts:41–57  ·  view source on GitHub ↗
(
  sourceHandle: string,
  oldBlockId: string,
  newBlockId: string
)

Source from the content-addressed store, hash-verified

39 * @returns The remapped handle string, or the original if no remapping needed
40 */
41export function remapConditionEdgeHandle(
42 sourceHandle: string,
43 oldBlockId: string,
44 newBlockId: string
45): string {
46 for (const handlePrefix of HANDLE_PREFIXES) {
47 if (!sourceHandle.startsWith(handlePrefix)) continue
48
49 const innerId = sourceHandle.slice(handlePrefix.length)
50 if (!innerId.startsWith(`${oldBlockId}-`)) continue
51
52 const suffix = innerId.slice(oldBlockId.length + 1)
53 return `${handlePrefix}${newBlockId}-${suffix}`
54 }
55
56 return sourceHandle
57}

Callers 5

regenerateWorkflowIdsFunction · 0.90
regenerateBlockIdsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected