graphql 14.4.2 → 14.5.3

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/README.md +5 -10
  2. package/error/GraphQLError.d.ts +87 -0
  3. package/error/GraphQLError.js +7 -45
  4. package/error/GraphQLError.js.flow +1 -0
  5. package/error/GraphQLError.mjs +7 -45
  6. package/error/formatError.d.ts +39 -0
  7. package/error/formatError.js +5 -2
  8. package/error/formatError.js.flow +27 -3
  9. package/error/formatError.mjs +5 -2
  10. package/error/index.d.ts +4 -0
  11. package/error/locatedError.d.ts +13 -0
  12. package/error/locatedError.js.flow +2 -1
  13. package/error/locatedError.mjs +1 -1
  14. package/error/syntaxError.d.ts +12 -0
  15. package/error/syntaxError.js.flow +1 -0
  16. package/execution/execute.d.ts +190 -0
  17. package/execution/execute.js +55 -89
  18. package/execution/execute.js.flow +95 -133
  19. package/execution/execute.mjs +75 -80
  20. package/execution/index.d.ts +11 -0
  21. package/execution/index.js +8 -6
  22. package/execution/index.js.flow +3 -6
  23. package/execution/index.mjs +2 -1
  24. package/execution/values.d.ts +68 -0
  25. package/execution/values.js +119 -128
  26. package/execution/values.js.flow +150 -127
  27. package/execution/values.mjs +117 -125
  28. package/graphql.d.ts +88 -0
  29. package/graphql.js +5 -5
  30. package/graphql.js.flow +9 -5
  31. package/graphql.mjs +41 -1
  32. package/index.d.ts +446 -0
  33. package/index.js +6 -0
  34. package/index.js.flow +3 -1
  35. package/index.mjs +2 -1
  36. package/jsutils/ObjMap.js.flow +6 -0
  37. package/jsutils/Path.d.ts +14 -0
  38. package/jsutils/Path.js +33 -0
  39. package/jsutils/Path.js.flow +26 -0
  40. package/jsutils/Path.mjs +24 -0
  41. package/jsutils/PromiseOrValue.d.ts +1 -0
  42. package/jsutils/dedent.js +6 -24
  43. package/jsutils/dedent.mjs +6 -24
  44. package/jsutils/defineToStringTag.js.flow +1 -1
  45. package/jsutils/devAssert.js +14 -0
  46. package/jsutils/devAssert.js.flow +8 -0
  47. package/jsutils/devAssert.mjs +7 -0
  48. package/jsutils/inspect.js +1 -1
  49. package/jsutils/inspect.js.flow +1 -1
  50. package/jsutils/inspect.mjs +1 -1
  51. package/jsutils/invariant.js +1 -2
  52. package/jsutils/invariant.js.flow +2 -3
  53. package/jsutils/invariant.mjs +1 -2
  54. package/jsutils/mapValue.js +6 -24
  55. package/jsutils/mapValue.js.flow +2 -1
  56. package/jsutils/mapValue.mjs +6 -24
  57. package/jsutils/printPathArray.js +15 -0
  58. package/jsutils/printPathArray.js.flow +14 -0
  59. package/jsutils/printPathArray.mjs +8 -0
  60. package/jsutils/suggestionList.js +14 -34
  61. package/jsutils/suggestionList.js.flow +4 -6
  62. package/jsutils/suggestionList.mjs +14 -34
  63. package/jsutils/toObjMap.js +28 -0
  64. package/jsutils/toObjMap.js.flow +26 -0
  65. package/jsutils/toObjMap.mjs +18 -0
  66. package/language/ast.d.ts +573 -0
  67. package/language/blockString.d.ts +21 -0
  68. package/language/directiveLocation.d.ts +35 -0
  69. package/language/index.d.ts +96 -0
  70. package/language/kinds.d.ts +77 -0
  71. package/language/lexer.d.ts +60 -0
  72. package/language/lexer.js +2 -12
  73. package/language/lexer.js.flow +6 -12
  74. package/language/lexer.mjs +1 -9
  75. package/language/location.d.ts +15 -0
  76. package/language/parser.d.ts +89 -0
  77. package/language/parser.js +1329 -1302
  78. package/language/parser.js.flow +1289 -1298
  79. package/language/parser.mjs +1326 -1297
  80. package/language/predicates.d.ts +36 -0
  81. package/language/predicates.js.flow +1 -1
  82. package/language/printLocation.d.ts +16 -0
  83. package/language/printLocation.js.flow +1 -1
  84. package/language/printer.d.ts +7 -0
  85. package/language/printer.js.flow +1 -1
  86. package/language/source.d.ts +19 -0
  87. package/language/source.js +3 -3
  88. package/language/source.js.flow +3 -3
  89. package/language/source.mjs +3 -3
  90. package/language/tokenKind.d.ts +35 -0
  91. package/language/visitor.d.ts +264 -0
  92. package/language/visitor.js +2 -2
  93. package/language/visitor.js.flow +3 -1
  94. package/language/visitor.mjs +2 -2
  95. package/package.json +1 -1
  96. package/polyfills/find.js +2 -2
  97. package/polyfills/find.js.flow +1 -2
  98. package/polyfills/find.mjs +2 -2
  99. package/polyfills/flatMap.js +3 -3
  100. package/polyfills/flatMap.js.flow +2 -3
  101. package/polyfills/flatMap.mjs +3 -3
  102. package/subscription/asyncIteratorReject.d.ts +6 -0
  103. package/subscription/index.d.ts +5 -0
  104. package/subscription/mapAsyncIterator.d.ts +9 -0
  105. package/subscription/mapAsyncIterator.js.flow +1 -0
  106. package/subscription/subscribe.d.ts +86 -0
  107. package/subscription/subscribe.js +29 -10
  108. package/subscription/subscribe.js.flow +45 -24
  109. package/subscription/subscribe.mjs +27 -9
  110. package/tsutils/Maybe.d.ts +4 -0
  111. package/type/definition.d.ts +805 -0
  112. package/type/definition.js +154 -70
  113. package/type/definition.js.flow +217 -160
  114. package/type/definition.mjs +149 -66
  115. package/type/directives.d.ts +72 -0
  116. package/type/directives.js +20 -12
  117. package/type/directives.js.flow +34 -19
  118. package/type/directives.mjs +17 -10
  119. package/type/index.d.ts +155 -0
  120. package/type/index.js.flow +2 -2
  121. package/type/introspection.d.ts +40 -0
  122. package/type/introspection.js +24 -10
  123. package/type/introspection.js.flow +29 -8
  124. package/type/introspection.mjs +23 -10
  125. package/type/scalars.d.ts +11 -0
  126. package/type/scalars.js +2 -2
  127. package/type/scalars.js.flow +4 -1
  128. package/type/scalars.mjs +2 -2
  129. package/type/schema.d.ts +108 -0
  130. package/type/schema.js +74 -151
  131. package/type/schema.js.flow +75 -73
  132. package/type/schema.mjs +75 -149
  133. package/type/validate.d.ts +19 -0
  134. package/type/validate.js +227 -486
  135. package/type/validate.js.flow +13 -8
  136. package/type/validate.mjs +218 -477
  137. package/utilities/TypeInfo.d.ts +49 -0
  138. package/utilities/TypeInfo.js.flow +9 -6
  139. package/utilities/assertValidName.d.ts +15 -0
  140. package/utilities/assertValidName.js +3 -3
  141. package/utilities/assertValidName.js.flow +3 -2
  142. package/utilities/assertValidName.mjs +2 -2
  143. package/utilities/astFromValue.d.ts +25 -0
  144. package/utilities/astFromValue.js +22 -38
  145. package/utilities/astFromValue.js.flow +7 -4
  146. package/utilities/astFromValue.mjs +19 -36
  147. package/utilities/buildASTSchema.d.ts +114 -0
  148. package/utilities/buildASTSchema.js +37 -68
  149. package/utilities/buildASTSchema.js.flow +32 -30
  150. package/utilities/buildASTSchema.mjs +32 -64
  151. package/utilities/buildClientSchema.d.ts +21 -0
  152. package/utilities/buildClientSchema.js +23 -15
  153. package/utilities/buildClientSchema.js.flow +17 -16
  154. package/utilities/buildClientSchema.mjs +20 -12
  155. package/utilities/coerceInputValue.d.ts +17 -0
  156. package/utilities/coerceInputValue.js +161 -0
  157. package/utilities/coerceInputValue.js.flow +214 -0
  158. package/utilities/coerceInputValue.mjs +142 -0
  159. package/utilities/coerceValue.d.ts +23 -0
  160. package/utilities/coerceValue.js +21 -199
  161. package/utilities/coerceValue.js.flow +31 -223
  162. package/utilities/coerceValue.mjs +20 -195
  163. package/utilities/concatAST.d.ts +8 -0
  164. package/utilities/concatAST.js.flow +1 -0
  165. package/utilities/extendSchema.d.ts +45 -0
  166. package/utilities/extendSchema.js +64 -131
  167. package/utilities/extendSchema.js.flow +27 -24
  168. package/utilities/extendSchema.mjs +61 -129
  169. package/utilities/findBreakingChanges.d.ts +64 -0
  170. package/utilities/findBreakingChanges.js +194 -619
  171. package/utilities/findBreakingChanges.js.flow +8 -5
  172. package/utilities/findBreakingChanges.mjs +194 -619
  173. package/utilities/findDeprecatedUsages.d.ts +13 -0
  174. package/utilities/findDeprecatedUsages.js.flow +4 -1
  175. package/utilities/getOperationAST.d.ts +12 -0
  176. package/utilities/getOperationAST.js +13 -31
  177. package/utilities/getOperationAST.mjs +13 -31
  178. package/utilities/getOperationRootType.d.ts +14 -0
  179. package/utilities/getOperationRootType.js.flow +2 -0
  180. package/utilities/index.d.ts +127 -0
  181. package/utilities/index.js +8 -0
  182. package/utilities/index.js.flow +4 -1
  183. package/utilities/index.mjs +3 -1
  184. package/utilities/introspectionFromSchema.d.ts +16 -0
  185. package/utilities/introspectionFromSchema.js +5 -3
  186. package/utilities/introspectionFromSchema.js.flow +4 -2
  187. package/utilities/introspectionFromSchema.mjs +4 -2
  188. package/utilities/introspectionQuery.d.ts +177 -0
  189. package/utilities/isValidJSValue.d.ts +8 -0
  190. package/utilities/isValidJSValue.js +1 -1
  191. package/utilities/isValidJSValue.js.flow +3 -2
  192. package/utilities/isValidJSValue.mjs +2 -2
  193. package/utilities/isValidLiteralValue.d.ts +15 -0
  194. package/utilities/isValidLiteralValue.js +4 -4
  195. package/utilities/isValidLiteralValue.js.flow +8 -4
  196. package/utilities/isValidLiteralValue.mjs +2 -2
  197. package/utilities/lexicographicSortSchema.d.ts +6 -0
  198. package/utilities/lexicographicSortSchema.js +11 -8
  199. package/utilities/lexicographicSortSchema.js.flow +5 -3
  200. package/utilities/lexicographicSortSchema.mjs +9 -7
  201. package/utilities/schemaPrinter.d.ts +30 -0
  202. package/utilities/schemaPrinter.js +15 -32
  203. package/utilities/schemaPrinter.js.flow +14 -10
  204. package/utilities/schemaPrinter.mjs +14 -32
  205. package/utilities/separateOperations.d.ts +11 -0
  206. package/utilities/separateOperations.js +6 -6
  207. package/utilities/separateOperations.js.flow +2 -1
  208. package/utilities/separateOperations.mjs +6 -6
  209. package/utilities/stripIgnoredCharacters.d.ts +55 -0
  210. package/utilities/stripIgnoredCharacters.js.flow +1 -0
  211. package/utilities/typeComparators.d.ts +32 -0
  212. package/utilities/typeComparators.js.flow +1 -1
  213. package/utilities/typeComparators.mjs +1 -1
  214. package/utilities/typeFromAST.d.ts +29 -0
  215. package/utilities/typeFromAST.js +5 -3
  216. package/utilities/typeFromAST.js.flow +5 -3
  217. package/utilities/typeFromAST.mjs +14 -3
  218. package/utilities/valueFromAST.d.ts +29 -0
  219. package/utilities/valueFromAST.js +40 -74
  220. package/utilities/valueFromAST.js.flow +7 -4
  221. package/utilities/valueFromAST.mjs +39 -74
  222. package/utilities/valueFromASTUntyped.d.ts +23 -0
  223. package/utilities/valueFromASTUntyped.js +4 -3
  224. package/utilities/valueFromASTUntyped.js.flow +3 -2
  225. package/utilities/valueFromASTUntyped.mjs +3 -3
  226. package/validation/ValidationContext.d.ts +96 -0
  227. package/validation/ValidationContext.js +38 -86
  228. package/validation/ValidationContext.js.flow +22 -7
  229. package/validation/ValidationContext.mjs +37 -85
  230. package/validation/index.d.ts +126 -0
  231. package/validation/rules/ExecutableDefinitions.d.ts +14 -0
  232. package/validation/rules/ExecutableDefinitions.js +4 -23
  233. package/validation/rules/ExecutableDefinitions.js.flow +4 -2
  234. package/validation/rules/ExecutableDefinitions.mjs +4 -23
  235. package/validation/rules/FieldsOnCorrectType.d.ts +17 -0
  236. package/validation/rules/FieldsOnCorrectType.js +21 -57
  237. package/validation/rules/FieldsOnCorrectType.js.flow +7 -3
  238. package/validation/rules/FieldsOnCorrectType.mjs +21 -57
  239. package/validation/rules/FragmentsOnCompositeTypes.d.ts +20 -0
  240. package/validation/rules/FragmentsOnCompositeTypes.js.flow +5 -1
  241. package/validation/rules/KnownArgumentNames.d.ts +28 -0
  242. package/validation/rules/KnownArgumentNames.js +26 -79
  243. package/validation/rules/KnownArgumentNames.js.flow +10 -6
  244. package/validation/rules/KnownArgumentNames.mjs +22 -75
  245. package/validation/rules/KnownDirectives.d.ts +19 -0
  246. package/validation/rules/KnownDirectives.js +12 -48
  247. package/validation/rules/KnownDirectives.js.flow +8 -5
  248. package/validation/rules/KnownDirectives.mjs +12 -48
  249. package/validation/rules/KnownFragmentNames.d.ts +12 -0
  250. package/validation/rules/KnownFragmentNames.js.flow +2 -1
  251. package/validation/rules/KnownTypeNames.d.ts +15 -0
  252. package/validation/rules/KnownTypeNames.js +6 -24
  253. package/validation/rules/KnownTypeNames.js.flow +10 -6
  254. package/validation/rules/KnownTypeNames.mjs +6 -24
  255. package/validation/rules/LoneAnonymousOperation.d.ts +14 -0
  256. package/validation/rules/LoneAnonymousOperation.js.flow +3 -1
  257. package/validation/rules/LoneSchemaDefinition.d.ts +13 -0
  258. package/validation/rules/LoneSchemaDefinition.js.flow +2 -1
  259. package/validation/rules/NoFragmentCycles.d.ts +9 -0
  260. package/validation/rules/NoFragmentCycles.js +17 -35
  261. package/validation/rules/NoFragmentCycles.js.flow +4 -2
  262. package/validation/rules/NoFragmentCycles.mjs +17 -35
  263. package/validation/rules/NoUndefinedVariables.d.ts +16 -0
  264. package/validation/rules/NoUndefinedVariables.js +6 -24
  265. package/validation/rules/NoUndefinedVariables.js.flow +2 -1
  266. package/validation/rules/NoUndefinedVariables.mjs +6 -24
  267. package/validation/rules/NoUnusedFragments.d.ts +12 -0
  268. package/validation/rules/NoUnusedFragments.js +7 -25
  269. package/validation/rules/NoUnusedFragments.js.flow +2 -1
  270. package/validation/rules/NoUnusedFragments.mjs +7 -25
  271. package/validation/rules/NoUnusedVariables.d.ts +16 -0
  272. package/validation/rules/NoUnusedVariables.js +6 -24
  273. package/validation/rules/NoUnusedVariables.js.flow +2 -1
  274. package/validation/rules/NoUnusedVariables.mjs +6 -24
  275. package/validation/rules/OverlappingFieldsCanBeMerged.d.ts +24 -0
  276. package/validation/rules/OverlappingFieldsCanBeMerged.js +27 -46
  277. package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +17 -8
  278. package/validation/rules/OverlappingFieldsCanBeMerged.mjs +25 -44
  279. package/validation/rules/PossibleFragmentSpreads.d.ts +22 -0
  280. package/validation/rules/PossibleFragmentSpreads.js +2 -2
  281. package/validation/rules/PossibleFragmentSpreads.js.flow +8 -3
  282. package/validation/rules/PossibleFragmentSpreads.mjs +2 -2
  283. package/validation/rules/PossibleTypeExtensions.d.ts +21 -0
  284. package/validation/rules/PossibleTypeExtensions.js +4 -22
  285. package/validation/rules/PossibleTypeExtensions.js.flow +6 -2
  286. package/validation/rules/PossibleTypeExtensions.mjs +4 -22
  287. package/validation/rules/ProvidedRequiredArguments.d.ts +29 -0
  288. package/validation/rules/ProvidedRequiredArguments.js +27 -79
  289. package/validation/rules/ProvidedRequiredArguments.js.flow +12 -8
  290. package/validation/rules/ProvidedRequiredArguments.mjs +25 -77
  291. package/validation/rules/ScalarLeafs.d.ts +20 -0
  292. package/validation/rules/ScalarLeafs.js.flow +6 -2
  293. package/validation/rules/SingleFieldSubscriptions.d.ts +14 -0
  294. package/validation/rules/SingleFieldSubscriptions.js.flow +4 -2
  295. package/validation/rules/UniqueArgumentNames.d.ts +12 -0
  296. package/validation/rules/UniqueArgumentNames.js.flow +2 -1
  297. package/validation/rules/UniqueDirectiveNames.d.ts +13 -0
  298. package/validation/rules/UniqueDirectiveNames.js.flow +2 -1
  299. package/validation/rules/UniqueDirectivesPerLocation.d.ts +14 -0
  300. package/validation/rules/UniqueDirectivesPerLocation.js +15 -69
  301. package/validation/rules/UniqueDirectivesPerLocation.js.flow +7 -4
  302. package/validation/rules/UniqueDirectivesPerLocation.mjs +15 -69
  303. package/validation/rules/UniqueEnumValueNames.d.ts +19 -0
  304. package/validation/rules/UniqueEnumValueNames.js +10 -28
  305. package/validation/rules/UniqueEnumValueNames.js.flow +2 -1
  306. package/validation/rules/UniqueEnumValueNames.mjs +10 -28
  307. package/validation/rules/UniqueFieldDefinitionNames.d.ts +21 -0
  308. package/validation/rules/UniqueFieldDefinitionNames.js +9 -27
  309. package/validation/rules/UniqueFieldDefinitionNames.js.flow +2 -1
  310. package/validation/rules/UniqueFieldDefinitionNames.mjs +9 -27
  311. package/validation/rules/UniqueFragmentNames.d.ts +11 -0
  312. package/validation/rules/UniqueFragmentNames.js.flow +2 -1
  313. package/validation/rules/UniqueInputFieldNames.d.ts +14 -0
  314. package/validation/rules/UniqueInputFieldNames.js.flow +2 -1
  315. package/validation/rules/UniqueOperationNames.d.ts +11 -0
  316. package/validation/rules/UniqueOperationNames.js.flow +2 -1
  317. package/validation/rules/UniqueOperationTypes.d.ts +13 -0
  318. package/validation/rules/UniqueOperationTypes.js +11 -30
  319. package/validation/rules/UniqueOperationTypes.js.flow +2 -1
  320. package/validation/rules/UniqueOperationTypes.mjs +10 -29
  321. package/validation/rules/UniqueTypeNames.d.ts +13 -0
  322. package/validation/rules/UniqueTypeNames.js.flow +3 -1
  323. package/validation/rules/UniqueVariableNames.d.ts +11 -0
  324. package/validation/rules/UniqueVariableNames.js.flow +4 -2
  325. package/validation/rules/ValuesOfCorrectType.d.ts +34 -0
  326. package/validation/rules/ValuesOfCorrectType.js +16 -34
  327. package/validation/rules/ValuesOfCorrectType.js.flow +11 -6
  328. package/validation/rules/ValuesOfCorrectType.mjs +12 -30
  329. package/validation/rules/VariablesAreInputTypes.d.ts +15 -0
  330. package/validation/rules/VariablesAreInputTypes.js.flow +6 -2
  331. package/validation/rules/VariablesInAllowedPosition.d.ts +15 -0
  332. package/validation/rules/VariablesInAllowedPosition.js +22 -40
  333. package/validation/rules/VariablesInAllowedPosition.js.flow +8 -3
  334. package/validation/rules/VariablesInAllowedPosition.mjs +18 -36
  335. package/validation/specifiedRules.d.ts +98 -0
  336. package/validation/validate.d.ts +56 -0
  337. package/validation/validate.js +35 -7
  338. package/validation/validate.js.flow +51 -9
  339. package/validation/validate.mjs +30 -7
  340. package/version.d.ts +14 -0
  341. package/version.js +3 -3
  342. package/version.js.flow +3 -3
  343. package/version.mjs +3 -3
