import type { ProcessContext } from "../context.js"; import type { SyncMailboxesEvent, SyncMessagesEvent } from "../events.js"; export declare const syncMailboxes: (event: SyncMailboxesEvent, ctx: ProcessContext) => Promise; type SyncMessagesInput = Omit; /** * Separate INBOX from the rest of the fan-out. `collectAllMailboxes` sorts it * first, but sort order alone decides nothing once the emits go out together. */ export declare const splitInboxFirst: (mailboxes: readonly T[]) => { inbox: T | undefined; rest: T[]; }; /** * Emit INBOX's SYNC_MESSAGES event and wait for it before emitting the rest. * * Every event of an account shares one FIFO group (`MessageGroupId = * accountId`), so the queue serves them strictly in arrival order. Emitting * the whole list through `pMap` only bounds concurrency — it races the writes, * and INBOX could land behind up to `EVENT_EMIT_CONCURRENCY - 1` other * folders. The mail a person pressed refresh for then arrived only after every * one of those folders had finished syncing. */ export declare const emitSyncMessagesEvents: (accountId: string, mailboxes: readonly { mailboxId: string; fullPath: string; }[], emit: (event: SyncMessagesInput) => Promise) => Promise; export {};