(
fieldValue: any,
executionContext: { workspaceId: string; workflowId: string; executionId: string },
requestId: string,
userId?: string
)
| 84 | * Process all files for a given field in workflow execution input |
| 85 | */ |
| 86 | export async function processExecutionFiles( |
| 87 | fieldValue: any, |
| 88 | executionContext: { workspaceId: string; workflowId: string; executionId: string }, |
| 89 | requestId: string, |
| 90 | userId?: string |
| 91 | ): Promise<UserFile[]> { |
| 92 | if (!fieldValue || typeof fieldValue !== 'object') { |
| 93 | return [] |
| 94 | } |
| 95 | |
| 96 | const files = Array.isArray(fieldValue) ? fieldValue : [fieldValue] |
| 97 | const uploadedFiles: UserFile[] = [] |
| 98 | const fullContext = { ...executionContext } |
| 99 | |
| 100 | for (const file of files) { |
| 101 | try { |
| 102 | const userFile = await processExecutionFile(file, fullContext, requestId, userId) |
| 103 | |
| 104 | if (userFile) { |
| 105 | uploadedFiles.push(userFile) |
| 106 | } |
| 107 | } catch (error) { |
| 108 | logger.error(`[${requestId}] Failed to process file ${file.name}:`, error) |
| 109 | throw new Error(`Failed to upload file: ${file.name}`) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | return uploadedFiles |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Extract inputFormat fields from a start block or trigger block |
no test coverage detected