import { DistributedTransactionEvents, DistributedTransactionType, LocalWorkflow, TransactionStepError } from "@medusajs/orchestration"; import { Context, LoadedModule, MedusaContainer } from "@medusajs/types"; type BaseFlowRunOptions = { context?: Context; resultFrom?: string | Symbol; throwOnError?: boolean; logOnError?: boolean; events?: DistributedTransactionEvents; container?: LoadedModule[] | MedusaContainer; }; export type FlowRunOptions = BaseFlowRunOptions & { input?: TData; }; export type FlowRegisterStepSuccessOptions = BaseFlowRunOptions & { idempotencyKey: string; response?: TData; }; export type FlowRetryStepOptions = Omit & { idempotencyKey: string; }; export type FlowRegisterStepFailureOptions = BaseFlowRunOptions & { idempotencyKey: string; response?: TData; forcePermanentFailure?: boolean; }; export type FlowCancelOptions = { transaction?: DistributedTransactionType; transactionId?: string; context?: Context; throwOnError?: boolean; logOnError?: boolean; events?: DistributedTransactionEvents; container?: LoadedModule[] | MedusaContainer; }; /** * The details of a workflow's execution. */ export type WorkflowResult = { /** * Any errors that occured in the workflow. */ errors: TransactionStepError[]; /** * The transaction details of the workflow's execution. */ transaction: DistributedTransactionType; /** * The result returned by the workflow. */ result: TResult; }; export type ExportedWorkflow = { run: (args?: FlowRunOptions) => Promise>; registerStepSuccess: (args?: FlowRegisterStepSuccessOptions) => Promise>; registerStepFailure: (args?: FlowRegisterStepFailureOptions) => Promise>; retryStep: (args?: FlowRetryStepOptions) => Promise; cancel: (args?: FlowCancelOptions) => Promise; }; export type MainExportedWorkflow = { (container?: LoadedModule[] | MedusaContainer): Omit & ExportedWorkflow; } & { /** * You can also directly call run, registerStepSuccess, registerStepFailure and cancel on the exported workflow */ run(args?: FlowRunOptions): Promise>; registerStepSuccess(args?: FlowRegisterStepSuccessOptions): Promise>; registerStepFailure(args?: FlowRegisterStepFailureOptions): Promise>; cancel(args?: FlowCancelOptions): Promise; }; export {}; //# sourceMappingURL=type.d.ts.map