graphql 14.0.2 → 14.2.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 (361) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +5 -5
  3. package/codecov.yml +14 -0
  4. package/error/GraphQLError.js +2 -2
  5. package/error/GraphQLError.js.flow +4 -4
  6. package/error/GraphQLError.mjs +2 -2
  7. package/error/formatError.js +2 -2
  8. package/error/formatError.js.flow +1 -1
  9. package/error/formatError.mjs +2 -2
  10. package/error/index.js.flow +1 -1
  11. package/error/index.mjs +2 -2
  12. package/error/locatedError.js +2 -2
  13. package/error/locatedError.js.flow +1 -1
  14. package/error/locatedError.mjs +2 -2
  15. package/error/printError.js +2 -2
  16. package/error/printError.js.flow +1 -1
  17. package/error/printError.mjs +2 -2
  18. package/error/syntaxError.js +2 -2
  19. package/error/syntaxError.js.flow +1 -1
  20. package/error/syntaxError.mjs +2 -2
  21. package/execution/execute.js +20 -11
  22. package/execution/execute.js.flow +41 -27
  23. package/execution/execute.mjs +19 -13
  24. package/execution/index.js +6 -0
  25. package/execution/index.js.flow +7 -2
  26. package/execution/index.mjs +3 -3
  27. package/execution/values.js +10 -10
  28. package/execution/values.js.flow +8 -8
  29. package/execution/values.mjs +9 -9
  30. package/graphql.js +8 -8
  31. package/graphql.js.flow +18 -4
  32. package/graphql.mjs +8 -8
  33. package/index.js +18 -0
  34. package/index.js.flow +4 -1
  35. package/index.mjs +4 -4
  36. package/jsutils/ObjMap.js.flow +1 -1
  37. package/jsutils/{MaybePromise.js → PromiseOrValue.js} +0 -0
  38. package/jsutils/{MaybePromise.js.flow → PromiseOrValue.js.flow} +2 -2
  39. package/jsutils/{MaybePromise.mjs → PromiseOrValue.mjs} +0 -0
  40. package/jsutils/dedent.js +2 -2
  41. package/jsutils/dedent.js.flow +1 -1
  42. package/jsutils/dedent.mjs +2 -2
  43. package/jsutils/defineToJSON.js +18 -7
  44. package/jsutils/defineToJSON.js.flow +15 -6
  45. package/jsutils/defineToJSON.mjs +15 -7
  46. package/jsutils/defineToStringTag.js +6 -6
  47. package/jsutils/defineToStringTag.js.flow +4 -4
  48. package/jsutils/defineToStringTag.mjs +5 -5
  49. package/jsutils/inspect.js +109 -23
  50. package/jsutils/inspect.js.flow +112 -14
  51. package/jsutils/inspect.mjs +108 -17
  52. package/jsutils/instanceOf.js +2 -2
  53. package/jsutils/instanceOf.js.flow +1 -1
  54. package/jsutils/instanceOf.mjs +2 -2
  55. package/jsutils/invariant.js +2 -2
  56. package/jsutils/invariant.js.flow +1 -1
  57. package/jsutils/invariant.mjs +2 -2
  58. package/jsutils/isInvalid.js +2 -2
  59. package/jsutils/isInvalid.js.flow +1 -1
  60. package/jsutils/isInvalid.mjs +2 -2
  61. package/jsutils/isNullish.js +2 -2
  62. package/jsutils/isNullish.js.flow +1 -1
  63. package/jsutils/isNullish.mjs +2 -2
  64. package/jsutils/isPromise.js +2 -2
  65. package/jsutils/isPromise.js.flow +1 -1
  66. package/jsutils/isPromise.mjs +2 -2
  67. package/jsutils/keyMap.js +2 -2
  68. package/jsutils/keyMap.js.flow +1 -1
  69. package/jsutils/keyMap.mjs +2 -2
  70. package/jsutils/keyValMap.js +2 -2
  71. package/jsutils/keyValMap.js.flow +1 -1
  72. package/jsutils/keyValMap.mjs +2 -2
  73. package/jsutils/mapValue.js +54 -0
  74. package/jsutils/mapValue.js.flow +27 -0
  75. package/jsutils/mapValue.mjs +44 -0
  76. package/jsutils/memoize3.js +2 -2
  77. package/jsutils/memoize3.js.flow +1 -1
  78. package/jsutils/memoize3.mjs +2 -2
  79. package/jsutils/nodejsCustomInspectSymbol.js +18 -0
  80. package/jsutils/nodejsCustomInspectSymbol.js.flow +15 -0
  81. package/jsutils/nodejsCustomInspectSymbol.mjs +10 -0
  82. package/jsutils/orList.js +18 -5
  83. package/jsutils/orList.js.flow +14 -8
  84. package/jsutils/orList.mjs +15 -5
  85. package/jsutils/promiseForObject.js +2 -2
  86. package/jsutils/promiseForObject.js.flow +1 -1
  87. package/jsutils/promiseForObject.mjs +2 -2
  88. package/jsutils/promiseReduce.js +2 -2
  89. package/jsutils/promiseReduce.js.flow +5 -5
  90. package/jsutils/promiseReduce.mjs +2 -2
  91. package/jsutils/quotedOrList.js +2 -2
  92. package/jsutils/quotedOrList.js.flow +1 -1
  93. package/jsutils/quotedOrList.mjs +2 -2
  94. package/jsutils/suggestionList.js +2 -2
  95. package/jsutils/suggestionList.js.flow +1 -1
  96. package/jsutils/suggestionList.mjs +2 -2
  97. package/language/ast.js.flow +1 -1
  98. package/language/{blockStringValue.mjs → blockString.js} +39 -3
  99. package/language/{blockStringValue.js.flow → blockString.js.flow} +31 -2
  100. package/language/{blockStringValue.js → blockString.mjs} +31 -10
  101. package/language/directiveLocation.js +2 -2
  102. package/language/directiveLocation.js.flow +1 -1
  103. package/language/directiveLocation.mjs +2 -2
  104. package/language/index.js.flow +1 -1
  105. package/language/index.mjs +2 -2
  106. package/language/kinds.js +2 -2
  107. package/language/kinds.js.flow +1 -1
  108. package/language/kinds.mjs +2 -2
  109. package/language/lexer.js +60 -46
  110. package/language/lexer.js.flow +71 -69
  111. package/language/lexer.mjs +58 -45
  112. package/language/location.js +2 -2
  113. package/language/location.js.flow +1 -1
  114. package/language/location.mjs +2 -2
  115. package/language/parser.js +84 -83
  116. package/language/parser.js.flow +85 -94
  117. package/language/parser.mjs +83 -83
  118. package/language/predicates.js +2 -2
  119. package/language/predicates.js.flow +1 -1
  120. package/language/predicates.mjs +2 -2
  121. package/language/printer.js +15 -17
  122. package/language/printer.js.flow +21 -20
  123. package/language/printer.mjs +14 -17
  124. package/language/source.js +8 -7
  125. package/language/source.js.flow +1 -1
  126. package/language/source.mjs +2 -10
  127. package/language/visitor.js +7 -6
  128. package/language/visitor.js.flow +3 -5
  129. package/language/visitor.mjs +7 -6
  130. package/package.json +5 -2
  131. package/polyfills/find.js +31 -0
  132. package/polyfills/find.js.flow +29 -0
  133. package/polyfills/find.mjs +23 -0
  134. package/polyfills/flatMap.js +38 -0
  135. package/polyfills/flatMap.js.flow +34 -0
  136. package/polyfills/flatMap.mjs +30 -0
  137. package/{jsutils → polyfills}/isFinite.js +2 -2
  138. package/{jsutils → polyfills}/isFinite.js.flow +1 -1
  139. package/{jsutils → polyfills}/isFinite.mjs +2 -2
  140. package/{jsutils → polyfills}/isInteger.js +2 -2
  141. package/{jsutils → polyfills}/isInteger.js.flow +1 -1
  142. package/{jsutils → polyfills}/isInteger.mjs +2 -2
  143. package/polyfills/objectEntries.js +26 -0
  144. package/polyfills/objectEntries.js.flow +19 -0
  145. package/polyfills/objectEntries.mjs +18 -0
  146. package/{jsutils → polyfills}/objectValues.js +2 -2
  147. package/{jsutils → polyfills}/objectValues.js.flow +2 -2
  148. package/{jsutils → polyfills}/objectValues.mjs +2 -2
  149. package/subscription/asyncIteratorReject.js.flow +1 -1
  150. package/subscription/asyncIteratorReject.mjs +2 -2
  151. package/subscription/index.js.flow +1 -1
  152. package/subscription/index.mjs +2 -2
  153. package/subscription/mapAsyncIterator.js.flow +5 -5
  154. package/subscription/mapAsyncIterator.mjs +2 -2
  155. package/subscription/subscribe.js +2 -2
  156. package/subscription/subscribe.js.flow +1 -1
  157. package/subscription/subscribe.mjs +2 -2
  158. package/type/definition.js +161 -138
  159. package/type/definition.js.flow +193 -57
  160. package/type/definition.mjs +158 -140
  161. package/type/directives.js +35 -29
  162. package/type/directives.js.flow +39 -21
  163. package/type/directives.mjs +34 -31
  164. package/type/index.js +12 -0
  165. package/type/index.js.flow +5 -1
  166. package/type/index.mjs +6 -4
  167. package/type/introspection.js +11 -7
  168. package/type/introspection.js.flow +11 -8
  169. package/type/introspection.mjs +11 -7
  170. package/type/scalars.js +45 -34
  171. package/type/scalars.js.flow +41 -27
  172. package/type/scalars.mjs +45 -27
  173. package/type/schema.js +134 -88
  174. package/type/schema.js.flow +77 -11
  175. package/type/schema.mjs +132 -88
  176. package/type/validate.js +152 -187
  177. package/type/validate.js.flow +12 -61
  178. package/type/validate.mjs +143 -188
  179. package/utilities/TypeInfo.js +10 -23
  180. package/utilities/TypeInfo.js.flow +2 -2
  181. package/utilities/TypeInfo.mjs +3 -25
  182. package/utilities/assertValidName.js +2 -2
  183. package/utilities/assertValidName.js.flow +1 -1
  184. package/utilities/assertValidName.mjs +2 -2
  185. package/utilities/astFromValue.js +7 -6
  186. package/utilities/astFromValue.js.flow +7 -6
  187. package/utilities/astFromValue.mjs +9 -8
  188. package/utilities/buildASTSchema.js +213 -197
  189. package/utilities/buildASTSchema.js.flow +163 -173
  190. package/utilities/buildASTSchema.mjs +203 -198
  191. package/utilities/buildClientSchema.js +39 -47
  192. package/utilities/buildClientSchema.js.flow +49 -58
  193. package/utilities/buildClientSchema.mjs +38 -46
  194. package/utilities/coerceValue.js +41 -21
  195. package/utilities/coerceValue.js.flow +44 -49
  196. package/utilities/coerceValue.mjs +42 -23
  197. package/utilities/concatAST.js +9 -13
  198. package/utilities/concatAST.js.flow +3 -9
  199. package/utilities/concatAST.mjs +6 -13
  200. package/utilities/extendSchema.js +256 -630
  201. package/utilities/extendSchema.js.flow +190 -426
  202. package/utilities/extendSchema.mjs +256 -631
  203. package/utilities/findBreakingChanges.js +8 -6
  204. package/utilities/findBreakingChanges.js.flow +4 -3
  205. package/utilities/findBreakingChanges.mjs +7 -6
  206. package/utilities/findDeprecatedUsages.js +4 -4
  207. package/utilities/findDeprecatedUsages.js.flow +3 -3
  208. package/utilities/findDeprecatedUsages.mjs +4 -4
  209. package/utilities/getOperationAST.js +2 -2
  210. package/utilities/getOperationAST.js.flow +1 -1
  211. package/utilities/getOperationAST.mjs +2 -2
  212. package/utilities/getOperationRootType.js +6 -6
  213. package/utilities/getOperationRootType.js.flow +9 -7
  214. package/utilities/getOperationRootType.mjs +6 -6
  215. package/utilities/index.js.flow +1 -1
  216. package/utilities/index.mjs +2 -2
  217. package/utilities/introspectionFromSchema.js +2 -2
  218. package/utilities/introspectionFromSchema.js.flow +1 -1
  219. package/utilities/introspectionFromSchema.mjs +2 -2
  220. package/utilities/introspectionQuery.js +2 -2
  221. package/utilities/introspectionQuery.js.flow +1 -1
  222. package/utilities/introspectionQuery.mjs +2 -2
  223. package/utilities/isValidJSValue.js +4 -2
  224. package/utilities/isValidJSValue.js.flow +2 -1
  225. package/utilities/isValidJSValue.mjs +4 -2
  226. package/utilities/isValidLiteralValue.js +2 -2
  227. package/utilities/isValidLiteralValue.js.flow +1 -1
  228. package/utilities/isValidLiteralValue.mjs +2 -2
  229. package/utilities/lexicographicSortSchema.js +86 -124
  230. package/utilities/lexicographicSortSchema.js.flow +68 -96
  231. package/utilities/lexicographicSortSchema.mjs +86 -124
  232. package/utilities/schemaPrinter.js +47 -73
  233. package/utilities/schemaPrinter.js.flow +62 -111
  234. package/utilities/schemaPrinter.mjs +46 -73
  235. package/utilities/separateOperations.js +11 -10
  236. package/utilities/separateOperations.js.flow +1 -1
  237. package/utilities/separateOperations.mjs +11 -10
  238. package/utilities/typeComparators.js +2 -2
  239. package/utilities/typeComparators.js.flow +1 -1
  240. package/utilities/typeComparators.mjs +2 -2
  241. package/utilities/typeFromAST.js +9 -4
  242. package/utilities/typeFromAST.js.flow +5 -2
  243. package/utilities/typeFromAST.mjs +6 -4
  244. package/utilities/valueFromAST.js +9 -6
  245. package/utilities/valueFromAST.js.flow +5 -3
  246. package/utilities/valueFromAST.mjs +7 -5
  247. package/utilities/valueFromASTUntyped.js +7 -4
  248. package/utilities/valueFromASTUntyped.js.flow +5 -2
  249. package/utilities/valueFromASTUntyped.mjs +6 -4
  250. package/validation/ValidationContext.js +57 -82
  251. package/validation/ValidationContext.js.flow +53 -50
  252. package/validation/ValidationContext.mjs +53 -78
  253. package/validation/index.js.flow +1 -1
  254. package/validation/index.mjs +2 -2
  255. package/validation/rules/ExecutableDefinitions.js +3 -3
  256. package/validation/rules/ExecutableDefinitions.js.flow +3 -3
  257. package/validation/rules/ExecutableDefinitions.mjs +3 -3
  258. package/validation/rules/FieldsOnCorrectType.js +3 -3
  259. package/validation/rules/FieldsOnCorrectType.js.flow +2 -2
  260. package/validation/rules/FieldsOnCorrectType.mjs +3 -3
  261. package/validation/rules/FragmentsOnCompositeTypes.js +4 -4
  262. package/validation/rules/FragmentsOnCompositeTypes.js.flow +3 -3
  263. package/validation/rules/FragmentsOnCompositeTypes.mjs +4 -4
  264. package/validation/rules/KnownArgumentNames.js.flow +1 -1
  265. package/validation/rules/KnownArgumentNames.mjs +2 -2
  266. package/validation/rules/KnownDirectives.js +4 -4
  267. package/validation/rules/KnownDirectives.js.flow +5 -4
  268. package/validation/rules/KnownDirectives.mjs +4 -4
  269. package/validation/rules/KnownFragmentNames.js +3 -3
  270. package/validation/rules/KnownFragmentNames.js.flow +2 -2
  271. package/validation/rules/KnownFragmentNames.mjs +3 -3
  272. package/validation/rules/KnownTypeNames.js +60 -22
  273. package/validation/rules/KnownTypeNames.js.flow +55 -21
  274. package/validation/rules/KnownTypeNames.mjs +57 -22
  275. package/validation/rules/LoneAnonymousOperation.js +3 -3
  276. package/validation/rules/LoneAnonymousOperation.js.flow +2 -2
  277. package/validation/rules/LoneAnonymousOperation.mjs +3 -3
  278. package/validation/rules/LoneSchemaDefinition.js +2 -2
  279. package/validation/rules/LoneSchemaDefinition.js.flow +1 -1
  280. package/validation/rules/LoneSchemaDefinition.mjs +2 -2
  281. package/validation/rules/NoFragmentCycles.js +2 -2
  282. package/validation/rules/NoFragmentCycles.js.flow +3 -3
  283. package/validation/rules/NoFragmentCycles.mjs +2 -2
  284. package/validation/rules/NoUndefinedVariables.js +2 -2
  285. package/validation/rules/NoUndefinedVariables.js.flow +1 -1
  286. package/validation/rules/NoUndefinedVariables.mjs +2 -2
  287. package/validation/rules/NoUnusedFragments.js +10 -7
  288. package/validation/rules/NoUnusedFragments.js.flow +4 -4
  289. package/validation/rules/NoUnusedFragments.mjs +10 -7
  290. package/validation/rules/NoUnusedVariables.js +7 -5
  291. package/validation/rules/NoUnusedVariables.js.flow +4 -3
  292. package/validation/rules/NoUnusedVariables.mjs +7 -5
  293. package/validation/rules/OverlappingFieldsCanBeMerged.js +58 -33
  294. package/validation/rules/OverlappingFieldsCanBeMerged.js.flow +4 -4
  295. package/validation/rules/OverlappingFieldsCanBeMerged.mjs +50 -34
  296. package/validation/rules/PossibleFragmentSpreads.js +4 -4
  297. package/validation/rules/PossibleFragmentSpreads.js.flow +3 -3
  298. package/validation/rules/PossibleFragmentSpreads.mjs +4 -4
  299. package/validation/rules/PossibleTypeExtensions.js +158 -0
  300. package/validation/rules/PossibleTypeExtensions.js.flow +160 -0
  301. package/validation/rules/PossibleTypeExtensions.mjs +146 -0
  302. package/validation/rules/ProvidedRequiredArguments.js +3 -3
  303. package/validation/rules/ProvidedRequiredArguments.js.flow +4 -4
  304. package/validation/rules/ProvidedRequiredArguments.mjs +5 -5
  305. package/validation/rules/ScalarLeafs.js +4 -4
  306. package/validation/rules/ScalarLeafs.js.flow +3 -3
  307. package/validation/rules/ScalarLeafs.mjs +4 -4
  308. package/validation/rules/SingleFieldSubscriptions.js +2 -2
  309. package/validation/rules/SingleFieldSubscriptions.js.flow +1 -1
  310. package/validation/rules/SingleFieldSubscriptions.mjs +2 -2
  311. package/validation/rules/UniqueArgumentNames.js +2 -2
  312. package/validation/rules/UniqueArgumentNames.js.flow +1 -1
  313. package/validation/rules/UniqueArgumentNames.mjs +2 -2
  314. package/validation/rules/UniqueDirectiveNames.js +55 -0
  315. package/validation/rules/UniqueDirectiveNames.js.flow +64 -0
  316. package/validation/rules/UniqueDirectiveNames.mjs +43 -0
  317. package/validation/rules/UniqueDirectivesPerLocation.js +2 -2
  318. package/validation/rules/UniqueDirectivesPerLocation.js.flow +1 -1
  319. package/validation/rules/UniqueDirectivesPerLocation.mjs +2 -2
  320. package/validation/rules/UniqueEnumValueNames.js +90 -0
  321. package/validation/rules/UniqueEnumValueNames.js.flow +85 -0
  322. package/validation/rules/UniqueEnumValueNames.mjs +77 -0
  323. package/validation/rules/UniqueFieldDefinitionNames.js +101 -0
  324. package/validation/rules/UniqueFieldDefinitionNames.js.flow +99 -0
  325. package/validation/rules/UniqueFieldDefinitionNames.mjs +88 -0
  326. package/validation/rules/UniqueFragmentNames.js +2 -2
  327. package/validation/rules/UniqueFragmentNames.js.flow +1 -1
  328. package/validation/rules/UniqueFragmentNames.mjs +2 -2
  329. package/validation/rules/UniqueInputFieldNames.js +2 -4
  330. package/validation/rules/UniqueInputFieldNames.js.flow +1 -2
  331. package/validation/rules/UniqueInputFieldNames.mjs +2 -4
  332. package/validation/rules/UniqueOperationNames.js +2 -2
  333. package/validation/rules/UniqueOperationNames.js.flow +1 -1
  334. package/validation/rules/UniqueOperationNames.mjs +2 -2
  335. package/validation/rules/UniqueOperationTypes.js +85 -0
  336. package/validation/rules/UniqueOperationTypes.js.flow +76 -0
  337. package/validation/rules/UniqueOperationTypes.mjs +73 -0
  338. package/validation/rules/UniqueTypeNames.js +62 -0
  339. package/validation/rules/UniqueTypeNames.js.flow +67 -0
  340. package/validation/rules/UniqueTypeNames.mjs +50 -0
  341. package/validation/rules/UniqueVariableNames.js +2 -2
  342. package/validation/rules/UniqueVariableNames.js.flow +1 -1
  343. package/validation/rules/UniqueVariableNames.mjs +2 -2
  344. package/validation/rules/ValuesOfCorrectType.js +30 -14
  345. package/validation/rules/ValuesOfCorrectType.js.flow +5 -6
  346. package/validation/rules/ValuesOfCorrectType.mjs +29 -14
  347. package/validation/rules/VariablesAreInputTypes.js +3 -3
  348. package/validation/rules/VariablesAreInputTypes.js.flow +2 -2
  349. package/validation/rules/VariablesAreInputTypes.mjs +3 -3
  350. package/validation/rules/VariablesInAllowedPosition.js +5 -5
  351. package/validation/rules/VariablesInAllowedPosition.js.flow +1 -1
  352. package/validation/rules/VariablesInAllowedPosition.mjs +5 -5
  353. package/validation/specifiedRules.js +15 -3
  354. package/validation/specifiedRules.js.flow +14 -1
  355. package/validation/specifiedRules.mjs +9 -3
  356. package/validation/validate.js +2 -2
  357. package/validation/validate.js.flow +1 -1
  358. package/validation/validate.mjs +2 -2
  359. package/jsutils/find.js +0 -22
  360. package/jsutils/find.js.flow +0 -19
  361. package/jsutils/find.mjs +0 -15
