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