@graphql-tools/stitch 10.4.4 → 10.4.5-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46
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 +22 -0
- package/dist/index.cjs +9 -10
- package/dist/index.js +9 -10
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @graphql-tools/stitch
|
|
2
2
|
|
|
3
|
+
## 10.4.5-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#2767](https://github.com/graphql-hive/gateway/pull/2767) [`76d5ded`](https://github.com/graphql-hive/gateway/commit/76d5deda736221c3a2a973e11ef35b430dc109d2) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Keep fields of named fragments spread on an interface when fetching the concrete type from the implementing subgraph
|
|
9
|
+
|
|
10
|
+
For example, `node { ...NodeFields }` with `fragment NodeFields on Node { ... on Leaf { extra } }` now fetches `extra` instead of returning `null` for it.
|
|
11
|
+
|
|
12
|
+
Closes [#2463](https://github.com/graphql-hive/gateway/issues/2463)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
- [#2767](https://github.com/graphql-hive/gateway/pull/2767) [`717bc72`](https://github.com/graphql-hive/gateway/commit/717bc72c8dcb0c56b7f2210c176fb6f2905cb715) Thanks [@enisdenjo](https://github.com/enisdenjo)! - Fetch `@requires` fields of an `@interfaceObject` field when it is selected through an inline fragment on an implementation
|
|
16
|
+
|
|
17
|
+
For example, `location { ... on Store { events } }` where `events` is `@requires(fields: "code")` on the `Location` interface object now sends `code` to the contributing subgraph.
|
|
18
|
+
|
|
19
|
+
Closes [#2737](https://github.com/graphql-hive/gateway/issues/2737)
|
|
20
|
+
- Updated dependencies [[`b180423`](https://github.com/graphql-hive/gateway/commit/b1804230911a8cd047ee0953304469ff4cb6b131), [`537901e`](https://github.com/graphql-hive/gateway/commit/537901e52a07ec93cd78fd3836f6223447064383)]:
|
|
21
|
+
- @graphql-tools/delegate@12.3.5-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46
|
|
22
|
+
- @graphql-tools/batch-delegate@10.1.7-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46
|
|
23
|
+
- @graphql-tools/wrap@11.2.7-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46
|
|
24
|
+
|
|
3
25
|
## 10.4.4
|
|
4
26
|
### Patch Changes
|
|
5
27
|
|
package/dist/index.cjs
CHANGED
|
@@ -810,12 +810,12 @@ function createDelegationPlanBuilder(mergedTypeInfo) {
|
|
|
810
810
|
if (graphql.isAbstractType(typeInSubschema) && fieldsNotInSubschema.some(
|
|
811
811
|
(fieldNode) => fieldNode.name.value === "__typename"
|
|
812
812
|
)) {
|
|
813
|
-
const
|
|
813
|
+
const fragmentSelections = [];
|
|
814
814
|
for (const fieldNode of fieldNodes) {
|
|
815
815
|
if (fieldNode.selectionSet) {
|
|
816
816
|
for (const selection of fieldNode.selectionSet.selections) {
|
|
817
|
-
if (selection.kind === graphql.Kind.INLINE_FRAGMENT) {
|
|
818
|
-
|
|
817
|
+
if (selection.kind === graphql.Kind.INLINE_FRAGMENT || selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
818
|
+
fragmentSelections.push(selection);
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
821
|
}
|
|
@@ -836,7 +836,7 @@ function createDelegationPlanBuilder(mergedTypeInfo) {
|
|
|
836
836
|
value: "__typename"
|
|
837
837
|
}
|
|
838
838
|
});
|
|
839
|
-
existingSelections.push(...
|
|
839
|
+
existingSelections.push(...fragmentSelections);
|
|
840
840
|
added = true;
|
|
841
841
|
break;
|
|
842
842
|
}
|
|
@@ -859,7 +859,7 @@ function createDelegationPlanBuilder(mergedTypeInfo) {
|
|
|
859
859
|
value: "__typename"
|
|
860
860
|
}
|
|
861
861
|
},
|
|
862
|
-
...
|
|
862
|
+
...fragmentSelections
|
|
863
863
|
]
|
|
864
864
|
});
|
|
865
865
|
delegationMaps.push(delegationStageToFetchTypeName);
|
|
@@ -1368,6 +1368,7 @@ function completeStitchingInfo(stitchingInfo, resolvers, schema) {
|
|
|
1368
1368
|
const fieldNodeMap = /* @__PURE__ */ Object.create(null);
|
|
1369
1369
|
for (const typeName in selectionSetsByField) {
|
|
1370
1370
|
const type = schema.getType(typeName);
|
|
1371
|
+
const typeNames = graphql.isInterfaceType(type) ? [typeName, ...schema.getPossibleTypes(type).map((t) => t.name)] : [typeName];
|
|
1371
1372
|
for (const fieldName in selectionSetsByField[typeName]) {
|
|
1372
1373
|
for (const selectionSet of selectionSetsByField[typeName][fieldName]) {
|
|
1373
1374
|
const { fields } = utils.collectFields(
|
|
@@ -1380,13 +1381,11 @@ function completeStitchingInfo(stitchingInfo, resolvers, schema) {
|
|
|
1380
1381
|
for (const [, fieldNodes] of fields) {
|
|
1381
1382
|
for (const fieldNode of fieldNodes) {
|
|
1382
1383
|
const key = graphql.print(fieldNode);
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
updateArrayMap(fieldNodesByField, typeName, fieldName, fieldNode);
|
|
1386
|
-
} else {
|
|
1384
|
+
fieldNodeMap[key] ??= fieldNode;
|
|
1385
|
+
for (const name of typeNames) {
|
|
1387
1386
|
updateArrayMap(
|
|
1388
1387
|
fieldNodesByField,
|
|
1389
|
-
|
|
1388
|
+
name,
|
|
1390
1389
|
fieldName,
|
|
1391
1390
|
fieldNodeMap[key]
|
|
1392
1391
|
);
|
package/dist/index.js
CHANGED
|
@@ -808,12 +808,12 @@ function createDelegationPlanBuilder(mergedTypeInfo) {
|
|
|
808
808
|
if (isAbstractType(typeInSubschema) && fieldsNotInSubschema.some(
|
|
809
809
|
(fieldNode) => fieldNode.name.value === "__typename"
|
|
810
810
|
)) {
|
|
811
|
-
const
|
|
811
|
+
const fragmentSelections = [];
|
|
812
812
|
for (const fieldNode of fieldNodes) {
|
|
813
813
|
if (fieldNode.selectionSet) {
|
|
814
814
|
for (const selection of fieldNode.selectionSet.selections) {
|
|
815
|
-
if (selection.kind === Kind.INLINE_FRAGMENT) {
|
|
816
|
-
|
|
815
|
+
if (selection.kind === Kind.INLINE_FRAGMENT || selection.kind === Kind.FRAGMENT_SPREAD) {
|
|
816
|
+
fragmentSelections.push(selection);
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
}
|
|
@@ -834,7 +834,7 @@ function createDelegationPlanBuilder(mergedTypeInfo) {
|
|
|
834
834
|
value: "__typename"
|
|
835
835
|
}
|
|
836
836
|
});
|
|
837
|
-
existingSelections.push(...
|
|
837
|
+
existingSelections.push(...fragmentSelections);
|
|
838
838
|
added = true;
|
|
839
839
|
break;
|
|
840
840
|
}
|
|
@@ -857,7 +857,7 @@ function createDelegationPlanBuilder(mergedTypeInfo) {
|
|
|
857
857
|
value: "__typename"
|
|
858
858
|
}
|
|
859
859
|
},
|
|
860
|
-
...
|
|
860
|
+
...fragmentSelections
|
|
861
861
|
]
|
|
862
862
|
});
|
|
863
863
|
delegationMaps.push(delegationStageToFetchTypeName);
|
|
@@ -1366,6 +1366,7 @@ function completeStitchingInfo(stitchingInfo, resolvers, schema) {
|
|
|
1366
1366
|
const fieldNodeMap = /* @__PURE__ */ Object.create(null);
|
|
1367
1367
|
for (const typeName in selectionSetsByField) {
|
|
1368
1368
|
const type = schema.getType(typeName);
|
|
1369
|
+
const typeNames = isInterfaceType(type) ? [typeName, ...schema.getPossibleTypes(type).map((t) => t.name)] : [typeName];
|
|
1369
1370
|
for (const fieldName in selectionSetsByField[typeName]) {
|
|
1370
1371
|
for (const selectionSet of selectionSetsByField[typeName][fieldName]) {
|
|
1371
1372
|
const { fields } = collectFields(
|
|
@@ -1378,13 +1379,11 @@ function completeStitchingInfo(stitchingInfo, resolvers, schema) {
|
|
|
1378
1379
|
for (const [, fieldNodes] of fields) {
|
|
1379
1380
|
for (const fieldNode of fieldNodes) {
|
|
1380
1381
|
const key = print(fieldNode);
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
updateArrayMap(fieldNodesByField, typeName, fieldName, fieldNode);
|
|
1384
|
-
} else {
|
|
1382
|
+
fieldNodeMap[key] ??= fieldNode;
|
|
1383
|
+
for (const name of typeNames) {
|
|
1385
1384
|
updateArrayMap(
|
|
1386
1385
|
fieldNodesByField,
|
|
1387
|
-
|
|
1386
|
+
name,
|
|
1388
1387
|
fieldName,
|
|
1389
1388
|
fieldNodeMap[key]
|
|
1390
1389
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/stitch",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.5-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@graphql-tools/batch-delegate": "
|
|
42
|
-
"@graphql-tools/delegate": "
|
|
41
|
+
"@graphql-tools/batch-delegate": "10.1.7-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46",
|
|
42
|
+
"@graphql-tools/delegate": "12.3.5-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46",
|
|
43
43
|
"@graphql-tools/executor": "^2.0.1",
|
|
44
44
|
"@graphql-tools/merge": "^9.2.4",
|
|
45
45
|
"@graphql-tools/schema": "^10.1.1",
|
|
46
46
|
"@graphql-tools/utils": "^12.1.0",
|
|
47
|
-
"@graphql-tools/wrap": "
|
|
47
|
+
"@graphql-tools/wrap": "11.2.7-alpha-47b3616bea031cb73fd4642fd35bb86e53909b46",
|
|
48
48
|
"@whatwg-node/promise-helpers": "^1.3.2",
|
|
49
49
|
"tslib": "^2.8.1"
|
|
50
50
|
},
|