graphql 16.0.1 → 16.3.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 (177) hide show
  1. package/README.md +4 -4
  2. package/error/GraphQLError.d.ts +17 -1
  3. package/error/GraphQLError.js +28 -10
  4. package/error/GraphQLError.mjs +28 -19
  5. package/error/locatedError.js +2 -8
  6. package/error/locatedError.mjs +2 -6
  7. package/execution/collectFields.d.ts +8 -8
  8. package/execution/collectFields.js +8 -8
  9. package/execution/collectFields.mjs +7 -7
  10. package/execution/execute.d.ts +5 -5
  11. package/execution/execute.js +28 -17
  12. package/execution/execute.mjs +30 -19
  13. package/execution/index.d.ts +1 -1
  14. package/execution/index.js +6 -0
  15. package/execution/index.mjs +1 -1
  16. package/execution/mapAsyncIterator.js +3 -1
  17. package/execution/mapAsyncIterator.mjs +3 -1
  18. package/execution/subscribe.d.ts +1 -1
  19. package/execution/subscribe.js +10 -2
  20. package/execution/subscribe.mjs +8 -1
  21. package/execution/values.d.ts +3 -5
  22. package/execution/values.js +7 -8
  23. package/execution/values.mjs +5 -6
  24. package/graphql.js +12 -4
  25. package/graphql.mjs +8 -1
  26. package/index.d.ts +7 -61
  27. package/index.js +30 -0
  28. package/index.mjs +62 -111
  29. package/jsutils/devAssert.js +1 -1
  30. package/jsutils/devAssert.mjs +1 -1
  31. package/jsutils/instanceOf.js +3 -1
  32. package/jsutils/instanceOf.mjs +3 -1
  33. package/jsutils/invariant.js +1 -1
  34. package/jsutils/invariant.mjs +1 -1
  35. package/jsutils/mapValue.js +2 -2
  36. package/jsutils/mapValue.mjs +2 -2
  37. package/jsutils/promiseReduce.mjs +1 -1
  38. package/jsutils/toError.d.ts +4 -0
  39. package/jsutils/toError.js +25 -0
  40. package/jsutils/toError.mjs +18 -0
  41. package/language/blockString.d.ts +7 -3
  42. package/language/blockString.js +121 -64
  43. package/language/blockString.mjs +111 -62
  44. package/language/characterClasses.d.ts +9 -0
  45. package/language/characterClasses.js +13 -0
  46. package/language/characterClasses.mjs +12 -0
  47. package/language/index.d.ts +0 -1
  48. package/language/lexer.d.ts +1 -1
  49. package/language/lexer.js +23 -15
  50. package/language/lexer.mjs +23 -15
  51. package/language/parser.d.ts +40 -40
  52. package/language/parser.js +9 -8
  53. package/language/parser.mjs +7 -6
  54. package/language/predicates.d.ts +4 -4
  55. package/language/printLocation.d.ts +1 -1
  56. package/language/printLocation.mjs +1 -1
  57. package/language/printer.js +5 -3
  58. package/language/printer.mjs +4 -2
  59. package/language/source.js +2 -2
  60. package/language/source.mjs +1 -1
  61. package/language/visitor.js +12 -13
  62. package/language/visitor.mjs +11 -12
  63. package/package.json +4 -1
  64. package/type/assertName.mjs +1 -1
  65. package/type/definition.d.ts +18 -14
  66. package/type/definition.js +13 -11
  67. package/type/definition.mjs +10 -16
  68. package/type/directives.d.ts +1 -1
  69. package/type/directives.js +9 -9
  70. package/type/directives.mjs +7 -7
  71. package/type/index.d.ts +5 -27
  72. package/type/index.js +24 -0
  73. package/type/index.mjs +26 -40
  74. package/type/introspection.d.ts +2 -2
  75. package/type/introspection.js +12 -8
  76. package/type/introspection.mjs +16 -12
  77. package/type/scalars.d.ts +10 -0
  78. package/type/scalars.js +20 -12
  79. package/type/scalars.mjs +17 -12
  80. package/type/schema.d.ts +4 -4
  81. package/type/schema.js +11 -9
  82. package/type/schema.mjs +11 -10
  83. package/type/validate.js +39 -30
  84. package/type/validate.mjs +42 -33
  85. package/utilities/TypeInfo.d.ts +9 -9
  86. package/utilities/TypeInfo.js +6 -2
  87. package/utilities/TypeInfo.mjs +11 -7
  88. package/utilities/assertValidName.js +3 -2
  89. package/utilities/assertValidName.mjs +3 -2
  90. package/utilities/astFromValue.js +8 -6
  91. package/utilities/astFromValue.mjs +7 -5
  92. package/utilities/buildASTSchema.d.ts +1 -1
  93. package/utilities/buildASTSchema.js +2 -2
  94. package/utilities/buildASTSchema.mjs +2 -2
  95. package/utilities/buildClientSchema.js +9 -7
  96. package/utilities/buildClientSchema.mjs +17 -15
  97. package/utilities/coerceInputValue.js +9 -7
  98. package/utilities/coerceInputValue.mjs +9 -7
  99. package/utilities/extendSchema.d.ts +1 -1
  100. package/utilities/extendSchema.js +50 -42
  101. package/utilities/extendSchema.mjs +71 -60
  102. package/utilities/findBreakingChanges.js +9 -22
  103. package/utilities/findBreakingChanges.mjs +13 -22
  104. package/utilities/getIntrospectionQuery.d.ts +4 -0
  105. package/utilities/getIntrospectionQuery.js +4 -0
  106. package/utilities/getIntrospectionQuery.mjs +4 -0
  107. package/utilities/getOperationRootType.d.ts +1 -1
  108. package/utilities/index.d.ts +0 -25
  109. package/utilities/index.mjs +21 -44
  110. package/utilities/introspectionFromSchema.d.ts +1 -1
  111. package/utilities/lexicographicSortSchema.js +8 -7
  112. package/utilities/lexicographicSortSchema.mjs +16 -15
  113. package/utilities/printSchema.d.ts +1 -1
  114. package/utilities/printSchema.js +14 -12
  115. package/utilities/printSchema.mjs +20 -15
  116. package/utilities/separateOperations.js +2 -0
  117. package/utilities/separateOperations.mjs +2 -0
  118. package/utilities/sortValueNode.d.ts +9 -0
  119. package/utilities/sortValueNode.js +47 -0
  120. package/utilities/sortValueNode.mjs +39 -0
  121. package/utilities/stripIgnoredCharacters.js +7 -23
  122. package/utilities/stripIgnoredCharacters.mjs +6 -25
  123. package/utilities/typeComparators.d.ts +1 -1
  124. package/utilities/typeComparators.mjs +3 -3
  125. package/utilities/typeFromAST.d.ts +4 -4
  126. package/utilities/typeFromAST.js +13 -24
  127. package/utilities/typeFromAST.mjs +12 -25
  128. package/utilities/valueFromAST.d.ts +1 -1
  129. package/utilities/valueFromAST.js +6 -4
  130. package/utilities/valueFromAST.mjs +7 -5
  131. package/utilities/valueFromASTUntyped.d.ts +1 -1
  132. package/utilities/valueFromASTUntyped.js +1 -11
  133. package/utilities/valueFromASTUntyped.mjs +2 -6
  134. package/validation/ValidationContext.d.ts +10 -10
  135. package/validation/index.d.ts +0 -29
  136. package/validation/index.mjs +29 -58
  137. package/validation/rules/FieldsOnCorrectTypeRule.js +2 -2
  138. package/validation/rules/FieldsOnCorrectTypeRule.mjs +3 -3
  139. package/validation/rules/KnownArgumentNamesRule.d.ts +1 -1
  140. package/validation/rules/KnownArgumentNamesRule.js +3 -1
  141. package/validation/rules/KnownArgumentNamesRule.mjs +3 -1
  142. package/validation/rules/KnownDirectivesRule.d.ts +1 -1
  143. package/validation/rules/KnownDirectivesRule.js +13 -9
  144. package/validation/rules/KnownDirectivesRule.mjs +8 -4
  145. package/validation/rules/KnownTypeNamesRule.d.ts +1 -1
  146. package/validation/rules/KnownTypeNamesRule.js +2 -2
  147. package/validation/rules/KnownTypeNamesRule.mjs +1 -1
  148. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +41 -36
  149. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +41 -39
  150. package/validation/rules/PossibleFragmentSpreadsRule.js +2 -2
  151. package/validation/rules/PossibleFragmentSpreadsRule.mjs +1 -1
  152. package/validation/rules/PossibleTypeExtensionsRule.js +16 -10
  153. package/validation/rules/PossibleTypeExtensionsRule.mjs +15 -9
  154. package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +1 -1
  155. package/validation/rules/ProvidedRequiredArgumentsRule.js +10 -5
  156. package/validation/rules/ProvidedRequiredArgumentsRule.mjs +9 -4
  157. package/validation/rules/UniqueArgumentDefinitionNamesRule.js +9 -3
  158. package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +9 -3
  159. package/validation/rules/UniqueArgumentNamesRule.js +3 -1
  160. package/validation/rules/UniqueArgumentNamesRule.mjs +3 -1
  161. package/validation/rules/UniqueEnumValueNamesRule.js +3 -1
  162. package/validation/rules/UniqueEnumValueNamesRule.mjs +3 -1
  163. package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -1
  164. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +5 -3
  165. package/validation/rules/UniqueOperationTypesRule.js +3 -1
  166. package/validation/rules/UniqueOperationTypesRule.mjs +3 -1
  167. package/validation/rules/UniqueVariableNamesRule.js +3 -1
  168. package/validation/rules/UniqueVariableNamesRule.mjs +3 -1
  169. package/validation/rules/ValuesOfCorrectTypeRule.js +2 -2
  170. package/validation/rules/ValuesOfCorrectTypeRule.mjs +5 -5
  171. package/validation/rules/VariablesInAllowedPositionRule.js +2 -2
  172. package/validation/rules/VariablesInAllowedPositionRule.mjs +1 -1
  173. package/validation/specifiedRules.d.ts +1 -1
  174. package/validation/specifiedRules.js +47 -47
  175. package/validation/specifiedRules.mjs +41 -41
  176. package/version.js +3 -3
  177. package/version.mjs +3 -3
