Improve object metadata maps size (#8635)

## Context
The object metadata map is becoming quite large and its structure could
be simplified.
We are removing byNameSingular/byNamePlural keys, the former can be
retrieved through a new helper and the latter is not used in the code
base currently.
This commit is contained in:
Weiko
2024-11-21 11:49:19 +01:00
committed by GitHub
parent 8772f8aac7
commit 24dbabcad7
10 changed files with 130 additions and 29 deletions

View File

@ -9,8 +9,7 @@ export const generateObjectMetadataMaps = (
): ObjectMetadataMaps => {
const objectMetadataMaps: ObjectMetadataMaps = {
byId: {},
byNameSingular: {},
byNamePlural: {},
idByNameSingular: {},
};
for (const objectMetadata of objectMetadataCollection) {
@ -29,10 +28,8 @@ export const generateObjectMetadataMaps = (
};
objectMetadataMaps.byId[objectMetadata.id] = processedObjectMetadata;
objectMetadataMaps.byNameSingular[objectMetadata.nameSingular] =
processedObjectMetadata;
objectMetadataMaps.byNamePlural[objectMetadata.namePlural] =
processedObjectMetadata;
objectMetadataMaps.idByNameSingular[objectMetadata.nameSingular] =
objectMetadata.id;
}
return objectMetadataMaps;