import { type ZodType } from "zod"; /** * @module utils * @category Utilities * * Small utilities used across the framework: * - {@link validate} — parse a payload against a Zod schema, throwing * {@link ValidationError} on failure. * - {@link extend} — validate a source object and merge into defaults. * - {@link sleep} — async delay (default duration from `config().sleepMs`). */ /** * Parse `payload` against `schema`, returning the validated value or throwing * a {@link ValidationError} with prettified Zod details. When `schema` is * omitted, returns `payload` unchanged. The framework calls this for every * `app.do()` action, every emitted event, and every state init. * * @example * ```typescript * const UserSchema = z.object({ email: z.string().email() }); * const user = validate("User", { email: "alice@example.com" }, UserSchema); * ``` * * @see {@link ValidationError} */ export declare const validate: (target: string, payload: Readonly, schema?: ZodType) => Readonly; /** * Validate `source` against `schema` and return a new object that merges * `source` over the optional `target` defaults. Used by {@link config} for * env-var-overrides-defaults patterns; safe to call elsewhere — it never * mutates `target`. * * @example * ```typescript * const schema = z.object({ host: z.string(), port: z.number() }); * const cfg = extend({ port: 8080 }, schema, { host: "localhost", port: 80 }); * // → { host: "localhost", port: 8080 } * ``` * * @throws {@link ValidationError} if `source` fails the schema. */ export declare const extend: , T extends Record>(source: Readonly, schema: ZodType, target?: Readonly) => Readonly; /** * Pause for `ms` milliseconds (or `config().sleepMs` when omitted — `100ms` * in dev, `0ms` in tests). Used by adapters to simulate async I/O. * * @example * ```typescript * await sleep(); // default delay from config * await sleep(500); // explicit 500ms * ``` */ export declare function sleep(ms?: number): Promise; /** * True when `source` is a **literal** stream name — it carries no regex * metacharacter, so every adapter treats it as an exact match. This is the * fast, index-friendly path and covers every autoclose/dynamic-resolver * source (bare stream names). A `false` return means the source is a * **pattern** (contains `^ $ . * + ? ( ) [ ] { } | \`) and must be compiled * as a RegExp before matching — the shape the calculator's static * `source: "^(A|B)$"` reaction relies on. * * The single source of truth for literal-vs-pattern classification across * the InMemory has-work probe, the drain fetch path, and the SQL adapters, * so all three agree on which sources take the exact path. * * @example * ```typescript * is_literal_source("Board"); // → true (exact lookup) * is_literal_source("^(A|B)$"); // → false (compile as RegExp) * ``` */ export declare function is_literal_source(source: string): boolean; /** * Revive ISO-8601-shaped strings into `Date`s during `JSON.parse`. * * **The framework no longer uses this.** Dates are resolved from the declared * `z.date()` paths at build time and converted on read, so a field declared * `z.string()` keeps its string even when the value looks like a timestamp * ([#1556](https://github.com/Rotorsoft/act-root/issues/1556)). Adapters * return what they stored; typing is the orchestrator's job. * * Kept exported for host applications that parse Act JSON themselves and want * the old shape-based behaviour. New code should let the schema decide. * */ export declare const dateReviver: (_key: string, value: unknown) => unknown; //# sourceMappingURL=utils.d.ts.map