@@ -233,10 +233,10 @@ export class InputValidator<Schema extends SchemaDef> {
233233 } else {
234234 return match ( type )
235235 . with ( 'String' , ( ) => z . string ( ) )
236- . with ( 'Int' , ( ) => z . int ( ) )
236+ . with ( 'Int' , ( ) => z . number ( ) . int ( ) )
237237 . with ( 'Float' , ( ) => z . number ( ) )
238238 . with ( 'Boolean' , ( ) => z . boolean ( ) )
239- . with ( 'BigInt' , ( ) => z . union ( [ z . int ( ) , z . bigint ( ) ] ) )
239+ . with ( 'BigInt' , ( ) => z . union ( [ z . number ( ) . int ( ) , z . bigint ( ) ] ) )
240240 . with ( 'Decimal' , ( ) => z . union ( [ z . number ( ) , z . instanceof ( Decimal ) , z . string ( ) ] ) )
241241 . with ( 'DateTime' , ( ) => z . union ( [ z . date ( ) , z . string ( ) . datetime ( ) ] ) )
242242 . with ( 'Bytes' , ( ) => z . instanceof ( Uint8Array ) )
@@ -252,20 +252,22 @@ export class InputValidator<Schema extends SchemaDef> {
252252 }
253253 const typeDef = this . schema . typeDefs ?. [ type ] ;
254254 invariant ( typeDef , `Type definition "${ type } " not found in schema` ) ;
255- schema = z . looseObject (
256- Object . fromEntries (
257- Object . entries ( typeDef . fields ) . map ( ( [ field , def ] ) => {
258- let fieldSchema = this . makePrimitiveSchema ( def . type ) ;
259- if ( def . array ) {
260- fieldSchema = fieldSchema . array ( ) ;
261- }
262- if ( def . optional ) {
263- fieldSchema = fieldSchema . optional ( ) ;
264- }
265- return [ field , fieldSchema ] ;
266- } ) ,
267- ) ,
268- ) ;
255+ schema = z
256+ . object (
257+ Object . fromEntries (
258+ Object . entries ( typeDef . fields ) . map ( ( [ field , def ] ) => {
259+ let fieldSchema = this . makePrimitiveSchema ( def . type ) ;
260+ if ( def . array ) {
261+ fieldSchema = fieldSchema . array ( ) ;
262+ }
263+ if ( def . optional ) {
264+ fieldSchema = fieldSchema . optional ( ) ;
265+ }
266+ return [ field , fieldSchema ] ;
267+ } ) ,
268+ ) ,
269+ )
270+ . passthrough ( ) ;
269271 this . schemaCache . set ( key , schema ) ;
270272 return schema ;
271273 }
@@ -469,7 +471,7 @@ export class InputValidator<Schema extends SchemaDef> {
469471
470472 private makeDateTimeFilterSchema ( optional : boolean , withAggregations : boolean ) : ZodType {
471473 return this . makeCommonPrimitiveFilterSchema (
472- z . union ( [ z . iso . datetime ( ) , z . date ( ) ] ) ,
474+ z . union ( [ z . string ( ) . datetime ( ) , z . date ( ) ] ) ,
473475 optional ,
474476 ( ) => z . lazy ( ( ) => this . makeDateTimeFilterSchema ( optional , withAggregations ) ) ,
475477 withAggregations ? [ '_count' , '_min' , '_max' ] : undefined ,
@@ -519,7 +521,7 @@ export class InputValidator<Schema extends SchemaDef> {
519521 gte : baseSchema . optional ( ) ,
520522 not : makeThis ( ) . optional ( ) ,
521523 ...( withAggregations ?. includes ( '_count' )
522- ? { _count : this . makeNumberFilterSchema ( z . int ( ) , false , false ) . optional ( ) }
524+ ? { _count : this . makeNumberFilterSchema ( z . number ( ) . int ( ) , false , false ) . optional ( ) }
523525 : { } ) ,
524526 ...( withAggregations ?. includes ( '_avg' ) ? { _avg : commonAggSchema ( ) } : { } ) ,
525527 ...( withAggregations ?. includes ( '_sum' ) ? { _sum : commonAggSchema ( ) } : { } ) ,
@@ -1020,7 +1022,7 @@ export class InputValidator<Schema extends SchemaDef> {
10201022 return z . strictObject ( {
10211023 where : this . makeWhereSchema ( model , false ) . optional ( ) ,
10221024 data : this . makeUpdateDataSchema ( model , [ ] , true ) ,
1023- limit : z . int ( ) . nonnegative ( ) . optional ( ) ,
1025+ limit : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
10241026 } ) ;
10251027 }
10261028
@@ -1158,7 +1160,7 @@ export class InputValidator<Schema extends SchemaDef> {
11581160 return z
11591161 . object ( {
11601162 where : this . makeWhereSchema ( model , false ) . optional ( ) ,
1161- limit : z . int ( ) . nonnegative ( ) . optional ( ) ,
1163+ limit : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
11621164 } )
11631165
11641166 . optional ( ) ;
@@ -1255,10 +1257,10 @@ export class InputValidator<Schema extends SchemaDef> {
12551257 const modelDef = requireModel ( this . schema , model ) ;
12561258 const nonRelationFields = Object . keys ( modelDef . fields ) . filter ( ( field ) => ! modelDef . fields [ field ] ?. relation ) ;
12571259
1258- let schema = z . strictObject ( {
1260+ let schema : z . ZodSchema = z . strictObject ( {
12591261 where : this . makeWhereSchema ( model , false ) . optional ( ) ,
12601262 orderBy : this . orArray ( this . makeOrderBySchema ( model , false , true ) , true ) . optional ( ) ,
1261- by : this . orArray ( z . enum ( nonRelationFields ) , true ) ,
1263+ by : this . orArray ( z . enum ( nonRelationFields as [ string , ... string [ ] ] ) , true ) ,
12621264 having : this . makeHavingSchema ( model ) . optional ( ) ,
12631265 skip : this . makeSkipSchema ( ) . optional ( ) ,
12641266 take : this . makeTakeSchema ( ) . optional ( ) ,
@@ -1340,11 +1342,11 @@ export class InputValidator<Schema extends SchemaDef> {
13401342 // #region Helpers
13411343
13421344 private makeSkipSchema ( ) {
1343- return z . int ( ) . nonnegative ( ) ;
1345+ return z . number ( ) . int ( ) . nonnegative ( ) ;
13441346 }
13451347
13461348 private makeTakeSchema ( ) {
1347- return z . int ( ) ;
1349+ return z . number ( ) . int ( ) ;
13481350 }
13491351
13501352 private refineForSelectIncludeMutuallyExclusive ( schema : ZodType ) {
0 commit comments