Version: 4.3

Interface: LoadedReference<T, P>

Type parameters

NameTypeDefault
TAnyEntity<T>-
P-never

Hierarchy

Constructors

constructor

+ new LoadedReference(entity: T): LoadedReference

Inherited from Reference.constructor

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

Parameters:

NameType
entityT

Returns: LoadedReference

Properties

$

$: T & P

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

Methods

get

get(): T & P

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

Returns: T & P


getEntity

getEntity(): T

Inherited from Reference.getEntity

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

Returns: T


getProperty

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

Inherited from Reference.getProperty

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

Type parameters:

NameType
Kkeyof T

Parameters:

NameType
propK

Returns: T[K]


isInitialized

isInitialized(): boolean

Inherited from Reference.isInitialized

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

Returns: boolean


load

load(): Promise<T>

Inherited from Reference.load

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

Ensures the underlying entity is loaded first (without reloading it if it already is loaded). Returns the entity.

Returns: Promise<T>

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

Inherited from Reference.load

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

Ensures the underlying entity is loaded first (without reloading it if it already is loaded). Returns the requested property instead of the whole entity.

Type parameters:

NameType
Kkeyof T

Parameters:

NameType
propK

Returns: Promise<T[K]>


populated

populated(populated?: boolean): void

Inherited from Reference.populated

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

Parameters:

NameType
populated?boolean

Returns: void


set

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

Inherited from Reference.set

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

Parameters:

NameType
entityT | IdentifiedReference<T>

Returns: void


toJSON

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

Inherited from Reference.toJSON

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

Parameters:

NameType
...argsany[]

Returns: Dictionary


unwrap

unwrap(): T

Inherited from Reference.unwrap

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

Returns: T


create

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

Inherited from Reference.create

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

Type parameters:

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

Parameters:

NameType
entityT | IdentifiedReference<T, PK>

Returns: IdentifiedReference<T, PK>


isReference

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

Inherited from Reference.isReference

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

Inherited from Reference.unwrapReference

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

Inherited from Reference.wrapReference

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 Martin Adámek