From 063acc6bbf59c0496c35ddbcf84d224c78cf9c1a Mon Sep 17 00:00:00 2001 From: Felix Kaspar Date: Tue, 14 Nov 2023 23:32:03 +0100 Subject: [PATCH] replaced structuredClone, fixed download single --- server-node/src/routes/api/workflow-controller.ts | 2 +- shared-operations/src/workflow/traverseOperations.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server-node/src/routes/api/workflow-controller.ts b/server-node/src/routes/api/workflow-controller.ts index 2c9a52e5..16320b8e 100644 --- a/server-node/src/routes/api/workflow-controller.ts +++ b/server-node/src/routes/api/workflow-controller.ts @@ -216,7 +216,7 @@ async function downloadHandler(res: Response, pdfResults: PdfFile[]) { } else { const readStream = new stream.PassThrough(); - readStream.end(pdfResults[0].uint8Array); + readStream.end(await pdfResults[0].uint8Array); // TODO: Implement other file types (mostly fro image & text extraction) res.set("Content-disposition", 'attachment; filename=' + pdfResults[0].filename + ".pdf"); diff --git a/shared-operations/src/workflow/traverseOperations.ts b/shared-operations/src/workflow/traverseOperations.ts index 60a39e51..ea4de1ef 100644 --- a/shared-operations/src/workflow/traverseOperations.ts +++ b/shared-operations/src/workflow/traverseOperations.ts @@ -26,12 +26,12 @@ export async function * traverseOperations(operations: Action[], input: PdfFile[ } for (let i = 0; i < actions.length; i++) { - yield* computeOperation(actions[i], input); // TODO: structuredClone doesn't work in ts need to find another solution to pass by value. + yield* computeOperation(actions[i], Object.assign([], input)); // structuredClone-like for ts TODO: test if this really works } } async function * computeOperation(action: Action, input: PdfFile|PdfFile[]): AsyncGenerator { - + console.log("Input: ", input); yield "Starting: " + action.type; switch (action.type) { case "done": // Skip this, because it is a valid node.