@graphql-tools/delegate 11.1.3 → 11.1.4-alpha-ad320b7517760ed405c9780cb7a5f429fdb491a7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @graphql-tools/delegate
2
2
 
3
+ ## 11.1.4-alpha-ad320b7517760ed405c9780cb7a5f429fdb491a7
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#1727](https://github.com/graphql-hive/gateway/pull/1727) [`b1295c5`](https://github.com/graphql-hive/gateway/commit/b1295c5d6bdccb8187816c72d40a55a5fca35bdd) Thanks [@ardatan](https://github.com/ardatan)! - Avoid extra `__typename` in the root selection
9
+
3
10
  ## 11.1.3
4
11
  ### Patch Changes
5
12
 
package/dist/index.cjs CHANGED
@@ -652,6 +652,7 @@ function finalizeGatewayDocument(targetSchema, fragments, operations, onOverlapp
652
652
  }
653
653
  }
654
654
  let fragmentSet = /* @__PURE__ */ Object.create(null);
655
+ let selectionCnt = 0;
655
656
  for (const operation of operations) {
656
657
  const type = utils.getDefinedRootType(targetSchema, operation.operation);
657
658
  const {
@@ -698,6 +699,7 @@ function finalizeGatewayDocument(targetSchema, fragments, operations, onOverlapp
698
699
  if (selectionSet.selections.length === 1 && selectionSet.selections[0] && selectionSet.selections[0].kind === graphql.Kind.FIELD && selectionSet.selections[0].name.value === "__typename") {
699
700
  continue;
700
701
  }
702
+ selectionCnt += selectionSet.selections.length;
701
703
  newOperations.push({
702
704
  kind: graphql.Kind.OPERATION_DEFINITION,
703
705
  operation: operation.operation,
@@ -707,7 +709,7 @@ function finalizeGatewayDocument(targetSchema, fragments, operations, onOverlapp
707
709
  selectionSet
708
710
  });
709
711
  }
710
- if (!newOperations.length) {
712
+ if (!newOperations.length || selectionCnt === 0) {
711
713
  throw utils.createGraphQLError(
712
714
  "Failed to create a gateway request. The request must contain at least one operation.",
713
715
  {
package/dist/index.js CHANGED
@@ -652,6 +652,7 @@ function finalizeGatewayDocument(targetSchema, fragments, operations, onOverlapp
652
652
  }
653
653
  }
654
654
  let fragmentSet = /* @__PURE__ */ Object.create(null);
655
+ let selectionCnt = 0;
655
656
  for (const operation of operations) {
656
657
  const type = getDefinedRootType(targetSchema, operation.operation);
657
658
  const {
@@ -698,6 +699,7 @@ function finalizeGatewayDocument(targetSchema, fragments, operations, onOverlapp
698
699
  if (selectionSet.selections.length === 1 && selectionSet.selections[0] && selectionSet.selections[0].kind === Kind.FIELD && selectionSet.selections[0].name.value === "__typename") {
699
700
  continue;
700
701
  }
702
+ selectionCnt += selectionSet.selections.length;
701
703
  newOperations.push({
702
704
  kind: Kind.OPERATION_DEFINITION,
703
705
  operation: operation.operation,
@@ -707,7 +709,7 @@ function finalizeGatewayDocument(targetSchema, fragments, operations, onOverlapp
707
709
  selectionSet
708
710
  });
709
711
  }
710
- if (!newOperations.length) {
712
+ if (!newOperations.length || selectionCnt === 0) {
711
713
  throw createGraphQLError(
712
714
  "Failed to create a gateway request. The request must contain at least one operation.",
713
715
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/delegate",
3
- "version": "11.1.3",
3
+ "version": "11.1.4-alpha-ad320b7517760ed405c9780cb7a5f429fdb491a7",
4
4
  "type": "module",
5
5
  "description": "A set of utils for faster development of GraphQL tools",
6
6
  "repository": {