@docstack/client
Classes
| Class | Description |
|---|---|
| Attribute | Represents a single attribute (field) within a Class schema. |
| Class | Represents a data class (schema definition) in the DocStack database. |
| ClientStack | The core database engine for DocStack client applications. |
| DocStack | The main entry point for the DocStack client library. |
| DocStackSyncHandle | Every stack's replication under one object. |
| Domain | Represents a relationship definition between two Classes in the DocStack database. |
| JobEngine | Engine for executing background jobs in the DocStack system. |
| JobScheduler | Decides when the jobs an application has approved should run, and dispatches them. |
| StackLockedError | Raised when a locked stack is asked to write a class carrying encrypted attributes. |
| StackScopeMismatchError | A write whose ~scope label disagrees with its sealed payloads' key ids (spec 02 §2.3 rule 2). Refused, never repaired: re-sealing content the writer could not open under the labeled scope's key is exactly the induced-downgrade attack a tampered label is fishing for. A legitimate relabel opens the original scope first, so its payloads arrive as plaintext. |
| StackSyncHandle | One stack's replication: its lifecycle, its filter, and its convergence state. |
| StackWriteGuardError | Raised when application code tries to write around a stack's authoring path. |
| SyncSchemaMismatchError | Raised when a remote is ahead of this device's data model. |
| TransactionConflictError | Raised by commit when a staged document's base revision no longer matches the stored winner - a direct write, another transaction's commit, or replication moved it. Nothing is written; the transaction stays open for re-staging or discard. |
| TransactionDb | The handle's db-like surface. Writes stage; reads overlay. Not a Proxy over the guarded db on purpose: this object has no adapter methods or escape hatches to forward, so staging cannot become a fourth door around the authoring path. |
| TransactionEngine | Named write transactions for one stack (ADR-0039). |
| TransactionHandle | One transaction: a private write journal plus a read view that overlays it on committed state (ADR-0039). |
| TransactionsDisabledError | Raised by beginTransaction() on a stack opened without transactions: true. |
| TransactionStateError | Raised when a handle is used in a state that cannot accept the operation. |
| TransactionUnsupportedDocError | Raised at stage time for documents transactions cannot carry: class models (their write propagates to other documents mid-pipeline and cannot be staged or rolled back - ADR-0039), _local/ device state, and design documents. |
| TransactionValidationError | Raised when the validation sweep refuses a document - at stage time (the write is not staged) or at commit time (nothing is written, the transaction stays open). |
| Trigger | The Trigger class dynamically hydrates a function from a string. This allows for declarative, data-driven logic to be executed at runtime. |
Interfaces
| Interface | Description |
|---|---|
| ClassFilterOptions | Which classes replicate. |
| ClassModel | Document-modelling types, re-exported from @docstack/shared. |
| ContentExport | A stack's content, portable to another stack. |
| ContentExportOptions | Controls what ClientStack.exportContent collects. |
| ContentImportIssue | One document that could not be imported, or that was changed on the way in. |
| ContentImportOptions | Controls how ClientStack.importContent reconciles against the datamodel. |
| ContentImportReport | What an import did, per category. |
| DocStackSyncOptions | Options for DocStack.sync, which starts one handle per stack. |
| DomainModel | Document-modelling types, re-exported from @docstack/shared. |
| InternalDocFilterOptions | Options controlling which of DocStack's own documents stay on this device. |
| JobScheduleState | Per-job bookkeeping, as stored in JOB_SCHEDULE_DOC_ID. |
| Patch | Document-modelling types, re-exported from @docstack/shared. |
| SchedulerHost | What the scheduler needs from a stack. Narrow on purpose, so it can be tested without one. |
| SchedulerOptions | - |
| StackSyncOptions | Options for ClientStack.sync. |
| SyncMetaDoc | The contents of SYNC_META_DOC_ID. |
| SyncStatus | A point-in-time reading of one stack's replication. |
| TenantScope | A channel's entitlement, compiled into sync configuration. |
| TickReport | - |
| TriggerModel | Document-modelling types, re-exported from @docstack/shared. |
Type Aliases
| Type Alias | Description |
|---|---|
| AttributeModel | Document-modelling types, re-exported from @docstack/shared. |
| AttributeType | Document-modelling types, re-exported from @docstack/shared. |
| AttributeTypeConfig | Document-modelling types, re-exported from @docstack/shared. |
| ClassBuildOptions | How a Class instance should be built. |
| ClientCredentials | Document-modelling types, re-exported from @docstack/shared. |
| DocstackReady | Document-modelling types, re-exported from @docstack/shared. |
| Document | Document-modelling types, re-exported from @docstack/shared. |
| EncryptedPayload | - |
| ParsedSchedule | A schedule string after parsing. source is kept so callers can report what they read. |
| PatchJob | A one-shot job carried by a patch (ADR-0044): preApply massages data so the patch's model can validate, postApply backfills what needs the model landed. Never persisted as a ~Job - a migration is not a schedulable job, and replicable executable content keeps its one existing surface. |
| RelationDocument | Document-modelling types, re-exported from @docstack/shared. |
| RemoteResolver | How a stack finds its remote. |
| SelectAST | Document-modelling types, re-exported from @docstack/shared. |
| SkipReason | Why a due-looking job was not dispatched. Reported rather than thrown. |
| StackConfig | Document-modelling types, re-exported from @docstack/shared. |
| StackOptions | Document-modelling types, re-exported from @docstack/shared. |
| SyncDirection | Which way documents move. |
| SyncState | Where a stack's replication currently stands. |
| TransactionCommitReport | What one commit did, and on what guarantee. |
| TransactionStatus | - |
| UnionAST | Document-modelling types, re-exported from @docstack/shared. |
Variables
| Variable | Description |
|---|---|
| CONTENT_EXPORT_FORMAT | The envelope format identifier, so an importer can refuse what it does not understand. |
| DATA_MODEL_CLASSES | Classes that describe the stack itself rather than its subject matter. |
| INTERNAL_DOC_CLASSES | ~class values whose documents describe device-local state. |
| INTERNAL_DOC_ID_PREFIXES | Identifier prefixes that mark a document as device-local. |
| INTERNAL_DOC_IDS | Document identifiers that are device-local in full. |
| JOB_SCHEDULE_DOC_ID | The _local/ document holding this device's schedule state. Never replicates. |
| META_CLASSES | ~class values that describe the stack rather than hold its content. |
| OPTIONAL_INTERNAL_DOC_CLASSES | ~class values that are device-local by default but that a caller may choose to replicate. Sessions belong to the device that authenticated; the patch ledger is written by whichever device applied the patch, and patches themselves ship with the application code rather than through the database. |
| SYNC_META_DOC_ID | The document DocStack keeps on a remote to record which schema wrote it. |
| SYSTEM_SEEDED_DOC_IDS | Every document id the system patches seed. |
Functions
| Function | Description |
|---|---|
| classTenants | Normalizes a class model's tenant declaration. |
| collectQueryClasses | Collects the class names a parsed query reads. |
| createClassFilter | Builds a class-level replication filter. |
| createReplicationFilter | Builds the replication filter DocStack passes to PouchDB. |
| deriveKeyId | Derives the stable identifier of a document key. |
| deriveTenantScope | Compiles an entitlement into the stacks it reaches and the class rules it needs. |
| describeFilter | Builds the identity string for a filter of a given kind and configuration. |
| hasClassRules | Reports whether a set of options would filter anything at all. |
| isContentClassName | Reports whether a class name belongs to application content. |
| isContentDocument | Reports whether a document is application content rather than part of the stack. |
| isContentRelation | Reports whether a document is an application relation. |
| isEncryptedPayload | The sync layer: lifecycle, filtering, convergence state and the schema gate. |
| isInternalDoc | Reports whether a document describes device-local state rather than stack data. |
| nextOccurrence | The first moment this schedule comes due strictly after from. |
| parseSchedule | Reads a schedule string, or returns null when it is not one. |
| publishSchemaVersion | Records this device's schema version on a remote, if it is the newest seen. |
| readRemoteConsumerSchemaVersion | Reads the highest consumer patch version recorded on a remote. |
| readRemoteSchemaVersion | Reads the schema version a remote was last written with. |
| resolveInternalClasses | Resolves the full set of device-local classes for a given set of options. |
| withFilterIdentity | Replaces a filter's toString with a stable, configuration-derived identity. |
References
default
Renames and re-exports DocStack