* Builds a unified child-subflow → parent-subflow mapping that covers all nesting * combinations: loop-in-loop, parallel-in-parallel, loop-in-parallel, parallel-in-loop. * Used by the iteration context builder to walk the full ancestor chain for SSE events.
(
dag: DAG
)
| 545 | * Used by the iteration context builder to walk the full ancestor chain for SSE events. |
| 546 | */ |
| 547 | private buildSubflowParentMap( |
| 548 | dag: DAG |
| 549 | ): Map<string, { parentId: string; parentType: SubflowType; branchIndex?: number }> { |
| 550 | const parentMap = new Map< |
| 551 | string, |
| 552 | { parentId: string; parentType: SubflowType; branchIndex?: number } |
| 553 | >() |
| 554 | |
| 555 | // Scan loop configs: children can be loops or parallels |
| 556 | for (const [loopId, config] of dag.loopConfigs) { |
| 557 | for (const nodeId of config.nodes) { |
| 558 | if (dag.loopConfigs.has(nodeId) || dag.parallelConfigs.has(nodeId)) { |
| 559 | parentMap.set(nodeId, { parentId: loopId, parentType: 'loop' }) |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | // Scan parallel configs: children can be parallels or loops |
| 565 | for (const [parallelId, config] of dag.parallelConfigs) { |
| 566 | for (const nodeId of config.nodes ?? []) { |
| 567 | if (dag.parallelConfigs.has(nodeId) || dag.loopConfigs.has(nodeId)) { |
| 568 | parentMap.set(nodeId, { parentId: parallelId, parentType: 'parallel', branchIndex: 0 }) |
| 569 | } |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | return parentMap |
| 574 | } |
| 575 | |
| 576 | private initializeStarterBlock( |
| 577 | context: ExecutionContext, |
no test coverage detected