Skip to content

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.

optional into?: 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.


optional job?: 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.


optional track?: 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.