@edryslabs/genericprovider 1.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 +24 -0
- package/README.md +660 -0
- package/dist/index.d.ts +323 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1001 -0
- package/dist/index.js.map +1 -0
- package/dist/lib.d.ts +36 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +37 -0
- package/dist/lib.js.map +1 -0
- package/dist/providers/dummy/index.d.ts +226 -0
- package/dist/providers/dummy/index.d.ts.map +1 -0
- package/dist/providers/dummy/index.js +326 -0
- package/dist/providers/dummy/index.js.map +1 -0
- package/dist/providers/gun/index.d.ts +269 -0
- package/dist/providers/gun/index.d.ts.map +1 -0
- package/dist/providers/gun/index.js +683 -0
- package/dist/providers/gun/index.js.map +1 -0
- package/dist/providers/indexeddb/index.d.ts +161 -0
- package/dist/providers/indexeddb/index.d.ts.map +1 -0
- package/dist/providers/indexeddb/index.js +369 -0
- package/dist/providers/indexeddb/index.js.map +1 -0
- package/dist/providers/matrix/index.d.ts +109 -0
- package/dist/providers/matrix/index.d.ts.map +1 -0
- package/dist/providers/matrix/index.js +329 -0
- package/dist/providers/matrix/index.js.map +1 -0
- package/dist/providers/nostr/index.d.ts +172 -0
- package/dist/providers/nostr/index.d.ts.map +1 -0
- package/dist/providers/nostr/index.js +280 -0
- package/dist/providers/nostr/index.js.map +1 -0
- package/dist/providers/peerjs/index.d.ts +231 -0
- package/dist/providers/peerjs/index.d.ts.map +1 -0
- package/dist/providers/peerjs/index.js +1038 -0
- package/dist/providers/peerjs/index.js.map +1 -0
- package/dist/providers/pubnub/index.d.ts +106 -0
- package/dist/providers/pubnub/index.d.ts.map +1 -0
- package/dist/providers/pubnub/index.js +357 -0
- package/dist/providers/pubnub/index.js.map +1 -0
- package/dist/providers/simple-peer/index.d.ts +253 -0
- package/dist/providers/simple-peer/index.d.ts.map +1 -0
- package/dist/providers/simple-peer/index.js +783 -0
- package/dist/providers/simple-peer/index.js.map +1 -0
- package/dist/providers/supabase/index.d.ts +80 -0
- package/dist/providers/supabase/index.d.ts.map +1 -0
- package/dist/providers/supabase/index.js +202 -0
- package/dist/providers/supabase/index.js.map +1 -0
- package/dist/providers/trystero/index.d.ts +181 -0
- package/dist/providers/trystero/index.d.ts.map +1 -0
- package/dist/providers/trystero/index.js +187 -0
- package/dist/providers/trystero/index.js.map +1 -0
- package/dist/providers/websocket/index.d.ts +92 -0
- package/dist/providers/websocket/index.d.ts.map +1 -0
- package/dist/providers/websocket/index.js +272 -0
- package/dist/providers/websocket/index.js.map +1 -0
- package/dist/sync-monitor.d.ts +90 -0
- package/dist/sync-monitor.d.ts.map +1 -0
- package/dist/sync-monitor.js +149 -0
- package/dist/sync-monitor.js.map +1 -0
- package/dist/transport.d.ts +116 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +2 -0
- package/dist/transport.js.map +1 -0
- package/package.json +137 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dummy Transport for Testing
|
|
3
|
+
*
|
|
4
|
+
* A simple in-memory transport that simulates network behavior without
|
|
5
|
+
* any external dependencies. Perfect for:
|
|
6
|
+
* - Unit testing
|
|
7
|
+
* - Learning how transports work
|
|
8
|
+
* - Local development without a server
|
|
9
|
+
* - Reference implementation for custom transports
|
|
10
|
+
*
|
|
11
|
+
* Features:
|
|
12
|
+
* - Simulated network latency
|
|
13
|
+
* - Simulated packet loss
|
|
14
|
+
* - Connect multiple clients in-memory
|
|
15
|
+
* - No external dependencies
|
|
16
|
+
* - Auto-managed hubs (just works!)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { GenericProvider } from 'y-generic'
|
|
21
|
+
* import { DummyTransport } from 'y-generic/providers/dummy'
|
|
22
|
+
*
|
|
23
|
+
* // Simple usage - hub is auto-managed
|
|
24
|
+
* const doc1 = new Y.Doc()
|
|
25
|
+
* const provider1 = new GenericProvider(doc1, new DummyTransport())
|
|
26
|
+
* await provider1.connect({ room: 'test-room' })
|
|
27
|
+
*
|
|
28
|
+
* const doc2 = new Y.Doc()
|
|
29
|
+
* const provider2 = new GenericProvider(doc2, new DummyTransport())
|
|
30
|
+
* await provider2.connect({ room: 'test-room' })
|
|
31
|
+
*
|
|
32
|
+
* // Changes sync automatically!
|
|
33
|
+
* doc1.getText('test').insert(0, 'Hello')
|
|
34
|
+
* // doc2 receives the update
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Advanced: Explicit hub for fine control
|
|
40
|
+
* import { DummyHub } from 'y-generic/providers/dummy'
|
|
41
|
+
*
|
|
42
|
+
* const hub = new DummyHub()
|
|
43
|
+
* const transport1 = new DummyTransport({ hub })
|
|
44
|
+
* const transport2 = new DummyTransport({ hub })
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Central hub that routes messages between DummyTransport instances.
|
|
49
|
+
* Simulates a server or message broker.
|
|
50
|
+
*/
|
|
51
|
+
export class DummyHub {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.rooms = new Map();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Register a transport in a room.
|
|
57
|
+
*/
|
|
58
|
+
join(room, transport, callback) {
|
|
59
|
+
if (!this.rooms.has(room)) {
|
|
60
|
+
this.rooms.set(room, new Set());
|
|
61
|
+
}
|
|
62
|
+
this.rooms.get(room).add({ transport, callback });
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Unregister a transport from a room.
|
|
66
|
+
*/
|
|
67
|
+
leave(room, transport) {
|
|
68
|
+
const clients = this.rooms.get(room);
|
|
69
|
+
if (clients) {
|
|
70
|
+
for (const client of clients) {
|
|
71
|
+
if (client.transport === transport) {
|
|
72
|
+
clients.delete(client);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (clients.size === 0) {
|
|
77
|
+
this.rooms.delete(room);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Broadcast a message to all clients in a room except the sender.
|
|
83
|
+
*/
|
|
84
|
+
broadcast(room, data, sender, options) {
|
|
85
|
+
const clients = this.rooms.get(room);
|
|
86
|
+
if (!clients)
|
|
87
|
+
return;
|
|
88
|
+
const latency = options?.latency ?? 0;
|
|
89
|
+
const dropRate = options?.dropRate ?? 0;
|
|
90
|
+
const jitter = options?.jitter ?? 0;
|
|
91
|
+
for (const client of clients) {
|
|
92
|
+
// Don't send back to sender
|
|
93
|
+
if (client.transport === sender)
|
|
94
|
+
continue;
|
|
95
|
+
// Simulate packet loss
|
|
96
|
+
if (dropRate > 0 && Math.random() < dropRate) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
// Calculate actual delay with jitter
|
|
100
|
+
let actualDelay = latency;
|
|
101
|
+
if (latency > 0 && jitter > 0) {
|
|
102
|
+
// Random delay between latency*(1-jitter) and latency*(1+jitter)
|
|
103
|
+
const minDelay = latency * (1 - jitter);
|
|
104
|
+
const maxDelay = latency * (1 + jitter);
|
|
105
|
+
actualDelay = minDelay + Math.random() * (maxDelay - minDelay);
|
|
106
|
+
}
|
|
107
|
+
// Simulate network latency
|
|
108
|
+
if (actualDelay > 0) {
|
|
109
|
+
setTimeout(() => {
|
|
110
|
+
try {
|
|
111
|
+
client.callback(data);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
console.error('Error delivering message:', error);
|
|
115
|
+
}
|
|
116
|
+
}, actualDelay);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
try {
|
|
120
|
+
client.callback(data);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.error('Error delivering message:', error);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get the number of clients connected to a room.
|
|
130
|
+
*/
|
|
131
|
+
getRoomSize(room) {
|
|
132
|
+
return this.rooms.get(room)?.size ?? 0;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get all active room names.
|
|
136
|
+
*/
|
|
137
|
+
getRooms() {
|
|
138
|
+
return Array.from(this.rooms.keys());
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Disconnect all clients and clear all rooms.
|
|
142
|
+
*/
|
|
143
|
+
clear() {
|
|
144
|
+
this.rooms.clear();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Global hub registry for auto-managed hubs (one per room).
|
|
149
|
+
* Used when no explicit hub is provided.
|
|
150
|
+
*/
|
|
151
|
+
const globalHubs = new Map();
|
|
152
|
+
/**
|
|
153
|
+
* Get or create a hub for a room.
|
|
154
|
+
*/
|
|
155
|
+
function getOrCreateHub(room) {
|
|
156
|
+
if (!globalHubs.has(room)) {
|
|
157
|
+
globalHubs.set(room, new DummyHub());
|
|
158
|
+
}
|
|
159
|
+
return globalHubs.get(room);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Dummy transport implementation for testing and development.
|
|
163
|
+
* Routes messages through a DummyHub instance.
|
|
164
|
+
*/
|
|
165
|
+
export class DummyTransport {
|
|
166
|
+
/**
|
|
167
|
+
* Create a new DummyTransport.
|
|
168
|
+
*
|
|
169
|
+
* @param options - Optional behavior simulation settings
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* // Simple case - hub is auto-managed
|
|
174
|
+
* const transport = new DummyTransport()
|
|
175
|
+
*
|
|
176
|
+
* // With network simulation
|
|
177
|
+
* const transport = new DummyTransport({ latency: 100, dropRate: 0.1 })
|
|
178
|
+
*
|
|
179
|
+
* // With out-of-order delivery (useful for testing CRDT)
|
|
180
|
+
* const transport = new DummyTransport({ latency: 100, jitter: 0.5 })
|
|
181
|
+
* // Messages arrive between 50ms and 150ms (may arrive out of order)
|
|
182
|
+
*
|
|
183
|
+
* // Advanced - explicit shared hub
|
|
184
|
+
* const hub = new DummyHub()
|
|
185
|
+
* const transport1 = new DummyTransport({ hub })
|
|
186
|
+
* const transport2 = new DummyTransport({ hub })
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
constructor(options = {}) {
|
|
190
|
+
this._connected = false;
|
|
191
|
+
this._room = '';
|
|
192
|
+
this.hub = options.hub;
|
|
193
|
+
this.explicitHub = !!options.hub;
|
|
194
|
+
this.options = {
|
|
195
|
+
latency: options.latency ?? 0,
|
|
196
|
+
dropRate: options.dropRate ?? 0,
|
|
197
|
+
jitter: options.jitter ?? 0,
|
|
198
|
+
autoConnect: options.autoConnect ?? false,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Connect to a room on the hub.
|
|
203
|
+
*/
|
|
204
|
+
async connect(config) {
|
|
205
|
+
if (this._connected) {
|
|
206
|
+
throw new Error('Already connected');
|
|
207
|
+
}
|
|
208
|
+
this._room = config.room;
|
|
209
|
+
// Get or create hub for this room if not explicitly provided
|
|
210
|
+
if (!this.hub) {
|
|
211
|
+
this.hub = getOrCreateHub(this._room);
|
|
212
|
+
}
|
|
213
|
+
// Simulate async connection
|
|
214
|
+
await new Promise((resolve) => setTimeout(resolve, this.options.latency));
|
|
215
|
+
// If callback is registered, join immediately
|
|
216
|
+
if (this._callback) {
|
|
217
|
+
this.hub.join(this._room, this, this._callback);
|
|
218
|
+
}
|
|
219
|
+
// Otherwise, will join when onMessage() is called
|
|
220
|
+
this._connected = true;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Disconnect from the hub.
|
|
224
|
+
*/
|
|
225
|
+
disconnect() {
|
|
226
|
+
if (!this._connected)
|
|
227
|
+
return;
|
|
228
|
+
if (this.hub) {
|
|
229
|
+
this.hub.leave(this._room, this);
|
|
230
|
+
}
|
|
231
|
+
this._connected = false;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Send data to all other clients in the room.
|
|
235
|
+
*/
|
|
236
|
+
send(data) {
|
|
237
|
+
if (!this._connected || !this.hub) {
|
|
238
|
+
if (this.options.autoConnect && this._room) {
|
|
239
|
+
// Auto-reconnect was requested
|
|
240
|
+
console.warn('DummyTransport: Not connected, dropping message');
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
// Broadcast through hub
|
|
245
|
+
this.hub.broadcast(this._room, data, this, {
|
|
246
|
+
latency: this.options.latency,
|
|
247
|
+
dropRate: this.options.dropRate,
|
|
248
|
+
jitter: this.options.jitter,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Register callback for incoming messages.
|
|
253
|
+
*/
|
|
254
|
+
onMessage(callback) {
|
|
255
|
+
this._callback = callback;
|
|
256
|
+
// If already connected, register with hub now
|
|
257
|
+
if (this._connected && this._room && this.hub) {
|
|
258
|
+
this.hub.join(this._room, this, callback);
|
|
259
|
+
}
|
|
260
|
+
// Return unsubscribe function
|
|
261
|
+
return () => {
|
|
262
|
+
this._callback = undefined;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Check if connected.
|
|
267
|
+
*/
|
|
268
|
+
get isConnected() {
|
|
269
|
+
return this._connected;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Get current room name (for debugging).
|
|
273
|
+
*/
|
|
274
|
+
get room() {
|
|
275
|
+
return this._room;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Get the hub instance being used (for debugging).
|
|
279
|
+
*/
|
|
280
|
+
getHub() {
|
|
281
|
+
return this.hub;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Utility functions for debugging and testing.
|
|
286
|
+
*/
|
|
287
|
+
/**
|
|
288
|
+
* Get statistics about all auto-managed hubs.
|
|
289
|
+
* Useful for debugging and verifying test cleanup.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* const stats = getGlobalHubStats()
|
|
294
|
+
* console.log(`Active rooms: ${stats.totalRooms}`)
|
|
295
|
+
* console.log(`Total clients: ${stats.totalClients}`)
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
export function getGlobalHubStats() {
|
|
299
|
+
const rooms = Array.from(globalHubs.entries()).map(([room, hub]) => ({
|
|
300
|
+
room,
|
|
301
|
+
clients: hub.getRoomSize(room),
|
|
302
|
+
}));
|
|
303
|
+
return {
|
|
304
|
+
totalRooms: globalHubs.size,
|
|
305
|
+
totalClients: rooms.reduce((sum, r) => sum + r.clients, 0),
|
|
306
|
+
rooms,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Clear all auto-managed hubs.
|
|
311
|
+
* Useful for cleaning up between tests.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```typescript
|
|
315
|
+
* afterEach(() => {
|
|
316
|
+
* clearGlobalHubs()
|
|
317
|
+
* })
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
export function clearGlobalHubs() {
|
|
321
|
+
for (const hub of globalHubs.values()) {
|
|
322
|
+
hub.clear();
|
|
323
|
+
}
|
|
324
|
+
globalHubs.clear();
|
|
325
|
+
}
|
|
326
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/dummy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAIH;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAArB;QACU,UAAK,GAMT,IAAI,GAAG,EAAE,CAAA;IA2Gf,CAAC;IAzGC;;OAEG;IACH,IAAI,CACF,IAAY,EACZ,S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,UAAU,CAAC,IAAI;QAC3B,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,KAAK;KACN,CAAA;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe;IAC7B,KAAK,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;QACtC,GAAG,CAAC,KAAK,EAAE,CAAA;IACb,CAAC;IACD,UAAU,CAAC,KAAK,EAAE,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GunDB Transport Provider
|
|
3
|
+
*
|
|
4
|
+
* Decentralized peer-to-peer transport using GunDB graph database.
|
|
5
|
+
* GunDB provides automatic conflict resolution and offline-first sync.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Decentralized P2P architecture
|
|
9
|
+
* - Automatic conflict resolution (CRDT)
|
|
10
|
+
* - Offline-first with auto-sync
|
|
11
|
+
* - Real-time updates via .on()
|
|
12
|
+
* - Optional relay servers
|
|
13
|
+
* - Graph-based data structure
|
|
14
|
+
* - Password-protected rooms with AES encryption (via SEA)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { GenericProvider } from 'y-generic'
|
|
19
|
+
* import { GunTransport } from 'y-generic/providers/gun'
|
|
20
|
+
* import Gun from 'gun'
|
|
21
|
+
*
|
|
22
|
+
* const doc = new Y.Doc()
|
|
23
|
+
* const transport = new GunTransport({
|
|
24
|
+
* gun: Gun, // Pass the Gun constructor
|
|
25
|
+
* peers: ['https://gun-relay.herokuapp.com/gun']
|
|
26
|
+
* })
|
|
27
|
+
* const provider = new GenericProvider(doc, transport)
|
|
28
|
+
* await provider.connect({ room: 'my-room' })
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Password-protected room
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import Gun from 'gun'
|
|
34
|
+
* import 'gun/sea' // Required for encryption
|
|
35
|
+
*
|
|
36
|
+
* const transport = new GunTransport({
|
|
37
|
+
* gun: Gun,
|
|
38
|
+
* sea: Gun.SEA, // Provide SEA module
|
|
39
|
+
* password: 'my-secret-room-password',
|
|
40
|
+
* peers: ['https://gun-relay.herokuapp.com/gun']
|
|
41
|
+
* })
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
import * as Y from 'yjs';
|
|
45
|
+
import type { Transport, ConnectionConfig } from '../../transport';
|
|
46
|
+
/**
|
|
47
|
+
* Gun constructor type (from gun library).
|
|
48
|
+
*/
|
|
49
|
+
export type GunConstructor = any;
|
|
50
|
+
/**
|
|
51
|
+
* Configuration options for Gun transport.
|
|
52
|
+
*/
|
|
53
|
+
export interface GunTransportOptions {
|
|
54
|
+
/**
|
|
55
|
+
* The Gun library constructor.
|
|
56
|
+
* Users must provide this to avoid bundling the library.
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import Gun from 'gun'
|
|
60
|
+
* const transport = new GunTransport({ gun: Gun })
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
gun: GunConstructor;
|
|
64
|
+
/**
|
|
65
|
+
* Array of peer relay servers to connect to.
|
|
66
|
+
* Gun will attempt to sync with these peers and any peers they know about.
|
|
67
|
+
* @default [] (local only)
|
|
68
|
+
* @example ['https://gun-relay.herokuapp.com/gun']
|
|
69
|
+
*/
|
|
70
|
+
peers?: string[];
|
|
71
|
+
/**
|
|
72
|
+
* Gun configuration options.
|
|
73
|
+
* @see https://gun.eco/docs/API
|
|
74
|
+
*/
|
|
75
|
+
gunOptions?: {
|
|
76
|
+
localStorage?: boolean;
|
|
77
|
+
radisk?: boolean;
|
|
78
|
+
axe?: boolean;
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Enable debug logging.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
debug?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Update batch interval in milliseconds.
|
|
88
|
+
* Uses debouncing - timer resets on each update.
|
|
89
|
+
* Only sends after this period of inactivity.
|
|
90
|
+
* @default 100
|
|
91
|
+
*/
|
|
92
|
+
batchInterval?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Password for room encryption.
|
|
95
|
+
* When set, all data is encrypted with AES using Gun's SEA module.
|
|
96
|
+
* All peers in the room must use the same password.
|
|
97
|
+
* Requires the SEA module to be provided.
|
|
98
|
+
* @default undefined (no encryption)
|
|
99
|
+
* @example 'my-secret-password'
|
|
100
|
+
*/
|
|
101
|
+
password?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Gun SEA (Security, Encryption, Authorization) module.
|
|
104
|
+
* Required when using password encryption.
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* import Gun from 'gun'
|
|
108
|
+
* import 'gun/sea'
|
|
109
|
+
* const SEA = Gun.SEA
|
|
110
|
+
* const transport = new GunTransport({ gun: Gun, sea: SEA, password: 'secret' })
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
sea?: any;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Extended connection config with optional persistence settings.
|
|
117
|
+
*/
|
|
118
|
+
export interface GunConnectionConfig extends ConnectionConfig {
|
|
119
|
+
/**
|
|
120
|
+
* When true, a full Y.Doc snapshot is saved to Gun on every debounced
|
|
121
|
+
* update and loaded back when peers reconnect after all going offline.
|
|
122
|
+
* When false (default), any previously stored snapshot is cleared on
|
|
123
|
+
* connect so new sessions start from a blank state.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
persistent?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* The Y.Doc to snapshot. Required when persistent is true.
|
|
129
|
+
*/
|
|
130
|
+
doc?: Y.Doc;
|
|
131
|
+
/**
|
|
132
|
+
* Debounce delay in ms before writing the snapshot to Gun.
|
|
133
|
+
* @default 2000
|
|
134
|
+
*/
|
|
135
|
+
persistDebounceMs?: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* GunDB transport implementation.
|
|
139
|
+
* Creates decentralized P2P connections using Gun graph database.
|
|
140
|
+
*/
|
|
141
|
+
export declare class GunTransport implements Transport {
|
|
142
|
+
private options;
|
|
143
|
+
private _connected;
|
|
144
|
+
private _room;
|
|
145
|
+
private _callback?;
|
|
146
|
+
private gun;
|
|
147
|
+
private roomNode;
|
|
148
|
+
private updateListener;
|
|
149
|
+
private lastUpdateTime;
|
|
150
|
+
private updateBatch;
|
|
151
|
+
private batchTimeout?;
|
|
152
|
+
private processedUpdates;
|
|
153
|
+
private connectionTime;
|
|
154
|
+
private throttleTimeout?;
|
|
155
|
+
private pendingUpdates;
|
|
156
|
+
private updateSlot;
|
|
157
|
+
private readonly BUFFER_SIZE;
|
|
158
|
+
private awarenessListener;
|
|
159
|
+
private lastAwarenessId;
|
|
160
|
+
private encryptionEnabled;
|
|
161
|
+
private persistentMode;
|
|
162
|
+
private persistDoc;
|
|
163
|
+
private persistDebounceMs;
|
|
164
|
+
private persistTimer?;
|
|
165
|
+
private isWritingToGun;
|
|
166
|
+
private savePending;
|
|
167
|
+
/** Data loaded from Gun snapshot before onMessage callback is registered */
|
|
168
|
+
private pendingLoad;
|
|
169
|
+
/**
|
|
170
|
+
* Create a new Gun transport.
|
|
171
|
+
*
|
|
172
|
+
* @param options - Configuration options (must include gun constructor)
|
|
173
|
+
*/
|
|
174
|
+
constructor(options: GunTransportOptions);
|
|
175
|
+
/**
|
|
176
|
+
* Connect to the room and start syncing.
|
|
177
|
+
*/
|
|
178
|
+
connect(config: GunConnectionConfig): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Setup listener for Gun updates.
|
|
181
|
+
*/
|
|
182
|
+
private setupUpdateListener;
|
|
183
|
+
/**
|
|
184
|
+
* Process all pending updates at once.
|
|
185
|
+
*/
|
|
186
|
+
private processPendingUpdates;
|
|
187
|
+
/**
|
|
188
|
+
* Disconnect from Gun and cleanup.
|
|
189
|
+
*/
|
|
190
|
+
disconnect(): void;
|
|
191
|
+
/**
|
|
192
|
+
* Send data to all peers via Gun.
|
|
193
|
+
* Routes awareness to a separate volatile node, doc sync to circular buffer.
|
|
194
|
+
* Uses debouncing for doc sync - each new update resets the timer.
|
|
195
|
+
*/
|
|
196
|
+
send(data: Uint8Array): void;
|
|
197
|
+
/**
|
|
198
|
+
* Peek at the message type from CRC32-wrapped data.
|
|
199
|
+
* Format: [CRC32 (4 bytes)][message type (varint)]...
|
|
200
|
+
* Returns -1 if cannot determine type.
|
|
201
|
+
*/
|
|
202
|
+
private peekMessageType;
|
|
203
|
+
/**
|
|
204
|
+
* Send awareness update to a separate volatile node.
|
|
205
|
+
* Awareness is ephemeral - only the latest state matters.
|
|
206
|
+
* Each client writes to its own awareness slot to avoid overwrites.
|
|
207
|
+
*/
|
|
208
|
+
private sendAwareness;
|
|
209
|
+
/**
|
|
210
|
+
* Setup listener for awareness updates (separate from doc sync).
|
|
211
|
+
*/
|
|
212
|
+
private setupAwarenessListener;
|
|
213
|
+
/**
|
|
214
|
+
* Flush batched updates to Gun.
|
|
215
|
+
* Called after debounce period (no new updates for batchInterval ms).
|
|
216
|
+
*/
|
|
217
|
+
private flushBatch;
|
|
218
|
+
/**
|
|
219
|
+
* Register callback for incoming messages.
|
|
220
|
+
*/
|
|
221
|
+
onMessage(callback: (data: Uint8Array) => void): () => void;
|
|
222
|
+
/**
|
|
223
|
+
* Check if connected.
|
|
224
|
+
*/
|
|
225
|
+
get isConnected(): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Generate a circular buffer slot ID.
|
|
228
|
+
* Uses only BUFFER_SIZE slots to prevent infinite accumulation.
|
|
229
|
+
*/
|
|
230
|
+
private generateUpdateId;
|
|
231
|
+
/**
|
|
232
|
+
* Schedule a debounced snapshot write. Called on every doc update.
|
|
233
|
+
* Always saves the latest full state, never an individual delta.
|
|
234
|
+
*/
|
|
235
|
+
private queuePersist;
|
|
236
|
+
/**
|
|
237
|
+
* Encode the full Y.Doc state as a proper y-protocols SYNC_STEP_2 message
|
|
238
|
+
* and write it to the Gun `snapshot` node.
|
|
239
|
+
* Using SYNC_STEP_2 format ensures GenericProvider interprets it correctly.
|
|
240
|
+
*/
|
|
241
|
+
private saveSnapshot;
|
|
242
|
+
/**
|
|
243
|
+
* Load the snapshot from Gun and deliver it to the message callback.
|
|
244
|
+
* Uses a pendingLoad buffer in case the callback isn't registered yet.
|
|
245
|
+
*/
|
|
246
|
+
private loadSnapshot;
|
|
247
|
+
/**
|
|
248
|
+
* Convert Uint8Array to base64 string.
|
|
249
|
+
*/
|
|
250
|
+
private uint8ArrayToBase64;
|
|
251
|
+
/**
|
|
252
|
+
* Convert base64 string to Uint8Array.
|
|
253
|
+
*/
|
|
254
|
+
private base64ToUint8Array;
|
|
255
|
+
/**
|
|
256
|
+
* Encrypt data using SEA with the configured password.
|
|
257
|
+
*/
|
|
258
|
+
private encrypt;
|
|
259
|
+
/**
|
|
260
|
+
* Decrypt data using SEA with the configured password.
|
|
261
|
+
* Returns null if decryption fails (wrong password).
|
|
262
|
+
*/
|
|
263
|
+
private decrypt;
|
|
264
|
+
/**
|
|
265
|
+
* Log debug messages if enabled.
|
|
266
|
+
*/
|
|
267
|
+
private log;
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/gun/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAGxB,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAwClE;;GAEG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