@@ -5,25 +5,25 @@ Object.defineProperty(exports, '__esModule', {
5
5
  });
6
6
  exports.buildClientSchema = buildClientSchema;
7
7
 
8
- var _inspect = require('../jsutils/inspect.js');
9
-
10
8
  var _devAssert = require('../jsutils/devAssert.js');
11
9
 
12
- var _keyValMap = require('../jsutils/keyValMap.js');
10
+ var _inspect = require('../jsutils/inspect.js');
13
11
 
14
12
  var _isObjectLike = require('../jsutils/isObjectLike.js');
15
13
 
14
+ var _keyValMap = require('../jsutils/keyValMap.js');
15
+
16
16
  var _parser = require('../language/parser.js');
17
17
 
18
- var _schema = require('../type/schema.js');
18
+ var _definition = require('../type/definition.js');
19
19
 
20
20
  var _directives = require('../type/directives.js');
21
21
 
22
- var _scalars = require('../type/scalars.js');
23
-
24
22
  var _introspection = require('../type/introspection.js');
25
23
 
26
- var _definition = require('../type/definition.js');
24
+ var _scalars = require('../type/scalars.js');
25
+
26
+ var _schema = require('../type/schema.js');
27
27
 
28
28
  var _valueFromAST = require('./valueFromAST.js');
