@framers/sql-storage-adapter 0.4.2 → 0.5.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/README.md +94 -2
- package/dist/adapters/electron/electronMainAdapter.d.ts +241 -0
- package/dist/adapters/electron/electronMainAdapter.d.ts.map +1 -0
- package/dist/adapters/electron/electronMainAdapter.js +442 -0
- package/dist/adapters/electron/electronMainAdapter.js.map +1 -0
- package/dist/adapters/electron/electronRendererAdapter.d.ts +177 -0
- package/dist/adapters/electron/electronRendererAdapter.d.ts.map +1 -0
- package/dist/adapters/electron/electronRendererAdapter.js +339 -0
- package/dist/adapters/electron/electronRendererAdapter.js.map +1 -0
- package/dist/adapters/electron/index.d.ts +74 -0
- package/dist/adapters/electron/index.d.ts.map +1 -0
- package/dist/adapters/electron/index.js +96 -0
- package/dist/adapters/electron/index.js.map +1 -0
- package/dist/adapters/electron/ipc/channels.d.ts +196 -0
- package/dist/adapters/electron/ipc/channels.d.ts.map +1 -0
- package/dist/adapters/electron/ipc/channels.js +121 -0
- package/dist/adapters/electron/ipc/channels.js.map +1 -0
- package/dist/adapters/electron/ipc/index.d.ts +11 -0
- package/dist/adapters/electron/ipc/index.d.ts.map +1 -0
- package/dist/adapters/electron/ipc/index.js +11 -0
- package/dist/adapters/electron/ipc/index.js.map +1 -0
- package/dist/adapters/electron/ipc/protocol.d.ts +78 -0
- package/dist/adapters/electron/ipc/protocol.d.ts.map +1 -0
- package/dist/adapters/electron/ipc/protocol.js +347 -0
- package/dist/adapters/electron/ipc/protocol.js.map +1 -0
- package/dist/adapters/electron/ipc/types.d.ts +248 -0
- package/dist/adapters/electron/ipc/types.d.ts.map +1 -0
- package/dist/adapters/electron/ipc/types.js +8 -0
- package/dist/adapters/electron/ipc/types.js.map +1 -0
- package/dist/adapters/electron/migration/autoMigrator.d.ts +184 -0
- package/dist/adapters/electron/migration/autoMigrator.d.ts.map +1 -0
- package/dist/adapters/electron/migration/autoMigrator.js +478 -0
- package/dist/adapters/electron/migration/autoMigrator.js.map +1 -0
- package/dist/adapters/electron/migration/index.d.ts +9 -0
- package/dist/adapters/electron/migration/index.d.ts.map +1 -0
- package/dist/adapters/electron/migration/index.js +9 -0
- package/dist/adapters/electron/migration/index.js.map +1 -0
- package/dist/adapters/electron/preload.d.ts +126 -0
- package/dist/adapters/electron/preload.d.ts.map +1 -0
- package/dist/adapters/electron/preload.js +254 -0
- package/dist/adapters/electron/preload.js.map +1 -0
- package/dist/adapters/electron/recovery/corruptionDetector.d.ts +214 -0
- package/dist/adapters/electron/recovery/corruptionDetector.d.ts.map +1 -0
- package/dist/adapters/electron/recovery/corruptionDetector.js +410 -0
- package/dist/adapters/electron/recovery/corruptionDetector.js.map +1 -0
- package/dist/adapters/electron/recovery/index.d.ts +11 -0
- package/dist/adapters/electron/recovery/index.d.ts.map +1 -0
- package/dist/adapters/electron/recovery/index.js +11 -0
- package/dist/adapters/electron/recovery/index.js.map +1 -0
- package/dist/adapters/electron/recovery/walCheckpoint.d.ts +186 -0
- package/dist/adapters/electron/recovery/walCheckpoint.d.ts.map +1 -0
- package/dist/adapters/electron/recovery/walCheckpoint.js +302 -0
- package/dist/adapters/electron/recovery/walCheckpoint.js.map +1 -0
- package/dist/adapters/electron/window/index.d.ts +9 -0
- package/dist/adapters/electron/window/index.d.ts.map +1 -0
- package/dist/adapters/electron/window/index.js +9 -0
- package/dist/adapters/electron/window/index.js.map +1 -0
- package/dist/adapters/electron/window/windowManager.d.ts +190 -0
- package/dist/adapters/electron/window/windowManager.d.ts.map +1 -0
- package/dist/adapters/electron/window/windowManager.js +358 -0
- package/dist/adapters/electron/window/windowManager.js.map +1 -0
- package/dist/core/contracts/context.d.ts +2 -2
- package/dist/core/contracts/context.d.ts.map +1 -1
- package/dist/core/database.d.ts +19 -0
- package/dist/core/database.d.ts.map +1 -1
- package/dist/core/database.js +4 -0
- package/dist/core/database.js.map +1 -1
- package/dist/core/resolver.d.ts +3 -0
- package/dist/core/resolver.d.ts.map +1 -1
- package/dist/core/resolver.js +39 -3
- package/dist/core/resolver.js.map +1 -1
- package/dist/features/sync/conflicts/conflictResolver.d.ts +222 -0
- package/dist/features/sync/conflicts/conflictResolver.d.ts.map +1 -0
- package/dist/features/sync/conflicts/conflictResolver.js +396 -0
- package/dist/features/sync/conflicts/conflictResolver.js.map +1 -0
- package/dist/features/sync/conflicts/index.d.ts +9 -0
- package/dist/features/sync/conflicts/index.d.ts.map +1 -0
- package/dist/features/sync/conflicts/index.js +9 -0
- package/dist/features/sync/conflicts/index.js.map +1 -0
- package/dist/features/sync/crossPlatformSync.d.ts +281 -0
- package/dist/features/sync/crossPlatformSync.d.ts.map +1 -0
- package/dist/features/sync/crossPlatformSync.js +623 -0
- package/dist/features/sync/crossPlatformSync.js.map +1 -0
- package/dist/features/sync/devices/deviceManager.d.ts +243 -0
- package/dist/features/sync/devices/deviceManager.d.ts.map +1 -0
- package/dist/features/sync/devices/deviceManager.js +494 -0
- package/dist/features/sync/devices/deviceManager.js.map +1 -0
- package/dist/features/sync/devices/index.d.ts +10 -0
- package/dist/features/sync/devices/index.d.ts.map +1 -0
- package/dist/features/sync/devices/index.js +10 -0
- package/dist/features/sync/devices/index.js.map +1 -0
- package/dist/features/sync/index.d.ts +37 -0
- package/dist/features/sync/index.d.ts.map +1 -0
- package/dist/features/sync/index.js +47 -0
- package/dist/features/sync/index.js.map +1 -0
- package/dist/features/sync/protocol/index.d.ts +11 -0
- package/dist/features/sync/protocol/index.d.ts.map +1 -0
- package/dist/features/sync/protocol/index.js +11 -0
- package/dist/features/sync/protocol/index.js.map +1 -0
- package/dist/features/sync/protocol/messages.d.ts +348 -0
- package/dist/features/sync/protocol/messages.d.ts.map +1 -0
- package/dist/features/sync/protocol/messages.js +216 -0
- package/dist/features/sync/protocol/messages.js.map +1 -0
- package/dist/features/sync/protocol/vectorClock.d.ts +164 -0
- package/dist/features/sync/protocol/vectorClock.d.ts.map +1 -0
- package/dist/features/sync/protocol/vectorClock.js +286 -0
- package/dist/features/sync/protocol/vectorClock.js.map +1 -0
- package/dist/features/sync/tables/index.d.ts +10 -0
- package/dist/features/sync/tables/index.d.ts.map +1 -0
- package/dist/features/sync/tables/index.js +10 -0
- package/dist/features/sync/tables/index.js.map +1 -0
- package/dist/features/sync/tables/syncLogManager.d.ts +216 -0
- package/dist/features/sync/tables/syncLogManager.d.ts.map +1 -0
- package/dist/features/sync/tables/syncLogManager.js +456 -0
- package/dist/features/sync/tables/syncLogManager.js.map +1 -0
- package/dist/features/sync/transport/httpTransport.d.ts +123 -0
- package/dist/features/sync/transport/httpTransport.d.ts.map +1 -0
- package/dist/features/sync/transport/httpTransport.js +380 -0
- package/dist/features/sync/transport/httpTransport.js.map +1 -0
- package/dist/features/sync/transport/index.d.ts +12 -0
- package/dist/features/sync/transport/index.d.ts.map +1 -0
- package/dist/features/sync/transport/index.js +12 -0
- package/dist/features/sync/transport/index.js.map +1 -0
- package/dist/features/sync/transport/transport.d.ts +259 -0
- package/dist/features/sync/transport/transport.d.ts.map +1 -0
- package/dist/features/sync/transport/transport.js +153 -0
- package/dist/features/sync/transport/transport.js.map +1 -0
- package/dist/features/sync/transport/websocketTransport.d.ts +126 -0
- package/dist/features/sync/transport/websocketTransport.d.ts.map +1 -0
- package/dist/features/sync/transport/websocketTransport.js +374 -0
- package/dist/features/sync/transport/websocketTransport.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +21 -1
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device Registry and Presence Management.
|
|
3
|
+
*
|
|
4
|
+
* Manages device registration, presence tracking, and peer discovery
|
|
5
|
+
* for cross-platform sync.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { generateDeviceId, createVectorClock } from '../protocol/vectorClock.js';
|
|
10
|
+
/**
|
|
11
|
+
* Detects the current device type.
|
|
12
|
+
*/
|
|
13
|
+
const detectDeviceType = () => {
|
|
14
|
+
// Check for Electron
|
|
15
|
+
if (typeof process !== 'undefined' && process.versions?.electron) {
|
|
16
|
+
return 'electron';
|
|
17
|
+
}
|
|
18
|
+
// Check for Capacitor
|
|
19
|
+
if (typeof window !== 'undefined') {
|
|
20
|
+
const win = window;
|
|
21
|
+
if (win.Capacitor?.isNativePlatform?.()) {
|
|
22
|
+
return 'capacitor';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Check for Node.js server
|
|
26
|
+
if (typeof process !== 'undefined' && process.versions?.node && typeof window === 'undefined') {
|
|
27
|
+
return 'server';
|
|
28
|
+
}
|
|
29
|
+
// Browser
|
|
30
|
+
if (typeof window !== 'undefined') {
|
|
31
|
+
return 'browser';
|
|
32
|
+
}
|
|
33
|
+
return 'unknown';
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Generates a default device name.
|
|
37
|
+
*/
|
|
38
|
+
const generateDeviceName = (type) => {
|
|
39
|
+
const timestamp = Date.now().toString(36).slice(-4);
|
|
40
|
+
switch (type) {
|
|
41
|
+
case 'electron':
|
|
42
|
+
return `Desktop-${timestamp}`;
|
|
43
|
+
case 'capacitor':
|
|
44
|
+
return `Mobile-${timestamp}`;
|
|
45
|
+
case 'browser':
|
|
46
|
+
return `Browser-${timestamp}`;
|
|
47
|
+
case 'server':
|
|
48
|
+
return `Server-${timestamp}`;
|
|
49
|
+
default:
|
|
50
|
+
return `Device-${timestamp}`;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Default device capabilities by type.
|
|
55
|
+
*/
|
|
56
|
+
const getDefaultCapabilities = (type) => {
|
|
57
|
+
switch (type) {
|
|
58
|
+
case 'electron':
|
|
59
|
+
return {
|
|
60
|
+
realTimeSync: true,
|
|
61
|
+
backgroundSync: true,
|
|
62
|
+
pushNotifications: true,
|
|
63
|
+
offlineMode: true,
|
|
64
|
+
maxBatchSize: 1000,
|
|
65
|
+
};
|
|
66
|
+
case 'capacitor':
|
|
67
|
+
return {
|
|
68
|
+
realTimeSync: true,
|
|
69
|
+
backgroundSync: true,
|
|
70
|
+
pushNotifications: true,
|
|
71
|
+
offlineMode: true,
|
|
72
|
+
maxBatchSize: 500,
|
|
73
|
+
};
|
|
74
|
+
case 'browser':
|
|
75
|
+
return {
|
|
76
|
+
realTimeSync: true,
|
|
77
|
+
backgroundSync: false,
|
|
78
|
+
pushNotifications: false,
|
|
79
|
+
offlineMode: true,
|
|
80
|
+
maxBatchSize: 500,
|
|
81
|
+
};
|
|
82
|
+
case 'server':
|
|
83
|
+
return {
|
|
84
|
+
realTimeSync: true,
|
|
85
|
+
backgroundSync: true,
|
|
86
|
+
pushNotifications: false,
|
|
87
|
+
offlineMode: false,
|
|
88
|
+
maxBatchSize: 10000,
|
|
89
|
+
};
|
|
90
|
+
default:
|
|
91
|
+
return {
|
|
92
|
+
realTimeSync: false,
|
|
93
|
+
backgroundSync: false,
|
|
94
|
+
pushNotifications: false,
|
|
95
|
+
offlineMode: false,
|
|
96
|
+
maxBatchSize: 100,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Device registry and presence manager.
|
|
102
|
+
*
|
|
103
|
+
* Manages device registration, presence tracking, and peer discovery
|
|
104
|
+
* across all connected devices in a sync cluster.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const manager = new DeviceManager({
|
|
109
|
+
* adapter: db,
|
|
110
|
+
* deviceName: 'MacBook Pro',
|
|
111
|
+
* });
|
|
112
|
+
*
|
|
113
|
+
* await manager.initialize();
|
|
114
|
+
*
|
|
115
|
+
* // Get current device
|
|
116
|
+
* const thisDevice = manager.getCurrentDevice();
|
|
117
|
+
*
|
|
118
|
+
* // Get all known peers
|
|
119
|
+
* const peers = await manager.getPeers();
|
|
120
|
+
*
|
|
121
|
+
* // Listen for presence changes
|
|
122
|
+
* manager.on('presenceChanged', (event) => {
|
|
123
|
+
* console.log(`${event.deviceId} is now ${event.currentStatus}`);
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export class DeviceManager {
|
|
128
|
+
constructor(options) {
|
|
129
|
+
this._currentDevice = null;
|
|
130
|
+
this._peers = new Map();
|
|
131
|
+
this._heartbeatTimer = null;
|
|
132
|
+
this._listeners = new Map();
|
|
133
|
+
this._initialized = false;
|
|
134
|
+
this._adapter = options.adapter;
|
|
135
|
+
this._options = {
|
|
136
|
+
adapter: options.adapter,
|
|
137
|
+
presenceTimeout: options.presenceTimeout ?? 60000,
|
|
138
|
+
heartbeatInterval: options.heartbeatInterval ?? 30000,
|
|
139
|
+
autoDetect: options.autoDetect ?? true,
|
|
140
|
+
deviceName: options.deviceName ?? '',
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Initialize the device manager.
|
|
145
|
+
*/
|
|
146
|
+
async initialize() {
|
|
147
|
+
if (this._initialized)
|
|
148
|
+
return;
|
|
149
|
+
// Create tables if needed
|
|
150
|
+
await this._ensureTables();
|
|
151
|
+
// Register or load current device
|
|
152
|
+
await this._initializeCurrentDevice();
|
|
153
|
+
// Load known peers
|
|
154
|
+
await this._loadPeers();
|
|
155
|
+
// Start heartbeat
|
|
156
|
+
this._startHeartbeat();
|
|
157
|
+
this._initialized = true;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get the current device.
|
|
161
|
+
*/
|
|
162
|
+
getCurrentDevice() {
|
|
163
|
+
return this._currentDevice;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get all known peer devices.
|
|
167
|
+
*/
|
|
168
|
+
async getPeers() {
|
|
169
|
+
return Array.from(this._peers.values());
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get online peers only.
|
|
173
|
+
*/
|
|
174
|
+
async getOnlinePeers() {
|
|
175
|
+
const now = Date.now();
|
|
176
|
+
const timeout = this._options.presenceTimeout;
|
|
177
|
+
return Array.from(this._peers.values()).filter((peer) => {
|
|
178
|
+
return (now - peer.lastSeenAt) < timeout;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get a specific device by ID.
|
|
183
|
+
*/
|
|
184
|
+
async getDevice(deviceId) {
|
|
185
|
+
if (deviceId === this._currentDevice?.deviceId) {
|
|
186
|
+
return this._currentDevice;
|
|
187
|
+
}
|
|
188
|
+
return this._peers.get(deviceId) ?? null;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Update the current device's presence.
|
|
192
|
+
*/
|
|
193
|
+
async updatePresence(status) {
|
|
194
|
+
if (!this._currentDevice)
|
|
195
|
+
return;
|
|
196
|
+
const previous = this._currentDevice.presence;
|
|
197
|
+
this._currentDevice.presence = status;
|
|
198
|
+
this._currentDevice.lastSeenAt = Date.now();
|
|
199
|
+
await this._saveDevice(this._currentDevice);
|
|
200
|
+
this._emit('presenceChanged', {
|
|
201
|
+
deviceId: this._currentDevice.deviceId,
|
|
202
|
+
previousStatus: previous,
|
|
203
|
+
currentStatus: status,
|
|
204
|
+
timestamp: Date.now(),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Update the current device's vector clock.
|
|
209
|
+
*/
|
|
210
|
+
async updateVectorClock(clock) {
|
|
211
|
+
if (!this._currentDevice)
|
|
212
|
+
return;
|
|
213
|
+
this._currentDevice.vectorClock = clock;
|
|
214
|
+
this._currentDevice.lastSeenAt = Date.now();
|
|
215
|
+
await this._saveDevice(this._currentDevice);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Register or update a peer device.
|
|
219
|
+
*/
|
|
220
|
+
async registerPeer(peerInfo) {
|
|
221
|
+
const existing = this._peers.get(peerInfo.deviceId);
|
|
222
|
+
if (existing) {
|
|
223
|
+
// Update existing peer
|
|
224
|
+
const changes = {};
|
|
225
|
+
if (peerInfo.lastSeenAt > existing.lastSeenAt) {
|
|
226
|
+
Object.assign(existing, peerInfo);
|
|
227
|
+
this._emit('deviceUpdated', { device: existing, changes: peerInfo });
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
// New peer discovered
|
|
232
|
+
this._peers.set(peerInfo.deviceId, peerInfo);
|
|
233
|
+
await this._saveDevice(peerInfo);
|
|
234
|
+
this._emit('peerDiscovered', peerInfo);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Remove a device from the registry.
|
|
239
|
+
*/
|
|
240
|
+
async removeDevice(deviceId, reason = 'removed') {
|
|
241
|
+
if (deviceId === this._currentDevice?.deviceId) {
|
|
242
|
+
throw new Error('Cannot remove current device');
|
|
243
|
+
}
|
|
244
|
+
const device = this._peers.get(deviceId);
|
|
245
|
+
if (!device)
|
|
246
|
+
return;
|
|
247
|
+
this._peers.delete(deviceId);
|
|
248
|
+
await this._adapter.run('DELETE FROM _sync_devices WHERE device_id = ?', [deviceId]);
|
|
249
|
+
this._emit('deviceRemoved', { deviceId, reason });
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Check for stale peers and update their presence.
|
|
253
|
+
*/
|
|
254
|
+
async checkStaleDevices() {
|
|
255
|
+
const now = Date.now();
|
|
256
|
+
const timeout = this._options.presenceTimeout;
|
|
257
|
+
for (const peer of this._peers.values()) {
|
|
258
|
+
if (peer.presence !== 'offline' && (now - peer.lastSeenAt) > timeout) {
|
|
259
|
+
const previousStatus = peer.presence;
|
|
260
|
+
peer.presence = 'offline';
|
|
261
|
+
this._emit('presenceChanged', {
|
|
262
|
+
deviceId: peer.deviceId,
|
|
263
|
+
previousStatus,
|
|
264
|
+
currentStatus: 'offline',
|
|
265
|
+
timestamp: now,
|
|
266
|
+
});
|
|
267
|
+
this._emit('peerLost', {
|
|
268
|
+
deviceId: peer.deviceId,
|
|
269
|
+
lastSeenAt: peer.lastSeenAt,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Listen for device manager events.
|
|
276
|
+
*/
|
|
277
|
+
on(event, listener) {
|
|
278
|
+
if (!this._listeners.has(event)) {
|
|
279
|
+
this._listeners.set(event, new Set());
|
|
280
|
+
}
|
|
281
|
+
const listeners = this._listeners.get(event);
|
|
282
|
+
listeners.add(listener);
|
|
283
|
+
return () => {
|
|
284
|
+
listeners.delete(listener);
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Dispose of the device manager.
|
|
289
|
+
*/
|
|
290
|
+
async dispose() {
|
|
291
|
+
if (this._heartbeatTimer) {
|
|
292
|
+
clearInterval(this._heartbeatTimer);
|
|
293
|
+
this._heartbeatTimer = null;
|
|
294
|
+
}
|
|
295
|
+
// Mark as offline before disposing
|
|
296
|
+
if (this._currentDevice) {
|
|
297
|
+
await this.updatePresence('offline');
|
|
298
|
+
}
|
|
299
|
+
this._listeners.clear();
|
|
300
|
+
this._peers.clear();
|
|
301
|
+
this._currentDevice = null;
|
|
302
|
+
this._initialized = false;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Emit an event to listeners.
|
|
306
|
+
*/
|
|
307
|
+
_emit(event, data) {
|
|
308
|
+
const listeners = this._listeners.get(event);
|
|
309
|
+
if (!listeners)
|
|
310
|
+
return;
|
|
311
|
+
for (const listener of listeners) {
|
|
312
|
+
try {
|
|
313
|
+
listener(data);
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
console.error(`[DeviceManager] Error in ${event} listener:`, error);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Ensure device tables exist.
|
|
322
|
+
*/
|
|
323
|
+
async _ensureTables() {
|
|
324
|
+
await this._adapter.exec(`
|
|
325
|
+
CREATE TABLE IF NOT EXISTS _sync_devices (
|
|
326
|
+
device_id TEXT PRIMARY KEY,
|
|
327
|
+
device_type TEXT NOT NULL,
|
|
328
|
+
device_name TEXT NOT NULL,
|
|
329
|
+
vector_clock TEXT NOT NULL,
|
|
330
|
+
capabilities TEXT NOT NULL,
|
|
331
|
+
metadata TEXT,
|
|
332
|
+
presence TEXT DEFAULT 'offline',
|
|
333
|
+
created_at INTEGER NOT NULL,
|
|
334
|
+
last_seen_at INTEGER NOT NULL
|
|
335
|
+
)
|
|
336
|
+
`);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Initialize the current device.
|
|
340
|
+
*/
|
|
341
|
+
async _initializeCurrentDevice() {
|
|
342
|
+
// Try to load existing device ID from storage
|
|
343
|
+
const storedId = await this._loadStoredDeviceId();
|
|
344
|
+
if (storedId) {
|
|
345
|
+
// Load existing device
|
|
346
|
+
const device = await this._loadDevice(storedId);
|
|
347
|
+
if (device) {
|
|
348
|
+
device.presence = 'online';
|
|
349
|
+
device.lastSeenAt = Date.now();
|
|
350
|
+
await this._saveDevice(device);
|
|
351
|
+
this._currentDevice = device;
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
// Register new device
|
|
356
|
+
const deviceType = this._options.autoDetect ? detectDeviceType() : 'unknown';
|
|
357
|
+
const deviceName = this._options.deviceName || generateDeviceName(deviceType);
|
|
358
|
+
const deviceId = generateDeviceId();
|
|
359
|
+
const device = {
|
|
360
|
+
deviceId,
|
|
361
|
+
deviceType,
|
|
362
|
+
deviceName,
|
|
363
|
+
vectorClock: createVectorClock(deviceId),
|
|
364
|
+
createdAt: Date.now(),
|
|
365
|
+
lastSeenAt: Date.now(),
|
|
366
|
+
presence: 'online',
|
|
367
|
+
capabilities: getDefaultCapabilities(deviceType),
|
|
368
|
+
};
|
|
369
|
+
await this._saveDevice(device);
|
|
370
|
+
await this._storeDeviceId(deviceId);
|
|
371
|
+
this._currentDevice = device;
|
|
372
|
+
this._emit('deviceRegistered', device);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Load stored device ID.
|
|
376
|
+
*/
|
|
377
|
+
async _loadStoredDeviceId() {
|
|
378
|
+
try {
|
|
379
|
+
// Try localStorage for browser/Electron renderer
|
|
380
|
+
if (typeof localStorage !== 'undefined') {
|
|
381
|
+
return localStorage.getItem('_sync_device_id');
|
|
382
|
+
}
|
|
383
|
+
// For other environments, use a settings table
|
|
384
|
+
const result = await this._adapter.get('SELECT value FROM _sync_settings WHERE key = ?', ['device_id']);
|
|
385
|
+
return result?.value ?? null;
|
|
386
|
+
}
|
|
387
|
+
catch {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Store device ID for persistence.
|
|
393
|
+
*/
|
|
394
|
+
async _storeDeviceId(deviceId) {
|
|
395
|
+
try {
|
|
396
|
+
// Use localStorage for browser/Electron renderer
|
|
397
|
+
if (typeof localStorage !== 'undefined') {
|
|
398
|
+
localStorage.setItem('_sync_device_id', deviceId);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
// For other environments, use a settings table
|
|
402
|
+
await this._adapter.exec(`
|
|
403
|
+
CREATE TABLE IF NOT EXISTS _sync_settings (
|
|
404
|
+
key TEXT PRIMARY KEY,
|
|
405
|
+
value TEXT NOT NULL
|
|
406
|
+
)
|
|
407
|
+
`);
|
|
408
|
+
await this._adapter.run('INSERT OR REPLACE INTO _sync_settings (key, value) VALUES (?, ?)', ['device_id', deviceId]);
|
|
409
|
+
}
|
|
410
|
+
catch (error) {
|
|
411
|
+
console.warn('[DeviceManager] Failed to persist device ID:', error);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Load a device from the database.
|
|
416
|
+
*/
|
|
417
|
+
async _loadDevice(deviceId) {
|
|
418
|
+
const row = await this._adapter.get('SELECT * FROM _sync_devices WHERE device_id = ?', [deviceId]);
|
|
419
|
+
if (!row)
|
|
420
|
+
return null;
|
|
421
|
+
return {
|
|
422
|
+
deviceId: row.device_id,
|
|
423
|
+
deviceType: row.device_type,
|
|
424
|
+
deviceName: row.device_name,
|
|
425
|
+
vectorClock: JSON.parse(row.vector_clock),
|
|
426
|
+
capabilities: JSON.parse(row.capabilities),
|
|
427
|
+
metadata: row.metadata ? JSON.parse(row.metadata) : undefined,
|
|
428
|
+
presence: row.presence,
|
|
429
|
+
createdAt: row.created_at,
|
|
430
|
+
lastSeenAt: row.last_seen_at,
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Save a device to the database.
|
|
435
|
+
*/
|
|
436
|
+
async _saveDevice(device) {
|
|
437
|
+
await this._adapter.run(`INSERT OR REPLACE INTO _sync_devices
|
|
438
|
+
(device_id, device_type, device_name, vector_clock, capabilities, metadata, presence, created_at, last_seen_at)
|
|
439
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
440
|
+
device.deviceId,
|
|
441
|
+
device.deviceType,
|
|
442
|
+
device.deviceName,
|
|
443
|
+
JSON.stringify(device.vectorClock),
|
|
444
|
+
JSON.stringify(device.capabilities),
|
|
445
|
+
device.metadata ? JSON.stringify(device.metadata) : null,
|
|
446
|
+
device.presence,
|
|
447
|
+
device.createdAt,
|
|
448
|
+
device.lastSeenAt,
|
|
449
|
+
]);
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Load all peer devices.
|
|
453
|
+
*/
|
|
454
|
+
async _loadPeers() {
|
|
455
|
+
const rows = await this._adapter.all('SELECT * FROM _sync_devices WHERE device_id != ?', [this._currentDevice?.deviceId ?? '']);
|
|
456
|
+
for (const row of rows) {
|
|
457
|
+
const device = {
|
|
458
|
+
deviceId: row.device_id,
|
|
459
|
+
deviceType: row.device_type,
|
|
460
|
+
deviceName: row.device_name,
|
|
461
|
+
vectorClock: JSON.parse(row.vector_clock),
|
|
462
|
+
capabilities: JSON.parse(row.capabilities),
|
|
463
|
+
metadata: row.metadata ? JSON.parse(row.metadata) : undefined,
|
|
464
|
+
presence: row.presence,
|
|
465
|
+
createdAt: row.created_at,
|
|
466
|
+
lastSeenAt: row.last_seen_at,
|
|
467
|
+
};
|
|
468
|
+
this._peers.set(device.deviceId, device);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Start heartbeat timer.
|
|
473
|
+
*/
|
|
474
|
+
_startHeartbeat() {
|
|
475
|
+
if (this._heartbeatTimer)
|
|
476
|
+
return;
|
|
477
|
+
this._heartbeatTimer = setInterval(async () => {
|
|
478
|
+
// Update own presence
|
|
479
|
+
if (this._currentDevice) {
|
|
480
|
+
this._currentDevice.lastSeenAt = Date.now();
|
|
481
|
+
await this._saveDevice(this._currentDevice);
|
|
482
|
+
}
|
|
483
|
+
// Check for stale devices
|
|
484
|
+
await this.checkStaleDevices();
|
|
485
|
+
}, this._options.heartbeatInterval);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Create a device manager instance.
|
|
490
|
+
*/
|
|
491
|
+
export const createDeviceManager = (options) => {
|
|
492
|
+
return new DeviceManager(options);
|
|
493
|
+
};
|
|
494
|
+
//# sourceMappingURL=deviceManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceManager.js","sourceRoot":"","sources":["../../../../src/features/sync/devices/deviceManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAsI9E;;GAEG;AACH,MAAM,gBAAgB,GAAG,GAAe,EAAE;IACxC,qBAAqB;IACrB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC;QACjE,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,sBAAsB;IACtB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,MAAuE,CAAC;QACpF,IAAI,GAAG,CAAC,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,EAAE,GAAG,CAAC,QAA0B;gBACxC,SAAS,EAAE,GAAG,CAAC,UAAU;gBACzB,UAAU,EAAE,GAAG,CAAC,YAAY;aAC7B,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED;;OAEG;IACK,eAAe;QACrB,IAAI,IAAI,CAAC,eAAe;YAAE,OAAO;QAEjC,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;YAC5C,sBAAsB;YACtB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;gBACxB,IAAI,CAAC,cAAc,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBAC5C,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC9C,CAAC;YAED,0BAA0B;YAC1B,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACjC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACtC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAA6B,EACd,EAAE;IACjB,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/sync/devices/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/features/sync/devices/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Platform Sync Module.
|
|
3
|
+
*
|
|
4
|
+
* Provides real-time delta synchronization across Electron, Capacitor,
|
|
5
|
+
* browser, and server platforms with conflict resolution and device management.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createCrossPlatformSync } from '@framers/sql-storage-adapter/sync';
|
|
12
|
+
*
|
|
13
|
+
* const sync = await createCrossPlatformSync({
|
|
14
|
+
* localAdapter: db,
|
|
15
|
+
* endpoint: 'wss://sync.example.com',
|
|
16
|
+
* tables: {
|
|
17
|
+
* notes: { priority: 'high', conflictStrategy: 'merge' },
|
|
18
|
+
* settings: { priority: 'critical', conflictStrategy: 'local-wins' },
|
|
19
|
+
* },
|
|
20
|
+
* hooks: {
|
|
21
|
+
* onConflictNeedsResolution: (conflict) => showConflictDialog(conflict),
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* await sync.sync();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export { CrossPlatformSync, createCrossPlatformSync, type CrossPlatformSyncOptions, type CrossPlatformSyncHooks, type TableSyncConfig, type SyncResult, type SyncStatus as CrossPlatformSyncStatus, } from './crossPlatformSync';
|
|
29
|
+
export { VectorClock, createVectorClock, compareClocks, mergeClocks, generateDeviceId, dominates, type VectorClockData, type CausalRelation, type SerializedVectorClock, } from './protocol/vectorClock';
|
|
30
|
+
export { type ChangeOperation, type ChangeRecord, type ChangeBatch, type SyncProgress, type SyncStatus as ProtocolSyncStatus, type BaseMessage, type HandshakeRequest, type HandshakeResponse, type DeltaPush, type DeltaPullRequest, type DeltaPullResponse, type AckMessage, type ConflictMessage, type PresenceMessage, type HeartbeatMessage, type HeartbeatAck, type ErrorMessage, type SyncMessage, type SyncMessageType, type DeviceType as ProtocolDeviceType, type DeviceInfo as ProtocolDeviceInfo, type ConflictResolution as ProtocolConflictResolution, generateMessageId, createBaseMessage, createHandshakeRequest, createAck, createHeartbeat, createError, createDeltaPushMessage, createDeltaPullRequest, createPresenceMessage, createHeartbeatMessage, createAckMessage, generateChangeId, createChangeRecord, isHandshakeRequest, isDeltaPush, isConflict, isError, isSyncMessage, } from './protocol/messages';
|
|
31
|
+
export { BaseTransport, TransportError, TransportErrorCodes, type SyncTransport, type TransportOptions, type TransportState, type TransportStats, type TransportEventType, type TransportEvents, type TransportEventListener, } from './transport/transport';
|
|
32
|
+
export { WebSocketTransport, createWebSocketTransport, type WebSocketTransportOptions, } from './transport/websocketTransport';
|
|
33
|
+
export { HttpTransport, createHttpTransport, type HttpTransportOptions, } from './transport/httpTransport';
|
|
34
|
+
export { ConflictResolver, createConflictResolver, FieldMergers, type ConflictStrategy, type ResolutionDecision, type SyncConflict, type ConflictResolution, type ConflictUIHooks, type ConflictResolverOptions, type FieldMerger, } from './conflicts/conflictResolver';
|
|
35
|
+
export { DeviceManager, createDeviceManager, type DeviceType, type PresenceStatus, type DeviceInfo, type DeviceCapabilities, type DeviceRegistrationOptions, type PresenceEvent, type DeviceManagerEventType, type DeviceManagerEvents, type DeviceManagerOptions, } from './devices/deviceManager';
|
|
36
|
+
export { SyncLogManager, type ChangeLogEntry as SyncLogChange, type ConflictEntry as SyncLogConflict, } from './tables/syncLogManager';
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/sync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,UAAU,IAAI,uBAAuB,GAC3C,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,SAAS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B,EAChB,sBAAsB,EACtB,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,GACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,cAAc,EACd,KAAK,cAAc,IAAI,aAAa,EACpC,KAAK,aAAa,IAAI,eAAe,GACtC,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-Platform Sync Module.
|
|
3
|
+
*
|
|
4
|
+
* Provides real-time delta synchronization across Electron, Capacitor,
|
|
5
|
+
* browser, and server platforms with conflict resolution and device management.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createCrossPlatformSync } from '@framers/sql-storage-adapter/sync';
|
|
12
|
+
*
|
|
13
|
+
* const sync = await createCrossPlatformSync({
|
|
14
|
+
* localAdapter: db,
|
|
15
|
+
* endpoint: 'wss://sync.example.com',
|
|
16
|
+
* tables: {
|
|
17
|
+
* notes: { priority: 'high', conflictStrategy: 'merge' },
|
|
18
|
+
* settings: { priority: 'critical', conflictStrategy: 'local-wins' },
|
|
19
|
+
* },
|
|
20
|
+
* hooks: {
|
|
21
|
+
* onConflictNeedsResolution: (conflict) => showConflictDialog(conflict),
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* await sync.sync();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
// Main entry point
|
|
29
|
+
export { CrossPlatformSync, createCrossPlatformSync, } from './crossPlatformSync.js';
|
|
30
|
+
// Protocol layer - use explicit exports to avoid conflicts
|
|
31
|
+
export { VectorClock, createVectorClock, compareClocks, mergeClocks, generateDeviceId, dominates, } from './protocol/vectorClock.js';
|
|
32
|
+
export {
|
|
33
|
+
// Factories
|
|
34
|
+
generateMessageId, createBaseMessage, createHandshakeRequest, createAck, createHeartbeat, createError, createDeltaPushMessage, createDeltaPullRequest, createPresenceMessage, createHeartbeatMessage, createAckMessage, generateChangeId, createChangeRecord,
|
|
35
|
+
// Type guards
|
|
36
|
+
isHandshakeRequest, isDeltaPush, isConflict, isError, isSyncMessage, } from './protocol/messages.js';
|
|
37
|
+
// Transport layer
|
|
38
|
+
export { BaseTransport, TransportError, TransportErrorCodes, } from './transport/transport.js';
|
|
39
|
+
export { WebSocketTransport, createWebSocketTransport, } from './transport/websocketTransport.js';
|
|
40
|
+
export { HttpTransport, createHttpTransport, } from './transport/httpTransport.js';
|
|
41
|
+
// Conflict resolution
|
|
42
|
+
export { ConflictResolver, createConflictResolver, FieldMergers, } from './conflicts/conflictResolver.js';
|
|
43
|
+
// Device management
|
|
44
|
+
export { DeviceManager, createDeviceManager, } from './devices/deviceManager.js';
|
|
45
|
+
// Sync tables
|
|
46
|
+
export { SyncLogManager, } from './tables/syncLogManager.js';
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/sync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,mBAAmB;AACnB,OAAO,EACL,iBAAiB,EACjB,uBAAuB,GAMxB,MAAM,qBAAqB,CAAC;AAE7B,2DAA2D;AAC3D,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,SAAS,GAIV,MAAM,wBAAwB,CAAC;AAEhC,OAAO;AAwBL,YAAY;AACZ,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,WAAW,EACX,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB;AAClB,cAAc;AACd,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,OAAO,EACP,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,kBAAkB;AAClB,OAAO,EACL,aAAa,EACb,cAAc,EACd,mBAAmB,GAQpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GAEzB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,aAAa,EACb,mBAAmB,GAEpB,MAAM,2BAA2B,CAAC;AAEnC,sBAAsB;AACtB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,GAQb,MAAM,8BAA8B,CAAC;AAEtC,oBAAoB;AACpB,OAAO,EACL,aAAa,EACb,mBAAmB,GAUpB,MAAM,yBAAyB,CAAC;AAEjC,cAAc;AACd,OAAO,EACL,cAAc,GAGf,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Protocol Module.
|
|
3
|
+
*
|
|
4
|
+
* Provides message types, vector clocks, and protocol utilities
|
|
5
|
+
* for cross-platform synchronization.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export * from './vectorClock';
|
|
10
|
+
export * from './messages';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/sync/protocol/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Protocol Module.
|
|
3
|
+
*
|
|
4
|
+
* Provides message types, vector clocks, and protocol utilities
|
|
5
|
+
* for cross-platform synchronization.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export * from './vectorClock.js';
|
|
10
|
+
export * from './messages.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/features/sync/protocol/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|