/** * @module date-reviver * @category Internal * * Turning stored text back into `Date`s, driven by the declared schema. * * JSON has no date type, so a `Date` is stored as its ISO form and something * has to revive it on the way out. Which fields those are is a property of the * Zod schema, so working it out is a Zod concern rather than an event one — * this module knows nothing about events, states or PII. It takes a declared * schema and returns the schema that revives its dates, or `undefined` when * there are none to revive. * * Sits beside the other schema utilities rather than inside the event builder, * which composes it: `event_tags` asks for one reviver for an event's `data` * and another for the sensitive fields held in its `pii` sidecar. One function * is the whole interface — how a Zod schema is taken apart stays in here. * * The shape-based {@link dateReviver} in `utils.ts` is the predecessor this * replaced — it revived anything ISO-8601-looking, including fields declared * `z.string()` ([#1556](https://github.com/Rotorsoft/act-root/issues/1556)). * * @internal */ import { z } from "zod"; /** * Build the schema that revives an event's dates, or `undefined` when it * declares none. * * JSON has no date type, so a stored `Date` comes back as text and something * has to turn it back. That is this function's only job, and the schema it * returns says only where the dates are: every other field is left out and * rides through the loose object untouched. The payload was validated when it * was committed, so re-checking it on the way out would be work already done. * * Naming only the dates is also what makes a read tolerant, without needing a * rule per exception. A `sensitive(...)` field lives in the `pii` sidecar * rather than in `data`; an event written against an older declaration * predates whatever was added since; a field dropped from the declaration is * still in the store. None of those are dates, so none of them are described * here, and a payload carrying any of them still reads. The dates themselves * are optional for the same reason — absent is not wrong. * * Zod does the walking, so nesting, arrays, records, unions and the wrappers * are handled by the engine rather than by a traversal of our own that would * drift as Zod grows constructs. A construct this doesn't recognise * contributes no date, which is the documented fallthrough. */ export declare function date_reviver_schema(schema: unknown): z.ZodType | undefined; //# sourceMappingURL=date-reviver.d.ts.map