29
29
 
@@ -151,6 +151,8 @@ function buildClientSchema(introspection, options) {
151
151
  function buildType(type) {
152
152
  // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
153
153
  if (type != null && type.name != null && type.kind != null) {
154
+ // FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17
155
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
154
156
  switch (type.kind) {
155
157
  case _introspection.TypeKind.SCALAR:
156
158
  return buildScalarDef(type);
@@ -1,27 +1,27 @@
1
- import { inspect } from '../jsutils/inspect.mjs';
2
1
  import { devAssert } from '../jsutils/devAssert.mjs';
3
- import { keyValMap } from '../jsutils/keyValMap.mjs';
2
+ import { inspect } from '../jsutils/inspect.mjs';
4
3
  import { isObjectLike } from '../jsutils/isObjectLike.mjs';
4
+ import { keyValMap } from '../jsutils/keyValMap.mjs';
5
5
  import { parseValue } from '../language/parser.mjs';
6
- import { GraphQLSchema } from '../type/schema.mjs';
7
- import { GraphQLDirective } from '../type/directives.mjs';
8
- import { specifiedScalarTypes } from '../type/scalars.mjs';
9
- import { introspectionTypes, TypeKind } from '../type/introspection.mjs';
10
6
  import {
11
- isInputType,
12
- isOutputType,
7
+ assertInterfaceType,
8
+ assertNullableType,
9
+ assertObjectType,
10
+ GraphQLEnumType,
11
+ GraphQLInputObjectType,
12
+ GraphQLInterfaceType,
13
13
  GraphQLList,
14
14
  GraphQLNonNull,
15
- GraphQLScalarType,
16
15
  GraphQLObjectType,
17
- GraphQLInterfaceType,
16
+ GraphQLScalarType,
18
17
  GraphQLUnionType,
19
- GraphQLEnumType,
20
- GraphQLInputObjectType,
21
- assertNullableType,
22
- assertObjectType,
23
- assertInterfaceType,
18
+ isInputType,
19
+ isOutputType,
24
20
  } from '../type/definition.mjs';
21
+ import { GraphQLDirective } from '../type/directives.mjs';
22
+ import { introspectionTypes, TypeKind } from '../type/introspection.mjs';
23
+ import { specifiedScalarTypes } from '../type/scalars.mjs';
24
+ import { GraphQLSchema } from '../type/schema.mjs';
25
25
  import { valueFromAST } from './valueFromAST.mjs';
26
26
  /**
27
27
  * Build a GraphQLSchema for use by client tools.
@@ -141,6 +141,8 @@ export function buildClientSchema(introspection, options) {
141
141
  function buildType(type) {
142
142
  // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
143
143
  if (type != null && type.name != null && type.kind != null) {
144
+ // FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17
145
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
144
146
  switch (type.kind) {
145
147
  case TypeKind.SCALAR:
146
148
  return buildScalarDef(type);
@@ -5,21 +5,21 @@ Object.defineProperty(exports, '__esModule', {
5
5
  });
6
6
  exports.coerceInputValue = coerceInputValue;
7
7
 
8
+ var _didYouMean = require('../jsutils/didYouMean.js');
9
+
8
10
  var _inspect = require('../jsutils/inspect.js');
9
11
 
10
12
  var _invariant = require('../jsutils/invariant.js');
11
13
 
12
- var _didYouMean = require('../jsutils/didYouMean.js');
14
+ var _isIterableObject = require('../jsutils/isIterableObject.js');
13
15
 
14
16
  var _isObjectLike = require('../jsutils/isObjectLike.js');
15
17
 
16
- var _suggestionList = require('../jsutils/suggestionList.js');
18
+ var _Path = require('../jsutils/Path.js');
17
19
 
18
20
  var _printPathArray = require('../jsutils/printPathArray.js');
19
21
 
20
- var _Path = require('../jsutils/Path.js');
21
-
22
- var _isIterableObject = require('../jsutils/isIterableObject.js');
22
+ var _suggestionList = require('../jsutils/suggestionList.js');
23
23
 
24
24
  var _GraphQLError = require('../error/GraphQLError.js');
25
25
 
@@ -140,7 +140,7 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
140
140
  }
141
141
 
142
142
  return coercedValue;
143
- } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
143
+ }
144
144
 
145
145
  if ((0, _definition.isLeafType)(type)) {
146
146
  let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(),
@@ -179,7 +179,9 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
179
179
  }
180
180
 
181
181
  return parseResult;
182
- } // istanbul ignore next (Not reachable. All possible input types have been considered)
182
+ }
183
+ /* c8 ignore next 3 */
184
+ // Not reachable, all possible types have been considered.
183
185
 
184
186
  false ||
185
187
  (0, _invariant.invariant)(
@@ -1,15 +1,15 @@
1
+ import { didYouMean } from '../jsutils/didYouMean.mjs';
1
2
  import { inspect } from '../jsutils/inspect.mjs';
2
3
  import { invariant } from '../jsutils/invariant.mjs';
3
- import { didYouMean } from '../jsutils/didYouMean.mjs';
4
+ import { isIterableObject } from '../jsutils/isIterableObject.mjs';
4
5
  import { isObjectLike } from '../jsutils/isObjectLike.mjs';
5
- import { suggestionList } from '../jsutils/suggestionList.mjs';
6
- import { printPathArray } from '../jsutils/printPathArray.mjs';
7
6
  import { addPath, pathToArray } from '../jsutils/Path.mjs';
8
- import { isIterableObject } from '../jsutils/isIterableObject.mjs';
7
+ import { printPathArray } from '../jsutils/printPathArray.mjs';
8
+ import { suggestionList } from '../jsutils/suggestionList.mjs';
9
9
  import { GraphQLError } from '../error/GraphQLError.mjs';
10
10
  import {
11
- isLeafType,
12
11
  isInputObjectType,
12
+ isLeafType,
13
13
  isListType,
14
14
  isNonNullType,
15
15
  } from '../type/definition.mjs';
@@ -125,7 +125,7 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
125
125
  }
126
126
 
127
127
  return coercedValue;
128
- } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
128
+ }
129
129
 
130
130
  if (isLeafType(type)) {
131
131
  let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(),
@@ -164,7 +164,9 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
164
164
  }
165
165
 
166
166
  return parseResult;
167
- } // istanbul ignore next (Not reachable. All possible input types have been considered)
167
+ }
168
+ /* c8 ignore next 3 */
169
+ // Not reachable, all possible types have been considered.
168
170
 
