Fix flatFieldMetadata transpiler to fit real cache typing (#13529)

# Introduction
The cache is not accurately typed regarding the `fieldMetadataMaps` they
do not contain relations
In this way we:
- Created dedicated transpilation tools for cache manipulation
- Avoided recursivity in transpilation tools
- Fix and finalized the createMany fields metadata service v2
- Refactor the validator to handle validation :)

## What's next:
- Implem integration tests to make things run 🙃 
- migrate existing settings valdiation
- Finish the create object metadata service
- Handle update input transpilation and validation
This commit is contained in:
Paul Rastoin
2025-08-01 18:39:11 +02:00
committed by GitHub
parent dd47bfe6d5
commit b98d8c4d39
22 changed files with 383 additions and 123 deletions
@@ -0,0 +1,14 @@
import { FieldMetadataType } from 'twenty-shared/types';
import { CachedFieldMetadataEntity } from 'src/engine/metadata-modules/types/cached-field-metadata-entity';
export function isCachedFieldMetadataEntityOfType<
Field extends CachedFieldMetadataEntity<FieldMetadataType>,
Type extends FieldMetadataType,
>(
fieldMetadata: Pick<Field, 'type'>,
type: Type,
): fieldMetadata is CachedFieldMetadataEntity &
CachedFieldMetadataEntity<Type> {
return fieldMetadata.type === type;
}