feat(orchestration,workflows-sdk,core-flows): workflow cancel (#6778)
This commit is contained in:
committed by
GitHub
parent
3e85f4dd93
commit
7e93eda1a4
@@ -781,7 +781,7 @@ export class TransactionOrchestrator extends EventEmitter {
|
||||
if (flow.state === TransactionState.FAILED) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.NOT_ALLOWED,
|
||||
`Cannot revert a perment failed transaction.`
|
||||
`Cannot revert a permanent failed transaction.`
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
MedusaModuleType,
|
||||
createMedusaContainer,
|
||||
isDefined,
|
||||
isString,
|
||||
} from "@medusajs/utils"
|
||||
import { asValue } from "awilix"
|
||||
import {
|
||||
@@ -348,17 +349,16 @@ export class LocalWorkflow {
|
||||
}
|
||||
|
||||
async cancel(
|
||||
uniqueTransactionId: string,
|
||||
transactionOrTransactionId: string | DistributedTransaction,
|
||||
context?: Context,
|
||||
subscribe?: DistributedTransactionEvents
|
||||
) {
|
||||
this.medusaContext = context
|
||||
const { orchestrator } = this.workflow
|
||||
|
||||
const transaction = await this.getRunningTransaction(
|
||||
uniqueTransactionId,
|
||||
context
|
||||
)
|
||||
const transaction = isString(transactionOrTransactionId)
|
||||
? await this.getRunningTransaction(transactionOrTransactionId, context)
|
||||
: transactionOrTransactionId
|
||||
|
||||
const { cleanUpEventListeners } = this.registerEventCallbacks({
|
||||
orchestrator,
|
||||
|
||||
Reference in New Issue
Block a user