graphql 16.0.1 → 16.3.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 (177) hide show
  1. package/README.md +4 -4
  2. package/error/GraphQLError.d.ts +17 -1
  3. package/error/GraphQLError.js +28 -10
  4. package/error/GraphQLError.mjs +28 -19
  5. package/error/locatedError.js +2 -8
  6. package/error/locatedError.mjs +2 -6
  7. package/execution/collectFields.d.ts +8 -8
  8. package/execution/collectFields.js +8 -8
  9. package/execution/collectFields.mjs +7 -7
  10. package/execution/execute.d.ts +5 -5
  11. package/execution/execute.js +28 -17
  12. package/execution/execute.mjs +30 -19
  13. package/execution/index.d.ts +1 -1
  14. package/execution/index.js +6 -0
  15. package/execution/index.mjs +1 -1
  16. package/execution/mapAsyncIterator.js +3 -1
  17. package/execution/mapAsyncIterator.mjs +3 -1
  18. package/execution/subscribe.d.ts +1 -1
  19. package/execution/subscribe.js +10 -2
  20. package/execution/subscribe.mjs +8 -1
  21. package/execution/values.d.ts +3 -5
  22. package/execution/values.js +7 -8
  23. package/execution/values.mjs +5 -6
  24. package/graphql.js +12 -4
  25. package/graphql.mjs +8 -1
  26. package/index.d.ts +7 -61
  27. package/index.js +30 -0
  28. package/index.mjs +62 -111
  29. package/jsutils/devAssert.js +1 -1
  30. package/jsutils/devAssert.mjs +1 -1
  31. package/jsutils/instanceOf.js +3 -1
  32. package/jsutils/instanceOf.mjs +3 -1
  33. package/jsutils/invariant.js +1 -1
  34. package/jsutils/invariant.mjs +1 -1
  35. package/jsutils/mapValue.js +2 -2
  36. package/jsutils/mapValue.mjs +2 -2
  37. package/jsutils/promiseReduce.mjs +1 -1
  38. package/jsutils/toError.d.ts +4 -0
  39. package/jsutils/toError.js +25 -0
  40. package/jsutils/toError.mjs +18 -0
  41. package/language/blockString.d.ts +7 -3
  42. package/language/blockString.js +121 -64
  43. package/language/blockString.mjs +111 -62
  44. package/language/characterClasses.d.ts +9 -0
  45. package/language/characterClasses.js +13 -0
  46. package/language/characterClasses.mjs +12 -0
  47. package/language/index.d.ts +0 -1
  48. package/language/lexer.d.ts +1 -1
  49. package/language/lexer.js +23 -15
  50. package/language/lexer.mjs +23 -15
  51. package/language/parser.d.ts +40 -40
  52. package/language/parser.js +9 -8
  53. package/language/parser.mjs +7 -6
  54. package/language/predicates.d.ts +4 -4
  55. package/language/printLocation.d.ts +1 -1
  56. package/language/printLocation.mjs +1 -1
  57. package/language/printer.js +5 -3
  58. package/language/printer.mjs +4 -2
  59. package/language/source.js +2 -2
  60. package/language/source.mjs +1 -1
  61. package/language/visitor.js +12 -13
  62. package/language/visitor.mjs +11 -12
  63. package/package.json +4 -1
  64. package/type/assertName.mjs +1 -1
  65. package/type/definition.d.ts +18 -14
  66. package/type/definition.js +13 -11
  67. package/type/definition.mjs +10 -16
  68. package/type/directives.d.ts +1 -1
  69. package/type/directives.js +9 -9
  70. package/type/directives.mjs +7 -7
  71. package/type/index.d.ts +5 -27
  72. package/type/index.js +24 -0
  73. package/type/index.mjs +26 -40
  74. package/type/introspection.d.ts +2 -2
  75. package/type/introspection.js +12 -8
  76. package/type/introspection.mjs +16 -12
  77. package/type/scalars.d.ts +10 -0
  78. package/type/scalars.js +20 -12
  79. package/type/scalars.mjs +17 -12
  80. package/type/schema.d.ts +4 -4
  81. package/type/schema.js +11 -9
  82. package/type/schema.mjs +11 -10
  83. package/type/validate.js +39 -30
  84. package/type/validate.mjs +42 -33
  85. package/utilities/TypeInfo.d.ts +9 -9
  86. package/utilities/TypeInfo.js +6 -2
  87. package/utilities/TypeInfo.mjs +11 -7
  88. package/utilities/assertValidName.js +3 -2
  89. package/utilities/assertValidName.mjs +3 -2
  90. package/utilities/astFromValue.js +8 -6
  91. package/utilities/astFromValue.mjs +7 -5
  92. package/utilities/buildASTSchema.d.ts +1 -1
  93. package/utilities/buildASTSchema.js +2 -2
  94. package/utilities/buildASTSchema.mjs +2 -2
  95. package/utilities/buildClientSchema.js +9 -7
  96. package/utilities/buildClientSchema.mjs +17 -15
  97. package/utilities/coerceInputValue.js +9 -7
  98. package/utilities/coerceInputValue.mjs +9 -7
  99. package/utilities/extendSchema.d.ts +1 -1
  100. package/utilities/extendSchema.js +50 -42
  101. package/utilities/extendSchema.mjs +71 -60
  102. package/utilities/findBreakingChanges.js +9 -22
  103. package/utilities/findBreakingChanges.mjs +13 -22
  104. package/utilities/getIntrospectionQuery.d.ts +4 -0
  105. package/utilities/getIntrospectionQuery.js +4 -0
  106. package/utilities/getIntrospectionQuery.mjs +4 -0
  107. package/utilities/getOperationRootType.d.ts +1 -1
  108. package/utilities/index.d.ts +0 -25
  109. package/utilities/index.mjs +21 -44
  110. package/utilities/introspectionFromSchema.d.ts +1 -1
  111. package/utilities/lexicographicSortSchema.js +8 -7
  112. package/utilities/lexicographicSortSchema.mjs +16 -15
  113. package/utilities/printSchema.d.ts +1 -1
  114. package/utilities/printSchema.js +14 -12
  115. package/utilities/printSchema.mjs +20 -15
  116. package/utilities/separateOperations.js +2 -0
  117. package/utilities/separateOperations.mjs +2 -0
  118. package/utilities/sortValueNode.d.ts +9 -0
  119. package/utilities/sortValueNode.js +47 -0
  120. package/utilities/sortValueNode.mjs +39 -0
  121. package/utilities/stripIgnoredCharacters.js +7 -23
  122. package/utilities/stripIgnoredCharacters.mjs +6 -25
  123. package/utilities/typeComparators.d.ts +1 -1
  124. package/utilities/typeComparators.mjs +3 -3
  125. package/utilities/typeFromAST.d.ts +4 -4
  126. package/utilities/typeFromAST.js +13 -24
  127. package/utilities/typeFromAST.mjs +12 -25
  128. package/utilities/valueFromAST.d.ts +1 -1
  129. package/utilities/valueFromAST.js +6 -4
  130. package/utilities/valueFromAST.mjs +7 -5
  131. package/utilities/valueFromASTUntyped.d.ts +1 -1
  132. package/utilities/valueFromASTUntyped.js +1 -11
  133. package/utilities/valueFromASTUntyped.mjs +2 -6
  134. package/validation/ValidationContext.d.ts +10 -10
  135. package/validation/index.d.ts +0 -29
  136. package/validation/index.mjs +29 -58
  137. package/validation/rules/FieldsOnCorrectTypeRule.js +2 -2
  138. package/validation/rules/FieldsOnCorrectTypeRule.mjs +3 -3
  139. package/validation/rules/KnownArgumentNamesRule.d.ts +1 -1
  140. package/validation/rules/KnownArgumentNamesRule.js +3 -1
  141. package/validation/rules/KnownArgumentNamesRule.mjs +3 -1
  142. package/validation/rules/KnownDirectivesRule.d.ts +1 -1
  143. package/validation/rules/KnownDirectivesRule.js +13 -9
  144. package/validation/rules/KnownDirectivesRule.mjs +8 -4
  145. package/validation/rules/KnownTypeNamesRule.d.ts +1 -1
  146. package/validation/rules/KnownTypeNamesRule.js +2 -2
  147. package/validation/rules/KnownTypeNamesRule.mjs +1 -1
  148. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +41 -36
  149. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +41 -39
  150. package/validation/rules/PossibleFragmentSpreadsRule.js +2 -2
  151. package/validation/rules/PossibleFragmentSpreadsRule.mjs +1 -1
  152. package/validation/rules/PossibleTypeExtensionsRule.js +16 -10
  153. package/validation/rules/PossibleTypeExtensionsRule.mjs +15 -9
  154. package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +1 -1
  155. package/validation/rules/ProvidedRequiredArgumentsRule.js +10 -5
  156. package/validation/rules/ProvidedRequiredArgumentsRule.mjs +9 -4
  157. package/validation/rules/UniqueArgumentDefinitionNamesRule.js +9 -3
  158. package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +9 -3
  159. package/validation/rules/UniqueArgumentNamesRule.js +3 -1
  160. package/validation/rules/UniqueArgumentNamesRule.mjs +3 -1
  161. package/validation/rules/UniqueEnumValueNamesRule.js +3 -1
  162. package/validation/rules/UniqueEnumValueNamesRule.mjs +3 -1
  163. package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -1
  164. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +5 -3
  165. package/validation/rules/UniqueOperationTypesRule.js +3 -1
  166. package/validation/rules/UniqueOperationTypesRule.mjs +3 -1
  167. package/validation/rules/UniqueVariableNamesRule.js +3 -1
  168. package/validation/rules/UniqueVariableNamesRule.mjs +3 -1
  169. package/validation/rules/ValuesOfCorrectTypeRule.js +2 -2
  170. package/validation/rules/ValuesOfCorrectTypeRule.mjs +5 -5
  171. package/validation/rules/VariablesInAllowedPositionRule.js +2 -2
  172. package/validation/rules/VariablesInAllowedPositionRule.mjs +1 -1
  173. package/validation/specifiedRules.d.ts +1 -1
  174. package/validation/specifiedRules.js +47 -47
  175. package/validation/specifiedRules.mjs +41 -41
  176. package/version.js +3 -3
  177. package/version.mjs +3 -3