169
171
  false || invariant(false, 'Unexpected input type: ' + inspect(type));
170
172
  }
@@ -1,7 +1,7 @@
1
1
  import type { DocumentNode } from '../language/ast';
2
2
  import type {
3
- GraphQLSchemaValidationOptions,
4
3
  GraphQLSchemaNormalizedConfig,
4
+ GraphQLSchemaValidationOptions,
5
5
  } from '../type/schema';
6
6
  import { GraphQLSchema } from '../type/schema';
7
7
  interface Options extends GraphQLSchemaValidationOptions {
@@ -6,33 +6,33 @@ Object.defineProperty(exports, '__esModule', {
6
6
  exports.extendSchema = extendSchema;
7
7
  exports.extendSchemaImpl = extendSchemaImpl;
8
8
 
9
- var _keyMap = require('../jsutils/keyMap.js');
9
+ var _devAssert = require('../jsutils/devAssert.js');
10
10
 
11
11
  var _inspect = require('../jsutils/inspect.js');
12
12
 
13
- var _mapValue = require('../jsutils/mapValue.js');
14
-
15
13
  var _invariant = require('../jsutils/invariant.js');
16
14
 
17
- var _devAssert = require('../jsutils/devAssert.js');
15
+ var _keyMap = require('../jsutils/keyMap.js');
16
+
17
+ var _mapValue = require('../jsutils/mapValue.js');
18
18
 
19
19
  var _kinds = require('../language/kinds.js');
20
20
 
21
21
  var _predicates = require('../language/predicates.js');
22
22
 
23
- var _validate = require('../validation/validate.js');
23
+ var _definition = require('../type/definition.js');
24
24
 
25
- var _values = require('../execution/values.js');
25
+ var _directives = require('../type/directives.js');
26
26
 
27
- var _schema = require('../type/schema.js');
27
+ var _introspection = require('../type/introspection.js');
28
28
 
29
29
  var _scalars = require('../type/scalars.js');
30
30
 
31
- var _introspection = require('../type/introspection.js');
31
+ var _schema = require('../type/schema.js');
32
32
 
33
- var _directives = require('../type/directives.js');
33
+ var _validate = require('../validation/validate.js');
34
34
 
35
- var _definition = require('../type/definition.js');
35
+ var _values = require('../execution/values.js');
36
36
 
37
37
  var _valueFromAST = require('./valueFromAST.js');
38
38
 
@@ -229,11 +229,13 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
229
229
 
230
230
  if ((0, _definition.isEnumType)(type)) {
231
231
  return extendEnumType(type);
232
- } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
232
+ }
233
233
 
234
234
  if ((0, _definition.isInputObjectType)(type)) {
235
235
  return extendInputObjectType(type);
236
- } // istanbul ignore next (Not reachable. All possible types have been considered)
236
+ }
237
+ /* c8 ignore next 3 */
238
+ // Not reachable, all possible type definition nodes have been considered.
237
239
 
238
240
  false ||
239
241
  (0, _invariant.invariant)(
@@ -391,8 +393,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
391
393
  for (const node of nodes) {
392
394
  var _node$operationTypes;
393
395
 
394
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
396
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
395
397
  const operationTypesNodes =
398
+ /* c8 ignore next */
396
399
  (_node$operationTypes = node.operationTypes) !== null &&
397
400
  _node$operationTypes !== void 0
398
401
  ? _node$operationTypes
@@ -463,8 +466,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
463
466
  for (const node of nodes) {
464
467
  var _node$fields;
465
468
 
466
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
469
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
467
470
  const nodeFields =
471
+ /* c8 ignore next */
468
472
  (_node$fields = node.fields) !== null && _node$fields !== void 0
469
473
  ? _node$fields
470
474
  : [];
@@ -493,8 +497,10 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
493
497
  }
494
498
 
495
499
  function buildArgumentMap(args) {
496
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
497
- const argsNodes = args !== null && args !== void 0 ? args : [];
500
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
501
+ const argsNodes =
502
+ /* c8 ignore next */
503
+ args !== null && args !== void 0 ? args : [];
498
504
  const argConfigMap = Object.create(null);
499
505
 
500
506
  for (const arg of argsNodes) {
@@ -526,8 +532,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
526
532
  for (const node of nodes) {
527
533
  var _node$fields2;
528
534
 
529
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
535
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
530
536
  const fieldsNodes =
537
+ /* c8 ignore next */
531
538
  (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0
532
539
  ? _node$fields2
533
540
  : [];
@@ -565,8 +572,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
565
572
  for (const node of nodes) {
566
573
  var _node$values;
567
574
 
568
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
575
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
569
576
  const valuesNodes =
577
+ /* c8 ignore next */
570
578
  (_node$values = node.values) !== null && _node$values !== void 0
571
579
  ? _node$values
572
580
  : [];
@@ -595,18 +603,21 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
595
603
  // validation with validateSchema() will produce more actionable results.
596
604
  // @ts-expect-error
597
605
  return nodes.flatMap(
598
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
606
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
599
607
  (node) => {
600
608
  var _node$interfaces$map, _node$interfaces;
601
609
 
602
- return (_node$interfaces$map =
603
- (_node$interfaces = node.interfaces) === null ||
604
- _node$interfaces === void 0
605
- ? void 0
606
- : _node$interfaces.map(getNamedType)) !== null &&
607
- _node$interfaces$map !== void 0
608
- ? _node$interfaces$map
609
- : [];
610
+ return (
611
+ /* c8 ignore next */
612
+ (_node$interfaces$map =
613
+ (_node$interfaces = node.interfaces) === null ||
614
+ _node$interfaces === void 0
615
+ ? void 0
616
+ : _node$interfaces.map(getNamedType)) !== null &&
617
+ _node$interfaces$map !== void 0
618
+ ? _node$interfaces$map
619
+ : []
620
+ );
610
621
  },
611
622
  );
612
623
  }
@@ -617,17 +628,20 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
617
628
  // validation with validateSchema() will produce more actionable results.
618
629
  // @ts-expect-error
619
630
  return nodes.flatMap(
620
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
631
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
621
632
  (node) => {
622
633
  var _node$types$map, _node$types;
623
634
 
624
- return (_node$types$map =
625
- (_node$types = node.types) === null || _node$types === void 0
626
- ? void 0
627
- : _node$types.map(getNamedType)) !== null &&
628
- _node$types$map !== void 0
629
- ? _node$types$map
630
- : [];
635
+ return (
636
+ /* c8 ignore next */
637
+ (_node$types$map =
638
+ (_node$types = node.types) === null || _node$types === void 0
639
+ ? void 0
640
+ : _node$types.map(getNamedType)) !== null &&
641
+ _node$types$map !== void 0
642
+ ? _node$types$map
643
+ : []
644
+ );
631
645
  },
632
646
  );
633
647
  }
@@ -745,13 +759,7 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
745
759
  extensionASTNodes,
746
760
  });
747
761
  }
748
- } // istanbul ignore next (Not reachable. All possible type definition nodes have been considered)
749
-
750
- false ||
751
- (0, _invariant.invariant)(
752
- false,
753
- 'Unexpected type definition node: ' + (0, _inspect.inspect)(astNode),
754
- );
762
+ }
755
763
  }
