graphql 14.1.1 → 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 (377) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/error/GraphQLError.js +12 -10
  4. package/error/GraphQLError.js.flow +11 -6
  5. package/error/GraphQLError.mjs +20 -3
  6. package/error/formatError.js +2 -2
  7. package/error/formatError.js.flow +3 -3
  8. package/error/formatError.mjs +2 -2
  9. package/error/index.js +1 -1
  10. package/error/index.js.flow +5 -2
  11. package/error/index.mjs +2 -2
  12. package/error/locatedError.js +2 -2
  13. package/error/locatedError.js.flow +2 -2
  14. package/error/locatedError.mjs +2 -2
  15. package/error/printError.js +2 -2
  16. package/error/printError.js.flow +4 -5
  17. package/error/printError.mjs +2 -2
  18. package/error/syntaxError.js +2 -2
  19. package/error/syntaxError.js.flow +2 -2
  20. package/error/syntaxError.mjs +2 -2
  21. package/execution/execute.js +52 -37
  22. package/execution/execute.js.flow +66 -51
  23. package/execution/execute.mjs +50 -38
  24. package/execution/index.js +7 -1
  25. package/execution/index.js.flow +9 -4
  26. package/execution/index.mjs +3 -3
  27. package/execution/values.js +11 -11
  28. package/execution/values.js.flow +23 -19
  29. package/execution/values.mjs +11 -11
  30. package/graphql.js +13 -9
  31. package/graphql.js.flow +28 -10
  32. package/graphql.mjs +10 -9
  33. package/index.js +83 -53
  34. package/index.js.flow +60 -47
  35. package/index.mjs +26 -23
  36. package/jsutils/ObjMap.js +1 -1
  37. package/jsutils/ObjMap.js.flow +1 -1
  38. package/jsutils/ObjMap.mjs +1 -0
  39. package/jsutils/PromiseOrValue.js +1 -0
  40. package/jsutils/{MaybePromise.js.flow → PromiseOrValue.js.flow} +2 -2
  41. package/jsutils/PromiseOrValue.mjs +1 -0
  42. package/jsutils/dedent.js +2 -2
  43. package/jsutils/dedent.js.flow +1 -1
  44. package/jsutils/dedent.mjs +2 -2
  45. package/jsutils/defineToJSON.js +2 -2
  46. package/jsutils/defineToJSON.js.flow +1 -1
  47. package/jsutils/defineToJSON.mjs +2 -2
  48. package/jsutils/defineToStringTag.js +2 -2
  49. package/jsutils/defineToStringTag.js.flow +1 -1
  50. package/jsutils/defineToStringTag.mjs +2 -2
  51. package/jsutils/inspect.js +94 -19
  52. package/jsutils/inspect.js.flow +98 -20
  53. package/jsutils/inspect.mjs +94 -20
  54. package/jsutils/instanceOf.js +2 -2
  55. package/jsutils/instanceOf.js.flow +1 -1
  56. package/jsutils/instanceOf.mjs +2 -2
  57. package/jsutils/invariant.js +5 -3
  58. package/jsutils/invariant.js.flow +3 -2
  59. package/jsutils/invariant.mjs +5 -3
  60. package/jsutils/isInvalid.js +2 -2
  61. package/jsutils/isInvalid.js.flow +1 -1
  62. package/jsutils/isInvalid.mjs +2 -2
  63. package/jsutils/isNullish.js +2 -2
  64. package/jsutils/isNullish.js.flow +1 -1
  65. package/jsutils/isNullish.mjs +2 -2
  66. package/jsutils/isPromise.js +2 -2
  67. package/jsutils/isPromise.js.flow +1 -1
  68. package/jsutils/isPromise.mjs +2 -2
  69. package/jsutils/keyMap.js +4 -3
  70. package/jsutils/keyMap.js.flow +6 -6
  71. package/jsutils/keyMap.mjs +4 -3
  72. package/jsutils/keyValMap.js +4 -3
  73. package/jsutils/keyValMap.js.flow +6 -6
  74. package/jsutils/keyValMap.mjs +4 -3
  75. package/jsutils/mapValue.js +2 -2
  76. package/jsutils/mapValue.js.flow +2 -2
  77. package/jsutils/mapValue.mjs +2 -2
  78. package/jsutils/memoize3.js +3 -3
  79. package/jsutils/memoize3.js.flow +2 -2
  80. package/jsutils/memoize3.mjs +3 -3
  81. package/jsutils/nodejsCustomInspectSymbol.js +2 -2
  82. package/jsutils/nodejsCustomInspectSymbol.js.flow +1 -1
  83. package/jsutils/nodejsCustomInspectSymbol.mjs +2 -2
  84. package/jsutils/orList.js +2 -2
  85. package/jsutils/orList.js.flow +1 -1
  86. package/jsutils/orList.mjs +2 -2
  87. package/jsutils/promiseForObject.js +2 -2
  88. package/jsutils/promiseForObject.js.flow +2 -2
  89. package/jsutils/promiseForObject.mjs +2 -2
  90. package/jsutils/promiseReduce.js +2 -2
  91. package/jsutils/promiseReduce.js.flow +5 -5
  92. package/jsutils/promiseReduce.mjs +2 -2
  93. package/jsutils/quotedOrList.js +2 -2
  94. package/jsutils/quotedOrList.js.flow +1 -1
  95. package/jsutils/quotedOrList.mjs +2 -2
  96. package/jsutils/suggestionList.js +2 -2
  97. package/jsutils/suggestionList.js.flow +1 -1
  98. package/jsutils/suggestionList.mjs +2 -2
  99. package/language/ast.js +1 -1
  100. package/language/ast.js.flow +3 -3
  101. package/language/ast.mjs +1 -0
  102. package/language/blockString.js +114 -0
  103. package/language/blockString.js.flow +102 -0
  104. package/language/blockString.mjs +104 -0
  105. package/language/directiveLocation.js +2 -2
  106. package/language/directiveLocation.js.flow +1 -1
  107. package/language/directiveLocation.mjs +2 -2
  108. package/language/index.js +9 -9
  109. package/language/index.js.flow +10 -5
  110. package/language/index.mjs +3 -3
  111. package/language/kinds.js +2 -2
  112. package/language/kinds.js.flow +1 -1
  113. package/language/kinds.mjs +2 -2
  114. package/language/lexer.js +52 -44
  115. package/language/lexer.js.flow +65 -54
  116. package/language/lexer.mjs +49 -43
  117. package/language/location.js +2 -2
  118. package/language/location.js.flow +2 -2
  119. package/language/location.mjs +2 -2
  120. package/language/parser.js +75 -67
  121. package/language/parser.js.flow +138 -127
  122. package/language/parser.mjs +76 -68
  123. package/language/predicates.js +2 -2
  124. package/language/predicates.js.flow +2 -2
  125. package/language/predicates.mjs +2 -2
  126. package/language/printer.js +6 -14
  127. package/language/printer.js.flow +8 -17
  128. package/language/printer.mjs +5 -14
  129. package/language/source.js +2 -2
  130. package/language/source.js.flow +1 -1
  131. package/language/source.mjs +2 -2
  132. package/language/visitor.js +4 -6
  133. package/language/visitor.js.flow +3 -3
  134. package/language/visitor.mjs +4 -6
  135. package/package.json +1 -1
  136. package/polyfills/find.js +2 -2
  137. package/polyfills/find.js.flow +1 -1
  138. package/polyfills/find.mjs +2 -2
  139. package/polyfills/flatMap.js +38 -0
  140. package/polyfills/flatMap.js.flow +34 -0
  141. package/polyfills/flatMap.mjs +30 -0
  142. package/polyfills/isFinite.js +2 -2
  143. package/polyfills/isFinite.js.flow +1 -1
  144. package/polyfills/isFinite.mjs +2 -2
  145. package/polyfills/isInteger.js +2 -2
  146. package/polyfills/isInteger.js.flow +1 -1
  147. package/polyfills/isInteger.mjs +2 -2
  148. package/polyfills/objectEntries.js +2 -2
  149. package/polyfills/objectEntries.js.flow +2 -2
  150. package/polyfills/objectEntries.mjs +2 -2
  151. package/polyfills/objectValues.js +2 -2
  152. package/polyfills/objectValues.js.flow +2 -2
  153. package/polyfills/objectValues.mjs +2 -2
  154. package/subscription/asyncIteratorReject.js +1 -1
  155. package/subscription/asyncIteratorReject.js.flow +1 -1
  156. package/subscription/asyncIteratorReject.mjs +2 -2
  157. package/subscription/index.js +1 -1
  158. package/subscription/index.js.flow +1 -1
  159. package/subscription/index.mjs +2 -2
  160. package/subscription/mapAsyncIterator.js +1 -1
  161. package/subscription/mapAsyncIterator.js.flow +5 -5
  162. package/subscription/mapAsyncIterator.mjs +2 -2
  163. package/subscription/subscribe.js +2 -2
  164. package/subscription/subscribe.js.flow +6 -6
  165. package/subscription/subscribe.mjs +2 -2
  166. package/type/definition.js +138 -22
  167. package/type/definition.js.flow +184 -36
  168. package/type/definition.mjs +136 -23
  169. package/type/directives.js +14 -3
  170. package/type/directives.js.flow +24 -11
  171. package/type/directives.mjs +16 -5
  172. package/type/index.js +7 -7
  173. package/type/index.js.flow +8 -4
  174. package/type/index.mjs +10 -6
  175. package/type/introspection.js +14 -9
  176. package/type/introspection.js.flow +12 -18
  177. package/type/introspection.mjs +14 -9
  178. package/type/scalars.js +5 -4
  179. package/type/scalars.js.flow +4 -10
  180. package/type/scalars.mjs +7 -6
  181. package/type/schema.js +55 -3
  182. package/type/schema.js.flow +73 -17
  183. package/type/schema.mjs +56 -4
  184. package/type/validate.js +19 -47
  185. package/type/validate.js.flow +17 -29
  186. package/type/validate.mjs +18 -47
  187. package/utilities/TypeInfo.js +93 -73
  188. package/utilities/TypeInfo.js.flow +30 -23
  189. package/utilities/TypeInfo.mjs +93 -73
  190. package/utilities/assertValidName.js +2 -2
  191. package/utilities/assertValidName.js.flow +2 -2
  192. package/utilities/assertValidName.mjs +2 -2
  193. package/utilities/astFromValue.js +5 -4
  194. package/utilities/astFromValue.js.flow +8 -7
  195. package/utilities/astFromValue.mjs +7 -6
  196. package/utilities/buildASTSchema.js +63 -62
  197. package/utilities/buildASTSchema.js.flow +92 -108
  198. package/utilities/buildASTSchema.mjs +61 -62
  199. package/utilities/buildClientSchema.js +38 -45
  200. package/utilities/buildClientSchema.js.flow +66 -79
  201. package/utilities/buildClientSchema.mjs +37 -44
  202. package/utilities/coerceValue.js +6 -7
  203. package/utilities/coerceValue.js.flow +5 -4
  204. package/utilities/coerceValue.mjs +7 -8
  205. package/utilities/concatAST.js +9 -13
  206. package/utilities/concatAST.js.flow +4 -10
  207. package/utilities/concatAST.mjs +6 -13
  208. package/utilities/extendSchema.js +219 -511
  209. package/utilities/extendSchema.js.flow +195 -304
  210. package/utilities/extendSchema.mjs +218 -512
  211. package/utilities/findBreakingChanges.js +54 -95
  212. package/utilities/findBreakingChanges.js.flow +49 -47
  213. package/utilities/findBreakingChanges.mjs +80 -95
  214. package/utilities/findDeprecatedUsages.js +4 -4
  215. package/utilities/findDeprecatedUsages.js.flow +5 -5
  216. package/utilities/findDeprecatedUsages.mjs +4 -4
  217. package/utilities/getOperationAST.js +2 -2
  218. package/utilities/getOperationAST.js.flow +5 -2
  219. package/utilities/getOperationAST.mjs +2 -2
  220. package/utilities/getOperationRootType.js +24 -24
  221. package/utilities/getOperationRootType.js.flow +40 -35
  222. package/utilities/getOperationRootType.mjs +24 -24
  223. package/utilities/index.js +9 -1
  224. package/utilities/index.js.flow +13 -6
  225. package/utilities/index.mjs +13 -8
  226. package/utilities/introspectionFromSchema.js +6 -4
  227. package/utilities/introspectionFromSchema.js.flow +8 -7
  228. package/utilities/introspectionFromSchema.mjs +6 -5
  229. package/utilities/introspectionQuery.js +2 -2
  230. package/utilities/introspectionQuery.js.flow +2 -2
  231. package/utilities/introspectionQuery.mjs +2 -2
  232. package/utilities/isValidJSValue.js +4 -2
  233. package/utilities/isValidJSValue.js.flow +3 -2
  234. package/utilities/isValidJSValue.mjs +4 -2
  235. package/utilities/isValidLiteralValue.js +2 -2
  236. package/utilities/isValidLiteralValue.js.flow +4 -4
  237. package/utilities/isValidLiteralValue.mjs +2 -2
  238. package/utilities/lexicographicSortSchema.js +84 -123
  239. package/utilities/lexicographicSortSchema.js.flow +68 -96
  240. package/utilities/lexicographicSortSchema.mjs +84 -123
  241. package/utilities/schemaPrinter.js +47 -73
  242. package/utilities/schemaPrinter.js.flow +69 -120
  243. package/utilities/schemaPrinter.mjs +45 -72
  244. package/utilities/separateOperations.js +8 -12
  245. package/utilities/separateOperations.js.flow +6 -3
  246. package/utilities/separateOperations.mjs +8 -12
  247. package/utilities/stripIgnoredCharacters.js +140 -0
  248. package/utilities/stripIgnoredCharacters.js.flow +129 -0
  249. package/utilities/stripIgnoredCharacters.mjs +127 -0
  250. package/utilities/typeComparators.js +2 -2
  251. package/utilities/typeComparators.js.flow +4 -3
  252. package/utilities/typeComparators.mjs +2 -2
  253. package/utilities/typeFromAST.js +9 -4
  254. package/utilities/typeFromAST.js.flow +15 -9
  255. package/utilities/typeFromAST.mjs +6 -4
  256. package/utilities/valueFromAST.js +7 -4
  257. package/utilities/valueFromAST.js.flow +7 -5
  258. package/utilities/valueFromAST.mjs +6 -4
  259. package/utilities/valueFromASTUntyped.js +11 -6
  260. package/utilities/valueFromASTUntyped.js.flow +9 -5
  261. package/utilities/valueFromASTUntyped.mjs +10 -6
  262. package/validation/ValidationContext.js +1 -1
  263. package/validation/ValidationContext.js.flow +19 -20
  264. package/validation/ValidationContext.mjs +2 -2
  265. package/validation/index.js +1 -1
  266. package/validation/index.js.flow +2 -1
  267. package/validation/index.mjs +3 -2
  268. package/validation/rules/ExecutableDefinitions.js +3 -3
  269. package/validation/rules/ExecutableDefinitions.js.flow +4 -4
  270. package/validation/rules/ExecutableDefinitions.mjs +3 -3
  271. package/validation/rules/FieldsOnCorrectType.js +3 -3
  272. package/validation/rules/FieldsOnCorrectType.js.flow +7 -7
  273. package/validation/rules/FieldsOnCorrectType.mjs +3 -3
  274. package/validation/rules/FragmentsOnCompositeTypes.js +4 -4
  275. package/validation/rules/FragmentsOnCompositeTypes.js.flow +5 -5
  276. package/validation/rules/FragmentsOnCompositeTypes.mjs +4 -4
  277. package/validation/rules/KnownArgumentNames.js +1 -1
  278. package/validation/rules/KnownArgumentNames.js.flow +5 -5
  279. package/validation/rules/KnownArgumentNames.mjs +2 -2
  280. package/validation/rules/KnownDirectives.js +8 -6
  281. package/validation/rules/KnownDirectives.js.flow +11 -9
  282. package/validation/rules/KnownDirectives.mjs +8 -6
  283. package/validation/rules/KnownFragmentNames.js +3 -3
  284. package/validation/rules/KnownFragmentNames.js.flow +4 -4
  285. package/validation/rules/KnownFragmentNames.mjs +3 -3
  286. package/validation/rules/KnownTypeNames.js +2 -2
  287. package/validation/rules/KnownTypeNames.js.flow +6 -6
  288. package/validation/rules/KnownTypeNames.mjs +2 -2
  289. package/validation/rules/LoneAnonymousOperation.js +3 -3
  290. package/validation/rules/LoneAnonymousOperation.js.flow +4 -4
  291. package/validation/rules/LoneAnonymousOperation.mjs +3 -3
  292. package/validation/rules/LoneSchemaDefinition.js +2 -2
  293. package/validation/rules/LoneSchemaDefinition.js.flow +3 -3
  294. package/validation/rules/LoneSchemaDefinition.mjs +2 -2
  295. package/validation/rules/NoFragmentCycles.js +2 -2
  296. package/validation/rules/NoFragmentCycles.js.flow +4 -4
  297. package/validation/rules/NoFragmentCycles.mjs +2 -2
  298. package/validation/rules/NoUndefinedVariables.js +2 -2
  299. package/validation/rules/NoUndefinedVariables.js.flow +3 -3
  300. package/validation/rules/NoUndefinedVariables.mjs +2 -2
  301. package/validation/rules/NoUnusedFragments.js +7 -7
  302. package/validation/rules/NoUnusedFragments.js.flow +4 -4
  303. package/validation/rules/NoUnusedFragments.mjs +7 -7
  304. package/validation/rules/NoUnusedVariables.js +5 -5
  305. package/validation/rules/NoUnusedVariables.js.flow +6 -5
  306. package/validation/rules/NoUnusedVariables.mjs +5 -5
  307. package/validation/rules/OverlappingFieldsCanBeMerged.js +26 -23
  308. package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +17 -17
  309. package/validation/rules/OverlappingFieldsCanBeMerged.mjs +26 -23
  310. package/validation/rules/PossibleFragmentSpreads.js +4 -4
  311. package/validation/rules/PossibleFragmentSpreads.js.flow +5 -5
  312. package/validation/rules/PossibleFragmentSpreads.mjs +4 -4
  313. package/validation/rules/PossibleTypeExtensions.js +3 -3
  314. package/validation/rules/PossibleTypeExtensions.js.flow +5 -5
  315. package/validation/rules/PossibleTypeExtensions.mjs +4 -4
  316. package/validation/rules/ProvidedRequiredArguments.js +6 -8
  317. package/validation/rules/ProvidedRequiredArguments.js.flow +8 -8
  318. package/validation/rules/ProvidedRequiredArguments.mjs +7 -9
  319. package/validation/rules/ScalarLeafs.js +4 -4
  320. package/validation/rules/ScalarLeafs.js.flow +6 -6
  321. package/validation/rules/ScalarLeafs.mjs +4 -4
  322. package/validation/rules/SingleFieldSubscriptions.js +2 -2
  323. package/validation/rules/SingleFieldSubscriptions.js.flow +4 -4
  324. package/validation/rules/SingleFieldSubscriptions.mjs +2 -2
  325. package/validation/rules/UniqueArgumentNames.js +2 -2
  326. package/validation/rules/UniqueArgumentNames.js.flow +3 -3
  327. package/validation/rules/UniqueArgumentNames.mjs +2 -2
  328. package/validation/rules/UniqueDirectiveNames.js +2 -2
  329. package/validation/rules/UniqueDirectiveNames.js.flow +3 -3
  330. package/validation/rules/UniqueDirectiveNames.mjs +2 -2
  331. package/validation/rules/UniqueDirectivesPerLocation.js +3 -2
  332. package/validation/rules/UniqueDirectivesPerLocation.js.flow +4 -4
  333. package/validation/rules/UniqueDirectivesPerLocation.mjs +3 -2
  334. package/validation/rules/UniqueEnumValueNames.js +4 -8
  335. package/validation/rules/UniqueEnumValueNames.js.flow +6 -8
  336. package/validation/rules/UniqueEnumValueNames.mjs +4 -8
  337. package/validation/rules/UniqueFieldDefinitionNames.js +4 -8
  338. package/validation/rules/UniqueFieldDefinitionNames.js.flow +6 -8
  339. package/validation/rules/UniqueFieldDefinitionNames.mjs +4 -8
  340. package/validation/rules/UniqueFragmentNames.js +2 -2
  341. package/validation/rules/UniqueFragmentNames.js.flow +3 -3
  342. package/validation/rules/UniqueFragmentNames.mjs +2 -2
  343. package/validation/rules/UniqueInputFieldNames.js +2 -4
  344. package/validation/rules/UniqueInputFieldNames.js.flow +3 -4
  345. package/validation/rules/UniqueInputFieldNames.mjs +2 -4
  346. package/validation/rules/UniqueOperationNames.js +2 -2
  347. package/validation/rules/UniqueOperationNames.js.flow +3 -3
  348. package/validation/rules/UniqueOperationNames.mjs +2 -2
  349. package/validation/rules/UniqueOperationTypes.js +2 -2
  350. package/validation/rules/UniqueOperationTypes.js.flow +3 -3
  351. package/validation/rules/UniqueOperationTypes.mjs +2 -2
  352. package/validation/rules/UniqueTypeNames.js +2 -2
  353. package/validation/rules/UniqueTypeNames.js.flow +4 -4
  354. package/validation/rules/UniqueTypeNames.mjs +2 -2
  355. package/validation/rules/UniqueVariableNames.js +2 -2
  356. package/validation/rules/UniqueVariableNames.js.flow +4 -4
  357. package/validation/rules/UniqueVariableNames.mjs +2 -2
  358. package/validation/rules/ValuesOfCorrectType.js +2 -2
  359. package/validation/rules/ValuesOfCorrectType.js.flow +5 -5
  360. package/validation/rules/ValuesOfCorrectType.mjs +2 -2
  361. package/validation/rules/VariablesAreInputTypes.js +3 -3
  362. package/validation/rules/VariablesAreInputTypes.js.flow +5 -5
  363. package/validation/rules/VariablesAreInputTypes.mjs +3 -3
  364. package/validation/rules/VariablesInAllowedPosition.js +3 -3
  365. package/validation/rules/VariablesInAllowedPosition.js.flow +7 -8
  366. package/validation/rules/VariablesInAllowedPosition.mjs +3 -3
  367. package/validation/specifiedRules.js +2 -2
  368. package/validation/specifiedRules.js.flow +13 -6
  369. package/validation/specifiedRules.mjs +7 -7
  370. package/validation/validate.js +2 -2
  371. package/validation/validate.js.flow +10 -6
  372. package/validation/validate.mjs +2 -2
  373. package/jsutils/MaybePromise.js +0 -1
  374. package/jsutils/MaybePromise.mjs +0 -0
  375. package/language/blockStringValue.js +0 -73
  376. package/language/blockStringValue.js.flow +0 -64
  377. package/language/blockStringValue.mjs +0 -66
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -8,10 +8,11 @@
8
8
  */
