graphql 15.1.0 → 15.4.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 (343) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +10 -12
  3. package/error/GraphQLError.js +5 -5
  4. package/error/GraphQLError.js.flow +5 -5
  5. package/error/GraphQLError.mjs +1 -1
  6. package/error/formatError.js +1 -1
  7. package/error/formatError.js.flow +2 -3
  8. package/error/index.js +4 -4
  9. package/error/index.js.flow +0 -1
  10. package/error/locatedError.d.ts +2 -2
  11. package/error/locatedError.js +10 -5
  12. package/error/locatedError.js.flow +11 -5
  13. package/error/locatedError.mjs +6 -4
  14. package/error/syntaxError.js +1 -1
  15. package/error/syntaxError.js.flow +1 -2
  16. package/execution/execute.d.ts +24 -16
  17. package/execution/execute.js +123 -105
  18. package/execution/execute.js.flow +169 -153
  19. package/execution/execute.mjs +101 -82
  20. package/execution/index.d.ts +2 -0
  21. package/execution/index.js +9 -3
  22. package/execution/index.js.flow +12 -3
  23. package/execution/index.mjs +1 -1
  24. package/execution/values.js +11 -11
  25. package/execution/values.js.flow +10 -14
  26. package/graphql.js +5 -5
  27. package/graphql.js.flow +9 -9
  28. package/index.d.ts +19 -1
  29. package/index.js +27 -9
  30. package/index.js.flow +10 -3
  31. package/index.mjs +4 -3
  32. package/jsutils/ObjMap.js.flow +0 -1
  33. package/jsutils/Path.d.ts +6 -1
  34. package/jsutils/Path.js +3 -2
  35. package/jsutils/Path.js.flow +3 -2
  36. package/jsutils/Path.mjs +3 -2
  37. package/jsutils/PromiseOrValue.js.flow +0 -1
  38. package/jsutils/defineInspect.js +2 -2
  39. package/jsutils/defineInspect.js.flow +0 -1
  40. package/jsutils/devAssert.js.flow +0 -1
  41. package/jsutils/didYouMean.js.flow +0 -1
  42. package/jsutils/identityFunc.js.flow +0 -1
  43. package/jsutils/inspect.js +1 -2
  44. package/jsutils/inspect.js.flow +10 -8
  45. package/jsutils/inspect.mjs +1 -1
  46. package/jsutils/instanceOf.js.flow +2 -3
  47. package/jsutils/invariant.js.flow +0 -1
  48. package/jsutils/isAsyncIterable.js +19 -0
  49. package/jsutils/isAsyncIterable.js.flow +18 -0
  50. package/jsutils/isAsyncIterable.mjs +16 -0
  51. package/jsutils/isCollection.js +1 -1
  52. package/jsutils/isCollection.js.flow +0 -1
  53. package/jsutils/isObjectLike.js.flow +0 -1
  54. package/jsutils/isPromise.js.flow +0 -1
  55. package/jsutils/keyMap.js.flow +1 -2
  56. package/jsutils/keyValMap.js.flow +1 -2
  57. package/jsutils/mapValue.js +1 -1
  58. package/jsutils/mapValue.js.flow +1 -2
  59. package/jsutils/memoize3.js +2 -5
  60. package/jsutils/memoize3.js.flow +2 -5
  61. package/jsutils/memoize3.mjs +2 -5
  62. package/jsutils/nodejsCustomInspectSymbol.js.flow +0 -1
  63. package/jsutils/printPathArray.js.flow +0 -1
  64. package/jsutils/promiseForObject.js.flow +1 -2
  65. package/jsutils/promiseReduce.js +1 -1
  66. package/jsutils/promiseReduce.js.flow +1 -1
  67. package/jsutils/promiseReduce.mjs +1 -1
  68. package/jsutils/suggestionList.js.flow +1 -2
  69. package/jsutils/toObjMap.js +1 -1
  70. package/jsutils/toObjMap.js.flow +5 -6
  71. package/language/ast.js +1 -1
  72. package/language/ast.js.flow +2 -3
  73. package/language/blockString.d.ts +1 -1
  74. package/language/blockString.js +53 -32
  75. package/language/blockString.js.flow +49 -34
  76. package/language/blockString.mjs +54 -33
  77. package/language/directiveLocation.js.flow +0 -1
  78. package/language/experimentalOnlineParser/grammar.d.ts +1006 -0
  79. package/language/experimentalOnlineParser/grammar.js +987 -0
  80. package/language/experimentalOnlineParser/grammar.js.flow +1000 -0
  81. package/language/experimentalOnlineParser/grammar.mjs +980 -0
  82. package/language/experimentalOnlineParser/index.d.ts +6 -0
  83. package/language/experimentalOnlineParser/index.js +31 -0
  84. package/language/experimentalOnlineParser/index.js.flow +7 -0
  85. package/language/experimentalOnlineParser/index.mjs +1 -0
  86. package/language/experimentalOnlineParser/onlineParser.d.ts +125 -0
  87. package/language/experimentalOnlineParser/onlineParser.js +604 -0
  88. package/language/experimentalOnlineParser/onlineParser.js.flow +723 -0
  89. package/language/experimentalOnlineParser/onlineParser.mjs +587 -0
  90. package/language/index.js +12 -12
  91. package/language/index.js.flow +0 -1
  92. package/language/kinds.js.flow +0 -1
  93. package/language/lexer.js +242 -183
  94. package/language/lexer.js.flow +191 -186
  95. package/language/lexer.mjs +239 -180
  96. package/language/location.js.flow +1 -2
  97. package/language/parser.js +73 -68
  98. package/language/parser.js.flow +112 -106
  99. package/language/parser.mjs +66 -62
  100. package/language/predicates.js +1 -1
  101. package/language/predicates.js.flow +1 -2
  102. package/language/printLocation.js +1 -1
  103. package/language/printLocation.js.flow +4 -4
  104. package/language/printer.js +20 -13
  105. package/language/printer.js.flow +27 -25
  106. package/language/printer.mjs +18 -11
  107. package/language/source.d.ts +12 -6
  108. package/language/source.js +25 -9
  109. package/language/source.js.flow +25 -8
  110. package/language/source.mjs +19 -7
  111. package/language/tokenKind.js.flow +0 -1
  112. package/language/visitor.d.ts +3 -3
  113. package/language/visitor.js +5 -5
  114. package/language/visitor.js.flow +5 -5
  115. package/language/visitor.mjs +3 -3
  116. package/package.json +1 -1
  117. package/polyfills/arrayFrom.js +2 -2
  118. package/polyfills/arrayFrom.js.flow +1 -2
  119. package/polyfills/arrayFrom.mjs +1 -1
  120. package/polyfills/find.js +1 -1
  121. package/polyfills/find.js.flow +1 -2
  122. package/polyfills/find.mjs +1 -1
  123. package/polyfills/isFinite.js +1 -1
  124. package/polyfills/isFinite.js.flow +1 -2
  125. package/polyfills/isFinite.mjs +1 -1
  126. package/polyfills/isInteger.js +1 -1
  127. package/polyfills/isInteger.js.flow +1 -2
  128. package/polyfills/isInteger.mjs +1 -1
  129. package/polyfills/objectEntries.js +1 -1
  130. package/polyfills/objectEntries.js.flow +2 -3
  131. package/polyfills/objectEntries.mjs +1 -1
  132. package/polyfills/objectValues.js +1 -1
  133. package/polyfills/objectValues.js.flow +2 -3
  134. package/polyfills/objectValues.mjs +1 -1
  135. package/polyfills/symbols.js +3 -5
  136. package/polyfills/symbols.js.flow +9 -6
  137. package/polyfills/symbols.mjs +3 -5
  138. package/subscription/index.js +1 -1
  139. package/subscription/index.js.flow +0 -1
  140. package/subscription/mapAsyncIterator.js +2 -2
  141. package/subscription/mapAsyncIterator.js.flow +9 -10
  142. package/subscription/mapAsyncIterator.mjs +1 -1
  143. package/subscription/subscribe.js +61 -73
  144. package/subscription/subscribe.js.flow +74 -88
  145. package/subscription/subscribe.mjs +53 -65
  146. package/type/definition.d.ts +181 -31
  147. package/type/definition.js +37 -32
  148. package/type/definition.js.flow +66 -51
  149. package/type/definition.mjs +20 -18
  150. package/type/directives.d.ts +17 -3
  151. package/type/directives.js +17 -16
  152. package/type/directives.js.flow +20 -21
  153. package/type/directives.mjs +6 -5
  154. package/type/index.d.ts +12 -0
  155. package/type/index.js +6 -6
  156. package/type/index.js.flow +0 -1
  157. package/type/introspection.js +86 -68
  158. package/type/introspection.js.flow +85 -54
  159. package/type/introspection.mjs +79 -61
  160. package/type/scalars.js +9 -9
  161. package/type/scalars.js.flow +3 -3
  162. package/type/scalars.mjs +1 -1
  163. package/type/schema.d.ts +17 -4
  164. package/type/schema.js +13 -13
  165. package/type/schema.js.flow +18 -16
  166. package/type/schema.mjs +1 -1
  167. package/type/validate.js +52 -19
  168. package/type/validate.js.flow +67 -18
  169. package/type/validate.mjs +44 -10
  170. package/utilities/TypeInfo.js +7 -7
  171. package/utilities/TypeInfo.js.flow +16 -18
  172. package/utilities/TypeInfo.mjs +1 -1
  173. package/utilities/assertValidName.js +2 -2
  174. package/utilities/assertValidName.js.flow +0 -1
  175. package/utilities/astFromValue.js +10 -10
  176. package/utilities/astFromValue.js.flow +2 -3
  177. package/utilities/buildASTSchema.js +17 -27
  178. package/utilities/buildASTSchema.js.flow +11 -28
  179. package/utilities/buildASTSchema.mjs +11 -21
  180. package/utilities/buildClientSchema.js +14 -14
  181. package/utilities/buildClientSchema.js.flow +41 -29
  182. package/utilities/buildClientSchema.mjs +5 -5
  183. package/utilities/coerceInputValue.js +14 -14
  184. package/utilities/coerceInputValue.js.flow +7 -6
  185. package/utilities/coerceInputValue.mjs +2 -2
  186. package/utilities/concatAST.js +9 -8
  187. package/utilities/concatAST.js.flow +9 -9
  188. package/utilities/concatAST.mjs +9 -6
  189. package/utilities/extendSchema.js +26 -19
  190. package/utilities/extendSchema.js.flow +58 -45
  191. package/utilities/extendSchema.mjs +9 -2
  192. package/utilities/findBreakingChanges.js +9 -9
  193. package/utilities/findBreakingChanges.js.flow +12 -11
  194. package/utilities/findDeprecatedUsages.d.ts +9 -1
  195. package/utilities/findDeprecatedUsages.js +11 -27
  196. package/utilities/findDeprecatedUsages.js.flow +15 -44
  197. package/utilities/findDeprecatedUsages.mjs +11 -25
  198. package/utilities/getIntrospectionQuery.js.flow +2 -3
  199. package/utilities/getOperationAST.js +1 -1
  200. package/utilities/getOperationAST.js.flow +1 -5
  201. package/utilities/getOperationAST.mjs +1 -1
  202. package/utilities/getOperationRootType.js +1 -1
  203. package/utilities/getOperationRootType.js.flow +5 -6
  204. package/utilities/index.d.ts +4 -1
  205. package/utilities/index.js +22 -22
  206. package/utilities/index.js.flow +1 -2
  207. package/utilities/index.mjs +1 -1
  208. package/utilities/introspectionFromSchema.js +6 -8
  209. package/utilities/introspectionFromSchema.js.flow +10 -10
  210. package/utilities/introspectionFromSchema.mjs +3 -4
  211. package/utilities/lexicographicSortSchema.js +10 -8
  212. package/utilities/lexicographicSortSchema.js.flow +19 -12
  213. package/utilities/lexicographicSortSchema.mjs +3 -1
  214. package/utilities/printSchema.js +15 -16
  215. package/utilities/printSchema.js.flow +34 -25
  216. package/utilities/printSchema.mjs +6 -7
  217. package/utilities/separateOperations.js +2 -2
  218. package/utilities/separateOperations.js.flow +2 -6
  219. package/utilities/separateOperations.mjs +1 -1
  220. package/utilities/stripIgnoredCharacters.js +6 -16
  221. package/utilities/stripIgnoredCharacters.js.flow +4 -13
  222. package/utilities/stripIgnoredCharacters.mjs +3 -10
  223. package/utilities/typeComparators.js +1 -1
  224. package/utilities/typeComparators.js.flow +2 -4
  225. package/utilities/typeFromAST.js +6 -6
  226. package/utilities/typeFromAST.js.flow +11 -14
  227. package/utilities/typeFromAST.mjs +2 -2
  228. package/utilities/typedQueryDocumentNode.d.ts +20 -0
  229. package/utilities/valueFromAST.js +6 -6
  230. package/utilities/valueFromAST.js.flow +7 -5
  231. package/utilities/valueFromASTUntyped.js +4 -4
  232. package/utilities/valueFromASTUntyped.js.flow +2 -3
  233. package/validation/ValidationContext.d.ts +3 -0
  234. package/validation/ValidationContext.js +7 -3
  235. package/validation/ValidationContext.js.flow +28 -22
  236. package/validation/ValidationContext.mjs +4 -0
  237. package/validation/index.d.ts +4 -0
  238. package/validation/index.js +52 -36
  239. package/validation/index.js.flow +4 -1
  240. package/validation/index.mjs +4 -1
  241. package/validation/rules/ExecutableDefinitions.js +1 -1
  242. package/validation/rules/ExecutableDefinitions.js.flow +0 -1
  243. package/validation/rules/ExecutableDefinitionsRule.js +3 -3
  244. package/validation/rules/ExecutableDefinitionsRule.js.flow +2 -3
  245. package/validation/rules/FieldsOnCorrectTypeRule.js +5 -5
  246. package/validation/rules/FieldsOnCorrectTypeRule.js.flow +9 -8
  247. package/validation/rules/FragmentsOnCompositeTypesRule.js +4 -4
  248. package/validation/rules/FragmentsOnCompositeTypesRule.js.flow +2 -3
  249. package/validation/rules/KnownArgumentNamesRule.js +5 -5
  250. package/validation/rules/KnownArgumentNamesRule.js.flow +5 -5
  251. package/validation/rules/KnownDirectivesRule.js +6 -6
  252. package/validation/rules/KnownDirectivesRule.js.flow +10 -11
  253. package/validation/rules/KnownFragmentNamesRule.js +1 -1
  254. package/validation/rules/KnownFragmentNamesRule.js.flow +3 -3
  255. package/validation/rules/KnownTypeNamesRule.js +12 -10
  256. package/validation/rules/KnownTypeNamesRule.js.flow +14 -11
  257. package/validation/rules/KnownTypeNamesRule.mjs +6 -5
  258. package/validation/rules/LoneAnonymousOperationRule.js +2 -2
  259. package/validation/rules/LoneAnonymousOperationRule.js.flow +2 -3
  260. package/validation/rules/LoneSchemaDefinition.js +1 -1
  261. package/validation/rules/LoneSchemaDefinition.js.flow +0 -1
  262. package/validation/rules/LoneSchemaDefinitionRule.js +1 -1
  263. package/validation/rules/LoneSchemaDefinitionRule.js.flow +2 -3
  264. package/validation/rules/NoFragmentCyclesRule.js +1 -1
  265. package/validation/rules/NoFragmentCyclesRule.js.flow +4 -5
  266. package/validation/rules/NoUndefinedVariablesRule.js +1 -1
  267. package/validation/rules/NoUndefinedVariablesRule.js.flow +3 -3
  268. package/validation/rules/NoUnusedFragmentsRule.js +1 -1
  269. package/validation/rules/NoUnusedFragmentsRule.js.flow +3 -3
  270. package/validation/rules/NoUnusedVariablesRule.js +1 -1
  271. package/validation/rules/NoUnusedVariablesRule.js.flow +3 -3
  272. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +20 -20
  273. package/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +29 -27
  274. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +12 -12
  275. package/validation/rules/PossibleFragmentSpreadsRule.js +5 -5
  276. package/validation/rules/PossibleFragmentSpreadsRule.js.flow +7 -4
  277. package/validation/rules/PossibleTypeExtensions.js +1 -1
  278. package/validation/rules/PossibleTypeExtensions.js.flow +0 -1
  279. package/validation/rules/PossibleTypeExtensionsRule.js +8 -8
  280. package/validation/rules/PossibleTypeExtensionsRule.js.flow +8 -6
  281. package/validation/rules/ProvidedRequiredArgumentsRule.js +7 -7
  282. package/validation/rules/ProvidedRequiredArgumentsRule.js.flow +7 -6
  283. package/validation/rules/ScalarLeafsRule.js +3 -3
  284. package/validation/rules/ScalarLeafsRule.js.flow +3 -4
  285. package/validation/rules/SingleFieldSubscriptionsRule.js +1 -1
  286. package/validation/rules/SingleFieldSubscriptionsRule.js.flow +3 -4
  287. package/validation/rules/UniqueArgumentNamesRule.js +1 -1
  288. package/validation/rules/UniqueArgumentNamesRule.js.flow +2 -3
  289. package/validation/rules/UniqueDirectiveNames.js +1 -1
  290. package/validation/rules/UniqueDirectiveNames.js.flow +0 -1
  291. package/validation/rules/UniqueDirectiveNamesRule.js +1 -1
  292. package/validation/rules/UniqueDirectiveNamesRule.js.flow +2 -3
  293. package/validation/rules/UniqueDirectivesPerLocationRule.js +4 -4
  294. package/validation/rules/UniqueDirectivesPerLocationRule.js.flow +4 -5
  295. package/validation/rules/UniqueEnumValueNames.js +1 -1
  296. package/validation/rules/UniqueEnumValueNames.js.flow +0 -1
  297. package/validation/rules/UniqueEnumValueNamesRule.js +2 -2
  298. package/validation/rules/UniqueEnumValueNamesRule.js.flow +11 -4
  299. package/validation/rules/UniqueFieldDefinitionNames.js +1 -1
  300. package/validation/rules/UniqueFieldDefinitionNames.js.flow +0 -1
  301. package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -3
  302. package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +17 -6
  303. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +1 -1
  304. package/validation/rules/UniqueFragmentNamesRule.js +1 -1
  305. package/validation/rules/UniqueFragmentNamesRule.js.flow +3 -3
  306. package/validation/rules/UniqueInputFieldNamesRule.js +1 -1
  307. package/validation/rules/UniqueInputFieldNamesRule.js.flow +3 -3
  308. package/validation/rules/UniqueOperationNamesRule.js +1 -1
  309. package/validation/rules/UniqueOperationNamesRule.js.flow +3 -3
  310. package/validation/rules/UniqueOperationTypes.js +1 -1
  311. package/validation/rules/UniqueOperationTypes.js.flow +0 -1
  312. package/validation/rules/UniqueOperationTypesRule.js +1 -1
  313. package/validation/rules/UniqueOperationTypesRule.js.flow +10 -4
  314. package/validation/rules/UniqueTypeNames.js +1 -1
  315. package/validation/rules/UniqueTypeNames.js.flow +0 -1
  316. package/validation/rules/UniqueTypeNamesRule.js +1 -1
  317. package/validation/rules/UniqueTypeNamesRule.js.flow +3 -4
  318. package/validation/rules/UniqueVariableNamesRule.js +1 -1
  319. package/validation/rules/UniqueVariableNamesRule.js.flow +3 -4
  320. package/validation/rules/ValuesOfCorrectTypeRule.js +8 -8
  321. package/validation/rules/ValuesOfCorrectTypeRule.js.flow +3 -4
  322. package/validation/rules/VariablesAreInputTypesRule.js +4 -4
  323. package/validation/rules/VariablesAreInputTypesRule.js.flow +3 -4
  324. package/validation/rules/VariablesInAllowedPositionRule.js +6 -6
  325. package/validation/rules/VariablesInAllowedPositionRule.js.flow +6 -6
  326. package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +14 -0
  327. package/validation/rules/custom/NoDeprecatedCustomRule.js +79 -0
  328. package/validation/rules/custom/NoDeprecatedCustomRule.js.flow +94 -0
  329. package/validation/rules/custom/NoDeprecatedCustomRule.mjs +68 -0
  330. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +16 -0
  331. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +34 -0
  332. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow +38 -0
  333. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +25 -0
  334. package/validation/specifiedRules.js +33 -33
  335. package/validation/specifiedRules.js.flow +0 -1
  336. package/validation/validate.js +7 -7
  337. package/validation/validate.js.flow +4 -9
  338. package/version.js +2 -2
  339. package/version.js.flow +2 -3
  340. package/version.mjs +2 -2
  341. package/polyfills/flatMap.js +0 -30
  342. package/polyfills/flatMap.js.flow +0 -28
  343. package/polyfills/flatMap.mjs +0 -23
