ModelRefWithCreate
Class: ModelRefWithCreate<T>
Extends
ModelRef<T>
Type parameters
• T extends CoreModel
Constructors
new ModelRefWithCreate(uuid, model, parent)
new ModelRefWithCreate<
T>(uuid,model,parent?):ModelRefWithCreate<T>
Parameters
• uuid: string
• model: CoreModelDefinition<T>
• parent?: CoreModel
Returns
Inherited from
Source
packages/core/src/models/coremodel.ts:449
Properties
model
protectedmodel:CoreModelDefinition<T>
Inherited from
Source
packages/core/src/models/coremodel.ts:445
parent
protectedparent:CoreModel
Inherited from
Source
packages/core/src/models/coremodel.ts:447
store
protectedstore:Store<T,StoreParameters,StoreEvents>
Inherited from
Source
packages/core/src/models/coremodel.ts:443
uuid
protecteduuid:string
Inherited from
Source
packages/core/src/models/coremodel.ts:450
Methods
conditionalPatch()
conditionalPatch(
updates,conditionField,condition):Promise<boolean>
Parameters
• updates: Partial<T>
• conditionField: any
• condition: any
Returns
Promise<boolean>
Inherited from
Source
packages/core/src/models/coremodel.ts:535
create()
create(
defaultValue,context?,withSave?):Promise<T>
Allow to create a model
Parameters
• defaultValue: RawModel<T>
• context?: OperationContext<any, any>
• withSave?: boolean= true
Returns
Promise<T>
Source
packages/core/src/models/coremodel.ts:587
delete()
delete():
Promise<void>
Returns
Promise<void>
Inherited from
Source
packages/core/src/models/coremodel.ts:532
deleteItemFromCollection()
deleteItemFromCollection(
prop,index,itemWriteCondition,itemWriteConditionField?):Promise<ModelRefWithCreate<T>>
Parameters
• prop: FilterAttributes<T, any[]>
• index: number
• itemWriteCondition: any
• itemWriteConditionField?: string
Returns
Promise<ModelRefWithCreate<T>>
Inherited from
ModelRef.deleteItemFromCollection
Source
packages/core/src/models/coremodel.ts:474
exists()
exists():
Promise<boolean>
Returns
Promise<boolean>
Inherited from
Source
packages/core/src/models/coremodel.ts:529
get()
get(
context?):Promise<T>
Parameters
• context?: OperationContext<any, any>
Returns
Promise<T>
Inherited from
Source
packages/core/src/models/coremodel.ts:458
getOrCreate()
getOrCreate(
defaultValue,context?,withSave?):Promise<T>
Load a model from the known store
Parameters
• defaultValue: RawModel<T>
if object not found return a default object
• context?: OperationContext<any, any>
to set on the object
• withSave?: boolean= true
Returns
Promise<T>
Source
packages/core/src/models/coremodel.ts:604
getUuid()
getUuid():
string
Returns
string
Inherited from
Source
packages/core/src/models/coremodel.ts:471
incrementAttributes()
incrementAttributes(
info):Promise<ModelRefWithCreate<T>>
Parameters
• info: Object[]
Returns
Promise<ModelRefWithCreate<T>>
Inherited from
Source
packages/core/src/models/coremodel.ts:560
patch()
patch(
updates):Promise<boolean>
Parameters
• updates: Partial<T>
Returns
Promise<boolean>
Inherited from
Source
packages/core/src/models/coremodel.ts:538
removeAttribute()
removeAttribute(
attribute,itemWriteCondition?,itemWriteConditionField?):Promise<ModelRefWithCreate<T>>
Parameters
• attribute: keyof T
• itemWriteCondition?: any
• itemWriteConditionField?: keyof T
Returns
Promise<ModelRefWithCreate<T>>
Inherited from
Source
packages/core/src/models/coremodel.ts:545
set()
set(
id):void
Parameters
• id: string | T
Returns
void
Inherited from
Source
packages/core/src/models/coremodel.ts:461
setAttribute()
setAttribute(
attribute,value):Promise<ModelRefWithCreate<T>>
Parameters
• attribute: keyof T
• value: any
Returns
Promise<ModelRefWithCreate<T>>
Inherited from
Source
packages/core/src/models/coremodel.ts:541
toJSON()
toJSON():
string
Returns
string
Inherited from
Source
packages/core/src/models/coremodel.ts:468
toString()
toString():
string
Returns
string
Inherited from
Source
packages/core/src/models/coremodel.ts:465
upsertItemToCollection()
upsertItemToCollection(
prop,item,index?,itemWriteCondition?,itemWriteConditionField?):Promise<ModelRefWithCreate<T>>
Parameters
• prop: FilterAttributes<T, any[]>
• item: any
• index?: number
• itemWriteCondition?: any
• itemWriteConditionField?: string
Returns
Promise<ModelRefWithCreate<T>>
Inherited from
ModelRef.upsertItemToCollection