@dxos/echo-pipeline 0.6.2-main.d41f0d2 → 0.6.2-main.e09770c
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-SJUDZ3CQ.mjs → chunk-UJQ5VS5V.mjs} +7 -17
- package/dist/lib/browser/chunk-UJQ5VS5V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +71 -573
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-NLHNTXVQ.cjs → chunk-RH6TDRML.cjs} +10 -20
- package/dist/lib/node/chunk-RH6TDRML.cjs.map +7 -0
- package/dist/lib/node/index.cjs +93 -593
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +11 -11
- package/dist/types/src/automerge/automerge-host.d.ts +2 -17
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +1 -1
- package/dist/types/src/automerge/index.d.ts +0 -2
- 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/dist/types/src/db-host/data-service.d.ts +2 -5
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-host.ts +6 -56
- package/src/automerge/automerge-repo.test.ts +124 -1
- package/src/automerge/echo-network-adapter.test.ts +11 -0
- package/src/automerge/echo-network-adapter.ts +1 -1
- package/src/automerge/index.ts +0 -2
- package/src/automerge/mesh-echo-replicator.ts +3 -0
- package/src/db-host/data-service.ts +3 -20
- package/src/db-host/documents-synchronizer.test.ts +1 -1
- package/src/db-host/documents-synchronizer.ts +1 -1
- package/dist/lib/browser/chunk-SJUDZ3CQ.mjs.map +0 -7
- package/dist/lib/node/chunk-NLHNTXVQ.cjs.map +0 -7
- package/dist/types/src/automerge/automerge-doc-loader.d.ts +0 -71
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge-doc-loader.test.d.ts +0 -2
- package/dist/types/src/automerge/automerge-doc-loader.test.d.ts.map +0 -1
- package/dist/types/src/automerge/local-host-network-adapter.d.ts +0 -30
- package/dist/types/src/automerge/local-host-network-adapter.d.ts.map +0 -1
- package/src/automerge/automerge-doc-loader.test.ts +0 -103
- package/src/automerge/automerge-doc-loader.ts +0 -267
- package/src/automerge/local-host-network-adapter.ts +0 -115
|
@@ -26,14 +26,14 @@ import {
|
|
|
26
26
|
mapTimeframeToFeedIndexes,
|
|
27
27
|
startAfter,
|
|
28
28
|
valueEncoding
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-UJQ5VS5V.mjs";
|
|
30
30
|
|
|
31
31
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts
|
|
32
32
|
import { Event, asyncTimeout } from "@dxos/async";
|
|
33
|
-
import { next as automerge, getBackend, getHeads, isAutomerge,
|
|
33
|
+
import { next as automerge, getBackend, getHeads, isAutomerge, equals as headsEquals, save } from "@dxos/automerge/automerge";
|
|
34
34
|
import { Repo } from "@dxos/automerge/automerge-repo";
|
|
35
35
|
import { Context, Resource as Resource2, cancelWithContext } from "@dxos/context";
|
|
36
|
-
import { invariant as
|
|
36
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
37
37
|
import { PublicKey } from "@dxos/keys";
|
|
38
38
|
import { log as log2 } from "@dxos/log";
|
|
39
39
|
import { objectPointerCodec } from "@dxos/protocols";
|
|
@@ -106,7 +106,7 @@ var EchoNetworkAdapter = class extends NetworkAdapter {
|
|
|
106
106
|
}
|
|
107
107
|
async close() {
|
|
108
108
|
if (this._lifecycleState === LifecycleState.CLOSED) {
|
|
109
|
-
return;
|
|
109
|
+
return this;
|
|
110
110
|
}
|
|
111
111
|
for (const replicator of this._replicators) {
|
|
112
112
|
await replicator.disconnect();
|
|
@@ -456,144 +456,6 @@ var encodingOptions = {
|
|
|
456
456
|
};
|
|
457
457
|
var isLevelDbNotFoundError = (err) => err.code === "LEVEL_NOT_FOUND";
|
|
458
458
|
|
|
459
|
-
// packages/core/echo/echo-pipeline/src/automerge/local-host-network-adapter.ts
|
|
460
|
-
import { Trigger as Trigger2 } from "@dxos/async";
|
|
461
|
-
import { NetworkAdapter as NetworkAdapter2, cbor } from "@dxos/automerge/automerge-repo";
|
|
462
|
-
import { Stream } from "@dxos/codec-protobuf";
|
|
463
|
-
import { invariant as invariant2 } from "@dxos/invariant";
|
|
464
|
-
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/local-host-network-adapter.ts";
|
|
465
|
-
var LocalHostNetworkAdapter = class extends NetworkAdapter2 {
|
|
466
|
-
constructor() {
|
|
467
|
-
super(...arguments);
|
|
468
|
-
this._peers = /* @__PURE__ */ new Map();
|
|
469
|
-
this._connected = new Trigger2();
|
|
470
|
-
this._isConnected = false;
|
|
471
|
-
}
|
|
472
|
-
/**
|
|
473
|
-
* Emits `ready` event. That signals to `Repo` that it can start using the adapter.
|
|
474
|
-
*/
|
|
475
|
-
ready() {
|
|
476
|
-
this.emit("ready", {
|
|
477
|
-
network: this
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
* Called by `Repo` to connect to the network.
|
|
482
|
-
*
|
|
483
|
-
* @param peerId Our peer Id.
|
|
484
|
-
*/
|
|
485
|
-
connect(peerId) {
|
|
486
|
-
this.peerId = peerId;
|
|
487
|
-
this._isConnected = true;
|
|
488
|
-
this._connected.wake();
|
|
489
|
-
}
|
|
490
|
-
send(message) {
|
|
491
|
-
const peer = this._peers.get(message.targetId);
|
|
492
|
-
invariant2(peer, "Peer not found.", {
|
|
493
|
-
F: __dxlog_file2,
|
|
494
|
-
L: 51,
|
|
495
|
-
S: this,
|
|
496
|
-
A: [
|
|
497
|
-
"peer",
|
|
498
|
-
"'Peer not found.'"
|
|
499
|
-
]
|
|
500
|
-
});
|
|
501
|
-
peer.send(message);
|
|
502
|
-
}
|
|
503
|
-
async close() {
|
|
504
|
-
this._peers.forEach((peer) => peer.disconnect());
|
|
505
|
-
this.emit("close");
|
|
506
|
-
}
|
|
507
|
-
disconnect() {
|
|
508
|
-
}
|
|
509
|
-
async whenConnected() {
|
|
510
|
-
await this._connected.wait({
|
|
511
|
-
timeout: 1e4
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
syncRepo({ id, syncMessage }) {
|
|
515
|
-
const peerId = this._getPeerId(id);
|
|
516
|
-
return new Stream(({ next, close }) => {
|
|
517
|
-
invariant2(!this._peers.has(peerId), "Peer already connected.", {
|
|
518
|
-
F: __dxlog_file2,
|
|
519
|
-
L: 73,
|
|
520
|
-
S: this,
|
|
521
|
-
A: [
|
|
522
|
-
"!this._peers.has(peerId)",
|
|
523
|
-
"'Peer already connected.'"
|
|
524
|
-
]
|
|
525
|
-
});
|
|
526
|
-
this._peers.set(peerId, {
|
|
527
|
-
connected: true,
|
|
528
|
-
send: (message) => {
|
|
529
|
-
next({
|
|
530
|
-
syncMessage: cbor.encode(message)
|
|
531
|
-
});
|
|
532
|
-
},
|
|
533
|
-
disconnect: () => {
|
|
534
|
-
this._peers.delete(peerId);
|
|
535
|
-
close();
|
|
536
|
-
this.emit("peer-disconnected", {
|
|
537
|
-
peerId
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
invariant2(this._isConnected, void 0, {
|
|
542
|
-
F: __dxlog_file2,
|
|
543
|
-
L: 90,
|
|
544
|
-
S: this,
|
|
545
|
-
A: [
|
|
546
|
-
"this._isConnected",
|
|
547
|
-
""
|
|
548
|
-
]
|
|
549
|
-
});
|
|
550
|
-
this.emit("peer-candidate", {
|
|
551
|
-
peerMetadata: {},
|
|
552
|
-
peerId
|
|
553
|
-
});
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
async sendSyncMessage({ id, syncMessage }) {
|
|
557
|
-
invariant2(this._isConnected, void 0, {
|
|
558
|
-
F: __dxlog_file2,
|
|
559
|
-
L: 99,
|
|
560
|
-
S: this,
|
|
561
|
-
A: [
|
|
562
|
-
"this._isConnected",
|
|
563
|
-
""
|
|
564
|
-
]
|
|
565
|
-
});
|
|
566
|
-
const message = cbor.decode(syncMessage);
|
|
567
|
-
this.emit("message", message);
|
|
568
|
-
}
|
|
569
|
-
async getHostInfo() {
|
|
570
|
-
invariant2(this._isConnected, void 0, {
|
|
571
|
-
F: __dxlog_file2,
|
|
572
|
-
L: 105,
|
|
573
|
-
S: this,
|
|
574
|
-
A: [
|
|
575
|
-
"this._isConnected",
|
|
576
|
-
""
|
|
577
|
-
]
|
|
578
|
-
});
|
|
579
|
-
invariant2(this.peerId, "Peer id not set.", {
|
|
580
|
-
F: __dxlog_file2,
|
|
581
|
-
L: 106,
|
|
582
|
-
S: this,
|
|
583
|
-
A: [
|
|
584
|
-
"this.peerId",
|
|
585
|
-
"'Peer id not set.'"
|
|
586
|
-
]
|
|
587
|
-
});
|
|
588
|
-
return {
|
|
589
|
-
peerId: this.peerId
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
_getPeerId(id) {
|
|
593
|
-
return id;
|
|
594
|
-
}
|
|
595
|
-
};
|
|
596
|
-
|
|
597
459
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts
|
|
598
460
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
599
461
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -605,7 +467,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
605
467
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
606
468
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
607
469
|
}
|
|
608
|
-
var
|
|
470
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
|
|
609
471
|
var AutomergeHost = class extends Resource2 {
|
|
610
472
|
constructor({ db, indexMetadataStore }) {
|
|
611
473
|
super();
|
|
@@ -628,26 +490,20 @@ var AutomergeHost = class extends Resource2 {
|
|
|
628
490
|
async _open() {
|
|
629
491
|
this._peerId = `host-${PublicKey.random().toHex()}`;
|
|
630
492
|
await this._storage.open?.();
|
|
631
|
-
this._clientNetwork = new LocalHostNetworkAdapter();
|
|
632
493
|
this._repo = new Repo({
|
|
633
494
|
peerId: this._peerId,
|
|
634
495
|
sharePolicy: this._sharePolicy.bind(this),
|
|
635
496
|
storage: this._storage,
|
|
636
497
|
network: [
|
|
637
|
-
// Downstream client.
|
|
638
|
-
this._clientNetwork,
|
|
639
498
|
// Upstream swarm.
|
|
640
499
|
this._echoNetworkAdapter
|
|
641
500
|
]
|
|
642
501
|
});
|
|
643
|
-
this._clientNetwork.ready();
|
|
644
502
|
await this._echoNetworkAdapter.open();
|
|
645
|
-
await this._clientNetwork.whenConnected();
|
|
646
503
|
await this._echoNetworkAdapter.whenConnected();
|
|
647
504
|
}
|
|
648
505
|
async _close() {
|
|
649
506
|
await this._storage.close?.();
|
|
650
|
-
await this._clientNetwork.close();
|
|
651
507
|
await this._echoNetworkAdapter.close();
|
|
652
508
|
await this._ctx.dispose();
|
|
653
509
|
}
|
|
@@ -709,8 +565,8 @@ var AutomergeHost = class extends Resource2 {
|
|
|
709
565
|
return;
|
|
710
566
|
}
|
|
711
567
|
const handle = await this.loadDoc(Context.default(void 0, {
|
|
712
|
-
F:
|
|
713
|
-
L:
|
|
568
|
+
F: __dxlog_file2,
|
|
569
|
+
L: 189
|
|
714
570
|
}), documentId);
|
|
715
571
|
await waitForHeads(handle, heads2);
|
|
716
572
|
}) ?? []);
|
|
@@ -721,8 +577,8 @@ var AutomergeHost = class extends Resource2 {
|
|
|
721
577
|
log2.info("re-indexing heads for document", {
|
|
722
578
|
documentId
|
|
723
579
|
}, {
|
|
724
|
-
F:
|
|
725
|
-
L:
|
|
580
|
+
F: __dxlog_file2,
|
|
581
|
+
L: 200,
|
|
726
582
|
S: this,
|
|
727
583
|
C: (f, a) => f(...a)
|
|
728
584
|
});
|
|
@@ -737,17 +593,17 @@ var AutomergeHost = class extends Resource2 {
|
|
|
737
593
|
log2.warn("document is not available locally, skipping", {
|
|
738
594
|
documentId
|
|
739
595
|
}, {
|
|
740
|
-
F:
|
|
741
|
-
L:
|
|
596
|
+
F: __dxlog_file2,
|
|
597
|
+
L: 204,
|
|
742
598
|
S: this,
|
|
743
599
|
C: (f, a) => f(...a)
|
|
744
600
|
});
|
|
745
601
|
continue;
|
|
746
602
|
}
|
|
747
603
|
const doc = handle.docSync();
|
|
748
|
-
|
|
749
|
-
F:
|
|
750
|
-
L:
|
|
604
|
+
invariant2(doc, void 0, {
|
|
605
|
+
F: __dxlog_file2,
|
|
606
|
+
L: 209,
|
|
751
607
|
S: this,
|
|
752
608
|
A: [
|
|
753
609
|
"doc",
|
|
@@ -760,8 +616,8 @@ var AutomergeHost = class extends Resource2 {
|
|
|
760
616
|
await batch.write();
|
|
761
617
|
}
|
|
762
618
|
log2.info("done re-indexing heads", void 0, {
|
|
763
|
-
F:
|
|
764
|
-
L:
|
|
619
|
+
F: __dxlog_file2,
|
|
620
|
+
L: 216,
|
|
765
621
|
S: this,
|
|
766
622
|
C: (f, a) => f(...a)
|
|
767
623
|
});
|
|
@@ -854,17 +710,8 @@ var AutomergeHost = class extends Resource2 {
|
|
|
854
710
|
/**
|
|
855
711
|
* Flush documents to disk.
|
|
856
712
|
*/
|
|
857
|
-
async flush({
|
|
858
|
-
|
|
859
|
-
await Promise.all(states.map(async ({ heads, documentId }) => {
|
|
860
|
-
if (!heads) {
|
|
861
|
-
return;
|
|
862
|
-
}
|
|
863
|
-
const handle = this._repo.handles[documentId] ?? this._repo.find(documentId);
|
|
864
|
-
await waitForHeads(handle, heads);
|
|
865
|
-
}) ?? []);
|
|
866
|
-
}
|
|
867
|
-
await this._repo.flush(states?.map(({ documentId }) => documentId));
|
|
713
|
+
async flush({ documentIds } = {}) {
|
|
714
|
+
await this._repo.flush(documentIds);
|
|
868
715
|
}
|
|
869
716
|
async getHeads(documentId) {
|
|
870
717
|
const handle = this._repo.handles[documentId];
|
|
@@ -878,24 +725,6 @@ var AutomergeHost = class extends Resource2 {
|
|
|
878
725
|
return this._headsStore.getHeads(documentId);
|
|
879
726
|
}
|
|
880
727
|
}
|
|
881
|
-
/**
|
|
882
|
-
* Host <-> Client sync.
|
|
883
|
-
*/
|
|
884
|
-
syncRepo(request) {
|
|
885
|
-
return this._clientNetwork.syncRepo(request);
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* Host <-> Client sync.
|
|
889
|
-
*/
|
|
890
|
-
sendSyncMessage(request) {
|
|
891
|
-
return this._clientNetwork.sendSyncMessage(request);
|
|
892
|
-
}
|
|
893
|
-
/**
|
|
894
|
-
* Host <-> Client sync.
|
|
895
|
-
*/
|
|
896
|
-
async getHostInfo() {
|
|
897
|
-
return this._clientNetwork.getHostInfo();
|
|
898
|
-
}
|
|
899
728
|
};
|
|
900
729
|
_ts_decorate2([
|
|
901
730
|
trace.info()
|
|
@@ -941,351 +770,19 @@ var changeIsPresentInDoc = (doc, changeHash) => {
|
|
|
941
770
|
return !!getBackend(doc).getChangeByHash(changeHash);
|
|
942
771
|
};
|
|
943
772
|
|
|
944
|
-
// packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts
|
|
945
|
-
import { Event as Event2 } from "@dxos/async";
|
|
946
|
-
import { interpretAsDocumentId } from "@dxos/automerge/automerge-repo";
|
|
947
|
-
import { cancelWithContext as cancelWithContext2 } from "@dxos/context";
|
|
948
|
-
import { warnAfterTimeout } from "@dxos/debug";
|
|
949
|
-
import { SpaceDocVersion } from "@dxos/echo-protocol";
|
|
950
|
-
import { invariant as invariant4 } from "@dxos/invariant";
|
|
951
|
-
import { log as log3 } from "@dxos/log";
|
|
952
|
-
import { trace as trace2 } from "@dxos/tracing";
|
|
953
|
-
function _ts_decorate3(decorators, target, key, desc) {
|
|
954
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
955
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
956
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
957
|
-
else
|
|
958
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
959
|
-
if (d = decorators[i])
|
|
960
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
961
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
962
|
-
}
|
|
963
|
-
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
964
|
-
var AutomergeDocumentLoaderImpl = class {
|
|
965
|
-
constructor(_spaceId, _repo, _spaceKey) {
|
|
966
|
-
this._spaceId = _spaceId;
|
|
967
|
-
this._repo = _repo;
|
|
968
|
-
this._spaceKey = _spaceKey;
|
|
969
|
-
this._spaceRootDocHandle = null;
|
|
970
|
-
this._objectDocumentHandles = /* @__PURE__ */ new Map();
|
|
971
|
-
this._objectsPendingDocumentLoad = /* @__PURE__ */ new Set();
|
|
972
|
-
this.onObjectDocumentLoaded = new Event2();
|
|
973
|
-
}
|
|
974
|
-
getAllHandles() {
|
|
975
|
-
return this._spaceRootDocHandle != null ? [
|
|
976
|
-
this._spaceRootDocHandle,
|
|
977
|
-
...new Set(this._objectDocumentHandles.values())
|
|
978
|
-
] : [];
|
|
979
|
-
}
|
|
980
|
-
async loadSpaceRootDocHandle(ctx, spaceState) {
|
|
981
|
-
if (this._spaceRootDocHandle != null) {
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
if (!spaceState.rootUrl) {
|
|
985
|
-
throw new Error("Database opened with no rootUrl");
|
|
986
|
-
}
|
|
987
|
-
const existingDocHandle = await this._initDocHandle(ctx, spaceState.rootUrl);
|
|
988
|
-
const doc = existingDocHandle.docSync();
|
|
989
|
-
invariant4(doc, void 0, {
|
|
990
|
-
F: __dxlog_file4,
|
|
991
|
-
L: 84,
|
|
992
|
-
S: this,
|
|
993
|
-
A: [
|
|
994
|
-
"doc",
|
|
995
|
-
""
|
|
996
|
-
]
|
|
997
|
-
});
|
|
998
|
-
invariant4(doc.version === SpaceDocVersion.CURRENT, void 0, {
|
|
999
|
-
F: __dxlog_file4,
|
|
1000
|
-
L: 85,
|
|
1001
|
-
S: this,
|
|
1002
|
-
A: [
|
|
1003
|
-
"doc.version === SpaceDocVersion.CURRENT",
|
|
1004
|
-
""
|
|
1005
|
-
]
|
|
1006
|
-
});
|
|
1007
|
-
if (doc.access == null) {
|
|
1008
|
-
this._initDocAccess(existingDocHandle);
|
|
1009
|
-
}
|
|
1010
|
-
this._spaceRootDocHandle = existingDocHandle;
|
|
1011
|
-
}
|
|
1012
|
-
loadObjectDocument(objectIdOrMany) {
|
|
1013
|
-
const objectIds = Array.isArray(objectIdOrMany) ? objectIdOrMany : [
|
|
1014
|
-
objectIdOrMany
|
|
1015
|
-
];
|
|
1016
|
-
let hasUrlsToLoad = false;
|
|
1017
|
-
const urlsToLoad = {};
|
|
1018
|
-
for (const objectId of objectIds) {
|
|
1019
|
-
invariant4(this._spaceRootDocHandle, void 0, {
|
|
1020
|
-
F: __dxlog_file4,
|
|
1021
|
-
L: 97,
|
|
1022
|
-
S: this,
|
|
1023
|
-
A: [
|
|
1024
|
-
"this._spaceRootDocHandle",
|
|
1025
|
-
""
|
|
1026
|
-
]
|
|
1027
|
-
});
|
|
1028
|
-
if (this._objectDocumentHandles.has(objectId) || this._objectsPendingDocumentLoad.has(objectId)) {
|
|
1029
|
-
continue;
|
|
1030
|
-
}
|
|
1031
|
-
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
1032
|
-
invariant4(spaceRootDoc, void 0, {
|
|
1033
|
-
F: __dxlog_file4,
|
|
1034
|
-
L: 102,
|
|
1035
|
-
S: this,
|
|
1036
|
-
A: [
|
|
1037
|
-
"spaceRootDoc",
|
|
1038
|
-
""
|
|
1039
|
-
]
|
|
1040
|
-
});
|
|
1041
|
-
const documentUrl = (spaceRootDoc.links ?? {})[objectId];
|
|
1042
|
-
if (documentUrl == null) {
|
|
1043
|
-
this._objectsPendingDocumentLoad.add(objectId);
|
|
1044
|
-
log3.info("loading delayed until object links are initialized", {
|
|
1045
|
-
objectId
|
|
1046
|
-
}, {
|
|
1047
|
-
F: __dxlog_file4,
|
|
1048
|
-
L: 106,
|
|
1049
|
-
S: this,
|
|
1050
|
-
C: (f, a) => f(...a)
|
|
1051
|
-
});
|
|
1052
|
-
} else {
|
|
1053
|
-
urlsToLoad[objectId] = documentUrl;
|
|
1054
|
-
hasUrlsToLoad = true;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
if (hasUrlsToLoad) {
|
|
1058
|
-
this._loadLinkedObjects(urlsToLoad);
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
getObjectDocumentId(objectId) {
|
|
1062
|
-
invariant4(this._spaceRootDocHandle, void 0, {
|
|
1063
|
-
F: __dxlog_file4,
|
|
1064
|
-
L: 118,
|
|
1065
|
-
S: this,
|
|
1066
|
-
A: [
|
|
1067
|
-
"this._spaceRootDocHandle",
|
|
1068
|
-
""
|
|
1069
|
-
]
|
|
1070
|
-
});
|
|
1071
|
-
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
1072
|
-
invariant4(spaceRootDoc, void 0, {
|
|
1073
|
-
F: __dxlog_file4,
|
|
1074
|
-
L: 120,
|
|
1075
|
-
S: this,
|
|
1076
|
-
A: [
|
|
1077
|
-
"spaceRootDoc",
|
|
1078
|
-
""
|
|
1079
|
-
]
|
|
1080
|
-
});
|
|
1081
|
-
if (spaceRootDoc.objects?.[objectId]) {
|
|
1082
|
-
return this._spaceRootDocHandle.documentId;
|
|
1083
|
-
}
|
|
1084
|
-
const documentUrl = (spaceRootDoc.links ?? {})[objectId];
|
|
1085
|
-
return documentUrl && interpretAsDocumentId(documentUrl);
|
|
1086
|
-
}
|
|
1087
|
-
onObjectLinksUpdated(links) {
|
|
1088
|
-
if (!links) {
|
|
1089
|
-
return;
|
|
1090
|
-
}
|
|
1091
|
-
const linksAwaitingLoad = Object.entries(links).filter(([objectId]) => this._objectsPendingDocumentLoad.has(objectId));
|
|
1092
|
-
this._loadLinkedObjects(Object.fromEntries(linksAwaitingLoad));
|
|
1093
|
-
linksAwaitingLoad.forEach(([objectId]) => this._objectsPendingDocumentLoad.delete(objectId));
|
|
1094
|
-
}
|
|
1095
|
-
getSpaceRootDocHandle() {
|
|
1096
|
-
invariant4(this._spaceRootDocHandle, void 0, {
|
|
1097
|
-
F: __dxlog_file4,
|
|
1098
|
-
L: 140,
|
|
1099
|
-
S: this,
|
|
1100
|
-
A: [
|
|
1101
|
-
"this._spaceRootDocHandle",
|
|
1102
|
-
""
|
|
1103
|
-
]
|
|
1104
|
-
});
|
|
1105
|
-
return this._spaceRootDocHandle;
|
|
1106
|
-
}
|
|
1107
|
-
createDocumentForObject(objectId) {
|
|
1108
|
-
invariant4(this._spaceRootDocHandle, void 0, {
|
|
1109
|
-
F: __dxlog_file4,
|
|
1110
|
-
L: 145,
|
|
1111
|
-
S: this,
|
|
1112
|
-
A: [
|
|
1113
|
-
"this._spaceRootDocHandle",
|
|
1114
|
-
""
|
|
1115
|
-
]
|
|
1116
|
-
});
|
|
1117
|
-
const spaceDocHandle = this._repo.create({
|
|
1118
|
-
version: SpaceDocVersion.CURRENT
|
|
1119
|
-
});
|
|
1120
|
-
this._initDocAccess(spaceDocHandle);
|
|
1121
|
-
this.onObjectBoundToDocument(spaceDocHandle, objectId);
|
|
1122
|
-
this._spaceRootDocHandle.change((newDoc) => {
|
|
1123
|
-
newDoc.links ??= {};
|
|
1124
|
-
newDoc.links[objectId] = spaceDocHandle.url;
|
|
1125
|
-
});
|
|
1126
|
-
return spaceDocHandle;
|
|
1127
|
-
}
|
|
1128
|
-
onObjectBoundToDocument(handle, objectId) {
|
|
1129
|
-
this._objectDocumentHandles.set(objectId, handle);
|
|
1130
|
-
}
|
|
1131
|
-
clearHandleReferences() {
|
|
1132
|
-
const objectsWithHandles = [
|
|
1133
|
-
...this._objectDocumentHandles.keys()
|
|
1134
|
-
];
|
|
1135
|
-
this._objectDocumentHandles.clear();
|
|
1136
|
-
this._spaceRootDocHandle = null;
|
|
1137
|
-
return objectsWithHandles;
|
|
1138
|
-
}
|
|
1139
|
-
_loadLinkedObjects(links) {
|
|
1140
|
-
if (!links) {
|
|
1141
|
-
return;
|
|
1142
|
-
}
|
|
1143
|
-
for (const [objectId, automergeUrl] of Object.entries(links)) {
|
|
1144
|
-
const logMeta = {
|
|
1145
|
-
objectId,
|
|
1146
|
-
automergeUrl
|
|
1147
|
-
};
|
|
1148
|
-
const objectDocumentHandle = this._objectDocumentHandles.get(objectId);
|
|
1149
|
-
if (objectDocumentHandle != null && objectDocumentHandle.url !== automergeUrl) {
|
|
1150
|
-
log3.warn("object already inlined in a different document, ignoring the link", {
|
|
1151
|
-
...logMeta,
|
|
1152
|
-
actualDocumentUrl: objectDocumentHandle.url
|
|
1153
|
-
}, {
|
|
1154
|
-
F: __dxlog_file4,
|
|
1155
|
-
L: 177,
|
|
1156
|
-
S: this,
|
|
1157
|
-
C: (f, a) => f(...a)
|
|
1158
|
-
});
|
|
1159
|
-
continue;
|
|
1160
|
-
}
|
|
1161
|
-
if (objectDocumentHandle?.url === automergeUrl) {
|
|
1162
|
-
log3.warn("object document was already loaded", logMeta, {
|
|
1163
|
-
F: __dxlog_file4,
|
|
1164
|
-
L: 184,
|
|
1165
|
-
S: this,
|
|
1166
|
-
C: (f, a) => f(...a)
|
|
1167
|
-
});
|
|
1168
|
-
continue;
|
|
1169
|
-
}
|
|
1170
|
-
const handle = this._repo.find(automergeUrl);
|
|
1171
|
-
log3.debug("document loading triggered", logMeta, {
|
|
1172
|
-
F: __dxlog_file4,
|
|
1173
|
-
L: 188,
|
|
1174
|
-
S: this,
|
|
1175
|
-
C: (f, a) => f(...a)
|
|
1176
|
-
});
|
|
1177
|
-
this._objectDocumentHandles.set(objectId, handle);
|
|
1178
|
-
void this._createObjectOnDocumentLoad(handle, objectId);
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
async _initDocHandle(ctx, url) {
|
|
1182
|
-
const docHandle = this._repo.find(url);
|
|
1183
|
-
while (true) {
|
|
1184
|
-
try {
|
|
1185
|
-
await warnAfterTimeout(5e3, "Automerge root doc load timeout (CoreDatabase)", async () => {
|
|
1186
|
-
await cancelWithContext2(ctx, docHandle.whenReady());
|
|
1187
|
-
});
|
|
1188
|
-
break;
|
|
1189
|
-
} catch (err) {
|
|
1190
|
-
if (`${err}`.includes("Timeout")) {
|
|
1191
|
-
log3.info("wraparound", {
|
|
1192
|
-
id: docHandle.documentId,
|
|
1193
|
-
state: docHandle.state
|
|
1194
|
-
}, {
|
|
1195
|
-
F: __dxlog_file4,
|
|
1196
|
-
L: 204,
|
|
1197
|
-
S: this,
|
|
1198
|
-
C: (f, a) => f(...a)
|
|
1199
|
-
});
|
|
1200
|
-
continue;
|
|
1201
|
-
}
|
|
1202
|
-
throw err;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
if (docHandle.state === "unavailable") {
|
|
1206
|
-
throw new Error("Automerge document is unavailable");
|
|
1207
|
-
}
|
|
1208
|
-
return docHandle;
|
|
1209
|
-
}
|
|
1210
|
-
_initDocAccess(handle) {
|
|
1211
|
-
handle.change((newDoc) => {
|
|
1212
|
-
newDoc.access ??= {
|
|
1213
|
-
spaceKey: this._spaceKey.toHex()
|
|
1214
|
-
};
|
|
1215
|
-
newDoc.access.spaceKey = this._spaceKey.toHex();
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
|
-
async _createObjectOnDocumentLoad(handle, objectId) {
|
|
1219
|
-
try {
|
|
1220
|
-
await handle.whenReady();
|
|
1221
|
-
const logMeta = {
|
|
1222
|
-
objectId,
|
|
1223
|
-
docUrl: handle.url
|
|
1224
|
-
};
|
|
1225
|
-
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1226
|
-
log3.info("document loaded after all listeners were removed", logMeta, {
|
|
1227
|
-
F: __dxlog_file4,
|
|
1228
|
-
L: 231,
|
|
1229
|
-
S: this,
|
|
1230
|
-
C: (f, a) => f(...a)
|
|
1231
|
-
});
|
|
1232
|
-
return;
|
|
1233
|
-
}
|
|
1234
|
-
const objectDocHandle = this._objectDocumentHandles.get(objectId);
|
|
1235
|
-
if (objectDocHandle?.url !== handle.url) {
|
|
1236
|
-
log3.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1237
|
-
F: __dxlog_file4,
|
|
1238
|
-
L: 236,
|
|
1239
|
-
S: this,
|
|
1240
|
-
C: (f, a) => f(...a)
|
|
1241
|
-
});
|
|
1242
|
-
return;
|
|
1243
|
-
}
|
|
1244
|
-
this.onObjectDocumentLoaded.emit({
|
|
1245
|
-
handle,
|
|
1246
|
-
objectId
|
|
1247
|
-
});
|
|
1248
|
-
} catch (err) {
|
|
1249
|
-
const shouldRetryLoading = this.onObjectDocumentLoaded.listenerCount() > 0;
|
|
1250
|
-
log3.warn("failed to load a document", {
|
|
1251
|
-
objectId,
|
|
1252
|
-
automergeUrl: handle.url,
|
|
1253
|
-
retryLoading: shouldRetryLoading,
|
|
1254
|
-
err
|
|
1255
|
-
}, {
|
|
1256
|
-
F: __dxlog_file4,
|
|
1257
|
-
L: 242,
|
|
1258
|
-
S: this,
|
|
1259
|
-
C: (f, a) => f(...a)
|
|
1260
|
-
});
|
|
1261
|
-
if (shouldRetryLoading) {
|
|
1262
|
-
await this._createObjectOnDocumentLoad(handle, objectId);
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
_ts_decorate3([
|
|
1268
|
-
trace2.span({
|
|
1269
|
-
showInBrowserTimeline: true
|
|
1270
|
-
})
|
|
1271
|
-
], AutomergeDocumentLoaderImpl.prototype, "loadSpaceRootDocHandle", null);
|
|
1272
|
-
AutomergeDocumentLoaderImpl = _ts_decorate3([
|
|
1273
|
-
trace2.resource()
|
|
1274
|
-
], AutomergeDocumentLoaderImpl);
|
|
1275
|
-
|
|
1276
773
|
// packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator.ts
|
|
1277
|
-
import { invariant as
|
|
774
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
1278
775
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
1279
|
-
import { log as
|
|
776
|
+
import { log as log4 } from "@dxos/log";
|
|
1280
777
|
import { ComplexMap, ComplexSet, defaultMap } from "@dxos/util";
|
|
1281
778
|
|
|
1282
779
|
// packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator-connection.ts
|
|
1283
|
-
import { cbor
|
|
780
|
+
import { cbor } from "@dxos/automerge/automerge-repo";
|
|
1284
781
|
import { Resource as Resource3 } from "@dxos/context";
|
|
1285
|
-
import { invariant as
|
|
1286
|
-
import { log as
|
|
782
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
783
|
+
import { log as log3 } from "@dxos/log";
|
|
1287
784
|
import { AutomergeReplicator } from "@dxos/teleport-extension-automerge-replicator";
|
|
1288
|
-
var
|
|
785
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator-connection.ts";
|
|
1289
786
|
var DEFAULT_FACTORY = (params) => new AutomergeReplicator(...params);
|
|
1290
787
|
var MeshReplicatorConnection = class extends Resource3 {
|
|
1291
788
|
constructor(_params) {
|
|
@@ -1303,8 +800,8 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1303
800
|
});
|
|
1304
801
|
this.writable = new WritableStream({
|
|
1305
802
|
write: async (message, controller) => {
|
|
1306
|
-
|
|
1307
|
-
F:
|
|
803
|
+
invariant3(this._isEnabled, "Writing to a disabled connection", {
|
|
804
|
+
F: __dxlog_file3,
|
|
1308
805
|
L: 47,
|
|
1309
806
|
S: this,
|
|
1310
807
|
A: [
|
|
@@ -1314,7 +811,7 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1314
811
|
});
|
|
1315
812
|
try {
|
|
1316
813
|
await this.replicatorExtension.sendSyncMessage({
|
|
1317
|
-
payload:
|
|
814
|
+
payload: cbor.encode(message)
|
|
1318
815
|
});
|
|
1319
816
|
} catch (err) {
|
|
1320
817
|
controller.error(err);
|
|
@@ -1331,12 +828,12 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1331
828
|
onStartReplication: async (info, remotePeerId) => {
|
|
1332
829
|
this.remoteDeviceKey = remotePeerId;
|
|
1333
830
|
this._remotePeerId = info.id;
|
|
1334
|
-
|
|
831
|
+
log3("onStartReplication", {
|
|
1335
832
|
id: info.id,
|
|
1336
833
|
thisPeerId: this.peerId,
|
|
1337
834
|
remotePeerId: remotePeerId.toHex()
|
|
1338
835
|
}, {
|
|
1339
|
-
F:
|
|
836
|
+
F: __dxlog_file3,
|
|
1340
837
|
L: 81,
|
|
1341
838
|
S: this,
|
|
1342
839
|
C: (f, a) => f(...a)
|
|
@@ -1347,7 +844,7 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1347
844
|
if (!this._isEnabled) {
|
|
1348
845
|
return;
|
|
1349
846
|
}
|
|
1350
|
-
const message =
|
|
847
|
+
const message = cbor.decode(payload);
|
|
1351
848
|
readableStreamController.enqueue(message);
|
|
1352
849
|
},
|
|
1353
850
|
onClose: async () => {
|
|
@@ -1362,8 +859,8 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1362
859
|
}
|
|
1363
860
|
}
|
|
1364
861
|
get peerId() {
|
|
1365
|
-
|
|
1366
|
-
F:
|
|
862
|
+
invariant3(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
863
|
+
F: __dxlog_file3,
|
|
1367
864
|
L: 107,
|
|
1368
865
|
S: this,
|
|
1369
866
|
A: [
|
|
@@ -1381,8 +878,8 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1381
878
|
* Call after the remote peer has connected.
|
|
1382
879
|
*/
|
|
1383
880
|
enable() {
|
|
1384
|
-
|
|
1385
|
-
F:
|
|
881
|
+
invariant3(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
882
|
+
F: __dxlog_file3,
|
|
1386
883
|
L: 120,
|
|
1387
884
|
S: this,
|
|
1388
885
|
A: [
|
|
@@ -1401,7 +898,7 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1401
898
|
};
|
|
1402
899
|
|
|
1403
900
|
// packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator.ts
|
|
1404
|
-
var
|
|
901
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator.ts";
|
|
1405
902
|
var MeshEchoReplicator = class {
|
|
1406
903
|
constructor() {
|
|
1407
904
|
this._connections = /* @__PURE__ */ new Set();
|
|
@@ -1419,6 +916,9 @@ var MeshEchoReplicator = class {
|
|
|
1419
916
|
this._context = context;
|
|
1420
917
|
}
|
|
1421
918
|
async disconnect() {
|
|
919
|
+
for (const connection of this._connectionsPerPeer.values()) {
|
|
920
|
+
this._context?.onConnectionClosed(connection);
|
|
921
|
+
}
|
|
1422
922
|
for (const connection of this._connections) {
|
|
1423
923
|
await connection.close();
|
|
1424
924
|
}
|
|
@@ -1427,9 +927,9 @@ var MeshEchoReplicator = class {
|
|
|
1427
927
|
this._context = null;
|
|
1428
928
|
}
|
|
1429
929
|
createExtension(extensionFactory) {
|
|
1430
|
-
|
|
1431
|
-
F:
|
|
1432
|
-
L:
|
|
930
|
+
invariant4(this._context, void 0, {
|
|
931
|
+
F: __dxlog_file4,
|
|
932
|
+
L: 54,
|
|
1433
933
|
S: this,
|
|
1434
934
|
A: [
|
|
1435
935
|
"this._context",
|
|
@@ -1440,17 +940,17 @@ var MeshEchoReplicator = class {
|
|
|
1440
940
|
ownPeerId: this._context.peerId,
|
|
1441
941
|
replicatorFactory: extensionFactory,
|
|
1442
942
|
onRemoteConnected: async () => {
|
|
1443
|
-
|
|
943
|
+
log4("onRemoteConnected", {
|
|
1444
944
|
peerId: connection.peerId
|
|
1445
945
|
}, {
|
|
1446
|
-
F:
|
|
1447
|
-
L:
|
|
946
|
+
F: __dxlog_file4,
|
|
947
|
+
L: 60,
|
|
1448
948
|
S: this,
|
|
1449
949
|
C: (f, a) => f(...a)
|
|
1450
950
|
});
|
|
1451
|
-
|
|
1452
|
-
F:
|
|
1453
|
-
L:
|
|
951
|
+
invariant4(this._context, void 0, {
|
|
952
|
+
F: __dxlog_file4,
|
|
953
|
+
L: 61,
|
|
1454
954
|
S: this,
|
|
1455
955
|
A: [
|
|
1456
956
|
"this._context",
|
|
@@ -1466,11 +966,11 @@ var MeshEchoReplicator = class {
|
|
|
1466
966
|
}
|
|
1467
967
|
},
|
|
1468
968
|
onRemoteDisconnected: async () => {
|
|
1469
|
-
|
|
969
|
+
log4("onRemoteDisconnected", {
|
|
1470
970
|
peerId: connection.peerId
|
|
1471
971
|
}, {
|
|
1472
|
-
F:
|
|
1473
|
-
L:
|
|
972
|
+
F: __dxlog_file4,
|
|
973
|
+
L: 72,
|
|
1474
974
|
S: this,
|
|
1475
975
|
C: (f, a) => f(...a)
|
|
1476
976
|
});
|
|
@@ -1480,18 +980,18 @@ var MeshEchoReplicator = class {
|
|
|
1480
980
|
this._connections.delete(connection);
|
|
1481
981
|
},
|
|
1482
982
|
shouldAdvertise: async (params) => {
|
|
1483
|
-
|
|
983
|
+
log4("shouldAdvertise", {
|
|
1484
984
|
peerId: connection.peerId,
|
|
1485
985
|
documentId: params.documentId
|
|
1486
986
|
}, {
|
|
1487
|
-
F:
|
|
1488
|
-
L:
|
|
987
|
+
F: __dxlog_file4,
|
|
988
|
+
L: 79,
|
|
1489
989
|
S: this,
|
|
1490
990
|
C: (f, a) => f(...a)
|
|
1491
991
|
});
|
|
1492
|
-
|
|
1493
|
-
F:
|
|
1494
|
-
L:
|
|
992
|
+
invariant4(this._context, void 0, {
|
|
993
|
+
F: __dxlog_file4,
|
|
994
|
+
L: 80,
|
|
1495
995
|
S: this,
|
|
1496
996
|
A: [
|
|
1497
997
|
"this._context",
|
|
@@ -1501,12 +1001,12 @@ var MeshEchoReplicator = class {
|
|
|
1501
1001
|
try {
|
|
1502
1002
|
const spaceKey = await this._context.getContainingSpaceForDocument(params.documentId);
|
|
1503
1003
|
if (!spaceKey) {
|
|
1504
|
-
|
|
1004
|
+
log4("space key not found for share policy check", {
|
|
1505
1005
|
peerId: connection.peerId,
|
|
1506
1006
|
documentId: params.documentId
|
|
1507
1007
|
}, {
|
|
1508
|
-
F:
|
|
1509
|
-
L:
|
|
1008
|
+
F: __dxlog_file4,
|
|
1009
|
+
L: 84,
|
|
1510
1010
|
S: this,
|
|
1511
1011
|
C: (f, a) => f(...a)
|
|
1512
1012
|
});
|
|
@@ -1514,19 +1014,19 @@ var MeshEchoReplicator = class {
|
|
|
1514
1014
|
}
|
|
1515
1015
|
const authorizedDevices = this._authorizedDevices.get(spaceKey);
|
|
1516
1016
|
if (!connection.remoteDeviceKey) {
|
|
1517
|
-
|
|
1017
|
+
log4("device key not found for share policy check", {
|
|
1518
1018
|
peerId: connection.peerId,
|
|
1519
1019
|
documentId: params.documentId
|
|
1520
1020
|
}, {
|
|
1521
|
-
F:
|
|
1522
|
-
L:
|
|
1021
|
+
F: __dxlog_file4,
|
|
1022
|
+
L: 94,
|
|
1523
1023
|
S: this,
|
|
1524
1024
|
C: (f, a) => f(...a)
|
|
1525
1025
|
});
|
|
1526
1026
|
return false;
|
|
1527
1027
|
}
|
|
1528
1028
|
const isAuthorized = authorizedDevices?.has(connection.remoteDeviceKey) ?? false;
|
|
1529
|
-
|
|
1029
|
+
log4("share policy check", {
|
|
1530
1030
|
localPeer: this._context.peerId,
|
|
1531
1031
|
remotePeer: connection.peerId,
|
|
1532
1032
|
documentId: params.documentId,
|
|
@@ -1534,16 +1034,16 @@ var MeshEchoReplicator = class {
|
|
|
1534
1034
|
spaceKey,
|
|
1535
1035
|
isAuthorized
|
|
1536
1036
|
}, {
|
|
1537
|
-
F:
|
|
1538
|
-
L:
|
|
1037
|
+
F: __dxlog_file4,
|
|
1038
|
+
L: 102,
|
|
1539
1039
|
S: this,
|
|
1540
1040
|
C: (f, a) => f(...a)
|
|
1541
1041
|
});
|
|
1542
1042
|
return isAuthorized;
|
|
1543
1043
|
} catch (err) {
|
|
1544
|
-
|
|
1545
|
-
F:
|
|
1546
|
-
L:
|
|
1044
|
+
log4.catch(err, void 0, {
|
|
1045
|
+
F: __dxlog_file4,
|
|
1046
|
+
L: 112,
|
|
1547
1047
|
S: this,
|
|
1548
1048
|
C: (f, a) => f(...a)
|
|
1549
1049
|
});
|
|
@@ -1555,12 +1055,12 @@ var MeshEchoReplicator = class {
|
|
|
1555
1055
|
return connection.replicatorExtension;
|
|
1556
1056
|
}
|
|
1557
1057
|
authorizeDevice(spaceKey, deviceKey) {
|
|
1558
|
-
|
|
1058
|
+
log4("authorizeDevice", {
|
|
1559
1059
|
spaceKey,
|
|
1560
1060
|
deviceKey
|
|
1561
1061
|
}, {
|
|
1562
|
-
F:
|
|
1563
|
-
L:
|
|
1062
|
+
F: __dxlog_file4,
|
|
1063
|
+
L: 123,
|
|
1564
1064
|
S: this,
|
|
1565
1065
|
C: (f, a) => f(...a)
|
|
1566
1066
|
});
|
|
@@ -1577,14 +1077,12 @@ var MeshEchoReplicator = class {
|
|
|
1577
1077
|
export {
|
|
1578
1078
|
AuthExtension,
|
|
1579
1079
|
AuthStatus,
|
|
1580
|
-
AutomergeDocumentLoaderImpl,
|
|
1581
1080
|
AutomergeHost,
|
|
1582
1081
|
CredentialRetrieverExtension,
|
|
1583
1082
|
CredentialServerExtension,
|
|
1584
1083
|
DataServiceImpl,
|
|
1585
1084
|
DocumentsSynchronizer,
|
|
1586
1085
|
LevelDBStorageAdapter,
|
|
1587
|
-
LocalHostNetworkAdapter,
|
|
1588
1086
|
MOCK_AUTH_PROVIDER,
|
|
1589
1087
|
MOCK_AUTH_VERIFIER,
|
|
1590
1088
|
MeshEchoReplicator,
|