@@ -4,55 +4,55 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.execute = execute;
7
+ exports.executeSync = executeSync;
7
8
  exports.assertValidExecutionArguments = assertValidExecutionArguments;
8
9
  exports.buildExecutionContext = buildExecutionContext;
9
10
  exports.collectFields = collectFields;
10
11
  exports.buildResolveInfo = buildResolveInfo;
11
- exports.resolveFieldValueOrError = resolveFieldValueOrError;
12
12
  exports.getFieldDef = getFieldDef;
13
13
  exports.defaultFieldResolver = exports.defaultTypeResolver = void 0;
14
14
 
15
- var _arrayFrom = _interopRequireDefault(require("../polyfills/arrayFrom"));
15
+ var _arrayFrom = _interopRequireDefault(require("../polyfills/arrayFrom.js"));
16
16
 
17
- var _inspect = _interopRequireDefault(require("../jsutils/inspect"));
17
+ var _inspect = _interopRequireDefault(require("../jsutils/inspect.js"));
18
18
 
19
- var _memoize = _interopRequireDefault(require("../jsutils/memoize3"));
19
+ var _memoize = _interopRequireDefault(require("../jsutils/memoize3.js"));
20
20
 
21
- var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
21
+ var _invariant = _interopRequireDefault(require("../jsutils/invariant.js"));
22
22
 
