graphql 16.7.1 → 16.8.1
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/package.json +1 -1
- package/utilities/getIntrospectionQuery.js +8 -0
- package/utilities/getIntrospectionQuery.mjs +8 -0
- package/validation/rules/OverlappingFieldsCanBeMergedRule.js +33 -20
- package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +33 -18
- package/version.js +2 -2
- package/version.mjs +2 -2
package/package.json
CHANGED
|
@@ -543,7 +543,7 @@ function findConflict(
|
|
|
543
543
|
];
|
|
544
544
|
} // Two field calls must have the same arguments.
|
|
545
545
|
|
|
546
|
-
if (
|
|
546
|
+
if (!sameArguments(node1, node2)) {
|
|
547
547
|
return [
|
|
548
548
|
[responseName, 'they have differing arguments'],
|
|
549
549
|
[node1],
|
|
@@ -588,27 +588,40 @@ function findConflict(
|
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
-
function
|
|
592
|
-
|
|
591
|
+
function sameArguments(node1, node2) {
|
|
592
|
+
const args1 = node1.arguments;
|
|
593
|
+
const args2 = node2.arguments;
|
|
593
594
|
|
|
594
|
-
|
|
595
|
-
|
|
595
|
+
if (args1 === undefined || args1.length === 0) {
|
|
596
|
+
return args2 === undefined || args2.length === 0;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
if (args2 === undefined || args2.length === 0) {
|
|
600
|
+
return false;
|
|
601
|
+
}
|
|
602
|
+
/* c8 ignore next */
|
|
603
|
+
|
|
604
|
+
if (args1.length !== args2.length) {
|
|
596
605
|
/* c8 ignore next */
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
(
|
|
611
|
-
);
|
|
606
|
+
return false;
|
|
607
|
+
/* c8 ignore next */
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
const values2 = new Map(args2.map(({ name, value }) => [name.value, value]));
|
|
611
|
+
return args1.every((arg1) => {
|
|
612
|
+
const value1 = arg1.value;
|
|
613
|
+
const value2 = values2.get(arg1.name.value);
|
|
614
|
+
|
|
615
|
+
if (value2 === undefined) {
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
return stringifyValue(value1) === stringifyValue(value2);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function stringifyValue(value) {
|
|
624
|
+
return (0, _printer.print)((0, _sortValueNode.sortValueNode)(value));
|
|
612
625
|
} // Two types conflict if both types could not apply to a value simultaneously.
|
|
613
626
|
// Composite types are ignored as their individual field types will be compared
|
|
614
627
|
// later recursively. However List and Non-Null types must match.
|
|
@@ -537,7 +537,7 @@ function findConflict(
|
|
|
537
537
|
];
|
|
538
538
|
} // Two field calls must have the same arguments.
|
|
539
539
|
|
|
540
|
-
if (
|
|
540
|
+
if (!sameArguments(node1, node2)) {
|
|
541
541
|
return [
|
|
542
542
|
[responseName, 'they have differing arguments'],
|
|
543
543
|
[node1],
|
|
@@ -582,25 +582,40 @@ function findConflict(
|
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
-
function
|
|
586
|
-
|
|
585
|
+
function sameArguments(node1, node2) {
|
|
586
|
+
const args1 = node1.arguments;
|
|
587
|
+
const args2 = node2.arguments;
|
|
587
588
|
|
|
588
|
-
|
|
589
|
-
|
|
589
|
+
if (args1 === undefined || args1.length === 0) {
|
|
590
|
+
return args2 === undefined || args2.length === 0;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
if (args2 === undefined || args2.length === 0) {
|
|
594
|
+
return false;
|
|
595
|
+
}
|
|
596
|
+
/* c8 ignore next */
|
|
597
|
+
|
|
598
|
+
if (args1.length !== args2.length) {
|
|
590
599
|
/* c8 ignore next */
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
600
|
+
return false;
|
|
601
|
+
/* c8 ignore next */
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
const values2 = new Map(args2.map(({ name, value }) => [name.value, value]));
|
|
605
|
+
return args1.every((arg1) => {
|
|
606
|
+
const value1 = arg1.value;
|
|
607
|
+
const value2 = values2.get(arg1.name.value);
|
|
608
|
+
|
|
609
|
+
if (value2 === undefined) {
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
return stringifyValue(value1) === stringifyValue(value2);
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function stringifyValue(value) {
|
|
618
|
+
return print(sortValueNode(value));
|
|
604
619
|
} // Two types conflict if both types could not apply to a value simultaneously.
|
|
605
620
|
// Composite types are ignored as their individual field types will be compared
|
|
606
621
|
// later recursively. However List and Non-Null types must match.
|
package/version.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.versionInfo = exports.version = void 0;
|
|
|
10
10
|
/**
|
|
11
11
|
* A string containing the version of the GraphQL.js library
|
|
12
12
|
*/
|
|
13
|
-
const version = '16.
|
|
13
|
+
const version = '16.8.1';
|
|
14
14
|
/**
|
|
15
15
|
* An object containing the components of the GraphQL.js version string
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ const version = '16.7.1';
|
|
|
18
18
|
exports.version = version;
|
|
19
19
|
const versionInfo = Object.freeze({
|
|
20
20
|
major: 16,
|
|
21
|
-
minor:
|
|
21
|
+
minor: 8,
|
|
22
22
|
patch: 1,
|
|
23
23
|
preReleaseTag: null,
|
|
24
24
|
});
|
package/version.mjs
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* A string containing the version of the GraphQL.js library
|
|
6
6
|
*/
|
|
7
|
-
export const version = '16.
|
|
7
|
+
export const version = '16.8.1';
|
|
8
8
|
/**
|
|
9
9
|
* An object containing the components of the GraphQL.js version string
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
export const versionInfo = Object.freeze({
|
|
13
13
|
major: 16,
|
|
14
|
-
minor:
|
|
14
|
+
minor: 8,
|
|
15
15
|
patch: 1,
|
|
16
16
|
preReleaseTag: null,
|
|
17
17
|
});
|