From 142d299d578f8a34e9d007bfbac4759099192518 Mon Sep 17 00:00:00 2001 From: DivineDemon Date: Wed, 25 Dec 2024 15:06:47 +0500 Subject: [PATCH] - Updated the Query & Mutation Function Types to Support Zod Arrays as well as Objects. - Fixes Issue #16 --- bun.lockb | Bin 185534 -> 185534 bytes src/server/__internals/procedure.ts | 2 +- src/server/__internals/types.ts | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bun.lockb b/bun.lockb index 39b7498c9a220077d9ed96ff79d7c808be250e4d..cf5c2b3a0b3a1636f471e6561aa22d16c170f290 100755 GIT binary patch delta 26 icmdnDl6&7u?uIRlAD?nC#u=LE8R=PU|M`^h=sN(Ky$j0# delta 26 icmdnDl6&7u?uIRlAD?nC { return new Procedure([...this.middlewares, fn as any]) } - input = >( + input = | Record[]>( schema: z.ZodSchema ) => ({ query: ( diff --git a/src/server/__internals/types.ts b/src/server/__internals/types.ts index d29c54c..c127c78 100644 --- a/src/server/__internals/types.ts +++ b/src/server/__internals/types.ts @@ -15,14 +15,14 @@ export type Middleware = ({ c: Context<{ Bindings: Bindings; Variables: Variables }> }) => Promise -export type QueryOperation, ZodInput = never> = { +export type QueryOperation | Record[], ZodInput = never> = { type: "query" schema?: z.ZodType handler: ({ ctx, c, input }: { ctx: Ctx; c: Context; input: ZodInput }) => Promise> middlewares: Middleware[] } -export type MutationOperation, ZodInput = never> = { +export type MutationOperation | Record[], ZodInput = never> = { type: "mutation" schema?: z.ZodType handler: ({ ctx, c }: { ctx: Input; c: Context; input: ZodInput }) => Promise>