756
764
  }
757
765
 
@@ -1,47 +1,47 @@
1
- import { keyMap } from '../jsutils/keyMap.mjs';
1
+ import { devAssert } from '../jsutils/devAssert.mjs';
2
2
  import { inspect } from '../jsutils/inspect.mjs';
3
- import { mapValue } from '../jsutils/mapValue.mjs';
4
3
  import { invariant } from '../jsutils/invariant.mjs';
5
- import { devAssert } from '../jsutils/devAssert.mjs';
4
+ import { keyMap } from '../jsutils/keyMap.mjs';
5
+ import { mapValue } from '../jsutils/mapValue.mjs';
6
6
  import { Kind } from '../language/kinds.mjs';
7
7
  import {
8
8
  isTypeDefinitionNode,
9
9
  isTypeExtensionNode,
10
10
  } from '../language/predicates.mjs';
11
- import { assertValidSDLExtension } from '../validation/validate.mjs';
12
- import { getDirectiveValues } from '../execution/values.mjs';
13
- import { assertSchema, GraphQLSchema } from '../type/schema.mjs';
14
- import {
15
- specifiedScalarTypes,
16
- isSpecifiedScalarType,
17
- } from '../type/scalars.mjs';
18
- import {
19
- introspectionTypes,
20
- isIntrospectionType,
21
- } from '../type/introspection.mjs';
22
- import {
23
- GraphQLDirective,
24
- GraphQLDeprecatedDirective,
25
- GraphQLSpecifiedByDirective,
26
- } from '../type/directives.mjs';
27
11
  import {
28
- isScalarType,
29
- isObjectType,
30
- isInterfaceType,
31
- isUnionType,
32
- isListType,
33
- isNonNullType,
34
- isEnumType,
35
- isInputObjectType,
12
+ GraphQLEnumType,
13
+ GraphQLInputObjectType,
14
+ GraphQLInterfaceType,
36
15
  GraphQLList,
37
16
  GraphQLNonNull,
38
- GraphQLScalarType,
39
17
  GraphQLObjectType,
40
- GraphQLInterfaceType,
18
+ GraphQLScalarType,
41
19
  GraphQLUnionType,
42
- GraphQLEnumType,
43
- GraphQLInputObjectType,
20
+ isEnumType,
21
+ isInputObjectType,
22
+ isInterfaceType,
23
+ isListType,
24
+ isNonNullType,
25
+ isObjectType,
26
+ isScalarType,
27
+ isUnionType,
44
28
  } from '../type/definition.mjs';
