index.mjs 7.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**
  2. * GraphQL.js provides a reference implementation for the GraphQL specification
  3. * but is also a useful utility for operating on GraphQL files and building
  4. * sophisticated tools.
  5. *
  6. * This primary module exports a general purpose function for fulfilling all
  7. * steps of the GraphQL specification in a single operation, but also includes
  8. * utilities for every part of the GraphQL specification:
  9. *
  10. * - Parsing the GraphQL language.
  11. * - Building a GraphQL type schema.
  12. * - Validating a GraphQL request against a type schema.
  13. * - Executing a GraphQL request against a type schema.
  14. *
  15. * This also includes utility functions for operating on GraphQL types and
  16. * GraphQL documents to facilitate building tools.
  17. *
  18. * You may also import from each sub-directory directly. For example, the
  19. * following two import statements are equivalent:
  20. *
  21. * import { parse } from 'graphql';
  22. * import { parse } from 'graphql/language';
  23. */
  24. // The GraphQL.js version info.
  25. export { version, versionInfo } from './version'; // The primary entry point into fulfilling a GraphQL request.
  26. export { graphql, graphqlSync } from './graphql'; // Create and operate on GraphQL type definitions and schema.
  27. export { // Definitions
  28. GraphQLSchema, GraphQLDirective, GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull, // Standard GraphQL Scalars
  29. specifiedScalarTypes, GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID, // Built-in Directives defined by the Spec
  30. specifiedDirectives, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, // "Enum" of Type Kinds
  31. TypeKind, // Constant Deprecation Reason
  32. DEFAULT_DEPRECATION_REASON, // GraphQL Types for introspection.
  33. introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind, // Meta-field definitions.
  34. SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, // Predicates
  35. isSchema, isDirective, isType, isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isListType, isNonNullType, isInputType, isOutputType, isLeafType, isCompositeType, isAbstractType, isWrappingType, isNullableType, isNamedType, isRequiredArgument, isRequiredInputField, isSpecifiedScalarType, isIntrospectionType, isSpecifiedDirective, // Assertions
  36. assertSchema, assertDirective, assertType, assertScalarType, assertObjectType, assertInterfaceType, assertUnionType, assertEnumType, assertInputObjectType, assertListType, assertNonNullType, assertInputType, assertOutputType, assertLeafType, assertCompositeType, assertAbstractType, assertWrappingType, assertNullableType, assertNamedType, // Un-modifiers
  37. getNullableType, getNamedType, // Validate GraphQL schema.
  38. validateSchema, assertValidSchema } from './type';
  39. // Parse and operate on GraphQL language source files.
  40. export { Source, getLocation, // Print source location
  41. printLocation, printSourceLocation, // Lex
  42. createLexer, TokenKind, // Parse
  43. parse, parseValue, parseType, // Print
  44. print, // Visit
  45. visit, visitInParallel, visitWithTypeInfo, getVisitFn, BREAK, Kind, DirectiveLocation, // Predicates
  46. isDefinitionNode, isExecutableDefinitionNode, isSelectionNode, isValueNode, isTypeNode, isTypeSystemDefinitionNode, isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode } from './language';
  47. // Execute GraphQL queries.
  48. export { execute, defaultFieldResolver, defaultTypeResolver, responsePathAsArray, getDirectiveValues } from './execution';
  49. export { subscribe, createSourceEventStream } from './subscription';
  50. // Validate GraphQL documents.
  51. export { validate, ValidationContext, // All validation rules in the GraphQL Specification.
  52. specifiedRules, // Individual validation rules.
  53. ExecutableDefinitionsRule, FieldsOnCorrectTypeRule, FragmentsOnCompositeTypesRule, KnownArgumentNamesRule, KnownDirectivesRule, KnownFragmentNamesRule, KnownTypeNamesRule, LoneAnonymousOperationRule, NoFragmentCyclesRule, NoUndefinedVariablesRule, NoUnusedFragmentsRule, NoUnusedVariablesRule, OverlappingFieldsCanBeMergedRule, PossibleFragmentSpreadsRule, ProvidedRequiredArgumentsRule, ScalarLeafsRule, SingleFieldSubscriptionsRule, UniqueArgumentNamesRule, UniqueDirectivesPerLocationRule, UniqueFragmentNamesRule, UniqueInputFieldNamesRule, UniqueOperationNamesRule, UniqueVariableNamesRule, ValuesOfCorrectTypeRule, VariablesAreInputTypesRule, VariablesInAllowedPositionRule, // SDL-specific validation rules
  54. LoneSchemaDefinitionRule, UniqueOperationTypesRule, UniqueTypeNamesRule, UniqueEnumValueNamesRule, UniqueFieldDefinitionNamesRule, UniqueDirectiveNamesRule, PossibleTypeExtensionsRule } from './validation';
  55. // Create, format, and print GraphQL errors.
  56. export { GraphQLError, syntaxError, locatedError, printError, formatError } from './error';
  57. // Utilities for operating on GraphQL type schema and parsed sources.
  58. export { // Produce the GraphQL query recommended for a full schema introspection.
  59. // Accepts optional IntrospectionOptions.
  60. getIntrospectionQuery, // @deprecated: use getIntrospectionQuery - will be removed in v15.
  61. introspectionQuery, // Gets the target Operation from a Document.
  62. getOperationAST, // Gets the Type for the target Operation AST.
  63. getOperationRootType, // Convert a GraphQLSchema to an IntrospectionQuery.
  64. introspectionFromSchema, // Build a GraphQLSchema from an introspection result.
  65. buildClientSchema, // Build a GraphQLSchema from a parsed GraphQL Schema language AST.
  66. buildASTSchema, // Build a GraphQLSchema from a GraphQL schema language document.
  67. buildSchema, // @deprecated: Get the description from a schema AST node and supports legacy
  68. // syntax for specifying descriptions - will be removed in v16.
  69. getDescription, // Extends an existing GraphQLSchema from a parsed GraphQL Schema
  70. // language AST.
  71. extendSchema, // Sort a GraphQLSchema.
  72. lexicographicSortSchema, // Print a GraphQLSchema to GraphQL Schema language.
  73. printSchema, // Print a GraphQLType to GraphQL Schema language.
  74. printType, // Prints the built-in introspection schema in the Schema Language
  75. // format.
  76. printIntrospectionSchema, // Create a GraphQLType from a GraphQL language AST.
  77. typeFromAST, // Create a JavaScript value from a GraphQL language AST with a Type.
  78. valueFromAST, // Create a JavaScript value from a GraphQL language AST without a Type.
  79. valueFromASTUntyped, // Create a GraphQL language AST from a JavaScript value.
  80. astFromValue, // A helper to use within recursive-descent visitors which need to be aware of
  81. // the GraphQL type system.
  82. TypeInfo, // Coerces a JavaScript value to a GraphQL type, or produces errors.
  83. coerceInputValue, // @deprecated use coerceInputValue - will be removed in v15
  84. coerceValue, // @deprecated use coerceInputValue - will be removed in v15
  85. isValidJSValue, // @deprecated use validation - will be removed in v15
  86. isValidLiteralValue, // Concatenates multiple AST together.
  87. concatAST, // Separates an AST into an AST per Operation.
  88. separateOperations, // Strips characters that are not significant to the validity or execution
  89. // of a GraphQL document.
  90. stripIgnoredCharacters, // Comparators for types
  91. isEqualType, isTypeSubTypeOf, doTypesOverlap, // Asserts a string is a valid GraphQL name.
  92. assertValidName, // Determine if a string is a valid GraphQL name.
  93. isValidNameError, // Compares two GraphQLSchemas and detects breaking changes.
  94. BreakingChangeType, DangerousChangeType, findBreakingChanges, findDangerousChanges, // Report all deprecated usage within a GraphQL document.
  95. findDeprecatedUsages } from './utilities';