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

Function remapConditionBlockIds

apps/sim/lib/workflows/condition-ids.ts:13–28  ·  view source on GitHub ↗
(
  conditions: Array<{ id: string; [key: string]: unknown }>,
  oldBlockId: string,
  newBlockId: string
)

Source from the content-addressed store, hash-verified

11 * @returns Whether any IDs were changed (mutates in place)
12 */
13export function remapConditionBlockIds(
14 conditions: Array<{ id: string; [key: string]: unknown }>,
15 oldBlockId: string,
16 newBlockId: string
17): boolean {
18 let changed = false
19 const prefix = `${oldBlockId}-`
20 for (const condition of conditions) {
21 if (typeof condition.id === 'string' && condition.id.startsWith(prefix)) {
22 const suffix = condition.id.slice(prefix.length)
23 condition.id = `${newBlockId}-${suffix}`
24 changed = true
25 }
26 }
27 return changed
28}
29
30/** Handle prefixes that embed block-scoped condition/route IDs */
31const HANDLE_PREFIXES = [EDGE.CONDITION_PREFIX, EDGE.ROUTER_PREFIX] as const

Callers 3

remapConditionIdsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected