/** * LocalStorage Repository for persistent cache (Browser Bundle Version) * Implements ISyncRepository for synchronous access to localStorage */ import type { ISyncRepository, IStatsProvider } from '../../interfaces/repository.interface.js'; import type { MemoryRepositoryConfig } from '../../config/repository.config.js'; import type { TranslationData } from '../../types/translation-data.types.js'; /** * Configuration options for LocalStorageRepository */ export interface LocalStorageRepositoryConfig extends MemoryRepositoryConfig { options?: MemoryRepositoryConfig['options'] & { /** Storage key prefix (default: 'lionrapid:') */ prefix?: string; /** TTL in milliseconds (default: 24 hours) */ ttl?: number; /** Maximum number of entries before eviction (default: 500) */ maxSize?: number; }; } /** * LocalStorage-based repository for persistent translation caching * * Features: * - Synchronous access (localStorage is sync) * - TTL-based expiration * - Graceful fallback when localStorage unavailable (SSR, private mode) * - Automatic eviction when quota exceeded * - Version migration support */ export declare class LocalStorageRepository implements ISyncRepository, IStatsProvider { readonly name = "LocalStorageRepository"; readonly type: "memory"; readonly config: LocalStorageRepositoryConfig; private available; private prefix; private defaultTTL; private maxSize; constructor(config?: LocalStorageRepositoryConfig); /** * Check if localStorage is available * Returns false in SSR, private browsing, or when quota is 0 */ private checkAvailability; /** * Handle version migrations - clear cache when version changes */ private migrateIfNeeded; /** * Get a translation value by key * Returns null if not found or expired */ get(key: string): string | null; /** * Set a translation value * Automatically handles quota exceeded by evicting oldest entries */ set(key: string, value: string): void; /** * Remove a translation by key */ remove(key: string): void; /** * Clear all LionRapid entries from localStorage * Preserves entries from other applications */ clear(): void; /** * Clear all entries for a specific namespace */ clearNamespace(locale: string, namespace: string): void; /** * Get namespace translations */ getNamespace(locale: string, namespace: string): TranslationData | null; /** * Set namespace translations */ setNamespace(locale: string, namespace: string, translations: TranslationData): void; /** * Get all cache entries for debugging */ getEntries(): Record; /** * Get repository configuration */ getConfig(): LocalStorageRepositoryConfig; /** * Check if localStorage is available */ isAvailable(): boolean; /** * Get the number of entries in the cache */ private getEntryCount; /** * Check if error is a quota exceeded error */ private isQuotaError; /** * Evict oldest 25% of entries when quota is exceeded */ private evictOldest; /** * Get cache statistics */ getCacheStats(): { size: number; maxSize: number; usage: string; }; } //# sourceMappingURL=localstorage-repository.d.ts.map