UNPKG

1.87 kBTypeScriptView Raw
1import { GraphQLSchema, GraphQLFieldResolver, DocumentNode, GraphQLError, GraphQLFormattedError } from 'graphql';
2import { GraphQLExtension } from 'graphql-extensions';
3import { DataSource } from 'apollo-datasource';
4import { PersistedQueryOptions } from './graphqlOptions';
5import { GraphQLRequest, GraphQLResponse, GraphQLRequestContext, GraphQLExecutor, InvalidGraphQLRequestError, ValidationRule } from 'apollo-server-types';
6import { ApolloServerPlugin } from 'apollo-server-plugin-base';
7import { InMemoryLRUCache } from 'apollo-server-caching';
8import { GraphQLParseOptions } from 'graphql-tools';
9export { GraphQLRequest, GraphQLResponse, GraphQLRequestContext, InvalidGraphQLRequestError, };
10export declare const APQ_CACHE_PREFIX = "apq:";
11export interface GraphQLRequestPipelineConfig<TContext> {
12 schema: GraphQLSchema;
13 rootValue?: ((document: DocumentNode) => any) | any;
14 validationRules?: ValidationRule[];
15 executor?: GraphQLExecutor;
16 fieldResolver?: GraphQLFieldResolver<any, TContext>;
17 dataSources?: () => DataSources<TContext>;
18 extensions?: Array<() => GraphQLExtension>;
19 persistedQueries?: PersistedQueryOptions;
20 formatError?: (error: GraphQLError) => GraphQLFormattedError;
21 formatResponse?: (response: GraphQLResponse, requestContext: GraphQLRequestContext<TContext>) => GraphQLResponse | null;
22 plugins?: ApolloServerPlugin[];
23 documentStore?: InMemoryLRUCache<DocumentNode>;
24 parseOptions?: GraphQLParseOptions;
25}
26export declare type DataSources<TContext> = {
27 [name: string]: DataSource<TContext>;
28};
29declare type Mutable<T> = {
30 -readonly [P in keyof T]: T[P];
31};
32export declare function processGraphQLRequest<TContext>(config: GraphQLRequestPipelineConfig<TContext>, requestContext: Mutable<GraphQLRequestContext<TContext>>): Promise<GraphQLResponse>;
33//# sourceMappingURL=requestPipeline.d.ts.map
\No newline at end of file