Skip to main content
Version: Next

Module: core

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#

NameType
TT = any

Defined in#

packages/core/src/typings.ts:114


Cast#

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

Type parameters#

Name
T
R

Defined in#

packages/core/src/typings.ts:13


Constructor#

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

Type parameters#

NameType
TT = unknown

Type declaration#

• (...args)

Parameters#
NameType
...argsany[]

Defined in#

packages/core/src/typings.ts:9


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:16


Dictionary#

Ƭ Dictionary<T>: Object

Type parameters#

NameType
TT = any

Index signature#

▪ [k: string]: T

Defined in#

packages/core/src/typings.ts:10


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


EntityDTO#

Ƭ EntityDTO<T>: { [K in keyof T as ExcludeFunctions<T, K>]: EntityDTOProp<T[K]>}

Type parameters#

Name
T

Defined in#

packages/core/src/typings.ts:164


EntityData#

Ƭ EntityData<T>: { [K in keyof T]?: EntityDataItem<T[K]>}

Type parameters#

Name
T

Defined in#

packages/core/src/typings.ts:147


EntityDictionary#

Ƭ EntityDictionary<T>: EntityData<T> & Dictionary

Type parameters#

Name
T

Defined in#

packages/core/src/typings.ts:148


EntityLoaderOptions#

Ƭ EntityLoaderOptions<T>: Object

Type parameters#

Name
T

Type declaration#

NameType
convertCustomTypes?boolean
fields?(string | FieldsMap)[]
filters?Dictionary<boolean | Dictionary> | string[] | boolean
lookup?boolean
orderBy?QueryOrderMap
refresh?boolean
strategy?LoadStrategy
validate?boolean
where?FilterQuery<T>

Defined in#

packages/core/src/entity/EntityLoader.ts:11


EntityName#

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

Type parameters#

NameType
TT: AnyEntity<T>

Defined in#

packages/core/src/typings.ts:125


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
schema?string
tableName?string

Defined in#

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


FieldsMap#

Ƭ FieldsMap: Object

Index signature#

▪ [K: string]: (string | FieldsMap)[]

Defined in#

packages/core/src/drivers/IDatabaseDriver.ts:82


FilterQuery#

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

Type parameters#

Name
T

Defined in#

packages/core/src/typings.ts:79


GetRepository#

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

Type parameters#

NameType
TT: AnyEntity<T>
UU

Defined in#

packages/core/src/typings.ts:126


IPrimaryKey#

Ƭ IPrimaryKey<T>: T

Type parameters#

NameType
TT: IPrimaryKeyValue = IPrimaryKeyValue

Defined in#

packages/core/src/typings.ts:40


IdentifiedReference#

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

Type parameters#

NameType
TT: AnyEntity<T>
PKPK: keyof T | unknown = PrimaryProperty<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:14


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#

NameType
TT: AnyEntity<T>
PP = unknown

Defined in#

packages/core/src/typings.ts:458


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
snapshot?boolean
tableName?string
transactional?boolean

Defined in#

packages/core/src/utils/Configuration.ts:310


New#

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

Type parameters#

NameType
TT: AnyEntity<T>
PP = string[]

Defined in#

packages/core/src/typings.ts:466


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#

NameType
DD: IDatabaseDriver = IDatabaseDriver

Defined in#

packages/core/src/utils/Configuration.ts:406


Populate#

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

Type parameters#

Name
T

Defined in#

packages/core/src/typings.ts:420


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:422


Primary#

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

Type parameters#

Name
T

Defined in#

packages/core/src/typings.ts:29


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:34


PropertyOptions#

Ƭ PropertyOptions<T>: Object

Type parameters#

Name
T

Type declaration#

NameType
autoincrement?boolean
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
getter?boolean
hidden?boolean
index?boolean | string
lazy?boolean
length?number
name?string
nullable?boolean
onCreate?(entity: T) => any
onUpdate?(entity: T) => any
persist?boolean
precision?number
primary?boolean
scale?number
serializedName?string
serializedPrimaryKey?boolean
serializer?(value: any) => any
setter?boolean
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#

NameType
TT = any

Defined in#

packages/core/src/typings.ts:80


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


Transaction#

Ƭ Transaction<T>: T

Type parameters#

NameType
TT = any

Defined in#

packages/core/src/connections/Connection.ts:146


TransactionEventType#

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

Defined in#

packages/core/src/enums.ts:128

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:24


ObjectBindingPattern#

Const ObjectBindingPattern: typeof ObjectBindingPattern

