/** * Coalesces concurrent reads into one POST /api/q. * * Callers enqueue a batch token (`o:Customer?field=id&q=lop`). Tokens that * arrive inside an 8ms window share one request. Each part keeps its own * success, data and etag. A failed part does not reject the others. */ import type { ApiClient } from './api-context'; export interface QueryPart { success: boolean; data?: unknown; meta?: unknown; message?: string; etag?: string; not_modified?: boolean; } export interface InListToken { field: string; ids: string[]; shape: string; } /** * A concrete `t:` `in:` list. `@` references stay whole: the ids are not known * yet. A paginated list (`page=`) is not split: serving part of it from memory * would change which rows land on the page and the total. */ export declare function splitInToken(token: string): InListToken | null; export interface NarrowedIn { wire: string; rows: Record[]; missingIds: string[]; field: string; shape: string; } /** Drops ids already cached for this shape. An empty wire means nothing has to travel. */ export declare function narrowInToken(token: string, now?: number): NarrowedIn | null; /** * Stores every row of each requested id (one id can match many rows: the * stock of a product in several warehouses). An id with no row is remembered * as empty. */ export declare function rememberInRows(token: string, ids: string[], rows: unknown, now?: number): void; export declare function resetQueryBatchCache(): void; /** * Forgets every row, record and option read. useApi calls it after each * mutation so the list that just gained, changed or lost a row reads it * again instead of the copy from before the save. Metadata and i18n stay. */ export declare function invalidateQueryBatchData(): void; export declare function optionsModelFromUrl(url: string): string | null; export declare function optionsBatchToken(model: string, field: string, query: string, limit: number | undefined, filter: string | undefined, context?: Record): string; /** Names each distinct token so the server can key the response. */ export declare function nameBatchTokens(tokens: string[]): { name: string; token: string; plan: string; }[]; export declare function loadQueryPart(api: ApiClient, token: string): Promise; /** * Token for a host GET that the batch can serve. Custom endpoints, aggregates * and `/me` stay on the legacy GET. */ export declare function tokenForGet(url: string, params?: Record): string | null; /** * GET through the batch when the URL is a list, table metadata, modal metadata * or options read. Anything the batch refuses falls back to the original GET. */ export declare function batchGet(api: ApiClient, url: string, config?: { params?: Record; }): Promise<{ data: any; headers?: any; }>; //# sourceMappingURL=query-batch.d.ts.map