Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: graphql @ 14.2.1 .. 14.3.0

error/formatError.js.flow

@@ -8,8 +8,8 @@
*/
import invariant from '../jsutils/invariant';
-import type { GraphQLError } from './GraphQLError';
-import type { SourceLocation } from '../language/location';
+import { type GraphQLError } from './GraphQLError';
+import { type SourceLocation } from '../language/location';
/**
* Given a GraphQLError, format it according to the rules described by the

error/GraphQLError.js.flow

@@ -8,10 +8,9 @@
*/
import { printError } from './printError';
-import { getLocation } from '../language/location';
-import type { SourceLocation } from '../language/location';
-import type { ASTNode } from '../language/ast';
-import type { Source } from '../language/source';
+import { type ASTNode } from '../language/ast';
+import { type Source } from '../language/source';
+import { type SourceLocation, getLocation } from '../language/location';
/**
* A GraphQLError describes an Error found during the parse, validate, or

error/GraphQLError.mjs

@@ -8,6 +8,13 @@
*/
import { printError } from './printError';
import { getLocation } from '../language/location';
+/**
+ * A GraphQLError describes an Error found during the parse, validate, or
+ * execute phases of performing a GraphQL operation. In addition to a message
+ * and stack trace, it also includes information about the locations in a
+ * GraphQL document and/or execution result that correspond to the Error.
+ */
+
export function GraphQLError( // eslint-disable-line no-redeclare
message, nodes, source, positions, path, originalError, extensions) {
// Compute list of blame nodes.

error/index.js.flow

@@ -8,9 +8,12 @@
*/
export { GraphQLError } from './GraphQLError';
+
export { syntaxError } from './syntaxError';
+
export { locatedError } from './locatedError';
+
export { printError } from './printError';
-export { formatError } from './formatError';
+export { formatError } from './formatError';
export type { GraphQLFormattedError } from './formatError';

error/locatedError.js.flow

@@ -8,7 +8,7 @@
*/
import { GraphQLError } from './GraphQLError';
-import type { ASTNode } from '../language/ast';
+import { type ASTNode } from '../language/ast';
/**
* Given an arbitrary Error, presumably thrown while attempting to execute a

error/printError.js.flow

@@ -7,10 +7,9 @@
* @flow strict
*/
-import { getLocation } from '../language/location';
-import type { SourceLocation } from '../language/location';
-import type { Source } from '../language/source';
-import type { GraphQLError } from './GraphQLError';
+import { type SourceLocation, getLocation } from '../language/location';
+import { type Source } from '../language/source';
+import { type GraphQLError } from './GraphQLError';
/**
* Prints a GraphQLError to a string, representing useful location information

error/syntaxError.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { Source } from '../language/source';
+import { type Source } from '../language/source';
import { GraphQLError } from './GraphQLError';
/**

execution/execute.js.flow

@@ -18,8 +18,8 @@
import memoize3 from '../jsutils/memoize3';
import promiseForObject from '../jsutils/promiseForObject';
import promiseReduce from '../jsutils/promiseReduce';
-import type { ObjMap } from '../jsutils/ObjMap';
-import type { PromiseOrValue } from '../jsutils/PromiseOrValue';
+import { type ObjMap } from '../jsutils/ObjMap';
+import { type PromiseOrValue } from '../jsutils/PromiseOrValue';
import { getOperationRootType } from '../utilities/getOperationRootType';
import { typeFromAST } from '../utilities/typeFromAST';
@@ -30,25 +30,23 @@
getDirectiveValues,
} from './values';
import {
+ type GraphQLObjectType,
+ type GraphQLOutputType,
+ type GraphQLLeafType,
+ type GraphQLAbstractType,
+ type GraphQLField,
+ type GraphQLFieldResolver,
+ type GraphQLResolveInfo,
+ type GraphQLTypeResolver,
+ type ResponsePath,
+ type GraphQLList,
isObjectType,
isAbstractType,
isLeafType,
isListType,
isNonNullType,
} from '../type/definition';
-import type {
- GraphQLObjectType,
- GraphQLOutputType,
- GraphQLLeafType,
- GraphQLAbstractType,
- GraphQLField,
- GraphQLFieldResolver,
- GraphQLResolveInfo,
- GraphQLTypeResolver,
- ResponsePath,
- GraphQLList,
-} from '../type/definition';
-import type { GraphQLSchema } from '../type/schema';
+import { type GraphQLSchema } from '../type/schema';
import {
SchemaMetaFieldDef,
TypeMetaFieldDef,
@@ -59,14 +57,14 @@
GraphQLSkipDirective,
} from '../type/directives';
import { assertValidSchema } from '../type/validate';
-import type {
- DocumentNode,
- OperationDefinitionNode,
- SelectionSetNode,
- FieldNode,
- FragmentSpreadNode,
- InlineFragmentNode,
- FragmentDefinitionNode,
+import {
+ type DocumentNode,
+ type OperationDefinitionNode,
+ type SelectionSetNode,
+ type FieldNode,
+ type FragmentSpreadNode,
+ type InlineFragmentNode,
+ type FragmentDefinitionNode,
} from '../language/ast';
/**

execution/index.js.flow

@@ -13,6 +13,6 @@
defaultTypeResolver,
responsePathAsArray,
} from './execute';
-export { getDirectiveValues } from './values';
-
export type { ExecutionArgs, ExecutionResult } from './execute';
+
+export { getDirectiveValues } from './values';

execution/values.js.flow

@@ -17,15 +17,18 @@
import { valueFromAST } from '../utilities/valueFromAST';
import { Kind } from '../language/kinds';
import { print } from '../language/printer';
-import { isInputType, isNonNullType } from '../type/definition';
-import type { ObjMap } from '../jsutils/ObjMap';
-import type { GraphQLField } from '../type/definition';
-import type { GraphQLDirective } from '../type/directives';
-import type { GraphQLSchema } from '../type/schema';
-import type {
- FieldNode,
- DirectiveNode,
- VariableDefinitionNode,
+import {
+ type GraphQLField,
+ isInputType,
+ isNonNullType,
+} from '../type/definition';
+import { type GraphQLDirective } from '../type/directives';
+import { type ObjMap } from '../jsutils/ObjMap';
+import { type GraphQLSchema } from '../type/schema';
+import {
+ type FieldNode,
+ type DirectiveNode,
+ type VariableDefinitionNode,
} from '../language/ast';
type CoercedVariableValues = {|

graphql.js.flow

@@ -10,16 +10,15 @@
import { validateSchema } from './type/validate';
import { parse } from './language/parser';
import { validate } from './validation/validate';
-import { execute } from './execution/execute';
-import type { ObjMap } from './jsutils/ObjMap';
-import type { Source } from './language/source';
-import type {
- GraphQLFieldResolver,
- GraphQLTypeResolver,
+import { type ExecutionResult, execute } from './execution/execute';
+import { type ObjMap } from './jsutils/ObjMap';
+import { type Source } from './language/source';
+import {
+ type GraphQLFieldResolver,
+ type GraphQLTypeResolver,
} from './type/definition';
-import type { GraphQLSchema } from './type/schema';
-import type { ExecutionResult } from './execution/execute';
-import type { PromiseOrValue } from './jsutils/PromiseOrValue';
+import { type GraphQLSchema } from './type/schema';
+import { type PromiseOrValue } from './jsutils/PromiseOrValue';
/**
* This is the primary entry point function for fulfilling GraphQL operations
@@ -55,6 +54,10 @@
* A resolver function to use when one is not provided by the schema.
* If not provided, the default field resolver is used (which looks for a
* value or method on the source value with the field's name).
+ * typeResolver:
+ * A type resolver function to use when none is provided by the schema.
+ * If not provided, the default type resolver is used (which looks for a
+ * `__typename` field or alternatively calls the `isTypeOf` method).
*/
export type GraphQLArgs = {|
schema: GraphQLSchema,

index.js

@@ -21,6 +21,12 @@
return _type.GraphQLSchema;
}
});
+Object.defineProperty(exports, "GraphQLDirective", {
+ enumerable: true,
+ get: function get() {
+ return _type.GraphQLDirective;
+ }
+});
Object.defineProperty(exports, "GraphQLScalarType", {
enumerable: true,
get: function get() {
@@ -69,18 +75,6 @@
return _type.GraphQLNonNull;
}
});
-Object.defineProperty(exports, "GraphQLDirective", {
- enumerable: true,
- get: function get() {
- return _type.GraphQLDirective;
- }
-});
-Object.defineProperty(exports, "TypeKind", {
- enumerable: true,
- get: function get() {
- return _type.TypeKind;
- }
-});
Object.defineProperty(exports, "specifiedScalarTypes", {
enumerable: true,
get: function get() {
@@ -141,28 +135,16 @@
return _type.GraphQLDeprecatedDirective;
}
});
-Object.defineProperty(exports, "DEFAULT_DEPRECATION_REASON", {
- enumerable: true,
- get: function get() {
- return _type.DEFAULT_DEPRECATION_REASON;
- }
-});
-Object.defineProperty(exports, "SchemaMetaFieldDef", {
- enumerable: true,
- get: function get() {
- return _type.SchemaMetaFieldDef;
- }
-});
-Object.defineProperty(exports, "TypeMetaFieldDef", {
+Object.defineProperty(exports, "TypeKind", {
enumerable: true,
get: function get() {
- return _type.TypeMetaFieldDef;
+ return _type.TypeKind;
}
});
-Object.defineProperty(exports, "TypeNameMetaFieldDef", {
+Object.defineProperty(exports, "DEFAULT_DEPRECATION_REASON", {
enumerable: true,
get: function get() {
- return _type.TypeNameMetaFieldDef;
+ return _type.DEFAULT_DEPRECATION_REASON;
}
});
Object.defineProperty(exports, "introspectionTypes", {
@@ -219,6 +201,24 @@
return _type.__TypeKind;
}
});
+Object.defineProperty(exports, "SchemaMetaFieldDef", {
+ enumerable: true,
+ get: function get() {
+ return _type.SchemaMetaFieldDef;
+ }
+});
+Object.defineProperty(exports, "TypeMetaFieldDef", {
+ enumerable: true,
+ get: function get() {
+ return _type.TypeMetaFieldDef;
+ }
+});
+Object.defineProperty(exports, "TypeNameMetaFieldDef", {
+ enumerable: true,
+ get: function get() {
+ return _type.TypeNameMetaFieldDef;
+ }
+});
Object.defineProperty(exports, "isSchema", {
enumerable: true,
get: function get() {
@@ -513,6 +513,18 @@
return _language.getLocation;
}
});
+Object.defineProperty(exports, "createLexer", {
+ enumerable: true,
+ get: function get() {
+ return _language.createLexer;
+ }
+});
+Object.defineProperty(exports, "TokenKind", {
+ enumerable: true,
+ get: function get() {
+ return _language.TokenKind;
+ }
+});
Object.defineProperty(exports, "parse", {
enumerable: true,
get: function get() {
@@ -561,16 +573,16 @@
return _language.getVisitFn;
}
});
-Object.defineProperty(exports, "Kind", {
+Object.defineProperty(exports, "BREAK", {
enumerable: true,
get: function get() {
- return _language.Kind;
+ return _language.BREAK;
}
});
-Object.defineProperty(exports, "TokenKind", {
+Object.defineProperty(exports, "Kind", {
enumerable: true,
get: function get() {
- return _language.TokenKind;
+ return _language.Kind;
}
});
Object.defineProperty(exports, "DirectiveLocation", {
@@ -579,12 +591,6 @@
return _language.DirectiveLocation;
}
});
-Object.defineProperty(exports, "BREAK", {
- enumerable: true,
- get: function get() {
- return _language.BREAK;
- }
-});
Object.defineProperty(exports, "isDefinitionNode", {
enumerable: true,
get: function get() {
@@ -855,10 +861,16 @@
return _error.GraphQLError;
}
});
-Object.defineProperty(exports, "formatError", {
+Object.defineProperty(exports, "syntaxError", {
enumerable: true,
get: function get() {
- return _error.formatError;
+ return _error.syntaxError;
+ }
+});
+Object.defineProperty(exports, "locatedError", {
+ enumerable: true,
+ get: function get() {
+ return _error.locatedError;
}
});
Object.defineProperty(exports, "printError", {
@@ -867,6 +879,12 @@
return _error.printError;
}
});
+Object.defineProperty(exports, "formatError", {
+ enumerable: true,
+ get: function get() {
+ return _error.formatError;
+ }
+});
Object.defineProperty(exports, "getIntrospectionQuery", {
enumerable: true,
get: function get() {
@@ -939,16 +957,16 @@
return _utilities.printSchema;
}
});
-Object.defineProperty(exports, "printIntrospectionSchema", {
+Object.defineProperty(exports, "printType", {
enumerable: true,
get: function get() {
- return _utilities.printIntrospectionSchema;
+ return _utilities.printType;
}
});
-Object.defineProperty(exports, "printType", {
+Object.defineProperty(exports, "printIntrospectionSchema", {
enumerable: true,
get: function get() {
- return _utilities.printType;
+ return _utilities.printIntrospectionSchema;
}
});
Object.defineProperty(exports, "typeFromAST", {
@@ -1011,6 +1029,12 @@
return _utilities.separateOperations;
}
});
+Object.defineProperty(exports, "stripIgnoredCharacters", {
+ enumerable: true,
+ get: function get() {
+ return _utilities.stripIgnoredCharacters;
+ }
+});
Object.defineProperty(exports, "isEqualType", {
enumerable: true,
get: function get() {
@@ -1041,28 +1065,28 @@
return _utilities.isValidNameError;
}
});
-Object.defineProperty(exports, "findBreakingChanges", {
+Object.defineProperty(exports, "BreakingChangeType", {
enumerable: true,
get: function get() {
- return _utilities.findBreakingChanges;
+ return _utilities.BreakingChangeType;
}
});
-Object.defineProperty(exports, "findDangerousChanges", {
+Object.defineProperty(exports, "DangerousChangeType", {
enumerable: true,
get: function get() {
- return _utilities.findDangerousChanges;
+ return _utilities.DangerousChangeType;
}
});
-Object.defineProperty(exports, "BreakingChangeType", {
+Object.defineProperty(exports, "findBreakingChanges", {
enumerable: true,
get: function get() {
- return _utilities.BreakingChangeType;
+ return _utilities.findBreakingChanges;
}
});
-Object.defineProperty(exports, "DangerousChangeType", {
+Object.defineProperty(exports, "findDangerousChanges", {
enumerable: true,
get: function get() {
- return _utilities.DangerousChangeType;
+ return _utilities.findDangerousChanges;
}
});
Object.defineProperty(exports, "findDeprecatedUsages", {

index.js.flow

@@ -37,8 +37,9 @@
// Create and operate on GraphQL type definitions and schema.
export {
- GraphQLSchema,
// Definitions
+ GraphQLSchema,
+ GraphQLDirective,
GraphQLScalarType,
GraphQLObjectType,
GraphQLInterfaceType,
@@ -47,10 +48,7 @@
GraphQLInputObjectType,
GraphQLList,
GraphQLNonNull,
- GraphQLDirective,
- // "Enum" of Type Kinds
- TypeKind,
- // Scalars
+ // Standard GraphQL Scalars
specifiedScalarTypes,
GraphQLInt,
GraphQLFloat,
@@ -62,12 +60,10 @@
GraphQLIncludeDirective,
GraphQLSkipDirective,
GraphQLDeprecatedDirective,
+ // "Enum" of Type Kinds
+ TypeKind,
// Constant Deprecation Reason
DEFAULT_DEPRECATION_REASON,
- // Meta-field definitions.
- SchemaMetaFieldDef,
- TypeMetaFieldDef,
- TypeNameMetaFieldDef,
// GraphQL Types for introspection.
introspectionTypes,
__Schema,
@@ -78,6 +74,10 @@
__InputValue,
__EnumValue,
__TypeKind,
+ // Meta-field definitions.
+ SchemaMetaFieldDef,
+ TypeMetaFieldDef,
+ TypeNameMetaFieldDef,
// Predicates
isSchema,
isDirective,
@@ -143,6 +143,7 @@
GraphQLNamedType,
Thunk,
GraphQLSchemaConfig,
+ GraphQLDirectiveConfig,
GraphQLArgument,
GraphQLArgumentConfig,
GraphQLEnumTypeConfig,
@@ -168,7 +169,6 @@
GraphQLScalarTypeConfig,
GraphQLTypeResolver,
GraphQLUnionTypeConfig,
- GraphQLDirectiveConfig,
GraphQLScalarSerializer,
GraphQLScalarValueParser,
GraphQLScalarLiteralParser,
@@ -178,6 +178,9 @@
export {
Source,
getLocation,
+ // Lex
+ createLexer,
+ TokenKind,
// Parse
parse,
parseValue,
@@ -189,10 +192,9 @@
visitInParallel,
visitWithTypeInfo,
getVisitFn,
+ BREAK,
Kind,
- TokenKind,
DirectiveLocation,
- BREAK,
// Predicates
isDefinitionNode,
isExecutableDefinitionNode,
@@ -209,16 +211,20 @@
Lexer,
ParseOptions,
SourceLocation,
+ Location,
+ Token,
+ TokenKindEnum,
+ KindEnum,
+ DirectiveLocationEnum,
// Visitor utilities
ASTVisitor,
Visitor,
VisitFn,
VisitorKeyMap,
// AST nodes
- Location,
- Token,
ASTNode,
ASTKindToNode,
+ // Each kind of AST node
NameNode,
DocumentNode,
DefinitionNode,
@@ -272,9 +278,6 @@
UnionTypeExtensionNode,
EnumTypeExtensionNode,
InputObjectTypeExtensionNode,
- KindEnum,
- TokenKindEnum,
- DirectiveLocationEnum,
} from './language';
// Execute GraphQL queries.
@@ -290,7 +293,7 @@
export { subscribe, createSourceEventStream } from './subscription';
-// Validate GraphQL queries.
+// Validate GraphQL documents.
export {
validate,
ValidationContext,
@@ -327,7 +330,13 @@
export type { ValidationRule } from './validation';
// Create, format, and print GraphQL errors.
-export { GraphQLError, formatError, printError } from './error';
+export {
+ GraphQLError,
+ syntaxError,
+ locatedError,
+ printError,
+ formatError,
+} from './error';
export type { GraphQLFormattedError } from './error';
@@ -336,13 +345,13 @@
// Produce the GraphQL query recommended for a full schema introspection.
// Accepts optional IntrospectionOptions.
getIntrospectionQuery,
- // @deprecated: use getIntrospectionQuery - will be removed in v15
+ // @deprecated: use getIntrospectionQuery - will be removed in v15.
introspectionQuery,
- // Gets the target Operation from a Document
+ // Gets the target Operation from a Document.
getOperationAST,
// Gets the Type for the target Operation AST.
getOperationRootType,
- // Convert a GraphQLSchema to an IntrospectionQuery
+ // Convert a GraphQLSchema to an IntrospectionQuery.
introspectionFromSchema,
// Build a GraphQLSchema from an introspection result.
buildClientSchema,
@@ -351,7 +360,7 @@
// Build a GraphQLSchema from a GraphQL schema language document.
buildSchema,
// @deprecated: Get the description from a schema AST node and supports legacy
- // syntax for specifying descriptions - will be removed in v16
+ // syntax for specifying descriptions - will be removed in v16.
getDescription,
// Extends an existing GraphQLSchema from a parsed GraphQL Schema
// language AST.
@@ -360,11 +369,11 @@
lexicographicSortSchema,
// Print a GraphQLSchema to GraphQL Schema language.
printSchema,
+ // Print a GraphQLType to GraphQL Schema language.
+ printType,
// Prints the built-in introspection schema in the Schema Language
// format.
printIntrospectionSchema,
- // Print a GraphQLType to GraphQL Schema language.
- printType,
// Create a GraphQLType from a GraphQL language AST.
typeFromAST,
// Create a JavaScript value from a GraphQL language AST with a Type.
@@ -386,6 +395,9 @@
concatAST,
// Separates an AST into an AST per Operation.
separateOperations,
+ // Strips characters that are not significant to the validity or execution
+ // of a GraphQL document.
+ stripIgnoredCharacters,
// Comparators for types
isEqualType,
isTypeSubTypeOf,
@@ -395,38 +407,38 @@
// Determine if a string is a valid GraphQL name.
isValidNameError,
// Compares two GraphQLSchemas and detects breaking changes.
- findBreakingChanges,
- findDangerousChanges,
BreakingChangeType,
DangerousChangeType,
+ findBreakingChanges,
+ findDangerousChanges,
// Report all deprecated usage within a GraphQL document.
findDeprecatedUsages,
} from './utilities';
export type {
- BuildSchemaOptions,
- BreakingChange,
- DangerousChange,
IntrospectionOptions,
- IntrospectionDirective,
+ IntrospectionQuery,
+ IntrospectionSchema,
+ IntrospectionType,
+ IntrospectionInputType,
+ IntrospectionOutputType,
+ IntrospectionScalarType,
+ IntrospectionObjectType,
+ IntrospectionInterfaceType,
+ IntrospectionUnionType,
IntrospectionEnumType,
- IntrospectionEnumValue,
- IntrospectionField,
IntrospectionInputObjectType,
- IntrospectionInputType,
+ IntrospectionTypeRef,
IntrospectionInputTypeRef,
- IntrospectionInputValue,
- IntrospectionInterfaceType,
- IntrospectionListTypeRef,
+ IntrospectionOutputTypeRef,
IntrospectionNamedTypeRef,
+ IntrospectionListTypeRef,
IntrospectionNonNullTypeRef,
- IntrospectionObjectType,
- IntrospectionOutputType,
- IntrospectionOutputTypeRef,
- IntrospectionQuery,
- IntrospectionScalarType,
- IntrospectionSchema,
- IntrospectionType,
- IntrospectionTypeRef,
- IntrospectionUnionType,
+ IntrospectionField,
+ IntrospectionInputValue,
+ IntrospectionEnumValue,
+ IntrospectionDirective,
+ BuildSchemaOptions,
+ BreakingChange,
+ DangerousChange,
} from './utilities';

index.mjs

@@ -33,53 +33,54 @@
// The primary entry point into fulfilling a GraphQL request.
export { graphql, graphqlSync } from './graphql'; // Create and operate on GraphQL type definitions and schema.
-export { GraphQLSchema, // Definitions
-GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull, GraphQLDirective, // "Enum" of Type Kinds
-TypeKind, // Scalars
+export { // Definitions
+GraphQLSchema, GraphQLDirective, GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull, // Standard GraphQL Scalars
specifiedScalarTypes, GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID, // Built-in Directives defined by the Spec
-specifiedDirectives, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, // Constant Deprecation Reason
-DEFAULT_DEPRECATION_REASON, // Meta-field definitions.
-SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, // GraphQL Types for introspection.
-introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind, // Predicates
+specifiedDirectives, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, // "Enum" of Type Kinds
+TypeKind, // Constant Deprecation Reason
+DEFAULT_DEPRECATION_REASON, // GraphQL Types for introspection.
+introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind, // Meta-field definitions.
+SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef, // Predicates
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
assertSchema, assertDirective, assertType, assertScalarType, assertObjectType, assertInterfaceType, assertUnionType, assertEnumType, assertInputObjectType, assertListType, assertNonNullType, assertInputType, assertOutputType, assertLeafType, assertCompositeType, assertAbstractType, assertWrappingType, assertNullableType, assertNamedType, // Un-modifiers
getNullableType, getNamedType, // Validate GraphQL schema.
validateSchema, assertValidSchema } from './type';
// Parse and operate on GraphQL language source files.
-export { Source, getLocation, // Parse
+export { Source, getLocation, // Lex
+createLexer, TokenKind, // Parse
parse, parseValue, parseType, // Print
print, // Visit
-visit, visitInParallel, visitWithTypeInfo, getVisitFn, Kind, TokenKind, DirectiveLocation, BREAK, // Predicates
+visit, visitInParallel, visitWithTypeInfo, getVisitFn, BREAK, Kind, DirectiveLocation, // Predicates
isDefinitionNode, isExecutableDefinitionNode, isSelectionNode, isValueNode, isTypeNode, isTypeSystemDefinitionNode, isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode } from './language';
// Execute GraphQL queries.
export { execute, defaultFieldResolver, defaultTypeResolver, responsePathAsArray, getDirectiveValues } from './execution';
-export { subscribe, createSourceEventStream } from './subscription'; // Validate GraphQL queries.
+export { subscribe, createSourceEventStream } from './subscription'; // Validate GraphQL documents.
export { validate, ValidationContext, // All validation rules in the GraphQL Specification.
specifiedRules, // Individual validation rules.
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 } from './validation';
// Create, format, and print GraphQL errors.
-export { GraphQLError, formatError, printError } from './error';
+export { GraphQLError, syntaxError, locatedError, printError, formatError } from './error';
// Utilities for operating on GraphQL type schema and parsed sources.
export { // Produce the GraphQL query recommended for a full schema introspection.
// Accepts optional IntrospectionOptions.
-getIntrospectionQuery, // @deprecated: use getIntrospectionQuery - will be removed in v15
-introspectionQuery, // Gets the target Operation from a Document
+getIntrospectionQuery, // @deprecated: use getIntrospectionQuery - will be removed in v15.
+introspectionQuery, // Gets the target Operation from a Document.
getOperationAST, // Gets the Type for the target Operation AST.
-getOperationRootType, // Convert a GraphQLSchema to an IntrospectionQuery
+getOperationRootType, // Convert a GraphQLSchema to an IntrospectionQuery.
introspectionFromSchema, // Build a GraphQLSchema from an introspection result.
buildClientSchema, // Build a GraphQLSchema from a parsed GraphQL Schema language AST.
buildASTSchema, // Build a GraphQLSchema from a GraphQL schema language document.
buildSchema, // @deprecated: Get the description from a schema AST node and supports legacy
-// syntax for specifying descriptions - will be removed in v16
+// syntax for specifying descriptions - will be removed in v16.
getDescription, // Extends an existing GraphQLSchema from a parsed GraphQL Schema
// language AST.
extendSchema, // Sort a GraphQLSchema.
lexicographicSortSchema, // Print a GraphQLSchema to GraphQL Schema language.
-printSchema, // Prints the built-in introspection schema in the Schema Language
+printSchema, // Print a GraphQLType to GraphQL Schema language.
+printType, // Prints the built-in introspection schema in the Schema Language
// format.
-printIntrospectionSchema, // Print a GraphQLType to GraphQL Schema language.
-printType, // Create a GraphQLType from a GraphQL language AST.
+printIntrospectionSchema, // Create a GraphQLType from a GraphQL language AST.
typeFromAST, // Create a JavaScript value from a GraphQL language AST with a Type.
valueFromAST, // Create a JavaScript value from a GraphQL language AST without a Type.
valueFromASTUntyped, // Create a GraphQL language AST from a JavaScript value.
@@ -90,9 +91,11 @@
isValidJSValue, // @deprecated use validation - will be removed in v15
isValidLiteralValue, // Concatenates multiple AST together.
concatAST, // Separates an AST into an AST per Operation.
-separateOperations, // Comparators for types
+separateOperations, // Strips characters that are not significant to the validity or execution
+// of a GraphQL document.
+stripIgnoredCharacters, // Comparators for types
isEqualType, isTypeSubTypeOf, doTypesOverlap, // Asserts a string is a valid GraphQL name.
assertValidName, // Determine if a string is a valid GraphQL name.
isValidNameError, // Compares two GraphQLSchemas and detects breaking changes.
-findBreakingChanges, findDangerousChanges, BreakingChangeType, DangerousChangeType, // Report all deprecated usage within a GraphQL document.
+BreakingChangeType, DangerousChangeType, findBreakingChanges, findDangerousChanges, // Report all deprecated usage within a GraphQL document.
findDeprecatedUsages } from './utilities';
\ No newline at end of file

jsutils/keyMap.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { ObjMap } from './ObjMap';
+import { type ObjMap } from './ObjMap';
/**
* Creates a keyed JS object from an array, given a function to produce the keys

jsutils/keyValMap.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { ObjMap } from './ObjMap';
+import { type ObjMap } from './ObjMap';
/**
* Creates a keyed JS object from an array, given a function to produce the keys

jsutils/mapValue.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { ObjMap } from './ObjMap';
+import { type ObjMap } from './ObjMap';
import objectEntries from '../polyfills/objectEntries';
/**

jsutils/promiseForObject.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { ObjMap } from './ObjMap';
+import { type ObjMap } from './ObjMap';
/**
* This function transforms a JS object `ObjMap<Promise<T>>` into

jsutils/promiseReduce.js.flow

@@ -8,7 +8,7 @@
*/
import isPromise from './isPromise';
-import type { PromiseOrValue } from './PromiseOrValue';
+import { type PromiseOrValue } from './PromiseOrValue';
/**
* Similar to Array.prototype.reduce(), however the reducing callback may return

language/ast.js.flow

@@ -7,8 +7,8 @@
* @flow strict
*/
-import type { Source } from './source';
-import type { TokenKindEnum } from './lexer';
+import { type Source } from './source';
+import { type TokenKindEnum } from './lexer';
/**
* Contains a range of UTF-8 character offsets and token references that

language/blockString.js

@@ -4,6 +4,7 @@
value: true
});
exports.dedentBlockStringValue = dedentBlockStringValue;
+exports.getBlockStringIndentation = getBlockStringIndentation;
exports.printBlockString = printBlockString;
/**
@@ -25,24 +26,11 @@
// Expand a block string's raw value into independent lines.
var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first.
- var commonIndent = null;
+ var commonIndent = getBlockStringIndentation(lines);
+ if (commonIndent !== 0) {
for (var i = 1; i < lines.length; i++) {
- var line = lines[i];
- var indent = leadingWhitespace(line);
-
- if (indent < line.length && (commonIndent === null || indent < commonIndent)) {
- commonIndent = indent;
-
- if (commonIndent === 0) {
- break;
- }
- }
- }
-
- if (commonIndent) {
- for (var _i = 1; _i < lines.length; _i++) {
- lines[_i] = lines[_i].slice(commonIndent);
+ lines[i] = lines[i].slice(commonIndent);
}
} // Remove leading and trailing blank lines.
@@ -57,6 +45,30 @@
return lines.join('\n');
+} // @internal
+
+
+function getBlockStringIndentation(lines) {
+ var commonIndent = null;
+
+ for (var i = 1; i < lines.length; i++) {
+ var line = lines[i];
+ var indent = leadingWhitespace(line);
+
+ if (indent === line.length) {
+ continue; // skip empty lines
+ }
+
+ if (commonIndent === null || indent < commonIndent) {
+ commonIndent = indent;
+
+ if (commonIndent === 0) {
+ break;
+ }
+ }
+ }
+
+ return commonIndent === null ? 0 : commonIndent;
}
function leadingWhitespace(str) {

language/blockString.js.flow

@@ -18,22 +18,9 @@
const lines = rawString.split(/\r\n|[\n\r]/g);
// Remove common indentation from all lines but first.
- let commonIndent = null;
- for (let i = 1; i < lines.length; i++) {
- const line = lines[i];
- const indent = leadingWhitespace(line);
- if (
- indent < line.length &&
- (commonIndent === null || indent < commonIndent)
- ) {
- commonIndent = indent;
- if (commonIndent === 0) {
- break;
- }
- }
- }
+ const commonIndent = getBlockStringIndentation(lines);
- if (commonIndent) {
+ if (commonIndent !== 0) {
for (let i = 1; i < lines.length; i++) {
lines[i] = lines[i].slice(commonIndent);
}
@@ -51,6 +38,28 @@
return lines.join('\n');
}
+// @internal
+export function getBlockStringIndentation(lines: Array<string>): number {
+ let commonIndent = null;
+
+ for (let i = 1; i < lines.length; i++) {
+ const line = lines[i];
+ const indent = leadingWhitespace(line);
+ if (indent === line.length) {
+ continue; // skip empty lines
+ }
+
+ if (commonIndent === null || indent < commonIndent) {
+ commonIndent = indent;
+ if (commonIndent === 0) {
+ break;
+ }
+ }
+ }
+
+ return commonIndent === null ? 0 : commonIndent;
+}
+
function leadingWhitespace(str) {
let i = 0;
while (i < str.length && (str[i] === ' ' || str[i] === '\t')) {

language/blockString.mjs

@@ -17,24 +17,11 @@
// Expand a block string's raw value into independent lines.
var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first.
- var commonIndent = null;
+ var commonIndent = getBlockStringIndentation(lines);
+ if (commonIndent !== 0) {
for (var i = 1; i < lines.length; i++) {
- var line = lines[i];
- var indent = leadingWhitespace(line);
-
- if (indent < line.length && (commonIndent === null || indent < commonIndent)) {
- commonIndent = indent;
-
- if (commonIndent === 0) {
- break;
- }
- }
- }
-
- if (commonIndent) {
- for (var _i = 1; _i < lines.length; _i++) {
- lines[_i] = lines[_i].slice(commonIndent);
+ lines[i] = lines[i].slice(commonIndent);
}
} // Remove leading and trailing blank lines.
@@ -49,6 +36,29 @@
return lines.join('\n');
+} // @internal
+
+export function getBlockStringIndentation(lines) {
+ var commonIndent = null;
+
+ for (var i = 1; i < lines.length; i++) {
+ var line = lines[i];
+ var indent = leadingWhitespace(line);
+
+ if (indent === line.length) {
+ continue; // skip empty lines
+ }
+
+ if (commonIndent === null || indent < commonIndent) {
+ commonIndent = indent;
+
+ if (commonIndent === 0) {
+ break;
+ }
+ }
+ }
+
+ return commonIndent === null ? 0 : commonIndent;
}
function leadingWhitespace(str) {

language/index.js

@@ -3,6 +3,12 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
+Object.defineProperty(exports, "Source", {
+ enumerable: true,
+ get: function get() {
+ return _source.Source;
+ }
+});
Object.defineProperty(exports, "getLocation", {
enumerable: true,
get: function get() {
@@ -51,12 +57,6 @@
return _printer.print;
}
});
-Object.defineProperty(exports, "Source", {
- enumerable: true,
- get: function get() {
- return _source.Source;
- }
-});
Object.defineProperty(exports, "visit", {
enumerable: true,
get: function get() {
@@ -148,6 +148,8 @@
}
});
+var _source = require("./source");
+
var _location = require("./location");
var _kinds = require("./kinds");
@@ -158,8 +160,6 @@
var _printer = require("./printer");
-var _source = require("./source");
-
var _visitor = require("./visitor");
var _predicates = require("./predicates");

language/index.js.flow

@@ -7,14 +7,22 @@
* @flow strict
*/
+export { Source } from './source';
+
export { getLocation } from './location';
export type { SourceLocation } from './location';
+
export { Kind } from './kinds';
export type { KindEnum } from './kinds';
+
export { createLexer, TokenKind } from './lexer';
+export type { Lexer, TokenKindEnum } from './lexer';
+
export { parse, parseValue, parseType } from './parser';
+export type { ParseOptions } from './parser';
+
export { print } from './printer';
-export { Source } from './source';
+
export {
visit,
visitInParallel,
@@ -24,9 +32,6 @@
} from './visitor';
export type { ASTVisitor, Visitor, VisitFn, VisitorKeyMap } from './visitor';
-export type { Lexer, TokenKindEnum } from './lexer';
-export type { ParseOptions } from './parser';
-
export type {
Location,
Token,

language/index.mjs

@@ -6,12 +6,12 @@
*
*
*/
+export { Source } from './source';
export { getLocation } from './location';
export { Kind } from './kinds';
export { createLexer, TokenKind } from './lexer';
export { parse, parseValue, parseType } from './parser';
export { print } from './printer';
-export { Source } from './source';
export { visit, visitInParallel, visitWithTypeInfo, getVisitFn, BREAK } from './visitor';
export { isDefinitionNode, isExecutableDefinitionNode, isSelectionNode, isValueNode, isTypeNode, isTypeSystemDefinitionNode, isTypeDefinitionNode, isTypeSystemExtensionNode, isTypeExtensionNode } from './predicates';
export { DirectiveLocation } from './directiveLocation';
\ No newline at end of file

language/lexer.js

@@ -4,6 +4,7 @@
value: true
});
exports.createLexer = createLexer;
+exports.isPunctuatorToken = isPunctuatorToken;
exports.getTokenDesc = getTokenDesc;
exports.TokenKind = void 0;
@@ -104,6 +105,11 @@
exports.TokenKind = TokenKind;
+// @internal
+function isPunctuatorToken(token) {
+ var kind = token.kind;
+ return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;
+}
/**
* A helper function to describe a token as a string for debugging
*/

language/lexer.js.flow

@@ -8,8 +8,8 @@
*/
import defineToJSON from '../jsutils/defineToJSON';
-import type { Token } from './ast';
-import type { Source } from './source';
+import { type Token } from './ast';
+import { type Source } from './source';
import { syntaxError } from '../error';
import { dedentBlockStringValue } from './blockString';
@@ -129,6 +129,27 @@
*/
export type TokenKindEnum = $Values<typeof TokenKind>;
+// @internal
+export function isPunctuatorToken(token: Token) {
+ const kind = token.kind;
+ return (
+ kind === TokenKind.BANG ||
+ kind === TokenKind.DOLLAR ||
+ kind === TokenKind.AMP ||
+ kind === TokenKind.PAREN_L ||
+ kind === TokenKind.PAREN_R ||
+ kind === TokenKind.SPREAD ||
+ kind === TokenKind.COLON ||
+ kind === TokenKind.EQUALS ||
+ kind === TokenKind.AT ||
+ kind === TokenKind.BRACKET_L ||
+ kind === TokenKind.BRACKET_R ||
+ kind === TokenKind.BRACE_L ||
+ kind === TokenKind.PIPE ||
+ kind === TokenKind.BRACE_R
+ );
+}
+
/**
* A helper function to describe a token as a string for debugging
*/

language/lexer.mjs

@@ -88,6 +88,11 @@
* The enum type representing the token kinds values.
*/
+// @internal
+export function isPunctuatorToken(token) {
+ var kind = token.kind;
+ return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;
+}
/**
* A helper function to describe a token as a string for debugging
*/

language/location.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { Source } from './source';
+import { type Source } from './source';
/**
* Represents a location in a Source.

language/parser.js.flow

@@ -10,59 +10,63 @@
import inspect from '../jsutils/inspect';
import defineToJSON from '../jsutils/defineToJSON';
import { Source } from './source';
-import { syntaxError } from '../error';
-import type { GraphQLError } from '../error';
-import { createLexer, TokenKind, getTokenDesc } from './lexer';
-import type { Lexer, TokenKindEnum } from './lexer';
-import type {
- Location,
- Token,
- NameNode,
- VariableNode,
- DocumentNode,
- DefinitionNode,
- ExecutableDefinitionNode,
- OperationDefinitionNode,
- OperationTypeNode,
- VariableDefinitionNode,
- SelectionSetNode,
- SelectionNode,
- FieldNode,
- ArgumentNode,
- FragmentSpreadNode,
- InlineFragmentNode,
- FragmentDefinitionNode,
- ValueNode,
- StringValueNode,
- ListValueNode,
- ObjectValueNode,
- ObjectFieldNode,
- DirectiveNode,
- TypeNode,
- NamedTypeNode,
- ListTypeNode,
- NonNullTypeNode,
- TypeSystemDefinitionNode,
- SchemaDefinitionNode,
- OperationTypeDefinitionNode,
- ScalarTypeDefinitionNode,
- ObjectTypeDefinitionNode,
- FieldDefinitionNode,
- InputValueDefinitionNode,
- InterfaceTypeDefinitionNode,
- UnionTypeDefinitionNode,
- EnumTypeDefinitionNode,
- EnumValueDefinitionNode,
- InputObjectTypeDefinitionNode,
- DirectiveDefinitionNode,
- TypeSystemExtensionNode,
- SchemaExtensionNode,
- ScalarTypeExtensionNode,
- ObjectTypeExtensionNode,
- InterfaceTypeExtensionNode,
- UnionTypeExtensionNode,
- EnumTypeExtensionNode,
- InputObjectTypeExtensionNode,
+import { type GraphQLError, syntaxError } from '../error';
+import {
+ type Lexer,
+ type TokenKindEnum,
+ TokenKind,
+ getTokenDesc,
+ createLexer,
+} from './lexer';
+import {
+ type Location,
+ type Token,
+ type NameNode,
+ type VariableNode,
+ type DocumentNode,
+ type DefinitionNode,
+ type ExecutableDefinitionNode,
+ type OperationDefinitionNode,
+ type OperationTypeNode,
+ type VariableDefinitionNode,
+ type SelectionSetNode,
+ type SelectionNode,
+ type FieldNode,
+ type ArgumentNode,
+ type FragmentSpreadNode,
+ type InlineFragmentNode,
+ type FragmentDefinitionNode,
+ type ValueNode,
+ type StringValueNode,
+ type ListValueNode,
+ type ObjectValueNode,
+ type ObjectFieldNode,
+ type DirectiveNode,
+ type TypeNode,
+ type NamedTypeNode,
+ type ListTypeNode,
+ type NonNullTypeNode,
+ type TypeSystemDefinitionNode,
+ type SchemaDefinitionNode,
+ type OperationTypeDefinitionNode,
+ type ScalarTypeDefinitionNode,
+ type ObjectTypeDefinitionNode,
+ type FieldDefinitionNode,
+ type InputValueDefinitionNode,
+ type InterfaceTypeDefinitionNode,
+ type UnionTypeDefinitionNode,
+ type EnumTypeDefinitionNode,
+ type EnumValueDefinitionNode,
+ type InputObjectTypeDefinitionNode,
+ type DirectiveDefinitionNode,
+ type TypeSystemExtensionNode,
+ type SchemaExtensionNode,
+ type ScalarTypeExtensionNode,
+ type ObjectTypeExtensionNode,
+ type InterfaceTypeExtensionNode,
+ type UnionTypeExtensionNode,
+ type EnumTypeExtensionNode,
+ type InputObjectTypeExtensionNode,
} from './ast';
import { Kind } from './kinds';

language/parser.mjs

@@ -10,7 +10,7 @@
import defineToJSON from '../jsutils/defineToJSON';
import { Source } from './source';
import { syntaxError } from '../error';
-import { createLexer, TokenKind, getTokenDesc } from './lexer';
+import { TokenKind, getTokenDesc, createLexer } from './lexer';
import { Kind } from './kinds';
import { DirectiveLocation } from './directiveLocation';
/**

language/predicates.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { ASTNode } from './ast';
+import { type ASTNode } from './ast';
import { Kind } from './kinds';
export function isDefinitionNode(node: ASTNode): boolean %checks {

language/printer.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { ASTNode } from './ast';
+import { type ASTNode } from './ast';
import { visit } from './visitor';
import { printBlockString } from './blockString';

language/visitor.js

@@ -192,10 +192,8 @@
} else {
var clone = {};
- var _arr = Object.keys(node);
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var k = _arr[_i];
+ for (var _i = 0, _Object$keys = Object.keys(node); _i < _Object$keys.length; _i++) {
+ var k = _Object$keys[_i];
clone[k] = node[k];
}

language/visitor.js.flow

@@ -8,8 +8,8 @@
*/
import inspect from '../jsutils/inspect';
-import type { ASTNode, ASTKindToNode } from './ast';
-import type { TypeInfo } from '../utilities/TypeInfo';
+import { type ASTNode, type ASTKindToNode } from './ast';
+import { type TypeInfo } from '../utilities/TypeInfo';
/**
* A visitor is provided to visit, it contains the collection of

language/visitor.mjs

@@ -175,10 +175,8 @@
} else {
var clone = {};
- var _arr = Object.keys(node);
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var k = _arr[_i];
+ for (var _i = 0, _Object$keys = Object.keys(node); _i < _Object$keys.length; _i++) {
+ var k = _Object$keys[_i];
clone[k] = node[k];
}

package.json

@@ -1,6 +1,6 @@
{
"name": "graphql",
- "version": "14.2.1",
+ "version": "14.3.0",
"description": "A Query Language and Runtime which can target any service.",
"license": "MIT",
"main": "index",

polyfills/objectEntries.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { ObjMap } from '../jsutils/ObjMap';
+import { type ObjMap } from '../jsutils/ObjMap';
declare function objectEntries<T>(obj: ObjMap<T>): Array<[string, T]>;

polyfills/objectValues.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { ObjMap } from '../jsutils/ObjMap';
+import { type ObjMap } from '../jsutils/ObjMap';
declare function objectValues<T>(obj: ObjMap<T>): Array<T>;

subscription/mapAsyncIterator.js.flow

@@ -8,7 +8,7 @@
*/
import { $$asyncIterator, getAsyncIterator } from 'iterall';
-import type { PromiseOrValue } from '../jsutils/PromiseOrValue';
+import { type PromiseOrValue } from '../jsutils/PromiseOrValue';
/**
* Given an AsyncIterable and a callback function, return an AsyncIterator

subscription/subscribe.js.flow

@@ -12,6 +12,7 @@
import { GraphQLError } from '../error/GraphQLError';
import { locatedError } from '../error/locatedError';
import {
+ type ExecutionResult,
addPath,
assertValidExecutionArguments,
buildExecutionContext,
@@ -22,13 +23,12 @@
resolveFieldValueOrError,
responsePathAsArray,
} from '../execution/execute';
-import type { GraphQLSchema } from '../type/schema';
+import { type GraphQLSchema } from '../type/schema';
import mapAsyncIterator from './mapAsyncIterator';
-import type { ObjMap } from '../jsutils/ObjMap';
-import type { ExecutionResult } from '../execution/execute';
-import type { DocumentNode } from '../language/ast';
-import type { GraphQLFieldResolver } from '../type/definition';
+import { type ObjMap } from '../jsutils/ObjMap';
+import { type DocumentNode } from '../language/ast';
+import { type GraphQLFieldResolver } from '../type/definition';
import { getOperationRootType } from '../utilities/getOperationRootType';
/**

type/definition.js.flow

@@ -16,32 +16,32 @@
import keyMap from '../jsutils/keyMap';
import keyValMap from '../jsutils/keyValMap';
import mapValue from '../jsutils/mapValue';
-import type { ObjMap } from '../jsutils/ObjMap';
+import { type ObjMap } from '../jsutils/ObjMap';
import { Kind } from '../language/kinds';
import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped';
-import type {
- ScalarTypeDefinitionNode,
- ObjectTypeDefinitionNode,
- FieldDefinitionNode,
- InputValueDefinitionNode,
- InterfaceTypeDefinitionNode,
- UnionTypeDefinitionNode,
- EnumTypeDefinitionNode,
- EnumValueDefinitionNode,
- InputObjectTypeDefinitionNode,
- ScalarTypeExtensionNode,
- ObjectTypeExtensionNode,
- InterfaceTypeExtensionNode,
- UnionTypeExtensionNode,
- EnumTypeExtensionNode,
- InputObjectTypeExtensionNode,
- OperationDefinitionNode,
- FieldNode,
- FragmentDefinitionNode,
- ValueNode,
+import {
+ type ScalarTypeDefinitionNode,
+ type ObjectTypeDefinitionNode,
+ type FieldDefinitionNode,
+ type InputValueDefinitionNode,
+ type InterfaceTypeDefinitionNode,
+ type UnionTypeDefinitionNode,
+ type EnumTypeDefinitionNode,
+ type EnumValueDefinitionNode,
+ type InputObjectTypeDefinitionNode,
+ type ScalarTypeExtensionNode,
+ type ObjectTypeExtensionNode,
+ type InterfaceTypeExtensionNode,
+ type UnionTypeExtensionNode,
+ type EnumTypeExtensionNode,
+ type InputObjectTypeExtensionNode,
+ type OperationDefinitionNode,
+ type FieldNode,
+ type FragmentDefinitionNode,
+ type ValueNode,
} from '../language/ast';
-import type { GraphQLSchema } from './schema';
-import type { PromiseOrValue } from '../jsutils/PromiseOrValue';
+import { type GraphQLSchema } from './schema';
+import { type PromiseOrValue } from '../jsutils/PromiseOrValue';
// Predicates & Assertions

type/directives.js

@@ -156,7 +156,8 @@
exports.specifiedDirectives = specifiedDirectives;
function isSpecifiedDirective(directive) {
- return specifiedDirectives.some(function (specifiedDirective) {
- return specifiedDirective.name === directive.name;
+ return isDirective(directive) && specifiedDirectives.some(function (_ref2) {
+ var name = _ref2.name;
+ return name === directive.name;
});
}
\ No newline at end of file

type/directives.js.flow

@@ -8,19 +8,19 @@
*/
import objectEntries from '../polyfills/objectEntries';
-import { argsToArgsConfig } from './definition';
-import type {
- GraphQLFieldConfigArgumentMap,
- GraphQLArgument,
+import {
+ type GraphQLFieldConfigArgumentMap,
+ type GraphQLArgument,
+ argsToArgsConfig,
+ GraphQLNonNull,
} from './definition';
-import { GraphQLNonNull } from './definition';
import { GraphQLString, GraphQLBoolean } from './scalars';
import defineToStringTag from '../jsutils/defineToStringTag';
import defineToJSON from '../jsutils/defineToJSON';
import instanceOf from '../jsutils/instanceOf';
import invariant from '../jsutils/invariant';
import inspect from '../jsutils/inspect';
-import type { DirectiveDefinitionNode } from '../language/ast';
+import { type DirectiveDefinitionNode } from '../language/ast';
import {
DirectiveLocation,
type DirectiveLocationEnum,
@@ -187,10 +187,9 @@
GraphQLDeprecatedDirective,
];
-export function isSpecifiedDirective(
- directive: GraphQLDirective,
-): boolean %checks {
- return specifiedDirectives.some(
- specifiedDirective => specifiedDirective.name === directive.name,
+export function isSpecifiedDirective(directive: mixed): boolean %checks {
+ return (
+ isDirective(directive) &&
+ specifiedDirectives.some(({ name }) => name === directive.name)
);
}

type/directives.mjs

@@ -9,8 +9,7 @@
*
*/
import objectEntries from '../polyfills/objectEntries';
-import { argsToArgsConfig } from './definition';
-import { GraphQLNonNull } from './definition';
+import { argsToArgsConfig, GraphQLNonNull } from './definition';
import { GraphQLString, GraphQLBoolean } from './scalars';
import defineToStringTag from '../jsutils/defineToStringTag';
import defineToJSON from '../jsutils/defineToJSON';
@@ -138,7 +137,8 @@
export var specifiedDirectives = [GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective];
export function isSpecifiedDirective(directive) {
- return specifiedDirectives.some(function (specifiedDirective) {
- return specifiedDirective.name === directive.name;
+ return isDirective(directive) && specifiedDirectives.some(function (_ref2) {
+ var name = _ref2.name;
+ return name === directive.name;
});
}
\ No newline at end of file

type/index.js

@@ -393,12 +393,6 @@
return _scalars.GraphQLID;
}
});
-Object.defineProperty(exports, "TypeKind", {
- enumerable: true,
- get: function get() {
- return _introspection.TypeKind;
- }
-});
Object.defineProperty(exports, "isIntrospectionType", {
enumerable: true,
get: function get() {
@@ -459,6 +453,12 @@
return _introspection.__TypeKind;
}
});
+Object.defineProperty(exports, "TypeKind", {
+ enumerable: true,
+ get: function get() {
+ return _introspection.TypeKind;
+ }
+});
Object.defineProperty(exports, "SchemaMetaFieldDef", {
enumerable: true,
get: function get() {

type/index.js.flow

@@ -93,7 +93,9 @@
// Common built-in scalar instances.
export {
+ // Predicate
isSpecifiedScalarType,
+ // Standard GraphQL Scalars
specifiedScalarTypes,
GraphQLInt,
GraphQLFloat,
@@ -103,10 +105,9 @@
} from './scalars';
export {
- // "Enum" of Type Kinds
- TypeKind,
- // GraphQL Types for introspection.
+ // Predicate
isIntrospectionType,
+ // GraphQL Types for introspection.
introspectionTypes,
__Schema,
__Directive,
@@ -116,6 +117,8 @@
__InputValue,
__EnumValue,
__TypeKind,
+ // "Enum" of Type Kinds
+ TypeKind,
// Meta-field definitions.
SchemaMetaFieldDef,
TypeMetaFieldDef,
@@ -163,4 +166,5 @@
GraphQLScalarLiteralParser,
} from './definition';
+// Validate GraphQL schema.
export { validateSchema, assertValidSchema } from './validate';

type/index.mjs

@@ -23,9 +23,13 @@
isSpecifiedDirective, specifiedDirectives, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, // Constant Deprecation Reason
DEFAULT_DEPRECATION_REASON } from './directives';
// Common built-in scalar instances.
-export { isSpecifiedScalarType, specifiedScalarTypes, GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID } from './scalars';
-export { // "Enum" of Type Kinds
-TypeKind, // GraphQL Types for introspection.
-isIntrospectionType, introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind, // Meta-field definitions.
+export { // Predicate
+isSpecifiedScalarType, // Standard GraphQL Scalars
+specifiedScalarTypes, GraphQLInt, GraphQLFloat, GraphQLString, GraphQLBoolean, GraphQLID } from './scalars';
+export { // Predicate
+isIntrospectionType, // GraphQL Types for introspection.
+introspectionTypes, __Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind, // "Enum" of Type Kinds
+TypeKind, // Meta-field definitions.
SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef } from './introspection';
+// Validate GraphQL schema.
export { validateSchema, assertValidSchema } from './validate';
\ No newline at end of file

type/introspection.js

@@ -544,7 +544,8 @@
exports.introspectionTypes = introspectionTypes;
function isIntrospectionType(type) {
- return (0, _definition.isNamedType)(type) && ( // Would prefer to use introspectionTypes.some(), however %checks needs
- // a simple expression.
- type.name === __Schema.name || type.name === __Directive.name || type.name === __DirectiveLocation.name || type.name === __Type.name || type.name === __Field.name || type.name === __InputValue.name || type.name === __EnumValue.name || type.name === __TypeKind.name);
+ return (0, _definition.isNamedType)(type) && introspectionTypes.some(function (_ref8) {
+ var name = _ref8.name;
+ return type.name === name;
+ });
}
\ No newline at end of file

type/introspection.js.flow

@@ -12,6 +12,7 @@
import { astFromValue } from '../utilities/astFromValue';
import { print } from '../language/printer';
import {
+ type GraphQLField,
GraphQLObjectType,
GraphQLEnumType,
GraphQLList,
@@ -29,7 +30,6 @@
} from './definition';
import { GraphQLString, GraphQLBoolean } from './scalars';
import { DirectiveLocation } from '../language/directiveLocation';
-import type { GraphQLField } from './definition';
export const __Schema = new GraphQLObjectType({
name: '__Schema',
@@ -487,15 +487,6 @@
export function isIntrospectionType(type: mixed): boolean %checks {
return (
isNamedType(type) &&
- // Would prefer to use introspectionTypes.some(), however %checks needs
- // a simple expression.
- (type.name === __Schema.name ||
- type.name === __Directive.name ||
- type.name === __DirectiveLocation.name ||
- type.name === __Type.name ||
- type.name === __Field.name ||
- type.name === __InputValue.name ||
- type.name === __EnumValue.name ||
- type.name === __TypeKind.name)
+ introspectionTypes.some(({ name }) => type.name === name)
);
}

type/introspection.mjs

@@ -498,7 +498,8 @@
};
export var introspectionTypes = [__Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind];
export function isIntrospectionType(type) {
- return isNamedType(type) && ( // Would prefer to use introspectionTypes.some(), however %checks needs
- // a simple expression.
- type.name === __Schema.name || type.name === __Directive.name || type.name === __DirectiveLocation.name || type.name === __Type.name || type.name === __Field.name || type.name === __InputValue.name || type.name === __EnumValue.name || type.name === __TypeKind.name);
+ return isNamedType(type) && introspectionTypes.some(function (_ref8) {
+ var name = _ref8.name;
+ return type.name === name;
+ });
}
\ No newline at end of file

type/scalars.js

@@ -249,7 +249,8 @@
exports.specifiedScalarTypes = specifiedScalarTypes;
function isSpecifiedScalarType(type) {
- return (0, _definition.isNamedType)(type) && ( // Would prefer to use specifiedScalarTypes.some(), however %checks needs
- // a simple expression.
- type.name === GraphQLString.name || type.name === GraphQLInt.name || type.name === GraphQLFloat.name || type.name === GraphQLBoolean.name || type.name === GraphQLID.name);
+ return (0, _definition.isScalarType)(type) && specifiedScalarTypes.some(function (_ref) {
+ var name = _ref.name;
+ return type.name === name;
+ });
}
\ No newline at end of file

type/scalars.js.flow

@@ -10,7 +10,7 @@
import isFinite from '../polyfills/isFinite';
import isInteger from '../polyfills/isInteger';
import inspect from '../jsutils/inspect';
-import { GraphQLScalarType, isNamedType } from './definition';
+import { GraphQLScalarType, isScalarType } from './definition';
import { Kind } from '../language/kinds';
// As per the GraphQL Spec, Integers are only treated as valid when a valid
@@ -255,13 +255,7 @@
export function isSpecifiedScalarType(type: mixed): boolean %checks {
return (
- isNamedType(type) &&
- // Would prefer to use specifiedScalarTypes.some(), however %checks needs
- // a simple expression.
- (type.name === GraphQLString.name ||
- type.name === GraphQLInt.name ||
- type.name === GraphQLFloat.name ||
- type.name === GraphQLBoolean.name ||
- type.name === GraphQLID.name)
+ isScalarType(type) &&
+ specifiedScalarTypes.some(({ name }) => type.name === name)
);
}

type/scalars.mjs

@@ -11,7 +11,7 @@
import isFinite from '../polyfills/isFinite';
import isInteger from '../polyfills/isInteger';
import inspect from '../jsutils/inspect';
-import { GraphQLScalarType, isNamedType } from './definition';
+import { GraphQLScalarType, isScalarType } from './definition';
import { Kind } from '../language/kinds'; // As per the GraphQL Spec, Integers are only treated as valid when a valid
// 32-bit signed integer, providing the broadest support across platforms.
//
@@ -234,7 +234,8 @@
});
export var specifiedScalarTypes = [GraphQLString, GraphQLInt, GraphQLFloat, GraphQLBoolean, GraphQLID];
export function isSpecifiedScalarType(type) {
- return isNamedType(type) && ( // Would prefer to use specifiedScalarTypes.some(), however %checks needs
- // a simple expression.
- type.name === GraphQLString.name || type.name === GraphQLInt.name || type.name === GraphQLFloat.name || type.name === GraphQLBoolean.name || type.name === GraphQLID.name);
+ return isScalarType(type) && specifiedScalarTypes.some(function (_ref) {
+ var name = _ref.name;
+ return type.name === name;
+ });
}
\ No newline at end of file

type/schema.js.flow

@@ -10,6 +10,10 @@
import find from '../polyfills/find';
import objectValues from '../polyfills/objectValues';
import {
+ type GraphQLType,
+ type GraphQLNamedType,
+ type GraphQLAbstractType,
+ type GraphQLObjectType,
isAbstractType,
isObjectType,
isInterfaceType,
@@ -17,28 +21,22 @@
isInputObjectType,
isWrappingType,
} from './definition';
-import type {
- GraphQLType,
- GraphQLNamedType,
- GraphQLAbstractType,
- GraphQLObjectType,
-} from './definition';
-import type {
- SchemaDefinitionNode,
- SchemaExtensionNode,
+import {
+ type SchemaDefinitionNode,
+ type SchemaExtensionNode,
} from '../language/ast';
import {
GraphQLDirective,
isDirective,
specifiedDirectives,
} from './directives';
-import type { GraphQLError } from '../error/GraphQLError';
+import { type GraphQLError } from '../error/GraphQLError';
import inspect from '../jsutils/inspect';
import { __Schema } from './introspection';
import defineToStringTag from '../jsutils/defineToStringTag';
import instanceOf from '../jsutils/instanceOf';
import invariant from '../jsutils/invariant';
-import type { ObjMap } from '../jsutils/ObjMap';
+import { type ObjMap } from '../jsutils/ObjMap';
/**
* Test if the given value is a GraphQL schema.

type/validate.js.flow

@@ -12,6 +12,11 @@
import objectValues from '../polyfills/objectValues';
import objectEntries from '../polyfills/objectEntries';
import {
+ type GraphQLObjectType,
+ type GraphQLInterfaceType,
+ type GraphQLUnionType,
+ type GraphQLEnumType,
+ type GraphQLInputObjectType,
isObjectType,
isInterfaceType,
isUnionType,
@@ -22,26 +27,17 @@
isOutputType,
isRequiredArgument,
} from './definition';
-import type {
- GraphQLObjectType,
- GraphQLInterfaceType,
- GraphQLUnionType,
- GraphQLEnumType,
- GraphQLInputObjectType,
-} from './definition';
-import { isDirective } from './directives';
-import type { GraphQLDirective } from './directives';
+import { type GraphQLDirective, isDirective } from './directives';
import { isIntrospectionType } from './introspection';
-import { assertSchema } from './schema';
-import type { GraphQLSchema } from './schema';
+import { type GraphQLSchema, assertSchema } from './schema';
import inspect from '../jsutils/inspect';
import { GraphQLError } from '../error/GraphQLError';
-import type {
- ASTNode,
- FieldDefinitionNode,
- InputValueDefinitionNode,
- NamedTypeNode,
- TypeNode,
+import {
+ type ASTNode,
+ type FieldDefinitionNode,
+ type InputValueDefinitionNode,
+ type NamedTypeNode,
+ type TypeNode,
} from '../language/ast';
import { isValidNameError } from '../utilities/assertValidName';
import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators';

utilities/assertValidName.js.flow

@@ -8,7 +8,7 @@
*/
import { GraphQLError } from '../error/GraphQLError';
-import type { ASTNode } from '../language/ast';
+import { type ASTNode } from '../language/ast';
import invariant from '../jsutils/invariant';
const NAME_RX = /^[_a-zA-Z][_a-zA-Z0-9]*$/;

utilities/astFromValue.js.flow

@@ -13,10 +13,10 @@
import inspect from '../jsutils/inspect';
import isNullish from '../jsutils/isNullish';
import isInvalid from '../jsutils/isInvalid';
-import type { ValueNode } from '../language/ast';
+import { type ValueNode } from '../language/ast';
import { Kind } from '../language/kinds';
-import type { GraphQLInputType } from '../type/definition';
import {
+ type GraphQLInputType,
isLeafType,
isEnumType,
isInputObjectType,

utilities/buildASTSchema.js.flow

@@ -12,51 +12,47 @@
import invariant from '../jsutils/invariant';
import keyMap from '../jsutils/keyMap';
import keyValMap from '../jsutils/keyValMap';
-import type { ObjMap } from '../jsutils/ObjMap';
+import { type ObjMap } from '../jsutils/ObjMap';
import { valueFromAST } from './valueFromAST';
import { assertValidSDL } from '../validation/validate';
import { dedentBlockStringValue } from '../language/blockString';
import { TokenKind } from '../language/lexer';
-import { parse } from '../language/parser';
-import type { ParseOptions } from '../language/parser';
-import type { Source } from '../language/source';
+import { type ParseOptions, parse } from '../language/parser';
+import { type Source } from '../language/source';
import { getDirectiveValues } from '../execution/values';
import { Kind } from '../language/kinds';
-import type {
- DocumentNode,
- NameNode,
- TypeNode,
- NamedTypeNode,
- SchemaDefinitionNode,
- TypeDefinitionNode,
- ScalarTypeDefinitionNode,
- ObjectTypeDefinitionNode,
- FieldDefinitionNode,
- InputValueDefinitionNode,
- InterfaceTypeDefinitionNode,
- UnionTypeDefinitionNode,
- EnumTypeDefinitionNode,
- EnumValueDefinitionNode,
- InputObjectTypeDefinitionNode,
- DirectiveDefinitionNode,
- StringValueNode,
- Location,
+import {
+ type DocumentNode,
+ type NameNode,
+ type TypeNode,
+ type NamedTypeNode,
+ type SchemaDefinitionNode,
+ type TypeDefinitionNode,
+ type ScalarTypeDefinitionNode,
+ type ObjectTypeDefinitionNode,
+ type FieldDefinitionNode,
+ type InputValueDefinitionNode,
+ type InterfaceTypeDefinitionNode,
+ type UnionTypeDefinitionNode,
+ type EnumTypeDefinitionNode,
+ type EnumValueDefinitionNode,
+ type InputObjectTypeDefinitionNode,
+ type DirectiveDefinitionNode,
+ type StringValueNode,
+ type Location,
} from '../language/ast';
import { isTypeDefinitionNode } from '../language/predicates';
-import type { DirectiveLocationEnum } from '../language/directiveLocation';
-
-import type {
- GraphQLType,
- GraphQLNamedType,
- GraphQLFieldConfig,
- GraphQLArgumentConfig,
- GraphQLEnumValueConfig,
- GraphQLInputFieldConfig,
-} from '../type/definition';
+import { type DirectiveLocationEnum } from '../language/directiveLocation';
import {
+ type GraphQLType,
+ type GraphQLNamedType,
+ type GraphQLFieldConfig,
+ type GraphQLArgumentConfig,
+ type GraphQLEnumValueConfig,
+ type GraphQLInputFieldConfig,
GraphQLScalarType,
GraphQLObjectType,
GraphQLInterfaceType,
@@ -78,8 +74,10 @@
import { specifiedScalarTypes } from '../type/scalars';
-import { GraphQLSchema } from '../type/schema';
-import type { GraphQLSchemaValidationOptions } from '../type/schema';
+import {
+ type GraphQLSchemaValidationOptions,
+ GraphQLSchema,
+} from '../type/schema';
export type BuildSchemaOptions = {
...GraphQLSchemaValidationOptions,

utilities/buildClientSchema.js

@@ -60,9 +60,7 @@
return buildType(typeIntrospection);
});
- var _arr = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes);
-
- for (var _i = 0; _i < _arr.length; _i++) {
+ for (var _i = 0, _arr = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes); _i < _arr.length; _i++) {
var stdType = _arr[_i];
typeMap[stdType.name] = stdType;
} // Get the root Query, Mutation, and Subscription types.

utilities/buildClientSchema.js.flow

@@ -13,9 +13,16 @@
import keyValMap from '../jsutils/keyValMap';
import { valueFromAST } from './valueFromAST';
import { parseValue } from '../language/parser';
-import { GraphQLSchema } from '../type/schema';
+import {
+ type GraphQLSchemaValidationOptions,
+ GraphQLSchema,
+} from '../type/schema';
import {
+ type GraphQLType,
+ type GraphQLInputType,
+ type GraphQLOutputType,
+ type GraphQLNamedType,
isInputType,
isOutputType,
GraphQLScalarType,
@@ -31,36 +38,27 @@
assertInterfaceType,
} from '../type/definition';
-import type {
- GraphQLType,
- GraphQLInputType,
- GraphQLOutputType,
- GraphQLNamedType,
-} from '../type/definition';
-
import { GraphQLDirective } from '../type/directives';
import { introspectionTypes, TypeKind } from '../type/introspection';
import { specifiedScalarTypes } from '../type/scalars';
-import type {
- IntrospectionQuery,
- IntrospectionType,
- IntrospectionScalarType,
- IntrospectionObjectType,
- IntrospectionInterfaceType,
- IntrospectionUnionType,
- IntrospectionEnumType,
- IntrospectionInputObjectType,
- IntrospectionTypeRef,
- IntrospectionInputTypeRef,
- IntrospectionOutputTypeRef,
- IntrospectionNamedTypeRef,
+import {
+ type IntrospectionQuery,
+ type IntrospectionType,
+ type IntrospectionScalarType,
+ type IntrospectionObjectType,
+ type IntrospectionInterfaceType,
+ type IntrospectionUnionType,
+ type IntrospectionEnumType,
+ type IntrospectionInputObjectType,
+ type IntrospectionTypeRef,
+ type IntrospectionInputTypeRef,
+ type IntrospectionOutputTypeRef,
+ type IntrospectionNamedTypeRef,
} from './introspectionQuery';
-import type { GraphQLSchemaValidationOptions } from '../type/schema';
-
type Options = {|
...GraphQLSchemaValidationOptions,
|};

utilities/buildClientSchema.mjs

@@ -40,9 +40,7 @@
return buildType(typeIntrospection);
});
- var _arr = [].concat(specifiedScalarTypes, introspectionTypes);
-
- for (var _i = 0; _i < _arr.length; _i++) {
+ for (var _i = 0, _arr = [].concat(specifiedScalarTypes, introspectionTypes); _i < _arr.length; _i++) {
var stdType = _arr[_i];
typeMap[stdType.name] = stdType;
} // Get the root Query, Mutation, and Subscription types.

utilities/coerceValue.js

@@ -154,10 +154,8 @@
}
}
- var _arr = Object.keys(value);
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var fieldName = _arr[_i];
+ for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
+ var fieldName = _Object$keys[_i];
if (!fields[fieldName]) {
var _suggestions = (0, _suggestionList.default)(fieldName, Object.keys(fields));

utilities/coerceValue.js.flow

@@ -14,15 +14,15 @@
import orList from '../jsutils/orList';
import suggestionList from '../jsutils/suggestionList';
import { GraphQLError } from '../error/GraphQLError';
-import type { ASTNode } from '../language/ast';
+import { type ASTNode } from '../language/ast';
import {
+ type GraphQLInputType,
isScalarType,
isEnumType,
isInputObjectType,
isListType,
isNonNullType,
} from '../type/definition';
-import type { GraphQLInputType } from '../type/definition';
type CoercedValue = {|
+errors: $ReadOnlyArray<GraphQLError> | void,

utilities/coerceValue.mjs

@@ -146,10 +146,8 @@
}
}
- var _arr = Object.keys(value);
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var fieldName = _arr[_i];
+ for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
+ var fieldName = _Object$keys[_i];
if (!fields[fieldName]) {
var _suggestions = suggestionList(fieldName, Object.keys(fields));

utilities/concatAST.js.flow

@@ -8,7 +8,7 @@
*/
import flatMap from '../polyfills/flatMap';
-import type { DocumentNode } from '../language/ast';
+import { type DocumentNode } from '../language/ast';
/**
* Provided a collection of ASTs, presumably each from different files,

utilities/extendSchema.js

@@ -190,10 +190,8 @@
} // Then, incorporate schema definition and all schema extensions.
- var _arr = schemaExts;
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var schemaExt = _arr[_i];
+ for (var _i = 0, _schemaExts = schemaExts; _i < _schemaExts.length; _i++) {
+ var schemaExt = _schemaExts[_i];
if (schemaExt.operationTypes) {
var _iteratorNormalCompletion4 = true;

utilities/extendSchema.js.flow

@@ -15,14 +15,16 @@
import keyValMap from '../jsutils/keyValMap';
import { ASTDefinitionBuilder } from './buildASTSchema';
import { assertValidSDLExtension } from '../validation/validate';
-import { assertSchema, GraphQLSchema } from '../type/schema';
+import {
+ type GraphQLSchemaValidationOptions,
+ assertSchema,
+ GraphQLSchema,
+} from '../type/schema';
import { isIntrospectionType } from '../type/introspection';
import { isSpecifiedScalarType } from '../type/scalars';
-import type { GraphQLSchemaValidationOptions } from '../type/schema';
-import type { GraphQLNamedType } from '../type/definition';
-
import {
+ type GraphQLNamedType,
isScalarType,
isObjectType,
isInterfaceType,
@@ -45,11 +47,11 @@
import { Kind } from '../language/kinds';
-import type {
- DocumentNode,
- DirectiveDefinitionNode,
- SchemaExtensionNode,
- SchemaDefinitionNode,
+import {
+ type DocumentNode,
+ type DirectiveDefinitionNode,
+ type SchemaExtensionNode,
+ type SchemaDefinitionNode,
} from '../language/ast';
import {
isTypeDefinitionNode,

utilities/extendSchema.mjs

@@ -175,10 +175,8 @@
} // Then, incorporate schema definition and all schema extensions.
- var _arr = schemaExts;
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var schemaExt = _arr[_i];
+ for (var _i = 0, _schemaExts = schemaExts; _i < _schemaExts.length; _i++) {
+ var schemaExt = _schemaExts[_i];
if (schemaExt.operationTypes) {
var _iteratorNormalCompletion4 = true;

utilities/findBreakingChanges.js

@@ -94,10 +94,8 @@
var newTypeMap = newSchema.getTypeMap();
var breakingChanges = [];
- var _arr = Object.keys(oldTypeMap);
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var typeName = _arr[_i];
+ for (var _i = 0, _Object$keys = Object.keys(oldTypeMap); _i < _Object$keys.length; _i++) {
+ var typeName = _Object$keys[_i];
if (!newTypeMap[typeName]) {
breakingChanges.push({
@@ -120,10 +118,8 @@
var newTypeMap = newSchema.getTypeMap();
var breakingChanges = [];
- var _arr2 = Object.keys(oldTypeMap);
-
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
- var typeName = _arr2[_i2];
+ for (var _i2 = 0, _Object$keys2 = Object.keys(oldTypeMap); _i2 < _Object$keys2.length; _i2++) {
+ var typeName = _Object$keys2[_i2];
if (!newTypeMap[typeName]) {
continue;
@@ -156,10 +152,8 @@
var breakingChanges = [];
var dangerousChanges = [];
- var _arr3 = Object.keys(oldTypeMap);
-
- for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
- var typeName = _arr3[_i3];
+ for (var _i3 = 0, _Object$keys3 = Object.keys(oldTypeMap); _i3 < _Object$keys3.length; _i3++) {
+ var typeName = _Object$keys3[_i3];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -170,10 +164,8 @@
var oldTypeFields = oldType.getFields();
var newTypeFields = newType.getFields();
- var _arr4 = Object.keys(oldTypeFields);
-
- for (var _i4 = 0; _i4 < _arr4.length; _i4++) {
- var fieldName = _arr4[_i4];
+ for (var _i4 = 0, _Object$keys4 = Object.keys(oldTypeFields); _i4 < _Object$keys4.length; _i4++) {
+ var fieldName = _Object$keys4[_i4];
if (!newTypeFields[fieldName]) {
continue;
@@ -320,10 +312,8 @@
var newTypeMap = newSchema.getTypeMap();
var breakingChanges = [];
- var _arr5 = Object.keys(oldTypeMap);
-
- for (var _i5 = 0; _i5 < _arr5.length; _i5++) {
- var typeName = _arr5[_i5];
+ for (var _i5 = 0, _Object$keys5 = Object.keys(oldTypeMap); _i5 < _Object$keys5.length; _i5++) {
+ var typeName = _Object$keys5[_i5];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -334,10 +324,8 @@
var oldTypeFieldsDef = oldType.getFields();
var newTypeFieldsDef = newType.getFields();
- var _arr6 = Object.keys(oldTypeFieldsDef);
-
- for (var _i6 = 0; _i6 < _arr6.length; _i6++) {
- var fieldName = _arr6[_i6];
+ for (var _i6 = 0, _Object$keys6 = Object.keys(oldTypeFieldsDef); _i6 < _Object$keys6.length; _i6++) {
+ var fieldName = _Object$keys6[_i6];
// Check if the field is missing on the type in the new schema.
if (!(fieldName in newTypeFieldsDef)) {
@@ -371,10 +359,8 @@
var breakingChanges = [];
var dangerousChanges = [];
- var _arr7 = Object.keys(oldTypeMap);
-
- for (var _i7 = 0; _i7 < _arr7.length; _i7++) {
- var typeName = _arr7[_i7];
+ for (var _i7 = 0, _Object$keys7 = Object.keys(oldTypeMap); _i7 < _Object$keys7.length; _i7++) {
+ var typeName = _Object$keys7[_i7];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -385,10 +371,8 @@
var oldTypeFieldsDef = oldType.getFields();
var newTypeFieldsDef = newType.getFields();
- var _arr8 = Object.keys(oldTypeFieldsDef);
-
- for (var _i8 = 0; _i8 < _arr8.length; _i8++) {
- var fieldName = _arr8[_i8];
+ for (var _i8 = 0, _Object$keys8 = Object.keys(oldTypeFieldsDef); _i8 < _Object$keys8.length; _i8++) {
+ var fieldName = _Object$keys8[_i8];
// Check if the field is missing on the type in the new schema.
if (!(fieldName in newTypeFieldsDef)) {
@@ -413,10 +397,8 @@
} // Check if a field was added to the input object type
- var _arr9 = Object.keys(newTypeFieldsDef);
-
- for (var _i9 = 0; _i9 < _arr9.length; _i9++) {
- var _fieldName = _arr9[_i9];
+ for (var _i9 = 0, _Object$keys9 = Object.keys(newTypeFieldsDef); _i9 < _Object$keys9.length; _i9++) {
+ var _fieldName = _Object$keys9[_i9];
if (!(_fieldName in oldTypeFieldsDef)) {
if ((0, _definition.isRequiredInputField)(newTypeFieldsDef[_fieldName])) {
@@ -487,10 +469,8 @@
var newTypeMap = newSchema.getTypeMap();
var typesRemovedFromUnion = [];
- var _arr10 = Object.keys(oldTypeMap);
-
- for (var _i10 = 0; _i10 < _arr10.length; _i10++) {
- var typeName = _arr10[_i10];
+ for (var _i10 = 0, _Object$keys10 = Object.keys(oldTypeMap); _i10 < _Object$keys10.length; _i10++) {
+ var typeName = _Object$keys10[_i10];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -567,10 +547,8 @@
var newTypeMap = newSchema.getTypeMap();
var typesAddedToUnion = [];
- var _arr11 = Object.keys(newTypeMap);
-
- for (var _i11 = 0; _i11 < _arr11.length; _i11++) {
- var typeName = _arr11[_i11];
+ for (var _i11 = 0, _Object$keys11 = Object.keys(newTypeMap); _i11 < _Object$keys11.length; _i11++) {
+ var typeName = _Object$keys11[_i11];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -647,10 +625,8 @@
var newTypeMap = newSchema.getTypeMap();
var valuesRemovedFromEnums = [];
- var _arr12 = Object.keys(oldTypeMap);
-
- for (var _i12 = 0; _i12 < _arr12.length; _i12++) {
- var typeName = _arr12[_i12];
+ for (var _i12 = 0, _Object$keys12 = Object.keys(oldTypeMap); _i12 < _Object$keys12.length; _i12++) {
+ var typeName = _Object$keys12[_i12];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -727,10 +703,8 @@
var newTypeMap = newSchema.getTypeMap();
var valuesAddedToEnums = [];
- var _arr13 = Object.keys(oldTypeMap);
-
- for (var _i13 = 0; _i13 < _arr13.length; _i13++) {
- var typeName = _arr13[_i13];
+ for (var _i13 = 0, _Object$keys13 = Object.keys(oldTypeMap); _i13 < _Object$keys13.length; _i13++) {
+ var typeName = _Object$keys13[_i13];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -802,10 +776,8 @@
var newTypeMap = newSchema.getTypeMap();
var breakingChanges = [];
- var _arr14 = Object.keys(oldTypeMap);
-
- for (var _i14 = 0; _i14 < _arr14.length; _i14++) {
- var typeName = _arr14[_i14];
+ for (var _i14 = 0, _Object$keys14 = Object.keys(oldTypeMap); _i14 < _Object$keys14.length; _i14++) {
+ var typeName = _Object$keys14[_i14];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -860,10 +832,8 @@
var newTypeMap = newSchema.getTypeMap();
var interfacesAddedToObjectTypes = [];
- var _arr15 = Object.keys(newTypeMap);
-
- for (var _i15 = 0; _i15 < _arr15.length; _i15++) {
- var typeName = _arr15[_i15];
+ for (var _i15 = 0, _Object$keys15 = Object.keys(newTypeMap); _i15 < _Object$keys15.length; _i15++) {
+ var typeName = _Object$keys15[_i15];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];

utilities/findBreakingChanges.js.flow

@@ -9,6 +9,10 @@
import find from '../polyfills/find';
import {
+ type GraphQLNamedType,
+ type GraphQLFieldMap,
+ type GraphQLType,
+ type GraphQLArgument,
isScalarType,
isObjectType,
isInterfaceType,
@@ -21,20 +25,12 @@
isRequiredArgument,
isRequiredInputField,
} from '../type/definition';
-
-import type {
- GraphQLNamedType,
- GraphQLFieldMap,
- GraphQLType,
- GraphQLArgument,
-} from '../type/definition';
-
-import type { GraphQLDirective } from '../type/directives';
-import type { GraphQLSchema } from '../type/schema';
+import { type GraphQLDirective } from '../type/directives';
+import { type GraphQLSchema } from '../type/schema';
import keyMap from '../jsutils/keyMap';
-import type { ObjMap } from '../jsutils/ObjMap';
-import type { DirectiveLocationEnum } from '../language/directiveLocation';
+import { type ObjMap } from '../jsutils/ObjMap';
+import { type DirectiveLocationEnum } from '../language/directiveLocation';
export const BreakingChangeType = {
FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND',

utilities/findBreakingChanges.mjs

@@ -60,10 +60,8 @@
var newTypeMap = newSchema.getTypeMap();
var breakingChanges = [];
- var _arr = Object.keys(oldTypeMap);
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var typeName = _arr[_i];
+ for (var _i = 0, _Object$keys = Object.keys(oldTypeMap); _i < _Object$keys.length; _i++) {
+ var typeName = _Object$keys[_i];
if (!newTypeMap[typeName]) {
breakingChanges.push({
@@ -85,10 +83,8 @@
var newTypeMap = newSchema.getTypeMap();
var breakingChanges = [];
- var _arr2 = Object.keys(oldTypeMap);
-
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
- var typeName = _arr2[_i2];
+ for (var _i2 = 0, _Object$keys2 = Object.keys(oldTypeMap); _i2 < _Object$keys2.length; _i2++) {
+ var typeName = _Object$keys2[_i2];
if (!newTypeMap[typeName]) {
continue;
@@ -120,10 +116,8 @@
var breakingChanges = [];
var dangerousChanges = [];
- var _arr3 = Object.keys(oldTypeMap);
-
- for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
- var typeName = _arr3[_i3];
+ for (var _i3 = 0, _Object$keys3 = Object.keys(oldTypeMap); _i3 < _Object$keys3.length; _i3++) {
+ var typeName = _Object$keys3[_i3];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -134,10 +128,8 @@
var oldTypeFields = oldType.getFields();
var newTypeFields = newType.getFields();
- var _arr4 = Object.keys(oldTypeFields);
-
- for (var _i4 = 0; _i4 < _arr4.length; _i4++) {
- var fieldName = _arr4[_i4];
+ for (var _i4 = 0, _Object$keys4 = Object.keys(oldTypeFields); _i4 < _Object$keys4.length; _i4++) {
+ var fieldName = _Object$keys4[_i4];
if (!newTypeFields[fieldName]) {
continue;
@@ -284,10 +276,8 @@
var newTypeMap = newSchema.getTypeMap();
var breakingChanges = [];
- var _arr5 = Object.keys(oldTypeMap);
-
- for (var _i5 = 0; _i5 < _arr5.length; _i5++) {
- var typeName = _arr5[_i5];
+ for (var _i5 = 0, _Object$keys5 = Object.keys(oldTypeMap); _i5 < _Object$keys5.length; _i5++) {
+ var typeName = _Object$keys5[_i5];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -298,10 +288,8 @@
var oldTypeFieldsDef = oldType.getFields();
var newTypeFieldsDef = newType.getFields();
- var _arr6 = Object.keys(oldTypeFieldsDef);
-
- for (var _i6 = 0; _i6 < _arr6.length; _i6++) {
- var fieldName = _arr6[_i6];
+ for (var _i6 = 0, _Object$keys6 = Object.keys(oldTypeFieldsDef); _i6 < _Object$keys6.length; _i6++) {
+ var fieldName = _Object$keys6[_i6];
// Check if the field is missing on the type in the new schema.
if (!(fieldName in newTypeFieldsDef)) {
@@ -334,10 +322,8 @@
var breakingChanges = [];
var dangerousChanges = [];
- var _arr7 = Object.keys(oldTypeMap);
-
- for (var _i7 = 0; _i7 < _arr7.length; _i7++) {
- var typeName = _arr7[_i7];
+ for (var _i7 = 0, _Object$keys7 = Object.keys(oldTypeMap); _i7 < _Object$keys7.length; _i7++) {
+ var typeName = _Object$keys7[_i7];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -348,10 +334,8 @@
var oldTypeFieldsDef = oldType.getFields();
var newTypeFieldsDef = newType.getFields();
- var _arr8 = Object.keys(oldTypeFieldsDef);
-
- for (var _i8 = 0; _i8 < _arr8.length; _i8++) {
- var fieldName = _arr8[_i8];
+ for (var _i8 = 0, _Object$keys8 = Object.keys(oldTypeFieldsDef); _i8 < _Object$keys8.length; _i8++) {
+ var fieldName = _Object$keys8[_i8];
// Check if the field is missing on the type in the new schema.
if (!(fieldName in newTypeFieldsDef)) {
@@ -376,10 +360,8 @@
} // Check if a field was added to the input object type
- var _arr9 = Object.keys(newTypeFieldsDef);
-
- for (var _i9 = 0; _i9 < _arr9.length; _i9++) {
- var _fieldName = _arr9[_i9];
+ for (var _i9 = 0, _Object$keys9 = Object.keys(newTypeFieldsDef); _i9 < _Object$keys9.length; _i9++) {
+ var _fieldName = _Object$keys9[_i9];
if (!(_fieldName in oldTypeFieldsDef)) {
if (isRequiredInputField(newTypeFieldsDef[_fieldName])) {
@@ -450,10 +432,8 @@
var newTypeMap = newSchema.getTypeMap();
var typesRemovedFromUnion = [];
- var _arr10 = Object.keys(oldTypeMap);
-
- for (var _i10 = 0; _i10 < _arr10.length; _i10++) {
- var typeName = _arr10[_i10];
+ for (var _i10 = 0, _Object$keys10 = Object.keys(oldTypeMap); _i10 < _Object$keys10.length; _i10++) {
+ var typeName = _Object$keys10[_i10];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -529,10 +509,8 @@
var newTypeMap = newSchema.getTypeMap();
var typesAddedToUnion = [];
- var _arr11 = Object.keys(newTypeMap);
-
- for (var _i11 = 0; _i11 < _arr11.length; _i11++) {
- var typeName = _arr11[_i11];
+ for (var _i11 = 0, _Object$keys11 = Object.keys(newTypeMap); _i11 < _Object$keys11.length; _i11++) {
+ var typeName = _Object$keys11[_i11];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -608,10 +586,8 @@
var newTypeMap = newSchema.getTypeMap();
var valuesRemovedFromEnums = [];
- var _arr12 = Object.keys(oldTypeMap);
-
- for (var _i12 = 0; _i12 < _arr12.length; _i12++) {
- var typeName = _arr12[_i12];
+ for (var _i12 = 0, _Object$keys12 = Object.keys(oldTypeMap); _i12 < _Object$keys12.length; _i12++) {
+ var typeName = _Object$keys12[_i12];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -687,10 +663,8 @@
var newTypeMap = newSchema.getTypeMap();
var valuesAddedToEnums = [];
- var _arr13 = Object.keys(oldTypeMap);
-
- for (var _i13 = 0; _i13 < _arr13.length; _i13++) {
- var typeName = _arr13[_i13];
+ for (var _i13 = 0, _Object$keys13 = Object.keys(oldTypeMap); _i13 < _Object$keys13.length; _i13++) {
+ var typeName = _Object$keys13[_i13];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -761,10 +735,8 @@
var newTypeMap = newSchema.getTypeMap();
var breakingChanges = [];
- var _arr14 = Object.keys(oldTypeMap);
-
- for (var _i14 = 0; _i14 < _arr14.length; _i14++) {
- var typeName = _arr14[_i14];
+ for (var _i14 = 0, _Object$keys14 = Object.keys(oldTypeMap); _i14 < _Object$keys14.length; _i14++) {
+ var typeName = _Object$keys14[_i14];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];
@@ -818,10 +790,8 @@
var newTypeMap = newSchema.getTypeMap();
var interfacesAddedToObjectTypes = [];
- var _arr15 = Object.keys(newTypeMap);
-
- for (var _i15 = 0; _i15 < _arr15.length; _i15++) {
- var typeName = _arr15[_i15];
+ for (var _i15 = 0, _Object$keys15 = Object.keys(newTypeMap); _i15 < _Object$keys15.length; _i15++) {
+ var typeName = _Object$keys15[_i15];
var oldType = oldTypeMap[typeName];
var newType = newTypeMap[typeName];

utilities/findDeprecatedUsages.js.flow

@@ -9,9 +9,9 @@
import { GraphQLError } from '../error/GraphQLError';
import { visit, visitWithTypeInfo } from '../language/visitor';
-import type { DocumentNode } from '../language/ast';
+import { type DocumentNode } from '../language/ast';
import { getNamedType } from '../type/definition';
-import type { GraphQLSchema } from '../type/schema';
+import { type GraphQLSchema } from '../type/schema';
import { TypeInfo } from './TypeInfo';
/**

utilities/getOperationAST.js.flow

@@ -8,7 +8,10 @@
*/
import { Kind } from '../language/kinds';
-import type { DocumentNode, OperationDefinitionNode } from '../language/ast';
+import {
+ type DocumentNode,
+ type OperationDefinitionNode,
+} from '../language/ast';
/**
* Returns an operation AST given a document AST and optionally an operation

utilities/getOperationRootType.js.flow

@@ -8,12 +8,12 @@
*/
import { GraphQLError } from '../error/GraphQLError';
-import type {
- OperationDefinitionNode,
- OperationTypeDefinitionNode,
+import {
+ type OperationDefinitionNode,
+ type OperationTypeDefinitionNode,
} from '../language/ast';
-import type { GraphQLSchema } from '../type/schema';
-import type { GraphQLObjectType } from '../type/definition';
+import { type GraphQLSchema } from '../type/schema';
+import { type GraphQLObjectType } from '../type/definition';
/**
* Extracts the root type of the operation from the schema.

utilities/index.js

@@ -147,6 +147,12 @@
return _separateOperations.separateOperations;
}
});
+Object.defineProperty(exports, "stripIgnoredCharacters", {
+ enumerable: true,
+ get: function get() {
+ return _stripIgnoredCharacters.stripIgnoredCharacters;
+ }
+});
Object.defineProperty(exports, "isEqualType", {
enumerable: true,
get: function get() {
@@ -246,6 +252,8 @@
var _separateOperations = require("./separateOperations");
+var _stripIgnoredCharacters = require("./stripIgnoredCharacters");
+
var _typeComparators = require("./typeComparators");
var _assertValidName = require("./assertValidName");

utilities/index.js.flow

@@ -9,10 +9,13 @@
// The GraphQL query recommended for a full schema introspection.
export {
+ // Produce the GraphQL query recommended for a full schema introspection.
+ // Accepts optional IntrospectionOptions.
getIntrospectionQuery,
- // @deprecated, use getIntrospectionQuery() - will be removed in v15
+ // @deprecated, use getIntrospectionQuery() - will be removed in v15.
introspectionQuery,
} from './introspectionQuery';
+
export type {
IntrospectionOptions,
IntrospectionQuery,
@@ -38,13 +41,13 @@
IntrospectionDirective,
} from './introspectionQuery';
-// Gets the target Operation from a Document
+// Gets the target Operation from a Document.
export { getOperationAST } from './getOperationAST';
// Gets the Type for the target Operation AST.
export { getOperationRootType } from './getOperationRootType';
-// Convert a GraphQLSchema to an IntrospectionQuery
+// Convert a GraphQLSchema to an IntrospectionQuery.
export { introspectionFromSchema } from './introspectionFromSchema';
// Build a GraphQLSchema from an introspection result.
@@ -55,7 +58,7 @@
buildASTSchema,
buildSchema,
// @deprecated: Get the description from a schema AST node and supports legacy
- // syntax for specifying descriptions - will be removed in v16
+ // syntax for specifying descriptions - will be removed in v16.
getDescription,
} from './buildASTSchema';
export type { BuildSchemaOptions } from './buildASTSchema';
@@ -92,7 +95,7 @@
// Coerces a JavaScript value to a GraphQL type, or produces errors.
export { coerceValue } from './coerceValue';
-// @deprecated use coerceValue - will be removed in v15
+// @deprecated use coerceValue - will be removed in v15.
export { isValidJSValue } from './isValidJSValue';
// @deprecated use validation - will be removed in v15
@@ -104,6 +107,10 @@
// Separates an AST into an AST per Operation.
export { separateOperations } from './separateOperations';
+// Strips characters that are not significant to the validity or execution
+// of a GraphQL document.
+export { stripIgnoredCharacters } from './stripIgnoredCharacters';
+
// Comparators for types
export {
isEqualType,

utilities/index.mjs

@@ -7,19 +7,21 @@
*
*/
// The GraphQL query recommended for a full schema introspection.
-export { getIntrospectionQuery, // @deprecated, use getIntrospectionQuery() - will be removed in v15
+export { // Produce the GraphQL query recommended for a full schema introspection.
+// Accepts optional IntrospectionOptions.
+getIntrospectionQuery, // @deprecated, use getIntrospectionQuery() - will be removed in v15.
introspectionQuery } from './introspectionQuery';
-// Gets the target Operation from a Document
+// Gets the target Operation from a Document.
export { getOperationAST } from './getOperationAST'; // Gets the Type for the target Operation AST.
-export { getOperationRootType } from './getOperationRootType'; // Convert a GraphQLSchema to an IntrospectionQuery
+export { getOperationRootType } from './getOperationRootType'; // Convert a GraphQLSchema to an IntrospectionQuery.
export { introspectionFromSchema } from './introspectionFromSchema'; // Build a GraphQLSchema from an introspection result.
export { buildClientSchema } from './buildClientSchema'; // Build a GraphQLSchema from GraphQL Schema language.
export { buildASTSchema, buildSchema, // @deprecated: Get the description from a schema AST node and supports legacy
-// syntax for specifying descriptions - will be removed in v16
+// syntax for specifying descriptions - will be removed in v16.
getDescription } from './buildASTSchema';
// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST.
export { extendSchema } from './extendSchema'; // Sort a GraphQLSchema.
@@ -39,7 +41,7 @@
export { TypeInfo } from './TypeInfo'; // Coerces a JavaScript value to a GraphQL type, or produces errors.
-export { coerceValue } from './coerceValue'; // @deprecated use coerceValue - will be removed in v15
+export { coerceValue } from './coerceValue'; // @deprecated use coerceValue - will be removed in v15.
export { isValidJSValue } from './isValidJSValue'; // @deprecated use validation - will be removed in v15
@@ -47,7 +49,10 @@
export { concatAST } from './concatAST'; // Separates an AST into an AST per Operation.
-export { separateOperations } from './separateOperations'; // Comparators for types
+export { separateOperations } from './separateOperations'; // Strips characters that are not significant to the validity or execution
+// of a GraphQL document.
+
+export { stripIgnoredCharacters } from './stripIgnoredCharacters'; // Comparators for types
export { isEqualType, isTypeSubTypeOf, doTypesOverlap } from './typeComparators'; // Asserts that a string is a valid GraphQL name

utilities/introspectionFromSchema.js

@@ -7,12 +7,12 @@
var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
-var _introspectionQuery = require("./introspectionQuery");
-
var _execute = require("../execution/execute");
var _parser = require("../language/parser");
+var _introspectionQuery = require("./introspectionQuery");
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**

utilities/introspectionFromSchema.js.flow

@@ -8,13 +8,13 @@
*/
import invariant from '../jsutils/invariant';
-import { getIntrospectionQuery } from './introspectionQuery';
-import type { GraphQLSchema } from '../type/schema';
+import { type GraphQLSchema } from '../type/schema';
import { execute } from '../execution/execute';
import { parse } from '../language/parser';
-import type {
- IntrospectionQuery,
- IntrospectionOptions,
+import {
+ type IntrospectionQuery,
+ type IntrospectionOptions,
+ getIntrospectionQuery,
} from './introspectionQuery';
/**

utilities/introspectionFromSchema.mjs

@@ -7,10 +7,9 @@
*
*/
import invariant from '../jsutils/invariant';
-import { getIntrospectionQuery } from './introspectionQuery';
import { execute } from '../execution/execute';
import { parse } from '../language/parser';
-
+import { getIntrospectionQuery } from './introspectionQuery';
/**
* Build an IntrospectionQuery from a GraphQLSchema
*

utilities/introspectionQuery.js.flow

@@ -7,7 +7,7 @@
* @flow strict
*/
-import type { DirectiveLocationEnum } from '../language/directiveLocation';
+import { type DirectiveLocationEnum } from '../language/directiveLocation';
export type IntrospectionOptions = {|
// Whether to include descriptions in the introspection result.

utilities/isValidJSValue.js.flow

@@ -9,7 +9,7 @@
/* istanbul ignore file */
import { coerceValue } from './coerceValue';
-import type { GraphQLInputType } from '../type/definition';
+import { type GraphQLInputType } from '../type/definition';
/**
* Deprecated. Use coerceValue() directly for richer information.

utilities/isValidLiteralValue.js.flow

@@ -8,11 +8,11 @@
*/
import { TypeInfo } from './TypeInfo';
-import type { GraphQLError } from '../error/GraphQLError';
-import type { ValueNode } from '../language/ast';
+import { type GraphQLError } from '../error/GraphQLError';
+import { type ValueNode } from '../language/ast';
import { Kind } from '../language/kinds';
import { visit, visitWithTypeInfo } from '../language/visitor';
-import type { GraphQLInputType } from '../type/definition';
+import { type GraphQLInputType } from '../type/definition';
import { GraphQLSchema } from '../type/schema';
import { ValuesOfCorrectType } from '../validation/rules/ValuesOfCorrectType';
import { ValidationContext } from '../validation/ValidationContext';

utilities/lexicographicSortSchema.js

@@ -155,10 +155,9 @@
var sortedKeys = sortBy(Object.keys(map), function (x) {
return x;
});
- var _arr = sortedKeys;
- for (var _i = 0; _i < _arr.length; _i++) {
- var key = _arr[_i];
+ for (var _i = 0, _sortedKeys = sortedKeys; _i < _sortedKeys.length; _i++) {
+ var key = _sortedKeys[_i];
var value = map[key];
sortedMap[key] = sortValueFn ? sortValueFn(value) : value;
}

utilities/lexicographicSortSchema.js.flow

@@ -10,11 +10,11 @@
import objectValues from '../polyfills/objectValues';
import inspect from '../jsutils/inspect';
import keyValMap from '../jsutils/keyValMap';
-import type { ObjMap } from '../jsutils/ObjMap';
+import { type ObjMap } from '../jsutils/ObjMap';
import { GraphQLSchema } from '../type/schema';
import { GraphQLDirective } from '../type/directives';
-import type { GraphQLNamedType } from '../type/definition';
import {
+ type GraphQLNamedType,
GraphQLObjectType,
GraphQLInterfaceType,
GraphQLUnionType,

utilities/lexicographicSortSchema.mjs

@@ -148,10 +148,9 @@
var sortedKeys = sortBy(Object.keys(map), function (x) {
return x;
});
- var _arr = sortedKeys;
- for (var _i = 0; _i < _arr.length; _i++) {
- var key = _arr[_i];
+ for (var _i = 0, _sortedKeys = sortedKeys; _i < _sortedKeys.length; _i++) {
+ var key = _sortedKeys[_i];
var value = map[key];
sortedMap[key] = sortValueFn ? sortValueFn(value) : value;
}

utilities/schemaPrinter.js.flow

@@ -13,8 +13,15 @@
import { astFromValue } from '../utilities/astFromValue';
import { print } from '../language/printer';
import { printBlockString } from '../language/blockString';
-import type { GraphQLSchema } from '../type/schema';
+import { type GraphQLSchema } from '../type/schema';
import {
+ type GraphQLNamedType,
+ type GraphQLScalarType,
+ type GraphQLEnumType,
+ type GraphQLObjectType,
+ type GraphQLInterfaceType,
+ type GraphQLUnionType,
+ type GraphQLInputObjectType,
isScalarType,
isObjectType,
isInterfaceType,
@@ -22,15 +29,6 @@
isEnumType,
isInputObjectType,
} from '../type/definition';
-import type {
- GraphQLNamedType,
- GraphQLScalarType,
- GraphQLEnumType,
- GraphQLObjectType,
- GraphQLInterfaceType,
- GraphQLUnionType,
- GraphQLInputObjectType,
-} from '../type/definition';
import { GraphQLString, isSpecifiedScalarType } from '../type/scalars';
import {
GraphQLDirective,

utilities/separateOperations.js

@@ -49,10 +49,9 @@
// is necessary for completing that operation.
var separatedDocumentASTs = Object.create(null);
- var _arr = operations;
- for (var _i = 0; _i < _arr.length; _i++) {
- var operation = _arr[_i];
+ for (var _i = 0, _operations = operations; _i < _operations.length; _i++) {
+ var operation = _operations[_i];
var operationName = opName(operation);
var dependencies = Object.create(null);
collectTransitiveDependencies(dependencies, depGraph, operationName); // The list of definition nodes to be included for this operation, sorted
@@ -60,10 +59,8 @@
var definitions = [operation];
- var _arr2 = Object.keys(dependencies);
-
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
- var name = _arr2[_i2];
+ for (var _i2 = 0, _Object$keys = Object.keys(dependencies); _i2 < _Object$keys.length; _i2++) {
+ var name = _Object$keys[_i2];
definitions.push(fragments[name]);
}
@@ -90,10 +87,8 @@
var immediateDeps = depGraph[fromName];
if (immediateDeps) {
- var _arr3 = Object.keys(immediateDeps);
-
- for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
- var toName = _arr3[_i3];
+ for (var _i3 = 0, _Object$keys2 = Object.keys(immediateDeps); _i3 < _Object$keys2.length; _i3++) {
+ var toName = _Object$keys2[_i3];
if (!collected[toName]) {
collected[toName] = true;

utilities/separateOperations.js.flow

@@ -8,8 +8,11 @@
*/
import { visit } from '../language/visitor';
-import type { ObjMap } from '../jsutils/ObjMap';
-import type { DocumentNode, OperationDefinitionNode } from '../language/ast';
+import { type ObjMap } from '../jsutils/ObjMap';
+import {
+ type DocumentNode,
+ type OperationDefinitionNode,
+} from '../language/ast';
/**
* separateOperations accepts a single AST document which may contain many

utilities/separateOperations.mjs

@@ -41,10 +41,9 @@
// is necessary for completing that operation.
var separatedDocumentASTs = Object.create(null);
- var _arr = operations;
- for (var _i = 0; _i < _arr.length; _i++) {
- var operation = _arr[_i];
+ for (var _i = 0, _operations = operations; _i < _operations.length; _i++) {
+ var operation = _operations[_i];
var operationName = opName(operation);
var dependencies = Object.create(null);
collectTransitiveDependencies(dependencies, depGraph, operationName); // The list of definition nodes to be included for this operation, sorted
@@ -52,10 +51,8 @@
var definitions = [operation];
- var _arr2 = Object.keys(dependencies);
-
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
- var name = _arr2[_i2];
+ for (var _i2 = 0, _Object$keys = Object.keys(dependencies); _i2 < _Object$keys.length; _i2++) {
+ var name = _Object$keys[_i2];
definitions.push(fragments[name]);
}
@@ -82,10 +79,8 @@
var immediateDeps = depGraph[fromName];
if (immediateDeps) {
- var _arr3 = Object.keys(immediateDeps);
-
- for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
- var toName = _arr3[_i3];
+ for (var _i3 = 0, _Object$keys2 = Object.keys(immediateDeps); _i3 < _Object$keys2.length; _i3++) {
+ var toName = _Object$keys2[_i3];
if (!collected[toName]) {
collected[toName] = true;

utilities/stripIgnoredCharacters.js

@@ -0,0 +1,140 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.stripIgnoredCharacters = stripIgnoredCharacters;
+
+var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
+
+var _source = require("../language/source");
+
+var _lexer = require("../language/lexer");
+
+var _blockString = require("../language/blockString");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ *
+ */
+
+/**
+ * Strips characters that are not significant to the validity or execution
+ * of a GraphQL document:
+ * - UnicodeBOM
+ * - WhiteSpace
+ * - LineTerminator
+ * - Comment
+ * - Comma
+ * - BlockString indentation
+ *
+ * Note: It is required to have delimiter character between neighboring
+ * non-Punctuator tokes and this function always use single space as delimiter.
+ *
+ * It is guaranteed that both input and output documents if parsed would result
+ * in the exact same AST except for nodes location.
+ *
+ * Warning: It guaranteed that this function will always produce stable results
+ * however, it's not guaranteed that it will stay the same between different
+ * releases due to bugfixes or changes in the GraphQL Specification.
+ *
+ * Query example:
+ *
+ * query SomeQuery($foo: String!, $bar: String) {
+ * someField(foo: $foo, bar: $bar) {
+ * a
+ * b {
+ * c
+ * d
+ * }
+ * }
+ * }
+ *
+ * Becomes:
+ *
+ * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}}
+ *
+ * SDL example:
+ *
+ * """
+ * Type description
+ * """
+ * type Foo {
+ * """
+ * Field description
+ * """
+ * bar: String
+ * }
+ *
+ * Becomes:
+ *
+ * """Type description""" type Foo{"""Field description""" bar:String}
+ */
+function stripIgnoredCharacters(source) {
+ var sourceObj = typeof source === 'string' ? new _source.Source(source) : source;
+
+ if (!(sourceObj instanceof _source.Source)) {
+ throw new TypeError("Must provide string or Source. Received: ".concat((0, _inspect.default)(sourceObj)));
+ }
+
+ var body = sourceObj.body;
+ var lexer = (0, _lexer.createLexer)(sourceObj);
+ var strippedBody = '';
+ var wasLastAddedTokenNonPunctuator = false;
+
+ while (lexer.advance().kind !== _lexer.TokenKind.EOF) {
+ var currentToken = lexer.token;
+ var tokenKind = currentToken.kind;
+ /**
+ * Every two non-punctuator tokens should have space between them.
+ * Also prevent case of non-punctuator token following by spread resulting
+ * in invalid toke (e.g. `1...` is invalid Float token).
+ */
+
+ var isNonPunctuator = !(0, _lexer.isPunctuatorToken)(currentToken);
+
+ if (wasLastAddedTokenNonPunctuator) {
+ if (isNonPunctuator || currentToken.kind === _lexer.TokenKind.SPREAD) {
+ strippedBody += ' ';
+ }
+ }
+
+ var tokenBody = body.slice(currentToken.start, currentToken.end);
+
+ if (tokenKind === _lexer.TokenKind.BLOCK_STRING) {
+ strippedBody += dedentBlockString(tokenBody);
+ } else {
+ strippedBody += tokenBody;
+ }
+
+ wasLastAddedTokenNonPunctuator = isNonPunctuator;
+ }
+
+ return strippedBody;
+}
+
+function dedentBlockString(blockStr) {
+ // skip leading and trailing triple quotations
+ var rawStr = blockStr.slice(3, -3);
+ var body = (0, _blockString.dedentBlockStringValue)(rawStr);
+ var lines = body.split(/\r\n|[\n\r]/g);
+
+ if ((0, _blockString.getBlockStringIndentation)(lines) > 0) {
+ body = '\n' + body;
+ }
+
+ var lastChar = body[body.length - 1];
+ var hasTrailingQuote = lastChar === '"' && body.slice(-4) !== '\\"""';
+
+ if (hasTrailingQuote || lastChar === '\\') {
+ body += '\n';
+ }
+
+ return '"""' + body + '"""';
+}
\ No newline at end of file

utilities/stripIgnoredCharacters.js.flow

@@ -0,0 +1,129 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ * @flow strict
+ */
+
+import inspect from '../jsutils/inspect';
+import { Source } from '../language/source';
+import { createLexer, TokenKind, isPunctuatorToken } from '../language/lexer';
+import {
+ dedentBlockStringValue,
+ getBlockStringIndentation,
+} from '../language/blockString';
+
+/**
+ * Strips characters that are not significant to the validity or execution
+ * of a GraphQL document:
+ * - UnicodeBOM
+ * - WhiteSpace
+ * - LineTerminator
+ * - Comment
+ * - Comma
+ * - BlockString indentation
+ *
+ * Note: It is required to have delimiter character between neighboring
+ * non-Punctuator tokes and this function always use single space as delimiter.
+ *
+ * It is guaranteed that both input and output documents if parsed would result
+ * in the exact same AST except for nodes location.
+ *
+ * Warning: It guaranteed that this function will always produce stable results
+ * however, it's not guaranteed that it will stay the same between different
+ * releases due to bugfixes or changes in the GraphQL Specification.
+ *
+ * Query example:
+ *
+ * query SomeQuery($foo: String!, $bar: String) {
+ * someField(foo: $foo, bar: $bar) {
+ * a
+ * b {
+ * c
+ * d
+ * }
+ * }
+ * }
+ *
+ * Becomes:
+ *
+ * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}}
+ *
+ * SDL example:
+ *
+ * """
+ * Type description
+ * """
+ * type Foo {
+ * """
+ * Field description
+ * """
+ * bar: String
+ * }
+ *
+ * Becomes:
+ *
+ * """Type description""" type Foo{"""Field description""" bar:String}
+ */
+export function stripIgnoredCharacters(source: string | Source): string {
+ const sourceObj = typeof source === 'string' ? new Source(source) : source;
+ if (!(sourceObj instanceof Source)) {
+ throw new TypeError(
+ `Must provide string or Source. Received: ${inspect(sourceObj)}`,
+ );
+ }
+
+ const body = sourceObj.body;
+ const lexer = createLexer(sourceObj);
+ let strippedBody = '';
+
+ let wasLastAddedTokenNonPunctuator = false;
+ while (lexer.advance().kind !== TokenKind.EOF) {
+ const currentToken = lexer.token;
+ const tokenKind = currentToken.kind;
+
+ /**
+ * Every two non-punctuator tokens should have space between them.
+ * Also prevent case of non-punctuator token following by spread resulting
+ * in invalid toke (e.g. `1...` is invalid Float token).
+ */
+ const isNonPunctuator = !isPunctuatorToken(currentToken);
+ if (wasLastAddedTokenNonPunctuator) {
+ if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) {
+ strippedBody += ' ';
+ }
+ }
+
+ const tokenBody = body.slice(currentToken.start, currentToken.end);
+ if (tokenKind === TokenKind.BLOCK_STRING) {
+ strippedBody += dedentBlockString(tokenBody);
+ } else {
+ strippedBody += tokenBody;
+ }
+
+ wasLastAddedTokenNonPunctuator = isNonPunctuator;
+ }
+
+ return strippedBody;
+}
+
+function dedentBlockString(blockStr) {
+ // skip leading and trailing triple quotations
+ const rawStr = blockStr.slice(3, -3);
+ let body = dedentBlockStringValue(rawStr);
+
+ const lines = body.split(/\r\n|[\n\r]/g);
+ if (getBlockStringIndentation(lines) > 0) {
+ body = '\n' + body;
+ }
+
+ const lastChar = body[body.length - 1];
+ const hasTrailingQuote = lastChar === '"' && body.slice(-4) !== '\\"""';
+ if (hasTrailingQuote || lastChar === '\\') {
+ body += '\n';
+ }
+
+ return '"""' + body + '"""';
+}

utilities/stripIgnoredCharacters.mjs

@@ -0,0 +1,127 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ *
+ *
+ */
+import inspect from '../jsutils/inspect';
+import { Source } from '../language/source';
+import { createLexer, TokenKind, isPunctuatorToken } from '../language/lexer';
+import { dedentBlockStringValue, getBlockStringIndentation } from '../language/blockString';
+/**
+ * Strips characters that are not significant to the validity or execution
+ * of a GraphQL document:
+ * - UnicodeBOM
+ * - WhiteSpace
+ * - LineTerminator
+ * - Comment
+ * - Comma
+ * - BlockString indentation
+ *
+ * Note: It is required to have delimiter character between neighboring
+ * non-Punctuator tokes and this function always use single space as delimiter.
+ *
+ * It is guaranteed that both input and output documents if parsed would result
+ * in the exact same AST except for nodes location.
+ *
+ * Warning: It guaranteed that this function will always produce stable results
+ * however, it's not guaranteed that it will stay the same between different
+ * releases due to bugfixes or changes in the GraphQL Specification.
+ *
+ * Query example:
+ *
+ * query SomeQuery($foo: String!, $bar: String) {
+ * someField(foo: $foo, bar: $bar) {
+ * a
+ * b {
+ * c
+ * d
+ * }
+ * }
+ * }
+ *
+ * Becomes:
+ *
+ * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}}
+ *
+ * SDL example:
+ *
+ * """
+ * Type description
+ * """
+ * type Foo {
+ * """
+ * Field description
+ * """
+ * bar: String
+ * }
+ *
+ * Becomes:
+ *
+ * """Type description""" type Foo{"""Field description""" bar:String}
+ */
+
+export function stripIgnoredCharacters(source) {
+ var sourceObj = typeof source === 'string' ? new Source(source) : source;
+
+ if (!(sourceObj instanceof Source)) {
+ throw new TypeError("Must provide string or Source. Received: ".concat(inspect(sourceObj)));
+ }
+
+ var body = sourceObj.body;
+ var lexer = createLexer(sourceObj);
+ var strippedBody = '';
+ var wasLastAddedTokenNonPunctuator = false;
+
+ while (lexer.advance().kind !== TokenKind.EOF) {
+ var currentToken = lexer.token;
+ var tokenKind = currentToken.kind;
+ /**
+ * Every two non-punctuator tokens should have space between them.
+ * Also prevent case of non-punctuator token following by spread resulting
+ * in invalid toke (e.g. `1...` is invalid Float token).
+ */
+
+ var isNonPunctuator = !isPunctuatorToken(currentToken);
+
+ if (wasLastAddedTokenNonPunctuator) {
+ if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) {
+ strippedBody += ' ';
+ }
+ }
+
+ var tokenBody = body.slice(currentToken.start, currentToken.end);
+
+ if (tokenKind === TokenKind.BLOCK_STRING) {
+ strippedBody += dedentBlockString(tokenBody);
+ } else {
+ strippedBody += tokenBody;
+ }
+
+ wasLastAddedTokenNonPunctuator = isNonPunctuator;
+ }
+
+ return strippedBody;
+}
+
+function dedentBlockString(blockStr) {
+ // skip leading and trailing triple quotations
+ var rawStr = blockStr.slice(3, -3);
+ var body = dedentBlockStringValue(rawStr);
+ var lines = body.split(/\r\n|[\n\r]/g);
+
+ if (getBlockStringIndentation(lines) > 0) {
+ body = '\n' + body;
+ }
+
+ var lastChar = body[body.length - 1];
+ var hasTrailingQuote = lastChar === '"' && body.slice(-4) !== '\\"""';
+
+ if (hasTrailingQuote || lastChar === '\\') {
+ body += '\n';
+ }
+
+ return '"""' + body + '"""';
+}
\ No newline at end of file

utilities/typeComparators.js.flow

@@ -8,13 +8,14 @@
*/
import {
+ type GraphQLType,
+ type GraphQLCompositeType,
isObjectType,
isListType,
isNonNullType,
isAbstractType,
} from '../type/definition';
-import type { GraphQLType, GraphQLCompositeType } from '../type/definition';
-import type { GraphQLSchema } from '../type/schema';
+import { type GraphQLSchema } from '../type/schema';
/**
* Provided two types, return true if the types are equal (invariant).

utilities/typeFromAST.js.flow

@@ -9,14 +9,17 @@
import inspect from '../jsutils/inspect';
import { Kind } from '../language/kinds';
-import type {
- NamedTypeNode,
- ListTypeNode,
- NonNullTypeNode,
+import {
+ type NamedTypeNode,
+ type ListTypeNode,
+ type NonNullTypeNode,
} from '../language/ast';
-import { GraphQLList, GraphQLNonNull } from '../type/definition';
-import type { GraphQLNamedType } from '../type/definition';
-import type { GraphQLSchema } from '../type/schema';
+import {
+ type GraphQLNamedType,
+ GraphQLList,
+ GraphQLNonNull,
+} from '../type/definition';
+import { type GraphQLSchema } from '../type/schema';
/**
* Given a Schema and an AST node describing a type, return a GraphQLType

utilities/TypeInfo.js.flow

@@ -10,6 +10,14 @@
import find from '../polyfills/find';
import { Kind } from '../language/kinds';
import {
+ type GraphQLType,
+ type GraphQLInputType,
+ type GraphQLOutputType,
+ type GraphQLCompositeType,
+ type GraphQLField,
+ type GraphQLArgument,
+ type GraphQLInputField,
+ type GraphQLEnumValue,
isObjectType,
isInterfaceType,
isEnumType,
@@ -21,24 +29,14 @@
getNullableType,
getNamedType,
} from '../type/definition';
-import type {
- GraphQLType,
- GraphQLInputType,
- GraphQLOutputType,
- GraphQLCompositeType,
- GraphQLField,
- GraphQLArgument,
- GraphQLInputField,
- GraphQLEnumValue,
-} from '../type/definition';
-import type { GraphQLDirective } from '../type/directives';
+import { type GraphQLDirective } from '../type/directives';
import {
SchemaMetaFieldDef,
TypeMetaFieldDef,
TypeNameMetaFieldDef,
} from '../type/introspection';
-import type { GraphQLSchema } from '../type/schema';
-import type { ASTNode, FieldNode } from '../language/ast';
+import { type GraphQLSchema } from '../type/schema';
+import { type ASTNode, type FieldNode } from '../language/ast';
import { typeFromAST } from './typeFromAST';
/**

utilities/valueFromAST.js.flow

@@ -11,17 +11,17 @@
import inspect from '../jsutils/inspect';
import keyMap from '../jsutils/keyMap';
import isInvalid from '../jsutils/isInvalid';
-import type { ObjMap } from '../jsutils/ObjMap';
+import { type ObjMap } from '../jsutils/ObjMap';
import { Kind } from '../language/kinds';
import {
+ type GraphQLInputType,
isScalarType,
isEnumType,
isInputObjectType,
isListType,
isNonNullType,
} from '../type/definition';
-import type { GraphQLInputType } from '../type/definition';
-import type { ValueNode } from '../language/ast';
+import { type ValueNode } from '../language/ast';
/**
* Produces a JavaScript value given a GraphQL Value AST.

utilities/valueFromASTUntyped.js.flow

@@ -10,9 +10,9 @@
import inspect from '../jsutils/inspect';
import keyValMap from '../jsutils/keyValMap';
import isInvalid from '../jsutils/isInvalid';
-import type { ObjMap } from '../jsutils/ObjMap';
+import { type ObjMap } from '../jsutils/ObjMap';
import { Kind } from '../language/kinds';
-import type { ValueNode } from '../language/ast';
+import { type ValueNode } from '../language/ast';
/**
* Produces a JavaScript value given a GraphQL Value AST.

validation/index.js.flow

@@ -12,6 +12,7 @@
export { ValidationContext } from './ValidationContext';
export type { ValidationRule } from './ValidationContext';
+// All validation rules in the GraphQL Specification.
export { specifiedRules } from './specifiedRules';
// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types"

validation/index.mjs

@@ -8,6 +8,7 @@
*/
export { validate } from './validate';
export { ValidationContext } from './ValidationContext';
+// All validation rules in the GraphQL Specification.
export { specifiedRules } from './specifiedRules'; // Spec Section: "Field Selections on Objects, Interfaces, and Unions Types"
export { FieldsOnCorrectType as FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectType'; // Spec Section: "Fragments on Composite Types"

validation/rules/ExecutableDefinitions.js.flow

@@ -7,11 +7,11 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import { Kind } from '../../language/kinds';
import { isExecutableDefinitionNode } from '../../language/predicates';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function nonExecutableDefinitionMessage(defName: string): string {
return `The ${defName} definition is not executable.`;

validation/rules/FieldsOnCorrectType.js.flow

@@ -7,15 +7,15 @@
* @flow strict
*/
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import suggestionList from '../../jsutils/suggestionList';
import quotedOrList from '../../jsutils/quotedOrList';
-import type { FieldNode } from '../../language/ast';
-import type { ASTVisitor } from '../../language/visitor';
-import type { GraphQLSchema } from '../../type/schema';
-import type { GraphQLOutputType } from '../../type/definition';
+import { type FieldNode } from '../../language/ast';
+import { type ASTVisitor } from '../../language/visitor';
+import { type GraphQLSchema } from '../../type/schema';
import {
+ type GraphQLOutputType,
isObjectType,
isInterfaceType,
isAbstractType,

validation/rules/FragmentsOnCompositeTypes.js.flow

@@ -7,10 +7,10 @@
* @flow strict
*/
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import { print } from '../../language/printer';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import { isCompositeType } from '../../type/definition';
import { typeFromAST } from '../../utilities/typeFromAST';

validation/rules/KnownArgumentNames.js.flow

@@ -7,12 +7,12 @@
* @flow strict
*/
-import type {
- ValidationContext,
- SDLValidationContext,
+import {
+ type ValidationContext,
+ type SDLValidationContext,
} from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import suggestionList from '../../jsutils/suggestionList';
import quotedOrList from '../../jsutils/quotedOrList';
import { Kind } from '../../language/kinds';

validation/rules/KnownDirectives.js.flow

@@ -7,14 +7,14 @@
* @flow strict
*/
-import type {
- ValidationContext,
- SDLValidationContext,
+import {
+ type ValidationContext,
+ type SDLValidationContext,
} from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import { Kind } from '../../language/kinds';
import { DirectiveLocation } from '../../language/directiveLocation';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import { specifiedDirectives } from '../../type/directives';
export function unknownDirectiveMessage(directiveName: string): string {

validation/rules/KnownFragmentNames.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function unknownFragmentMessage(fragName: string): string {
return `Unknown fragment "${fragName}".`;

validation/rules/KnownTypeNames.js.flow

@@ -7,15 +7,15 @@
* @flow strict
*/
-import type {
- ValidationContext,
- SDLValidationContext,
+import {
+ type ValidationContext,
+ type SDLValidationContext,
} from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import suggestionList from '../../jsutils/suggestionList';
import quotedOrList from '../../jsutils/quotedOrList';
-import type { ASTNode } from '../../language/ast';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTNode } from '../../language/ast';
+import { type ASTVisitor } from '../../language/visitor';
import {
isTypeDefinitionNode,
isTypeSystemDefinitionNode,

validation/rules/LoneAnonymousOperation.js.flow

@@ -7,10 +7,10 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import { Kind } from '../../language/kinds';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function anonOperationNotAloneMessage(): string {
return 'This anonymous operation must be the only defined operation.';

validation/rules/LoneSchemaDefinition.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { SDLValidationContext } from '../ValidationContext';
+import { type SDLValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function schemaDefinitionNotAloneMessage(): string {
return 'Must provide only one schema definition.';

validation/rules/NoFragmentCycles.js.flow

@@ -7,10 +7,10 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { FragmentDefinitionNode } from '../../language/ast';
-import type { ASTVisitor } from '../../language/visitor';
+import { type FragmentDefinitionNode } from '../../language/ast';
+import { type ASTVisitor } from '../../language/visitor';
export function cycleErrorMessage(
fragName: string,

validation/rules/NoUndefinedVariables.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function undefinedVarMessage(varName: string, opName: ?string): string {
return opName

validation/rules/NoUnusedFragments.js

@@ -42,10 +42,9 @@
Document: {
leave: function leave() {
var fragmentNameUsed = Object.create(null);
- var _arr = operationDefs;
- for (var _i = 0; _i < _arr.length; _i++) {
- var operation = _arr[_i];
+ for (var _i = 0, _operationDefs = operationDefs; _i < _operationDefs.length; _i++) {
+ var operation = _operationDefs[_i];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
@@ -71,10 +70,8 @@
}
}
- var _arr2 = fragmentDefs;
-
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
- var fragmentDef = _arr2[_i2];
+ for (var _i2 = 0, _fragmentDefs = fragmentDefs; _i2 < _fragmentDefs.length; _i2++) {
+ var fragmentDef = _fragmentDefs[_i2];
var fragName = fragmentDef.name.value;
if (fragmentNameUsed[fragName] !== true) {

validation/rules/NoUnusedFragments.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function unusedFragMessage(fragName: string): string {
return `Fragment "${fragName}" is never used.`;

validation/rules/NoUnusedFragments.mjs

@@ -32,10 +32,9 @@
Document: {
leave: function leave() {
var fragmentNameUsed = Object.create(null);
- var _arr = operationDefs;
- for (var _i = 0; _i < _arr.length; _i++) {
- var operation = _arr[_i];
+ for (var _i = 0, _operationDefs = operationDefs; _i < _operationDefs.length; _i++) {
+ var operation = _operationDefs[_i];
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
@@ -61,10 +60,8 @@
}
}
- var _arr2 = fragmentDefs;
-
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
- var fragmentDef = _arr2[_i2];
+ for (var _i2 = 0, _fragmentDefs = fragmentDefs; _i2 < _fragmentDefs.length; _i2++) {
+ var fragmentDef = _fragmentDefs[_i2];
var fragName = fragmentDef.name.value;
if (fragmentNameUsed[fragName] !== true) {

validation/rules/NoUnusedVariables.js

@@ -63,10 +63,8 @@
}
}
- var _arr = variableDefs;
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var variableDef = _arr[_i];
+ for (var _i = 0, _variableDefs = variableDefs; _i < _variableDefs.length; _i++) {
+ var variableDef = _variableDefs[_i];
var variableName = variableDef.variable.name.value;
if (variableNameUsed[variableName] !== true) {

validation/rules/NoUnusedVariables.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function unusedVariableMessage(
varName: string,

validation/rules/NoUnusedVariables.mjs

@@ -53,10 +53,8 @@
}
}
- var _arr = variableDefs;
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var variableDef = _arr[_i];
+ for (var _i = 0, _variableDefs = variableDefs; _i < _variableDefs.length; _i++) {
+ var variableDef = _variableDefs[_i];
var variableName = variableDef.variable.name.value;
if (variableNameUsed[variableName] !== true) {

validation/rules/OverlappingFieldsCanBeMerged.js

@@ -68,10 +68,9 @@
return {
SelectionSet: function SelectionSet(selectionSet) {
var conflicts = findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, context.getParentType(), selectionSet);
- var _arr = conflicts;
- for (var _i = 0; _i < _arr.length; _i++) {
- var _ref3 = _arr[_i];
+ for (var _i = 0, _conflicts = conflicts; _i < _conflicts.length; _i++) {
+ var _ref3 = _conflicts[_i];
var _ref2$ = _ref3[0];
var responseName = _ref2$[0];
var reason = _ref2$[1];
@@ -356,10 +355,8 @@
// response name. For any response name which appears in both provided field
// maps, each field from the first field map must be compared to every field
// in the second field map to find potential conflicts.
- var _arr2 = Object.keys(fieldMap1);
-
- for (var _i3 = 0; _i3 < _arr2.length; _i3++) {
- var responseName = _arr2[_i3];
+ for (var _i3 = 0, _Object$keys = Object.keys(fieldMap1); _i3 < _Object$keys.length; _i3++) {
+ var responseName = _Object$keys[_i3];
var fields2 = fieldMap2[responseName];
if (fields2) {

validation/rules/OverlappingFieldsCanBeMerged.js.flow

@@ -9,20 +9,24 @@
import find from '../../polyfills/find';
import objectEntries from '../../polyfills/objectEntries';
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import inspect from '../../jsutils/inspect';
-import type { ObjMap } from '../../jsutils/ObjMap';
-import type {
- SelectionSetNode,
- FieldNode,
- ArgumentNode,
- FragmentDefinitionNode,
+import { type ObjMap } from '../../jsutils/ObjMap';
+import {
+ type SelectionSetNode,
+ type FieldNode,
+ type ArgumentNode,
+ type FragmentDefinitionNode,
} from '../../language/ast';
import { Kind } from '../../language/kinds';
import { print } from '../../language/printer';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import {
+ type GraphQLNamedType,
+ type GraphQLOutputType,
+ type GraphQLCompositeType,
+ type GraphQLField,
getNamedType,
isNonNullType,
isLeafType,
@@ -30,12 +34,6 @@
isListType,
isInterfaceType,
} from '../../type/definition';
-import type {
- GraphQLNamedType,
- GraphQLOutputType,
- GraphQLCompositeType,
- GraphQLField,
-} from '../../type/definition';
import { typeFromAST } from '../../utilities/typeFromAST';
export function fieldsConflictMessage(

validation/rules/OverlappingFieldsCanBeMerged.mjs

@@ -50,10 +50,9 @@
return {
SelectionSet: function SelectionSet(selectionSet) {
var conflicts = findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, context.getParentType(), selectionSet);
- var _arr = conflicts;
- for (var _i = 0; _i < _arr.length; _i++) {
- var _ref3 = _arr[_i];
+ for (var _i = 0, _conflicts = conflicts; _i < _conflicts.length; _i++) {
+ var _ref3 = _conflicts[_i];
var _ref2$ = _ref3[0];
var responseName = _ref2$[0];
var reason = _ref2$[1];
@@ -338,10 +337,8 @@
// response name. For any response name which appears in both provided field
// maps, each field from the first field map must be compared to every field
// in the second field map to find potential conflicts.
- var _arr2 = Object.keys(fieldMap1);
-
- for (var _i3 = 0; _i3 < _arr2.length; _i3++) {
- var responseName = _arr2[_i3];
+ for (var _i3 = 0, _Object$keys = Object.keys(fieldMap1); _i3 < _Object$keys.length; _i3++) {
+ var responseName = _Object$keys[_i3];
var fields2 = fieldMap2[responseName];
if (fields2) {

validation/rules/PossibleFragmentSpreads.js.flow

@@ -8,9 +8,9 @@
*/
import inspect from '../../jsutils/inspect';
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import { doTypesOverlap } from '../../utilities/typeComparators';
import { typeFromAST } from '../../utilities/typeFromAST';
import { isCompositeType } from '../../type/definition';

validation/rules/PossibleTypeExtensions.js.flow

@@ -9,11 +9,11 @@
import quotedOrList from '../../jsutils/quotedOrList';
import suggestionList from '../../jsutils/suggestionList';
-import type { SDLValidationContext } from '../ValidationContext';
+import { type SDLValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import { Kind } from '../../language/kinds';
import { isTypeDefinitionNode } from '../../language/predicates';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import {
isScalarType,
isObjectType,

validation/rules/ProvidedRequiredArguments.js

@@ -164,10 +164,8 @@
return arg.name.value;
});
- var _arr = Object.keys(requiredArgs);
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var argName = _arr[_i];
+ for (var _i = 0, _Object$keys = Object.keys(requiredArgs); _i < _Object$keys.length; _i++) {
+ var argName = _Object$keys[_i];
if (!argNodeMap[argName]) {
var argType = requiredArgs[argName].type;

validation/rules/ProvidedRequiredArguments.js.flow

@@ -7,16 +7,16 @@
* @flow strict
*/
-import type {
- ValidationContext,
- SDLValidationContext,
+import {
+ type ValidationContext,
+ type SDLValidationContext,
} from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import { Kind } from '../../language/kinds';
import inspect from '../../jsutils/inspect';
import keyMap from '../../jsutils/keyMap';
import { isType, isRequiredArgument } from '../../type/definition';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import { print } from '../../language/printer';
import { specifiedDirectives } from '../../type/directives';

validation/rules/ProvidedRequiredArguments.mjs

@@ -150,10 +150,8 @@
return arg.name.value;
});
- var _arr = Object.keys(requiredArgs);
-
- for (var _i = 0; _i < _arr.length; _i++) {
- var argName = _arr[_i];
+ for (var _i = 0, _Object$keys = Object.keys(requiredArgs); _i < _Object$keys.length; _i++) {
+ var argName = _Object$keys[_i];
if (!argNodeMap[argName]) {
var argType = requiredArgs[argName].type;

validation/rules/ScalarLeafs.js.flow

@@ -8,11 +8,11 @@
*/
import inspect from '../../jsutils/inspect';
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { FieldNode } from '../../language/ast';
+import { type FieldNode } from '../../language/ast';
import { getNamedType, isLeafType } from '../../type/definition';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function noSubselectionAllowedMessage(
fieldName: string,

validation/rules/SingleFieldSubscriptions.js.flow

@@ -7,10 +7,10 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { OperationDefinitionNode } from '../../language/ast';
-import type { ASTVisitor } from '../../language/visitor';
+import { type OperationDefinitionNode } from '../../language/ast';
+import { type ASTVisitor } from '../../language/visitor';
export function singleFieldOnlyMessage(name: ?string): string {
return (

validation/rules/UniqueArgumentNames.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function duplicateArgMessage(argName: string): string {
return `There can be only one argument named "${argName}".`;

validation/rules/UniqueDirectiveNames.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { SDLValidationContext } from '../ValidationContext';
+import { type SDLValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function duplicateDirectiveNameMessage(directiveName: string): string {
return `There can be only one directive named "${directiveName}".`;

validation/rules/UniqueDirectivesPerLocation.js.flow

@@ -7,10 +7,10 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { DirectiveNode } from '../../language/ast';
-import type { ASTVisitor } from '../../language/visitor';
+import { type DirectiveNode } from '../../language/ast';
+import { type ASTVisitor } from '../../language/visitor';
export function duplicateDirectiveMessage(directiveName: string): string {
return (

validation/rules/UniqueEnumValueNames.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { SDLValidationContext } from '../ValidationContext';
+import { type SDLValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import { isEnumType } from '../../type/definition';
export function duplicateEnumValueNameMessage(

validation/rules/UniqueFieldDefinitionNames.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { SDLValidationContext } from '../ValidationContext';
+import { type SDLValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import {
isObjectType,
isInterfaceType,

validation/rules/UniqueFragmentNames.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function duplicateFragmentNameMessage(fragName: string): string {
return `There can be only one fragment named "${fragName}".`;

validation/rules/UniqueInputFieldNames.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function duplicateInputFieldMessage(fieldName: string): string {
return `There can be only one input field named "${fieldName}".`;

validation/rules/UniqueOperationNames.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
+import { type ASTValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function duplicateOperationNameMessage(operationName: string): string {
return `There can be only one operation named "${operationName}".`;

validation/rules/UniqueOperationTypes.js.flow

@@ -7,9 +7,9 @@
* @flow strict
*/
-import type { SDLValidationContext } from '../ValidationContext';
+import { type SDLValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function duplicateOperationTypeMessage(operation: string): string {
return `There can be only one ${operation} type in schema.`;

validation/rules/UniqueTypeNames.js.flow

@@ -7,10 +7,10 @@
* @flow strict
*/
-import type { SDLValidationContext } from '../ValidationContext';
+import { type SDLValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
-import type { TypeDefinitionNode } from '../../language/ast';
+import { type ASTVisitor } from '../../language/visitor';
+import { type TypeDefinitionNode } from '../../language/ast';
export function duplicateTypeNameMessage(typeName: string): string {
return `There can be only one type named "${typeName}".`;

validation/rules/UniqueVariableNames.js.flow

@@ -7,10 +7,10 @@
* @flow strict
*/
-import type { ASTValidationContext } from '../ValidationContext';
-import type { VariableDefinitionNode } from '../../language/ast';
+import { type ASTValidationContext } from '../ValidationContext';
+import { type VariableDefinitionNode } from '../../language/ast';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
export function duplicateVariableMessage(variableName: string): string {
return `There can be only one variable named "${variableName}".`;

validation/rules/ValuesOfCorrectType.js.flow

@@ -8,12 +8,13 @@
*/
import objectValues from '../../polyfills/objectValues';
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { ValueNode } from '../../language/ast';
+import { type ValueNode } from '../../language/ast';
import { print } from '../../language/printer';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import {
+ type GraphQLType,
isScalarType,
isEnumType,
isInputObjectType,
@@ -23,7 +24,6 @@
getNullableType,
getNamedType,
} from '../../type/definition';
-import type { GraphQLType } from '../../type/definition';
import inspect from '../../jsutils/inspect';
import isInvalid from '../../jsutils/isInvalid';
import keyMap from '../../jsutils/keyMap';

validation/rules/VariablesAreInputTypes.js.flow

@@ -7,11 +7,11 @@
* @flow strict
*/
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
-import type { VariableDefinitionNode } from '../../language/ast';
+import { type VariableDefinitionNode } from '../../language/ast';
import { print } from '../../language/printer';
-import type { ASTVisitor } from '../../language/visitor';
+import { type ASTVisitor } from '../../language/visitor';
import { isInputType } from '../../type/definition';
import { typeFromAST } from '../../utilities/typeFromAST';

validation/rules/VariablesInAllowedPosition.js.flow

@@ -8,16 +8,15 @@
*/
import inspect from '../../jsutils/inspect';
-import type { ValidationContext } from '../ValidationContext';
+import { type ValidationContext } from '../ValidationContext';
import { GraphQLError } from '../../error/GraphQLError';
import { Kind } from '../../language/kinds';
-import type { ValueNode } from '../../language/ast';
-import type { ASTVisitor } from '../../language/visitor';
-import { isNonNullType } from '../../type/definition';
+import { type ValueNode } from '../../language/ast';
+import { type ASTVisitor } from '../../language/visitor';
+import { type GraphQLType, isNonNullType } from '../../type/definition';
import { isTypeSubTypeOf } from '../../utilities/typeComparators';
import { typeFromAST } from '../../utilities/typeFromAST';
-import type { GraphQLType } from '../../type/definition';
-import type { GraphQLSchema } from '../../type/schema';
+import { type GraphQLSchema } from '../../type/schema';
export function badVarPosMessage(
varName: string,

validation/specifiedRules.js.flow

@@ -7,7 +7,10 @@
* @flow strict
*/
-import type { ValidationRule, SDLValidationRule } from './ValidationContext';
+import {
+ type ValidationRule,
+ type SDLValidationRule,
+} from './ValidationContext';
// Spec Section: "Executable Definitions"
import { ExecutableDefinitions } from './rules/ExecutableDefinitions';
@@ -67,7 +70,10 @@
import { UniqueDirectivesPerLocation } from './rules/UniqueDirectivesPerLocation';
// Spec Section: "Argument Names"
-import { KnownArgumentNames } from './rules/KnownArgumentNames';
+import {
+ KnownArgumentNames,
+ KnownArgumentNamesOnDirectives, // @internal
+} from './rules/KnownArgumentNames';
// Spec Section: "Argument Uniqueness"
import { UniqueArgumentNames } from './rules/UniqueArgumentNames';
@@ -76,7 +82,10 @@
import { ValuesOfCorrectType } from './rules/ValuesOfCorrectType';
// Spec Section: "Argument Optionality"
-import { ProvidedRequiredArguments } from './rules/ProvidedRequiredArguments';
+import {
+ ProvidedRequiredArguments,
+ ProvidedRequiredArgumentsOnDirectives, // @internal
+} from './rules/ProvidedRequiredArguments';
// Spec Section: "All Variable Usages Are Allowed"
import { VariablesInAllowedPosition } from './rules/VariablesInAllowedPosition';
@@ -129,8 +138,6 @@
import { UniqueFieldDefinitionNames } from './rules/UniqueFieldDefinitionNames';
import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames';
import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions';
-import { KnownArgumentNamesOnDirectives } from './rules/KnownArgumentNames';
-import { ProvidedRequiredArgumentsOnDirectives } from './rules/ProvidedRequiredArguments';
// @internal
export const specifiedSDLRules: $ReadOnlyArray<SDLValidationRule> = [

validation/specifiedRules.mjs

@@ -45,13 +45,15 @@
import { UniqueDirectivesPerLocation } from './rules/UniqueDirectivesPerLocation'; // Spec Section: "Argument Names"
-import { KnownArgumentNames } from './rules/KnownArgumentNames'; // Spec Section: "Argument Uniqueness"
+import { KnownArgumentNames, KnownArgumentNamesOnDirectives } from // @internal
+'./rules/KnownArgumentNames'; // Spec Section: "Argument Uniqueness"
import { UniqueArgumentNames } from './rules/UniqueArgumentNames'; // Spec Section: "Value Type Correctness"
import { ValuesOfCorrectType } from './rules/ValuesOfCorrectType'; // Spec Section: "Argument Optionality"
-import { ProvidedRequiredArguments } from './rules/ProvidedRequiredArguments'; // Spec Section: "All Variable Usages Are Allowed"
+import { ProvidedRequiredArguments, ProvidedRequiredArgumentsOnDirectives } from // @internal
+'./rules/ProvidedRequiredArguments'; // Spec Section: "All Variable Usages Are Allowed"
import { VariablesInAllowedPosition } from './rules/VariablesInAllowedPosition'; // Spec Section: "Field Selection Merging"
@@ -72,8 +74,6 @@
import { UniqueEnumValueNames } from './rules/UniqueEnumValueNames';
import { UniqueFieldDefinitionNames } from './rules/UniqueFieldDefinitionNames';
import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames';
-import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions';
-import { KnownArgumentNamesOnDirectives } from './rules/KnownArgumentNames';
-import { ProvidedRequiredArgumentsOnDirectives } from './rules/ProvidedRequiredArguments'; // @internal
+import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions'; // @internal
export var specifiedSDLRules = [LoneSchemaDefinition, UniqueOperationTypes, UniqueTypeNames, UniqueEnumValueNames, UniqueFieldDefinitionNames, UniqueDirectiveNames, KnownTypeNames, KnownDirectives, UniqueDirectivesPerLocation, PossibleTypeExtensions, KnownArgumentNamesOnDirectives, UniqueArgumentNames, UniqueInputFieldNames, ProvidedRequiredArgumentsOnDirectives];
\ No newline at end of file

validation/validate.js.flow

@@ -8,15 +8,19 @@
*/
import invariant from '../jsutils/invariant';
-import type { GraphQLError } from '../error';
+import { type GraphQLError } from '../error';
import { visit, visitInParallel, visitWithTypeInfo } from '../language/visitor';
-import type { DocumentNode } from '../language/ast';
-import type { GraphQLSchema } from '../type/schema';
+import { type DocumentNode } from '../language/ast';
+import { type GraphQLSchema } from '../type/schema';
import { assertValidSchema } from '../type/validate';
import { TypeInfo } from '../utilities/TypeInfo';
import { specifiedRules, specifiedSDLRules } from './specifiedRules';
-import type { SDLValidationRule, ValidationRule } from './ValidationContext';
-import { SDLValidationContext, ValidationContext } from './ValidationContext';
+import {
+ type SDLValidationRule,
+ type ValidationRule,
+ SDLValidationContext,
+ ValidationContext,
+} from './ValidationContext';
/**
* Implements the "Validation" section of the spec.

validation/ValidationContext.js.flow

@@ -7,28 +7,27 @@
* @flow strict
*/
-import type { ObjMap } from '../jsutils/ObjMap';
-import type { GraphQLError } from '../error';
-import { visit, visitWithTypeInfo } from '../language/visitor';
+import { type ObjMap } from '../jsutils/ObjMap';
+import { type GraphQLError } from '../error';
+import { type ASTVisitor, visit, visitWithTypeInfo } from '../language/visitor';
import { Kind } from '../language/kinds';
-import type {
- DocumentNode,
- OperationDefinitionNode,
- VariableNode,
- SelectionSetNode,
- FragmentSpreadNode,
- FragmentDefinitionNode,
+import {
+ type DocumentNode,
+ type OperationDefinitionNode,
+ type VariableNode,
+ type SelectionSetNode,
+ type FragmentSpreadNode,
+ type FragmentDefinitionNode,
} from '../language/ast';
-import type { ASTVisitor } from '../language/visitor';
-import type { GraphQLSchema } from '../type/schema';
-import type {
- GraphQLInputType,
- GraphQLOutputType,
- GraphQLCompositeType,
- GraphQLField,
- GraphQLArgument,
+import { type GraphQLSchema } from '../type/schema';
+import {
+ type GraphQLInputType,
+ type GraphQLOutputType,
+ type GraphQLCompositeType,
+ type GraphQLField,
+ type GraphQLArgument,
} from '../type/definition';
-import type { GraphQLDirective } from '../type/directives';
+import { type GraphQLDirective } from '../type/directives';
import { TypeInfo } from '../utilities/TypeInfo';
type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode;