@wundergraph/composition 0.48.2 → 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 +9 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/composition-version.js +1 -1
- package/dist/v1/federation/federation-factory.d.ts +1 -1
- package/dist/v1/federation/federation-factory.js +47 -43
- 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 +100 -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) {
|
|
@@ -2190,13 +2190,14 @@ class FederationFactory {
|
|
|
2190
2190
|
definitions: this.clientDefinitions,
|
|
2191
2191
|
}, { assumeValid: true, assumeValidSDL: true });
|
|
2192
2192
|
const subgraphConfigBySubgraphName = new Map();
|
|
2193
|
-
for (const
|
|
2194
|
-
subgraphConfigBySubgraphName.set(
|
|
2195
|
-
configurationDataByTypeName:
|
|
2196
|
-
directiveDefinitionByName:
|
|
2197
|
-
isVersionTwo:
|
|
2198
|
-
parentDefinitionDataByTypeName:
|
|
2199
|
-
schema:
|
|
2193
|
+
for (const { configurationDataByTypeName, directiveDefinitionByName, isVersionTwo, name, parentDefinitionDataByTypeName, schema, schemaNode, } of this.internalSubgraphBySubgraphName.values()) {
|
|
2194
|
+
subgraphConfigBySubgraphName.set(name, {
|
|
2195
|
+
configurationDataByTypeName: configurationDataByTypeName,
|
|
2196
|
+
directiveDefinitionByName: directiveDefinitionByName,
|
|
2197
|
+
isVersionTwo: isVersionTwo,
|
|
2198
|
+
parentDefinitionDataByTypeName: parentDefinitionDataByTypeName,
|
|
2199
|
+
schema: schema,
|
|
2200
|
+
schemaNode,
|
|
2200
2201
|
});
|
|
2201
2202
|
}
|
|
2202
2203
|
for (const authorizationData of this.authorizationDataByParentTypeName.values()) {
|
|
@@ -2232,7 +2233,7 @@ class FederationFactory {
|
|
|
2232
2233
|
continue;
|
|
2233
2234
|
}
|
|
2234
2235
|
if (!tagNames.isDisjointFrom(childTagData.tagNames)) {
|
|
2235
|
-
(0, utils_6.getValueOrDefault)(childData.persistedDirectivesData.
|
|
2236
|
+
(0, utils_6.getValueOrDefault)(childData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2236
2237
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2237
2238
|
]);
|
|
2238
2239
|
this.inaccessibleCoords.add(`${parentDefinitionData.name}.${childName}`);
|
|
@@ -2240,7 +2241,7 @@ class FederationFactory {
|
|
|
2240
2241
|
}
|
|
2241
2242
|
}
|
|
2242
2243
|
if (accessibleChildren < 1) {
|
|
2243
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2244
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2244
2245
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2245
2246
|
]);
|
|
2246
2247
|
this.inaccessibleCoords.add(parentDefinitionData.name);
|
|
@@ -2255,7 +2256,7 @@ class FederationFactory {
|
|
|
2255
2256
|
}
|
|
2256
2257
|
const childTagData = childTagDataByChildName.get(childName);
|
|
2257
2258
|
if (!childTagData || tagNames.isDisjointFrom(childTagData.tagNames)) {
|
|
2258
|
-
(0, utils_6.getValueOrDefault)(childData.persistedDirectivesData.
|
|
2259
|
+
(0, utils_6.getValueOrDefault)(childData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2259
2260
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2260
2261
|
]);
|
|
2261
2262
|
this.inaccessibleCoords.add(`${parentDefinitionData.name}.${childName}`);
|
|
@@ -2263,7 +2264,7 @@ class FederationFactory {
|
|
|
2263
2264
|
}
|
|
2264
2265
|
}
|
|
2265
2266
|
if (accessibleChildren < 1) {
|
|
2266
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2267
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2267
2268
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2268
2269
|
]);
|
|
2269
2270
|
this.inaccessibleCoords.add(parentDefinitionData.name);
|
|
@@ -2282,7 +2283,7 @@ class FederationFactory {
|
|
|
2282
2283
|
continue;
|
|
2283
2284
|
}
|
|
2284
2285
|
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(parentTagData.tagNames)) {
|
|
2285
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2286
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2286
2287
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2287
2288
|
]);
|
|
2288
2289
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2315,7 +2316,7 @@ class FederationFactory {
|
|
|
2315
2316
|
continue;
|
|
2316
2317
|
}
|
|
2317
2318
|
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(childTagData.tagNames)) {
|
|
2318
|
-
(0, utils_6.getValueOrDefault)(fieldData.persistedDirectivesData.
|
|
2319
|
+
(0, utils_6.getValueOrDefault)(fieldData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2319
2320
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2320
2321
|
]);
|
|
2321
2322
|
this.inaccessibleCoords.add(fieldData.federatedCoords);
|
|
@@ -2328,13 +2329,15 @@ class FederationFactory {
|
|
|
2328
2329
|
continue;
|
|
2329
2330
|
}
|
|
2330
2331
|
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(argTagNames)) {
|
|
2331
|
-
(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
|
+
]);
|
|
2332
2335
|
this.inaccessibleCoords.add(inputValueData.federatedCoords);
|
|
2333
2336
|
}
|
|
2334
2337
|
}
|
|
2335
2338
|
}
|
|
2336
2339
|
if (accessibleFields < 1) {
|
|
2337
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2340
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2338
2341
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2339
2342
|
]);
|
|
2340
2343
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2350,7 +2353,7 @@ class FederationFactory {
|
|
|
2350
2353
|
}
|
|
2351
2354
|
const parentTagData = this.parentTagDataByTypeName.get(parentTypeName);
|
|
2352
2355
|
if (!parentTagData) {
|
|
2353
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2356
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2354
2357
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2355
2358
|
]);
|
|
2356
2359
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2361,7 +2364,7 @@ class FederationFactory {
|
|
|
2361
2364
|
continue;
|
|
2362
2365
|
}
|
|
2363
2366
|
if (parentTagData.childTagDataByChildName.size < 1) {
|
|
2364
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2367
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2365
2368
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2366
2369
|
]);
|
|
2367
2370
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2388,7 +2391,7 @@ class FederationFactory {
|
|
|
2388
2391
|
}
|
|
2389
2392
|
const childTagData = parentTagData.childTagDataByChildName.get(fieldName);
|
|
2390
2393
|
if (!childTagData || contractTagOptions.tagNamesToInclude.isDisjointFrom(childTagData.tagNames)) {
|
|
2391
|
-
(0, utils_6.getValueOrDefault)(fieldData.persistedDirectivesData.
|
|
2394
|
+
(0, utils_6.getValueOrDefault)(fieldData.persistedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2392
2395
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2393
2396
|
]);
|
|
2394
2397
|
this.inaccessibleCoords.add(fieldData.federatedCoords);
|
|
@@ -2396,7 +2399,7 @@ class FederationFactory {
|
|
|
2396
2399
|
}
|
|
2397
2400
|
}
|
|
2398
2401
|
if (accessibleFields < 1) {
|
|
2399
|
-
parentDefinitionData.persistedDirectivesData.
|
|
2402
|
+
parentDefinitionData.persistedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2400
2403
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2401
2404
|
]);
|
|
2402
2405
|
this.inaccessibleCoords.add(parentTypeName);
|
|
@@ -2426,13 +2429,14 @@ class FederationFactory {
|
|
|
2426
2429
|
definitions: this.clientDefinitions,
|
|
2427
2430
|
}, { assumeValid: true, assumeValidSDL: true });
|
|
2428
2431
|
const subgraphConfigBySubgraphName = new Map();
|
|
2429
|
-
for (const
|
|
2430
|
-
subgraphConfigBySubgraphName.set(
|
|
2431
|
-
configurationDataByTypeName
|
|
2432
|
-
directiveDefinitionByName
|
|
2433
|
-
isVersionTwo
|
|
2434
|
-
parentDefinitionDataByTypeName
|
|
2435
|
-
schema
|
|
2432
|
+
for (const { configurationDataByTypeName, directiveDefinitionByName, isVersionTwo, name, parentDefinitionDataByTypeName, schema, schemaNode, } of this.internalSubgraphBySubgraphName.values()) {
|
|
2433
|
+
subgraphConfigBySubgraphName.set(name, {
|
|
2434
|
+
configurationDataByTypeName,
|
|
2435
|
+
directiveDefinitionByName,
|
|
2436
|
+
isVersionTwo,
|
|
2437
|
+
parentDefinitionDataByTypeName,
|
|
2438
|
+
schema,
|
|
2439
|
+
schemaNode,
|
|
2436
2440
|
});
|
|
2437
2441
|
}
|
|
2438
2442
|
for (const authorizationData of this.authorizationDataByParentTypeName.values()) {
|