Skip to main content
Version: 4.5

Module: core#

Table of contents#

Enumerations#

Classes#

Interfaces#

Type aliases#

AnyEntity#

Ƭ AnyEntity<T>: Partial<T> & { [EntityRepositoryType]?: unknown ; [PrimaryKeyType]?: unknown ; __helper?: IWrappedEntityInternal<T, keyof T> ; __meta?: EntityMetadata<T> ; __platform?: Platform }

Type parameters:#

NameDefault
Tany

Defined in: packages/core/src/typings.ts:110


Cast#

Ƭ Cast<T, R>: T extends R ? T : R

Type parameters:#

Name
T
R

Defined in: packages/core/src/typings.ts:12


Constructor#

Ƭ Constructor<T>: (...args: any[]) => T

Type parameters:#

Name
T

Type declaration:#

+ (...args: any[]): T

Parameters:#

NameType
...argsany[]

Returns: T

Defined in: packages/core/src/typings.ts:8


DeepPartial#

Ƭ DeepPartial<T>: T & { [P in keyof T]?: T[P] extends infer U[] ? DeepPartial<U>[] : T[P] extends Readonly<infer U>[] ? Readonly<DeepPartial<U>>[] : DeepPartial<T[P]>}

Type parameters:#

Name
T

Defined in: packages/core/src/typings.ts:15


Dictionary#

Ƭ Dictionary<T>: object

Type parameters:#

NameDefault
Tany

Type declaration:#

Defined in: packages/core/src/typings.ts:9


EmbeddedOptions#

Ƭ EmbeddedOptions: object

Type declaration:#

NameType
array?boolean
entity?string | () => AnyEntity
nullable?boolean
object?boolean
prefix?string | boolean
type?string

Defined in: packages/core/src/decorators/Embedded.ts:19


EntityData#

Ƭ EntityData<T>: { [P in keyof T]?: T[P] | any} & Dictionary

Type parameters:#

Name
T

Defined in: packages/core/src/typings.ts:122


EntityName#

Ƭ EntityName<T>: string | EntityClass<T> | EntitySchema<T, any>

Type parameters:#

NameType
TAnyEntity<T>

Defined in: packages/core/src/typings.ts:121


EntityOptions#

Ƭ EntityOptions<T>: object

Type parameters:#

Name
T

Type declaration:#

NameType
abstract?boolean
collection?string
comment?string
customRepository?() => Constructor<EntityRepository<T>>
discriminatorColumn?string
discriminatorMap?Dictionary<string>
discriminatorValue?string
readonly?boolean
tableName?string

Defined in: packages/core/src/decorators/Entity.ts:20


FieldsMap#

Ƭ FieldsMap: object

Type declaration:#

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:80


FilterQuery#

Ƭ FilterQuery<T>: NonNullable<Query<T>> | { [PrimaryKeyType]?: any }

Type parameters:#

Name
T

Defined in: packages/core/src/typings.ts:76


GetRepository#

Ƭ GetRepository<T, U>: T[typeof EntityRepositoryType] extends EntityRepository<any> | undefined ? NonNullable<T[typeof EntityRepositoryType]> : U

Type parameters:#

NameType
TAnyEntity<T>
U-

Defined in: packages/core/src/typings.ts:123


IPrimaryKey#

Ƭ IPrimaryKey<T>: T

Type parameters:#

NameTypeDefault
TIPrimaryKeyValueIPrimaryKeyValue

Defined in: packages/core/src/typings.ts:37


IdentifiedReference#

Ƭ IdentifiedReference<T, PK>: true extends IsUnknown<PK> ? Reference<T> : { [K in Cast<PK, keyof T>]: T[K]} & Reference<T>

Type parameters:#

NameTypeDefault
TAnyEntity<T>-
PKkeyof T | unknownPrimaryProperty<T>

Defined in: packages/core/src/entity/Reference.ts:4


IsUnknown#

Ƭ IsUnknown<T>: T extends unknown ? unknown extends T ? true : never : never

Type parameters:#