Defined in#

packages/core/src/utils/Utils.ts:23


PrimaryKeyProp#

Const PrimaryKeyProp: typeof PrimaryKeyProp

Defined in#

packages/core/src/typings.ts:26


PrimaryKeyType#

Const PrimaryKeyType: typeof PrimaryKeyType

Defined in#

packages/core/src/typings.ts:25


SCALAR_TYPES#

Const SCALAR_TYPES: string[]

Defined in#

packages/core/src/enums.ts:67


t#

Const t: Object

Type declaration#

NameType
arraytypeof ArrayType
biginttypeof BigIntType
blobtypeof BlobType
booleantypeof BooleanType
datetypeof DateType
datetimetypeof DateTimeType
decimaltypeof DecimalType
doubletypeof DoubleType
enumtypeof EnumType
enumArraytypeof EnumArrayType
floattypeof FloatType
integertypeof IntegerType
jsontypeof JsonType
smallinttypeof SmallIntType
stringtypeof StringType
texttypeof TextType
timetypeof TimeType
tinyinttypeof TinyIntType
uuidtypeof UuidType

Defined in#

packages/core/src/types/index.ts:29

Functions#

AfterCreate#

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

Returns#

fn

▸ (target, method): void

Parameters#
NameType
targetany
methodstring
Returns#

void

Defined in#

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


AfterDelete#

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

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

Returns#

fn

▸ (target, method): void

Parameters#
NameType
targetany
methodstring
Returns#

void

Defined in#

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


AfterUpdate#

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

Returns#

fn

▸ (target, method): void

Parameters#
NameType
targetany
methodstring
Returns#

void

Defined in#

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


BeforeCreate#

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

Returns#

fn

▸ (target, method): void

Parameters#
NameType
targetany
methodstring
Returns#

void

Defined in#

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


BeforeDelete#

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

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

Returns#

fn

▸ (target, method): void

Parameters#
NameType
targetany
methodstring
Returns#

void

Defined in#

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


BeforeUpdate#

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

Returns#

fn

▸ (target, method): void

Parameters#
NameType
targetany
methodstring
Returns#

void

Defined in#

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


Embeddable#

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

Returns#

fn

▸ <T>(target): T & Dictionary<any>

Type parameters#
Name
T
Parameters#
NameType
targetT & Dictionary<any>
Returns#

T & Dictionary<any>

Defined in#

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


Embedded#

Embedded(type?, options?): (target: AnyEntity<any>, propertyName: string) => any

Parameters#

NameType
typeEmbeddedOptions | () => AnyEntity
optionsEmbeddedOptions

Returns#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


Entity#

Entity(options?): <T>(target: T & Dictionary<any>) => T & Dictionary<any>

Parameters#

NameType
optionsEntityOptions<any>

Returns#

fn

▸ <T>(target): T & Dictionary<any>

Type parameters#
Name
T
Parameters#
NameType
targetT & Dictionary<any>
Returns#

T & Dictionary<any>

Defined in#

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


Enum#

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

Parameters#

NameType
optionsEnumOptions<AnyEntity> | () => Dictionary

Returns#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


Filter#

Filter<T>(options): <U>(target: U & Dictionary<any>) => U & Dictionary<any>

Type parameters#

Name
T

Parameters#

NameType
optionsFilterDef<T>

Returns#

fn

▸ <U>(target): U & Dictionary<any>

Type parameters#
Name
U
Parameters#
NameType
targetU & Dictionary<any>
Returns#

U & Dictionary<any>

Defined in#

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


Formula#

Formula<T>(formula, options?): (target: AnyEntity<any>, propertyName: string) => any

Type parameters#

Name
T

Parameters#

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

Returns#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


Index#

Index<T>(options?): (target: AnyEntity<any>, propertyName?: string) => any

Type parameters#

Name
T

Parameters#

NameType
optionsIndexOptions<T>

Returns#

fn

▸ (target, propertyName?): any

Parameters#
NameType
targetAnyEntity<any>
propertyName?string
Returns#

any

Defined in#

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


ManyToMany#

ManyToMany<T, O>(entity?, mappedBy?, options?): (target: AnyEntity<any>, propertyName: string) => any

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#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


ManyToOne#

ManyToOne<T, O>(entity?, options?): (target: AnyEntity<any>, propertyName: string) => any

Type parameters#

Name
T
O

Parameters#

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

Returns#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


OnInit#

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

Returns#

fn

▸ (target, method): void

Parameters#
NameType
targetany
methodstring
Returns#

