This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk/extension / wire

wire() ​

wire<S>(shape): ZodMiniPipe<ZodMiniObject<{ -readonly [P in string | number | symbol]: S[P] }, $strip>, ZodMiniTransform<Awaited<CamelKeys<$InferObjectOutput<{ -readonly [P in string | number | symbol]: S[P] }, { }>>>, $InferObjectOutput<{ -readonly [P in string | number | symbol]: S[P] }, { }>>>

Declares an object in wire format (snake_case) and delivers the output in camelCase. Only the declared keys are renamed; nested objects use wire again. Extra keys in the response are dropped (in contract tests, with the strict-schemas flag, they become an error). For SDK packages (via @getenginex/sdk/extension), not for apps.

Type Parameters ​

S ​

S extends Readonly<{[k: string]: $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; }>

Parameters ​

shape ​

S

Returns ​

ZodMiniPipe<ZodMiniObject<{ -readonly [P in string | number | symbol]: S[P] }, $strip>, ZodMiniTransform<Awaited<CamelKeys<$InferObjectOutput<{ -readonly [P in string | number | symbol]: S[P] }, { }>>>, $InferObjectOutput<{ -readonly [P in string | number | symbol]: S[P] }, { }>>>

Example ​

ts
wire({ game_id: z.string(), provider: wire({ provider_id: z.string() }) })
// output: { gameId: string; provider: { providerId: string } }