@@ -15,24 +15,24 @@ exports.isDirective = isDirective;
15
15
  exports.isSpecifiedDirective = isSpecifiedDirective;
16
16
  exports.specifiedDirectives = void 0;
17
17
 
18
- var _inspect = require('../jsutils/inspect.js');
19
-
20
- var _toObjMap = require('../jsutils/toObjMap.js');
21
-
22
18
  var _devAssert = require('../jsutils/devAssert.js');
23
19
 
20
+ var _inspect = require('../jsutils/inspect.js');
21
+
24
22
  var _instanceOf = require('../jsutils/instanceOf.js');
25
23
 
26
24
  var _isObjectLike = require('../jsutils/isObjectLike.js');
27
25
 
26
+ var _toObjMap = require('../jsutils/toObjMap.js');
27
+
28
28
  var _directiveLocation = require('../language/directiveLocation.js');
29
29
 
30
30
  var _assertName = require('./assertName.js');
31
31
 
32
- var _scalars = require('./scalars.js');
33
-
34
32
  var _definition = require('./definition.js');
35
33
 
34
+ var _scalars = require('./scalars.js');
35
+
36
36
  /**
37
37
  * Test if the given value is a GraphQL directive.
38
38
  */
@@ -191,18 +191,18 @@ const GraphQLDeprecatedDirective = new GraphQLDirective({
191
191
  },
192
192
  });
