graphql 14.3.0 → 14.3.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.
Files changed (272) hide show
  1. package/error/GraphQLError.js +12 -10
  2. package/error/GraphQLError.js.flow +7 -1
  3. package/error/GraphQLError.mjs +12 -2
  4. package/error/formatError.js +1 -1
  5. package/error/formatError.mjs +1 -1
  6. package/error/index.js +1 -1
  7. package/error/index.mjs +1 -1
  8. package/error/locatedError.js +1 -1
  9. package/error/locatedError.mjs +1 -1
  10. package/error/printError.js +1 -1
  11. package/error/printError.mjs +1 -1
  12. package/error/syntaxError.js +1 -1
  13. package/error/syntaxError.mjs +1 -1
  14. package/execution/execute.js +32 -26
  15. package/execution/execute.js.flow +6 -3
  16. package/execution/execute.mjs +32 -26
  17. package/execution/index.js +1 -1
  18. package/execution/index.mjs +1 -1
  19. package/execution/values.js +4 -4
  20. package/execution/values.js.flow +4 -3
  21. package/execution/values.mjs +4 -4
  22. package/graphql.js +6 -2
  23. package/graphql.js.flow +2 -1
  24. package/graphql.mjs +3 -2
  25. package/index.js +1 -1
  26. package/index.mjs +1 -1
  27. package/jsutils/ObjMap.js +1 -1
  28. package/jsutils/ObjMap.mjs +1 -0
  29. package/jsutils/PromiseOrValue.js +1 -1
  30. package/jsutils/PromiseOrValue.mjs +1 -0
  31. package/jsutils/dedent.js +1 -1
  32. package/jsutils/dedent.mjs +1 -1
  33. package/jsutils/defineToJSON.js +1 -1
  34. package/jsutils/defineToJSON.mjs +1 -1
  35. package/jsutils/defineToStringTag.js +1 -1
  36. package/jsutils/defineToStringTag.mjs +1 -1
  37. package/jsutils/inspect.js +2 -2
  38. package/jsutils/inspect.js.flow +1 -1
  39. package/jsutils/inspect.mjs +2 -2
  40. package/jsutils/instanceOf.js +1 -1
  41. package/jsutils/instanceOf.mjs +1 -1
  42. package/jsutils/invariant.js +4 -2
  43. package/jsutils/invariant.js.flow +2 -1
  44. package/jsutils/invariant.mjs +4 -2
  45. package/jsutils/isInvalid.js +1 -1
  46. package/jsutils/isInvalid.mjs +1 -1
  47. package/jsutils/isNullish.js +1 -1
  48. package/jsutils/isNullish.mjs +1 -1
  49. package/jsutils/isPromise.js +1 -1
  50. package/jsutils/isPromise.mjs +1 -1
  51. package/jsutils/keyMap.js +3 -2
  52. package/jsutils/keyMap.js.flow +4 -4
  53. package/jsutils/keyMap.mjs +3 -2
  54. package/jsutils/keyValMap.js +3 -2
  55. package/jsutils/keyValMap.js.flow +4 -4
  56. package/jsutils/keyValMap.mjs +3 -2
  57. package/jsutils/mapValue.js +1 -1
  58. package/jsutils/mapValue.mjs +1 -1
  59. package/jsutils/memoize3.js +2 -2
  60. package/jsutils/memoize3.js.flow +1 -1
  61. package/jsutils/memoize3.mjs +2 -2
  62. package/jsutils/nodejsCustomInspectSymbol.js +1 -1
  63. package/jsutils/nodejsCustomInspectSymbol.mjs +1 -1
  64. package/jsutils/orList.js +1 -1
  65. package/jsutils/orList.mjs +1 -1
  66. package/jsutils/promiseForObject.js +1 -1
  67. package/jsutils/promiseForObject.mjs +1 -1
  68. package/jsutils/promiseReduce.js +1 -1
  69. package/jsutils/promiseReduce.mjs +1 -1
  70. package/jsutils/quotedOrList.js +1 -1
  71. package/jsutils/quotedOrList.mjs +1 -1
  72. package/jsutils/suggestionList.js +1 -1
  73. package/jsutils/suggestionList.mjs +1 -1
  74. package/language/ast.js +1 -1
  75. package/language/ast.mjs +1 -0
  76. package/language/blockString.js +1 -1
  77. package/language/blockString.js.flow +1 -1
  78. package/language/blockString.mjs +1 -1
  79. package/language/directiveLocation.js +1 -1
  80. package/language/directiveLocation.mjs +1 -1
  81. package/language/index.js +1 -1
  82. package/language/index.mjs +1 -1
  83. package/language/kinds.js +1 -1
  84. package/language/kinds.mjs +1 -1
  85. package/language/lexer.js +11 -9
  86. package/language/lexer.js.flow +3 -1
  87. package/language/lexer.mjs +11 -9
  88. package/language/location.js +1 -1
  89. package/language/location.mjs +1 -1
  90. package/language/parser.js +2 -2
  91. package/language/parser.js.flow +1 -1
  92. package/language/parser.mjs +2 -2
  93. package/language/predicates.js +1 -1
  94. package/language/predicates.mjs +1 -1
  95. package/language/printer.js +1 -1
  96. package/language/printer.mjs +1 -1
  97. package/language/source.js +1 -1
  98. package/language/source.mjs +1 -1
  99. package/language/visitor.js +1 -1
  100. package/language/visitor.mjs +1 -1
  101. package/package.json +1 -1
  102. package/polyfills/find.js +1 -1
  103. package/polyfills/find.mjs +1 -1
  104. package/polyfills/flatMap.js +1 -1
  105. package/polyfills/flatMap.mjs +1 -1
  106. package/polyfills/isFinite.js +1 -1
  107. package/polyfills/isFinite.mjs +1 -1
  108. package/polyfills/isInteger.js +1 -1
  109. package/polyfills/isInteger.mjs +1 -1
  110. package/polyfills/objectEntries.js +1 -1
  111. package/polyfills/objectEntries.mjs +1 -1
  112. package/polyfills/objectValues.js +1 -1
  113. package/polyfills/objectValues.mjs +1 -1
  114. package/subscription/asyncIteratorReject.js +1 -1
  115. package/subscription/asyncIteratorReject.mjs +1 -1
  116. package/subscription/index.js +1 -1
  117. package/subscription/index.mjs +1 -1
  118. package/subscription/mapAsyncIterator.js +1 -1
  119. package/subscription/mapAsyncIterator.mjs +1 -1
  120. package/subscription/subscribe.js +1 -1
  121. package/subscription/subscribe.mjs +1 -1
  122. package/type/definition.js +8 -14
  123. package/type/definition.js.flow +4 -4
  124. package/type/definition.mjs +8 -14
  125. package/type/directives.js +1 -1
  126. package/type/directives.mjs +1 -1
  127. package/type/index.js +1 -1
  128. package/type/index.mjs +1 -1
  129. package/type/introspection.js +1 -1
  130. package/type/introspection.mjs +1 -1
  131. package/type/scalars.js +1 -1
  132. package/type/scalars.mjs +1 -1
  133. package/type/schema.js +3 -2
  134. package/type/schema.js.flow +4 -4
  135. package/type/schema.mjs +3 -2
  136. package/type/validate.js +1 -1
  137. package/type/validate.mjs +1 -1
  138. package/utilities/TypeInfo.js +92 -72
  139. package/utilities/TypeInfo.js.flow +18 -9
  140. package/utilities/TypeInfo.mjs +92 -72
  141. package/utilities/assertValidName.js +1 -1
  142. package/utilities/assertValidName.mjs +1 -1
  143. package/utilities/astFromValue.js +1 -1
  144. package/utilities/astFromValue.mjs +1 -1
  145. package/utilities/buildASTSchema.js +3 -1
  146. package/utilities/buildASTSchema.mjs +3 -1
  147. package/utilities/buildClientSchema.js +5 -2
  148. package/utilities/buildClientSchema.js.flow +3 -1
  149. package/utilities/buildClientSchema.mjs +5 -2
  150. package/utilities/coerceValue.js +1 -1
  151. package/utilities/coerceValue.mjs +1 -1
  152. package/utilities/concatAST.js +1 -1
  153. package/utilities/concatAST.mjs +1 -1
  154. package/utilities/extendSchema.js +1 -1
  155. package/utilities/extendSchema.mjs +1 -1
  156. package/utilities/findBreakingChanges.js +23 -34
  157. package/utilities/findBreakingChanges.js.flow +40 -34
  158. package/utilities/findBreakingChanges.mjs +49 -34
  159. package/utilities/findDeprecatedUsages.js +1 -1
  160. package/utilities/findDeprecatedUsages.mjs +1 -1
  161. package/utilities/getOperationAST.js +1 -1
  162. package/utilities/getOperationAST.mjs +1 -1
  163. package/utilities/getOperationRootType.js +23 -23
  164. package/utilities/getOperationRootType.js.flow +33 -30
  165. package/utilities/getOperationRootType.mjs +23 -23
  166. package/utilities/index.js +1 -1
  167. package/utilities/index.mjs +1 -1
  168. package/utilities/introspectionFromSchema.js +4 -2
  169. package/utilities/introspectionFromSchema.js.flow +2 -1
  170. package/utilities/introspectionFromSchema.mjs +3 -2
  171. package/utilities/introspectionQuery.js +1 -1
  172. package/utilities/introspectionQuery.mjs +1 -1
  173. package/utilities/isValidJSValue.js +1 -1
  174. package/utilities/isValidJSValue.mjs +1 -1
  175. package/utilities/isValidLiteralValue.js +1 -1
  176. package/utilities/isValidLiteralValue.mjs +1 -1
  177. package/utilities/lexicographicSortSchema.js +1 -1
  178. package/utilities/lexicographicSortSchema.mjs +1 -1
  179. package/utilities/schemaPrinter.js +1 -1
  180. package/utilities/schemaPrinter.mjs +1 -1
  181. package/utilities/separateOperations.js +1 -1
  182. package/utilities/separateOperations.mjs +1 -1
  183. package/utilities/stripIgnoredCharacters.js +7 -7
  184. package/utilities/stripIgnoredCharacters.js.flow +6 -6
  185. package/utilities/stripIgnoredCharacters.mjs +7 -7
  186. package/utilities/typeComparators.js +1 -1
  187. package/utilities/typeComparators.mjs +1 -1
  188. package/utilities/typeFromAST.js +1 -1
  189. package/utilities/typeFromAST.mjs +1 -1
  190. package/utilities/valueFromAST.js +1 -1
  191. package/utilities/valueFromAST.mjs +1 -1
  192. package/utilities/valueFromASTUntyped.js +5 -3
  193. package/utilities/valueFromASTUntyped.js.flow +2 -1
  194. package/utilities/valueFromASTUntyped.mjs +5 -3
  195. package/validation/ValidationContext.js +1 -1
  196. package/validation/ValidationContext.mjs +1 -1
  197. package/validation/index.js +1 -1
  198. package/validation/index.mjs +1 -1
  199. package/validation/rules/ExecutableDefinitions.js +1 -1
  200. package/validation/rules/ExecutableDefinitions.mjs +1 -1
  201. package/validation/rules/FieldsOnCorrectType.js +1 -1
  202. package/validation/rules/FieldsOnCorrectType.mjs +1 -1
  203. package/validation/rules/FragmentsOnCompositeTypes.js +1 -1
  204. package/validation/rules/FragmentsOnCompositeTypes.mjs +1 -1
  205. package/validation/rules/KnownArgumentNames.js +1 -1
  206. package/validation/rules/KnownArgumentNames.mjs +1 -1
  207. package/validation/rules/KnownDirectives.js +5 -3
  208. package/validation/rules/KnownDirectives.js.flow +2 -1
  209. package/validation/rules/KnownDirectives.mjs +5 -3
  210. package/validation/rules/KnownFragmentNames.js +1 -1
  211. package/validation/rules/KnownFragmentNames.mjs +1 -1
  212. package/validation/rules/KnownTypeNames.js +1 -1
  213. package/validation/rules/KnownTypeNames.mjs +1 -1
  214. package/validation/rules/LoneAnonymousOperation.js +1 -1
  215. package/validation/rules/LoneAnonymousOperation.mjs +1 -1
  216. package/validation/rules/LoneSchemaDefinition.js +1 -1
  217. package/validation/rules/LoneSchemaDefinition.mjs +1 -1
  218. package/validation/rules/NoFragmentCycles.js +1 -1
  219. package/validation/rules/NoFragmentCycles.mjs +1 -1
  220. package/validation/rules/NoUndefinedVariables.js +1 -1
  221. package/validation/rules/NoUndefinedVariables.mjs +1 -1
  222. package/validation/rules/NoUnusedFragments.js +1 -1
  223. package/validation/rules/NoUnusedFragments.mjs +1 -1
  224. package/validation/rules/NoUnusedVariables.js +1 -1
  225. package/validation/rules/NoUnusedVariables.mjs +1 -1
  226. package/validation/rules/OverlappingFieldsCanBeMerged.js +21 -16
  227. package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +4 -2
  228. package/validation/rules/OverlappingFieldsCanBeMerged.mjs +21 -16
  229. package/validation/rules/PossibleFragmentSpreads.js +1 -1
  230. package/validation/rules/PossibleFragmentSpreads.mjs +1 -1
  231. package/validation/rules/PossibleTypeExtensions.js +1 -1
  232. package/validation/rules/PossibleTypeExtensions.mjs +1 -1
  233. package/validation/rules/ProvidedRequiredArguments.js +1 -1
  234. package/validation/rules/ProvidedRequiredArguments.mjs +1 -1
  235. package/validation/rules/ScalarLeafs.js +1 -1
  236. package/validation/rules/ScalarLeafs.mjs +1 -1
  237. package/validation/rules/SingleFieldSubscriptions.js +1 -1
  238. package/validation/rules/SingleFieldSubscriptions.mjs +1 -1
  239. package/validation/rules/UniqueArgumentNames.js +1 -1
  240. package/validation/rules/UniqueArgumentNames.mjs +1 -1
  241. package/validation/rules/UniqueDirectiveNames.js +1 -1
  242. package/validation/rules/UniqueDirectiveNames.mjs +1 -1
  243. package/validation/rules/UniqueDirectivesPerLocation.js +2 -1
  244. package/validation/rules/UniqueDirectivesPerLocation.mjs +2 -1
  245. package/validation/rules/UniqueEnumValueNames.js +1 -1
  246. package/validation/rules/UniqueEnumValueNames.mjs +1 -1
  247. package/validation/rules/UniqueFieldDefinitionNames.js +1 -1
  248. package/validation/rules/UniqueFieldDefinitionNames.mjs +1 -1
  249. package/validation/rules/UniqueFragmentNames.js +1 -1
  250. package/validation/rules/UniqueFragmentNames.mjs +1 -1
  251. package/validation/rules/UniqueInputFieldNames.js +1 -1
  252. package/validation/rules/UniqueInputFieldNames.mjs +1 -1
  253. package/validation/rules/UniqueOperationNames.js +1 -1
  254. package/validation/rules/UniqueOperationNames.mjs +1 -1
  255. package/validation/rules/UniqueOperationTypes.js +1 -1
  256. package/validation/rules/UniqueOperationTypes.mjs +1 -1
  257. package/validation/rules/UniqueTypeNames.js +1 -1
  258. package/validation/rules/UniqueTypeNames.mjs +1 -1
  259. package/validation/rules/UniqueVariableNames.js +1 -1
  260. package/validation/rules/UniqueVariableNames.mjs +1 -1
  261. package/validation/rules/ValuesOfCorrectType.js +1 -1
  262. package/validation/rules/ValuesOfCorrectType.mjs +1 -1
  263. package/validation/rules/VariablesAreInputTypes.js +1 -1
  264. package/validation/rules/VariablesAreInputTypes.mjs +1 -1
  265. package/validation/rules/VariablesInAllowedPosition.js +2 -2
  266. package/validation/rules/VariablesInAllowedPosition.js.flow +1 -1
  267. package/validation/rules/VariablesInAllowedPosition.mjs +2 -2
  268. package/validation/specifiedRules.js +1 -1
  269. package/validation/specifiedRules.mjs +1 -1
  270. package/validation/validate.js +1 -1
  271. package/validation/validate.mjs +1 -1
  272. package/codecov.yml +0 -14
