1 | import type { GraphQLSchema, DocumentNode } from 'graphql';
|
2 | import type { IMocks } from '@graphql-tools/mock';
|
3 | import type { IExecutableSchemaDefinition } from '@graphql-tools/schema';
|
4 | import type { ApolloConfig, ValueOrPromise, GraphQLExecutor, ApolloConfigInput } from 'apollo-server-types';
|
5 | import type { GraphQLServerOptions as GraphQLOptions, PersistedQueryOptions } from './graphqlOptions';
|
6 | import type { ApolloServerPlugin } from 'apollo-server-plugin-base';
|
7 | import type { GraphQLSchemaModule } from '@apollographql/apollo-tools';
|
8 | export type { GraphQLSchemaModule };
|
9 | import type { KeyValueCache } from '@apollo/utils.keyvaluecache';
|
10 | export type { KeyValueCache };
|
11 | export declare type Context<T = object> = T;
|
12 | export declare type ContextFunction<FunctionParams = any, ProducedContext = object> = (context: FunctionParams) => ValueOrPromise<Context<ProducedContext>>;
|
13 | export declare type PluginDefinition = ApolloServerPlugin | (() => ApolloServerPlugin);
|
14 | declare type BaseConfig = Pick<GraphQLOptions<Context>, 'formatError' | 'debug' | 'rootValue' | 'validationRules' | 'executor' | 'formatResponse' | 'fieldResolver' | 'dataSources' | 'logger' | 'allowBatchedHttpRequests'>;
|
15 | export declare type Unsubscriber = () => void;
|
16 | export declare type SchemaChangeCallback = (apiSchema: GraphQLSchema) => void;
|
17 | export declare type GraphQLServiceConfig = {
|
18 | schema: GraphQLSchema;
|
19 | executor: GraphQLExecutor | null;
|
20 | };
|
21 | export 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 | }
|
32 | export interface GraphQLService extends GatewayInterface {
|
33 | }
|
34 | export declare type DocumentStore = KeyValueCache<DocumentNode>;
|
35 | export 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 | }
|
56 | export interface CSRFPreventionOptions {
|
57 | requestHeaders?: string[];
|
58 | }
|
59 |
|
\ | No newline at end of file |