graphql 14.0.0 → 14.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/error/GraphQLError.js +1 -1
- package/error/GraphQLError.js.flow +3 -3
- package/error/GraphQLError.mjs +1 -1
- package/error/formatError.js +1 -1
- package/error/formatError.mjs +1 -1
- package/error/index.mjs +1 -1
- package/error/locatedError.js +1 -1
- package/error/locatedError.mjs +1 -1
- package/error/printError.js +1 -1
- package/error/printError.mjs +1 -1
- package/error/syntaxError.js +1 -1
- package/error/syntaxError.mjs +1 -1
- package/execution/execute.js +4 -4
- package/execution/execute.js.flow +4 -6
- package/execution/execute.mjs +5 -5
- package/execution/index.mjs +1 -1
- package/execution/values.js +4 -4
- package/execution/values.js.flow +3 -3
- package/execution/values.mjs +3 -3
- package/graphql.js +1 -1
- package/graphql.mjs +1 -1
- package/index.js +12 -0
- package/index.js.flow +4 -0
- package/index.mjs +4 -4
- package/jsutils/dedent.js +2 -2
- package/jsutils/dedent.js.flow +1 -1
- package/jsutils/dedent.mjs +2 -2
- package/jsutils/defineToJSON.js +17 -6
- package/jsutils/defineToJSON.js.flow +14 -5
- package/jsutils/defineToJSON.mjs +14 -6
- package/jsutils/defineToStringTag.js +5 -5
- package/jsutils/defineToStringTag.js.flow +3 -3
- package/jsutils/defineToStringTag.mjs +4 -4
- package/jsutils/inspect.js +46 -12
- package/jsutils/inspect.js.flow +42 -15
- package/jsutils/inspect.mjs +45 -5
- package/jsutils/instanceOf.js +1 -1
- package/jsutils/instanceOf.mjs +1 -1
- package/jsutils/invariant.js +1 -1
- package/jsutils/invariant.mjs +1 -1
- package/jsutils/isInvalid.js +1 -1
- package/jsutils/isInvalid.mjs +1 -1
- package/jsutils/isNullish.js +1 -1
- package/jsutils/isNullish.mjs +1 -1
- package/jsutils/isPromise.js +1 -1
- package/jsutils/isPromise.mjs +1 -1
- package/jsutils/keyMap.js +1 -1
- package/jsutils/keyMap.mjs +1 -1
- package/jsutils/keyValMap.js +1 -1
- package/jsutils/keyValMap.mjs +1 -1
- package/jsutils/mapValue.js +54 -0
- package/jsutils/mapValue.js.flow +27 -0
- package/jsutils/mapValue.mjs +44 -0
- package/jsutils/memoize3.js +1 -1
- package/jsutils/memoize3.mjs +1 -1
- package/jsutils/nodejsCustomInspectSymbol.js +18 -0
- package/jsutils/nodejsCustomInspectSymbol.js.flow +15 -0
- package/jsutils/nodejsCustomInspectSymbol.mjs +10 -0
- package/jsutils/orList.js +17 -4
- package/jsutils/orList.js.flow +13 -7
- package/jsutils/orList.mjs +14 -4
- package/jsutils/promiseForObject.js +1 -1
- package/jsutils/promiseForObject.mjs +1 -1
- package/jsutils/promiseReduce.js +1 -1
- package/jsutils/promiseReduce.mjs +1 -1
- package/jsutils/quotedOrList.js +1 -1
- package/jsutils/quotedOrList.mjs +1 -1
- package/jsutils/suggestionList.js +1 -1
- package/jsutils/suggestionList.mjs +1 -1
- package/language/blockStringValue.js +2 -2
- package/language/blockStringValue.js.flow +1 -1
- package/language/blockStringValue.mjs +2 -2
- package/language/directiveLocation.js +1 -1
- package/language/directiveLocation.mjs +1 -1
- package/language/index.mjs +1 -1
- package/language/kinds.js +1 -1
- package/language/kinds.mjs +1 -1
- package/language/lexer.js +29 -13
- package/language/lexer.js.flow +34 -20
- package/language/lexer.mjs +28 -13
- package/language/location.js +1 -1
- package/language/location.mjs +1 -1
- package/language/parser.js +31 -38
- package/language/parser.js.flow +32 -48
- package/language/parser.mjs +30 -38
- package/language/predicates.js +1 -1
- package/language/predicates.mjs +1 -1
- package/language/printer.js +13 -7
- package/language/printer.js.flow +19 -9
- package/language/printer.mjs +13 -7
- package/language/source.js +8 -7
- package/language/source.mjs +1 -9
- package/language/visitor.js +11 -20
- package/language/visitor.js.flow +4 -5
- package/language/visitor.mjs +8 -20
- package/package.json +10 -3
- package/polyfills/find.js +31 -0
- package/polyfills/find.js.flow +29 -0
- package/polyfills/find.mjs +23 -0
- package/{jsutils → polyfills}/isFinite.js +1 -1
- package/{jsutils → polyfills}/isFinite.js.flow +0 -0
- package/{jsutils → polyfills}/isFinite.mjs +1 -1
- package/{jsutils → polyfills}/isInteger.js +1 -1
- package/{jsutils → polyfills}/isInteger.js.flow +0 -0
- package/{jsutils → polyfills}/isInteger.mjs +1 -1
- package/polyfills/objectEntries.js +26 -0
- package/polyfills/objectEntries.js.flow +19 -0
- package/polyfills/objectEntries.mjs +18 -0
- package/{jsutils → polyfills}/objectValues.js +1 -1
- package/{jsutils → polyfills}/objectValues.js.flow +1 -1
- package/{jsutils → polyfills}/objectValues.mjs +1 -1
- package/subscription/asyncIteratorReject.mjs +1 -1
- package/subscription/index.mjs +1 -1
- package/subscription/mapAsyncIterator.mjs +1 -1
- package/subscription/subscribe.js +1 -1
- package/subscription/subscribe.js.flow +1 -1
- package/subscription/subscribe.mjs +2 -2
- package/type/definition.js +31 -130
- package/type/definition.js.flow +35 -47
- package/type/definition.mjs +30 -131
- package/type/directives.js +25 -29
- package/type/directives.js.flow +24 -20
- package/type/directives.mjs +22 -30
- package/type/index.js +12 -0
- package/type/index.js.flow +4 -0
- package/type/index.mjs +5 -3
- package/type/introspection.js +3 -3
- package/type/introspection.js.flow +1 -1
- package/type/introspection.mjs +2 -2
- package/type/scalars.js +45 -34
- package/type/scalars.js.flow +40 -26
- package/type/scalars.mjs +44 -26
- package/type/schema.js +82 -87
- package/type/schema.js.flow +17 -9
- package/type/schema.mjs +79 -86
- package/type/validate.js +168 -175
- package/type/validate.js.flow +8 -49
- package/type/validate.mjs +159 -175
- package/utilities/TypeInfo.js +10 -23
- package/utilities/TypeInfo.js.flow +1 -1
- package/utilities/TypeInfo.mjs +2 -24
- package/utilities/assertValidName.js +1 -1
- package/utilities/assertValidName.mjs +1 -1
- package/utilities/astFromValue.js +2 -2
- package/utilities/astFromValue.js.flow +1 -1
- package/utilities/astFromValue.mjs +2 -2
- package/utilities/buildASTSchema.js +169 -152
- package/utilities/buildASTSchema.js.flow +117 -113
- package/utilities/buildASTSchema.mjs +160 -152
- package/utilities/buildClientSchema.js +24 -14
- package/utilities/buildClientSchema.js.flow +24 -14
- package/utilities/buildClientSchema.mjs +23 -14
- package/utilities/coerceValue.js +38 -19
- package/utilities/coerceValue.js.flow +41 -47
- package/utilities/coerceValue.mjs +38 -20
- package/utilities/concatAST.js +1 -1
- package/utilities/concatAST.mjs +1 -1
- package/utilities/extendSchema.js +228 -312
- package/utilities/extendSchema.js.flow +27 -152
- package/utilities/extendSchema.mjs +229 -312
- package/utilities/findBreakingChanges.js +7 -5
- package/utilities/findBreakingChanges.js.flow +3 -2
- package/utilities/findBreakingChanges.mjs +6 -5
- package/utilities/findDeprecatedUsages.js +1 -1
- package/utilities/findDeprecatedUsages.mjs +1 -1
- package/utilities/getOperationAST.js +1 -1
- package/utilities/getOperationAST.mjs +1 -1
- package/utilities/getOperationRootType.js +1 -1
- package/utilities/getOperationRootType.mjs +1 -1
- package/utilities/index.mjs +1 -1
- package/utilities/introspectionFromSchema.js +1 -1
- package/utilities/introspectionFromSchema.mjs +1 -1
- package/utilities/introspectionQuery.js +1 -1
- package/utilities/introspectionQuery.mjs +1 -1
- package/utilities/isValidJSValue.js +1 -1
- package/utilities/isValidJSValue.mjs +1 -1
- package/utilities/isValidLiteralValue.js +1 -1
- package/utilities/isValidLiteralValue.mjs +1 -1
- package/utilities/lexicographicSortSchema.js +2 -2
- package/utilities/lexicographicSortSchema.js.flow +1 -1
- package/utilities/lexicographicSortSchema.mjs +2 -2
- package/utilities/schemaPrinter.js +3 -3
- package/utilities/schemaPrinter.js.flow +1 -1
- package/utilities/schemaPrinter.mjs +2 -2
- package/utilities/separateOperations.js +1 -1
- package/utilities/separateOperations.mjs +1 -1
- package/utilities/typeComparators.js +1 -1
- package/utilities/typeComparators.mjs +1 -1
- package/utilities/typeFromAST.js +1 -1
- package/utilities/typeFromAST.mjs +1 -1
- package/utilities/valueFromAST.js +3 -3
- package/utilities/valueFromAST.js.flow +1 -1
- package/utilities/valueFromAST.mjs +2 -2
- package/utilities/valueFromASTUntyped.js +1 -1
- package/utilities/valueFromASTUntyped.mjs +1 -1
- package/validation/ValidationContext.js +57 -82
- package/validation/ValidationContext.js.flow +52 -49
- package/validation/ValidationContext.mjs +52 -77
- package/validation/index.js.flow +1 -0
- package/validation/index.mjs +1 -1
- package/validation/rules/ExecutableDefinitions.js +1 -1
- package/validation/rules/ExecutableDefinitions.js.flow +1 -1
- package/validation/rules/ExecutableDefinitions.mjs +1 -1
- package/validation/rules/FieldsOnCorrectType.js +1 -1
- package/validation/rules/FieldsOnCorrectType.mjs +1 -1
- package/validation/rules/FragmentsOnCompositeTypes.js +1 -1
- package/validation/rules/FragmentsOnCompositeTypes.mjs +1 -1
- package/validation/rules/KnownArgumentNames.mjs +1 -1
- package/validation/rules/KnownDirectives.js +1 -1
- package/validation/rules/KnownDirectives.mjs +1 -1
- package/validation/rules/KnownFragmentNames.js +1 -1
- package/validation/rules/KnownFragmentNames.mjs +1 -1
- package/validation/rules/KnownTypeNames.js +59 -21
- package/validation/rules/KnownTypeNames.js.flow +54 -20
- package/validation/rules/KnownTypeNames.mjs +56 -21
- package/validation/rules/LoneAnonymousOperation.js +1 -1
- package/validation/rules/LoneAnonymousOperation.mjs +1 -1
- package/validation/rules/LoneSchemaDefinition.js +1 -1
- package/validation/rules/LoneSchemaDefinition.mjs +1 -1
- package/validation/rules/NoFragmentCycles.js +1 -1
- package/validation/rules/NoFragmentCycles.js.flow +2 -2
- package/validation/rules/NoFragmentCycles.mjs +1 -1
- package/validation/rules/NoUndefinedVariables.js +1 -1
- package/validation/rules/NoUndefinedVariables.mjs +1 -1
- package/validation/rules/NoUnusedFragments.js +1 -1
- package/validation/rules/NoUnusedFragments.js.flow +2 -2
- package/validation/rules/NoUnusedFragments.mjs +1 -1
- package/validation/rules/NoUnusedVariables.js +1 -1
- package/validation/rules/NoUnusedVariables.mjs +1 -1
- package/validation/rules/OverlappingFieldsCanBeMerged.js +57 -33
- package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +5 -6
- package/validation/rules/OverlappingFieldsCanBeMerged.mjs +48 -33
- package/validation/rules/PossibleFragmentSpreads.js +1 -1
- package/validation/rules/PossibleFragmentSpreads.mjs +1 -1
- package/validation/rules/PossibleTypeExtensions.js +158 -0
- package/validation/rules/PossibleTypeExtensions.js.flow +160 -0
- package/validation/rules/PossibleTypeExtensions.mjs +146 -0
- package/validation/rules/ProvidedRequiredArguments.mjs +1 -1
- package/validation/rules/ScalarLeafs.js +1 -1
- package/validation/rules/ScalarLeafs.mjs +1 -1
- package/validation/rules/SingleFieldSubscriptions.js +1 -1
- package/validation/rules/SingleFieldSubscriptions.mjs +1 -1
- package/validation/rules/UniqueArgumentNames.js +1 -1
- package/validation/rules/UniqueArgumentNames.mjs +1 -1
- package/validation/rules/UniqueDirectiveNames.js +55 -0
- package/validation/rules/UniqueDirectiveNames.js.flow +64 -0
- package/validation/rules/UniqueDirectiveNames.mjs +43 -0
- package/validation/rules/UniqueDirectivesPerLocation.js +1 -1
- package/validation/rules/UniqueDirectivesPerLocation.mjs +1 -1
- package/validation/rules/UniqueEnumValueNames.js +94 -0
- package/validation/rules/UniqueEnumValueNames.js.flow +87 -0
- package/validation/rules/UniqueEnumValueNames.mjs +81 -0
- package/validation/rules/UniqueFieldDefinitionNames.js +105 -0
- package/validation/rules/UniqueFieldDefinitionNames.js.flow +101 -0
- package/validation/rules/UniqueFieldDefinitionNames.mjs +92 -0
- package/validation/rules/UniqueFragmentNames.js +1 -1
- package/validation/rules/UniqueFragmentNames.mjs +1 -1
- package/validation/rules/UniqueInputFieldNames.js +1 -1
- package/validation/rules/UniqueInputFieldNames.mjs +1 -1
- package/validation/rules/UniqueOperationNames.js +1 -1
- package/validation/rules/UniqueOperationNames.mjs +1 -1
- package/validation/rules/UniqueOperationTypes.js +85 -0
- package/validation/rules/UniqueOperationTypes.js.flow +76 -0
- package/validation/rules/UniqueOperationTypes.mjs +73 -0
- package/validation/rules/UniqueTypeNames.js +62 -0
- package/validation/rules/UniqueTypeNames.js.flow +67 -0
- package/validation/rules/UniqueTypeNames.mjs +50 -0
- package/validation/rules/UniqueVariableNames.js +1 -1
- package/validation/rules/UniqueVariableNames.mjs +1 -1
- package/validation/rules/ValuesOfCorrectType.js +29 -13
- package/validation/rules/ValuesOfCorrectType.js.flow +4 -5
- package/validation/rules/ValuesOfCorrectType.mjs +28 -13
- package/validation/rules/VariablesAreInputTypes.js +1 -1
- package/validation/rules/VariablesAreInputTypes.mjs +1 -1
- package/validation/rules/VariablesInAllowedPosition.js +4 -4
- package/validation/rules/VariablesInAllowedPosition.mjs +4 -4
- package/validation/specifiedRules.js +14 -2
- package/validation/specifiedRules.js.flow +13 -0
- package/validation/specifiedRules.mjs +8 -2
- package/validation/validate.js +1 -1
- package/validation/validate.mjs +1 -1
- package/jsutils/find.js +0 -22
- package/jsutils/find.js.flow +0 -19
- package/jsutils/find.mjs +0 -15
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
*/
|
|
9
|
+
import objectValues from '../../polyfills/objectValues';
|
|
9
10
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
10
11
|
import { print } from '../../language/printer';
|
|
11
12
|
import { isScalarType, isEnumType, isInputObjectType, isListType, isNonNullType, isRequiredInputField, getNullableType, getNamedType } from '../../type/definition';
|
|
@@ -58,21 +59,35 @@ export function ValuesOfCorrectType(context) {
|
|
|
58
59
|
} // Ensure every required field exists.
|
|
59
60
|
|
|
60
61
|
|
|
61
|
-
var inputFields = type.getFields();
|
|
62
62
|
var fieldNodeMap = keyMap(node.fields, function (field) {
|
|
63
63
|
return field.name.value;
|
|
64
64
|
});
|
|
65
|
-
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
var _iteratorNormalCompletion = true;
|
|
66
|
+
var _didIteratorError = false;
|
|
67
|
+
var _iteratorError = undefined;
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
for (var _iterator = objectValues(type.getFields())[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
71
|
+
var fieldDef = _step.value;
|
|
72
|
+
var fieldNode = fieldNodeMap[fieldDef.name];
|
|
73
|
+
|
|
74
|
+
if (!fieldNode && isRequiredInputField(fieldDef)) {
|
|
75
|
+
var typeStr = inspect(fieldDef.type);
|
|
76
|
+
context.reportError(new GraphQLError(requiredFieldMessage(type.name, fieldDef.name, typeStr), node));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} catch (err) {
|
|
80
|
+
_didIteratorError = true;
|
|
81
|
+
_iteratorError = err;
|
|
82
|
+
} finally {
|
|
83
|
+
try {
|
|
84
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
85
|
+
_iterator.return();
|
|
86
|
+
}
|
|
87
|
+
} finally {
|
|
88
|
+
if (_didIteratorError) {
|
|
89
|
+
throw _iteratorError;
|
|
90
|
+
}
|
|
76
91
|
}
|
|
77
92
|
}
|
|
78
93
|
},
|
|
@@ -20,7 +20,7 @@ var _typeFromAST = require("../../utilities/typeFromAST");
|
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
*/
|
|
25
25
|
function nonInputTypeOnVarMessage(variableName, typeName) {
|
|
26
26
|
return "Variable \"$".concat(variableName, "\" cannot be non-input type \"").concat(typeName, "\".");
|
|
@@ -26,7 +26,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
26
26
|
* This source code is licensed under the MIT license found in the
|
|
27
27
|
* LICENSE file in the root directory of this source tree.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
29
|
+
*
|
|
30
30
|
*/
|
|
31
31
|
function badVarPosMessage(varName, varType, expectedType) {
|
|
32
32
|
return "Variable \"$".concat(varName, "\" of type \"").concat(varType, "\" used in ") + "position expecting type \"".concat(expectedType, "\".");
|
|
@@ -52,9 +52,9 @@ function VariablesInAllowedPosition(context) {
|
|
|
52
52
|
try {
|
|
53
53
|
for (var _iterator = usages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
54
54
|
var _ref2 = _step.value;
|
|
55
|
-
var node = _ref2.node
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
var node = _ref2.node;
|
|
56
|
+
var type = _ref2.type;
|
|
57
|
+
var defaultValue = _ref2.defaultValue;
|
|
58
58
|
var varName = node.name.value;
|
|
59
59
|
var varDef = varDefMap[varName];
|
|
60
60
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
*/
|
|
9
9
|
import inspect from '../../jsutils/inspect';
|
|
10
10
|
import { GraphQLError } from '../../error/GraphQLError';
|
|
@@ -35,9 +35,9 @@ export function VariablesInAllowedPosition(context) {
|
|
|
35
35
|
try {
|
|
36
36
|
for (var _iterator = usages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
37
37
|
var _ref2 = _step.value;
|
|
38
|
-
var node = _ref2.node
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
var node = _ref2.node;
|
|
39
|
+
var type = _ref2.type;
|
|
40
|
+
var defaultValue = _ref2.defaultValue;
|
|
41
41
|
var varName = node.name.value;
|
|
42
42
|
var varDef = varDefMap[varName];
|
|
43
43
|
|
|
@@ -59,13 +59,25 @@ var _UniqueInputFieldNames = require("./rules/UniqueInputFieldNames");
|
|
|
59
59
|
|
|
60
60
|
var _LoneSchemaDefinition = require("./rules/LoneSchemaDefinition");
|
|
61
61
|
|
|
62
|
+
var _UniqueOperationTypes = require("./rules/UniqueOperationTypes");
|
|
63
|
+
|
|
64
|
+
var _UniqueTypeNames = require("./rules/UniqueTypeNames");
|
|
65
|
+
|
|
66
|
+
var _UniqueEnumValueNames = require("./rules/UniqueEnumValueNames");
|
|
67
|
+
|
|
68
|
+
var _UniqueFieldDefinitionNames = require("./rules/UniqueFieldDefinitionNames");
|
|
69
|
+
|
|
70
|
+
var _UniqueDirectiveNames = require("./rules/UniqueDirectiveNames");
|
|
71
|
+
|
|
72
|
+
var _PossibleTypeExtensions = require("./rules/PossibleTypeExtensions");
|
|
73
|
+
|
|
62
74
|
/**
|
|
63
75
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
64
76
|
*
|
|
65
77
|
* This source code is licensed under the MIT license found in the
|
|
66
78
|
* LICENSE file in the root directory of this source tree.
|
|
67
79
|
*
|
|
68
|
-
*
|
|
80
|
+
*
|
|
69
81
|
*/
|
|
70
82
|
// Spec Section: "Executable Definitions"
|
|
71
83
|
// Spec Section: "Operation Name Uniqueness"
|
|
@@ -103,5 +115,5 @@ var _LoneSchemaDefinition = require("./rules/LoneSchemaDefinition");
|
|
|
103
115
|
var specifiedRules = [_ExecutableDefinitions.ExecutableDefinitions, _UniqueOperationNames.UniqueOperationNames, _LoneAnonymousOperation.LoneAnonymousOperation, _SingleFieldSubscriptions.SingleFieldSubscriptions, _KnownTypeNames.KnownTypeNames, _FragmentsOnCompositeTypes.FragmentsOnCompositeTypes, _VariablesAreInputTypes.VariablesAreInputTypes, _ScalarLeafs.ScalarLeafs, _FieldsOnCorrectType.FieldsOnCorrectType, _UniqueFragmentNames.UniqueFragmentNames, _KnownFragmentNames.KnownFragmentNames, _NoUnusedFragments.NoUnusedFragments, _PossibleFragmentSpreads.PossibleFragmentSpreads, _NoFragmentCycles.NoFragmentCycles, _UniqueVariableNames.UniqueVariableNames, _NoUndefinedVariables.NoUndefinedVariables, _NoUnusedVariables.NoUnusedVariables, _KnownDirectives.KnownDirectives, _UniqueDirectivesPerLocation.UniqueDirectivesPerLocation, _KnownArgumentNames.KnownArgumentNames, _UniqueArgumentNames.UniqueArgumentNames, _ValuesOfCorrectType.ValuesOfCorrectType, _ProvidedRequiredArguments.ProvidedRequiredArguments, _VariablesInAllowedPosition.VariablesInAllowedPosition, _OverlappingFieldsCanBeMerged.OverlappingFieldsCanBeMerged, _UniqueInputFieldNames.UniqueInputFieldNames];
|
|
104
116
|
exports.specifiedRules = specifiedRules;
|
|
105
117
|
// @internal
|
|
106
|
-
var specifiedSDLRules = [_LoneSchemaDefinition.LoneSchemaDefinition, _KnownDirectives.KnownDirectives, _UniqueDirectivesPerLocation.UniqueDirectivesPerLocation, _KnownArgumentNames.KnownArgumentNamesOnDirectives, _UniqueArgumentNames.UniqueArgumentNames, _UniqueInputFieldNames.UniqueInputFieldNames, _ProvidedRequiredArguments.ProvidedRequiredArgumentsOnDirectives];
|
|
118
|
+
var specifiedSDLRules = [_LoneSchemaDefinition.LoneSchemaDefinition, _UniqueOperationTypes.UniqueOperationTypes, _UniqueTypeNames.UniqueTypeNames, _UniqueEnumValueNames.UniqueEnumValueNames, _UniqueFieldDefinitionNames.UniqueFieldDefinitionNames, _UniqueDirectiveNames.UniqueDirectiveNames, _KnownTypeNames.KnownTypeNames, _KnownDirectives.KnownDirectives, _UniqueDirectivesPerLocation.UniqueDirectivesPerLocation, _PossibleTypeExtensions.PossibleTypeExtensions, _KnownArgumentNames.KnownArgumentNamesOnDirectives, _UniqueArgumentNames.UniqueArgumentNames, _UniqueInputFieldNames.UniqueInputFieldNames, _ProvidedRequiredArguments.ProvidedRequiredArgumentsOnDirectives];
|
|
107
119
|
exports.specifiedSDLRules = specifiedSDLRules;
|
|
@@ -123,14 +123,27 @@ export const specifiedRules: $ReadOnlyArray<ValidationRule> = [
|
|
|
123
123
|
];
|
|
124
124
|
|
|
125
125
|
import { LoneSchemaDefinition } from './rules/LoneSchemaDefinition';
|
|
126
|
+
import { UniqueOperationTypes } from './rules/UniqueOperationTypes';
|
|
127
|
+
import { UniqueTypeNames } from './rules/UniqueTypeNames';
|
|
128
|
+
import { UniqueEnumValueNames } from './rules/UniqueEnumValueNames';
|
|
129
|
+
import { UniqueFieldDefinitionNames } from './rules/UniqueFieldDefinitionNames';
|
|
130
|
+
import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames';
|
|
131
|
+
import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions';
|
|
126
132
|
import { KnownArgumentNamesOnDirectives } from './rules/KnownArgumentNames';
|
|
127
133
|
import { ProvidedRequiredArgumentsOnDirectives } from './rules/ProvidedRequiredArguments';
|
|
128
134
|
|
|
129
135
|
// @internal
|
|
130
136
|
export const specifiedSDLRules: $ReadOnlyArray<SDLValidationRule> = [
|
|
131
137
|
LoneSchemaDefinition,
|
|
138
|
+
UniqueOperationTypes,
|
|
139
|
+
UniqueTypeNames,
|
|
140
|
+
UniqueEnumValueNames,
|
|
141
|
+
UniqueFieldDefinitionNames,
|
|
142
|
+
UniqueDirectiveNames,
|
|
143
|
+
KnownTypeNames,
|
|
132
144
|
KnownDirectives,
|
|
133
145
|
UniqueDirectivesPerLocation,
|
|
146
|
+
PossibleTypeExtensions,
|
|
134
147
|
KnownArgumentNamesOnDirectives,
|
|
135
148
|
UniqueArgumentNames,
|
|
136
149
|
UniqueInputFieldNames,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
*/
|
|
9
9
|
// Spec Section: "Executable Definitions"
|
|
10
10
|
import { ExecutableDefinitions } from './rules/ExecutableDefinitions'; // Spec Section: "Operation Name Uniqueness"
|
|
@@ -67,7 +67,13 @@ import { UniqueInputFieldNames } from './rules/UniqueInputFieldNames';
|
|
|
67
67
|
|
|
68
68
|
export var specifiedRules = [ExecutableDefinitions, UniqueOperationNames, LoneAnonymousOperation, SingleFieldSubscriptions, KnownTypeNames, FragmentsOnCompositeTypes, VariablesAreInputTypes, ScalarLeafs, FieldsOnCorrectType, UniqueFragmentNames, KnownFragmentNames, NoUnusedFragments, PossibleFragmentSpreads, NoFragmentCycles, UniqueVariableNames, NoUndefinedVariables, NoUnusedVariables, KnownDirectives, UniqueDirectivesPerLocation, KnownArgumentNames, UniqueArgumentNames, ValuesOfCorrectType, ProvidedRequiredArguments, VariablesInAllowedPosition, OverlappingFieldsCanBeMerged, UniqueInputFieldNames];
|
|
69
69
|
import { LoneSchemaDefinition } from './rules/LoneSchemaDefinition';
|
|
70
|
+
import { UniqueOperationTypes } from './rules/UniqueOperationTypes';
|
|
71
|
+
import { UniqueTypeNames } from './rules/UniqueTypeNames';
|
|
72
|
+
import { UniqueEnumValueNames } from './rules/UniqueEnumValueNames';
|
|
73
|
+
import { UniqueFieldDefinitionNames } from './rules/UniqueFieldDefinitionNames';
|
|
74
|
+
import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames';
|
|
75
|
+
import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions';
|
|
70
76
|
import { KnownArgumentNamesOnDirectives } from './rules/KnownArgumentNames';
|
|
71
77
|
import { ProvidedRequiredArgumentsOnDirectives } from './rules/ProvidedRequiredArguments'; // @internal
|
|
72
78
|
|
|
73
|
-
export var specifiedSDLRules = [LoneSchemaDefinition, KnownDirectives, UniqueDirectivesPerLocation, KnownArgumentNamesOnDirectives, UniqueArgumentNames, UniqueInputFieldNames, ProvidedRequiredArgumentsOnDirectives];
|
|
79
|
+
export var specifiedSDLRules = [LoneSchemaDefinition, UniqueOperationTypes, UniqueTypeNames, UniqueEnumValueNames, UniqueFieldDefinitionNames, UniqueDirectiveNames, KnownTypeNames, KnownDirectives, UniqueDirectivesPerLocation, PossibleTypeExtensions, KnownArgumentNamesOnDirectives, UniqueArgumentNames, UniqueInputFieldNames, ProvidedRequiredArgumentsOnDirectives];
|
package/validation/validate.js
CHANGED
package/validation/validate.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
*/
|
|
9
9
|
import invariant from '../jsutils/invariant';
|
|
10
10
|
import { visit, visitInParallel, visitWithTypeInfo } from '../language/visitor';
|
package/jsutils/find.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = find;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*
|
|
14
|
-
* strict
|
|
15
|
-
*/
|
|
16
|
-
function find(list, predicate) {
|
|
17
|
-
for (var i = 0; i < list.length; i++) {
|
|
18
|
-
if (predicate(list[i])) {
|
|
19
|
-
return list[i];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
package/jsutils/find.js.flow
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @flow strict
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export default function find<T>(
|
|
11
|
-
list: $ReadOnlyArray<T>,
|
|
12
|
-
predicate: (item: T) => boolean,
|
|
13
|
-
): ?T {
|
|
14
|
-
for (let i = 0; i < list.length; i++) {
|
|
15
|
-
if (predicate(list[i])) {
|
|
16
|
-
return list[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
package/jsutils/find.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* strict
|
|
8
|
-
*/
|
|
9
|
-
export default function find(list, predicate) {
|
|
10
|
-
for (var i = 0; i < list.length; i++) {
|
|
11
|
-
if (predicate(list[i])) {
|
|
12
|
-
return list[i];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|