import { DistributedTransactionEvents, DistributedTransactionType, TransactionStep } from "@victorhugosilva30/framework/orchestration"; import { ContainerLike, Context, MedusaContainer } from "@victorhugosilva30/framework/types"; import { TransactionState } from "@victorhugosilva30/framework/utils"; import { type FlowRunOptions, ReturnWorkflow } from "@victorhugosilva30/framework/workflows-sdk"; import { WorkflowOrchestratorCancelOptions } from "../types"; import { InMemoryDistributedTransactionStorage } from "../utils"; export type WorkflowOrchestratorRunOptions = Omit, "container"> & { transactionId?: string; runId?: string; container?: ContainerLike; }; type RegisterStepSuccessOptions = Omit, "transactionId" | "input">; type IdempotencyKeyParts = { workflowId: string; transactionId: string; stepId: string; action: "invoke" | "compensate"; }; type NotifyOptions = { eventType: keyof DistributedTransactionEvents; workflowId: string; transactionId?: string; state?: TransactionState; step?: TransactionStep; response?: unknown; result?: unknown; errors?: unknown[]; }; type SubscriberHandler = { (input: NotifyOptions): void; } & { _id?: string; }; type SubscribeOptions = { workflowId: string; transactionId?: string; subscriber: SubscriberHandler; subscriberId?: string; }; type UnsubscribeOptions = { workflowId: string; transactionId?: string; subscriberOrId: string | SubscriberHandler; }; export declare class WorkflowOrchestratorService { private subscribers; private container_; private inMemoryDistributedTransactionStorage_; constructor({ inMemoryDistributedTransactionStorage, sharedContainer, }: { inMemoryDistributedTransactionStorage: InMemoryDistributedTransactionStorage; workflowOrchestratorService: WorkflowOrchestratorService; sharedContainer: MedusaContainer; }); onApplicationStart(): Promise; onApplicationShutdown(): Promise; private triggerParentStep; run(workflowIdOrWorkflow: string | ReturnWorkflow, options?: WorkflowOrchestratorRunOptions): Promise; cancel(workflowIdOrWorkflow: string | ReturnWorkflow, options?: WorkflowOrchestratorCancelOptions): Promise; getRunningTransaction(workflowId: string, transactionId: string, context?: Context): Promise; setStepSuccess({ idempotencyKey, stepResponse, options, }: { idempotencyKey: string | IdempotencyKeyParts; stepResponse: unknown; options?: RegisterStepSuccessOptions; }): Promise; setStepFailure({ idempotencyKey, stepResponse, options, }: { idempotencyKey: string | IdempotencyKeyParts; stepResponse: unknown; options?: RegisterStepSuccessOptions; }): Promise; subscribe({ workflowId, transactionId, subscriber, subscriberId, }: SubscribeOptions): void; unsubscribe({ workflowId, transactionId, subscriberOrId, }: UnsubscribeOptions): void; private notify; private buildWorkflowEvents; private buildIdempotencyKeyAndParts; } export {}; //# sourceMappingURL=workflow-orchestrator.d.ts.map