Interface: ClassModel
Defined in: packages/shared/lib/types.d.ts:97
Document-modelling types, re-exported from @docstack/shared.
These describe the values consumers have to construct themselves — most of all
Patch, which StackOptions.patches asks for. @docstack/shared is an internal
package, so surfacing them here is the only import path an application has.
Note that Document shadows the DOM's global Document in whichever module imports
it; alias it (import type { Document as DocStackDocument }) in code that needs both.
Extends
Indexable
[key: string]: any
Properties
| Property | Type | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|
_rev? | string | - | - | - | packages/shared/lib/types.d.ts:147 |
~class | "class" | "~self" | - | Document.~class | - | packages/shared/lib/types.d.ts:98 |
~createTimestamp? | number | - | - | Document.~createTimestamp | packages/shared/lib/types.d.ts:174 |
~domain? | never | - | - | Document.~domain | packages/shared/lib/types.d.ts:201 |
~updateTimestamp? | number | - | - | Document.~updateTimestamp | packages/shared/lib/types.d.ts:175 |
active? | boolean | - | - | Document.active | packages/shared/lib/types.d.ts:176 |
defaultScope? | string | The 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. | - | - | packages/shared/lib/types.d.ts:146 |
description? | string | - | - | - | packages/shared/lib/types.d.ts:100 |
ephemeral? | boolean | Documents 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. | - | - | packages/shared/lib/types.d.ts:112 |
name | string | - | - | - | packages/shared/lib/types.d.ts:99 |
parentClass? | string | - | - | - | packages/shared/lib/types.d.ts:101 |
schema | object | - | - | - | packages/shared/lib/types.d.ts:148 |
simple? | boolean | Documents 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. | - | - | packages/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. | - | - | packages/shared/lib/types.d.ts:136 |
triggers | TriggerModel[] | - | - | - | packages/shared/lib/types.d.ts:151 |