package/type/validate.mjs CHANGED
@@ -1,21 +1,20 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
1
  /**
4
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
3
  *
6
4
  * This source code is licensed under the MIT license found in the
7
5
  * LICENSE file in the root directory of this source tree.
8
6
  *
9
- * strict
7
+ *
10
8
  */
9
+ import find from '../polyfills/find';
10
+ import flatMap from '../polyfills/flatMap';
11
+ import objectValues from '../polyfills/objectValues';
12
+ import objectEntries from '../polyfills/objectEntries';
11
13
  import { isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType, isNamedType, isInputType, isOutputType, isRequiredArgument } from './definition';
12
14
  import { isDirective } from './directives';
13
15
  import { isIntrospectionType } from './introspection';
14
- import { isSchema } from './schema';
16
+ import { assertSchema } from './schema';
15
17
  import inspect from '../jsutils/inspect';
16
- import find from '../jsutils/find';
17
- import invariant from '../jsutils/invariant';
18
- import objectValues from '../jsutils/objectValues';
19
18
  import { GraphQLError } from '../error/GraphQLError';
20
19
  import { isValidNameError } from '../utilities/assertValidName';
21
20
  import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators';
@@ -29,7 +28,7 @@ import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators';
29
28
 
30
29
  export function validateSchema(schema) {
31
30
  // First check to ensure the provided value is in fact a GraphQLSchema.
32
- !isSchema(schema) ? invariant(0, "Expected ".concat(inspect(schema), " to be a GraphQL schema.")) : void 0; // If this Schema has already been validated, return the previous results.
31
+ assertSchema(schema); // If this Schema has already been validated, return the previous results.
33
32
 
34
33
  if (schema.__validationErrors) {
35
34
  return schema.__validationErrors;
@@ -65,10 +64,6 @@ var SchemaValidationContext =
65
64
  /*#__PURE__*/
66
65
  function () {
67
66
  function SchemaValidationContext(schema) {
68
- _defineProperty(this, "_errors", void 0);
69
-
70
- _defineProperty(this, "schema", void 0);
71
-
72
67
  this._errors = [];
73
68
  this.schema = schema;
74
69
  }
@@ -76,7 +71,7 @@ function () {
76
71
  var _proto = SchemaValidationContext.prototype;
77
72
 
78
73
  _proto.reportError = function reportError(message, nodes) {
79
- var _nodes = (Array.isArray(nodes) ? nodes : [nodes]).filter(Boolean);
74
+ var _nodes = Array.isArray(nodes) ? nodes.filter(Boolean) : nodes;
80
75
 
81
76
  this.addError(new GraphQLError(message, _nodes));
82
77
  };
@@ -308,15 +303,7 @@ function validateFields(context, type) {
308
303
  for (var _iterator5 = fields[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
309
304
  var field = _step5.value;
310
305
  // Ensure they are named correctly.
311
- validateName(context, field); // Ensure they were defined at most once.
312
-
313
- var fieldNodes = getAllFieldNodes(type, field.name);
314
-
315
- if (fieldNodes.length > 1) {
316
- context.reportError("Field ".concat(type.name, ".").concat(field.name, " can only be defined once."), fieldNodes);
317
- continue;
318
- } // Ensure the type is an output type
319
-
306
+ validateName(context, field); // Ensure the type is an output type
320
307
 
321
308
  if (!isOutputType(field.type)) {
322
309
  context.reportError("The type of ".concat(type.name, ".").concat(field.name, " must be Output Type ") + "but got: ".concat(inspect(field.type), "."), getFieldTypeNode(type, field.name));
@@ -419,104 +406,122 @@ function validateObjectImplementsInterface(context, object, iface) {
419
406
  var objectFieldMap = object.getFields();
420
407
  var ifaceFieldMap = iface.getFields(); // Assert each interface field is implemented.
421
408
 
422
- var _arr = Object.keys(ifaceFieldMap);
409
+ var _iteratorNormalCompletion8 = true;
410
+ var _didIteratorError8 = false;
411
+ var _iteratorError8 = undefined;
412
+
413
+ try {
414
+ for (var _iterator8 = objectEntries(ifaceFieldMap)[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
415
+ var _ref2 = _step8.value;
416
+ var fieldName = _ref2[0];
417
+ var ifaceField = _ref2[1];
418
+ var objectField = objectFieldMap[fieldName]; // Assert interface field exists on object.
419
+
420
+ if (!objectField) {
421
+ context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expected but ") + "".concat(object.name, " does not provide it."), [getFieldNode(iface, fieldName)].concat(getAllNodes(object)));
422
+ continue;
423
+ } // Assert interface field type is satisfied by object field type, by being
424
+ // a valid subtype. (covariant)
423
425
 
424
- for (var _i = 0; _i < _arr.length; _i++) {
425
- var fieldName = _arr[_i];
426
- var objectField = objectFieldMap[fieldName];
427
- var ifaceField = ifaceFieldMap[fieldName]; // Assert interface field exists on object.
428
426
 
429
- if (!objectField) {
430
- context.reportError("Interface field ".concat(iface.name, ".").concat(fieldName, " expected but ") + "".concat(object.name, " does not provide it."), [getFieldNode(iface, fieldName)].concat(getAllNodes(object)));
431
- continue;
432
- } // Assert interface field type is satisfied by object field type, by being
433
- // a valid subtype. (covariant)
427
+ if (!isTypeSubTypeOf(context.schema, objectField.type, ifaceField.type)) {
428
+ 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), "."), [getFieldTypeNode(iface, fieldName), getFieldTypeNode(object, fieldName)]);
429
+ } // Assert each interface field arg is implemented.
434
430
 
435
431
 
436
- if (!isTypeSubTypeOf(context.schema, objectField.type, ifaceField.type)) {
437
- 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), "."), [getFieldTypeNode(iface, fieldName), getFieldTypeNode(object, fieldName)]);
438
- } // Assert each interface field arg is implemented.
432
+ var _iteratorNormalCompletion9 = true;
433
+ var _didIteratorError9 = false;
434
+ var _iteratorError9 = undefined;
439
435
 
436
+ try {
437
+ var _loop = function _loop() {
438
+ var ifaceArg = _step9.value;
439
+ var argName = ifaceArg.name;
440
+ var objectArg = find(objectField.args, function (arg) {
441
+ return arg.name === argName;
442
+ }); // Assert interface field arg exists on object field.
440
443
 
441
- var _iteratorNormalCompletion8 = true;
442
- var _didIteratorError8 = false;
443
- var _iteratorError8 = undefined;
444
+ if (!objectArg) {
445
+ context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) ") + "expected but ".concat(object.name, ".").concat(fieldName, " does not provide it."), [getFieldArgNode(iface, fieldName, argName), getFieldNode(object, fieldName)]);
446
+ return "continue";
447
+ } // Assert interface field arg type matches object field arg type.
448
+ // (invariant)
449
+ // TODO: change to contravariant?
444
450
 
445
- try {
446
- var _loop = function _loop() {
447
- var ifaceArg = _step8.value;
448
- var argName = ifaceArg.name;
449
- var objectArg = find(objectField.args, function (arg) {
450
- return arg.name === argName;
451
- }); // Assert interface field arg exists on object field.
452
451
 
453
- if (!objectArg) {
454
- context.reportError("Interface field argument ".concat(iface.name, ".").concat(fieldName, "(").concat(argName, ":) ") + "expected but ".concat(object.name, ".").concat(fieldName, " does not provide it."), [getFieldArgNode(iface, fieldName, argName), getFieldNode(object, fieldName)]);
455
- return "continue";
456
- } // Assert interface field arg type matches object field arg type.
457
- // (invariant)
458
- // TODO: change to contravariant?
452
+ if (!isEqualType(ifaceArg.type, objectArg.type)) {
453
+ 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), "."), [getFieldArgTypeNode(iface, fieldName, argName), getFieldArgTypeNode(object, fieldName, argName)]);
454
+ } // TODO: validate default values?
459
455
 
456
+ };
460
457
 
461
- if (!isEqualType(ifaceArg.type, objectArg.type)) {
462
- 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), "."), [getFieldArgTypeNode(iface, fieldName, argName), getFieldArgTypeNode(object, fieldName, argName)]);
463
- } // TODO: validate default values?
458
+ for (var _iterator9 = ifaceField.args[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
459
+ var _ret = _loop();
464
460
 
465
- };
461
+ if (_ret === "continue") continue;
462
+ } // Assert additional arguments must not be required.
466
463
 
467
- for (var _iterator8 = ifaceField.args[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
468
- var _ret = _loop();
464
+ } catch (err) {
465
+ _didIteratorError9 = true;
466
+ _iteratorError9 = err;
467
+ } finally {
468
+ try {
469
+ if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
470
+ _iterator9.return();
471
+ }
472
+ } finally {
473
+ if (_didIteratorError9) {
474
+ throw _iteratorError9;
475
+ }
476
+ }
477
+ }
469
478
 
470
- if (_ret === "continue") continue;
471
- } // Assert additional arguments must not be required.
479
+ var _iteratorNormalCompletion10 = true;
480
+ var _didIteratorError10 = false;
481
+ var _iteratorError10 = undefined;
472
482
 
473
- } catch (err) {
474
- _didIteratorError8 = true;
475
- _iteratorError8 = err;
476
- } finally {
477
483
  try {
478
- if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
479
- _iterator8.return();
484
+ var _loop2 = function _loop2() {
485
+ var objectArg = _step10.value;
486
+ var argName = objectArg.name;
487
+ var ifaceArg = find(ifaceField.args, function (arg) {
488
+ return arg.name === argName;
489
+ });
490
+
491
+ if (!ifaceArg && isRequiredArgument(objectArg)) {
492
+ 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, "."), [getFieldArgNode(object, fieldName, argName), getFieldNode(iface, fieldName)]);
493
+ }
494
+ };
495
+
496
+ for (var _iterator10 = objectField.args[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
497
+ _loop2();
480
498
  }
499
+ } catch (err) {
500
+ _didIteratorError10 = true;
501
+ _iteratorError10 = err;
481
502
  } finally {
482
- if (_didIteratorError8) {
483
- throw _iteratorError8;
503
+ try {
504
+ if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
505
+ _iterator10.return();
506
+ }
507
+ } finally {
508
+ if (_didIteratorError10) {
509
+ throw _iteratorError10;
510
+ }
484
511
  }
485
512
  }
486
513
  }
