UNPKG

7.55 kBJavaScriptView Raw
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.
25export { version, versionInfo } from "./version.mjs"; // The primary entry point into fulfilling a GraphQL request.
26
27export { graphql, graphqlSync } from "./graphql.mjs"; // Create and operate on GraphQL type definitions and schema.
28
29export { // Definitions
30GraphQLSchema, GraphQLDirective, GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull // Standard GraphQL Scalars
31, specifiedScalarTypes, GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID // Built-in Directives defined by the Spec
32, specifiedDirectives, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective // "Enum" of Type Kinds
33, TypeKind // Constant Deprecation Reason
34, DEFAULT_DEPRECATION_REASON // GraphQL Types for introspection.
35, introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind // Meta-field definitions.
36, SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef // Predicates
37, 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
38, assertSchema, assertDirective, assertType, assertScalarType, assertObjectType, assertInterfaceType, assertUnionType, assertEnumType, assertInputObjectType, assertListType, assertNonNullType, assertInputType, assertOutputType, assertLeafType, assertCompositeType, assertAbstractType, assertWrappingType, assertNullableType, assertNamedType // Un-modifiers
39, getNullableType, getNamedType // Validate GraphQL schema.
40, validateSchema, assertValidSchema } from "./type/index.mjs";
41// Parse and operate on GraphQL language source files.
42export { Token, Source, Location, getLocation // Print source location
43, printLocation, printSourceLocation // Lex
44, Lexer, TokenKind // Parse
45, parse, parseValue, parseType // Print
46, print // Visit
47, visit, visitInParallel, getVisitFn, BREAK, Kind, DirectiveLocation // Predicates
48, isDefinitionNode, isExecutableDefinitionNode, isSelectionNode, isValueNode, isTypeNode, isTypeSystemDefinitionNode, isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode } from "./language/index.mjs";
49// Execute GraphQL queries.
50export { execute, executeSync, defaultFieldResolver, defaultTypeResolver, responsePathAsArray, getDirectiveValues } from "./execution/index.mjs";
51export { subscribe, createSourceEventStream } from "./subscription/index.mjs";
52// Validate GraphQL documents.
53export { validate, ValidationContext // All validation rules in the GraphQL Specification.
54, specifiedRules // Individual validation rules.
55, 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
56, LoneSchemaDefinitionRule, UniqueOperationTypesRule, UniqueTypeNamesRule, UniqueEnumValueNamesRule, UniqueFieldDefinitionNamesRule, UniqueDirectiveNamesRule, PossibleTypeExtensionsRule // Custom validation rules
57, NoDeprecatedCustomRule, NoSchemaIntrospectionCustomRule } from "./validation/index.mjs";
58// Create, format, and print GraphQL errors.
59export { GraphQLError, syntaxError, locatedError, printError, formatError } from "./error/index.mjs";
60// Utilities for operating on GraphQL type schema and parsed sources.
61export { // Produce the GraphQL query recommended for a full schema introspection.
62// Accepts optional IntrospectionOptions.
63getIntrospectionQuery // Gets the target Operation from a Document.
64, getOperationAST // Gets the Type for the target Operation AST.
65, getOperationRootType // Convert a GraphQLSchema to an IntrospectionQuery.
66, introspectionFromSchema // Build a GraphQLSchema from an introspection result.
67, buildClientSchema // Build a GraphQLSchema from a parsed GraphQL Schema language AST.
68, buildASTSchema // Build a GraphQLSchema from a GraphQL schema language document.
69, buildSchema // @deprecated: Get the description from a schema AST node and supports legacy
70// syntax for specifying descriptions - will be removed in v16.
71, getDescription // Extends an existing GraphQLSchema from a parsed GraphQL Schema
72// language AST.
73, extendSchema // Sort a GraphQLSchema.
74, lexicographicSortSchema // Print a GraphQLSchema to GraphQL Schema language.
75, printSchema // Print a GraphQLType to GraphQL Schema language.
76, printType // Prints the built-in introspection schema in the Schema Language
77// format.
78, printIntrospectionSchema // Create a GraphQLType from a GraphQL language AST.
79, typeFromAST // Create a JavaScript value from a GraphQL language AST with a Type.
80, valueFromAST // Create a JavaScript value from a GraphQL language AST without a Type.
81, valueFromASTUntyped // Create a GraphQL language AST from a JavaScript value.
82, astFromValue // A helper to use within recursive-descent visitors which need to be aware of
83// the GraphQL type system.
84, TypeInfo, visitWithTypeInfo // Coerces a JavaScript value to a GraphQL type, or produces errors.
85, coerceInputValue // Concatenates multiple AST together.
86, concatAST // Separates an AST into an AST per Operation.
87, separateOperations // Strips characters that are not significant to the validity or execution
88// of a GraphQL document.
89, stripIgnoredCharacters // Comparators for types
90, isEqualType, isTypeSubTypeOf, doTypesOverlap // Asserts a string is a valid GraphQL name.
91, assertValidName // Determine if a string is a valid GraphQL name.
92, isValidNameError // Compares two GraphQLSchemas and detects breaking changes.
93, BreakingChangeType, DangerousChangeType, findBreakingChanges, findDangerousChanges // @deprecated: Report all deprecated usage within a GraphQL document.
94, findDeprecatedUsages } from "./utilities/index.mjs";