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

Method resolveValue

apps/sim/executor/variables/resolver.ts:334–366  ·  view source on GitHub ↗
(
    ctx: ExecutionContext,
    currentNodeId: string,
    value: any,
    loopScope?: LoopScope,
    block?: SerializedBlock,
    options: { allowLargeValueRefs?: boolean } = {}
  )

Source from the content-addressed store, hash-verified

332 }
333
334 private async resolveValue(
335 ctx: ExecutionContext,
336 currentNodeId: string,
337 value: any,
338 loopScope?: LoopScope,
339 block?: SerializedBlock,
340 options: { allowLargeValueRefs?: boolean } = {}
341 ): Promise<any> {
342 if (value === null || value === undefined) {
343 return value
344 }
345
346 if (Array.isArray(value)) {
347 return Promise.all(
348 value.map((v) => this.resolveValue(ctx, currentNodeId, v, loopScope, block, options))
349 )
350 }
351
352 if (typeof value === 'object') {
353 const entries = await Promise.all(
354 Object.entries(value).map(async ([key, val]) => [
355 key,
356 await this.resolveValue(ctx, currentNodeId, val, loopScope, block, options),
357 ])
358 )
359 return Object.fromEntries(entries)
360 }
361
362 if (typeof value === 'string') {
363 return this.resolveTemplate(ctx, currentNodeId, value, loopScope, block, options)
364 }
365 return value
366 }
367 /**
368 * Resolves a code template for a function block. Block output references are stored
369 * in `contextVarAccumulator` as named variables (e.g. `__blockRef_0`) and replaced

Callers 3

resolveInputsMethod · 0.95

Calls 1

resolveTemplateMethod · 0.95

Tested by

no test coverage detected