chore(workflow-engine): export cancel method (#11844)
What: * Workflow engine exports the method `cancel` to revert a workflow.
This commit is contained in:
committed by
GitHub
parent
3db146c56e
commit
0625f76cd4
@@ -17,7 +17,10 @@ import type {
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
import { WorkflowExecution } from "@models"
|
||||
import { WorkflowOrchestratorService } from "@services"
|
||||
import {
|
||||
WorkflowOrchestratorCancelOptions,
|
||||
WorkflowOrchestratorService,
|
||||
} from "@services"
|
||||
|
||||
type InjectedDependencies = {
|
||||
manager: SqlEntityManager
|
||||
@@ -112,7 +115,7 @@ export class WorkflowsModuleService<
|
||||
return await this.workflowOrchestratorService_.getRunningTransaction(
|
||||
workflowId,
|
||||
transactionId,
|
||||
{ context }
|
||||
context
|
||||
)
|
||||
}
|
||||
|
||||
@@ -194,4 +197,13 @@ export class WorkflowsModuleService<
|
||||
updated_at <= (CURRENT_TIMESTAMP - INTERVAL '1 second' * retention_time);
|
||||
`)
|
||||
}
|
||||
|
||||
@InjectSharedContext()
|
||||
async cancel(
|
||||
workflowId: string,
|
||||
options: WorkflowOrchestratorCancelOptions,
|
||||
@MedusaContext() context: Context = {}
|
||||
) {
|
||||
return this.workflowOrchestratorService_.cancel(workflowId, options)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user