Skip to main content

@webda/coreReadme | API


Class: ModelRef<T>

Extended by

Type parameters

T extends CoreModel

Constructors

new ModelRef(uuid, model, parent)

new ModelRef<T>(uuid, model, parent?): ModelRef<T>

Parameters

uuid: string

model: CoreModelDefinition<T>

parent?: CoreModel

Returns

ModelRef<T>

Source

packages/core/src/models/coremodel.ts:442

Properties

model

protected model: CoreModelDefinition<T>

Source

packages/core/src/models/coremodel.ts:438


parent

protected parent: CoreModel

Source

packages/core/src/models/coremodel.ts:440


store

protected store: Store<T, StoreParameters, StoreEvents>

Source

packages/core/src/models/coremodel.ts:436


uuid

protected uuid: string

Source

packages/core/src/models/coremodel.ts:443

Methods

conditionalPatch()

conditionalPatch(updates, conditionField, condition): Promise<boolean>

Parameters

updates: Partial<T>

conditionField: any

condition: any

Returns

Promise<boolean>

Source

packages/core/src/models/coremodel.ts:528


delete()

delete(): Promise<void>

Returns

Promise<void>

Source

packages/core/src/models/coremodel.ts:525


deleteItemFromCollection()

deleteItemFromCollection(prop, index, itemWriteCondition, itemWriteConditionField?): Promise<ModelRef<T>>

Parameters

prop: FilterAttributes<T, any[]>

index: number

itemWriteCondition: any

itemWriteConditionField?: string

Returns

Promise<ModelRef<T>>

Source

packages/core/src/models/coremodel.ts:467


exists()

exists(): Promise<boolean>

Returns

Promise<boolean>

Source

packages/core/src/models/coremodel.ts:522


get()

get(context?): Promise<T>

Parameters

context?: OperationContext<any, any>

Returns

Promise<T>

Source

packages/core/src/models/coremodel.ts:451


getUuid()

getUuid(): string

Returns

string

Source

packages/core/src/models/coremodel.ts:464


incrementAttributes()

incrementAttributes(info): Promise<ModelRef<T>>

Parameters

info: Object[]

Returns

Promise<ModelRef<T>>

Source

packages/core/src/models/coremodel.ts:553


patch()

patch(updates): Promise<boolean>

Parameters

updates: Partial<T>

Returns

Promise<boolean>

Source

packages/core/src/models/coremodel.ts:531


removeAttribute()

removeAttribute(attribute, itemWriteCondition?, itemWriteConditionField?): Promise<ModelRef<T>>

Parameters

attribute: keyof T

itemWriteCondition?: any

itemWriteConditionField?: keyof T

Returns

Promise<ModelRef<T>>

Source

packages/core/src/models/coremodel.ts:538


set()

set(id): void

Parameters

id: string | T

Returns

void

Source

packages/core/src/models/coremodel.ts:454


setAttribute()

setAttribute(attribute, value): Promise<ModelRef<T>>

Parameters

attribute: keyof T

value: any

Returns

Promise<ModelRef<T>>

Source

packages/core/src/models/coremodel.ts:534


toJSON()

toJSON(): string

Returns

string

Source

packages/core/src/models/coremodel.ts:461


toString()

toString(): string

Returns

string

Source

packages/core/src/models/coremodel.ts:458


upsertItemToCollection()

upsertItemToCollection(prop, item, index?, itemWriteCondition?, itemWriteConditionField?): Promise<ModelRef<T>>

Parameters

prop: FilterAttributes<T, any[]>

item: any

index?: number

itemWriteCondition?: any

itemWriteConditionField?: string

Returns

Promise<ModelRef<T>>

Source

packages/core/src/models/coremodel.ts:493