graphql 15.0.0 → 15.1.0

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.
Files changed (164) hide show
  1. package/README.md +5 -5
  2. package/error/GraphQLError.d.ts +2 -2
  3. package/error/GraphQLError.js +4 -5
  4. package/error/GraphQLError.js.flow +1 -1
  5. package/error/GraphQLError.mjs +4 -5
  6. package/error/locatedError.d.ts +1 -1
  7. package/execution/execute.d.ts +8 -6
  8. package/execution/execute.js +4 -6
  9. package/execution/execute.js.flow +3 -2
  10. package/execution/execute.mjs +4 -6
  11. package/execution/values.d.ts +2 -1
  12. package/execution/values.js +1 -2
  13. package/execution/values.js.flow +1 -1
  14. package/execution/values.mjs +1 -2
  15. package/graphql.d.ts +2 -1
  16. package/index.d.ts +3 -2
  17. package/index.js +18 -0
  18. package/index.js.flow +3 -2
  19. package/index.mjs +2 -2
  20. package/jsutils/Maybe.d.ts +2 -0
  21. package/jsutils/Path.d.ts +2 -2
  22. package/jsutils/defineInspect.js +25 -0
  23. package/jsutils/defineInspect.js.flow +21 -0
  24. package/jsutils/defineInspect.mjs +15 -0
  25. package/jsutils/devAssert.js +1 -2
  26. package/jsutils/devAssert.js.flow +1 -1
  27. package/jsutils/devAssert.mjs +1 -2
  28. package/jsutils/instanceOf.js +1 -2
  29. package/jsutils/instanceOf.js.flow +1 -1
  30. package/jsutils/instanceOf.mjs +1 -2
  31. package/jsutils/invariant.js +1 -2
  32. package/jsutils/invariant.js.flow +1 -1
  33. package/jsutils/invariant.mjs +1 -2
  34. package/jsutils/nodejsCustomInspectSymbol.js +1 -2
  35. package/jsutils/nodejsCustomInspectSymbol.js.flow +1 -1
  36. package/jsutils/nodejsCustomInspectSymbol.mjs +1 -1
  37. package/language/ast.d.ts +11 -2
  38. package/language/ast.js +94 -80
  39. package/language/ast.js.flow +23 -14
  40. package/language/ast.mjs +86 -72
  41. package/language/blockString.js +2 -1
  42. package/language/blockString.js.flow +5 -1
  43. package/language/blockString.mjs +2 -1
  44. package/language/directiveLocation.d.ts +2 -7
  45. package/language/index.js +14 -0
  46. package/language/index.js.flow +1 -2
  47. package/language/index.mjs +1 -0
  48. package/language/kinds.d.ts +2 -7
  49. package/language/lexer.d.ts +6 -0
  50. package/language/tokenKind.d.ts +2 -4
  51. package/language/visitor.d.ts +4 -3
  52. package/package.json +2 -2
  53. package/polyfills/arrayFrom.js +1 -2
  54. package/polyfills/arrayFrom.js.flow +1 -1
  55. package/polyfills/arrayFrom.mjs +1 -2
  56. package/polyfills/symbols.js +3 -6
  57. package/polyfills/symbols.js.flow +3 -3
  58. package/polyfills/symbols.mjs +3 -6
  59. package/subscription/subscribe.d.ts +2 -1
  60. package/type/definition.d.ts +30 -21
  61. package/type/definition.js +60 -17
  62. package/type/definition.js.flow +61 -9
  63. package/type/definition.mjs +60 -17
  64. package/type/directives.d.ts +6 -1
  65. package/type/directives.js +28 -7
  66. package/type/directives.js.flow +23 -2
  67. package/type/directives.mjs +24 -4
  68. package/type/index.d.ts +1 -0
  69. package/type/index.js +6 -0
  70. package/type/index.js.flow +1 -0
  71. package/type/index.mjs +1 -1
  72. package/type/introspection.js +11 -6
  73. package/type/introspection.js.flow +8 -2
  74. package/type/introspection.mjs +11 -6
  75. package/type/schema.d.ts +7 -5
  76. package/type/validate.js +22 -8
  77. package/type/validate.js.flow +23 -11
  78. package/type/validate.mjs +22 -8
  79. package/utilities/TypeInfo.d.ts +2 -1
  80. package/utilities/astFromValue.d.ts +2 -1
  81. package/utilities/astFromValue.js +4 -5
  82. package/utilities/astFromValue.js.flow +2 -1
  83. package/utilities/astFromValue.mjs +4 -5
  84. package/utilities/buildASTSchema.js +15 -4
  85. package/utilities/buildASTSchema.js.flow +13 -2
  86. package/utilities/buildASTSchema.mjs +15 -4
  87. package/utilities/buildClientSchema.js +2 -1
  88. package/utilities/buildClientSchema.js.flow +1 -0
  89. package/utilities/buildClientSchema.mjs +2 -1
  90. package/utilities/coerceInputValue.js +4 -5
  91. package/utilities/coerceInputValue.js.flow +2 -1
  92. package/utilities/coerceInputValue.mjs +4 -5
  93. package/utilities/extendSchema.d.ts +2 -1
  94. package/utilities/extendSchema.js +78 -66
  95. package/utilities/extendSchema.js.flow +30 -9
  96. package/utilities/extendSchema.mjs +79 -67
  97. package/utilities/findBreakingChanges.d.ts +6 -16
  98. package/utilities/findBreakingChanges.js +5 -8
  99. package/utilities/findBreakingChanges.js.flow +2 -1
  100. package/utilities/findBreakingChanges.mjs +5 -8
  101. package/utilities/getIntrospectionQuery.d.ts +12 -2
  102. package/utilities/getIntrospectionQuery.js +3 -1
  103. package/utilities/getIntrospectionQuery.js.flow +10 -0
  104. package/utilities/getIntrospectionQuery.mjs +3 -1
  105. package/utilities/getOperationAST.d.ts +3 -2
  106. package/utilities/getOperationAST.js.flow +1 -1
  107. package/utilities/introspectionFromSchema.js +0 -2
  108. package/utilities/introspectionFromSchema.mjs +0 -2
  109. package/utilities/lexicographicSortSchema.js +14 -15
  110. package/utilities/lexicographicSortSchema.js.flow +2 -1
  111. package/utilities/lexicographicSortSchema.mjs +14 -15
  112. package/utilities/printSchema.js +16 -6
  113. package/utilities/printSchema.js.flow +20 -2
  114. package/utilities/printSchema.mjs +16 -6
  115. package/utilities/typeFromAST.js +4 -5
  116. package/utilities/typeFromAST.js.flow +2 -1
  117. package/utilities/typeFromAST.mjs +4 -5
  118. package/utilities/valueFromAST.d.ts +2 -1
  119. package/utilities/valueFromAST.js +4 -5
  120. package/utilities/valueFromAST.js.flow +2 -1
  121. package/utilities/valueFromAST.mjs +4 -5
  122. package/utilities/valueFromASTUntyped.d.ts +2 -1
  123. package/utilities/valueFromASTUntyped.js +2 -3
  124. package/utilities/valueFromASTUntyped.js.flow +1 -1
  125. package/utilities/valueFromASTUntyped.mjs +2 -3
  126. package/validation/ValidationContext.d.ts +4 -3
  127. package/validation/ValidationContext.js +0 -16
  128. package/validation/ValidationContext.mjs +0 -16
  129. package/validation/rules/KnownArgumentNamesRule.js +2 -2
  130. package/validation/rules/KnownArgumentNamesRule.js.flow +1 -1
  131. package/validation/rules/KnownArgumentNamesRule.mjs +2 -2
  132. package/validation/rules/KnownDirectivesRule.js +2 -5
  133. package/validation/rules/KnownDirectivesRule.js.flow +1 -1
  134. package/validation/rules/KnownDirectivesRule.mjs +2 -5
  135. package/validation/rules/KnownTypeNamesRule.d.ts +4 -2
  136. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +2 -4
  137. package/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +2 -2
  138. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +2 -4
  139. package/validation/rules/PossibleTypeExtensionsRule.js +6 -8
  140. package/validation/rules/PossibleTypeExtensionsRule.js.flow +3 -2
  141. package/validation/rules/PossibleTypeExtensionsRule.mjs +6 -8
  142. package/validation/rules/ProvidedRequiredArgumentsRule.js +4 -5
  143. package/validation/rules/ProvidedRequiredArgumentsRule.js.flow +3 -3
  144. package/validation/rules/ProvidedRequiredArgumentsRule.mjs +4 -5
  145. package/validation/rules/UniqueEnumValueNamesRule.js +1 -2
  146. package/validation/rules/UniqueEnumValueNamesRule.js.flow +1 -1
  147. package/validation/rules/UniqueEnumValueNamesRule.mjs +1 -2
  148. package/validation/rules/UniqueFieldDefinitionNamesRule.js +1 -2
  149. package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +1 -1
  150. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +1 -2
  151. package/validation/rules/UniqueOperationTypesRule.js +1 -1
  152. package/validation/rules/UniqueOperationTypesRule.js.flow +1 -1
  153. package/validation/rules/UniqueOperationTypesRule.mjs +1 -1
  154. package/validation/validate.d.ts +3 -3
  155. package/version.js +3 -3
  156. package/version.js.flow +3 -3
  157. package/version.mjs +3 -3
  158. package/jsutils/dedent.js +0 -50
  159. package/jsutils/dedent.js.flow +0 -44
  160. package/jsutils/dedent.mjs +0 -43
  161. package/jsutils/defineToJSON.js +0 -25
  162. package/jsutils/defineToJSON.js.flow +0 -20
  163. package/jsutils/defineToJSON.mjs +0 -16
  164. package/tsutils/Maybe.d.ts +0 -6