9
9
 
10
10
  import objectValues from '../polyfills/objectValues';
11
- import isInvalid from '../jsutils/isInvalid';
11
+ import inspect from '../jsutils/inspect';
12
12
  import { astFromValue } from '../utilities/astFromValue';
13
13
  import { print } from '../language/printer';
14
14
  import {
15
+ type GraphQLField,
15
16
  GraphQLObjectType,
16
17
  GraphQLEnumType,
17
18
  GraphQLList,
@@ -29,7 +30,6 @@ import {
29
30
  } from './definition';
30
31
  import { GraphQLString, GraphQLBoolean } from './scalars';
31
32
  import { DirectiveLocation } from '../language/directiveLocation';
32
- import type { GraphQLField } from './definition';
33
33
 
34
34
  export const __Schema = new GraphQLObjectType({
35
35
  name: '__Schema',
@@ -218,7 +218,10 @@ export const __Type = new GraphQLObjectType({
218
218
  } else if (isNonNullType(type)) {
219
219
  return TypeKind.NON_NULL;
220
220
  }
221
- throw new Error('Unknown kind of type: ' + type);
221
+
222
+ // Not reachable. All possible types have been considered.
223
+ /* istanbul ignore next */
224
+ throw new Error(`Unexpected type: "${inspect((type: empty))}".`);
222
225
  },
223
226
  },
224
227
  name: {
@@ -348,10 +351,10 @@ export const __InputValue = new GraphQLObjectType({
348
351
  description:
349
352
  'A GraphQL-formatted string representing the default value for this ' +
350
353
  'input value.',
351
- resolve: inputVal =>
352
- isInvalid(inputVal.defaultValue)
353
- ? null
354
- : print(astFromValue(inputVal.defaultValue, inputVal.type)),
354
+ resolve(inputVal) {
355
+ const valueAST = astFromValue(inputVal.defaultValue, inputVal.type);
356
+ return valueAST ? print(valueAST) : null;
357
+ },
355
358
  },
356
359
  }),
357
360
  });
