@wundergraph/composition 0.59.0 → 0.63.0
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/ast/utils.d.ts +2 -0
- package/dist/ast/utils.js +4 -0
- package/dist/ast/utils.js.map +1 -1
- package/dist/directive-definition-data/directive-definition-data.d.ts +3 -0
- package/dist/directive-definition-data/directive-definition-data.js +82 -1
- package/dist/directive-definition-data/directive-definition-data.js.map +1 -1
- package/dist/errors/errors.d.ts +10 -3
- package/dist/errors/errors.js +82 -10
- package/dist/errors/errors.js.map +1 -1
- package/dist/errors/types/params.d.ts +4 -0
- package/dist/router-configuration/types.d.ts +26 -0
- package/dist/router-configuration/utils.d.ts +2 -1
- package/dist/router-configuration/utils.js +11 -0
- package/dist/router-configuration/utils.js.map +1 -1
- package/dist/schema-building/types/types.d.ts +1 -0
- package/dist/schema-building/utils.js +9 -10
- package/dist/schema-building/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/composition-version.js +1 -1
- package/dist/utils/string-constants.d.ts +9 -0
- package/dist/utils/string-constants.js +17 -4
- package/dist/utils/string-constants.js.map +1 -1
- package/dist/v1/constants/constants.js +3 -0
- package/dist/v1/constants/constants.js.map +1 -1
- package/dist/v1/constants/directive-definitions.d.ts +3 -0
- package/dist/v1/constants/directive-definitions.js +60 -1
- package/dist/v1/constants/directive-definitions.js.map +1 -1
- package/dist/v1/constants/type-nodes.d.ts +3 -1
- package/dist/v1/constants/type-nodes.js +6 -1
- package/dist/v1/constants/type-nodes.js.map +1 -1
- package/dist/v1/federation/federation-factory.d.ts +2 -2
- package/dist/v1/federation/federation-factory.js +62 -55
- package/dist/v1/federation/federation-factory.js.map +1 -1
- package/dist/v1/normalization/normalization-factory.d.ts +11 -6
- package/dist/v1/normalization/normalization-factory.js +275 -28
- package/dist/v1/normalization/normalization-factory.js.map +1 -1
- package/dist/v1/normalization/types/params.d.ts +8 -1
- package/dist/v1/normalization/types/results.d.ts +5 -0
- package/dist/v1/normalization/types/types.d.ts +74 -6
- package/dist/v1/normalization/utils.js +9 -1
- package/dist/v1/normalization/utils.js.map +1 -1
- package/dist/v1/utils/utils.d.ts +2 -1
- package/dist/v1/utils/utils.js +7 -0
- package/dist/v1/utils/utils.js.map +1 -1
- package/dist/v1/warnings/params.d.ts +6 -0
- package/dist/v1/warnings/warnings.d.ts +2 -1
- package/dist/v1/warnings/warnings.js +12 -0
- package/dist/v1/warnings/warnings.js.map +1 -1
- package/package.json +2 -2
|
@@ -2358,7 +2358,7 @@ class FederationFactory {
|
|
|
2358
2358
|
})).subscriptionFilterCondition = result.condition;
|
|
2359
2359
|
}
|
|
2360
2360
|
}
|
|
2361
|
-
mergeSubscriptionFilterTargetResults({ directiveNode,
|
|
2361
|
+
mergeSubscriptionFilterTargetResults({ abstractTypeData, directiveNode, directiveSubgraphName, targets, }) {
|
|
2362
2362
|
const aggregatedErrors = [];
|
|
2363
2363
|
let firstCondition = null;
|
|
2364
2364
|
for (const target of targets) {
|
|
@@ -2375,7 +2375,6 @@ class FederationFactory {
|
|
|
2375
2375
|
? (0, errors_1.subscriptionFilterUnionMemberInvalidError)(abstractTypeData.name, target.name, result.errors.map((error) => error.message).join(string_constants_1.LITERAL_NEW_LINE))
|
|
2376
2376
|
: (0, errors_1.subscriptionFilterInterfaceImplementationInvalidError)(abstractTypeData.name, target.name, result.errors.map((error) => error.message).join(string_constants_1.LITERAL_NEW_LINE));
|
|
2377
2377
|
aggregatedErrors.push(wrapped);
|
|
2378
|
-
continue;
|
|
2379
2378
|
}
|
|
2380
2379
|
if (firstCondition === null || aggregatedErrors.length > 0) {
|
|
2381
2380
|
return { errors: aggregatedErrors, success: false };
|
|
@@ -2531,13 +2530,21 @@ class FederationFactory {
|
|
|
2531
2530
|
** However, contracts require @inaccessible to exclude applicable tagged types. */
|
|
2532
2531
|
this.routerDefinitions.push(directive_definitions_1.INACCESSIBLE_DEFINITION);
|
|
2533
2532
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2533
|
+
const tagIntersection = contractTagOptions.tagNamesToExclude.intersection(contractTagOptions.tagNamesToInclude);
|
|
2534
|
+
if (tagIntersection.size > 0) {
|
|
2535
|
+
return {
|
|
2536
|
+
errors: [(0, errors_1.intersectingExcludeAndIncludeContractTagsError)([...tagIntersection])],
|
|
2537
|
+
success: false,
|
|
2538
|
+
warnings: this.warnings,
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
if (contractTagOptions.tagNamesToInclude.size > 0) {
|
|
2542
|
+
for (const [parentTypeName, parentDefinitionData] of this.parentDefinitionDataByTypeName) {
|
|
2537
2543
|
if ((0, utils_5.isNodeDataInaccessible)(parentDefinitionData)) {
|
|
2538
2544
|
continue;
|
|
2539
2545
|
}
|
|
2540
|
-
|
|
2546
|
+
const parentTagData = this.parentTagDataByTypeName.get(parentTypeName);
|
|
2547
|
+
if (!parentTagData) {
|
|
2541
2548
|
parentDefinitionData.federatedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2542
2549
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2543
2550
|
]);
|
|
@@ -2545,50 +2552,42 @@ class FederationFactory {
|
|
|
2545
2552
|
// If the parent is inaccessible, there is no need to assess further
|
|
2546
2553
|
continue;
|
|
2547
2554
|
}
|
|
2555
|
+
if (!contractTagOptions.tagNamesToInclude.isDisjointFrom(parentTagData.tagNames)) {
|
|
2556
|
+
continue;
|
|
2557
|
+
}
|
|
2548
2558
|
if (parentTagData.childTagDataByChildName.size < 1) {
|
|
2559
|
+
parentDefinitionData.federatedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2560
|
+
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2561
|
+
]);
|
|
2562
|
+
this.inaccessibleCoords.add(parentTypeName);
|
|
2563
|
+
// If the parent is inaccessible, there is no need to assess further
|
|
2549
2564
|
continue;
|
|
2550
2565
|
}
|
|
2551
2566
|
switch (parentDefinitionData.kind) {
|
|
2552
2567
|
case graphql_1.Kind.SCALAR_TYPE_DEFINITION:
|
|
2553
2568
|
// intentional fallthrough
|
|
2554
|
-
case graphql_1.Kind.UNION_TYPE_DEFINITION:
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
this.handleChildTagExclusions(parentDefinitionData, parentDefinitionData.enumValueDataByName, parentTagData.childTagDataByChildName, contractTagOptions.tagNamesToExclude);
|
|
2569
|
+
case graphql_1.Kind.UNION_TYPE_DEFINITION:
|
|
2570
|
+
continue;
|
|
2571
|
+
case graphql_1.Kind.ENUM_TYPE_DEFINITION:
|
|
2572
|
+
this.handleChildTagInclusions(parentDefinitionData, parentDefinitionData.enumValueDataByName, parentTagData.childTagDataByChildName, contractTagOptions.tagNamesToInclude);
|
|
2559
2573
|
break;
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
this.handleChildTagExclusions(parentDefinitionData, parentDefinitionData.inputValueDataByName, parentTagData.childTagDataByChildName, contractTagOptions.tagNamesToExclude);
|
|
2574
|
+
case graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION:
|
|
2575
|
+
this.handleChildTagInclusions(parentDefinitionData, parentDefinitionData.inputValueDataByName, parentTagData.childTagDataByChildName, contractTagOptions.tagNamesToInclude);
|
|
2563
2576
|
break;
|
|
2564
|
-
|
|
2565
|
-
default: {
|
|
2577
|
+
default:
|
|
2566
2578
|
let accessibleFields = parentDefinitionData.fieldDataByName.size;
|
|
2567
|
-
for (const [fieldName,
|
|
2568
|
-
const fieldData = (0, utils_6.getOrThrowError)(parentDefinitionData.fieldDataByName, fieldName, `${parentTypeName}.fieldDataByFieldName`);
|
|
2579
|
+
for (const [fieldName, fieldData] of parentDefinitionData.fieldDataByName) {
|
|
2569
2580
|
if ((0, utils_5.isNodeDataInaccessible)(fieldData)) {
|
|
2570
2581
|
accessibleFields -= 1;
|
|
2571
2582
|
continue;
|
|
2572
2583
|
}
|
|
2573
|
-
|
|
2584
|
+
const childTagData = parentTagData.childTagDataByChildName.get(fieldName);
|
|
2585
|
+
if (!childTagData || contractTagOptions.tagNamesToInclude.isDisjointFrom(childTagData.tagNames)) {
|
|
2574
2586
|
(0, utils_6.getValueOrDefault)(fieldData.federatedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2575
2587
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2576
2588
|
]);
|
|
2577
2589
|
this.inaccessibleCoords.add(fieldData.federatedCoords);
|
|
2578
2590
|
accessibleFields -= 1;
|
|
2579
|
-
continue;
|
|
2580
|
-
}
|
|
2581
|
-
for (const [argumentName, argTagNames] of childTagData.tagNamesByArgumentName) {
|
|
2582
|
-
const inputValueData = (0, utils_6.getOrThrowError)(fieldData.argumentDataByName, argumentName, `${fieldName}.argumentDataByArgumentName`);
|
|
2583
|
-
if ((0, utils_5.isNodeDataInaccessible)(inputValueData)) {
|
|
2584
|
-
continue;
|
|
2585
|
-
}
|
|
2586
|
-
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(argTagNames)) {
|
|
2587
|
-
(0, utils_6.getValueOrDefault)(inputValueData.federatedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2588
|
-
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2589
|
-
]);
|
|
2590
|
-
this.inaccessibleCoords.add(inputValueData.federatedCoords);
|
|
2591
|
-
}
|
|
2592
2591
|
}
|
|
2593
2592
|
}
|
|
2594
2593
|
if (accessibleFields < 1) {
|
|
@@ -2597,17 +2596,16 @@ class FederationFactory {
|
|
|
2597
2596
|
]);
|
|
2598
2597
|
this.inaccessibleCoords.add(parentTypeName);
|
|
2599
2598
|
}
|
|
2600
|
-
}
|
|
2601
2599
|
}
|
|
2602
2600
|
}
|
|
2603
2601
|
}
|
|
2604
|
-
|
|
2605
|
-
for (const [parentTypeName,
|
|
2602
|
+
if (contractTagOptions.tagNamesToExclude.size > 0) {
|
|
2603
|
+
for (const [parentTypeName, parentTagData] of this.parentTagDataByTypeName) {
|
|
2604
|
+
const parentDefinitionData = (0, utils_6.getOrThrowError)(this.parentDefinitionDataByTypeName, parentTypeName, string_constants_1.PARENT_DEFINITION_DATA);
|
|
2606
2605
|
if ((0, utils_5.isNodeDataInaccessible)(parentDefinitionData)) {
|
|
2607
2606
|
continue;
|
|
2608
2607
|
}
|
|
2609
|
-
|
|
2610
|
-
if (!parentTagData) {
|
|
2608
|
+
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(parentTagData.tagNames)) {
|
|
2611
2609
|
parentDefinitionData.federatedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2612
2610
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2613
2611
|
]);
|
|
@@ -2615,42 +2613,50 @@ class FederationFactory {
|
|
|
2615
2613
|
// If the parent is inaccessible, there is no need to assess further
|
|
2616
2614
|
continue;
|
|
2617
2615
|
}
|
|
2618
|
-
if (!contractTagOptions.tagNamesToInclude.isDisjointFrom(parentTagData.tagNames)) {
|
|
2619
|
-
continue;
|
|
2620
|
-
}
|
|
2621
2616
|
if (parentTagData.childTagDataByChildName.size < 1) {
|
|
2622
|
-
parentDefinitionData.federatedDirectivesData.directivesByName.set(string_constants_1.INACCESSIBLE, [
|
|
2623
|
-
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2624
|
-
]);
|
|
2625
|
-
this.inaccessibleCoords.add(parentTypeName);
|
|
2626
|
-
// If the parent is inaccessible, there is no need to assess further
|
|
2627
2617
|
continue;
|
|
2628
2618
|
}
|
|
2629
2619
|
switch (parentDefinitionData.kind) {
|
|
2630
2620
|
case graphql_1.Kind.SCALAR_TYPE_DEFINITION:
|
|
2631
2621
|
// intentional fallthrough
|
|
2632
|
-
case graphql_1.Kind.UNION_TYPE_DEFINITION:
|
|
2633
|
-
continue;
|
|
2634
|
-
case graphql_1.Kind.ENUM_TYPE_DEFINITION:
|
|
2635
|
-
this.handleChildTagInclusions(parentDefinitionData, parentDefinitionData.enumValueDataByName, parentTagData.childTagDataByChildName, contractTagOptions.tagNamesToInclude);
|
|
2622
|
+
case graphql_1.Kind.UNION_TYPE_DEFINITION: {
|
|
2636
2623
|
break;
|
|
2637
|
-
|
|
2638
|
-
|
|
2624
|
+
}
|
|
2625
|
+
case graphql_1.Kind.ENUM_TYPE_DEFINITION: {
|
|
2626
|
+
this.handleChildTagExclusions(parentDefinitionData, parentDefinitionData.enumValueDataByName, parentTagData.childTagDataByChildName, contractTagOptions.tagNamesToExclude);
|
|
2639
2627
|
break;
|
|
2640
|
-
|
|
2628
|
+
}
|
|
2629
|
+
case graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION: {
|
|
2630
|
+
this.handleChildTagExclusions(parentDefinitionData, parentDefinitionData.inputValueDataByName, parentTagData.childTagDataByChildName, contractTagOptions.tagNamesToExclude);
|
|
2631
|
+
break;
|
|
2632
|
+
}
|
|
2633
|
+
default: {
|
|
2641
2634
|
let accessibleFields = parentDefinitionData.fieldDataByName.size;
|
|
2642
|
-
for (const [fieldName,
|
|
2635
|
+
for (const [fieldName, childTagData] of parentTagData.childTagDataByChildName) {
|
|
2636
|
+
const fieldData = (0, utils_6.getOrThrowError)(parentDefinitionData.fieldDataByName, fieldName, `${parentTypeName}.fieldDataByFieldName`);
|
|
2643
2637
|
if ((0, utils_5.isNodeDataInaccessible)(fieldData)) {
|
|
2644
2638
|
accessibleFields -= 1;
|
|
2645
2639
|
continue;
|
|
2646
2640
|
}
|
|
2647
|
-
|
|
2648
|
-
if (!childTagData || contractTagOptions.tagNamesToInclude.isDisjointFrom(childTagData.tagNames)) {
|
|
2641
|
+
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(childTagData.tagNames)) {
|
|
2649
2642
|
(0, utils_6.getValueOrDefault)(fieldData.federatedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2650
2643
|
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2651
2644
|
]);
|
|
2652
2645
|
this.inaccessibleCoords.add(fieldData.federatedCoords);
|
|
2653
2646
|
accessibleFields -= 1;
|
|
2647
|
+
continue;
|
|
2648
|
+
}
|
|
2649
|
+
for (const [argumentName, argTagNames] of childTagData.tagNamesByArgumentName) {
|
|
2650
|
+
const inputValueData = (0, utils_6.getOrThrowError)(fieldData.argumentDataByName, argumentName, `${fieldName}.argumentDataByArgumentName`);
|
|
2651
|
+
if ((0, utils_5.isNodeDataInaccessible)(inputValueData)) {
|
|
2652
|
+
continue;
|
|
2653
|
+
}
|
|
2654
|
+
if (!contractTagOptions.tagNamesToExclude.isDisjointFrom(argTagNames)) {
|
|
2655
|
+
(0, utils_6.getValueOrDefault)(inputValueData.federatedDirectivesData.directivesByName, string_constants_1.INACCESSIBLE, () => [
|
|
2656
|
+
(0, utils_6.generateSimpleDirective)(string_constants_1.INACCESSIBLE),
|
|
2657
|
+
]);
|
|
2658
|
+
this.inaccessibleCoords.add(inputValueData.federatedCoords);
|
|
2659
|
+
}
|
|
2654
2660
|
}
|
|
2655
2661
|
}
|
|
2656
2662
|
if (accessibleFields < 1) {
|
|
@@ -2659,6 +2665,7 @@ class FederationFactory {
|
|
|
2659
2665
|
]);
|
|
2660
2666
|
this.inaccessibleCoords.add(parentTypeName);
|
|
2661
2667
|
}
|
|
2668
|
+
}
|
|
2662
2669
|
}
|
|
2663
2670
|
}
|
|
2664
2671
|
}
|