diff --git a/index.js b/index.js index d197652..86c9df3 100644 --- a/index.js +++ b/index.js @@ -48,7 +48,7 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); allWorkFlowInfo[workflow.id] = { isValid: invalidPathsWithoutEnding.length == 0 ? true : false, root: { - validPaths: invalidPathsWithoutEnding.length == 0 && tree.length>0?tree: [], + validPaths: invalidPathsWithoutEnding.length == 0 && tree.length > 0 ? tree : [], // invalidPaths: invalidPathsWithoutEnding.length == 0?[]:invalidPathsWithoutEnding, valid: tree.length, invalid: invalidPathsWithoutEnding.length, @@ -57,7 +57,7 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); subFlow: {} } - if(invalidPathsWithoutEnding.length > 0) { + if (invalidPathsWithoutEnding.length > 0) { allWorkFlowInfo[workflow.id].isValid = false; continue workflowsFor; } @@ -91,7 +91,7 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); } const { subTreePath, invalidSubPathsWithoutEnding } = await getProcessPathsSubFlow(processesSubFlow, subFlowId, workflow); - if(invalidSubPathsWithoutEnding.length > 0) { + if (invalidSubPathsWithoutEnding.length > 0) { allWorkFlowInfo[workflow.id].isValid = false; } subFlowInfo[subFlowId] = { @@ -102,13 +102,23 @@ require(path.join(process.cwd(), "..", "server", "dist", "database.js")); } } allWorkFlowInfo[workflow.id]["subFlow"] = subFlowInfo; - + } // console.log("allWorkFlowInfo", JSON.stringify(allWorkFlowInfo, null, 2)); // fs.writeFileSync("./result-pretty.json", JSON.stringify(allWorkFlowInfo, null, 2)); - saveLargeObject(allWorkFlowInfo,"./result-pretty.json") - fs.writeFileSync("./result.json", JSON.stringify(allWorkFlowInfo)); + await saveLargeObject(allWorkFlowInfo, "./result-pretty-beforeProcess.json") + fs.writeFileSync("./result-beforeProcess.json", JSON.stringify(allWorkFlowInfo)); + + for await(let key of Object.keys(allWorkFlowInfo)){ + if (!allWorkFlowInfo[key].isValid) { + delete allWorkFlowInfo[key]; + } + } + + await saveLargeObject(allWorkFlowInfo, "./result-pretty-afterProcess.json") + fs.writeFileSync("./result-afterProcess.json", JSON.stringify(allWorkFlowInfo)); + console.timeEnd("WorkflowTester"); console.log("DONE"); process.exit(0);