Name
T

Defined in: packages/core/src/typings.ts:13


Loaded#

Ƭ Loaded<T, P>: unknown extends P ? T : T & { [K in keyof RelationsIn<T>]: P extends readonly infer U[] ? LoadedIfInKeyHint<T, K, U> : P extends NestedLoadHint<T> ? LoadedIfInNestedHint<T, K, P> : LoadedIfInKeyHint<T, K, P>}

Type parameters:#

NameTypeDefault
TAnyEntity<T>-
P-unknown

Defined in: packages/core/src/typings.ts:413


LoggerNamespace#

Ƭ LoggerNamespace: query | query-params | discovery | info

Defined in: packages/core/src/utils/Logger.ts:34


MigrationsOptions#

Ƭ MigrationsOptions: object

Type declaration:#

NameType
allOrNothing?boolean
disableForeignKeys?boolean
dropTables?boolean
emit?js | ts
fileName?(timestamp: string) => string
migrationsList?MigrationObject[]
path?string
pattern?RegExp
safe?boolean
tableName?string
transactional?boolean

Defined in: packages/core/src/utils/Configuration.ts:302


New#

Ƭ New<T, P>: Loaded<T, P>

Type parameters:#

NameTypeDefault
TAnyEntity<T>-
P-string[]

Defined in: packages/core/src/typings.ts:421


ORMDomain#

Ƭ ORMDomain: Domain & { __mikro_orm_context?: RequestContext }

Defined in: packages/core/src/utils/RequestContext.ts:5


OneToManyOptions#

Ƭ OneToManyOptions<T, O>: ReferenceOptions<T, O> & { entity?: string | () => EntityName<T> ; inverseJoinColumn?: string ; inverseJoinColumns?: string[] ; joinColumn?: string ; joinColumns?: string[] ; mappedBy: string & keyof T | (e: T) => any ; orderBy?: { [field: string]: QueryOrder; } ; orphanRemoval?: boolean ; referenceColumnName?: string }

Type parameters:#

Name
T
O

Defined in: packages/core/src/decorators/OneToMany.ts:40


Options#

Ƭ Options<D>: Pick<MikroORMOptions<D>, Exclude<keyof MikroORMOptions<D>, keyof typeof DEFAULTS>> & Partial<MikroORMOptions<D>>

Type parameters:#

NameTypeDefault
DIDatabaseDriverIDatabaseDriver

Defined in: packages/core/src/utils/Configuration.ts:396


Populate#

Ƭ Populate<T>: readonly keyof T[] | readonly string[] | boolean | PopulateMap<T>

Type parameters:#

Name
T

Defined in: packages/core/src/typings.ts:375


PopulateOptions#

Ƭ PopulateOptions<T>: object

Type parameters:#

Name
T

Type declaration:#

NameType
all?boolean
children?PopulateOptions<T[keyof T]>[]
fieldstring
strategy?LoadStrategy

Defined in: packages/core/src/typings.ts:377


Primary#

Ƭ Primary<T>: T extends { [PrimaryKeyType]: infer PK } ? PK : T extends { _id: infer PK } ? PK | string : T extends { uuid: infer PK } ? PK : T extends { id: infer PK } ? PK : never

Type parameters:#

Name
T

Defined in: packages/core/src/typings.ts:26


PrimaryProperty#

Ƭ PrimaryProperty<T>: T extends { [PrimaryKeyProp]?: infer PK } ? PK : T extends { _id: any } ? _id | string : T extends { uuid: any } ? uuid : T extends { id: any } ? id : never

Type parameters:#

Name
T

Defined in: packages/core/src/typings.ts:31


PropertyOptions#

Ƭ PropertyOptions<T>: object

Type parameters:#

Name
T

Type declaration:#

