graphql 15.0.0-alpha.1 → 15.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (432) hide show
  1. package/README.md +33 -4
  2. package/error/GraphQLError.d.ts +1 -1
  3. package/error/GraphQLError.js +228 -115
  4. package/error/GraphQLError.js.flow +138 -138
  5. package/error/GraphQLError.mjs +223 -117
  6. package/error/formatError.d.ts +1 -0
  7. package/error/formatError.js +3 -1
  8. package/error/formatError.js.flow +1 -1
  9. package/error/formatError.mjs +4 -2
  10. package/error/index.mjs +4 -4
  11. package/error/locatedError.d.ts +5 -2
  12. package/error/locatedError.js +4 -2
  13. package/error/locatedError.js.flow +7 -7
  14. package/error/locatedError.mjs +5 -3
  15. package/error/syntaxError.d.ts +1 -0
  16. package/error/syntaxError.mjs +1 -1
  17. package/execution/execute.d.ts +18 -25
  18. package/execution/execute.js +27 -21
  19. package/execution/execute.js.flow +35 -34
  20. package/execution/execute.mjs +44 -37
  21. package/execution/index.mjs +3 -3
  22. package/execution/values.d.ts +2 -6
  23. package/execution/values.js +8 -3
  24. package/execution/values.js.flow +21 -13
  25. package/execution/values.mjs +19 -14
  26. package/graphql.d.ts +7 -14
  27. package/graphql.js.flow +1 -1
  28. package/graphql.mjs +5 -5
  29. package/index.d.ts +21 -12
  30. package/index.js +239 -191
  31. package/index.js.flow +24 -15
  32. package/index.mjs +12 -11
  33. package/jsutils/Path.js.flow +4 -1
  34. package/jsutils/dedent.js +3 -1
  35. package/jsutils/dedent.js.flow +4 -1
  36. package/jsutils/dedent.mjs +3 -1
  37. package/jsutils/defineToJSON.js +1 -0
  38. package/jsutils/defineToJSON.js.flow +2 -0
  39. package/jsutils/defineToJSON.mjs +2 -1
  40. package/jsutils/devAssert.js +1 -0
  41. package/jsutils/devAssert.js.flow +1 -0
  42. package/jsutils/devAssert.mjs +1 -0
  43. package/jsutils/didYouMean.js.flow +1 -1
  44. package/jsutils/inspect.js +1 -1
  45. package/jsutils/inspect.js.flow +1 -1
  46. package/jsutils/inspect.mjs +2 -2
  47. package/jsutils/instanceOf.js +3 -1
  48. package/jsutils/instanceOf.js.flow +2 -1
  49. package/jsutils/instanceOf.mjs +3 -1
  50. package/jsutils/invariant.js +2 -1
  51. package/jsutils/invariant.js.flow +2 -1
  52. package/jsutils/invariant.mjs +2 -1
  53. package/jsutils/isCollection.js +47 -0
  54. package/jsutils/isCollection.js.flow +39 -0
  55. package/jsutils/isCollection.mjs +40 -0
  56. package/jsutils/isObjectLike.js +1 -1
  57. package/jsutils/isObjectLike.mjs +1 -1
  58. package/jsutils/isPromise.js +1 -1
  59. package/jsutils/isPromise.js.flow +1 -1
  60. package/jsutils/isPromise.mjs +1 -1
  61. package/jsutils/mapValue.mjs +1 -1
  62. package/jsutils/nodejsCustomInspectSymbol.js +2 -0
  63. package/jsutils/nodejsCustomInspectSymbol.js.flow +1 -0
  64. package/jsutils/nodejsCustomInspectSymbol.mjs +1 -0
  65. package/jsutils/printPathArray.js.flow +1 -1
  66. package/jsutils/promiseForObject.js.flow +2 -2
  67. package/jsutils/promiseReduce.js.flow +1 -1
  68. package/jsutils/promiseReduce.mjs +1 -1
  69. package/jsutils/suggestionList.js +85 -33
  70. package/jsutils/suggestionList.js.flow +93 -40
  71. package/jsutils/suggestionList.mjs +85 -33
  72. package/jsutils/toObjMap.js.flow +1 -0
  73. package/jsutils/toObjMap.mjs +1 -1
  74. package/language/ast.d.ts +20 -2
  75. package/language/ast.js +117 -0
  76. package/language/ast.js.flow +154 -149
  77. package/language/ast.mjs +103 -0
  78. package/language/blockString.d.ts +1 -1
  79. package/language/index.d.ts +0 -1
  80. package/language/index.js +0 -6
  81. package/language/index.js.flow +1 -7
  82. package/language/index.mjs +11 -11
  83. package/language/lexer.d.ts +1 -2
  84. package/language/lexer.js +28 -55
  85. package/language/lexer.js.flow +25 -59
  86. package/language/lexer.mjs +30 -54
  87. package/language/parser.d.ts +1 -2
  88. package/language/parser.js +51 -52
  89. package/language/parser.js.flow +33 -48
  90. package/language/parser.mjs +61 -59
  91. package/language/predicates.mjs +1 -1
  92. package/language/printLocation.d.ts +3 -3
  93. package/language/printLocation.js +10 -10
  94. package/language/printLocation.js.flow +14 -13
  95. package/language/printLocation.mjs +10 -10
  96. package/language/printer.js +11 -7
  97. package/language/printer.js.flow +10 -9
  98. package/language/printer.mjs +13 -9
  99. package/language/source.js +29 -13
  100. package/language/source.js.flow +16 -9
  101. package/language/source.mjs +29 -13
  102. package/language/visitor.d.ts +3 -12
  103. package/language/visitor.js +11 -55
  104. package/language/visitor.js.flow +8 -49
  105. package/language/visitor.mjs +14 -53
  106. package/package.json +4 -9
  107. package/polyfills/arrayFrom.js +58 -0
  108. package/polyfills/arrayFrom.js.flow +59 -0
  109. package/polyfills/arrayFrom.mjs +50 -0
  110. package/polyfills/find.js.flow +2 -2
  111. package/polyfills/flatMap.js +0 -1
  112. package/polyfills/flatMap.js.flow +3 -4
  113. package/polyfills/flatMap.mjs +0 -1
  114. package/polyfills/isFinite.js.flow +1 -1
  115. package/polyfills/isInteger.js.flow +1 -1
  116. package/polyfills/objectEntries.js.flow +1 -1
  117. package/polyfills/objectValues.js.flow +1 -1
  118. package/polyfills/symbols.js +22 -0
  119. package/polyfills/symbols.js.flow +17 -0
  120. package/polyfills/symbols.mjs +13 -0
  121. package/subscription/index.mjs +1 -1
  122. package/subscription/mapAsyncIterator.d.ts +1 -1
  123. package/subscription/mapAsyncIterator.js +6 -5
  124. package/subscription/mapAsyncIterator.js.flow +12 -12
  125. package/subscription/mapAsyncIterator.mjs +6 -5
  126. package/subscription/subscribe.d.ts +7 -14
  127. package/subscription/subscribe.js +31 -6
  128. package/subscription/subscribe.js.flow +23 -10
  129. package/subscription/subscribe.mjs +35 -11
  130. package/tsutils/Maybe.d.ts +2 -0
  131. package/type/definition.d.ts +40 -64
  132. package/type/definition.js +179 -83
  133. package/type/definition.js.flow +179 -95
  134. package/type/definition.mjs +191 -96
  135. package/type/directives.d.ts +10 -5
  136. package/type/directives.js +22 -12
  137. package/type/directives.js.flow +10 -7
  138. package/type/directives.mjs +31 -21
  139. package/type/index.mjs +6 -6
  140. package/type/introspection.d.ts +3 -3
  141. package/type/introspection.js +86 -51
  142. package/type/introspection.js.flow +63 -40
  143. package/type/introspection.mjs +94 -59
  144. package/type/scalars.js +95 -89
  145. package/type/scalars.js.flow +106 -95
  146. package/type/scalars.mjs +103 -97
  147. package/type/schema.d.ts +24 -6
  148. package/type/schema.js +159 -134
  149. package/type/schema.js.flow +158 -153
  150. package/type/schema.mjs +167 -143
  151. package/type/validate.d.ts +1 -0
  152. package/type/validate.js +34 -65
  153. package/type/validate.js.flow +24 -56
  154. package/type/validate.mjs +44 -76
  155. package/utilities/TypeInfo.d.ts +12 -2
  156. package/utilities/TypeInfo.js +66 -12
  157. package/utilities/TypeInfo.js.flow +56 -11
  158. package/utilities/TypeInfo.mjs +68 -17
  159. package/utilities/assertValidName.d.ts +1 -5
  160. package/utilities/assertValidName.js +4 -4
  161. package/utilities/assertValidName.js.flow +2 -8
  162. package/utilities/assertValidName.mjs +6 -6
  163. package/utilities/astFromValue.js +22 -18
  164. package/utilities/astFromValue.js.flow +14 -13
  165. package/utilities/astFromValue.mjs +26 -22
  166. package/utilities/buildASTSchema.d.ts +2 -63
  167. package/utilities/buildASTSchema.js +38 -394
  168. package/utilities/buildASTSchema.js.flow +45 -410
  169. package/utilities/buildASTSchema.mjs +44 -383
  170. package/utilities/buildClientSchema.d.ts +2 -3
  171. package/utilities/buildClientSchema.js +61 -55
  172. package/utilities/buildClientSchema.js.flow +77 -86
  173. package/utilities/buildClientSchema.mjs +73 -67
  174. package/utilities/coerceInputValue.js +17 -33
  175. package/utilities/coerceInputValue.js.flow +11 -42
  176. package/utilities/coerceInputValue.mjs +25 -42
  177. package/utilities/concatAST.js.flow +1 -1
  178. package/utilities/concatAST.mjs +1 -1
  179. package/utilities/extendSchema.d.ts +31 -2
  180. package/utilities/extendSchema.js +489 -164
  181. package/utilities/extendSchema.js.flow +481 -176
  182. package/utilities/extendSchema.mjs +493 -174
  183. package/utilities/findBreakingChanges.d.ts +1 -2
  184. package/utilities/findBreakingChanges.js +9 -1
  185. package/utilities/findBreakingChanges.js.flow +14 -8
  186. package/utilities/findBreakingChanges.mjs +18 -10
  187. package/utilities/findDeprecatedUsages.d.ts +1 -1
  188. package/utilities/findDeprecatedUsages.js +7 -15
  189. package/utilities/findDeprecatedUsages.js.flow +20 -26
  190. package/utilities/findDeprecatedUsages.mjs +10 -18
  191. package/utilities/getIntrospectionQuery.d.ts +7 -3
  192. package/utilities/getIntrospectionQuery.js +16 -2
  193. package/utilities/getIntrospectionQuery.js.flow +54 -38
  194. package/utilities/getIntrospectionQuery.mjs +16 -2
  195. package/utilities/getOperationAST.js +3 -1
  196. package/utilities/getOperationAST.js.flow +1 -1
  197. package/utilities/getOperationAST.mjs +4 -2
  198. package/utilities/getOperationRootType.mjs +1 -1
  199. package/utilities/index.d.ts +8 -6
  200. package/utilities/index.js +14 -8
  201. package/utilities/index.js.flow +8 -9
  202. package/utilities/index.mjs +24 -24
  203. package/utilities/introspectionFromSchema.d.ts +1 -0
  204. package/utilities/introspectionFromSchema.js +16 -2
  205. package/utilities/introspectionFromSchema.js.flow +8 -2
  206. package/utilities/introspectionFromSchema.mjs +21 -7
  207. package/utilities/lexicographicSortSchema.d.ts +2 -0
  208. package/utilities/lexicographicSortSchema.js +19 -6
  209. package/utilities/lexicographicSortSchema.js.flow +24 -14
  210. package/utilities/lexicographicSortSchema.mjs +27 -14
  211. package/utilities/{schemaPrinter.d.ts → printSchema.d.ts} +1 -1
  212. package/utilities/{schemaPrinter.js → printSchema.js} +32 -65
  213. package/utilities/{schemaPrinter.js.flow → printSchema.js.flow} +34 -58
  214. package/utilities/{schemaPrinter.mjs → printSchema.mjs} +41 -73
  215. package/utilities/separateOperations.js +21 -23
  216. package/utilities/separateOperations.js.flow +13 -19
  217. package/utilities/separateOperations.mjs +21 -24
  218. package/utilities/stripIgnoredCharacters.js +1 -1
  219. package/utilities/stripIgnoredCharacters.js.flow +1 -1
  220. package/utilities/stripIgnoredCharacters.mjs +6 -6
  221. package/utilities/typeComparators.js.flow +1 -1
  222. package/utilities/typeComparators.mjs +1 -1
  223. package/utilities/typeFromAST.mjs +4 -4
  224. package/utilities/valueFromAST.js +21 -37
  225. package/utilities/valueFromAST.js.flow +22 -35
  226. package/utilities/valueFromAST.mjs +27 -42
  227. package/utilities/valueFromASTUntyped.js +1 -6
  228. package/utilities/valueFromASTUntyped.js.flow +7 -10
  229. package/utilities/valueFromASTUntyped.mjs +5 -9
  230. package/validation/ValidationContext.js +20 -10
  231. package/validation/ValidationContext.js.flow +5 -5
  232. package/validation/ValidationContext.mjs +22 -12
  233. package/validation/index.d.ts +37 -71
  234. package/validation/index.js +114 -50
  235. package/validation/index.js.flow +37 -71
  236. package/validation/index.mjs +38 -28
  237. package/validation/rules/ExecutableDefinitions.d.ts +6 -10
  238. package/validation/rules/ExecutableDefinitions.js +7 -29
  239. package/validation/rules/ExecutableDefinitions.js.flow +6 -36
  240. package/validation/rules/ExecutableDefinitions.mjs +6 -24
  241. package/validation/rules/ExecutableDefinitionsRule.d.ts +12 -0
  242. package/validation/rules/ExecutableDefinitionsRule.js +35 -0
  243. package/validation/rules/ExecutableDefinitionsRule.js.flow +40 -0
  244. package/validation/rules/ExecutableDefinitionsRule.mjs +26 -0
  245. package/validation/rules/{FieldsOnCorrectType.d.ts → FieldsOnCorrectTypeRule.d.ts} +1 -1
  246. package/validation/rules/FieldsOnCorrectTypeRule.js +130 -0
  247. package/validation/rules/{FieldsOnCorrectType.js.flow → FieldsOnCorrectTypeRule.js.flow} +61 -40
  248. package/validation/rules/FieldsOnCorrectTypeRule.mjs +116 -0
  249. package/validation/rules/{FragmentsOnCompositeTypes.d.ts → FragmentsOnCompositeTypesRule.d.ts} +1 -1
  250. package/validation/rules/{FragmentsOnCompositeTypes.js → FragmentsOnCompositeTypesRule.js} +2 -2
  251. package/validation/rules/{FragmentsOnCompositeTypes.js.flow → FragmentsOnCompositeTypesRule.js.flow} +1 -1
  252. package/validation/rules/{FragmentsOnCompositeTypes.mjs → FragmentsOnCompositeTypesRule.mjs} +5 -5
  253. package/validation/rules/{KnownArgumentNames.d.ts → KnownArgumentNamesRule.d.ts} +2 -2
  254. package/validation/rules/{KnownArgumentNames.js → KnownArgumentNamesRule.js} +12 -8
  255. package/validation/rules/{KnownArgumentNames.js.flow → KnownArgumentNamesRule.js.flow} +9 -8
  256. package/validation/rules/{KnownArgumentNames.mjs → KnownArgumentNamesRule.mjs} +15 -11
  257. package/validation/rules/{KnownDirectives.d.ts → KnownDirectivesRule.d.ts} +1 -1
  258. package/validation/rules/KnownDirectivesRule.js +151 -0
  259. package/validation/rules/KnownDirectivesRule.js.flow +139 -0
  260. package/validation/rules/KnownDirectivesRule.mjs +137 -0
  261. package/validation/rules/{KnownFragmentNames.d.ts → KnownFragmentNamesRule.d.ts} +1 -1
  262. package/validation/rules/{KnownFragmentNames.js → KnownFragmentNamesRule.js} +2 -2
  263. package/validation/rules/{KnownFragmentNames.js.flow → KnownFragmentNamesRule.js.flow} +1 -1
  264. package/validation/rules/{KnownFragmentNames.mjs → KnownFragmentNamesRule.mjs} +2 -2
  265. package/validation/rules/{KnownTypeNames.d.ts → KnownTypeNamesRule.d.ts} +1 -1
  266. package/validation/rules/{KnownTypeNames.js → KnownTypeNamesRule.js} +5 -3
  267. package/validation/rules/{KnownTypeNames.js.flow → KnownTypeNamesRule.js.flow} +3 -3
  268. package/validation/rules/{KnownTypeNames.mjs → KnownTypeNamesRule.mjs} +9 -7
  269. package/validation/rules/{LoneAnonymousOperation.d.ts → LoneAnonymousOperationRule.d.ts} +1 -1
  270. package/validation/rules/{LoneAnonymousOperation.js → LoneAnonymousOperationRule.js} +2 -2
  271. package/validation/rules/{LoneAnonymousOperation.js.flow → LoneAnonymousOperationRule.js.flow} +2 -2
  272. package/validation/rules/{LoneAnonymousOperation.mjs → LoneAnonymousOperationRule.mjs} +3 -3
  273. package/validation/rules/LoneSchemaDefinition.d.ts +6 -7
  274. package/validation/rules/LoneSchemaDefinition.js +7 -27
  275. package/validation/rules/LoneSchemaDefinition.js.flow +6 -41
  276. package/validation/rules/LoneSchemaDefinition.mjs +6 -24
  277. package/validation/rules/LoneSchemaDefinitionRule.d.ts +11 -0
  278. package/validation/rules/LoneSchemaDefinitionRule.js +35 -0
  279. package/validation/rules/LoneSchemaDefinitionRule.js.flow +44 -0
  280. package/validation/rules/LoneSchemaDefinitionRule.mjs +28 -0
  281. package/validation/rules/{NoFragmentCycles.d.ts → NoFragmentCyclesRule.d.ts} +1 -1
  282. package/validation/rules/{NoFragmentCycles.js → NoFragmentCyclesRule.js} +2 -2
  283. package/validation/rules/{NoFragmentCycles.js.flow → NoFragmentCyclesRule.js.flow} +4 -2
  284. package/validation/rules/{NoFragmentCycles.mjs → NoFragmentCyclesRule.mjs} +2 -2
  285. package/validation/rules/{NoUndefinedVariables.d.ts → NoUndefinedVariablesRule.d.ts} +3 -1
  286. package/validation/rules/{NoUndefinedVariables.js → NoUndefinedVariablesRule.js} +2 -2
  287. package/validation/rules/{NoUndefinedVariables.js.flow → NoUndefinedVariablesRule.js.flow} +3 -1
  288. package/validation/rules/{NoUndefinedVariables.mjs → NoUndefinedVariablesRule.mjs} +2 -2
  289. package/validation/rules/{NoUnusedFragments.d.ts → NoUnusedFragmentsRule.d.ts} +1 -1
  290. package/validation/rules/{NoUnusedFragments.js → NoUnusedFragmentsRule.js} +2 -2
  291. package/validation/rules/{NoUnusedFragments.js.flow → NoUnusedFragmentsRule.js.flow} +3 -1
  292. package/validation/rules/{NoUnusedFragments.mjs → NoUnusedFragmentsRule.mjs} +2 -2
  293. package/validation/rules/{NoUnusedVariables.d.ts → NoUnusedVariablesRule.d.ts} +1 -1
  294. package/validation/rules/{NoUnusedVariables.js → NoUnusedVariablesRule.js} +2 -2
  295. package/validation/rules/{NoUnusedVariables.js.flow → NoUnusedVariablesRule.js.flow} +1 -1
  296. package/validation/rules/{NoUnusedVariables.mjs → NoUnusedVariablesRule.mjs} +2 -2
  297. package/validation/rules/{OverlappingFieldsCanBeMerged.d.ts → OverlappingFieldsCanBeMergedRule.d.ts} +1 -1
  298. package/validation/rules/{OverlappingFieldsCanBeMerged.js → OverlappingFieldsCanBeMergedRule.js} +27 -32
  299. package/validation/rules/{OverlappingFieldsCanBeMerged.js.flow → OverlappingFieldsCanBeMergedRule.js.flow} +16 -27
  300. package/validation/rules/{OverlappingFieldsCanBeMerged.mjs → OverlappingFieldsCanBeMergedRule.mjs} +34 -39
  301. package/validation/rules/{PossibleFragmentSpreads.d.ts → PossibleFragmentSpreadsRule.d.ts} +3 -1
  302. package/validation/rules/{PossibleFragmentSpreads.js → PossibleFragmentSpreadsRule.js} +2 -2
  303. package/validation/rules/{PossibleFragmentSpreads.js.flow → PossibleFragmentSpreadsRule.js.flow} +1 -1
  304. package/validation/rules/{PossibleFragmentSpreads.mjs → PossibleFragmentSpreadsRule.mjs} +6 -6
  305. package/validation/rules/PossibleTypeExtensions.d.ts +6 -9
  306. package/validation/rules/PossibleTypeExtensions.js +6 -116
  307. package/validation/rules/PossibleTypeExtensions.js.flow +6 -127
  308. package/validation/rules/PossibleTypeExtensions.mjs +6 -106
  309. package/validation/rules/PossibleTypeExtensionsRule.d.ts +11 -0
  310. package/validation/rules/PossibleTypeExtensionsRule.js +143 -0
  311. package/validation/rules/PossibleTypeExtensionsRule.js.flow +142 -0
  312. package/validation/rules/PossibleTypeExtensionsRule.mjs +126 -0
  313. package/validation/rules/{ProvidedRequiredArguments.d.ts → ProvidedRequiredArgumentsRule.d.ts} +2 -2
  314. package/validation/rules/{ProvidedRequiredArguments.js → ProvidedRequiredArgumentsRule.js} +22 -21
  315. package/validation/rules/{ProvidedRequiredArguments.js.flow → ProvidedRequiredArgumentsRule.js.flow} +15 -26
  316. package/validation/rules/{ProvidedRequiredArguments.mjs → ProvidedRequiredArgumentsRule.mjs} +28 -22
  317. package/validation/rules/{ScalarLeafs.d.ts → ScalarLeafsRule.d.ts} +1 -1
  318. package/validation/rules/{ScalarLeafs.js → ScalarLeafsRule.js} +2 -13
  319. package/validation/rules/{ScalarLeafs.js.flow → ScalarLeafsRule.js.flow} +1 -15
  320. package/validation/rules/{ScalarLeafs.mjs → ScalarLeafsRule.mjs} +5 -11
  321. package/validation/rules/{SingleFieldSubscriptions.d.ts → SingleFieldSubscriptionsRule.d.ts} +1 -2
  322. package/validation/rules/{SingleFieldSubscriptions.js → SingleFieldSubscriptionsRule.js} +2 -2
  323. package/validation/rules/{SingleFieldSubscriptions.js.flow → SingleFieldSubscriptionsRule.js.flow} +1 -1
  324. package/validation/rules/{SingleFieldSubscriptions.mjs → SingleFieldSubscriptionsRule.mjs} +2 -2
  325. package/validation/rules/{UniqueArgumentNames.d.ts → UniqueArgumentNamesRule.d.ts} +3 -1
  326. package/validation/rules/{UniqueArgumentNames.js → UniqueArgumentNamesRule.js} +2 -8
  327. package/validation/rules/{UniqueArgumentNames.js.flow → UniqueArgumentNamesRule.js.flow} +3 -5
  328. package/validation/rules/{UniqueArgumentNames.mjs → UniqueArgumentNamesRule.mjs} +3 -6
  329. package/validation/rules/UniqueDirectiveNames.d.ts +6 -7
  330. package/validation/rules/UniqueDirectiveNames.js +7 -41
  331. package/validation/rules/UniqueDirectiveNames.js.flow +6 -51
  332. package/validation/rules/UniqueDirectiveNames.mjs +6 -33
  333. package/validation/rules/UniqueDirectiveNamesRule.d.ts +11 -0
  334. package/validation/rules/UniqueDirectiveNamesRule.js +36 -0
  335. package/validation/rules/UniqueDirectiveNamesRule.js.flow +47 -0
  336. package/validation/rules/UniqueDirectiveNamesRule.mjs +29 -0
  337. package/validation/rules/{UniqueDirectivesPerLocation.d.ts → UniqueDirectivesPerLocationRule.d.ts} +1 -1
  338. package/validation/rules/UniqueDirectivesPerLocationRule.js +82 -0
  339. package/validation/rules/UniqueDirectivesPerLocationRule.js.flow +91 -0
  340. package/validation/rules/UniqueDirectivesPerLocationRule.mjs +72 -0
  341. package/validation/rules/UniqueEnumValueNames.d.ts +6 -7
  342. package/validation/rules/UniqueEnumValueNames.js +7 -47
  343. package/validation/rules/UniqueEnumValueNames.js.flow +6 -58
  344. package/validation/rules/UniqueEnumValueNames.mjs +6 -43
  345. package/validation/rules/UniqueEnumValueNamesRule.d.ts +11 -0
  346. package/validation/rules/UniqueEnumValueNamesRule.js +56 -0
  347. package/validation/rules/UniqueEnumValueNamesRule.js.flow +62 -0
  348. package/validation/rules/UniqueEnumValueNamesRule.mjs +48 -0
  349. package/validation/rules/UniqueFieldDefinitionNames.d.ts +6 -9
  350. package/validation/rules/UniqueFieldDefinitionNames.js +6 -57
  351. package/validation/rules/UniqueFieldDefinitionNames.js.flow +6 -72
  352. package/validation/rules/UniqueFieldDefinitionNames.mjs +6 -54
  353. package/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +11 -0
  354. package/validation/rules/UniqueFieldDefinitionNamesRule.js +67 -0
  355. package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +76 -0
  356. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +59 -0
  357. package/validation/rules/{UniqueFragmentNames.d.ts → UniqueFragmentNamesRule.d.ts} +3 -1
  358. package/validation/rules/{UniqueFragmentNames.js → UniqueFragmentNamesRule.js} +2 -2
  359. package/validation/rules/{UniqueFragmentNames.js.flow → UniqueFragmentNamesRule.js.flow} +3 -1
  360. package/validation/rules/{UniqueFragmentNames.mjs → UniqueFragmentNamesRule.mjs} +2 -2
  361. package/validation/rules/{UniqueInputFieldNames.d.ts → UniqueInputFieldNamesRule.d.ts} +1 -1
  362. package/validation/rules/{UniqueInputFieldNames.js → UniqueInputFieldNamesRule.js} +2 -2
  363. package/validation/rules/{UniqueInputFieldNames.js.flow → UniqueInputFieldNamesRule.js.flow} +1 -1
  364. package/validation/rules/{UniqueInputFieldNames.mjs → UniqueInputFieldNamesRule.mjs} +2 -2
  365. package/validation/rules/{UniqueOperationNames.d.ts → UniqueOperationNamesRule.d.ts} +3 -1
  366. package/validation/rules/{UniqueOperationNames.js → UniqueOperationNamesRule.js} +2 -2
  367. package/validation/rules/{UniqueOperationNames.js.flow → UniqueOperationNamesRule.js.flow} +1 -1
  368. package/validation/rules/{UniqueOperationNames.mjs → UniqueOperationNamesRule.mjs} +2 -2
  369. package/validation/rules/UniqueOperationTypes.d.ts +6 -7
  370. package/validation/rules/UniqueOperationTypes.js +7 -41
  371. package/validation/rules/UniqueOperationTypes.js.flow +6 -55
  372. package/validation/rules/UniqueOperationTypes.mjs +6 -38
  373. package/validation/rules/UniqueOperationTypesRule.d.ts +11 -0
  374. package/validation/rules/UniqueOperationTypesRule.js +50 -0
  375. package/validation/rules/UniqueOperationTypesRule.js.flow +60 -0
  376. package/validation/rules/UniqueOperationTypesRule.mjs +43 -0
  377. package/validation/rules/UniqueTypeNames.d.ts +6 -7
  378. package/validation/rules/UniqueTypeNames.js +7 -37
  379. package/validation/rules/UniqueTypeNames.js.flow +6 -50
  380. package/validation/rules/UniqueTypeNames.mjs +6 -34
  381. package/validation/rules/UniqueTypeNamesRule.d.ts +9 -0
  382. package/validation/rules/UniqueTypeNamesRule.js +43 -0
  383. package/validation/rules/UniqueTypeNamesRule.js.flow +54 -0
  384. package/validation/rules/UniqueTypeNamesRule.mjs +36 -0
  385. package/validation/rules/{UniqueVariableNames.d.ts → UniqueVariableNamesRule.d.ts} +3 -1
  386. package/validation/rules/{UniqueVariableNames.js → UniqueVariableNamesRule.js} +2 -2
  387. package/validation/rules/{UniqueVariableNames.js.flow → UniqueVariableNamesRule.js.flow} +3 -1
  388. package/validation/rules/{UniqueVariableNames.mjs → UniqueVariableNamesRule.mjs} +2 -2
  389. package/validation/rules/{ValuesOfCorrectType.d.ts → ValuesOfCorrectTypeRule.d.ts} +1 -1
  390. package/validation/rules/{ValuesOfCorrectType.js → ValuesOfCorrectTypeRule.js} +6 -22
  391. package/validation/rules/{ValuesOfCorrectType.js.flow → ValuesOfCorrectTypeRule.js.flow} +14 -31
  392. package/validation/rules/{ValuesOfCorrectType.mjs → ValuesOfCorrectTypeRule.mjs} +13 -27
  393. package/validation/rules/{VariablesAreInputTypes.d.ts → VariablesAreInputTypesRule.d.ts} +3 -1
  394. package/validation/rules/{VariablesAreInputTypes.js → VariablesAreInputTypesRule.js} +2 -2
  395. package/validation/rules/{VariablesAreInputTypes.js.flow → VariablesAreInputTypesRule.js.flow} +3 -1
  396. package/validation/rules/{VariablesAreInputTypes.mjs → VariablesAreInputTypesRule.mjs} +5 -5
  397. package/validation/rules/{VariablesInAllowedPosition.d.ts → VariablesInAllowedPositionRule.d.ts} +1 -1
  398. package/validation/rules/{VariablesInAllowedPosition.js → VariablesInAllowedPositionRule.js} +2 -2
  399. package/validation/rules/{VariablesInAllowedPosition.js.flow → VariablesInAllowedPositionRule.js.flow} +1 -1
  400. package/validation/rules/{VariablesInAllowedPosition.mjs → VariablesInAllowedPositionRule.mjs} +7 -7
  401. package/validation/specifiedRules.d.ts +0 -86
  402. package/validation/specifiedRules.js +38 -37
  403. package/validation/specifiedRules.js.flow +79 -78
  404. package/validation/specifiedRules.mjs +36 -35
  405. package/validation/validate.d.ts +7 -2
  406. package/validation/validate.js +6 -5
  407. package/validation/validate.js.flow +11 -12
  408. package/validation/validate.mjs +12 -11
  409. package/version.js +2 -2
  410. package/version.js.flow +2 -2
  411. package/version.mjs +2 -2
  412. package/jsutils/defineToStringTag.js +0 -29
  413. package/jsutils/defineToStringTag.js.flow +0 -24
  414. package/jsutils/defineToStringTag.mjs +0 -22
  415. package/jsutils/isInvalid.js +0 -13
  416. package/jsutils/isInvalid.js.flow +0 -8
  417. package/jsutils/isInvalid.mjs +0 -6
  418. package/jsutils/isNullish.js +0 -13
  419. package/jsutils/isNullish.js.flow +0 -8
  420. package/jsutils/isNullish.mjs +0 -6
  421. package/subscription/asyncIteratorReject.d.ts +0 -6
  422. package/subscription/asyncIteratorReject.js +0 -45
  423. package/subscription/asyncIteratorReject.js.flow +0 -34
  424. package/subscription/asyncIteratorReject.mjs +0 -38
  425. package/validation/rules/FieldsOnCorrectType.js +0 -106
  426. package/validation/rules/FieldsOnCorrectType.mjs +0 -93
  427. package/validation/rules/KnownDirectives.js +0 -138
  428. package/validation/rules/KnownDirectives.js.flow +0 -124
  429. package/validation/rules/KnownDirectives.mjs +0 -128
  430. package/validation/rules/UniqueDirectivesPerLocation.js +0 -67
  431. package/validation/rules/UniqueDirectivesPerLocation.js.flow +0 -71
  432. package/validation/rules/UniqueDirectivesPerLocation.mjs +0 -58