29
+ import {
30
+ GraphQLDeprecatedDirective,
31
+ GraphQLDirective,
32
+ GraphQLSpecifiedByDirective,
33
+ } from '../type/directives.mjs';
34
+ import {
35
+ introspectionTypes,
36
+ isIntrospectionType,
37
+ } from '../type/introspection.mjs';
38
+ import {
39
+ isSpecifiedScalarType,
40
+ specifiedScalarTypes,
41
+ } from '../type/scalars.mjs';
42
+ import { assertSchema, GraphQLSchema } from '../type/schema.mjs';
43
+ import { assertValidSDLExtension } from '../validation/validate.mjs';
44
+ import { getDirectiveValues } from '../execution/values.mjs';
45
45
  import { valueFromAST } from './valueFromAST.mjs';
46
46
 
47
47
  /**
@@ -234,11 +234,13 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
234
234
 
235
235
  if (isEnumType(type)) {
236
236
  return extendEnumType(type);
237
- } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
237
+ }
238
238
 
239
239
  if (isInputObjectType(type)) {
240
240
  return extendInputObjectType(type);
241
- } // istanbul ignore next (Not reachable. All possible types have been considered)
241
+ }
242
+ /* c8 ignore next 3 */
243
+ // Not reachable, all possible type definition nodes have been considered.
242
244
 
