MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / mergeOutputPackFiles

Function mergeOutputPackFiles

src/nodeExecutor.ts:227–253  ·  view source on GitHub ↗
(
  packPath: string,
  newFiles: NewPackedFile[],
  executionContext?: FlowExecutionContext,
)

Source from the content-addressed store, hash-verified

225};
226
227const 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
255export const executeNodeAction = async (request: NodeExecutionRequest): Promise<NodeExecutionResult> => {
256 const { nodeId, nodeType, textValue, inputData, config, executionContext } = request;

Callers 1

executeSaveChangesNodeFunction · 0.85

Calls 2

cloneNewPackedFileFunction · 0.85

Tested by

no test coverage detected