@graphql-tools/federation 4.0.3 → 4.0.4-alpha-6a2e238d8aaf73e465301cb939df13a61d1d47d5

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/federation
2
2
 
3
+ ## 4.0.4-alpha-6a2e238d8aaf73e465301cb939df13a61d1d47d5
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#1533](https://github.com/graphql-hive/gateway/pull/1533) [`6a2e238`](https://github.com/graphql-hive/gateway/commit/6a2e238d8aaf73e465301cb939df13a61d1d47d5) Thanks [@ardatan](https://github.com/ardatan)! - Fix shared root handling in case of heavily nested selections
9
+
3
10
  ## 4.0.3
4
11
  ### Patch Changes
5
12
 
package/dist/index.cjs CHANGED
@@ -1162,7 +1162,7 @@ function getStitchingOptionsFromSupergraphSdl(opts) {
1162
1162
  }
1163
1163
  if (operationType) {
1164
1164
  const defaultMergedField = defaultMerger(candidates);
1165
- const mergedResolver = function mergedResolver2(_root, _args, context, info) {
1165
+ const mergedResolver = function mergedResolver2(_root, args, context, info) {
1166
1166
  const originalSelectionSet = {
1167
1167
  kind: graphql.Kind.SELECTION_SET,
1168
1168
  selections: info.fieldNodes
@@ -1243,6 +1243,7 @@ function getStitchingOptionsFromSupergraphSdl(opts) {
1243
1243
  schema: currentSubschema,
1244
1244
  operation: rootTypeMap.get(info.parentType.name) || "query",
1245
1245
  context,
1246
+ args,
1246
1247
  info: currentFriendSubschemas?.size ? {
1247
1248
  ...info,
1248
1249
  fieldNodes: [
@@ -1267,6 +1268,7 @@ function getStitchingOptionsFromSupergraphSdl(opts) {
1267
1268
  schema: friendSubschema,
1268
1269
  operation: rootTypeMap.get(info.parentType.name) || "query",
1269
1270
  context,
1271
+ args,
1270
1272
  info: {
1271
1273
  ...info,
1272
1274
  fieldNodes: friendSelectionSet.selections
@@ -1539,11 +1541,19 @@ function mergeResults(results, getFieldNames) {
1539
1541
  if (datas.length === 1) {
1540
1542
  return makeExternalObject(datas[0], errors, getFieldNames);
1541
1543
  }
1542
- return makeExternalObject(
1544
+ const mergedData = makeExternalObject(
1543
1545
  utils.mergeDeep(datas, void 0, true, true),
1544
1546
  errors,
1545
1547
  getFieldNames
1546
1548
  );
1549
+ const firstData = datas[0];
1550
+ const propertySymbols = Object.getOwnPropertySymbols(firstData);
1551
+ for (const propertySymbol of propertySymbols) {
1552
+ if (mergedData[propertySymbol] == null) {
1553
+ mergedData[propertySymbol] = firstData[propertySymbol];
1554
+ }
1555
+ }
1556
+ return mergedData;
1547
1557
  }
1548
1558
  if (errors.length) {
1549
1559
  if (errors.length === 1) {
package/dist/index.js CHANGED
@@ -1160,7 +1160,7 @@ function getStitchingOptionsFromSupergraphSdl(opts) {
1160
1160
  }
1161
1161
  if (operationType) {
1162
1162
  const defaultMergedField = defaultMerger(candidates);
1163
- const mergedResolver = function mergedResolver2(_root, _args, context, info) {
1163
+ const mergedResolver = function mergedResolver2(_root, args, context, info) {
1164
1164
  const originalSelectionSet = {
1165
1165
  kind: Kind.SELECTION_SET,
1166
1166
  selections: info.fieldNodes
@@ -1241,6 +1241,7 @@ function getStitchingOptionsFromSupergraphSdl(opts) {
1241
1241
  schema: currentSubschema,
1242
1242
  operation: rootTypeMap.get(info.parentType.name) || "query",
1243
1243
  context,
1244
+ args,
1244
1245
  info: currentFriendSubschemas?.size ? {
1245
1246
  ...info,
1246
1247
  fieldNodes: [
@@ -1265,6 +1266,7 @@ function getStitchingOptionsFromSupergraphSdl(opts) {
1265
1266
  schema: friendSubschema,
1266
1267
  operation: rootTypeMap.get(info.parentType.name) || "query",
1267
1268
  context,
1269
+ args,
1268
1270
  info: {
1269
1271
  ...info,
1270
1272
  fieldNodes: friendSelectionSet.selections
@@ -1537,11 +1539,19 @@ function mergeResults(results, getFieldNames) {
1537
1539
  if (datas.length === 1) {
1538
1540
  return makeExternalObject(datas[0], errors, getFieldNames);
1539
1541
  }
1540
- return makeExternalObject(
1542
+ const mergedData = makeExternalObject(
1541
1543
  mergeDeep(datas, void 0, true, true),
1542
1544
  errors,
1543
1545
  getFieldNames
1544
1546
  );
1547
+ const firstData = datas[0];
1548
+ const propertySymbols = Object.getOwnPropertySymbols(firstData);
1549
+ for (const propertySymbol of propertySymbols) {
1550
+ if (mergedData[propertySymbol] == null) {
1551
+ mergedData[propertySymbol] = firstData[propertySymbol];
1552
+ }
1553
+ }
1554
+ return mergedData;
1545
1555
  }
1546
1556
  if (errors.length) {
1547
1557
  if (errors.length === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/federation",
3
- "version": "4.0.3",
3
+ "version": "4.0.4-alpha-6a2e238d8aaf73e465301cb939df13a61d1d47d5",
4
4
  "type": "module",
5
5
  "description": "Useful tools to create and manipulate GraphQL schemas.",
6
6
  "repository": {