UNPKG

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