feat(medusa): workflow engine api (#6330)
What:
Workflow Engine API.
Endpoints for:
- List workflow executions
- Run a workflow
- Set async steps as success or failure
- Retrieve the details of a workflow run
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
export * from "./helper"
|
||||
export * from "./medusa-workflow"
|
||||
export * as WorkflowOrchestratorTypes from "./types"
|
||||
export { IWorkflowEngineService } from "./types/service"
|
||||
export * from "./utils/composer"
|
||||
export * as Composer from "./utils/composer"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseFilterable } from "@medusajs/types"
|
||||
import { BaseFilterable, OperatorMap } from "@medusajs/types"
|
||||
|
||||
export interface WorkflowExecutionDTO {
|
||||
id: string
|
||||
@@ -14,8 +14,8 @@ export interface WorkflowExecutionDTO {
|
||||
|
||||
export interface FilterableWorkflowExecutionProps
|
||||
extends BaseFilterable<FilterableWorkflowExecutionProps> {
|
||||
id?: string[]
|
||||
workflow_id?: string[]
|
||||
transaction_id?: string[]
|
||||
state?: any[]
|
||||
id?: string | string[] | OperatorMap<string>
|
||||
workflow_id?: string | string[] | OperatorMap<string>
|
||||
transaction_id?: string | string[] | OperatorMap<string>
|
||||
state?: string | string[] | OperatorMap<string>
|
||||
}
|
||||
|
||||
@@ -31,7 +31,18 @@ export type IdempotencyKeyParts = {
|
||||
action: "invoke" | "compensate"
|
||||
}
|
||||
|
||||
export interface IWorkflowsModuleService extends IModuleService {
|
||||
export interface IWorkflowEngineService extends IModuleService {
|
||||
retrieveWorkflowExecution(
|
||||
idOrObject:
|
||||
| string
|
||||
| {
|
||||
workflow_id: string
|
||||
transaction_id: string
|
||||
},
|
||||
config?: FindConfig<WorkflowExecutionDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<WorkflowExecutionDTO>
|
||||
|
||||
listWorkflowExecution(
|
||||
filters?: FilterableWorkflowExecutionProps,
|
||||
config?: FindConfig<WorkflowExecutionDTO>,
|
||||
@@ -88,7 +99,7 @@ export interface IWorkflowsModuleService extends IModuleService {
|
||||
stepResponse,
|
||||
options,
|
||||
}: {
|
||||
idempotencyKey: string | object
|
||||
idempotencyKey: string | IdempotencyKeyParts
|
||||
stepResponse: unknown
|
||||
options?: Record<string, any>
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user