import { HttpClient } from '@angular/common/http'; import { InjectionToken } from '@angular/core'; import { Observable } from 'rxjs'; import { KaduMultiLangTranslator, KaduTranslationRequest } from './kadu-multi-lang.translator'; import * as i0 from "@angular/core"; /** * Configuration for {@link KaduProxyTranslatorService}. * * The proxy contract is intentionally minimal so any backend - AWS Lambda, * Cloudflare Worker, Vercel Edge Function, Spring/Node/etc. - can implement * it in a few lines: * * POST {endpoint} * Body: { "text": string, "fromLang": string, "toLang": string } * Response: { "translated": string } */ export interface KaduProxyConfig { /** Fully qualified URL of the translation endpoint, e.g. an AWS Function URL. */ endpoint: string; /** * Optional static headers (e.g. `Authorization` for an API gateway key). * If you need per-request auth (signed JWT, rotating token, etc.) prefer * an HTTP interceptor. */ headers?: Record; /** Maximum entries kept in the in-memory LRU cache. Defaults to 500. */ cacheSize?: number; } export declare const KADU_PROXY_CONFIG: InjectionToken; export interface ProxyTranslatorCacheStats { hits: number; misses: number; size: number; maxSize: number; } /** * Translator implementation that calls a customer-hosted proxy instead of * an AI vendor directly. Use this in production so API keys stay on the * server. * * Pair with `KADU_PROXY_CONFIG` to supply the endpoint: * * providers: [ * { provide: KADU_PROXY_CONFIG, useValue: { endpoint: '...' } }, * { provide: KADU_MULTI_LANG_TRANSLATOR, useExisting: KaduProxyTranslatorService }, * ] * * Includes the same in-memory LRU cache as the direct OpenAI service to * deduplicate identical requests within a session. */ export declare class KaduProxyTranslatorService implements KaduMultiLangTranslator { private http; private config; private readonly cache; private readonly maxCacheSize; private cacheHits; private cacheMisses; constructor(http: HttpClient, config: KaduProxyConfig | null); translate(req: KaduTranslationRequest): Observable; getCacheStats(): ProxyTranslatorCacheStats; clearCache(): void; private buildCacheKey; private readFromCache; private writeToCache; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }