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