@dxos/echo-pipeline 0.5.9-main.ea1d25b → 0.5.9-main.eacfffa
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/dist/lib/browser/{chunk-I2J5TTHJ.mjs → chunk-ZCEMVITI.mjs} +28 -7
- package/dist/lib/browser/{chunk-I2J5TTHJ.mjs.map → chunk-ZCEMVITI.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +138 -230
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +11 -7
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-QPCNQ4ZK.cjs → chunk-V2O4ACHA.cjs} +31 -10
- package/dist/lib/node/{chunk-QPCNQ4ZK.cjs.map → chunk-V2O4ACHA.cjs.map} +1 -1
- package/dist/lib/node/index.cjs +172 -259
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +21 -17
- package/dist/lib/node/testing/index.cjs.map +1 -1
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-host.d.ts +1 -9
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +6 -0
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +1 -0
- package/dist/types/src/automerge/echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/index.d.ts +0 -1
- package/dist/types/src/automerge/index.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-doc-loader.test.ts +2 -3
- package/src/automerge/automerge-doc-loader.ts +4 -2
- package/src/automerge/automerge-host.ts +8 -35
- package/src/automerge/echo-network-adapter.ts +24 -8
- package/src/automerge/echo-replicator.ts +2 -0
- package/src/automerge/index.ts +0 -1
- package/src/automerge/mesh-echo-replicator.ts +8 -1
- package/src/automerge/storage-adapter.test.ts +103 -139
- package/src/space/space-protocol.test.ts +2 -0
- package/dist/types/src/automerge/automerge-storage-adapter.d.ts +0 -16
- package/dist/types/src/automerge/automerge-storage-adapter.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge-storage/342/200/223wrapper.d.ts +0 -25
- package/dist/types/src/automerge/automerge-storage/342/200/223wrapper.d.ts.map +0 -1
- package/dist/types/src/automerge/migrations.d.ts +0 -7
- package/dist/types/src/automerge/migrations.d.ts.map +0 -1
- package/src/automerge/automerge-storage-adapter.ts +0 -103
- package/src/automerge/automerge-storage/342/200/223wrapper.ts +0 -59
- package/src/automerge/migrations.ts +0 -42
package/dist/lib/node/index.cjs
CHANGED
|
@@ -18,46 +18,44 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var node_exports = {};
|
|
20
20
|
__export(node_exports, {
|
|
21
|
-
AuthExtension: () =>
|
|
22
|
-
AuthStatus: () =>
|
|
21
|
+
AuthExtension: () => import_chunk_V2O4ACHA.AuthExtension,
|
|
22
|
+
AuthStatus: () => import_chunk_V2O4ACHA.AuthStatus,
|
|
23
23
|
AutomergeDocumentLoaderImpl: () => AutomergeDocumentLoaderImpl,
|
|
24
24
|
AutomergeHost: () => AutomergeHost,
|
|
25
|
-
|
|
26
|
-
DataServiceImpl: () => import_chunk_QPCNQ4ZK.DataServiceImpl,
|
|
25
|
+
DataServiceImpl: () => import_chunk_V2O4ACHA.DataServiceImpl,
|
|
27
26
|
LevelDBStorageAdapter: () => LevelDBStorageAdapter,
|
|
28
27
|
LocalHostNetworkAdapter: () => LocalHostNetworkAdapter,
|
|
29
|
-
MOCK_AUTH_PROVIDER: () =>
|
|
30
|
-
MOCK_AUTH_VERIFIER: () =>
|
|
28
|
+
MOCK_AUTH_PROVIDER: () => import_chunk_V2O4ACHA.MOCK_AUTH_PROVIDER,
|
|
29
|
+
MOCK_AUTH_VERIFIER: () => import_chunk_V2O4ACHA.MOCK_AUTH_VERIFIER,
|
|
31
30
|
MeshEchoReplicator: () => MeshEchoReplicator,
|
|
32
|
-
MetadataStore: () =>
|
|
33
|
-
Pipeline: () =>
|
|
34
|
-
SnapshotManager: () =>
|
|
35
|
-
SnapshotStore: () =>
|
|
36
|
-
Space: () =>
|
|
37
|
-
SpaceManager: () =>
|
|
38
|
-
SpaceProtocol: () =>
|
|
39
|
-
SpaceProtocolSession: () =>
|
|
40
|
-
TimeframeClock: () =>
|
|
41
|
-
codec: () =>
|
|
42
|
-
createIdFromSpaceKey: () =>
|
|
43
|
-
createMappedFeedWriter: () =>
|
|
31
|
+
MetadataStore: () => import_chunk_V2O4ACHA.MetadataStore,
|
|
32
|
+
Pipeline: () => import_chunk_V2O4ACHA.Pipeline,
|
|
33
|
+
SnapshotManager: () => import_chunk_V2O4ACHA.SnapshotManager,
|
|
34
|
+
SnapshotStore: () => import_chunk_V2O4ACHA.SnapshotStore,
|
|
35
|
+
Space: () => import_chunk_V2O4ACHA.Space,
|
|
36
|
+
SpaceManager: () => import_chunk_V2O4ACHA.SpaceManager,
|
|
37
|
+
SpaceProtocol: () => import_chunk_V2O4ACHA.SpaceProtocol,
|
|
38
|
+
SpaceProtocolSession: () => import_chunk_V2O4ACHA.SpaceProtocolSession,
|
|
39
|
+
TimeframeClock: () => import_chunk_V2O4ACHA.TimeframeClock,
|
|
40
|
+
codec: () => import_chunk_V2O4ACHA.codec,
|
|
41
|
+
createIdFromSpaceKey: () => import_chunk_V2O4ACHA.createIdFromSpaceKey,
|
|
42
|
+
createMappedFeedWriter: () => import_chunk_V2O4ACHA.createMappedFeedWriter,
|
|
44
43
|
encodingOptions: () => encodingOptions,
|
|
45
44
|
getSpaceKeyFromDoc: () => getSpaceKeyFromDoc,
|
|
46
|
-
hasInvitationExpired: () =>
|
|
47
|
-
mapFeedIndexesToTimeframe: () =>
|
|
48
|
-
mapTimeframeToFeedIndexes: () =>
|
|
49
|
-
startAfter: () =>
|
|
50
|
-
valueEncoding: () =>
|
|
45
|
+
hasInvitationExpired: () => import_chunk_V2O4ACHA.hasInvitationExpired,
|
|
46
|
+
mapFeedIndexesToTimeframe: () => import_chunk_V2O4ACHA.mapFeedIndexesToTimeframe,
|
|
47
|
+
mapTimeframeToFeedIndexes: () => import_chunk_V2O4ACHA.mapTimeframeToFeedIndexes,
|
|
48
|
+
startAfter: () => import_chunk_V2O4ACHA.startAfter,
|
|
49
|
+
valueEncoding: () => import_chunk_V2O4ACHA.valueEncoding
|
|
51
50
|
});
|
|
52
51
|
module.exports = __toCommonJS(node_exports);
|
|
53
|
-
var
|
|
52
|
+
var import_chunk_V2O4ACHA = require("./chunk-V2O4ACHA.cjs");
|
|
54
53
|
var import_async = require("@dxos/async");
|
|
55
54
|
var import_automerge = require("@dxos/automerge/automerge");
|
|
56
55
|
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
57
56
|
var import_context = require("@dxos/context");
|
|
58
57
|
var import_invariant = require("@dxos/invariant");
|
|
59
58
|
var import_keys = require("@dxos/keys");
|
|
60
|
-
var import_log = require("@dxos/log");
|
|
61
59
|
var import_protocols = require("@dxos/protocols");
|
|
62
60
|
var import_tracing = require("@dxos/tracing");
|
|
63
61
|
var import_util = require("@dxos/util");
|
|
@@ -65,29 +63,26 @@ var import_async2 = require("@dxos/async");
|
|
|
65
63
|
var import_automerge_repo2 = require("@dxos/automerge/automerge-repo");
|
|
66
64
|
var import_context2 = require("@dxos/context");
|
|
67
65
|
var import_invariant2 = require("@dxos/invariant");
|
|
68
|
-
var
|
|
66
|
+
var import_log = require("@dxos/log");
|
|
69
67
|
var import_context3 = require("@dxos/context");
|
|
70
68
|
var import_async3 = require("@dxos/async");
|
|
71
69
|
var import_automerge_repo3 = require("@dxos/automerge/automerge-repo");
|
|
72
70
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
73
71
|
var import_invariant3 = require("@dxos/invariant");
|
|
74
|
-
var import_automerge_repo_storage_indexeddb = require("@dxos/automerge/automerge-repo-storage-indexeddb");
|
|
75
|
-
var import_log3 = require("@dxos/log");
|
|
76
|
-
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
77
|
-
var import_util2 = require("@dxos/util");
|
|
78
72
|
var import_async4 = require("@dxos/async");
|
|
79
73
|
var import_context4 = require("@dxos/context");
|
|
80
74
|
var import_debug = require("@dxos/debug");
|
|
75
|
+
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
81
76
|
var import_invariant4 = require("@dxos/invariant");
|
|
82
|
-
var
|
|
77
|
+
var import_log2 = require("@dxos/log");
|
|
83
78
|
var import_tracing2 = require("@dxos/tracing");
|
|
84
79
|
var import_automerge_repo4 = require("@dxos/automerge/automerge-repo");
|
|
85
80
|
var import_context5 = require("@dxos/context");
|
|
86
81
|
var import_invariant5 = require("@dxos/invariant");
|
|
87
82
|
var import_keys2 = require("@dxos/keys");
|
|
88
|
-
var
|
|
83
|
+
var import_log3 = require("@dxos/log");
|
|
89
84
|
var import_teleport_extension_automerge_replicator = require("@dxos/teleport-extension-automerge-replicator");
|
|
90
|
-
var
|
|
85
|
+
var import_util2 = require("@dxos/util");
|
|
91
86
|
function _ts_decorate(decorators, target, key, desc) {
|
|
92
87
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
93
88
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -120,7 +115,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
120
115
|
}
|
|
121
116
|
connectionEntry.writer.write(message).catch((err) => {
|
|
122
117
|
if (connectionEntry.isOpen) {
|
|
123
|
-
|
|
118
|
+
import_log.log.catch(err, void 0, {
|
|
124
119
|
F: __dxlog_file,
|
|
125
120
|
L: 49,
|
|
126
121
|
S: this,
|
|
@@ -142,7 +137,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
142
137
|
]
|
|
143
138
|
});
|
|
144
139
|
this._lifecycleState = import_context2.LifecycleState.OPEN;
|
|
145
|
-
(0,
|
|
140
|
+
(0, import_log.log)("emit ready", void 0, {
|
|
146
141
|
F: __dxlog_file,
|
|
147
142
|
L: 63,
|
|
148
143
|
S: this,
|
|
@@ -206,13 +201,14 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
206
201
|
peerId: this.peerId,
|
|
207
202
|
onConnectionOpen: this._onConnectionOpen.bind(this),
|
|
208
203
|
onConnectionClosed: this._onConnectionClosed.bind(this),
|
|
204
|
+
onConnectionAuthScopeChanged: this._onConnectionAuthScopeChanged.bind(this),
|
|
209
205
|
getContainingSpaceForDocument: this._params.getContainingSpaceForDocument
|
|
210
206
|
});
|
|
211
207
|
}
|
|
212
208
|
async removeReplicator(replicator) {
|
|
213
209
|
(0, import_invariant2.invariant)(this._lifecycleState === import_context2.LifecycleState.OPEN, void 0, {
|
|
214
210
|
F: __dxlog_file,
|
|
215
|
-
L:
|
|
211
|
+
L: 103,
|
|
216
212
|
S: this,
|
|
217
213
|
A: [
|
|
218
214
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -221,14 +217,13 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
221
217
|
});
|
|
222
218
|
(0, import_invariant2.invariant)(this._replicators.has(replicator), void 0, {
|
|
223
219
|
F: __dxlog_file,
|
|
224
|
-
L:
|
|
220
|
+
L: 104,
|
|
225
221
|
S: this,
|
|
226
222
|
A: [
|
|
227
223
|
"this._replicators.has(replicator)",
|
|
228
224
|
""
|
|
229
225
|
]
|
|
230
226
|
});
|
|
231
|
-
"";
|
|
232
227
|
await replicator.disconnect();
|
|
233
228
|
this._replicators.delete(replicator);
|
|
234
229
|
}
|
|
@@ -240,7 +235,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
240
235
|
return connection.connection.shouldAdvertize(params);
|
|
241
236
|
}
|
|
242
237
|
_onConnectionOpen(connection) {
|
|
243
|
-
(0,
|
|
238
|
+
(0, import_log.log)("Connection opened", {
|
|
244
239
|
peerId: connection.peerId
|
|
245
240
|
}, {
|
|
246
241
|
F: __dxlog_file,
|
|
@@ -277,7 +272,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
277
272
|
}
|
|
278
273
|
} catch (err) {
|
|
279
274
|
if (connectionEntry.isOpen) {
|
|
280
|
-
|
|
275
|
+
import_log.log.catch(err, void 0, {
|
|
281
276
|
F: __dxlog_file,
|
|
282
277
|
L: 139,
|
|
283
278
|
S: this,
|
|
@@ -286,7 +281,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
286
281
|
}
|
|
287
282
|
}
|
|
288
283
|
});
|
|
289
|
-
(0,
|
|
284
|
+
(0, import_log.log)("emit peer-candidate", {
|
|
290
285
|
peerId: connection.peerId
|
|
291
286
|
}, {
|
|
292
287
|
F: __dxlog_file,
|
|
@@ -294,27 +289,49 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
294
289
|
S: this,
|
|
295
290
|
C: (f, a) => f(...a)
|
|
296
291
|
});
|
|
297
|
-
this.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
292
|
+
this._emitPeerCandidate(connection);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Trigger doc-synchronizer shared documents set recalculation. Happens on peer-candidate.
|
|
296
|
+
* TODO(y): replace with a proper API call when sharePolicy update becomes supported by automerge-repo
|
|
297
|
+
*/
|
|
298
|
+
_onConnectionAuthScopeChanged(connection) {
|
|
299
|
+
(0, import_log.log)("Connection auth scope changed", {
|
|
300
|
+
peerId: connection.peerId
|
|
301
|
+
}, {
|
|
302
|
+
F: __dxlog_file,
|
|
303
|
+
L: 153,
|
|
304
|
+
S: this,
|
|
305
|
+
C: (f, a) => f(...a)
|
|
306
|
+
});
|
|
307
|
+
const entry = this._connections.get(connection.peerId);
|
|
308
|
+
(0, import_invariant2.invariant)(entry, void 0, {
|
|
309
|
+
F: __dxlog_file,
|
|
310
|
+
L: 155,
|
|
311
|
+
S: this,
|
|
312
|
+
A: [
|
|
313
|
+
"entry",
|
|
314
|
+
""
|
|
315
|
+
]
|
|
303
316
|
});
|
|
317
|
+
this.emit("peer-disconnected", {
|
|
318
|
+
peerId: connection.peerId
|
|
319
|
+
});
|
|
320
|
+
this._emitPeerCandidate(connection);
|
|
304
321
|
}
|
|
305
322
|
_onConnectionClosed(connection) {
|
|
306
|
-
(0,
|
|
323
|
+
(0, import_log.log)("Connection closed", {
|
|
307
324
|
peerId: connection.peerId
|
|
308
325
|
}, {
|
|
309
326
|
F: __dxlog_file,
|
|
310
|
-
L:
|
|
327
|
+
L: 161,
|
|
311
328
|
S: this,
|
|
312
329
|
C: (f, a) => f(...a)
|
|
313
330
|
});
|
|
314
331
|
const entry = this._connections.get(connection.peerId);
|
|
315
332
|
(0, import_invariant2.invariant)(entry, void 0, {
|
|
316
333
|
F: __dxlog_file,
|
|
317
|
-
L:
|
|
334
|
+
L: 163,
|
|
318
335
|
S: this,
|
|
319
336
|
A: [
|
|
320
337
|
"entry",
|
|
@@ -325,20 +342,29 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
325
342
|
this.emit("peer-disconnected", {
|
|
326
343
|
peerId: connection.peerId
|
|
327
344
|
});
|
|
328
|
-
void entry.reader.cancel().catch((err) =>
|
|
345
|
+
void entry.reader.cancel().catch((err) => import_log.log.catch(err, void 0, {
|
|
329
346
|
F: __dxlog_file,
|
|
330
|
-
L:
|
|
347
|
+
L: 168,
|
|
331
348
|
S: this,
|
|
332
349
|
C: (f, a) => f(...a)
|
|
333
350
|
}));
|
|
334
|
-
void entry.writer.abort().catch((err) =>
|
|
351
|
+
void entry.writer.abort().catch((err) => import_log.log.catch(err, void 0, {
|
|
335
352
|
F: __dxlog_file,
|
|
336
|
-
L:
|
|
353
|
+
L: 169,
|
|
337
354
|
S: this,
|
|
338
355
|
C: (f, a) => f(...a)
|
|
339
356
|
}));
|
|
340
357
|
this._connections.delete(connection.peerId);
|
|
341
358
|
}
|
|
359
|
+
_emitPeerCandidate(connection) {
|
|
360
|
+
this.emit("peer-candidate", {
|
|
361
|
+
peerId: connection.peerId,
|
|
362
|
+
peerMetadata: {
|
|
363
|
+
// TODO(dmaretskyi): Refactor this.
|
|
364
|
+
dxos_peerSource: "EchoNetworkAdapter"
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
342
368
|
};
|
|
343
369
|
_ts_decorate([
|
|
344
370
|
import_async2.synchronized
|
|
@@ -577,108 +603,6 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo3.NetworkAdapte
|
|
|
577
603
|
return id;
|
|
578
604
|
}
|
|
579
605
|
};
|
|
580
|
-
var AutomergeStorageAdapter = class {
|
|
581
|
-
constructor(_directory) {
|
|
582
|
-
this._directory = _directory;
|
|
583
|
-
this._state = "opened";
|
|
584
|
-
}
|
|
585
|
-
async load(key) {
|
|
586
|
-
if (this._state !== "opened") {
|
|
587
|
-
return void 0;
|
|
588
|
-
}
|
|
589
|
-
const filename = this._getFilename(key);
|
|
590
|
-
const file = this._directory.getOrCreateFile(filename);
|
|
591
|
-
const { size } = await file.stat();
|
|
592
|
-
if (!size || size === 0) {
|
|
593
|
-
return void 0;
|
|
594
|
-
}
|
|
595
|
-
const buffer = await file.read(0, size);
|
|
596
|
-
return (0, import_util2.bufferToArray)(buffer);
|
|
597
|
-
}
|
|
598
|
-
async save(key, data) {
|
|
599
|
-
if (this._state !== "opened") {
|
|
600
|
-
return void 0;
|
|
601
|
-
}
|
|
602
|
-
const filename = this._getFilename(key);
|
|
603
|
-
const file = this._directory.getOrCreateFile(filename);
|
|
604
|
-
await file.write(0, (0, import_util2.arrayToBuffer)(data));
|
|
605
|
-
await file.truncate?.(data.length);
|
|
606
|
-
await file.flush?.();
|
|
607
|
-
}
|
|
608
|
-
async remove(key) {
|
|
609
|
-
if (this._state !== "opened") {
|
|
610
|
-
return void 0;
|
|
611
|
-
}
|
|
612
|
-
const filename = this._getFilename(key);
|
|
613
|
-
const file = this._directory.getOrCreateFile(filename);
|
|
614
|
-
await file.destroy();
|
|
615
|
-
}
|
|
616
|
-
async loadRange(keyPrefix) {
|
|
617
|
-
if (this._state !== "opened") {
|
|
618
|
-
return [];
|
|
619
|
-
}
|
|
620
|
-
const filename = this._getFilename(keyPrefix);
|
|
621
|
-
const entries = await this._directory.list();
|
|
622
|
-
return Promise.all(entries.filter((entry) => entry.startsWith(filename)).map(async (entry) => {
|
|
623
|
-
const file = this._directory.getOrCreateFile(entry);
|
|
624
|
-
const { size } = await file.stat();
|
|
625
|
-
const buffer = await file.read(0, size);
|
|
626
|
-
return {
|
|
627
|
-
key: this._getKeyFromFilename(entry),
|
|
628
|
-
data: (0, import_util2.bufferToArray)(buffer)
|
|
629
|
-
};
|
|
630
|
-
}));
|
|
631
|
-
}
|
|
632
|
-
async removeRange(keyPrefix) {
|
|
633
|
-
if (this._state !== "opened") {
|
|
634
|
-
return void 0;
|
|
635
|
-
}
|
|
636
|
-
const filename = this._getFilename(keyPrefix);
|
|
637
|
-
const entries = await this._directory.list();
|
|
638
|
-
await Promise.all(entries.filter((entry) => entry.startsWith(filename)).map(async (entry) => {
|
|
639
|
-
const file = this._directory.getOrCreateFile(entry);
|
|
640
|
-
await file.destroy();
|
|
641
|
-
}));
|
|
642
|
-
}
|
|
643
|
-
async close() {
|
|
644
|
-
this._state = "closed";
|
|
645
|
-
}
|
|
646
|
-
_getFilename(key) {
|
|
647
|
-
return key.map((k) => k.replaceAll("%", "%25").replaceAll("-", "%2D")).join("-");
|
|
648
|
-
}
|
|
649
|
-
_getKeyFromFilename(filename) {
|
|
650
|
-
return filename.split("-").map((k) => k.replaceAll("%2D", "-").replaceAll("%25", "%"));
|
|
651
|
-
}
|
|
652
|
-
};
|
|
653
|
-
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/migrations.ts";
|
|
654
|
-
var levelMigration = async ({ db, directory }) => {
|
|
655
|
-
const isNewLevel = !await db.iterator({
|
|
656
|
-
...encodingOptions
|
|
657
|
-
}).next();
|
|
658
|
-
if (!isNewLevel) {
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
const oldStorageAdapter = directory.type === import_random_access_storage.StorageType.IDB ? new import_automerge_repo_storage_indexeddb.IndexedDBStorageAdapter(directory.path, "data") : new AutomergeStorageAdapter(directory);
|
|
662
|
-
const chunks = await oldStorageAdapter.loadRange([]);
|
|
663
|
-
if (chunks.length === 0) {
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
const batch = db.batch();
|
|
667
|
-
import_log3.log.info("found chunks on old storage adapter", {
|
|
668
|
-
chunks: chunks.length
|
|
669
|
-
}, {
|
|
670
|
-
F: __dxlog_file3,
|
|
671
|
-
L: 37,
|
|
672
|
-
S: void 0,
|
|
673
|
-
C: (f, a) => f(...a)
|
|
674
|
-
});
|
|
675
|
-
for (const { key, data } of await oldStorageAdapter.loadRange([])) {
|
|
676
|
-
data && batch.put(key, data, {
|
|
677
|
-
...encodingOptions
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
await batch.write();
|
|
681
|
-
};
|
|
682
606
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
683
607
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
684
608
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -689,31 +613,27 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
689
613
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
690
614
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
691
615
|
}
|
|
692
|
-
var
|
|
616
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
|
|
693
617
|
var AutomergeHost = class {
|
|
694
|
-
constructor({
|
|
695
|
-
this._ctx = new import_context.Context(
|
|
618
|
+
constructor({ db, indexMetadataStore }) {
|
|
619
|
+
this._ctx = new import_context.Context(void 0, {
|
|
620
|
+
F: __dxlog_file3,
|
|
621
|
+
L: 49
|
|
622
|
+
});
|
|
696
623
|
this._echoNetworkAdapter = new EchoNetworkAdapter({
|
|
697
624
|
getContainingSpaceForDocument: this._getContainingSpaceForDocument.bind(this)
|
|
698
625
|
});
|
|
699
|
-
this._requestedDocs = /* @__PURE__ */ new Set();
|
|
700
|
-
this._directory = directory;
|
|
701
|
-
this._db = db;
|
|
702
|
-
this._indexMetadataStore = indexMetadataStore;
|
|
703
|
-
}
|
|
704
|
-
async open() {
|
|
705
|
-
this._peerId = `host-${import_keys.PublicKey.random().toHex()}`;
|
|
706
|
-
this._directory && await levelMigration({
|
|
707
|
-
db: this._db,
|
|
708
|
-
directory: this._directory
|
|
709
|
-
});
|
|
710
626
|
this._storage = new LevelDBStorageAdapter({
|
|
711
|
-
db
|
|
627
|
+
db,
|
|
712
628
|
callbacks: {
|
|
713
629
|
beforeSave: async (params) => this._beforeSave(params),
|
|
714
630
|
afterSave: async () => this._afterSave()
|
|
715
631
|
}
|
|
716
632
|
});
|
|
633
|
+
this._indexMetadataStore = indexMetadataStore;
|
|
634
|
+
}
|
|
635
|
+
async open() {
|
|
636
|
+
this._peerId = `host-${import_keys.PublicKey.random().toHex()}`;
|
|
717
637
|
await this._storage.open?.();
|
|
718
638
|
this._clientNetwork = new LocalHostNetworkAdapter();
|
|
719
639
|
this._repo = new import_automerge_repo.Repo({
|
|
@@ -758,21 +678,6 @@ var AutomergeHost = class {
|
|
|
758
678
|
if (!documentId) {
|
|
759
679
|
return false;
|
|
760
680
|
}
|
|
761
|
-
const doc = this._repo.handles[documentId]?.docSync();
|
|
762
|
-
if (!doc) {
|
|
763
|
-
const isRequested = this._requestedDocs.has(`automerge:${documentId}`);
|
|
764
|
-
(0, import_log.log)("doc share policy check", {
|
|
765
|
-
peerId,
|
|
766
|
-
documentId,
|
|
767
|
-
isRequested
|
|
768
|
-
}, {
|
|
769
|
-
F: __dxlog_file4,
|
|
770
|
-
L: 156,
|
|
771
|
-
S: this,
|
|
772
|
-
C: (f, a) => f(...a)
|
|
773
|
-
});
|
|
774
|
-
return isRequested;
|
|
775
|
-
}
|
|
776
681
|
const peerMetadata = this.repo.peerMetadataByPeerId[peerId];
|
|
777
682
|
if (peerMetadata?.dxos_peerSource === "EchoNetworkAdapter") {
|
|
778
683
|
return this._echoNetworkAdapter.shouldAdvertize(peerId, {
|
|
@@ -852,8 +757,8 @@ var AutomergeHost = class {
|
|
|
852
757
|
async flush({ states }) {
|
|
853
758
|
await Promise.all(states?.map(async ({ heads, documentId }) => {
|
|
854
759
|
(0, import_invariant.invariant)(heads, "heads are required for flush", {
|
|
855
|
-
F:
|
|
856
|
-
L:
|
|
760
|
+
F: __dxlog_file3,
|
|
761
|
+
L: 223,
|
|
857
762
|
S: this,
|
|
858
763
|
A: [
|
|
859
764
|
"heads",
|
|
@@ -931,7 +836,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
931
836
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
932
837
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
933
838
|
}
|
|
934
|
-
var
|
|
839
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
935
840
|
var AutomergeDocumentLoaderImpl = class {
|
|
936
841
|
constructor(_spaceId, _repo, _spaceKey) {
|
|
937
842
|
this._spaceId = _spaceId;
|
|
@@ -953,10 +858,10 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
953
858
|
return;
|
|
954
859
|
}
|
|
955
860
|
if (!spaceState.rootUrl) {
|
|
956
|
-
|
|
861
|
+
import_log2.log.error("Database opened with no rootUrl", {
|
|
957
862
|
spaceId: this._spaceId
|
|
958
863
|
}, {
|
|
959
|
-
F:
|
|
864
|
+
F: __dxlog_file4,
|
|
960
865
|
L: 72,
|
|
961
866
|
S: this,
|
|
962
867
|
C: (f, a) => f(...a)
|
|
@@ -966,7 +871,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
966
871
|
const existingDocHandle = await this._initDocHandle(ctx, spaceState.rootUrl);
|
|
967
872
|
const doc = existingDocHandle.docSync();
|
|
968
873
|
(0, import_invariant4.invariant)(doc, void 0, {
|
|
969
|
-
F:
|
|
874
|
+
F: __dxlog_file4,
|
|
970
875
|
L: 77,
|
|
971
876
|
S: this,
|
|
972
877
|
A: [
|
|
@@ -988,7 +893,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
988
893
|
const urlsToLoad = {};
|
|
989
894
|
for (const objectId of objectIds) {
|
|
990
895
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
991
|
-
F:
|
|
896
|
+
F: __dxlog_file4,
|
|
992
897
|
L: 90,
|
|
993
898
|
S: this,
|
|
994
899
|
A: [
|
|
@@ -1001,7 +906,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1001
906
|
}
|
|
1002
907
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
1003
908
|
(0, import_invariant4.invariant)(spaceRootDoc, void 0, {
|
|
1004
|
-
F:
|
|
909
|
+
F: __dxlog_file4,
|
|
1005
910
|
L: 95,
|
|
1006
911
|
S: this,
|
|
1007
912
|
A: [
|
|
@@ -1012,10 +917,10 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1012
917
|
const documentUrl = (spaceRootDoc.links ?? {})[objectId];
|
|
1013
918
|
if (documentUrl == null) {
|
|
1014
919
|
this._objectsPendingDocumentLoad.add(objectId);
|
|
1015
|
-
|
|
920
|
+
import_log2.log.info("loading delayed until object links are initialized", {
|
|
1016
921
|
objectId
|
|
1017
922
|
}, {
|
|
1018
|
-
F:
|
|
923
|
+
F: __dxlog_file4,
|
|
1019
924
|
L: 99,
|
|
1020
925
|
S: this,
|
|
1021
926
|
C: (f, a) => f(...a)
|
|
@@ -1039,7 +944,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1039
944
|
}
|
|
1040
945
|
getSpaceRootDocHandle() {
|
|
1041
946
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1042
|
-
F:
|
|
947
|
+
F: __dxlog_file4,
|
|
1043
948
|
L: 122,
|
|
1044
949
|
S: this,
|
|
1045
950
|
A: [
|
|
@@ -1051,7 +956,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1051
956
|
}
|
|
1052
957
|
createDocumentForObject(objectId) {
|
|
1053
958
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1054
|
-
F:
|
|
959
|
+
F: __dxlog_file4,
|
|
1055
960
|
L: 127,
|
|
1056
961
|
S: this,
|
|
1057
962
|
A: [
|
|
@@ -1059,7 +964,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1059
964
|
""
|
|
1060
965
|
]
|
|
1061
966
|
});
|
|
1062
|
-
const spaceDocHandle = this._repo.create(
|
|
967
|
+
const spaceDocHandle = this._repo.create({
|
|
968
|
+
version: import_echo_protocol.SpaceDocVersion.CURRENT
|
|
969
|
+
});
|
|
1063
970
|
this._initDocAccess(spaceDocHandle);
|
|
1064
971
|
this.onObjectBoundToDocument(spaceDocHandle, objectId);
|
|
1065
972
|
this._spaceRootDocHandle.change((newDoc) => {
|
|
@@ -1090,30 +997,30 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1090
997
|
};
|
|
1091
998
|
const objectDocumentHandle = this._objectDocumentHandles.get(objectId);
|
|
1092
999
|
if (objectDocumentHandle != null && objectDocumentHandle.url !== automergeUrl) {
|
|
1093
|
-
|
|
1000
|
+
import_log2.log.warn("object already inlined in a different document, ignoring the link", {
|
|
1094
1001
|
...logMeta,
|
|
1095
1002
|
actualDocumentUrl: objectDocumentHandle.url
|
|
1096
1003
|
}, {
|
|
1097
|
-
F:
|
|
1098
|
-
L:
|
|
1004
|
+
F: __dxlog_file4,
|
|
1005
|
+
L: 159,
|
|
1099
1006
|
S: this,
|
|
1100
1007
|
C: (f, a) => f(...a)
|
|
1101
1008
|
});
|
|
1102
1009
|
continue;
|
|
1103
1010
|
}
|
|
1104
1011
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
1105
|
-
|
|
1106
|
-
F:
|
|
1107
|
-
L:
|
|
1012
|
+
import_log2.log.warn("object document was already loaded", logMeta, {
|
|
1013
|
+
F: __dxlog_file4,
|
|
1014
|
+
L: 166,
|
|
1108
1015
|
S: this,
|
|
1109
1016
|
C: (f, a) => f(...a)
|
|
1110
1017
|
});
|
|
1111
1018
|
continue;
|
|
1112
1019
|
}
|
|
1113
1020
|
const handle = this._repo.find(automergeUrl);
|
|
1114
|
-
|
|
1115
|
-
F:
|
|
1116
|
-
L:
|
|
1021
|
+
import_log2.log.debug("document loading triggered", logMeta, {
|
|
1022
|
+
F: __dxlog_file4,
|
|
1023
|
+
L: 170,
|
|
1117
1024
|
S: this,
|
|
1118
1025
|
C: (f, a) => f(...a)
|
|
1119
1026
|
});
|
|
@@ -1131,12 +1038,12 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1131
1038
|
break;
|
|
1132
1039
|
} catch (err) {
|
|
1133
1040
|
if (`${err}`.includes("Timeout")) {
|
|
1134
|
-
|
|
1041
|
+
import_log2.log.info("wraparound", {
|
|
1135
1042
|
id: docHandle.documentId,
|
|
1136
1043
|
state: docHandle.state
|
|
1137
1044
|
}, {
|
|
1138
|
-
F:
|
|
1139
|
-
L:
|
|
1045
|
+
F: __dxlog_file4,
|
|
1046
|
+
L: 186,
|
|
1140
1047
|
S: this,
|
|
1141
1048
|
C: (f, a) => f(...a)
|
|
1142
1049
|
});
|
|
@@ -1176,9 +1083,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1176
1083
|
docUrl: handle.url
|
|
1177
1084
|
};
|
|
1178
1085
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1179
|
-
|
|
1180
|
-
F:
|
|
1181
|
-
L:
|
|
1086
|
+
import_log2.log.info("document loaded after all listeners were removed", logMeta, {
|
|
1087
|
+
F: __dxlog_file4,
|
|
1088
|
+
L: 222,
|
|
1182
1089
|
S: this,
|
|
1183
1090
|
C: (f, a) => f(...a)
|
|
1184
1091
|
});
|
|
@@ -1186,9 +1093,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1186
1093
|
}
|
|
1187
1094
|
const objectDocHandle = this._objectDocumentHandles.get(objectId);
|
|
1188
1095
|
if (objectDocHandle?.url !== handle.url) {
|
|
1189
|
-
|
|
1190
|
-
F:
|
|
1191
|
-
L:
|
|
1096
|
+
import_log2.log.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1097
|
+
F: __dxlog_file4,
|
|
1098
|
+
L: 227,
|
|
1192
1099
|
S: this,
|
|
1193
1100
|
C: (f, a) => f(...a)
|
|
1194
1101
|
});
|
|
@@ -1200,14 +1107,14 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1200
1107
|
});
|
|
1201
1108
|
} catch (err) {
|
|
1202
1109
|
const shouldRetryLoading = this.onObjectDocumentLoaded.listenerCount() > 0;
|
|
1203
|
-
|
|
1110
|
+
import_log2.log.warn("failed to load a document", {
|
|
1204
1111
|
objectId,
|
|
1205
1112
|
automergeUrl: handle.url,
|
|
1206
1113
|
retryLoading: shouldRetryLoading,
|
|
1207
1114
|
err
|
|
1208
1115
|
}, {
|
|
1209
|
-
F:
|
|
1210
|
-
L:
|
|
1116
|
+
F: __dxlog_file4,
|
|
1117
|
+
L: 233,
|
|
1211
1118
|
S: this,
|
|
1212
1119
|
C: (f, a) => f(...a)
|
|
1213
1120
|
});
|
|
@@ -1225,12 +1132,12 @@ _ts_decorate3([
|
|
|
1225
1132
|
AutomergeDocumentLoaderImpl = _ts_decorate3([
|
|
1226
1133
|
import_tracing2.trace.resource()
|
|
1227
1134
|
], AutomergeDocumentLoaderImpl);
|
|
1228
|
-
var
|
|
1135
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator.ts";
|
|
1229
1136
|
var MeshEchoReplicator = class {
|
|
1230
1137
|
constructor() {
|
|
1231
1138
|
this._connections = /* @__PURE__ */ new Set();
|
|
1232
1139
|
this._connectionsPerPeer = /* @__PURE__ */ new Map();
|
|
1233
|
-
this._authorizedDevices = new
|
|
1140
|
+
this._authorizedDevices = new import_util2.ComplexMap(import_keys2.PublicKey.hash);
|
|
1234
1141
|
this._context = null;
|
|
1235
1142
|
}
|
|
1236
1143
|
async connect(context) {
|
|
@@ -1246,7 +1153,7 @@ var MeshEchoReplicator = class {
|
|
|
1246
1153
|
}
|
|
1247
1154
|
createExtension() {
|
|
1248
1155
|
(0, import_invariant5.invariant)(this._context, void 0, {
|
|
1249
|
-
F:
|
|
1156
|
+
F: __dxlog_file5,
|
|
1250
1157
|
L: 54,
|
|
1251
1158
|
S: this,
|
|
1252
1159
|
A: [
|
|
@@ -1257,16 +1164,16 @@ var MeshEchoReplicator = class {
|
|
|
1257
1164
|
const connection = new MeshReplicatorConnection({
|
|
1258
1165
|
ownPeerId: this._context.peerId,
|
|
1259
1166
|
onRemoteConnected: async () => {
|
|
1260
|
-
(0,
|
|
1167
|
+
(0, import_log3.log)("onRemoteConnected", {
|
|
1261
1168
|
peerId: connection.peerId
|
|
1262
1169
|
}, {
|
|
1263
|
-
F:
|
|
1170
|
+
F: __dxlog_file5,
|
|
1264
1171
|
L: 59,
|
|
1265
1172
|
S: this,
|
|
1266
1173
|
C: (f, a) => f(...a)
|
|
1267
1174
|
});
|
|
1268
1175
|
(0, import_invariant5.invariant)(this._context, void 0, {
|
|
1269
|
-
F:
|
|
1176
|
+
F: __dxlog_file5,
|
|
1270
1177
|
L: 60,
|
|
1271
1178
|
S: this,
|
|
1272
1179
|
A: [
|
|
@@ -1274,18 +1181,20 @@ var MeshEchoReplicator = class {
|
|
|
1274
1181
|
""
|
|
1275
1182
|
]
|
|
1276
1183
|
});
|
|
1277
|
-
if (
|
|
1184
|
+
if (this._connectionsPerPeer.has(connection.peerId)) {
|
|
1185
|
+
this._context.onConnectionAuthScopeChanged(connection);
|
|
1186
|
+
} else {
|
|
1278
1187
|
this._connectionsPerPeer.set(connection.peerId, connection);
|
|
1279
1188
|
await connection.enable();
|
|
1280
1189
|
this._context.onConnectionOpen(connection);
|
|
1281
1190
|
}
|
|
1282
1191
|
},
|
|
1283
1192
|
onRemoteDisconnected: async () => {
|
|
1284
|
-
(0,
|
|
1193
|
+
(0, import_log3.log)("onRemoteDisconnected", {
|
|
1285
1194
|
peerId: connection.peerId
|
|
1286
1195
|
}, {
|
|
1287
|
-
F:
|
|
1288
|
-
L:
|
|
1196
|
+
F: __dxlog_file5,
|
|
1197
|
+
L: 71,
|
|
1289
1198
|
S: this,
|
|
1290
1199
|
C: (f, a) => f(...a)
|
|
1291
1200
|
});
|
|
@@ -1295,18 +1204,18 @@ var MeshEchoReplicator = class {
|
|
|
1295
1204
|
this._connections.delete(connection);
|
|
1296
1205
|
},
|
|
1297
1206
|
shouldAdvertize: async (params) => {
|
|
1298
|
-
(0,
|
|
1207
|
+
(0, import_log3.log)("shouldAdvertize", {
|
|
1299
1208
|
peerId: connection.peerId,
|
|
1300
1209
|
documentId: params.documentId
|
|
1301
1210
|
}, {
|
|
1302
|
-
F:
|
|
1303
|
-
L:
|
|
1211
|
+
F: __dxlog_file5,
|
|
1212
|
+
L: 78,
|
|
1304
1213
|
S: this,
|
|
1305
1214
|
C: (f, a) => f(...a)
|
|
1306
1215
|
});
|
|
1307
1216
|
(0, import_invariant5.invariant)(this._context, void 0, {
|
|
1308
|
-
F:
|
|
1309
|
-
L:
|
|
1217
|
+
F: __dxlog_file5,
|
|
1218
|
+
L: 79,
|
|
1310
1219
|
S: this,
|
|
1311
1220
|
A: [
|
|
1312
1221
|
"this._context",
|
|
@@ -1316,12 +1225,12 @@ var MeshEchoReplicator = class {
|
|
|
1316
1225
|
try {
|
|
1317
1226
|
const spaceKey = await this._context.getContainingSpaceForDocument(params.documentId);
|
|
1318
1227
|
if (!spaceKey) {
|
|
1319
|
-
(0,
|
|
1228
|
+
(0, import_log3.log)("space key not found for share policy check", {
|
|
1320
1229
|
peerId: connection.peerId,
|
|
1321
1230
|
documentId: params.documentId
|
|
1322
1231
|
}, {
|
|
1323
|
-
F:
|
|
1324
|
-
L:
|
|
1232
|
+
F: __dxlog_file5,
|
|
1233
|
+
L: 83,
|
|
1325
1234
|
S: this,
|
|
1326
1235
|
C: (f, a) => f(...a)
|
|
1327
1236
|
});
|
|
@@ -1329,19 +1238,19 @@ var MeshEchoReplicator = class {
|
|
|
1329
1238
|
}
|
|
1330
1239
|
const authorizedDevices = this._authorizedDevices.get(spaceKey);
|
|
1331
1240
|
if (!connection.remoteDeviceKey) {
|
|
1332
|
-
(0,
|
|
1241
|
+
(0, import_log3.log)("device key not found for share policy check", {
|
|
1333
1242
|
peerId: connection.peerId,
|
|
1334
1243
|
documentId: params.documentId
|
|
1335
1244
|
}, {
|
|
1336
|
-
F:
|
|
1337
|
-
L:
|
|
1245
|
+
F: __dxlog_file5,
|
|
1246
|
+
L: 93,
|
|
1338
1247
|
S: this,
|
|
1339
1248
|
C: (f, a) => f(...a)
|
|
1340
1249
|
});
|
|
1341
1250
|
return false;
|
|
1342
1251
|
}
|
|
1343
1252
|
const isAuthorized = authorizedDevices?.has(connection.remoteDeviceKey) ?? false;
|
|
1344
|
-
(0,
|
|
1253
|
+
(0, import_log3.log)("share policy check", {
|
|
1345
1254
|
localPeer: this._context.peerId,
|
|
1346
1255
|
remotePeer: connection.peerId,
|
|
1347
1256
|
documentId: params.documentId,
|
|
@@ -1349,16 +1258,16 @@ var MeshEchoReplicator = class {
|
|
|
1349
1258
|
spaceKey,
|
|
1350
1259
|
isAuthorized
|
|
1351
1260
|
}, {
|
|
1352
|
-
F:
|
|
1353
|
-
L:
|
|
1261
|
+
F: __dxlog_file5,
|
|
1262
|
+
L: 101,
|
|
1354
1263
|
S: this,
|
|
1355
1264
|
C: (f, a) => f(...a)
|
|
1356
1265
|
});
|
|
1357
1266
|
return isAuthorized;
|
|
1358
1267
|
} catch (err) {
|
|
1359
|
-
|
|
1360
|
-
F:
|
|
1361
|
-
L:
|
|
1268
|
+
import_log3.log.catch(err, void 0, {
|
|
1269
|
+
F: __dxlog_file5,
|
|
1270
|
+
L: 111,
|
|
1362
1271
|
S: this,
|
|
1363
1272
|
C: (f, a) => f(...a)
|
|
1364
1273
|
});
|
|
@@ -1370,16 +1279,21 @@ var MeshEchoReplicator = class {
|
|
|
1370
1279
|
return connection.replicatorExtension;
|
|
1371
1280
|
}
|
|
1372
1281
|
authorizeDevice(spaceKey, deviceKey) {
|
|
1373
|
-
(0,
|
|
1282
|
+
(0, import_log3.log)("authorizeDevice", {
|
|
1374
1283
|
spaceKey,
|
|
1375
1284
|
deviceKey
|
|
1376
1285
|
}, {
|
|
1377
|
-
F:
|
|
1378
|
-
L:
|
|
1286
|
+
F: __dxlog_file5,
|
|
1287
|
+
L: 122,
|
|
1379
1288
|
S: this,
|
|
1380
1289
|
C: (f, a) => f(...a)
|
|
1381
1290
|
});
|
|
1382
|
-
(0,
|
|
1291
|
+
(0, import_util2.defaultMap)(this._authorizedDevices, spaceKey, () => new import_util2.ComplexSet(import_keys2.PublicKey.hash)).add(deviceKey);
|
|
1292
|
+
for (const connection of this._connections) {
|
|
1293
|
+
if (connection.remoteDeviceKey && connection.remoteDeviceKey.equals(deviceKey)) {
|
|
1294
|
+
this._context?.onConnectionAuthScopeChanged(connection);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1383
1297
|
}
|
|
1384
1298
|
};
|
|
1385
1299
|
var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
@@ -1411,13 +1325,13 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1411
1325
|
onStartReplication: async (info, remotePeerId) => {
|
|
1412
1326
|
this.remoteDeviceKey = remotePeerId;
|
|
1413
1327
|
this._remotePeerId = info.id;
|
|
1414
|
-
(0,
|
|
1328
|
+
(0, import_log3.log)("onStartReplication", {
|
|
1415
1329
|
id: info.id,
|
|
1416
1330
|
thisPeerId: this.peerId,
|
|
1417
1331
|
remotePeerId: remotePeerId.toHex()
|
|
1418
1332
|
}, {
|
|
1419
|
-
F:
|
|
1420
|
-
L:
|
|
1333
|
+
F: __dxlog_file5,
|
|
1334
|
+
L: 192,
|
|
1421
1335
|
S: this,
|
|
1422
1336
|
C: (f, a) => f(...a)
|
|
1423
1337
|
});
|
|
@@ -1440,8 +1354,8 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1440
1354
|
}
|
|
1441
1355
|
get peerId() {
|
|
1442
1356
|
(0, import_invariant5.invariant)(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1443
|
-
F:
|
|
1444
|
-
L:
|
|
1357
|
+
F: __dxlog_file5,
|
|
1358
|
+
L: 215,
|
|
1445
1359
|
S: this,
|
|
1446
1360
|
A: [
|
|
1447
1361
|
"this._remotePeerId != null",
|
|
@@ -1459,8 +1373,8 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1459
1373
|
*/
|
|
1460
1374
|
async enable() {
|
|
1461
1375
|
(0, import_invariant5.invariant)(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1462
|
-
F:
|
|
1463
|
-
L:
|
|
1376
|
+
F: __dxlog_file5,
|
|
1377
|
+
L: 228,
|
|
1464
1378
|
S: this,
|
|
1465
1379
|
A: [
|
|
1466
1380
|
"this._remotePeerId != null",
|
|
@@ -1482,7 +1396,6 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1482
1396
|
AuthStatus,
|
|
1483
1397
|
AutomergeDocumentLoaderImpl,
|
|
1484
1398
|
AutomergeHost,
|
|
1485
|
-
AutomergeStorageAdapter,
|
|
1486
1399
|
DataServiceImpl,
|
|
1487
1400
|
LevelDBStorageAdapter,
|
|
1488
1401
|
LocalHostNetworkAdapter,
|