import { type CachedTable } from "@snort/shared"; import type { RequestBuilder, SystemInterface, TaggedNostrEvent } from "."; /** Debounce intervals (ms) per priority tier */ declare const FlushIntervals: { readonly high: 50; readonly normal: 500; readonly low: 5000; }; export type ProfilePriority = keyof typeof FlushIntervals; export declare abstract class BackgroundLoader { #private; readonly cache: CachedTable; /** * Custom loader function for fetching data from alternative sources */ loaderFn?: (pubkeys: Array) => Promise>; constructor(system: SystemInterface, cache: CachedTable); /** * Stop all pending flush timers. * Call this when the loader is no longer needed to prevent timer leaks. */ destroy(): void; /** * Name of this loader service */ abstract name(): string; /** * Handle fetched data */ abstract onEvent(e: Readonly): T | undefined; /** * Get expire time as unix milliseconds */ abstract getExpireCutoff(): number; /** * Build subscription for a chunk of missing keys */ protected abstract buildSub(missing: Array): RequestBuilder; /** * Start requesting a set of keys to be loaded. * @param pk One or more hex pubkeys * @param priority Priority tier — higher tiers flush sooner (default: "normal") */ TrackKeys(pk: string | Array, priority?: ProfilePriority): void; /** * Stop requesting a set of keys to be loaded */ UntrackKeys(pk: string | Array): void; /** * Get object from cache or fetch if missing */ fetch(key: string, timeoutMs?: number): Promise; } export {}; //# sourceMappingURL=background-loader.d.ts.map