(
conditions: Array<{ id: string; [key: string]: unknown }>,
oldBlockId: string,
newBlockId: string
)
| 11 | * @returns Whether any IDs were changed (mutates in place) |
| 12 | */ |
| 13 | export 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 */ |
| 31 | const HANDLE_PREFIXES = [EDGE.CONDITION_PREFIX, EDGE.ROUTER_PREFIX] as const |
no outgoing calls
no test coverage detected