AbstractRepository
Abstract Class: AbstractRepository<T>
Defined in: packages/models/src/repositories/abstract.ts:37
Base repository implementation providing shared logic for key management, event handling, and default method implementations.
Concrete repositories (MemoryRepository, etc.) extend this class and implement the abstract storage methods.
Extended by
Type Parameters
T
T extends ModelClass
The ModelClass this repository manages
Implements
Repository<T>
Constructors
Constructor
new AbstractRepository<
T>(model,pks,separator?):AbstractRepository<T>
Defined in: packages/models/src/repositories/abstract.ts:61
Parameters
model
T
The model class constructor
pks
string[]
Array of primary key field names
separator?
string = "_"
Separator used when joining composite key fields into a string (default: "_")
Returns
AbstractRepository<T>
Properties
aggregationOptions
protectedaggregationOptions:AggregationOptions
Defined in: packages/models/src/repositories/abstract.ts:42
Aggregation fallback policy, set by the owning store through configureAggregation
events
protectedevents:Map<keyofInstanceType<T>[typeofWEBDA_EVENTS],Set<(data) =>void>>
Defined in: packages/models/src/repositories/abstract.ts:39
Registered event listeners keyed by event name
maxListeners
protectedmaxListeners:number=100
Defined in: packages/models/src/repositories/abstract.ts:891
Max-listeners hint kept for Node EventEmitter API compatibility. Not
enforced — repositories use an unbounded Set per event.
model
protectedmodel:T
Defined in: packages/models/src/repositories/abstract.ts:62
The model class constructor
monitorOptions
protectedmonitorOptions:QueryMonitorOptions={}
Defined in: packages/models/src/repositories/abstract.ts:44
Query monitoring options, set by the owning store through configureMonitoring
pks
protectedpks:string[]
Defined in: packages/models/src/repositories/abstract.ts:63
Array of primary key field names
separator
protectedseparator:string="_"
Defined in: packages/models/src/repositories/abstract.ts:64
Separator used when joining composite key fields into a string (default: "_")
tableRoot?
protectedoptionaltableRoot?:ModelClass<Storable<any,any>>
Defined in: packages/models/src/repositories/abstract.ts:50
Model owning the untyped rows of the storage (the first model of the store), undefined when not known
warnedAggregations
protectedwarnedAggregations:Set<string>
Defined in: packages/models/src/repositories/abstract.ts:46
Fallback shapes already warned about
Methods
acceptedTypes()
acceptedTypes():
string[]
Defined in: packages/models/src/repositories/abstract.ts:109
Every stored __type value of this model and its transitive subclasses, for stores filtering in their query
language
Returns
string[]
the values, empty when the model carries no Metadata
aggregate()
aggregate<
G,M>(spec,params?):Promise<AggregationResult<AggregatedRow<InstanceType<T>,G,M>>>
Defined in: packages/models/src/repositories/abstract.ts:700
Keep the full generic signature here (not spec: any): concrete repositories are used
directly in code and tests, and must expose the typed rows.
Type Parameters
G
G extends readonly _NonFunctionPropertyPaths<InstanceType<T>>[] = []
M
M extends Record<string, MetricSpec<InstanceType<T>>> = Record<string, MetricSpec<InstanceType<T>>>
Parameters
spec
AggregationSpec<InstanceType<T>, G, M>
params?
QueryParameters
Returns
Promise<AggregationResult<AggregatedRow<InstanceType<T>, G, M>>>
Implementation of
aggregateInMemory()
protectedaggregateInMemory(query):Promise<Record<string,unknown>[]>
Defined in: packages/models/src/repositories/abstract.ts:799
Aggregate by streaming the filtered items
Parameters
query
AggregationQuery
the aggregation
Returns
Promise<Record<string, unknown>[]>
the rows
applyAssignments()
protectedapplyAssignments<O>(target,assignments):O
Defined in: packages/models/src/repositories/abstract.ts:466
Set the assignments of an UPDATE on an object, creating the intermediate objects of dotted paths
Targets were checked by parseStatement: letters, digits and _ only, no __ segment, no
Object.prototype member name.
Type Parameters
O
O
Parameters
target
O
the object to change in place
assignments
Assignment[]
the SET assignments
Returns
O
the target
belongsToModel()
belongsToModel(
stored?):boolean
Defined in: packages/models/src/repositories/abstract.ts:121
Whether a stored row belongs to this model, for stores filtering in memory
Parameters
stored?
string
the stored __type, undefined for an untyped row
Returns
boolean
true when the row belongs to this model (always without Metadata)
buildItem()
protectedbuildItem(data):InstanceType<T>
Defined in: packages/models/src/repositories/abstract.ts:138
Build the model instance to create from the incoming data
Primary key fields that are undefined or null are dropped from the data so a key generated by the model constructor (e.g. UuidModel) is not overwritten. Repositories must read the storage key from the returned instance.
Parameters
data
Helpers<InstanceType<T>>
the incoming data
Returns
InstanceType<T>
the model instance
checkAggregationFallback()
protectedcheckAggregationFallback(query,reason):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:730
Apply the fallback policy before aggregating or counting in memory
Parameters
query
AggregationQuery | undefined
the aggregation, undefined for a count
reason
string
why it cannot run natively
Returns
Promise<void>
Throws
AggregationError AGGREGATION_NOT_NATIVE when the policy is deny
collectStatementKeys()
protectedcollectStatementKeys(statement):Promise<PrimaryKeyType<InstanceType<T>>[]>
Defined in: packages/models/src/repositories/abstract.ts:488
Keys of the objects matching the WHERE of a statement, collected before any change so an update changing a WHERE field cannot meet the same object twice; at most LIMIT keys
Parameters
statement
Query
the parsed statement
Returns
Promise<PrimaryKeyType<InstanceType<T>>[]>
the primary keys
configureAggregation()
configureAggregation(
options):void
Defined in: packages/models/src/repositories/abstract.ts:611
Copy the known options (fallback, maxGroups, warn); undefined values keep the current ones
Parameters
options
Partial<AggregationOptions>
Returns
void
Throws
Error when maxGroups is not a positive integer or fallback is unknown
Implementation of
Repository.configureAggregation
configureMonitoring()
configureMonitoring(
options):void
Defined in: packages/models/src/repositories/abstract.ts:628
Configure the query monitoring policy, called by the owning store
Parameters
options
Partial<QueryMonitorOptions>
options to override
Returns
void
Implementation of
Repository.configureMonitoring
count()
count(
filter?,params?,options?):Promise<CountResult>
Defined in: packages/models/src/repositories/abstract.ts:752
Parse the filter, refuse statements, drop ORDER BY / LIMIT / OFFSET and run executeCount
Parameters
filter?
string
params?
QueryParameters
options?
Returns
Promise<CountResult>
Throws
Error when max is not a positive integer
Implementation of
countInMemory()
protectedcountInMemory(filter,max?):Promise<Omit<CountResult,"native">>
Defined in: packages/models/src/repositories/abstract.ts:785
Count by streaming the filtered items, stopping at max + 1
Parameters
filter
Expression
the filter
max?
number
stop after max objects, undefined for an exact count
Returns
Promise<Omit<CountResult, "native">>
the value and its relation
create()
abstractcreate(data,save?):Promise<InstanceType<T>>
Defined in: packages/models/src/repositories/abstract.ts:837
Create data in the store
Parameters
data
Helpers<InstanceType<T>>
save?
boolean
if false, create in-memory object without saving
Returns
Promise<InstanceType<T>>
Implementation of
delete()
abstractdelete<K>(uuid,conditionField?,condition?):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:849
Delete data from the store
Type Parameters
K
K extends string
Parameters
uuid
PrimaryKeyType<InstanceType<T>>
conditionField?
K | null
Field to check for condition (optional)
condition?
PropertyPathType<InstanceType<T>, K> | JSONed<PropertyPathType<InstanceType<T>, K>>
Value to check for condition (optional)
Returns
Promise<void>
Implementation of
deleteItemFromCollection()
abstractdeleteItemFromCollection<K,L>(uuid,collection,index,itemWriteConditionField?,itemWriteCondition?):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:807
Remove item from a collection by index
Type Parameters
K
K extends string
L
L extends string | number | symbol
Parameters
uuid
PrimaryKeyType<InstanceType<T>>
collection
K
Name of the array field
index
number
Position of item to remove
itemWriteConditionField?
L
Field to check for condition on item
itemWriteCondition?
ArrayElement<InstanceType<T>[K]>[L]
Expected value for condition field on item
Returns
Promise<void>
Implementation of
Repository.deleteItemFromCollection
deleteMany()
deleteMany(
statement,params?):Promise<number>
Defined in: packages/models/src/repositories/abstract.ts:585
Delete in bulk: see Repository.deleteMany
The generic implementation collects the matching keys then deletes them with delete; stores override it
with their native batch operation.
Parameters
statement
string | Query
params?
QueryParameters
Returns
Promise<number>
Implementation of
deleteManyByKey()
protecteddeleteManyByKey(statement,params?):Promise<number>
Defined in: packages/models/src/repositories/abstract.ts:530
Generic deleteMany: collect the matching keys (up to LIMIT), then delete them one by one with this
repository's delete primitive
Used by stores without a native bulk delete. On a store repository the primitive emits no event.
Parameters
statement
string | Query
the DELETE statement or its parsed form
params?
QueryParameters
values for the placeholders
Returns
Promise<number>
the number of objects deleted
emit()
emit<
K>(event,data):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:930
Emit an event to all registered listeners and await their completion.
Type Parameters
K
K extends string | number | symbol
Parameters
event
K
The event name to emit
data
InstanceType<T>[typeof WEBDA_EVENTS][K]
The event payload
Returns
Promise<void>
Implementation of
excludePrimaryKey()
excludePrimaryKey(
object):any
Defined in: packages/models/src/repositories/abstract.ts:222
Parameters
object
any
Returns
any
Implementation of
executeAggregation()
protectedexecuteAggregation(query):Promise<AggregationResult<any>>
Defined in: packages/models/src/repositories/abstract.ts:719
Run a validated aggregation
Backends override it to aggregate natively, and call super for the shapes they cannot translate. The default streams iterate() into the in-memory Aggregator, under the fallback policy.
Parameters
query
AggregationQuery
the validated aggregation
Returns
Promise<AggregationResult<any>>
the rows
executeCount()
protectedexecuteCount(filter,max?):Promise<CountResult>
Defined in: packages/models/src/repositories/abstract.ts:774
Count the objects matching a validated filter
Backends override it to count natively. The default scans iterate() in memory, under the fallback policy. It does not go through executeAggregation: an aggregation has no cap.
Parameters
filter
Expression
the filter, without ORDER BY, LIMIT or OFFSET
max?
number
stop after max objects, undefined for an exact count
Returns
Promise<CountResult>
the count
exists()
abstractexists(uuid):Promise<boolean>
Defined in: packages/models/src/repositories/abstract.ts:854
Verify if the object exists
Parameters
uuid
PrimaryKeyType<InstanceType<T>>
Returns
Promise<boolean>
Implementation of
fromUID()
fromUID(
uid):ModelRefWithCreate<InstanceType<T>>
Defined in: packages/models/src/repositories/abstract.ts:171
Return a ref from the uuid
Parameters
uid
string
the serialized primary key
Returns
ModelRefWithCreate<InstanceType<T>>
a model reference with create capability
Implementation of
get()
abstractget(primaryKey):Promise<HelperProperties<InstanceType<T>>>
Defined in: packages/models/src/repositories/abstract.ts:836
Get data from the store
Parameters
primaryKey
PrimaryKeyType<InstanceType<T>>
Returns
Promise<HelperProperties<InstanceType<T>>>
Implementation of
getAllowedFields()
getAllowedFields():
string[] |undefined
Defined in: packages/models/src/repositories/abstract.ts:365
Field paths of the model, from its metadata (Reflection and the stored, input and output schemas)
Used to validate UPDATE SET targets.
Returns
string[] | undefined
the field names, undefined when the model carries no field metadata (no validation then)
getCompletionFields()
getCompletionFields():
CompletionField[]
Defined in: packages/models/src/repositories/abstract.ts:382
Completion fields of the model, flattened from its schemas
Returns
CompletionField[]
array of completion fields
getMaxListeners()
getMaxListeners():
number
Defined in: packages/models/src/repositories/abstract.ts:911
EventEmitter-compatibility shim. Returns the max-listeners hint.
Returns
number
the current max-listeners hint
getPrimaryKey()
Call Signature
getPrimaryKey(
object,forceObject?):PrimaryKeyType<InstanceType<T>>
Defined in: packages/models/src/repositories/abstract.ts:232
Get the primary key value for an object as a scalar or string.
Parameters
object
any
forceObject?
false
Returns
PrimaryKeyType<InstanceType<T>>
Implementation of
Call Signature
getPrimaryKey(
object,forceObject):PrimaryKey<InstanceType<T>>
Defined in: packages/models/src/repositories/abstract.ts:234
Get the primary key value for an object as a structured key object.
Parameters
object
any
forceObject
true
Returns
PrimaryKey<InstanceType<T>>
Implementation of
Repository.getPrimaryKey
getRootModel()
getRootModel():
T
Defined in: packages/models/src/repositories/abstract.ts:67
Returns
T
Implementation of
getTableRoot()
getTableRoot():
ModelClass<Storable<any,any>> |undefined
Defined in: packages/models/src/repositories/abstract.ts:84
Returns
ModelClass<Storable<any, any>> | undefined
the model owning the untyped rows of the storage
getUID()
getUID(
object):string
Defined in: packages/models/src/repositories/abstract.ts:307
Parameters
object
any
Returns
string
Implementation of
incrementAttribute()
incrementAttribute<
K,L>(primaryKey,info,_conditionField?,_condition?):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:340
Type Parameters
K
K extends string
L
L extends string
Parameters
primaryKey
PK<InstanceType<T>, InstanceType<T>[typeof WEBDA_PRIMARY_KEY][number]>
info
L | { property: L; value?: number; }
_conditionField?
K | null
_condition?
any
Returns
Promise<void>
Implementation of
incrementAttributes()
abstractincrementAttributes<K,L>(primaryKey,info,_conditionField?,_condition?):Promise<void|Record<string,number>>
Defined in: packages/models/src/repositories/abstract.ts:349
Atomically increment numeric field(s)
Type Parameters
K
K extends string
L
L extends string
Parameters
primaryKey
PK<InstanceType<T>, InstanceType<T>[typeof WEBDA_PRIMARY_KEY][number]>
info
(L | { property: L; value?: number; })[] | Record<L, number>
Fields to increment with optional values (default: 1)
_conditionField?
K | null
_condition?
any
Returns
Promise<void | Record<string, number>>
Implementation of
Repository.incrementAttributes
iterate()
abstractiterate(query,params?):AsyncGenerator<InstanceType<T>,any,any>
Defined in: packages/models/src/repositories/abstract.ts:604
Iterate over the store
Takes a filter query (a = 1 ORDER BY b LIMIT 10): DELETE and UPDATE statements go to
deleteMany / updateMany, and SELECT field lists are refused (objects are returned whole).
Parameters
query
string
the WebdaQL query, optionally with ? or :name placeholders
params?
QueryParameters
values for the placeholders: an array for ?, an object for :name
Returns
AsyncGenerator<InstanceType<T>, any, any>
Implementation of
monitor()
protectedmonitor<R>(operation,query,fn,details):Promise<R>
Defined in: packages/models/src/repositories/abstract.ts:652
Helper that times a query operation, catches and rethrows errors, and calls onQuery safely
Type Parameters
R
R
Parameters
operation
the query operation
query
string
the query string
fn
() => Promise<R>
the async function to execute and time
details
((r) => object) | ((r) => number)
optional callback to extract result count or pagination details
Returns
Promise<R>
the result of fn
off()
off<
K>(event,listener):void
Defined in: packages/models/src/repositories/abstract.ts:880
Type Parameters
K
K extends string | number | symbol
Parameters
event
K
listener
(data) => void
Returns
void
Implementation of
on()
on<
K>(event,listener):void
Defined in: packages/models/src/repositories/abstract.ts:857
Type Parameters
K
K extends string | number | symbol
Parameters
event
K
listener
(data) => void
Returns
void
Implementation of
once()
once<
K>(event,listener):void
Defined in: packages/models/src/repositories/abstract.ts:868
Type Parameters
K
K extends string | number | symbol
Parameters
event
K
listener
(data) => void
Returns
void
Implementation of
parseLegacyUID()
protectedparseLegacyUID(uid):PrimaryKey<InstanceType<T>> |undefined
Defined in: packages/models/src/repositories/abstract.ts:210
Parse a uid through the model's parseLegacyUID hook
Parameters
uid
string
the raw storage key
Returns
PrimaryKey<InstanceType<T>> | undefined
a key whose string form is the raw uid, or undefined when the model does not recognise it
parseStatement()
protectedparseStatement(type,statement,params?):Promise<Query>
Defined in: packages/models/src/repositories/abstract.ts:403
Parse a bulk statement and check it is of the expected type
For an UPDATE, every SET target is checked: no primary key field, no private (__) segment, no
constructor/prototype segment, and a field of the model when its metadata lists them.
Parameters
type
"DELETE" | "UPDATE"
the expected statement type
statement
string | Query
the statement string or its parsed form
params?
QueryParameters
values for the placeholders of a statement string
Returns
Promise<Query>
the parsed statement
Throws
WebdaQLError when the statement has another type or a SET target is refused
Throws
SyntaxError when the statement does not parse, or a SET target is not a field of the model
parseUID()
parseUID(
uid,forceObject?):PrimaryKeyType<InstanceType<T>> |PrimaryKey<InstanceType<T>>
Defined in: packages/models/src/repositories/abstract.ts:184
Parse a serialized primary key
A composite key that does not split into the primary key fields is offered to the model's optional
static parseLegacyUID(uid) hook (see WEBDA_LEGACY_UID): the returned key keeps the raw uid as its
string form so it addresses the legacy storage entry. Without a hook, or when the hook declines, the
uid is rejected.
Parameters
uid
string
forceObject?
boolean
Returns
PrimaryKeyType<InstanceType<T>> | PrimaryKey<InstanceType<T>>
Implementation of
patch()
abstractpatch<K>(primaryKey,data,_conditionField?,_condition?):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:838
Partially update object (only specified fields)
Type Parameters
K
K extends string
Parameters
primaryKey
PK<InstanceType<T>, InstanceType<T>[typeof WEBDA_PRIMARY_KEY][number]>
data
Partial<InstanceType<T>>
Partial object data (only fields to update)
_conditionField?
K | null
_condition?
any
Returns
Promise<void>
Implementation of
query()
abstractquery(query,params?):Promise<{continuationToken?:string;results:InstanceType<T>[]; }>
Defined in: packages/models/src/repositories/abstract.ts:600
Query the store
Takes a filter query (a = 1 ORDER BY b LIMIT 10): DELETE and UPDATE statements go to
deleteMany / updateMany, and SELECT field lists are refused (objects are returned whole).
Parameters
query
string
the WebdaQL query, optionally with ? or :name placeholders
params?
QueryParameters
values for the placeholders: an array for ?, an object for :name
Returns
Promise<{ continuationToken?: string; results: InstanceType<T>[]; }>
Implementation of
ref()
ref(
key):ModelRefWithCreate<InstanceType<T>>
Defined in: packages/models/src/repositories/abstract.ts:333
Parameters
key
PK<InstanceType<T>, InstanceType<T>[typeof WEBDA_PRIMARY_KEY][number]>
Returns
ModelRefWithCreate<InstanceType<T>>
Implementation of
removeAttribute()
abstractremoveAttribute<L,K>(uuid,attribute,conditionField?,condition?):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:830
Atomically remove an attribute
Type Parameters
L
L extends string
K
K extends string
Parameters
uuid
PrimaryKeyType<InstanceType<T>>
attribute
K
Attribute name to remove
conditionField?
L | null
Field to check for condition
condition?
PropertyPathType<InstanceType<T>, L> | JSONed<PropertyPathType<InstanceType<T>, L>>
Expected value for condition field
Returns
Promise<void>
Implementation of
removeListener()
removeListener<
K>(event,listener):void
Defined in: packages/models/src/repositories/abstract.ts:900
EventEmitter-compatibility alias for off. Consumers that treat a
repository as a Node EventEmitter (e.g. @webda/runtime EventIterator)
call removeListener.
Type Parameters
K
K extends string | number | symbol
Parameters
event
K
the event name
listener
(data) => void
the listener to remove
Returns
void
safeOnQuery()
protectedsafeOnQuery(info):void
Defined in: packages/models/src/repositories/abstract.ts:636
Safely invoke the onQuery callback without throwing into the caller
Parameters
info
query execution info
Returns
void
setAttribute()
setAttribute<
K,L>(primaryKey,attribute,value,conditionField?,condition?):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:322
Type Parameters
K
K extends string
L
L extends string
Parameters
primaryKey
string | PK<InstanceType<T>, InstanceType<T>[typeof WEBDA_PRIMARY_KEY][number]>
attribute
K
value
PropertyPathType<InstanceType<T>, K>
conditionField?
L | null
condition?
PropertyPathType<InstanceType<T>, L> | JSONed<PropertyPathType<InstanceType<T>, L>>
Returns
Promise<void>
Implementation of
setMaxListeners()
setMaxListeners(
n):this
Defined in: packages/models/src/repositories/abstract.ts:920
EventEmitter-compatibility shim. Records the max-listeners hint (no enforcement).
Parameters
n
number
the new hint value
Returns
this
this for chaining
setTableRoot()
setTableRoot(
root?):this
Defined in: packages/models/src/repositories/abstract.ts:76
Set the model owning the untyped rows of the storage
Parameters
root?
ModelClass<Storable<any, any>>
the first model of the store, undefined when not known
Returns
this
this
typeResolver()
protectedtypeResolver():ModelTypeResolver
Defined in: packages/models/src/repositories/abstract.ts:93
Resolver of the stored __type: the installed application one when it knows the model, else the model's own
hierarchy with exact identifiers only
Returns
the resolver
update()
abstractupdate<K>(data,conditionField?,condition?):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:844
Replace entire object (full update)
Type Parameters
K
K extends string
Parameters
data
Helpers<InstanceType<T>>
Complete object data including primary key
conditionField?
K | null
Field to check for optimistic locking (null = no check)
condition?
PropertyPathType<InstanceType<T>, K>
Expected value for condition field
Returns
Promise<void>
Implementation of
updateMany()
updateMany(
statement,params?):Promise<number>
Defined in: packages/models/src/repositories/abstract.ts:596
Update in bulk: see Repository.updateMany
The generic implementation collects the matching keys then patches them with patch; stores override it
with their native batch operation.
Parameters
statement
string | Query
params?
QueryParameters
Returns
Promise<number>
Implementation of
updateManyByKey()
protectedupdateManyByKey(statement,params?):Promise<number>
Defined in: packages/models/src/repositories/abstract.ts:549
Generic updateMany: collect the matching keys (up to LIMIT), then patch them one by one with this
repository's patch primitive. A dotted target reads the object to rewrite its top-level field.
Used by stores without a native bulk update. On a store repository the primitive emits no event.
Parameters
statement
string | Query
the UPDATE statement or its parsed form
params?
QueryParameters
values for the placeholders
Returns
Promise<number>
the number of objects updated
upsert()
upsert(
data):Promise<InstanceType<T>>
Defined in: packages/models/src/repositories/abstract.ts:312
Parameters
data
Helpers<InstanceType<T>>
Returns
Promise<InstanceType<T>>
Implementation of
upsertItemToCollection()
abstractupsertItemToCollection<K,L>(uuid,collection,item,index?,itemWriteConditionField?,itemWriteCondition?):Promise<void>
Defined in: packages/models/src/repositories/abstract.ts:817
Add or update item in a collection (array field)
Type Parameters
K
K extends string
L
L extends string | number | symbol
Parameters
uuid
PrimaryKeyType<InstanceType<T>>
collection
K
Name of the array field
item
ArrayElement<InstanceType<T>[K]> | JSONed<ArrayElement<InstanceType<T>[K]>>
Item to add/update
index?
number
Position to insert (undefined = append to end)
itemWriteConditionField?
ArrayElement<InstanceType<T>[K]> extends object ? L : never
Field to check for condition on item
itemWriteCondition?
ArrayElement<InstanceType<T>[K]> extends object ? object & ArrayElement[L] : ArrayElement<InstanceType<T>[K]>
Expected value for condition field on item
Returns
Promise<void>
Implementation of
Repository.upsertItemToCollection
writeIfPresent()
protectedwriteIfPresent(key,write):Promise<boolean>
Defined in: packages/models/src/repositories/abstract.ts:509
Run one write of the generic fallback; an object deleted since the keys were collected is skipped
Parameters
key
PrimaryKeyType<InstanceType<T>>
the primary key
write
() => Promise<void>
the write
Returns
Promise<boolean>
true when written, false when the object is gone
Throws
the write error when the object still exists