@wundergraph/composition 0.37.3 → 0.38.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/normalization/types.d.ts +3 -0
- package/dist/router-configuration/types.d.ts +2 -1
- package/dist/schema-building/types.d.ts +13 -4
- package/dist/schema-building/utils.d.ts +5 -4
- package/dist/schema-building/utils.js +34 -38
- 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 +1 -1
- package/dist/utils/string-constants.js +3 -3
- package/dist/utils/string-constants.js.map +1 -1
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.js +8 -0
- package/dist/utils/utils.js.map +1 -1
- package/dist/v1/federation/federation-factory.d.ts +4 -2
- package/dist/v1/federation/federation-factory.js +65 -27
- package/dist/v1/federation/federation-factory.js.map +1 -1
- package/dist/v1/federation/utils.d.ts +1 -0
- package/dist/v1/federation/utils.js.map +1 -1
- package/dist/v1/normalization/normalization-factory.d.ts +7 -8
- package/dist/v1/normalization/normalization-factory.js +47 -148
- package/dist/v1/normalization/normalization-factory.js.map +1 -1
- package/dist/v1/normalization/utils.d.ts +1 -1
- package/dist/v1/normalization/utils.js +3 -1
- package/dist/v1/normalization/utils.js.map +1 -1
- package/dist/v1/normalization/walkers.d.ts +0 -1
- package/dist/v1/normalization/walkers.js +1 -100
- package/dist/v1/normalization/walkers.js.map +1 -1
- package/dist/v1/utils/constants.d.ts +1 -0
- package/dist/v1/utils/constants.js +2 -1
- package/dist/v1/utils/constants.js.map +1 -1
- package/dist/v1/utils/utils.d.ts +14 -13
- package/dist/v1/utils/utils.js +129 -91
- package/dist/v1/utils/utils.js.map +1 -1
- package/package.json +3 -2
|
@@ -54,8 +54,6 @@ class NormalizationFactory {
|
|
|
54
54
|
entityInterfaceDataByTypeName = new Map();
|
|
55
55
|
eventsConfigurations = new Map();
|
|
56
56
|
fieldSetDataByTypeName = new Map();
|
|
57
|
-
heirFieldAuthorizationDataByTypeName = new Map();
|
|
58
|
-
interfaceTypeNamesWithAuthorizationDirectives = new Set();
|
|
59
57
|
internalGraph;
|
|
60
58
|
invalidConfigureDescriptionNodeDatas = [];
|
|
61
59
|
invalidRepeatedDirectiveNameByCoords = new Map();
|
|
@@ -67,16 +65,18 @@ class NormalizationFactory {
|
|
|
67
65
|
keyFieldSetDatasByTypeName = new Map();
|
|
68
66
|
lastParentNodeKind = graphql_1.Kind.NULL;
|
|
69
67
|
lastChildNodeKind = graphql_1.Kind.NULL;
|
|
70
|
-
|
|
68
|
+
parentTypeNamesWithAuthDirectives = new Set();
|
|
71
69
|
keyFieldSetDataByTypeName = new Map();
|
|
70
|
+
keyFieldSetsByEntityTypeNameByFieldCoords = new Map();
|
|
72
71
|
keyFieldNamesByParentTypeName = new Map();
|
|
72
|
+
fieldCoordsByNamedTypeName = new Map();
|
|
73
73
|
operationTypeNodeByTypeName = new Map();
|
|
74
74
|
originalParentTypeName = '';
|
|
75
75
|
originalTypeNameByRenamedTypeName = new Map();
|
|
76
76
|
parentDefinitionDataByTypeName = new Map();
|
|
77
77
|
parentsWithChildArguments = new Set();
|
|
78
78
|
overridesByTargetSubgraphName = new Map();
|
|
79
|
-
|
|
79
|
+
invalidORScopesCoords = new Set();
|
|
80
80
|
schemaData;
|
|
81
81
|
referencedDirectiveNames = new Set();
|
|
82
82
|
referencedTypeNames = new Set();
|
|
@@ -137,83 +137,6 @@ class NormalizationFactory {
|
|
|
137
137
|
this.errors.push((0, errors_1.invalidArgumentsError)(fieldPath, invalidArguments));
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
// Note that directive validation errors are handled elsewhere
|
|
141
|
-
getAuthorizationData(node) {
|
|
142
|
-
const parentTypeName = this.renamedParentTypeName || this.originalParentTypeName;
|
|
143
|
-
let authorizationData = this.authorizationDataByParentTypeName.get(parentTypeName);
|
|
144
|
-
(0, utils_3.resetAuthorizationData)(authorizationData);
|
|
145
|
-
if (!node.directives) {
|
|
146
|
-
return authorizationData;
|
|
147
|
-
}
|
|
148
|
-
let requiresAuthentication = false;
|
|
149
|
-
const requiresScopes = [];
|
|
150
|
-
for (const directiveNode of node.directives) {
|
|
151
|
-
const directiveName = directiveNode.name.value;
|
|
152
|
-
if (directiveName === string_constants_2.AUTHENTICATED) {
|
|
153
|
-
// @authenticated is not repeatable
|
|
154
|
-
if (requiresAuthentication) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
requiresAuthentication = true;
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
if (directiveName !== string_constants_2.REQUIRES_SCOPES) {
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
// @requiresScopes is not repeatable
|
|
164
|
-
if (requiresScopes.length > 0) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
requiresScopes.push(directiveNode);
|
|
168
|
-
}
|
|
169
|
-
if (!requiresAuthentication && requiresScopes.length < 1) {
|
|
170
|
-
return authorizationData;
|
|
171
|
-
}
|
|
172
|
-
if ((0, utils_3.isNodeKindInterface)(node.kind)) {
|
|
173
|
-
this.interfaceTypeNamesWithAuthorizationDirectives.add(parentTypeName);
|
|
174
|
-
}
|
|
175
|
-
if (!authorizationData) {
|
|
176
|
-
authorizationData = (0, utils_3.setAndGetValue)(this.authorizationDataByParentTypeName, this.renamedParentTypeName || this.originalParentTypeName, (0, utils_3.newAuthorizationData)(parentTypeName));
|
|
177
|
-
}
|
|
178
|
-
authorizationData.hasParentLevelAuthorization = true;
|
|
179
|
-
authorizationData.requiresAuthentication = requiresAuthentication;
|
|
180
|
-
if (requiresScopes.length !== 1) {
|
|
181
|
-
return authorizationData;
|
|
182
|
-
}
|
|
183
|
-
const directiveNode = requiresScopes[0];
|
|
184
|
-
if (!directiveNode.arguments || directiveNode.arguments.length !== 1) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const scopesArgument = directiveNode.arguments[0];
|
|
188
|
-
// @TODO list coercion
|
|
189
|
-
if (scopesArgument.name.value !== string_constants_2.SCOPES || scopesArgument.value.kind !== graphql_1.Kind.LIST) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
const orScopes = scopesArgument.value.values;
|
|
193
|
-
if (orScopes.length < 1) {
|
|
194
|
-
return authorizationData;
|
|
195
|
-
}
|
|
196
|
-
if (orScopes.length > utils_3.maxOrScopes) {
|
|
197
|
-
this.invalidOrScopesHostPaths.add(this.originalParentTypeName);
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
for (const scopes of orScopes) {
|
|
201
|
-
if (scopes.kind !== graphql_1.Kind.LIST) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
const andScopes = new Set();
|
|
205
|
-
for (const scope of scopes.values) {
|
|
206
|
-
if (scope.kind !== graphql_1.Kind.STRING) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
andScopes.add(scope.value);
|
|
210
|
-
}
|
|
211
|
-
if (andScopes.size) {
|
|
212
|
-
authorizationData.requiredScopes.push(andScopes);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return authorizationData;
|
|
216
|
-
}
|
|
217
140
|
isTypeNameRootType(typeName) {
|
|
218
141
|
return string_constants_2.ROOT_TYPE_NAMES.has(typeName) || this.operationTypeNodeByTypeName.has(typeName);
|
|
219
142
|
}
|
|
@@ -378,7 +301,7 @@ class NormalizationFactory {
|
|
|
378
301
|
if (!isRequiresScopes || argumentName !== string_constants_2.SCOPES) {
|
|
379
302
|
continue;
|
|
380
303
|
}
|
|
381
|
-
this.
|
|
304
|
+
this.extractRequiredScopes({
|
|
382
305
|
directiveCoords,
|
|
383
306
|
// Casts are safe because invalid arguments would short circuit
|
|
384
307
|
orScopes: argumentNode.value.values,
|
|
@@ -398,17 +321,16 @@ class NormalizationFactory {
|
|
|
398
321
|
if (errorMessages.length > 0 || !isRequiresScopes) {
|
|
399
322
|
return errorMessages;
|
|
400
323
|
}
|
|
401
|
-
|
|
402
|
-
data.kind !== graphql_1.Kind.FIELD_DEFINITION &&
|
|
403
|
-
data.kind !== graphql_1.Kind.SCALAR_TYPE_DEFINITION) {
|
|
404
|
-
return errorMessages;
|
|
405
|
-
}
|
|
324
|
+
const parentAuthorizationData = (0, utils_5.getValueOrDefault)(this.authorizationDataByParentTypeName, parentTypeName, () => (0, utils_3.newAuthorizationData)(parentTypeName));
|
|
406
325
|
if (data.kind !== graphql_1.Kind.FIELD_DEFINITION) {
|
|
407
|
-
this.
|
|
326
|
+
this.parentTypeNamesWithAuthDirectives.add(parentTypeName);
|
|
327
|
+
parentAuthorizationData.requiredScopes.push(...requiredScopes);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
const fieldAuthData = (0, utils_5.getValueOrDefault)(parentAuthorizationData.fieldAuthDataByFieldName, data.name, () => (0, utils_3.newFieldAuthorizationData)(data.name));
|
|
331
|
+
fieldAuthData.inheritedData.requiredScopes.push(...requiredScopes);
|
|
332
|
+
fieldAuthData.originalData.requiredScopes.push(...requiredScopes);
|
|
408
333
|
}
|
|
409
|
-
const parentAuthorizationData = (0, utils_5.getValueOrDefault)(this.authorizationDataByParentTypeName, parentTypeName, () => (0, utils_3.newAuthorizationData)(parentTypeName));
|
|
410
|
-
const authorizationData = (0, utils_3.getAuthorizationDataToUpdate)(parentAuthorizationData, data.node);
|
|
411
|
-
authorizationData.requiredScopes.push(...requiredScopes);
|
|
412
334
|
return errorMessages;
|
|
413
335
|
}
|
|
414
336
|
validateDirectives(data, directiveCoords) {
|
|
@@ -1512,16 +1434,16 @@ class NormalizationFactory {
|
|
|
1512
1434
|
}
|
|
1513
1435
|
}
|
|
1514
1436
|
handleAuthenticatedDirective(data, parentTypeName) {
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
data.
|
|
1518
|
-
|
|
1437
|
+
const parentAuthData = (0, utils_5.getValueOrDefault)(this.authorizationDataByParentTypeName, parentTypeName, () => (0, utils_3.newAuthorizationData)(parentTypeName));
|
|
1438
|
+
if (data.kind === graphql_1.Kind.FIELD_DEFINITION) {
|
|
1439
|
+
const fieldAuthData = (0, utils_5.getValueOrDefault)(parentAuthData.fieldAuthDataByFieldName, data.name, () => (0, utils_3.newFieldAuthorizationData)(data.name));
|
|
1440
|
+
fieldAuthData.inheritedData.requiresAuthentication = true;
|
|
1441
|
+
fieldAuthData.originalData.requiresAuthentication = true;
|
|
1519
1442
|
}
|
|
1520
|
-
|
|
1521
|
-
|
|
1443
|
+
else {
|
|
1444
|
+
parentAuthData.requiresAuthentication = true;
|
|
1445
|
+
this.parentTypeNamesWithAuthDirectives.add(parentTypeName);
|
|
1522
1446
|
}
|
|
1523
|
-
const parentAuthorizationData = (0, utils_5.getValueOrDefault)(this.authorizationDataByParentTypeName, parentTypeName, () => (0, utils_3.newAuthorizationData)(parentTypeName));
|
|
1524
|
-
(0, utils_3.getAuthorizationDataToUpdate)(parentAuthorizationData, data.node).requiresAuthentication = true;
|
|
1525
1447
|
}
|
|
1526
1448
|
handleOverrideDirective({ data, directiveCoords, errorMessages, targetSubgraphName }) {
|
|
1527
1449
|
if (targetSubgraphName === this.subgraphName) {
|
|
@@ -1531,19 +1453,20 @@ class NormalizationFactory {
|
|
|
1531
1453
|
const overrideDataForSubgraph = (0, utils_5.getValueOrDefault)(this.overridesByTargetSubgraphName, targetSubgraphName, () => new Map());
|
|
1532
1454
|
(0, utils_5.getValueOrDefault)(overrideDataForSubgraph, data.renamedParentTypeName, () => new Set()).add(data.name);
|
|
1533
1455
|
}
|
|
1534
|
-
|
|
1535
|
-
if (orScopes.length >
|
|
1536
|
-
this.
|
|
1456
|
+
extractRequiredScopes({ directiveCoords, orScopes, requiredScopes }) {
|
|
1457
|
+
if (orScopes.length > constants_1.MAX_OR_SCOPES) {
|
|
1458
|
+
this.invalidORScopesCoords.add(directiveCoords);
|
|
1537
1459
|
return;
|
|
1538
1460
|
}
|
|
1539
1461
|
for (const scopes of orScopes) {
|
|
1540
|
-
const
|
|
1462
|
+
const newANDScopes = new Set();
|
|
1541
1463
|
for (const scope of scopes.values) {
|
|
1542
|
-
|
|
1464
|
+
newANDScopes.add(scope.value);
|
|
1543
1465
|
}
|
|
1544
|
-
if (
|
|
1545
|
-
|
|
1466
|
+
if (newANDScopes.size < 1) {
|
|
1467
|
+
continue;
|
|
1546
1468
|
}
|
|
1469
|
+
(0, utils_3.addScopes)(requiredScopes, newANDScopes);
|
|
1547
1470
|
}
|
|
1548
1471
|
}
|
|
1549
1472
|
getKafkaPublishConfiguration(directive, argumentDataByArgumentName, fieldName, errorMessages) {
|
|
@@ -2114,7 +2037,7 @@ class NormalizationFactory {
|
|
|
2114
2037
|
}
|
|
2115
2038
|
const typeName = (0, utils_4.getParentTypeName)(parentData);
|
|
2116
2039
|
const configurationData = (0, utils_5.getValueOrDefault)(this.configurationDataByTypeName, typeName, () => (0, utils_6.newConfigurationData)(true, typeName));
|
|
2117
|
-
const keys = (0, utils_2.validateKeyFieldSets)(this, parentData, keyFieldSetDataByFieldSet
|
|
2040
|
+
const keys = (0, utils_2.validateKeyFieldSets)(this, parentData, keyFieldSetDataByFieldSet);
|
|
2118
2041
|
if (keys) {
|
|
2119
2042
|
configurationData.keys = keys;
|
|
2120
2043
|
}
|
|
@@ -2164,19 +2087,19 @@ class NormalizationFactory {
|
|
|
2164
2087
|
getEnumNodeByData(enumDefinitionData) {
|
|
2165
2088
|
enumDefinitionData.node.description = enumDefinitionData.description;
|
|
2166
2089
|
enumDefinitionData.node.directives = this.getValidFlattenedDirectiveArray(enumDefinitionData.directivesByDirectiveName, enumDefinitionData.name);
|
|
2167
|
-
enumDefinitionData.node.values = (0, utils_4.childMapToValueArray)(enumDefinitionData.enumValueDataByValueName
|
|
2090
|
+
enumDefinitionData.node.values = (0, utils_4.childMapToValueArray)(enumDefinitionData.enumValueDataByValueName);
|
|
2168
2091
|
return enumDefinitionData.node;
|
|
2169
2092
|
}
|
|
2170
2093
|
getInputObjectNodeByData(inputObjectDefinitionData) {
|
|
2171
2094
|
inputObjectDefinitionData.node.description = inputObjectDefinitionData.description;
|
|
2172
2095
|
inputObjectDefinitionData.node.directives = this.getValidFlattenedDirectiveArray(inputObjectDefinitionData.directivesByDirectiveName, inputObjectDefinitionData.name);
|
|
2173
|
-
inputObjectDefinitionData.node.fields = (0, utils_4.childMapToValueArray)(inputObjectDefinitionData.inputValueDataByValueName
|
|
2096
|
+
inputObjectDefinitionData.node.fields = (0, utils_4.childMapToValueArray)(inputObjectDefinitionData.inputValueDataByValueName);
|
|
2174
2097
|
return inputObjectDefinitionData.node;
|
|
2175
2098
|
}
|
|
2176
2099
|
getCompositeOutputNodeByData(compositeOutputData) {
|
|
2177
2100
|
compositeOutputData.node.description = compositeOutputData.description;
|
|
2178
2101
|
compositeOutputData.node.directives = this.getValidFlattenedDirectiveArray(compositeOutputData.directivesByDirectiveName, compositeOutputData.name);
|
|
2179
|
-
compositeOutputData.node.fields = (0, utils_4.childMapToValueArray)(compositeOutputData.fieldDataByFieldName
|
|
2102
|
+
compositeOutputData.node.fields = (0, utils_4.childMapToValueArray)(compositeOutputData.fieldDataByFieldName);
|
|
2180
2103
|
compositeOutputData.node.interfaces = (0, utils_1.setToNamedTypeNodeArray)(compositeOutputData.implementedInterfaceTypeNames);
|
|
2181
2104
|
return compositeOutputData.node;
|
|
2182
2105
|
}
|
|
@@ -2383,36 +2306,8 @@ class NormalizationFactory {
|
|
|
2383
2306
|
for (const [parentTypeName, parentData] of this.parentDefinitionDataByTypeName) {
|
|
2384
2307
|
this.validateDirectives(parentData, parentTypeName);
|
|
2385
2308
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
const interfaceAuthorizationData = this.authorizationDataByParentTypeName.get(interfaceTypeName);
|
|
2389
|
-
if (!interfaceAuthorizationData) {
|
|
2390
|
-
continue;
|
|
2391
|
-
}
|
|
2392
|
-
const concreteTypeNames = this.concreteTypeNamesByAbstractTypeName.get(interfaceTypeName);
|
|
2393
|
-
for (const concreteTypeName of concreteTypeNames || []) {
|
|
2394
|
-
const concreteAuthorizationData = (0, utils_5.getValueOrDefault)(this.authorizationDataByParentTypeName, concreteTypeName, () => (0, utils_3.newAuthorizationData)(concreteTypeName));
|
|
2395
|
-
for (const [fieldName, interfaceFieldAuthorizationData,] of interfaceAuthorizationData.fieldAuthorizationDataByFieldName) {
|
|
2396
|
-
if (!(0, utils_3.upsertFieldAuthorizationData)(concreteAuthorizationData.fieldAuthorizationDataByFieldName, interfaceFieldAuthorizationData)) {
|
|
2397
|
-
this.invalidOrScopesHostPaths.add(`${concreteTypeName}.${fieldName}`);
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
// Apply inherited leaf authorization that was not applied to interface fields of that type earlier
|
|
2403
|
-
for (const [typeName, fieldAuthorizationDatas] of this.heirFieldAuthorizationDataByTypeName) {
|
|
2404
|
-
const authorizationData = this.authorizationDataByParentTypeName.get(typeName);
|
|
2405
|
-
if (!authorizationData) {
|
|
2406
|
-
continue;
|
|
2407
|
-
}
|
|
2408
|
-
for (const fieldAuthorizationData of fieldAuthorizationDatas) {
|
|
2409
|
-
if (!(0, utils_3.mergeAuthorizationDataByAND)(authorizationData, fieldAuthorizationData)) {
|
|
2410
|
-
this.invalidOrScopesHostPaths.add(`${typeName}.${fieldAuthorizationData.fieldName}`);
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
if (this.invalidOrScopesHostPaths.size > 0) {
|
|
2415
|
-
this.errors.push((0, errors_1.orScopesLimitError)(utils_3.maxOrScopes, [...this.invalidOrScopesHostPaths]));
|
|
2309
|
+
if (this.invalidORScopesCoords.size > 0) {
|
|
2310
|
+
this.errors.push((0, errors_1.orScopesLimitError)(constants_1.MAX_OR_SCOPES, [...this.invalidORScopesCoords]));
|
|
2416
2311
|
}
|
|
2417
2312
|
const definitions = [];
|
|
2418
2313
|
for (const directiveDefinition of constants_1.BASE_DIRECTIVE_DEFINITIONS) {
|
|
@@ -2472,7 +2367,6 @@ class NormalizationFactory {
|
|
|
2472
2367
|
this.errors.push((0, errors_1.noDefinedEnumValuesError)(parentTypeName));
|
|
2473
2368
|
break;
|
|
2474
2369
|
}
|
|
2475
|
-
(0, utils_4.removeIgnoredDirectives)(parentDefinitionData);
|
|
2476
2370
|
definitions.push(this.getEnumNodeByData(parentDefinitionData));
|
|
2477
2371
|
break;
|
|
2478
2372
|
case graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION:
|
|
@@ -2496,7 +2390,6 @@ class NormalizationFactory {
|
|
|
2496
2390
|
parentDefinitionData.fieldDataByFieldName.delete(string_constants_2.SERVICE_FIELD);
|
|
2497
2391
|
parentDefinitionData.fieldDataByFieldName.delete(string_constants_2.ENTITIES_FIELD);
|
|
2498
2392
|
}
|
|
2499
|
-
(0, utils_4.removeIgnoredDirectives)(parentDefinitionData);
|
|
2500
2393
|
(0, utils_4.removeInheritableDirectivesFromObjectParent)(parentDefinitionData);
|
|
2501
2394
|
if (this.parentsWithChildArguments.has(parentTypeName) || !isObject) {
|
|
2502
2395
|
const externalInterfaceFieldNames = [];
|
|
@@ -2543,7 +2436,6 @@ class NormalizationFactory {
|
|
|
2543
2436
|
this.errors.push((0, errors_1.noBaseScalarDefinitionError)(parentTypeName));
|
|
2544
2437
|
break;
|
|
2545
2438
|
}
|
|
2546
|
-
(0, utils_4.removeIgnoredDirectives)(parentDefinitionData);
|
|
2547
2439
|
definitions.push(this.getScalarNodeByData(parentDefinitionData));
|
|
2548
2440
|
break;
|
|
2549
2441
|
case graphql_1.Kind.UNION_TYPE_DEFINITION:
|
|
@@ -2650,9 +2542,11 @@ class NormalizationFactory {
|
|
|
2650
2542
|
configurationDataByTypeName: this.configurationDataByTypeName,
|
|
2651
2543
|
entityDataByTypeName: this.entityDataByTypeName,
|
|
2652
2544
|
entityInterfaces: this.entityInterfaceDataByTypeName,
|
|
2545
|
+
fieldCoordsByNamedTypeName: this.fieldCoordsByNamedTypeName,
|
|
2653
2546
|
isEventDrivenGraph: this.isSubgraphEventDrivenGraph,
|
|
2654
2547
|
isVersionTwo: this.isSubgraphVersionTwo,
|
|
2655
2548
|
keyFieldNamesByParentTypeName: this.keyFieldNamesByParentTypeName,
|
|
2549
|
+
keyFieldSetsByEntityTypeNameByKeyFieldCoords: this.keyFieldSetsByEntityTypeNameByFieldCoords,
|
|
2656
2550
|
operationTypes: this.operationTypeNodeByTypeName,
|
|
2657
2551
|
originalTypeNameByRenamedTypeName: this.originalTypeNameByRenamedTypeName,
|
|
2658
2552
|
overridesByTargetSubgraphName: this.overridesByTargetSubgraphName,
|
|
@@ -2679,7 +2573,8 @@ function batchNormalize(subgraphs) {
|
|
|
2679
2573
|
const subgraphNames = new Set();
|
|
2680
2574
|
const nonUniqueSubgraphNames = new Set();
|
|
2681
2575
|
const invalidNameErrorMessages = [];
|
|
2682
|
-
const
|
|
2576
|
+
const invalidORScopesCoords = new Set();
|
|
2577
|
+
const fieldCoordsByNamedTypeName = new Map();
|
|
2683
2578
|
const warnings = [];
|
|
2684
2579
|
const validationErrors = [];
|
|
2685
2580
|
// Record the subgraph names first, so that subgraph references can be validated
|
|
@@ -2709,7 +2604,10 @@ function batchNormalize(subgraphs) {
|
|
|
2709
2604
|
}
|
|
2710
2605
|
parentDefinitionDataMapsBySubgraphName.set(subgraphName, normalizationResult.parentDefinitionDataByTypeName);
|
|
2711
2606
|
for (const authorizationData of normalizationResult.authorizationDataByParentTypeName.values()) {
|
|
2712
|
-
(0, utils_3.upsertAuthorizationData)(authorizationDataByParentTypeName, authorizationData,
|
|
2607
|
+
(0, utils_3.upsertAuthorizationData)(authorizationDataByParentTypeName, authorizationData, invalidORScopesCoords);
|
|
2608
|
+
}
|
|
2609
|
+
for (const [namedTypeName, fieldCoords] of normalizationResult.fieldCoordsByNamedTypeName) {
|
|
2610
|
+
(0, utils_5.addIterableValuesToSet)(fieldCoords, (0, utils_5.getValueOrDefault)(fieldCoordsByNamedTypeName, namedTypeName, () => new Set()));
|
|
2713
2611
|
}
|
|
2714
2612
|
for (const [abstractTypeName, incomingConcreteTypeNames,] of normalizationResult.concreteTypeNamesByAbstractTypeName) {
|
|
2715
2613
|
const existingConcreteTypeNames = concreteTypeNamesByAbstractTypeName.get(abstractTypeName);
|
|
@@ -2779,8 +2677,8 @@ function batchNormalize(subgraphs) {
|
|
|
2779
2677
|
}
|
|
2780
2678
|
}
|
|
2781
2679
|
const allErrors = [];
|
|
2782
|
-
if (
|
|
2783
|
-
allErrors.push((0, errors_1.orScopesLimitError)(
|
|
2680
|
+
if (invalidORScopesCoords.size > 0) {
|
|
2681
|
+
allErrors.push((0, errors_1.orScopesLimitError)(constants_1.MAX_OR_SCOPES, [...invalidORScopesCoords]));
|
|
2784
2682
|
}
|
|
2785
2683
|
if (invalidNameErrorMessages.length > 0 || nonUniqueSubgraphNames.size > 0) {
|
|
2786
2684
|
allErrors.push((0, errors_1.invalidSubgraphNamesError)([...nonUniqueSubgraphNames], invalidNameErrorMessages));
|
|
@@ -2809,7 +2707,7 @@ function batchNormalize(subgraphs) {
|
|
|
2809
2707
|
if (!configurationData) {
|
|
2810
2708
|
continue;
|
|
2811
2709
|
}
|
|
2812
|
-
(0, utils_3.
|
|
2710
|
+
(0, utils_3.subtractSet)(fieldNames, configurationData.fieldNames);
|
|
2813
2711
|
if (configurationData.fieldNames.size < 1) {
|
|
2814
2712
|
internalSubgraph.configurationDataByTypeName.delete(parentTypeName);
|
|
2815
2713
|
}
|
|
@@ -2819,6 +2717,7 @@ function batchNormalize(subgraphs) {
|
|
|
2819
2717
|
authorizationDataByParentTypeName,
|
|
2820
2718
|
concreteTypeNamesByAbstractTypeName,
|
|
2821
2719
|
entityDataByTypeName,
|
|
2720
|
+
fieldCoordsByNamedTypeName,
|
|
2822
2721
|
internalSubgraphBySubgraphName: internalSubgraphBySubgraphName,
|
|
2823
2722
|
internalGraph,
|
|
2824
2723
|
success: true,
|