/** * Array-based handler chain implementation * Much simpler than linked list approach */ import { EventEmitter } from '../base/event-emitter.js'; import type { IAsyncHandler, ISyncHandler } from '../interfaces/handler.interface.js'; import type { TranslationData } from '../types/translation-data.types.js'; import type { TranslationContext, TranslationRequest, TranslationResult } from '../types/translation.types.js'; export declare class HandlerChain { private asyncHandlers; private syncHandlers; private bus; constructor(eventEmitter: EventEmitter); addSyncHandler(handler: ISyncHandler): void; handleSync(request: TranslationRequest): TranslationResult | null; private saveToMemoryHandlers; private saveNamespaceToMemoryHandlers; addAsyncHandler(handler: IAsyncHandler): void; handleAsync(request: TranslationRequest): Promise; /** * Save translation to all storage handlers that come before the source handler */ private saveToStorageHandlers; private saveNamespaceToStorageHandlers; saveNamespaceToHandlers(translations: TranslationData, context: TranslationContext): Promise; getSyncHandlers(): ISyncHandler[]; getAsyncHandlers(): IAsyncHandler[]; /** * Get chain info for debugging */ getChainInfo(): { length: number; handlers: Array<{ name: string; priority: number; type: 'memory' | 'storage' | 'network' | 'fallback'; enabled: boolean | undefined; }>; }; /** * Check if any handler has cached data */ isCached(request: TranslationRequest): boolean; /** * Get combined cache entries */ getEntries(): Record; /** * Destroy all handlers */ destroy(): Promise; private sortHandlersIfNeeded; loadNamespace(locale: string, namespace: string): Promise; clearCache(): void; /** * Clear cache entries for a specific namespace */ clearNamespace(locale: string, namespace: string): void; /** * Set a value directly in the cache (for optimistic updates) * Bypasses the normal handler flow to directly set values in memory handlers * Stores as ContentUnit (text + styles) for consistency * * @param key - Full cache key (e.g., 'en:app:welcome') * @param value - Translation value * @param styles - Optional styles for indexed tags */ setCache(key: string, value: string, styles?: Record): void; /** * Get namespace data from cache for ContentUnit style lookup * * Used by t() to retrieve styles for indexed tags at render time. * * @param namespaceCacheKey - Cache key in format @locale:namespace * @returns Parsed namespace data or null if not found */ getNamespaceData(namespaceCacheKey: string): TranslationData | null; } //# sourceMappingURL=handler-chain.d.ts.map