@@ -9,14 +9,8 @@ var _printError = require("./printError");
9
9
 
10
10
  var _location = require("../language/location");
11
11
 
12
- /**
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- *
18
- *
19
- */
12
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
13
+
20
14
  function GraphQLError( // eslint-disable-line no-redeclare
21
15
  message, nodes, source, positions, path, originalError, extensions) {
22
16
  // Compute list of blame nodes.
@@ -62,7 +56,15 @@ message, nodes, source, positions, path, originalError, extensions) {
62
56
  }, []);
63
57
  }
64
58
 
65
- var _extensions = extensions || originalError && originalError.extensions;
59
+ var _extensions = extensions;
60
+
61
+ if (_extensions == null && originalError != null) {
62
+ var originalExtensions = originalError.extensions;
63
+
64
+ if (originalExtensions != null && _typeof(originalExtensions) === 'object') {
65
+ _extensions = originalExtensions;
66
+ }
67
+ }
66
68
 
67
69
  Object.defineProperties(this, {
68
70
  message: {
@@ -143,4 +145,4 @@ GraphQLError.prototype = Object.create(Error.prototype, {
143
145
  return (0, _printError.printError)(this);
144
146
  }
145
147
  }
146
- });
148
+ });
@@ -138,7 +138,13 @@ export function GraphQLError( // eslint-disable-line no-redeclare
138
138
  }, []);
