UNPKG

2.02 kBTypeScriptView Raw
1import type { GraphQLSchema, ValidationContext, GraphQLFieldResolver, DocumentNode, GraphQLError, GraphQLFormattedError, ParseOptions } from 'graphql';
2import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
3import type { DataSource } from 'apollo-datasource';
4import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
5import type { GraphQLExecutor, ValueOrPromise, GraphQLResponse, GraphQLRequestContext, SchemaHash } from 'apollo-server-types';
6import type { Logger } from '@apollo/utils.logger';
7import type { DocumentStore } from './types';
8export interface GraphQLServerOptions<TContext = Record<string, any>, TRootValue = any> {
9 schema: GraphQLSchema;
10 schemaHash: SchemaHash;
11 logger?: Logger;
12 formatError?: (error: GraphQLError) => GraphQLFormattedError;
13 rootValue?: ((parsedQuery: DocumentNode) => TRootValue) | TRootValue;
14 context?: TContext | (() => never);
15 validationRules?: Array<(context: ValidationContext) => any>;
16 executor?: GraphQLExecutor;
17 formatResponse?: (response: GraphQLResponse, requestContext: GraphQLRequestContext<TContext>) => GraphQLResponse | null;
18 fieldResolver?: GraphQLFieldResolver<any, TContext>;
19 debug?: boolean;
20 dataSources?: () => DataSources<TContext>;
21 cache?: KeyValueCache;
22 persistedQueries?: PersistedQueryOptions;
23 plugins?: ApolloServerPlugin[];
24 documentStore?: DocumentStore | null;
25 dangerouslyDisableValidation?: boolean;
26 parseOptions?: ParseOptions;
27 nodeEnv?: string;
28 allowBatchedHttpRequests?: boolean;
29}
30export declare type DataSources<TContext> = {
31 [name: string]: DataSource<TContext>;
32};
33export interface PersistedQueryOptions {
34 cache?: KeyValueCache;
35 ttl?: number | null;
36}
37export default GraphQLServerOptions;
38export declare function resolveGraphqlOptions(options: GraphQLServerOptions | ((...args: Array<any>) => ValueOrPromise<GraphQLServerOptions>), ...args: Array<any>): Promise<GraphQLServerOptions>;
39//# sourceMappingURL=graphqlOptions.d.ts.map
\No newline at end of file