graphql 15.3.0 → 15.5.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 (337) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +10 -0
  3. package/error/GraphQLError.js +8 -8
  4. package/error/GraphQLError.js.flow +2 -3
  5. package/error/GraphQLError.mjs +2 -2
  6. package/error/formatError.js +1 -1
  7. package/error/formatError.js.flow +0 -1
  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 +10 -4
  13. package/error/locatedError.mjs +6 -4
  14. package/error/syntaxError.js +1 -1
  15. package/error/syntaxError.js.flow +0 -1
  16. package/execution/execute.d.ts +0 -15
  17. package/execution/execute.js +104 -104
  18. package/execution/execute.js.flow +119 -133
  19. package/execution/execute.mjs +86 -82
  20. package/execution/index.js +3 -3
  21. package/execution/index.js.flow +0 -1
  22. package/execution/values.js +11 -11
  23. package/execution/values.js.flow +0 -1
  24. package/graphql.js +5 -5
  25. package/graphql.js.flow +0 -1
  26. package/index.d.ts +1 -0
  27. package/index.js +9 -9
  28. package/index.js.flow +0 -1
  29. package/jsutils/ObjMap.js.flow +0 -1
  30. package/jsutils/Path.js.flow +0 -1
  31. package/jsutils/PromiseOrValue.js.flow +0 -1
  32. package/jsutils/defineInspect.js +2 -2
  33. package/jsutils/defineInspect.js.flow +0 -1
  34. package/jsutils/devAssert.js.flow +0 -1
  35. package/jsutils/didYouMean.js.flow +0 -1
  36. package/jsutils/identityFunc.js.flow +0 -1
  37. package/jsutils/inspect.js +1 -2
  38. package/jsutils/inspect.js.flow +10 -8
  39. package/jsutils/inspect.mjs +1 -1
  40. package/jsutils/instanceOf.js +15 -9
  41. package/jsutils/instanceOf.js.flow +13 -7
  42. package/jsutils/instanceOf.mjs +13 -5
  43. package/jsutils/invariant.js.flow +0 -1
  44. package/jsutils/isAsyncIterable.js +13 -0
  45. package/jsutils/isAsyncIterable.js.flow +14 -0
  46. package/jsutils/isAsyncIterable.mjs +10 -0
  47. package/jsutils/isObjectLike.js.flow +0 -1
  48. package/jsutils/isPromise.js.flow +0 -1
  49. package/jsutils/keyMap.js.flow +0 -1
  50. package/jsutils/keyValMap.js.flow +0 -1
  51. package/jsutils/mapValue.js +1 -1
  52. package/jsutils/mapValue.js.flow +0 -1
  53. package/jsutils/memoize3.js +2 -5
  54. package/jsutils/memoize3.js.flow +2 -5
  55. package/jsutils/memoize3.mjs +2 -5
  56. package/jsutils/naturalCompare.js +69 -0
  57. package/jsutils/naturalCompare.js.flow +59 -0
  58. package/jsutils/naturalCompare.mjs +61 -0
  59. package/jsutils/nodejsCustomInspectSymbol.js.flow +0 -1
  60. package/jsutils/printPathArray.js.flow +0 -1
  61. package/jsutils/promiseForObject.js.flow +0 -1
  62. package/jsutils/promiseReduce.js +1 -1
  63. package/jsutils/promiseReduce.js.flow +0 -1
  64. package/jsutils/safeArrayFrom.js +73 -0
  65. package/jsutils/safeArrayFrom.js.flow +59 -0
  66. package/jsutils/safeArrayFrom.mjs +66 -0
  67. package/jsutils/suggestionList.js +5 -1
  68. package/jsutils/suggestionList.js.flow +3 -2
  69. package/jsutils/suggestionList.mjs +3 -1
  70. package/jsutils/toObjMap.js +1 -1
  71. package/jsutils/toObjMap.js.flow +0 -1
  72. package/language/ast.js +1 -1
  73. package/language/ast.js.flow +0 -1
  74. package/language/blockString.d.ts +1 -1
  75. package/language/blockString.js +53 -32
  76. package/language/blockString.js.flow +51 -36
  77. package/language/blockString.mjs +54 -33
  78. package/language/directiveLocation.js.flow +0 -1
  79. package/language/experimentalOnlineParser/grammar.d.ts +1006 -0
  80. package/language/experimentalOnlineParser/grammar.js +987 -0
  81. package/language/experimentalOnlineParser/grammar.js.flow +1000 -0
  82. package/language/experimentalOnlineParser/grammar.mjs +980 -0
  83. package/language/experimentalOnlineParser/index.d.ts +6 -0
  84. package/language/experimentalOnlineParser/index.js +31 -0
  85. package/language/experimentalOnlineParser/index.js.flow +7 -0
  86. package/language/experimentalOnlineParser/index.mjs +1 -0
  87. package/language/experimentalOnlineParser/onlineParser.d.ts +125 -0
  88. package/language/experimentalOnlineParser/onlineParser.js +604 -0
  89. package/language/experimentalOnlineParser/onlineParser.js.flow +723 -0
  90. package/language/experimentalOnlineParser/onlineParser.mjs +587 -0
  91. package/language/index.js +12 -12
  92. package/language/index.js.flow +0 -1
  93. package/language/kinds.js.flow +0 -1
  94. package/language/lexer.js +242 -183
  95. package/language/lexer.js.flow +188 -184
  96. package/language/lexer.mjs +238 -179
  97. package/language/location.js.flow +0 -1
  98. package/language/parser.js +73 -68
  99. package/language/parser.js.flow +62 -57
  100. package/language/parser.mjs +64 -60
  101. package/language/predicates.js +1 -1
  102. package/language/predicates.js.flow +0 -1
  103. package/language/printLocation.js +1 -1
  104. package/language/printLocation.js.flow +0 -1
  105. package/language/printer.js +20 -13
  106. package/language/printer.js.flow +26 -25
  107. package/language/printer.mjs +18 -11
  108. package/language/source.d.ts +7 -0
  109. package/language/source.js +20 -3
  110. package/language/source.js.flow +21 -3
  111. package/language/source.mjs +14 -1
  112. package/language/tokenKind.js.flow +0 -1
  113. package/language/visitor.js +2 -2
  114. package/language/visitor.js.flow +0 -1
  115. package/package.json +2 -3
  116. package/polyfills/arrayFrom.js +2 -2
  117. package/polyfills/arrayFrom.js.flow +1 -2
  118. package/polyfills/arrayFrom.mjs +1 -1
  119. package/polyfills/find.js +1 -1
  120. package/polyfills/find.js.flow +1 -2
  121. package/polyfills/find.mjs +1 -1
  122. package/polyfills/isFinite.js +1 -1
  123. package/polyfills/isFinite.js.flow +1 -2
  124. package/polyfills/isFinite.mjs +1 -1
  125. package/polyfills/isInteger.js +1 -1
  126. package/polyfills/isInteger.js.flow +1 -2
  127. package/polyfills/isInteger.mjs +1 -1
  128. package/polyfills/objectEntries.js +1 -1
  129. package/polyfills/objectEntries.js.flow +1 -2
  130. package/polyfills/objectEntries.mjs +1 -1
  131. package/polyfills/objectValues.js +1 -1
  132. package/polyfills/objectValues.js.flow +1 -2
  133. package/polyfills/objectValues.mjs +1 -1
  134. package/polyfills/symbols.js +3 -5
  135. package/polyfills/symbols.js.flow +9 -6
  136. package/polyfills/symbols.mjs +3 -5
  137. package/subscription/index.js +1 -1
  138. package/subscription/index.js.flow +0 -1
  139. package/subscription/mapAsyncIterator.js +2 -2
  140. package/subscription/mapAsyncIterator.js.flow +8 -9
  141. package/subscription/mapAsyncIterator.mjs +1 -1
  142. package/subscription/subscribe.js +61 -73
  143. package/subscription/subscribe.js.flow +71 -85
  144. package/subscription/subscribe.mjs +53 -65
  145. package/type/definition.d.ts +16 -6
  146. package/type/definition.js +37 -32
  147. package/type/definition.js.flow +93 -63
  148. package/type/definition.mjs +19 -14
  149. package/type/directives.js +17 -16
  150. package/type/directives.js.flow +20 -13
  151. package/type/directives.mjs +6 -5
  152. package/type/index.js +6 -6
  153. package/type/index.js.flow +0 -1
  154. package/type/introspection.js +86 -65
  155. package/type/introspection.js.flow +75 -43
  156. package/type/introspection.mjs +79 -58
  157. package/type/scalars.js +9 -9
  158. package/type/scalars.js.flow +1 -2
  159. package/type/scalars.mjs +1 -1
  160. package/type/schema.js +13 -13
  161. package/type/schema.js.flow +2 -3
  162. package/type/schema.mjs +1 -1
  163. package/type/validate.js +52 -19
  164. package/type/validate.js.flow +54 -8
  165. package/type/validate.mjs +43 -9
  166. package/utilities/TypeInfo.js +7 -7
  167. package/utilities/TypeInfo.js.flow +1 -2
  168. package/utilities/assertValidName.js +2 -2
  169. package/utilities/assertValidName.js.flow +0 -1
  170. package/utilities/astFromValue.js +14 -16
  171. package/utilities/astFromValue.js.flow +6 -7
  172. package/utilities/astFromValue.mjs +6 -7
  173. package/utilities/buildASTSchema.js +17 -27
  174. package/utilities/buildASTSchema.js.flow +5 -21
  175. package/utilities/buildASTSchema.mjs +11 -21
  176. package/utilities/buildClientSchema.js +16 -15
  177. package/utilities/buildClientSchema.js.flow +28 -12
  178. package/utilities/buildClientSchema.mjs +5 -4
  179. package/utilities/coerceInputValue.js +17 -18
  180. package/utilities/coerceInputValue.js.flow +12 -10
  181. package/utilities/coerceInputValue.mjs +7 -7
  182. package/utilities/concatAST.js +9 -8
  183. package/utilities/concatAST.js.flow +8 -8
  184. package/utilities/concatAST.mjs +9 -6
  185. package/utilities/extendSchema.js +26 -19
  186. package/utilities/extendSchema.js.flow +19 -7
  187. package/utilities/extendSchema.mjs +8 -1
  188. package/utilities/findBreakingChanges.js +15 -11
  189. package/utilities/findBreakingChanges.js.flow +6 -3
  190. package/utilities/findBreakingChanges.mjs +5 -2
  191. package/utilities/findDeprecatedUsages.js +2 -2
  192. package/utilities/findDeprecatedUsages.js.flow +0 -1
  193. package/utilities/getIntrospectionQuery.d.ts +6 -0
  194. package/utilities/getIntrospectionQuery.js +8 -2
  195. package/utilities/getIntrospectionQuery.js.flow +17 -5
  196. package/utilities/getIntrospectionQuery.mjs +8 -2
  197. package/utilities/getOperationAST.js +1 -1
  198. package/utilities/getOperationAST.js.flow +0 -1
  199. package/utilities/getOperationRootType.js +1 -1
  200. package/utilities/getOperationRootType.js.flow +0 -1
  201. package/utilities/index.d.ts +3 -0
  202. package/utilities/index.js +22 -22
  203. package/utilities/index.js.flow +0 -1
  204. package/utilities/introspectionFromSchema.js +7 -5
  205. package/utilities/introspectionFromSchema.js.flow +2 -1
  206. package/utilities/introspectionFromSchema.mjs +3 -1
  207. package/utilities/lexicographicSortSchema.js +13 -9
  208. package/utilities/lexicographicSortSchema.js.flow +21 -13
  209. package/utilities/lexicographicSortSchema.mjs +5 -2
  210. package/utilities/printSchema.js +15 -16
  211. package/utilities/printSchema.js.flow +23 -16
  212. package/utilities/printSchema.mjs +5 -6
  213. package/utilities/separateOperations.js +46 -42
  214. package/utilities/separateOperations.js.flow +46 -37
  215. package/utilities/separateOperations.mjs +44 -40
  216. package/utilities/stripIgnoredCharacters.js +6 -16
  217. package/utilities/stripIgnoredCharacters.js.flow +4 -13
  218. package/utilities/stripIgnoredCharacters.mjs +3 -10
  219. package/utilities/typeComparators.js +1 -1
  220. package/utilities/typeComparators.js.flow +0 -1
  221. package/utilities/typeFromAST.js +6 -6
  222. package/utilities/typeFromAST.js.flow +2 -3
  223. package/utilities/typeFromAST.mjs +2 -2
  224. package/utilities/typedQueryDocumentNode.d.ts +20 -0
  225. package/utilities/valueFromAST.js +6 -6
  226. package/utilities/valueFromAST.js.flow +4 -2
  227. package/utilities/valueFromASTUntyped.js +4 -4
  228. package/utilities/valueFromASTUntyped.js.flow +0 -1
  229. package/validation/ValidationContext.js +3 -3
  230. package/validation/ValidationContext.js.flow +3 -4
  231. package/validation/index.js +38 -38
  232. package/validation/index.js.flow +0 -1
  233. package/validation/rules/ExecutableDefinitions.js +1 -1
  234. package/validation/rules/ExecutableDefinitions.js.flow +0 -1
  235. package/validation/rules/ExecutableDefinitionsRule.js +3 -3
  236. package/validation/rules/ExecutableDefinitionsRule.js.flow +0 -1
  237. package/validation/rules/FieldsOnCorrectTypeRule.js +8 -6
  238. package/validation/rules/FieldsOnCorrectTypeRule.js.flow +2 -2
  239. package/validation/rules/FieldsOnCorrectTypeRule.mjs +2 -1
  240. package/validation/rules/FragmentsOnCompositeTypesRule.js +4 -4
  241. package/validation/rules/FragmentsOnCompositeTypesRule.js.flow +0 -1
  242. package/validation/rules/KnownArgumentNamesRule.js +5 -5
  243. package/validation/rules/KnownArgumentNamesRule.js.flow +1 -1
  244. package/validation/rules/KnownDirectivesRule.js +6 -6
  245. package/validation/rules/KnownDirectivesRule.js.flow +4 -3
  246. package/validation/rules/KnownFragmentNamesRule.js +1 -1
  247. package/validation/rules/KnownFragmentNamesRule.js.flow +0 -1
  248. package/validation/rules/KnownTypeNamesRule.js +6 -6
  249. package/validation/rules/KnownTypeNamesRule.js.flow +1 -2
  250. package/validation/rules/LoneAnonymousOperationRule.js +2 -2
  251. package/validation/rules/LoneAnonymousOperationRule.js.flow +0 -1
  252. package/validation/rules/LoneSchemaDefinition.js +1 -1
  253. package/validation/rules/LoneSchemaDefinition.js.flow +0 -1
  254. package/validation/rules/LoneSchemaDefinitionRule.js +1 -1
  255. package/validation/rules/LoneSchemaDefinitionRule.js.flow +0 -1
  256. package/validation/rules/NoFragmentCyclesRule.js +1 -1
  257. package/validation/rules/NoFragmentCyclesRule.js.flow +1 -2
  258. package/validation/rules/NoUndefinedVariablesRule.js +1 -1
  259. package/validation/rules/NoUndefinedVariablesRule.js.flow +0 -1
  260. package/validation/rules/NoUnusedFragmentsRule.js +1 -1
  261. package/validation/rules/NoUnusedFragmentsRule.js.flow +0 -1
  262. package/validation/rules/NoUnusedVariablesRule.js +1 -1
  263. package/validation/rules/NoUnusedVariablesRule.js.flow +0 -1
  264. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +20 -20
  265. package/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +14 -14
  266. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +12 -12
  267. package/validation/rules/PossibleFragmentSpreadsRule.js +5 -5
  268. package/validation/rules/PossibleFragmentSpreadsRule.js.flow +5 -2
  269. package/validation/rules/PossibleTypeExtensions.js +1 -1
  270. package/validation/rules/PossibleTypeExtensions.js.flow +0 -1
  271. package/validation/rules/PossibleTypeExtensionsRule.js +8 -8
  272. package/validation/rules/PossibleTypeExtensionsRule.js.flow +6 -4
  273. package/validation/rules/ProvidedRequiredArgumentsRule.js +7 -7
  274. package/validation/rules/ProvidedRequiredArgumentsRule.js.flow +4 -3
  275. package/validation/rules/ScalarLeafsRule.js +3 -3
  276. package/validation/rules/ScalarLeafsRule.js.flow +0 -1
  277. package/validation/rules/SingleFieldSubscriptionsRule.js +1 -1
  278. package/validation/rules/SingleFieldSubscriptionsRule.js.flow +0 -1
  279. package/validation/rules/UniqueArgumentNamesRule.js +1 -1
  280. package/validation/rules/UniqueArgumentNamesRule.js.flow +0 -1
  281. package/validation/rules/UniqueDirectiveNames.js +1 -1
  282. package/validation/rules/UniqueDirectiveNames.js.flow +0 -1
  283. package/validation/rules/UniqueDirectiveNamesRule.js +2 -2
  284. package/validation/rules/UniqueDirectiveNamesRule.js.flow +0 -1
  285. package/validation/rules/UniqueDirectiveNamesRule.mjs +1 -1
  286. package/validation/rules/UniqueDirectivesPerLocationRule.js +4 -4
  287. package/validation/rules/UniqueDirectivesPerLocationRule.js.flow +0 -1
  288. package/validation/rules/UniqueEnumValueNames.js +1 -1
  289. package/validation/rules/UniqueEnumValueNames.js.flow +0 -1
  290. package/validation/rules/UniqueEnumValueNamesRule.js +2 -2
  291. package/validation/rules/UniqueEnumValueNamesRule.js.flow +7 -2
  292. package/validation/rules/UniqueFieldDefinitionNames.js +1 -1
  293. package/validation/rules/UniqueFieldDefinitionNames.js.flow +0 -1
  294. package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -3
  295. package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +13 -4
  296. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +1 -1
  297. package/validation/rules/UniqueFragmentNamesRule.js +1 -1
  298. package/validation/rules/UniqueFragmentNamesRule.js.flow +0 -1
  299. package/validation/rules/UniqueInputFieldNamesRule.js +1 -1
  300. package/validation/rules/UniqueInputFieldNamesRule.js.flow +0 -1
  301. package/validation/rules/UniqueOperationNamesRule.js +1 -1
  302. package/validation/rules/UniqueOperationNamesRule.js.flow +0 -1
  303. package/validation/rules/UniqueOperationTypes.js +1 -1
  304. package/validation/rules/UniqueOperationTypes.js.flow +0 -1
  305. package/validation/rules/UniqueOperationTypesRule.js +1 -1
  306. package/validation/rules/UniqueOperationTypesRule.js.flow +7 -2
  307. package/validation/rules/UniqueTypeNames.js +1 -1
  308. package/validation/rules/UniqueTypeNames.js.flow +0 -1
  309. package/validation/rules/UniqueTypeNamesRule.js +2 -2
  310. package/validation/rules/UniqueTypeNamesRule.js.flow +0 -1
  311. package/validation/rules/UniqueTypeNamesRule.mjs +1 -1
  312. package/validation/rules/UniqueVariableNamesRule.js +1 -1
  313. package/validation/rules/UniqueVariableNamesRule.js.flow +0 -1
  314. package/validation/rules/ValuesOfCorrectTypeRule.js +8 -8
  315. package/validation/rules/ValuesOfCorrectTypeRule.js.flow +0 -1
  316. package/validation/rules/VariablesAreInputTypesRule.js +4 -4
  317. package/validation/rules/VariablesAreInputTypesRule.js.flow +0 -1
  318. package/validation/rules/VariablesInAllowedPositionRule.js +6 -6
  319. package/validation/rules/VariablesInAllowedPositionRule.js.flow +0 -1
  320. package/validation/rules/custom/NoDeprecatedCustomRule.js +47 -9
  321. package/validation/rules/custom/NoDeprecatedCustomRule.js.flow +56 -13
  322. package/validation/rules/custom/NoDeprecatedCustomRule.mjs +43 -8
  323. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +3 -3
  324. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow +0 -1
  325. package/validation/specifiedRules.js +33 -33
  326. package/validation/specifiedRules.js.flow +0 -1
  327. package/validation/validate.js +7 -7
  328. package/validation/validate.js.flow +4 -5
  329. package/version.js +3 -3
  330. package/version.js.flow +3 -4
  331. package/version.mjs +3 -3
  332. package/jsutils/isCollection.js +0 -47
  333. package/jsutils/isCollection.js.flow +0 -39
  334. package/jsutils/isCollection.mjs +0 -40
  335. package/polyfills/flatMap.js +0 -30
  336. package/polyfills/flatMap.js.flow +0 -28
  337. package/polyfills/flatMap.mjs +0 -23
