(
blockId: string,
currentNodeId: string
)
| 113 | } |
| 114 | |
| 115 | private getScopedBlockOutput( |
| 116 | blockId: string, |
| 117 | currentNodeId: string |
| 118 | ): NormalizedBlockOutput | undefined { |
| 119 | const currentBranchSuffix = extractBranchSuffix(currentNodeId) |
| 120 | const loopSuffix = extractLoopSuffix(currentNodeId) |
| 121 | |
| 122 | const currentOuterBranchIndex = extractOuterBranchIndex(currentNodeId) |
| 123 | if (currentOuterBranchIndex !== undefined) { |
| 124 | for (const [storedId, state] of this.blockStates.entries()) { |
| 125 | if (stripCloneSuffixes(storedId) !== blockId) continue |
| 126 | if (extractOuterBranchIndex(storedId) !== currentOuterBranchIndex) continue |
| 127 | if (extractBranchSuffix(storedId) !== currentBranchSuffix) continue |
| 128 | if (extractLoopSuffix(storedId) !== loopSuffix) continue |
| 129 | |
| 130 | return state.output |
| 131 | } |
| 132 | |
| 133 | const siblingBranchOutput = this.blockStates.get( |
| 134 | `${blockId}₍${currentOuterBranchIndex}₎` |
| 135 | )?.output |
| 136 | if (siblingBranchOutput !== undefined) { |
| 137 | return siblingBranchOutput |
| 138 | } |
| 139 | } else { |
| 140 | const withSuffix = `${blockId}${currentBranchSuffix}${loopSuffix}` |
| 141 | const suffixedOutput = this.blockStates.get(withSuffix)?.output |
| 142 | if (suffixedOutput !== undefined) { |
| 143 | return suffixedOutput |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | return undefined |
| 148 | } |
| 149 | |
| 150 | setBlockOutput(blockId: string, output: NormalizedBlockOutput, executionTime = 0): void { |
| 151 | this.blockStates.set(blockId, { output, executed: true, executionTime }) |
no test coverage detected