23
- var _devAssert = _interopRequireDefault(require("../jsutils/devAssert"));
23
+ var _devAssert = _interopRequireDefault(require("../jsutils/devAssert.js"));
24
24
 
25
- var _isPromise = _interopRequireDefault(require("../jsutils/isPromise"));
25
+ var _isPromise = _interopRequireDefault(require("../jsutils/isPromise.js"));
26
26
 
27
- var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike"));
27
+ var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike.js"));
28
28
 
29
- var _isCollection = _interopRequireDefault(require("../jsutils/isCollection"));
29
+ var _isCollection = _interopRequireDefault(require("../jsutils/isCollection.js"));
30
30
 
31
- var _promiseReduce = _interopRequireDefault(require("../jsutils/promiseReduce"));
31
+ var _promiseReduce = _interopRequireDefault(require("../jsutils/promiseReduce.js"));
32
32
 
33
- var _promiseForObject = _interopRequireDefault(require("../jsutils/promiseForObject"));
33
+ var _promiseForObject = _interopRequireDefault(require("../jsutils/promiseForObject.js"));
34
34
 
35
- var _Path = require("../jsutils/Path");
35
+ var _Path = require("../jsutils/Path.js");
36
36
 
37
- var _GraphQLError = require("../error/GraphQLError");
37
+ var _GraphQLError = require("../error/GraphQLError.js");
38
38
 