@@ -484,15 +487,6 @@ export const introspectionTypes: $ReadOnlyArray<*> = [
484
487
  export function isIntrospectionType(type: mixed): boolean %checks {
485
488
  return (
486
489
  isNamedType(type) &&
487
- // Would prefer to use introspectionTypes.some(), however %checks needs
488
- // a simple expression.
489
- (type.name === __Schema.name ||
490
- type.name === __Directive.name ||
491
- type.name === __DirectiveLocation.name ||
492
- type.name === __Type.name ||
493
- type.name === __Field.name ||
494
- type.name === __InputValue.name ||
495
- type.name === __EnumValue.name ||
496
- type.name === __TypeKind.name)
490
+ introspectionTypes.some(({ name }) => type.name === name)
497
491
  );
498
492
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -7,7 +7,7 @@
7
7
  *
8
8
  */
9
9
  import objectValues from '../polyfills/objectValues';
10
- import isInvalid from '../jsutils/isInvalid';
10
+ import inspect from '../jsutils/inspect';
11
11
  import { astFromValue } from '../utilities/astFromValue';
12
12
  import { print } from '../language/printer';
13
13
  import { GraphQLObjectType, GraphQLEnumType, GraphQLList, GraphQLNonNull, isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isListType, isNonNullType, isAbstractType, isNamedType } from './definition';
@@ -194,9 +194,12 @@ export var __Type = new GraphQLObjectType({
194
194
  return TypeKind.LIST;
195
195
  } else if (isNonNullType(type)) {
196
196
  return TypeKind.NON_NULL;
197
- }
197
+ } // Not reachable. All possible types have been considered.
198
+
199
+ /* istanbul ignore next */
200
+
198
201
 
199
- throw new Error('Unknown kind of type: ' + type);
202
+ throw new Error("Unexpected type: \"".concat(inspect(type), "\"."));
200
203
  }
201
204
  },
