collectFields.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import type { ObjMap } from '../jsutils/ObjMap';
  2. import type {
  3. FieldNode,
  4. FragmentDefinitionNode,
  5. SelectionSetNode,
  6. } from '../language/ast';
  7. import type { GraphQLObjectType } from '../type/definition';
  8. import type { GraphQLSchema } from '../type/schema';
  9. /**
  10. * Given a selectionSet, collects all of the fields and returns them.
  11. *
  12. * CollectFields requires the "runtime type" of an object. For a field that
  13. * returns an Interface or Union type, the "runtime type" will be the actual
  14. * object type returned by that field.
  15. *
  16. * @internal
  17. */
  18. export declare function collectFields(
  19. schema: GraphQLSchema,
  20. fragments: ObjMap<FragmentDefinitionNode>,
  21. variableValues: {
  22. [variable: string]: unknown;
  23. },
  24. runtimeType: GraphQLObjectType,
  25. selectionSet: SelectionSetNode,
  26. ): Map<string, ReadonlyArray<FieldNode>>;
  27. /**
  28. * Given an array of field nodes, collects all of the subfields of the passed
  29. * in fields, and returns them at the end.
  30. *
  31. * CollectSubFields requires the "return type" of an object. For a field that
  32. * returns an Interface or Union type, the "return type" will be the actual
  33. * object type returned by that field.
  34. *
  35. * @internal
  36. */
  37. export declare function collectSubfields(
  38. schema: GraphQLSchema,
  39. fragments: ObjMap<FragmentDefinitionNode>,
  40. variableValues: {
  41. [variable: string]: unknown;
  42. },
  43. returnType: GraphQLObjectType,
  44. fieldNodes: ReadonlyArray<FieldNode>,
  45. ): Map<string, ReadonlyArray<FieldNode>>;