Skip to main content

Type Alias: StackOptions

type StackOptions = object & PouchDB.Configuration.DatabaseConfiguration;

Defined in: packages/shared/lib/types.d.ts:257

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.

Type Declaration

NameTypeDescriptionDefined in
accessKeys?objectThe consumer key contract for cryptographic access scopes (ADR-0045, spec 02 §4). DocStack never runs the authority and never invents key material: the application adopts the session's attribute key from its own infrastructure (its server, a Drive grant, Firebase) and persists it consumer-side, exactly as it provisions documentKey today.packages/shared/lib/types.d.ts:302
accessKeys.attributeKey?stringThe session's ABE attribute secret key, serialized (opaque blob from @docstack/abe keygen).packages/shared/lib/types.d.ts:304
accessKeys.requestAttributeKey()?(lockedScopes) => Promise<string | null>Called once at open when active scopes remain locked after the supplied material was attempted. The consumer may fetch newer material and return it - it is attempted immediately - or return null to stay partially locked (later adoption goes through stack.unlockScopes(key)).packages/shared/lib/types.d.ts:312
credentials?ClientCredentials-packages/shared/lib/types.d.ts:261
disableCryptoEngine?booleanDisable the client-side crypto engine for this stack. This flag is persisted on first use and cannot be changed when reopening the same database.packages/shared/lib/types.d.ts:266
documentKey?stringThe document encryption key, as a hex string, supplied by the application. DocStack never invents this key: one generated per session could not outlive it, and a second device would generate a different one. Provision it from wherever the application can hand the same value to every device of a user - typically its own server - or let ClientCredentials recover it through the wrapped-key path. Omitting it opens the stack locked: readable, but refusing writes to any class carrying encrypted attributes until stack.unlock(key) supplies one. See ADR-0018.packages/shared/lib/types.d.ts:279
logLevel?"error" | "warn" | "info" | "debug" | "silent"Most verbose level this stack's loggers emit, on console and into the stack's own log sink alike. "silent" turns them off entirely - what a production build wants. Omitted, the library defaults apply (console shows warn and above, the sink records info and above).packages/shared/lib/types.d.ts:286
name?string-packages/shared/lib/types.d.ts:258
patches?Patch[]-packages/shared/lib/types.d.ts:260
plugins?PouchDB.Plugin[]-packages/shared/lib/types.d.ts:259
transactions?booleanEnables named write transactions on this stack (stack.beginTransaction(), stack.commit(t), stack.discardTransaction(t)). Off by default. The flag only unlocks the capability: direct writes stay immediate next to open transactions, and staged writes live in memory until commit - a reload discards them. See ADR-0039.packages/shared/lib/types.d.ts:294