202
205
  name: {
@@ -367,7 +370,8 @@ export var __InputValue = new GraphQLObjectType({
367
370
  type: GraphQLString,
368
371
  description: 'A GraphQL-formatted string representing the default value for this ' + 'input value.',
369
372
  resolve: function resolve(inputVal) {
370
- return isInvalid(inputVal.defaultValue) ? null : print(astFromValue(inputVal.defaultValue, inputVal.type));
373
+ var valueAST = astFromValue(inputVal.defaultValue, inputVal.type);
374
+ return valueAST ? print(valueAST) : null;
371
375
  }
372
376
  }
373
377
  };
@@ -494,7 +498,8 @@ export var TypeNameMetaFieldDef = {
494
498
  };
495
499
  export var introspectionTypes = [__Schema, __Directive, __DirectiveLocation, __Type, __Field, __InputValue, __EnumValue, __TypeKind];
496
500
  export function isIntrospectionType(type) {
497
- return isNamedType(type) && ( // Would prefer to use introspectionTypes.some(), however %checks needs
498
- // a simple expression.
499
- type.name === __Schema.name || type.name === __Directive.name || type.name === __DirectiveLocation.name || type.name === __Type.name || type.name === __Field.name || type.name === __InputValue.name || type.name === __EnumValue.name || type.name === __TypeKind.name);
500
- }
501
+ return isNamedType(type) && introspectionTypes.some(function (_ref8) {
502
+ var name = _ref8.name;
503
+ return type.name === name;
504
+ });
505
+ }
package/type/scalars.js CHANGED
@@ -249,7 +249,8 @@ var specifiedScalarTypes = [GraphQLString, GraphQLInt, GraphQLFloat, GraphQLBool
249
249
  exports.specifiedScalarTypes = specifiedScalarTypes;
250
250
 
251
251
  function isSpecifiedScalarType(type) {
252
- return (0, _definition.isNamedType)(type) && ( // Would prefer to use specifiedScalarTypes.some(), however %checks needs
253
- // a simple expression.
254
- type.name === GraphQLString.name || type.name === GraphQLInt.name || type.name === GraphQLFloat.name || type.name === GraphQLBoolean.name || type.name === GraphQLID.name);
255
- }
252
+ return (0, _definition.isScalarType)(type) && specifiedScalarTypes.some(function (_ref) {
253
+ var name = _ref.name;
254
+ return type.name === name;
255
+ });
256
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,7 +10,7 @@
10
10
  import isFinite from '../polyfills/isFinite';
11
11
  import isInteger from '../polyfills/isInteger';
12
12
  import inspect from '../jsutils/inspect';
13
- import { GraphQLScalarType, isNamedType } from './definition';
13
+ import { GraphQLScalarType, isScalarType } from './definition';
14
14
  import { Kind } from '../language/kinds';
15
15
 
16
16
  // As per the GraphQL Spec, Integers are only treated as valid when a valid
@@ -255,13 +255,7 @@ export const specifiedScalarTypes: $ReadOnlyArray<*> = [
255
255
 
256
256
  export function isSpecifiedScalarType(type: mixed): boolean %checks {
257
257
  return (
258
- isNamedType(type) &&
259
- // Would prefer to use specifiedScalarTypes.some(), however %checks needs
260
- // a simple expression.
261
- (type.name === GraphQLString.name ||
262
- type.name === GraphQLInt.name ||
263
- type.name === GraphQLFloat.name ||
264
- type.name === GraphQLBoolean.name ||
265
- type.name === GraphQLID.name)
258
+ isScalarType(type) &&
259
+ specifiedScalarTypes.some(({ name }) => type.name === name)
266
260
  );
267
261
  }
package/type/scalars.mjs CHANGED
@@ -1,7 +1,7 @@
1
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
2
 
3
3
  /**
4
- * Copyright (c) 2015-present, Facebook, Inc.
4
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
5
  *
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
@@ -11,7 +11,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
11
11
  import isFinite from '../polyfills/isFinite';
12
12
  import isInteger from '../polyfills/isInteger';
13
13
  import inspect from '../jsutils/inspect';
14
- import { GraphQLScalarType, isNamedType } from './definition';
14
+ import { GraphQLScalarType, isScalarType } from './definition';
15
15
  import { Kind } from '../language/kinds'; // As per the GraphQL Spec, Integers are only treated as valid when a valid
16
16
  // 32-bit signed integer, providing the broadest support across platforms.
17
17
  //
@@ -234,7 +234,8 @@ export var GraphQLID = new GraphQLScalarType({
234
234
  });
235
235
  export var specifiedScalarTypes = [GraphQLString, GraphQLInt, GraphQLFloat, GraphQLBoolean, GraphQLID];
236
236
  export function isSpecifiedScalarType(type) {
237
- return isNamedType(type) && ( // Would prefer to use specifiedScalarTypes.some(), however %checks needs
238
- // a simple expression.
239
- type.name === GraphQLString.name || type.name === GraphQLInt.name || type.name === GraphQLFloat.name || type.name === GraphQLBoolean.name || type.name === GraphQLID.name);
240
- }
237
+ return isScalarType(type) && specifiedScalarTypes.some(function (_ref) {
238
+ var name = _ref.name;
239
+ return type.name === name;
240
+ });
241
+ }
package/type/schema.js CHANGED
@@ -52,6 +52,43 @@ function assertSchema(schema) {
52
52
  * mutation: MyAppMutationRootType,
53
53
  * })
54
54
  *
55
+ * Note: When the schema is constructed, by default only the types that are
56
+ * reachable by traversing the root types are included, other types must be
57
+ * explicitly referenced.
58
+ *
59
+ * Example:
60
+ *
61
+ * const characterInterface = new GraphQLInterfaceType({
62
+ * name: 'Character',
63
+ * ...
64
+ * });
65
+ *
66
+ * const humanType = new GraphQLObjectType({
67
+ * name: 'Human',
68
+ * interfaces: [characterInterface],
69
+ * ...
70
+ * });
71
+ *
72
+ * const droidType = new GraphQLObjectType({
73
+ * name: 'Droid',
74
+ * interfaces: [characterInterface],
75
+ * ...
76
+ * });
77
+ *
78
+ * const schema = new GraphQLSchema({
79
+ * query: new GraphQLObjectType({
80
+ * name: 'Query',
81
+ * fields: {
82
+ * hero: { type: characterInterface, ... },
83
+ * }
84
+ * }),
85
+ * ...
86
+ * // Since this schema references only the `Character` interface it's
87
+ * // necessary to explicitly list the types that implement it if
88
+ * // you want them to be included in the final schema.
89
+ * types: [humanType, droidType],
90
+ * })
91
+ *
55
92
  * Note: If an array of `directives` are provided to GraphQLSchema, that will be
56
93
  * the exact list of directives represented and allowed. If `directives` is not
57
94
  * provided then a default set of the specified directives (e.g. @include and
@@ -210,7 +247,8 @@ function () {
210
247
  if (!possibleTypeMap[abstractType.name]) {
211
248
  var possibleTypes = this.getPossibleTypes(abstractType);
212
249
  possibleTypeMap[abstractType.name] = possibleTypes.reduce(function (map, type) {
213
- return map[type.name] = true, map;
250
+ map[type.name] = true;
251
+ return map;
214
252
  }, Object.create(null));
215
253
  }
216
254
 
@@ -227,6 +265,20 @@ function () {
227
265
  });
228
266
  };
229
267
 
268
+ _proto.toConfig = function toConfig() {
269
+ return {
270
+ types: (0, _objectValues.default)(this.getTypeMap()),
271
+ directives: this.getDirectives().slice(),
272
+ query: this.getQueryType(),
273
+ mutation: this.getMutationType(),
274
+ subscription: this.getSubscriptionType(),
275
+ astNode: this.astNode,
276
+ extensionASTNodes: this.extensionASTNodes || [],
277
+ assumeValid: this.__validationErrors !== undefined,
278
+ allowedLegacyNames: this.__allowedLegacyNames
279
+ };
280
+ };
281
+
230
282
  return GraphQLSchema;
231
283
  }(); // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
232
284
 
@@ -244,7 +296,7 @@ function typeMapReducer(map, type) {
244
296
  }
245
297
 
246
298
  if (map[type.name]) {
247
- !(map[type.name] === type) ? (0, _invariant.default)(0, 'Schema must contain unique named types but contains multiple ' + "types named \"".concat(type.name, "\".")) : void 0;
299
+ !(map[type.name] === type) ? (0, _invariant.default)(0, 'Schema must contain uniquely named types but contains multiple ' + "types named \"".concat(type.name, "\".")) : void 0;
248
300
  return map;
249
301
  }
250
302
 
@@ -331,4 +383,4 @@ function typeMapDirectiveReducer(map, directive) {
331
383
  return directive.args.reduce(function (_map, arg) {
332
384
  return typeMapReducer(_map, arg.type);
333
385
  }, map);
334
- }
386
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -10,6 +10,10 @@
10
10
  import find from '../polyfills/find';
11
11
  import objectValues from '../polyfills/objectValues';
12
12
  import {
13
+ type GraphQLType,
14
+ type GraphQLNamedType,
15
+ type GraphQLAbstractType,
16
+ type GraphQLObjectType,
13
17
  isAbstractType,
14
18
  isObjectType,
15
19
  isInterfaceType,
@@ -17,28 +21,22 @@ import {
17
21
  isInputObjectType,
18
22
  isWrappingType,
19
23
  } from './definition';
20
- import type {
21
- GraphQLType,
22
- GraphQLNamedType,
23
- GraphQLAbstractType,
24
- GraphQLObjectType,
25
- } from './definition';
26
- import type {
27
- SchemaDefinitionNode,
28
- SchemaExtensionNode,
24
+ import {
25
+ type SchemaDefinitionNode,
26
+ type SchemaExtensionNode,
29
27
  } from '../language/ast';
30
28
  import {
31
29
  GraphQLDirective,
32
30
  isDirective,
33
31
  specifiedDirectives,
34
32
  } from './directives';
35
- import type { GraphQLError } from '../error/GraphQLError';
33
+ import { type GraphQLError } from '../error/GraphQLError';
36
34
  import inspect from '../jsutils/inspect';
37
35
  import { __Schema } from './introspection';
38
36
  import defineToStringTag from '../jsutils/defineToStringTag';
39
37
  import instanceOf from '../jsutils/instanceOf';
40
38
  import invariant from '../jsutils/invariant';
41
- import type { ObjMap } from '../jsutils/ObjMap';
39
+ import { type ObjMap } from '../jsutils/ObjMap';
42
40
 
43
41
  /**
44
42
  * Test if the given value is a GraphQL schema.
@@ -72,6 +70,43 @@ export function assertSchema(schema: mixed): GraphQLSchema {
72
70
  * mutation: MyAppMutationRootType,
73
71
  * })
74
72
  *
73
+ * Note: When the schema is constructed, by default only the types that are
74
+ * reachable by traversing the root types are included, other types must be
75
+ * explicitly referenced.
76
+ *
77
+ * Example:
78
+ *
79
+ * const characterInterface = new GraphQLInterfaceType({
80
+ * name: 'Character',
81
+ * ...
82
+ * });
83
+ *
84
+ * const humanType = new GraphQLObjectType({
85
+ * name: 'Human',
86
+ * interfaces: [characterInterface],
87
+ * ...
88
+ * });
89
+ *
90
+ * const droidType = new GraphQLObjectType({
91
+ * name: 'Droid',
92
+ * interfaces: [characterInterface],
93
+ * ...
94
+ * });
95
+ *
96
+ * const schema = new GraphQLSchema({
97
+ * query: new GraphQLObjectType({
98
+ * name: 'Query',
99
+ * fields: {
100
+ * hero: { type: characterInterface, ... },
101
+ * }
102
+ * }),
103
+ * ...
104
+ * // Since this schema references only the `Character` interface it's
105
+ * // necessary to explicitly list the types that implement it if
106
+ * // you want them to be included in the final schema.
107
+ * types: [humanType, droidType],
108
+ * })
109
+ *
75
110
  * Note: If an array of `directives` are provided to GraphQLSchema, that will be
76
111
  * the exact list of directives represented and allowed. If `directives` is not
77
112
  * provided then a default set of the specified directives (e.g. @include and
@@ -222,10 +257,10 @@ export class GraphQLSchema {
222
257
 
223
258
  if (!possibleTypeMap[abstractType.name]) {
224
259
  const possibleTypes = this.getPossibleTypes(abstractType);
225
- possibleTypeMap[abstractType.name] = possibleTypes.reduce(
226
- (map, type) => ((map[type.name] = true), map),
227
- Object.create(null),
228
- );
260
+ possibleTypeMap[abstractType.name] = possibleTypes.reduce((map, type) => {
261
+ map[type.name] = true;
262
+ return map;
263
+ }, Object.create(null));
229
264
  }
230
265
 
231
266
  return Boolean(possibleTypeMap[abstractType.name][possibleType.name]);
@@ -238,6 +273,27 @@ export class GraphQLSchema {
238
273
  getDirective(name: string): ?GraphQLDirective {
239
274
  return find(this.getDirectives(), directive => directive.name === name);
240
275
  }
276
+
277
+ toConfig(): {|
278
+ ...GraphQLSchemaConfig,
279
+ types: Array<GraphQLNamedType>,
280
+ directives: Array<GraphQLDirective>,
281
+ extensionASTNodes: $ReadOnlyArray<SchemaExtensionNode>,
282
+ assumeValid: boolean,
283
+ allowedLegacyNames: $ReadOnlyArray<string>,
284
+ |} {
285
+ return {
286
+ types: objectValues(this.getTypeMap()),
287
+ directives: this.getDirectives().slice(),
288
+ query: this.getQueryType(),
289
+ mutation: this.getMutationType(),
290
+ subscription: this.getSubscriptionType(),
291
+ astNode: this.astNode,
292
+ extensionASTNodes: this.extensionASTNodes || [],
293
+ assumeValid: this.__validationErrors !== undefined,
294
+ allowedLegacyNames: this.__allowedLegacyNames,
295
+ };
296
+ }
241
297
  }
242
298
 
243
299
  // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
@@ -286,7 +342,7 @@ function typeMapReducer(map: TypeMap, type: ?GraphQLType): TypeMap {
286
342
  if (map[type.name]) {
287
343
  invariant(
288
344
  map[type.name] === type,
289
- 'Schema must contain unique named types but contains multiple ' +
345
+ 'Schema must contain uniquely named types but contains multiple ' +
290
346
  `types named "${type.name}".`,
291
347
  );
292
348
  return map;
package/type/schema.mjs CHANGED
@@ -1,7 +1,7 @@
1
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
2
 
3
3
  /**
4
- * Copyright (c) 2015-present, Facebook, Inc.
4
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
5
  *
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
@@ -39,6 +39,43 @@ export function assertSchema(schema) {
39
39
  * mutation: MyAppMutationRootType,
40
40
  * })
41
41
  *
42
+ * Note: When the schema is constructed, by default only the types that are
43
+ * reachable by traversing the root types are included, other types must be
44
+ * explicitly referenced.
45
+ *
46
+ * Example:
47
+ *
48
+ * const characterInterface = new GraphQLInterfaceType({
49
+ * name: 'Character',
50
+ * ...
51
+ * });
52
+ *
53
+ * const humanType = new GraphQLObjectType({
54
+ * name: 'Human',
55
+ * interfaces: [characterInterface],
56
+ * ...
57
+ * });
58
+ *
59
+ * const droidType = new GraphQLObjectType({
60
+ * name: 'Droid',
61
+ * interfaces: [characterInterface],
62
+ * ...
63
+ * });
64
+ *
65
+ * const schema = new GraphQLSchema({
66
+ * query: new GraphQLObjectType({
67
+ * name: 'Query',
68
+ * fields: {
69
+ * hero: { type: characterInterface, ... },
70
+ * }
71
+ * }),
72
+ * ...
73
+ * // Since this schema references only the `Character` interface it's
74
+ * // necessary to explicitly list the types that implement it if
75
+ * // you want them to be included in the final schema.
76
+ * types: [humanType, droidType],
77
+ * })
78
+ *
42
79
  * Note: If an array of `directives` are provided to GraphQLSchema, that will be
43
80
  * the exact list of directives represented and allowed. If `directives` is not
44
81
  * provided then a default set of the specified directives (e.g. @include and
@@ -196,7 +233,8 @@ function () {
196
233
  if (!possibleTypeMap[abstractType.name]) {
197
234
  var possibleTypes = this.getPossibleTypes(abstractType);
198
235
  possibleTypeMap[abstractType.name] = possibleTypes.reduce(function (map, type) {
199
- return map[type.name] = true, map;
236
+ map[type.name] = true;
237
+ return map;
200
238
  }, Object.create(null));
201
239
  }
202
240
 
@@ -213,6 +251,20 @@ function () {
213
251
  });
214
252
  };
215
253
 
254
+ _proto.toConfig = function toConfig() {
255
+ return {
256
+ types: objectValues(this.getTypeMap()),
257
+ directives: this.getDirectives().slice(),
258
+ query: this.getQueryType(),
259
+ mutation: this.getMutationType(),
260
+ subscription: this.getSubscriptionType(),
261
+ astNode: this.astNode,
262
+ extensionASTNodes: this.extensionASTNodes || [],
263
+ assumeValid: this.__validationErrors !== undefined,
264
+ allowedLegacyNames: this.__allowedLegacyNames
265
+ };
266
+ };
267
+
216
268
  return GraphQLSchema;
217
269
  }(); // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported
218
270
 
@@ -228,7 +280,7 @@ function typeMapReducer(map, type) {
228
280
  }
229
281
 
230
282
  if (map[type.name]) {
231
- !(map[type.name] === type) ? invariant(0, 'Schema must contain unique named types but contains multiple ' + "types named \"".concat(type.name, "\".")) : void 0;
283
+ !(map[type.name] === type) ? invariant(0, 'Schema must contain uniquely named types but contains multiple ' + "types named \"".concat(type.name, "\".")) : void 0;
232
284
  return map;
233
285
  }
234
286
 
@@ -315,4 +367,4 @@ function typeMapDirectiveReducer(map, directive) {
315
367
  return directive.args.reduce(function (_map, arg) {
316
368
  return typeMapReducer(_map, arg.type);
317
369
  }, map);
318
- }
370
+ }
package/type/validate.js CHANGED
@@ -8,6 +8,8 @@ exports.assertValidSchema = assertValidSchema;
8
8
 
9
9
  var _find = _interopRequireDefault(require("../polyfills/find"));
10
10
 
11
+ var _flatMap = _interopRequireDefault(require("../polyfills/flatMap"));
12
+
11
13
  var _objectValues = _interopRequireDefault(require("../polyfills/objectValues"));
12
14
 
13
15
  var _objectEntries = _interopRequireDefault(require("../polyfills/objectEntries"));
@@ -31,7 +33,7 @@ var _typeComparators = require("../utilities/typeComparators");
31
33
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
34
 
33
35
  /**
34
- * Copyright (c) 2015-present, Facebook, Inc.
36
+ * Copyright (c) Facebook, Inc. and its affiliates.
35
37
  *
36
38
  * This source code is licensed under the MIT license found in the
37
39
  * LICENSE file in the root directory of this source tree.
@@ -92,7 +94,7 @@ function () {
92
94
  var _proto = SchemaValidationContext.prototype;
93
95
 
94
96
  _proto.reportError = function reportError(message, nodes) {
95
- var _nodes = (Array.isArray(nodes) ? nodes : [nodes]).filter(Boolean);
97
+ var _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes;
96
98
 
97
99
  this.addError(new _GraphQLError.GraphQLError(message, _nodes));
98
100
  };
@@ -674,39 +676,9 @@ function getAllNodes(object) {
674
676
  }
675
677
 
676
678
  function getAllSubNodes(object, getter) {
677
- var result = [];
678
- var _iteratorNormalCompletion14 = true;
679
- var _didIteratorError14 = false;
680
- var _iteratorError14 = undefined;
681
-
682
- try {
683
- for (var _iterator14 = getAllNodes(object)[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
684
- var astNode = _step14.value;
685
-
686
- if (astNode) {
687
- var subNodes = getter(astNode);
688
-
689
- if (subNodes) {
690
- result = result.concat(subNodes);
691
- }
692
- }
693
- }
694
- } catch (err) {
695
- _didIteratorError14 = true;
696
- _iteratorError14 = err;
697
- } finally {
698
- try {
699
- if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
700
- _iterator14.return();
701
- }
702
- } finally {
703
- if (_didIteratorError14) {
704
- throw _iteratorError14;
705
- }
706
- }
707
- }
708
-
709
- return result;
679
+ return (0, _flatMap.default)(getAllNodes(object), function (item) {
680
+ return getter(item) || [];
681
+ });
710
682
  }
711
683
 
712
684
  function getImplementsInterfaceNode(type, iface) {
@@ -743,29 +715,29 @@ function getAllFieldArgNodes(type, fieldName, argName) {
743
715
  var fieldNode = getFieldNode(type, fieldName);
744
716
 
745
717
  if (fieldNode && fieldNode.arguments) {
746
- var _iteratorNormalCompletion15 = true;
747
- var _didIteratorError15 = false;
748
- var _iteratorError15 = undefined;
718
+ var _iteratorNormalCompletion14 = true;
719
+ var _didIteratorError14 = false;
720
+ var _iteratorError14 = undefined;
749
721
 
750
722
  try {
751
- for (var _iterator15 = fieldNode.arguments[Symbol.iterator](), _step15; !(_iteratorNormalCompletion15 = (_step15 = _iterator15.next()).done); _iteratorNormalCompletion15 = true) {
752
- var node = _step15.value;
723
+ for (var _iterator14 = fieldNode.arguments[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
724
+ var node = _step14.value;
753
725
 
754
726
  if (node.name.value === argName) {
755
727
  argNodes.push(node);
756
728
  }
757
729
  }
758
730
  } catch (err) {
759
- _didIteratorError15 = true;
760
- _iteratorError15 = err;
731
+ _didIteratorError14 = true;
732
+ _iteratorError14 = err;
761
733
  } finally {
762
734
  try {
763
- if (!_iteratorNormalCompletion15 && _iterator15.return != null) {
764
- _iterator15.return();
735
+ if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
736
+ _iterator14.return();
765
737
  }
766
738
  } finally {
767
- if (_didIteratorError15) {
768
- throw _iteratorError15;
739
+ if (_didIteratorError14) {
740
+ throw _iteratorError14;
769
741
  }
770
742
  }
771
743
  }
@@ -798,4 +770,4 @@ function getUnionMemberTypeNodes(union, typeName) {
798
770
  }).filter(function (typeNode) {
799
771
  return typeNode.name.value === typeName;
800
772
  });
801
- }
773
+ }