UNPKG

2.45 kBTypeScriptView Raw
1import { GraphQLSchema } from 'graphql';
2import { ITypeDefinitions, IResolvers, IResolverValidationOptions, IDirectiveResolvers, SchemaDirectiveVisitorClass, GraphQLParseOptions, PruneSchemaOptions } from '@graphql-tools/utils';
3export interface ILogger {
4 log: (error: Error) => void;
5}
6/**
7 * Configuration object for creating an executable schema
8 */
9export interface IExecutableSchemaDefinition<TContext = any> {
10 /**
11 * The type definitions used to create the schema
12 */
13 typeDefs: ITypeDefinitions;
14 /**
15 * Object describing the field resolvers for the provided type definitions
16 */
17 resolvers?: IResolvers<any, TContext> | Array<IResolvers<any, TContext>>;
18 /**
19 * Logger instance used to print errors to the server console that are
20 * usually swallowed by GraphQL.
21 */
22 logger?: ILogger;
23 /**
24 * Set to `false` to have resolvers throw an if they return undefined, which
25 * can help make debugging easier
26 */
27 allowUndefinedInResolve?: boolean;
28 /**
29 * Additional options for validating the provided resolvers
30 */
31 resolverValidationOptions?: IResolverValidationOptions;
32 /**
33 * Map of directive resolvers
34 */
35 directiveResolvers?: IDirectiveResolvers<any, TContext>;
36 /**
37 * A map of schema directives used with the legacy class-based implementation
38 * of schema directives
39 */
40 schemaDirectives?: Record<string, SchemaDirectiveVisitorClass>;
41 /**
42 * An array of schema transformation functions
43 */
44 schemaTransforms?: ExecutableSchemaTransformation[];
45 /**
46 * Additional options for parsing the type definitions if they are provided
47 * as a string
48 */
49 parseOptions?: GraphQLParseOptions;
50 /**
51 * GraphQL object types that implement interfaces will inherit any missing
52 * resolvers from their interface types defined in the `resolvers` object
53 */
54 inheritResolversFromInterfaces?: boolean;
55 /**
56 * Additional options for removing unused types from the schema
57 */
58 pruningOptions?: PruneSchemaOptions;
59 /**
60 * Do not create a schema again and use the one from `buildASTSchema`
61 */
62 updateResolversInPlace?: boolean;
63 /**
64 * Do not extract and apply extensions seperately and leave it to `buildASTSchema`
65 */
66 noExtensionExtraction?: boolean;
67}
68export declare type ExecutableSchemaTransformation = (schema: GraphQLSchema) => GraphQLSchema;