From d59539ef69b7b5b11816d7ef38539d45f57c2cb5 Mon Sep 17 00:00:00 2001 From: Vicary A Date: Mon, 3 Feb 2025 16:47:52 +0800 Subject: [PATCH] chore(example/react): update generated files --- examples/react/api/ez.generated.ts | 31 ++++---- examples/react/next-env.d.ts | 2 +- .../react/src/graphql/schema.generated.ts | 70 +++++++++++-------- 3 files changed, 62 insertions(+), 41 deletions(-) diff --git a/examples/react/api/ez.generated.ts b/examples/react/api/ez.generated.ts index eea406d6d..8bf9cf01c 100644 --- a/examples/react/api/ez.generated.ts +++ b/examples/react/api/ez.generated.ts @@ -202,7 +202,7 @@ export interface SubscriptionSubscriberObject< TKey extends string, TParent, TContext, - TArgs + TArgs, > { subscribe: SubscriptionSubscribeFn< { [key in TKey]: TResult }, @@ -228,7 +228,7 @@ export type SubscriptionObject< TKey extends string, TParent, TContext, - TArgs + TArgs, > = | SubscriptionSubscriberObject | SubscriptionResolverObject; @@ -238,7 +238,7 @@ export type SubscriptionResolver< TKey extends string, TParent = {}, TContext = {}, - TArgs = {} + TArgs = {}, > = | (( ...args: any[] @@ -263,7 +263,7 @@ export type DirectiveResolverFn< TResult = {}, TParent = {}, TContext = {}, - TArgs = {} + TArgs = {}, > = ( next: NextResolverFn, parent: TParent, @@ -313,7 +313,7 @@ export type ResolversParentTypes = { export type DogResolvers< ContextType = EZContext, - ParentType extends ResolversParentTypes['Dog'] = ResolversParentTypes['Dog'] + ParentType extends ResolversParentTypes['Dog'] = ResolversParentTypes['Dog'], > = { id?: Resolver; name?: Resolver; @@ -323,7 +323,8 @@ export type DogResolvers< export type HumanResolvers< ContextType = EZContext, - ParentType extends ResolversParentTypes['Human'] = ResolversParentTypes['Human'] + ParentType extends + ResolversParentTypes['Human'] = ResolversParentTypes['Human'], > = { id?: Resolver; name?: Resolver; @@ -339,7 +340,8 @@ export type HumanResolvers< export type QueryResolvers< ContextType = EZContext, - ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query'] + ParentType extends + ResolversParentTypes['Query'] = ResolversParentTypes['Query'], > = { expectedError?: Resolver; expectedNullableError?: Resolver< @@ -378,7 +380,8 @@ export type QueryResolvers< export type MutationResolvers< ContextType = EZContext, - ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation'] + ParentType extends + ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation'], > = { renameDog?: Resolver< Maybe, @@ -420,7 +423,8 @@ export type MutationResolvers< export type SubscriptionResolvers< ContextType = EZContext, - ParentType extends ResolversParentTypes['Subscription'] = ResolversParentTypes['Subscription'] + ParentType extends + ResolversParentTypes['Subscription'] = ResolversParentTypes['Subscription'], > = { newNotification?: SubscriptionResolver< ResolversTypes['String'], @@ -432,7 +436,8 @@ export type SubscriptionResolvers< export type HumansConnectionResolvers< ContextType = EZContext, - ParentType extends ResolversParentTypes['HumansConnection'] = ResolversParentTypes['HumansConnection'] + ParentType extends + ResolversParentTypes['HumansConnection'] = ResolversParentTypes['HumansConnection'], > = { pageInfo?: Resolver; nodes?: Resolver, ParentType, ContextType>; @@ -441,7 +446,8 @@ export type HumansConnectionResolvers< export type PageInfoResolvers< ContextType = EZContext, - ParentType extends ResolversParentTypes['PageInfo'] = ResolversParentTypes['PageInfo'] + ParentType extends + ResolversParentTypes['PageInfo'] = ResolversParentTypes['PageInfo'], > = { hasPreviousPage?: Resolver< ResolversTypes['Boolean'], @@ -464,7 +470,8 @@ export type PageInfoResolvers< export type SpeciesResolvers< ContextType = EZContext, - ParentType extends ResolversParentTypes['Species'] = ResolversParentTypes['Species'] + ParentType extends + ResolversParentTypes['Species'] = ResolversParentTypes['Species'], > = { __resolveType: TypeResolveFn<'Human' | 'Dog', ParentType, ContextType>; }; diff --git a/examples/react/next-env.d.ts b/examples/react/next-env.d.ts index 4f11a03dc..a4a7b3f5c 100644 --- a/examples/react/next-env.d.ts +++ b/examples/react/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. diff --git a/examples/react/src/graphql/schema.generated.ts b/examples/react/src/graphql/schema.generated.ts index af6e96f2a..cb313d562 100644 --- a/examples/react/src/graphql/schema.generated.ts +++ b/examples/react/src/graphql/schema.generated.ts @@ -2,7 +2,7 @@ * GQty AUTO-GENERATED CODE: PLEASE DO NOT MODIFY MANUALLY */ -import { SchemaUnionsKey } from 'gqty'; +import { SchemaUnionsKey, type ScalarsEnumsHash } from 'gqty'; export type Maybe = T | null; export type InputMaybe = Maybe; @@ -15,24 +15,33 @@ export type MakeOptional = Omit & { export type MakeMaybe = Omit & { [SubKey in K]: Maybe; }; +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T, +> = { [_ in K]?: never }; +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never; + }; /** All built-in and custom scalars, mapped to their actual values */ export interface Scalars { - ID: string; - String: string; - Boolean: boolean; - Int: number; - Float: number; + ID: { input: string; output: string }; + String: { input: string; output: string }; + Boolean: { input: boolean; output: boolean }; + Int: { input: number; output: number }; + Float: { input: number; output: number }; /** The `Upload` scalar type represents a file upload. */ - Upload: File; + Upload: { input: File; output: File }; } /** ConnectionArgs description! */ export interface ConnectionArgs { - after?: InputMaybe; - before?: InputMaybe; - first?: InputMaybe; + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; /** @deprecated asd */ - last?: InputMaybe; + last?: InputMaybe; } /** Dog Type */ @@ -45,11 +54,11 @@ export enum DogType { /** Input Type Example XD */ export interface inputTypeExample { - a: Scalars['String']; - other?: InputMaybe; + a: Scalars['String']['input']; + other?: InputMaybe; } -export const scalarsEnumsHash: import('gqty').ScalarsEnumsHash = { +export const scalarsEnumsHash: ScalarsEnumsHash = { Boolean: true, DogType: true, ID: true, @@ -148,7 +157,7 @@ export interface Human { /** * @defaultValue `"Hello World"` */ - a?: Maybe; + a?: Maybe; }) => Maybe; id: ScalarsEnums['ID']; /** @@ -187,23 +196,28 @@ export interface Species { */ export interface Mutation { __typename?: 'Mutation'; - createHuman: (args: { id: Scalars['ID']; name: Scalars['String'] }) => Human; + createHuman: (args: { + id: ScalarsEnums['ID']; + name: ScalarsEnums['String']; + }) => Human; other: (args: { arg: inputTypeExample }) => Maybe; renameDog: (args: { /** * Dog Id */ - id: Scalars['ID']; - name: Scalars['String']; + id: ScalarsEnums['ID']; + name: ScalarsEnums['String']; }) => Maybe; renameHuman: (args: { - id: Scalars['ID']; - name: Scalars['String']; + id: ScalarsEnums['ID']; + name: ScalarsEnums['String']; }) => Maybe; sendNotification: (args: { - message: Scalars['String']; + message: ScalarsEnums['String']; }) => ScalarsEnums['Boolean']; - uploadFile: (args: { file: Scalars['Upload'] }) => ScalarsEnums['String']; + uploadFile: (args: { + file: ScalarsEnums['Upload']; + }) => ScalarsEnums['String']; } /** @@ -249,10 +263,10 @@ export interface GeneratedSchema { subscription: Subscription; } -export type MakeNullable = { - [K in keyof T]: T[K] | undefined; +export type ScalarsEnums = { + [Key in keyof Scalars]: Scalars[Key] extends { output: unknown } + ? Scalars[Key]['output'] + : never; +} & { + DogType: DogType; }; - -export interface ScalarsEnums extends MakeNullable { - DogType: DogType | undefined; -}