Reference / @getenginex/sdk/extension / WireSchema
WireSchema<TWire, TMessage>
Schema of a realtime message: a Zod schema (usually wire({...})) that takes the wire payload (TWire, snake_case) and returns the public message (TMessage, camelCase). Typed structurally, so that Zod types do not appear in the realtime API: it requires Zod's safeParse, which realtime uses to validate in the client's mode (warn recovers field by field, as in HTTP responses). A schema that is only Standard Schema (e.g. Valibot) will not do.
Type Parameters
TWire
TWire
TMessage
TMessage
Properties
~standard
readonly~standard:object
Standard Schema metadata (only the types are read, to infer TWire).
types?
readonlyoptionaltypes?:object
Input (wire) and output (public message) types.
types.input
readonlyinput:TWire
types.output
readonlyoutput:TMessage
vendor
readonlyvendor:string
Schema library (Zod).
version
readonlyversion:1
Version of the Standard Schema interface.
Methods
safeParse()
safeParse(
data): {data:TMessage;success:true; } | {error:unknown;success:false; }
Validates and converts a value (Zod's safeParse).
Parameters
data
unknown
Payload received from the gateway.
Returns
{ data: TMessage; success: true; } | { error: unknown; success: false; }