diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-12-31 15:06:25 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-12-31 15:06:25 +0900 |
| commit | 2e21859626e69d992d4dff21338487d372097cb0 (patch) | |
| tree | 9f84a36729701d542f3e430694bb64b402fe3da1 /src/client/sync/crdt/index.ts | |
| parent | d463fd3339c791bf999873ea37d320d56319d7d4 (diff) | |
| download | kioku-2e21859626e69d992d4dff21338487d372097cb0.tar.gz kioku-2e21859626e69d992d4dff21338487d372097cb0.tar.zst kioku-2e21859626e69d992d4dff21338487d372097cb0.zip | |
feat(crdt): add Automerge document lifecycle management
Implement document-manager.ts with core CRDT operations:
- Document creation, update, merge, save/load functions
- Conversion functions between local entities and CRDT documents
- Actor ID management for client identification
- Conflict detection utilities
Completes Phase 1 of CRDT implementation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/client/sync/crdt/index.ts')
| -rw-r--r-- | src/client/sync/crdt/index.ts | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/client/sync/crdt/index.ts b/src/client/sync/crdt/index.ts new file mode 100644 index 0000000..fa296bd --- /dev/null +++ b/src/client/sync/crdt/index.ts @@ -0,0 +1,69 @@ +/** + * CRDT Module + * + * This module provides Automerge CRDT-based sync functionality for Kioku. + * It enables conflict-free synchronization of data between clients and server. + */ + +// Document lifecycle management +export { + // Core document operations + applyChanges, + // Entity to/from CRDT document conversions + cardToCrdtDocument, + crdtDocumentToCard, + crdtDocumentToDeck, + crdtDocumentToNote, + crdtDocumentToNoteFieldType, + crdtDocumentToNoteFieldValue, + crdtDocumentToNoteType, + crdtDocumentToReviewLog, + createDocument, + // Generic entity conversion + createDocumentFromEntity, + createEmptyDocument, + // Types + type DocumentChange, + type DocumentSnapshot, + deckToCrdtDocument, + // Actor ID management + getActorId, + getChanges, + // Conflict detection and utilities + getLastModified, + hasConflicts, + initDocumentWithActor, + isDeleted, + loadDocument, + loadIncremental, + type MergeResult, + mergeDocuments, + noteFieldTypeToCrdtDocument, + noteFieldValueToCrdtDocument, + noteToCrdtDocument, + noteTypeToCrdtDocument, + reviewLogToCrdtDocument, + saveDocument, + saveIncremental, + updateDocument, +} from "./document-manager"; +// Type definitions +export { + type CrdtCardDocument, + type CrdtDeckDocument, + type CrdtDocument, + type CrdtDocumentMap, + CrdtEntityType, + type CrdtEntityTypeValue, + type CrdtMetadata, + type CrdtNoteDocument, + type CrdtNoteFieldTypeDocument, + type CrdtNoteFieldValueDocument, + type CrdtNoteTypeDocument, + type CrdtReviewLogDocument, + createCrdtMetadata, + createDeletedCrdtMetadata, + createDocumentId, + type DocumentId, + parseDocumentId, +} from "./types"; |