@@ -1,7 +1,4 @@
1
1
  // @flow strict
2
-
3
- import arrayFrom from '../polyfills/arrayFrom';
4
-
5
2
  import type { Path } from '../jsutils/Path';
6
3
  import type { ObjMap } from '../jsutils/ObjMap';
7
4
  import type { PromiseOrValue } from '../jsutils/PromiseOrValue';
@@ -11,7 +8,7 @@ import invariant from '../jsutils/invariant';
11
8
  import devAssert from '../jsutils/devAssert';
12
9
  import isPromise from '../jsutils/isPromise';
13
10
  import isObjectLike from '../jsutils/isObjectLike';
14
- import isCollection from '../jsutils/isCollection';
11
+ import safeArrayFrom from '../jsutils/safeArrayFrom';
15
12
  import promiseReduce from '../jsutils/promiseReduce';
16
13
  import promiseForObject from '../jsutils/promiseForObject';
17
14
  import { addPath, pathToArray } from '../jsutils/Path';
@@ -54,6 +51,7 @@ import {
54
51
  GraphQLSkipDirective,
55
52
  } from '../type/directives';
56
53
  import {
54
+ isNamedType,
57
55
  isObjectType,
58
56
  isAbstractType,
59
57
  isLeafType,
@@ -388,8 +386,6 @@ function executeOperation(
388
386
  // Errors from sub-fields of a NonNull type may propagate to the top level,
389
387
  // at which point we still log the error and null the parent field, which
390
388
  // in this case is the entire response.
391
- //
392
- // Similar to completeValueCatchingError.
393
389
  try {
394
390
  const result =
395
391
  operation.operation === 'mutation'
@@ -474,7 +470,7 @@ function executeFields(
474
470
 
475
471
  if (result !== undefined) {
476
472
  results[responseName] = result;
477
- if (!containsPromise && isPromise(result)) {
473
+ if (isPromise(result)) {
478
474
  containsPromise = true;
479
475
  }
480
476
  }
@@ -645,6 +641,7 @@ function resolveField(
645
641
  return;
646
642
  }
647
643
 
644
+ const returnType = fieldDef.type;
648
645
  const resolveFn = fieldDef.resolve ?? exeContext.fieldResolver;
649
646
 
650
647
  const info = buildResolveInfo(
@@ -655,67 +652,7 @@ function resolveField(
655
652
  path,
656
653
  );
657
654
 
658
- // Get the resolve function, regardless of if its result is normal
659
- // or abrupt (error).
660
- const result = resolveFieldValueOrError(
661
- exeContext,
662
- fieldDef,
663
- fieldNodes,
664
- resolveFn,
665
- source,
666
- info,
667
- );
668
-
669
- return completeValueCatchingError(
670
- exeContext,
671
- fieldDef.type,
672
- fieldNodes,
673
- info,
674
- path,
675
- result,
676
- );
677
- }
678
-
679
- /**
680
- * @internal
681
- */
682
- export function buildResolveInfo(
683
- exeContext: ExecutionContext,
684
- fieldDef: GraphQLField<mixed, mixed>,
685
- fieldNodes: $ReadOnlyArray<FieldNode>,
686
- parentType: GraphQLObjectType,
687
- path: Path,
688
- ): GraphQLResolveInfo {
689
- // The resolve function's optional fourth argument is a collection of
690
- // information about the current execution state.
691
- return {
692
- fieldName: fieldDef.name,
693
- fieldNodes,
694
- returnType: fieldDef.type,
695
- parentType,
696
- path,
697
- schema: exeContext.schema,
698
- fragments: exeContext.fragments,
699
- rootValue: exeContext.rootValue,
700
- operation: exeContext.operation,
701
- variableValues: exeContext.variableValues,
702
- };
703
- }
704
-
705
- /**
706
- * Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField`
707
- * function. Returns the result of resolveFn or the abrupt-return Error object.
708
- *
709
- * @internal
710
- */
711
- export function resolveFieldValueOrError(
712
- exeContext: ExecutionContext,
713
- fieldDef: GraphQLField<mixed, mixed>,
714
- fieldNodes: $ReadOnlyArray<FieldNode>,
715
- resolveFn: GraphQLFieldResolver<mixed, mixed>,
716
- source: mixed,
717
- info: GraphQLResolveInfo,
718
- ): Error | mixed {
655
+ // Get the resolve function, regardless of if its result is normal or abrupt (error).
719
656
  try {
720
657
  // Build a JS object of arguments from the field.arguments AST, using the
721
658
  // variables scope to fulfill any variable references.
@@ -732,32 +669,7 @@ export function resolveFieldValueOrError(
732
669
  const contextValue = exeContext.contextValue;
733
670
 
734
671
  const result = resolveFn(source, args, contextValue, info);
735
- return isPromise(result) ? result.then(undefined, asErrorInstance) : result;
736
- } catch (error) {
737
- return asErrorInstance(error);
738
- }
739
- }
740
672
 
741
- // Sometimes a non-error is thrown, wrap it as an Error instance to ensure a
742
- // consistent Error interface.
743
- function asErrorInstance(error: mixed): Error {
744
- if (error instanceof Error) {
745
- return error;
746
- }
747
- return new Error('Unexpected error value: ' + inspect(error));
748
- }
749
-
750
- // This is a small wrapper around completeValue which detects and logs errors
751
- // in the execution context.
752
- function completeValueCatchingError(
753
- exeContext: ExecutionContext,
754
- returnType: GraphQLOutputType,
755
- fieldNodes: $ReadOnlyArray<FieldNode>,
756
- info: GraphQLResolveInfo,
757
- path: Path,
758
- result: mixed,
759
- ): PromiseOrValue<mixed> {
760
- try {
761
673
  let completed;
762
674
  if (isPromise(result)) {
763
675
  completed = result.then((resolved) =>
@@ -777,23 +689,49 @@ function completeValueCatchingError(
777
689
  if (isPromise(completed)) {
778
690
  // Note: we don't rely on a `catch` method, but we do expect "thenable"
779
691
  // to take a second callback for the error case.
780
- return completed.then(undefined, (error) =>
781
- handleFieldError(error, fieldNodes, path, returnType, exeContext),
782
- );
692
+ return completed.then(undefined, (rawError) => {
693
+ const error = locatedError(rawError, fieldNodes, pathToArray(path));
694
+ return handleFieldError(error, returnType, exeContext);
695
+ });
783
696
  }
784
697
  return completed;
785
- } catch (error) {
786
- return handleFieldError(error, fieldNodes, path, returnType, exeContext);
698
+ } catch (rawError) {
699
+ const error = locatedError(rawError, fieldNodes, pathToArray(path));
700
+ return handleFieldError(error, returnType, exeContext);
787
701
  }
788
702
  }
789
703
 
790
- function handleFieldError(rawError, fieldNodes, path, returnType, exeContext) {
791
- const error = locatedError(
792
- asErrorInstance(rawError),
704
+ /**
705
+ * @internal
706
+ */
707
+ export function buildResolveInfo(
708
+ exeContext: ExecutionContext,
709
+ fieldDef: GraphQLField<mixed, mixed>,
710
+ fieldNodes: $ReadOnlyArray<FieldNode>,
711
+ parentType: GraphQLObjectType,
712
+ path: Path,
713
+ ): GraphQLResolveInfo {
714
+ // The resolve function's optional fourth argument is a collection of
715
+ // information about the current execution state.
716
+ return {
717
+ fieldName: fieldDef.name,
793
718
  fieldNodes,
794
- pathToArray(path),
795
- );
719
+ returnType: fieldDef.type,
720
+ parentType,
721
+ path,
722
+ schema: exeContext.schema,
723
+ fragments: exeContext.fragments,
724
+ rootValue: exeContext.rootValue,
725
+ operation: exeContext.operation,
726
+ variableValues: exeContext.variableValues,
727
+ };
728
+ }
796
729
 
730
+ function handleFieldError(
731
+ error: GraphQLError,
732
+ returnType: GraphQLOutputType,
733
+ exeContext: ExecutionContext,
734
+ ): null {
797
735
  // If the field type is non-nullable, then it is resolved without any
798
736
  // protection from errors, however it still properly locates the error.
799
737
  if (isNonNullType(returnType)) {
@@ -928,36 +866,64 @@ function completeListValue(
928
866
  path: Path,
929
867
  result: mixed,
930
868
  ): PromiseOrValue<$ReadOnlyArray<mixed>> {
931
- if (!isCollection(result)) {
932
- throw new GraphQLError(
933
- `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`,
934
- );
935
- }
936
-
937
869
  // This is specified as a simple map, however we're optimizing the path
938
870
  // where the list contains no Promises by avoiding creating another Promise.
939
871
  const itemType = returnType.ofType;
940
872
  let containsPromise = false;
941
- const completedResults = arrayFrom(result, (item, index) => {
873
+ const completedResults = safeArrayFrom(result, (item, index) => {
942
874
  // No need to modify the info object containing the path,
943
875
  // since from here on it is not ever accessed by resolver functions.
944
- const fieldPath = addPath(path, index, undefined);
945
- const completedItem = completeValueCatchingError(
946
- exeContext,
947
- itemType,
948
- fieldNodes,
949
- info,
950
- fieldPath,
951
- item,
952
- );
876
+ const itemPath = addPath(path, index, undefined);
877
+ try {
878
+ let completedItem;
879
+ if (isPromise(item)) {
880
+ completedItem = item.then((resolved) =>
881
+ completeValue(
882
+ exeContext,
883
+ itemType,
884
+ fieldNodes,
885
+ info,
886
+ itemPath,
887
+ resolved,
888
+ ),
889
+ );
890
+ } else {
891
+ completedItem = completeValue(
892
+ exeContext,
893
+ itemType,
894
+ fieldNodes,
895
+ info,
896
+ itemPath,
897
+ item,
898
+ );
899
+ }
953
900
 
954
- if (!containsPromise && isPromise(completedItem)) {
955
- containsPromise = true;
901
+ if (isPromise(completedItem)) {
902
+ containsPromise = true;
903
+ // Note: we don't rely on a `catch` method, but we do expect "thenable"
904
+ // to take a second callback for the error case.
905
+ return completedItem.then(undefined, (rawError) => {
906
+ const error = locatedError(
907
+ rawError,
908
+ fieldNodes,
909
+ pathToArray(itemPath),
910
+ );
911
+ return handleFieldError(error, itemType, exeContext);
912
+ });
913
+ }
914
+ return completedItem;
915
+ } catch (rawError) {
916
+ const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
917
+ return handleFieldError(error, itemType, exeContext);
956
918
  }
957
-
958
- return completedItem;
959
919
  });
960
920
 
921
+ if (completedResults == null) {
922
+ throw new GraphQLError(
923
+ `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`,
924
+ );
925
+ }
926
+
961
927
  return containsPromise ? Promise.all(completedResults) : completedResults;
962
928
  }
963
929
 
@@ -1030,23 +996,43 @@ function completeAbstractValue(
1030
996
  }
1031
997
 
1032
998
  function ensureValidRuntimeType(
1033
- runtimeTypeOrName: ?GraphQLObjectType | string,
999
+ runtimeTypeOrName: mixed,
1034
1000
  exeContext: ExecutionContext,
1035
1001
  returnType: GraphQLAbstractType,
1036
1002
  fieldNodes: $ReadOnlyArray<FieldNode>,
1037
1003
  info: GraphQLResolveInfo,
1038
1004
  result: mixed,
1039
1005
  ): GraphQLObjectType {
1040
- const runtimeType =
1041
- typeof runtimeTypeOrName === 'string'
1042
- ? exeContext.schema.getType(runtimeTypeOrName)
1043
- : runtimeTypeOrName;
1006
+ if (runtimeTypeOrName == null) {
1007
+ throw new GraphQLError(
1008
+ `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,
1009
+ fieldNodes,
1010
+ );
1011
+ }
1044
1012
 
1045
- if (!isObjectType(runtimeType)) {
1013
+ // FIXME: temporary workaround until support for passing object types would be removed in v16.0.0
1014
+ const runtimeTypeName = isNamedType(runtimeTypeOrName)
1015
+ ? runtimeTypeOrName.name
1016
+ : runtimeTypeOrName;
1017
+
1018
+ if (typeof runtimeTypeName !== 'string') {
1046
1019
  throw new GraphQLError(
1047
1020
  `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` +
1048
- `value ${inspect(result)}, received "${inspect(runtimeType)}". ` +
1049
- `Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`,
1021
+ `value ${inspect(result)}, received "${inspect(runtimeTypeOrName)}".`,
1022
+ );
1023
+ }
1024
+
1025
+ const runtimeType = exeContext.schema.getType(runtimeTypeName);
1026
+ if (runtimeType == null) {
1027
+ throw new GraphQLError(
1028
+ `Abstract type "${returnType.name}" was resolve to a type "${runtimeTypeName}" that does not exist inside schema.`,
1029
+ fieldNodes,
1030
+ );
1031
+ }
1032
+
1033
+ if (!isObjectType(runtimeType)) {
1034
+ throw new GraphQLError(
1035
+ `Abstract type "${returnType.name}" was resolve to a non-object type "${runtimeTypeName}".`,
1050
1036
  fieldNodes,
1051
1037
  );
1052
1038
  }
@@ -1191,7 +1177,7 @@ export const defaultTypeResolver: GraphQLTypeResolver<mixed, mixed> = function (
1191
1177
  if (isPromise(isTypeOfResult)) {
1192
1178
  promisedIsTypeOfResults[i] = isTypeOfResult;
1193
1179
  } else if (isTypeOfResult) {
1194
- return type;
1180
+ return type.name;
1195
1181
  }
1196
1182
  }
1197
1183
  }
@@ -1200,7 +1186,7 @@ export const defaultTypeResolver: GraphQLTypeResolver<mixed, mixed> = function (
1200
1186
  return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => {
1201
1187
  for (let i = 0; i < isTypeOfResults.length; i++) {
1202
1188
  if (isTypeOfResults[i]) {
1203
- return possibleTypes[i];
1189
+ return possibleTypes[i].name;
1204
1190
  }
1205
1191
  }
1206
1192
  });
@@ -1,11 +1,10 @@
1
- import arrayFrom from "../polyfills/arrayFrom.mjs";
2
1
  import inspect from "../jsutils/inspect.mjs";
3
2
  import memoize3 from "../jsutils/memoize3.mjs";
4
3
  import invariant from "../jsutils/invariant.mjs";
5
4
  import devAssert from "../jsutils/devAssert.mjs";
6
5
  import isPromise from "../jsutils/isPromise.mjs";
7
6
  import isObjectLike from "../jsutils/isObjectLike.mjs";
8
- import isCollection from "../jsutils/isCollection.mjs";
7
+ import safeArrayFrom from "../jsutils/safeArrayFrom.mjs";
9
8
  import promiseReduce from "../jsutils/promiseReduce.mjs";
10
9
  import promiseForObject from "../jsutils/promiseForObject.mjs";
11
10
  import { addPath, pathToArray } from "../jsutils/Path.mjs";
@@ -15,7 +14,7 @@ import { Kind } from "../language/kinds.mjs";
15
14
  import { assertValidSchema } from "../type/validate.mjs";
16
15
  import { SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef } from "../type/introspection.mjs";
17
16
  import { GraphQLIncludeDirective, GraphQLSkipDirective } from "../type/directives.mjs";
18
- import { isObjectType, isAbstractType, isLeafType, isListType, isNonNullType } from "../type/definition.mjs";
17
+ import { isNamedType, isObjectType, isAbstractType, isLeafType, isListType, isNonNullType } from "../type/definition.mjs";
19
18
  import { typeFromAST } from "../utilities/typeFromAST.mjs";
20
19
  import { getOperationRootType } from "../utilities/getOperationRootType.mjs";
21
20
  import { getVariableValues, getArgumentValues, getDirectiveValues } from "./values.mjs";
@@ -220,8 +219,6 @@ function executeOperation(exeContext, operation, rootValue) {
220
219
  var path = undefined; // Errors from sub-fields of a NonNull type may propagate to the top level,
221
220
  // at which point we still log the error and null the parent field, which
222
221
  // in this case is the entire response.
223
- //
224
- // Similar to completeValueCatchingError.
225
222
 
226
223
  try {
227
224
  var result = operation.operation === 'mutation' ? executeFieldsSerially(exeContext, type, rootValue, path, fields) : executeFields(exeContext, type, rootValue, path, fields);
@@ -285,7 +282,7 @@ function executeFields(exeContext, parentType, sourceValue, path, fields) {
285
282
  if (result !== undefined) {
286
283
  results[responseName] = result;
287
284
 
288
- if (!containsPromise && isPromise(result)) {
285
+ if (isPromise(result)) {
289
286
  containsPromise = true;
290
287
  }
291
288
  }
@@ -438,42 +435,10 @@ function resolveField(exeContext, parentType, source, fieldNodes, path) {
438
435
  return;
439
436
  }
440
437
 
438
+ var returnType = fieldDef.type;
441
439
  var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
442
- var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path); // Get the resolve function, regardless of if its result is normal
443
- // or abrupt (error).
444
-
445
- var result = resolveFieldValueOrError(exeContext, fieldDef, fieldNodes, resolveFn, source, info);
446
- return completeValueCatchingError(exeContext, fieldDef.type, fieldNodes, info, path, result);
447
- }
448
- /**
449
- * @internal
450
- */
451
-
452
-
453
- export function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) {
454
- // The resolve function's optional fourth argument is a collection of
455
- // information about the current execution state.
456
- return {
457
- fieldName: fieldDef.name,
458
- fieldNodes: fieldNodes,
459
- returnType: fieldDef.type,
460
- parentType: parentType,
461
- path: path,
462
- schema: exeContext.schema,
463
- fragments: exeContext.fragments,
464
- rootValue: exeContext.rootValue,
465
- operation: exeContext.operation,
466
- variableValues: exeContext.variableValues
467
- };
468
- }
469
- /**
470
- * Isolates the "ReturnOrAbrupt" behavior to not de-opt the `resolveField`
471
- * function. Returns the result of resolveFn or the abrupt-return Error object.
472
- *
473
- * @internal
474
- */
440
+ var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path); // Get the resolve function, regardless of if its result is normal or abrupt (error).
475
441
 
476
- export function resolveFieldValueOrError(exeContext, fieldDef, fieldNodes, resolveFn, source, info) {
477
442
  try {
478
443
  // Build a JS object of arguments from the field.arguments AST, using the
479
444
  // variables scope to fulfill any variable references.
@@ -484,25 +449,6 @@ export function resolveFieldValueOrError(exeContext, fieldDef, fieldNodes, resol
484
449
 
485
450
  var _contextValue = exeContext.contextValue;
486
451
  var result = resolveFn(source, args, _contextValue, info);
487
- return isPromise(result) ? result.then(undefined, asErrorInstance) : result;
488
- } catch (error) {
489
- return asErrorInstance(error);
490
- }
491
- } // Sometimes a non-error is thrown, wrap it as an Error instance to ensure a
492
- // consistent Error interface.
493
-
494
- function asErrorInstance(error) {
495
- if (error instanceof Error) {
496
- return error;
497
- }
498
-
499
- return new Error('Unexpected error value: ' + inspect(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
452
  var completed;
507
453
 
508
454
  if (isPromise(result)) {
@@ -516,21 +462,43 @@ function completeValueCatchingError(exeContext, returnType, fieldNodes, info, pa
516
462
  if (isPromise(completed)) {
517
463
  // Note: we don't rely on a `catch` method, but we do expect "thenable"
518
464
  // to take a second callback for the error case.
519
- return completed.then(undefined, function (error) {
520
- return handleFieldError(error, fieldNodes, path, returnType, exeContext);
465
+ return completed.then(undefined, function (rawError) {
466
+ var error = locatedError(rawError, fieldNodes, pathToArray(path));
467
+ return handleFieldError(error, returnType, exeContext);
521
468
  });
522
469
  }
523
470
 
524
471
  return completed;
525
- } catch (error) {
526
- return handleFieldError(error, fieldNodes, path, returnType, exeContext);
472
+ } catch (rawError) {
473
+ var error = locatedError(rawError, fieldNodes, pathToArray(path));
474
+ return handleFieldError(error, returnType, exeContext);
527
475
  }
528
476
  }
477
+ /**
478
+ * @internal
479
+ */
480
+
481
+
482
+ export function buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path) {
483
+ // The resolve function's optional fourth argument is a collection of
484
+ // information about the current execution state.
485
+ return {
486
+ fieldName: fieldDef.name,
487
+ fieldNodes: fieldNodes,
488
+ returnType: fieldDef.type,
489
+ parentType: parentType,
490
+ path: path,
491
+ schema: exeContext.schema,
492
+ fragments: exeContext.fragments,
493
+ rootValue: exeContext.rootValue,
494
+ operation: exeContext.operation,
495
+ variableValues: exeContext.variableValues
496
+ };
497
+ }
529
498
 
530
- function handleFieldError(rawError, fieldNodes, path, returnType, exeContext) {
531
- var error = locatedError(asErrorInstance(rawError), fieldNodes, pathToArray(path)); // If the field type is non-nullable, then it is resolved without any
499
+ function handleFieldError(error, returnType, exeContext) {
500
+ // If the field type is non-nullable, then it is resolved without any
532
501
  // protection from errors, however it still properly locates the error.
533
-
534
502
  if (isNonNullType(returnType)) {
535
503
  throw error;
536
504
  } // Otherwise, error protection is applied, logging the error and resolving
@@ -619,26 +587,47 @@ function completeValue(exeContext, returnType, fieldNodes, info, path, result) {
619
587
 
620
588
 
621
589
  function completeListValue(exeContext, returnType, fieldNodes, info, path, result) {
622
- if (!isCollection(result)) {
623
- throw new GraphQLError("Expected Iterable, but did not find one for field \"".concat(info.parentType.name, ".").concat(info.fieldName, "\"."));
624
- } // This is specified as a simple map, however we're optimizing the path
590
+ // This is specified as a simple map, however we're optimizing the path
625
591
  // where the list contains no Promises by avoiding creating another Promise.
626
-
627
-
628
592
  var itemType = returnType.ofType;
629
593
  var containsPromise = false;
630
- var completedResults = arrayFrom(result, function (item, index) {
594
+ var completedResults = safeArrayFrom(result, function (item, index) {
631
595
  // No need to modify the info object containing the path,
632
596
  // since from here on it is not ever accessed by resolver functions.
633
- var fieldPath = addPath(path, index, undefined);
634
- var completedItem = completeValueCatchingError(exeContext, itemType, fieldNodes, info, fieldPath, item);
597
+ var itemPath = addPath(path, index, undefined);
635
598
 
636
- if (!containsPromise && isPromise(completedItem)) {
637
- containsPromise = true;
638
- }
599
+ try {
600
+ var completedItem;
601
+
602
+ if (isPromise(item)) {
603
+ completedItem = item.then(function (resolved) {
604
+ return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved);
605
+ });
606
+ } else {
607
+ completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item);
608
+ }
639
609
 
640
- return completedItem;
610
+ if (isPromise(completedItem)) {
611
+ containsPromise = true; // Note: we don't rely on a `catch` method, but we do expect "thenable"
612
+ // to take a second callback for the error case.
613
+
614
+ return completedItem.then(undefined, function (rawError) {
615
+ var error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
616
+ return handleFieldError(error, itemType, exeContext);
617
+ });
618
+ }
619
+
620
+ return completedItem;
621
+ } catch (rawError) {
622
+ var error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
623
+ return handleFieldError(error, itemType, exeContext);
624
+ }
641
625
  });
626
+
627
+ if (completedResults == null) {
628
+ throw new GraphQLError("Expected Iterable, but did not find one for field \"".concat(info.parentType.name, ".").concat(info.fieldName, "\"."));
629
+ }
630
+
642
631
  return containsPromise ? Promise.all(completedResults) : completedResults;
643
632
  }
644
633
  /**
@@ -679,10 +668,25 @@ function completeAbstractValue(exeContext, returnType, fieldNodes, info, path, r
679
668
  }
680
669
 
681
670
  function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) {
682
- var runtimeType = typeof runtimeTypeOrName === 'string' ? exeContext.schema.getType(runtimeTypeOrName) : runtimeTypeOrName;
671
+ if (runtimeTypeOrName == null) {
672
+ throw new 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);
673
+ } // FIXME: temporary workaround until support for passing object types would be removed in v16.0.0
674
+
675
+
676
+ var runtimeTypeName = isNamedType(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName;
677
+
678
+ if (typeof runtimeTypeName !== 'string') {
679
+ throw new 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(inspect(result), ", received \"").concat(inspect(runtimeTypeOrName), "\"."));
680
+ }
681
+
682
+ var runtimeType = exeContext.schema.getType(runtimeTypeName);
683
+
684
+ if (runtimeType == null) {
685
+ throw new GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a type \"").concat(runtimeTypeName, "\" that does not exist inside schema."), fieldNodes);
686
+ }
683
687
 
684
688
  if (!isObjectType(runtimeType)) {
685
- throw new 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(inspect(result), ", received \"").concat(inspect(runtimeType), "\". ") + "Either the \"".concat(returnType.name, "\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function."), fieldNodes);
689
+ throw new GraphQLError("Abstract type \"".concat(returnType.name, "\" was resolve to a non-object type \"").concat(runtimeTypeName, "\"."), fieldNodes);
686
690
  }
687
691
 
688
692
  if (!exeContext.schema.isSubType(returnType, runtimeType)) {
@@ -784,7 +788,7 @@ export var defaultTypeResolver = function defaultTypeResolver(value, contextValu
784
788
  if (isPromise(isTypeOfResult)) {
785
789
  promisedIsTypeOfResults[i] = isTypeOfResult;
786
790
  } else if (isTypeOfResult) {
787
- return type;
791
+ return type.name;
788
792
  }
789
793
  }
790
794
  }
@@ -793,7 +797,7 @@ export var defaultTypeResolver = function defaultTypeResolver(value, contextValu
793
797
  return Promise.all(promisedIsTypeOfResults).then(function (isTypeOfResults) {
794
798
  for (var _i9 = 0; _i9 < isTypeOfResults.length; _i9++) {
795
799
  if (isTypeOfResults[_i9]) {
796
- return possibleTypes[_i9];
800
+ return possibleTypes[_i9].name;
797
801
  }
798
802
  }
799
803
  });
@@ -40,8 +40,8 @@ Object.defineProperty(exports, "getDirectiveValues", {
40
40
  }
41
41
  });
42
42
 
43
- var _Path = require("../jsutils/Path");
43
+ var _Path = require("../jsutils/Path.js");
44
44
 
45
- var _execute = require("./execute");
45
+ var _execute = require("./execute.js");
46
46
 
47
- var _values = require("./values");
47
+ var _values = require("./values.js");
@@ -1,5 +1,4 @@
1
1
  // @flow strict
2
-
3
2
  export { pathToArray as responsePathAsArray } from '../jsutils/Path';
4
3
 
5
4
  export {