import type { ConnectorRecord, SkipResult } from "./protocol.js"; /** * What one connector has collected for one Personal Server owner: the * cursor per stream to resume from, and every record seen so far. * * The Personal Server replaces a scope on each write, while an incremental * run only returns what changed, so the full set has to be kept here and * sent every time. It is kept per owner so switching identities never * uploads one person's history into another's server. */ export interface CollectionState { version: 1; checkpoints: Record>; snapshot: Record; }>>; } export declare function ownerKey(owner: string | null | undefined): string; export declare function collectionStatePath(source: string, owner: string | null | undefined): string; export declare function readCollectionState(file: string): Promise; /** Streams whose output this run can stand behind; a skip without a stream voids them all. */ export declare function completedStreams(requested: string[], skips: SkipResult[]): string[]; /** One line naming every skip and its reason, for a run that saved nothing. */ export declare function describeSkips(skips: SkipResult[]): string; /** * Fold a finished run into the stored state. Only completed streams change: * a skipped stream keeps its previous records and cursor, so a partial run * never erases what an earlier one collected. */ export declare function mergeRun(previous: CollectionState, run: { mode: "full_refresh" | "incremental"; completed: string[]; records: ConnectorRecord[]; checkpoints: Record>; }): CollectionState; export declare function writeCollectionState(file: string, state: CollectionState): Promise; /** * The result file the ingest step reads: one `.` key per * completed stream, each an object wrapping every record the owner has, since * the Personal Server rejects array bodies. */ export declare function projectResult(source: string, displayName: string, state: CollectionState, completed: string[]): Record; export declare function writeResult(file: string, result: Record): Promise; //# sourceMappingURL=store.d.ts.map