139
139
  }
140
140
 
141
- const _extensions = extensions || (originalError && originalError.extensions);
141
+ let _extensions = extensions;
142
+ if (_extensions == null && originalError != null) {
143
+ const originalExtensions = originalError.extensions;
144
+ if (originalExtensions != null && typeof originalExtensions === 'object') {
145
+ _extensions = originalExtensions;
146
+ }
147
+ }
142
148
 
143
149
  Object.defineProperties(this, {
144
150
  message: {
@@ -1,3 +1,5 @@
1
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
+
1
3
  /**
2
4
  * Copyright (c) Facebook, Inc. and its affiliates.
3
5
  *
@@ -60,7 +62,15 @@ message, nodes, source, positions, path, originalError, extensions) {
60
62
  }, []);
61
63
  }
62
64
 
63
- var _extensions = extensions || originalError && originalError.extensions;
65
+ var _extensions = extensions;
66
+
67
+ if (_extensions == null && originalError != null) {
68
+ var originalExtensions = originalError.extensions;
69
+
70
+ if (originalExtensions != null && _typeof(originalExtensions) === 'object') {
71
+ _extensions = originalExtensions;
72
+ }
73
+ }
64
74
 
65
75
  Object.defineProperties(this, {
66
76
  message: {
@@ -140,4 +150,4 @@ GraphQLError.prototype = Object.create(Error.prototype, {
140
150
  return printError(this);
141
151
  }
142
152
  }
143
- });
153
+ });
@@ -38,4 +38,4 @@ function formatError(error) {
38
38
  locations: locations,
39
39
  path: path
40
40
  };
41
- }
41
+ }
@@ -28,4 +28,4 @@ export function formatError(error) {
28
28
  locations: locations,
29
29
  path: path
30
30
  };
31
- }
31
+ }
package/error/index.js CHANGED
@@ -42,4 +42,4 @@ var _locatedError = require("./locatedError");
42
42
 
43
43
  var _printError = require("./printError");
44
44
 
45
- var _formatError = require("./formatError");
45
+ var _formatError = require("./formatError");
package/error/index.mjs CHANGED
@@ -10,4 +10,4 @@ export { GraphQLError } from './GraphQLError';
10
10
  export { syntaxError } from './syntaxError';
11
11
  export { locatedError } from './locatedError';
12
12
  export { printError } from './printError';
13
- export { formatError } from './formatError';
13
+ export { formatError } from './formatError';
@@ -29,4 +29,4 @@ function locatedError(originalError, nodes, path) {
29
29
  }
30
30
 
31
31
  return new _GraphQLError.GraphQLError(originalError && originalError.message, originalError && originalError.nodes || nodes, originalError && originalError.source, originalError && originalError.positions, path, originalError);
32
- }
32
+ }
@@ -21,4 +21,4 @@ export function locatedError(originalError, nodes, path) {
21
21
  }
22
22
 
23
23
  return new GraphQLError(originalError && originalError.message, originalError && originalError.nodes || nodes, originalError && originalError.source, originalError && originalError.positions, path, originalError);
24
- }
24
+ }
@@ -143,4 +143,4 @@ function whitespace(len) {
143
143
 
144
144
  function lpad(len, str) {
145
145
  return whitespace(len - str.length) + str;
146
- }
146
+ }
@@ -134,4 +134,4 @@ function whitespace(len) {
134
134
 
135
135
  function lpad(len, str) {
136
136
  return whitespace(len - str.length) + str;
137
- }
137
+ }
@@ -22,4 +22,4 @@ var _GraphQLError = require("./GraphQLError");
22
22
  */
23
23
  function syntaxError(source, position, description) {
24
24
  return new _GraphQLError.GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]);
25
- }
25
+ }
@@ -14,4 +14,4 @@ import { GraphQLError } from './GraphQLError';
14
14
 
