@nestjs/graphql
- Version 13.4.2
- Published
- 2.03 MB
- 13 dependencies
- MIT license
Install
npm i @nestjs/graphqlyarn add @nestjs/graphqlpnpm add @nestjs/graphqlOverview
Nest - modern, fast, powerful node.js web framework (@graphql)
Index
Variables
- CLASS_TYPE_METADATA
- CONTEXT
- DEFINITIONS_FILE_HEADER
- FIELD_RESOLVER_MIDDLEWARE_METADATA
- FIELD_TYPENAME
- Float
- GRAPHQL_MODULE_ID
- GRAPHQL_MODULE_OPTIONS
- GRAPHQL_SDL_FILE_END
- GRAPHQL_SDL_FILE_HEADER
- GraphQLISODateTime
- GraphQLTimestamp
- ID
- Int
- PARAM_ARGS_METADATA
- RESOLVER_DELEGATE_METADATA
- RESOLVER_NAME_METADATA
- RESOLVER_PROPERTY_METADATA
- RESOLVER_REFERENCE_KEY
- RESOLVER_REFERENCE_METADATA
- RESOLVER_TYPE_METADATA
- SCALAR_NAME_METADATA
- SCALAR_TYPE_METADATA
- SUBSCRIPTION_OPTIONS_METADATA
- SUBSCRIPTION_TYPE
- TypeMetadataStorage
Functions
- addFieldMetadata()
- Args()
- ArgsType()
- Context()
- createUnionType()
- Directive()
- extend()
- Extensions()
- Field()
- HideField()
- Info()
- InputType()
- InterfaceType()
- IntersectionType()
- Mutation()
- ObjectType()
- OmitType()
- Parent()
- PartialType()
- PickType()
- Query()
- registerEnumType()
- ResolveField()
- ResolveProperty()
- Resolver()
- ResolveReference()
- Root()
- Scalar()
- Subscription()
- transformSchema()
Classes
GraphQLAstExplorer
- addSymbolIfRoot()
- explore()
- getDefaultTypes()
- getFieldTypeDefinition()
- getFunctionParameters()
- getType()
- isRoot()
- toDefinitionStructures()
- toEnumDefinitionStructure()
- toMethodDeclarationStructure()
- toObjectTypeDefinitionStructure()
- toPropertyDeclarationStructure()
- toRootSchemaDefinitionStructure()
- toScalarDefinitionStructure()
- toUnionDefinitionStructure()
- unwrapTypeIfNonNull()
Interfaces
GqlModuleOptions
- autoSchemaFile
- buildSchemaOptions
- context
- debug
- definitions
- directiveResolvers
- driver
- fieldResolverEnhancers
- include
- inheritResolversFromInterfaces
- introspection
- metadata
- path
- resolvers
- resolverValidationOptions
- schema
- sortSchema
- stopOnApplicationShutdown
- transformAutoSchemaFile
- transformResolvers
- transformSchema
- typeDefs
- typePaths
- useGlobalPrefix
Type Aliases
- ArgsOptions
- ArrayElement
- AutoSchemaFileValue
- BaseTypeOptions
- Complexity
- ComplexityEstimator
- ComplexityEstimatorArgs
- DateScalarMode
- Enhancer
- FederationConfig
- FederationVersion
- FieldOptions
- FieldType
- GenerateOptions
- GqlContextType
- GqlTypeReference
- GraphQLExecutionContext
- GraphQLSubscriptionTransportWsConfig
- GraphQLWsSubscriptionsConfig
- MutationOptions
- NextFn
- NullableList
- NumberScalarMode
- QueryOptions
- ResolveFieldOptions
- ResolverTypeFn
- ResolveTypeFn
- ReturnTypeFunc
- ReturnTypeFuncValue
- SubscriptionConfig
- SubscriptionOptions
- Union
Variables
variable CLASS_TYPE_METADATA
const CLASS_TYPE_METADATA: string;variable CONTEXT
const CONTEXT: string;variable DEFINITIONS_FILE_HEADER
const DEFINITIONS_FILE_HEADER: string;variable FIELD_RESOLVER_MIDDLEWARE_METADATA
const FIELD_RESOLVER_MIDDLEWARE_METADATA: string;variable FIELD_TYPENAME
const FIELD_TYPENAME: string;variable Float
const Float: any;variable GRAPHQL_MODULE_ID
const GRAPHQL_MODULE_ID: string;variable GRAPHQL_MODULE_OPTIONS
const GRAPHQL_MODULE_OPTIONS: string;variable GRAPHQL_SDL_FILE_END
const GRAPHQL_SDL_FILE_END: string;variable GRAPHQL_SDL_FILE_HEADER
const GRAPHQL_SDL_FILE_HEADER: string;variable GraphQLISODateTime
const GraphQLISODateTime: GraphQLScalarType<Date, string>;variable GraphQLTimestamp
const GraphQLTimestamp: GraphQLScalarType<any, number>;variable ID
const ID: any;variable Int
const Int: any;variable PARAM_ARGS_METADATA
const PARAM_ARGS_METADATA: string;variable RESOLVER_DELEGATE_METADATA
const RESOLVER_DELEGATE_METADATA: string;variable RESOLVER_NAME_METADATA
const RESOLVER_NAME_METADATA: string;variable RESOLVER_PROPERTY_METADATA
const RESOLVER_PROPERTY_METADATA: string;variable RESOLVER_REFERENCE_KEY
const RESOLVER_REFERENCE_KEY: string;variable RESOLVER_REFERENCE_METADATA
const RESOLVER_REFERENCE_METADATA: string;variable RESOLVER_TYPE_METADATA
const RESOLVER_TYPE_METADATA: string;variable SCALAR_NAME_METADATA
const SCALAR_NAME_METADATA: string;variable SCALAR_TYPE_METADATA
const SCALAR_TYPE_METADATA: string;variable SUBSCRIPTION_OPTIONS_METADATA
const SUBSCRIPTION_OPTIONS_METADATA: string;variable SUBSCRIPTION_TYPE
const SUBSCRIPTION_TYPE: string;variable TypeMetadataStorage
const TypeMetadataStorage: TypeMetadataStorageHost;Functions
function addFieldMetadata
addFieldMetadata: <T extends unknown>( typeOrOptions: ReturnTypeFunc<T> | FieldOptionsExtractor<T>, fieldOptions: FieldOptionsExtractor<T>, prototype: object, propertyKey?: string, descriptor?: TypedPropertyDescriptor<any>, loadEagerly?: boolean) => void;function Args
Args: { (): ParameterDecorator; (...pipes: any[]): ParameterDecorator; (property: string, ...pipes: any[]): ParameterDecorator; (options: ArgsOptions<any>, ...pipes: any[]): ParameterDecorator; ( property: string, options: ArgsOptions<any>, ...pipes: any[] ): ParameterDecorator;};Resolver method parameter decorator. Extracts the arguments object from the underlying platform and populates the decorated parameter with the value of either all arguments or a single specified argument.
function ArgsType
ArgsType: { (): ClassDecorator; (options: ArgsTypeOptions): ClassDecorator };Decorator that marks a class as a resolver arguments type.
function Context
Context: { (): ParameterDecorator; (...pipes: any[]): ParameterDecorator; (property: string, ...pipes: any[]): ParameterDecorator;};Resolver method parameter decorator. Extracts the
Contextobject from the underlying platform and populates the decorated parameter with the value ofContext.
function createUnionType
createUnionType: <T extends readonly Type<unknown>[] = Type<unknown>[]>( options: UnionOptions<T>) => Union<T>;Creates a GraphQL union type composed of types references.
Parameter options
function Directive
Directive: ( sdl: string | string[]) => MethodDecorator & PropertyDecorator & ClassDecorator;Adds one or more directives to a field, type, or handler. Passing an array attaches every directive in a single decorator call, equivalent to stacking multiple
@Directive(...)decorators.
function extend
extend: (obj1: unknown, obj2: unknown) => any;function Extensions
Extensions: ( value: Record<string, unknown>) => MethodDecorator & ClassDecorator & PropertyDecorator;Adds arbitrary data accessible through the "extensions" property to specified field, type, or handler.
function Field
Field: { (): PropertyDecorator & MethodDecorator; <T extends unknown>(options: FieldOptionsExtractor<T>): PropertyDecorator & MethodDecorator; <T extends unknown>( returnTypeFunction?: ReturnTypeFunc<T>, options?: FieldOptionsExtractor<T> ): PropertyDecorator & MethodDecorator;};@Field() decorator is used to mark a specific class property as a GraphQL field. Only properties decorated with this decorator will be defined in the schema.
function HideField
HideField: () => PropertyDecorator;function Info
Info: (...pipes: (Type<PipeTransform> | PipeTransform)[]) => ParameterDecorator;Resolver method parameter decorator. Extracts the
Infoobject from the underlying platform and populates the decorated parameter with the value ofInfo.
function InputType
InputType: { (): ClassDecorator; (options: InputTypeOptions): ClassDecorator; (name: string, options?: InputTypeOptions): ClassDecorator;};Decorator that marks a class as a GraphQL input type.
function InterfaceType
InterfaceType: { (options?: InterfaceTypeOptions): ClassDecorator; (name: string, options?: InterfaceTypeOptions): ClassDecorator;};Decorator that marks a class as a GraphQL interface type.
function IntersectionType
IntersectionType: <A, B>( classARef: Type<A>, classBRef: Type<B>, decorator?: ClassDecoratorFactory) => Type<A & B>;function Mutation
Mutation: { (): MethodDecorator; (name: string): MethodDecorator; (typeFunc: ReturnTypeFunc<any>, options?: MutationOptions<any>): MethodDecorator;};Mutation handler (method) Decorator. Routes specified mutation to this method.
function ObjectType
ObjectType: { (): ClassDecorator; (options: ObjectTypeOptions): ClassDecorator; (name: string, options?: ObjectTypeOptions): ClassDecorator;};Decorator that marks a class as a GraphQL type.
function OmitType
OmitType: <T, K extends keyof T>( classRef: Type<T>, keys: readonly K[], decorator?: ClassDecoratorFactory) => Type<Omit<T, K>>;function Parent
Parent: () => ParameterDecorator;Resolver method parameter decorator. Extracts the parent/root object from the underlying platform and populates the decorated parameter with the value of parent/root.
function PartialType
PartialType: <T>( classRef: Type<T>, optionsOrDecorator?: ClassDecoratorFactory | PartialTypeOptions) => Type<Partial<T>>;function PickType
PickType: <T, K extends keyof T>( classRef: Type<T>, keys: readonly K[], decorator?: ClassDecoratorFactory) => Type<Pick<T, K>>;function Query
Query: { (): MethodDecorator; (name: string): MethodDecorator; (typeFunc: ReturnTypeFunc<any>, options?: QueryOptions<any>): MethodDecorator;};Query handler (method) Decorator. Routes specified query to this method.
function registerEnumType
registerEnumType: <T extends object = any>( enumRef: T, options?: EnumOptions<T>) => void;Registers a GraphqQL enum type based on the passed enumerator reference.
Parameter options
function ResolveField
ResolveField: { (typeFunc?: ReturnTypeFunc, options?: ResolveFieldOptions): MethodDecorator; ( propertyName?: string, typeFunc?: ReturnTypeFunc<any>, options?: ResolveFieldOptions<any> ): MethodDecorator;};Field resolver (method) Decorator.
Property resolver (method) Decorator.
function ResolveProperty
ResolveProperty: { (typeFunc?: ReturnTypeFunc, options?: ResolveFieldOptions): MethodDecorator; ( propertyName?: string, typeFunc?: ReturnTypeFunc<any>, options?: ResolveFieldOptions<any> ): MethodDecorator;};Property resolver (method) Decorator.
function Resolver
Resolver: { (): MethodDecorator & ClassDecorator; (name: string): MethodDecorator & ClassDecorator; (options: ResolverOptions): MethodDecorator & ClassDecorator; (classType: Function, options?: ResolverOptions): MethodDecorator & ClassDecorator; (typeFunc: ResolverTypeFn, options?: ResolverOptions): MethodDecorator & ClassDecorator;};Object resolver decorator.
function ResolveReference
ResolveReference: () => MethodDecorator;Property reference resolver (method) Decorator.
function Root
Root: () => ParameterDecorator;Resolver method parameter decorator. Extracts the parent/root object from the underlying platform and populates the decorated parameter with the value of parent/root.
function Scalar
Scalar: { (name: string): ClassDecorator; (name: string, typeFunc: ReturnTypeFunc<any>): ClassDecorator;};Decorator that marks a class as a GraphQL scalar.
function Subscription
Subscription: { (): MethodDecorator; (name: string): MethodDecorator; ( name: string, options: Pick<SubscriptionOptions<any>, 'filter' | 'resolve'> ): MethodDecorator; ( typeFunc: ReturnTypeFunc<any>, options?: SubscriptionOptions<any> ): MethodDecorator;};Subscription handler (method) Decorator. Routes subscriptions to this method.
function transformSchema
transformSchema: ( schema: GraphQLSchema, transformType: TypeTransformer) => GraphQLSchema;Classes
class AbstractGraphQLDriver
abstract class AbstractGraphQLDriver< TOptions extends Record<string, any> = GqlModuleOptions> implements GraphQLDriver<TOptions> {}property applicationConfig
protected readonly applicationConfig?: ApplicationConfig;property graphQlFactory
protected readonly graphQlFactory: GraphQLFactory;property httpAdapterHost
protected readonly httpAdapterHost: HttpAdapterHost;method generateSchema
generateSchema: (options: TOptions) => Promise<GraphQLSchema> | null;method getNormalizedPath
protected getNormalizedPath: (options: TOptions) => string;method mergeDefaultOptions
mergeDefaultOptions: ( options: TOptions, defaults?: Record<string, any>) => Promise<TOptions>;method start
abstract start: (options: TOptions) => Promise<unknown>;method stop
abstract stop: () => Promise<void>;method subscriptionWithFilter
subscriptionWithFilter: ( instanceRef: unknown, filterFn: ( payload: any, variables: any, context: any ) => boolean | Promise<boolean>, createSubscribeContext: Function) => any;class BaseExplorerService
class BaseExplorerService {}method flatMap
flatMap: <T = ResolverMetadata>( modules: Module[], callback: (instance: InstanceWrapper, moduleRef: Module) => T | T[]) => T[];method getModules
getModules: ( modulesContainer: Map<string, Module> | undefined, include: Function[]) => Module[];method groupMetadata
groupMetadata: (resolvers: ResolverMetadata[]) => any;method includeWhitelisted
includeWhitelisted: ( modulesContainer: Map<string, Module>, include: Function[]) => Module[];class FileSystemHelper
class FileSystemHelper {}method getDirs
getDirs: (path: string) => string[];method mkdirRecursive
mkdirRecursive: (path: string) => Promise<void>;method writeFile
writeFile: (path: string, content: string) => Promise<void>;class GqlArgumentsHost
class GqlArgumentsHost extends ExecutionContextHost implements GraphQLArgumentsHost {}method create
static create: (context: ArgumentsHost) => GqlArgumentsHost;method getArgs
getArgs: <T = any>() => T;method getContext
getContext: <T = any>() => T;method getInfo
getInfo: <T = any>() => T;method getRoot
getRoot: <T = any>() => T;class GqlExecutionContext
class GqlExecutionContext extends ExecutionContextHost implements GraphQLArgumentsHost {}method create
static create: (context: ExecutionContext) => GqlExecutionContext;method getArgs
getArgs: <T = any>() => T;method getContext
getContext: <T = any>() => T;method getInfo
getInfo: <T = any>() => T;method getRoot
getRoot: <T = any>() => T;method getType
getType: <TContext extends string = any>() => TContext;class GqlSubscriptionService
class GqlSubscriptionService {}constructor
constructor(options: GqlSubscriptionServiceOptions, httpServer: any);method stop
stop: () => Promise<void>;class GraphQLAstExplorer
class GraphQLAstExplorer {}method addSymbolIfRoot
addSymbolIfRoot: (name: string) => string;method explore
explore: ( documentNode: DocumentNode, outputPath: string, mode: 'class' | 'interface', options?: DefinitionsGeneratorOptions) => Promise<SourceFile>;method getDefaultTypes
getDefaultTypes: (options: DefinitionsGeneratorOptions) => { [type: string]: string;};method getFieldTypeDefinition
getFieldTypeDefinition: ( typeNode: TypeNode, options: DefinitionsGeneratorOptions) => { name: string; required: boolean };method getFunctionParameters
getFunctionParameters: ( inputs: ReadonlyArray<InputValueDefinitionNode>, options: DefinitionsGeneratorOptions) => ParameterDeclarationStructure[];method getType
getType: (typeName: string, options: DefinitionsGeneratorOptions) => string;method isRoot
isRoot: (name: string) => boolean;method toDefinitionStructures
toDefinitionStructures: ( item: Readonly<TypeSystemDefinitionNode | TypeSystemExtensionNode>, mode: 'class' | 'interface', options: DefinitionsGeneratorOptions) => | ClassDeclarationStructure | InterfaceDeclarationStructure | TypeAliasDeclarationStructure | EnumDeclarationStructure;method toEnumDefinitionStructure
toEnumDefinitionStructure: ( item: EnumTypeDefinitionNode | EnumTypeExtensionNode, options: DefinitionsGeneratorOptions) => TypeAliasDeclarationStructure | EnumDeclarationStructure;method toMethodDeclarationStructure
toMethodDeclarationStructure: ( item: FieldDefinitionNode | InputValueDefinitionNode, mode: 'class' | 'interface', options: DefinitionsGeneratorOptions) => OptionalKind<MethodDeclarationStructure> & OptionalKind<MethodSignatureStructure>;method toObjectTypeDefinitionStructure
toObjectTypeDefinitionStructure: ( item: | ObjectTypeDefinitionNode | ObjectTypeExtensionNode | InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode | InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode, mode: 'class' | 'interface', options: DefinitionsGeneratorOptions) => ClassDeclarationStructure | InterfaceDeclarationStructure;method toPropertyDeclarationStructure
toPropertyDeclarationStructure: ( item: FieldDefinitionNode | InputValueDefinitionNode, options: DefinitionsGeneratorOptions) => OptionalKind<PropertyDeclarationStructure> & OptionalKind<PropertySignatureStructure>;method toRootSchemaDefinitionStructure
toRootSchemaDefinitionStructure: ( operationTypes: ReadonlyArray<OperationTypeDefinitionNode>, mode: 'class' | 'interface') => ClassDeclarationStructure | InterfaceDeclarationStructure;method toScalarDefinitionStructure
toScalarDefinitionStructure: ( item: ScalarTypeDefinitionNode | ScalarTypeExtensionNode, options: DefinitionsGeneratorOptions) => TypeAliasDeclarationStructure;method toUnionDefinitionStructure
toUnionDefinitionStructure: ( item: UnionTypeDefinitionNode | UnionTypeExtensionNode, options: DefinitionsGeneratorOptions) => TypeAliasDeclarationStructure;method unwrapTypeIfNonNull
unwrapTypeIfNonNull: (type: TypeNode) => { type: TypeNode; required: boolean };class GraphQLDefinitionsFactory
class GraphQLDefinitionsFactory {}property gqlAstExplorer
protected readonly gqlAstExplorer: GraphQLAstExplorer;property gqlTypesLoader
protected readonly gqlTypesLoader: GraphQLTypesLoader;method exploreAndEmit
protected exploreAndEmit: ( typePaths: string[], path: string, outputAs: 'class' | 'interface', isDebugEnabled: boolean, definitionsGeneratorOptions: DefinitionsGeneratorOptions, typeDefs?: string | string[]) => Promise<void>;method generate
generate: (options: GenerateOptions) => Promise<void>;method printMessage
protected printMessage: (text: string, isEnabled: boolean) => void;class GraphQLFactory
class GraphQLFactory {}constructor
constructor( resolversExplorerService: ResolversExplorerService, scalarsExplorerService: ScalarsExplorerService, graphqlAstExplorer: GraphQLAstExplorer, gqlSchemaBuilder: GraphQLSchemaBuilder);method generateDefinitions
generateDefinitions: ( typeDefs: string | string[], options: GqlModuleOptions) => Promise<void>;method generateSchema
generateSchema: <T extends GqlModuleOptions<any>>( options?: T) => Promise<GraphQLSchema>;class GraphQLFederationDefinitionsFactory
class GraphQLFederationDefinitionsFactory extends GraphQLDefinitionsFactory {}method exploreAndEmit
protected exploreAndEmit: ( typePaths: string[], path: string, outputAs: 'class' | 'interface', isDebugEnabled: boolean, definitionsGeneratorOptions: DefinitionsGeneratorOptions, typeDefs?: string | string[]) => Promise<void>;class GraphQLFederationFactory
class GraphQLFederationFactory {}constructor
constructor( resolversExplorerService: ResolversExplorerService, scalarsExplorerService: ScalarsExplorerService, gqlSchemaBuilder: GraphQLSchemaBuilder, typeDefsDecoratorFactory: TypeDefsDecoratorFactory);method buildFederatedSchema
buildFederatedSchema: <T extends GqlModuleOptions<any>>( autoSchemaFile: AutoSchemaFileValue, options: T, resolvers: Function[]) => Promise<GraphQLSchema>;method generateSchema
generateSchema: <T extends GqlModuleOptions<any>>( options?: T, buildFederatedSchema?: ( options: BuildFederatedSchemaOptions ) => GraphQLSchema) => Promise<GraphQLSchema>;class GraphQLModule
class GraphQLModule<TAdapter extends AbstractGraphQLDriver = AbstractGraphQLDriver> implements OnModuleInit, OnModuleDestroy, OnApplicationShutdown {}constructor
constructor( httpAdapterHost: HttpAdapterHost, options: GqlModuleOptions<any>, _graphQlAdapter: AbstractGraphQLDriver<GqlModuleOptions<any>>, graphQlTypesLoader: GraphQLTypesLoader, gqlSchemaHost: GraphQLSchemaHost);property completeOptions
completeOptions: GqlModuleOptions<any>;property graphQlAdapter
readonly graphQlAdapter: AbstractGraphQLDriver<GqlModuleOptions<any>>;method forRoot
static forRoot: <TOptions extends Record<string, any> = GqlModuleOptions<any>>( options?: TOptions) => DynamicModule;method forRootAsync
static forRootAsync: < TOptions extends Record<string, any> = GqlModuleOptions<any>>( options: GqlModuleAsyncOptions<TOptions, GqlOptionsFactory<TOptions>>) => DynamicModule;method onApplicationShutdown
onApplicationShutdown: () => Promise<void>;method onModuleDestroy
onModuleDestroy: () => Promise<void>;method onModuleInit
onModuleInit: () => Promise<void>;class GraphQLSchemaBuilderModule
class GraphQLSchemaBuilderModule {}class GraphQLSchemaFactory
class GraphQLSchemaFactory {}constructor
constructor( queryTypeFactory: QueryTypeFactory, mutationTypeFactory: MutationTypeFactory, subscriptionTypeFactory: SubscriptionTypeFactory, orphanedTypesFactory: OrphanedTypesFactory, typeDefinitionsGenerator: TypeDefinitionsGenerator);method create
create: { (resolvers: Function[]): Promise<GraphQLSchema>; (resolvers: Function[], scalarClasses: Function[]): Promise<GraphQLSchema>; (resolvers: Function[], options: BuildSchemaOptions): Promise<GraphQLSchema>; ( resolvers: Function[], scalarClasses: Function[], options: BuildSchemaOptions ): Promise<GraphQLSchema>;};class GraphQLSchemaHost
class GraphQLSchemaHost {}property schema
schema: GraphQLSchema;class GraphQLTypesLoader
class GraphQLTypesLoader {}method mergeTypesByPaths
mergeTypesByPaths: (paths: string | string[]) => Promise<string>;Interfaces
interface AliasDirectiveImport
interface AliasDirectiveImport {}interface ArgsTypeOptions
interface ArgsTypeOptions {}Interface defining options that can be passed to
@ArgsType()decorator.
property registerIn
registerIn?: RegisterInOption;NestJS module that this type belongs to. When specified, this type will only be included in GraphQL schemas that include this module via the
includeoption.See Also
RegisterInOption for details
interface BuildFederatedSchemaOptions
interface BuildFederatedSchemaOptions {}interface BuildSchemaOptions
interface BuildSchemaOptions {}property addNewlineAtEnd
addNewlineAtEnd?: boolean;Add new line at the end of the generated GraphQL SDL file
property dateScalarMode
dateScalarMode?: DateScalarMode;Date scalar mode 'isoDate'
property directives
directives?: GraphQLDirective[];GraphQL directives
property fieldMiddleware
fieldMiddleware?: FieldMiddleware[];Array of global field middleware functions
property noDuplicatedFields
noDuplicatedFields?: boolean;Set to true if it should throw an error when the same Query / Mutation field is defined more than once
property numberScalarMode
numberScalarMode?: NumberScalarMode;Number scalar mode 'float'
property orphanedTypes
orphanedTypes?: (Function | object)[];Orphaned type classes/enums that are not explicitly used in GraphQL types definitions
property scalarsMap
scalarsMap?: ScalarsTypeMap[];Scalars map
property skipCheck
skipCheck?: boolean;Disable checking on build the correctness of a schema
interface CustomScalar
interface CustomScalar<T, K> {}property description
description?: string;property extensions
extensions?: Record<string, unknown>;Arbitrary metadata attached to the scalar, accessible through the generated
GraphQLScalarType'sextensionsfield.
property parseLiteral
parseLiteral: ( valueNode: ValueNode, variables?: { [key: string]: any; } | null) => K | null | undefined;property parseValue
parseValue: (value: unknown) => K | null | undefined;property serialize
serialize: (value: unknown) => T | null | undefined;property specifiedByURL
specifiedByURL?: string;URL pointing to the specification for this scalar (emitted as the
@specifiedBy(url: ...)directive in the generated SDL).
interface DefinitionsGeneratorOptions
interface DefinitionsGeneratorOptions {}property additionalHeader
additionalHeader?: string;If provided, specifies a custom header to add after the to the output file (eg. for custom type imports or comments) undefined
property customScalarTypeMapping
customScalarTypeMapping?: Record< string, | string | { name: string; }>;If provided, specifies a mapping of types to use for custom scalars undefined
property defaultScalarType
defaultScalarType?: string;If provided, specifies a default generated TypeScript type for custom scalars. 'any'
property defaultTypeMapping
defaultTypeMapping?: Partial< Record<'ID' | 'Float' | 'Int', 'string' | 'number'> & Record<'Boolean' | 'String', 'boolean' | 'string' | 'number'>>;If provided, specifies a mapping of default scalar types (Int, Boolean, ID, Float, String). undefined
property emitTypenameField
emitTypenameField?: boolean;If true, the additional "__typename" field is generated for every object type. false
property enumsAsTypes
enumsAsTypes?: boolean;If true, enums are generated as string literal union types. false
property skipResolverArgs
skipResolverArgs?: boolean;If true, resolvers (query/mutation/etc) are generated as plain fields without arguments. false
property typeName
typeName?: (name: string) => string;If provided, specifies a function to transform type names.
Example 1
(name) =>
${name}Schemaundefined
interface EnumOptions
interface EnumOptions<T extends object = any> {}Interface defining options that can be passed to
registerEnumTypefunction.
property description
description?: string;Description of the enum.
property directives
directives?: string[];An array of directive SDL strings (e.g.
['@tag(name: "internal")']) to be applied on the generated enum type.
property name
name: string;Name of the enum.
property registerIn
registerIn?: RegisterInOption;NestJS module that this enum belongs to. When specified, this enum will only be included in GraphQL schemas that include this module via the
includeoption.See Also
RegisterInOption for details
property valuesMap
valuesMap?: EnumMetadataValuesMap<T>;A map of options for the values of the enum.
interface Federation2Config
interface Federation2Config {}property directives
directives?: (string | AliasDirectiveImport)[];The imported directives ['@authenticated', '@cacheTag', '@composeDirective', '@context', '@cost', '@extends', '@external', '@fromContext', '@inaccessible', '@interfaceObject', '@key', '@listSize', '@override', '@policy', '@provides', '@requires', '@requiresScopes', '@shareable', '@tag']
property importUrl
importUrl?: string;The import link 'https://specs.apollo.dev/federation/v2.12'
property version
version: 2;interface FieldMiddleware
interface FieldMiddleware< TSource = any, TContext = any, TArgs = { [argName: string]: any; }, TOutput = any> {}call signature
(ctx: MiddlewareContext<TSource, TContext, TArgs>, next: NextFn): | Promise<TOutput> | TOutput;interface GqlExceptionFilter
interface GqlExceptionFilter<TInput = any, TOutput = any> {}Interface defining a GraphQL exception filter.
method catch
catch: (exception: TInput, host: ArgumentsHost) => TOutput;interface GqlModuleAsyncOptions
interface GqlModuleAsyncOptions< TOptions extends Record<string, any> = GqlModuleOptions, TFactory = GqlOptionsFactory<TOptions>> extends Pick<ModuleMetadata, 'imports'> {}property driver
driver?: TOptions['driver'];GraphQL server driver
property inject
inject?: any[];property useClass
useClass?: Type<TFactory>;property useExisting
useExisting?: Type<TFactory>;property useFactory
useFactory?: ( ...args: any[]) => Promise<Omit<TOptions, 'driver'>> | Omit<TOptions, 'driver'>;interface GqlModuleOptions
interface GqlModuleOptions<TDriver extends GraphQLDriver = any> {}"GraphQLModule" options object.
property autoSchemaFile
autoSchemaFile?: AutoSchemaFileValue;If enabled, GraphQL schema will be generated automatically
property buildSchemaOptions
buildSchemaOptions?: BuildSchemaOptions;Options to be passed to the schema generator Only applicable if "autoSchemaFile" = true
property context
context?: any;Context function
property debug
debug?: boolean;If
true, enables development mode helpers and logs messages of all severity levels Iffalse, only warn- and error-level messages are logged. true
property definitions
definitions?: { path?: string; outputAs?: 'class' | 'interface';} & DefinitionsGeneratorOptions;TypeScript definitions generator options
property directiveResolvers
directiveResolvers?: any;Directive resolvers
property driver
driver?: Type<TDriver>;GraphQL server adapter
property fieldResolverEnhancers
fieldResolverEnhancers?: Enhancer[];Enable/disable enhancers for @ResolveField()
property include
include?: Function[];An array of modules to scan when searching for resolvers
property inheritResolversFromInterfaces
inheritResolversFromInterfaces?: boolean;Inherit missing resolvers from their interface types defined in the resolvers object.
property introspection
introspection?: boolean;If
true, enables schema introspection by clients. Default istrueunlessNODE_ENVis set toproductiontrue
property metadata
metadata?: () => Promise<Record<string, any>>;Extra static metadata to be loaded into the specification
property path
path?: string;Path to mount GraphQL API
property resolvers
resolvers?: IResolvers | Array<IResolvers>;Extra resolvers to be registered.
property resolverValidationOptions
resolverValidationOptions?: IResolverValidationOptions;Resolver validation options.
property schema
schema?: GraphQLSchema;Optional GraphQL schema (to be used or to be merged)
property sortSchema
sortSchema?: boolean;Sort the schema lexicographically
property stopOnApplicationShutdown
stopOnApplicationShutdown?: boolean;If
true, the GraphQL server will stop duringonApplicationShutdowninstead ofonModuleDestroy. This allows the server to keep accepting requests duringbeforeApplicationShutdown, enabling graceful shutdown. false
property transformAutoSchemaFile
transformAutoSchemaFile?: boolean;Apply
transformSchemato theautoSchemaFile
property transformResolvers
transformResolvers?: ( resolvers: IResolvers | Array<IResolvers>) => | IResolvers | Array<IResolvers> | Promise<IResolvers> | Promise<Array<IResolvers>>;Function to be applied to the discovered resolvers letting you perform compositions.
property transformSchema
transformSchema?: ( schema: GraphQLSchema) => GraphQLSchema | Promise<GraphQLSchema>;Function to be applied to the schema letting you register custom transformations.
property typeDefs
typeDefs?: string | string[];Type definitions
property typePaths
typePaths?: string[];Paths to files that contain GraphQL definitions
property useGlobalPrefix
useGlobalPrefix?: boolean;Prepends the global prefix to the url
See Also
[faq/global-prefix](Global Prefix)
interface GqlOptionsFactory
interface GqlOptionsFactory<T extends Record<string, any> = GqlModuleOptions> {}method createGqlOptions
createGqlOptions: () => Promise<Omit<T, 'driver'>> | Omit<T, 'driver'>;interface GqlSubscriptionServiceOptions
interface GqlSubscriptionServiceOptions extends SubscriptionConfig {}interface GraphQLArgumentsHost
interface GraphQLArgumentsHost extends ArgumentsHost {}method getArgs
getArgs: <T = any>() => T;method getContext
getContext: <T = any>() => T;method getInfo
getInfo: <T = any>() => T;method getRoot
getRoot: <T = any>() => T;interface GraphQLDriver
interface GraphQLDriver<TOptions = any> {}interface InputTypeOptions
interface InputTypeOptions {}Interface defining options that can be passed to
@InputType()decorator.
property description
description?: string;Description of the input type.
property isAbstract
isAbstract?: boolean;If
true, type will not be registered in the schema.
property isOneOf
isOneOf?: boolean;If 'true', the input type will be '@oneOf' type. More info about '@oneOf' types in the [GraphQL spec](https://spec.graphql.org/September2025/#sec-OneOf-Input-Objects).
property registerIn
registerIn?: RegisterInOption;NestJS module that this type belongs to. When specified, this type will only be included in GraphQL schemas that include this module via the
includeoption.See Also
RegisterInOption for details
interface InterfaceTypeOptions
interface InterfaceTypeOptions {}Interface defining options that can be passed to
@InterfaceType()decorator.
property description
description?: string;Description of the argument.
property implements
implements?: Function | Function[] | (() => Function | Function[]);Interfaces implemented by this interface.
property isAbstract
isAbstract?: boolean;If
true, type will not be registered in the schema.
property registerIn
registerIn?: RegisterInOption;NestJS module that this type belongs to. When specified, this type will only be included in GraphQL schemas that include this module via the
includeoption.See Also
RegisterInOption for details
property resolveType
resolveType?: ResolveTypeFn<any, any>;Custom implementation of the "resolveType" function.
interface MiddlewareContext
interface MiddlewareContext< TSource = any, TContext = any, TArgs = { [argName: string]: any; }> {}interface ObjectTypeOptions
interface ObjectTypeOptions {}Interface defining options that can be passed to
@ObjectType()decorator
property description
description?: string;Description of the input type.
property implements
implements?: Function | Function[] | (() => Function | Function[]);Interfaces implemented by this object type.
property inheritDescription
inheritDescription?: boolean;If
true, direct descendant classes will inherit the parent's description if own description is not set. Also works on classes marked withisAbstract: true.
property isAbstract
isAbstract?: boolean;If
true, type will not be registered in the schema.
property registerIn
registerIn?: RegisterInOption;NestJS module that this type belongs to. When specified, this type will only be included in GraphQL schemas that include this module via the
includeoption.See Also
RegisterInOption for details
interface ResolverOptions
interface ResolverOptions {}Interface defining options that can be passed to
@Resolve()decorator
property isAbstract
isAbstract?: boolean;If
true, type will not be registered in the schema.
interface ScalarsTypeMap
interface ScalarsTypeMap {}interface SchemaFileConfig
interface SchemaFileConfig {}property federation
federation?: FederationVersion | FederationConfig;Federation version and its configuration,
1
property path
path?: string;Path to the schema file.
interface UnionOptions
interface UnionOptions<T extends readonly Type<unknown>[] = Type<unknown>[]> {}Interface defining options that can be passed to
createUnionTypefunction.
property description
description?: string;Description of the union.
property directives
directives?: string[];An array of directive SDL strings (e.g.
['@tag(name: "internal")']) to be applied on the generated union type.
property name
name?: string;Name of the union.
property registerIn
registerIn?: RegisterInOption;NestJS module that this union belongs to. When specified, this union will only be included in GraphQL schemas that include this module via the
includeoption.See Also
RegisterInOption for details
property resolveType
resolveType?: ResolveTypeFn<any, any>;Custom implementation of the "resolveType" function.
property types
types: () => T;Types that the union consist of.
Type Aliases
type ArgsOptions
type ArgsOptions<T = any> = BaseTypeOptions<T> & { /** * Name of the argument. */ name?: string; /** * Description of the argument. */ description?: string; /** * Argument deprecation reason (if deprecated). */ deprecationReason?: string; /** * Function that returns a reference to the arguments host class. */ type?: () => any;};Interface defining options that can be passed to
@Args()decorator.
type ArrayElement
type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType[number];type AutoSchemaFileValue
type AutoSchemaFileValue = boolean | string | SchemaFileConfig;type BaseTypeOptions
type BaseTypeOptions<T = any> = NonNullableBaseType<T> | NullableBaseType<T>;type Complexity
type Complexity = ComplexityEstimator | number;type ComplexityEstimator
type ComplexityEstimator = (options: ComplexityEstimatorArgs) => number | void;type ComplexityEstimatorArgs
type ComplexityEstimatorArgs = { type: GraphQLCompositeType; field: GraphQLField<any, any>; args: { [key: string]: any; }; childComplexity: number;};type DateScalarMode
type DateScalarMode = 'isoDate' | 'timestamp';type Enhancer
type Enhancer = 'guards' | 'interceptors' | 'filters';type FederationConfig
type FederationConfig = Federation2Config;type FederationVersion
type FederationVersion = 1 | 2;type FieldOptions
type FieldOptions<T = any> = BaseTypeOptions<T> & { /** * Name of the field. */ name?: string; /** * Description of the field. */ description?: string; /** * Field deprecation reason (if deprecated). */ deprecationReason?: string; /** * Field complexity options. */ complexity?: Complexity; /** * Array of middleware to apply. */ middleware?: FieldMiddleware[];};Interface defining options that can be passed to
@Field()decorator.
type FieldType
type FieldType<T> = T;type GenerateOptions
type GenerateOptions = DefinitionsGeneratorOptions & { typePaths: string[]; path: string; outputAs?: 'class' | 'interface'; watch?: boolean; debug?: boolean; typeDefs?: string | string[];};type GqlContextType
type GqlContextType = 'graphql' | ContextType;type GqlTypeReference
type GqlTypeReference<T = any> = | Type<T> | GraphQLScalarType | Function | object | symbol | string;type GraphQLExecutionContext
type GraphQLExecutionContext = GqlExecutionContext;type GraphQLSubscriptionTransportWsConfig
type GraphQLSubscriptionTransportWsConfig = Partial< Pick< SubscriptionTransportWsServerOptions, 'onConnect' | 'onDisconnect' | 'onOperation' | 'keepAlive' >> & { path?: string;};type GraphQLWsSubscriptionsConfig
type GraphQLWsSubscriptionsConfig = Partial< Pick< ServerOptions, | 'connectionInitWaitTimeout' | 'onConnect' | 'onDisconnect' | 'onClose' | 'onSubscribe' | 'onNext' >> & { path?: string;};type MutationOptions
type MutationOptions<T = any> = BaseTypeOptions<T> & { /** * Name of the mutation. */ name?: string; /** * Description of the mutation. */ description?: string; /** * Mutation deprecation reason (if deprecated). */ deprecationReason?: string; /** * Mutation complexity options. */ complexity?: Complexity;};Interface defining options that can be passed to
@Mutation()decorator.
type NextFn
type NextFn<T = any> = () => Promise<T>;type NullableList
type NullableList = 'items' | 'itemsAndList';type NumberScalarMode
type NumberScalarMode = 'float' | 'integer';type QueryOptions
type QueryOptions<T = any> = BaseTypeOptions<T> & { /** * Name of the query. */ name?: string; /** * Description of the query. */ description?: string; /** * Query deprecation reason (if deprecated). */ deprecationReason?: string; /** * Query complexity options. */ complexity?: Complexity;};Interface defining options that can be passed to
@Query()decorator.
type ResolveFieldOptions
type ResolveFieldOptions<T = any> = BaseTypeOptions<T> & { /** * Name of the field. */ name?: string; /** * Description of the field. */ description?: string; /** * Field deprecation reason (if deprecated). */ deprecationReason?: string; /** * Field complexity options. */ complexity?: Complexity; /** * Array of middleware to apply. */ middleware?: FieldMiddleware[];};Interface defining options that can be passed to
@ResolveField()decorator.
type ResolverTypeFn
type ResolverTypeFn = (of?: void) => Function;type ResolveTypeFn
type ResolveTypeFn<TSource = any, TContext = any> = ( ...args: Parameters<GraphQLTypeResolver<TSource, TContext>>) => any;type ReturnTypeFunc
type ReturnTypeFunc<T extends ReturnTypeFuncValue = any> = (returns?: void) => T;type ReturnTypeFuncValue
type ReturnTypeFuncValue = GqlTypeReference | [GqlTypeReference];type SubscriptionConfig
type SubscriptionConfig = { 'graphql-ws'?: GraphQLWsSubscriptionsConfig | boolean; 'subscriptions-transport-ws'?: GraphQLSubscriptionTransportWsConfig | boolean;};type SubscriptionOptions
type SubscriptionOptions<T = any> = BaseTypeOptions<T> & { /** * Name of the subscription. */ name?: string; /** * Description of the subscription. */ description?: string; /** * Subscription deprecation reason (if deprecated). */ deprecationReason?: string; /** * Filter messages function. */ filter?: ( payload: any, variables: any, context: any ) => boolean | Promise<boolean>; /** * Resolve messages function (to transform payload/message shape). */ resolve?: ( payload: any, args: any, context: any, info: any ) => any | Promise<any>;};Interface defining options that can be passed to
@Subscription()decorator.
type Union
type Union<T extends readonly any[]> = InstanceType<ArrayElement<T>>;Package Files (65)
- dist/decorators/args-type.decorator.d.ts
- dist/decorators/args.decorator.d.ts
- dist/decorators/context.decorator.d.ts
- dist/decorators/directive.decorator.d.ts
- dist/decorators/extensions.decorator.d.ts
- dist/decorators/field.decorator.d.ts
- dist/decorators/hide-field.decorator.d.ts
- dist/decorators/info.decorator.d.ts
- dist/decorators/input-type.decorator.d.ts
- dist/decorators/interface-type.decorator.d.ts
- dist/decorators/mutation.decorator.d.ts
- dist/decorators/object-type.decorator.d.ts
- dist/decorators/parent.decorator.d.ts
- dist/decorators/query.decorator.d.ts
- dist/decorators/resolve-field.decorator.d.ts
- dist/decorators/resolve-property.decorator.d.ts
- dist/decorators/resolve-reference.decorator.d.ts
- dist/decorators/resolver.decorator.d.ts
- dist/decorators/root.decorator.d.ts
- dist/decorators/scalar.decorator.d.ts
- dist/decorators/subscription.decorator.d.ts
- dist/drivers/abstract-graphql.driver.d.ts
- dist/federation/graphql-federation-definitions.factory.d.ts
- dist/federation/graphql-federation.factory.d.ts
- dist/graphql-ast.explorer.d.ts
- dist/graphql-definitions.factory.d.ts
- dist/graphql-schema.host.d.ts
- dist/graphql-types.loader.d.ts
- dist/graphql.constants.d.ts
- dist/graphql.factory.d.ts
- dist/graphql.module.d.ts
- dist/index.d.ts
- dist/interfaces/base-type-options.interface.d.ts
- dist/interfaces/build-federated-schema-options.interface.d.ts
- dist/interfaces/build-schema-options.interface.d.ts
- dist/interfaces/complexity.interface.d.ts
- dist/interfaces/custom-scalar.interface.d.ts
- dist/interfaces/field-middleware.interface.d.ts
- dist/interfaces/gql-exception-filter.interface.d.ts
- dist/interfaces/gql-module-options.interface.d.ts
- dist/interfaces/graphql-driver.interface.d.ts
- dist/interfaces/resolve-type-fn.interface.d.ts
- dist/interfaces/return-type-func.interface.d.ts
- dist/interfaces/schema-file-config.interface.d.ts
- dist/scalars/index.d.ts
- dist/scalars/iso-date.scalar.d.ts
- dist/scalars/timestamp.scalar.d.ts
- dist/schema-builder/graphql-schema.factory.d.ts
- dist/schema-builder/helpers/file-system.helper.d.ts
- dist/schema-builder/schema-builder.module.d.ts
- dist/schema-builder/storages/type-metadata.storage.d.ts
- dist/services/base-explorer.service.d.ts
- dist/services/gql-arguments-host.d.ts
- dist/services/gql-execution-context.d.ts
- dist/services/gql-subscription.service.d.ts
- dist/tokens.d.ts
- dist/type-factories/create-union-type.factory.d.ts
- dist/type-factories/register-enum-type.factory.d.ts
- dist/type-helpers/field-type.helper.d.ts
- dist/type-helpers/intersection-type.helper.d.ts
- dist/type-helpers/omit-type.helper.d.ts
- dist/type-helpers/partial-type.helper.d.ts
- dist/type-helpers/pick-type.helper.d.ts
- dist/utils/extend.util.d.ts
- dist/utils/transform-schema.util.d.ts
Dependencies (13)
Dev Dependencies (7)
Peer Dependencies (8)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@nestjs/graphql.
- Markdown[](https://www.jsdocs.io/package/@nestjs/graphql)
- HTML<a href="https://www.jsdocs.io/package/@nestjs/graphql"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4727 ms. - Missing or incorrect documentation? Open an issue for this package.
