import type { AnyEntity, Constructor, EntityName as CoreEntityName, EntitySchema, ForkOptions, IDatabaseDriver, Options } from '@mikro-orm/core'; import type { MiddlewareConsumer, ModuleMetadata, Scope, Type } from '@nestjs/common'; import type { AbstractHttpAdapter } from '@nestjs/core'; export type MaybePromise = T | Promise; export interface NestMiddlewareConsumer extends MiddlewareConsumer { httpAdapter: AbstractHttpAdapter; } type MikroOrmNestScopeOptions = { /** * The NestJS provider scope to use for the EntityManager (and any subsequent downstream records). * * This scope will also impact the scope of Entity Repositories as they depend on the EntityManager. * * @see [NestJS Scope Hierarchy](https://docs.nestjs.com/fundamentals/injection-scopes#scope-hierarchy) */ scope?: Scope; /** * An optional configuration object to use when forking the Event Manager if it is configured with a scope other than Scope.DEFAULT * * This configuration option has no effect when the scope is set to Scope.DEFAULT. * * https://mikro-orm.io/api/core/interface/ForkOptions */ forkOptions?: ForkOptions; }; export type MikroOrmMiddlewareModuleOptions = { /** * Routes to apply the middleware. * * For Fastify, the middleware applies to all routes using `(.*)`. * * For all other frameworks including Express, the middleware applies to all routes using `*`. */ forRoutesPath?: string; }; export type MikroOrmModuleOptions = { registerRequestContext?: boolean; /** * Specifies whether or not to automatically load the entities based on MikroOrmModule.forFeature invocations. * * @see [MikroOrm - NestJS - Load Entities Automatically](https://mikro-orm.io/docs/usage-with-nestjs#load-entities-automatically) * * @default false */ autoLoadEntities?: boolean; } & Partial> & MikroOrmMiddlewareModuleOptions; export interface MikroOrmModuleFeatureOptions { /** * The entities to provide an EntityRepository for. * * @see [MikroOrm - NestJS - Repositories](https://mikro-orm.io/docs/usage-with-nestjs#repositories) */ entities?: EntityName[]; /** * The context (database connection) to use for the entity repository. * * @see [MikroOrm - NestJS - Multiple Database Connections](https://mikro-orm.io/docs/usage-with-nestjs#multiple-database-connections) */ contextName?: string; } export interface MikroOrmOptionsFactory { createMikroOrmOptions(contextName?: string): Promise> | MikroOrmModuleOptions; } export interface MikroOrmModuleSyncOptions extends MikroOrmModuleOptions, MikroOrmNestScopeOptions { } export interface MikroOrmModuleAsyncOptions extends Pick, MikroOrmNestScopeOptions { /** * The context name (database connection) to specify for this instance. * * When injecting repositories or entity manager instances, this context name will need to be specified where there are multiple datbaase connections. * * @see [MikroOrm - NestJS - Multiple Database Connections](https://mikro-orm.io/docs/usage-with-nestjs#multiple-database-connections) */ contextName?: string; useExisting?: Type>; useClass?: Type>; useFactory?: (...args: any[]) => Promise, 'contextName'>> | Omit, 'contextName'>; driver?: Constructor; inject?: any[]; } export declare type EntityName> = CoreEntityName | EntitySchema; export {};