import { APIResource } from "../../../core/resource.js"; import * as EventsAPI from "./events.js"; import { BaseEvents, EventCreateParams, EventCreateResponse, Events } from "./events.js"; import * as StatusAPI from "./status.js"; import { BaseStatus, Status, StatusEditParams, StatusEditResponse } from "./status.js"; import { APIPromise } from "../../../core/api-promise.js"; import { PagePromise, SinglePage, V4PagePaginationArray, type V4PagePaginationArrayParams } from "../../../core/pagination.js"; import { RequestOptions } from "../../../internal/request-options.js"; export declare class BaseInstances extends APIResource { static readonly _key: readonly ['workflows', 'instances']; /** * Creates a new instance of a workflow, starting its execution. */ create(workflowName: string, params: InstanceCreateParams, options?: RequestOptions): APIPromise; /** * Lists all instances of a workflow with their execution status. */ list(workflowName: string, params: InstanceListParams, options?: RequestOptions): PagePromise; /** * Creates multiple workflow instances in a single batch operation. */ bulk(workflowName: string, params: InstanceBulkParams, options?: RequestOptions): PagePromise; /** * Retrieves logs and execution status for a specific workflow instance. */ get(instanceID: string, params: InstanceGetParams, options?: RequestOptions): APIPromise; /** * Retrieves the full, untruncated output for a specific step on a workflow * instance. Returns a flat status-shaped JSON body with step `status` ('running' | * 'waiting' | 'complete' | 'errored'), `error` (nullable), and `output` (the step * value, or null while running/waiting/errored). When the step returned a * ReadableStream from step.do, the response is served as * 'application/octet-stream' with the raw bytes as the body instead of JSON. A * `status='running'` response with non-null `error` indicates the step is * currently retrying after a prior attempt failed. */ step(instanceID: string, params: InstanceStepParams, options?: RequestOptions): APIPromise; } export declare class Instances extends BaseInstances { status: StatusAPI.Status; events: EventsAPI.Events; } export type InstanceListResponsesV4PagePaginationArray = V4PagePaginationArray; export type InstanceBulkResponsesSinglePage = SinglePage; export interface InstanceCreateResponse { id: string; status: 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waitingForPause' | 'waiting' | 'rollingBack'; version_id: string; workflow_id: string; trigger_source?: 'unknown' | 'api' | 'binding' | 'event' | 'cron'; } export interface InstanceListResponse { id: string; created_on: string; ended_on: string | null; modified_on: string; started_on: string | null; status: 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waitingForPause' | 'waiting' | 'rollingBack'; version_id: string; workflow_id: string; trigger_source?: 'unknown' | 'api' | 'binding' | 'event' | 'cron'; } export interface InstanceBulkResponse { id: string; status: 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waitingForPause' | 'waiting' | 'rollingBack'; version_id: string; workflow_id: string; trigger_source?: 'unknown' | 'api' | 'binding' | 'event' | 'cron'; } export interface InstanceGetResponse { end: string | null; error: InstanceGetResponse.Error | null; output: string | number; params: unknown; queued: string; rollback: InstanceGetResponse.Rollback | null; start: string | null; status: 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waitingForPause' | 'waiting' | 'rollingBack'; step_count: number; steps: Array; success: boolean | null; trigger: InstanceGetResponse.Trigger; versionId: string; schedule?: InstanceGetResponse.Schedule; } export declare namespace InstanceGetResponse { interface Error { message: string; name: string; } interface Rollback { error: Rollback.Error | null; outcome: 'complete' | 'failed'; } namespace Rollback { interface Error { message: string; name: string; } } interface UnionMember0 { attempts: Array; config: UnionMember0.Config; end: string | null; name: string; output: string | null; start: string; success: boolean | null; type: 'step' | 'rollback'; } namespace UnionMember0 { interface Attempt { end: string | null; error: Attempt.Error | null; start: string; success: boolean | null; } namespace Attempt { interface Error { message: string; name: string; } } interface Config { retries: Config.Retries; /** * Specifies the timeout duration. */ timeout: string | number; /** * When set to 'output', step output is redacted from log and step output * responses. */ sensitive?: 'output'; } namespace Config { interface Retries { /** * Specifies the delay duration. '[dynamic]' indicates the delay is computed by a * user-supplied function. */ delay: string | number; limit: number; backoff?: 'constant' | 'linear' | 'exponential'; } } } interface UnionMember1 { end: string; error: UnionMember1.Error | null; finished: boolean; name: string; start: string; type: 'sleep'; } namespace UnionMember1 { interface Error { message: string; name: string; } } interface UnionMember2 { trigger: UnionMember2.Trigger; type: 'termination'; } namespace UnionMember2 { interface Trigger { source: string; } } interface UnionMember3 { end: string; error: UnionMember3.Error | null; finished: boolean; name: string; start: string; type: 'waitForEvent'; output?: string; } namespace UnionMember3 { interface Error { message: string; name: string; } } interface Trigger { source: 'unknown' | 'api' | 'binding' | 'event' | 'cron'; } interface Schedule { cron: string; scheduledTime: number; } } export interface InstanceStepResponse { /** * Error details when status='errored'; null otherwise. */ error: InstanceStepResponse.Error | null; status: 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waitingForPause' | 'waiting' | 'rollingBack'; /** * Full step output or waitForEvent payload without truncation. Sensitive outputs * are returned as '[REDACTED]'. Populated when status='complete'. May be a * ReadableStream when the step returned one from step.do; stream outputs are * served as application/octet-stream rather than JSON. */ output?: unknown; } export declare namespace InstanceStepResponse { /** * Error details when status='errored'; null otherwise. */ interface Error { message: string; name: string; } } export interface InstanceCreateParams { /** * Path param */ account_id: string; /** * Body param */ instance_id?: string; /** * Body param */ instance_retention?: InstanceCreateParams.InstanceRetention; /** * Body param */ params?: unknown; } export declare namespace InstanceCreateParams { interface InstanceRetention { /** * Specifies the duration in milliseconds or as a string like '5 minutes'. */ error_retention?: number | string; /** * Specifies the duration in milliseconds or as a string like '5 minutes'. */ success_retention?: number | string; } } export interface InstanceListParams extends V4PagePaginationArrayParams { /** * Path param */ account_id: string; /** * Query param: Opaque token for cursor-based pagination. Mutually exclusive with * `page`. */ cursor?: string; /** * Query param: Accepts ISO 8601 with no timezone offsets and in UTC. */ date_end?: string; /** * Query param: Accepts ISO 8601 with no timezone offsets and in UTC. */ date_start?: string; /** * Query param: Defines the direction for cursor-based pagination. */ direction?: 'asc' | 'desc'; /** * Query param */ status?: 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waitingForPause' | 'waiting' | 'rollingBack'; } export interface InstanceBulkParams { /** * Path param */ account_id: string; /** * Body param */ body?: Array; } export declare namespace InstanceBulkParams { interface Body { instance_id?: string; instance_retention?: Body.InstanceRetention; params?: unknown; } namespace Body { interface InstanceRetention { /** * Specifies the duration in milliseconds or as a string like '5 minutes'. */ error_retention?: number | string; /** * Specifies the duration in milliseconds or as a string like '5 minutes'. */ success_retention?: number | string; } } } export interface InstanceGetParams { /** * Path param */ account_id: string; /** * Path param */ workflow_name: string; /** * Query param: Step ordering: "asc" (default, oldest first) or "desc" (newest * first). */ order?: 'asc' | 'desc'; /** * Query param: When true, omits step details and returns only metadata with * step_count. */ simple?: 'true' | 'false'; } export interface InstanceStepParams { /** * Path param */ account_id: string; /** * Path param */ workflow_name: string; /** * Query param: Exact step name from the instance logs response, including the * generated counter suffix. */ name: string; /** * Query param: Step type to disambiguate step.do and waitForEvent entries that * share the same name. */ type: 'step' | 'waitForEvent'; /** * Query param: Specific attempt number to retrieve output or error for. */ attempt?: number; } export declare namespace Instances { export { type InstanceCreateResponse as InstanceCreateResponse, type InstanceListResponse as InstanceListResponse, type InstanceBulkResponse as InstanceBulkResponse, type InstanceGetResponse as InstanceGetResponse, type InstanceStepResponse as InstanceStepResponse, type InstanceListResponsesV4PagePaginationArray as InstanceListResponsesV4PagePaginationArray, type InstanceBulkResponsesSinglePage as InstanceBulkResponsesSinglePage, type InstanceCreateParams as InstanceCreateParams, type InstanceListParams as InstanceListParams, type InstanceBulkParams as InstanceBulkParams, type InstanceGetParams as InstanceGetParams, type InstanceStepParams as InstanceStepParams, }; export { Status as Status, BaseStatus as BaseStatus, type StatusEditResponse as StatusEditResponse, type StatusEditParams as StatusEditParams, }; export { Events as Events, BaseEvents as BaseEvents, type EventCreateResponse as EventCreateResponse, type EventCreateParams as EventCreateParams, }; } //# sourceMappingURL=instances.d.ts.map