39
- var _locatedError = require("../error/locatedError");
39
+ var _locatedError = require("../error/locatedError.js");
40
40
 
41
- var _kinds = require("../language/kinds");
41
+ var _kinds = require("../language/kinds.js");
42
42
 
43
- var _validate = require("../type/validate");
43
+ var _validate = require("../type/validate.js");
44
44
 
45
- var _introspection = require("../type/introspection");
45
+ var _introspection = require("../type/introspection.js");
46
46
 
47
- var _directives = require("../type/directives");
47
+ var _directives = require("../type/directives.js");
48
48
 
49
- var _definition = require("../type/definition");
49
+ var _definition = require("../type/definition.js");
50
50
 
51
- var _typeFromAST = require("../utilities/typeFromAST");
51
+ var _typeFromAST = require("../utilities/typeFromAST.js");
52
52
 
53
- var _getOperationRootType = require("../utilities/getOperationRootType");
53
+ var _getOperationRootType = require("../utilities/getOperationRootType.js");
54
54
 
55
- var _values = require("./values");
55
+ var _values = require("./values.js");
56
56
 
57
57
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
58
58
 
@@ -70,6 +70,22 @@ function execute(argsOrSchema, document, rootValue, contextValue, variableValues
70
70
  typeResolver: typeResolver
71
71
  });
