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:442
Properties
model
protected
model:CoreModelDefinition
<T
>
Inherited from
Source
packages/core/src/models/coremodel.ts:438
parent
protected
parent:CoreModel
Inherited from
Source
packages/core/src/models/coremodel.ts:440
store
protected
store:Store
<T
,StoreParameters
,StoreEvents
>
Inherited from
Source
packages/core/src/models/coremodel.ts:436
uuid
protected
uuid:string
Inherited from
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
>
Inherited from
Source
packages/core/src/models/coremodel.ts:528
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:580
delete()
delete():
Promise
<void
>
Returns
Promise
<void
>
Inherited from
Source
packages/core/src/models/coremodel.ts:525
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:467
exists()
exists():
Promise
<boolean
>
Returns
Promise
<boolean
>
Inherited from
Source
packages/core/src/models/coremodel.ts:522
get()
get(
context
?):Promise
<T
>
Parameters
• context?: OperationContext
<any
, any
>
Returns
Promise
<T
>
Inherited from
Source
packages/core/src/models/coremodel.ts:451
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:597
getUuid()
getUuid():
string
Returns
string
Inherited from
Source
packages/core/src/models/coremodel.ts:464
incrementAttributes()
incrementAttributes(
info
):Promise
<ModelRefWithCreate
<T
>>
Parameters
• info: Object
[]
Returns
Promise
<ModelRefWithCreate
<T
>>
Inherited from
Source
packages/core/src/models/coremodel.ts:553
patch()
patch(
updates
):Promise
<boolean
>
Parameters
• updates: Partial
<T
>
Returns
Promise
<boolean
>
Inherited from
Source
packages/core/src/models/coremodel.ts:531
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:538
set()
set(
id
):void
Parameters
• id: string
| T
Returns
void
Inherited from
Source
packages/core/src/models/coremodel.ts:454
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:534
toJSON()
toJSON():
string
Returns
string
Inherited from
Source
packages/core/src/models/coremodel.ts:461
toString()
toString():
string
Returns
string
Inherited from
Source
packages/core/src/models/coremodel.ts:458
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