@@ -2,7 +2,7 @@ import { enumerate, invariant } from '@zenstackhq/common-helpers';
22import Decimal from 'decimal.js' ;
33import stableStringify from 'json-stable-stringify' ;
44import { match , P } from 'ts-pattern' ;
5- import { z , ZodSchema , ZodType } from 'zod' ;
5+ import { z , ZodType } from 'zod' ;
66import {
77 type AttributeApplication ,
88 type BuiltinType ,
@@ -830,7 +830,7 @@ export class InputValidator<Schema extends SchemaDef> {
830830
831831 private makeCreateSchema ( model : string ) {
832832 const dataSchema = this . makeCreateDataSchema ( model , false ) ;
833- let schema : ZodSchema = z . strictObject ( {
833+ let schema : ZodType = z . strictObject ( {
834834 data : dataSchema ,
835835 select : this . makeSelectSchema ( model ) . optional ( ) ,
836836 include : this . makeIncludeSchema ( model ) . optional ( ) ,
@@ -1107,7 +1107,7 @@ export class InputValidator<Schema extends SchemaDef> {
11071107 // #region Update
11081108
11091109 private makeUpdateSchema ( model : string ) {
1110- let schema : ZodSchema = z . strictObject ( {
1110+ let schema : ZodType = z . strictObject ( {
11111111 where : this . makeWhereSchema ( model , true ) ,
11121112 data : this . makeUpdateDataSchema ( model ) ,
11131113 select : this . makeSelectSchema ( model ) . optional ( ) ,
@@ -1129,7 +1129,7 @@ export class InputValidator<Schema extends SchemaDef> {
11291129
11301130 private makeUpdateManyAndReturnSchema ( model : string ) {
11311131 const base = this . makeUpdateManySchema ( model ) ;
1132- let schema : ZodSchema = base . extend ( {
1132+ let schema : ZodType = base . extend ( {
11331133 select : this . makeSelectSchema ( model ) . optional ( ) ,
11341134 omit : this . makeOmitSchema ( model ) . optional ( ) ,
11351135 } ) ;
@@ -1138,7 +1138,7 @@ export class InputValidator<Schema extends SchemaDef> {
11381138 }
11391139
11401140 private makeUpsertSchema ( model : string ) {
1141- let schema : ZodSchema = z . strictObject ( {
1141+ let schema : ZodType = z . strictObject ( {
11421142 where : this . makeWhereSchema ( model , true ) ,
11431143 create : this . makeCreateDataSchema ( model , false ) ,
11441144 update : this . makeUpdateDataSchema ( model ) ,
@@ -1257,7 +1257,7 @@ export class InputValidator<Schema extends SchemaDef> {
12571257 // #region Delete
12581258
12591259 private makeDeleteSchema ( model : GetModels < Schema > ) {
1260- let schema : ZodSchema = z . strictObject ( {
1260+ let schema : ZodType = z . strictObject ( {
12611261 where : this . makeWhereSchema ( model , true ) ,
12621262 select : this . makeSelectSchema ( model ) . optional ( ) ,
12631263 include : this . makeIncludeSchema ( model ) . optional ( ) ,
@@ -1387,7 +1387,7 @@ export class InputValidator<Schema extends SchemaDef> {
13871387 } ) ;
13881388
13891389 // fields used in `having` must be either in the `by` list, or aggregations
1390- schema = schema . refine ( ( value ) => {
1390+ schema = schema . refine ( ( value : any ) => {
13911391 const bys = typeof value . by === 'string' ? [ value . by ] : value . by ;
13921392 if ( value . having && typeof value . having === 'object' ) {
13931393 for ( const [ key , val ] of Object . entries ( value . having ) ) {
@@ -1414,7 +1414,7 @@ export class InputValidator<Schema extends SchemaDef> {
14141414 } , 'fields in "having" must be in "by"' ) ;
14151415
14161416 // fields used in `orderBy` must be either in the `by` list, or aggregations
1417- schema = schema . refine ( ( value ) => {
1417+ schema = schema . refine ( ( value : any ) => {
14181418 const bys = typeof value . by === 'string' ? [ value . by ] : value . by ;
14191419 if (
14201420 value . orderBy &&
0 commit comments