import { Logger } from "../shared/logger.js"; import type { ItemField } from "./api/client.js"; export interface FieldCacheOptions { envName: string; maxEntries?: number; cacheDir?: string; logger?: Logger; } export interface FieldCache { /** Look up cached fields. Returns null on miss or stale entry. */ get(itemId: string, updatedDate: string | null | undefined): ItemField[] | null; /** Store a field bundle. No-op when `updatedDate` is missing. */ set(itemId: string, updatedDate: string | null | undefined, fields: ItemField[]): void; /** Persist the cache to disk. Safe to call multiple times. */ flush(): Promise; /** Read-only stats for reporting. */ stats(): { hits: number; misses: number; size: number; }; } export declare const createFieldCache: (options: FieldCacheOptions) => FieldCache; /** * Wrap `getItemFieldsBatch` with a field-cache layer. The returned * function consults the cache first per item, then defers to the * underlying batch for any cache misses, and finally writes the * fresh results back into the cache. * * `searchResults` is required so the wrapper knows each item's * `updatedDate` — that's the cache freshness key. Callers pass the * search results from the same enumeration pass. */ export declare const wrapFieldsBatchWithCache: (underlying: (itemIds: readonly string[]) => Promise>, cache: FieldCache, updatedDateByItemId: Map) => (itemIds: readonly string[]) => Promise>; export declare const isAuditCacheEnabled: () => boolean;