graphql 16.14.1 → 16.15.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 (240) hide show
  1. package/error/GraphQLError.d.ts +5 -1
  2. package/error/GraphQLError.js +12 -7
  3. package/error/GraphQLError.mjs +13 -6
  4. package/error/locatedError.d.ts +6 -4
  5. package/error/locatedError.js +6 -4
  6. package/error/locatedError.mjs +6 -4
  7. package/execution/collectFields.d.ts +1 -0
  8. package/execution/collectFields.js +9 -0
  9. package/execution/collectFields.mjs +9 -0
  10. package/execution/execute.d.ts +9 -10
  11. package/execution/execute.js +44 -29
  12. package/execution/execute.mjs +44 -29
  13. package/execution/mapAsyncIterator.js +12 -11
  14. package/execution/mapAsyncIterator.mjs +12 -11
  15. package/execution/subscribe.d.ts +5 -2
  16. package/execution/subscribe.js +5 -2
  17. package/execution/subscribe.mjs +5 -2
  18. package/execution/values.d.ts +43 -21
  19. package/execution/values.js +52 -24
  20. package/execution/values.mjs +51 -23
  21. package/graphql.d.ts +8 -14
  22. package/graphql.js +16 -15
  23. package/graphql.mjs +11 -15
  24. package/jsutils/SetMap.d.ts +14 -0
  25. package/jsutils/SetMap.js +48 -0
  26. package/jsutils/SetMap.mjs +39 -0
  27. package/jsutils/isIterableObject.d.ts +2 -0
  28. package/jsutils/isIterableObject.js +2 -0
  29. package/jsutils/isIterableObject.mjs +2 -0
  30. package/jsutils/keyMap.d.ts +2 -0
  31. package/jsutils/keyMap.js +2 -0
  32. package/jsutils/keyMap.mjs +2 -0
  33. package/jsutils/keyValMap.d.ts +3 -3
  34. package/jsutils/keyValMap.js +3 -3
  35. package/jsutils/keyValMap.mjs +3 -3
  36. package/language/ast.d.ts +2 -6
  37. package/language/ast.js +2 -6
  38. package/language/ast.mjs +2 -6
  39. package/language/lexer.d.ts +6 -0
  40. package/language/lexer.js +22 -0
  41. package/language/lexer.mjs +22 -0
  42. package/language/location.d.ts +8 -3
  43. package/language/location.js +57 -17
  44. package/language/location.mjs +56 -16
  45. package/language/parser.d.ts +27 -13
  46. package/language/parser.js +31 -9
  47. package/language/parser.mjs +31 -9
  48. package/language/predicates.d.ts +10 -3
  49. package/language/predicates.js +10 -3
  50. package/language/predicates.mjs +10 -3
  51. package/language/printLocation.d.ts +2 -6
  52. package/language/printLocation.js +2 -6
  53. package/language/printLocation.mjs +2 -6
  54. package/language/printer.d.ts +22 -3
  55. package/language/printer.js +394 -308
  56. package/language/printer.mjs +394 -308
  57. package/language/reducer.d.ts +32 -0
  58. package/language/reducer.js +95 -0
  59. package/language/reducer.mjs +86 -0
  60. package/language/source.d.ts +4 -5
  61. package/language/source.js +4 -5
  62. package/language/source.mjs +4 -5
  63. package/language/visitor.d.ts +16 -10
  64. package/language/visitor.js +15 -7
  65. package/language/visitor.mjs +15 -7
  66. package/package.json +1 -4
  67. package/type/definition.d.ts +190 -122
  68. package/type/definition.js +175 -102
  69. package/type/definition.mjs +174 -101
  70. package/type/directives.d.ts +14 -8
  71. package/type/directives.js +13 -7
  72. package/type/directives.mjs +13 -7
  73. package/type/scalars.js +8 -11
  74. package/type/scalars.mjs +1 -1
  75. package/type/schema.d.ts +38 -13
  76. package/type/schema.js +36 -11
  77. package/type/schema.mjs +36 -11
  78. package/type/validate.d.ts +1 -3
  79. package/type/validate.js +1 -3
  80. package/type/validate.mjs +1 -3
  81. package/utilities/TypeInfo.d.ts +15 -11
  82. package/utilities/TypeInfo.js +15 -11
  83. package/utilities/TypeInfo.mjs +15 -11
  84. package/utilities/assertValidName.d.ts +1 -1
  85. package/utilities/assertValidName.js +1 -1
  86. package/utilities/assertValidName.mjs +1 -1
  87. package/utilities/astFromValue.d.ts +3 -1
  88. package/utilities/astFromValue.js +3 -1
  89. package/utilities/astFromValue.mjs +3 -1
  90. package/utilities/buildASTSchema.d.ts +8 -8
  91. package/utilities/buildASTSchema.js +9 -20
  92. package/utilities/buildASTSchema.mjs +9 -20
  93. package/utilities/buildClientSchema.d.ts +6 -2
  94. package/utilities/buildClientSchema.js +6 -2
  95. package/utilities/buildClientSchema.mjs +6 -2
  96. package/utilities/coerceInputValue.d.ts +9 -3
  97. package/utilities/coerceInputValue.js +60 -13
  98. package/utilities/coerceInputValue.mjs +58 -13
  99. package/utilities/concatAST.d.ts +4 -1
  100. package/utilities/concatAST.js +4 -1
  101. package/utilities/concatAST.mjs +4 -1
  102. package/utilities/extendSchema.d.ts +7 -4
  103. package/utilities/extendSchema.js +7 -4
  104. package/utilities/extendSchema.mjs +7 -4
  105. package/utilities/findBreakingChanges.d.ts +2 -2
  106. package/utilities/findBreakingChanges.js +2 -2
  107. package/utilities/findBreakingChanges.mjs +2 -2
  108. package/utilities/getIntrospectionQuery.d.ts +9 -9
  109. package/utilities/getIntrospectionQuery.js +8 -8
  110. package/utilities/getIntrospectionQuery.mjs +8 -8
  111. package/utilities/getOperationAST.d.ts +2 -2
  112. package/utilities/getOperationAST.js +2 -2
  113. package/utilities/getOperationAST.mjs +2 -2
  114. package/utilities/getOperationRootType.d.ts +3 -1
  115. package/utilities/getOperationRootType.js +3 -1
  116. package/utilities/getOperationRootType.mjs +3 -1
  117. package/utilities/introspectionFromSchema.d.ts +12 -4
  118. package/utilities/introspectionFromSchema.js +12 -4
  119. package/utilities/introspectionFromSchema.mjs +12 -4
  120. package/utilities/lexicographicSortSchema.d.ts +17 -13
  121. package/utilities/lexicographicSortSchema.js +17 -13
  122. package/utilities/lexicographicSortSchema.mjs +17 -13
  123. package/utilities/printSchema.d.ts +7 -4
  124. package/utilities/printSchema.js +7 -4
  125. package/utilities/printSchema.mjs +7 -4
  126. package/utilities/resolveSchemaCoordinate.d.ts +9 -8
  127. package/utilities/resolveSchemaCoordinate.js +9 -8
  128. package/utilities/resolveSchemaCoordinate.mjs +9 -8
  129. package/utilities/separateOperations.d.ts +2 -2
  130. package/utilities/separateOperations.js +2 -2
  131. package/utilities/separateOperations.mjs +2 -2
  132. package/utilities/stripIgnoredCharacters.d.ts +19 -5
  133. package/utilities/stripIgnoredCharacters.js +19 -5
  134. package/utilities/stripIgnoredCharacters.mjs +19 -5
  135. package/utilities/typeComparators.d.ts +1 -5
  136. package/utilities/typeComparators.js +1 -5
  137. package/utilities/typeComparators.mjs +1 -5
  138. package/utilities/valueFromAST.js +4 -4
  139. package/utilities/valueFromAST.mjs +4 -4
  140. package/utilities/valueFromASTUntyped.d.ts +1 -3
  141. package/utilities/valueFromASTUntyped.js +1 -3
  142. package/utilities/valueFromASTUntyped.mjs +1 -3
  143. package/validation/ValidationContext.d.ts +22 -3
  144. package/validation/ValidationContext.js +84 -27
  145. package/validation/ValidationContext.mjs +82 -27
  146. package/validation/rules/ExecutableDefinitionsRule.d.ts +6 -4
  147. package/validation/rules/ExecutableDefinitionsRule.js +6 -4
  148. package/validation/rules/ExecutableDefinitionsRule.mjs +6 -4
  149. package/validation/rules/FieldsOnCorrectTypeRule.d.ts +4 -4
  150. package/validation/rules/FieldsOnCorrectTypeRule.js +10 -6
  151. package/validation/rules/FieldsOnCorrectTypeRule.mjs +12 -6
  152. package/validation/rules/FragmentsOnCompositeTypesRule.d.ts +6 -4
  153. package/validation/rules/FragmentsOnCompositeTypesRule.js +6 -4
  154. package/validation/rules/FragmentsOnCompositeTypesRule.mjs +6 -4
  155. package/validation/rules/KnownArgumentNamesRule.d.ts +4 -4
  156. package/validation/rules/KnownArgumentNamesRule.js +26 -17
  157. package/validation/rules/KnownArgumentNamesRule.mjs +21 -11
  158. package/validation/rules/KnownDirectivesRule.d.ts +1 -3
  159. package/validation/rules/KnownDirectivesRule.js +1 -3
  160. package/validation/rules/KnownDirectivesRule.mjs +1 -3
  161. package/validation/rules/KnownFragmentNamesRule.d.ts +4 -4
  162. package/validation/rules/KnownFragmentNamesRule.js +4 -4
  163. package/validation/rules/KnownFragmentNamesRule.mjs +4 -4
  164. package/validation/rules/KnownTypeNamesRule.d.ts +1 -3
  165. package/validation/rules/KnownTypeNamesRule.js +7 -7
  166. package/validation/rules/KnownTypeNamesRule.mjs +7 -7
  167. package/validation/rules/LoneAnonymousOperationRule.d.ts +6 -4
  168. package/validation/rules/LoneAnonymousOperationRule.js +6 -4
  169. package/validation/rules/LoneAnonymousOperationRule.mjs +6 -4
  170. package/validation/rules/MaxIntrospectionDepthRule.d.ts +6 -4
  171. package/validation/rules/MaxIntrospectionDepthRule.js +44 -19
  172. package/validation/rules/MaxIntrospectionDepthRule.mjs +44 -19
  173. package/validation/rules/NoFragmentCyclesRule.d.ts +1 -3
  174. package/validation/rules/NoFragmentCyclesRule.js +1 -3
  175. package/validation/rules/NoFragmentCyclesRule.mjs +1 -3
  176. package/validation/rules/NoUndefinedVariablesRule.d.ts +4 -4
  177. package/validation/rules/NoUndefinedVariablesRule.js +4 -4
  178. package/validation/rules/NoUndefinedVariablesRule.mjs +4 -4
  179. package/validation/rules/NoUnusedFragmentsRule.d.ts +4 -4
  180. package/validation/rules/NoUnusedFragmentsRule.js +10 -14
  181. package/validation/rules/NoUnusedFragmentsRule.mjs +10 -14
  182. package/validation/rules/NoUnusedVariablesRule.d.ts +4 -4
  183. package/validation/rules/NoUnusedVariablesRule.js +4 -4
  184. package/validation/rules/NoUnusedVariablesRule.mjs +4 -4
  185. package/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +8 -6
  186. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +552 -354
  187. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +545 -352
  188. package/validation/rules/PossibleFragmentSpreadsRule.d.ts +6 -4
  189. package/validation/rules/PossibleFragmentSpreadsRule.js +6 -4
  190. package/validation/rules/PossibleFragmentSpreadsRule.mjs +6 -4
  191. package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +6 -4
  192. package/validation/rules/ProvidedRequiredArgumentsRule.js +6 -4
  193. package/validation/rules/ProvidedRequiredArgumentsRule.mjs +6 -4
  194. package/validation/rules/ScalarLeafsRule.d.ts +1 -3
  195. package/validation/rules/ScalarLeafsRule.js +1 -3
  196. package/validation/rules/ScalarLeafsRule.mjs +1 -3
  197. package/validation/rules/SingleFieldSubscriptionsRule.d.ts +6 -4
  198. package/validation/rules/SingleFieldSubscriptionsRule.js +50 -9
  199. package/validation/rules/SingleFieldSubscriptionsRule.mjs +50 -9
  200. package/validation/rules/UniqueArgumentNamesRule.d.ts +4 -4
  201. package/validation/rules/UniqueArgumentNamesRule.js +4 -4
  202. package/validation/rules/UniqueArgumentNamesRule.mjs +4 -4
  203. package/validation/rules/UniqueDirectivesPerLocationRule.d.ts +6 -4
  204. package/validation/rules/UniqueDirectivesPerLocationRule.js +6 -4
  205. package/validation/rules/UniqueDirectivesPerLocationRule.mjs +6 -4
  206. package/validation/rules/UniqueFragmentNamesRule.d.ts +4 -4
  207. package/validation/rules/UniqueFragmentNamesRule.js +4 -4
  208. package/validation/rules/UniqueFragmentNamesRule.mjs +4 -4
  209. package/validation/rules/UniqueInputFieldNamesRule.d.ts +6 -4
  210. package/validation/rules/UniqueInputFieldNamesRule.js +6 -4
  211. package/validation/rules/UniqueInputFieldNamesRule.mjs +6 -4
  212. package/validation/rules/UniqueOperationNamesRule.d.ts +4 -4
  213. package/validation/rules/UniqueOperationNamesRule.js +4 -4
  214. package/validation/rules/UniqueOperationNamesRule.mjs +4 -4
  215. package/validation/rules/UniqueVariableNamesRule.d.ts +4 -4
  216. package/validation/rules/UniqueVariableNamesRule.js +4 -4
  217. package/validation/rules/UniqueVariableNamesRule.mjs +4 -4
  218. package/validation/rules/ValuesOfCorrectTypeRule.d.ts +4 -4
  219. package/validation/rules/ValuesOfCorrectTypeRule.js +29 -23
  220. package/validation/rules/ValuesOfCorrectTypeRule.mjs +24 -14
  221. package/validation/rules/VariablesAreInputTypesRule.d.ts +6 -4
  222. package/validation/rules/VariablesAreInputTypesRule.js +6 -4
  223. package/validation/rules/VariablesAreInputTypesRule.mjs +6 -4
  224. package/validation/rules/VariablesInAllowedPositionRule.d.ts +6 -4
  225. package/validation/rules/VariablesInAllowedPositionRule.js +6 -4
  226. package/validation/rules/VariablesInAllowedPositionRule.mjs +6 -4
  227. package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +4 -4
  228. package/validation/rules/custom/NoDeprecatedCustomRule.js +4 -4
  229. package/validation/rules/custom/NoDeprecatedCustomRule.mjs +4 -4
  230. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +7 -5
  231. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +7 -5
  232. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +7 -5
  233. package/validation/validate.d.ts +2 -0
  234. package/validation/validate.js +14 -2
  235. package/validation/validate.mjs +13 -2
  236. package/validation/validationAbortedError.d.ts +3 -0
  237. package/validation/validationAbortedError.js +14 -0
  238. package/validation/validationAbortedError.mjs +4 -0
  239. package/version.js +3 -3
  240. package/version.mjs +3 -3
