import { type Task } from "./models.js"; import type { ListInput, SubmitInput, TaskStore } from "./store/base.js"; import { type TaskDef } from "./task.js"; export type SubmitOptions = Omit; export interface CallOptions extends SubmitOptions { waitTimeoutMs?: number; pollMs?: number; } /** API-side handle. Thin wrapper over a TaskStore + SDK-orchestrated wait/call. */ export declare class CairnQ { private readonly _store; constructor(_store: TaskStore); static sqlite(path: string, opts?: { busyTimeoutMs?: number; }): CairnQ; /** Multi-host backend. `dsn` is a libpq connection string; requires the * optional `pg` package. */ static postgres(dsn: string, opts?: { max?: number; }): CairnQ; get store(): TaskStore; connect(): Promise; close(): Promise; submit(name: string, payload?: unknown, opts?: SubmitOptions): Promise; submit(task: TaskDef, payload?: P, opts?: SubmitOptions): Promise; get(taskId: string): Promise; getByKey(key: string): Promise; list(input?: ListInput): Promise; cancel(taskId: string): Promise; cancelByKey(key: string): Promise; retry(taskId: string, opts?: { resetAttempt?: boolean; }): Promise; retryByKey(key: string, opts?: { resetAttempt?: boolean; }): Promise; wait(taskId: string, opts?: { timeoutMs?: number; pollMs?: number; }): Promise; /** submit + wait. Resolves with the result on success; rejects with * TaskFailed / TaskCanceled / TaskTimeout otherwise. Pass a TaskDef and the * resolved value is typed as its Result. */ call(name: string, payload?: unknown, opts?: CallOptions): Promise; call(task: TaskDef, payload?: P, opts?: CallOptions): Promise; }