import type { Execution, ExecutionHandle } from "./execution.js"; import type { Command, CommandInput } from "./http/command.js"; import type { EventualService, ExecutionHistoryResponse, GetExecutionLogsRequest, GetExecutionLogsResponse, ListExecutionEventsResponse, ListExecutionsResponse, ListWorkflowsResponse, SendTaskFailureRequest, SendTaskHeartbeatRequest, SendTaskHeartbeatResponse, SendTaskSuccessRequest } from "./internal/eventual-service.js"; import type { Signal } from "./signals.js"; import type { Transaction, TransactionInput, TransactionOutput } from "./transaction.js"; import type { Workflow, WorkflowExecutionOptions, WorkflowInput } from "./workflow.js"; /** * Top level Eventual Client used by systems outside of an Eventual Service to interact with it. */ export interface EventualServiceClient { listWorkflows(): Promise; /** * Start a workflow execution * @param name Suffix of execution id * @param input Workflow parameters */ startExecution(request: StartExecutionRequest): Promise>; /** * Retrieves one or more workflow execution. */ listExecutions(request: ListExecutionsRequest): Promise; /** * Retrieves a single workflow execution. */ getExecution(executionId: string): Promise; /** * Retrieves the workflow events for an execution. */ getExecutionHistory(request: ListExecutionEventsRequest): Promise; /** * Retrieves logs for an execution or workflow. */ getExecutionLogs(request: GetExecutionLogsRequest): Promise; /** * Retrieves the workflow history events for an execution. * * @deprecated use {@link EventualServiceClient.getExecutionHistory}. This API will be removed in the future. * * TODO: Support the mixed use case of retrieving events and history events from * the {@link EventualServiceClient.getExecutionHistory} API. */ getExecutionWorkflowHistory(executionId: string): Promise; /** * Sends a signal to the given execution. * * The execution may be waiting on a signal or may have a handler registered * that runs when the signal is received. */ sendSignal(request: SendSignalRequest): Promise; /** * Emits one or more events to the service. */ emitEvents(request: EmitEventsRequest): Promise; /** * Succeeds an async task with the given value. */ sendTaskSuccess(request: SendTaskSuccessRequest): Promise; /** * Fails an async task causing it to throw the given error. */ sendTaskFailure(request: SendTaskFailureRequest): Promise; executeTransaction(request: ExecuteTransactionRequest): Promise>; /** * Submits a "heartbeat" for the given taskToken. * * @returns whether the task has been cancelled by the calling workflow. */ sendTaskHeartbeat(request: SendTaskHeartbeatRequest): Promise; } export type EmitEventsRequest = CommandInput; export interface StartExecutionRequest extends WorkflowExecutionOptions { /** * Name of the workflow execution. * * Only one workflow can exist for an ID. Requests to start a workflow * with the name of an existing workflow will fail. * * @default - a unique name is generated. */ executionName?: string; /** * Name of the workflow to execute. */ workflow: string | W; /** * Input payload for the workflow function. */ input: WorkflowInput; } export interface SucceedExecutionRequest { executionId: string; result?: Result; endTime: string; } export interface FailExecutionRequest { executionId: string; error: string; message: string; endTime: string; } export type ListExecutionsRequest = CommandInput; export type ListExecutionEventsRequest = CommandInput; export interface SendSignalRequest { signal: Signal | string; execution: ExecutionHandle | string; payload?: Payload; /** * Execution scoped unique event id. Duplicates will be deduplicated. */ id?: string; } export interface InvokeCommandRequest { command: Command | string; payload?: Payload; } export interface ExecuteTransactionRequest { input: TransactionInput; transaction: T | string; } export type ExecuteTransactionResponse = { succeeded: false; error: string; message: string; } | { output: TransactionOutput; succeeded: true; }; export { ExecutionHistoryResponse, ListExecutionEventsResponse, ListExecutionsResponse, ListWorkflowsResponse, SendTaskFailureRequest, SendTaskHeartbeatRequest, SendTaskHeartbeatResponse, SendTaskSuccessRequest, }; //# sourceMappingURL=service-client.d.ts.map