15
15
  export function syntaxError(source, position, description) {
16
16
  return new GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]);
17
- }
17
+ }
@@ -328,43 +328,49 @@ function collectFields(exeContext, runtimeType, selectionSet, fields, visitedFra
328
328
 
329
329
  switch (selection.kind) {
330
330
  case _kinds.Kind.FIELD:
331
- if (!shouldIncludeNode(exeContext, selection)) {
332
- continue;
333
- }
331
+ {
332
+ if (!shouldIncludeNode(exeContext, selection)) {
333
+ continue;
334
+ }
334
335
 
335
- var name = getFieldEntryKey(selection);
336
+ var name = getFieldEntryKey(selection);
336
337
 
337
- if (!fields[name]) {
338
- fields[name] = [];
339
- }
338
+ if (!fields[name]) {
339
+ fields[name] = [];
340
+ }
340
341
 
341
- fields[name].push(selection);
342
- break;
342
+ fields[name].push(selection);
343
+ break;
344
+ }
343
345
 
344
346
  case _kinds.Kind.INLINE_FRAGMENT:
345
- if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {
346
- continue;
347
- }
347
+ {
348
+ if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {
349
+ continue;
350
+ }
348
351
 
349
- collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames);
350
- break;
352
+ collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames);
353
+ break;
354
+ }
351
355
 
