graphql 15.0.0 → 15.1.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 (164) hide show
  1. package/README.md +5 -5
  2. package/error/GraphQLError.d.ts +2 -2
  3. package/error/GraphQLError.js +4 -5
  4. package/error/GraphQLError.js.flow +1 -1
  5. package/error/GraphQLError.mjs +4 -5
  6. package/error/locatedError.d.ts +1 -1
  7. package/execution/execute.d.ts +8 -6
  8. package/execution/execute.js +4 -6
  9. package/execution/execute.js.flow +3 -2
  10. package/execution/execute.mjs +4 -6
  11. package/execution/values.d.ts +2 -1
  12. package/execution/values.js +1 -2
  13. package/execution/values.js.flow +1 -1
  14. package/execution/values.mjs +1 -2
  15. package/graphql.d.ts +2 -1
  16. package/index.d.ts +3 -2
  17. package/index.js +18 -0
  18. package/index.js.flow +3 -2
  19. package/index.mjs +2 -2
  20. package/jsutils/Maybe.d.ts +2 -0
  21. package/jsutils/Path.d.ts +2 -2
  22. package/jsutils/defineInspect.js +25 -0
  23. package/jsutils/defineInspect.js.flow +21 -0
  24. package/jsutils/defineInspect.mjs +15 -0
  25. package/jsutils/devAssert.js +1 -2
  26. package/jsutils/devAssert.js.flow +1 -1
  27. package/jsutils/devAssert.mjs +1 -2
  28. package/jsutils/instanceOf.js +1 -2
  29. package/jsutils/instanceOf.js.flow +1 -1
  30. package/jsutils/instanceOf.mjs +1 -2
  31. package/jsutils/invariant.js +1 -2
  32. package/jsutils/invariant.js.flow +1 -1
  33. package/jsutils/invariant.mjs +1 -2
  34. package/jsutils/nodejsCustomInspectSymbol.js +1 -2
  35. package/jsutils/nodejsCustomInspectSymbol.js.flow +1 -1
  36. package/jsutils/nodejsCustomInspectSymbol.mjs +1 -1
  37. package/language/ast.d.ts +11 -2
  38. package/language/ast.js +94 -80
  39. package/language/ast.js.flow +23 -14
  40. package/language/ast.mjs +86 -72
  41. package/language/blockString.js +2 -1
  42. package/language/blockString.js.flow +5 -1
  43. package/language/blockString.mjs +2 -1
  44. package/language/directiveLocation.d.ts +2 -7
  45. package/language/index.js +14 -0
  46. package/language/index.js.flow +1 -2
  47. package/language/index.mjs +1 -0
  48. package/language/kinds.d.ts +2 -7
  49. package/language/lexer.d.ts +6 -0
  50. package/language/tokenKind.d.ts +2 -4
  51. package/language/visitor.d.ts +4 -3
  52. package/package.json +2 -2
  53. package/polyfills/arrayFrom.js +1 -2
  54. package/polyfills/arrayFrom.js.flow +1 -1
  55. package/polyfills/arrayFrom.mjs +1 -2
  56. package/polyfills/symbols.js +3 -6
  57. package/polyfills/symbols.js.flow +3 -3
  58. package/polyfills/symbols.mjs +3 -6
  59. package/subscription/subscribe.d.ts +2 -1
  60. package/type/definition.d.ts +30 -21
  61. package/type/definition.js +60 -17
  62. package/type/definition.js.flow +61 -9
  63. package/type/definition.mjs +60 -17
  64. package/type/directives.d.ts +6 -1
  65. package/type/directives.js +28 -7
  66. package/type/directives.js.flow +23 -2
  67. package/type/directives.mjs +24 -4
  68. package/type/index.d.ts +1 -0
  69. package/type/index.js +6 -0
  70. package/type/index.js.flow +1 -0
  71. package/type/index.mjs +1 -1
  72. package/type/introspection.js +11 -6
  73. package/type/introspection.js.flow +8 -2
  74. package/type/introspection.mjs +11 -6
  75. package/type/schema.d.ts +7 -5
  76. package/type/validate.js +22 -8
  77. package/type/validate.js.flow +23 -11
  78. package/type/validate.mjs +22 -8
  79. package/utilities/TypeInfo.d.ts +2 -1
  80. package/utilities/astFromValue.d.ts +2 -1
  81. package/utilities/astFromValue.js +4 -5
  82. package/utilities/astFromValue.js.flow +2 -1
  83. package/utilities/astFromValue.mjs +4 -5
  84. package/utilities/buildASTSchema.js +15 -4
  85. package/utilities/buildASTSchema.js.flow +13 -2
  86. package/utilities/buildASTSchema.mjs +15 -4
  87. package/utilities/buildClientSchema.js +2 -1
  88. package/utilities/buildClientSchema.js.flow +1 -0
  89. package/utilities/buildClientSchema.mjs +2 -1
  90. package/utilities/coerceInputValue.js +4 -5
  91. package/utilities/coerceInputValue.js.flow +2 -1
  92. package/utilities/coerceInputValue.mjs +4 -5
  93. package/utilities/extendSchema.d.ts +2 -1
  94. package/utilities/extendSchema.js +78 -66
  95. package/utilities/extendSchema.js.flow +30 -9
  96. package/utilities/extendSchema.mjs +79 -67
  97. package/utilities/findBreakingChanges.d.ts +6 -16
  98. package/utilities/findBreakingChanges.js +5 -8
  99. package/utilities/findBreakingChanges.js.flow +2 -1
  100. package/utilities/findBreakingChanges.mjs +5 -8
  101. package/utilities/getIntrospectionQuery.d.ts +12 -2
  102. package/utilities/getIntrospectionQuery.js +3 -1
  103. package/utilities/getIntrospectionQuery.js.flow +10 -0
  104. package/utilities/getIntrospectionQuery.mjs +3 -1
  105. package/utilities/getOperationAST.d.ts +3 -2
  106. package/utilities/getOperationAST.js.flow +1 -1
  107. package/utilities/introspectionFromSchema.js +0 -2
  108. package/utilities/introspectionFromSchema.mjs +0 -2
  109. package/utilities/lexicographicSortSchema.js +14 -15
  110. package/utilities/lexicographicSortSchema.js.flow +2 -1
  111. package/utilities/lexicographicSortSchema.mjs +14 -15
  112. package/utilities/printSchema.js +16 -6
  113. package/utilities/printSchema.js.flow +20 -2
  114. package/utilities/printSchema.mjs +16 -6
  115. package/utilities/typeFromAST.js +4 -5
  116. package/utilities/typeFromAST.js.flow +2 -1
  117. package/utilities/typeFromAST.mjs +4 -5
  118. package/utilities/valueFromAST.d.ts +2 -1
  119. package/utilities/valueFromAST.js +4 -5
  120. package/utilities/valueFromAST.js.flow +2 -1
  121. package/utilities/valueFromAST.mjs +4 -5
  122. package/utilities/valueFromASTUntyped.d.ts +2 -1
  123. package/utilities/valueFromASTUntyped.js +2 -3
  124. package/utilities/valueFromASTUntyped.js.flow +1 -1
  125. package/utilities/valueFromASTUntyped.mjs +2 -3
  126. package/validation/ValidationContext.d.ts +4 -3
  127. package/validation/ValidationContext.js +0 -16
  128. package/validation/ValidationContext.mjs +0 -16
  129. package/validation/rules/KnownArgumentNamesRule.js +2 -2
  130. package/validation/rules/KnownArgumentNamesRule.js.flow +1 -1
  131. package/validation/rules/KnownArgumentNamesRule.mjs +2 -2
  132. package/validation/rules/KnownDirectivesRule.js +2 -5
  133. package/validation/rules/KnownDirectivesRule.js.flow +1 -1
  134. package/validation/rules/KnownDirectivesRule.mjs +2 -5
  135. package/validation/rules/KnownTypeNamesRule.d.ts +4 -2
  136. package/validation/rules/OverlappingFieldsCanBeMergedRule.js +2 -4
  137. package/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +2 -2
  138. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +2 -4
  139. package/validation/rules/PossibleTypeExtensionsRule.js +6 -8
  140. package/validation/rules/PossibleTypeExtensionsRule.js.flow +3 -2
  141. package/validation/rules/PossibleTypeExtensionsRule.mjs +6 -8
  142. package/validation/rules/ProvidedRequiredArgumentsRule.js +4 -5
  143. package/validation/rules/ProvidedRequiredArgumentsRule.js.flow +3 -3
  144. package/validation/rules/ProvidedRequiredArgumentsRule.mjs +4 -5
  145. package/validation/rules/UniqueEnumValueNamesRule.js +1 -2
  146. package/validation/rules/UniqueEnumValueNamesRule.js.flow +1 -1
  147. package/validation/rules/UniqueEnumValueNamesRule.mjs +1 -2
  148. package/validation/rules/UniqueFieldDefinitionNamesRule.js +1 -2
  149. package/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +1 -1
  150. package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +1 -2
  151. package/validation/rules/UniqueOperationTypesRule.js +1 -1
  152. package/validation/rules/UniqueOperationTypesRule.js.flow +1 -1
  153. package/validation/rules/UniqueOperationTypesRule.mjs +1 -1
  154. package/validation/validate.d.ts +3 -3
  155. package/version.js +3 -3
  156. package/version.js.flow +3 -3
  157. package/version.mjs +3 -3
  158. package/jsutils/dedent.js +0 -50
  159. package/jsutils/dedent.js.flow +0 -44
  160. package/jsutils/dedent.mjs +0 -43
  161. package/jsutils/defineToJSON.js +0 -25
  162. package/jsutils/defineToJSON.js.flow +0 -20
  163. package/jsutils/defineToJSON.mjs +0 -16
  164. package/tsutils/Maybe.d.ts +0 -6