@@ -947,13 +947,15 @@ export declare function assertAbstractType(type: unknown): GraphQLAbstractType;
947
947
  * @typeParam T - The GraphQL type wrapped by this list type.
948
948
  * @example
949
949
  * ```ts
950
- * const PersonType = new GraphQLObjectType({
950
+ * import { GraphQLList, GraphQLObjectType } from 'graphql';
951
+ *
952
+ * const PersonType: GraphQLObjectType = new GraphQLObjectType({
951
953
  * name: 'Person',
952
954
  * fields: () => ({
953
955
  * parents: { type: new GraphQLList(PersonType) },
954
956
  * children: { type: new GraphQLList(PersonType) },
955
- * })
956
- * })
957
+ * }),
958
+ * });
957
959
  * ```
958
960
  */
959
961
  export declare class GraphQLList<T extends GraphQLType> {
@@ -1019,12 +1021,14 @@ export declare class GraphQLList<T extends GraphQLType> {
1019
1021
  * @typeParam T - The nullable GraphQL type wrapped by this non-null type.
1020
1022
  * @example
1021
1023
  * ```ts
1024
+ * import { GraphQLNonNull, GraphQLObjectType, GraphQLString } from 'graphql';
1025
+ *
1022
1026
  * const RowType = new GraphQLObjectType({
1023
1027
  * name: 'Row',
1024
1028
  * fields: () => ({
1025
1029
  * id: { type: new GraphQLNonNull(GraphQLString) },
1026
- * })
1027
- * })
1030
+ * }),
1031
+ * });
1028
1032
  * ```
1029
1033
  *
1030
1034
  * Note: the enforcement of non-nullability occurs within the executor.
@@ -1059,9 +1063,7 @@ export declare class GraphQLNonNull<T extends GraphQLNullableType> {
1059
1063
  * import { GraphQLList, GraphQLNonNull, GraphQLString } from 'graphql/type';
1060
1064
  *
1061
1065
  * const requiredString = new GraphQLNonNull(GraphQLString);
1062
- * const requiredStringList = new GraphQLNonNull(
1063
- * new GraphQLList(GraphQLString),
1064
- * );
1066
+ * const requiredStringList = new GraphQLNonNull(new GraphQLList(GraphQLString));
1065
1067
  *
1066
1068
  * requiredString.toString(); // => 'String!'
1067
1069
  * requiredStringList.toString(); // => '[String]!'
@@ -1160,9 +1162,7 @@ export declare function isNullableType(
1160
1162
  * assertNullableType,
1161
1163
  * } from 'graphql/type';
1162
1164
  *
1163
- * const nullableType = assertNullableType(GraphQLString);
1164
- *
1165
- * nullableType; // => GraphQLString
1165
+ * const nullableType = assertNullableType(GraphQLString); // => GraphQLString
1166
1166
  * assertNullableType(new GraphQLNonNull(GraphQLString)); // throws an error
1167
1167
  * ```
1168
1168
  */
@@ -1217,9 +1217,7 @@ export declare function getNullableType<T extends GraphQLNullableType>(
1217
1217
  * getNullableType,
1218
1218
  * } from 'graphql/type';
1219
1219
  *
1220
- * const requiredStringList = new GraphQLNonNull(
1221
- * new GraphQLList(GraphQLString),
1222
- * );
1220
+ * const requiredStringList = new GraphQLNonNull(new GraphQLList(GraphQLString));
1223
1221
  *
1224
1222
  * getNullableType(requiredStringList).toString(); // => '[String]'
1225
1223
  * getNullableType(GraphQLString); // => GraphQLString
@@ -1307,7 +1305,7 @@ export declare function getNamedType(type: undefined | null): void;
1307
1305
  *
1308
1306
  * const inputArg = schema.getQueryType()?.getFields().review.args[0];
1309
1307
  *
1310
- * getNamedType(inputArg?.type).toString(); // => 'ReviewInput'
1308
+ * getNamedType(inputArg?.type)?.toString(); // => 'ReviewInput'
1311
1309
  * ```
1312
1310
  */
1313
1311
  export declare function getNamedType(
@@ -1334,7 +1332,7 @@ export declare function getNamedType(
1334
1332
  *
1335
1333
  * const usersField = schema.getQueryType()?.getFields().users;
1336
1334
  *
1337
- * getNamedType(usersField?.type).toString(); // => 'User'
1335
+ * getNamedType(usersField?.type)?.toString(); // => 'User'
1338
1336
  * ```
1339
1337
  */
1340
1338
  export declare function getNamedType(
@@ -1367,11 +1365,7 @@ export declare function getNamedType(type: GraphQLType): GraphQLNamedType;
1367
1365
  * @returns The named type after unwrapping all wrappers, or undefined for nullish input.
1368
1366
  * @example
1369
1367
  * ```ts
1370
- * import {
1371
- * GraphQLList,
1372
- * GraphQLString,
1373
- * getNamedType,
1374
- * } from 'graphql/type';
1368
+ * import { GraphQLList, GraphQLString, getNamedType } from 'graphql/type';
1375
1369
  *
1376
1370
  * getNamedType(new GraphQLList(GraphQLString)); // => GraphQLString
1377
1371
  * getNamedType(undefined); // => undefined
@@ -1402,11 +1396,8 @@ export declare type ThunkObjMap<T> = (() => ObjMap<T>) | ObjMap<T>;
1402
1396
  * ```ts
1403
1397
  * import { GraphQLString, resolveReadonlyArrayThunk } from 'graphql/type';
1404
1398
  *
1405
- * const lazyFields = resolveReadonlyArrayThunk(() => [GraphQLString]);
1406
- * const fields = resolveReadonlyArrayThunk([GraphQLString]);
1407
- *
1408
- * lazyFields; // => [GraphQLString]
1409
- * fields; // => [GraphQLString]
1399
+ * const lazyFields = resolveReadonlyArrayThunk(() => [GraphQLString]); // => [GraphQLString]
1400
+ * const fields = resolveReadonlyArrayThunk([GraphQLString]); // => [GraphQLString]
1410
1401
  * ```
1411
1402
  */
1412
1403
  export declare function resolveReadonlyArrayThunk<T>(
@@ -1456,21 +1447,29 @@ export interface GraphQLScalarTypeExtensions {
1456
1447
  * @typeParam TExternal - The serialized representation exposed in GraphQL results.
1457
1448
  * @example
1458
1449
  * ```ts
1450
+ * import { GraphQLScalarType } from 'graphql/type';
1451
+ *
1459
1452
  * const OddType = new GraphQLScalarType({
1460
1453
  * name: 'Odd',
1461
1454
  * serialize: (value) => {
1462
- * if (!Number.isFinite(value)) {
1455
+ * if (typeof value !== 'number' || !Number.isInteger(value)) {
1463
1456
  * throw new Error(
1464
- * `Scalar "Odd" cannot represent "${value}" since it is not a finite number.`,
1457
+ * `Scalar "Odd" cannot represent "${value}" since it is not an integer.`,
1465
1458
  * );
1466
1459
  * }
1467
1460
  *
1468
1461
  * if (value % 2 === 0) {
1469
- * throw new Error(`Scalar "Odd" cannot represent "${value}" since it is even.`);
1462
+ * throw new Error(
1463
+ * `Scalar "Odd" cannot represent "${value}" since it is even.`,
1464
+ * );
1470
1465
  * }
1471
1466
  * return value;
1472
- * }
1467
+ * },
1473
1468
  * });
1469
+ *
1470
+ * OddType.serialize(3); // => 3
1471
+ * OddType.serialize(2); // throws an error
1472
+ * OddType.serialize(1.5); // throws an error
1474
1473
  * ```
1475
1474
  */
1476
1475
  export declare class GraphQLScalarType<
@@ -1489,7 +1488,7 @@ export declare class GraphQLScalarType<
1489
1488
  parseValue: GraphQLScalarValueParser<TInternal>;
1490
1489
  /** Function that converts AST input literals into this scalar's internal value. */
1491
1490
  parseLiteral: GraphQLScalarLiteralParser<TInternal>;
1492
- /** Extension fields to include in the formatted result. */
1491
+ /** Custom extension fields reserved for users. */
1493
1492
  extensions: Readonly<GraphQLScalarTypeExtensions>;
1494
1493
  /** AST node from which this schema element was built, if available. */
1495
1494
  astNode: Maybe<ScalarTypeDefinitionNode>;
@@ -1500,6 +1499,7 @@ export declare class GraphQLScalarType<
1500
1499
  * @param config - Configuration describing this object.
1501
1500
  * @example
1502
1501
  * ```ts
1502
+ * import assert from 'node:assert/strict';
1503
1503
  * import { Kind, parse } from 'graphql/language';
1504
1504
  * import { GraphQLScalarType } from 'graphql/type';
1505
1505
  *
@@ -1509,42 +1509,43 @@ export declare class GraphQLScalarType<
1509
1509
  *
1510
1510
  * extend scalar Odd @specifiedBy(url: "https://example.com/odd-v2")
1511
1511
  * `);
1512
+ * assert(document.definitions[0].kind === Kind.SCALAR_TYPE_DEFINITION);
1513
+ * assert(document.definitions[1].kind === Kind.SCALAR_TYPE_EXTENSION);
1514
+ *
1515
+ * const ensureOdd = (value: unknown) => {
1516
+ * if (
1517
+ * typeof value !== 'number' ||
1518
+ * !Number.isInteger(value) ||
1519
+ * value % 2 === 0
1520
+ * ) {
1521
+ * throw new TypeError('Odd can only accept odd integers.');
1522
+ * }
1523
+ * return value;
1524
+ * };
1512
1525
  *
1513
1526
  * const Odd = new GraphQLScalarType({
1514
1527
  * name: 'Odd',
1515
1528
  * description: 'Odd integer values.',
1516
1529
  * specifiedByURL: 'https://example.com/odd',
1517
- * serialize: (value) => {
1518
- * if (typeof value !== 'number' || value % 2 === 0) {
1519
- * throw new TypeError('Odd can only serialize odd numbers.');
1520
- * }
1521
- * return value;
1522
- * },
1523
- * parseValue: (value) => {
1524
- * if (typeof value !== 'number' || value % 2 === 0) {
1525
- * throw new TypeError('Odd can only parse odd numbers.');
1526
- * }
1527
- * return value;
1528
- * },
1530
+ * serialize: ensureOdd,
1531
+ * parseValue: ensureOdd,
1529
1532
  * parseLiteral: (ast) => {
1530
1533
  * if (ast.kind !== Kind.INT) {
1531
1534
  * throw new TypeError('Odd can only parse integer literals.');
1532
1535
  * }
1533
- * const value = Number(ast.value);
1534
- * if (value % 2 === 0) {
1535
- * throw new TypeError('Odd can only parse odd integer literals.');
1536
- * }
1537
- * return value;
1536
+ * return ensureOdd(Number(ast.value));
1538
1537
  * },
1539
1538
  * extensions: { numeric: true },
1540
1539
  * astNode: document.definitions[0],
1541
- * extensionASTNodes: [ document.definitions[1] ],
1540
+ * extensionASTNodes: [document.definitions[1]],
1542
1541
  * });
1543
1542
  *
1544
1543
  * Odd.description; // => 'Odd integer values.'
1545
1544
  * Odd.specifiedByURL; // => 'https://example.com/odd'
1546
1545
  * Odd.serialize(3); // => 3
1547
1546
  * Odd.parseValue(5); // => 5
1547
+ * Odd.parseValue(2); // throws an error
1548
+ * Odd.parseValue(1.5); // throws an error
1548
1549
  * Odd.extensions; // => { numeric: true }
1549
1550
  * ```
1550
1551
  */
@@ -1645,7 +1646,7 @@ export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
1645
1646
  parseValue?: GraphQLScalarValueParser<TInternal>;
1646
1647
  /** Parses an externally provided literal value to use as an input. */
1647
1648
  parseLiteral?: GraphQLScalarLiteralParser<TInternal>;
1648
- /** Extension fields to include in the formatted result. */
1649
+ /** Custom extension fields reserved for users. */
1649
1650
  extensions?: Maybe<Readonly<GraphQLScalarTypeExtensions>>;
1650
1651
  /** AST node from which this schema element was built, if available. */
1651
1652
  astNode?: Maybe<ScalarTypeDefinitionNode>;
@@ -1684,6 +1685,8 @@ export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> {
1684
1685
  * @typeParam TContext - Context object type passed to resolvers.
1685
1686
  * @example
1686
1687
  * ```ts
1688
+ * import { GraphQLInt, GraphQLObjectType, GraphQLString } from 'graphql';
1689
+ *
1687
1690
  * const AddressType = new GraphQLObjectType({
1688
1691
  * name: 'Address',
1689
1692
  * fields: {
@@ -1692,10 +1695,10 @@ export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> {
1692
1695
  * formatted: {
1693
1696
  * type: GraphQLString,
1694
1697
  * resolve: (obj) => {
1695
- * return obj.number + ' ' + obj.street
1696
- * }
1697
- * }
1698
- * }
1698
+ * return obj.number + ' ' + obj.street;
1699
+ * },
1700
+ * },
1701
+ * },
1699
1702
  * });
1700
1703
  * ```
1701
1704
  * @example
@@ -1704,12 +1707,14 @@ export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> {
1704
1707
  * thunk) to supply the fields lazily.
1705
1708
  *
1706
1709
  * ```ts
1707
- * const PersonType = new GraphQLObjectType({
1710
+ * import { GraphQLObjectType, GraphQLString } from 'graphql';
1711
+ *
1712
+ * const PersonType: GraphQLObjectType = new GraphQLObjectType({
1708
1713
  * name: 'Person',
1709
1714
  * fields: () => ({
1710
1715
  * name: { type: GraphQLString },
1711
1716
  * bestFriend: { type: PersonType },
1712
- * })
1717
+ * }),
1713
1718
  * });
1714
1719
  * ```
1715
1720
  */
@@ -1720,7 +1725,7 @@ export declare class GraphQLObjectType<TSource = any, TContext = any> {
1720
1725
  description: Maybe<string>;
1721
1726
  /** Predicate used to determine whether a runtime value belongs to this object type. */
1722
1727
  isTypeOf: Maybe<GraphQLIsTypeOfFn<TSource, TContext>>;
1723
- /** Extension fields to include in the formatted result. */
1728
+ /** Custom extension fields reserved for users. */
1724
1729
  extensions: Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>;
1725
1730
  /** AST node from which this schema element was built, if available. */
1726
1731
  astNode: Maybe<ObjectTypeDefinitionNode>;
@@ -1733,8 +1738,9 @@ export declare class GraphQLObjectType<TSource = any, TContext = any> {
1733
1738
  * @param config - Configuration describing this object.
1734
1739
  * @example
1735
1740
  * ```ts
1741
+ * import assert from 'node:assert/strict';
1736
1742
  * // Configure an object type with interfaces, fields, arguments, and metadata.
1737
- * import { parse } from 'graphql/language';
1743
+ * import { parse, Kind } from 'graphql/language';
1738
1744
  * import {
1739
1745
  * GraphQLID,
1740
1746
  * GraphQLInterfaceType,
@@ -1753,9 +1759,11 @@ export declare class GraphQLObjectType<TSource = any, TContext = any> {
1753
1759
  * displayName: String
1754
1760
  * }
1755
1761
  * `);
1762
+ * assert(document.definitions[0].kind === Kind.OBJECT_TYPE_DEFINITION);
1763
+ * assert(document.definitions[1].kind === Kind.OBJECT_TYPE_EXTENSION);
1756
1764
  * const definition = document.definitions[0];
1757
- * const nameField = definition.fields[1];
1758
- * const formatArg = nameField.arguments[0];
1765
+ * const nameField = definition.fields?.[1];
1766
+ * const formatArg = nameField?.arguments?.[0];
1759
1767
  *
1760
1768
  * const Node = new GraphQLInterfaceType({
1761
1769
  * name: 'Node',
@@ -1796,7 +1804,7 @@ export declare class GraphQLObjectType<TSource = any, TContext = any> {
1796
1804
  * },
1797
1805
  * extensions: { entity: 'User' },
1798
1806
  * astNode: definition,
1799
- * extensionASTNodes: [ document.definitions[1] ],
1807
+ * extensionASTNodes: [document.definitions[1]],
1800
1808
  * });
1801
1809
  *
1802
1810
  * User.name; // => 'User'
@@ -1977,7 +1985,7 @@ export interface GraphQLObjectTypeConfig<TSource, TContext> {
1977
1985
  fields: ThunkObjMap<GraphQLFieldConfig<TSource, TContext>>;
1978
1986
  /** Predicate used to determine whether a runtime value belongs to this object type. */
1979
1987
  isTypeOf?: Maybe<GraphQLIsTypeOfFn<TSource, TContext>>;
1980
- /** Extension fields to include in the formatted result. */
1988
+ /** Custom extension fields reserved for users. */
1981
1989
  extensions?: Maybe<Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>>;
1982
1990
  /** AST node from which this schema element was built, if available. */
1983
1991
  astNode?: Maybe<ObjectTypeDefinitionNode>;
@@ -2032,7 +2040,7 @@ export declare type GraphQLFieldResolver<
2032
2040
  ) => TResult;
2033
2041
  /** Information about the currently executing GraphQL field. */
2034
2042
  export interface GraphQLResolveInfo {
2035
- /** The field name referenced by this schema coordinate. */
2043
+ /** Name of the field being resolved. */
2036
2044
  readonly fieldName: string;
2037
2045
  /** AST field nodes that contributed to the current field execution. */
2038
2046
  readonly fieldNodes: ReadonlyArray<FieldNode>;
@@ -2040,9 +2048,9 @@ export interface GraphQLResolveInfo {
2040
2048
  readonly returnType: GraphQLOutputType;
2041
2049
  /** Object type that owns the current field. */
2042
2050
  readonly parentType: GraphQLObjectType;
2043
- /** Response path where this error occurred during execution. */
2051
+ /** Response path of the field being resolved. */
2044
2052
  readonly path: Path;
2045
- /** The schema used for validation or execution. */
2053
+ /** The schema being executed. */
2046
2054
  readonly schema: GraphQLSchema;
2047
2055
  /** Fragment definitions in the operation document keyed by fragment name. */
2048
2056
  readonly fragments: ObjMap<FragmentDefinitionNode>;
@@ -2090,7 +2098,7 @@ export interface GraphQLFieldConfig<TSource, TContext, TArgs = any> {
2090
2098
  subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
2091
2099
  /** Reason this element is deprecated, if one was provided. */
2092
2100
  deprecationReason?: Maybe<string>;
2093
- /** Extension fields to include in the formatted result. */
2101
+ /** Custom extension fields reserved for users. */
2094
2102
  extensions?: Maybe<
2095
2103
  Readonly<GraphQLFieldExtensions<TSource, TContext, TArgs>>
2096
2104
  >;
@@ -2121,7 +2129,7 @@ export interface GraphQLArgumentConfig {
2121
2129
  defaultValue?: unknown;
2122
2130
  /** Reason this element is deprecated, if one was provided. */
2123
2131
  deprecationReason?: Maybe<string>;
2124
- /** Extension fields to include in the formatted result. */
2132
+ /** Custom extension fields reserved for users. */
2125
2133
  extensions?: Maybe<Readonly<GraphQLArgumentExtensions>>;
2126
2134
  /** AST node from which this schema element was built, if available. */
2127
2135
  astNode?: Maybe<InputValueDefinitionNode>;
@@ -2155,7 +2163,7 @@ export interface GraphQLField<TSource, TContext, TArgs = any> {
2155
2163
  subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
2156
2164
  /** Reason this element is deprecated, if one was provided. */
2157
2165
  deprecationReason: Maybe<string>;
2158
- /** Extension fields to include in the formatted result. */
2166
+ /** Custom extension fields reserved for users. */
2159
2167
  extensions: Readonly<GraphQLFieldExtensions<TSource, TContext, TArgs>>;
2160
2168
  /** AST node from which this schema element was built, if available. */
2161
2169
  astNode: Maybe<FieldDefinitionNode>;
@@ -2172,7 +2180,7 @@ export interface GraphQLArgument {
2172
2180
  defaultValue: unknown;
2173
2181
  /** Reason this element is deprecated, if one was provided. */
2174
2182
  deprecationReason: Maybe<string>;
2175
- /** Extension fields to include in the formatted result. */
2183
+ /** Custom extension fields reserved for users. */
2176
2184
  extensions: Readonly<GraphQLArgumentExtensions>;
2177
2185
  /** AST node from which this schema element was built, if available. */
2178
2186
  astNode: Maybe<InputValueDefinitionNode>;
@@ -2186,17 +2194,26 @@ export interface GraphQLArgument {
2186
2194
  * import {
2187
2195
  * GraphQLInt,
2188
2196
  * GraphQLNonNull,
2197
+ * GraphQLObjectType,
2189
2198
  * GraphQLString,
2190
2199
  * isRequiredArgument,
2191
2200
  * } from 'graphql/type';
2192
2201
  *
2193
- * const requiredArgument = { name: 'id', type: new GraphQLNonNull(GraphQLInt) };
2194
- * const optionalArgument = { name: 'name', type: GraphQLString };
2195
- * const argumentWithDefault = {
2196
- * name: 'limit',
2197
- * type: new GraphQLNonNull(GraphQLInt),
2198
- * defaultValue: 10,
2199
- * };
2202
+ * const Query = new GraphQLObjectType({
2203
+ * name: 'Query',
2204
+ * fields: {
2205
+ * greeting: {
2206
+ * type: GraphQLString,
2207
+ * args: {
2208
+ * id: { type: new GraphQLNonNull(GraphQLInt) },
2209
+ * name: { type: GraphQLString },
2210
+ * limit: { type: new GraphQLNonNull(GraphQLInt), defaultValue: 10 },
2211
+ * },
2212
+ * },
2213
+ * },
2214
+ * });
2215
+ * const [requiredArgument, optionalArgument, argumentWithDefault] =
2216
+ * Query.getFields().greeting.args;
2200
2217
  *
2201
2218
  * isRequiredArgument(requiredArgument); // => true
2202
2219
  * isRequiredArgument(optionalArgument); // => false
@@ -2232,11 +2249,13 @@ export interface GraphQLInterfaceTypeExtensions {
2232
2249
  * when the field is resolved.
2233
2250
  * @example
2234
2251
  * ```ts
2252
+ * import { GraphQLInterfaceType, GraphQLString } from 'graphql';
2253
+ *
2235
2254
  * const EntityType = new GraphQLInterfaceType({
2236
2255
  * name: 'Entity',
2237
2256
  * fields: {
2238
- * name: { type: GraphQLString }
2239
- * }
2257
+ * name: { type: GraphQLString },
2258
+ * },
2240
2259
  * });
2241
2260
  * ```
2242
2261
  */
@@ -2247,7 +2266,7 @@ export declare class GraphQLInterfaceType {
2247
2266
  description: Maybe<string>;
2248
2267
  /** Function that resolves the concrete object type for this abstract type. */
2249
2268
  resolveType: Maybe<GraphQLTypeResolver<any, any>>;
2250
- /** Extension fields to include in the formatted result. */
2269
+ /** Custom extension fields reserved for users. */
2251
2270
  extensions: Readonly<GraphQLInterfaceTypeExtensions>;
2252
2271
  /** AST node from which this schema element was built, if available. */
2253
2272
  astNode: Maybe<InterfaceTypeDefinitionNode>;
@@ -2260,7 +2279,8 @@ export declare class GraphQLInterfaceType {
2260
2279
  * @param config - Configuration describing this object.
2261
2280
  * @example
2262
2281
  * ```ts
2263
- * import { parse } from 'graphql/language';
2282
+ * import assert from 'node:assert/strict';
2283
+ * import { parse, Kind } from 'graphql/language';
2264
2284
  * import { GraphQLID, GraphQLInterfaceType, GraphQLNonNull } from 'graphql/type';
2265
2285
  *
2266
2286
  * const document = parse(`
@@ -2276,6 +2296,8 @@ export declare class GraphQLInterfaceType {
2276
2296
  * url: String
2277
2297
  * }
2278
2298
  * `);
2299
+ * assert(document.definitions[1].kind === Kind.INTERFACE_TYPE_DEFINITION);
2300
+ * assert(document.definitions[2].kind === Kind.INTERFACE_TYPE_EXTENSION);
2279
2301
  *
2280
2302
  * const Node = new GraphQLInterfaceType({
2281
2303
  * name: 'Node',
@@ -2294,11 +2316,11 @@ export declare class GraphQLInterfaceType {
2294
2316
  * resolveType: (value) => {
2295
2317
  * return typeof value === 'object' && value != null && 'url' in value
2296
2318
  * ? 'WebPage'
2297
- * : null;
2319
+ * : undefined;
2298
2320
  * },
2299
2321
  * extensions: { abstract: true },
2300
2322
  * astNode: document.definitions[1],
2301
- * extensionASTNodes: [ document.definitions[2] ],
2323
+ * extensionASTNodes: [document.definitions[2]],
2302
2324
  * });
2303
2325
  *
2304
2326
  * Resource.name; // => 'Resource'
@@ -2465,7 +2487,7 @@ export interface GraphQLInterfaceTypeConfig<TSource, TContext> {
2465
2487
  * Object type.
2466
2488
  */
2467
2489
  resolveType?: Maybe<GraphQLTypeResolver<TSource, TContext>>;
2468
- /** Extension fields to include in the formatted result. */
2490
+ /** Custom extension fields reserved for users. */
2469
2491
  extensions?: Maybe<Readonly<GraphQLInterfaceTypeExtensions>>;
2470
2492
  /** AST node from which this schema element was built, if available. */
2471
2493
  astNode?: Maybe<InterfaceTypeDefinitionNode>;
@@ -2499,17 +2521,30 @@ export interface GraphQLUnionTypeExtensions {
2499
2521
  * to determine which type is actually used when the field is resolved.
2500
2522
  * @example
2501
2523
  * ```ts
2524
+ * import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql';
2525
+ *
2526
+ * class Dog {}
2527
+ * class Cat {}
2528
+ * const DogType = new GraphQLObjectType({
2529
+ * name: 'Dog',
2530
+ * fields: { name: { type: GraphQLString } },
2531
+ * });
2532
+ * const CatType = new GraphQLObjectType({
2533
+ * name: 'Cat',
2534
+ * fields: { name: { type: GraphQLString } },
2535
+ * });
2536
+ *
2502
2537
  * const PetType = new GraphQLUnionType({
2503
2538
  * name: 'Pet',
2504
2539
  * types: [DogType, CatType],
2505
2540
  * resolveType: (value) => {
2506
2541
  * if (value instanceof Dog) {
2507
- * return DogType;
2542
+ * return 'Dog';
2508
2543
  * }
2509
2544
  * if (value instanceof Cat) {
2510
- * return CatType;
2545
+ * return 'Cat';
2511
2546
  * }
2512
- * }
2547
+ * },
2513
2548
  * });
2514
2549
  * ```
2515
2550
  */
@@ -2520,7 +2555,7 @@ export declare class GraphQLUnionType {
2520
2555
  description: Maybe<string>;
2521
2556
  /** Function that resolves the concrete object type for this abstract type. */
2522
2557
  resolveType: Maybe<GraphQLTypeResolver<any, any>>;
2523
- /** Extension fields to include in the formatted result. */
2558
+ /** Custom extension fields reserved for users. */
2524
2559
  extensions: Readonly<GraphQLUnionTypeExtensions>;
2525
2560
  /** AST node from which this schema element was built, if available. */
2526
2561
  astNode: Maybe<UnionTypeDefinitionNode>;
@@ -2532,14 +2567,21 @@ export declare class GraphQLUnionType {
2532
2567
  * @param config - Configuration describing this object.
2533
2568
  * @example
2534
2569
  * ```ts
2535
- * import { parse } from 'graphql/language';
2536
- * import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql/type';
2570
+ * import assert from 'node:assert/strict';
2571
+ * import { parse, Kind } from 'graphql/language';
2572
+ * import {
2573
+ * GraphQLObjectType,
2574
+ * GraphQLString,
2575
+ * GraphQLUnionType,
2576
+ * } from 'graphql/type';
2537
2577
  *
2538
2578
  * const document = parse(`
2539
2579
  * union Media = Photo | Video
2540
2580
  *
2541
2581
  * extend union Media = Audio
2542
2582
  * `);
2583
+ * assert(document.definitions[0].kind === Kind.UNION_TYPE_DEFINITION);
2584
+ * assert(document.definitions[1].kind === Kind.UNION_TYPE_EXTENSION);
2543
2585
  *
2544
2586
  * const Photo = new GraphQLObjectType({
2545
2587
  * name: 'Photo',
@@ -2561,7 +2603,7 @@ export declare class GraphQLUnionType {
2561
2603
  * },
2562
2604
  * extensions: { searchable: true },
2563
2605
  * astNode: document.definitions[0],
2564
- * extensionASTNodes: [ document.definitions[1] ],
2606
+ * extensionASTNodes: [document.definitions[1]],
2565
2607
  * });
2566
2608
  *
2567
2609
  * Media.description; // => 'Media that can appear in a search result.'
@@ -2610,7 +2652,11 @@ export declare class GraphQLUnionType {
2610
2652
  * @returns A configuration object that can be used to recreate this object.
2611
2653
  * @example
2612
2654
  * ```ts
2613
- * import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql/type';
2655
+ * import {
2656
+ * GraphQLObjectType,
2657
+ * GraphQLString,
2658
+ * GraphQLUnionType,
2659
+ * } from 'graphql/type';
2614
2660
  *
2615
2661
  * const Photo = new GraphQLObjectType({
2616
2662
  * name: 'Photo',
@@ -2663,7 +2709,11 @@ export declare class GraphQLUnionType {
2663
2709
  * @returns The JSON-serializable representation.
2664
2710
  * @example
2665
2711
  * ```ts
2666
- * import { GraphQLObjectType, GraphQLString, GraphQLUnionType } from 'graphql/type';
2712
+ * import {
2713
+ * GraphQLObjectType,
2714
+ * GraphQLString,
2715
+ * GraphQLUnionType,
2716
+ * } from 'graphql/type';
2667
2717
  *
2668
2718
  * const Photo = new GraphQLObjectType({
2669
2719
  * name: 'Photo',
@@ -2698,7 +2748,7 @@ export interface GraphQLUnionTypeConfig<TSource, TContext> {
2698
2748
  * Object type.
2699
2749
  */
2700
2750
  resolveType?: Maybe<GraphQLTypeResolver<TSource, TContext>>;
2701
- /** Extension fields to include in the formatted result. */
2751
+ /** Custom extension fields reserved for users. */
2702
2752
  extensions?: Maybe<Readonly<GraphQLUnionTypeExtensions>>;
2703
2753
  /** AST node from which this schema element was built, if available. */
2704
2754
  astNode?: Maybe<UnionTypeDefinitionNode>;
@@ -2752,7 +2802,7 @@ export declare class GraphQLEnumType {
2752
2802
  name: string;
2753
2803
  /** Human-readable description for this schema element, if provided. */
2754
2804
  description: Maybe<string>;
2755
- /** Extension fields to include in the formatted result. */
2805
+ /** Custom extension fields reserved for users. */
2756
2806
  extensions: Readonly<GraphQLEnumTypeExtensions>;
2757
2807
  /** AST node from which this schema element was built, if available. */
2758
2808
  astNode: Maybe<EnumTypeDefinitionNode>;
@@ -2766,7 +2816,8 @@ export declare class GraphQLEnumType {
2766
2816
  * @param config - Configuration describing this object.
2767
2817
  * @example
2768
2818
  * ```ts
2769
- * import { parse } from 'graphql/language';
2819
+ * import assert from 'node:assert/strict';
2820
+ * import { parse, Kind } from 'graphql/language';
2770
2821
  * import { GraphQLEnumType } from 'graphql/type';
2771
2822
  *
2772
2823
  * const document = parse(`
@@ -2780,6 +2831,8 @@ export declare class GraphQLEnumType {
2780
2831
  * FORCE_AWAKENS
2781
2832
  * }
2782
2833
  * `);
2834
+ * assert(document.definitions[0].kind === Kind.ENUM_TYPE_DEFINITION);
2835
+ * assert(document.definitions[1].kind === Kind.ENUM_TYPE_EXTENSION);
2783
2836
  * const definition = document.definitions[0];
2784
2837
  *
2785
2838
  * const Episode = new GraphQLEnumType({
@@ -2790,24 +2843,24 @@ export declare class GraphQLEnumType {
2790
2843
  * value: 4,
2791
2844
  * description: 'Released in 1977.',
2792
2845
  * extensions: { trilogy: 'original' },
2793
- * astNode: definition.values[0],
2846
+ * astNode: definition.values?.[0],
2794
2847
  * },
2795
- * EMPIRE: { value: 5, astNode: definition.values[1] },
2848
+ * EMPIRE: { value: 5, astNode: definition.values?.[1] },
2796
2849
  * JEDI: {
2797
2850
  * value: 6,
2798
2851
  * deprecationReason: 'Use RETURN_OF_THE_JEDI.',
2799
- * astNode: definition.values[2],
2852
+ * astNode: definition.values?.[2],
2800
2853
  * },
2801
2854
  * },
2802
2855
  * extensions: { catalog: 'films' },
2803
2856
  * astNode: definition,
2804
- * extensionASTNodes: [ document.definitions[1] ],
2857
+ * extensionASTNodes: [document.definitions[1]],
2805
2858
  * });
2806
2859
  *
2807
2860
  * Episode.description; // => 'A Star Wars film episode.'
2808
2861
  * Episode.serialize(5); // => 'EMPIRE'
2809
2862
  * Episode.parseValue('JEDI'); // => 6
2810
- * Episode.getValue('JEDI').deprecationReason; // => 'Use RETURN_OF_THE_JEDI.'
2863
+ * Episode.getValue('JEDI')?.deprecationReason; // => 'Use RETURN_OF_THE_JEDI.'
2811
2864
  * Episode.extensions; // => { catalog: 'films' }
2812
2865
  * ```
2813
2866
  */
@@ -2895,6 +2948,7 @@ export declare class GraphQLEnumType {
2895
2948
  /**
2896
2949
  * Parses a GraphQL enum name from variable input.
2897
2950
  * @param inputValue - Runtime input value to parse.
2951
+ * @param hideSuggestions - Omit suggestions from error messages.
2898
2952
  * @returns The internal enum value represented by the input name.
2899
2953
  * @example
2900
2954
  * ```ts
@@ -2914,11 +2968,12 @@ export declare class GraphQLEnumType {
2914
2968
  * RGB.parseValue(2); // throws an error
2915
2969
  * ```
2916
2970
  */
2917
- parseValue(inputValue: unknown): Maybe<any>;
2971
+ parseValue(inputValue: unknown, hideSuggestions?: Maybe<boolean>): Maybe<any>;
2918
2972
  /**
2919
2973
  * Parses a GraphQL enum name from an AST value literal.
2920
2974
  * @param valueNode - AST value literal to parse.
2921
2975
  * @param _variables - Runtime variable values; ignored because enum literals cannot contain variables.
2976
+ * @param hideSuggestions - Omit suggestions from error messages.
2922
2977
  * @returns The internal enum value represented by the literal.
2923
2978
  * @example
2924
2979
  * ```ts
@@ -2934,13 +2989,14 @@ export declare class GraphQLEnumType {
2934
2989
  * },
2935
2990
  * });
2936
2991
  *
2937
- * RGB.parseLiteral(parseValue('RED')); // => 0
2938
- * RGB.parseLiteral(parseValue('"RED"')); // throws an error
2992
+ * RGB.parseLiteral(parseValue('RED'), undefined); // => 0
2993
+ * RGB.parseLiteral(parseValue('"RED"'), undefined); // throws an error
2939
2994
  * ```
2940
2995
  */
2941
2996
  parseLiteral(
2942
2997
  valueNode: ValueNode,
2943
2998
  _variables: Maybe<ObjMap<unknown>>,
2999
+ hideSuggestions?: Maybe<boolean>,
2944
3000
  ): Maybe<any>;
2945
3001
  /**
2946
3002
  * Returns a normalized configuration object for this object.
@@ -3018,7 +3074,7 @@ export interface GraphQLEnumTypeConfig {
3018
3074
  description?: Maybe<string>;
3019
3075
  /** Values contained in this enum, list, or input-object definition. */
3020
3076
  values: ThunkObjMap<GraphQLEnumValueConfig>;
3021
- /** Extension fields to include in the formatted result. */
3077
+ /** Custom extension fields reserved for users. */
3022
3078
  extensions?: Maybe<Readonly<GraphQLEnumTypeExtensions>>;
3023
3079
  /** AST node from which this schema element was built, if available. */
3024
3080
  astNode?: Maybe<EnumTypeDefinitionNode>;
@@ -3051,7 +3107,7 @@ export interface GraphQLEnumValueConfig {
3051
3107
  value?: any;
3052
3108
  /** Reason this element is deprecated, if one was provided. */
3053
3109
  deprecationReason?: Maybe<string>;
3054
- /** Extension fields to include in the formatted result. */
3110
+ /** Custom extension fields reserved for users. */
3055
3111
  extensions?: Maybe<Readonly<GraphQLEnumValueExtensions>>;
3056
3112
  /** AST node from which this schema element was built, if available. */
3057
3113
  astNode?: Maybe<EnumValueDefinitionNode>;
@@ -3066,7 +3122,7 @@ export interface GraphQLEnumValue {
3066
3122
  value: any;
3067
3123
  /** Reason this element is deprecated, if one was provided. */
3068
3124
  deprecationReason: Maybe<string>;
3069
- /** Extension fields to include in the formatted result. */
3125
+ /** Custom extension fields reserved for users. */
3070
3126
  extensions: Readonly<GraphQLEnumValueExtensions>;
3071
3127
  /** AST node from which this schema element was built, if available. */
3072
3128
  astNode: Maybe<EnumValueDefinitionNode>;
@@ -3091,13 +3147,15 @@ export interface GraphQLInputObjectTypeExtensions {
3091
3147
  * Using `NonNull` will ensure that a value must be provided by the query
3092
3148
  * @example
3093
3149
  * ```ts
3150
+ * import { GraphQLFloat, GraphQLInputObjectType, GraphQLNonNull } from 'graphql';
3151
+ *
3094
3152
  * const GeoPoint = new GraphQLInputObjectType({
3095
3153
  * name: 'GeoPoint',
3096
3154
  * fields: {
3097
3155
  * lat: { type: new GraphQLNonNull(GraphQLFloat) },
3098
3156
  * lon: { type: new GraphQLNonNull(GraphQLFloat) },
3099
3157
  * alt: { type: GraphQLFloat, defaultValue: 0 },
3100
- * }
3158
+ * },
3101
3159
  * });
3102
3160
  * ```
3103
3161
  */
@@ -3106,7 +3164,7 @@ export declare class GraphQLInputObjectType {
3106
3164
  name: string;
3107
3165
  /** Human-readable description for this schema element, if provided. */
3108
3166
  description: Maybe<string>;
3109
- /** Extension fields to include in the formatted result. */
3167
+ /** Custom extension fields reserved for users. */
3110
3168
  extensions: Readonly<GraphQLInputObjectTypeExtensions>;
3111
3169
  /** AST node from which this schema element was built, if available. */
3112
3170
  astNode: Maybe<InputObjectTypeDefinitionNode>;
@@ -3120,7 +3178,8 @@ export declare class GraphQLInputObjectType {
3120
3178
  * @param config - Configuration describing this object.
3121
3179
  * @example
3122
3180
  * ```ts
3123
- * import { parse } from 'graphql/language';
3181
+ * import assert from 'node:assert/strict';
3182
+ * import { parse, Kind } from 'graphql/language';
3124
3183
  * import {
3125
3184
  * GraphQLID,
3126
3185
  * GraphQLInputObjectType,
@@ -3139,6 +3198,8 @@ export declare class GraphQLInputObjectType {
3139
3198
  * body: String
3140
3199
  * }
3141
3200
  * `);
3201
+ * assert(document.definitions[0].kind === Kind.INPUT_OBJECT_TYPE_DEFINITION);
3202
+ * assert(document.definitions[1].kind === Kind.INPUT_OBJECT_TYPE_EXTENSION);
3142
3203
  * const definition = document.definitions[0];
3143
3204
  *
3144
3205
  * const ReviewInput = new GraphQLInputObjectType({
@@ -3149,18 +3210,18 @@ export declare class GraphQLInputObjectType {
3149
3210
  * description: 'Star rating from one to five.',
3150
3211
  * type: new GraphQLNonNull(GraphQLInt),
3151
3212
  * extensions: { min: 1, max: 5 },
3152
- * astNode: definition.fields[0],
3213
+ * astNode: definition.fields?.[0],
3153
3214
  * },
3154
3215
  * commentary: {
3155
3216
  * type: GraphQLString,
3156
3217
  * defaultValue: '',
3157
3218
  * deprecationReason: 'Use body.',
3158
- * astNode: definition.fields[1],
3219
+ * astNode: definition.fields?.[1],
3159
3220
  * },
3160
3221
  * },
3161
3222
  * extensions: { form: 'review' },
3162
3223
  * astNode: definition,
3163
- * extensionASTNodes: [ document.definitions[1] ],
3224
+ * extensionASTNodes: [document.definitions[1]],
3164
3225
  * isOneOf: false,
3165
3226
  * });
3166
3227
  * const SearchBy = new GraphQLInputObjectType({
@@ -3294,7 +3355,7 @@ export interface GraphQLInputObjectTypeConfig {
3294
3355
  description?: Maybe<string>;
3295
3356
  /** Fields declared by this object, interface, input object, or literal. */
3296
3357
  fields: ThunkObjMap<GraphQLInputFieldConfig>;
3297
- /** Extension fields to include in the formatted result. */
3358
+ /** Custom extension fields reserved for users. */
3298
3359
  extensions?: Maybe<Readonly<GraphQLInputObjectTypeExtensions>>;
3299
3360
  /** AST node from which this schema element was built, if available. */
3300
3361
  astNode?: Maybe<InputObjectTypeDefinitionNode>;
@@ -3330,7 +3391,7 @@ export interface GraphQLInputFieldConfig {
3330
3391
  defaultValue?: unknown;
3331
3392
  /** Reason this element is deprecated, if one was provided. */
3332
3393
  deprecationReason?: Maybe<string>;
3333
- /** Extension fields to include in the formatted result. */
3394
+ /** Custom extension fields reserved for users. */
3334
3395
  extensions?: Maybe<Readonly<GraphQLInputFieldExtensions>>;
3335
3396
  /** AST node from which this schema element was built, if available. */
3336
3397
  astNode?: Maybe<InputValueDefinitionNode>;
@@ -3350,7 +3411,7 @@ export interface GraphQLInputField {
3350
3411
  defaultValue: unknown;
3351
3412
  /** Reason this element is deprecated, if one was provided. */
3352
3413
  deprecationReason: Maybe<string>;
3353
- /** Extension fields to include in the formatted result. */
3414
+ /** Custom extension fields reserved for users. */
3354
3415
  extensions: Readonly<GraphQLInputFieldExtensions>;
3355
3416
  /** AST node from which this schema element was built, if available. */
3356
3417
  astNode: Maybe<InputValueDefinitionNode>;
@@ -3362,19 +3423,26 @@ export interface GraphQLInputField {
3362
3423
  * @example
3363
3424
  * ```ts
3364
3425
  * import {
3426
+ * GraphQLInputObjectType,
3365
3427
  * GraphQLInt,
3366
3428
  * GraphQLNonNull,
3367
3429
  * GraphQLString,
3368
3430
  * isRequiredInputField,
3369
3431
  * } from 'graphql/type';
3370
3432
  *
3371
- * const requiredField = { name: 'id', type: new GraphQLNonNull(GraphQLInt) };
3372
- * const optionalField = { name: 'name', type: GraphQLString };
3373
- * const fieldWithDefault = {
3374
- * name: 'limit',
3375
- * type: new GraphQLNonNull(GraphQLInt),
3376
- * defaultValue: 10,
3377
- * };
3433
+ * const Input = new GraphQLInputObjectType({
3434
+ * name: 'Input',
3435
+ * fields: {
3436
+ * id: { type: new GraphQLNonNull(GraphQLInt) },
3437
+ * name: { type: GraphQLString },
3438
+ * limit: { type: new GraphQLNonNull(GraphQLInt), defaultValue: 10 },
3439
+ * },
3440
+ * });
3441
+ * const {
3442
+ * id: requiredField,
3443
+ * name: optionalField,
3444
+ * limit: fieldWithDefault,
3445
+ * } = Input.getFields();
3378
3446
  *
3379
3447
  * isRequiredInputField(requiredField); // => true
3380
3448
  * isRequiredInputField(optionalField); // => false