import { z } from "zod"; import type { DomicileHost } from "../domicile-host"; import type { On } from "./subscribe"; export declare enum DownloadState { InProgress = 0, Complete = 1, /** Interrupted by the network or the disk. */ Failed = 2 } /** * Parses a row of `DomicileHost.downloads`. The engine and the SDK ship apart, * so a row is checked rather than trusted. */ declare const downloadSchema: z.ZodObject<{ id: z.ZodString; page: z.ZodString; path: z.ZodString; receivedBytes: z.ZodNumber; state: z.ZodPipe, z.ZodTransform>; totalBytes: z.ZodNumber; window: z.ZodPipe>; }, z.core.$strip>; export type Download = z.infer; export type DownloadsListeners = { /** A download started, progressed, finished, failed or left the list. */ change: () => void; }; export type Downloads = { /** Oldest first; `undefined` until the engine says. */ readonly list: readonly Download[] | undefined; /** Cancel download `id`. It leaves the list. */ cancel: (id: string) => void; /** Take finished or failed download `id` off the list. The file stays. */ remove: (id: string) => void; /** Take every download not in progress off the list. The files stay. */ clear: () => void; on: On; }; export type DownloadsHost = Pick; export declare const downloads: (host: DownloadsHost) => Downloads; export {};