@affectively/aeon 1.3.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +5 -11
- package/README.md +90 -10
- package/dist/compression/index.cjs +20 -3
- package/dist/compression/index.cjs.map +1 -1
- package/dist/compression/index.js +20 -3
- package/dist/compression/index.js.map +1 -1
- package/dist/crypto/index.cjs +30 -0
- package/dist/crypto/index.cjs.map +1 -1
- package/dist/crypto/index.js +29 -1
- package/dist/crypto/index.js.map +1 -1
- package/dist/distributed/index.cjs +15 -8
- package/dist/distributed/index.cjs.map +1 -1
- package/dist/distributed/index.js +15 -8
- package/dist/distributed/index.js.map +1 -1
- package/dist/index.cjs +2923 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2879 -47
- package/dist/index.js.map +1 -1
- package/dist/optimization/index.cjs +6 -3
- package/dist/optimization/index.cjs.map +1 -1
- package/dist/optimization/index.js +6 -3
- package/dist/optimization/index.js.map +1 -1
- package/dist/persistence/index.cjs +91 -29
- package/dist/persistence/index.cjs.map +1 -1
- package/dist/persistence/index.js +91 -29
- package/dist/persistence/index.js.map +1 -1
- package/dist/presence/index.cjs.map +1 -1
- package/dist/presence/index.js.map +1 -1
- package/dist/versioning/index.cjs +4 -3
- package/dist/versioning/index.cjs.map +1 -1
- package/dist/versioning/index.js +4 -3
- package/dist/versioning/index.js.map +1 -1
- package/package.json +7 -8
- package/dist/compression/index.d.cts +0 -189
- package/dist/compression/index.d.ts +0 -189
- package/dist/core/index.d.cts +0 -216
- package/dist/core/index.d.ts +0 -216
- package/dist/crypto/index.d.cts +0 -446
- package/dist/crypto/index.d.ts +0 -446
- package/dist/distributed/index.d.cts +0 -1016
- package/dist/distributed/index.d.ts +0 -1016
- package/dist/index.d.cts +0 -12
- package/dist/index.d.ts +0 -12
- package/dist/offline/index.d.cts +0 -154
- package/dist/offline/index.d.ts +0 -154
- package/dist/optimization/index.d.cts +0 -347
- package/dist/optimization/index.d.ts +0 -347
- package/dist/persistence/index.d.cts +0 -63
- package/dist/persistence/index.d.ts +0 -63
- package/dist/presence/index.d.cts +0 -283
- package/dist/presence/index.d.ts +0 -283
- package/dist/types-B7gCpNX9.d.cts +0 -33
- package/dist/types-B7gCpNX9.d.ts +0 -33
- package/dist/utils/index.d.cts +0 -38
- package/dist/utils/index.d.ts +0 -38
- package/dist/versioning/index.d.cts +0 -537
- package/dist/versioning/index.d.ts +0 -537
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { Operation } from '../core/index.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Compression Engine (Phase 12)
|
|
5
|
-
*
|
|
6
|
-
* Provides compression for delta operations using native CompressionStream API.
|
|
7
|
-
* Falls back gracefully when native compression is unavailable.
|
|
8
|
-
*/
|
|
9
|
-
interface CompressedBatch {
|
|
10
|
-
id: string;
|
|
11
|
-
compressed: Uint8Array;
|
|
12
|
-
originalSize: number;
|
|
13
|
-
compressedSize: number;
|
|
14
|
-
compressionRatio: number;
|
|
15
|
-
algorithm: 'gzip' | 'deflate' | 'none';
|
|
16
|
-
timestamp: number;
|
|
17
|
-
}
|
|
18
|
-
interface CompressedChunk {
|
|
19
|
-
chunkId: string;
|
|
20
|
-
batchId: string;
|
|
21
|
-
data: Uint8Array;
|
|
22
|
-
index: number;
|
|
23
|
-
total: number;
|
|
24
|
-
checksum: string;
|
|
25
|
-
}
|
|
26
|
-
interface CompressionStats {
|
|
27
|
-
totalCompressed: number;
|
|
28
|
-
totalDecompressed: number;
|
|
29
|
-
totalOriginalBytes: number;
|
|
30
|
-
totalCompressedBytes: number;
|
|
31
|
-
averageCompressionRatio: number;
|
|
32
|
-
compressionTimeMs: number;
|
|
33
|
-
decompressionTimeMs: number;
|
|
34
|
-
}
|
|
35
|
-
declare class CompressionEngine {
|
|
36
|
-
private stats;
|
|
37
|
-
private preferredAlgorithm;
|
|
38
|
-
constructor(preferredAlgorithm?: 'gzip' | 'deflate');
|
|
39
|
-
/**
|
|
40
|
-
* Check if native compression is available
|
|
41
|
-
*/
|
|
42
|
-
supportsNativeCompression(): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Compress data
|
|
45
|
-
*/
|
|
46
|
-
compress(data: Uint8Array | string): Promise<CompressedBatch>;
|
|
47
|
-
/**
|
|
48
|
-
* Decompress data
|
|
49
|
-
*/
|
|
50
|
-
decompress(batch: CompressedBatch): Promise<Uint8Array>;
|
|
51
|
-
/**
|
|
52
|
-
* Compress using native CompressionStream
|
|
53
|
-
*/
|
|
54
|
-
private compressNative;
|
|
55
|
-
/**
|
|
56
|
-
* Decompress using native DecompressionStream
|
|
57
|
-
*/
|
|
58
|
-
private decompressNative;
|
|
59
|
-
/**
|
|
60
|
-
* Split compressed batch into chunks for transmission
|
|
61
|
-
*/
|
|
62
|
-
splitIntoChunks(batch: CompressedBatch, chunkSize?: number): CompressedChunk[];
|
|
63
|
-
/**
|
|
64
|
-
* Reassemble chunks into compressed batch
|
|
65
|
-
*/
|
|
66
|
-
reassembleChunks(chunks: CompressedChunk[]): Uint8Array;
|
|
67
|
-
/**
|
|
68
|
-
* Simple checksum for chunk verification
|
|
69
|
-
*/
|
|
70
|
-
private simpleChecksum;
|
|
71
|
-
/**
|
|
72
|
-
* Update average compression ratio
|
|
73
|
-
*/
|
|
74
|
-
private updateAverageRatio;
|
|
75
|
-
/**
|
|
76
|
-
* Get statistics
|
|
77
|
-
*/
|
|
78
|
-
getStats(): CompressionStats;
|
|
79
|
-
/**
|
|
80
|
-
* Reset statistics
|
|
81
|
-
*/
|
|
82
|
-
resetStats(): void;
|
|
83
|
-
}
|
|
84
|
-
declare function getCompressionEngine(): CompressionEngine;
|
|
85
|
-
declare function resetCompressionEngine(): void;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Delta Sync Optimizer (Phase 12)
|
|
89
|
-
*
|
|
90
|
-
* Implements field-level change detection to reduce payload size.
|
|
91
|
-
* Computes delta between current and previous operation state.
|
|
92
|
-
*
|
|
93
|
-
* Performance Impact:
|
|
94
|
-
* - Delta sync alone: 70-80% payload reduction
|
|
95
|
-
* - Combined with compression: 80-90% total reduction
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Delta operation - represents only changed fields
|
|
100
|
-
*/
|
|
101
|
-
interface DeltaOperation {
|
|
102
|
-
id: string;
|
|
103
|
-
type: 'full' | 'delta';
|
|
104
|
-
operationId: string;
|
|
105
|
-
operationType: Operation['type'];
|
|
106
|
-
sessionId: string;
|
|
107
|
-
timestamp: number;
|
|
108
|
-
changes?: Record<string, unknown>;
|
|
109
|
-
changeMask?: string[];
|
|
110
|
-
fullData?: Record<string, unknown>;
|
|
111
|
-
priority?: 'high' | 'normal' | 'low';
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Batch of delta operations
|
|
115
|
-
*/
|
|
116
|
-
interface DeltaBatch {
|
|
117
|
-
batchId: string;
|
|
118
|
-
operations: DeltaOperation[];
|
|
119
|
-
timestamp: number;
|
|
120
|
-
totalOriginalSize: number;
|
|
121
|
-
totalDeltaSize: number;
|
|
122
|
-
reductionPercent: number;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Statistics about delta sync performance
|
|
126
|
-
*/
|
|
127
|
-
interface DeltaStats {
|
|
128
|
-
totalOperations: number;
|
|
129
|
-
totalFull: number;
|
|
130
|
-
totalDelta: number;
|
|
131
|
-
totalOriginalSize: number;
|
|
132
|
-
totalDeltaSize: number;
|
|
133
|
-
averageReductionPercent: number;
|
|
134
|
-
lastSyncTime: number;
|
|
135
|
-
fullOperationThreshold: number;
|
|
136
|
-
}
|
|
137
|
-
declare class DeltaSyncOptimizer {
|
|
138
|
-
private operationHistory;
|
|
139
|
-
private stats;
|
|
140
|
-
constructor(fullOperationThreshold?: number);
|
|
141
|
-
/**
|
|
142
|
-
* Compute delta for single operation
|
|
143
|
-
*/
|
|
144
|
-
computeDelta(operation: Operation): DeltaOperation;
|
|
145
|
-
/**
|
|
146
|
-
* Compute deltas for batch of operations
|
|
147
|
-
*/
|
|
148
|
-
computeBatchDeltas(operations: Operation[]): DeltaBatch;
|
|
149
|
-
/**
|
|
150
|
-
* Decompress delta operation back to full operation
|
|
151
|
-
*/
|
|
152
|
-
decompressDelta(delta: DeltaOperation): Operation;
|
|
153
|
-
/**
|
|
154
|
-
* Update history after successful sync
|
|
155
|
-
*/
|
|
156
|
-
updateHistory(operations: Operation[]): void;
|
|
157
|
-
/**
|
|
158
|
-
* Clear history for specific operations
|
|
159
|
-
*/
|
|
160
|
-
clearHistory(operationIds: string[]): void;
|
|
161
|
-
/**
|
|
162
|
-
* Get current performance statistics
|
|
163
|
-
*/
|
|
164
|
-
getStats(): DeltaStats;
|
|
165
|
-
/**
|
|
166
|
-
* Reset statistics
|
|
167
|
-
*/
|
|
168
|
-
resetStats(): void;
|
|
169
|
-
/**
|
|
170
|
-
* Set the full operation threshold
|
|
171
|
-
*/
|
|
172
|
-
setFullOperationThreshold(bytes: number): void;
|
|
173
|
-
/**
|
|
174
|
-
* Get history size for memory monitoring
|
|
175
|
-
*/
|
|
176
|
-
getHistorySize(): number;
|
|
177
|
-
/**
|
|
178
|
-
* Get memory footprint estimate
|
|
179
|
-
*/
|
|
180
|
-
getMemoryEstimate(): number;
|
|
181
|
-
/**
|
|
182
|
-
* Deep equality check for nested objects
|
|
183
|
-
*/
|
|
184
|
-
private deepEqual;
|
|
185
|
-
}
|
|
186
|
-
declare function getDeltaSyncOptimizer(threshold?: number): DeltaSyncOptimizer;
|
|
187
|
-
declare function resetDeltaSyncOptimizer(): void;
|
|
188
|
-
|
|
189
|
-
export { type CompressedBatch, type CompressedChunk, CompressionEngine, type CompressionStats, type DeltaBatch, type DeltaOperation, type DeltaStats, DeltaSyncOptimizer, getCompressionEngine, getDeltaSyncOptimizer, resetCompressionEngine, resetDeltaSyncOptimizer };
|
package/dist/core/index.d.cts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Aeon Core Types
|
|
3
|
-
*
|
|
4
|
-
* Shared type definitions for the Aeon synchronization and versioning system.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Operation type - what action is being performed
|
|
8
|
-
*/
|
|
9
|
-
type OperationType = 'create' | 'update' | 'delete' | 'sync' | 'batch';
|
|
10
|
-
/**
|
|
11
|
-
* Operation priority for sync ordering
|
|
12
|
-
*/
|
|
13
|
-
type OperationPriority = 'high' | 'normal' | 'low';
|
|
14
|
-
/**
|
|
15
|
-
* Operation sync status
|
|
16
|
-
*/
|
|
17
|
-
type OperationStatus = 'pending' | 'syncing' | 'synced' | 'failed';
|
|
18
|
-
/**
|
|
19
|
-
* Queued operation for offline-first synchronization
|
|
20
|
-
*/
|
|
21
|
-
interface Operation {
|
|
22
|
-
id: string;
|
|
23
|
-
type: OperationType;
|
|
24
|
-
sessionId: string;
|
|
25
|
-
status: OperationStatus;
|
|
26
|
-
data: Record<string, unknown>;
|
|
27
|
-
priority?: OperationPriority;
|
|
28
|
-
createdAt?: number;
|
|
29
|
-
syncedAt?: number;
|
|
30
|
-
retryCount?: number;
|
|
31
|
-
maxRetries?: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Conflict detection result
|
|
35
|
-
*/
|
|
36
|
-
interface ConflictDetectionResult {
|
|
37
|
-
hasConflict: boolean;
|
|
38
|
-
type?: 'update_update' | 'delete_update' | 'update_delete' | 'concurrent';
|
|
39
|
-
severity?: 'low' | 'medium' | 'high';
|
|
40
|
-
similarity?: number;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Conflict resolution strategy
|
|
44
|
-
*/
|
|
45
|
-
type ResolutionStrategy =
|
|
46
|
-
| 'local_wins'
|
|
47
|
-
| 'remote_wins'
|
|
48
|
-
| 'last_modified'
|
|
49
|
-
| 'merge'
|
|
50
|
-
| 'manual';
|
|
51
|
-
/**
|
|
52
|
-
* Sync batch for uploading multiple operations
|
|
53
|
-
*/
|
|
54
|
-
interface SyncBatch {
|
|
55
|
-
batchId: string;
|
|
56
|
-
operations: Operation[];
|
|
57
|
-
totalSize: number;
|
|
58
|
-
createdAt: number;
|
|
59
|
-
priority: OperationPriority;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Sync result from server
|
|
63
|
-
*/
|
|
64
|
-
interface SyncResult {
|
|
65
|
-
success: boolean;
|
|
66
|
-
synced: string[];
|
|
67
|
-
failed: Array<{
|
|
68
|
-
operationId: string;
|
|
69
|
-
error: string;
|
|
70
|
-
}>;
|
|
71
|
-
conflicts: Array<{
|
|
72
|
-
operationId: string;
|
|
73
|
-
remoteVersion: Record<string, unknown>;
|
|
74
|
-
strategy: ResolutionStrategy;
|
|
75
|
-
}>;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Network state for adaptive sync
|
|
79
|
-
*/
|
|
80
|
-
type NetworkState = 'online' | 'offline' | 'poor' | 'unknown';
|
|
81
|
-
/**
|
|
82
|
-
* Bandwidth profile for sync adaptation
|
|
83
|
-
*/
|
|
84
|
-
interface BandwidthProfile {
|
|
85
|
-
bandwidth: number;
|
|
86
|
-
latency: number;
|
|
87
|
-
timestamp: number;
|
|
88
|
-
reliability: number;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Sync coordinator configuration
|
|
92
|
-
*/
|
|
93
|
-
interface SyncCoordinatorConfig {
|
|
94
|
-
maxBatchSize: number;
|
|
95
|
-
maxBatchBytes: number;
|
|
96
|
-
maxRetries: number;
|
|
97
|
-
retryDelayMs: number;
|
|
98
|
-
enableCompression: boolean;
|
|
99
|
-
enableDeltaSync: boolean;
|
|
100
|
-
adaptateBatchSize: boolean;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Vector clock for causality tracking
|
|
104
|
-
*/
|
|
105
|
-
interface VectorClock {
|
|
106
|
-
[nodeId: string]: number;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* CRDT operation for conflict-free updates
|
|
110
|
-
*/
|
|
111
|
-
interface CRDTOperation {
|
|
112
|
-
id: string;
|
|
113
|
-
type: 'insert' | 'delete' | 'update';
|
|
114
|
-
path: string[];
|
|
115
|
-
value?: unknown;
|
|
116
|
-
timestamp: number;
|
|
117
|
-
nodeId: string;
|
|
118
|
-
vectorClock: VectorClock;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Presence selection range
|
|
122
|
-
*/
|
|
123
|
-
interface PresenceSelection {
|
|
124
|
-
start: number;
|
|
125
|
-
end: number;
|
|
126
|
-
direction?: 'forward' | 'backward' | 'none';
|
|
127
|
-
path?: string;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Presence typing signal
|
|
131
|
-
*/
|
|
132
|
-
interface PresenceTyping {
|
|
133
|
-
isTyping: boolean;
|
|
134
|
-
field?: string;
|
|
135
|
-
isComposing?: boolean;
|
|
136
|
-
startedAt?: number;
|
|
137
|
-
stoppedAt?: number;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Presence scroll signal
|
|
141
|
-
*/
|
|
142
|
-
interface PresenceScroll {
|
|
143
|
-
depth: number;
|
|
144
|
-
y?: number;
|
|
145
|
-
viewportHeight?: number;
|
|
146
|
-
documentHeight?: number;
|
|
147
|
-
path?: string;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Presence viewport signal
|
|
151
|
-
*/
|
|
152
|
-
interface PresenceViewport {
|
|
153
|
-
width: number;
|
|
154
|
-
height: number;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Presence input signal
|
|
158
|
-
*/
|
|
159
|
-
interface PresenceInputState {
|
|
160
|
-
field: string;
|
|
161
|
-
hasFocus: boolean;
|
|
162
|
-
valueLength?: number;
|
|
163
|
-
selectionStart?: number;
|
|
164
|
-
selectionEnd?: number;
|
|
165
|
-
isComposing?: boolean;
|
|
166
|
-
inputMode?: string;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Presence emotional state signal
|
|
170
|
-
*/
|
|
171
|
-
interface PresenceEmotion {
|
|
172
|
-
primary?: string;
|
|
173
|
-
secondary?: string;
|
|
174
|
-
confidence?: number;
|
|
175
|
-
intensity?: number;
|
|
176
|
-
valence?: number;
|
|
177
|
-
arousal?: number;
|
|
178
|
-
dominance?: number;
|
|
179
|
-
source?: 'self-report' | 'inferred' | 'sensor' | 'hybrid';
|
|
180
|
-
updatedAt?: number;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Presence information for real-time collaboration
|
|
184
|
-
*/
|
|
185
|
-
interface PresenceInfo {
|
|
186
|
-
userId: string;
|
|
187
|
-
nodeId: string;
|
|
188
|
-
cursor?: {
|
|
189
|
-
x: number;
|
|
190
|
-
y: number;
|
|
191
|
-
};
|
|
192
|
-
focusNode?: string;
|
|
193
|
-
selection?: PresenceSelection;
|
|
194
|
-
typing?: PresenceTyping;
|
|
195
|
-
scroll?: PresenceScroll;
|
|
196
|
-
viewport?: PresenceViewport;
|
|
197
|
-
inputState?: PresenceInputState;
|
|
198
|
-
emotion?: PresenceEmotion;
|
|
199
|
-
metadata?: Record<string, unknown>;
|
|
200
|
-
lastActivity: number;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Event emitter types
|
|
204
|
-
*/
|
|
205
|
-
type EventCallback<T = unknown> = (data: T) => void;
|
|
206
|
-
type EventUnsubscribe = () => void;
|
|
207
|
-
/**
|
|
208
|
-
* Generic event emitter interface
|
|
209
|
-
*/
|
|
210
|
-
interface IEventEmitter {
|
|
211
|
-
on<T = unknown>(event: string, callback: EventCallback<T>): EventUnsubscribe;
|
|
212
|
-
off(event: string, callback: EventCallback): void;
|
|
213
|
-
emit<T = unknown>(event: string, data?: T): void;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export type { BandwidthProfile, CRDTOperation, ConflictDetectionResult, EventCallback, EventUnsubscribe, IEventEmitter, NetworkState, Operation, OperationPriority, OperationStatus, OperationType, PresenceEmotion, PresenceInfo, PresenceInputState, PresenceScroll, PresenceSelection, PresenceTyping, PresenceViewport, ResolutionStrategy, SyncBatch, SyncCoordinatorConfig, SyncResult, VectorClock };
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Aeon Core Types
|
|
3
|
-
*
|
|
4
|
-
* Shared type definitions for the Aeon synchronization and versioning system.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Operation type - what action is being performed
|
|
8
|
-
*/
|
|
9
|
-
type OperationType = 'create' | 'update' | 'delete' | 'sync' | 'batch';
|
|
10
|
-
/**
|
|
11
|
-
* Operation priority for sync ordering
|
|
12
|
-
*/
|
|
13
|
-
type OperationPriority = 'high' | 'normal' | 'low';
|
|
14
|
-
/**
|
|
15
|
-
* Operation sync status
|
|
16
|
-
*/
|
|
17
|
-
type OperationStatus = 'pending' | 'syncing' | 'synced' | 'failed';
|
|
18
|
-
/**
|
|
19
|
-
* Queued operation for offline-first synchronization
|
|
20
|
-
*/
|
|
21
|
-
interface Operation {
|
|
22
|
-
id: string;
|
|
23
|
-
type: OperationType;
|
|
24
|
-
sessionId: string;
|
|
25
|
-
status: OperationStatus;
|
|
26
|
-
data: Record<string, unknown>;
|
|
27
|
-
priority?: OperationPriority;
|
|
28
|
-
createdAt?: number;
|
|
29
|
-
syncedAt?: number;
|
|
30
|
-
retryCount?: number;
|
|
31
|
-
maxRetries?: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Conflict detection result
|
|
35
|
-
*/
|
|
36
|
-
interface ConflictDetectionResult {
|
|
37
|
-
hasConflict: boolean;
|
|
38
|
-
type?: 'update_update' | 'delete_update' | 'update_delete' | 'concurrent';
|
|
39
|
-
severity?: 'low' | 'medium' | 'high';
|
|
40
|
-
similarity?: number;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Conflict resolution strategy
|
|
44
|
-
*/
|
|
45
|
-
type ResolutionStrategy =
|
|
46
|
-
| 'local_wins'
|
|
47
|
-
| 'remote_wins'
|
|
48
|
-
| 'last_modified'
|
|
49
|
-
| 'merge'
|
|
50
|
-
| 'manual';
|
|
51
|
-
/**
|
|
52
|
-
* Sync batch for uploading multiple operations
|
|
53
|
-
*/
|
|
54
|
-
interface SyncBatch {
|
|
55
|
-
batchId: string;
|
|
56
|
-
operations: Operation[];
|
|
57
|
-
totalSize: number;
|
|
58
|
-
createdAt: number;
|
|
59
|
-
priority: OperationPriority;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Sync result from server
|
|
63
|
-
*/
|
|
64
|
-
interface SyncResult {
|
|
65
|
-
success: boolean;
|
|
66
|
-
synced: string[];
|
|
67
|
-
failed: Array<{
|
|
68
|
-
operationId: string;
|
|
69
|
-
error: string;
|
|
70
|
-
}>;
|
|
71
|
-
conflicts: Array<{
|
|
72
|
-
operationId: string;
|
|
73
|
-
remoteVersion: Record<string, unknown>;
|
|
74
|
-
strategy: ResolutionStrategy;
|
|
75
|
-
}>;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Network state for adaptive sync
|
|
79
|
-
*/
|
|
80
|
-
type NetworkState = 'online' | 'offline' | 'poor' | 'unknown';
|
|
81
|
-
/**
|
|
82
|
-
* Bandwidth profile for sync adaptation
|
|
83
|
-
*/
|
|
84
|
-
interface BandwidthProfile {
|
|
85
|
-
bandwidth: number;
|
|
86
|
-
latency: number;
|
|
87
|
-
timestamp: number;
|
|
88
|
-
reliability: number;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Sync coordinator configuration
|
|
92
|
-
*/
|
|
93
|
-
interface SyncCoordinatorConfig {
|
|
94
|
-
maxBatchSize: number;
|
|
95
|
-
maxBatchBytes: number;
|
|
96
|
-
maxRetries: number;
|
|
97
|
-
retryDelayMs: number;
|
|
98
|
-
enableCompression: boolean;
|
|
99
|
-
enableDeltaSync: boolean;
|
|
100
|
-
adaptateBatchSize: boolean;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Vector clock for causality tracking
|
|
104
|
-
*/
|
|
105
|
-
interface VectorClock {
|
|
106
|
-
[nodeId: string]: number;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* CRDT operation for conflict-free updates
|
|
110
|
-
*/
|
|
111
|
-
interface CRDTOperation {
|
|
112
|
-
id: string;
|
|
113
|
-
type: 'insert' | 'delete' | 'update';
|
|
114
|
-
path: string[];
|
|
115
|
-
value?: unknown;
|
|
116
|
-
timestamp: number;
|
|
117
|
-
nodeId: string;
|
|
118
|
-
vectorClock: VectorClock;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Presence selection range
|
|
122
|
-
*/
|
|
123
|
-
interface PresenceSelection {
|
|
124
|
-
start: number;
|
|
125
|
-
end: number;
|
|
126
|
-
direction?: 'forward' | 'backward' | 'none';
|
|
127
|
-
path?: string;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Presence typing signal
|
|
131
|
-
*/
|
|
132
|
-
interface PresenceTyping {
|
|
133
|
-
isTyping: boolean;
|
|
134
|
-
field?: string;
|
|
135
|
-
isComposing?: boolean;
|
|
136
|
-
startedAt?: number;
|
|
137
|
-
stoppedAt?: number;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Presence scroll signal
|
|
141
|
-
*/
|
|
142
|
-
interface PresenceScroll {
|
|
143
|
-
depth: number;
|
|
144
|
-
y?: number;
|
|
145
|
-
viewportHeight?: number;
|
|
146
|
-
documentHeight?: number;
|
|
147
|
-
path?: string;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Presence viewport signal
|
|
151
|
-
*/
|
|
152
|
-
interface PresenceViewport {
|
|
153
|
-
width: number;
|
|
154
|
-
height: number;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Presence input signal
|
|
158
|
-
*/
|
|
159
|
-
interface PresenceInputState {
|
|
160
|
-
field: string;
|
|
161
|
-
hasFocus: boolean;
|
|
162
|
-
valueLength?: number;
|
|
163
|
-
selectionStart?: number;
|
|
164
|
-
selectionEnd?: number;
|
|
165
|
-
isComposing?: boolean;
|
|
166
|
-
inputMode?: string;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Presence emotional state signal
|
|
170
|
-
*/
|
|
171
|
-
interface PresenceEmotion {
|
|
172
|
-
primary?: string;
|
|
173
|
-
secondary?: string;
|
|
174
|
-
confidence?: number;
|
|
175
|
-
intensity?: number;
|
|
176
|
-
valence?: number;
|
|
177
|
-
arousal?: number;
|
|
178
|
-
dominance?: number;
|
|
179
|
-
source?: 'self-report' | 'inferred' | 'sensor' | 'hybrid';
|
|
180
|
-
updatedAt?: number;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Presence information for real-time collaboration
|
|
184
|
-
*/
|
|
185
|
-
interface PresenceInfo {
|
|
186
|
-
userId: string;
|
|
187
|
-
nodeId: string;
|
|
188
|
-
cursor?: {
|
|
189
|
-
x: number;
|
|
190
|
-
y: number;
|
|
191
|
-
};
|
|
192
|
-
focusNode?: string;
|
|
193
|
-
selection?: PresenceSelection;
|
|
194
|
-
typing?: PresenceTyping;
|
|
195
|
-
scroll?: PresenceScroll;
|
|
196
|
-
viewport?: PresenceViewport;
|
|
197
|
-
inputState?: PresenceInputState;
|
|
198
|
-
emotion?: PresenceEmotion;
|
|
199
|
-
metadata?: Record<string, unknown>;
|
|
200
|
-
lastActivity: number;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Event emitter types
|
|
204
|
-
*/
|
|
205
|
-
type EventCallback<T = unknown> = (data: T) => void;
|
|
206
|
-
type EventUnsubscribe = () => void;
|
|
207
|
-
/**
|
|
208
|
-
* Generic event emitter interface
|
|
209
|
-
*/
|
|
210
|
-
interface IEventEmitter {
|
|
211
|
-
on<T = unknown>(event: string, callback: EventCallback<T>): EventUnsubscribe;
|
|
212
|
-
off(event: string, callback: EventCallback): void;
|
|
213
|
-
emit<T = unknown>(event: string, data?: T): void;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export type { BandwidthProfile, CRDTOperation, ConflictDetectionResult, EventCallback, EventUnsubscribe, IEventEmitter, NetworkState, Operation, OperationPriority, OperationStatus, OperationType, PresenceEmotion, PresenceInfo, PresenceInputState, PresenceScroll, PresenceSelection, PresenceTyping, PresenceViewport, ResolutionStrategy, SyncBatch, SyncCoordinatorConfig, SyncResult, VectorClock };
|