352
356
  case _kinds.Kind.FRAGMENT_SPREAD:
353
- var fragName = selection.name.value;
357
+ {
358
+ var fragName = selection.name.value;
354
359
 
355
- if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) {
356
- continue;
357
- }
360
+ if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) {
361
+ continue;
362
+ }
358
363
 
359
- visitedFragmentNames[fragName] = true;
360
- var fragment = exeContext.fragments[fragName];
364
+ visitedFragmentNames[fragName] = true;
365
+ var fragment = exeContext.fragments[fragName];
361
366
 
362
- if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) {
363
- continue;
364
- }
367
+ if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) {
368
+ continue;
369
+ }
365
370
 
366
- collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames);
367
- break;
371
+ collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames);
372
+ break;
373
+ }
368
374
  }
369
375
  }
370
376
 
@@ -837,4 +843,4 @@ function getFieldDef(schema, parentType, fieldName) {
837
843
  }
838
844
 
839
845
  return parentType.getFields()[fieldName];
840
- }
846
+ }
@@ -528,7 +528,7 @@ export function collectFields(
528
528
  for (let i = 0; i < selectionSet.selections.length; i++) {
529
529
  const selection = selectionSet.selections[i];
530
530
  switch (selection.kind) {
531
- case Kind.FIELD:
531
+ case Kind.FIELD: {
532
532
  if (!shouldIncludeNode(exeContext, selection)) {
533
533
  continue;
534
534
  }
@@ -538,7 +538,8 @@ export function collectFields(
538
538
  }
539
539
  fields[name].push(selection);
540
540
  break;
541
- case Kind.INLINE_FRAGMENT:
541
+ }
542
+ case Kind.INLINE_FRAGMENT: {
542
543
  if (
543
544
  !shouldIncludeNode(exeContext, selection) ||
544
545
  !doesFragmentConditionMatch(exeContext, selection, runtimeType)
@@ -553,7 +554,8 @@ export function collectFields(
553
554
  visitedFragmentNames,
554
555
  );
555
556
  break;
556
- case Kind.FRAGMENT_SPREAD:
557
+ }
558
+ case Kind.FRAGMENT_SPREAD: {
557
559
  const fragName = selection.name.value;
558
560
  if (
559
561
  visitedFragmentNames[fragName] ||
@@ -577,6 +579,7 @@ export function collectFields(
577
579
  visitedFragmentNames,
578
580
  );
579
581
  break;
582
+ }
580
583
  }
581
584
  }
582
585
  return fields;
@@ -295,43 +295,49 @@ export function collectFields(exeContext, runtimeType, selectionSet, fields, vis
295
295
 
296
296
  switch (selection.kind) {
297
297
  case Kind.FIELD:
298
- if (!shouldIncludeNode(exeContext, selection)) {
299
- continue;
300
- }
298
+ {
299
+ if (!shouldIncludeNode(exeContext, selection)) {
300
+ continue;
301
+ }
301
302
 
302
- var name = getFieldEntryKey(selection);
303
+ var name = getFieldEntryKey(selection);
303
304
 
304
- if (!fields[name]) {
305
- fields[name] = [];
306
- }
305
+ if (!fields[name]) {
306
+ fields[name] = [];
307
+ }
307
308
 
308
- fields[name].push(selection);
309
- break;
309
+ fields[name].push(selection);
310
+ break;
311
+ }
310
312
 
311
313
  case Kind.INLINE_FRAGMENT:
312
- if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {
313
- continue;
314
- }
314
+ {
315
+ if (!shouldIncludeNode(exeContext, selection) || !doesFragmentConditionMatch(exeContext, selection, runtimeType)) {
316
+ continue;
317
+ }
315
318
 
316
- collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames);
317
- break;
319
+ collectFields(exeContext, runtimeType, selection.selectionSet, fields, visitedFragmentNames);
320
+ break;
321
+ }
318
322
 
319
323
  case Kind.FRAGMENT_SPREAD:
320
- var fragName = selection.name.value;
324
+ {
325
+ var fragName = selection.name.value;
321
326
 
322
- if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) {
323
- continue;
324
- }
327
+ if (visitedFragmentNames[fragName] || !shouldIncludeNode(exeContext, selection)) {
328
+ continue;
329
+ }
325
330
 
326
- visitedFragmentNames[fragName] = true;
327
- var fragment = exeContext.fragments[fragName];
331
+ visitedFragmentNames[fragName] = true;
332
+ var fragment = exeContext.fragments[fragName];
328
333
 
329
- if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) {
330
- continue;
331
- }
334
+ if (!fragment || !doesFragmentConditionMatch(exeContext, fragment, runtimeType)) {
335
+ continue;
336
+ }
332
337
 
333
- collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames);
334
- break;
338
+ collectFields(exeContext, runtimeType, fragment.selectionSet, fields, visitedFragmentNames);
339
+ break;
340
+ }
335
341
  }
