@saplings/collaboration
v0.2.0
Published
Optimistic document revision primitives
Readme
@saplings/collaboration
Tenant-scoped optimistic document revisions with a pluggable atomic storage contract.
Usage
import { createCollaborationService, createMemoryRevisionStore } from '@saplings/collaboration';
const service = createCollaborationService({ store: createMemoryRevisionStore<string>(), authorize, parse: String });
await service.save(actor, { tenantId: 'a', documentId: 'draft' }, 0, 'Hello');A stale write throws RevisionConflict instead of overwriting a newer revision. Authorize every operation with a trusted actor. The in-memory adapter is not durable or bounded; production requires an atomic persistent adapter, transactional authorization where needed, retention and quota policy. This is optimistic document editing, not a CRDT or multiplayer presence system.