72
72
  }
73
+ /**
74
+ * Also implements the "Evaluating requests" section of the GraphQL specification.
75
+ * However, it guarantees to complete synchronously (or throw an error) assuming
76
+ * that all field resolvers are also synchronous.
77
+ */
78
+
79
+
80
+ function executeSync(args) {
81
+ var result = executeImpl(args); // Assert that the execution was synchronous.
82
+
83
+ if ((0, _isPromise.default)(result)) {
84
+ throw new Error('GraphQL execution failed to complete synchronously.');
85
+ }
86
+
87
+ return result;
88
+ }
73
89
 
74
90
  function executeImpl(args) {
75
91
  var schema = args.schema,
@@ -217,8 +233,6 @@ function executeOperation(exeContext, operation, rootValue) {
217
233
  var path = undefined; // Errors from sub-fields of a NonNull type may propagate to the top level,
218
234
  // at which point we still log the error and null the parent field, which
219
235
  // in this case is the entire response.
220
- //
221
- // Similar to completeValueCatchingError.
222
236
 
223
237
  try {
224
238
  var result = operation.operation === 'mutation' ? executeFieldsSerially(exeContext, type, rootValue, path, fields) : executeFields(exeContext, type, rootValue, path, fields);
@@ -245,7 +259,7 @@ function executeOperation(exeContext, operation, rootValue) {
245
259
  function executeFieldsSerially(exeContext, parentType, sourceValue, path, fields) {
246
260
  return (0, _promiseReduce.default)(Object.keys(fields), function (results, responseName) {
247
261
  var fieldNodes = fields[responseName];
248
- var fieldPath = (0, _Path.addPath)(path, responseName);
262
+ var fieldPath = (0, _Path.addPath)(path, responseName, parentType.name);
249
263
  var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath);
250
264
 
251
265
  if (result === undefined) {
@@ -276,13 +290,13 @@ function executeFields(exeContext, parentType, sourceValue, path, fields) {
276
290
  for (var _i4 = 0, _Object$keys2 = Object.keys(fields); _i4 < _Object$keys2.length; _i4++) {
277
291
  var responseName = _Object$keys2[_i4];
278
292
  var fieldNodes = fields[responseName];
279
- var fieldPath = (0, _Path.addPath)(path, responseName);
293
+ var fieldPath = (0, _Path.addPath)(path, responseName, parentType.name);
280
294
  var result = resolveField(exeContext, parentType, sourceValue, fieldNodes, fieldPath);
281
295
 
282
296
  if (result !== undefined) {
283
297
  results[responseName] = result;
284
298
 
285
- if (!containsPromise && (0, _isPromise.default)(result)) {
299
+ if ((0, _isPromise.default)(result)) {
286
300
  containsPromise = true;
287
301
  }
288
302
  }
@@ -436,43 +450,10 @@ function resolveField(exeContext, parentType, source, fieldNodes, path) {
436
450
  return;
437
451
  }
438
452
 
453
+ var returnType = fieldDef.type;
439
454
  var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
440
- var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path); // Get the resolve function, regardless of if its result is normal
441
- // or abrupt (error).
442
-
443
- var result = resolveFieldValueOrError(exeContext, fieldDef, fieldNodes, resolveFn, source, info);
444
- return completeValueCatchingError(exeContext, fieldDef.type, fieldNodes, info, path, result);
445
- }
446
- /**
447
- * @internal
448
- */
449
-
450
-
451
- function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) {
452
- // The resolve function's optional fourth argument is a collection of
453
- // information about the current execution state.
454
- return {
455
- fieldName: fieldDef.name,
456
- fieldNodes: fieldNodes,
457
- returnType: fieldDef.type,
458
- parentType: parentType,
459
- path: path,
460
- schema: exeContext.schema,
461
- fragments: exeContext.fragments,
462
- rootValue: exeContext.rootValue,
463
- operation: exeContext.operation,
464
- variableValues: exeContext.variableValues
465
- };
466
- }
467
- /**
468
- * Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField`
469
- * function. Returns the result of resolveFn or the abrupt-return Error object.
470
- *
471
- * @internal
472
- */
473
-
455
+ var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path); // Get the resolve function, regardless of if its result is normal or abrupt (error).
474
456
 
475
- function resolveFieldValueOrError(exeContext, fieldDef, fieldNodes, resolveFn, source, info) {
476
457
  try {
477
458
  // Build a JS object of arguments from the field.arguments AST, using the
478
459
  // variables scope to fulfill any variable references.
@@ -483,26 +464,6 @@ function resolveFieldValueOrError(exeContext, fieldDef, fieldNodes, resolveFn, s
483
464
 
484
465
  var _contextValue = exeContext.contextValue;
485
466
  var result = resolveFn(source, args, _contextValue, info);
486
- return (0, _isPromise.default)(result) ? result.then(undefined, asErrorInstance) : result;
487
- } catch (error) {
488
- return asErrorInstance(error);
489
- }
490
- } // Sometimes a non-error is thrown, wrap it as an Error instance to ensure a
491
- // consistent Error interface.
492
-
493
-
494
- function asErrorInstance(error) {
495
- if (error instanceof Error) {
496
- return error;
497
- }
498
-
499
- return new Error('Unexpected error value: ' + (0, _inspect.default)(error));
500
- } // This is a small wrapper around completeValue which detects and logs errors
501
- // in the execution context.
502
-
503
-
504
- function completeValueCatchingError(exeContext, returnType, fieldNodes, info, path, result) {
505
- try {
506
467
  var completed;
507
468
 
508
469
  if ((0, _isPromise.default)(result)) {
@@ -516,21 +477,43 @@ function completeValueCatchingError(exeContext, returnType, fieldNodes, info, pa
516
477
  if ((0, _isPromise.default)(completed)) {
517
478
  // Note: we don't rely on a `catch` method, but we do expect "thenable"
518
479
  // to take a second callback for the error case.
519
- return completed.then(undefined, function (error) {
520
- return handleFieldError(error, fieldNodes, path, returnType, exeContext);
480
+ return completed.then(undefined, function (rawError) {
481
+ var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(path));
482
+ return handleFieldError(error, returnType, exeContext);
521
483
  });
522
484
  }
523
485
 
524
486
  return completed;
525
- } catch (error) {
526
- return handleFieldError(error, fieldNodes, path, returnType, exeContext);
487
+ } catch (rawError) {
488
+ var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(path));
489
+ return handleFieldError(error, returnType, exeContext);
527
490
  }
528
491
  }
492
+ /**
493
+ * @internal
494
+ */
529
495
 
530
- function handleFieldError(rawError, fieldNodes, path, returnType, exeContext) {
531
- var error = (0, _locatedError.locatedError)(asErrorInstance(rawError), fieldNodes, (0, _Path.pathToArray)(path)); // If the field type is non-nullable, then it is resolved without any
532
- // protection from errors, however it still properly locates the error.
533
496
 
497
+ function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) {
498
+ // The resolve function's optional fourth argument is a collection of
499
+ // information about the current execution state.
500
+ return {
501
+ fieldName: fieldDef.name,
502
+ fieldNodes: fieldNodes,
503
+ returnType: fieldDef.type,
504
+ parentType: parentType,
505
+ path: path,
506
+ schema: exeContext.schema,
507
+ fragments: exeContext.fragments,
508
+ rootValue: exeContext.rootValue,
509
+ operation: exeContext.operation,
510
+ variableValues: exeContext.variableValues
511
+ };
512
+ }
513
+
514
+ function handleFieldError(error, returnType, exeContext) {
515
+ // If the field type is non-nullable, then it is resolved without any
516
+ // protection from errors, however it still properly locates the error.
534
517
  if ((0, _definition.isNonNullType)(returnType)) {
535
518
  throw error;
536
519
  } // Otherwise, error protection is applied, logging the error and resolving
@@ -630,14 +613,34 @@ function completeListValue(exeContext, returnType, fieldNodes, info, path, resul
630
613
  var completedResults = (0, _arrayFrom.default)(result, function (item, index) {
631
614
  // No need to modify the info object containing the path,
632
615
  // since from here on it is not ever accessed by resolver functions.
633
- var fieldPath = (0, _Path.addPath)(path, index);
634
- var completedItem = completeValueCatchingError(exeContext, itemType, fieldNodes, info, fieldPath, item);
616
+ var itemPath = (0, _Path.addPath)(path, index, undefined);
635
617
 
636
- if (!containsPromise && (0, _isPromise.default)(completedItem)) {
637
- containsPromise = true;
638
- }
618
+ try {
619
+ var completedItem;
620
+
621
+ if ((0, _isPromise.default)(item)) {
622
+ completedItem = item.then(function (resolved) {
623
+ return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved);
624
+ });
625
+ } else {
626
+ completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item);
627
+ }
628
+
629
+ if ((0, _isPromise.default)(completedItem)) {
630
+ containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable"
631
+ // to take a second callback for the error case.
639
632
 
640
- return completedItem;
633
+ return completedItem.then(undefined, function (rawError) {
634
+ var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(itemPath));
635
+ return handleFieldError(error, itemType, exeContext);
636
+ });
637
+ }
638
+
639
+ return completedItem;
640
+ } catch (rawError) {
641
+ var error = (0, _locatedError.locatedError)(rawError, fieldNodes, (0, _Path.pathToArray)(itemPath));
642
+ return handleFieldError(error, itemType, exeContext);
643
+ }
641
644
  });
642
645
  return containsPromise ? Promise.all(completedResults) : completedResults;
643
646
  }
@@ -679,10 +682,25 @@ function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, r
679
682
  }
680
683
 
681
684
  function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) {
682
- var runtimeType = typeof runtimeTypeOrName === 'string' ? exeContext.schema.getType(runtimeTypeOrName) : runtimeTypeOrName;
685
+ if (runtimeTypeOrName == null) {
686
+ throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\". Either the \"").concat(returnType.name, "\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function."), fieldNodes);
687
+ } // FIXME: temporary workaround until support for passing object types would be removed in v16.0.0
688
+
689
+
690
+ var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName;
691
+
692
+ if (typeof runtimeTypeName !== 'string') {
693
+ throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\" with ") + "value ".concat((0, _inspect.default)(result), ", received \"").concat((0, _inspect.default)(runtimeTypeOrName), "\"."));
694
+ }
695
+
696
+ var runtimeType = exeContext.schema.getType(runtimeTypeName);
697
+
698
+ if (runtimeType == null) {
699
+ throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a type \"").concat(runtimeTypeName, "\" that does not exist inside schema."), fieldNodes);
700
+ }
683
701
 
