feat(orchestration,workflows-sdk,core-flows): workflow cancel (#6778)

This commit is contained in:
Carlos R. L. Rodrigues
2024-03-22 11:03:06 -03:00
committed by GitHub
parent 3e85f4dd93
commit 7e93eda1a4
9 changed files with 271 additions and 22 deletions

View File

@@ -2,7 +2,7 @@ import {
TransactionStepsDefinition,
WorkflowManager,
} from "@medusajs/orchestration"
import { OrchestrationUtils, isString } from "@medusajs/utils"
import { OrchestrationUtils, deepCopy, isString } from "@medusajs/utils"
import { ulid } from "ulid"
import { StepResponse, resolveValue } from "./helpers"
import { proxify } from "./helpers/proxy"
@@ -168,8 +168,8 @@ function applyStep<
stepOutput?.__type ===
OrchestrationUtils.SymbolWorkflowStepResponse
? stepOutput.compensateInput &&
JSON.parse(JSON.stringify(stepOutput.compensateInput))
: stepOutput && JSON.parse(JSON.stringify(stepOutput))
deepCopy(stepOutput.compensateInput)
: stepOutput && deepCopy(stepOutput)
const args = [invokeResult, executionContext]
const output = await compensateFn.apply(this, args)