243
245
  false || invariant(false, 'Unexpected type: ' + inspect(type));
244
246
  }
@@ -392,8 +394,9 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
392
394
  for (const node of nodes) {
393
395
  var _node$operationTypes;
394
396
 
395
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
397
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
396
398
  const operationTypesNodes =
399
+ /* c8 ignore next */
397
400
  (_node$operationTypes = node.operationTypes) !== null &&
398
401
  _node$operationTypes !== void 0
399
402
  ? _node$operationTypes
@@ -464,8 +467,9 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
464
467
  for (const node of nodes) {
465
468
  var _node$fields;
466
469
 
467
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
470
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
468
471
  const nodeFields =
472
+ /* c8 ignore next */
469
473
  (_node$fields = node.fields) !== null && _node$fields !== void 0
470
474
  ? _node$fields
471
475
  : [];
@@ -494,8 +498,10 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
494
498
  }
495
499
 
496
500
  function buildArgumentMap(args) {
497
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
498
- const argsNodes = args !== null && args !== void 0 ? args : [];
501
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
502
+ const argsNodes =
503
+ /* c8 ignore next */
504
+ args !== null && args !== void 0 ? args : [];
499
505
  const argConfigMap = Object.create(null);
500
506
 
501
507
  for (const arg of argsNodes) {
@@ -527,8 +533,9 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
527
533
  for (const node of nodes) {
528
534
  var _node$fields2;
529
535
 
530
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
536
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
531
537
  const fieldsNodes =
538
+ /* c8 ignore next */
532
539
  (_node$fields2 = node.fields) !== null && _node$fields2 !== void 0
533
540
  ? _node$fields2
534
541
  : [];
@@ -563,8 +570,9 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
563
570
  for (const node of nodes) {
564
571
  var _node$values;
565
572
 
566
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
573
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
567
574
  const valuesNodes =
575
+ /* c8 ignore next */
568
576
  (_node$values = node.values) !== null && _node$values !== void 0
569
577
  ? _node$values
570
578
  : [];
@@ -593,18 +601,21 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
593
601
  // validation with validateSchema() will produce more actionable results.
594
602
  // @ts-expect-error
595
603
  return nodes.flatMap(
596
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
604
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
597
605
  (node) => {
598
606
  var _node$interfaces$map, _node$interfaces;
599
607
 
600
- return (_node$interfaces$map =
601
- (_node$interfaces = node.interfaces) === null ||
602
- _node$interfaces === void 0
603
- ? void 0
604
- : _node$interfaces.map(getNamedType)) !== null &&
605
- _node$interfaces$map !== void 0
606
- ? _node$interfaces$map
607
- : [];
608
+ return (
609
+ /* c8 ignore next */
610
+ (_node$interfaces$map =
611
+ (_node$interfaces = node.interfaces) === null ||
612
+ _node$interfaces === void 0
613
+ ? void 0
614
+ : _node$interfaces.map(getNamedType)) !== null &&
615
+ _node$interfaces$map !== void 0
616
+ ? _node$interfaces$map
617
+ : []
618
+ );
608
619
  },
609
620
  );
610
621
  }
@@ -615,17 +626,20 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
615
626
  // validation with validateSchema() will produce more actionable results.
616
627
  // @ts-expect-error
617
628
  return nodes.flatMap(
618
- // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
629
+ // FIXME: https://github.com/graphql/graphql-js/issues/2203
619
630
  (node) => {
620
631
  var _node$types$map, _node$types;
621
632
 
622
- return (_node$types$map =
623
- (_node$types = node.types) === null || _node$types === void 0
624
- ? void 0
625
- : _node$types.map(getNamedType)) !== null &&
626
- _node$types$map !== void 0
627
- ? _node$types$map
628
- : [];
633
+ return (
634
+ /* c8 ignore next */
635
+ (_node$types$map =
636
+ (_node$types = node.types) === null || _node$types === void 0
637
+ ? void 0
638
+ : _node$types.map(getNamedType)) !== null &&
639
+ _node$types$map !== void 0
640
+ ? _node$types$map
641
+ : []
642
+ );
629
643
  },
630
644
  );
631
645
  }
@@ -743,10 +757,7 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
743
757
  extensionASTNodes,
744
758
  });
745
759
  }
