( blocks: Record<string, BlockState>, nameMap: Map<string, string>, clearTriggerRuntimeValues = false )
| 305 | } |
| 306 | |
| 307 | function updateBlockReferences( |
| 308 | blocks: Record<string, BlockState>, |
| 309 | nameMap: Map<string, string>, |
| 310 | clearTriggerRuntimeValues = false |
| 311 | ): void { |
| 312 | Object.entries(blocks).forEach(([_, block]) => { |
| 313 | if (block.subBlocks) { |
| 314 | Object.entries(block.subBlocks).forEach(([subBlockId, subBlock]) => { |
| 315 | if (clearTriggerRuntimeValues && TRIGGER_RUNTIME_SUBBLOCK_IDS.includes(subBlockId)) { |
| 316 | block.subBlocks[subBlockId] = { ...subBlock, value: null } |
| 317 | return |
| 318 | } |
| 319 | |
| 320 | if (subBlock.value !== undefined && subBlock.value !== null) { |
| 321 | const updatedValue = updateValueReferences( |
| 322 | subBlock.value, |
| 323 | nameMap |
| 324 | ) as SubBlockState['value'] |
| 325 | block.subBlocks[subBlockId] = { ...subBlock, value: updatedValue } |
| 326 | } |
| 327 | }) |
| 328 | } |
| 329 | }) |
| 330 | } |
| 331 | |
| 332 | export function regenerateWorkflowIds( |
| 333 | workflowState: WorkflowState, |
no test coverage detected