Version: 4.2

Class: Reference<T>

Type parameters#

NameType
TAnyEntity<T>

Hierarchy#

Constructors#

constructor#

+ new Reference(entity: T): Reference

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

Parameters:#

NameType
entityT

Returns: Reference

Properties#

entity#

Private entity: T

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

Methods#

getEntity#

getEntity(): T

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

Returns: T


getProperty#

getProperty<K>(prop: K): T[K]

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

Type parameters:#

NameType
Kkeyof T

Parameters:#

NameType
propK

Returns: T[K]


isInitialized#

isInitialized(): boolean

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

Returns: boolean


load#

load(): Promise<T>

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

Returns: Promise<T>

load<K>(prop: K): Promise<T[K]>

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

Type parameters:#

NameType
Kkeyof T

Parameters:#

NameType
propK

Returns: Promise<T[K]>


populated#

populated(populated?: boolean): void

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

Parameters:#

NameType
populated?boolean

Returns: void


set#

set(entity: T | IdentifiedReference<T>): void

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

Parameters:#

NameType
entityT | IdentifiedReference<T>

Returns: void


toJSON#

toJSON(...args: any[]): Dictionary

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

Parameters:#

NameType
...argsany[]

Returns: Dictionary


unwrap#

unwrap(): T

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

Returns: T


create#

Staticcreate<T, PK>(entity: T | IdentifiedReference<T, PK>): IdentifiedReference<T, PK>

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

Type parameters:#

NameType
TAnyEntity<T>
PKkeyof T

Parameters:#

NameType
entityT | IdentifiedReference<T, PK>

Returns: IdentifiedReference<T, PK>


isReference#

StaticisReference<T>(data: any): data is Reference<T>

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

Checks whether the argument is instance or Reference wrapper.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
dataany

Returns: data is Reference<T>


unwrapReference#

StaticunwrapReference<T>(ref: T | Reference<T>): T

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

Returns wrapped entity.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
refT | Reference<T>

Returns: T


wrapReference#

StaticwrapReference<T>(entity: T | Reference<T>, prop: EntityProperty<T>): Reference<T> | T

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

Wraps the entity in a Reference wrapper if the property is defined as wrappedReference.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityT | Reference<T>
propEntityProperty<T>

Returns: Reference<T> | T

Last updated on by Renovate Bot