/** * Workflow Executions Resource * * Read-only resource manager for workflow execution records. */ import type { CancelWorkflowExecutionResponse, GetExecutionFileDownloadUrlInput, ListOptions, ListResumableExecutionsResponse, NodeDataResponse, PaginatedResponse, PresignedDownloadUrl, RunReconnectInfo, WorkflowExecutionFilter } from "@artu-ai/shared"; import { WorkflowExecution } from "../models/WorkflowExecution"; import { ReadOnlyResource } from "./base"; /** * Read-only resource manager for workflow executions. * * Event-triggered workflows whose trigger condition doesn't match no * longer produce execution records — every row in the table represents * a run that actually happened (either completed successfully or * errored). Filter by `workflowId` / `triggerType` / `createdAt` as * needed. * * @example * ```typescript * // List executions for a specific workflow * const { data } = await sdk.workflows.executions.list({ * filter: { workflowId: { eq: workflowId } }, * }); * * // Retrieve a single execution * const execution = await sdk.workflows.executions.retrieve(executionId); * ``` */ export declare class WorkflowExecutionsResource extends ReadOnlyResource { /** * Retrieve a workflow execution by ID. */ retrieve(id: string): Promise; /** * List workflow executions with optional filtering and pagination. */ list(options?: ListOptions): Promise>; /** * Count workflow executions matching the given filter. */ count(filter?: WorkflowExecutionFilter): Promise; /** * Wait for a workflow execution to reach a stopping state — either truly * terminal (`completed` / `errored` / `timed_out` / `abandoned`) or * suspended waiting for human input (`waiting_for_input`, e.g. paused * on a `form.choice` step). Returns the execution as soon as it * transitions to any of these, or the current row (still `running`) on * timeout. Hard cap: 60 seconds. * * `waiting_for_input` is treated as an early-return state because the * run won't progress without a human acting on the execution — there's * no point waiting longer. * * Long-poll variant of `retrieve`; use this when you want sync semantics * and would otherwise be polling client-side. * * @example * ```typescript * const exec = await sdk.workflows.executions.wait(id, { timeoutMs: 10000 }); * if (exec.status === "completed") { ... } * if (exec.status === "waiting_for_input") { * // Surface to user so they can complete the form step * } * ``` */ wait(id: string, options?: { timeoutMs?: number; }): Promise; /** * Get paginated data rows from a node output in a workflow execution. * * Returns the actual data that flowed through a specific node output handle * during workflow execution, loaded from the stored Parquet snapshot. * * @example * ```typescript * const data = await sdk.workflows.executions.getNodeData({ * executionId: "exec_123", * nodeId: "node_abc", * handle: "output", * limit: 50, * offset: 0, * }); * if (data) { * console.log(data.columns); // ["id", "name", "amount"] * console.log(data.rows); // [{ id: "1", name: "...", amount: 100 }, ...] * console.log(data.totalRows); // 42 * } * ``` */ getNodeData(input: { executionId: string; nodeId: string; handle: string; limit?: number; offset?: number; /** * Case-insensitive substring search applied across every column * (values cast to text). When set, both the returned rows and * `totalRows` reflect only matching records. */ search?: string; }): Promise; /** * Get a short-lived signed URL to view/download a file produced by an * execution. Authorized by the opaque server-minted `fileId`; the storage * key never leaves the server. */ getFileDownloadUrl(input: GetExecutionFileDownloadUrlInput): Promise; /** * List resumable executions for a workflow. * * Returns the most-recent paused-on-form-step executions plus a * `total` count (of the requested view — "me" by default, or "all" * for the org-wide list) and `mineTotal` (count of paused runs the * current user initiated, used to power the `RunWorkflowButton` * badge regardless of which view the dialog is currently showing). * The server caps `items` so the picker UI can show "Showing N of M" * when more exist beyond the window. */ listResumable(input: { workflowId: string; /** `"me"` (default) returns only runs initiated by the current user. * `"all"` returns every paused run for the workflow. */ initiatedBy?: "me" | "all"; }): Promise; /** * Get reconnect info for resuming a paused execution run. * * Returns a short-lived public token and metadata needed to reconnect * the browser to the Trigger.dev run so the resume UI can call * `runs.resume()`. */ getRunReconnectInfo(input: { executionId: string; }): Promise; /** * Cancel an in-flight workflow execution. * * Rejects with `BAD_REQUEST` if the execution is already in a * terminal state. Writes `cancelled` to the DB row immediately and * dispatches the underlying Trigger.dev run cancel in the background. * * @example * ```typescript * await sdk.workflows.executions.cancel("exec_abc"); * ``` */ cancel(id: string): Promise; }