@dxos/echo-pipeline 0.5.8 → 0.5.9-main.0a0e87d
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-GANAND63.mjs → chunk-I2J5TTHJ.mjs} +48 -23
- package/dist/lib/browser/{chunk-GANAND63.mjs.map → chunk-I2J5TTHJ.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +89 -51
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +99 -4
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/{chunk-M475BGBI.cjs → chunk-QPCNQ4ZK.cjs} +51 -25
- package/dist/lib/node/chunk-QPCNQ4ZK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +110 -72
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +107 -13
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/automerge/automerge-doc-loader.d.ts +7 -3
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
- 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/mesh-echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/migrations.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +2 -2
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +2 -2
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +9 -1
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +2 -2
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts +18 -0
- package/dist/types/src/testing/test-network-adapter.d.ts.map +1 -0
- package/package.json +33 -33
- package/src/automerge/automerge-doc-loader.test.ts +5 -2
- package/src/automerge/automerge-doc-loader.ts +6 -4
- package/src/automerge/automerge-host.test.ts +1 -553
- package/src/automerge/automerge-host.ts +12 -5
- package/src/automerge/automerge-repo.test.ts +450 -2
- package/src/automerge/echo-network-adapter.ts +24 -8
- package/src/automerge/echo-replicator.ts +2 -0
- package/src/automerge/mesh-echo-replicator.ts +3 -1
- package/src/automerge/migrations.ts +2 -1
- package/src/automerge/storage-adapter.test.ts +81 -15
- package/src/space/space-manager.ts +6 -4
- package/src/space/space-protocol.test.ts +5 -3
- package/src/space/space-protocol.ts +3 -3
- package/src/space/space.ts +32 -2
- package/src/testing/index.ts +1 -0
- package/src/testing/test-agent-builder.ts +4 -4
- package/src/testing/test-network-adapter.ts +62 -0
- package/dist/lib/node/chunk-M475BGBI.cjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -18,38 +18,39 @@ 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_QPCNQ4ZK.AuthExtension,
|
|
22
|
+
AuthStatus: () => import_chunk_QPCNQ4ZK.AuthStatus,
|
|
23
23
|
AutomergeDocumentLoaderImpl: () => AutomergeDocumentLoaderImpl,
|
|
24
24
|
AutomergeHost: () => AutomergeHost,
|
|
25
25
|
AutomergeStorageAdapter: () => AutomergeStorageAdapter,
|
|
26
|
-
DataServiceImpl: () =>
|
|
26
|
+
DataServiceImpl: () => import_chunk_QPCNQ4ZK.DataServiceImpl,
|
|
27
27
|
LevelDBStorageAdapter: () => LevelDBStorageAdapter,
|
|
28
28
|
LocalHostNetworkAdapter: () => LocalHostNetworkAdapter,
|
|
29
|
-
MOCK_AUTH_PROVIDER: () =>
|
|
30
|
-
MOCK_AUTH_VERIFIER: () =>
|
|
29
|
+
MOCK_AUTH_PROVIDER: () => import_chunk_QPCNQ4ZK.MOCK_AUTH_PROVIDER,
|
|
30
|
+
MOCK_AUTH_VERIFIER: () => import_chunk_QPCNQ4ZK.MOCK_AUTH_VERIFIER,
|
|
31
31
|
MeshEchoReplicator: () => MeshEchoReplicator,
|
|
32
|
-
MetadataStore: () =>
|
|
33
|
-
Pipeline: () =>
|
|
34
|
-
SnapshotManager: () =>
|
|
35
|
-
SnapshotStore: () =>
|
|
36
|
-
Space: () =>
|
|
37
|
-
SpaceManager: () =>
|
|
38
|
-
SpaceProtocol: () =>
|
|
39
|
-
SpaceProtocolSession: () =>
|
|
40
|
-
TimeframeClock: () =>
|
|
41
|
-
codec: () =>
|
|
42
|
-
|
|
32
|
+
MetadataStore: () => import_chunk_QPCNQ4ZK.MetadataStore,
|
|
33
|
+
Pipeline: () => import_chunk_QPCNQ4ZK.Pipeline,
|
|
34
|
+
SnapshotManager: () => import_chunk_QPCNQ4ZK.SnapshotManager,
|
|
35
|
+
SnapshotStore: () => import_chunk_QPCNQ4ZK.SnapshotStore,
|
|
36
|
+
Space: () => import_chunk_QPCNQ4ZK.Space,
|
|
37
|
+
SpaceManager: () => import_chunk_QPCNQ4ZK.SpaceManager,
|
|
38
|
+
SpaceProtocol: () => import_chunk_QPCNQ4ZK.SpaceProtocol,
|
|
39
|
+
SpaceProtocolSession: () => import_chunk_QPCNQ4ZK.SpaceProtocolSession,
|
|
40
|
+
TimeframeClock: () => import_chunk_QPCNQ4ZK.TimeframeClock,
|
|
41
|
+
codec: () => import_chunk_QPCNQ4ZK.codec,
|
|
42
|
+
createIdFromSpaceKey: () => import_chunk_QPCNQ4ZK.createIdFromSpaceKey,
|
|
43
|
+
createMappedFeedWriter: () => import_chunk_QPCNQ4ZK.createMappedFeedWriter,
|
|
43
44
|
encodingOptions: () => encodingOptions,
|
|
44
45
|
getSpaceKeyFromDoc: () => getSpaceKeyFromDoc,
|
|
45
|
-
hasInvitationExpired: () =>
|
|
46
|
-
mapFeedIndexesToTimeframe: () =>
|
|
47
|
-
mapTimeframeToFeedIndexes: () =>
|
|
48
|
-
startAfter: () =>
|
|
49
|
-
valueEncoding: () =>
|
|
46
|
+
hasInvitationExpired: () => import_chunk_QPCNQ4ZK.hasInvitationExpired,
|
|
47
|
+
mapFeedIndexesToTimeframe: () => import_chunk_QPCNQ4ZK.mapFeedIndexesToTimeframe,
|
|
48
|
+
mapTimeframeToFeedIndexes: () => import_chunk_QPCNQ4ZK.mapTimeframeToFeedIndexes,
|
|
49
|
+
startAfter: () => import_chunk_QPCNQ4ZK.startAfter,
|
|
50
|
+
valueEncoding: () => import_chunk_QPCNQ4ZK.valueEncoding
|
|
50
51
|
});
|
|
51
52
|
module.exports = __toCommonJS(node_exports);
|
|
52
|
-
var
|
|
53
|
+
var import_chunk_QPCNQ4ZK = require("./chunk-QPCNQ4ZK.cjs");
|
|
53
54
|
var import_async = require("@dxos/async");
|
|
54
55
|
var import_automerge = require("@dxos/automerge/automerge");
|
|
55
56
|
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
@@ -205,13 +206,14 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
205
206
|
peerId: this.peerId,
|
|
206
207
|
onConnectionOpen: this._onConnectionOpen.bind(this),
|
|
207
208
|
onConnectionClosed: this._onConnectionClosed.bind(this),
|
|
209
|
+
onConnectionAuthScopeChanged: this._onConnectionAuthScopeChanged.bind(this),
|
|
208
210
|
getContainingSpaceForDocument: this._params.getContainingSpaceForDocument
|
|
209
211
|
});
|
|
210
212
|
}
|
|
211
213
|
async removeReplicator(replicator) {
|
|
212
214
|
(0, import_invariant2.invariant)(this._lifecycleState === import_context2.LifecycleState.OPEN, void 0, {
|
|
213
215
|
F: __dxlog_file,
|
|
214
|
-
L:
|
|
216
|
+
L: 103,
|
|
215
217
|
S: this,
|
|
216
218
|
A: [
|
|
217
219
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -220,14 +222,13 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
220
222
|
});
|
|
221
223
|
(0, import_invariant2.invariant)(this._replicators.has(replicator), void 0, {
|
|
222
224
|
F: __dxlog_file,
|
|
223
|
-
L:
|
|
225
|
+
L: 104,
|
|
224
226
|
S: this,
|
|
225
227
|
A: [
|
|
226
228
|
"this._replicators.has(replicator)",
|
|
227
229
|
""
|
|
228
230
|
]
|
|
229
231
|
});
|
|
230
|
-
"";
|
|
231
232
|
await replicator.disconnect();
|
|
232
233
|
this._replicators.delete(replicator);
|
|
233
234
|
}
|
|
@@ -293,27 +294,49 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
293
294
|
S: this,
|
|
294
295
|
C: (f, a) => f(...a)
|
|
295
296
|
});
|
|
296
|
-
this.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
297
|
+
this._emitPeerCandidate(connection);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Trigger doc-synchronizer shared documents set recalculation. Happens on peer-candidate.
|
|
301
|
+
* TODO(y): replace with a proper API call when sharePolicy update becomes supported by automerge-repo
|
|
302
|
+
*/
|
|
303
|
+
_onConnectionAuthScopeChanged(connection) {
|
|
304
|
+
(0, import_log2.log)("Connection auth scope changed", {
|
|
305
|
+
peerId: connection.peerId
|
|
306
|
+
}, {
|
|
307
|
+
F: __dxlog_file,
|
|
308
|
+
L: 153,
|
|
309
|
+
S: this,
|
|
310
|
+
C: (f, a) => f(...a)
|
|
311
|
+
});
|
|
312
|
+
const entry = this._connections.get(connection.peerId);
|
|
313
|
+
(0, import_invariant2.invariant)(entry, void 0, {
|
|
314
|
+
F: __dxlog_file,
|
|
315
|
+
L: 155,
|
|
316
|
+
S: this,
|
|
317
|
+
A: [
|
|
318
|
+
"entry",
|
|
319
|
+
""
|
|
320
|
+
]
|
|
302
321
|
});
|
|
322
|
+
this.emit("peer-disconnected", {
|
|
323
|
+
peerId: connection.peerId
|
|
324
|
+
});
|
|
325
|
+
this._emitPeerCandidate(connection);
|
|
303
326
|
}
|
|
304
327
|
_onConnectionClosed(connection) {
|
|
305
328
|
(0, import_log2.log)("Connection closed", {
|
|
306
329
|
peerId: connection.peerId
|
|
307
330
|
}, {
|
|
308
331
|
F: __dxlog_file,
|
|
309
|
-
L:
|
|
332
|
+
L: 161,
|
|
310
333
|
S: this,
|
|
311
334
|
C: (f, a) => f(...a)
|
|
312
335
|
});
|
|
313
336
|
const entry = this._connections.get(connection.peerId);
|
|
314
337
|
(0, import_invariant2.invariant)(entry, void 0, {
|
|
315
338
|
F: __dxlog_file,
|
|
316
|
-
L:
|
|
339
|
+
L: 163,
|
|
317
340
|
S: this,
|
|
318
341
|
A: [
|
|
319
342
|
"entry",
|
|
@@ -326,18 +349,27 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
326
349
|
});
|
|
327
350
|
void entry.reader.cancel().catch((err) => import_log2.log.catch(err, void 0, {
|
|
328
351
|
F: __dxlog_file,
|
|
329
|
-
L:
|
|
352
|
+
L: 168,
|
|
330
353
|
S: this,
|
|
331
354
|
C: (f, a) => f(...a)
|
|
332
355
|
}));
|
|
333
356
|
void entry.writer.abort().catch((err) => import_log2.log.catch(err, void 0, {
|
|
334
357
|
F: __dxlog_file,
|
|
335
|
-
L:
|
|
358
|
+
L: 169,
|
|
336
359
|
S: this,
|
|
337
360
|
C: (f, a) => f(...a)
|
|
338
361
|
}));
|
|
339
362
|
this._connections.delete(connection.peerId);
|
|
340
363
|
}
|
|
364
|
+
_emitPeerCandidate(connection) {
|
|
365
|
+
this.emit("peer-candidate", {
|
|
366
|
+
peerId: connection.peerId,
|
|
367
|
+
peerMetadata: {
|
|
368
|
+
// TODO(dmaretskyi): Refactor this.
|
|
369
|
+
dxos_peerSource: "EchoNetworkAdapter"
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
341
373
|
};
|
|
342
374
|
_ts_decorate([
|
|
343
375
|
import_async2.synchronized
|
|
@@ -667,7 +699,7 @@ var levelMigration = async ({ db, directory }) => {
|
|
|
667
699
|
chunks: chunks.length
|
|
668
700
|
}, {
|
|
669
701
|
F: __dxlog_file3,
|
|
670
|
-
L:
|
|
702
|
+
L: 37,
|
|
671
703
|
S: void 0,
|
|
672
704
|
C: (f, a) => f(...a)
|
|
673
705
|
});
|
|
@@ -701,6 +733,7 @@ var AutomergeHost = class {
|
|
|
701
733
|
this._indexMetadataStore = indexMetadataStore;
|
|
702
734
|
}
|
|
703
735
|
async open() {
|
|
736
|
+
this._peerId = `host-${import_keys.PublicKey.random().toHex()}`;
|
|
704
737
|
this._directory && await levelMigration({
|
|
705
738
|
db: this._db,
|
|
706
739
|
directory: this._directory
|
|
@@ -713,16 +746,17 @@ var AutomergeHost = class {
|
|
|
713
746
|
}
|
|
714
747
|
});
|
|
715
748
|
await this._storage.open?.();
|
|
716
|
-
this._peerId = `host-${import_keys.PublicKey.random().toHex()}`;
|
|
717
749
|
this._clientNetwork = new LocalHostNetworkAdapter();
|
|
718
750
|
this._repo = new import_automerge_repo.Repo({
|
|
719
751
|
peerId: this._peerId,
|
|
752
|
+
sharePolicy: this._sharePolicy.bind(this),
|
|
753
|
+
storage: this._storage,
|
|
720
754
|
network: [
|
|
755
|
+
// Downstream client.
|
|
721
756
|
this._clientNetwork,
|
|
757
|
+
// Upstream swarm.
|
|
722
758
|
this._echoNetworkAdapter
|
|
723
|
-
]
|
|
724
|
-
storage: this._storage,
|
|
725
|
-
sharePolicy: this._sharePolicy.bind(this)
|
|
759
|
+
]
|
|
726
760
|
});
|
|
727
761
|
this._clientNetwork.ready();
|
|
728
762
|
await this._echoNetworkAdapter.open();
|
|
@@ -764,7 +798,7 @@ var AutomergeHost = class {
|
|
|
764
798
|
isRequested
|
|
765
799
|
}, {
|
|
766
800
|
F: __dxlog_file4,
|
|
767
|
-
L:
|
|
801
|
+
L: 156,
|
|
768
802
|
S: this,
|
|
769
803
|
C: (f, a) => f(...a)
|
|
770
804
|
});
|
|
@@ -850,7 +884,7 @@ var AutomergeHost = class {
|
|
|
850
884
|
await Promise.all(states?.map(async ({ heads, documentId }) => {
|
|
851
885
|
(0, import_invariant.invariant)(heads, "heads are required for flush", {
|
|
852
886
|
F: __dxlog_file4,
|
|
853
|
-
L:
|
|
887
|
+
L: 250,
|
|
854
888
|
S: this,
|
|
855
889
|
A: [
|
|
856
890
|
"heads",
|
|
@@ -930,9 +964,10 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
930
964
|
}
|
|
931
965
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
932
966
|
var AutomergeDocumentLoaderImpl = class {
|
|
933
|
-
constructor(
|
|
934
|
-
this.
|
|
967
|
+
constructor(_spaceId, _repo, _spaceKey) {
|
|
968
|
+
this._spaceId = _spaceId;
|
|
935
969
|
this._repo = _repo;
|
|
970
|
+
this._spaceKey = _spaceKey;
|
|
936
971
|
this._spaceRootDocHandle = null;
|
|
937
972
|
this._objectDocumentHandles = /* @__PURE__ */ new Map();
|
|
938
973
|
this._objectsPendingDocumentLoad = /* @__PURE__ */ new Set();
|
|
@@ -950,10 +985,10 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
950
985
|
}
|
|
951
986
|
if (!spaceState.rootUrl) {
|
|
952
987
|
import_log4.log.error("Database opened with no rootUrl", {
|
|
953
|
-
|
|
988
|
+
spaceId: this._spaceId
|
|
954
989
|
}, {
|
|
955
990
|
F: __dxlog_file5,
|
|
956
|
-
L:
|
|
991
|
+
L: 72,
|
|
957
992
|
S: this,
|
|
958
993
|
C: (f, a) => f(...a)
|
|
959
994
|
});
|
|
@@ -963,7 +998,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
963
998
|
const doc = existingDocHandle.docSync();
|
|
964
999
|
(0, import_invariant4.invariant)(doc, void 0, {
|
|
965
1000
|
F: __dxlog_file5,
|
|
966
|
-
L:
|
|
1001
|
+
L: 77,
|
|
967
1002
|
S: this,
|
|
968
1003
|
A: [
|
|
969
1004
|
"doc",
|
|
@@ -985,7 +1020,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
985
1020
|
for (const objectId of objectIds) {
|
|
986
1021
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
987
1022
|
F: __dxlog_file5,
|
|
988
|
-
L:
|
|
1023
|
+
L: 90,
|
|
989
1024
|
S: this,
|
|
990
1025
|
A: [
|
|
991
1026
|
"this._spaceRootDocHandle",
|
|
@@ -998,7 +1033,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
998
1033
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
999
1034
|
(0, import_invariant4.invariant)(spaceRootDoc, void 0, {
|
|
1000
1035
|
F: __dxlog_file5,
|
|
1001
|
-
L:
|
|
1036
|
+
L: 95,
|
|
1002
1037
|
S: this,
|
|
1003
1038
|
A: [
|
|
1004
1039
|
"spaceRootDoc",
|
|
@@ -1012,7 +1047,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1012
1047
|
objectId
|
|
1013
1048
|
}, {
|
|
1014
1049
|
F: __dxlog_file5,
|
|
1015
|
-
L:
|
|
1050
|
+
L: 99,
|
|
1016
1051
|
S: this,
|
|
1017
1052
|
C: (f, a) => f(...a)
|
|
1018
1053
|
});
|
|
@@ -1036,7 +1071,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1036
1071
|
getSpaceRootDocHandle() {
|
|
1037
1072
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1038
1073
|
F: __dxlog_file5,
|
|
1039
|
-
L:
|
|
1074
|
+
L: 122,
|
|
1040
1075
|
S: this,
|
|
1041
1076
|
A: [
|
|
1042
1077
|
"this._spaceRootDocHandle",
|
|
@@ -1048,7 +1083,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1048
1083
|
createDocumentForObject(objectId) {
|
|
1049
1084
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1050
1085
|
F: __dxlog_file5,
|
|
1051
|
-
L:
|
|
1086
|
+
L: 127,
|
|
1052
1087
|
S: this,
|
|
1053
1088
|
A: [
|
|
1054
1089
|
"this._spaceRootDocHandle",
|
|
@@ -1091,7 +1126,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1091
1126
|
actualDocumentUrl: objectDocumentHandle.url
|
|
1092
1127
|
}, {
|
|
1093
1128
|
F: __dxlog_file5,
|
|
1094
|
-
L:
|
|
1129
|
+
L: 157,
|
|
1095
1130
|
S: this,
|
|
1096
1131
|
C: (f, a) => f(...a)
|
|
1097
1132
|
});
|
|
@@ -1100,7 +1135,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1100
1135
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
1101
1136
|
import_log4.log.warn("object document was already loaded", logMeta, {
|
|
1102
1137
|
F: __dxlog_file5,
|
|
1103
|
-
L:
|
|
1138
|
+
L: 164,
|
|
1104
1139
|
S: this,
|
|
1105
1140
|
C: (f, a) => f(...a)
|
|
1106
1141
|
});
|
|
@@ -1109,7 +1144,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1109
1144
|
const handle = this._repo.find(automergeUrl);
|
|
1110
1145
|
import_log4.log.debug("document loading triggered", logMeta, {
|
|
1111
1146
|
F: __dxlog_file5,
|
|
1112
|
-
L:
|
|
1147
|
+
L: 168,
|
|
1113
1148
|
S: this,
|
|
1114
1149
|
C: (f, a) => f(...a)
|
|
1115
1150
|
});
|
|
@@ -1121,7 +1156,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1121
1156
|
const docHandle = this._repo.find(url);
|
|
1122
1157
|
while (true) {
|
|
1123
1158
|
try {
|
|
1124
|
-
await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (
|
|
1159
|
+
await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (CoreDatabase)", async () => {
|
|
1125
1160
|
await (0, import_context4.cancelWithContext)(ctx, docHandle.whenReady());
|
|
1126
1161
|
});
|
|
1127
1162
|
break;
|
|
@@ -1132,7 +1167,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1132
1167
|
state: docHandle.state
|
|
1133
1168
|
}, {
|
|
1134
1169
|
F: __dxlog_file5,
|
|
1135
|
-
L:
|
|
1170
|
+
L: 184,
|
|
1136
1171
|
S: this,
|
|
1137
1172
|
C: (f, a) => f(...a)
|
|
1138
1173
|
});
|
|
@@ -1174,7 +1209,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1174
1209
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1175
1210
|
import_log4.log.info("document loaded after all listeners were removed", logMeta, {
|
|
1176
1211
|
F: __dxlog_file5,
|
|
1177
|
-
L:
|
|
1212
|
+
L: 220,
|
|
1178
1213
|
S: this,
|
|
1179
1214
|
C: (f, a) => f(...a)
|
|
1180
1215
|
});
|
|
@@ -1184,7 +1219,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1184
1219
|
if (objectDocHandle?.url !== handle.url) {
|
|
1185
1220
|
import_log4.log.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1186
1221
|
F: __dxlog_file5,
|
|
1187
|
-
L:
|
|
1222
|
+
L: 225,
|
|
1188
1223
|
S: this,
|
|
1189
1224
|
C: (f, a) => f(...a)
|
|
1190
1225
|
});
|
|
@@ -1203,7 +1238,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1203
1238
|
err
|
|
1204
1239
|
}, {
|
|
1205
1240
|
F: __dxlog_file5,
|
|
1206
|
-
L:
|
|
1241
|
+
L: 231,
|
|
1207
1242
|
S: this,
|
|
1208
1243
|
C: (f, a) => f(...a)
|
|
1209
1244
|
});
|
|
@@ -1270,7 +1305,9 @@ var MeshEchoReplicator = class {
|
|
|
1270
1305
|
""
|
|
1271
1306
|
]
|
|
1272
1307
|
});
|
|
1273
|
-
if (
|
|
1308
|
+
if (this._connectionsPerPeer.has(connection.peerId)) {
|
|
1309
|
+
this._context.onConnectionAuthScopeChanged(connection);
|
|
1310
|
+
} else {
|
|
1274
1311
|
this._connectionsPerPeer.set(connection.peerId, connection);
|
|
1275
1312
|
await connection.enable();
|
|
1276
1313
|
this._context.onConnectionOpen(connection);
|
|
@@ -1281,7 +1318,7 @@ var MeshEchoReplicator = class {
|
|
|
1281
1318
|
peerId: connection.peerId
|
|
1282
1319
|
}, {
|
|
1283
1320
|
F: __dxlog_file6,
|
|
1284
|
-
L:
|
|
1321
|
+
L: 71,
|
|
1285
1322
|
S: this,
|
|
1286
1323
|
C: (f, a) => f(...a)
|
|
1287
1324
|
});
|
|
@@ -1296,13 +1333,13 @@ var MeshEchoReplicator = class {
|
|
|
1296
1333
|
documentId: params.documentId
|
|
1297
1334
|
}, {
|
|
1298
1335
|
F: __dxlog_file6,
|
|
1299
|
-
L:
|
|
1336
|
+
L: 78,
|
|
1300
1337
|
S: this,
|
|
1301
1338
|
C: (f, a) => f(...a)
|
|
1302
1339
|
});
|
|
1303
1340
|
(0, import_invariant5.invariant)(this._context, void 0, {
|
|
1304
1341
|
F: __dxlog_file6,
|
|
1305
|
-
L:
|
|
1342
|
+
L: 79,
|
|
1306
1343
|
S: this,
|
|
1307
1344
|
A: [
|
|
1308
1345
|
"this._context",
|
|
@@ -1317,7 +1354,7 @@ var MeshEchoReplicator = class {
|
|
|
1317
1354
|
documentId: params.documentId
|
|
1318
1355
|
}, {
|
|
1319
1356
|
F: __dxlog_file6,
|
|
1320
|
-
L:
|
|
1357
|
+
L: 83,
|
|
1321
1358
|
S: this,
|
|
1322
1359
|
C: (f, a) => f(...a)
|
|
1323
1360
|
});
|
|
@@ -1330,7 +1367,7 @@ var MeshEchoReplicator = class {
|
|
|
1330
1367
|
documentId: params.documentId
|
|
1331
1368
|
}, {
|
|
1332
1369
|
F: __dxlog_file6,
|
|
1333
|
-
L:
|
|
1370
|
+
L: 93,
|
|
1334
1371
|
S: this,
|
|
1335
1372
|
C: (f, a) => f(...a)
|
|
1336
1373
|
});
|
|
@@ -1346,7 +1383,7 @@ var MeshEchoReplicator = class {
|
|
|
1346
1383
|
isAuthorized
|
|
1347
1384
|
}, {
|
|
1348
1385
|
F: __dxlog_file6,
|
|
1349
|
-
L:
|
|
1386
|
+
L: 101,
|
|
1350
1387
|
S: this,
|
|
1351
1388
|
C: (f, a) => f(...a)
|
|
1352
1389
|
});
|
|
@@ -1354,7 +1391,7 @@ var MeshEchoReplicator = class {
|
|
|
1354
1391
|
} catch (err) {
|
|
1355
1392
|
import_log5.log.catch(err, void 0, {
|
|
1356
1393
|
F: __dxlog_file6,
|
|
1357
|
-
L:
|
|
1394
|
+
L: 111,
|
|
1358
1395
|
S: this,
|
|
1359
1396
|
C: (f, a) => f(...a)
|
|
1360
1397
|
});
|
|
@@ -1371,7 +1408,7 @@ var MeshEchoReplicator = class {
|
|
|
1371
1408
|
deviceKey
|
|
1372
1409
|
}, {
|
|
1373
1410
|
F: __dxlog_file6,
|
|
1374
|
-
L:
|
|
1411
|
+
L: 122,
|
|
1375
1412
|
S: this,
|
|
1376
1413
|
C: (f, a) => f(...a)
|
|
1377
1414
|
});
|
|
@@ -1413,7 +1450,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1413
1450
|
remotePeerId: remotePeerId.toHex()
|
|
1414
1451
|
}, {
|
|
1415
1452
|
F: __dxlog_file6,
|
|
1416
|
-
L:
|
|
1453
|
+
L: 187,
|
|
1417
1454
|
S: this,
|
|
1418
1455
|
C: (f, a) => f(...a)
|
|
1419
1456
|
});
|
|
@@ -1437,7 +1474,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1437
1474
|
get peerId() {
|
|
1438
1475
|
(0, import_invariant5.invariant)(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1439
1476
|
F: __dxlog_file6,
|
|
1440
|
-
L:
|
|
1477
|
+
L: 210,
|
|
1441
1478
|
S: this,
|
|
1442
1479
|
A: [
|
|
1443
1480
|
"this._remotePeerId != null",
|
|
@@ -1456,7 +1493,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1456
1493
|
async enable() {
|
|
1457
1494
|
(0, import_invariant5.invariant)(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1458
1495
|
F: __dxlog_file6,
|
|
1459
|
-
L:
|
|
1496
|
+
L: 223,
|
|
1460
1497
|
S: this,
|
|
1461
1498
|
A: [
|
|
1462
1499
|
"this._remotePeerId != null",
|
|
@@ -1495,6 +1532,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1495
1532
|
SpaceProtocolSession,
|
|
1496
1533
|
TimeframeClock,
|
|
1497
1534
|
codec,
|
|
1535
|
+
createIdFromSpaceKey,
|
|
1498
1536
|
createMappedFeedWriter,
|
|
1499
1537
|
encodingOptions,
|
|
1500
1538
|
getSpaceKeyFromDoc,
|