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

Function createResolver

apps/sim/executor/variables/resolver.test.ts:66–114  ·  view source on GitHub ↗
(
  language = 'javascript',
  options: ConstructorParameters<typeof VariableResolver>[3] = {}
)

Source from the content-addressed store, hash-verified

64}
65
66function createResolver(
67 language = 'javascript',
68 options: ConstructorParameters<typeof VariableResolver>[3] = {}
69) {
70 const producer = createBlock('producer', 'Producer', BlockType.API)
71 const functionBlock = createBlock('function', 'Function', BlockType.FUNCTION, {
72 language,
73 })
74 const workflow: SerializedWorkflow = {
75 version: '1',
76 blocks: [producer, functionBlock],
77 connections: [],
78 loops: {},
79 parallels: {},
80 }
81 const state = new ExecutionState()
82 state.setBlockOutput('producer', {
83 result: 'hello world',
84 items: ['a', 'b'],
85 file: {
86 id: 'file-1',
87 name: 'image.png',
88 url: 'https://example.com/image.png',
89 key: 'execution/workspace-1/workflow-1/execution-1/image.png',
90 context: 'execution',
91 size: 12 * 1024 * 1024,
92 type: 'image/png',
93 base64: 'large-inline-base64',
94 },
95 })
96 const ctx = {
97 blockStates: state.getBlockStates(),
98 blockLogs: [],
99 environmentVariables: {},
100 workflowVariables: {},
101 decisions: { router: new Map(), condition: new Map() },
102 loopExecutions: new Map(),
103 executedBlocks: new Set(),
104 activeExecutionPath: new Set(),
105 completedLoops: new Set(),
106 metadata: {},
107 } as ExecutionContext
108
109 return {
110 block: functionBlock,
111 ctx,
112 resolver: new VariableResolver(workflow, {}, state, options),
113 }
114}
115
116describe('VariableResolver function block inputs', () => {
117 it('returns empty inputs when params are missing', async () => {

Callers 2

resolver.test.tsFile · 0.85
createOffloadEnvFunction · 0.85

Calls 3

setBlockOutputMethod · 0.95
getBlockStatesMethod · 0.95
createBlockFunction · 0.70

Tested by

no test coverage detected