@@ -39,7 +39,7 @@ function lexicographicSortSchema(schema) {
39
39
  var typeMap = (0, _keyValMap.default)(sortByName(schemaConfig.types), function (type) {
40
40
  return type.name;
41
41
  }, sortNamedType);
42
- return new _schema.GraphQLSchema(_objectSpread({}, schemaConfig, {
42
+ return new _schema.GraphQLSchema(_objectSpread(_objectSpread({}, schemaConfig), {}, {
43
43
  types: (0, _objectValues.default)(typeMap),
44
44
  directives: sortByName(schemaConfig.directives).map(sortDirective),
45
45
  query: replaceMaybeType(schemaConfig.query),
@@ -67,7 +67,7 @@ function lexicographicSortSchema(schema) {
67
67
 
68
68
  function sortDirective(directive) {
69
69
  var config = directive.toConfig();
70
- return new _directives.GraphQLDirective(_objectSpread({}, config, {
70
+ return new _directives.GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, {
71
71
  locations: sortBy(config.locations, function (x) {
72
72
  return x;
73
73
  }),
@@ -77,7 +77,7 @@ function lexicographicSortSchema(schema) {
77
77
 
78
78
  function sortArgs(args) {
79
79
  return sortObjMap(args, function (arg) {
80
- return _objectSpread({}, arg, {
80
+ return _objectSpread(_objectSpread({}, arg), {}, {
81
81
  type: replaceType(arg.type)
82
82
  });
83
83
  });
@@ -85,7 +85,7 @@ function lexicographicSortSchema(schema) {
85
85
 
86
86
  function sortFields(fieldsMap) {
87
87
  return sortObjMap(fieldsMap, function (field) {
88
- return _objectSpread({}, field, {
88
+ return _objectSpread(_objectSpread({}, field), {}, {
89
89
  type: replaceType(field.type),
90
90
  args: sortArgs(field.args)
91
91
  });
@@ -94,7 +94,7 @@ function lexicographicSortSchema(schema) {
94
94
 
95
95
  function sortInputFields(fieldsMap) {
96
96
  return sortObjMap(fieldsMap, function (field) {
97
- return _objectSpread({}, field, {
97
+ return _objectSpread(_objectSpread({}, field), {}, {
98
98
  type: replaceType(field.type)
99
99
  });
100
100
  });
@@ -111,7 +111,7 @@ function lexicographicSortSchema(schema) {
111
111
 
112
112
  if ((0, _definition.isObjectType)(type)) {
113
113
  var config = type.toConfig();
114
- return new _definition.GraphQLObjectType(_objectSpread({}, config, {
114
+ return new _definition.GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, {
115
115
  interfaces: function interfaces() {
116
116
  return sortTypes(config.interfaces);
117
117
  },
@@ -124,7 +124,7 @@ function lexicographicSortSchema(schema) {
124
124
  if ((0, _definition.isInterfaceType)(type)) {
125
125
  var _config = type.toConfig();
126
126
 
127
- return new _definition.GraphQLInterfaceType(_objectSpread({}, _config, {
127
+ return new _definition.GraphQLInterfaceType(_objectSpread(_objectSpread({}, _config), {}, {
128
128
  interfaces: function interfaces() {
129
129
  return sortTypes(_config.interfaces);
130
130
  },
@@ -137,7 +137,7 @@ function lexicographicSortSchema(schema) {
137
137
  if ((0, _definition.isUnionType)(type)) {
138
138
  var _config2 = type.toConfig();
139
139
 
140
- return new _definition.GraphQLUnionType(_objectSpread({}, _config2, {
140
+ return new _definition.GraphQLUnionType(_objectSpread(_objectSpread({}, _config2), {}, {
141
141
  types: function types() {
142
142
  return sortTypes(_config2.types);
143
143
  }
@@ -147,25 +147,24 @@ function lexicographicSortSchema(schema) {
147
147
  if ((0, _definition.isEnumType)(type)) {
148
148
  var _config3 = type.toConfig();
149
149
 
150
- return new _definition.GraphQLEnumType(_objectSpread({}, _config3, {
150
+ return new _definition.GraphQLEnumType(_objectSpread(_objectSpread({}, _config3), {}, {
151
151
  values: sortObjMap(_config3.values)
152
152
  }));
153
- }
153
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
154
+
154
155
 
155
- /* istanbul ignore else */
156
156
  if ((0, _definition.isInputObjectType)(type)) {
157
157
  var _config4 = type.toConfig();
158
158
 
159
- return new _definition.GraphQLInputObjectType(_objectSpread({}, _config4, {
159
+ return new _definition.GraphQLInputObjectType(_objectSpread(_objectSpread({}, _config4), {}, {
160
160
  fields: function fields() {
161
161
  return sortInputFields(_config4.fields);
162
162
  }
163
163
  }));
164
- } // Not reachable. All possible types have been considered.
164
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
165
165
 
166
166
 
167
- /* istanbul ignore next */
168
- (0, _invariant.default)(false, 'Unexpected type: ' + (0, _inspect.default)(type));
167
+ false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type));
169
168
  }
170
169
  }
171
170
 
@@ -137,6 +137,7 @@ export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema {
137
137
  values: sortObjMap(config.values),
138
138
  });
139
139
  }
140
+ // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
140
141
  if (isInputObjectType(type)) {
141
142
  const config = type.toConfig();
142
143
  return new GraphQLInputObjectType({
@@ -145,7 +146,7 @@ export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema {
145
146
  });
146
147
  }
147
148
 
148
- // Not reachable. All possible types have been considered.
149
+ // istanbul ignore next (Not reachable. All possible types have been considered)
149
150
  invariant(false, 'Unexpected type: ' + inspect((type: empty)));
150
151
  }
151
152
  }
@@ -23,7 +23,7 @@ export function lexicographicSortSchema(schema) {
23
23
  var typeMap = keyValMap(sortByName(schemaConfig.types), function (type) {
24
24
  return type.name;
25
25
  }, sortNamedType);
26
- return new GraphQLSchema(_objectSpread({}, schemaConfig, {
26
+ return new GraphQLSchema(_objectSpread(_objectSpread({}, schemaConfig), {}, {
27
27
  types: objectValues(typeMap),
28
28
  directives: sortByName(schemaConfig.directives).map(sortDirective),
29
29
  query: replaceMaybeType(schemaConfig.query),
@@ -51,7 +51,7 @@ export function lexicographicSortSchema(schema) {
51
51
 
52
52
  function sortDirective(directive) {
53
53
  var config = directive.toConfig();
54
- return new GraphQLDirective(_objectSpread({}, config, {
54
+ return new GraphQLDirective(_objectSpread(_objectSpread({}, config), {}, {
55
55
  locations: sortBy(config.locations, function (x) {
56
56
  return x;
57
57
  }),
@@ -61,7 +61,7 @@ export function lexicographicSortSchema(schema) {
61
61
 
62
62
  function sortArgs(args) {
63
63
  return sortObjMap(args, function (arg) {
64
- return _objectSpread({}, arg, {
64
+ return _objectSpread(_objectSpread({}, arg), {}, {
65
65
  type: replaceType(arg.type)
66
66
  });
67
67
  });
@@ -69,7 +69,7 @@ export function lexicographicSortSchema(schema) {
69
69
 
70
70
  function sortFields(fieldsMap) {
71
71
  return sortObjMap(fieldsMap, function (field) {
72
- return _objectSpread({}, field, {
72
+ return _objectSpread(_objectSpread({}, field), {}, {
73
73
  type: replaceType(field.type),
74
74
  args: sortArgs(field.args)
75
75
  });
@@ -78,7 +78,7 @@ export function lexicographicSortSchema(schema) {
78
78
 
79
79
  function sortInputFields(fieldsMap) {
80
80
  return sortObjMap(fieldsMap, function (field) {
81
- return _objectSpread({}, field, {
81
+ return _objectSpread(_objectSpread({}, field), {}, {
82
82
  type: replaceType(field.type)
83
83
  });
84
84
  });
@@ -95,7 +95,7 @@ export function lexicographicSortSchema(schema) {
95
95
 
96
96
  if (isObjectType(type)) {
97
97
  var config = type.toConfig();
98
- return new GraphQLObjectType(_objectSpread({}, config, {
98
+ return new GraphQLObjectType(_objectSpread(_objectSpread({}, config), {}, {
99
99
  interfaces: function interfaces() {
100
100
  return sortTypes(config.interfaces);
101
101
  },
@@ -108,7 +108,7 @@ export function lexicographicSortSchema(schema) {
108
108
  if (isInterfaceType(type)) {
109
109
  var _config = type.toConfig();
110
110
 
111
- return new GraphQLInterfaceType(_objectSpread({}, _config, {
111
+ return new GraphQLInterfaceType(_objectSpread(_objectSpread({}, _config), {}, {
112
112
  interfaces: function interfaces() {
113
113
  return sortTypes(_config.interfaces);
114
114
  },
@@ -121,7 +121,7 @@ export function lexicographicSortSchema(schema) {
121
121
  if (isUnionType(type)) {
122
122
  var _config2 = type.toConfig();
123
123
 
124
- return new GraphQLUnionType(_objectSpread({}, _config2, {
124
+ return new GraphQLUnionType(_objectSpread(_objectSpread({}, _config2), {}, {
125
125
  types: function types() {
126
126
  return sortTypes(_config2.types);
127
127
  }
@@ -131,25 +131,24 @@ export function lexicographicSortSchema(schema) {
131
131
  if (isEnumType(type)) {
132
132
  var _config3 = type.toConfig();
133
133
 
134
- return new GraphQLEnumType(_objectSpread({}, _config3, {
134
+ return new GraphQLEnumType(_objectSpread(_objectSpread({}, _config3), {}, {
135
135
  values: sortObjMap(_config3.values)
136
136
  }));
137
- }
137
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
138
+
138
139
 
139
- /* istanbul ignore else */
140
140
  if (isInputObjectType(type)) {
141
141
  var _config4 = type.toConfig();
142
142
 
143
- return new GraphQLInputObjectType(_objectSpread({}, _config4, {
143
+ return new GraphQLInputObjectType(_objectSpread(_objectSpread({}, _config4), {}, {
144
144
  fields: function fields() {
145
145
  return sortInputFields(_config4.fields);
146
146
  }
147
147
  }));
148
- } // Not reachable. All possible types have been considered.
148
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
149
149
 
150
150
 
151
- /* istanbul ignore next */
152
- invariant(false, 'Unexpected type: ' + inspect(type));
151
+ false || invariant(0, 'Unexpected type: ' + inspect(type));
153
152
  }
154
153
  }
155
154
 
@@ -141,20 +141,19 @@ function printType(type, options) {
141
141
 
142
142
  if ((0, _definition.isEnumType)(type)) {
143
143
  return printEnum(type, options);
144
- }
144
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
145
+
145
146
 
146
- /* istanbul ignore else */
147
147
  if ((0, _definition.isInputObjectType)(type)) {
148
148
  return printInputObject(type, options);
149
- } // Not reachable. All possible types have been considered.
149
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
150
150
 
151
151
 
152
- /* istanbul ignore next */
153
- (0, _invariant.default)(false, 'Unexpected type: ' + (0, _inspect.default)(type));
152
+ false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type));
154
153
  }
155
154
 
156
155
  function printScalar(type, options) {
157
- return printDescription(options, type) + "scalar ".concat(type.name);
156
+ return printDescription(options, type) + "scalar ".concat(type.name) + printSpecifiedByUrl(type);
158
157
  }
159
158
 
160
159
  function printImplementedInterfaces(type) {
@@ -252,6 +251,17 @@ function printDeprecated(fieldOrEnumVal) {
252
251
  return ' @deprecated';
253
252
  }
254
253
 
254
+ function printSpecifiedByUrl(scalar) {
255
+ if (scalar.specifiedByUrl == null) {
256
+ return '';
257
+ }
258
+
259
+ var url = scalar.specifiedByUrl;
260
+ var urlAST = (0, _astFromValue.astFromValue)(url, _scalars.GraphQLString);
261
+ urlAST || (0, _invariant.default)(0, 'Unexpected null value returned from `astFromValue` for specifiedByUrl');
262
+ return ' @specifiedBy(url: ' + (0, _printer.print)(urlAST) + ')';
263
+ }
264
+
255
265
  function printDescription(options, def) {
256
266
  var indentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
257
267
  var firstInBlock = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
@@ -172,16 +172,21 @@ export function printType(type: GraphQLNamedType, options?: Options): string {
172
172
  if (isEnumType(type)) {
173
173
  return printEnum(type, options);
174
174
  }
175
+ // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
175
176
  if (isInputObjectType(type)) {
176
177
  return printInputObject(type, options);
177
178
  }
178
179
 
179
- // Not reachable. All possible types have been considered.
180
+ // istanbul ignore next (Not reachable. All possible types have been considered)
180
181
  invariant(false, 'Unexpected type: ' + inspect((type: empty)));
181
182
  }
182
183
 
183
184
  function printScalar(type: GraphQLScalarType, options): string {
184
- return printDescription(options, type) + `scalar ${type.name}`;
185
+ return (
186
+ printDescription(options, type) +
187
+ `scalar ${type.name}` +
188
+ printSpecifiedByUrl(type)
189
+ );
185
190
  }
186
191
 
187
192
  function printImplementedInterfaces(
@@ -321,6 +326,19 @@ function printDeprecated(fieldOrEnumVal) {
321
326
  return ' @deprecated';
322
327
  }
323
328
 
329
+ function printSpecifiedByUrl(scalar: GraphQLScalarType) {
330
+ if (scalar.specifiedByUrl == null) {
331
+ return '';
332
+ }
333
+ const url = scalar.specifiedByUrl;
334
+ const urlAST = astFromValue(url, GraphQLString);
335
+ invariant(
336
+ urlAST,
337
+ 'Unexpected null value returned from `astFromValue` for specifiedByUrl',
338
+ );
339
+ return ' @specifiedBy(url: ' + print(urlAST) + ')';
340
+ }
341
+
324
342
  function printDescription(
325
343
  options,
326
344
  def,
@@ -120,20 +120,19 @@ export function printType(type, options) {
120
120
 
121
121
  if (isEnumType(type)) {
122
122
  return printEnum(type, options);
123
- }
123
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
124
+
124
125
 
125
- /* istanbul ignore else */
126
126
  if (isInputObjectType(type)) {
127
127
  return printInputObject(type, options);
128
- } // Not reachable. All possible types have been considered.
128
+ } // istanbul ignore next (Not reachable. All possible types have been considered)
129
129
 
130
130
 
131
- /* istanbul ignore next */
132
- invariant(false, 'Unexpected type: ' + inspect(type));
131
+ false || invariant(0, 'Unexpected type: ' + inspect(type));
133
132
  }
134
133
 
135
134
  function printScalar(type, options) {
136
- return printDescription(options, type) + "scalar ".concat(type.name);
135
+ return printDescription(options, type) + "scalar ".concat(type.name) + printSpecifiedByUrl(type);
137
136
  }
138
137
 
139
138
  function printImplementedInterfaces(type) {
@@ -231,6 +230,17 @@ function printDeprecated(fieldOrEnumVal) {
231
230
  return ' @deprecated';
232
231
  }
233
232
 
233
+ function printSpecifiedByUrl(scalar) {
234
+ if (scalar.specifiedByUrl == null) {
235
+ return '';
236
+ }
237
+
238
+ var url = scalar.specifiedByUrl;
239
+ var urlAST = astFromValue(url, GraphQLString);
240
+ urlAST || invariant(0, 'Unexpected null value returned from `astFromValue` for specifiedByUrl');
241
+ return ' @specifiedBy(url: ' + print(urlAST) + ')';
242
+ }
243
+
234
244
  function printDescription(options, def) {
235
245
  var indentation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
236
246
  var firstInBlock = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
@@ -27,14 +27,13 @@ function typeFromAST(schema, typeNode) {
27
27
  if (typeNode.kind === _kinds.Kind.NON_NULL_TYPE) {
28
28
  innerType = typeFromAST(schema, typeNode.type);
29
29
  return innerType && (0, _definition.GraphQLNonNull)(innerType);
30
- }
30
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
31
+
31
32
 
32
- /* istanbul ignore else */
33
33
  if (typeNode.kind === _kinds.Kind.NAMED_TYPE) {
34
34
  return schema.getType(typeNode.name.value);
35
- } // Not reachable. All possible type nodes have been considered.
35
+ } // istanbul ignore next (Not reachable. All possible type nodes have been considered)
36
36
 
37
37
 
38
- /* istanbul ignore next */
39
- (0, _invariant.default)(false, 'Unexpected type node: ' + (0, _inspect.default)(typeNode));
38
+ false || (0, _invariant.default)(0, 'Unexpected type node: ' + (0, _inspect.default)(typeNode));
40
39
  }
@@ -48,10 +48,11 @@ export function typeFromAST(schema, typeNode) {
48
48
  innerType = typeFromAST(schema, typeNode.type);
49
49
  return innerType && GraphQLNonNull(innerType);
50
50
  }
51
+ // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
51
52
  if (typeNode.kind === Kind.NAMED_TYPE) {
52
53
  return schema.getType(typeNode.name.value);
53
54
  }
54
55
 
55
- // Not reachable. All possible type nodes have been considered.
56
+ // istanbul ignore next (Not reachable. All possible type nodes have been considered)
56
57
  invariant(false, 'Unexpected type node: ' + inspect((typeNode: empty)));
57
58
  }
@@ -24,14 +24,13 @@ export function typeFromAST(schema, typeNode) {
24
24
  if (typeNode.kind === Kind.NON_NULL_TYPE) {
25
25
  innerType = typeFromAST(schema, typeNode.type);
26
26
  return innerType && GraphQLNonNull(innerType);
27
- }
27
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
28
+
28
29
 
29
- /* istanbul ignore else */
30
30
  if (typeNode.kind === Kind.NAMED_TYPE) {
31
31
  return schema.getType(typeNode.name.value);
32
- } // Not reachable. All possible type nodes have been considered.
32
+ } // istanbul ignore next (Not reachable. All possible type nodes have been considered)
33
33
 
34
34
 
35
- /* istanbul ignore next */
36
- invariant(false, 'Unexpected type node: ' + inspect(typeNode));
35
+ false || invariant(0, 'Unexpected type node: ' + inspect(typeNode));
37
36
  }
@@ -1,4 +1,5 @@
1
- import Maybe from '../tsutils/Maybe';
1
+ import { Maybe } from '../jsutils/Maybe';
2
+
2
3
  import { ValueNode } from '../language/ast';
3
4
  import { GraphQLInputType } from '../type/definition';
4
5
 
@@ -153,9 +153,9 @@ function valueFromAST(valueNode, type, variables) {
153
153
  }
154
154
 
155
155
  return coercedObj;
156
- }
156
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
157
+
157
158
 
158
- /* istanbul ignore else */
159
159
  if ((0, _definition.isLeafType)(type)) {
160
160
  // Scalars and Enums fulfill parsing a literal value via parseLiteral().
161
161
  // Invalid values represent a failure to parse correctly, in which case
@@ -173,11 +173,10 @@ function valueFromAST(valueNode, type, variables) {
173
173
  }
174
174
 
175
175
  return result;
176
- } // Not reachable. All possible input types have been considered.
176
+ } // istanbul ignore next (Not reachable. All possible input types have been considered)
177
177
 
178
178
 
179
- /* istanbul ignore next */
180
- (0, _invariant.default)(false, 'Unexpected input type: ' + (0, _inspect.default)(type));
179
+ false || (0, _invariant.default)(0, 'Unexpected input type: ' + (0, _inspect.default)(type));
181
180
  } // Returns true if the provided valueNode is a variable which is not defined
182
181
  // in the set of variables.
183
182
 
@@ -131,6 +131,7 @@ export function valueFromAST(
131
131
  return coercedObj;
132
132
  }
133
133
 
134
+ // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
134
135
  if (isLeafType(type)) {
135
136
  // Scalars and Enums fulfill parsing a literal value via parseLiteral().
136
137
  // Invalid values represent a failure to parse correctly, in which case
@@ -147,7 +148,7 @@ export function valueFromAST(
147
148
  return result;
148
149
  }
149
150
 
150
- // Not reachable. All possible input types have been considered.
151
+ // istanbul ignore next (Not reachable. All possible input types have been considered)
151
152
  invariant(false, 'Unexpected input type: ' + inspect((type: empty)));
152
153
  }
153
154
 
@@ -139,9 +139,9 @@ export function valueFromAST(valueNode, type, variables) {
139
139
  }
140
140
 
141
141
  return coercedObj;
142
- }
142
+ } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618')
143
+
143
144
 
144
- /* istanbul ignore else */
145
145
  if (isLeafType(type)) {
146
146
  // Scalars and Enums fulfill parsing a literal value via parseLiteral().
147
147
  // Invalid values represent a failure to parse correctly, in which case
@@ -159,11 +159,10 @@ export function valueFromAST(valueNode, type, variables) {
159
159
  }
160
160
 
161
161
  return result;
162
- } // Not reachable. All possible input types have been considered.
162
+ } // istanbul ignore next (Not reachable. All possible input types have been considered)
163
163
 
164
164
 
165
- /* istanbul ignore next */
166
- invariant(false, 'Unexpected input type: ' + inspect(type));
165
+ false || invariant(0, 'Unexpected input type: ' + inspect(type));
167
166
  } // Returns true if the provided valueNode is a variable which is not defined
168
167
  // in the set of variables.
169
168
 
@@ -1,4 +1,5 @@
1
- import Maybe from '../tsutils/Maybe';
1
+ import { Maybe } from '../jsutils/Maybe';
2
+
2
3
  import { ValueNode } from '../language/ast';
3
4
 
4
5
  /**
@@ -61,9 +61,8 @@ function valueFromASTUntyped(valueNode, variables) {
61
61
 
62
62
  case _kinds.Kind.VARIABLE:
63
63
  return variables === null || variables === void 0 ? void 0 : variables[valueNode.name.value];
64
- } // Not reachable. All possible value nodes have been considered.
64
+ } // istanbul ignore next (Not reachable. All possible value nodes have been considered)
65
65
 
66
66
 
67
- /* istanbul ignore next */
68
- (0, _invariant.default)(false, 'Unexpected value node: ' + (0, _inspect.default)(valueNode));
67
+ false || (0, _invariant.default)(0, 'Unexpected value node: ' + (0, _inspect.default)(valueNode));
69
68
  }
@@ -53,6 +53,6 @@ export function valueFromASTUntyped(
53
53
  return variables?.[valueNode.name.value];
54
54
  }
55
55
 
56
- // Not reachable. All possible value nodes have been considered.
56
+ // istanbul ignore next (Not reachable. All possible value nodes have been considered)
57
57
  invariant(false, 'Unexpected value node: ' + inspect((valueNode: empty)));
58
58
  }
@@ -49,9 +49,8 @@ export function valueFromASTUntyped(valueNode, variables) {
49
49
 
50
50
  case Kind.VARIABLE:
51
51
  return variables === null || variables === void 0 ? void 0 : variables[valueNode.name.value];
52
- } // Not reachable. All possible value nodes have been considered.
52
+ } // istanbul ignore next (Not reachable. All possible value nodes have been considered)
53
53
 
54
54
 
55
- /* istanbul ignore next */
56
- invariant(false, 'Unexpected value node: ' + inspect(valueNode));
55
+ false || invariant(0, 'Unexpected value node: ' + inspect(valueNode));
57
56
  }
@@ -1,4 +1,5 @@
1
- import Maybe from '../tsutils/Maybe';
1
+ import { Maybe } from '../jsutils/Maybe';
2
+
2
3
  import { GraphQLError } from '../error/GraphQLError';
3
4
  import { ASTVisitor } from '../language/visitor';
4
5
  import {
@@ -21,11 +22,11 @@ import {
21
22
  import { TypeInfo } from '../utilities/TypeInfo';
22
23
 
23
24
  type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode;
24
- type VariableUsage = {
25
+ interface VariableUsage {
25
26
  readonly node: VariableNode;
26
27
  readonly type: Maybe<GraphQLInputType>;
27
28
  readonly defaultValue: Maybe<any>;
28
- };
29
+ }
29
30
 
30
31
  /**
31
32
  * An instance of this class is passed as the "this" context to all validators,
@@ -11,18 +11,6 @@ var _visitor = require("../language/visitor");
11
11
 
12
12
  var _TypeInfo = require("../utilities/TypeInfo");
13
13
 
14
- 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); }
15
-
16
- 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); }; }
17
-
18
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
19
-
20
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
21
-
22
- 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; } }
23
-
24
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
25
-
26
14
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
27
15
 
28
16
  /**
@@ -133,8 +121,6 @@ exports.ASTValidationContext = ASTValidationContext;
133
121
  var SDLValidationContext = /*#__PURE__*/function (_ASTValidationContext) {
134
122
  _inheritsLoose(SDLValidationContext, _ASTValidationContext);
135
123
 
136
- var _super = _createSuper(SDLValidationContext);
137
-
138
124
  function SDLValidationContext(ast, schema, onError) {
139
125
  var _this;
140
126
 
@@ -157,8 +143,6 @@ exports.SDLValidationContext = SDLValidationContext;
157
143
  var ValidationContext = /*#__PURE__*/function (_ASTValidationContext2) {
158
144
  _inheritsLoose(ValidationContext, _ASTValidationContext2);
159
145
 
160
- var _super2 = _createSuper(ValidationContext);
161
-
162
146
  function ValidationContext(schema, ast, typeInfo, onError) {
163
147
  var _this2;
164
148
 
@@ -1,15 +1,3 @@
1
- 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); }
2
-
3
- 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); }; }
4
-
5
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
6
-
7
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
8
-
9
- 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; } }
10
-
11
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
12
-
13
1
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
14
2
 
15
3
  import { Kind } from "../language/kinds.mjs";
@@ -121,8 +109,6 @@ export var ASTValidationContext = /*#__PURE__*/function () {
121
109
  export var SDLValidationContext = /*#__PURE__*/function (_ASTValidationContext) {
122
110
  _inheritsLoose(SDLValidationContext, _ASTValidationContext);
123
111
 
124
- var _super = _createSuper(SDLValidationContext);
125
-
126
112
  function SDLValidationContext(ast, schema, onError) {
127
113
  var _this;
128
114
 
@@ -142,8 +128,6 @@ export var SDLValidationContext = /*#__PURE__*/function (_ASTValidationContext)
142
128
  export var ValidationContext = /*#__PURE__*/function (_ASTValidationContext2) {
143
129
  _inheritsLoose(ValidationContext, _ASTValidationContext2);
144
130
 
145
- var _super2 = _createSuper(ValidationContext);
146
-
147
131
  function ValidationContext(schema, ast, typeInfo, onError) {
148
132
  var _this2;
149
133
 
@@ -31,7 +31,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
31
31
  * that field.
32
32
  */
33
33
  function KnownArgumentNamesRule(context) {
34
- return _objectSpread({}, KnownArgumentNamesOnDirectivesRule(context), {
34
+ return _objectSpread(_objectSpread({}, KnownArgumentNamesOnDirectivesRule(context)), {}, {
35
35
  Argument: function Argument(argNode) {
36
36
  var argDef = context.getArgument();
37
37
  var fieldDef = context.getFieldDef();
@@ -73,7 +73,7 @@ function KnownArgumentNamesOnDirectivesRule(context) {
73
73
  if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) {
74
74
  var _def$arguments;
75
75
 
76
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
76
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
77
77
  var argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : [];
78
78
  directiveArgs[def.name.value] = argsNodes.map(function (arg) {
79
79
  return arg.name.value;
@@ -64,7 +64,7 @@ export function KnownArgumentNamesOnDirectivesRule(
64
64
  const astDefinitions = context.getDocument().definitions;
65
65
  for (const def of astDefinitions) {
66
66
  if (def.kind === Kind.DIRECTIVE_DEFINITION) {
67
- /* istanbul ignore next (See https://github.com/graphql/graphql-js/issues/2203) */
67
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
68
68
  const argsNodes = def.arguments ?? [];
69
69
 
70
70
  directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value);