487
-
488
- var _iteratorNormalCompletion9 = true;
489
- var _didIteratorError9 = false;
490
- var _iteratorError9 = undefined;
491
-
514
+ } catch (err) {
515
+ _didIteratorError8 = true;
516
+ _iteratorError8 = err;
517
+ } finally {
492
518
  try {
493
- var _loop2 = function _loop2() {
494
- var objectArg = _step9.value;
495
- var argName = objectArg.name;
496
- var ifaceArg = find(ifaceField.args, function (arg) {
497
- return arg.name === argName;
498
- });
499
-
500
- if (!ifaceArg && isRequiredArgument(objectArg)) {
501
- 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, "."), [getFieldArgNode(object, fieldName, argName), getFieldNode(iface, fieldName)]);
502
- }
503
- };
504
-
505
- for (var _iterator9 = objectField.args[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
506
- _loop2();
519
+ if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
520
+ _iterator8.return();
507
521
  }
508
- } catch (err) {
509
- _didIteratorError9 = true;
510
- _iteratorError9 = err;
511
522
  } finally {
512
- try {
513
- if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
514
- _iterator9.return();
515
- }
516
- } finally {
517
- if (_didIteratorError9) {
518
- throw _iteratorError9;
519
- }
523
+ if (_didIteratorError8) {
524
+ throw _iteratorError8;
520
525
  }
521
526
  }
