( packPath: string, newFiles: NewPackedFile[], executionContext?: FlowExecutionContext, )
| 225 | }; |
| 226 | |
| 227 | const mergeOutputPackFiles = async ( |
| 228 | packPath: string, |
| 229 | newFiles: NewPackedFile[], |
| 230 | executionContext?: FlowExecutionContext, |
| 231 | ): Promise<NewPackedFile[]> => { |
| 232 | const existingFiles = await loadExistingOutputPackFiles(packPath, executionContext); |
| 233 | if (existingFiles.length === 0) { |
| 234 | if (executionContext) { |
| 235 | executionContext.outputPackByPath.set(packPath, newFiles.map(cloneNewPackedFile)); |
| 236 | } |
| 237 | return newFiles; |
| 238 | } |
| 239 | |
| 240 | const fileMap = new Map<string, NewPackedFile>(); |
| 241 | for (const existingFile of existingFiles) { |
| 242 | fileMap.set(existingFile.name, cloneNewPackedFile(existingFile)); |
| 243 | } |
| 244 | for (const newFile of newFiles) { |
| 245 | fileMap.set(newFile.name, cloneNewPackedFile(newFile)); |
| 246 | } |
| 247 | |
| 248 | const mergedFiles = Array.from(fileMap.values()); |
| 249 | if (executionContext) { |
| 250 | executionContext.outputPackByPath.set(packPath, mergedFiles.map(cloneNewPackedFile)); |
| 251 | } |
| 252 | return mergedFiles; |
| 253 | }; |
| 254 | |
| 255 | export const executeNodeAction = async (request: NodeExecutionRequest): Promise<NodeExecutionResult> => { |
| 256 | const { nodeId, nodeType, textValue, inputData, config, executionContext } = request; |
no test coverage detected