Files
twenty/packages/twenty-server/src/engine/dataloaders/dataloader.interface.ts
T
Weiko 04562b11fb Migrate metadata cache (#16030)
## Context
Deprecating legacy ObjectMetadata from cache in favor of flat entities.
Introducing utils to build byName/byNameSingular/byNamePlural in
isolated cases

## Next
- I had to introduce a util to build from flat to legacy
objectMetadataMaps, we should instead use flat maps directly when needed
(datasource, schema generation, etc)
- Deprecate metadata version in the cache
- Use the new cache strategy for flat entities with permissions and
feature flags and inject in the global datasource context
2025-11-24 19:50:47 +01:00

45 lines
1.4 KiB
TypeScript

import type DataLoader from 'dataloader';
import {
type FieldMetadataLoaderPayload,
type IndexFieldMetadataLoaderPayload,
type IndexMetadataLoaderPayload,
type MorphRelationLoaderPayload,
type ObjectMetadataLoaderPayload,
type RelationLoaderPayload,
} from 'src/engine/dataloaders/dataloader.service';
import { type FieldMetadataDTO } from 'src/engine/metadata-modules/field-metadata/dtos/field-metadata.dto';
import { type RelationDTO } from 'src/engine/metadata-modules/field-metadata/dtos/relation.dto';
import { type IndexFieldMetadataDTO } from 'src/engine/metadata-modules/index-metadata/dtos/index-field-metadata.dto';
import { type IndexMetadataDTO } from 'src/engine/metadata-modules/index-metadata/dtos/index-metadata.dto';
import { type ObjectMetadataDTO } from 'src/engine/metadata-modules/object-metadata/dtos/object-metadata.dto';
export interface IDataloaders {
relationLoader: DataLoader<RelationLoaderPayload, RelationDTO | null>;
morphRelationLoader: DataLoader<
MorphRelationLoaderPayload,
RelationDTO[] | null
>;
fieldMetadataLoader: DataLoader<
FieldMetadataLoaderPayload,
FieldMetadataDTO[]
>;
indexMetadataLoader: DataLoader<
IndexMetadataLoaderPayload,
IndexMetadataDTO[]
>;
indexFieldMetadataLoader: DataLoader<
IndexFieldMetadataLoaderPayload,
IndexFieldMetadataDTO[]
>;
objectMetadataLoader: DataLoader<
ObjectMetadataLoaderPayload,
ObjectMetadataDTO | null
>;
}