import type { EntityManagerType, IDatabaseDriver } from './drivers'; import { MetadataStorage, type EntitySchema } from './metadata'; import { Configuration, type Options } from './utils'; import type { EntityManager } from './EntityManager'; import type { Constructor, EntityMetadata, EntityName, IEntityGenerator, IMigrator, ISeedManager } from './typings'; /** * Helper class for bootstrapping the MikroORM. */ export declare class MikroORM { /** The global EntityManager instance. If you are using `RequestContext` helper, it will automatically pick the request specific context under the hood */ em: EM; readonly config: Configuration; private metadata; private readonly driver; private readonly logger; private readonly discovery; /** * Initialize the ORM, load entity metadata, create EntityManager and connect to the database. * If you omit the `options` parameter, your CLI config will be used. */ static init(options?: Options): Promise>; /** * Synchronous variant of the `init` method with some limitations: * - database connection will be established when you first interact with the database (or you can use `orm.connect()` explicitly) * - no loading of the `config` file, `options` parameter is mandatory * - no support for folder based discovery * - no check for mismatched package versions */ static initSync(options: Options): MikroORM; constructor(options: Options | Configuration); /** * Connects to the database. */ connect(): Promise; /** * Reconnects, possibly to a different database. */ reconnect(options?: Options): Promise; /** * Checks whether the database connection is active. */ isConnected(): Promise; /** * Checks whether the database connection is active, returns . */ checkConnection(): Promise<{ ok: true; } | { ok: false; reason: string; error?: Error; }>; /** * Closes the database connection. */ close(force?: boolean): Promise; /** * Gets the `MetadataStorage`. */ getMetadata(): MetadataStorage; /** * Gets the `EntityMetadata` instance when provided with the `entityName` parameter. */ getMetadata(entityName: EntityName): EntityMetadata; discoverEntities(): Promise; discoverEntitiesSync(): void; private createEntityManager; /** * Allows dynamically discovering new entity by reference, handy for testing schema diffing. */ discoverEntity(entities: T | T[], reset?: string | string[]): void; /** * Gets the SchemaGenerator. * @deprecated use `orm.schema` instead */ getSchemaGenerator(): ReturnType['getSchemaGenerator']>; /** * Gets the EntityGenerator. * @deprecated use `orm.entityGenerator` instead */ getEntityGenerator(): T; /** * Gets the Migrator. * @deprecated use `orm.migrator` instead */ getMigrator(): T; /** * Gets the SeedManager * @deprecated use `orm.seeder` instead */ getSeeder(): T; /** * Gets the SchemaGenerator. */ get schema(): ReturnType['getSchemaGenerator']>; /** * Gets the SeedManager */ get seeder(): ISeedManager; /** * Gets the Migrator. */ get migrator(): IMigrator; /** * Gets the EntityGenerator. */ get entityGenerator(): IEntityGenerator; }