NameType
columnType?string
comment?string
customType?Type<any>
default?string | string[] | number | number[] | boolean | null
defaultRaw?string
fieldName?string
fieldNames?string[]
formula?string | (alias: string) => string
hidden?boolean
index?boolean | string
lazy?boolean
length?number
name?string
nullable?boolean
onCreate?(entity: T) => any
onUpdate?(entity: T) => any
persist?boolean
primary?boolean
serializedName?string
serializedPrimaryKey?boolean
serializer?(value: any) => any
type?string | number | boolean | bigint | ObjectId | string | unknown | bigint | Date | Constructor<Type<any>> | Type<any>
unique?boolean | string
unsigned?boolean
version?boolean

Defined in: packages/core/src/decorators/Property.ts:37


QBFilterQuery#

Ƭ QBFilterQuery<T>: FilterQuery<T> & Dictionary | FilterQuery<T>

Type parameters:#

NameDefault
Tany

Defined in: packages/core/src/typings.ts:77


QueryOrderKeys#

Ƭ QueryOrderKeys: QueryOrderKeysFlat | QueryOrderMap

Defined in: packages/core/src/enums.ts:47


QueryOrderKeysFlat#

Ƭ QueryOrderKeysFlat: QueryOrder | QueryOrderNumeric | keyof typeof QueryOrder

Defined in: packages/core/src/enums.ts:46


TXDomain#

Ƭ TXDomain: Domain & { __mikro_orm_tx_context?: TransactionContext }

Defined in: packages/core/src/utils/TransactionContext.ts:5


Transaction#

Ƭ Transaction<T>: T

Type parameters:#

NameDefault
Tany

Defined in: packages/core/src/connections/Connection.ts:141


TransactionEventType#

Ƭ TransactionEventType: beforeTransactionStart | afterTransactionStart | beforeTransactionCommit | afterTransactionCommit | beforeTransactionRollback | afterTransactionRollback

Defined in: packages/core/src/enums.ts:115

Variables#

ARRAY_OPERATORS#

Const ARRAY_OPERATORS: string[]

Defined in: packages/core/src/enums.ts:24


EntityManagerType#

Const EntityManagerType: typeof EntityManagerType

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:10


EntityRepositoryType#

Const EntityRepositoryType: typeof EntityRepositoryType

Defined in: packages/core/src/typings.ts:23


ObjectBindingPattern#

Const ObjectBindingPattern: typeof ObjectBindingPattern

Defined in: packages/core/src/utils/Utils.ts:14


PrimaryKeyProp#

Const PrimaryKeyProp: typeof PrimaryKeyProp

Defined in: packages/core/src/typings.ts:25


PrimaryKeyType#

Const PrimaryKeyType: typeof PrimaryKeyType

Defined in: packages/core/src/typings.ts:24


SCALAR_TYPES#

Const SCALAR_TYPES: string[]

Defined in: packages/core/src/enums.ts:66

Functions#

AfterCreate#

AfterCreate(): function

Returns: (target: any, method: string) => void

Defined in: packages/core/src/decorators/hooks.ts:20


AfterDelete#

AfterDelete(): function

Called after deleting entity, but only when providing initialized entity to EM#remove()

Returns: (target: any, method: string) => void

Defined in: packages/core/src/decorators/hooks.ts:46


AfterUpdate#

AfterUpdate(): function

Returns: (target: any, method: string) => void

Defined in: packages/core/src/decorators/hooks.ts:28


BeforeCreate#

BeforeCreate(): function

Returns: (target: any, method: string) => void

Defined in: packages/core/src/decorators/hooks.ts:16


BeforeDelete#

BeforeDelete(): function

Called before deleting entity, but only when providing initialized entity to EM#remove()

Returns: (target: any, method: string) => void

Defined in: packages/core/src/decorators/hooks.ts:39


BeforeUpdate#

BeforeUpdate(): function

Returns: (target: any, method: string) => void

Defined in: packages/core/src/decorators/hooks.ts:24


Embeddable#

Embeddable(): function

Returns: <T>(target: T & Dictionary<any>) => T & Dictionary<any>

Defined in: packages/core/src/decorators/Embeddable.ts:4


Embedded#

Embedded(type?: EmbeddedOptions | () => AnyEntity, options?: EmbeddedOptions): function

