import { NamingStrategy } from "../naming-strategy"; import { CacheAdapter, FileCacheAdapter } from "../cache"; import { EntityFactory, EntityRepository } from "../entity"; import { AnyEntity, Constructor, Dictionary, EntityClass, EntityClassGroup, FilterDef, Highlighter, IPrimaryKey, MigrationObject } from "../typings"; import { Hydrator, ObjectHydrator } from "../hydration"; import { NullHighlighter } from "../utils/NullHighlighter"; import { Logger, LoggerNamespace } from "../utils/Logger"; import { EntityManager } from "../EntityManager"; import { EntitySchema } from "../metadata/EntitySchema"; import { MetadataProvider } from "../metadata/MetadataProvider"; import { ReflectMetadataProvider } from "../metadata/ReflectMetadataProvider"; import { EventSubscriber } from "../events"; import { IDatabaseDriver } from "../drivers/IDatabaseDriver"; import { EntityOptions } from "../decorators"; import { NotFoundError } from "../errors"; import { LoadStrategy } from "../enums"; export declare class Configuration { static readonly DEFAULTS: { pool: {}; entities: never[]; entitiesTs: never[]; subscribers: never[]; filters: {}; discovery: { warnWhenNoEntities: boolean; requireEntitiesArray: boolean; alwaysAnalyseProperties: boolean; disableDynamicFileAccess: boolean; }; strict: boolean; validate: boolean; context: () => EntityManager> | undefined; logger: { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; }; findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => NotFoundError>; baseDir: string; hydrator: typeof ObjectHydrator; loadStrategy: LoadStrategy; autoJoinOneToOneOwner: boolean; propagateToOneOwner: boolean; populateAfterFlush: boolean; forceUtcTimezone: boolean; ensureIndexes: boolean; debug: boolean; verbose: boolean; driverOptions: {}; migrations: { tableName: string; path: string; pattern: RegExp; transactional: boolean; disableForeignKeys: boolean; allOrNothing: boolean; dropTables: boolean; safe: boolean; emit: string; fileName: (timestamp: string) => string; }; cache: { pretty: boolean; adapter: typeof FileCacheAdapter; options: { cacheDir: string; }; }; metadataProvider: typeof ReflectMetadataProvider; highlighter: NullHighlighter; }; static readonly PLATFORMS: { mongo: { className: string; module: () => any; }; mysql: { className: string; module: () => any; }; mariadb: { className: string; module: () => any; }; postgresql: { className: string; module: () => any; }; sqlite: { className: string; module: () => any; }; }; private readonly options; private readonly logger; private readonly driver; private readonly platform; private readonly cache; constructor(options: Options, validate?: boolean); /** * Gets specific configuration option. Falls back to specified `defaultValue` if provided. */ get, U extends MikroORMOptions[T]>(key: T, defaultValue?: U): U; /** * Overrides specified configuration value. */ set, U extends MikroORMOptions[T]>(key: T, value: U): void; /** * Resets the configuration to its default value */ reset, U extends MikroORMOptions[T]>(key: T): void; /** * Gets Logger instance. */ getLogger(): Logger; /** * Gets current client URL (connection string). */ getClientUrl(hidePassword?: boolean): string; /** * Gets current database driver instance. */ getDriver(): D; /** * Gets instance of NamingStrategy. (cached) */ getNamingStrategy(): NamingStrategy; /** * Gets instance of Hydrator. Hydrator cannot be cached as it would have reference to wrong (global) EntityFactory. */ getHydrator(factory: EntityFactory, em: EntityManager): Hydrator; /** * Gets instance of MetadataProvider. (cached) */ getMetadataProvider(): MetadataProvider; /** * Gets instance of CacheAdapter. (cached) */ getCacheAdapter(): CacheAdapter; /** * Gets EntityRepository class to be instantiated. */ getRepositoryClass(customRepository: EntityOptions["customRepository"]): MikroORMOptions["entityRepository"]; private init; private validateOptions; private initDriver; private cached; } export interface ConnectionOptions { dbName?: string; name?: string; clientUrl?: string; host?: string; port?: number; user?: string; password?: string; charset?: string; multipleStatements?: boolean; pool?: PoolConfig; } export declare type MigrationsOptions = { tableName?: string; path?: string; pattern?: RegExp; transactional?: boolean; disableForeignKeys?: boolean; allOrNothing?: boolean; dropTables?: boolean; safe?: boolean; emit?: "js" | "ts"; fileName?: (timestamp: string) => string; migrationsList?: MigrationObject[]; }; export interface PoolConfig { name?: string; afterCreate?: (...a: unknown[]) => unknown; min?: number; max?: number; refreshIdle?: boolean; idleTimeoutMillis?: number; reapIntervalMillis?: number; returnToHead?: boolean; priorityRange?: number; log?: (message: string, logLevel: string) => void; maxWaitingClients?: number; testOnBorrow?: boolean; acquireTimeoutMillis?: number; fifo?: boolean; autostart?: boolean; evictionRunIntervalMillis?: number; numTestsPerRun?: number; softIdleTimeoutMillis?: number; Promise?: any; } export interface MikroORMOptions extends ConnectionOptions { entities: (string | EntityClass | EntityClassGroup | EntitySchema)[]; entitiesTs: (string | EntityClass | EntityClassGroup | EntitySchema)[]; subscribers: EventSubscriber[]; filters: Dictionary<{ name?: string; } & Omit, "name">>; discovery: { warnWhenNoEntities?: boolean; requireEntitiesArray?: boolean; alwaysAnalyseProperties?: boolean; disableDynamicFileAccess?: boolean; }; type?: keyof typeof Configuration.PLATFORMS; driver?: { new (config: Configuration): D; }; driverOptions: Dictionary; namingStrategy?: { new (): NamingStrategy; }; implicitTransactions?: boolean; autoJoinOneToOneOwner: boolean; propagateToOneOwner: boolean; populateAfterFlush: boolean; forceUtcTimezone: boolean; timezone?: string; ensureIndexes: boolean; hydrator: { new (factory: EntityFactory, em: EntityManager): Hydrator; }; loadStrategy: LoadStrategy; entityRepository?: Constructor>; replicas?: Partial[]; strict: boolean; validate: boolean; context: () => EntityManager | undefined; logger: (message: string) => void; findOneOrFailHandler: (entityName: string, where: Dictionary | IPrimaryKey) => Error; debug: boolean | LoggerNamespace[]; highlighter: Highlighter; tsNode?: boolean; baseDir: string; migrations: MigrationsOptions; cache: { enabled?: boolean; pretty?: boolean; adapter?: { new (...params: any[]): CacheAdapter; }; options?: Dictionary; }; metadataProvider: { new (config: Configuration): MetadataProvider; }; } export declare type Options = Pick, Exclude, keyof typeof Configuration.DEFAULTS>> & Partial>;