makeRemoteExecutableSchema.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { ApolloLink } from 'apollo-link';
  2. import { GraphQLFieldResolver, GraphQLSchema, ExecutionResult, GraphQLResolveInfo, DocumentNode, BuildSchemaOptions } from 'graphql';
  3. export declare type ResolverFn = (rootValue?: any, args?: any, context?: any, info?: GraphQLResolveInfo) => AsyncIterator<any>;
  4. export declare type Fetcher = (operation: FetcherOperation) => Promise<ExecutionResult>;
  5. export declare type FetcherOperation = {
  6. query: DocumentNode;
  7. operationName?: string;
  8. variables?: {
  9. [key: string]: any;
  10. };
  11. context?: {
  12. [key: string]: any;
  13. };
  14. };
  15. /**
  16. * This type has been copied inline from its source on `@types/graphql`:
  17. *
  18. * https://git.io/Jv8NX
  19. *
  20. * Previously, it was imported from `graphql/utilities/schemaPrinter`, however
  21. * that module has been removed in `graphql@15`. Furthermore, the sole property
  22. * on this type is due to be deprecated in `graphql@16`.
  23. */
  24. interface PrintSchemaOptions {
  25. /**
  26. * Descriptions are defined as preceding string literals, however an older
  27. * experimental version of the SDL supported preceding comments as
  28. * descriptions. Set to true to enable this deprecated behavior.
  29. * This option is provided to ease adoption and will be removed in v16.
  30. *
  31. * Default: false
  32. */
  33. commentDescriptions?: boolean;
  34. }
  35. export default function makeRemoteExecutableSchema({ schema, link, fetcher, createResolver: customCreateResolver, buildSchemaOptions, printSchemaOptions }: {
  36. schema: GraphQLSchema | string;
  37. link?: ApolloLink;
  38. fetcher?: Fetcher;
  39. createResolver?: (fetcher: Fetcher) => GraphQLFieldResolver<any, any>;
  40. buildSchemaOptions?: BuildSchemaOptions;
  41. printSchemaOptions?: PrintSchemaOptions;
  42. }): GraphQLSchema;
  43. export declare function createResolver(fetcher: Fetcher): GraphQLFieldResolver<any, any>;
  44. export {};