11import { z } from 'zod'
2- import { AttributeInput , ButtonComponentType , ComponentInput , DropDownComponentInput , EventArgumentInput , EventInput , EventOptionType , HttpInput , HttpMethod , LayoutInput , PageInput , PageType , User } from '../types'
2+ import { Admin , AttributeInput , ButtonComponentType , ComponentInput , DropDownComponentInput , EventArgumentInput , EventInput , EventOptionType , Guest , HttpInput , HttpMethod , LayoutInput , PageInput , PageType , User } from '../types'
33
44type Properties < T > = Required < {
55 [ K in keyof T ] : z . ZodType < T [ K ] , any , T [ K ] > ;
@@ -11,6 +11,13 @@ export const isDefinedNonNullAny = (v: any): v is definedNonNullAny => v !== und
1111
1212export const definedNonNullAnySchema = z . any ( ) . refine ( ( v ) => isDefinedNonNullAny ( v ) ) ;
1313
14+ export function AdminSchema ( ) : z . ZodObject < Properties < Admin > > {
15+ return z . object < Properties < Admin > > ( {
16+ __typename : z . literal ( 'Admin' ) . optional ( ) ,
17+ lastModifiedAt : definedNonNullAnySchema . nullish ( )
18+ } )
19+ }
20+
1421export function AttributeInputSchema ( ) : z . ZodObject < Properties < AttributeInput > > {
1522 return z . object < Properties < AttributeInput > > ( {
1623 key : z . string ( ) . nullish ( ) ,
@@ -53,6 +60,13 @@ export function EventInputSchema(): z.ZodObject<Properties<EventInput>> {
5360
5461export const EventOptionTypeSchema = z . nativeEnum ( EventOptionType ) ;
5562
63+ export function GuestSchema ( ) : z . ZodObject < Properties < Guest > > {
64+ return z . object < Properties < Guest > > ( {
65+ __typename : z . literal ( 'Guest' ) . optional ( ) ,
66+ lastLoggedIn : definedNonNullAnySchema . nullish ( )
67+ } )
68+ }
69+
5670export function HttpInputSchema ( ) : z . ZodObject < Properties < HttpInput > > {
5771 return z . object < Properties < HttpInput > > ( {
5872 method : HttpMethodSchema . nullish ( ) ,
@@ -92,8 +106,13 @@ export function UserSchema(): z.ZodObject<Properties<User>> {
92106 createdAt : definedNonNullAnySchema . nullish ( ) ,
93107 email : z . string ( ) . nullish ( ) ,
94108 id : z . string ( ) . nullish ( ) ,
109+ kind : UserKindSchema ( ) . nullish ( ) ,
95110 name : z . string ( ) . nullish ( ) ,
96111 password : z . string ( ) . nullish ( ) ,
97112 updatedAt : definedNonNullAnySchema . nullish ( )
98113 } )
99114}
115+
116+ export function UserKindSchema ( ) {
117+ return z . union ( [ AdminSchema ( ) , GuestSchema ( ) ] )
118+ }
0 commit comments