/** * Search, over one account or over all of them at once. * * The multi-account case is the reason this server exists, so it is built to * degrade rather than fail: one revoked account must not take down a search * across the other four. */ import type { AccountId, EmailSummary, MultiAccountSearchResult } from './types.js'; export interface SortableSummary { summary: EmailSummary; /** Epoch ms. Gmail's `internalDate` is authoritative; the Date header lies. */ sortKey: number; } /** * Orders messages newest first and trims to `limit`. * * Split out from the fetching so it can be tested without a network, because * the ordering is not cosmetic: `limit` applies per account on the way in, and * the merged list is cut to the same number afterwards. The sort decides *which * messages survive the cut*, so getting it wrong does not reorder a page — it * drops mail from it. * * The key is always `internalDate`, never the `Date` header. The header is * written by whoever sent the message and is routinely wrong; one message * claiming to be from 2099 would be enough to push a real one out of the page. */ export declare function mergeByRecency(perAccount: SortableSummary[][], limit: number): EmailSummary[]; /** Searches a single account. Throws on failure — the caller decides how to react. */ export declare function searchAccount(reference: AccountId, query: string, maxResults?: number): Promise; /** * Searches every configured account in parallel and merges the results. * * `maxResults` is per account, then the merged list is trimmed to the same * number: asking for 20 across three accounts should not return 60. */ export declare function searchAllAccounts(query: string, maxResults?: number): Promise; //# sourceMappingURL=search.d.ts.map