/** * Message-layer zod schemas: the four wire full forms + error body + * carrier receipt. The payload slot is unknown in the full-form schemas — business payloads * get a second parse dispatched by method (two-level parse discipline). * Brand cast point: rpcIdSchema, and only there. */ import { z } from 'zod'; import type { ClientRequest, ClientResponse, RpcError, RpcId, ServerRequest, ServerResponse } from './rpc.ts'; /** * Wire widening of a contract type: widens every property (deeply) to `original | undefined`. * The repo enables exactOptionalPropertyTypes while zod `.optional()` outputs `T | undefined`, * so `satisfies z.ZodType` is unusable across the board; anchoring is always * written `satisfies z.ZodType>` — the widening only adds undefined, so * missing fields / wrong types still fail to compile. On the JSON wire, "absent" and * "value undefined" serialize identically, so the widening loses no validation semantics. */ export type Wire = T extends readonly (infer E)[] ? Wire[] : T extends object ? { [K in keyof T]: Wire | undefined; } : T; /** * RpcId: one brand cast after schema validation (the only cast point in this * file). No min-length: the id is an opaque echo token, and rejecting values * here would only turn a correlatable error report into a client-side parse * failure (the handler substitutes a sentinel when a request's id is unreadable). */ export declare const rpcIdSchema: z.ZodType; /** Error body: discriminated by code, per-branch details aligned to RpcErrorDetailsMap; details is required. */ export declare const rpcErrorSchema: z.ZodType; /** * Business success/failure result schema (generic, reusable). * @param value - Schema for the business value. * @returns Schema for RpcResult. */ export declare function rpcResultSchema(value: z.ZodType): z.ZodUnion; /** ClientRequest full form (payload stays wide — the business layer runs the second parse). */ export declare const clientRequestSchema: z.ZodType; /** ServerResponse full form (result.value stays wide). */ export declare const serverResponseSchema: z.ZodType; /** ServerRequest full form (payload stays wide). */ export declare const serverRequestSchema: z.ZodType; /** ClientResponse full form (result.value stays wide). */ export declare const clientResponseSchema: z.ZodType; /** Wire full-form union (discriminated by type). */ export declare const rpcMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject>; }>, z.core.$strip>, z.ZodObject>; }>, z.core.$strip>, z.ZodObject>; }>, z.core.$strip>, z.ZodObject>; }>, z.core.$strip>], "type">; /** Carrier receipt schema. */ export declare const rpcReceiptSchema: z.ZodUnion; }, z.core.$strip>, z.ZodObject<{ accepted: z.ZodLiteral; reason: z.ZodUnion, z.ZodLiteral<"bad-response">]>; }, z.core.$strip>]>; //# sourceMappingURL=rpc.schema.d.ts.map