Parameters:#

NameType
typeEmbeddedOptions | () => AnyEntity
optionsEmbeddedOptions

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/Embedded.ts:6


Entity#

Entity(options?: EntityOptions<any>): function

Parameters:#

NameType
optionsEntityOptions<any>

Returns: <T>(target: T & Dictionary<any>) => T & Dictionary<any>

Defined in: packages/core/src/decorators/Entity.ts:6


Enum#

Enum(options?: EnumOptions<AnyEntity> | () => Dictionary): function

Parameters:#

NameType
optionsEnumOptions<AnyEntity> | () => Dictionary

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/Enum.ts:7


Filter#

Filter<T>(options: FilterDef<T>): function

Type parameters:#

Name
T

Parameters:#

NameType
optionsFilterDef<T>

Returns: <U>(target: U & Dictionary<any>) => U & Dictionary<any>

Defined in: packages/core/src/decorators/Filter.ts:4


Formula#

Formula<T>(formula: string | (alias: string) => string, options?: FormulaOptions<T>): function

Type parameters:#

Name
T

Parameters:#

NameType
formulastring | (alias: string) => string
optionsFormulaOptions<T>

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/Formula.ts:7


Index#

Index<T>(options?: IndexOptions<T>): function

Type parameters:#

Name
T

Parameters:#

NameType
optionsIndexOptions<T>

Returns: (target: AnyEntity<any>, propertyName?: string) => any

Defined in: packages/core/src/decorators/Indexed.ts:20


ManyToMany#

ManyToMany<T, O>(entity?: ManyToManyOptions<T, O> | string | () => EntityName<T>, mappedBy?: string & keyof T | (e: T) => any, options?: Partial<ManyToManyOptions<T, O>>): function

Type parameters:#

Name
T
O

Parameters:#

NameType
entity?ManyToManyOptions<T, O> | string | () => EntityName<T>
mappedBy?string & keyof T | (e: T) => any
optionsPartial<ManyToManyOptions<T, O>>

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/ManyToMany.ts:7


ManyToOne#

ManyToOne<T, O>(entity?: ManyToOneOptions<T, O> | string | (e?: any) => EntityName<T>, options?: Partial<ManyToOneOptions<T, O>>): function

Type parameters:#

Name
T
O

Parameters:#

NameType
entityManyToOneOptions<T, O> | string | (e?: any) => EntityName<T>
optionsPartial<ManyToOneOptions<T, O>>

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/ManyToOne.ts:7


OnInit#

OnInit(): function

Returns: (target: any, method: string) => void

Defined in: packages/core/src/decorators/hooks.ts:32


OneToMany#

OneToMany<T, O>(entity: string | (e?: any) => EntityName<T>, mappedBy: string & keyof T | (e: T) => any, options?: Partial<OneToManyOptions<T, O>>): function

Type parameters:#

Name
T
O

Parameters:#

NameType
entitystring | (e?: any) => EntityName<T>
mappedBystring & keyof T | (e: T) => any
options?Partial<OneToManyOptions<T, O>>

Returns: (target: AnyEntity, propertyName: string) => void

Defined in: packages/core/src/decorators/OneToMany.ts:24

OneToMany<T, O>(options: OneToManyOptions<T, O>): function

Type parameters:#

Name
T
O

Parameters:#

NameType
optionsOneToManyOptions<T, O>

Returns: (target: AnyEntity, propertyName: string) => void

Defined in: packages/core/src/decorators/OneToMany.ts:29


OneToOne#

OneToOne<T, O>(entity?: OneToOneOptions<T, O> | string | (e?: any) => EntityName<T>, mappedBy?: string & keyof T | (e: T) => any, options?: Partial<OneToOneOptions<T, O>>): function

Type parameters:#

Name
T
O

Parameters:#

NameType
entity?OneToOneOptions<T, O> | string | (e?: any) => EntityName<T>
mappedBy?string & keyof T | (e: T) => any
optionsPartial<OneToOneOptions<T, O>>

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/OneToOne.ts:5


