import { mkdir, writeFile } from "node:fs/promises"; import { Effect } from "effect"; import { type ExportManifest, type ExportManifestFile, type ExportStatus, PrismantixApiClient } from "./api.js"; export interface DownloadWorkflowOptions { readonly clientId?: string; readonly exportId?: string; readonly outputDir?: string; readonly pollIntervalMs?: number; readonly tables?: readonly string[]; readonly timeoutMs?: number; } export interface DownloadWorkflowRuntime { readonly cwd?: string; readonly mkdir?: typeof mkdir; readonly now?: () => number; readonly onEvent?: (event: WorkflowEvent) => void; readonly sleep?: (ms: number) => Promise; readonly writeFile?: typeof writeFile; readonly writeResponseBody?: (response: Response, path: string) => Promise; } export type WorkflowEvent = { readonly clientId: string; readonly exportId: string; readonly type: "created"; } | { readonly status: ExportStatus; readonly type: "poll"; } | { readonly manifest: ExportManifest; readonly type: "manifest"; } | { readonly file: ExportManifestFile; readonly type: "download-start"; } | { readonly file: DownloadedFile; readonly type: "download-complete"; }; export interface DownloadedFile { readonly path: string; readonly rowCount?: number; readonly sha256?: string; readonly sizeBytes: number; readonly tableName: string; } export interface DownloadResult { readonly clientId: string; readonly exportId: string; readonly files: readonly DownloadedFile[]; readonly manifestPath: string; readonly outputDir: string; } export declare function runDownloadWorkflowEffect(options: DownloadWorkflowOptions, runtime?: DownloadWorkflowRuntime): Effect.Effect; //# sourceMappingURL=workflow.d.ts.map