UNPKG

@mikro-orm/core

Version:

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.

36 lines (35 loc) 1.87 kB
import type { EntityMetadata } from '../typings.js'; import type { Logger } from '../logging/Logger.js'; import type { SyncCacheAdapter } from '../cache/CacheAdapter.js'; import type { Platform } from '../platforms/Platform.js'; export interface IConfiguration { get(key: string, defaultValue?: any): any; getLogger(): Logger; getMetadataCacheAdapter(): SyncCacheAdapter; getPlatform(): Platform; } /** Base metadata provider that resolves entity type information and manages metadata caching. */ export declare class MetadataProvider { protected readonly config: IConfiguration; constructor(config: IConfiguration); /** Resolves entity references and type information for all properties in the given metadata. */ loadEntityMetadata(meta: EntityMetadata): void; /** * Resolves the entity name for a given class or schema, respecting explicit names * set via `defineEntity({ name })` + `setClass()`. */ private resolveEntityName; /** Merges cached metadata into the given entity metadata, preserving function expressions. */ loadFromCache(meta: EntityMetadata, cache: EntityMetadata): void; /** Whether this provider class uses metadata caching by default. */ static useCache(): boolean; /** Whether metadata caching is enabled for this instance. */ useCache(): boolean; saveToCache(meta: EntityMetadata): void; /** Attempts to load metadata from cache, returning undefined if not available. */ getCachedMetadata<T>(meta: Pick<EntityMetadata<T>, 'className' | 'path' | 'root'>, root: EntityMetadata<T>): EntityMetadata<T> | undefined; /** Combines individual metadata cache entries into a single file. */ combineCache(): void; /** Returns the cache key for the given entity metadata. */ getCacheKey(meta: Pick<EntityMetadata, 'className' | 'path'>): string; }