package/type/validate.mjs CHANGED
@@ -2,14 +2,14 @@ import find from '../polyfills/find';
2
2
  import flatMap from '../polyfills/flatMap';
3
3
  import objectValues from '../polyfills/objectValues';
4
4
  import objectEntries from '../polyfills/objectEntries';
5
- import { isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isNamedType, isNonNullType, isInputType, isOutputType, isRequiredArgument } from './definition';
6
- import { isDirective } from './directives';
7
- import { isIntrospectionType } from './introspection';
8
- import { assertSchema } from './schema';
9
5
  import inspect from '../jsutils/inspect';
10
6
  import { GraphQLError } from '../error/GraphQLError';
11
7
  import { isValidNameError } from '../utilities/assertValidName';
12
8
  import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators';
9
+ import { isDirective } from './directives';
10
+ import { isIntrospectionType } from './introspection';
11
+ import { assertSchema } from './schema';
12
+ import { isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isNamedType, isNonNullType, isInputType, isOutputType, isRequiredArgument } from './definition';
13
13
  /**
14
14
  * Implements the "Type Validation" sub-sections of the specification's
15
15
  * "Type System" section.
@@ -106,30 +106,12 @@ function getOperationTypeNode(schema, type, operation) {
106
106
  var operationNodes = getAllSubNodes(schema, function (node) {
107
107
  return node.operationTypes;
108
108
  });
109
- var _iteratorNormalCompletion = true;
110
- var _didIteratorError = false;
111
- var _iteratorError = undefined;
112
109
 
113
- try {
114
- for (var _iterator = operationNodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
115
- var node = _step.value;
110
+ for (var _i2 = 0; _i2 < operationNodes.length; _i2++) {
111
+ var node = operationNodes[_i2];
116
112
 
117
- if (node.operation === operation) {
118
- return node.type;
119
- }
120
- }
121
- } catch (err) {
122
- _didIteratorError = true;
123
- _iteratorError = err;
124
- } finally {
125
- try {
126
- if (!_iteratorNormalCompletion && _iterator.return != null) {
127
- _iterator.return();
128
- }
129
- } finally {
130
- if (_didIteratorError) {
131
- throw _iteratorError;
132
- }
113
+ if (node.operation === operation) {
114
+ return node.type;
133
115
  }
134
116
  }
135
117
 
@@ -137,86 +119,49 @@ function getOperationTypeNode(schema, type, operation) {
137
119
  }
138
120
 
139
121
  function validateDirectives(context) {
140
- var _iteratorNormalCompletion2 = true;
141
- var _didIteratorError2 = false;
142
- var _iteratorError2 = undefined;
143
-
144
- try {
145
- for (var _iterator2 = context.schema.getDirectives()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
146
- var directive = _step2.value;
147
-
148
- // Ensure all directives are in fact GraphQL directives.
149
- if (!isDirective(directive)) {
150
- context.reportError("Expected directive but got: ".concat(inspect(directive), "."), directive && directive.astNode);
151
- continue;
152
- } // Ensure they are named correctly.
153
-
154
-
155
- validateName(context, directive); // TODO: Ensure proper locations.
156
- // Ensure the arguments are valid.
157
-
158
- var argNames = Object.create(null);
159
- var _iteratorNormalCompletion3 = true;
160
- var _didIteratorError3 = false;
161
- var _iteratorError3 = undefined;
162
-
163
- try {
164
- var _loop = function _loop() {
165
- var arg = _step3.value;
166
- var argName = arg.name; // Ensure they are named correctly.
167
-
168
- validateName(context, arg); // Ensure they are unique per directive.
169
-
170
- if (argNames[argName]) {
171
- context.reportError("Argument @".concat(directive.name, "(").concat(argName, ":) can only be defined once."), directive.astNode && directive.args.filter(function (_ref) {
172
- var name = _ref.name;
173
- return name === argName;
174
- }).map(function (_ref2) {
175
- var astNode = _ref2.astNode;
176
- return astNode;
177
- }));
178
- return "continue";
179
- }
180
-
181
- argNames[argName] = true; // Ensure the type is an input type.
182
-
183
- if (!isInputType(arg.type)) {
184
- context.reportError("The type of @".concat(directive.name, "(").concat(argName, ":) must be Input Type ") + "but got: ".concat(inspect(arg.type), "."), arg.astNode);
185
- }
186
- };
187
-
188
- for (var _iterator3 = directive.args[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
189
- var _ret = _loop();
190
-
191
- if (_ret === "continue") continue;
192
- }
193
- } catch (err) {
194
- _didIteratorError3 = true;
195
- _iteratorError3 = err;
196
- } finally {
197
- try {
198
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
199
- _iterator3.return();
200
- }
201
- } finally {
202
- if (_didIteratorError3) {
203
- throw _iteratorError3;
204
- }
205
- }
206
- }
207
- }
208
- } catch (err) {
209
- _didIteratorError2 = true;
210
- _iteratorError2 = err;
211
- } finally {
212
- try {
213
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
214
- _iterator2.return();
122
+ for (var _i4 = 0, _context$schema$getDi2 = context.schema.getDirectives(); _i4 < _context$schema$getDi2.length; _i4++) {
123
+ var directive = _context$schema$getDi2[_i4];
124
+
125
+ // Ensure all directives are in fact GraphQL directives.
126
+ if (!isDirective(directive)) {
127
+ context.reportError("Expected directive but got: ".concat(inspect(directive), "."), directive && directive.astNode);
128
+ continue;
129
+ } // Ensure they are named correctly.
130
+
131
+
132
+ validateName(context, directive); // TODO: Ensure proper locations.
133
+ // Ensure the arguments are valid.
134
+
135
+ var argNames = Object.create(null);
136
+
137
+ var _loop = function _loop(_i6, _directive$args2) {
138
+ var arg = _directive$args2[_i6];
139
+ var argName = arg.name; // Ensure they are named correctly.
140
+
141
+ validateName(context, arg); // Ensure they are unique per directive.
142
+
143
+ if (argNames[argName]) {
144
+ context.reportError("Argument @".concat(directive.name, "(").concat(argName, ":) can only be defined once."), directive.astNode && directive.args.filter(function (_ref) {
145
+ var name = _ref.name;
146
+ return name === argName;
147
+ }).map(function (_ref2) {
148
+ var astNode = _ref2.astNode;
149
+ return astNode;
150
+ }));
151
+ return "continue";
215
152
  }
216
- } finally {
217
- if (_didIteratorError2) {
218
- throw _iteratorError2;
153
+
154
+ argNames[argName] = true; // Ensure the type is an input type.
155
+
156
+ if (!isInputType(arg.type)) {
157
+ context.reportError("The type of @".concat(directive.name, "(").concat(argName, ":) must be Input Type ") + "but got: ".concat(inspect(arg.type), "."), arg.astNode);
219
158
  }
159
+ };
160
+
161
+ for (var _i6 = 0, _directive$args2 = directive.args; _i6 < _directive$args2.length; _i6++) {
162
+ var _ret = _loop(_i6, _directive$args2);
163
+
164
+ if (_ret === "continue") continue;
220
165
  }
221
166
  }
222
167
  }
@@ -239,58 +184,40 @@ function validateName(context, node) {
239
184
  function validateTypes(context) {
240
185
  var validateInputObjectCircularRefs = createInputObjectCircularRefsValidator(context);
241
186
  var typeMap = context.schema.getTypeMap();
242
- var _iteratorNormalCompletion4 = true;
243
- var _didIteratorError4 = false;
244
- var _iteratorError4 = undefined;
245
-
246
- try {
247
- for (var _iterator4 = objectValues(typeMap)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
248
- var type = _step4.value;
249
187
 
250
- // Ensure all provided types are in fact GraphQL type.
251
- if (!isNamedType(type)) {
252
- context.reportError("Expected GraphQL named type but got: ".concat(inspect(type), "."), type && type.astNode);
253
- continue;
254
- } // Ensure it is named correctly (excluding introspection types).
188
+ for (var _i8 = 0, _objectValues2 = objectValues(typeMap); _i8 < _objectValues2.length; _i8++) {
189
+ var type = _objectValues2[_i8];
255
190
 
191
+ // Ensure all provided types are in fact GraphQL type.
192
+ if (!isNamedType(type)) {
193
+ context.reportError("Expected GraphQL named type but got: ".concat(inspect(type), "."), type && type.astNode);
194
+ continue;
195
+ } // Ensure it is named correctly (excluding introspection types).
256
196
 
257
- if (!isIntrospectionType(type)) {
258
- validateName(context, type);
259
- }
260
197
 
261
- if (isObjectType(type)) {
262
- // Ensure fields are valid
263
- validateFields(context, type); // Ensure objects implement the interfaces they claim to.
264
-
265
- validateObjectInterfaces(context, type);
266
- } else if (isInterfaceType(type)) {
267
- // Ensure fields are valid.
268
- validateFields(context, type);
269
- } else if (isUnionType(type)) {
270
- // Ensure Unions include valid member types.
271
- validateUnionMembers(context, type);
272
- } else if (isEnumType(type)) {
273
- // Ensure Enums have valid values.
274
- validateEnumValues(context, type);
275
- } else if (isInputObjectType(type)) {
276
- // Ensure Input Object fields are valid.
277
- validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references
278
-
279
- validateInputObjectCircularRefs(type);
280
- }
198
+ if (!isIntrospectionType(type)) {
199
+ validateName(context, type);
281
200
  }
282
- } catch (err) {
283
- _didIteratorError4 = true;
284
- _iteratorError4 = err;
285
- } finally {
286
- try {
287
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
288
- _iterator4.return();
289
- }
290
- } finally {
291
- if (_didIteratorError4) {
292
- throw _iteratorError4;
293
- }
201
+
202
+ if (isObjectType(type)) {
203
+ // Ensure fields are valid
204
+ validateFields(context, type); // Ensure objects implement the interfaces they claim to.
205
+
206
+ validateObjectInterfaces(context, type);
207
+ } else if (isInterfaceType(type)) {
208
+ // Ensure fields are valid.
209
+ validateFields(context, type);
210
+ } else if (isUnionType(type)) {
211
+ // Ensure Unions include valid member types.
212
+ validateUnionMembers(context, type);
213
+ } else if (isEnumType(type)) {
214
+ // Ensure Enums have valid values.
215
+ validateEnumValues(context, type);
216
+ } else if (isInputObjectType(type)) {
217
+ // Ensure Input Object fields are valid.
218
+ validateInputFields(context, type); // Ensure Input Objects do not contain non-nullable circular references
219
+
220
+ validateInputObjectCircularRefs(type);
294
221
  }
295
222
  }
296
223
  }
@@ -302,120 +229,65 @@ function validateFields(context, type) {
302
229
  context.reportError("Type ".concat(type.name, " must define one or more fields."), getAllNodes(type));
303
230
  }
304
231
 
305
- var _iteratorNormalCompletion5 = true;
306
- var _didIteratorError5 = false;
307
- var _iteratorError5 = undefined;
308
-
309
- try {
310
- for (var _iterator5 = fields[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
311
- var field = _step5.value;
312
- // Ensure they are named correctly.
313
- validateName(context, field); // Ensure the type is an output type
314
-
315
- if (!isOutputType(field.type)) {
316
- context.reportError("The type of ".concat(type.name, ".").concat(field.name, " must be Output Type ") + "but got: ".concat(inspect(field.type), "."), field.astNode && field.astNode.type);
317
- } // Ensure the arguments are valid
232
+ for (var _i10 = 0; _i10 < fields.length; _i10++) {
233
+ var field = fields[_i10];
234
+ // Ensure they are named correctly.
235
+ validateName(context, field); // Ensure the type is an output type
318
236
 
237
+ if (!isOutputType(field.type)) {
238
+ context.reportError("The type of ".concat(type.name, ".").concat(field.name, " must be Output Type ") + "but got: ".concat(inspect(field.type), "."), field.astNode && field.astNode.type);
239
+ } // Ensure the arguments are valid
319
240
 
320
- var argNames = Object.create(null);
321
- var _iteratorNormalCompletion6 = true;
322
- var _didIteratorError6 = false;
323
- var _iteratorError6 = undefined;
324
241
 
325
- try {
326
- var _loop2 = function _loop2() {
327
- var arg = _step6.value;
328
- var argName = arg.name; // Ensure they are named correctly.
242
+ var argNames = Object.create(null);
329
243
 
330
- validateName(context, arg); // Ensure they are unique per field.
244
+ var _loop2 = function _loop2(_i12, _field$args2) {
245
+ var arg = _field$args2[_i12];
246
+ var argName = arg.name; // Ensure they are named correctly.
331
247
 
332
- if (argNames[argName]) {
333
- context.reportError("Field argument ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) can only be defined once."), field.args.filter(function (_ref3) {
334
- var name = _ref3.name;
335
- return name === argName;
336
- }).map(function (_ref4) {
337
- var astNode = _ref4.astNode;
338
- return astNode;
339
- }));
340
- }
248
+ validateName(context, arg); // Ensure they are unique per field.
341
249
 
342
- argNames[argName] = true; // Ensure the type is an input type
250
+ if (argNames[argName]) {
251
+ context.reportError("Field argument ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) can only be defined once."), field.args.filter(function (_ref3) {
252
+ var name = _ref3.name;
253
+ return name === argName;
254
+ }).map(function (_ref4) {
255
+ var astNode = _ref4.astNode;
256
+ return astNode;
257
+ }));
258
+ }
343
259
 
344
- if (!isInputType(arg.type)) {
345
- context.reportError("The type of ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) must be Input ") + "Type but got: ".concat(inspect(arg.type), "."), arg.astNode && arg.astNode.type);
346
- }
347
- };
260
+ argNames[argName] = true; // Ensure the type is an input type
348
261
 
349
- for (var _iterator6 = field.args[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
350
- _loop2();
351
- }
352
- } catch (err) {
353
- _didIteratorError6 = true;
354
- _iteratorError6 = err;
355
- } finally {
356
- try {
357
- if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
358
- _iterator6.return();
359
- }
360
- } finally {
361
- if (_didIteratorError6) {
362
- throw _iteratorError6;
363
- }
364
- }
365
- }
366
- }
367
- } catch (err) {
368
- _didIteratorError5 = true;
369
- _iteratorError5 = err;
370
- } finally {
371
- try {
372
- if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
373
- _iterator5.return();
374
- }
375
- } finally {
376
- if (_didIteratorError5) {
377
- throw _iteratorError5;
262
+ if (!isInputType(arg.type)) {
263
+ context.reportError("The type of ".concat(type.name, ".").concat(field.name, "(").concat(argName, ":) must be Input ") + "Type but got: ".concat(inspect(arg.type), "."), arg.astNode && arg.astNode.type);
378
264
  }
265
+ };
266
+
267
+ for (var _i12 = 0, _field$args2 = field.args; _i12 < _field$args2.length; _i12++) {
268
+ _loop2(_i12, _field$args2);
379
269
  }
380
270
  }
381
271
  }
382
272
 
383
273
  function validateObjectInterfaces(context, object) {
384
274
  var implementedTypeNames = Object.create(null);
385
- var _iteratorNormalCompletion7 = true;
386
- var _didIteratorError7 = false;
387
- var _iteratorError7 = undefined;
388
-
389
- try {
390
- for (var _iterator7 = object.getInterfaces()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
391
- var iface = _step7.value;
392
275
 
393
- if (!isInterfaceType(iface)) {
394
- context.reportError("Type ".concat(inspect(object), " must only implement Interface types, ") + "it cannot implement ".concat(inspect(iface), "."), getAllImplementsInterfaceNodes(object, iface));
395
- continue;
396
- }
397
-
398
- if (implementedTypeNames[iface.name]) {
399
- context.reportError("Type ".concat(object.name, " can only implement ").concat(iface.name, " once."), getAllImplementsInterfaceNodes(object, iface));
400
- continue;
401
- }
276
+ for (var _i14 = 0, _object$getInterfaces2 = object.getInterfaces(); _i14 < _object$getInterfaces2.length; _i14++) {
277
+ var iface = _object$getInterfaces2[_i14];
402
278
 
403
- implementedTypeNames[iface.name] = true;
404
- validateObjectImplementsInterface(context, object, iface);
279
+ if (!isInterfaceType(iface)) {
280
+ context.reportError("Type ".concat(inspect(object), " must only implement Interface types, ") + "it cannot implement ".concat(inspect(iface), "."), getAllImplementsInterfaceNodes(object, iface));
281
+ continue;
405
282
  }
406
- } catch (err) {
407
- _didIteratorError7 = true;
408
- _iteratorError7 = err;
409
- } finally {
410
- try {
411
- if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
412
- _iterator7.return();
413
- }
414
- } finally {
415
- if (_didIteratorError7) {
416
- throw _iteratorError7;
417
- }
283
+
284
+ if (implementedTypeNames[iface.name]) {
285
+ context.reportError("Type ".concat(object.name, " can only implement ").concat(iface.name, " once."), getAllImplementsInterfaceNodes(object, iface));
286
+ continue;
418
287
  }
288
+
289
+ implementedTypeNames[iface.name] = true;
290
+ validateObjectImplementsInterface(context, object, iface);
419
291
  }
420
292
  }
421
293
 
@@ -423,123 +295,66 @@ function validateObjectImplementsInterface(context, object, iface) {
423
295
  var objectFieldMap = object.getFields();
424
296
  var ifaceFieldMap = iface.getFields(); // Assert each interface field is implemented.
425
297
 
426
- var _iteratorNormalCompletion8 = true;
427
- var _didIteratorError8 = false;
428
- var _iteratorError8 = undefined;
429
-
430
- try {
431
- for (var _iterator8 = objectEntries(ifaceFieldMap)[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
432
- var _ref6 = _step8.value;
433
- var fieldName = _ref6[0];
434
- var ifaceField = _ref6[1];
435
- var objectField = objectFieldMap[fieldName]; // Assert interface field exists on object.
436
-
437
- if (!objectField) {
438
- context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expected but ").concat(object.name, " does not provide it."), [ifaceField.astNode].concat(getAllNodes(object)));
439
- continue;
440
- } // Assert interface field type is satisfied by object field type, by being
441
- // a valid subtype. (covariant)
442
-
443
-
444
- if (!isTypeSubTypeOf(context.schema, objectField.type, ifaceField.type)) {
445
- context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expects type ") + "".concat(inspect(ifaceField.type), " but ").concat(object.name, ".").concat(fieldName, " ") + "is type ".concat(inspect(objectField.type), "."), [ifaceField.astNode && ifaceField.astNode.type, objectField.astNode && objectField.astNode.type]);
446
- } // Assert each interface field arg is implemented.
447
-
448
-
449
- var _iteratorNormalCompletion9 = true;
450
- var _didIteratorError9 = false;
451
- var _iteratorError9 = undefined;
452
-
453
- try {
454
- var _loop3 = function _loop3() {
455
- var ifaceArg = _step9.value;
456
- var argName = ifaceArg.name;
457
- var objectArg = find(objectField.args, function (arg) {
458
- return arg.name === argName;
459
- }); // Assert interface field arg exists on object field.
460
-
461
- if (!objectArg) {
462
- context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) expected but ").concat(object.name, ".").concat(fieldName, " does not provide it."), [ifaceArg.astNode, objectField.astNode]);
463
- return "continue";
464
- } // Assert interface field arg type matches object field arg type.
465
- // (invariant)
466
- // TODO: change to contravariant?
467
-
468
-
469
- if (!isEqualType(ifaceArg.type, objectArg.type)) {
470
- context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) ") + "expects type ".concat(inspect(ifaceArg.type), " but ") + "".concat(object.name, ".").concat(fieldName, "(").concat(argName, ":) is type ") + "".concat(inspect(objectArg.type), "."), [ifaceArg.astNode && ifaceArg.astNode.type, objectArg.astNode && objectArg.astNode.type]);
471
- } // TODO: validate default values?
472
-
473
- };
474
-
475
- for (var _iterator9 = ifaceField.args[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
476
- var _ret2 = _loop3();
477
-
478
- if (_ret2 === "continue") continue;
479
- } // Assert additional arguments must not be required.
480
-
481
- } catch (err) {
482
- _didIteratorError9 = true;
483
- _iteratorError9 = err;
484
- } finally {
485
- try {
486
- if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
487
- _iterator9.return();
488
- }
489
- } finally {
490
- if (_didIteratorError9) {
491
- throw _iteratorError9;
492
- }
493
- }
494
- }
298
+ for (var _i16 = 0, _objectEntries2 = objectEntries(ifaceFieldMap); _i16 < _objectEntries2.length; _i16++) {
299
+ var _ref6 = _objectEntries2[_i16];
300
+ var fieldName = _ref6[0];
301
+ var ifaceField = _ref6[1];
302
+ var objectField = objectFieldMap[fieldName]; // Assert interface field exists on object.
495
303
 
496
- var _iteratorNormalCompletion10 = true;
497
- var _didIteratorError10 = false;
498
- var _iteratorError10 = undefined;
499
-
500
- try {
501
- var _loop4 = function _loop4() {
502
- var objectArg = _step10.value;
503
- var argName = objectArg.name;
504
- var ifaceArg = find(ifaceField.args, function (arg) {
505
- return arg.name === argName;
506
- });
507
-
508
- if (!ifaceArg && isRequiredArgument(objectArg)) {
509
- context.reportError("Object field ".concat(object.name, ".").concat(fieldName, " includes required argument ").concat(argName, " that is missing from the Interface field ").concat(iface.name, ".").concat(fieldName, "."), [objectArg.astNode, ifaceField.astNode]);
510
- }
511
- };
512
-
513
- for (var _iterator10 = objectField.args[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
514
- _loop4();
515
- }
516
- } catch (err) {
517
- _didIteratorError10 = true;
518
- _iteratorError10 = err;
519
- } finally {
520
- try {
521
- if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
522
- _iterator10.return();
523
- }
524
- } finally {
525
- if (_didIteratorError10) {
526
- throw _iteratorError10;
527
- }
528
- }
529
- }
530
- }
531
- } catch (err) {
532
- _didIteratorError8 = true;
533
- _iteratorError8 = err;
534
- } finally {
535
- try {
536
- if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
537
- _iterator8.return();
538
- }
539
- } finally {
540
- if (_didIteratorError8) {
541
- throw _iteratorError8;
304
+ if (!objectField) {
305
+ context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expected but ").concat(object.name, " does not provide it."), [ifaceField.astNode].concat(getAllNodes(object)));
306
+ continue;
307
+ } // Assert interface field type is satisfied by object field type, by being
308
+ // a valid subtype. (covariant)
309
+
310
+
311
+ if (!isTypeSubTypeOf(context.schema, objectField.type, ifaceField.type)) {
312
+ context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expects type ") + "".concat(inspect(ifaceField.type), " but ").concat(object.name, ".").concat(fieldName, " ") + "is type ".concat(inspect(objectField.type), "."), [ifaceField.astNode && ifaceField.astNode.type, objectField.astNode && objectField.astNode.type]);
313
+ } // Assert each interface field arg is implemented.
314
+
315
+
316
+ var _loop3 = function _loop3(_i18, _ifaceField$args2) {
317
+ var ifaceArg = _ifaceField$args2[_i18];
318
+ var argName = ifaceArg.name;
319
+ var objectArg = find(objectField.args, function (arg) {
320
+ return arg.name === argName;
321
+ }); // Assert interface field arg exists on object field.
322
+
323
+ if (!objectArg) {
324
+ context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) expected but ").concat(object.name, ".").concat(fieldName, " does not provide it."), [ifaceArg.astNode, objectField.astNode]);
325
+ return "continue";
326
+ } // Assert interface field arg type matches object field arg type.
327
+ // (invariant)
328
+ // TODO: change to contravariant?
329
+
330
+
331
+ if (!isEqualType(ifaceArg.type, objectArg.type)) {
332
+ context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) ") + "expects type ".concat(inspect(ifaceArg.type), " but ") + "".concat(object.name, ".").concat(fieldName, "(").concat(argName, ":) is type ") + "".concat(inspect(objectArg.type), "."), [ifaceArg.astNode && ifaceArg.astNode.type, objectArg.astNode && objectArg.astNode.type]);
333
+ } // TODO: validate default values?
334
+
335
+ };
336
+
337
+ for (var _i18 = 0, _ifaceField$args2 = ifaceField.args; _i18 < _ifaceField$args2.length; _i18++) {
338
+ var _ret2 = _loop3(_i18, _ifaceField$args2);
339
+
340
+ if (_ret2 === "continue") continue;
341
+ } // Assert additional arguments must not be required.
342
+
343
+
344
+ var _loop4 = function _loop4(_i20, _objectField$args2) {
345
+ var objectArg = _objectField$args2[_i20];
346
+ var argName = objectArg.name;
347
+ var ifaceArg = find(ifaceField.args, function (arg) {
348
+ return arg.name === argName;
349
+ });
350
+
351
+ if (!ifaceArg && isRequiredArgument(objectArg)) {
352
+ context.reportError("Object field ".concat(object.name, ".").concat(fieldName, " includes required argument ").concat(argName, " that is missing from the Interface field ").concat(iface.name, ".").concat(fieldName, "."), [objectArg.astNode, ifaceField.astNode]);
542
353
  }
354
+ };
355
+
356
+ for (var _i20 = 0, _objectField$args2 = objectField.args; _i20 < _objectField$args2.length; _i20++) {
357
+ _loop4(_i20, _objectField$args2);
543
358
  }
544
359
  }
545
360
  }
@@ -552,37 +367,19 @@ function validateUnionMembers(context, union) {
552
367
  }
553
368
 
554
369
  var includedTypeNames = Object.create(null);
555
- var _iteratorNormalCompletion11 = true;
556
- var _didIteratorError11 = false;
557
- var _iteratorError11 = undefined;
558
370
 
559
- try {
560
- for (var _iterator11 = memberTypes[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
561
- var memberType = _step11.value;
371
+ for (var _i22 = 0; _i22 < memberTypes.length; _i22++) {
372
+ var memberType = memberTypes[_i22];
562
373
 
563
- if (includedTypeNames[memberType.name]) {
564
- context.reportError("Union type ".concat(union.name, " can only include type ").concat(memberType.name, " once."), getUnionMemberTypeNodes(union, memberType.name));
565
- continue;
566
- }
374
+ if (includedTypeNames[memberType.name]) {
375
+ context.reportError("Union type ".concat(union.name, " can only include type ").concat(memberType.name, " once."), getUnionMemberTypeNodes(union, memberType.name));
376
+ continue;
377
+ }
567
378
 
568
- includedTypeNames[memberType.name] = true;
379
+ includedTypeNames[memberType.name] = true;
569
380
 
570
- if (!isObjectType(memberType)) {
571
- context.reportError("Union type ".concat(union.name, " can only include Object types, ") + "it cannot include ".concat(inspect(memberType), "."), getUnionMemberTypeNodes(union, String(memberType)));
572
- }
573
- }
574
- } catch (err) {
575
- _didIteratorError11 = true;
576
- _iteratorError11 = err;
577
- } finally {
578
- try {
579
- if (!_iteratorNormalCompletion11 && _iterator11.return != null) {
580
- _iterator11.return();
581
- }
582
- } finally {
583
- if (_didIteratorError11) {
584
- throw _iteratorError11;
585
- }
381
+ if (!isObjectType(memberType)) {
382
+ context.reportError("Union type ".concat(union.name, " can only include Object types, ") + "it cannot include ".concat(inspect(memberType), "."), getUnionMemberTypeNodes(union, String(memberType)));
586
383
  }
587
384
  }
588
385
  }
@@ -594,33 +391,14 @@ function validateEnumValues(context, enumType) {
594
391
  context.reportError("Enum type ".concat(enumType.name, " must define one or more values."), getAllNodes(enumType));
595
392
  }
596
393
 
597
- var _iteratorNormalCompletion12 = true;
598
- var _didIteratorError12 = false;
599
- var _iteratorError12 = undefined;
600
-
601
- try {
602
- for (var _iterator12 = enumValues[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
603
- var enumValue = _step12.value;
604
- var valueName = enumValue.name; // Ensure valid name.
394
+ for (var _i24 = 0; _i24 < enumValues.length; _i24++) {
395
+ var enumValue = enumValues[_i24];
396
+ var valueName = enumValue.name; // Ensure valid name.
605
397
 
606
- validateName(context, enumValue);
398
+ validateName(context, enumValue);
607
399
 
608
- if (valueName === 'true' || valueName === 'false' || valueName === 'null') {
609
- context.reportError("Enum type ".concat(enumType.name, " cannot include value: ").concat(valueName, "."), enumValue.astNode);
610
- }
611
- }
612
- } catch (err) {
613
- _didIteratorError12 = true;
614
- _iteratorError12 = err;
615
- } finally {
616
- try {
617
- if (!_iteratorNormalCompletion12 && _iterator12.return != null) {
618
- _iterator12.return();
619
- }
620
- } finally {
621
- if (_didIteratorError12) {
622
- throw _iteratorError12;
623
- }
400
+ if (valueName === 'true' || valueName === 'false' || valueName === 'null') {
401
+ context.reportError("Enum type ".concat(enumType.name, " cannot include value: ").concat(valueName, "."), enumValue.astNode);
624
402
  }
625
403
  }
626
404
  }
@@ -633,32 +411,13 @@ function validateInputFields(context, inputObj) {
633
411
  } // Ensure the arguments are valid
634
412
 
635
413
 
636
- var _iteratorNormalCompletion13 = true;
637
- var _didIteratorError13 = false;
638
- var _iteratorError13 = undefined;
639
-
640
- try {
641
- for (var _iterator13 = fields[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
642
- var field = _step13.value;
643
- // Ensure they are named correctly.
644
- validateName(context, field); // Ensure the type is an input type
414
+ for (var _i26 = 0; _i26 < fields.length; _i26++) {
415
+ var field = fields[_i26];
416
+ // Ensure they are named correctly.
417
+ validateName(context, field); // Ensure the type is an input type
645
418
 
646
- if (!isInputType(field.type)) {
647
- context.reportError("The type of ".concat(inputObj.name, ".").concat(field.name, " must be Input Type ") + "but got: ".concat(inspect(field.type), "."), field.astNode && field.astNode.type);
648
- }
649
- }
650
- } catch (err) {
651
- _didIteratorError13 = true;
652
- _iteratorError13 = err;
653
- } finally {
654
- try {
655
- if (!_iteratorNormalCompletion13 && _iterator13.return != null) {
656
- _iterator13.return();
657
- }
658
- } finally {
659
- if (_didIteratorError13) {
660
- throw _iteratorError13;
661
- }
419
+ if (!isInputType(field.type)) {
420
+ context.reportError("The type of ".concat(inputObj.name, ".").concat(field.name, " must be Input Type ") + "but got: ".concat(inspect(field.type), "."), field.astNode && field.astNode.type);
662
421
  }
663
422
  }
664
423
  }
@@ -684,46 +443,28 @@ function createInputObjectCircularRefsValidator(context) {
684
443
  visitedTypes[inputObj.name] = true;
685
444
  fieldPathIndexByTypeName[inputObj.name] = fieldPath.length;
686
445
  var fields = objectValues(inputObj.getFields());
687
- var _iteratorNormalCompletion14 = true;
688
- var _didIteratorError14 = false;
689
- var _iteratorError14 = undefined;
690
-
691
- try {
692
- for (var _iterator14 = fields[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
693
- var field = _step14.value;
694
-
695
- if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) {
696
- var fieldType = field.type.ofType;
697
- var cycleIndex = fieldPathIndexByTypeName[fieldType.name];
698
- fieldPath.push(field);
699
-
700
- if (cycleIndex === undefined) {
701
- detectCycleRecursive(fieldType);
702
- } else {
703
- var cyclePath = fieldPath.slice(cycleIndex);
704
- var pathStr = cyclePath.map(function (fieldObj) {
705
- return fieldObj.name;
706
- }).join('.');
707
- context.reportError("Cannot reference Input Object \"".concat(fieldType.name, "\" within itself through a series of non-null fields: \"").concat(pathStr, "\"."), cyclePath.map(function (fieldObj) {
708
- return fieldObj.astNode;
709
- }));
710
- }
711
-
712
- fieldPath.pop();
713
- }
714
- }
715
- } catch (err) {
716
- _didIteratorError14 = true;
717
- _iteratorError14 = err;
718
- } finally {
719
- try {
720
- if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
721
- _iterator14.return();
722
- }
723
- } finally {
724
- if (_didIteratorError14) {
725
- throw _iteratorError14;
446
+
447
+ for (var _i28 = 0; _i28 < fields.length; _i28++) {
448
+ var field = fields[_i28];
449
+
450
+ if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) {
451
+ var fieldType = field.type.ofType;
452
+ var cycleIndex = fieldPathIndexByTypeName[fieldType.name];
453
+ fieldPath.push(field);
454
+
455
+ if (cycleIndex === undefined) {
456
+ detectCycleRecursive(fieldType);
457
+ } else {
458
+ var cyclePath = fieldPath.slice(cycleIndex);
459
+ var pathStr = cyclePath.map(function (fieldObj) {
460
+ return fieldObj.name;
461
+ }).join('.');
462
+ context.reportError("Cannot reference Input Object \"".concat(fieldType.name, "\" within itself through a series of non-null fields: \"").concat(pathStr, "\"."), cyclePath.map(function (fieldObj) {
463
+ return fieldObj.astNode;
464
+ }));
726
465
  }
466
+
467
+ fieldPath.pop();
727
468
  }
728
469
  }
729
470