export type RequestStatus = 'queued' | 'pending' | 'unknown'; export interface RequestQueueOptions { /** * The function to call when a queued key is ready to be fetched. */ fetchFn: (key: TKey) => Promise; /** * The maximum number of concurrent requests. * @default Infinity */ maxConcurrentRequests?: number | undefined; /** * Serialize a key to a string for use as a map key. * Required for complex key types (e.g., objects). * @default String(key) */ getKeyId?: ((key: TKey) => string) | undefined; } /** * Manages concurrent fetching with a queue system. * Tracks request lifecycle through queued → pending states * and limits concurrency to prevent overwhelming the server. */ export declare class RequestQueue { protected pendingRequests: Map; protected queuedRequests: Map; protected fetchFn: (key: TKey) => Promise; protected maxConcurrentRequests: number; protected getKeyId: (key: TKey) => string; constructor(options: RequestQueueOptions); /** * Returns the next `count` entries to process from the queue. * Default is FIFO (oldest first). Subclasses can override for different ordering. */ protected pickEntries(count: number): [string, TKey][]; protected processQueue: () => Promise; queue: (keys: TKey[]) => Promise; setRequestSettled: (key: TKey) => Promise; clear: () => void; clearPendingRequest: (key: TKey) => Promise; getRequestStatus: (key: TKey) => RequestStatus; }