Skip to content

Documentation / @super-line/core / DocOptions

Interface: DocOptions

Defined in: packages/core/src/contract.ts:67

Per-document super-store config for a CRDT collection (ADR-0007). mode: 'document' makes the doc a recursive CRDT (nested-field merge); opaque keeps named subtrees atomic (discriminated-union blobs). Lives on the contract so both halves derive it from one source — the drift-free replacement for store-sync's "supply the SAME resolver to both halves" footgun.

Properties

mode?

optional mode?: "shallow" | "document"

Defined in: packages/core/src/contract.ts:68


opaque?

optional opaque?: string[]

Defined in: packages/core/src/contract.ts:69


validate?

optional validate?: boolean

Defined in: packages/core/src/contract.ts:86

Ingress validation (validate-before-commit) for this collection. Default true.

Unlike its siblings this is super-line's own knob, not super-store's — backends forward the whole bag to StoreValue, which ignores keys it does not know. Set false and the server passes NO validator to CrdtCollectionStore.apply, so the backend skips the scratch fold entirely rather than performing it and discarding the result.

Turn it off when writes are too fine-grained to validate: the fold is proportional to document size and op-log depth (a CRDT has no cheap clone), which is affordable per shape or per scene field and ruinous per keystroke. It is also the only way to hold collaborative text, whose merge granularity is finer than any field the schema could describe.

The cost is exact: the CrdtCollectionPolicy remains the only gate on such a collection. It still decides who may write; nothing then decides what.

Released under the MIT License.