graphql 16.8.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphql",
3
- "version": "16.8.0",
3
+ "version": "16.8.1",
4
4
  "description": "A Query Language and Runtime which can target any service.",
5
5
  "license": "MIT",
6
6
  "main": "index",
@@ -543,7 +543,7 @@ function findConflict(
543
543
  ];
544
544
  } // Two field calls must have the same arguments.
545
545
 
546
- if (stringifyArguments(node1) !== stringifyArguments(node2)) {
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 stringifyArguments(fieldNode) {
592
- var _fieldNode$arguments;
591
+ function sameArguments(node1, node2) {
592
+ const args1 = node1.arguments;
593
+ const args2 = node2.arguments;
593
594
 
594
- // FIXME https://github.com/graphql/graphql-js/issues/2203
595
- const args =
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
- (_fieldNode$arguments = fieldNode.arguments) !== null &&
598
- _fieldNode$arguments !== void 0
599
- ? _fieldNode$arguments
600
- : [];
601
- const inputObjectWithArgs = {
602
- kind: _kinds.Kind.OBJECT,
603
- fields: args.map((argNode) => ({
604
- kind: _kinds.Kind.OBJECT_FIELD,
605
- name: argNode.name,
606
- value: argNode.value,
607
- })),
608
- };
609
- return (0, _printer.print)(
610
- (0, _sortValueNode.sortValueNode)(inputObjectWithArgs),
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 (stringifyArguments(node1) !== stringifyArguments(node2)) {
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 stringifyArguments(fieldNode) {
586
- var _fieldNode$arguments;
585
+ function sameArguments(node1, node2) {
586
+ const args1 = node1.arguments;
587
+ const args2 = node2.arguments;
587
588
 
588
- // FIXME https://github.com/graphql/graphql-js/issues/2203
589
- const args =
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
- (_fieldNode$arguments = fieldNode.arguments) !== null &&
592
- _fieldNode$arguments !== void 0
593
- ? _fieldNode$arguments
594
- : [];
595
- const inputObjectWithArgs = {
596
- kind: Kind.OBJECT,
597
- fields: args.map((argNode) => ({
598
- kind: Kind.OBJECT_FIELD,
599
- name: argNode.name,
600
- value: argNode.value,
601
- })),
602
- };
603
- return print(sortValueNode(inputObjectWithArgs));
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.8.0';
13
+ const version = '16.8.1';
14
14
  /**
15
15
  * An object containing the components of the GraphQL.js version string
16
16
  */
@@ -19,7 +19,7 @@ exports.version = version;
19
19
  const versionInfo = Object.freeze({
20
20
  major: 16,
21
21
  minor: 8,
22
- patch: 0,
22
+ patch: 1,
23
23
  preReleaseTag: null,
24
24
  });
25
25
  exports.versionInfo = versionInfo;
package/version.mjs CHANGED
@@ -4,7 +4,7 @@
4
4
  /**
5
5
  * A string containing the version of the GraphQL.js library
6
6
  */
7
- export const version = '16.8.0';
7
+ export const version = '16.8.1';
8
8
  /**
9
9
  * An object containing the components of the GraphQL.js version string
10
10
  */
@@ -12,6 +12,6 @@ export const version = '16.8.0';
12
12
  export const versionInfo = Object.freeze({
13
13
  major: 16,
14
14
  minor: 8,
15
- patch: 0,
15
+ patch: 1,
16
16
  preReleaseTag: null,
17
17
  });