/** * Fixed-ceiling delta reader for realtime vault sync v2. * * A drain deliberately has two request shapes: its first request has the * recipient cursor and later requests have only the opaque page token. This * makes it impossible for the client to accidentally turn a fixed-H drain * into a new high-water request while it is following a page chain. Applying * a page (and making its cursor durable) belongs to U54; this module does not * persist or advance a cursor itself. */ import type { CandidateFetch, CandidateTransportAuthorization } from "./candidate-uploader.js"; export type DeltaOperation = "upsert" | "delete"; export interface DeltaRecord { deltaId: string; canonicalPath: string; operation: DeltaOperation; versionId: string | null; /** Source facts decide regular-file versus symlink application in U54. */ source: { kind: "regular" | "symlink"; mode: number; } | null; } export interface DeltaPage { /** Immutable recipient-bound high-water cursor for every page in a drain. */ untilCursor: string; /** A hidden projection page is valid: `deltas` may be empty while this exists. */ nextPageToken: string | null; deltas: readonly DeltaRecord[]; } export interface DeltaClientOptions { apiUrl: string; fetchImpl?: CandidateFetch; now?: () => number; authorizationTimeoutMs?: number; } export interface DeltaDrainRequest { authorization: CandidateTransportAuthorization; scopeHandle: string; scopeRevision: string; cursor: string; /** The server chooses the effective page size; this is merely its bounded request limit. */ limit: number; } export interface DeltaDrainResult { untilCursor: string; pages: number; deltas: number; } export declare class DeltaGapError extends Error { constructor(message?: string); } export declare class CursorRetiredError extends Error { constructor(message?: string); } /** * The V2 reader has no LIST capability or dependency. Its callback is * awaited before another page is requested, so a future durable applier can * make every page's effects and cursor durable before the next page arrives. */ export declare class DeltaClient { private readonly apiUrl; private readonly fetchImpl; private readonly now; private readonly timeoutMs; constructor(options: DeltaClientOptions); drain(request: DeltaDrainRequest, consume: (page: DeltaPage) => Promise): Promise; private assertRequest; private getPage; private assertLease; private request; } //# sourceMappingURL=delta-client.d.ts.map