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

Method resolveInputs

apps/sim/executor/variables/resolver.ts:229–291  ·  view source on GitHub ↗
(
    ctx: ExecutionContext,
    currentNodeId: string,
    params: Record<string, any>,
    block?: SerializedBlock
  )

Source from the content-addressed store, hash-verified

227 }
228
229 async resolveInputs(
230 ctx: ExecutionContext,
231 currentNodeId: string,
232 params: Record<string, any>,
233 block?: SerializedBlock
234 ): Promise<Record<string, any>> {
235 if (!params) {
236 return {}
237 }
238 const resolved: Record<string, any> = {}
239
240 const isConditionBlock = block?.metadata?.id === BlockType.CONDITION
241 if (isConditionBlock && typeof params.conditions === 'string') {
242 try {
243 const parsed = JSON.parse(params.conditions)
244 if (Array.isArray(parsed)) {
245 resolved.conditions = await Promise.all(
246 parsed.map(async (cond: any) => ({
247 ...cond,
248 value:
249 typeof cond.value === 'string'
250 ? await this.resolveTemplateWithoutConditionFormatting(
251 ctx,
252 currentNodeId,
253 cond.value
254 )
255 : cond.value,
256 }))
257 )
258 } else {
259 resolved.conditions = await this.resolveValue(
260 ctx,
261 currentNodeId,
262 params.conditions,
263 undefined,
264 block
265 )
266 }
267 } catch (parseError) {
268 logger.warn('Failed to parse conditions JSON, falling back to normal resolution', {
269 error: parseError,
270 conditions: params.conditions,
271 })
272 resolved.conditions = await this.resolveValue(
273 ctx,
274 currentNodeId,
275 params.conditions,
276 undefined,
277 block
278 )
279 }
280 }
281
282 for (const [key, value] of Object.entries(params)) {
283 if (isConditionBlock && key === 'conditions') {
284 continue
285 }
286 resolved[key] = await this.resolveValue(ctx, currentNodeId, value, undefined, block, {

Callers 3

resolveArrayInputAsyncFunction · 0.80
resolver.test.tsFile · 0.80
executeMethod · 0.80

Calls 5

resolveValueMethod · 0.95
parseMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected