import { IResolvers, IResolverValidationOptions } from '@graphql-tools/utils'; import { Type } from '@nestjs/common'; import { ModuleMetadata } from '@nestjs/common/interfaces'; import { GraphQLSchema } from 'graphql'; import { GraphQLDriver } from '.'; import { DefinitionsGeneratorOptions } from '../graphql-ast.explorer'; import { BuildSchemaOptions } from './build-schema-options.interface'; import { AutoSchemaFileValue } from './schema-file-config.interface'; export type Enhancer = 'guards' | 'interceptors' | 'filters'; /** * "GraphQLModule" options object. */ export interface GqlModuleOptions { /** * Path to mount GraphQL API */ path?: string; /** * Type definitions */ typeDefs?: string | string[]; /** * Paths to files that contain GraphQL definitions */ typePaths?: string[]; /** * GraphQL server adapter */ driver?: Type; /** * An array of modules to scan when searching for resolvers */ include?: Function[]; /** * Directive resolvers */ directiveResolvers?: any; /** * Optional GraphQL schema (to be used or to be merged) */ schema?: GraphQLSchema; /** * Extra resolvers to be registered. */ resolvers?: IResolvers | Array; /** * TypeScript definitions generator options */ definitions?: { path?: string; outputAs?: 'class' | 'interface'; } & DefinitionsGeneratorOptions; /** * If enabled, GraphQL schema will be generated automatically */ autoSchemaFile?: AutoSchemaFileValue; /** * Sort the schema lexicographically */ sortSchema?: boolean; /** * Options to be passed to the schema generator * Only applicable if "autoSchemaFile" = true */ buildSchemaOptions?: BuildSchemaOptions; /** * Prepends the global prefix to the url * * @see [faq/global-prefix](Global Prefix) */ useGlobalPrefix?: boolean; /** * Enable/disable enhancers for @ResolveField() */ fieldResolverEnhancers?: Enhancer[]; /** * Resolver validation options. */ resolverValidationOptions?: IResolverValidationOptions; /** * Inherit missing resolvers from their interface types defined in the resolvers object. */ inheritResolversFromInterfaces?: boolean; /** * Function to be applied to the schema letting you register custom transformations. */ transformSchema?: (schema: GraphQLSchema) => GraphQLSchema | Promise; /** * Apply `transformSchema` to the `autoSchemaFile` */ transformAutoSchemaFile?: boolean; /** * Context function */ context?: any; /** * Extra static metadata to be loaded into the specification */ metadata?: () => Promise>; } export interface GqlOptionsFactory = GqlModuleOptions> { createGqlOptions(): Promise> | Omit; } export interface GqlModuleAsyncOptions = GqlModuleOptions, TFactory = GqlOptionsFactory> extends Pick { /** * GraphQL server driver */ driver?: TOptions['driver']; useExisting?: Type; useClass?: Type; useFactory?: (...args: any[]) => Promise> | Omit; inject?: any[]; } //# sourceMappingURL=gql-module-options.interface.d.ts.map