[FRONT COMPONENT] Add Front component token generation (#17855)
closes https://github.com/twentyhq/core-team-issues/issues/2180 https://github.com/user-attachments/assets/a898455d-eb1c-4d22-b585-785e98fc38a7
This commit is contained in:
@@ -103,6 +103,12 @@ export class WorkspaceSchemaFactory {
|
||||
applicationIds,
|
||||
);
|
||||
|
||||
flatObjectMetadataMaps =
|
||||
this.reconcileObjectFieldIdsWithFilteredFieldMaps(
|
||||
flatObjectMetadataMaps,
|
||||
flatFieldMetadataMaps,
|
||||
);
|
||||
|
||||
if (isDefined(allFlatIndexMaps)) {
|
||||
flatIndexMaps = this.filterFlatEntityMapsByApplicationIds(
|
||||
allFlatIndexMaps,
|
||||
@@ -188,6 +194,35 @@ export class WorkspaceSchemaFactory {
|
||||
return executableSchema;
|
||||
}
|
||||
|
||||
private reconcileObjectFieldIdsWithFilteredFieldMaps(
|
||||
flatObjectMetadataMaps: FlatEntityMaps<FlatObjectMetadata>,
|
||||
flatFieldMetadataMaps: FlatEntityMaps<FlatFieldMetadata>,
|
||||
): FlatEntityMaps<FlatObjectMetadata> {
|
||||
const filteredFieldIds = new Set(
|
||||
Object.keys(flatFieldMetadataMaps.universalIdentifierById),
|
||||
);
|
||||
|
||||
const reconciledByUniversalIdentifier: Partial<
|
||||
Record<string, FlatObjectMetadata>
|
||||
> = {};
|
||||
|
||||
for (const [universalId, object] of Object.entries(
|
||||
flatObjectMetadataMaps.byUniversalIdentifier,
|
||||
)) {
|
||||
if (!isDefined(object)) continue;
|
||||
|
||||
reconciledByUniversalIdentifier[universalId] = {
|
||||
...object,
|
||||
fieldIds: object.fieldIds.filter((id) => filteredFieldIds.has(id)),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...flatObjectMetadataMaps,
|
||||
byUniversalIdentifier: reconciledByUniversalIdentifier,
|
||||
};
|
||||
}
|
||||
|
||||
private filterFlatEntityMapsByApplicationIds<
|
||||
T extends FlatObjectMetadata | FlatFieldMetadata | FlatIndexMetadata,
|
||||
>(
|
||||
|
||||
Reference in New Issue
Block a user