336
342
  }
337
343
 
@@ -795,4 +801,4 @@ export function getFieldDef(schema, parentType, fieldName) {
795
801
  }
796
802
 
797
803
  return parentType.getFields()[fieldName];
798
- }
804
+ }
@@ -36,4 +36,4 @@ Object.defineProperty(exports, "getDirectiveValues", {
36
36
 
37
37
  var _execute = require("./execute");
38
38
 
39
- var _values = require("./values");
39
+ var _values = require("./values");
@@ -7,4 +7,4 @@
7
7
  *
8
8
  */
9
9
  export { execute, defaultFieldResolver, defaultTypeResolver, responsePathAsArray } from './execute';
10
- export { getDirectiveValues } from './values';
10
+ export { getDirectiveValues } from './values';
@@ -160,11 +160,11 @@ function getArgumentValues(def, node, variableValues) {
160
160
 
161
161
  if (argumentNode && argumentNode.value.kind === _kinds.Kind.VARIABLE) {
162
162
  var variableName = argumentNode.value.name.value;
163
- hasValue = variableValues && hasOwnProperty(variableValues, variableName);
164
- isNull = variableValues && variableValues[variableName] === null;
163
+ hasValue = variableValues != null && hasOwnProperty(variableValues, variableName);
164
+ isNull = variableValues != null && variableValues[variableName] === null;
165
165
  } else {
166
166
  hasValue = argumentNode != null;
167
- isNull = argumentNode && argumentNode.value.kind === _kinds.Kind.NULL;
167
+ isNull = argumentNode != null && argumentNode.value.kind === _kinds.Kind.NULL;
168
168
  }
169
169
 
170
170
  if (!hasValue && argDef.defaultValue !== undefined) {
@@ -237,4 +237,4 @@ function getDirectiveValues(directiveDef, node, variableValues) {
237
237
 
238
238
  function hasOwnProperty(obj, prop) {
239
239
  return Object.prototype.hasOwnProperty.call(obj, prop);
240
- }
240
+ }
@@ -146,11 +146,12 @@ export function getArgumentValues(
146
146
  let isNull;
147
147
  if (argumentNode && argumentNode.value.kind === Kind.VARIABLE) {
148
148
  const variableName = argumentNode.value.name.value;
149
- hasValue = variableValues && hasOwnProperty(variableValues, variableName);
150
- isNull = variableValues && variableValues[variableName] === null;
149
+ hasValue =
150
+ variableValues != null && hasOwnProperty(variableValues, variableName);
151
+ isNull = variableValues != null && variableValues[variableName] === null;
151
152
  } else {
152
153
  hasValue = argumentNode != null;
153
- isNull = argumentNode && argumentNode.value.kind === Kind.NULL;
154
+ isNull = argumentNode != null && argumentNode.value.kind === Kind.NULL;
154
155
  }
155
156
 
156
157
  if (!hasValue && argDef.defaultValue !== undefined) {
@@ -137,11 +137,11 @@ export function getArgumentValues(def, node, variableValues) {
137
137
 
138
138
  if (argumentNode && argumentNode.value.kind === Kind.VARIABLE) {
139
139
  var variableName = argumentNode.value.name.value;
140
- hasValue = variableValues && hasOwnProperty(variableValues, variableName);
141
- isNull = variableValues && variableValues[variableName] === null;
140
+ hasValue = variableValues != null && hasOwnProperty(variableValues, variableName);
141
+ isNull = variableValues != null && variableValues[variableName] === null;
142
142
  } else {
143
143
  hasValue = argumentNode != null;
144
- isNull = argumentNode && argumentNode.value.kind === Kind.NULL;
144
+ isNull = argumentNode != null && argumentNode.value.kind === Kind.NULL;
145
145
  }
146
146
 
147
147
  if (!hasValue && argDef.defaultValue !== undefined) {
@@ -213,4 +213,4 @@ export function getDirectiveValues(directiveDef, node, variableValues) {
213
213
 
214
214
  function hasOwnProperty(obj, prop) {
215
215
  return Object.prototype.hasOwnProperty.call(obj, prop);
216
- }
216
+ }
package/graphql.js CHANGED
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.graphql = graphql;
7
7
  exports.graphqlSync = graphqlSync;
8
8
 
9
+ var _isPromise = _interopRequireDefault(require("./jsutils/isPromise"));
10
+
9
11
  var _validate = require("./type/validate");
10
12
 
11
13
  var _parser = require("./language/parser");
@@ -14,6 +16,8 @@ var _validate2 = require("./validation/validate");
14
16
 
15
17
  var _execute = require("./execution/execute");
16
18
 
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
17
21
  /**
18
22
  * Copyright (c) Facebook, Inc. and its affiliates.
19
23
  *
@@ -45,7 +49,7 @@ function graphqlSync(argsOrSchema, source, rootValue, contextValue, variableValu
45
49
  // Extract arguments from object args if provided.
46
50
  var result = arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver, argsOrSchema.typeResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Assert that the execution was synchronous.
47
51
 
48
- if (result.then) {
52
+ if ((0, _isPromise.default)(result)) {
49
53
  throw new Error('GraphQL execution failed to complete synchronously.');
50
54
  }
51
55
 
@@ -84,4 +88,4 @@ function graphqlImpl(schema, source, rootValue, contextValue, variableValues, op
84
88
 
85
89
 
86
90
  return (0, _execute.execute)(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver);
87
- }
91
+ }
package/graphql.js.flow CHANGED
@@ -7,6 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
+ import isPromise from './jsutils/isPromise';
10
11
  import { validateSchema } from './type/validate';
11
12
  import { parse } from './language/parser';
12
13
  import { validate } from './validation/validate';
@@ -175,7 +176,7 @@ export function graphqlSync(
175
176
  );
176
177
 
177
178
  // Assert that the execution was synchronous.
178
- if (result.then) {
179
+ if (isPromise(result)) {
179
180
  throw new Error('GraphQL execution failed to complete synchronously.');
180
181
  }
181
182
 
package/graphql.mjs CHANGED
@@ -6,6 +6,7 @@
6
6
  *
7
7
  *
8
8
  */
9
+ import isPromise from './jsutils/isPromise';
9
10
  import { validateSchema } from './type/validate';
10
11
  import { parse } from './language/parser';
11
12
  import { validate } from './validation/validate';
@@ -32,7 +33,7 @@ export function graphqlSync(argsOrSchema, source, rootValue, contextValue, varia
32
33
  // Extract arguments from object args if provided.
33
34
  var result = arguments.length === 1 ? graphqlImpl(argsOrSchema.schema, argsOrSchema.source, argsOrSchema.rootValue, argsOrSchema.contextValue, argsOrSchema.variableValues, argsOrSchema.operationName, argsOrSchema.fieldResolver, argsOrSchema.typeResolver) : graphqlImpl(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver); // Assert that the execution was synchronous.
34
35
 
35
- if (result.then) {
36
+ if (isPromise(result)) {
36
37
  throw new Error('GraphQL execution failed to complete synchronously.');
37
38
  }
38
39
 
@@ -71,4 +72,4 @@ function graphqlImpl(schema, source, rootValue, contextValue, variableValues, op
71
72
 
72
73
 
73
74
  return execute(schema, document, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver);
74
- }
75
+ }
package/index.js CHANGED
@@ -1110,4 +1110,4 @@ var _validation = require("./validation");
1110
1110
 
1111
1111
  var _error = require("./error");
1112
1112
 
1113
- var _utilities = require("./utilities");
1113
+ var _utilities = require("./utilities");
package/index.mjs CHANGED
@@ -98,4 +98,4 @@ isEqualType, isTypeSubTypeOf, doTypesOverlap, // Asserts a string is a valid Gra
98
98
  assertValidName, // Determine if a string is a valid GraphQL name.
99
99
  isValidNameError, // Compares two GraphQLSchemas and detects breaking changes.
100
100
  BreakingChangeType, DangerousChangeType, findBreakingChanges, findDangerousChanges, // Report all deprecated usage within a GraphQL document.
101
- findDeprecatedUsages } from './utilities';
101
+ findDeprecatedUsages } from './utilities';
package/jsutils/ObjMap.js CHANGED
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";
@@ -0,0 +1 @@
1
+
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";
@@ -0,0 +1 @@
1
+
package/jsutils/dedent.js CHANGED
@@ -63,4 +63,4 @@ function dedent(strings) {
63
63
  return next;
64
64
  }, '');
65
65
  return fixIndent(str);
66
- }
66
+ }
@@ -53,4 +53,4 @@ export default function dedent(strings) {
53
53
  return next;
54
54
  }, '');
55
55
  return fixIndent(str);
56
- }
56
+ }
@@ -31,4 +31,4 @@ classObject) {
31
31
  if (_nodejsCustomInspectSymbol.default) {
32
32
  classObject.prototype[_nodejsCustomInspectSymbol.default] = fn;
33
33
  }
34
- }
34
+ }
@@ -21,4 +21,4 @@ classObject) {
21
21
  if (nodejsCustomInspectSymbol) {
22
22
  classObject.prototype[nodejsCustomInspectSymbol] = fn;
23
23
  }
24
- }
24
+ }
@@ -35,4 +35,4 @@ function defineToStringTag(classObject) {
35
35
  }
