feat(types,medusa): add acknowledgement typing (#8991)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Acknowledgement } from "../../../workflows-sdk"
|
||||
import { PaginatedResponse } from "../../common/response"
|
||||
import { AdminWorkflowExecution } from "./entities"
|
||||
|
||||
@@ -8,3 +9,7 @@ export interface AdminWorkflowExecutionResponse {
|
||||
export type AdminWorkflowExecutionListResponse = PaginatedResponse<{
|
||||
workflow_executions: AdminWorkflowExecution[]
|
||||
}>
|
||||
|
||||
export type AdminWorkflowRunResponse = {
|
||||
acknowledgement: Acknowledgement
|
||||
}
|
||||
@@ -15,6 +15,11 @@ type FlowRunOptions<TData = unknown> = {
|
||||
events?: Record<string, Function>
|
||||
}
|
||||
|
||||
export type Acknowledgement = {
|
||||
workflowId: string
|
||||
transactionId: string
|
||||
}
|
||||
|
||||
export interface WorkflowOrchestratorRunDTO<T = unknown>
|
||||
extends FlowRunOptions<T> {
|
||||
transactionId?: string
|
||||
@@ -59,7 +64,7 @@ export interface IWorkflowEngineService extends IModuleService {
|
||||
errors: Error[]
|
||||
transaction: object
|
||||
result: any
|
||||
acknowledgement: object
|
||||
acknowledgement: Acknowledgement
|
||||
}>
|
||||
|
||||
getRunningTransaction(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
HttpTypes,
|
||||
IWorkflowEngineService,
|
||||
WorkflowOrchestratorRunDTO,
|
||||
} from "@medusajs/types"
|
||||
@@ -11,7 +12,7 @@ import { AdminCreateWorkflowsRunType } from "../../validators"
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminCreateWorkflowsRunType>,
|
||||
res: MedusaResponse<{ acknowledgement: object }>
|
||||
res: MedusaResponse<HttpTypes.AdminWorkflowRunResponse>
|
||||
) => {
|
||||
const workflowEngineService: IWorkflowEngineService = req.scope.resolve(
|
||||
ModuleRegistrationName.WORKFLOW_ENGINE
|
||||
|
||||
Reference in New Issue
Block a user