@@ -13,10 +13,7 @@ import { SemanticInternalAttributes } from "../semanticInternalAttributes.js";
1313import type { TriggerTracer } from "../tracer.js" ;
1414import { randomUUID } from "../utils/crypto.js" ;
1515import { accessoryAttributes } from "../utils/styleAttributes.js" ;
16- import type {
17- AnyZodSchema ,
18- inferZodSchemaOutput ,
19- } from "../types/schemas.js" ;
16+ import type { AnyZodSchema , inferZodSchemaOutput } from "../types/schemas.js" ;
2017import type {
2118 CursorPageParams ,
2219 CursorPageResponse ,
@@ -106,21 +103,22 @@ export function zodfetchCursorPage<TItemSchema extends AnyZodSchema>(
106103 query . set ( "page[before]" , params . before ) ;
107104 }
108105
109- const cursorPageSchema = "_zod" in schema
110- ? z . object ( {
111- data : z . array ( schema as any ) ,
112- pagination : z . object ( {
113- next : z . string ( ) . optional ( ) ,
114- previous : z . string ( ) . optional ( ) ,
115- } ) ,
116- } )
117- : z3 . object ( {
118- data : z3 . array ( schema as any ) ,
119- pagination : z3 . object ( {
120- next : z3 . string ( ) . optional ( ) ,
121- previous : z3 . string ( ) . optional ( ) ,
122- } ) ,
123- } ) ;
106+ const cursorPageSchema =
107+ "_zod" in schema
108+ ? z . object ( {
109+ data : z . array ( schema as any ) ,
110+ pagination : z . object ( {
111+ next : z . string ( ) . optional ( ) ,
112+ previous : z . string ( ) . optional ( ) ,
113+ } ) ,
114+ } )
115+ : z3 . object ( {
116+ data : z3 . array ( schema as any ) ,
117+ pagination : z3 . object ( {
118+ next : z3 . string ( ) . optional ( ) ,
119+ previous : z3 . string ( ) . optional ( ) ,
120+ } ) ,
121+ } ) ;
124122
125123 const $url = new URL ( url ) ;
126124 $url . search = query . toString ( ) ;
@@ -147,23 +145,24 @@ export function zodfetchOffsetLimitPage<TItemSchema extends AnyZodSchema>(
147145 query . set ( "page" , String ( params . page ) ) ;
148146 }
149147
150- const offsetLimitPageSchema = "_zod" in schema
151- ? z . object ( {
152- data : z . array ( schema as any ) ,
153- pagination : z . object ( {
154- currentPage : z . coerce . number ( ) ,
155- totalPages : z . coerce . number ( ) ,
156- count : z . coerce . number ( ) ,
157- } ) ,
158- } )
159- : z3 . object ( {
160- data : z3 . array ( schema as any ) ,
161- pagination : z3 . object ( {
162- currentPage : z3 . coerce . number ( ) ,
163- totalPages : z3 . coerce . number ( ) ,
164- count : z3 . coerce . number ( ) ,
165- } ) ,
166- } ) ;
148+ const offsetLimitPageSchema =
149+ "_zod" in schema
150+ ? z . object ( {
151+ data : z . array ( schema as any ) ,
152+ pagination : z . object ( {
153+ currentPage : z . coerce . number ( ) ,
154+ totalPages : z . coerce . number ( ) ,
155+ count : z . coerce . number ( ) ,
156+ } ) ,
157+ } )
158+ : z3 . object ( {
159+ data : z3 . array ( schema as any ) ,
160+ pagination : z3 . object ( {
161+ currentPage : z3 . coerce . number ( ) ,
162+ totalPages : z3 . coerce . number ( ) ,
163+ count : z3 . coerce . number ( ) ,
164+ } ) ,
165+ } ) ;
167166
168167 const $url = new URL ( url ) ;
169168 $url . search = query . toString ( ) ;
@@ -670,8 +669,7 @@ function injectRequestIdempotencyKey(
670669 } ;
671670}
672671
673- export type ZodFetchSSEMessageValueSchema < TSchema extends AnyZodSchema = AnyZodSchema > =
674- TSchema ;
672+ export type ZodFetchSSEMessageValueSchema < TSchema extends AnyZodSchema = AnyZodSchema > = TSchema ;
675673
676674export interface ZodFetchSSEMessageCatalogSchema {
677675 [ key : string ] : AnyZodSchema ;
0 commit comments