DerivedModel
DerivedModel =
object
Defined in: packages/schema/src/derived/derived-model.ts:13
A value worked out from other records for each record of a resource (.derived()): its compute function is the
default export of derived/<resource>.<name>.ts, run on the server, which keeps the value current.
Properties
Section titled “Properties”
optionalinto?:DerivedTarget
Defined in: packages/schema/src/derived/derived-model.ts:17
Where the value goes: a read-only field of the record, or a field of another resource’s record of the same key.
optionaljob?:string
Defined in: packages/schema/src/derived/derived-model.ts:19
The job enqueued with { resource, key, value } each time the value changes, instead of or beside into.
name:
string
Defined in: packages/schema/src/derived/derived-model.ts:15
Unique per resource; camelCase or snake_case.
reads:
string[]
Defined in: packages/schema/src/derived/derived-model.ts:21
The resources the compute function may read, besides the record’s own; their changes are captured.
track?
Section titled “track?”
optionaltrack?:false
Defined in: packages/schema/src/derived/derived-model.ts:23
false reads no queries, so only the dependencies the function names itself and its clock count.