UNPKG

2.9 kBTypeScriptView Raw
1import type { GraphQLSchema, DocumentNode } from 'graphql';
2import type { IMocks } from '@graphql-tools/mock';
3import type { IExecutableSchemaDefinition } from '@graphql-tools/schema';
4import type { ApolloConfig, ValueOrPromise, GraphQLExecutor, ApolloConfigInput } from 'apollo-server-types';
5import type { GraphQLServerOptions as GraphQLOptions, PersistedQueryOptions } from './graphqlOptions';
6import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
7import type { GraphQLSchemaModule } from '@apollographql/apollo-tools';
8export type { GraphQLSchemaModule };
9import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
10export type { KeyValueCache };
11export declare type Context<T = object> = T;
12export declare type ContextFunction<FunctionParams = any, ProducedContext = object> = (context: FunctionParams) => ValueOrPromise<Context<ProducedContext>>;
13export declare type PluginDefinition = ApolloServerPlugin | (() => ApolloServerPlugin);
14declare type BaseConfig = Pick<GraphQLOptions<Context>, 'formatError' | 'debug' | 'rootValue' | 'validationRules' | 'executor' | 'formatResponse' | 'fieldResolver' | 'dataSources' | 'logger' | 'allowBatchedHttpRequests'>;
15export declare type Unsubscriber = () => void;
16export declare type SchemaChangeCallback = (apiSchema: GraphQLSchema) => void;
17export declare type GraphQLServiceConfig = {
18 schema: GraphQLSchema;
19 executor: GraphQLExecutor | null;
20};
21export interface GatewayInterface {
22 load(options: {
23 apollo: ApolloConfig;
24 }): Promise<GraphQLServiceConfig>;
25 onSchemaChange?(callback: SchemaChangeCallback): Unsubscriber;
26 onSchemaLoadOrUpdate?(callback: (schemaContext: {
27 apiSchema: GraphQLSchema;
28 coreSupergraphSdl: string;
29 }) => void): Unsubscriber;
30 stop(): Promise<void>;
31}
32export interface GraphQLService extends GatewayInterface {
33}
34export declare type DocumentStore = KeyValueCache<DocumentNode>;
35export interface Config<ContextFunctionParams = any> extends BaseConfig {
36 modules?: GraphQLSchemaModule[];
37 typeDefs?: IExecutableSchemaDefinition['typeDefs'];
38 resolvers?: IExecutableSchemaDefinition['resolvers'];
39 parseOptions?: IExecutableSchemaDefinition['parseOptions'];
40 schema?: GraphQLSchema;
41 context?: Context | ContextFunction<ContextFunctionParams>;
42 introspection?: boolean;
43 mocks?: boolean | IMocks;
44 mockEntireSchema?: boolean;
45 plugins?: PluginDefinition[];
46 persistedQueries?: PersistedQueryOptions | false;
47 gateway?: GatewayInterface;
48 stopOnTerminationSignals?: boolean;
49 apollo?: ApolloConfigInput;
50 nodeEnv?: string;
51 dangerouslyDisableValidation?: boolean;
52 documentStore?: DocumentStore | null;
53 csrfPrevention?: CSRFPreventionOptions | boolean;
54 cache?: KeyValueCache | 'bounded';
55}
56export interface CSRFPreventionOptions {
57 requestHeaders?: string[];
58}
59//# sourceMappingURL=types.d.ts.map
\No newline at end of file