36
36
  });
37
37
  }
38
- }
38
+ }
@@ -28,4 +28,4 @@ export default function defineToStringTag(classObject) {
28
28
  }
29
29
  });
30
30
  }
31
- }
31
+ }
@@ -47,7 +47,7 @@ function formatObjectValue(value, previouslySeenValues) {
47
47
  if (value) {
48
48
  var customInspectFn = getCustomFn(value);
49
49
 
50
- if (customInspectFn) {
50
+ if (customInspectFn !== undefined) {
51
51
  // $FlowFixMe(>=0.90.0)
52
52
  var customValue = customInspectFn.call(value); // check for infinite recursion
53
53
 
@@ -132,4 +132,4 @@ function getObjectTag(object) {
132
132
  }
133
133
 
134
134
  return tag;
135
- }
135
+ }
@@ -41,7 +41,7 @@ function formatObjectValue(value, previouslySeenValues) {
41
41
  if (value) {
42
42
  const customInspectFn = getCustomFn(value);
43
43
 
44
- if (customInspectFn) {
44
+ if (customInspectFn !== undefined) {
45
45
  // $FlowFixMe(>=0.90.0)
46
46
  const customValue = customInspectFn.call(value);
47
47
 
@@ -45,7 +45,7 @@ function formatObjectValue(value, previouslySeenValues) {
45
45
  if (value) {
46
46
  var customInspectFn = getCustomFn(value);
47
47
 
48
- if (customInspectFn) {
48
+ if (customInspectFn !== undefined) {
49
49
  // $FlowFixMe(>=0.90.0)
50
50
  var customValue = customInspectFn.call(value); // check for infinite recursion
51
51
 
@@ -130,4 +130,4 @@ function getObjectTag(object) {
130
130
  }
131
131
 
132
132
  return tag;
133
- }
133
+ }
@@ -41,4 +41,4 @@ function instanceOf(value, constructor) {
41
41
  return false;
42
42
  };
43
43
 
44
- exports.default = _default;
44
+ exports.default = _default;
@@ -32,4 +32,4 @@ function instanceOf(value, constructor) {
32
32
  }
33
33
 
34
34
  return false;
35
- };
35
+ };
@@ -14,8 +14,10 @@ exports.default = invariant;
14
14
  *
15
15
  */
16
16
  function invariant(condition, message) {
17
+ var booleanCondition = Boolean(condition);
17
18
  /* istanbul ignore else */
18
- if (!condition) {
19
+
20
+ if (!booleanCondition) {
19
21
  throw new Error(message);
20
22
  }
21
- }
23
+ }