package/README.md CHANGED
@@ -74,7 +74,7 @@ Then, serve the result of a query against that type schema.
74
74
  ```js
75
75
  var query = '{ hello }';
76
76
 
77
- graphql(schema, query).then(result => {
77
+ graphql(schema, query).then((result) => {
78
78
  // Prints
79
79
  // {
80
80
  // data: { hello: "world" }
@@ -88,13 +88,13 @@ first ensure the query is syntactically and semantically valid before executing
88
88
  it, reporting errors otherwise.
89
89
 
90
90
  ```js
91
- var query = '{ boyhowdy }';
91
+ var query = '{ BoyHowdy }';
92
92
 
93
- graphql(schema, query).then(result => {
93
+ graphql(schema, query).then((result) => {
94
94
  // Prints
95
95
  // {
96
96
  // errors: [
97
- // { message: 'Cannot query field boyhowdy on RootQueryType',
97
+ // { message: 'Cannot query field BoyHowdy on RootQueryType',
98
98
  // locations: [ { line: 1, column: 3 } ] }
99
99
  // ]
100
100
  // }
@@ -102,6 +102,8 @@ graphql(schema, query).then(result => {
102
102
  });
103
103
  ```
104
104
 
105
+ **Note**: Please don't forget to set `NODE_ENV=production` if you are running a production server it will disable some checks that can be useful during development but will significantly improve performance.
106
+
105
107
  ### Want to ride the bleeding edge?
106
108
 
107
109
  The `npm` branch in this repository is automatically maintained to be the last
@@ -138,3 +140,30 @@ Changes are tracked as [GitHub releases](https://github.com/graphql/graphql-js/r
138
140
  ### License
139
141
 
140
142
  GraphQL.js is [MIT-licensed](https://github.com/graphql/graphql-js/blob/master/LICENSE).
143
+
144
+ ### Credits
145
+
146
+ The `*.d.ts` files in this project are based on [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/54712a7e28090c5b1253b746d1878003c954f3ff/types/graphql) definitions written by:
147
+
148
+ <!--- spell-checker:disable -->
149
+
150
+ - TonyYang https://github.com/TonyPythoneer
151
+ - Caleb Meredith https://github.com/calebmer
152
+ - Dominic Watson https://github.com/intellix
153
+ - Firede https://github.com/firede
154
+ - Kepennar https://github.com/kepennar
155
+ - Mikhail Novikov https://github.com/freiksenet
156
+ - Ivan Goncharov https://github.com/IvanGoncharov
157
+ - Hagai Cohen https://github.com/DxCx
158
+ - Ricardo Portugal https://github.com/rportugal
159
+ - Tim Griesser https://github.com/tgriesser
160
+ - Dylan Stewart https://github.com/dyst5422
161
+ - Alessio Dionisi https://github.com/adnsio
162
+ - Divyendu Singh https://github.com/divyenduz
163
+ - Brad Zacher https://github.com/bradzacher
164
+ - Curtis Layne https://github.com/clayne11
165
+ - Jonathan Cardoso https://github.com/JCMais
166
+ - Pavel Lang https://github.com/langpavel
167
+ - Mark Caudill https://github.com/mc0
168
+ - Martijn Walraven https://github.com/martijnwalraven
169
+ - Jed Mao https://github.com/jedmao
@@ -2,7 +2,7 @@ import Maybe from '../tsutils/Maybe';
2
2
 
3
3
  import { ASTNode } from '../language/ast';
4
4
  import { Source } from '../language/source';
5
- import { SourceLocation, getLocation } from '../language/location';
5
+ import { SourceLocation } from '../language/location';
6
6
 
7
7
  /**
8
8
  * A GraphQLError describes an Error found during the parse, validate, or
@@ -3,157 +3,270 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.GraphQLError = GraphQLError;
7
6
  exports.printError = printError;
7
+ exports.GraphQLError = void 0;
8
8
 
9
9
  var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike"));
10
10
 
11
+ var _symbols = require("../polyfills/symbols");
12
+
11
13
  var _location = require("../language/location");
12
14
 
13
15
  var _printLocation = require("../language/printLocation");
14
16
 
15
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
18
 
17
- function GraphQLError( // eslint-disable-line no-redeclare
18
- message, nodes, source, positions, path, originalError, extensions) {
19
- // Compute list of blame nodes.
20
- var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.
19
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
21
20
 
21
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
22
 
23
- var _source = source;
23
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
24
24
 
25
- if (!_source && _nodes) {
26
- var node = _nodes[0];
27
- _source = node && node.loc && node.loc.source;
28
- }
25
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
29
26
 
30
- var _positions = positions;
27
+ function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
28
 
32
- if (!_positions && _nodes) {
33
- _positions = _nodes.reduce(function (list, node) {
34
- if (node.loc) {
35
- list.push(node.loc.start);
36
- }
29
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
37
30
 
38
- return list;
39
- }, []);
40
- }
31
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
32
 
42
- if (_positions && _positions.length === 0) {
43
- _positions = undefined;
44
- }
33
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
45
34
 
46
- var _locations;
35
+ function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
47
36
 
48
- if (positions && source) {
49
- _locations = positions.map(function (pos) {
50
- return (0, _location.getLocation)(source, pos);
51
- });
52
- } else if (_nodes) {
53
- _locations = _nodes.reduce(function (list, node) {
54
- if (node.loc) {
55
- list.push((0, _location.getLocation)(node.loc.source, node.loc.start));
56
- }
37
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
38
+
39
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
40
+
41
+ function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
42
+
43
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
44
+
45
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
46
+
47
+ /**
48
+ * A GraphQLError describes an Error found during the parse, validate, or
49
+ * execute phases of performing a GraphQL operation. In addition to a message
50
+ * and stack trace, it also includes information about the locations in a
51
+ * GraphQL document and/or execution result that correspond to the Error.
52
+ */
53
+ var GraphQLError = /*#__PURE__*/function (_Error) {
54
+ _inherits(GraphQLError, _Error);
55
+
56
+ var _super = _createSuper(GraphQLError);
57
+
58
+ /**
59
+ * A message describing the Error for debugging purposes.
60
+ *
61
+ * Enumerable, and appears in the result of JSON.stringify().
62
+ *
63
+ * Note: should be treated as readonly, despite invariant usage.
64
+ */
65
+
66
+ /**
67
+ * An array of { line, column } locations within the source GraphQL document
68
+ * which correspond to this error.
69
+ *
70
+ * Errors during validation often contain multiple locations, for example to
71
+ * point out two things with the same name. Errors during execution include a
72
+ * single location, the field which produced the error.
73
+ *
74
+ * Enumerable, and appears in the result of JSON.stringify().
75
+ */
76
+
77
+ /**
78
+ * An array describing the JSON-path into the execution response which
79
+ * corresponds to this error. Only included for errors during execution.
80
+ *
81
+ * Enumerable, and appears in the result of JSON.stringify().
82
+ */
83
+
84
+ /**
85
+ * An array of GraphQL AST Nodes corresponding to this error.
86
+ */
87
+
88
+ /**
89
+ * The source GraphQL document for the first location of this error.
90
+ *
91
+ * Note that if this Error represents more than one node, the source may not
92
+ * represent nodes after the first node.
93
+ */
94
+
95
+ /**
96
+ * An array of character offsets within the source GraphQL document
97
+ * which correspond to this error.
98
+ */
99
+
100
+ /**
101
+ * The original error thrown from a field resolver during execution.
102
+ */
103
+
104
+ /**
105
+ * Extension fields to add to the formatted error.
106
+ */
107
+ function GraphQLError(message, nodes, source, positions, path, originalError, extensions) {
108
+ var _locations2, _source2, _positions2, _extensions2;
109
+
110
+ var _this;
111
+
112
+ _classCallCheck(this, GraphQLError);
113
+
114
+ _this = _super.call(this, message); // Compute list of blame nodes.
115
+
116
+ var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions.
57
117
 
58
- return list;
59
- }, []);
60
- }
61
118
 
62
- var _extensions = extensions;
119
+ var _source = source;
63
120
 
64
- if (_extensions == null && originalError != null) {
65
- var originalExtensions = originalError.extensions;
121
+ if (!_source && _nodes) {
122
+ var _nodes$0$loc;
66
123
 
67
- if ((0, _isObjectLike.default)(originalExtensions)) {
68
- _extensions = originalExtensions;
124
+ _source = (_nodes$0$loc = _nodes[0].loc) === null || _nodes$0$loc === void 0 ? void 0 : _nodes$0$loc.source;
69
125
  }
70
- }
71
126
 
72
- Object.defineProperties(this, {
73
- message: {
74
- value: message,
75
- // By being enumerable, JSON.stringify will include `message` in the
76
- // resulting output. This ensures that the simplest possible GraphQL
77
- // service adheres to the spec.
78
- enumerable: true,
79
- writable: true
80
- },
81
- locations: {
82
- // Coercing falsey values to undefined ensures they will not be included
83
- // in JSON.stringify() when not provided.
84
- value: _locations || undefined,
85
- // By being enumerable, JSON.stringify will include `locations` in the
86
- // resulting output. This ensures that the simplest possible GraphQL
87
- // service adheres to the spec.
88
- enumerable: _locations != null
89
- },
90
- path: {
91
- // Coercing falsey values to undefined ensures they will not be included
92
- // in JSON.stringify() when not provided.
93
- value: path || undefined,
94
- // By being enumerable, JSON.stringify will include `path` in the
95
- // resulting output. This ensures that the simplest possible GraphQL
96
- // service adheres to the spec.
97
- enumerable: path != null
98
- },
99
- nodes: {
100
- value: _nodes || undefined
101
- },
102
- source: {
103
- value: _source || undefined
104
- },
105
- positions: {
106
- value: _positions || undefined
107
- },
108
- originalError: {
109
- value: originalError
110
- },
111
- extensions: {
112
- // Coercing falsey values to undefined ensures they will not be included
113
- // in JSON.stringify() when not provided.
114
- value: _extensions || undefined,
115
- // By being enumerable, JSON.stringify will include `path` in the
116
- // resulting output. This ensures that the simplest possible GraphQL
117
- // service adheres to the spec.
118
- enumerable: _extensions != null
127
+ var _positions = positions;
128
+
129
+ if (!_positions && _nodes) {
130
+ _positions = _nodes.reduce(function (list, node) {
131
+ if (node.loc) {
132
+ list.push(node.loc.start);
133
+ }
134
+
135
+ return list;
136
+ }, []);
137
+ }
138
+
139
+ if (_positions && _positions.length === 0) {
140
+ _positions = undefined;
141
+ }
142
+
143
+ var _locations;
144
+
145
+ if (positions && source) {
146
+ _locations = positions.map(function (pos) {
147
+ return (0, _location.getLocation)(source, pos);
148
+ });
149
+ } else if (_nodes) {
150
+ _locations = _nodes.reduce(function (list, node) {
151
+ if (node.loc) {
152
+ list.push((0, _location.getLocation)(node.loc.source, node.loc.start));
153
+ }
154
+
155
+ return list;
156
+ }, []);
157
+ }
158
+
159
+ var _extensions = extensions;
160
+
161
+ if (_extensions == null && originalError != null) {
162
+ var originalExtensions = originalError.extensions;
163
+
164
+ if ((0, _isObjectLike.default)(originalExtensions)) {
165
+ _extensions = originalExtensions;
166
+ }
167
+ }
168
+
169
+ Object.defineProperties(_assertThisInitialized(_this), {
170
+ name: {
171
+ value: 'GraphQLError'
172
+ },
173
+ message: {
174
+ value: message,
175
+ // By being enumerable, JSON.stringify will include `message` in the
176
+ // resulting output. This ensures that the simplest possible GraphQL
177
+ // service adheres to the spec.
178
+ enumerable: true,
179
+ writable: true
180
+ },
181
+ locations: {
182
+ // Coercing falsy values to undefined ensures they will not be included
183
+ // in JSON.stringify() when not provided.
184
+ value: (_locations2 = _locations) !== null && _locations2 !== void 0 ? _locations2 : undefined,
185
+ // By being enumerable, JSON.stringify will include `locations` in the
186
+ // resulting output. This ensures that the simplest possible GraphQL
187
+ // service adheres to the spec.
188
+ enumerable: _locations != null
189
+ },
190
+ path: {
191
+ // Coercing falsy values to undefined ensures they will not be included
192
+ // in JSON.stringify() when not provided.
193
+ value: path !== null && path !== void 0 ? path : undefined,
194
+ // By being enumerable, JSON.stringify will include `path` in the
195
+ // resulting output. This ensures that the simplest possible GraphQL
196
+ // service adheres to the spec.
197
+ enumerable: path != null
198
+ },
199
+ nodes: {
200
+ value: _nodes !== null && _nodes !== void 0 ? _nodes : undefined
201
+ },
202
+ source: {
203
+ value: (_source2 = _source) !== null && _source2 !== void 0 ? _source2 : undefined
204
+ },
205
+ positions: {
206
+ value: (_positions2 = _positions) !== null && _positions2 !== void 0 ? _positions2 : undefined
207
+ },
208
+ originalError: {
209
+ value: originalError
210
+ },
211
+ extensions: {
212
+ // Coercing falsy values to undefined ensures they will not be included
213
+ // in JSON.stringify() when not provided.
214
+ value: (_extensions2 = _extensions) !== null && _extensions2 !== void 0 ? _extensions2 : undefined,
215
+ // By being enumerable, JSON.stringify will include `path` in the
216
+ // resulting output. This ensures that the simplest possible GraphQL
217
+ // service adheres to the spec.
218
+ enumerable: _extensions != null
219
+ }
220
+ }); // Include (non-enumerable) stack trace.
221
+
222
+ if (originalError === null || originalError === void 0 ? void 0 : originalError.stack) {
223
+ Object.defineProperty(_assertThisInitialized(_this), 'stack', {
224
+ value: originalError.stack,
225
+ writable: true,
226
+ configurable: true
227
+ });
228
+ return _possibleConstructorReturn(_this);
229
+ }
230
+ /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
231
+
232
+
233
+ if (Error.captureStackTrace) {
234
+ Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError);
235
+ } else {
236
+ Object.defineProperty(_assertThisInitialized(_this), 'stack', {
237
+ value: Error().stack,
238
+ writable: true,
239
+ configurable: true
240
+ });
119
241
  }
120
- }); // Include (non-enumerable) stack trace.
121
-
122
- if (originalError && originalError.stack) {
123
- Object.defineProperty(this, 'stack', {
124
- value: originalError.stack,
125
- writable: true,
126
- configurable: true
127
- });
128
- } else if (Error.captureStackTrace) {
129
- Error.captureStackTrace(this, GraphQLError);
130
- } else {
131
- Object.defineProperty(this, 'stack', {
132
- value: Error().stack,
133
- writable: true,
134
- configurable: true
135
- });
242
+
243
+ return _this;
136
244
  }
137
- }
138
245
 
139
- GraphQLError.prototype = Object.create(Error.prototype, {
140
- constructor: {
141
- value: GraphQLError
142
- },
143
- name: {
144
- value: 'GraphQLError'
145
- },
146
- toString: {
246
+ _createClass(GraphQLError, [{
247
+ key: "toString",
147
248
  value: function toString() {
148
249
  return printError(this);
250
+ } // FIXME: workaround to not break chai comparisons, should be remove in v16
251
+ // $FlowFixMe Flow doesn't support computed properties yet
252
+
253
+ }, {
254
+ key: _symbols.SYMBOL_TO_STRING_TAG,
255
+ get: function get() {
256
+ return 'Object';
149
257
  }
150
- }
151
- });
258
+ }]);
259
+
260
+ return GraphQLError;
261
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
152
262
  /**
153
263
  * Prints a GraphQLError to a string, representing useful location information
154
264
  * about the error's position in the source.
155
265
  */
156
266
 
267
+
268
+ exports.GraphQLError = GraphQLError;
269
+
157
270
  function printError(error) {
158
271
  var output = error.message;
159
272