@wundergraph/composition 0.48.3 → 0.48.4
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/dist/federation/types.d.ts +3 -3
- package/dist/schema-building/types.d.ts +11 -11
- package/dist/schema-building/utils.d.ts +1 -1
- package/dist/schema-building/utils.js +17 -22
- package/dist/schema-building/utils.js.map +1 -1
- package/dist/subgraph/types.d.ts +4 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/composition-version.js +1 -1
- package/dist/v1/federation/federation-factory.js +31 -29
- package/dist/v1/federation/federation-factory.js.map +1 -1
- package/dist/v1/federation/params.d.ts +1 -2
- package/dist/v1/normalization/normalization-factory.d.ts +7 -7
- package/dist/v1/normalization/normalization-factory.js +99 -102
- package/dist/v1/normalization/normalization-factory.js.map +1 -1
- package/dist/v1/normalization/params.d.ts +1 -1
- package/dist/v1/normalization/walkers.js +10 -10
- package/dist/v1/normalization/walkers.js.map +1 -1
- package/package.json +2 -2
|
@@ -98,9 +98,9 @@ class FederationFactory {
|
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
default: {
|
|
101
|
-
const existingDirectives = data.
|
|
101
|
+
const existingDirectives = data.directivesByName.get(directiveName);
|
|
102
102
|
if (!existingDirectives) {
|
|
103
|
-
data.
|
|
103
|
+
data.directivesByName.set(directiveName, [...directiveNodes]);
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
// Only add one instance of certain directives.
|
|
@@ -355,7 +355,7 @@ class FederationFactory {
|
|
|
355
355
|
const targetData = existingData || this.copyEnumValueData(incomingData);
|
|
356
356
|
this.extractPersistedDirectives({
|
|
357
357
|
data: targetData.persistedDirectivesData,
|
|
358
|
-
directivesByName: incomingData.
|
|
358
|
+
directivesByName: incomingData.directivesByName,
|
|
359
359
|
});
|
|
360
360
|
const isValueInaccessible = (0, utils_5.isNodeDataInaccessible)(incomingData);
|
|
361
361
|
if (isParentInaccessible || isValueInaccessible) {
|
|
@@ -380,7 +380,7 @@ class FederationFactory {
|
|
|
380
380
|
const targetData = existingData || this.copyInputValueData(incomingData);
|
|
381
381
|
this.extractPersistedDirectives({
|
|
382
382
|
data: targetData.persistedDirectivesData,
|
|
383
|
-
directivesByName: incomingData.
|
|
383
|
+
directivesByName: incomingData.directivesByName,
|
|
384
384
|
});
|
|
385
385
|
this.recordTagNamesByCoords(targetData, `${parentCoords}.${targetData.name}`);
|
|
386
386
|
this.namedInputValueTypeNames.add(targetData.namedTypeName);
|
|
@@ -435,7 +435,7 @@ class FederationFactory {
|
|
|
435
435
|
this.inaccessibleCoords.add(inputValueData.federatedCoords);
|
|
436
436
|
}
|
|
437
437
|
handleSubscriptionFilterDirective(incomingData, targetData) {
|
|
438
|
-
const subscriptionFilters = incomingData.
|
|
438
|
+
const subscriptionFilters = incomingData.directivesByName.get(string_constants_1.SUBSCRIPTION_FILTER);
|
|
439
439
|
if (!subscriptionFilters) {
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
@@ -540,7 +540,7 @@ class FederationFactory {
|
|
|
540
540
|
this.handleSubscriptionFilterDirective(incomingData, targetData);
|
|
541
541
|
this.extractPersistedDirectives({
|
|
542
542
|
data: targetData.persistedDirectivesData,
|
|
543
|
-
directivesByName: incomingData.
|
|
543
|
+
directivesByName: incomingData.directivesByName,
|
|
544
544
|
});
|
|
545
545
|
const isFieldInaccessible = isParentInaccessible || (0, utils_5.isNodeDataInaccessible)(targetData);
|
|
546
546
|
if (isFieldInaccessible) {
|
|
@@ -627,12 +627,12 @@ class FederationFactory {
|
|
|
627
627
|
copyMutualParentDefinitionData(sourceData) {
|
|
628
628
|
return {
|
|
629
629
|
configureDescriptionDataBySubgraphName: (0, utils_6.copyObjectValueMap)(sourceData.configureDescriptionDataBySubgraphName),
|
|
630
|
-
|
|
630
|
+
directivesByName: (0, utils_6.copyArrayValueMap)(sourceData.directivesByName),
|
|
631
631
|
extensionType: sourceData.extensionType,
|
|
632
632
|
name: sourceData.name,
|
|
633
633
|
persistedDirectivesData: this.extractPersistedDirectives({
|
|
634
634
|
data: (0, utils_5.newPersistedDirectivesData)(),
|
|
635
|
-
directivesByName: sourceData.
|
|
635
|
+
directivesByName: sourceData.directivesByName,
|
|
636
636
|
}),
|
|
637
637
|
description: (0, utils_5.getInitialFederatedDescription)(sourceData),
|
|
638
638
|
};
|
|
@@ -642,7 +642,7 @@ class FederationFactory {
|
|
|
642
642
|
appearances: sourceData.appearances,
|
|
643
643
|
configureDescriptionDataBySubgraphName: (0, utils_6.copyObjectValueMap)(sourceData.configureDescriptionDataBySubgraphName),
|
|
644
644
|
federatedCoords: sourceData.federatedCoords,
|
|
645
|
-
|
|
645
|
+
directivesByName: (0, utils_6.copyArrayValueMap)(sourceData.directivesByName),
|
|
646
646
|
kind: sourceData.kind,
|
|
647
647
|
name: sourceData.name,
|
|
648
648
|
node: {
|
|
@@ -653,7 +653,7 @@ class FederationFactory {
|
|
|
653
653
|
parentTypeName: sourceData.parentTypeName,
|
|
654
654
|
persistedDirectivesData: this.extractPersistedDirectives({
|
|
655
655
|
data: (0, utils_5.newPersistedDirectivesData)(),
|
|
656
|
-
directivesByName: sourceData.
|
|
656
|
+
directivesByName: sourceData.directivesByName,
|
|
657
657
|
}),
|
|
658
658
|
subgraphNames: new Set(sourceData.subgraphNames),
|
|
659
659
|
description: (0, utils_5.getInitialFederatedDescription)(sourceData),
|
|
@@ -662,7 +662,7 @@ class FederationFactory {
|
|
|
662
662
|
copyInputValueData(sourceData) {
|
|
663
663
|
return {
|
|
664
664
|
configureDescriptionDataBySubgraphName: (0, utils_6.copyObjectValueMap)(sourceData.configureDescriptionDataBySubgraphName),
|
|
665
|
-
|
|
665
|
+
directivesByName: (0, utils_6.copyArrayValueMap)(sourceData.directivesByName),
|
|
666
666
|
federatedCoords: sourceData.federatedCoords,
|
|
667
667
|
fieldName: sourceData.fieldName,
|
|
668
668
|
includeDefaultValue: sourceData.includeDefaultValue,
|
|
@@ -681,7 +681,7 @@ class FederationFactory {
|
|
|
681
681
|
originalParentTypeName: sourceData.originalParentTypeName,
|
|
682
682
|
persistedDirectivesData: this.extractPersistedDirectives({
|
|
683
683
|
data: (0, utils_5.newPersistedDirectivesData)(),
|
|
684
|
-
directivesByName: sourceData.
|
|
684
|
+
directivesByName: sourceData.directivesByName,
|
|
685
685
|
}),
|
|
686
686
|
renamedParentTypeName: sourceData.renamedParentTypeName,
|
|
687
687
|
requiredSubgraphNames: new Set(sourceData.requiredSubgraphNames),
|
|
@@ -707,7 +707,7 @@ class FederationFactory {
|
|
|
707
707
|
return {
|
|
708
708
|
argumentDataByName: this.copyInputValueDataByValueName(sourceData.argumentDataByName, isInaccessible, sourceData.federatedCoords),
|
|
709
709
|
configureDescriptionDataBySubgraphName: (0, utils_6.copyObjectValueMap)(sourceData.configureDescriptionDataBySubgraphName),
|
|
710
|
-
|
|
710
|
+
directivesByName: (0, utils_6.copyArrayValueMap)(sourceData.directivesByName),
|
|
711
711
|
externalFieldDataBySubgraphName: (0, utils_6.copyObjectValueMap)(sourceData.externalFieldDataBySubgraphName),
|
|
712
712
|
federatedCoords: sourceData.federatedCoords,
|
|
713
713
|
// Intentionally reset; only the subgraph fields involve directive inheritance
|
|
@@ -729,7 +729,7 @@ class FederationFactory {
|
|
|
729
729
|
originalParentTypeName: sourceData.originalParentTypeName,
|
|
730
730
|
persistedDirectivesData: this.extractPersistedDirectives({
|
|
731
731
|
data: (0, utils_5.newPersistedDirectivesData)(),
|
|
732
|
-
directivesByName: sourceData.
|
|
732
|
+
directivesByName: sourceData.directivesByName,
|
|
733
733
|
}),
|
|
734
734
|
renamedParentTypeName: sourceData.renamedParentTypeName,
|
|
735
735
|
subgraphNames: new Set(sourceData.subgraphNames),
|
|
@@ -866,7 +866,7 @@ class FederationFactory {
|
|
|
866
866
|
}
|
|
867
867
|
this.extractPersistedDirectives({
|
|
868
868
|
data: existingData.persistedDirectivesData,
|
|
869
|
-
directivesByName: incomingData.
|
|
869
|
+
directivesByName: incomingData.directivesByName,
|
|
870
870
|
});
|
|
871
871
|
return existingData;
|
|
872
872
|
}
|
|
@@ -1357,7 +1357,7 @@ class FederationFactory {
|
|
|
1357
1357
|
getValidFlattenedPersistedDirectiveNodeArray(data) {
|
|
1358
1358
|
const coords = (0, utils_3.getNodeCoords)(data);
|
|
1359
1359
|
const persistedDirectiveNodes = [];
|
|
1360
|
-
for (const [directiveName, directiveNodes] of data.persistedDirectivesData.
|
|
1360
|
+
for (const [directiveName, directiveNodes] of data.persistedDirectivesData.directivesByName) {
|
|
1361
1361
|
if (directiveName === string_constants_1.SEMANTIC_NON_NULL && (0, utils_5.isFieldData)(data)) {
|
|
1362
1362
|
persistedDirectiveNodes.push((0, utils_6.generateSemanticNonNullDirective)((0, utils_6.getFirstEntry)(data.nullLevelsBySubgraphName) ?? new Set([0])));
|
|
1363
1363
|
continue;
|
|
@@ -1484,7 +1484,7 @@ class FederationFactory {
|
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
1486
|
validateOneOfDirective({ data, inputValueNodes, requiredFieldNames }) {
|
|
1487
|
-
if (!data.
|
|
1487
|
+
if (!data.directivesByName.has(string_constants_1.ONE_OF)) {
|
|
1488
1488
|
return true;
|
|
1489
1489
|
}
|
|
1490
1490
|
if (requiredFieldNames.size > 0) {
|
|
@@ -2233,7 +2233,7 @@ class FederationFactory {
|
|
|
2233
2233
|
continue;
|
|
2234
2234
|
}
|
|
2235
2235
|
if (!tagNames.isDisjointFrom(childTagData.tagNames)) {
|
|
2236
|
-
(0, utils_6.getValueOrDefault)(childData.persistedDirectivesData.
|
|
2236
|
+
(0, utils_6.getValueOrDefault)(childData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2237
2237
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2238
2238
|
]);
|
|
2239
2239
|
this.inaccessibleCoords.add(`${parentDefinitionData.name}.${childName}`);
|
|
@@ -2241,7 +2241,7 @@ class FederationFactory {
|
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
2243
|
if (accessibleChildren < 1) {
|
|
2244
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2244
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2245
2245
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2246
2246
|
]);
|
|
2247
2247
|
this.inaccessibleCoords.add(parentDefinitionData.name);
|
|
@@ -2256,7 +2256,7 @@ class FederationFactory {
|
|
|
2256
2256
|
}
|
|
2257
2257
|
const childTagData = childTagDataByChildName.get(childName);
|
|
2258
2258
|
if (!childTagData || tagNames.isDisjointFrom(childTagData.tagNames)) {
|
|
2259
|
-
(0, utils_6.getValueOrDefault)(childData.persistedDirectivesData.
|
|
2259
|
+
(0, utils_6.getValueOrDefault)(childData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2260
2260
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2261
2261
|
]);
|
|
2262
2262
|
this.inaccessibleCoords.add(`${parentDefinitionData.name}.${childName}`);
|
|
@@ -2264,7 +2264,7 @@ class FederationFactory {
|
|
|
2264
2264
|
}
|
|
2265
2265
|
}
|
|
2266
2266
|
if (accessibleChildren < 1) {
|
|
2267
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2267
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2268
2268
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2269
2269
|
]);
|
|
2270
2270
|
this.inaccessibleCoords.add(parentDefinitionData.name);
|
|
@@ -2283,7 +2283,7 @@ class FederationFactory {
|
|
|
2283
2283
|
continue;
|
|
2284
2284
|
}
|
|
2285
2285
|
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(parentTagData.tagNames)) {
|
|
2286
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2286
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2287
2287
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2288
2288
|
]);
|
|
2289
2289
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2316,7 +2316,7 @@ class FederationFactory {
|
|
|
2316
2316
|
continue;
|
|
2317
2317
|
}
|
|
2318
2318
|
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(childTagData.tagNames)) {
|
|
2319
|
-
(0, utils_6.getValueOrDefault)(fieldData.persistedDirectivesData.
|
|
2319
|
+
(0, utils_6.getValueOrDefault)(fieldData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2320
2320
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2321
2321
|
]);
|
|
2322
2322
|
this.inaccessibleCoords.add(fieldData.federatedCoords);
|
|
@@ -2329,13 +2329,15 @@ class FederationFactory {
|
|
|
2329
2329
|
continue;
|
|
2330
2330
|
}
|
|
2331
2331
|
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(argTagNames)) {
|
|
2332
|
-
(0, utils_6.getValueOrDefault)(inputValueData.persistedDirectivesData.
|
|
2332
|
+
(0, utils_6.getValueOrDefault)(inputValueData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2333
|
+
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2334
|
+
]);
|
|
2333
2335
|
this.inaccessibleCoords.add(inputValueData.federatedCoords);
|
|
2334
2336
|
}
|
|
2335
2337
|
}
|
|
2336
2338
|
}
|
|
2337
2339
|
if (accessibleFields < 1) {
|
|
2338
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2340
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2339
2341
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2340
2342
|
]);
|
|
2341
2343
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2351,7 +2353,7 @@ class FederationFactory {
|
|
|
2351
2353
|
}
|
|
2352
2354
|
const parentTagData = this.parentTagDataByTypeName.get(parentTypeName);
|
|
2353
2355
|
if (!parentTagData) {
|
|
2354
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2356
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2355
2357
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2356
2358
|
]);
|
|
2357
2359
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2362,7 +2364,7 @@ class FederationFactory {
|
|
|
2362
2364
|
continue;
|
|
2363
2365
|
}
|
|
2364
2366
|
if (parentTagData.childTagDataByChildName.size < 1) {
|
|
2365
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2367
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2366
2368
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2367
2369
|
]);
|
|
2368
2370
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2389,7 +2391,7 @@ class FederationFactory {
|
|
|
2389
2391
|
}
|
|
2390
2392
|
const childTagData = parentTagData.childTagDataByChildName.get(fieldName);
|
|
2391
2393
|
if (!childTagData || contractTagOptions.tagNamesToInclude.isDisjointFrom(childTagData.tagNames)) {
|
|
2392
|
-
(0, utils_6.getValueOrDefault)(fieldData.persistedDirectivesData.
|
|
2394
|
+
(0, utils_6.getValueOrDefault)(fieldData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2393
2395
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2394
2396
|
]);
|
|
2395
2397
|
this.inaccessibleCoords.add(fieldData.federatedCoords);
|
|
@@ -2397,7 +2399,7 @@ class FederationFactory {
|
|
|
2397
2399
|
}
|
|
2398
2400
|
}
|
|
2399
2401
|
if (accessibleFields < 1) {
|
|
2400
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2402
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2401
2403
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2402
2404
|
]);
|
|
2403
2405
|
this.inaccessibleCoords.add(parentTypeName);
|