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
@@ -25,8 +25,7 @@ var arrayFrom = Array.from || function (obj, mapFn, thisArg) {
25
25
  for (var i = 0; !(step = iterator.next()).done; ++i) {
26
26
  result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever.
27
27
  // After a very large number of iterations, produce an error.
28
-
29
- /* istanbul ignore if */
28
+ // istanbul ignore if (Too big to actually test)
30
29
 
31
30
  if (i > 9999999) {
32
31
  throw new TypeError('Near-infinite iteration.');
@@ -32,7 +32,7 @@ const arrayFrom =
32
32
  result.push(mapFn.call(thisArg, step.value, i));
33
33
  // Infinite Iterators could cause forEach to run forever.
34
34
  // After a very large number of iterations, produce an error.
35
- /* istanbul ignore if */
35
+ // istanbul ignore if (Too big to actually test)
36
36
  if (i > 9999999) {
37
37
  throw new TypeError('Near-infinite iteration.');
38
38
  }
@@ -18,8 +18,7 @@ var arrayFrom = Array.from || function (obj, mapFn, thisArg) {
18
18
  for (var i = 0; !(step = iterator.next()).done; ++i) {
19
19
  result.push(mapFn.call(thisArg, step.value, i)); // Infinite Iterators could cause forEach to run forever.
20
20
  // After a very large number of iterations, produce an error.
21
-
22
- /* istanbul ignore if */
21
+ // istanbul ignore if (Too big to actually test)
23
22
 
24
23
  if (i > 9999999) {
25
24
  throw new TypeError('Near-infinite iteration.');
@@ -5,16 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SYMBOL_TO_STRING_TAG = exports.SYMBOL_ASYNC_ITERATOR = exports.SYMBOL_ITERATOR = void 0;
7
7
  // In ES2015 (or a polyfilled) environment, this will be Symbol.iterator
8
-
9
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
8
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
10
9
  var SYMBOL_ITERATOR = typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator
11
-
12
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
10
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
13
11
 
14
12
  exports.SYMBOL_ITERATOR = SYMBOL_ITERATOR;
15
13
  var SYMBOL_ASYNC_ITERATOR = // $FlowFixMe Flow doesn't define `Symbol.asyncIterator` yet
16
- typeof Symbol === 'function' ? Symbol.asyncIterator : '@@asyncIterator';
17
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
14
+ typeof Symbol === 'function' ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
18
15
 
19
16
  exports.SYMBOL_ASYNC_ITERATOR = SYMBOL_ASYNC_ITERATOR;
20
17
  var SYMBOL_TO_STRING_TAG = // $FlowFixMe Flow doesn't define `Symbol.toStringTag` yet
@@ -1,17 +1,17 @@
1
1
  // @flow strict
2
2
 
3
3
  // In ES2015 (or a polyfilled) environment, this will be Symbol.iterator
4
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
4
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
5
5
  export const SYMBOL_ITERATOR: string =
6
6
  typeof Symbol === 'function' ? Symbol.iterator : '@@iterator';
7
7
 
8
8
  // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator
9
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
9
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
10
10
  export const SYMBOL_ASYNC_ITERATOR: string =
11
11
  // $FlowFixMe Flow doesn't define `Symbol.asyncIterator` yet
12
12
  typeof Symbol === 'function' ? Symbol.asyncIterator : '@@asyncIterator';
13
13
 
14
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
14
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
15
15
  export const SYMBOL_TO_STRING_TAG: string =
16
16
  // $FlowFixMe Flow doesn't define `Symbol.toStringTag` yet
17
17
  typeof Symbol === 'function' ? Symbol.toStringTag : '@@toStringTag';
@@ -1,13 +1,10 @@
1
1
  // In ES2015 (or a polyfilled) environment, this will be Symbol.iterator
2
-
3
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
2
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
4
3
  export var SYMBOL_ITERATOR = typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator
5
-
6
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
4
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
7
5
 
8
6
  export var SYMBOL_ASYNC_ITERATOR = // $FlowFixMe Flow doesn't define `Symbol.asyncIterator` yet
9
- typeof Symbol === 'function' ? Symbol.asyncIterator : '@@asyncIterator';
10
- /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
7
+ typeof Symbol === 'function' ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')
11
8
 
12
9
  export var SYMBOL_TO_STRING_TAG = // $FlowFixMe Flow doesn't define `Symbol.toStringTag` yet
13
10
  typeof Symbol === 'function' ? Symbol.toStringTag : '@@toStringTag';
@@ -1,4 +1,5 @@
1
- import Maybe from '../tsutils/Maybe';
1
+ import { Maybe } from '../jsutils/Maybe';
2
+
2
3
  import { DocumentNode } from '../language/ast';
3
4
  import { ExecutionResult } from '../execution/execute';
4
5
  import { GraphQLSchema } from '../type/schema';
@@ -1,7 +1,8 @@
1
1
  // FIXME
2
2
  /* eslint-disable import/no-cycle */
3
3
 
4
- import Maybe from '../tsutils/Maybe';
4
+ import { Maybe } from '../jsutils/Maybe';
5
+
5
6
  import { PromiseOrValue } from '../jsutils/PromiseOrValue';
6
7
  import { Path } from '../jsutils/Path';
7
8
 
@@ -172,9 +173,9 @@ export function assertAbstractType(type: any): GraphQLAbstractType;
172
173
  */
173
174
  interface GraphQLList<T extends GraphQLType> {
174
175
  readonly ofType: T;
175
- toString(): string;
176
- toJSON(): string;
177
- inspect(): string;
176
+ toString: () => string;
177
+ toJSON: () => string;
178
+ inspect: () => string;
178
179
  }
179
180
 
180
181
  interface _GraphQLList<T extends GraphQLType> {
@@ -206,9 +207,9 @@ export const GraphQLList: _GraphQLList<GraphQLType>;
206
207
  */
207
208
  interface GraphQLNonNull<T extends GraphQLNullableType> {
208
209
  readonly ofType: T;
209
- toString(): string;
210
- toJSON(): string;
211
- inspect(): string;
210
+ toString: () => string;
211
+ toJSON: () => string;
212
+ inspect: () => string;
212
213
  }
213
214
 
214
215
  interface _GraphQLNonNull<T extends GraphQLNullableType> {
@@ -240,12 +241,15 @@ export function isNullableType(type: any): type is GraphQLNullableType;
240
241
 
241
242
  export function assertNullableType(type: any): GraphQLNullableType;
242
243
 
243
- export function getNullableType(type: void): undefined;
244
+ // FIXME Disabled because of https://github.com/yaacovCR/graphql-tools-fork/issues/40#issuecomment-586671219
245
+ // tslint:disable:unified-signatures
246
+ export function getNullableType(type: undefined): undefined;
244
247
  export function getNullableType<T extends GraphQLNullableType>(type: T): T;
245
248
  export function getNullableType<T extends GraphQLNullableType>(
246
249
  // eslint-disable-next-line @typescript-eslint/unified-signatures
247
250
  type: GraphQLNonNull<T>,
248
251
  ): T;
252
+ // tslint:enable:unified-signatures
249
253
 
250
254
  /**
251
255
  * These named types do not include modifiers like List or NonNull.
@@ -262,7 +266,7 @@ export function isNamedType(type: any): type is GraphQLNamedType;
262
266
 
263
267
  export function assertNamedType(type: any): GraphQLNamedType;
264
268
 
265
- export function getNamedType(type: void): undefined;
269
+ export function getNamedType(type: undefined): undefined;
266
270
  export function getNamedType(type: GraphQLType): GraphQLNamedType;
267
271
 
268
272
  /**
@@ -291,6 +295,7 @@ export type Thunk<T> = (() => T) | T;
291
295
  export class GraphQLScalarType {
292
296
  name: string;
293
297
  description: Maybe<string>;
298
+ specifiedByUrl: Maybe<string>;
294
299
  serialize: GraphQLScalarSerializer<any>;
295
300
  parseValue: GraphQLScalarValueParser<any>;
296
301
  parseLiteral: GraphQLScalarLiteralParser<any>;
@@ -301,6 +306,7 @@ export class GraphQLScalarType {
301
306
  constructor(config: Readonly<GraphQLScalarTypeConfig<any, any>>);
302
307
 
303
308
  toConfig(): GraphQLScalarTypeConfig<any, any> & {
309
+ specifiedByUrl: Maybe<string>;
304
310
  serialize: GraphQLScalarSerializer<any>;
305
311
  parseValue: GraphQLScalarValueParser<any>;
306
312
  parseLiteral: GraphQLScalarLiteralParser<any>;
@@ -327,8 +333,9 @@ export type GraphQLScalarLiteralParser<TInternal> = (
327
333
  export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
328
334
  name: string;
329
335
  description?: Maybe<string>;
336
+ specifiedByUrl?: Maybe<string>;
330
337
  // Serializes an internal value to include in a response.
331
- serialize: GraphQLScalarSerializer<TExternal>;
338
+ serialize?: GraphQLScalarSerializer<TExternal>;
332
339
  // Parses an externally provided value to use as an input.
333
340
  parseValue?: GraphQLScalarValueParser<TInternal>;
334
341
  // Parses an externally provided literal value to use as an input.
@@ -467,9 +474,9 @@ export interface GraphQLFieldConfig<
467
474
  astNode?: Maybe<FieldDefinitionNode>;
468
475
  }
469
476
 
470
- export type GraphQLFieldConfigArgumentMap = {
477
+ export interface GraphQLFieldConfigArgumentMap {
471
478
  [key: string]: GraphQLArgumentConfig;
472
- };
479
+ }
473
480
 
474
481
  export interface GraphQLArgumentConfig {
475
482
  description?: Maybe<string>;
@@ -479,9 +486,9 @@ export interface GraphQLArgumentConfig {
479
486
  astNode?: Maybe<InputValueDefinitionNode>;
480
487
  }
481
488
 
482
- export type GraphQLFieldConfigMap<TSource, TContext> = {
489
+ export interface GraphQLFieldConfigMap<TSource, TContext> {
483
490
  [key: string]: GraphQLFieldConfig<TSource, TContext>;
484
- };
491
+ }
485
492
 
486
493
  export interface GraphQLField<
487
494
  TSource,
@@ -511,9 +518,9 @@ export interface GraphQLArgument {
511
518
 
512
519
  export function isRequiredArgument(arg: GraphQLArgument): boolean;
513
520
 
514
- export type GraphQLFieldMap<TSource, TContext> = {
521
+ export interface GraphQLFieldMap<TSource, TContext> {
515
522
  [key: string]: GraphQLField<TSource, TContext>;
516
- };
523
+ }
517
524
 
518
525
  /**
519
526
  * Interface Type Definition
@@ -690,9 +697,9 @@ export interface GraphQLEnumTypeConfig {
690
697
  extensionASTNodes?: Maybe<ReadonlyArray<EnumTypeExtensionNode>>;
691
698
  }
692
699
 
693
- export type GraphQLEnumValueConfigMap = {
700
+ export interface GraphQLEnumValueConfigMap {
694
701
  [key: string]: GraphQLEnumValueConfig;
695
- };
702
+ }
696
703
 
697
704
  export interface GraphQLEnumValueConfig {
698
705
  description?: Maybe<string>;
@@ -770,9 +777,9 @@ export interface GraphQLInputFieldConfig {
770
777
  astNode?: Maybe<InputValueDefinitionNode>;
771
778
  }
772
779
 
773
- export type GraphQLInputFieldConfigMap = {
780
+ export interface GraphQLInputFieldConfigMap {
774
781
  [key: string]: GraphQLInputFieldConfig;
775
- };
782
+ }
776
783
 
777
784
  export interface GraphQLInputField {
778
785
  name: string;
@@ -785,4 +792,6 @@ export interface GraphQLInputField {
785
792
 
786
793
  export function isRequiredInputField(field: GraphQLInputField): boolean;
787
794
 
788
- export type GraphQLInputFieldMap = { [key: string]: GraphQLInputField };
795
+ export interface GraphQLInputFieldMap {
796
+ [key: string]: GraphQLInputField;
797
+ }
@@ -70,7 +70,7 @@ var _isObjectLike = _interopRequireDefault(require("../jsutils/isObjectLike"));
70
70
 
71
71
  var _identityFunc = _interopRequireDefault(require("../jsutils/identityFunc"));
72
72
 
73
- var _defineToJSON = _interopRequireDefault(require("../jsutils/defineToJSON"));
73
+ var _defineInspect = _interopRequireDefault(require("../jsutils/defineInspect"));
74
74
 
75
75
  var _suggestionList = _interopRequireDefault(require("../jsutils/suggestionList"));
76
76
 
@@ -330,12 +330,17 @@ GraphQLList.prototype.toString = function toString() {
330
330
  return '[' + String(this.ofType) + ']';
331
331
  };
332
332
 
333
+ GraphQLList.prototype.toJSON = function toJSON() {
334
+ return this.toString();
335
+ };
336
+
333
337
  Object.defineProperty(GraphQLList.prototype, _symbols.SYMBOL_TO_STRING_TAG, {
334
338
  get: function get() {
335
339
  return 'GraphQLList';
336
340
  }
337
- });
338
- (0, _defineToJSON.default)(GraphQLList);
341
+ }); // Print a simplified form when appearing in `inspect` and `util.inspect`.
342
+
343
+ (0, _defineInspect.default)(GraphQLList);
339
344
  /**
340
345
  * Non-Null Type Wrapper
341
346
  *
@@ -380,12 +385,17 @@ GraphQLNonNull.prototype.toString = function toString() {
380
385
  return String(this.ofType) + '!';
381
386
  };
382
387
 
388
+ GraphQLNonNull.prototype.toJSON = function toJSON() {
389
+ return this.toString();
390
+ };
391
+
383
392
  Object.defineProperty(GraphQLNonNull.prototype, _symbols.SYMBOL_TO_STRING_TAG, {
384
393
  get: function get() {
385
394
  return 'GraphQLNonNull';
386
395
  }
387
- });
388
- (0, _defineToJSON.default)(GraphQLNonNull);
396
+ }); // Print a simplified form when appearing in `inspect` and `util.inspect`.
397
+
398
+ (0, _defineInspect.default)(GraphQLNonNull);
389
399
  /**
390
400
  * These types wrap and modify other types
391
401
  */
@@ -504,6 +514,7 @@ var GraphQLScalarType = /*#__PURE__*/function () {
504
514
  var parseValue = (_config$parseValue = config.parseValue) !== null && _config$parseValue !== void 0 ? _config$parseValue : _identityFunc.default;
505
515
  this.name = config.name;
506
516
  this.description = config.description;
517
+ this.specifiedByUrl = config.specifiedByUrl;
507
518
  this.serialize = (_config$serialize = config.serialize) !== null && _config$serialize !== void 0 ? _config$serialize : _identityFunc.default;
508
519
  this.parseValue = parseValue;
509
520
  this.parseLiteral = (_config$parseLiteral = config.parseLiteral) !== null && _config$parseLiteral !== void 0 ? _config$parseLiteral : function (node) {
@@ -513,6 +524,7 @@ var GraphQLScalarType = /*#__PURE__*/function () {
513
524
  this.astNode = config.astNode;
514
525
  this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
515
526
  typeof config.name === 'string' || (0, _devAssert.default)(0, 'Must provide name.');
527
+ config.specifiedByUrl == null || typeof config.specifiedByUrl === 'string' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"specifiedByUrl\" as a string, ") + "but got: ".concat((0, _inspect.default)(config.specifiedByUrl), "."));
516
528
  config.serialize == null || typeof config.serialize === 'function' || (0, _devAssert.default)(0, "".concat(this.name, " must provide \"serialize\" function. If this custom Scalar is also used as an input type, ensure \"parseValue\" and \"parseLiteral\" functions are also provided."));
517
529
 
518
530
  if (config.parseLiteral) {
@@ -528,6 +540,7 @@ var GraphQLScalarType = /*#__PURE__*/function () {
528
540
  return {
529
541
  name: this.name,
530
542
  description: this.description,
543
+ specifiedByUrl: this.specifiedByUrl,
531
544
  serialize: this.serialize,
532
545
  parseValue: this.parseValue,
533
546
  parseLiteral: this.parseLiteral,
@@ -539,6 +552,10 @@ var GraphQLScalarType = /*#__PURE__*/function () {
539
552
 
540
553
  _proto.toString = function toString() {
541
554
  return this.name;
555
+ };
556
+
557
+ _proto.toJSON = function toJSON() {
558
+ return this.toString();
542
559
  } // $FlowFixMe Flow doesn't support computed properties yet
543
560
  ;
544
561
 
@@ -550,10 +567,11 @@ var GraphQLScalarType = /*#__PURE__*/function () {
550
567
  }]);
551
568
 
552
569
  return GraphQLScalarType;
553
- }();
570
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
571
+
554
572
 
555
573
  exports.GraphQLScalarType = GraphQLScalarType;
556
- (0, _defineToJSON.default)(GraphQLScalarType);
574
+ (0, _defineInspect.default)(GraphQLScalarType);
557
575
 
558
576
  /**
559
577
  * Object Type Definition
@@ -639,6 +657,10 @@ var GraphQLObjectType = /*#__PURE__*/function () {
639
657
 
640
658
  _proto2.toString = function toString() {
641
659
  return this.name;
660
+ };
661
+
662
+ _proto2.toJSON = function toJSON() {
663
+ return this.toString();
642
664
  } // $FlowFixMe Flow doesn't support computed properties yet
643
665
  ;
644
666
 
@@ -650,10 +672,11 @@ var GraphQLObjectType = /*#__PURE__*/function () {
650
672
  }]);
651
673
 
652
674
  return GraphQLObjectType;
653
- }();
675
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
676
+
654
677
 
655
678
  exports.GraphQLObjectType = GraphQLObjectType;
656
- (0, _defineToJSON.default)(GraphQLObjectType);
679
+ (0, _defineInspect.default)(GraphQLObjectType);
657
680
 
658
681
  function defineInterfaces(config) {
659
682
  var _resolveThunk;
@@ -809,6 +832,10 @@ var GraphQLInterfaceType = /*#__PURE__*/function () {
809
832
 
810
833
  _proto3.toString = function toString() {
811
834
  return this.name;
835
+ };
836
+
837
+ _proto3.toJSON = function toJSON() {
838
+ return this.toString();
812
839
  } // $FlowFixMe Flow doesn't support computed properties yet
813
840
  ;
814
841
 
@@ -820,10 +847,11 @@ var GraphQLInterfaceType = /*#__PURE__*/function () {
820
847
  }]);
821
848
 
822
849
  return GraphQLInterfaceType;
823
- }();
850
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
851
+
824
852
 
825
853
  exports.GraphQLInterfaceType = GraphQLInterfaceType;
826
- (0, _defineToJSON.default)(GraphQLInterfaceType);
854
+ (0, _defineInspect.default)(GraphQLInterfaceType);
827
855
 
828
856
  /**
829
857
  * Union Type Definition
@@ -887,6 +915,10 @@ var GraphQLUnionType = /*#__PURE__*/function () {
887
915
 
888
916
  _proto4.toString = function toString() {
889
917
  return this.name;
918
+ };
919
+
920
+ _proto4.toJSON = function toJSON() {
921
+ return this.toString();
890
922
  } // $FlowFixMe Flow doesn't support computed properties yet
891
923
  ;
892
924
 
@@ -898,10 +930,11 @@ var GraphQLUnionType = /*#__PURE__*/function () {
898
930
  }]);
899
931
 
900
932
  return GraphQLUnionType;
901
- }();
933
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
934
+
902
935
 
903
936
  exports.GraphQLUnionType = GraphQLUnionType;
904
- (0, _defineToJSON.default)(GraphQLUnionType);
937
+ (0, _defineInspect.default)(GraphQLUnionType);
905
938
 
906
939
  function defineTypes(config) {
907
940
  var types = resolveThunk(config.types);
@@ -1032,6 +1065,10 @@ var GraphQLEnumType
1032
1065
 
1033
1066
  _proto5.toString = function toString() {
1034
1067
  return this.name;
1068
+ };
1069
+
1070
+ _proto5.toJSON = function toJSON() {
1071
+ return this.toString();
1035
1072
  } // $FlowFixMe Flow doesn't support computed properties yet
1036
1073
  ;
1037
1074
 
@@ -1043,10 +1080,11 @@ var GraphQLEnumType
1043
1080
  }]);
1044
1081
 
1045
1082
  return GraphQLEnumType;
1046
- }();
1083
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
1084
+
1047
1085
 
1048
1086
  exports.GraphQLEnumType = GraphQLEnumType;
1049
- (0, _defineToJSON.default)(GraphQLEnumType);
1087
+ (0, _defineInspect.default)(GraphQLEnumType);
1050
1088
 
1051
1089
  function didYouMeanEnumValue(enumType, unknownValueStr) {
1052
1090
  var allNames = enumType.getValues().map(function (value) {
@@ -1140,6 +1178,10 @@ var GraphQLInputObjectType = /*#__PURE__*/function () {
1140
1178
 
1141
1179
  _proto6.toString = function toString() {
1142
1180
  return this.name;
1181
+ };
1182
+
1183
+ _proto6.toJSON = function toJSON() {
1184
+ return this.toString();
1143
1185
  } // $FlowFixMe Flow doesn't support computed properties yet
1144
1186
  ;
1145
1187
 
@@ -1151,10 +1193,11 @@ var GraphQLInputObjectType = /*#__PURE__*/function () {
1151
1193
  }]);
1152
1194
 
1153
1195
  return GraphQLInputObjectType;
1154
- }();
1196
+ }(); // Print a simplified form when appearing in `inspect` and `util.inspect`.
1197
+
1155
1198
 
1156
1199
  exports.GraphQLInputObjectType = GraphQLInputObjectType;
1157
- (0, _defineToJSON.default)(GraphQLInputObjectType);
1200
+ (0, _defineInspect.default)(GraphQLInputObjectType);
1158
1201
 
1159
1202
  function defineInputFieldMap(config) {
1160
1203
  var fieldMap = resolveThunk(config.fields);
@@ -17,7 +17,7 @@ import instanceOf from '../jsutils/instanceOf';
17
17
  import didYouMean from '../jsutils/didYouMean';
18
18
  import isObjectLike from '../jsutils/isObjectLike';
19
19
  import identityFunc from '../jsutils/identityFunc';
20
- import defineToJSON from '../jsutils/defineToJSON';
20
+ import defineInspect from '../jsutils/defineInspect';
21
21
  import suggestionList from '../jsutils/suggestionList';
22
22
  import { type PromiseOrValue } from '../jsutils/PromiseOrValue';
23
23
  import {
@@ -373,13 +373,18 @@ export function GraphQLList(ofType) {
373
373
  return '[' + String(this.ofType) + ']';
374
374
  };
375
375
 
376
+ (GraphQLList.prototype: any).toJSON = function toJSON() {
377
+ return this.toString();
378
+ };
379
+
376
380
  Object.defineProperty(GraphQLList.prototype, SYMBOL_TO_STRING_TAG, {
377
381
  get() {
378
382
  return 'GraphQLList';
379
383
  },
380
384
  });
381
385
 
382
- defineToJSON(GraphQLList);
386
+ // Print a simplified form when appearing in `inspect` and `util.inspect`.
387
+ defineInspect(GraphQLList);
383
388
 
384
389
  /**
385
390
  * Non-Null Type Wrapper
@@ -424,13 +429,18 @@ export function GraphQLNonNull(ofType) {
424
429
  return String(this.ofType) + '!';
425
430
  };
426
431
 
432
+ (GraphQLNonNull.prototype: any).toJSON = function toJSON() {
433
+ return this.toString();
434
+ };
435
+
427
436
  Object.defineProperty(GraphQLNonNull.prototype, SYMBOL_TO_STRING_TAG, {
428
437
  get() {
429
438
  return 'GraphQLNonNull';
430
439
  },
431
440
  });
432
441
 
433
- defineToJSON(GraphQLNonNull);
442
+ // Print a simplified form when appearing in `inspect` and `util.inspect`.
443
+ defineInspect(GraphQLNonNull);
434
444
 
435
445
  /**
436
446
  * These types wrap and modify other types
@@ -568,6 +578,7 @@ function undefineIfEmpty<T>(arr: ?$ReadOnlyArray<T>): ?$ReadOnlyArray<T> {
568
578
  export class GraphQLScalarType {
569
579
  name: string;
570
580
  description: ?string;
581
+ specifiedByUrl: ?string;
571
582
  serialize: GraphQLScalarSerializer<mixed>;
572
583
  parseValue: GraphQLScalarValueParser<mixed>;
573
584
  parseLiteral: GraphQLScalarLiteralParser<mixed>;
@@ -579,6 +590,7 @@ export class GraphQLScalarType {
579
590
  const parseValue = config.parseValue ?? identityFunc;
580
591
  this.name = config.name;
581
592
  this.description = config.description;
593
+ this.specifiedByUrl = config.specifiedByUrl;
582
594
  this.serialize = config.serialize ?? identityFunc;
583
595
  this.parseValue = parseValue;
584
596
  this.parseLiteral =
@@ -588,6 +600,14 @@ export class GraphQLScalarType {
588
600
  this.extensionASTNodes = undefineIfEmpty(config.extensionASTNodes);
589
601
 
590
602
  devAssert(typeof config.name === 'string', 'Must provide name.');
603
+
604
+ devAssert(
605
+ config.specifiedByUrl == null ||
606
+ typeof config.specifiedByUrl === 'string',
607
+ `${this.name} must provide "specifiedByUrl" as a string, ` +
608
+ `but got: ${inspect(config.specifiedByUrl)}.`,
609
+ );
610
+
591
611
  devAssert(
592
612
  config.serialize == null || typeof config.serialize === 'function',
593
613
  `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`,
@@ -613,6 +633,7 @@ export class GraphQLScalarType {
613
633
  return {
614
634
  name: this.name,
615
635
  description: this.description,
636
+ specifiedByUrl: this.specifiedByUrl,
616
637
  serialize: this.serialize,
617
638
  parseValue: this.parseValue,
618
639
  parseLiteral: this.parseLiteral,
@@ -626,13 +647,18 @@ export class GraphQLScalarType {
626
647
  return this.name;
627
648
  }
628
649
 
650
+ toJSON(): string {
651
+ return this.toString();
652
+ }
653
+
629
654
  // $FlowFixMe Flow doesn't support computed properties yet
630
655
  get [SYMBOL_TO_STRING_TAG]() {
631
656
  return 'GraphQLScalarType';
632
657
  }
633
658
  }
634
659
 
635
- defineToJSON(GraphQLScalarType);
660
+ // Print a simplified form when appearing in `inspect` and `util.inspect`.
661
+ defineInspect(GraphQLScalarType);
636
662
 
637
663
  export type GraphQLScalarSerializer<TExternal> = (
638
664
  outputValue: mixed,
@@ -650,6 +676,7 @@ export type GraphQLScalarLiteralParser<TInternal> = (
650
676
  export type GraphQLScalarTypeConfig<TInternal, TExternal> = {|
651
677
  name: string,
652
678
  description?: ?string,
679
+ specifiedByUrl?: ?string,
653
680
  // Serializes an internal value to include in a response.
654
681
  serialize?: GraphQLScalarSerializer<TExternal>,
655
682
  // Parses an externally provided value to use as an input.
@@ -764,13 +791,18 @@ export class GraphQLObjectType {
764
791
  return this.name;
765
792
  }
766
793
 
794
+ toJSON(): string {
795
+ return this.toString();
796
+ }
797
+
767
798
  // $FlowFixMe Flow doesn't support computed properties yet
768
799
  get [SYMBOL_TO_STRING_TAG]() {
769
800
  return 'GraphQLObjectType';
770
801
  }
771
802
  }
772
803
 
773
- defineToJSON(GraphQLObjectType);
804
+ // Print a simplified form when appearing in `inspect` and `util.inspect`.
805
+ defineInspect(GraphQLObjectType);
774
806
 
775
807
  function defineInterfaces(
776
808
  config: $ReadOnly<
@@ -1074,13 +1106,18 @@ export class GraphQLInterfaceType {
1074
1106
  return this.name;
1075
1107
  }
1076
1108
 
1109
+ toJSON(): string {
1110
+ return this.toString();
1111
+ }
1112
+
1077
1113
  // $FlowFixMe Flow doesn't support computed properties yet
1078
1114
  get [SYMBOL_TO_STRING_TAG]() {
1079
1115
  return 'GraphQLInterfaceType';
1080
1116
  }
1081
1117
  }
1082
1118
 
1083
- defineToJSON(GraphQLInterfaceType);
1119
+ // Print a simplified form when appearing in `inspect` and `util.inspect`.
1120
+ defineInspect(GraphQLInterfaceType);
1084
1121
 
1085
1122
  export type GraphQLInterfaceTypeConfig<TSource, TContext> = {|
1086
1123
  name: string,
@@ -1176,13 +1213,18 @@ export class GraphQLUnionType {
1176
1213
  return this.name;
1177
1214
  }
1178
1215
 
1216
+ toJSON(): string {
1217
+ return this.toString();
1218
+ }
1219
+
1179
1220
  // $FlowFixMe Flow doesn't support computed properties yet
1180
1221
  get [SYMBOL_TO_STRING_TAG]() {
1181
1222
  return 'GraphQLUnionType';
1182
1223
  }
1183
1224
  }
1184
1225
 
1185
- defineToJSON(GraphQLUnionType);
1226
+ // Print a simplified form when appearing in `inspect` and `util.inspect`.
1227
+ defineInspect(GraphQLUnionType);
1186
1228
 
1187
1229
  function defineTypes(
1188
1230
  config: $ReadOnly<GraphQLUnionTypeConfig<mixed, mixed>>,
@@ -1349,13 +1391,18 @@ export class GraphQLEnumType /* <T> */ {
1349
1391
  return this.name;
1350
1392
  }
1351
1393
 
1394
+ toJSON(): string {
1395
+ return this.toString();
1396
+ }
1397
+
1352
1398
  // $FlowFixMe Flow doesn't support computed properties yet
1353
1399
  get [SYMBOL_TO_STRING_TAG]() {
1354
1400
  return 'GraphQLEnumType';
1355
1401
  }
1356
1402
  }
1357
1403
 
1358
- defineToJSON(GraphQLEnumType);
1404
+ // Print a simplified form when appearing in `inspect` and `util.inspect`.
1405
+ defineInspect(GraphQLEnumType);
1359
1406
 
1360
1407
  function didYouMeanEnumValue(
1361
1408
  enumType: GraphQLEnumType,
@@ -1501,13 +1548,18 @@ export class GraphQLInputObjectType {
1501
1548
  return this.name;
1502
1549
  }
1503
1550
 
1551
+ toJSON(): string {
1552
+ return this.toString();
1553
+ }
1554
+
1504
1555
  // $FlowFixMe Flow doesn't support computed properties yet
1505
1556
  get [SYMBOL_TO_STRING_TAG]() {
1506
1557
  return 'GraphQLInputObjectType';
1507
1558
  }
1508
1559
  }
1509
1560
 
1510
- defineToJSON(GraphQLInputObjectType);
1561
+ // Print a simplified form when appearing in `inspect` and `util.inspect`.
1562
+ defineInspect(GraphQLInputObjectType);
1511
1563
 
1512
1564
  function defineInputFieldMap(
1513
1565
  config: $ReadOnly<GraphQLInputObjectTypeConfig>,