/*! * Copyright (c) 2026 Interop Alliance. All rights reserved. */ /** * The pull side of the WAS replication adapter: the `changes`-feed request / * response mapping and the RxDB pull handler built from it. Maps each wire * document (`{ id, _deleted, updatedAt, version, metaVersion?, data?, custom? }`) * into an RxDB `WithDeleted`, and applies the empty-page * `checkpoint: null` rule. */ import type { WithDeleted } from 'rxdb/plugins/core'; import type { SyncCheckpoint, SyncedDoc, WasSyncPort, WireDoc } from './types.js'; /** * Maps one `changes`-feed wire document into an RxDB document. The envelope * fields map straight across; the content body stays under `data` (omitted for * tombstones, which carry no `data`) and the metadata body under `custom`. * `metaVersion` / `custom` are present only once metadata has been written for * the resource, and are simply absent otherwise (forward-compatible with a * server that does not yet surface them on the feed). `_deleted` becomes RxDB's * native deleted flag. * * @param doc {WireDoc} * @returns {WithDeleted} */ export declare function wireDocToRxDoc(doc: WireDoc): WithDeleted; /** * Builds the RxDB pull handler that fetches one `changes` page per call and * resumes from the previous checkpoint. RxDB passes the last stored checkpoint * (`undefined` on the first pull -- which the port omits from the request) and * the batch size. * * The empty-page rule: when the server returns `checkpoint: null` (no change), * keep the checkpoint RxDB gave us rather than persisting `null`, so the next * pull resumes from the same position instead of restarting the feed. * * @param port {WasSyncPort} * @returns {(lastCheckpoint: SyncCheckpoint | undefined, batchSize: number) => * Promise<{ documents: WithDeleted[], checkpoint: SyncCheckpoint | undefined }>} */ export declare function createPullHandler(port: WasSyncPort): (lastCheckpoint: SyncCheckpoint | undefined, batchSize: number) => Promise<{ documents: WithDeleted[]; checkpoint: SyncCheckpoint | undefined; }>; //# sourceMappingURL=changesQuery.d.ts.map