feat: Workflow engine modules (#6128)

This commit is contained in:
Carlos R. L. Rodrigues
2024-01-23 10:08:08 -03:00
committed by GitHub
parent d85fee42ee
commit 302323916b
119 changed files with 5339 additions and 263 deletions

View File

@@ -81,9 +81,16 @@ export class WorkflowManager {
const finalFlow = flow instanceof OrchestratorBuilder ? flow.build() : flow
if (WorkflowManager.workflows.has(workflowId)) {
function excludeStepUuid(key, value) {
return key === "uuid" ? undefined : value
}
const areStepsEqual = finalFlow
? JSON.stringify(finalFlow) ===
JSON.stringify(WorkflowManager.workflows.get(workflowId)!.flow_)
? JSON.stringify(finalFlow, excludeStepUuid) ===
JSON.stringify(
WorkflowManager.workflows.get(workflowId)!.flow_,
excludeStepUuid
)
: true
if (!areStepsEqual) {
@@ -131,14 +138,19 @@ export class WorkflowManager {
}
const finalFlow = flow instanceof OrchestratorBuilder ? flow.build() : flow
const updatedOptions = { ...workflow.options, ...options }
WorkflowManager.workflows.set(workflowId, {
id: workflowId,
flow_: finalFlow,
orchestrator: new TransactionOrchestrator(workflowId, finalFlow, options),
orchestrator: new TransactionOrchestrator(
workflowId,
finalFlow,
updatedOptions
),
handler: WorkflowManager.buildHandlers(workflow.handlers_),
handlers_: workflow.handlers_,
options: { ...workflow.options, ...options },
options: updatedOptions,
requiredModules,
optionalModules,
})