graphql 16.0.0 → 16.2.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.
- package/README.md +4 -4
- package/error/GraphQLError.js +4 -1
- package/error/GraphQLError.mjs +4 -1
- package/error/locatedError.js +2 -8
- package/error/locatedError.mjs +2 -6
- package/execution/collectFields.d.ts +6 -6
- package/execution/collectFields.js +6 -6
- package/execution/collectFields.mjs +6 -6
- package/execution/execute.js +16 -5
- package/execution/execute.mjs +16 -5
- package/execution/mapAsyncIterator.js +3 -1
- package/execution/mapAsyncIterator.mjs +3 -1
- package/execution/subscribe.js +8 -0
- package/execution/subscribe.mjs +7 -0
- package/execution/values.js +3 -2
- package/execution/values.mjs +3 -2
- package/graphql.js +8 -0
- package/graphql.mjs +7 -0
- package/index.d.ts +5 -0
- package/index.js +24 -0
- package/index.mjs +5 -0
- package/jsutils/devAssert.js +1 -1
- package/jsutils/devAssert.mjs +1 -1
- package/jsutils/instanceOf.js +3 -1
- package/jsutils/instanceOf.mjs +3 -1
- package/jsutils/invariant.js +1 -1
- package/jsutils/invariant.mjs +1 -1
- package/jsutils/mapValue.js +2 -2
- package/jsutils/mapValue.mjs +2 -2
- package/jsutils/toError.d.ts +4 -0
- package/jsutils/toError.js +25 -0
- package/jsutils/toError.mjs +18 -0
- package/language/blockString.d.ts +7 -3
- package/language/blockString.js +121 -64
- package/language/blockString.mjs +111 -62
- package/language/characterClasses.d.ts +9 -0
- package/language/characterClasses.js +13 -0
- package/language/characterClasses.mjs +12 -0
- package/language/lexer.js +20 -9
- package/language/lexer.mjs +21 -10
- package/language/parser.js +3 -2
- package/language/parser.mjs +3 -2
- package/language/printer.js +3 -1
- package/language/printer.mjs +3 -1
- package/language/visitor.js +2 -1
- package/language/visitor.mjs +2 -1
- package/package.json +4 -1
- package/type/definition.d.ts +4 -0
- package/type/definition.js +2 -0
- package/type/definition.mjs +2 -3
- package/type/directives.d.ts +1 -1
- package/type/directives.js +3 -3
- package/type/directives.mjs +3 -3
- package/type/index.d.ts +5 -0
- package/type/index.js +24 -0
- package/type/index.mjs +5 -0
- package/type/introspection.js +8 -4
- package/type/introspection.mjs +8 -4
- package/type/scalars.d.ts +10 -0
- package/type/scalars.js +18 -10
- package/type/scalars.mjs +16 -11
- package/type/schema.d.ts +1 -1
- package/type/schema.js +5 -3
- package/type/schema.mjs +4 -3
- package/type/validate.js +35 -26
- package/type/validate.mjs +35 -26
- package/utilities/TypeInfo.js +4 -0
- package/utilities/TypeInfo.mjs +4 -0
- package/utilities/assertValidName.js +3 -2
- package/utilities/assertValidName.mjs +3 -2
- package/utilities/astFromValue.js +4 -2
- package/utilities/astFromValue.mjs +4 -2
- package/utilities/buildClientSchema.js +2 -0
- package/utilities/buildClientSchema.mjs +2 -0
- package/utilities/coerceInputValue.js +4 -2
- package/utilities/coerceInputValue.mjs +4 -2
- package/utilities/extendSchema.js +40 -32
- package/utilities/extendSchema.mjs +40 -29
- package/utilities/findBreakingChanges.js +4 -2
- package/utilities/findBreakingChanges.mjs +4 -2
- package/utilities/lexicographicSortSchema.js +6 -5
- package/utilities/lexicographicSortSchema.mjs +6 -5
- package/utilities/printSchema.js +9 -7
- package/utilities/printSchema.mjs +10 -5
- package/utilities/separateOperations.js +2 -0
- package/utilities/separateOperations.mjs +2 -0
- package/utilities/stripIgnoredCharacters.js +3 -19
- package/utilities/stripIgnoredCharacters.mjs +4 -23
- package/utilities/typeFromAST.js +13 -24
- package/utilities/typeFromAST.mjs +12 -17
- package/utilities/valueFromAST.js +4 -2
- package/utilities/valueFromAST.mjs +4 -2
- package/utilities/valueFromASTUntyped.js +1 -11
- package/utilities/valueFromASTUntyped.mjs +1 -5
- package/validation/rules/KnownArgumentNamesRule.js +3 -1
- package/validation/rules/KnownArgumentNamesRule.mjs +3 -1
- package/validation/rules/KnownDirectivesRule.js +11 -7
- package/validation/rules/KnownDirectivesRule.mjs +7 -3
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +4 -3
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +4 -3
- package/validation/rules/PossibleTypeExtensionsRule.js +14 -8
- package/validation/rules/PossibleTypeExtensionsRule.mjs +10 -4
- package/validation/rules/ProvidedRequiredArgumentsRule.js +8 -3
- package/validation/rules/ProvidedRequiredArgumentsRule.mjs +8 -3
- package/validation/rules/UniqueArgumentDefinitionNamesRule.js +9 -3
- package/validation/rules/UniqueArgumentDefinitionNamesRule.mjs +9 -3
- package/validation/rules/UniqueArgumentNamesRule.js +3 -1
- package/validation/rules/UniqueArgumentNamesRule.mjs +3 -1
- package/validation/rules/UniqueEnumValueNamesRule.js +3 -1
- package/validation/rules/UniqueEnumValueNamesRule.mjs +3 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.js +3 -1
- package/validation/rules/UniqueFieldDefinitionNamesRule.mjs +3 -1
- package/validation/rules/UniqueOperationTypesRule.js +3 -1
- package/validation/rules/UniqueOperationTypesRule.mjs +3 -1
- package/validation/rules/UniqueVariableNamesRule.js +3 -1
- package/validation/rules/UniqueVariableNamesRule.mjs +3 -1
- package/version.js +2 -2
- package/version.mjs +2 -2
package/type/validate.js
CHANGED
|
@@ -136,19 +136,24 @@ function validateRootTypes(context) {
|
|
|
136
136
|
function getOperationTypeNode(schema, operation) {
|
|
137
137
|
var _flatMap$find;
|
|
138
138
|
|
|
139
|
-
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
140
139
|
return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes]
|
|
141
|
-
.flatMap(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
140
|
+
.flatMap(
|
|
141
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
142
|
+
(schemaNode) => {
|
|
143
|
+
var _schemaNode$operation;
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
/* c8 ignore next */
|
|
147
|
+
(_schemaNode$operation =
|
|
148
|
+
schemaNode === null || schemaNode === void 0
|
|
149
|
+
? void 0
|
|
150
|
+
: schemaNode.operationTypes) !== null &&
|
|
151
|
+
_schemaNode$operation !== void 0
|
|
152
|
+
? _schemaNode$operation
|
|
153
|
+
: []
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
)
|
|
152
157
|
.find((operationNode) => operationNode.operation === operation)) === null ||
|
|
153
158
|
_flatMap$find === void 0
|
|
154
159
|
? void 0
|
|
@@ -422,11 +427,10 @@ function validateTypeImplementsInterface(context, type, iface) {
|
|
|
422
427
|
`${type.name}.${fieldName}(${argName}:) is type ` +
|
|
423
428
|
`${(0, _inspect.inspect)(typeArg.type)}.`,
|
|
424
429
|
[
|
|
425
|
-
// istanbul ignore next (TODO need to write coverage tests)
|
|
426
430
|
(_ifaceArg$astNode = ifaceArg.astNode) === null ||
|
|
427
431
|
_ifaceArg$astNode === void 0
|
|
428
432
|
? void 0
|
|
429
|
-
: _ifaceArg$astNode.type,
|
|
433
|
+
: _ifaceArg$astNode.type,
|
|
430
434
|
(_typeArg$astNode = typeArg.astNode) === null ||
|
|
431
435
|
_typeArg$astNode === void 0
|
|
432
436
|
? void 0
|
|
@@ -552,7 +556,7 @@ function validateInputFields(context, inputObj) {
|
|
|
552
556
|
context.reportError(
|
|
553
557
|
`Required input field ${inputObj.name}.${field.name} cannot be deprecated.`,
|
|
554
558
|
[
|
|
555
|
-
getDeprecatedDirectiveNode(field.astNode),
|
|
559
|
+
getDeprecatedDirectiveNode(field.astNode),
|
|
556
560
|
(_field$astNode3 = field.astNode) === null ||
|
|
557
561
|
_field$astNode3 === void 0
|
|
558
562
|
? void 0
|
|
@@ -616,16 +620,19 @@ function createInputObjectCircularRefsValidator(context) {
|
|
|
616
620
|
function getAllImplementsInterfaceNodes(type, iface) {
|
|
617
621
|
const { astNode, extensionASTNodes } = type;
|
|
618
622
|
const nodes =
|
|
619
|
-
astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; //
|
|
623
|
+
astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
620
624
|
|
|
621
625
|
return nodes
|
|
622
626
|
.flatMap((typeNode) => {
|
|
623
627
|
var _typeNode$interfaces;
|
|
624
628
|
|
|
625
|
-
return (
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
+
return (
|
|
630
|
+
/* c8 ignore next */
|
|
631
|
+
(_typeNode$interfaces = typeNode.interfaces) !== null &&
|
|
632
|
+
_typeNode$interfaces !== void 0
|
|
633
|
+
? _typeNode$interfaces
|
|
634
|
+
: []
|
|
635
|
+
);
|
|
629
636
|
})
|
|
630
637
|
.filter((ifaceNode) => ifaceNode.name.value === iface.name);
|
|
631
638
|
}
|
|
@@ -633,16 +640,19 @@ function getAllImplementsInterfaceNodes(type, iface) {
|
|
|
633
640
|
function getUnionMemberTypeNodes(union, typeName) {
|
|
634
641
|
const { astNode, extensionASTNodes } = union;
|
|
635
642
|
const nodes =
|
|
636
|
-
astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; //
|
|
643
|
+
astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
637
644
|
|
|
638
645
|
return nodes
|
|
639
646
|
.flatMap((unionNode) => {
|
|
640
647
|
var _unionNode$types;
|
|
641
648
|
|
|
642
|
-
return (
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
649
|
+
return (
|
|
650
|
+
/* c8 ignore next */
|
|
651
|
+
(_unionNode$types = unionNode.types) !== null &&
|
|
652
|
+
_unionNode$types !== void 0
|
|
653
|
+
? _unionNode$types
|
|
654
|
+
: []
|
|
655
|
+
);
|
|
646
656
|
})
|
|
647
657
|
.filter((typeNode) => typeNode.name.value === typeName);
|
|
648
658
|
}
|
|
@@ -650,7 +660,6 @@ function getUnionMemberTypeNodes(union, typeName) {
|
|
|
650
660
|
function getDeprecatedDirectiveNode(definitionNode) {
|
|
651
661
|
var _definitionNode$direc;
|
|
652
662
|
|
|
653
|
-
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
654
663
|
return definitionNode === null || definitionNode === void 0
|
|
655
664
|
? void 0
|
|
656
665
|
: (_definitionNode$direc = definitionNode.directives) === null ||
|
package/type/validate.mjs
CHANGED
|
@@ -134,19 +134,24 @@ function validateRootTypes(context) {
|
|
|
134
134
|
function getOperationTypeNode(schema, operation) {
|
|
135
135
|
var _flatMap$find;
|
|
136
136
|
|
|
137
|
-
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
138
137
|
return (_flatMap$find = [schema.astNode, ...schema.extensionASTNodes]
|
|
139
|
-
.flatMap(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
.flatMap(
|
|
139
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
140
|
+
(schemaNode) => {
|
|
141
|
+
var _schemaNode$operation;
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
/* c8 ignore next */
|
|
145
|
+
(_schemaNode$operation =
|
|
146
|
+
schemaNode === null || schemaNode === void 0
|
|
147
|
+
? void 0
|
|
148
|
+
: schemaNode.operationTypes) !== null &&
|
|
149
|
+
_schemaNode$operation !== void 0
|
|
150
|
+
? _schemaNode$operation
|
|
151
|
+
: []
|
|
152
|
+
);
|
|
153
|
+
},
|
|
154
|
+
)
|
|
150
155
|
.find((operationNode) => operationNode.operation === operation)) === null ||
|
|
151
156
|
_flatMap$find === void 0
|
|
152
157
|
? void 0
|
|
@@ -404,11 +409,10 @@ function validateTypeImplementsInterface(context, type, iface) {
|
|
|
404
409
|
`${type.name}.${fieldName}(${argName}:) is type ` +
|
|
405
410
|
`${inspect(typeArg.type)}.`,
|
|
406
411
|
[
|
|
407
|
-
// istanbul ignore next (TODO need to write coverage tests)
|
|
408
412
|
(_ifaceArg$astNode = ifaceArg.astNode) === null ||
|
|
409
413
|
_ifaceArg$astNode === void 0
|
|
410
414
|
? void 0
|
|
411
|
-
: _ifaceArg$astNode.type,
|
|
415
|
+
: _ifaceArg$astNode.type,
|
|
412
416
|
(_typeArg$astNode = typeArg.astNode) === null ||
|
|
413
417
|
_typeArg$astNode === void 0
|
|
414
418
|
? void 0
|
|
@@ -531,7 +535,7 @@ function validateInputFields(context, inputObj) {
|
|
|
531
535
|
context.reportError(
|
|
532
536
|
`Required input field ${inputObj.name}.${field.name} cannot be deprecated.`,
|
|
533
537
|
[
|
|
534
|
-
getDeprecatedDirectiveNode(field.astNode),
|
|
538
|
+
getDeprecatedDirectiveNode(field.astNode),
|
|
535
539
|
(_field$astNode3 = field.astNode) === null ||
|
|
536
540
|
_field$astNode3 === void 0
|
|
537
541
|
? void 0
|
|
@@ -592,16 +596,19 @@ function createInputObjectCircularRefsValidator(context) {
|
|
|
592
596
|
function getAllImplementsInterfaceNodes(type, iface) {
|
|
593
597
|
const { astNode, extensionASTNodes } = type;
|
|
594
598
|
const nodes =
|
|
595
|
-
astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; //
|
|
599
|
+
astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
596
600
|
|
|
597
601
|
return nodes
|
|
598
602
|
.flatMap((typeNode) => {
|
|
599
603
|
var _typeNode$interfaces;
|
|
600
604
|
|
|
601
|
-
return (
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
+
return (
|
|
606
|
+
/* c8 ignore next */
|
|
607
|
+
(_typeNode$interfaces = typeNode.interfaces) !== null &&
|
|
608
|
+
_typeNode$interfaces !== void 0
|
|
609
|
+
? _typeNode$interfaces
|
|
610
|
+
: []
|
|
611
|
+
);
|
|
605
612
|
})
|
|
606
613
|
.filter((ifaceNode) => ifaceNode.name.value === iface.name);
|
|
607
614
|
}
|
|
@@ -609,16 +616,19 @@ function getAllImplementsInterfaceNodes(type, iface) {
|
|
|
609
616
|
function getUnionMemberTypeNodes(union, typeName) {
|
|
610
617
|
const { astNode, extensionASTNodes } = union;
|
|
611
618
|
const nodes =
|
|
612
|
-
astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; //
|
|
619
|
+
astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; // FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
613
620
|
|
|
614
621
|
return nodes
|
|
615
622
|
.flatMap((unionNode) => {
|
|
616
623
|
var _unionNode$types;
|
|
617
624
|
|
|
618
|
-
return (
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
625
|
+
return (
|
|
626
|
+
/* c8 ignore next */
|
|
627
|
+
(_unionNode$types = unionNode.types) !== null &&
|
|
628
|
+
_unionNode$types !== void 0
|
|
629
|
+
? _unionNode$types
|
|
630
|
+
: []
|
|
631
|
+
);
|
|
622
632
|
})
|
|
623
633
|
.filter((typeNode) => typeNode.name.value === typeName);
|
|
624
634
|
}
|
|
@@ -626,7 +636,6 @@ function getUnionMemberTypeNodes(union, typeName) {
|
|
|
626
636
|
function getDeprecatedDirectiveNode(definitionNode) {
|
|
627
637
|
var _definitionNode$direc;
|
|
628
638
|
|
|
629
|
-
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
|
|
630
639
|
return definitionNode === null || definitionNode === void 0
|
|
631
640
|
? void 0
|
|
632
641
|
: (_definitionNode$direc = definitionNode.directives) === null ||
|
package/utilities/TypeInfo.js
CHANGED
|
@@ -276,6 +276,8 @@ class TypeInfo {
|
|
|
276
276
|
this._enumValue = enumValue;
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
|
+
|
|
280
|
+
default: // Ignore other nodes
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
283
|
|
|
@@ -329,6 +331,8 @@ class TypeInfo {
|
|
|
329
331
|
case _kinds.Kind.ENUM:
|
|
330
332
|
this._enumValue = null;
|
|
331
333
|
break;
|
|
334
|
+
|
|
335
|
+
default: // Ignore other nodes
|
|
332
336
|
}
|
|
333
337
|
}
|
|
334
338
|
}
|
package/utilities/TypeInfo.mjs
CHANGED
|
@@ -264,6 +264,8 @@ export class TypeInfo {
|
|
|
264
264
|
this._enumValue = enumValue;
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
|
+
|
|
268
|
+
default: // Ignore other nodes
|
|
267
269
|
}
|
|
268
270
|
}
|
|
269
271
|
|
|
@@ -317,6 +319,8 @@ export class TypeInfo {
|
|
|
317
319
|
case Kind.ENUM:
|
|
318
320
|
this._enumValue = null;
|
|
319
321
|
break;
|
|
322
|
+
|
|
323
|
+
default: // Ignore other nodes
|
|
320
324
|
}
|
|
321
325
|
}
|
|
322
326
|
}
|
|
@@ -12,11 +12,12 @@ var _GraphQLError = require('../error/GraphQLError.js');
|
|
|
12
12
|
|
|
13
13
|
var _assertName = require('../type/assertName.js');
|
|
14
14
|
|
|
15
|
+
/* c8 ignore start */
|
|
16
|
+
|
|
15
17
|
/**
|
|
16
18
|
* Upholds the spec rules about naming.
|
|
17
19
|
* @deprecated Please use `assertName` instead. Will be removed in v17
|
|
18
20
|
*/
|
|
19
|
-
// istanbul ignore next (Deprecated code)
|
|
20
21
|
function assertValidName(name) {
|
|
21
22
|
const error = isValidNameError(name);
|
|
22
23
|
|
|
@@ -30,7 +31,6 @@ function assertValidName(name) {
|
|
|
30
31
|
* Returns an Error if a name is invalid.
|
|
31
32
|
* @deprecated Please use `assertName` instead. Will be removed in v17
|
|
32
33
|
*/
|
|
33
|
-
// istanbul ignore next (Deprecated code)
|
|
34
34
|
|
|
35
35
|
function isValidNameError(name) {
|
|
36
36
|
typeof name === 'string' ||
|
|
@@ -48,3 +48,4 @@ function isValidNameError(name) {
|
|
|
48
48
|
return error;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
/* c8 ignore stop */
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { devAssert } from '../jsutils/devAssert.mjs';
|
|
2
2
|
import { GraphQLError } from '../error/GraphQLError.mjs';
|
|
3
3
|
import { assertName } from '../type/assertName.mjs';
|
|
4
|
+
/* c8 ignore start */
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Upholds the spec rules about naming.
|
|
6
8
|
* @deprecated Please use `assertName` instead. Will be removed in v17
|
|
7
9
|
*/
|
|
8
|
-
// istanbul ignore next (Deprecated code)
|
|
9
10
|
|
|
10
11
|
export function assertValidName(name) {
|
|
11
12
|
const error = isValidNameError(name);
|
|
@@ -20,7 +21,6 @@ export function assertValidName(name) {
|
|
|
20
21
|
* Returns an Error if a name is invalid.
|
|
21
22
|
* @deprecated Please use `assertName` instead. Will be removed in v17
|
|
22
23
|
*/
|
|
23
|
-
// istanbul ignore next (Deprecated code)
|
|
24
24
|
|
|
25
25
|
export function isValidNameError(name) {
|
|
26
26
|
typeof name === 'string' || devAssert(false, 'Expected name to be a string.');
|
|
@@ -37,3 +37,4 @@ export function isValidNameError(name) {
|
|
|
37
37
|
return error;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
/* c8 ignore stop */
|
|
@@ -115,7 +115,7 @@ function astFromValue(value, type) {
|
|
|
115
115
|
kind: _kinds.Kind.OBJECT,
|
|
116
116
|
fields: fieldNodes,
|
|
117
117
|
};
|
|
118
|
-
}
|
|
118
|
+
}
|
|
119
119
|
|
|
120
120
|
if ((0, _definition.isLeafType)(type)) {
|
|
121
121
|
// Since value is an internally represented value, it must be serialized
|
|
@@ -171,7 +171,9 @@ function astFromValue(value, type) {
|
|
|
171
171
|
throw new TypeError(
|
|
172
172
|
`Cannot convert value to AST: ${(0, _inspect.inspect)(serialized)}.`,
|
|
173
173
|
);
|
|
174
|
-
}
|
|
174
|
+
}
|
|
175
|
+
/* c8 ignore next 3 */
|
|
176
|
+
// Not reachable, all possible types have been considered.
|
|
175
177
|
|
|
176
178
|
false ||
|
|
177
179
|
(0, _invariant.invariant)(
|
|
@@ -108,7 +108,7 @@ export function astFromValue(value, type) {
|
|
|
108
108
|
kind: Kind.OBJECT,
|
|
109
109
|
fields: fieldNodes,
|
|
110
110
|
};
|
|
111
|
-
}
|
|
111
|
+
}
|
|
112
112
|
|
|
113
113
|
if (isLeafType(type)) {
|
|
114
114
|
// Since value is an internally represented value, it must be serialized
|
|
@@ -162,7 +162,9 @@ export function astFromValue(value, type) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
throw new TypeError(`Cannot convert value to AST: ${inspect(serialized)}.`);
|
|
165
|
-
}
|
|
165
|
+
}
|
|
166
|
+
/* c8 ignore next 3 */
|
|
167
|
+
// Not reachable, all possible types have been considered.
|
|
166
168
|
|
|
167
169
|
false || invariant(false, 'Unexpected input type: ' + inspect(type));
|
|
168
170
|
}
|
|
@@ -151,6 +151,8 @@ function buildClientSchema(introspection, options) {
|
|
|
151
151
|
function buildType(type) {
|
|
152
152
|
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
153
153
|
if (type != null && type.name != null && type.kind != null) {
|
|
154
|
+
// FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
154
156
|
switch (type.kind) {
|
|
155
157
|
case _introspection.TypeKind.SCALAR:
|
|
156
158
|
return buildScalarDef(type);
|
|
@@ -141,6 +141,8 @@ export function buildClientSchema(introspection, options) {
|
|
|
141
141
|
function buildType(type) {
|
|
142
142
|
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
143
143
|
if (type != null && type.name != null && type.kind != null) {
|
|
144
|
+
// FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
144
146
|
switch (type.kind) {
|
|
145
147
|
case TypeKind.SCALAR:
|
|
146
148
|
return buildScalarDef(type);
|
|
@@ -140,7 +140,7 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
return coercedValue;
|
|
143
|
-
}
|
|
143
|
+
}
|
|
144
144
|
|
|
145
145
|
if ((0, _definition.isLeafType)(type)) {
|
|
146
146
|
let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(),
|
|
@@ -179,7 +179,9 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
return parseResult;
|
|
182
|
-
}
|
|
182
|
+
}
|
|
183
|
+
/* c8 ignore next 3 */
|
|
184
|
+
// Not reachable, all possible types have been considered.
|
|
183
185
|
|
|
184
186
|
false ||
|
|
185
187
|
(0, _invariant.invariant)(
|
|
@@ -125,7 +125,7 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
return coercedValue;
|
|
128
|
-
}
|
|
128
|
+
}
|
|
129
129
|
|
|
130
130
|
if (isLeafType(type)) {
|
|
131
131
|
let parseResult; // Scalars and Enums determine if a input value is valid via parseValue(),
|
|
@@ -164,7 +164,9 @@ function coerceInputValueImpl(inputValue, type, onError, path) {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
return parseResult;
|
|
167
|
-
}
|
|
167
|
+
}
|
|
168
|
+
/* c8 ignore next 3 */
|
|
169
|
+
// Not reachable, all possible types have been considered.
|
|
168
170
|
|
|
169
171
|
false || invariant(false, 'Unexpected input type: ' + inspect(type));
|
|
170
172
|
}
|
|
@@ -229,11 +229,13 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
229
229
|
|
|
230
230
|
if ((0, _definition.isEnumType)(type)) {
|
|
231
231
|
return extendEnumType(type);
|
|
232
|
-
}
|
|
232
|
+
}
|
|
233
233
|
|
|
234
234
|
if ((0, _definition.isInputObjectType)(type)) {
|
|
235
235
|
return extendInputObjectType(type);
|
|
236
|
-
}
|
|
236
|
+
}
|
|
237
|
+
/* c8 ignore next 3 */
|
|
238
|
+
// Not reachable, all possible type definition nodes have been considered.
|
|
237
239
|
|
|
238
240
|
false ||
|
|
239
241
|
(0, _invariant.invariant)(
|
|
@@ -391,8 +393,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
391
393
|
for (const node of nodes) {
|
|
392
394
|
var _node$operationTypes;
|
|
393
395
|
|
|
394
|
-
//
|
|
396
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
395
397
|
const operationTypesNodes =
|
|
398
|
+
/* c8 ignore next */
|
|
396
399
|
(_node$operationTypes = node.operationTypes) !== null &&
|
|
397
400
|
_node$operationTypes !== void 0
|
|
398
401
|
? _node$operationTypes
|
|
@@ -463,8 +466,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
463
466
|
for (const node of nodes) {
|
|
464
467
|
var _node$fields;
|
|
465
468
|
|
|
466
|
-
//
|
|
469
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
467
470
|
const nodeFields =
|
|
471
|
+
/* c8 ignore next */
|
|
468
472
|
(_node$fields = node.fields) !== null && _node$fields !== void 0
|
|
469
473
|
? _node$fields
|
|
470
474
|
: [];
|
|
@@ -493,8 +497,10 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
493
497
|
}
|
|
494
498
|
|
|
495
499
|
function buildArgumentMap(args) {
|
|
496
|
-
//
|
|
497
|
-
const argsNodes =
|
|
500
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
501
|
+
const argsNodes =
|
|
502
|
+
/* c8 ignore next */
|
|
503
|
+
args !== null && args !== void 0 ? args : [];
|
|
498
504
|
const argConfigMap = Object.create(null);
|
|
499
505
|
|
|
500
506
|
for (const arg of argsNodes) {
|
|
@@ -526,8 +532,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
526
532
|
for (const node of nodes) {
|
|
527
533
|
var _node$fields2;
|
|
528
534
|
|
|
529
|
-
//
|
|
535
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
530
536
|
const fieldsNodes =
|
|
537
|
+
/* c8 ignore next */
|
|
531
538
|
(_node$fields2 = node.fields) !== null && _node$fields2 !== void 0
|
|
532
539
|
? _node$fields2
|
|
533
540
|
: [];
|
|
@@ -565,8 +572,9 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
565
572
|
for (const node of nodes) {
|
|
566
573
|
var _node$values;
|
|
567
574
|
|
|
568
|
-
//
|
|
575
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
569
576
|
const valuesNodes =
|
|
577
|
+
/* c8 ignore next */
|
|
570
578
|
(_node$values = node.values) !== null && _node$values !== void 0
|
|
571
579
|
? _node$values
|
|
572
580
|
: [];
|
|
@@ -595,18 +603,21 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
595
603
|
// validation with validateSchema() will produce more actionable results.
|
|
596
604
|
// @ts-expect-error
|
|
597
605
|
return nodes.flatMap(
|
|
598
|
-
//
|
|
606
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
599
607
|
(node) => {
|
|
600
608
|
var _node$interfaces$map, _node$interfaces;
|
|
601
609
|
|
|
602
|
-
return (
|
|
603
|
-
|
|
604
|
-
_node$interfaces
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
+
return (
|
|
611
|
+
/* c8 ignore next */
|
|
612
|
+
(_node$interfaces$map =
|
|
613
|
+
(_node$interfaces = node.interfaces) === null ||
|
|
614
|
+
_node$interfaces === void 0
|
|
615
|
+
? void 0
|
|
616
|
+
: _node$interfaces.map(getNamedType)) !== null &&
|
|
617
|
+
_node$interfaces$map !== void 0
|
|
618
|
+
? _node$interfaces$map
|
|
619
|
+
: []
|
|
620
|
+
);
|
|
610
621
|
},
|
|
611
622
|
);
|
|
612
623
|
}
|
|
@@ -617,17 +628,20 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
617
628
|
// validation with validateSchema() will produce more actionable results.
|
|
618
629
|
// @ts-expect-error
|
|
619
630
|
return nodes.flatMap(
|
|
620
|
-
//
|
|
631
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2203
|
|
621
632
|
(node) => {
|
|
622
633
|
var _node$types$map, _node$types;
|
|
623
634
|
|
|
624
|
-
return (
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
635
|
+
return (
|
|
636
|
+
/* c8 ignore next */
|
|
637
|
+
(_node$types$map =
|
|
638
|
+
(_node$types = node.types) === null || _node$types === void 0
|
|
639
|
+
? void 0
|
|
640
|
+
: _node$types.map(getNamedType)) !== null &&
|
|
641
|
+
_node$types$map !== void 0
|
|
642
|
+
? _node$types$map
|
|
643
|
+
: []
|
|
644
|
+
);
|
|
631
645
|
},
|
|
632
646
|
);
|
|
633
647
|
}
|
|
@@ -745,13 +759,7 @@ function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
745
759
|
extensionASTNodes,
|
|
746
760
|
});
|
|
747
761
|
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
false ||
|
|
751
|
-
(0, _invariant.invariant)(
|
|
752
|
-
false,
|
|
753
|
-
'Unexpected type definition node: ' + (0, _inspect.inspect)(astNode),
|
|
754
|
-
);
|
|
762
|
+
}
|
|
755
763
|
}
|
|
756
764
|
}
|
|
757
765
|
|