522
527
  }
@@ -530,13 +535,13 @@ function validateUnionMembers(context, union) {
530
535
  }
531
536
 
532
537
  var includedTypeNames = Object.create(null);
533
- var _iteratorNormalCompletion10 = true;
534
- var _didIteratorError10 = false;
535
- var _iteratorError10 = undefined;
538
+ var _iteratorNormalCompletion11 = true;
539
+ var _didIteratorError11 = false;
540
+ var _iteratorError11 = undefined;
536
541
 
537
542
  try {
538
- for (var _iterator10 = memberTypes[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
539
- var memberType = _step10.value;
543
+ for (var _iterator11 = memberTypes[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
544
+ var memberType = _step11.value;
540
545
 
541
546
  if (includedTypeNames[memberType.name]) {
542
547
  context.reportError("Union type ".concat(union.name, " can only include type ") + "".concat(memberType.name, " once."), getUnionMemberTypeNodes(union, memberType.name));
@@ -550,16 +555,16 @@ function validateUnionMembers(context, union) {
550
555
  }
551
556
  }
552
557
  } catch (err) {
553
- _didIteratorError10 = true;
554
- _iteratorError10 = err;
558
+ _didIteratorError11 = true;
559
+ _iteratorError11 = err;
555
560
  } finally {
556
561
  try {
557
- if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
558
- _iterator10.return();
562
+ if (!_iteratorNormalCompletion11 && _iterator11.return != null) {
563
+ _iterator11.return();
559
564
  }
560
565
  } finally {
561
- if (_didIteratorError10) {
562
- throw _iteratorError10;
566
+ if (_didIteratorError11) {
567
+ throw _iteratorError11;
563
568
  }
564
569
  }
565
570
  }
@@ -572,21 +577,14 @@ function validateEnumValues(context, enumType) {
572
577
  context.reportError("Enum type ".concat(enumType.name, " must define one or more values."), getAllNodes(enumType));
573
578
  }
574
579
 
575
- var _iteratorNormalCompletion11 = true;
576
- var _didIteratorError11 = false;
577
- var _iteratorError11 = undefined;
580
+ var _iteratorNormalCompletion12 = true;
581
+ var _didIteratorError12 = false;
582
+ var _iteratorError12 = undefined;
578
583
 
579
584
  try {
580
- for (var _iterator11 = enumValues[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
581
- var enumValue = _step11.value;
582
- var valueName = enumValue.name; // Ensure no duplicates.
583
-
584
- var allNodes = getEnumValueNodes(enumType, valueName);
585
-
586
- if (allNodes && allNodes.length > 1) {
587
- context.reportError("Enum type ".concat(enumType.name, " can include value ").concat(valueName, " only once."), allNodes);
588
- } // Ensure valid name.
589
-
585
+ for (var _iterator12 = enumValues[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
586
+ var enumValue = _step12.value;
587
+ var valueName = enumValue.name; // Ensure valid name.
590
588
 
591
589
  validateName(context, enumValue);
592
590
 
@@ -595,16 +593,16 @@ function validateEnumValues(context, enumType) {
595
593
  }
596
594
  }
597
595
  } catch (err) {
598
- _didIteratorError11 = true;
599
- _iteratorError11 = err;
596
+ _didIteratorError12 = true;
597
+ _iteratorError12 = err;
600
598
  } finally {
601
599
  try {
602
- if (!_iteratorNormalCompletion11 && _iterator11.return != null) {
603
- _iterator11.return();
600
+ if (!_iteratorNormalCompletion12 && _iterator12.return != null) {
601
+ _iterator12.return();
604
602
  }
605
603
  } finally {
606
- if (_didIteratorError11) {
607
- throw _iteratorError11;
604
+ if (_didIteratorError12) {
605
+ throw _iteratorError12;
608
606
  }
609
607
  }
610
608
  }
@@ -618,32 +616,31 @@ function validateInputFields(context, inputObj) {
618
616
  } // Ensure the arguments are valid
619
617
 
620
618
 
621
- var _iteratorNormalCompletion12 = true;
622
- var _didIteratorError12 = false;
623
- var _iteratorError12 = undefined;
619
+ var _iteratorNormalCompletion13 = true;
620
+ var _didIteratorError13 = false;
621
+ var _iteratorError13 = undefined;
624
622
 
625
623
  try {
626
- for (var _iterator12 = fields[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = true) {
627
- var field = _step12.value;
624
+ for (var _iterator13 = fields[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
625
+ var field = _step13.value;
628
626
  // Ensure they are named correctly.
629
- validateName(context, field); // TODO: Ensure they are unique per field.
630
- // Ensure the type is an input type
627
+ validateName(context, field); // Ensure the type is an input type
631
628
 
632
629
  if (!isInputType(field.type)) {
633
630
  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);
634
631
  }
635
632
  }
636
633
  } catch (err) {
637
- _didIteratorError12 = true;
638
- _iteratorError12 = err;
634
+ _didIteratorError13 = true;
635
+ _iteratorError13 = err;
639
636
  } finally {
640
637
  try {
641
- if (!_iteratorNormalCompletion12 && _iterator12.return != null) {
642
- _iterator12.return();
638
+ if (!_iteratorNormalCompletion13 && _iterator13.return != null) {
639
+ _iterator13.return();
643
640
  }
644
641
  } finally {
645
- if (_didIteratorError12) {
646
- throw _iteratorError12;
642
+ if (_didIteratorError13) {
643
+ throw _iteratorError13;
647
644
  }
648
645
  }
649
646
  }
@@ -656,39 +653,9 @@ function getAllNodes(object) {
656
653
  }
657
654
 
658
655
  function getAllSubNodes(object, getter) {
659
- var result = [];
660
- var _iteratorNormalCompletion13 = true;
661
- var _didIteratorError13 = false;
662
- var _iteratorError13 = undefined;
663
-
664
- try {
665
- for (var _iterator13 = getAllNodes(object)[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
666
- var astNode = _step13.value;
667
-
668
- if (astNode) {
669
- var subNodes = getter(astNode);
670
-
671
- if (subNodes) {
672
- result = result.concat(subNodes);
673
- }
674
- }
675
- }
676
- } catch (err) {
677
- _didIteratorError13 = true;
678
- _iteratorError13 = err;
679
- } finally {
680
- try {
681
- if (!_iteratorNormalCompletion13 && _iterator13.return != null) {
682
- _iterator13.return();
683
- }
684
- } finally {
685
- if (_didIteratorError13) {
686
- throw _iteratorError13;
687
- }
688
- }
689
- }
690
-
691
- return result;
656
+ return flatMap(getAllNodes(object), function (item) {
657
+ return getter(item) || [];
658
+ });
692
659
  }
693
660
 
694
661
  function getImplementsInterfaceNode(type, iface) {
@@ -704,13 +671,9 @@ function getAllImplementsInterfaceNodes(type, iface) {
704
671
  }
705
672
 
706
673
  function getFieldNode(type, fieldName) {
707
- return getAllFieldNodes(type, fieldName)[0];
708
- }
709
-
710
- function getAllFieldNodes(type, fieldName) {
711
- return getAllSubNodes(type, function (typeNode) {
674
+ return find(getAllSubNodes(type, function (typeNode) {
712
675
  return typeNode.fields;
713
- }).filter(function (fieldNode) {
676
+ }), function (fieldNode) {
714
677
  return fieldNode.name.value === fieldName;
715
678
  });
716
679
  }
@@ -784,12 +747,4 @@ function getUnionMemberTypeNodes(union, typeName) {
784
747
  }).filter(function (typeNode) {
785
748
  return typeNode.name.value === typeName;
786
749
  });
787
- }
788
-
789
- function getEnumValueNodes(enumType, valueName) {
790
- return getAllSubNodes(enumType, function (enumNode) {
791
- return enumNode.values;
792
- }).filter(function (valueNode) {
793
- return valueNode.name.value === valueName;
794
- });
795
750
  }
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.TypeInfo = void 0;
7
7
 
8
+ var _find = _interopRequireDefault(require("../polyfills/find"));
9
+
8
10
  var _kinds = require("../language/kinds");
9
11
 
10
12
  var _definition = require("../type/definition");
@@ -13,11 +15,16 @@ var _introspection = require("../type/introspection");
13
15
 
14
16
  var _typeFromAST = require("./typeFromAST");
15
17
 
16
- var _find = _interopRequireDefault(require("../jsutils/find"));
17
-
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
 
20
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
+ /**
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ *
26
+ *
27
+ */
21
28
 
22
29
  /**
23
30
  * TypeInfo is a utility class which, given a GraphQL schema, can keep track
@@ -31,26 +38,6 @@ function () {
31
38
  // to support non-spec-compliant codebases. You should never need to use it.
32
39
  getFieldDefFn, // Initial type may be provided in rare cases to facilitate traversals
33
40
  initialType) {
34
- _defineProperty(this, "_schema", void 0);
35
-
36
- _defineProperty(this, "_typeStack", void 0);
37
-
38
- _defineProperty(this, "_parentTypeStack", void 0);
39
-
40
- _defineProperty(this, "_inputTypeStack", void 0);
41
-
42
- _defineProperty(this, "_fieldDefStack", void 0);
43
-
44
- _defineProperty(this, "_defaultValueStack", void 0);
45
-
46
- _defineProperty(this, "_directive", void 0);
47
-
48
- _defineProperty(this, "_argument", void 0);
49
-
50
- _defineProperty(this, "_enumValue", void 0);
51
-
52
- _defineProperty(this, "_getFieldDef", void 0);
53
-
54
41
  this._schema = schema;
55
42
  this._typeStack = [];
56
43
  this._parentTypeStack = [];
@@ -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,6 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
+ import find from '../polyfills/find';
10
11
  import { Kind } from '../language/kinds';
11
12
  import {
12
13
  isObjectType,
@@ -39,7 +40,6 @@ import {
39
40
  import type { GraphQLSchema } from '../type/schema';
40
41
  import type { ASTNode, FieldNode } from '../language/ast';
41
42
  import { typeFromAST } from './typeFromAST';
42
- import find from '../jsutils/find';
43
43
 
44
44
  /**
45
45
  * TypeInfo is a utility class which, given a GraphQL schema, can keep track
@@ -1,18 +1,16 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
1
  /**
4
- * Copyright (c) 2015-present, Facebook, Inc.
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
3
  *
6
4
  * This source code is licensed under the MIT license found in the
7
5
  * LICENSE file in the root directory of this source tree.
8
6
  *
9
- * strict
7
+ *
10
8
  */
9
+ import find from '../polyfills/find';
11
10
  import { Kind } from '../language/kinds';
12
11
  import { isObjectType, isInterfaceType, isEnumType, isInputObjectType, isListType, isCompositeType, isInputType, isOutputType, getNullableType, getNamedType } from '../type/definition';
13
12
  import { SchemaMetaFieldDef, TypeMetaFieldDef, TypeNameMetaFieldDef } from '../type/introspection';
14
13
  import { typeFromAST } from './typeFromAST';
15
- import find from '../jsutils/find';
16
14
  /**
17
15
  * TypeInfo is a utility class which, given a GraphQL schema, can keep track
18
16
  * of the current field and type definitions at any point in a GraphQL document
@@ -26,26 +24,6 @@ function () {
26
24
  // to support non-spec-compliant codebases. You should never need to use it.
27
25
  getFieldDefFn, // Initial type may be provided in rare cases to facilitate traversals
28
26
  initialType) {
29
- _defineProperty(this, "_schema", void 0);
30
-
31
- _defineProperty(this, "_typeStack", void 0);
32
-
33
- _defineProperty(this, "_parentTypeStack", void 0);
34
-
35
- _defineProperty(this, "_inputTypeStack", void 0);
36
-
37
- _defineProperty(this, "_fieldDefStack", void 0);
38
-
39
- _defineProperty(this, "_defaultValueStack", void 0);
40
-
41
- _defineProperty(this, "_directive", void 0);
42
-
43
- _defineProperty(this, "_argument", void 0);
44
-
45
- _defineProperty(this, "_enumValue", void 0);
46
-
47
- _defineProperty(this, "_getFieldDef", void 0);
48
-
49
27
  this._schema = schema;
50
28
  this._typeStack = [];
51
29
  this._parentTypeStack = [];
@@ -13,12 +13,12 @@ var _invariant = _interopRequireDefault(require("../jsutils/invariant"));
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
 
15
15
  /**
16
- * Copyright (c) 2015-present, Facebook, Inc.
16
+ * Copyright (c) Facebook, Inc. and its affiliates.
17
17
  *
18
18
  * This source code is licensed under the MIT license found in the
19
19
  * LICENSE file in the root directory of this source tree.
20
20
  *
21
- * strict
21
+ *
22
22
  */
23
23
  var NAME_RX = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
24
24
  /**
@@ -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.
@@ -1,10 +1,10 @@
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.
6
6
  *
7
- * strict
7
+ *
8
8
  */
9
9
  import { GraphQLError } from '../error/GraphQLError';
10
10
  import invariant from '../jsutils/invariant';