193
193
  /**
194
- * Used to provide a URL for specifying the behaviour of custom scalar definitions.
194
+ * Used to provide a URL for specifying the behavior of custom scalar definitions.
195
195
  */
196
196
 
197
197
  exports.GraphQLDeprecatedDirective = GraphQLDeprecatedDirective;
198
198
  const GraphQLSpecifiedByDirective = new GraphQLDirective({
199
199
  name: 'specifiedBy',
200
- description: 'Exposes a URL that specifies the behaviour of this scalar.',
200
+ description: 'Exposes a URL that specifies the behavior of this scalar.',
201
201
  locations: [_directiveLocation.DirectiveLocation.SCALAR],
202
202
  args: {
203
203
  url: {
204
204
  type: new _definition.GraphQLNonNull(_scalars.GraphQLString),
205
- description: 'The URL that specifies the behaviour of this scalar.',
205
+ description: 'The URL that specifies the behavior of this scalar.',
206
206
  },
207
207
  },
208
208
  });
@@ -1,16 +1,16 @@
1
- import { inspect } from '../jsutils/inspect.mjs';
2
- import { toObjMap } from '../jsutils/toObjMap.mjs';
3
1
  import { devAssert } from '../jsutils/devAssert.mjs';
2
+ import { inspect } from '../jsutils/inspect.mjs';
4
3
  import { instanceOf } from '../jsutils/instanceOf.mjs';
5
4
  import { isObjectLike } from '../jsutils/isObjectLike.mjs';
5
+ import { toObjMap } from '../jsutils/toObjMap.mjs';
6
6
  import { DirectiveLocation } from '../language/directiveLocation.mjs';
7
7
  import { assertName } from './assertName.mjs';
8
- import { GraphQLString, GraphQLBoolean } from './scalars.mjs';
9
8
  import {
10
- defineArguments,
11
9
  argsToArgsConfig,
10
+ defineArguments,
12
11
  GraphQLNonNull,
13
12
  } from './definition.mjs';
13
+ import { GraphQLBoolean, GraphQLString } from './scalars.mjs';
14
14
  /**
15
15
  * Test if the given value is a GraphQL directive.
16
16
  */
@@ -161,17 +161,17 @@ export const GraphQLDeprecatedDirective = new GraphQLDirective({
161
161
  },
162
162
  });
163
163
  /**
164
- * Used to provide a URL for specifying the behaviour of custom scalar definitions.
164
+ * Used to provide a URL for specifying the behavior of custom scalar definitions.
165
165
  */
166
166
 
