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

Function resolveBlockReferenceAsync

apps/sim/executor/utils/block-reference.ts:251–284  ·  view source on GitHub ↗
(
  blockName: string,
  pathParts: string[],
  context: BlockReferenceContext,
  resolutionContext: ResolutionContext,
  navigatePathAsync: AsyncPathNavigator
)

Source from the content-addressed store, hash-verified

249}
250
251export async function resolveBlockReferenceAsync(
252 blockName: string,
253 pathParts: string[],
254 context: BlockReferenceContext,
255 resolutionContext: ResolutionContext,
256 navigatePathAsync: AsyncPathNavigator
257): Promise<BlockReferenceResult | undefined> {
258 const normalizedName = normalizeName(blockName)
259 const blockId = context.blockNameMapping[normalizedName]
260
261 if (!blockId) {
262 return undefined
263 }
264
265 const blockOutput = context.blockData[blockId]
266 if (blockOutput === undefined) {
267 return { value: undefined, blockId }
268 }
269
270 if (pathParts.length === 0) {
271 return { value: blockOutput, blockId }
272 }
273
274 const value = await navigatePathAsync(blockOutput, pathParts, resolutionContext)
275
276 const schema = context.blockOutputSchemas?.[blockId]
277 if (value === undefined && schema) {
278 if (!isPathInSchema(schema, pathParts)) {
279 throw new InvalidFieldError(blockName, pathParts.join('.'), getSchemaFieldNames(schema))
280 }
281 }
282
283 return { value, blockId }
284}

Callers 1

resolveAsyncMethod · 0.90

Calls 5

normalizeNameFunction · 0.90
navigatePathAsyncFunction · 0.85
isPathInSchemaFunction · 0.85
getSchemaFieldNamesFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected