import { EventSpecCoordinates, EventSpecResponse } from "./AvoEventSpecFetchTypes"; /** * The key of a fetch with gateway coordinates, or undefined without any: "\0" and a JSON * array of `parts` then both normalized coordinates (null for an absent one). JSON encodes * every part on its own, so no event name can make it equal another key; and as the * apiKey never contains NUL, no key without coordinates starts with "\0". * Shared by the spec cache key and the fetcher's in-flight dedupe key. */ export declare const coordinatesKey: (parts: string[], coordinates?: EventSpecCoordinates) => string | undefined; /** Trims each coordinate and drops a blank or non-string one. */ export declare const normalizeCoordinates: (coordinates?: EventSpecCoordinates) => EventSpecCoordinates; /** TTL of a fetch that failed other than with a 404, so a blip skips validation only briefly. */ export declare const TRANSIENT_FAILURE_TTL_MS = 5000; export declare class AvoEventSpecCache { private cache; private globalEventCount; /** * The key of one spec. Gateway coordinates are part of it, so a gateway-input spec and an * output spec for the same event name never share an entry; without coordinates the key * is the plain `apiKey\0streamId\0eventName`. */ static makeKey(apiKey: string, streamId: string, eventName: string, coordinates?: EventSpecCoordinates): string; /** * Returns the cached EventSpecResponse, or undefined on cache miss. * A cached response with eventSpec: null means "no spec exists for this event"; * a cached null means the fetch failed (such as a 404), so the event is not validated. */ get(key: string): EventSpecResponse | null | undefined; /** * Returns true if the key exists in the cache and has not expired. */ contains(key: string): boolean; /** * Stores a fetched spec, or null for a failed fetch. A spec is kept until its TTL or * MAX_EVENT_COUNT uses; a null until its TTL only. `ttlMs` defaults to 60 s; a transient * failure passes TRANSIENT_FAILURE_TTL_MS. */ set(key: string, value: EventSpecResponse | null, ttlMs?: number): void; flush(): void; private purgeExpired; private evictLRU; }