/** * JQHTML Cache Key Serializer * * Produces a deterministic string for a plain-data argument value, so that two * structurally equal objects built on separate renders yield the SAME cache key. * Templates rebuild `{contact_id: 12}` on every render, so identity-based keying * can never match and permanently opts the receiving component out of caching. * * --------------------------------------------------------------------------- * THIS IS NOT `process_for_serialization()` IN local-storage.ts. DO NOT MERGE THEM. * * That serializer stores cache VALUES and deliberately degrades: a function, a * symbol or a circular reference is dropped and serialization continues, because * losing a method while keeping the data is the right trade for a payload. * * For a cache KEY that policy manufactures false hits. Two argument objects that * differ ONLY by a callback would serialize identically, and a component would * render with another component's cached content - strictly worse than not * caching at all. So this serializer DECLINES on the first value it cannot * express exactly. It never drops anything. * --------------------------------------------------------------------------- * * Allow-list, and nothing else: null, undefined, boolean, number, string, Date, * arrays, and plain objects (prototype Object.prototype or null), in any nesting. * Everything else declines with a reason that reaches `data-nocache`. */ export type Serialize_Result = { ok: true; text: string; } | { ok: false; reason: string; }; /** * Values larger than this are declined rather than keyed. The supported case is a * handful of key/value pairs or a list of ids - not a payload. Declining loudly * beats spending the budget on a key nobody benefits from. */ export declare const MAX_KEY_BYTES = 500; /** * Serialize a value for use in a cache key. * * @returns `{ok: true, text}` when the value is exactly expressible, or * `{ok: false, reason}` naming why it is not. Never throws. */ export declare function serialize_for_cache_key(value: any): Serialize_Result; //# sourceMappingURL=cache-key-serializer.d.ts.map