Skip to main content

Interface: ClassModel

Defined in: shared/lib/types.d.ts:97

Document-modelling types, re-exported from @docstack/client.

Sourced from the client rather than @docstack/shared on purpose: the two packages would otherwise resolve their own copies of @docstack/shared, and a consumer using both could end up holding two structurally-identical-but-distinct Patch types. One source means one copy.

Extends

Indexable

[key: string]: any

Properties

PropertyTypeDescriptionOverridesInherited fromDefined in
_rev?string---shared/lib/types.d.ts:147
~class"class" | "~self"-Document.~class-shared/lib/types.d.ts:98
~createTimestamp?number--Document.~createTimestampshared/lib/types.d.ts:174
~domain?undefined--Document.~domainshared/lib/types.d.ts:201
~updateTimestamp?number | null--Document.~updateTimestampshared/lib/types.d.ts:175
active?boolean--Document.activeshared/lib/types.d.ts:176
defaultScope?stringThe access scope documents of this class default into (spec 02 §2.2). Applied at write time when a document states no ~scope of its own; the document's own label always wins. The scope decides under which key the class's encrypted: true attributes seal - the schema still decides what encrypts. A class with neither declaration follows the legacy document key. See ADR-0045.--shared/lib/types.d.ts:146
description?string---shared/lib/types.d.ts:100
ephemeral?booleanDocuments of this class describe this run of this client rather than the stack's data. Two consequences, both structural rather than conventional: they are emptied when the stack next opens, and they never replicate. Declared once on the class instead of being a shape the sync filter has to recognise document by document - which is what the client's own log records needed before, and what any other kind of derived local state would have needed again. See ADR-0028.--shared/lib/types.d.ts:112
namestring---shared/lib/types.d.ts:99
parentClass?string---shared/lib/types.d.ts:101
schemaobject---shared/lib/types.d.ts:148
simple?booleanDocuments of this class are stored as given. No schema, so no validation, no triggers, no relation checks and no field encryption - the authoring path is skipped entirely, which is what makes such a write cost what a plain PouchDB write costs. The point is somewhere to put documents whose shape is not known in advance, which is what a document database is for; a class that wants guarantees simply does not set this. Reads are unaffected: the query engine keys on ~class and the class model's name, never on its attributes, so a simple class is queried like any other. See ADR-0028.--shared/lib/types.d.ts:125
tenants?string[]The tenant spaces this class belongs to. A tenant is a stack (ADR-0030): declaring tenants: ["workspace"] says documents of this class live in the workspace tenant's stack, and a replication channel entitled to that tenant may carry them. A static list on purpose, so partitioning and channel scopes are derivable before any data exists; dynamic tenant spaces are dynamic stacks, not resolver-valued declarations. A class with no declaration is tenant-neutral - it follows its stack, and single-tenant consumers pay nothing.--shared/lib/types.d.ts:136
triggersTriggerModel[]---shared/lib/types.d.ts:151