@@ -17,7 +17,7 @@ import { specifiedDirectives } from "../../type/directives.mjs";
17
17
  * that field.
18
18
  */
19
19
  export function KnownArgumentNamesRule(context) {
20
- return _objectSpread({}, KnownArgumentNamesOnDirectivesRule(context), {
20
+ return _objectSpread(_objectSpread({}, KnownArgumentNamesOnDirectivesRule(context)), {}, {
21
21
  Argument: function Argument(argNode) {
22
22
  var argDef = context.getArgument();
23
23
  var fieldDef = context.getFieldDef();
@@ -58,7 +58,7 @@ export function KnownArgumentNamesOnDirectivesRule(context) {
58
58
  if (def.kind === Kind.DIRECTIVE_DEFINITION) {
59
59
  var _def$arguments;
60
60
 
61
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
61
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
62
62
  var argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : [];
63
63
  directiveArgs[def.name.value] = argsNodes.map(function (arg) {
64
64
  return arg.name.value;
@@ -68,8 +68,6 @@ function KnownDirectivesRule(context) {
68
68
 
69
69
  function getDirectiveLocationForASTPath(ancestors) {
70
70
  var appliedTo = ancestors[ancestors.length - 1];
71
-
72
- /* istanbul ignore next */
73
71
  !Array.isArray(appliedTo) || (0, _invariant.default)(0);
74
72
 
75
73
  switch (appliedTo.kind) {
@@ -143,9 +141,8 @@ function getDirectiveLocationForOperation(operation) {
143
141
 
144
142
  case 'subscription':
145
143
  return _directiveLocation.DirectiveLocation.SUBSCRIPTION;
146
- } // Not reachable. All possible types have been considered.
144
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
147
145
 
148
146
 
149
- /* istanbul ignore next */
150
- (0, _invariant.default)(false, 'Unexpected operation: ' + (0, _inspect.default)(operation));
147
+ false || (0, _invariant.default)(0, 'Unexpected operation: ' + (0, _inspect.default)(operation));
151
148
  }
@@ -134,6 +134,6 @@ function getDirectiveLocationForOperation(
134
134
  return DirectiveLocation.SUBSCRIPTION;
135
135
  }
136
136
 
137
- // Not reachable. All possible types have been considered.
137
+ // istanbul ignore next (Not reachable. All possible types have been considered)
138
138
  invariant(false, 'Unexpected operation: ' + inspect((operation: empty)));
139
139
  }
@@ -54,8 +54,6 @@ export function KnownDirectivesRule(context) {
54
54
 
55
55
  function getDirectiveLocationForASTPath(ancestors) {
56
56
  var appliedTo = ancestors[ancestors.length - 1];
57
-
58
- /* istanbul ignore next */
59
57
  !Array.isArray(appliedTo) || invariant(0);
60
58
 
61
59
  switch (appliedTo.kind) {
@@ -129,9 +127,8 @@ function getDirectiveLocationForOperation(operation) {
129
127
 
130
128
  case 'subscription':
131
129
  return DirectiveLocation.SUBSCRIPTION;
132
- } // Not reachable. All possible types have been considered.
130
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
133
131
 
134
132
 
135
- /* istanbul ignore next */
136
- invariant(false, 'Unexpected operation: ' + inspect(operation));
133
+ false || invariant(0, 'Unexpected operation: ' + inspect(operation));
137
134
  }
@@ -1,5 +1,5 @@
1
1
  import { ASTVisitor } from '../../language/visitor';
2
- import { ValidationContext } from '../ValidationContext';
2
+ import { ValidationContext, SDLValidationContext } from '../ValidationContext';
3
3
 
4
4
  /**
5
5
  * Known type names
@@ -7,4 +7,6 @@ import { ValidationContext } from '../ValidationContext';
7
7
  * A GraphQL document is only valid if referenced types (specifically
8
8
  * variable definitions and fragment conditions) are defined by the type schema.
9
9
  */
10
- export function KnownTypeNamesRule(context: ValidationContext): ASTVisitor;
10
+ export function KnownTypeNamesRule(
11
+ context: ValidationContext | SDLValidationContext,
12
+ ): ASTVisitor;
@@ -361,12 +361,10 @@ function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPai
361
361
 
362
362
  if (name1 !== name2) {
363
363
  return [[responseName, "\"".concat(name1, "\" and \"").concat(name2, "\" are different fields")], [node1], [node2]];
364
- }
365
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
364
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
366
365
 
367
366
 
368
- var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : [];
369
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
367
+ var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : []; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
370
368
 
371
369
  var args2 = (_node2$arguments = node2.arguments) !== null && _node2$arguments !== void 0 ? _node2$arguments : []; // Two field calls must have the same arguments.
372
370
 
@@ -571,9 +571,9 @@ function findConflict(
571
571
  ];
572
572
  }
573
573
 
574
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
574
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
575
575
  const args1 = node1.arguments ?? [];
576
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
576
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
577
577
  const args2 = node2.arguments ?? [];
578
578
  // Two field calls must have the same arguments.
579
579
  if (!sameArguments(args1, args2)) {
@@ -345,12 +345,10 @@ function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPai
345
345
 
346
346
  if (name1 !== name2) {
347
347
  return [[responseName, "\"".concat(name1, "\" and \"").concat(name2, "\" are different fields")], [node1], [node2]];
348
- }
349
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
348
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
350
349
 
351
350
 
352
- var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : [];
353
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
351
+ var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : []; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
354
352
 
355
353
  var args2 = (_node2$arguments = node2.arguments) !== null && _node2$arguments !== void 0 ? _node2$arguments : []; // Two field calls must have the same arguments.
356
354
 
@@ -104,16 +104,15 @@ function typeToExtKind(type) {
104
104
 
105
105
  if ((0, _definition.isEnumType)(type)) {
106
106
  return _kinds.Kind.ENUM_TYPE_EXTENSION;
107
- }
107
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
108
+
108
109
 
109
- /* istanbul ignore else */
110
110
  if ((0, _definition.isInputObjectType)(type)) {
111
111
  return _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION;
112
- } // Not reachable. All possible types have been considered.
112
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
113
113
 
114
114
 
115
- /* istanbul ignore next */
116
- (0, _invariant.default)(false, 'Unexpected type: ' + (0, _inspect.default)(type));
115
+ false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type));
117
116
  }
118
117
 
119
118
  function extensionKindToTypeName(kind) {
@@ -135,9 +134,8 @@ function extensionKindToTypeName(kind) {
135
134
 
136
135
  case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION:
137
136
  return 'input object';
138
- } // Not reachable. All possible types have been considered.
137
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
139
138
 
140
139
 
141
- /* istanbul ignore next */
142
- (0, _invariant.default)(false, 'Unexpected kind: ' + (0, _inspect.default)(kind));
140
+ false || (0, _invariant.default)(0, 'Unexpected kind: ' + (0, _inspect.default)(kind));
143
141
  }
@@ -113,11 +113,12 @@ function typeToExtKind(type) {
113
113
  if (isEnumType(type)) {
114
114
  return Kind.ENUM_TYPE_EXTENSION;
115
115
  }
116
+ // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
116
117
  if (isInputObjectType(type)) {
117
118
  return Kind.INPUT_OBJECT_TYPE_EXTENSION;
118
119
  }
119
120
 
120
- // Not reachable. All possible types have been considered.
121
+ // istanbul ignore next (Not reachable. All possible types have been considered)
121
122
  invariant(false, 'Unexpected type: ' + inspect((type: empty)));
122
123
  }
123
124
 
@@ -137,6 +138,6 @@ function extensionKindToTypeName(kind) {
137
138
  return 'input object';
138
139
  }
139
140
 
140
- // Not reachable. All possible types have been considered.
141
+ // istanbul ignore next (Not reachable. All possible types have been considered)
141
142
  invariant(false, 'Unexpected kind: ' + inspect(kind));
142
143
  }
@@ -87,16 +87,15 @@ function typeToExtKind(type) {
87
87
 
88
88
  if (isEnumType(type)) {
89
89
  return Kind.ENUM_TYPE_EXTENSION;
90
- }
90
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
91
+
91
92
 
92
- /* istanbul ignore else */
93
93
  if (isInputObjectType(type)) {
94
94
  return Kind.INPUT_OBJECT_TYPE_EXTENSION;
95
- } // Not reachable. All possible types have been considered.
95
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
96
96
 
97
97
 
98
- /* istanbul ignore next */
99
- invariant(false, 'Unexpected type: ' + inspect(type));
98
+ false || invariant(0, 'Unexpected type: ' + inspect(type));
100
99
  }
101
100
 
102
101
  function extensionKindToTypeName(kind) {
@@ -118,9 +117,8 @@ function extensionKindToTypeName(kind) {
118
117
 
119
118
  case Kind.INPUT_OBJECT_TYPE_EXTENSION:
120
119
  return 'input object';
121
- } // Not reachable. All possible types have been considered.
120
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
122
121
 
123
122
 
124
- /* istanbul ignore next */
125
- invariant(false, 'Unexpected kind: ' + inspect(kind));
123
+ false || invariant(0, 'Unexpected kind: ' + inspect(kind));
126
124
  }
@@ -35,7 +35,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
35
35
  * default value) field arguments have been provided.
36
36
  */
37
37
  function ProvidedRequiredArgumentsRule(context) {
38
- return _objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context), {
38
+ return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, {
39
39
  Field: {
40
40
  // Validate on leave to allow for deeper errors to appear first.
41
41
  leave: function leave(fieldNode) {
@@ -45,8 +45,7 @@ function ProvidedRequiredArgumentsRule(context) {
45
45
 
46
46
  if (!fieldDef) {
47
47
  return false;
48
- }
49
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
48
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
50
49
 
51
50
 
52
51
  var argNodes = (_fieldNode$arguments = fieldNode.arguments) !== null && _fieldNode$arguments !== void 0 ? _fieldNode$arguments : [];
@@ -92,7 +91,7 @@ function ProvidedRequiredArgumentsOnDirectivesRule(context) {
92
91
  if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) {
93
92
  var _def$arguments;
94
93
 
95
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
94
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
96
95
  var argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : [];
97
96
  requiredArgsMap[def.name.value] = (0, _keyMap.default)(argNodes.filter(isRequiredArgumentNode), function (arg) {
98
97
  return arg.name.value;
@@ -110,7 +109,7 @@ function ProvidedRequiredArgumentsOnDirectivesRule(context) {
110
109
  if (requiredArgs) {
111
110
  var _directiveNode$argume;
112
111
 
113
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
112
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
114
113
  var _argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : [];
115
114
 
116
115
  var argNodeMap = (0, _keyMap.default)(_argNodes, function (arg) {
@@ -36,7 +36,7 @@ export function ProvidedRequiredArgumentsRule(
36
36
  return false;
37
37
  }
38
38
 
39
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
39
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
40
40
  const argNodes = fieldNode.arguments ?? [];
41
41
  const argNodeMap = keyMap(argNodes, (arg) => arg.name.value);
42
42
  for (const argDef of fieldDef.args) {
@@ -78,7 +78,7 @@ export function ProvidedRequiredArgumentsOnDirectivesRule(
78
78
  const astDefinitions = context.getDocument().definitions;
79
79
  for (const def of astDefinitions) {
80
80
  if (def.kind === Kind.DIRECTIVE_DEFINITION) {
81
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
81
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
82
82
  const argNodes = def.arguments ?? [];
83
83
 
84
84
  requiredArgsMap[def.name.value] = keyMap(
@@ -95,7 +95,7 @@ export function ProvidedRequiredArgumentsOnDirectivesRule(
95
95
  const directiveName = directiveNode.name.value;
96
96
  const requiredArgs = requiredArgsMap[directiveName];
97
97
  if (requiredArgs) {
98
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
98
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
99
99
  const argNodes = directiveNode.arguments ?? [];
100
100
  const argNodeMap = keyMap(argNodes, (arg) => arg.name.value);
101
101
  for (const argName of Object.keys(requiredArgs)) {
@@ -19,7 +19,7 @@ import { isType, isRequiredArgument } from "../../type/definition.mjs";
19
19
  * default value) field arguments have been provided.
20
20
  */
21
21
  export function ProvidedRequiredArgumentsRule(context) {
22
- return _objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context), {
22
+ return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, {
23
23
  Field: {
24
24
  // Validate on leave to allow for deeper errors to appear first.
25
25
  leave: function leave(fieldNode) {
@@ -29,8 +29,7 @@ export function ProvidedRequiredArgumentsRule(context) {
29
29
 
30
30
  if (!fieldDef) {
31
31
  return false;
32
- }
33
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
32
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
34
33
 
35
34
 
36
35
  var argNodes = (_fieldNode$arguments = fieldNode.arguments) !== null && _fieldNode$arguments !== void 0 ? _fieldNode$arguments : [];
@@ -75,7 +74,7 @@ export function ProvidedRequiredArgumentsOnDirectivesRule(context) {
75
74
  if (def.kind === Kind.DIRECTIVE_DEFINITION) {
76
75
  var _def$arguments;
77
76
 
78
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
77
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
79
78
  var argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : [];
80
79
  requiredArgsMap[def.name.value] = keyMap(argNodes.filter(isRequiredArgumentNode), function (arg) {
81
80
  return arg.name.value;
@@ -93,7 +92,7 @@ export function ProvidedRequiredArgumentsOnDirectivesRule(context) {
93
92
  if (requiredArgs) {
94
93
  var _directiveNode$argume;
95
94
 
96
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
95
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
97
96
  var _argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : [];
98
97
 
99
98
  var argNodeMap = keyMap(_argNodes, function (arg) {
@@ -30,8 +30,7 @@ function UniqueEnumValueNamesRule(context) {
30
30
 
31
31
  if (!knownValueNames[typeName]) {
32
32
  knownValueNames[typeName] = Object.create(null);
33
- }
34
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
33
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
35
34
 
36
35
 
37
36
  var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];
@@ -30,7 +30,7 @@ export function UniqueEnumValueNamesRule(
30
30
  knownValueNames[typeName] = Object.create(null);
31
31
  }
32
32
 
33
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
33
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
34
34
  const valueNodes = node.values ?? [];
35
35
  const valueNames = knownValueNames[typeName];
36
36
 
@@ -22,8 +22,7 @@ export function UniqueEnumValueNamesRule(context) {
22
22
 
23
23
  if (!knownValueNames[typeName]) {
24
24
  knownValueNames[typeName] = Object.create(null);
25
- }
26
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
25
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
27
26
 
28
27
 
29
28
  var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : [];
@@ -34,8 +34,7 @@ function UniqueFieldDefinitionNamesRule(context) {
34
34
 
35
35
  if (!knownFieldNames[typeName]) {
36
36
  knownFieldNames[typeName] = Object.create(null);
37
- }
38
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
37
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
39
38
 
40
39
 
41
40
  var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : [];
@@ -38,7 +38,7 @@ export function UniqueFieldDefinitionNamesRule(
38
38
  knownFieldNames[typeName] = Object.create(null);
39
39
  }
40
40
 
41
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
41
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
42
42
  const fieldNodes = node.fields ?? [];
43
43
  const fieldNames = knownFieldNames[typeName];
44
44
 
@@ -26,8 +26,7 @@ export function UniqueFieldDefinitionNamesRule(context) {
26
26
 
27
27
  if (!knownFieldNames[typeName]) {
28
28
  knownFieldNames[typeName] = Object.create(null);
29
- }
30
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
29
+ } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
31
30
 
32
31
 
33
32
  var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : [];
@@ -28,7 +28,7 @@ function UniqueOperationTypesRule(context) {
28
28
  function checkOperationTypes(node) {
29
29
  var _node$operationTypes;
30
30
 
31
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
31
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
32
32
  var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];
33
33
 
34
34
  for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {
@@ -29,7 +29,7 @@ export function UniqueOperationTypesRule(
29
29
  };
30
30
 
31
31
  function checkOperationTypes(node) {
32
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
32
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
33
33
  const operationTypesNodes = node.operationTypes ?? [];
34
34
 
35
35
  for (const operationType of operationTypesNodes) {
@@ -21,7 +21,7 @@ export function UniqueOperationTypesRule(context) {
21
21
  function checkOperationTypes(node) {
22
22
  var _node$operationTypes;
23
23
 
24
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
24
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
25
25
  var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : [];
26
26
 
27
27
  for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) {
@@ -1,4 +1,4 @@
1
- import Maybe from '../tsutils/Maybe';
1
+ import { Maybe } from '../jsutils/Maybe';
2
2
 
3
3
  import { GraphQLError } from '../error/GraphQLError';
4
4
 
@@ -49,7 +49,7 @@ export function validateSDL(
49
49
  *
50
50
  * @internal
51
51
  */
52
- export function assertValidSDL(documentAST: DocumentNode): undefined;
52
+ export function assertValidSDL(documentAST: DocumentNode): void;
53
53
 
54
54
  /**
55
55
  * Utility function which asserts a SDL document is valid by throwing an error
@@ -60,4 +60,4 @@ export function assertValidSDL(documentAST: DocumentNode): undefined;
60
60
  export function assertValidSDLExtension(
61
61
  documentAST: DocumentNode,
62
62
  schema: GraphQLSchema,
63
- ): undefined;
63
+ ): void;
package/version.js CHANGED
@@ -7,13 +7,13 @@ exports.versionInfo = exports.version = void 0;
7
7
 
8
8
  /**
9
9
  * Note: This file is autogenerated using "resources/gen-version.js" script and
10
- * automatically updated by "yarn version" command.
10
+ * automatically updated by "npm version" command.
11
11
  */
12
12
 
13
13
  /**
14
14
  * A string containing the version of the GraphQL.js library
15
15
  */
16
- var version = '15.0.0';
16
+ var version = '15.1.0';
17
17
  /**
18
18
  * An object containing the components of the GraphQL.js version string
19
19
  */
@@ -21,7 +21,7 @@ var version = '15.0.0';
21
21
  exports.version = version;
22
22
  var versionInfo = Object.freeze({
23
23
  major: 15,
24
- minor: 0,
24
+ minor: 1,
25
25
  patch: 0,
26
26
  preReleaseTag: null
27
27
  });
package/version.js.flow CHANGED
@@ -2,20 +2,20 @@
2
2
 
3
3
  /**
4
4
  * Note: This file is autogenerated using "resources/gen-version.js" script and
5
- * automatically updated by "yarn version" command.
5
+ * automatically updated by "npm version" command.
6
6
  */
7
7
 
8
8
  /**
9
9
  * A string containing the version of the GraphQL.js library
10
10
  */
11
- export const version = '15.0.0';
11
+ export const version = '15.1.0';
12
12
 
13
13
  /**
14
14
  * An object containing the components of the GraphQL.js version string
15
15
  */
16
16
  export const versionInfo = Object.freeze({
17
17
  major: 15,
18
- minor: 0,
18
+ minor: 1,
19
19
  patch: 0,
20
20
  preReleaseTag: null,
21
21
  });
package/version.mjs CHANGED
@@ -1,19 +1,19 @@
1
1
  /**
2
2
  * Note: This file is autogenerated using "resources/gen-version.js" script and
3
- * automatically updated by "yarn version" command.
3
+ * automatically updated by "npm version" command.
4
4
  */
5
5
 
6
6
  /**
7
7
  * A string containing the version of the GraphQL.js library
8
8
  */
9
- export var version = '15.0.0';
9
+ export var version = '15.1.0';
10
10
  /**
11
11
  * An object containing the components of the GraphQL.js version string
12
12
  */
13
13
 
14
14
  export var versionInfo = Object.freeze({
15
15
  major: 15,
16
- minor: 0,
16
+ minor: 1,
17
17
  patch: 0,
18
18
  preReleaseTag: null
19
19
  });
package/jsutils/dedent.js DELETED
@@ -1,50 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = dedent;
7
-
8
- /**
9
- * An ES6 string tag that fixes indentation. Also removes leading newlines
10
- * and trailing spaces and tabs, but keeps trailing newlines.
11
- *
12
- * Example usage:
13
- * const str = dedent`
14
- * {
15
- * test
16
- * }
17
- * `;
18
- * str === "{\n test\n}\n";
19
- */
20
- function dedent(strings) {
21
- var str = '';
22
-
23
- for (var i = 0; i < strings.length; ++i) {
24
- str += strings[i];
25
-
26
- if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) {
27
- /* istanbul ignore next (ignore else inside Babel generated code) */
28
- var value = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
29
- str += value; // interpolation
30
- }
31
- }
32
-
33
- var trimmedStr = str.replace(/^\n*/m, '') // remove leading newline
34
- .replace(/[ \t]*$/, ''); // remove trailing spaces and tabs
35
- // fixes indentation by removing leading spaces and tabs from each line
36
-
37
- var indent = '';
38
-
39
- for (var _i2 = 0; _i2 < trimmedStr.length; _i2++) {
40
- var char = trimmedStr[_i2];
41
-
42
- if (char !== ' ' && char !== '\t') {
43
- break;
44
- }
45
-
46
- indent += char;
47
- }
48
-
49
- return trimmedStr.replace(RegExp('^' + indent, 'mg'), ''); // remove indent
50
- }
@@ -1,44 +0,0 @@
1
- // @flow strict
2
-
3
- /**
4
- * An ES6 string tag that fixes indentation. Also removes leading newlines
5
- * and trailing spaces and tabs, but keeps trailing newlines.
6
- *
7
- * Example usage:
8
- * const str = dedent`
9
- * {
10
- * test
11
- * }
12
- * `;
13
- * str === "{\n test\n}\n";
14
- */
15
- export default function dedent(
16
- strings: $ReadOnlyArray<string>,
17
- ...values: $ReadOnlyArray<string>
18
- ): string {
19
- let str = '';
20
-
21
- for (let i = 0; i < strings.length; ++i) {
22
- str += strings[i];
23
- if (i < values.length) {
24
- /* istanbul ignore next (ignore else inside Babel generated code) */
25
- const value = values[i];
26
-
27
- str += value; // interpolation
28
- }
29
- }
30
-
31
- const trimmedStr = str
32
- .replace(/^\n*/m, '') // remove leading newline
33
- .replace(/[ \t]*$/, ''); // remove trailing spaces and tabs
34
-
35
- // fixes indentation by removing leading spaces and tabs from each line
36
- let indent = '';
37
- for (const char of trimmedStr) {
38
- if (char !== ' ' && char !== '\t') {
39
- break;
40
- }
41
- indent += char;
42
- }
43
- return trimmedStr.replace(RegExp('^' + indent, 'mg'), ''); // remove indent
44
- }