PrimaryKey#

PrimaryKey<T>(options?: PrimaryKeyOptions<T>): function

Type parameters:#

Name
T

Parameters:#

NameType
optionsPrimaryKeyOptions<T>

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/PrimaryKey.ts:19


Property#

Property<T>(options?: PropertyOptions<T>): function

Type parameters:#

Name
T

Parameters:#

NameType
optionsPropertyOptions<T>

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/Property.ts:7


Repository#

Repository<T>(entity: EntityClass<T>): function

Type parameters:#

NameType
TAnyEntity<any>

Parameters:#

NameType
entityEntityClass<T>

Returns: (target: Constructor<EntityRepository<T>>) => void

Defined in: packages/core/src/decorators/Repository.ts:5


SerializedPrimaryKey#

SerializedPrimaryKey<T>(options?: SerializedPrimaryKeyOptions<T>): function

Type parameters:#

Name
T

Parameters:#

NameType
optionsSerializedPrimaryKeyOptions<T>

Returns: (target: AnyEntity<any>, propertyName: string) => any

Defined in: packages/core/src/decorators/PrimaryKey.ts:23


Subscriber#

Subscriber(): function

Returns: (target: Constructor<EventSubscriber<any>>) => void

Defined in: packages/core/src/decorators/Subscriber.ts:5


Unique#

Unique<T>(options?: UniqueOptions<T>): function

Type parameters:#

Name
T

Parameters:#

NameType
optionsUniqueOptions<T>

Returns: (target: AnyEntity<any>, propertyName?: string) => any

Defined in: packages/core/src/decorators/Indexed.ts:24


assign#

Constassign<T>(entity: T, data: EntityData<T>, options?: AssignOptions): T

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityT
dataEntityData<T>
options?AssignOptions

Returns: T

Defined in: packages/core/src/entity/EntityAssigner.ts:183

Constassign<T>(entity: T, data: EntityData<T>, onlyProperties?: boolean): T

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityT
dataEntityData<T>
onlyProperties?boolean

Returns: T

Defined in: packages/core/src/entity/EntityAssigner.ts:183


compareArrays#

compareArrays(a: any[], b: any[]): boolean

Parameters:#

NameType
aany[]
bany[]

Returns: boolean

Defined in: packages/core/src/utils/Utils.ts:59


compareBuffers#

compareBuffers(a: Buffer, b: Buffer): boolean

Parameters:#

NameType
aBuffer
bBuffer

Returns: boolean

Defined in: packages/core/src/utils/Utils.ts:76


compareObjects#

compareObjects(a: any, b: any): boolean

Parameters:#

NameType
aany
bany

Returns: boolean

Defined in: packages/core/src/utils/Utils.ts:16


equals#

equals(a: any, b: any): boolean

Checks if arguments are deeply (but not strictly) equal.

Parameters:#

NameType
aany
bany

Returns: boolean

Defined in: packages/core/src/utils/Utils.ts:95


expr#

Constexpr(sql: string): string

Parameters:#

NameType
sqlstring

Returns: string

Defined in: packages/core/src/utils/QueryHelper.ts:261


wrap#

wrap<T, PK>(entity: T, preferHelper: true): IWrappedEntityInternal<T, PK>

returns WrappedEntity instance associated with this entity. This includes all the internal properties like __meta or __em.

Type parameters:#

NameType
T-
PKstring | number | symbol

Parameters:#

NameType
entityT
preferHelpertrue

Returns: IWrappedEntityInternal<T, PK>

Defined in: packages/core/src/entity/wrap.ts:6

wrap<T, PK>(entity: T, preferHelper?: false): IWrappedEntity<T, PK>

wraps entity type with WrappedEntity internal properties and helpers like init/isInitialized/populated/toJSON

Type parameters:#

NameType
T-
PKstring | number | symbol

Parameters:#

NameType
entityT
preferHelper?false

Returns: IWrappedEntity<T, PK>

Defined in: packages/core/src/entity/wrap.ts:11

Last updated on by Renovate Bot