import type { TableMetadata } from './types'; export interface MetadataApiClient { get: (url: string, config?: any) => Promise<{ data: any; }>; } /** * Predicate matching a cache key against an addon. The default * implementation (see {@link defaultAddonKeyMatcher}) treats `addonKey` * itself plus any key beginning with `${addonKey}.`, `${addonKey}:` or * `${addonKey}/` as belonging to the addon. Hosts that namespace their * `model` strings differently can pass a custom matcher to * {@link MetadataCacheState.invalidateAddon}. */ export type AddonKeyMatcher = (cacheKey: string, addonKey: string) => boolean; /** * Default matcher used by {@link MetadataCacheState.invalidateAddon}. * Mirrors the convention used by the kernel installer when it scopes * model metadata under an addon's key. */ export declare function defaultAddonKeyMatcher(cacheKey: string, addonKey: string): boolean; interface MetadataCacheState { cache: Record; modalCache: Record; metadataVersion: string; prefetched: boolean; getMetadata: (key: string) => TableMetadata | undefined; getModalMetadata: (key: string) => TableMetadata | undefined; setMetadata: (key: string, metadata: TableMetadata) => void; setModalMetadata: (key: string, metadata: TableMetadata) => void; hasMetadata: (key: string) => boolean; hasModalMetadata: (key: string) => boolean; prefetchAll: (api: MetadataApiClient) => Promise; /** * Remove cached entries belonging to a specific addon. Used by the * hot-swap subscriber when the kernel announces a manifest change. * * Returns the number of entries removed across both caches, which is * useful for tests and observability — `0` means the cache had nothing * to flush (the addon either hadn't been hit yet or uses a key * convention the default matcher doesn't recognise; pass a custom * `matcher` if your host namespaces differently). * * Also resets `prefetched` to `false` so the next mount re-runs * `prefetchAll()` and the `metadataVersion` is allowed to advance to * the kernel's freshly-bumped hash. */ invalidateAddon: (addonKey: string, matcher?: AddonKeyMatcher) => number; /** * Remove every cached entry. Heavier hammer for hosts that prefer a * blanket flush on hot-swap rather than per-addon scoping. */ clearAll: () => void; } export declare const useMetadataCache: import("zustand").UseBoundStore, "setState" | "persist"> & { setState(partial: MetadataCacheState | Partial | ((state: MetadataCacheState) => MetadataCacheState | Partial), replace?: false | undefined): unknown; setState(state: MetadataCacheState | ((state: MetadataCacheState) => MetadataCacheState), replace: true): unknown; persist: { setOptions: (options: Partial; modalCache: Record; metadataVersion: string; }, unknown>>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: MetadataCacheState) => void) => () => void; onFinishHydration: (fn: (state: MetadataCacheState) => void) => () => void; getOptions: () => Partial; modalCache: Record; metadataVersion: string; }, unknown>>; }; }>; export {}; //# sourceMappingURL=metadata-cache.d.ts.map