@wundergraph/composition 0.54.1 → 0.55.1
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 +1 -0
- package/dist/normalization/types.d.ts +9 -7
- package/dist/resolvability-graph/constants/number-constants.d.ts +1 -0
- package/dist/resolvability-graph/constants/number-constants.js +5 -0
- package/dist/resolvability-graph/constants/number-constants.js.map +1 -0
- package/dist/resolvability-graph/graph.d.ts +4 -3
- package/dist/resolvability-graph/graph.js +31 -36
- package/dist/resolvability-graph/graph.js.map +1 -1
- package/dist/resolvability-graph/types/types.d.ts +2 -1
- package/dist/resolvability-graph/utils/types/params.d.ts +8 -1
- package/dist/resolvability-graph/utils/types/types.d.ts +1 -0
- package/dist/resolvability-graph/utils/utils.d.ts +1 -1
- package/dist/resolvability-graph/utils/utils.js +74 -10
- package/dist/resolvability-graph/utils/utils.js.map +1 -1
- package/dist/schema-building/params.d.ts +8 -0
- package/dist/schema-building/params.js +3 -0
- package/dist/schema-building/params.js.map +1 -0
- package/dist/schema-building/utils.d.ts +4 -2
- package/dist/schema-building/utils.js +25 -8
- package/dist/schema-building/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/utils/composition-version.js +1 -1
- package/dist/utils/string-constants.d.ts +1 -0
- package/dist/utils/string-constants.js +2 -1
- package/dist/utils/string-constants.js.map +1 -1
- package/dist/utils/types.d.ts +2 -2
- package/dist/v1/federation/federation-factory.d.ts +3 -2
- package/dist/v1/federation/federation-factory.js +10 -2
- package/dist/v1/federation/federation-factory.js.map +1 -1
- package/dist/v1/federation/params.d.ts +2 -1
- package/dist/v1/normalization/normalization-factory.d.ts +5 -4
- package/dist/v1/normalization/normalization-factory.js +25 -1
- package/dist/v1/normalization/normalization-factory.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ConstDirectiveNode, type ConstValueNode, type DirectiveDefinitionNode, type DocumentNode, type EnumValueDefinitionNode, type FieldDefinitionNode, type InputValueDefinitionNode, type InterfaceTypeDefinitionNode,
|
|
1
|
+
import { type ConstDirectiveNode, type ConstValueNode, type DirectiveDefinitionNode, type DocumentNode, type EnumValueDefinitionNode, type FieldDefinitionNode, type InputValueDefinitionNode, type InterfaceTypeDefinitionNode, Kind, type NamedTypeNode, OperationTypeNode, type SchemaDefinitionNode, type SchemaExtensionNode, type TypeDefinitionNode, type TypeExtensionNode, type TypeNode } from 'graphql';
|
|
2
2
|
import { type EnumTypeNode, type InputObjectTypeNode, type InterfaceTypeNode, type ObjectTypeNode, type ScalarTypeNode, type SchemaNode, type UnionTypeNode } from '../../ast/utils';
|
|
3
3
|
import { type ConfigurationData, type Costs, type EventConfiguration, type NatsEventType, type RequiredFieldConfiguration } from '../../router-configuration/types';
|
|
4
4
|
import { type AuthorizationData, type CompositeOutputData, type ConditionalFieldData, type EntityData, type EntityInterfaceSubgraphData, type EnumDefinitionData, ExtensionType, type FieldData, type InputObjectDefinitionData, type InputValueData, type NodeData, type ObjectDefinitionData, type ParentDefinitionData, type PersistedDirectiveDefinitionData, type ScalarDefinitionData, type SchemaData, type UnionDefinitionData } from '../../schema-building/types';
|
|
@@ -8,7 +8,7 @@ import { Graph } from '../../resolvability-graph/graph';
|
|
|
8
8
|
import { type Warning } from '../../warnings/types';
|
|
9
9
|
import { type BatchNormalizationResult, type NormalizationResult } from '../../normalization/types';
|
|
10
10
|
import { type AddInputValueDataByNodeParams, type ConditionalFieldSetValidationResult, type ExtractArgumentDataResult, type FieldSetData, type FieldSetParentResult, type HandleCostDirectiveParams, type HandleListSizeDirectiveParams, type HandleOverrideDirectiveParams, type HandleRequiresScopesDirectiveParams, type HandleSemanticNonNullDirectiveParams, type KeyFieldSetData, type UpsertInputObjectResult, type ValidateDirectiveParams } from './types';
|
|
11
|
-
import { type SubgraphName } from '../../types/types';
|
|
11
|
+
import { type AbstractTypeName, type SubgraphName, type TypeName } from '../../types/types';
|
|
12
12
|
import { type BatchNormalizeParams, type HandleFieldInheritableDirectivesParams, type NormalizationFactoryParams, type NormalizeSubgraphFromStringParams, type NormalizeSubgraphParams, type ValidateOneOfDirectiveParams } from './params';
|
|
13
13
|
import type { CompositionOptions } from '../../types/params';
|
|
14
14
|
export declare function normalizeSubgraphFromString({ noLocation, options, sdlString, }: NormalizeSubgraphFromStringParams): NormalizationResult;
|
|
@@ -32,6 +32,7 @@ export declare class NormalizationFactory {
|
|
|
32
32
|
entityInterfaceDataByTypeName: Map<string, EntityInterfaceSubgraphData>;
|
|
33
33
|
eventsConfigurations: Map<string, EventConfiguration[]>;
|
|
34
34
|
fieldSetDataByTypeName: Map<string, FieldSetData>;
|
|
35
|
+
interfaceImplementationTypeNamesByInterfaceTypeName: Map<string, Set<string>>;
|
|
35
36
|
internalGraph: Graph;
|
|
36
37
|
invalidConfigureDescriptionNodeDatas: Array<NodeData>;
|
|
37
38
|
invalidORScopesCoords: Set<string>;
|
|
@@ -73,9 +74,9 @@ export declare class NormalizationFactory {
|
|
|
73
74
|
setParentDataExtensionType(parentData: ParentDefinitionData, incomingExtensionType: ExtensionType): void;
|
|
74
75
|
extractConfigureDescriptionData(data: NodeData, directiveNode: ConstDirectiveNode): void;
|
|
75
76
|
extractConfigureDescriptionsData(data: NodeData): void;
|
|
76
|
-
extractImplementedInterfaceTypeNames(node:
|
|
77
|
+
extractImplementedInterfaceTypeNames(node: InterfaceTypeNode | ObjectTypeNode, implementedInterfaceTypeNames: Set<AbstractTypeName>): Set<AbstractTypeName>;
|
|
77
78
|
updateCompositeOutputDataByNode(node: CompositeOutputNode, data: CompositeOutputData, extensionType: ExtensionType): void;
|
|
78
|
-
addConcreteTypeNamesForImplementedInterfaces(interfaceTypeNames: Set<
|
|
79
|
+
addConcreteTypeNamesForImplementedInterfaces(interfaceTypeNames: Set<AbstractTypeName>, concreteTypeName: TypeName): void;
|
|
79
80
|
extractArguments(argumentDataByName: Map<string, InputValueData>, node: FieldDefinitionNode): Map<string, InputValueData>;
|
|
80
81
|
addPersistedDirectiveDefinitionDataByNode(persistedDirectiveDefinitionDataByDirectiveName: Map<string, PersistedDirectiveDefinitionData>, node: DirectiveDefinitionNode, executableLocations: Set<string>): void;
|
|
81
82
|
extractDirectiveLocations(node: DirectiveDefinitionNode, errorMessages: Array<string>): Set<string>;
|
|
@@ -65,6 +65,7 @@ class NormalizationFactory {
|
|
|
65
65
|
entityInterfaceDataByTypeName = new Map();
|
|
66
66
|
eventsConfigurations = new Map();
|
|
67
67
|
fieldSetDataByTypeName = new Map();
|
|
68
|
+
interfaceImplementationTypeNamesByInterfaceTypeName = new Map();
|
|
68
69
|
internalGraph;
|
|
69
70
|
invalidConfigureDescriptionNodeDatas = [];
|
|
70
71
|
invalidORScopesCoords = new Set();
|
|
@@ -543,6 +544,7 @@ class NormalizationFactory {
|
|
|
543
544
|
if (!node.interfaces) {
|
|
544
545
|
return implementedInterfaceTypeNames;
|
|
545
546
|
}
|
|
547
|
+
const isInterface = (0, utils_4.isInterfaceNode)(node);
|
|
546
548
|
const parentTypeName = node.name.value;
|
|
547
549
|
for (const implementedInterface of node.interfaces) {
|
|
548
550
|
const interfaceTypeName = implementedInterface.name.value;
|
|
@@ -550,6 +552,9 @@ class NormalizationFactory {
|
|
|
550
552
|
this.errors.push((0, errors_1.duplicateImplementedInterfaceError)((0, utils_3.kindToConvertedTypeString)(node.kind), parentTypeName, interfaceTypeName));
|
|
551
553
|
continue;
|
|
552
554
|
}
|
|
555
|
+
if (isInterface) {
|
|
556
|
+
(0, utils_5.getValueOrDefault)(this.interfaceImplementationTypeNamesByInterfaceTypeName, interfaceTypeName, () => new Set()).add(parentTypeName);
|
|
557
|
+
}
|
|
553
558
|
implementedInterfaceTypeNames.add(interfaceTypeName);
|
|
554
559
|
}
|
|
555
560
|
return implementedInterfaceTypeNames;
|
|
@@ -1550,7 +1555,12 @@ class NormalizationFactory {
|
|
|
1550
1555
|
unimplementedArguments: new Set(),
|
|
1551
1556
|
};
|
|
1552
1557
|
// The implemented field type must be equally or more restrictive than the original interface field type
|
|
1553
|
-
if (!(0, utils_4.isTypeValidImplementation)(
|
|
1558
|
+
if (!(0, utils_4.isTypeValidImplementation)({
|
|
1559
|
+
concreteTypeNamesByAbstractTypeName: this.concreteTypeNamesByAbstractTypeName,
|
|
1560
|
+
implementationType: fieldData.node.type,
|
|
1561
|
+
interfaceImplementationTypeNamesByInterfaceTypeName: this.interfaceImplementationTypeNamesByInterfaceTypeName,
|
|
1562
|
+
originalType: interfaceField.node.type,
|
|
1563
|
+
})) {
|
|
1554
1564
|
hasErrors = true;
|
|
1555
1565
|
hasNestedErrors = true;
|
|
1556
1566
|
invalidFieldImplementation.implementedResponseType = (0, merge_1.printTypeNode)(fieldData.node.type);
|
|
@@ -3152,6 +3162,7 @@ class NormalizationFactory {
|
|
|
3152
3162
|
entityDataByTypeName: this.entityDataByTypeName,
|
|
3153
3163
|
entityInterfaces: this.entityInterfaceDataByTypeName,
|
|
3154
3164
|
fieldCoordsByNamedTypeName: this.fieldCoordsByNamedTypeName,
|
|
3165
|
+
interfaceImplementationTypeNamesByInterfaceTypeName: this.interfaceImplementationTypeNamesByInterfaceTypeName,
|
|
3155
3166
|
isEventDrivenGraph: this.isSubgraphEventDrivenGraph,
|
|
3156
3167
|
isVersionTwo: this.isSubgraphVersionTwo,
|
|
3157
3168
|
keyFieldNamesByParentTypeName: this.keyFieldNamesByParentTypeName,
|
|
@@ -3175,6 +3186,7 @@ function batchNormalize({ options, subgraphs }) {
|
|
|
3175
3186
|
const authorizationDataByParentTypeName = new Map();
|
|
3176
3187
|
const concreteTypeNamesByAbstractTypeName = new Map();
|
|
3177
3188
|
const entityDataByTypeName = new Map();
|
|
3189
|
+
const interfaceImplementationTypeNamesByInterfaceTypeName = new Map();
|
|
3178
3190
|
const internalSubgraphBySubgraphName = new Map();
|
|
3179
3191
|
const allOverridesByTargetSubgraphName = new Map();
|
|
3180
3192
|
const overrideSourceSubgraphNamesByFieldPath = new Map();
|
|
@@ -3238,6 +3250,17 @@ function batchNormalize({ options, subgraphs }) {
|
|
|
3238
3250
|
target: existingConcreteTypeNames,
|
|
3239
3251
|
});
|
|
3240
3252
|
}
|
|
3253
|
+
for (const [interfaceTypeName, incomingInterfaceTypeNames,] of normalizationResult.interfaceImplementationTypeNamesByInterfaceTypeName) {
|
|
3254
|
+
const existingInterfaceTypeNames = interfaceImplementationTypeNamesByInterfaceTypeName.get(interfaceTypeName);
|
|
3255
|
+
if (!existingInterfaceTypeNames) {
|
|
3256
|
+
interfaceImplementationTypeNamesByInterfaceTypeName.set(interfaceTypeName, new Set(incomingInterfaceTypeNames));
|
|
3257
|
+
continue;
|
|
3258
|
+
}
|
|
3259
|
+
(0, utils_5.addIterableToSet)({
|
|
3260
|
+
source: incomingInterfaceTypeNames,
|
|
3261
|
+
target: existingInterfaceTypeNames,
|
|
3262
|
+
});
|
|
3263
|
+
}
|
|
3241
3264
|
for (const [typeName, entityData] of normalizationResult.entityDataByTypeName) {
|
|
3242
3265
|
const keyFieldSetDataByFieldSet = entityData.keyFieldSetDatasBySubgraphName.get(subgraphName);
|
|
3243
3266
|
if (!keyFieldSetDataByFieldSet) {
|
|
@@ -3345,6 +3368,7 @@ function batchNormalize({ options, subgraphs }) {
|
|
|
3345
3368
|
concreteTypeNamesByAbstractTypeName,
|
|
3346
3369
|
entityDataByTypeName,
|
|
3347
3370
|
fieldCoordsByNamedTypeName,
|
|
3371
|
+
interfaceImplementationTypeNamesByInterfaceTypeName,
|
|
3348
3372
|
internalSubgraphBySubgraphName: internalSubgraphBySubgraphName,
|
|
3349
3373
|
internalGraph,
|
|
3350
3374
|
success: true,
|