1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
/**
* 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";
// Migration utilities
export {
clearAllCrdtState,
getMigrationStatus,
isMigrationCompleted,
MIGRATION_VERSION,
type MigrationProgress,
type MigrationResult,
resetMigration,
runMigration,
runMigrationWithBatching,
} from "./migration";
// CRDT-aware repository wrappers
export {
type CrdtDocumentResult,
type CrdtMergeResult,
type CrdtRepository,
crdtCardRepository,
crdtDeckRepository,
crdtNoteFieldTypeRepository,
crdtNoteFieldValueRepository,
crdtNoteRepository,
crdtNoteTypeRepository,
crdtRepositories,
crdtReviewLogRepository,
entitiesToCrdtDocuments,
getCrdtRepository,
getRepositoryForDocumentId,
mergeAndConvert,
} from "./repositories";
// Sync state management
export {
base64ToBinary,
binaryToBase64,
type CrdtSyncMetadata,
type CrdtSyncPayload,
type CrdtSyncStateEntry,
CrdtSyncStateManager,
crdtSyncDb,
crdtSyncStateManager,
entriesToSyncPayload,
syncPayloadToEntries,
} from "./sync-state";
// 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";
|