MCPcopy Index your code
hub / github.com/simstudioai/sim / getScopedBlockOutput

Method getScopedBlockOutput

apps/sim/executor/execution/state.ts:115–148  ·  view source on GitHub ↗
(
    blockId: string,
    currentNodeId: string
  )

Source from the content-addressed store, hash-verified

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 })

Callers 1

getBlockOutputMethod · 0.95

Calls 5

extractOuterBranchIndexFunction · 0.90
stripCloneSuffixesFunction · 0.90
extractBranchSuffixFunction · 0.70
extractLoopSuffixFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected