UNPKG

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