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

Function processInputFiles

apps/sim/lib/webhooks/providers/generic.ts:91–142  ·  view source on GitHub ↗
({
    input,
    blocks,
    blockId,
    workspaceId,
    workflowId,
    executionId,
    requestId,
    userId,
  }: ProcessFilesContext)

Source from the content-addressed store, hash-verified

89 },
90
91 async processInputFiles({
92 input,
93 blocks,
94 blockId,
95 workspaceId,
96 workflowId,
97 executionId,
98 requestId,
99 userId,
100 }: ProcessFilesContext) {
101 const triggerBlock = blocks[blockId] as Record<string, unknown> | undefined
102 const subBlocks = triggerBlock?.subBlocks as Record<string, unknown> | undefined
103 const inputFormatBlock = subBlocks?.inputFormat as Record<string, unknown> | undefined
104
105 if (inputFormatBlock?.value) {
106 const inputFormat = inputFormatBlock.value as Array<{
107 name: string
108 type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'file[]'
109 }>
110
111 const fileFields = inputFormat.filter((field) => field.type === 'file[]')
112
113 if (fileFields.length > 0) {
114 const { processExecutionFiles } = await import('@/lib/execution/files')
115 const executionContext = {
116 workspaceId,
117 workflowId,
118 executionId,
119 }
120
121 for (const fileField of fileFields) {
122 const fieldValue = input[fileField.name]
123
124 if (fieldValue && typeof fieldValue === 'object') {
125 const uploadedFiles = await processExecutionFiles(
126 fieldValue,
127 executionContext,
128 requestId,
129 userId
130 )
131
132 if (uploadedFiles.length > 0) {
133 input[fileField.name] = uploadedFiles
134 logger.info(
135 `[${requestId}] Successfully processed ${uploadedFiles.length} file(s) for field: ${fileField.name}`
136 )
137 }
138 }
139 }
140 }
141 }
142 },
143}

Callers

nothing calls this directly

Calls 2

processExecutionFilesFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected