@dxos/echo-pipeline 0.6.0 → 0.6.1-main.7c5f65a
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/index.mjs +110 -82
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +105 -79
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/automerge/automerge-host.d.ts +10 -9
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/heads-store.d.ts +13 -0
- package/dist/types/src/automerge/heads-store.d.ts.map +1 -0
- package/package.json +33 -33
- package/src/automerge/automerge-host.test.ts +34 -17
- package/src/automerge/automerge-host.ts +30 -12
- package/src/automerge/echo-network-adapter.ts +6 -2
- package/src/automerge/heads-store.ts +39 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -65,6 +65,7 @@ var import_automerge_repo2 = require("@dxos/automerge/automerge-repo");
|
|
|
65
65
|
var import_context2 = require("@dxos/context");
|
|
66
66
|
var import_invariant = require("@dxos/invariant");
|
|
67
67
|
var import_log = require("@dxos/log");
|
|
68
|
+
var import_indexing = require("@dxos/indexing");
|
|
68
69
|
var import_context3 = require("@dxos/context");
|
|
69
70
|
var import_async3 = require("@dxos/async");
|
|
70
71
|
var import_automerge_repo3 = require("@dxos/automerge/automerge-repo");
|
|
@@ -129,19 +130,13 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
129
130
|
disconnect() {
|
|
130
131
|
}
|
|
131
132
|
async open() {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
S: this,
|
|
136
|
-
A: [
|
|
137
|
-
"this._lifecycleState === LifecycleState.CLOSED",
|
|
138
|
-
""
|
|
139
|
-
]
|
|
140
|
-
});
|
|
133
|
+
if (this._lifecycleState === import_context2.LifecycleState.OPEN) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
141
136
|
this._lifecycleState = import_context2.LifecycleState.OPEN;
|
|
142
137
|
(0, import_log.log)("emit ready", void 0, {
|
|
143
138
|
F: __dxlog_file,
|
|
144
|
-
L:
|
|
139
|
+
L: 65,
|
|
145
140
|
S: this,
|
|
146
141
|
C: (f, a) => f(...a)
|
|
147
142
|
});
|
|
@@ -150,15 +145,9 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
150
145
|
});
|
|
151
146
|
}
|
|
152
147
|
async close() {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
S: this,
|
|
157
|
-
A: [
|
|
158
|
-
"this._lifecycleState === LifecycleState.OPEN",
|
|
159
|
-
""
|
|
160
|
-
]
|
|
161
|
-
});
|
|
148
|
+
if (this._lifecycleState === import_context2.LifecycleState.CLOSED) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
162
151
|
for (const replicator of this._replicators) {
|
|
163
152
|
await replicator.disconnect();
|
|
164
153
|
}
|
|
@@ -173,7 +162,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
173
162
|
async addReplicator(replicator) {
|
|
174
163
|
(0, import_invariant.invariant)(this._lifecycleState === import_context2.LifecycleState.OPEN, void 0, {
|
|
175
164
|
F: __dxlog_file,
|
|
176
|
-
L:
|
|
165
|
+
L: 91,
|
|
177
166
|
S: this,
|
|
178
167
|
A: [
|
|
179
168
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -182,7 +171,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
182
171
|
});
|
|
183
172
|
(0, import_invariant.invariant)(this.peerId, void 0, {
|
|
184
173
|
F: __dxlog_file,
|
|
185
|
-
L:
|
|
174
|
+
L: 92,
|
|
186
175
|
S: this,
|
|
187
176
|
A: [
|
|
188
177
|
"this.peerId",
|
|
@@ -191,7 +180,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
191
180
|
});
|
|
192
181
|
(0, import_invariant.invariant)(!this._replicators.has(replicator), void 0, {
|
|
193
182
|
F: __dxlog_file,
|
|
194
|
-
L:
|
|
183
|
+
L: 93,
|
|
195
184
|
S: this,
|
|
196
185
|
A: [
|
|
197
186
|
"!this._replicators.has(replicator)",
|
|
@@ -210,7 +199,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
210
199
|
async removeReplicator(replicator) {
|
|
211
200
|
(0, import_invariant.invariant)(this._lifecycleState === import_context2.LifecycleState.OPEN, void 0, {
|
|
212
201
|
F: __dxlog_file,
|
|
213
|
-
L:
|
|
202
|
+
L: 107,
|
|
214
203
|
S: this,
|
|
215
204
|
A: [
|
|
216
205
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -219,7 +208,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
219
208
|
});
|
|
220
209
|
(0, import_invariant.invariant)(this._replicators.has(replicator), void 0, {
|
|
221
210
|
F: __dxlog_file,
|
|
222
|
-
L:
|
|
211
|
+
L: 108,
|
|
223
212
|
S: this,
|
|
224
213
|
A: [
|
|
225
214
|
"this._replicators.has(replicator)",
|
|
@@ -241,13 +230,13 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
241
230
|
peerId: connection.peerId
|
|
242
231
|
}, {
|
|
243
232
|
F: __dxlog_file,
|
|
244
|
-
L:
|
|
233
|
+
L: 123,
|
|
245
234
|
S: this,
|
|
246
235
|
C: (f, a) => f(...a)
|
|
247
236
|
});
|
|
248
237
|
(0, import_invariant.invariant)(!this._connections.has(connection.peerId), void 0, {
|
|
249
238
|
F: __dxlog_file,
|
|
250
|
-
L:
|
|
239
|
+
L: 124,
|
|
251
240
|
S: this,
|
|
252
241
|
A: [
|
|
253
242
|
"!this._connections.has(connection.peerId as PeerId)",
|
|
@@ -276,7 +265,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
276
265
|
if (connectionEntry.isOpen) {
|
|
277
266
|
import_log.log.catch(err, void 0, {
|
|
278
267
|
F: __dxlog_file,
|
|
279
|
-
L:
|
|
268
|
+
L: 143,
|
|
280
269
|
S: this,
|
|
281
270
|
C: (f, a) => f(...a)
|
|
282
271
|
});
|
|
@@ -287,7 +276,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
287
276
|
peerId: connection.peerId
|
|
288
277
|
}, {
|
|
289
278
|
F: __dxlog_file,
|
|
290
|
-
L:
|
|
279
|
+
L: 148,
|
|
291
280
|
S: this,
|
|
292
281
|
C: (f, a) => f(...a)
|
|
293
282
|
});
|
|
@@ -302,14 +291,14 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
302
291
|
peerId: connection.peerId
|
|
303
292
|
}, {
|
|
304
293
|
F: __dxlog_file,
|
|
305
|
-
L:
|
|
294
|
+
L: 157,
|
|
306
295
|
S: this,
|
|
307
296
|
C: (f, a) => f(...a)
|
|
308
297
|
});
|
|
309
298
|
const entry = this._connections.get(connection.peerId);
|
|
310
299
|
(0, import_invariant.invariant)(entry, void 0, {
|
|
311
300
|
F: __dxlog_file,
|
|
312
|
-
L:
|
|
301
|
+
L: 159,
|
|
313
302
|
S: this,
|
|
314
303
|
A: [
|
|
315
304
|
"entry",
|
|
@@ -326,14 +315,14 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
326
315
|
peerId: connection.peerId
|
|
327
316
|
}, {
|
|
328
317
|
F: __dxlog_file,
|
|
329
|
-
L:
|
|
318
|
+
L: 165,
|
|
330
319
|
S: this,
|
|
331
320
|
C: (f, a) => f(...a)
|
|
332
321
|
});
|
|
333
322
|
const entry = this._connections.get(connection.peerId);
|
|
334
323
|
(0, import_invariant.invariant)(entry, void 0, {
|
|
335
324
|
F: __dxlog_file,
|
|
336
|
-
L:
|
|
325
|
+
L: 167,
|
|
337
326
|
S: this,
|
|
338
327
|
A: [
|
|
339
328
|
"entry",
|
|
@@ -346,13 +335,13 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
|
346
335
|
});
|
|
347
336
|
void entry.reader.cancel().catch((err) => import_log.log.catch(err, void 0, {
|
|
348
337
|
F: __dxlog_file,
|
|
349
|
-
L:
|
|
338
|
+
L: 172,
|
|
350
339
|
S: this,
|
|
351
340
|
C: (f, a) => f(...a)
|
|
352
341
|
}));
|
|
353
342
|
void entry.writer.abort().catch((err) => import_log.log.catch(err, void 0, {
|
|
354
343
|
F: __dxlog_file,
|
|
355
|
-
L:
|
|
344
|
+
L: 173,
|
|
356
345
|
S: this,
|
|
357
346
|
C: (f, a) => f(...a)
|
|
358
347
|
}));
|
|
@@ -382,6 +371,31 @@ var createEchoPeerMetadata = () => ({
|
|
|
382
371
|
dxos_peerSource: "EchoNetworkAdapter"
|
|
383
372
|
});
|
|
384
373
|
var isEchoPeerMetadata = (metadata) => metadata?.dxos_peerSource === "EchoNetworkAdapter";
|
|
374
|
+
var HeadsStore = class {
|
|
375
|
+
constructor({ db }) {
|
|
376
|
+
this._db = db;
|
|
377
|
+
}
|
|
378
|
+
setHeads(documentId, heads, batch) {
|
|
379
|
+
batch.put(documentId, heads, {
|
|
380
|
+
sublevel: this._db,
|
|
381
|
+
keyEncoding: "utf8",
|
|
382
|
+
valueEncoding: import_indexing.headsEncoding
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
async getHeads(documentId) {
|
|
386
|
+
try {
|
|
387
|
+
return await this._db.get(documentId, {
|
|
388
|
+
keyEncoding: "utf8",
|
|
389
|
+
valueEncoding: import_indexing.headsEncoding
|
|
390
|
+
});
|
|
391
|
+
} catch (err) {
|
|
392
|
+
if (err.notFound) {
|
|
393
|
+
return void 0;
|
|
394
|
+
}
|
|
395
|
+
throw err;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
};
|
|
385
399
|
var LevelDBStorageAdapter = class extends import_context3.Resource {
|
|
386
400
|
constructor(_params) {
|
|
387
401
|
super();
|
|
@@ -617,26 +631,25 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
617
631
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
618
632
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
619
633
|
}
|
|
620
|
-
var
|
|
621
|
-
var AutomergeHost = class {
|
|
634
|
+
var AutomergeHost = class extends import_context.Resource {
|
|
622
635
|
constructor({ db, indexMetadataStore }) {
|
|
623
|
-
|
|
624
|
-
F: __dxlog_file3,
|
|
625
|
-
L: 71
|
|
626
|
-
});
|
|
636
|
+
super();
|
|
627
637
|
this._echoNetworkAdapter = new EchoNetworkAdapter({
|
|
628
638
|
getContainingSpaceForDocument: this._getContainingSpaceForDocument.bind(this)
|
|
629
639
|
});
|
|
630
640
|
this._storage = new LevelDBStorageAdapter({
|
|
631
|
-
db,
|
|
641
|
+
db: db.sublevel("automerge"),
|
|
632
642
|
callbacks: {
|
|
633
643
|
beforeSave: async (params) => this._beforeSave(params),
|
|
634
644
|
afterSave: async () => this._afterSave()
|
|
635
645
|
}
|
|
636
646
|
});
|
|
647
|
+
this._headsStore = new HeadsStore({
|
|
648
|
+
db: db.sublevel("heads")
|
|
649
|
+
});
|
|
637
650
|
this._indexMetadataStore = indexMetadataStore;
|
|
638
651
|
}
|
|
639
|
-
async
|
|
652
|
+
async _open() {
|
|
640
653
|
this._peerId = `host-${import_keys.PublicKey.random().toHex()}`;
|
|
641
654
|
await this._storage.open?.();
|
|
642
655
|
this._clientNetwork = new LocalHostNetworkAdapter();
|
|
@@ -656,7 +669,7 @@ var AutomergeHost = class {
|
|
|
656
669
|
await this._clientNetwork.whenConnected();
|
|
657
670
|
await this._echoNetworkAdapter.whenConnected();
|
|
658
671
|
}
|
|
659
|
-
async
|
|
672
|
+
async _close() {
|
|
660
673
|
await this._storage.close?.();
|
|
661
674
|
await this._clientNetwork.close();
|
|
662
675
|
await this._echoNetworkAdapter.close();
|
|
@@ -736,7 +749,8 @@ var AutomergeHost = class {
|
|
|
736
749
|
return;
|
|
737
750
|
}
|
|
738
751
|
const spaceKey = getSpaceKeyFromDoc(doc) ?? void 0;
|
|
739
|
-
const
|
|
752
|
+
const heads = (0, import_automerge.getHeads)(doc);
|
|
753
|
+
this._headsStore.setHeads(handle.documentId, heads, batch);
|
|
740
754
|
const objectIds = Object.keys(doc.objects ?? {});
|
|
741
755
|
const encodedIds = objectIds.map((objectId) => import_protocols.objectPointerCodec.encode({
|
|
742
756
|
documentId: handle.documentId,
|
|
@@ -745,7 +759,7 @@ var AutomergeHost = class {
|
|
|
745
759
|
}));
|
|
746
760
|
const idToLastHash = new Map(encodedIds.map((id) => [
|
|
747
761
|
id,
|
|
748
|
-
|
|
762
|
+
heads
|
|
749
763
|
]));
|
|
750
764
|
this._indexMetadataStore.markDirty(idToLastHash, batch);
|
|
751
765
|
}
|
|
@@ -794,18 +808,30 @@ var AutomergeHost = class {
|
|
|
794
808
|
/**
|
|
795
809
|
* Flush documents to disk.
|
|
796
810
|
*/
|
|
797
|
-
async flush({ states }) {
|
|
811
|
+
async flush({ states } = {}) {
|
|
798
812
|
if (states) {
|
|
799
813
|
await Promise.all(states.map(async ({ heads, documentId }) => {
|
|
800
814
|
if (!heads) {
|
|
801
815
|
return;
|
|
802
816
|
}
|
|
803
|
-
const handle = this.
|
|
817
|
+
const handle = this._repo.handles[documentId] ?? this._repo.find(documentId);
|
|
804
818
|
await waitForHeads(handle, heads);
|
|
805
819
|
}) ?? []);
|
|
806
820
|
}
|
|
807
821
|
await this._repo.flush(states?.map(({ documentId }) => documentId));
|
|
808
822
|
}
|
|
823
|
+
async getHeads(documentId) {
|
|
824
|
+
const handle = this._repo.handles[documentId];
|
|
825
|
+
if (handle) {
|
|
826
|
+
const doc = handle.docSync();
|
|
827
|
+
if (!doc) {
|
|
828
|
+
return void 0;
|
|
829
|
+
}
|
|
830
|
+
return (0, import_automerge.getHeads)(doc);
|
|
831
|
+
} else {
|
|
832
|
+
return this._headsStore.getHeads(documentId);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
809
835
|
/**
|
|
810
836
|
* Host <-> Client sync.
|
|
811
837
|
*/
|
|
@@ -881,7 +907,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
881
907
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
882
908
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
883
909
|
}
|
|
884
|
-
var
|
|
910
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
885
911
|
var AutomergeDocumentLoaderImpl = class {
|
|
886
912
|
constructor(_spaceId, _repo, _spaceKey) {
|
|
887
913
|
this._spaceId = _spaceId;
|
|
@@ -908,7 +934,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
908
934
|
const existingDocHandle = await this._initDocHandle(ctx, spaceState.rootUrl);
|
|
909
935
|
const doc = existingDocHandle.docSync();
|
|
910
936
|
(0, import_invariant3.invariant)(doc, void 0, {
|
|
911
|
-
F:
|
|
937
|
+
F: __dxlog_file3,
|
|
912
938
|
L: 84,
|
|
913
939
|
S: this,
|
|
914
940
|
A: [
|
|
@@ -917,7 +943,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
917
943
|
]
|
|
918
944
|
});
|
|
919
945
|
(0, import_invariant3.invariant)(doc.version === import_echo_protocol.SpaceDocVersion.CURRENT, void 0, {
|
|
920
|
-
F:
|
|
946
|
+
F: __dxlog_file3,
|
|
921
947
|
L: 85,
|
|
922
948
|
S: this,
|
|
923
949
|
A: [
|
|
@@ -938,7 +964,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
938
964
|
const urlsToLoad = {};
|
|
939
965
|
for (const objectId of objectIds) {
|
|
940
966
|
(0, import_invariant3.invariant)(this._spaceRootDocHandle, void 0, {
|
|
941
|
-
F:
|
|
967
|
+
F: __dxlog_file3,
|
|
942
968
|
L: 97,
|
|
943
969
|
S: this,
|
|
944
970
|
A: [
|
|
@@ -951,7 +977,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
951
977
|
}
|
|
952
978
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
953
979
|
(0, import_invariant3.invariant)(spaceRootDoc, void 0, {
|
|
954
|
-
F:
|
|
980
|
+
F: __dxlog_file3,
|
|
955
981
|
L: 102,
|
|
956
982
|
S: this,
|
|
957
983
|
A: [
|
|
@@ -965,7 +991,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
965
991
|
import_log2.log.info("loading delayed until object links are initialized", {
|
|
966
992
|
objectId
|
|
967
993
|
}, {
|
|
968
|
-
F:
|
|
994
|
+
F: __dxlog_file3,
|
|
969
995
|
L: 106,
|
|
970
996
|
S: this,
|
|
971
997
|
C: (f, a) => f(...a)
|
|
@@ -981,7 +1007,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
981
1007
|
}
|
|
982
1008
|
getObjectDocumentId(objectId) {
|
|
983
1009
|
(0, import_invariant3.invariant)(this._spaceRootDocHandle, void 0, {
|
|
984
|
-
F:
|
|
1010
|
+
F: __dxlog_file3,
|
|
985
1011
|
L: 118,
|
|
986
1012
|
S: this,
|
|
987
1013
|
A: [
|
|
@@ -991,7 +1017,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
991
1017
|
});
|
|
992
1018
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
993
1019
|
(0, import_invariant3.invariant)(spaceRootDoc, void 0, {
|
|
994
|
-
F:
|
|
1020
|
+
F: __dxlog_file3,
|
|
995
1021
|
L: 120,
|
|
996
1022
|
S: this,
|
|
997
1023
|
A: [
|
|
@@ -1015,7 +1041,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1015
1041
|
}
|
|
1016
1042
|
getSpaceRootDocHandle() {
|
|
1017
1043
|
(0, import_invariant3.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1018
|
-
F:
|
|
1044
|
+
F: __dxlog_file3,
|
|
1019
1045
|
L: 140,
|
|
1020
1046
|
S: this,
|
|
1021
1047
|
A: [
|
|
@@ -1027,7 +1053,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1027
1053
|
}
|
|
1028
1054
|
createDocumentForObject(objectId) {
|
|
1029
1055
|
(0, import_invariant3.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1030
|
-
F:
|
|
1056
|
+
F: __dxlog_file3,
|
|
1031
1057
|
L: 145,
|
|
1032
1058
|
S: this,
|
|
1033
1059
|
A: [
|
|
@@ -1072,7 +1098,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1072
1098
|
...logMeta,
|
|
1073
1099
|
actualDocumentUrl: objectDocumentHandle.url
|
|
1074
1100
|
}, {
|
|
1075
|
-
F:
|
|
1101
|
+
F: __dxlog_file3,
|
|
1076
1102
|
L: 177,
|
|
1077
1103
|
S: this,
|
|
1078
1104
|
C: (f, a) => f(...a)
|
|
@@ -1081,7 +1107,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1081
1107
|
}
|
|
1082
1108
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
1083
1109
|
import_log2.log.warn("object document was already loaded", logMeta, {
|
|
1084
|
-
F:
|
|
1110
|
+
F: __dxlog_file3,
|
|
1085
1111
|
L: 184,
|
|
1086
1112
|
S: this,
|
|
1087
1113
|
C: (f, a) => f(...a)
|
|
@@ -1090,7 +1116,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1090
1116
|
}
|
|
1091
1117
|
const handle = this._repo.find(automergeUrl);
|
|
1092
1118
|
import_log2.log.debug("document loading triggered", logMeta, {
|
|
1093
|
-
F:
|
|
1119
|
+
F: __dxlog_file3,
|
|
1094
1120
|
L: 188,
|
|
1095
1121
|
S: this,
|
|
1096
1122
|
C: (f, a) => f(...a)
|
|
@@ -1113,7 +1139,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1113
1139
|
id: docHandle.documentId,
|
|
1114
1140
|
state: docHandle.state
|
|
1115
1141
|
}, {
|
|
1116
|
-
F:
|
|
1142
|
+
F: __dxlog_file3,
|
|
1117
1143
|
L: 204,
|
|
1118
1144
|
S: this,
|
|
1119
1145
|
C: (f, a) => f(...a)
|
|
@@ -1147,7 +1173,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1147
1173
|
};
|
|
1148
1174
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1149
1175
|
import_log2.log.info("document loaded after all listeners were removed", logMeta, {
|
|
1150
|
-
F:
|
|
1176
|
+
F: __dxlog_file3,
|
|
1151
1177
|
L: 231,
|
|
1152
1178
|
S: this,
|
|
1153
1179
|
C: (f, a) => f(...a)
|
|
@@ -1157,7 +1183,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1157
1183
|
const objectDocHandle = this._objectDocumentHandles.get(objectId);
|
|
1158
1184
|
if (objectDocHandle?.url !== handle.url) {
|
|
1159
1185
|
import_log2.log.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1160
|
-
F:
|
|
1186
|
+
F: __dxlog_file3,
|
|
1161
1187
|
L: 236,
|
|
1162
1188
|
S: this,
|
|
1163
1189
|
C: (f, a) => f(...a)
|
|
@@ -1176,7 +1202,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1176
1202
|
retryLoading: shouldRetryLoading,
|
|
1177
1203
|
err
|
|
1178
1204
|
}, {
|
|
1179
|
-
F:
|
|
1205
|
+
F: __dxlog_file3,
|
|
1180
1206
|
L: 242,
|
|
1181
1207
|
S: this,
|
|
1182
1208
|
C: (f, a) => f(...a)
|
|
@@ -1195,7 +1221,7 @@ _ts_decorate3([
|
|
|
1195
1221
|
AutomergeDocumentLoaderImpl = _ts_decorate3([
|
|
1196
1222
|
import_tracing2.trace.resource()
|
|
1197
1223
|
], AutomergeDocumentLoaderImpl);
|
|
1198
|
-
var
|
|
1224
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator.ts";
|
|
1199
1225
|
var MeshEchoReplicator = class {
|
|
1200
1226
|
constructor() {
|
|
1201
1227
|
this._connections = /* @__PURE__ */ new Set();
|
|
@@ -1216,7 +1242,7 @@ var MeshEchoReplicator = class {
|
|
|
1216
1242
|
}
|
|
1217
1243
|
createExtension() {
|
|
1218
1244
|
(0, import_invariant4.invariant)(this._context, void 0, {
|
|
1219
|
-
F:
|
|
1245
|
+
F: __dxlog_file4,
|
|
1220
1246
|
L: 54,
|
|
1221
1247
|
S: this,
|
|
1222
1248
|
A: [
|
|
@@ -1230,13 +1256,13 @@ var MeshEchoReplicator = class {
|
|
|
1230
1256
|
(0, import_log3.log)("onRemoteConnected", {
|
|
1231
1257
|
peerId: connection.peerId
|
|
1232
1258
|
}, {
|
|
1233
|
-
F:
|
|
1259
|
+
F: __dxlog_file4,
|
|
1234
1260
|
L: 59,
|
|
1235
1261
|
S: this,
|
|
1236
1262
|
C: (f, a) => f(...a)
|
|
1237
1263
|
});
|
|
1238
1264
|
(0, import_invariant4.invariant)(this._context, void 0, {
|
|
1239
|
-
F:
|
|
1265
|
+
F: __dxlog_file4,
|
|
1240
1266
|
L: 60,
|
|
1241
1267
|
S: this,
|
|
1242
1268
|
A: [
|
|
@@ -1256,7 +1282,7 @@ var MeshEchoReplicator = class {
|
|
|
1256
1282
|
(0, import_log3.log)("onRemoteDisconnected", {
|
|
1257
1283
|
peerId: connection.peerId
|
|
1258
1284
|
}, {
|
|
1259
|
-
F:
|
|
1285
|
+
F: __dxlog_file4,
|
|
1260
1286
|
L: 71,
|
|
1261
1287
|
S: this,
|
|
1262
1288
|
C: (f, a) => f(...a)
|
|
@@ -1271,13 +1297,13 @@ var MeshEchoReplicator = class {
|
|
|
1271
1297
|
peerId: connection.peerId,
|
|
1272
1298
|
documentId: params.documentId
|
|
1273
1299
|
}, {
|
|
1274
|
-
F:
|
|
1300
|
+
F: __dxlog_file4,
|
|
1275
1301
|
L: 78,
|
|
1276
1302
|
S: this,
|
|
1277
1303
|
C: (f, a) => f(...a)
|
|
1278
1304
|
});
|
|
1279
1305
|
(0, import_invariant4.invariant)(this._context, void 0, {
|
|
1280
|
-
F:
|
|
1306
|
+
F: __dxlog_file4,
|
|
1281
1307
|
L: 79,
|
|
1282
1308
|
S: this,
|
|
1283
1309
|
A: [
|
|
@@ -1292,7 +1318,7 @@ var MeshEchoReplicator = class {
|
|
|
1292
1318
|
peerId: connection.peerId,
|
|
1293
1319
|
documentId: params.documentId
|
|
1294
1320
|
}, {
|
|
1295
|
-
F:
|
|
1321
|
+
F: __dxlog_file4,
|
|
1296
1322
|
L: 83,
|
|
1297
1323
|
S: this,
|
|
1298
1324
|
C: (f, a) => f(...a)
|
|
@@ -1305,7 +1331,7 @@ var MeshEchoReplicator = class {
|
|
|
1305
1331
|
peerId: connection.peerId,
|
|
1306
1332
|
documentId: params.documentId
|
|
1307
1333
|
}, {
|
|
1308
|
-
F:
|
|
1334
|
+
F: __dxlog_file4,
|
|
1309
1335
|
L: 93,
|
|
1310
1336
|
S: this,
|
|
1311
1337
|
C: (f, a) => f(...a)
|
|
@@ -1321,7 +1347,7 @@ var MeshEchoReplicator = class {
|
|
|
1321
1347
|
spaceKey,
|
|
1322
1348
|
isAuthorized
|
|
1323
1349
|
}, {
|
|
1324
|
-
F:
|
|
1350
|
+
F: __dxlog_file4,
|
|
1325
1351
|
L: 101,
|
|
1326
1352
|
S: this,
|
|
1327
1353
|
C: (f, a) => f(...a)
|
|
@@ -1329,7 +1355,7 @@ var MeshEchoReplicator = class {
|
|
|
1329
1355
|
return isAuthorized;
|
|
1330
1356
|
} catch (err) {
|
|
1331
1357
|
import_log3.log.catch(err, void 0, {
|
|
1332
|
-
F:
|
|
1358
|
+
F: __dxlog_file4,
|
|
1333
1359
|
L: 111,
|
|
1334
1360
|
S: this,
|
|
1335
1361
|
C: (f, a) => f(...a)
|
|
@@ -1346,7 +1372,7 @@ var MeshEchoReplicator = class {
|
|
|
1346
1372
|
spaceKey,
|
|
1347
1373
|
deviceKey
|
|
1348
1374
|
}, {
|
|
1349
|
-
F:
|
|
1375
|
+
F: __dxlog_file4,
|
|
1350
1376
|
L: 122,
|
|
1351
1377
|
S: this,
|
|
1352
1378
|
C: (f, a) => f(...a)
|
|
@@ -1393,7 +1419,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1393
1419
|
thisPeerId: this.peerId,
|
|
1394
1420
|
remotePeerId: remotePeerId.toHex()
|
|
1395
1421
|
}, {
|
|
1396
|
-
F:
|
|
1422
|
+
F: __dxlog_file4,
|
|
1397
1423
|
L: 192,
|
|
1398
1424
|
S: this,
|
|
1399
1425
|
C: (f, a) => f(...a)
|
|
@@ -1417,7 +1443,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1417
1443
|
}
|
|
1418
1444
|
get peerId() {
|
|
1419
1445
|
(0, import_invariant4.invariant)(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1420
|
-
F:
|
|
1446
|
+
F: __dxlog_file4,
|
|
1421
1447
|
L: 215,
|
|
1422
1448
|
S: this,
|
|
1423
1449
|
A: [
|
|
@@ -1436,7 +1462,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1436
1462
|
*/
|
|
1437
1463
|
async enable() {
|
|
1438
1464
|
(0, import_invariant4.invariant)(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1439
|
-
F:
|
|
1465
|
+
F: __dxlog_file4,
|
|
1440
1466
|
L: 228,
|
|
1441
1467
|
S: this,
|
|
1442
1468
|
A: [
|