684
702
  if (!(0, _definition.isObjectType)(runtimeType)) {
685
- throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" must resolve to an Object type at runtime for field \"").concat(info.parentType.name, ".").concat(info.fieldName, "\" with ") + "value ".concat((0, _inspect.default)(result), ", received \"").concat((0, _inspect.default)(runtimeType), "\". ") + "Either the \"".concat(returnType.name, "\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function."), fieldNodes);
703
+ throw new _GraphQLError.GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a non-object type \"").concat(runtimeTypeName, "\"."), fieldNodes);
686
704
  }
687
705
 
688
706
  if (!exeContext.schema.isSubType(returnType, runtimeType)) {
@@ -784,7 +802,7 @@ var defaultTypeResolver = function defaultTypeResolver(value, contextValue, info
784
802
  if ((0, _isPromise.default)(isTypeOfResult)) {
785
803
  promisedIsTypeOfResults[i] = isTypeOfResult;
786
804
  } else if (isTypeOfResult) {
787
- return type;
805
+ return type.name;
788
806
  }
789
807
  }
790
808
  }
@@ -793,7 +811,7 @@ var defaultTypeResolver = function defaultTypeResolver(value, contextValue, info
793
811
  return Promise.all(promisedIsTypeOfResults).then(function (isTypeOfResults) {
794
812
  for (var _i9 = 0; _i9 < isTypeOfResults.length; _i9++) {
795
813
  if (isTypeOfResults[_i9]) {
796
- return possibleTypes[_i9];
814
+ return possibleTypes[_i9].name;
797
815
  }
798
816
  }
799
817
  });
@@ -823,12 +841,12 @@ var defaultFieldResolver = function defaultFieldResolver(source, args, contextVa
823
841
  };
824
842
  /**
825
843
  * This method looks up the field on the given type definition.
826
- * It has special casing for the two introspection fields, __schema
827
- * and __typename. __typename is special because it can always be
828
- * queried as a field, even in situations where no other fields
829
- * are allowed, like on a Union. __schema could get automatically
830
- * added to the query type, but that would require mutating type
831
- * definitions, which would cause issues.
844
+ * It has special casing for the three introspection fields,
845
+ * __schema, __type and __typename. __typename is special because
846
+ * it can always be queried as a field, even in situations where no
847
+ * other fields are allowed, like on a Union. __schema and __type
848
+ * could get automatically added to the query type, but that would
849
+ * require mutating type definitions, which would cause issues.
832
850
  *
833
851
  * @internal
834
852
  */