746
- } // istanbul ignore next (Not reachable. All possible type definition nodes have been considered)
747
-
748
- false ||
749
- invariant(false, 'Unexpected type definition node: ' + inspect(astNode));
760
+ }
750
761
  }
751
762
  }
752
763
  const stdTypeMap = keyMap(
@@ -7,24 +7,22 @@ exports.DangerousChangeType = exports.BreakingChangeType = void 0;
7
7
  exports.findBreakingChanges = findBreakingChanges;
8
8
  exports.findDangerousChanges = findDangerousChanges;
9
9
 
10
- var _keyMap = require('../jsutils/keyMap.js');
11
-
12
10
  var _inspect = require('../jsutils/inspect.js');
13
11
 
14
12
  var _invariant = require('../jsutils/invariant.js');
15
13
 
16
- var _naturalCompare = require('../jsutils/naturalCompare.js');
14
+ var _keyMap = require('../jsutils/keyMap.js');
17
15
 
18
16
  var _printer = require('../language/printer.js');
19
17
 
20
- var _visitor = require('../language/visitor.js');
18
+ var _definition = require('../type/definition.js');
21
19
 
22
20
  var _scalars = require('../type/scalars.js');
23
21
 
24
- var _definition = require('../type/definition.js');
25
-
26
22
  var _astFromValue = require('./astFromValue.js');
27
23
 
24
+ var _sortValueNode = require('./sortValueNode.js');
25
+
28
26
  let BreakingChangeType;
29
27
  exports.BreakingChangeType = BreakingChangeType;
30
28
 
@@ -497,11 +495,13 @@ function typeKindName(type) {
497
495
 
498
496
  if ((0, _definition.isEnumType)(type)) {
499
497
  return 'an Enum type';
500
- } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
498
+ }
501
499
 
502
500
  if ((0, _definition.isInputObjectType)(type)) {
503
501
  return 'an Input type';
504
- } // istanbul ignore next (Not reachable. All possible named types have been considered)
502
+ }
503
+ /* c8 ignore next 3 */
504
+ // Not reachable, all possible types have been considered.
505
505
 
506
506
  false ||
507
507
  (0, _invariant.invariant)(
@@ -513,20 +513,7 @@ function typeKindName(type) {
513
513
  function stringifyValue(value, type) {
514
514
  const ast = (0, _astFromValue.astFromValue)(value, type);
515
515
  ast != null || (0, _invariant.invariant)(false);
516
- const sortedAST = (0, _visitor.visit)(ast, {
517
- ObjectValue(objectNode) {
518
- // Make a copy since sort mutates array
519
- const fields = [...objectNode.fields];
520
- fields.sort((fieldA, fieldB) =>
521
- (0, _naturalCompare.naturalCompare)(
522
- fieldA.name.value,
523
- fieldB.name.value,
524
- ),
525
- );
526
- return { ...objectNode, fields };
527
- },
528
- });
529
- return (0, _printer.print)(sortedAST);
516
+ return (0, _printer.print)((0, _sortValueNode.sortValueNode)(ast));
530
517
  }
531
518
 
532
519
  function diff(oldArray, newArray) {