void

Defined in#

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


OneToMany#

OneToMany<T, O>(entity, mappedBy, options?): (target: AnyEntity, propertyName: string) => void

Type parameters#

Name
T
O

Parameters#

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

Returns#

fn

▸ (target, propertyName): void

Parameters#
NameType
targetAnyEntity
propertyNamestring
Returns#

void

Defined in#

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

OneToMany<T, O>(options): (target: AnyEntity, propertyName: string) => void

Type parameters#

Name
T
O

Parameters#

NameType
optionsOneToManyOptions<T, O>

Returns#

fn

▸ (target, propertyName): void

Parameters#
NameType
targetAnyEntity
propertyNamestring
Returns#

void

Defined in#

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


OneToOne#

OneToOne<T, O>(entity?, mappedBy?, options?): (target: AnyEntity<any>, propertyName: string) => any

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#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


PrimaryKey#

PrimaryKey<T>(options?): (target: AnyEntity<any>, propertyName: string) => any

Type parameters#

Name
T

Parameters#

NameType
optionsPrimaryKeyOptions<T>

Returns#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


Property#

Property<T>(options?): (target: AnyEntity<any>, propertyName: string) => any

Type parameters#

Name
T

Parameters#

NameType
optionsPropertyOptions<T>

Returns#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


Repository#

Repository<T>(entity): (target: Constructor<EntityRepository<T>>) => void

Type parameters#

NameType
TT: AnyEntity<any>

Parameters#

NameType
entityEntityClass<T>

Returns#

fn

▸ (target): void

Parameters#
NameType
targetConstructor<EntityRepository<T>>
Returns#

void

Defined in#

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


SerializedPrimaryKey#

SerializedPrimaryKey<T>(options?): (target: AnyEntity<any>, propertyName: string) => any

Type parameters#

Name
T

Parameters#

NameType
optionsSerializedPrimaryKeyOptions<T>

Returns#

fn

▸ (target, propertyName): any

Parameters#
NameType
targetAnyEntity<any>
propertyNamestring
Returns#

any

Defined in#

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


Subscriber#

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

Returns#

fn

▸ (target): void

Parameters#
NameType
targetConstructor<EventSubscriber<any>>
Returns#

void

Defined in#

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


Unique#

Unique<T>(options?): (target: AnyEntity<any>, propertyName?: string) => any

Type parameters#

Name
T

Parameters#

NameType
optionsUniqueOptions<T>

Returns#

fn

▸ (target, propertyName?): any

Parameters#
NameType
targetAnyEntity<any>
propertyName?string
Returns#

any

Defined in#

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


assign#

Const assign<T>(entity, data, options?): T

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

NameType
entityT
dataEntityData<T> | Partial<EntityDTO<T>>
options?AssignOptions

Returns#

T

Defined in#

packages/core/src/entity/EntityAssigner.ts:202

Const assign<T>(entity, data, onlyProperties?): T

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

NameType
entityT
dataEntityData<T> | Partial<EntityDTO<T>>
onlyProperties?boolean

Returns#

T

Defined in#

packages/core/src/entity/EntityAssigner.ts:202


compareArrays#

compareArrays(a, b): boolean

Parameters#

NameType
aany[]
bany[]

Returns#

boolean

Defined in#

packages/core/src/utils/Utils.ts:68


compareBuffers#

compareBuffers(a, b): boolean

Parameters#

NameType
aBuffer
bBuffer

Returns#

boolean

Defined in#

packages/core/src/utils/Utils.ts:85


compareObjects#

compareObjects(a, b): boolean

Parameters#

NameType
aany
bany

Returns#

boolean

Defined in#

packages/core/src/utils/Utils.ts:25


equals#

equals(a, b): boolean

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

Parameters#

NameType
aany
bany

Returns#

boolean

Defined in#

packages/core/src/utils/Utils.ts:104


expr#

Const expr(sql): string

Parameters#

NameType
sqlstring

Returns#

string

Defined in#

packages/core/src/utils/QueryHelper.ts:253


wrap#

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

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

Type parameters#

NameType
TT
PKPK: unknown = PrimaryProperty<T>

Parameters#

NameType
entityT
preferHelpertrue

Returns#

IWrappedEntityInternal<T, PK>

Defined in#

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

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

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

Type parameters#

NameType
TT
PKPK: unknown = PrimaryProperty<T>

Parameters#

NameType
entityT
preferHelper?false

Returns#

IWrappedEntity<T, PK>

Defined in#

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