Created
October 29, 2019 07:21
-
-
Save 9renpoto/8ade2c0f8d7abf84fd17f0ff07a47e8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql'; | |
import gql from 'graphql-tag'; | |
export type Maybe<T> = T | null; | |
export type RequireFields<T, K extends keyof T> = { [X in Exclude<keyof T, K>]?: T[X] } & { [P in K]-?: NonNullable<T[P]> }; | |
/** All built-in and custom scalars, mapped to their actual values */ | |
export type Scalars = { | |
ID: string, | |
String: string, | |
Boolean: boolean, | |
Int: number, | |
Float: number, | |
/** Date custom scalar type */ | |
Date: any, | |
}; | |
export type Cat = { | |
__typename?: 'Cat', | |
id: Scalars['ID'], | |
name: Scalars['String'], | |
age: Scalars['Float'], | |
}; | |
export type CreateCatDto = { | |
age: Scalars['Int'], | |
}; | |
export type Mutation = { | |
__typename?: 'Mutation', | |
create: Cat, | |
addRecipe: Recipe, | |
}; | |
export type MutationCreateArgs = { | |
createCatInput: CreateCatDto | |
}; | |
export type MutationAddRecipeArgs = { | |
newRecipeData: NewRecipeInput | |
}; | |
export type NewRecipeInput = { | |
title: Scalars['String'], | |
description?: Maybe<Scalars['String']>, | |
ingredients: Array<Scalars['String']>, | |
}; | |
export type Query = { | |
__typename?: 'Query', | |
cats: Array<Cat>, | |
cat: Cat, | |
recipe: Recipe, | |
}; | |
export type QueryCatArgs = { | |
id: Scalars['Float'] | |
}; | |
export type QueryRecipeArgs = { | |
id: Scalars['String'] | |
}; | |
export type Recipe = { | |
__typename?: 'Recipe', | |
id: Scalars['ID'], | |
title: Scalars['String'], | |
description?: Maybe<Scalars['String']>, | |
createdAt: Scalars['Date'], | |
updatedAt: Scalars['Date'], | |
ingredients: Array<Scalars['String']>, | |
}; | |
export type Subscription = { | |
__typename?: 'Subscription', | |
catCreated: Cat, | |
recipeAdded: Recipe, | |
}; | |
export type ResolverTypeWrapper<T> = Promise<T> | T; | |
export type ResolverFn<TResult, TParent, TContext, TArgs> = ( | |
parent: TParent, | |
args: TArgs, | |
context: TContext, | |
info: GraphQLResolveInfo | |
) => Promise<TResult> | TResult; | |
export type StitchingResolver<TResult, TParent, TContext, TArgs> = { | |
fragment: string; | |
resolve: ResolverFn<TResult, TParent, TContext, TArgs>; | |
}; | |
export type Resolver<TResult, TParent = {}, TContext = {}, TArgs = {}> = | |
| ResolverFn<TResult, TParent, TContext, TArgs> | |
| StitchingResolver<TResult, TParent, TContext, TArgs>; | |
export type SubscriptionSubscribeFn<TResult, TParent, TContext, TArgs> = ( | |
parent: TParent, | |
args: TArgs, | |
context: TContext, | |
info: GraphQLResolveInfo | |
) => AsyncIterator<TResult> | Promise<AsyncIterator<TResult>>; | |
export type SubscriptionResolveFn<TResult, TParent, TContext, TArgs> = ( | |
parent: TParent, | |
args: TArgs, | |
context: TContext, | |
info: GraphQLResolveInfo | |
) => TResult | Promise<TResult>; | |
export interface SubscriptionSubscriberObject<TResult, TKey extends string, TParent, TContext, TArgs> { | |
subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs>; | |
resolve?: SubscriptionResolveFn<TResult, { [key in TKey]: TResult }, TContext, TArgs>; | |
} | |
export interface SubscriptionResolverObject<TResult, TParent, TContext, TArgs> { | |
subscribe: SubscriptionSubscribeFn<any, TParent, TContext, TArgs>; | |
resolve: SubscriptionResolveFn<TResult, any, TContext, TArgs>; | |
} | |
export type SubscriptionObject<TResult, TKey extends string, TParent, TContext, TArgs> = | |
| SubscriptionSubscriberObject<TResult, TKey, TParent, TContext, TArgs> | |
| SubscriptionResolverObject<TResult, TParent, TContext, TArgs>; | |
export type SubscriptionResolver<TResult, TKey extends string, TParent = {}, TContext = {}, TArgs = {}> = | |
| ((...args: any[]) => SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>) | |
| SubscriptionObject<TResult, TKey, TParent, TContext, TArgs>; | |
export type TypeResolveFn<TTypes, TParent = {}, TContext = {}> = ( | |
parent: TParent, | |
context: TContext, | |
info: GraphQLResolveInfo | |
) => Maybe<TTypes>; | |
export type NextResolverFn<T> = () => Promise<T>; | |
export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs = {}> = ( | |
next: NextResolverFn<TResult>, | |
parent: TParent, | |
args: TArgs, | |
context: TContext, | |
info: GraphQLResolveInfo | |
) => TResult | Promise<TResult>; | |
/** Mapping between all available schema types and the resolvers types */ | |
export type ResolversTypes = { | |
Query: ResolverTypeWrapper<{}>, | |
Cat: ResolverTypeWrapper<Cat>, | |
ID: ResolverTypeWrapper<Scalars['ID']>, | |
String: ResolverTypeWrapper<Scalars['String']>, | |
Float: ResolverTypeWrapper<Scalars['Float']>, | |
Recipe: ResolverTypeWrapper<Recipe>, | |
Date: ResolverTypeWrapper<Scalars['Date']>, | |
Mutation: ResolverTypeWrapper<{}>, | |
CreateCatDto: CreateCatDto, | |
Int: ResolverTypeWrapper<Scalars['Int']>, | |
NewRecipeInput: NewRecipeInput, | |
Subscription: ResolverTypeWrapper<{}>, | |
Boolean: ResolverTypeWrapper<Scalars['Boolean']>, | |
}; | |
/** Mapping between all available schema types and the resolvers parents */ | |
export type ResolversParentTypes = { | |
Query: {}, | |
Cat: Cat, | |
ID: Scalars['ID'], | |
String: Scalars['String'], | |
Float: Scalars['Float'], | |
Recipe: Recipe, | |
Date: Scalars['Date'], | |
Mutation: {}, | |
CreateCatDto: CreateCatDto, | |
Int: Scalars['Int'], | |
NewRecipeInput: NewRecipeInput, | |
Subscription: {}, | |
Boolean: Scalars['Boolean'], | |
}; | |
export type CatResolvers<ContextType = any, ParentType extends ResolversParentTypes['Cat'] = ResolversParentTypes['Cat']> = { | |
id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>, | |
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>, | |
age?: Resolver<ResolversTypes['Float'], ParentType, ContextType>, | |
}; | |
export interface DateScalarConfig extends GraphQLScalarTypeConfig<ResolversTypes['Date'], any> { | |
name: 'Date' | |
} | |
export type MutationResolvers<ContextType = any, ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation']> = { | |
create?: Resolver<ResolversTypes['Cat'], ParentType, ContextType, RequireFields<MutationCreateArgs, 'createCatInput'>>, | |
addRecipe?: Resolver<ResolversTypes['Recipe'], ParentType, ContextType, RequireFields<MutationAddRecipeArgs, 'newRecipeData'>>, | |
}; | |
export type QueryResolvers<ContextType = any, ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query']> = { | |
cats?: Resolver<Array<ResolversTypes['Cat']>, ParentType, ContextType>, | |
cat?: Resolver<ResolversTypes['Cat'], ParentType, ContextType, RequireFields<QueryCatArgs, 'id'>>, | |
recipe?: Resolver<ResolversTypes['Recipe'], ParentType, ContextType, RequireFields<QueryRecipeArgs, 'id'>>, | |
}; | |
export type RecipeResolvers<ContextType = any, ParentType extends ResolversParentTypes['Recipe'] = ResolversParentTypes['Recipe']> = { | |
id?: Resolver<ResolversTypes['ID'], ParentType, ContextType>, | |
title?: Resolver<ResolversTypes['String'], ParentType, ContextType>, | |
description?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>, | |
createdAt?: Resolver<ResolversTypes['Date'], ParentType, ContextType>, | |
updatedAt?: Resolver<ResolversTypes['Date'], ParentType, ContextType>, | |
ingredients?: Resolver<Array<ResolversTypes['String']>, ParentType, ContextType>, | |
}; | |
export type SubscriptionResolvers<ContextType = any, ParentType extends ResolversParentTypes['Subscription'] = ResolversParentTypes['Subscription']> = { | |
catCreated?: SubscriptionResolver<ResolversTypes['Cat'], "catCreated", ParentType, ContextType>, | |
recipeAdded?: SubscriptionResolver<ResolversTypes['Recipe'], "recipeAdded", ParentType, ContextType>, | |
}; | |
export type Resolvers<ContextType = any> = { | |
Cat?: CatResolvers<ContextType>, | |
Date?: GraphQLScalarType, | |
Mutation?: MutationResolvers<ContextType>, | |
Query?: QueryResolvers<ContextType>, | |
Recipe?: RecipeResolvers<ContextType>, | |
Subscription?: SubscriptionResolvers<ContextType>, | |
}; | |
/** | |
* @deprecated | |
* Use "Resolvers" root object instead. If you wish to get "IResolvers", add "typesPrefix: I" to your config. | |
*/ | |
export type IResolvers<ContextType = any> = Resolvers<ContextType>; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment