/** * Persistent IDLE watermarks. * * The watcher reports a message once, by remembering the highest UID it has * seen per account and folder. Holding that only in memory meant every fresh * connection re-baselined to the server's current UIDNEXT, so anything that * arrived while the process was down — or during a reconnect — was skipped * silently: no notification, no hook, no event. * * Same read/write/lock shape as verification-state.ts, with one addition that * matters more here: a watermark is only meaningful against the UIDVALIDITY it * was recorded under. If the server renumbers a mailbox, the stored UID points * at an unrelated message, so the pair is stored and compared together. */ export interface Watermark { /** UIDVALIDITY the UID below was observed under, as a decimal string. */ uidValidity: string; lastSeenUid: number; updatedAt: string; } /** The stored watermark for this account/folder, if any. */ export declare function readWatermark(account: string, folder: string): Promise; /** Record the highest UID reported for this account/folder. */ export declare function writeWatermark(account: string, folder: string, uidValidity: string, lastSeenUid: number): Promise; /** * Decide where a newly connected IDLE session should resume from. * * `uidNext - 1` is the "everything already here is old news" baseline, and it * is the right answer only when there is nothing better: the first time a * folder is watched, or when the mailbox has been renumbered. Otherwise resume * from the highest UID already reported, so the gap left by a restart or a * reconnect is reported rather than skipped. * * The in-memory value wins ties because it is never older than the file, and * one that has run ahead of UIDNEXT (a renumbered mailbox the UIDVALIDITY * check somehow missed) falls back to the baseline rather than going mute. */ export declare function resolveBaselineUid(opts: { inMemoryLastSeenUid: number; stored: Watermark | undefined; uidValidity: string; uidNext: number; }): number; //# sourceMappingURL=watcher-state.d.ts.map