graphqlOptions.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { GraphQLSchema, ValidationContext, GraphQLFieldResolver, DocumentNode, GraphQLError, GraphQLFormattedError } from 'graphql';
  2. import { GraphQLExtension } from 'graphql-extensions';
  3. import { CacheControlExtensionOptions } from 'apollo-cache-control';
  4. import { KeyValueCache, InMemoryLRUCache } from 'apollo-server-caching';
  5. import { DataSource } from 'apollo-datasource';
  6. import { ApolloServerPlugin } from 'apollo-server-plugin-base';
  7. import { GraphQLParseOptions } from 'graphql-tools';
  8. import { GraphQLExecutor, ValueOrPromise, GraphQLResponse, GraphQLRequestContext, Logger, SchemaHash } from 'apollo-server-types';
  9. export 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. }
  31. export declare type DataSources<TContext> = {
  32. [name: string]: DataSource<TContext>;
  33. };
  34. export interface PersistedQueryOptions {
  35. cache?: KeyValueCache;
  36. ttl?: number | null;
  37. }
  38. export default GraphQLServerOptions;
  39. export declare function resolveGraphqlOptions(options: GraphQLServerOptions | ((...args: Array<any>) => ValueOrPromise<GraphQLServerOptions>), ...args: Array<any>): Promise<GraphQLServerOptions>;
  40. //# sourceMappingURL=graphqlOptions.d.ts.map