167
167
  export const GraphQLSpecifiedByDirective = new GraphQLDirective({
168
168
  name: 'specifiedBy',
169
- description: 'Exposes a URL that specifies the behaviour of this scalar.',
169
+ description: 'Exposes a URL that specifies the behavior of this scalar.',
170
170
  locations: [DirectiveLocation.SCALAR],
171
171
  args: {
172
172
  url: {
173
173
  type: new GraphQLNonNull(GraphQLString),
174
- description: 'The URL that specifies the behaviour of this scalar.',
174
+ description: 'The URL that specifies the behavior of this scalar.',
175
175
  },
176
176
  },
177
177
  });
package/type/index.d.ts CHANGED
@@ -1,15 +1,9 @@
1
1
  export type { Path as ResponsePath } from '../jsutils/Path';
2
- export {
3
- /** Predicate */
4
- isSchema,
5
- /** Assertion */
6
- assertSchema,
7
- /** GraphQL Schema definition */
8
- GraphQLSchema,
9
- } from './schema';
2
+ export { isSchema, assertSchema, GraphQLSchema } from './schema';
10
3
  export type { GraphQLSchemaConfig, GraphQLSchemaExtensions } from './schema';
11
4
  export {
12
- /** Predicates */
5
+ resolveObjMapThunk,
6
+ resolveReadonlyArrayThunk,
13
7
  isType,
14
8
  isScalarType,
15
9
  isObjectType,
@@ -29,7 +23,6 @@ export {
29
23
  isNamedType,
30
24
  isRequiredArgument,
31
25
  isRequiredInputField,
32
- /** Assertions */
33
26
  assertType,
34
27
  assertScalarType,
35
28
  assertObjectType,
@@ -47,17 +40,14 @@ export {
47
40
  assertWrappingType,
48
41
  assertNullableType,
49
42
  assertNamedType,
50
- /** Un-modifiers */
51
43
  getNullableType,
52
44
  getNamedType,
53
- /** Definitions */
54
45
  GraphQLScalarType,
55
46
  GraphQLObjectType,
56
47
  GraphQLInterfaceType,
57
48
  GraphQLUnionType,
58
49
  GraphQLEnumType,
59
50
  GraphQLInputObjectType,
60
- /** Type Wrappers */
61
51
  GraphQLList,
62
52
  GraphQLNonNull,
63
53
  } from './definition';
@@ -114,42 +104,34 @@ export type {
114
104
  GraphQLScalarLiteralParser,
115
105
  } from './definition';
116
106
  export {
117
- /** Predicate */
118
107
  isDirective,
119
- /** Assertion */
120
108
  assertDirective,
121
- /** Directives Definition */
122
109
  GraphQLDirective,
123
- /** Built-in Directives defined by the Spec */
124
110
  isSpecifiedDirective,
125
111
  specifiedDirectives,
126
112
  GraphQLIncludeDirective,
127
113
  GraphQLSkipDirective,
128
114
  GraphQLDeprecatedDirective,
129
115
  GraphQLSpecifiedByDirective,
130
- /** Constant Deprecation Reason */
131
116
  DEFAULT_DEPRECATION_REASON,
132
117
  } from './directives';
133
118
  export type {
134
119
  GraphQLDirectiveConfig,
135
120
  GraphQLDirectiveExtensions,
136
121
  } from './directives';
137
- /** Common built-in scalar instances. */
138
122
  export {
139
- /** Predicate */
140
123
  isSpecifiedScalarType,
141
- /** Standard GraphQL Scalars */
142
124
  specifiedScalarTypes,
143
125
  GraphQLInt,
144
126
  GraphQLFloat,
145
127
  GraphQLString,
146
128
  GraphQLBoolean,
147
129
  GraphQLID,
130
+ GRAPHQL_MAX_INT,
131
+ GRAPHQL_MIN_INT,
148
132
  } from './scalars';
149
133
  export {
150
- /** Predicate */
151
134
  isIntrospectionType,
152
- /** GraphQL Types for introspection. */
153
135
  introspectionTypes,
154
136
  __Schema,
155
137
  __Directive,
@@ -159,14 +141,10 @@ export {
159
141
  __InputValue,
160
142
  __EnumValue,
161
143
  __TypeKind,
162
- /** "Enum" of Type Kinds */
163
144
  TypeKind,
164
- /** Meta-field definitions. */
165
145
  SchemaMetaFieldDef,
166
146
  TypeMetaFieldDef,
167
147
  TypeNameMetaFieldDef,
168
148
  } from './introspection';
169
- /** Validate GraphQL schema. */
170
149
  export { validateSchema, assertValidSchema } from './validate';
171
- /** Upholds the spec rules about naming. */
172
150
  export { assertName, assertEnumValueName } from './assertName';
package/type/index.js CHANGED
@@ -9,6 +9,18 @@ Object.defineProperty(exports, 'DEFAULT_DEPRECATION_REASON', {
9
9
  return _directives.DEFAULT_DEPRECATION_REASON;
10
10
  },
11
11
  });
12
+ Object.defineProperty(exports, 'GRAPHQL_MAX_INT', {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _scalars.GRAPHQL_MAX_INT;
16
+ },
17
+ });
18
+ Object.defineProperty(exports, 'GRAPHQL_MIN_INT', {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _scalars.GRAPHQL_MIN_INT;
22
+ },
23
+ });
12
24
  Object.defineProperty(exports, 'GraphQLBoolean', {
13
25
  enumerable: true,
14
26
  get: function () {
@@ -489,6 +501,18 @@ Object.defineProperty(exports, 'isWrappingType', {
489
501
  return _definition.isWrappingType;
490
502
  },
491
503
  });
504
+ Object.defineProperty(exports, 'resolveObjMapThunk', {
505
+ enumerable: true,
506
+ get: function () {
507
+ return _definition.resolveObjMapThunk;
508
+ },
509
+ });
510
+ Object.defineProperty(exports, 'resolveReadonlyArrayThunk', {
511
+ enumerable: true,
512
+ get: function () {
513
+ return _definition.resolveReadonlyArrayThunk;
514
+ },
515
+ });
492
516
  Object.defineProperty(exports, 'specifiedDirectives', {
493
517
  enumerable: true,
494
518
  get: function () {
package/type/index.mjs CHANGED
@@ -1,13 +1,12 @@
1
1
  export {
2
- /** Predicate */
3
- isSchema,
4
- /** Assertion */
5
- assertSchema,
6
- /** GraphQL Schema definition */
2
+ // Predicate
3
+ isSchema, // Assertion
4
+ assertSchema, // GraphQL Schema definition
7
5
  GraphQLSchema,
8
6
  } from './schema.mjs';
9
7
  export {
10
- /** Predicates */
8
+ resolveObjMapThunk,
9
+ resolveReadonlyArrayThunk, // Predicates
11
10
  isType,
12
11
  isScalarType,
13
12
  isObjectType,
@@ -26,8 +25,7 @@ export {
26
25
  isNullableType,
27
26
  isNamedType,
28
27
  isRequiredArgument,
29
- isRequiredInputField,
30
- /** Assertions */
28
+ isRequiredInputField, // Assertions
31
29
  assertType,
32
30
  assertScalarType,
33
31
  assertObjectType,
@@ -44,55 +42,47 @@ export {
44
42
  assertAbstractType,
45
43
  assertWrappingType,
46
44
  assertNullableType,
47
- assertNamedType,
48
- /** Un-modifiers */
45
+ assertNamedType, // Un-modifiers
49
46
  getNullableType,
50
- getNamedType,
51
- /** Definitions */
47
+ getNamedType, // Definitions
52
48
  GraphQLScalarType,
53
49
  GraphQLObjectType,
54
50
  GraphQLInterfaceType,
55
51
  GraphQLUnionType,
56
52
  GraphQLEnumType,
57
- GraphQLInputObjectType,
58
- /** Type Wrappers */
53
+ GraphQLInputObjectType, // Type Wrappers
59
54
  GraphQLList,
60
55
  GraphQLNonNull,
61
56
  } from './definition.mjs';
62
57
  export {
63
- /** Predicate */
64
- isDirective,
65
- /** Assertion */
66
- assertDirective,
67
- /** Directives Definition */
68
- GraphQLDirective,
69
- /** Built-in Directives defined by the Spec */
58
+ // Predicate
59
+ isDirective, // Assertion
60
+ assertDirective, // Directives Definition
61
+ GraphQLDirective, // Built-in Directives defined by the Spec
70
62
  isSpecifiedDirective,
71
63
  specifiedDirectives,
72
64
  GraphQLIncludeDirective,
73
65
  GraphQLSkipDirective,
74
66
  GraphQLDeprecatedDirective,
75
- GraphQLSpecifiedByDirective,
76
- /** Constant Deprecation Reason */
67
+ GraphQLSpecifiedByDirective, // Constant Deprecation Reason
77
68
  DEFAULT_DEPRECATION_REASON,
78
69
  } from './directives.mjs';
79
-
80
- /** Common built-in scalar instances. */
70
+ // Common built-in scalar instances.
81
71
  export {
82
- /** Predicate */
83
- isSpecifiedScalarType,
84
- /** Standard GraphQL Scalars */
72
+ // Predicate
73
+ isSpecifiedScalarType, // Standard GraphQL Scalars
85
74
  specifiedScalarTypes,
86
75
  GraphQLInt,
87
76
  GraphQLFloat,
88
77
  GraphQLString,
89
78
  GraphQLBoolean,
90
- GraphQLID,
79
+ GraphQLID, // Int boundaries constants
80
+ GRAPHQL_MAX_INT,
81
+ GRAPHQL_MIN_INT,
91
82
  } from './scalars.mjs';
92
83
  export {
93
- /** Predicate */
94
- isIntrospectionType,
95
- /** GraphQL Types for introspection. */
84
+ // Predicate
85
+ isIntrospectionType, // GraphQL Types for introspection.
96
86
  introspectionTypes,
97
87
  __Schema,
98
88
  __Directive,
@@ -101,17 +91,13 @@ export {
101
91
  __Field,
102
92
  __InputValue,
103
93
  __EnumValue,
104
- __TypeKind,
105
- /** "Enum" of Type Kinds */
106
- TypeKind,
107
- /** Meta-field definitions. */
94
+ __TypeKind, // "Enum" of Type Kinds
95
+ TypeKind, // Meta-field definitions.
108
96
  SchemaMetaFieldDef,
109
97
  TypeMetaFieldDef,
110
98
  TypeNameMetaFieldDef,
111
- } from './introspection.mjs';
112
- /** Validate GraphQL schema. */
99
+ } from './introspection.mjs'; // Validate GraphQL schema.
113
100
 
114
- export { validateSchema, assertValidSchema } from './validate.mjs';
115
- /** Upholds the spec rules about naming. */
101
+ export { validateSchema, assertValidSchema } from './validate.mjs'; // Upholds the spec rules about naming.
116
102
 
117
103
  export { assertName, assertEnumValueName } from './assertName.mjs';
@@ -1,5 +1,5 @@
1
- import type { GraphQLNamedType, GraphQLField } from './definition';
2
- import { GraphQLObjectType, GraphQLEnumType } from './definition';
1
+ import type { GraphQLField, GraphQLNamedType } from './definition';
2
+ import { GraphQLEnumType, GraphQLObjectType } from './definition';
3
3
  export declare const __Schema: GraphQLObjectType;
4
4
  export declare const __Directive: GraphQLObjectType;
5
5
  export declare const __DirectiveLocation: GraphQLEnumType;
@@ -23,16 +23,16 @@ var _inspect = require('../jsutils/inspect.js');
23
23
 
24
24
  var _invariant = require('../jsutils/invariant.js');
25
25
 
26
- var _printer = require('../language/printer.js');
27
-
28
26
  var _directiveLocation = require('../language/directiveLocation.js');
29
27
 
30
- var _astFromValue = require('../utilities/astFromValue.js');
28
+ var _printer = require('../language/printer.js');
31
29
 
32
- var _scalars = require('./scalars.js');
30
+ var _astFromValue = require('../utilities/astFromValue.js');
33
31
 
34
32
  var _definition = require('./definition.js');
35
33
 
34
+ var _scalars = require('./scalars.js');
35
+
36
36
  const __Schema = new _definition.GraphQLObjectType({
37
37
  name: '__Schema',
38
38
  description:
@@ -253,11 +253,13 @@ const __Type = new _definition.GraphQLObjectType({
253
253
 
254
254
  if ((0, _definition.isListType)(type)) {
255
255
  return TypeKind.LIST;
256
- } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
256
+ }
257
257
 
258
258
  if ((0, _definition.isNonNullType)(type)) {
259
259
  return TypeKind.NON_NULL;
260
- } // istanbul ignore next (Not reachable. All possible types have been considered)
260
+ }
261
+ /* c8 ignore next 3 */
262
+ // Not reachable, all possible types have been considered)
261
263
 
262
264
  false ||
263
265
  (0, _invariant.invariant)(
@@ -273,8 +275,10 @@ const __Type = new _definition.GraphQLObjectType({
273
275
  description: {
274
276
  type: _scalars.GraphQLString,
275
277
  resolve: (
276
- type, // istanbul ignore next (FIXME: add test case)
277
- ) => ('description' in type ? type.description : undefined),
278
+ type, // FIXME: add test case
279
+ ) =>
280
+ /* c8 ignore next */
281
+ 'description' in type ? type.description : undefined,
278
282
  },
279
283
  specifiedByURL: {
280
284
  type: _scalars.GraphQLString,
@@ -1,24 +1,24 @@
1
1
  import { inspect } from '../jsutils/inspect.mjs';
2
2
  import { invariant } from '../jsutils/invariant.mjs';
3
- import { print } from '../language/printer.mjs';
4
3
  import { DirectiveLocation } from '../language/directiveLocation.mjs';
4
+ import { print } from '../language/printer.mjs';
5
5
  import { astFromValue } from '../utilities/astFromValue.mjs';
6
- import { GraphQLString, GraphQLBoolean } from './scalars.mjs';
7
6
  import {
7
+ GraphQLEnumType,
8
8
  GraphQLList,
9
9
  GraphQLNonNull,
10
10
  GraphQLObjectType,
11
- GraphQLEnumType,
12
- isScalarType,
13
- isObjectType,
14
- isInterfaceType,
15
- isUnionType,
11
+ isAbstractType,
16
12
  isEnumType,
17
13
  isInputObjectType,
14
+ isInterfaceType,
18
15
  isListType,
19
16
  isNonNullType,
20
- isAbstractType,
17
+ isObjectType,
18
+ isScalarType,
19
+ isUnionType,
21
20
  } from './definition.mjs';
21
+ import { GraphQLBoolean, GraphQLString } from './scalars.mjs';
22
22
  export const __Schema = new GraphQLObjectType({
23
23
  name: '__Schema',
24
24
  description:
@@ -222,11 +222,13 @@ export const __Type = new GraphQLObjectType({
222
222
 
223
223
  if (isListType(type)) {
224
224
  return TypeKind.LIST;
225
- } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
225
+ }
226
226
 
227
227
  if (isNonNullType(type)) {
228
228
  return TypeKind.NON_NULL;
229
- } // istanbul ignore next (Not reachable. All possible types have been considered)
229
+ }
230
+ /* c8 ignore next 3 */
231
+ // Not reachable, all possible types have been considered)
230
232
 
231
233
  false || invariant(false, `Unexpected type: "${inspect(type)}".`);
232
234
  },
@@ -238,8 +240,10 @@ export const __Type = new GraphQLObjectType({
238
240
  description: {
239
241
  type: GraphQLString,
240
242
  resolve: (
241
- type, // istanbul ignore next (FIXME: add test case)
242
- ) => ('description' in type ? type.description : undefined),
243
+ type, // FIXME: add test case
244
+ ) =>
245
+ /* c8 ignore next */
246
+ 'description' in type ? type.description : undefined,
243
247
  },
244
248
  specifiedByURL: {
245
249
  type: GraphQLString,
package/type/scalars.d.ts CHANGED
@@ -1,5 +1,15 @@
1
1
  import type { GraphQLNamedType } from './definition';
2
2
  import { GraphQLScalarType } from './definition';
3
+ /**
4
+ * Maximum possible Int value as per GraphQL Spec (32-bit signed integer).
5
+ * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1
6
+ * */
7
+ export declare const GRAPHQL_MAX_INT = 2147483647;
8
+ /**
9
+ * Minimum possible Int value as per GraphQL Spec (32-bit signed integer).
10
+ * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1)
11
+ * */
12
+ export declare const GRAPHQL_MIN_INT = -2147483648;
3
13
  export declare const GraphQLInt: GraphQLScalarType<number, number>;
4
14
  export declare const GraphQLFloat: GraphQLScalarType<number, number>;
5
15
  export declare const GraphQLString: GraphQLScalarType<string, string>;
package/type/scalars.js CHANGED
@@ -8,6 +8,8 @@ exports.GraphQLString =
8
8
  exports.GraphQLID =
9
9
  exports.GraphQLFloat =
10
10
  exports.GraphQLBoolean =
11
+ exports.GRAPHQL_MIN_INT =
12
+ exports.GRAPHQL_MAX_INT =
11
13
  void 0;
12
14
  exports.isSpecifiedScalarType = isSpecifiedScalarType;
13
15
  exports.specifiedScalarTypes = void 0;
@@ -16,21 +18,27 @@ var _inspect = require('../jsutils/inspect.js');
16
18
 
17
19
  var _isObjectLike = require('../jsutils/isObjectLike.js');
18
20
 
21
+ var _GraphQLError = require('../error/GraphQLError.js');
22
+
19
23
  var _kinds = require('../language/kinds.js');
20
24
 
21
25
  var _printer = require('../language/printer.js');
22
26
 
23
- var _GraphQLError = require('../error/GraphQLError.js');
24
-
25
27
  var _definition = require('./definition.js');
26
28
 
27
- // As per the GraphQL Spec, Integers are only treated as valid when a valid
28
- // 32-bit signed integer, providing the broadest support across platforms.
29
- //
30
- // n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because
31
- // they are internally represented as IEEE 754 doubles.
32
- const MAX_INT = 2147483647;
33
- const MIN_INT = -2147483648;
29
+ /**
30
+ * Maximum possible Int value as per GraphQL Spec (32-bit signed integer).
31
+ * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1
32
+ * */
33
+ const GRAPHQL_MAX_INT = 2147483647;
34
+ /**
35
+ * Minimum possible Int value as per GraphQL Spec (32-bit signed integer).
36
+ * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1)
37
+ * */
38
+
39
+ exports.GRAPHQL_MAX_INT = GRAPHQL_MAX_INT;
40
+ const GRAPHQL_MIN_INT = -2147483648;
41
+ exports.GRAPHQL_MIN_INT = GRAPHQL_MIN_INT;
34
42
  const GraphQLInt = new _definition.GraphQLScalarType({
35
43
  name: 'Int',
36
44
  description:
@@ -57,7 +65,7 @@ const GraphQLInt = new _definition.GraphQLScalarType({
57
65
  );
58
66
  }
59
67
 
60
- if (num > MAX_INT || num < MIN_INT) {
68
+ if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
61
69
  throw new _GraphQLError.GraphQLError(
62
70
  'Int cannot represent non 32-bit signed integer value: ' +
63
71
  (0, _inspect.inspect)(coercedValue),
@@ -76,7 +84,7 @@ const GraphQLInt = new _definition.GraphQLScalarType({
76
84
  );
77
85
  }
78
86
 
79
- if (inputValue > MAX_INT || inputValue < MIN_INT) {
87
+ if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) {
80
88
  throw new _GraphQLError.GraphQLError(
81
89
  `Int cannot represent non 32-bit signed integer value: ${inputValue}`,
82
90
  );
@@ -97,7 +105,7 @@ const GraphQLInt = new _definition.GraphQLScalarType({
97
105
 
98
106
  const num = parseInt(valueNode.value, 10);
99
107
 
100
- if (num > MAX_INT || num < MIN_INT) {
108
+ if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
101
109
  throw new _GraphQLError.GraphQLError(
102
110
  `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`,
103
111
  valueNode,
package/type/scalars.mjs CHANGED
@@ -1,16 +1,21 @@
1
1
  import { inspect } from '../jsutils/inspect.mjs';
2
2
  import { isObjectLike } from '../jsutils/isObjectLike.mjs';
3
+ import { GraphQLError } from '../error/GraphQLError.mjs';
3
4
  import { Kind } from '../language/kinds.mjs';
4
5
  import { print } from '../language/printer.mjs';
5
- import { GraphQLError } from '../error/GraphQLError.mjs';
6
- import { GraphQLScalarType } from './definition.mjs'; // As per the GraphQL Spec, Integers are only treated as valid when a valid
7
- // 32-bit signed integer, providing the broadest support across platforms.
8
- //
9
- // n.b. JavaScript's integers are safe between -(2^53 - 1) and 2^53 - 1 because
10
- // they are internally represented as IEEE 754 doubles.
11
-
12
- const MAX_INT = 2147483647;
13
- const MIN_INT = -2147483648;
6
+ import { GraphQLScalarType } from './definition.mjs';
7
+ /**
8
+ * Maximum possible Int value as per GraphQL Spec (32-bit signed integer).
9
+ * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1
10
+ * */
11
+
12
+ export const GRAPHQL_MAX_INT = 2147483647;
13
+ /**
14
+ * Minimum possible Int value as per GraphQL Spec (32-bit signed integer).
15
+ * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1)
16
+ * */
17
+
18
+ export const GRAPHQL_MIN_INT = -2147483648;
14
19
  export const GraphQLInt = new GraphQLScalarType({
15
20
  name: 'Int',
16
21
  description:
@@ -35,7 +40,7 @@ export const GraphQLInt = new GraphQLScalarType({
35
40
  );
36
41
  }
37
42
 
38
- if (num > MAX_INT || num < MIN_INT) {
43
+ if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
39
44
  throw new GraphQLError(
40
45
  'Int cannot represent non 32-bit signed integer value: ' +
41
46
  inspect(coercedValue),
@@ -52,7 +57,7 @@ export const GraphQLInt = new GraphQLScalarType({
52
57
  );
53
58
  }
54
59
 
55
- if (inputValue > MAX_INT || inputValue < MIN_INT) {
60
+ if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) {
56
61
  throw new GraphQLError(
57
62
  `Int cannot represent non 32-bit signed integer value: ${inputValue}`,
58
63
  );
@@ -71,7 +76,7 @@ export const GraphQLInt = new GraphQLScalarType({
71
76
 
72
77
  const num = parseInt(valueNode.value, 10);
73
78
 
74
- if (num > MAX_INT || num < MIN_INT) {
79
+ if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
75
80
  throw new GraphQLError(
76
81
  `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`,
77
82
  valueNode,
package/type/schema.d.ts CHANGED
@@ -1,16 +1,16 @@
1
- import type { ObjMap } from '../jsutils/ObjMap';
2
1
  import type { Maybe } from '../jsutils/Maybe';
2
+ import type { ObjMap } from '../jsutils/ObjMap';
3
3
  import type { GraphQLError } from '../error/GraphQLError';
4
4
  import type {
5
- OperationTypeNode,
6
5
  SchemaDefinitionNode,
7
6
  SchemaExtensionNode,
8
7
  } from '../language/ast';
8
+ import { OperationTypeNode } from '../language/ast';
9
9
  import type {
10
- GraphQLNamedType,
11
10
  GraphQLAbstractType,
12
- GraphQLObjectType,
13
11
  GraphQLInterfaceType,
12
+ GraphQLNamedType,
13
+ GraphQLObjectType,
14
14
  } from './definition';
15
15
  import type { GraphQLDirective } from './directives';
16
16
  /**