@graphql-tools/stitch 9.4.16 → 9.4.17-alpha-552d52f205b8f09d8b98794a5f2fdec9d5b5b3be
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 +11 -0
- package/dist/index.cjs +24 -29
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -31
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @graphql-tools/stitch
|
|
2
2
|
|
|
3
|
+
## 9.4.17-alpha-552d52f205b8f09d8b98794a5f2fdec9d5b5b3be
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#614](https://github.com/graphql-hive/gateway/pull/614) [`552d52f`](https://github.com/graphql-hive/gateway/commit/552d52f205b8f09d8b98794a5f2fdec9d5b5b3be) Thanks [@ardatan](https://github.com/ardatan)! - Fix a bug while isolating computed abstract type fields
|
|
8
|
+
|
|
9
|
+
When a field in an interface needs to be isolated,
|
|
10
|
+
it should not remove the field from the base subschema if it is used by other members of the base subschema.
|
|
11
|
+
|
|
12
|
+
- [#614](https://github.com/graphql-hive/gateway/pull/614) [`552d52f`](https://github.com/graphql-hive/gateway/commit/552d52f205b8f09d8b98794a5f2fdec9d5b5b3be) Thanks [@ardatan](https://github.com/ardatan)! - While calculating the best subschema for a selection set, respect fragments
|
|
13
|
+
|
|
3
14
|
## 9.4.16
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -367,7 +367,7 @@ function calculateDelegationStage(mergedTypeInfo, sourceSubschemas, targetSubsch
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
if (delegationMap.size > 1) {
|
|
370
|
-
optimizeDelegationMap(delegationMap, mergedTypeInfo.typeName);
|
|
370
|
+
optimizeDelegationMap(delegationMap, mergedTypeInfo.typeName, fragments);
|
|
371
371
|
}
|
|
372
372
|
return {
|
|
373
373
|
delegationMap,
|
|
@@ -552,7 +552,7 @@ function createDelegationPlanBuilder(mergedTypeInfo) {
|
|
|
552
552
|
);
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
|
-
function optimizeDelegationMap(delegationMap, typeName) {
|
|
555
|
+
function optimizeDelegationMap(delegationMap, typeName, fragments) {
|
|
556
556
|
for (const [subschema, selectionSet] of delegationMap) {
|
|
557
557
|
for (const [subschema2, selectionSet2] of delegationMap) {
|
|
558
558
|
if (subschema === subschema2) {
|
|
@@ -563,7 +563,8 @@ function optimizeDelegationMap(delegationMap, typeName) {
|
|
|
563
563
|
// Unfortunately, getType returns GraphQLNamedType, but we already know the type is a GraphQLObjectType, so we can cast it.
|
|
564
564
|
subschema2.transformedSchema.getType(typeName),
|
|
565
565
|
selectionSet,
|
|
566
|
-
() => true
|
|
566
|
+
() => true,
|
|
567
|
+
fragments
|
|
567
568
|
);
|
|
568
569
|
if (!unavailableFields.length) {
|
|
569
570
|
delegationMap.set(subschema2, {
|
|
@@ -1052,7 +1053,8 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1052
1053
|
if (keyFieldNames.length === 0) {
|
|
1053
1054
|
if (mergedTypeConfig.selectionSet) {
|
|
1054
1055
|
const parsedSelectionSet = utils.parseSelectionSet(
|
|
1055
|
-
mergedTypeConfig.selectionSet
|
|
1056
|
+
mergedTypeConfig.selectionSet,
|
|
1057
|
+
{ noLocation: true }
|
|
1056
1058
|
);
|
|
1057
1059
|
const keyFields = utils.collectFields(
|
|
1058
1060
|
subschemaConfig.schema,
|
|
@@ -1066,7 +1068,8 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1066
1068
|
for (const entryPoint of mergedTypeConfig.entryPoints ?? []) {
|
|
1067
1069
|
if (entryPoint.selectionSet) {
|
|
1068
1070
|
const parsedSelectionSet = utils.parseSelectionSet(
|
|
1069
|
-
entryPoint.selectionSet
|
|
1071
|
+
entryPoint.selectionSet,
|
|
1072
|
+
{ noLocation: true }
|
|
1070
1073
|
);
|
|
1071
1074
|
const keyFields = utils.collectFields(
|
|
1072
1075
|
subschemaConfig.schema,
|
|
@@ -1122,7 +1125,8 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1122
1125
|
if (returnTypeSelectionSet) {
|
|
1123
1126
|
const keyFieldNames2 = [];
|
|
1124
1127
|
const parsedSelectionSet = utils.parseSelectionSet(
|
|
1125
|
-
returnTypeSelectionSet
|
|
1128
|
+
returnTypeSelectionSet,
|
|
1129
|
+
{ noLocation: true }
|
|
1126
1130
|
);
|
|
1127
1131
|
const keyFields = utils.collectFields(
|
|
1128
1132
|
subschemaConfig.schema,
|
|
@@ -1135,7 +1139,8 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1135
1139
|
for (const entryPoint of returnTypeMergeConfig.entryPoints ?? []) {
|
|
1136
1140
|
if (entryPoint.selectionSet) {
|
|
1137
1141
|
const parsedSelectionSet2 = utils.parseSelectionSet(
|
|
1138
|
-
entryPoint.selectionSet
|
|
1142
|
+
entryPoint.selectionSet,
|
|
1143
|
+
{ noLocation: true }
|
|
1139
1144
|
);
|
|
1140
1145
|
const keyFields2 = utils.collectFields(
|
|
1141
1146
|
subschemaConfig.schema,
|
|
@@ -1195,10 +1200,7 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1195
1200
|
}
|
|
1196
1201
|
if (Object.keys(isolatedSchemaTypes).length) {
|
|
1197
1202
|
return [
|
|
1198
|
-
filterIsolatedSubschema(
|
|
1199
|
-
...subschemaConfig,
|
|
1200
|
-
merge: isolatedSchemaTypes
|
|
1201
|
-
}),
|
|
1203
|
+
filterIsolatedSubschema(subschemaConfig, isolatedSchemaTypes),
|
|
1202
1204
|
filterBaseSubschema(
|
|
1203
1205
|
{ ...subschemaConfig, merge: baseSchemaTypes },
|
|
1204
1206
|
isolatedSchemaTypes
|
|
@@ -1260,7 +1262,7 @@ function filterBaseSubschema(subschemaConfig, isolatedSchemaTypes) {
|
|
|
1260
1262
|
}
|
|
1261
1263
|
}
|
|
1262
1264
|
const allTypes = [typeName, ...iFacesForType];
|
|
1263
|
-
const isIsolatedFieldName = allTypes.
|
|
1265
|
+
const isIsolatedFieldName = allTypes.every(
|
|
1264
1266
|
(implementingTypeName) => isIsolatedField(implementingTypeName, fieldName, isolatedSchemaTypes)
|
|
1265
1267
|
);
|
|
1266
1268
|
const isKeyFieldName = allTypes.some(
|
|
@@ -1291,7 +1293,7 @@ function filterBaseSubschema(subschemaConfig, isolatedSchemaTypes) {
|
|
|
1291
1293
|
...iFacesForType,
|
|
1292
1294
|
...typesForInterface[typeName]
|
|
1293
1295
|
];
|
|
1294
|
-
const isIsolatedFieldName = allTypes.
|
|
1296
|
+
const isIsolatedFieldName = allTypes.every(
|
|
1295
1297
|
(implementingTypeName) => isIsolatedField(implementingTypeName, fieldName, isolatedSchemaTypes)
|
|
1296
1298
|
);
|
|
1297
1299
|
const isKeyFieldName = allTypes.some(
|
|
@@ -1334,12 +1336,13 @@ function filterBaseSubschema(subschemaConfig, isolatedSchemaTypes) {
|
|
|
1334
1336
|
}
|
|
1335
1337
|
return filteredSubschema;
|
|
1336
1338
|
}
|
|
1337
|
-
function filterIsolatedSubschema(subschemaConfig,
|
|
1339
|
+
function filterIsolatedSubschema(subschemaConfig, isolatedSchemaTypes) {
|
|
1340
|
+
const computedFieldTypes = {};
|
|
1338
1341
|
const queryRootFields = {};
|
|
1339
1342
|
function listReachableTypesToIsolate(subschemaConfig2, type, typeNames = /* @__PURE__ */ new Set()) {
|
|
1340
1343
|
if (graphql.isScalarType(type)) {
|
|
1341
1344
|
return typeNames;
|
|
1342
|
-
} else if ((graphql.isObjectType(type) || graphql.isInterfaceType(type)) && subschemaConfig2.merge?.[type.name]
|
|
1345
|
+
} else if ((graphql.isObjectType(type) || graphql.isInterfaceType(type)) && subschemaConfig2.merge?.[type.name]) {
|
|
1343
1346
|
typeNames.add(type.name);
|
|
1344
1347
|
return typeNames;
|
|
1345
1348
|
} else if (graphql.isCompositeType(type)) {
|
|
@@ -1450,9 +1453,7 @@ function filterIsolatedSubschema(subschemaConfig, computedFieldTypes = {}) {
|
|
|
1450
1453
|
if (computedFieldTypes[fieldType.name]) {
|
|
1451
1454
|
return true;
|
|
1452
1455
|
}
|
|
1453
|
-
return subschemaConfig.merge[typeName] == null || subschemaConfig.merge[typeName]?.fields?.[fieldName] != null || (
|
|
1454
|
-
fieldName
|
|
1455
|
-
);
|
|
1456
|
+
return subschemaConfig.merge?.[typeName] == null || subschemaConfig.merge[typeName]?.fields?.[fieldName] != null || (isolatedSchemaTypes[typeName]?.keyFieldNames ?? []).includes(fieldName);
|
|
1456
1457
|
},
|
|
1457
1458
|
interfaceFieldFilter: (typeName, fieldName, config) => {
|
|
1458
1459
|
if (computedFieldTypes[typeName]) {
|
|
@@ -1472,12 +1473,8 @@ function filterIsolatedSubschema(subschemaConfig, computedFieldTypes = {}) {
|
|
|
1472
1473
|
return true;
|
|
1473
1474
|
}
|
|
1474
1475
|
const isIsolatedFieldName = typesForInterface[typeName].some(
|
|
1475
|
-
(implementingTypeName) => isIsolatedField(
|
|
1476
|
-
|
|
1477
|
-
fieldName,
|
|
1478
|
-
subschemaConfig.merge
|
|
1479
|
-
)
|
|
1480
|
-
) || subschemaConfig.merge[typeName]?.fields?.[fieldName] != null;
|
|
1476
|
+
(implementingTypeName) => isIsolatedField(implementingTypeName, fieldName, isolatedSchemaTypes)
|
|
1477
|
+
) || subschemaConfig.merge?.[typeName]?.fields?.[fieldName] != null;
|
|
1481
1478
|
const isComputedFieldType = typesForInterface[typeName].some(
|
|
1482
1479
|
(implementingTypeName) => {
|
|
1483
1480
|
if (computedFieldTypes[implementingTypeName]) {
|
|
@@ -1495,15 +1492,13 @@ function filterIsolatedSubschema(subschemaConfig, computedFieldTypes = {}) {
|
|
|
1495
1492
|
}
|
|
1496
1493
|
);
|
|
1497
1494
|
return isIsolatedFieldName || isComputedFieldType || typesForInterface[typeName].some(
|
|
1498
|
-
(implementingTypeName) => (
|
|
1499
|
-
) || (
|
|
1500
|
-
fieldName
|
|
1501
|
-
);
|
|
1495
|
+
(implementingTypeName) => (isolatedSchemaTypes?.[implementingTypeName]?.keyFieldNames ?? []).includes(fieldName)
|
|
1496
|
+
) || (isolatedSchemaTypes[typeName]?.keyFieldNames ?? []).includes(fieldName);
|
|
1502
1497
|
}
|
|
1503
1498
|
});
|
|
1504
1499
|
const merge = Object.fromEntries(
|
|
1505
1500
|
// get rid of keyFieldNames again
|
|
1506
|
-
Object.entries(
|
|
1501
|
+
Object.entries(isolatedSchemaTypes).map(
|
|
1507
1502
|
([typeName, { keyFieldNames, ...config }]) => [typeName, config]
|
|
1508
1503
|
)
|
|
1509
1504
|
);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldNode, SelectionSetNode,
|
|
1
|
+
import { FieldNode, SelectionSetNode, GraphQLSchema, GraphQLNamedType, GraphQLFieldConfig, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputFieldConfig, GraphQLInputObjectType, GraphQLEnumValueConfig, GraphQLEnumType, GraphQLOutputType, SelectionNode, FragmentDefinitionNode } from 'graphql';
|
|
2
2
|
import { SubschemaConfig, Subschema, MergedTypeResolverOptions, MergedTypeResolver } from '@graphql-tools/delegate';
|
|
3
3
|
import { IExecutableSchemaDefinition } from '@graphql-tools/schema';
|
|
4
4
|
import { TypeSource, Maybe, ExecutionRequest } from '@graphql-tools/utils';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldNode, SelectionSetNode,
|
|
1
|
+
import { FieldNode, SelectionSetNode, GraphQLSchema, GraphQLNamedType, GraphQLFieldConfig, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputFieldConfig, GraphQLInputObjectType, GraphQLEnumValueConfig, GraphQLEnumType, GraphQLOutputType, SelectionNode, FragmentDefinitionNode } from 'graphql';
|
|
2
2
|
import { SubschemaConfig, Subschema, MergedTypeResolverOptions, MergedTypeResolver } from '@graphql-tools/delegate';
|
|
3
3
|
import { IExecutableSchemaDefinition } from '@graphql-tools/schema';
|
|
4
4
|
import { TypeSource, Maybe, ExecutionRequest } from '@graphql-tools/utils';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { extractUnavailableFields, leftOverByDelegationPlan, extractUnavailableFieldsFromSelectionSet, delegateToSchema, cloneSubschemaConfig, isSubschemaConfig, defaultMergedResolver, Subschema } from '@graphql-tools/delegate';
|
|
2
2
|
import { mergeType, mergeInputType, mergeInterface, mergeUnion, mergeEnum, mergeScalar, mergeTypeDefs, mergeResolvers, mergeExtensions, applyExtensions } from '@graphql-tools/merge';
|
|
3
3
|
import { extendResolversFromInterfaces, addResolversToSchema, assertResolversPresent, makeExecutableSchema } from '@graphql-tools/schema';
|
|
4
|
-
import { collectSubFields, memoize2, memoize1, memoize3, parseSelectionSet, mapMaybePromise, isSome,
|
|
5
|
-
import { isAbstractType, Kind, getNamedType, GraphQLList,
|
|
4
|
+
import { collectSubFields, memoize2, memoize1, memoize3, parseSelectionSet, collectFields, mapMaybePromise, isSome, getImplementingTypes, getRootTypeNames, filterSchema, mergeDeep, getDescription, createNamedStub, createStub, getRootTypeMap, getRootTypes, inspect, rewireTypes, getOperationASTFromRequest, getDefinedRootType } from '@graphql-tools/utils';
|
|
5
|
+
import { isAbstractType, Kind, getNamedType, GraphQLList, isLeafType, isInputObjectType, isUnionType, print, isObjectType, isInterfaceType, isScalarType, isCompositeType, isNonNullType, isEnumType, isListType, getNullableType, isNullableType, GraphQLObjectType, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, GraphQLDirective, valueFromASTUntyped, getDirectiveValues, GraphQLDeprecatedDirective, DirectiveLocation, isNamedType, isIntrospectionType, isDirective, isSpecifiedScalarType, specifiedDirectives, GraphQLSchema, extendSchema } from 'graphql';
|
|
6
6
|
import { batchDelegateToSchema } from '@graphql-tools/batch-delegate';
|
|
7
7
|
import { FilterTypes, TransformCompositeFields, wrapSchema } from '@graphql-tools/wrap';
|
|
8
8
|
import { getFragmentsFromDocument } from '@graphql-tools/executor';
|
|
@@ -365,7 +365,7 @@ function calculateDelegationStage(mergedTypeInfo, sourceSubschemas, targetSubsch
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
if (delegationMap.size > 1) {
|
|
368
|
-
optimizeDelegationMap(delegationMap, mergedTypeInfo.typeName);
|
|
368
|
+
optimizeDelegationMap(delegationMap, mergedTypeInfo.typeName, fragments);
|
|
369
369
|
}
|
|
370
370
|
return {
|
|
371
371
|
delegationMap,
|
|
@@ -550,7 +550,7 @@ function createDelegationPlanBuilder(mergedTypeInfo) {
|
|
|
550
550
|
);
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
|
-
function optimizeDelegationMap(delegationMap, typeName) {
|
|
553
|
+
function optimizeDelegationMap(delegationMap, typeName, fragments) {
|
|
554
554
|
for (const [subschema, selectionSet] of delegationMap) {
|
|
555
555
|
for (const [subschema2, selectionSet2] of delegationMap) {
|
|
556
556
|
if (subschema === subschema2) {
|
|
@@ -561,7 +561,8 @@ function optimizeDelegationMap(delegationMap, typeName) {
|
|
|
561
561
|
// Unfortunately, getType returns GraphQLNamedType, but we already know the type is a GraphQLObjectType, so we can cast it.
|
|
562
562
|
subschema2.transformedSchema.getType(typeName),
|
|
563
563
|
selectionSet,
|
|
564
|
-
() => true
|
|
564
|
+
() => true,
|
|
565
|
+
fragments
|
|
565
566
|
);
|
|
566
567
|
if (!unavailableFields.length) {
|
|
567
568
|
delegationMap.set(subschema2, {
|
|
@@ -1050,7 +1051,8 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1050
1051
|
if (keyFieldNames.length === 0) {
|
|
1051
1052
|
if (mergedTypeConfig.selectionSet) {
|
|
1052
1053
|
const parsedSelectionSet = parseSelectionSet(
|
|
1053
|
-
mergedTypeConfig.selectionSet
|
|
1054
|
+
mergedTypeConfig.selectionSet,
|
|
1055
|
+
{ noLocation: true }
|
|
1054
1056
|
);
|
|
1055
1057
|
const keyFields = collectFields(
|
|
1056
1058
|
subschemaConfig.schema,
|
|
@@ -1064,7 +1066,8 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1064
1066
|
for (const entryPoint of mergedTypeConfig.entryPoints ?? []) {
|
|
1065
1067
|
if (entryPoint.selectionSet) {
|
|
1066
1068
|
const parsedSelectionSet = parseSelectionSet(
|
|
1067
|
-
entryPoint.selectionSet
|
|
1069
|
+
entryPoint.selectionSet,
|
|
1070
|
+
{ noLocation: true }
|
|
1068
1071
|
);
|
|
1069
1072
|
const keyFields = collectFields(
|
|
1070
1073
|
subschemaConfig.schema,
|
|
@@ -1120,7 +1123,8 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1120
1123
|
if (returnTypeSelectionSet) {
|
|
1121
1124
|
const keyFieldNames2 = [];
|
|
1122
1125
|
const parsedSelectionSet = parseSelectionSet(
|
|
1123
|
-
returnTypeSelectionSet
|
|
1126
|
+
returnTypeSelectionSet,
|
|
1127
|
+
{ noLocation: true }
|
|
1124
1128
|
);
|
|
1125
1129
|
const keyFields = collectFields(
|
|
1126
1130
|
subschemaConfig.schema,
|
|
@@ -1133,7 +1137,8 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1133
1137
|
for (const entryPoint of returnTypeMergeConfig.entryPoints ?? []) {
|
|
1134
1138
|
if (entryPoint.selectionSet) {
|
|
1135
1139
|
const parsedSelectionSet2 = parseSelectionSet(
|
|
1136
|
-
entryPoint.selectionSet
|
|
1140
|
+
entryPoint.selectionSet,
|
|
1141
|
+
{ noLocation: true }
|
|
1137
1142
|
);
|
|
1138
1143
|
const keyFields2 = collectFields(
|
|
1139
1144
|
subschemaConfig.schema,
|
|
@@ -1193,10 +1198,7 @@ function isolateComputedFieldsTransformer(subschemaConfig) {
|
|
|
1193
1198
|
}
|
|
1194
1199
|
if (Object.keys(isolatedSchemaTypes).length) {
|
|
1195
1200
|
return [
|
|
1196
|
-
filterIsolatedSubschema(
|
|
1197
|
-
...subschemaConfig,
|
|
1198
|
-
merge: isolatedSchemaTypes
|
|
1199
|
-
}),
|
|
1201
|
+
filterIsolatedSubschema(subschemaConfig, isolatedSchemaTypes),
|
|
1200
1202
|
filterBaseSubschema(
|
|
1201
1203
|
{ ...subschemaConfig, merge: baseSchemaTypes },
|
|
1202
1204
|
isolatedSchemaTypes
|
|
@@ -1258,7 +1260,7 @@ function filterBaseSubschema(subschemaConfig, isolatedSchemaTypes) {
|
|
|
1258
1260
|
}
|
|
1259
1261
|
}
|
|
1260
1262
|
const allTypes = [typeName, ...iFacesForType];
|
|
1261
|
-
const isIsolatedFieldName = allTypes.
|
|
1263
|
+
const isIsolatedFieldName = allTypes.every(
|
|
1262
1264
|
(implementingTypeName) => isIsolatedField(implementingTypeName, fieldName, isolatedSchemaTypes)
|
|
1263
1265
|
);
|
|
1264
1266
|
const isKeyFieldName = allTypes.some(
|
|
@@ -1289,7 +1291,7 @@ function filterBaseSubschema(subschemaConfig, isolatedSchemaTypes) {
|
|
|
1289
1291
|
...iFacesForType,
|
|
1290
1292
|
...typesForInterface[typeName]
|
|
1291
1293
|
];
|
|
1292
|
-
const isIsolatedFieldName = allTypes.
|
|
1294
|
+
const isIsolatedFieldName = allTypes.every(
|
|
1293
1295
|
(implementingTypeName) => isIsolatedField(implementingTypeName, fieldName, isolatedSchemaTypes)
|
|
1294
1296
|
);
|
|
1295
1297
|
const isKeyFieldName = allTypes.some(
|
|
@@ -1332,12 +1334,13 @@ function filterBaseSubschema(subschemaConfig, isolatedSchemaTypes) {
|
|
|
1332
1334
|
}
|
|
1333
1335
|
return filteredSubschema;
|
|
1334
1336
|
}
|
|
1335
|
-
function filterIsolatedSubschema(subschemaConfig,
|
|
1337
|
+
function filterIsolatedSubschema(subschemaConfig, isolatedSchemaTypes) {
|
|
1338
|
+
const computedFieldTypes = {};
|
|
1336
1339
|
const queryRootFields = {};
|
|
1337
1340
|
function listReachableTypesToIsolate(subschemaConfig2, type, typeNames = /* @__PURE__ */ new Set()) {
|
|
1338
1341
|
if (isScalarType(type)) {
|
|
1339
1342
|
return typeNames;
|
|
1340
|
-
} else if ((isObjectType(type) || isInterfaceType(type)) && subschemaConfig2.merge?.[type.name]
|
|
1343
|
+
} else if ((isObjectType(type) || isInterfaceType(type)) && subschemaConfig2.merge?.[type.name]) {
|
|
1341
1344
|
typeNames.add(type.name);
|
|
1342
1345
|
return typeNames;
|
|
1343
1346
|
} else if (isCompositeType(type)) {
|
|
@@ -1448,9 +1451,7 @@ function filterIsolatedSubschema(subschemaConfig, computedFieldTypes = {}) {
|
|
|
1448
1451
|
if (computedFieldTypes[fieldType.name]) {
|
|
1449
1452
|
return true;
|
|
1450
1453
|
}
|
|
1451
|
-
return subschemaConfig.merge[typeName] == null || subschemaConfig.merge[typeName]?.fields?.[fieldName] != null || (
|
|
1452
|
-
fieldName
|
|
1453
|
-
);
|
|
1454
|
+
return subschemaConfig.merge?.[typeName] == null || subschemaConfig.merge[typeName]?.fields?.[fieldName] != null || (isolatedSchemaTypes[typeName]?.keyFieldNames ?? []).includes(fieldName);
|
|
1454
1455
|
},
|
|
1455
1456
|
interfaceFieldFilter: (typeName, fieldName, config) => {
|
|
1456
1457
|
if (computedFieldTypes[typeName]) {
|
|
@@ -1470,12 +1471,8 @@ function filterIsolatedSubschema(subschemaConfig, computedFieldTypes = {}) {
|
|
|
1470
1471
|
return true;
|
|
1471
1472
|
}
|
|
1472
1473
|
const isIsolatedFieldName = typesForInterface[typeName].some(
|
|
1473
|
-
(implementingTypeName) => isIsolatedField(
|
|
1474
|
-
|
|
1475
|
-
fieldName,
|
|
1476
|
-
subschemaConfig.merge
|
|
1477
|
-
)
|
|
1478
|
-
) || subschemaConfig.merge[typeName]?.fields?.[fieldName] != null;
|
|
1474
|
+
(implementingTypeName) => isIsolatedField(implementingTypeName, fieldName, isolatedSchemaTypes)
|
|
1475
|
+
) || subschemaConfig.merge?.[typeName]?.fields?.[fieldName] != null;
|
|
1479
1476
|
const isComputedFieldType = typesForInterface[typeName].some(
|
|
1480
1477
|
(implementingTypeName) => {
|
|
1481
1478
|
if (computedFieldTypes[implementingTypeName]) {
|
|
@@ -1493,15 +1490,13 @@ function filterIsolatedSubschema(subschemaConfig, computedFieldTypes = {}) {
|
|
|
1493
1490
|
}
|
|
1494
1491
|
);
|
|
1495
1492
|
return isIsolatedFieldName || isComputedFieldType || typesForInterface[typeName].some(
|
|
1496
|
-
(implementingTypeName) => (
|
|
1497
|
-
) || (
|
|
1498
|
-
fieldName
|
|
1499
|
-
);
|
|
1493
|
+
(implementingTypeName) => (isolatedSchemaTypes?.[implementingTypeName]?.keyFieldNames ?? []).includes(fieldName)
|
|
1494
|
+
) || (isolatedSchemaTypes[typeName]?.keyFieldNames ?? []).includes(fieldName);
|
|
1500
1495
|
}
|
|
1501
1496
|
});
|
|
1502
1497
|
const merge = Object.fromEntries(
|
|
1503
1498
|
// get rid of keyFieldNames again
|
|
1504
|
-
Object.entries(
|
|
1499
|
+
Object.entries(isolatedSchemaTypes).map(
|
|
1505
1500
|
([typeName, { keyFieldNames, ...config }]) => [typeName, config]
|
|
1506
1501
|
)
|
|
1507
1502
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/stitch",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.17-alpha-552d52f205b8f09d8b98794a5f2fdec9d5b5b3be",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A set of utils for faster development of GraphQL tools",
|
|
6
6
|
"repository": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"dataloader": "^2.2.3",
|
|
52
52
|
"graphql": "^16.9.0",
|
|
53
|
-
"pkgroll": "2.
|
|
53
|
+
"pkgroll": "2.8.0"
|
|
54
54
|
},
|
|
55
55
|
"sideEffects": false
|
|
56
56
|
}
|