@dxos/echo-pipeline 0.5.9-next.728078d → 0.5.9-next.73dcc17
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-HS77A4I4.mjs} +174 -23
- package/dist/lib/browser/{chunk-I2J5TTHJ.mjs.map → chunk-HS77A4I4.mjs.map} +4 -4
- package/dist/lib/browser/index.mjs +155 -87
- package/dist/lib/browser/index.mjs.map +3 -3
- 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-Y5U7UXEL.cjs} +185 -34
- package/dist/lib/node/{chunk-QPCNQ4ZK.cjs.map → chunk-Y5U7UXEL.cjs.map} +4 -4
- package/dist/lib/node/index.cjs +193 -125
- package/dist/lib/node/index.cjs.map +3 -3
- 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 +2 -1
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-host.d.ts +40 -2
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +2 -0
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/space/admission-discovery-extension.d.ts +30 -0
- package/dist/types/src/space/admission-discovery-extension.d.ts.map +1 -0
- package/dist/types/src/space/index.d.ts +1 -0
- package/dist/types/src/space/index.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +8 -0
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-doc-loader.test.ts +6 -2
- package/src/automerge/automerge-doc-loader.ts +29 -20
- package/src/automerge/automerge-host.ts +96 -18
- package/src/automerge/echo-network-adapter.ts +10 -4
- package/src/automerge/mesh-echo-replicator.ts +2 -2
- package/src/space/admission-discovery-extension.ts +90 -0
- package/src/space/index.ts +1 -0
- package/src/space/space-manager.ts +46 -1
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
AuthExtension,
|
|
4
4
|
AuthStatus,
|
|
5
5
|
Buffer,
|
|
6
|
+
CredentialRetrieverExtension,
|
|
7
|
+
CredentialServerExtension,
|
|
6
8
|
DataServiceImpl,
|
|
7
9
|
MOCK_AUTH_PROVIDER,
|
|
8
10
|
MOCK_AUTH_VERIFIER,
|
|
@@ -23,14 +25,13 @@ import {
|
|
|
23
25
|
mapTimeframeToFeedIndexes,
|
|
24
26
|
startAfter,
|
|
25
27
|
valueEncoding
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-HS77A4I4.mjs";
|
|
27
29
|
|
|
28
30
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts
|
|
29
|
-
import { Event } from "@dxos/async";
|
|
30
|
-
import { next as automerge, getBackend, getHeads } from "@dxos/automerge/automerge";
|
|
31
|
+
import { Event, asyncTimeout } from "@dxos/async";
|
|
32
|
+
import { next as automerge, getBackend, getHeads, isAutomerge, save } from "@dxos/automerge/automerge";
|
|
31
33
|
import { Repo } from "@dxos/automerge/automerge-repo";
|
|
32
|
-
import { Context } from "@dxos/context";
|
|
33
|
-
import { invariant as invariant3 } from "@dxos/invariant";
|
|
34
|
+
import { Context, cancelWithContext } from "@dxos/context";
|
|
34
35
|
import { PublicKey } from "@dxos/keys";
|
|
35
36
|
import { objectPointerCodec } from "@dxos/protocols";
|
|
36
37
|
import { trace } from "@dxos/tracing";
|
|
@@ -318,10 +319,7 @@ var EchoNetworkAdapter = class extends NetworkAdapter {
|
|
|
318
319
|
_emitPeerCandidate(connection) {
|
|
319
320
|
this.emit("peer-candidate", {
|
|
320
321
|
peerId: connection.peerId,
|
|
321
|
-
peerMetadata:
|
|
322
|
-
// TODO(dmaretskyi): Refactor this.
|
|
323
|
-
dxos_peerSource: "EchoNetworkAdapter"
|
|
324
|
-
}
|
|
322
|
+
peerMetadata: createEchoPeerMetadata()
|
|
325
323
|
});
|
|
326
324
|
}
|
|
327
325
|
};
|
|
@@ -337,6 +335,11 @@ _ts_decorate([
|
|
|
337
335
|
_ts_decorate([
|
|
338
336
|
synchronized
|
|
339
337
|
], EchoNetworkAdapter.prototype, "removeReplicator", null);
|
|
338
|
+
var createEchoPeerMetadata = () => ({
|
|
339
|
+
// TODO(dmaretskyi): Refactor this.
|
|
340
|
+
dxos_peerSource: "EchoNetworkAdapter"
|
|
341
|
+
});
|
|
342
|
+
var isEchoPeerMetadata = (metadata) => metadata?.dxos_peerSource === "EchoNetworkAdapter";
|
|
340
343
|
|
|
341
344
|
// packages/core/echo/echo-pipeline/src/automerge/leveldb-storage-adapter.ts
|
|
342
345
|
import { LifecycleState as LifecycleState2, Resource } from "@dxos/context";
|
|
@@ -586,7 +589,10 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
586
589
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
|
|
587
590
|
var AutomergeHost = class {
|
|
588
591
|
constructor({ db, indexMetadataStore }) {
|
|
589
|
-
this._ctx = new Context(
|
|
592
|
+
this._ctx = new Context(void 0, {
|
|
593
|
+
F: __dxlog_file3,
|
|
594
|
+
L: 71
|
|
595
|
+
});
|
|
590
596
|
this._echoNetworkAdapter = new EchoNetworkAdapter({
|
|
591
597
|
getContainingSpaceForDocument: this._getContainingSpaceForDocument.bind(this)
|
|
592
598
|
});
|
|
@@ -625,6 +631,9 @@ var AutomergeHost = class {
|
|
|
625
631
|
await this._echoNetworkAdapter.close();
|
|
626
632
|
await this._ctx.dispose();
|
|
627
633
|
}
|
|
634
|
+
/**
|
|
635
|
+
* @deprecated To be abstracted away.
|
|
636
|
+
*/
|
|
628
637
|
get repo() {
|
|
629
638
|
return this._repo;
|
|
630
639
|
}
|
|
@@ -634,6 +643,39 @@ var AutomergeHost = class {
|
|
|
634
643
|
async removeReplicator(replicator) {
|
|
635
644
|
await this._echoNetworkAdapter.removeReplicator(replicator);
|
|
636
645
|
}
|
|
646
|
+
/**
|
|
647
|
+
* Loads the document handle from the repo and waits for it to be ready.
|
|
648
|
+
*/
|
|
649
|
+
async loadDoc(ctx, documentId, opts) {
|
|
650
|
+
let handle;
|
|
651
|
+
if (typeof documentId === "string") {
|
|
652
|
+
handle = this._repo.handles[documentId];
|
|
653
|
+
}
|
|
654
|
+
if (!handle) {
|
|
655
|
+
handle = this._repo.find(documentId);
|
|
656
|
+
}
|
|
657
|
+
if (!handle.isReady()) {
|
|
658
|
+
if (!opts?.timeout) {
|
|
659
|
+
await cancelWithContext(ctx, handle.whenReady());
|
|
660
|
+
} else {
|
|
661
|
+
await cancelWithContext(ctx, asyncTimeout(handle.whenReady(), opts.timeout));
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return handle;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Create new persisted document.
|
|
668
|
+
*/
|
|
669
|
+
createDoc(initialValue, opts) {
|
|
670
|
+
if (opts?.preserveHistory) {
|
|
671
|
+
if (!isAutomerge(initialValue)) {
|
|
672
|
+
throw new TypeError("Initial value must be an Automerge document");
|
|
673
|
+
}
|
|
674
|
+
return this._repo.import(save(initialValue));
|
|
675
|
+
} else {
|
|
676
|
+
return this._repo.create(initialValue);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
637
679
|
// TODO(dmaretskyi): Share based on HALO permissions and space affinity.
|
|
638
680
|
// Hosts, running in the worker, don't share documents unless requested by other peers.
|
|
639
681
|
// NOTE: If both peers return sharePolicy=false the replication will not happen
|
|
@@ -646,7 +688,7 @@ var AutomergeHost = class {
|
|
|
646
688
|
return false;
|
|
647
689
|
}
|
|
648
690
|
const peerMetadata = this.repo.peerMetadataByPeerId[peerId];
|
|
649
|
-
if (peerMetadata
|
|
691
|
+
if (isEchoPeerMetadata(peerMetadata)) {
|
|
650
692
|
return this._echoNetworkAdapter.shouldAdvertize(peerId, {
|
|
651
693
|
documentId
|
|
652
694
|
});
|
|
@@ -718,31 +760,36 @@ var AutomergeHost = class {
|
|
|
718
760
|
}
|
|
719
761
|
return PublicKey.from(spaceKeyHex);
|
|
720
762
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
763
|
+
/**
|
|
764
|
+
* Flush documents to disk.
|
|
765
|
+
*/
|
|
724
766
|
async flush({ states }) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
});
|
|
735
|
-
const handle = this.repo.handles[documentId] ?? this._repo.find(documentId);
|
|
736
|
-
await waitForHeads(handle, heads);
|
|
737
|
-
}) ?? []);
|
|
767
|
+
if (states) {
|
|
768
|
+
await Promise.all(states.map(async ({ heads, documentId }) => {
|
|
769
|
+
if (!heads) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
const handle = this.repo.handles[documentId] ?? this._repo.find(documentId);
|
|
773
|
+
await waitForHeads(handle, heads);
|
|
774
|
+
}) ?? []);
|
|
775
|
+
}
|
|
738
776
|
await this._repo.flush(states?.map(({ documentId }) => documentId));
|
|
739
777
|
}
|
|
778
|
+
/**
|
|
779
|
+
* Host <-> Client sync.
|
|
780
|
+
*/
|
|
740
781
|
syncRepo(request) {
|
|
741
782
|
return this._clientNetwork.syncRepo(request);
|
|
742
783
|
}
|
|
784
|
+
/**
|
|
785
|
+
* Host <-> Client sync.
|
|
786
|
+
*/
|
|
743
787
|
sendSyncMessage(request) {
|
|
744
788
|
return this._clientNetwork.sendSyncMessage(request);
|
|
745
789
|
}
|
|
790
|
+
/**
|
|
791
|
+
* Host <-> Client sync.
|
|
792
|
+
*/
|
|
746
793
|
async getHostInfo() {
|
|
747
794
|
return this._clientNetwork.getHostInfo();
|
|
748
795
|
}
|
|
@@ -796,10 +843,11 @@ var changeIsPresentInDoc = (doc, changeHash) => {
|
|
|
796
843
|
|
|
797
844
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts
|
|
798
845
|
import { Event as Event2 } from "@dxos/async";
|
|
799
|
-
import {
|
|
846
|
+
import { interpretAsDocumentId } from "@dxos/automerge/automerge-repo";
|
|
847
|
+
import { cancelWithContext as cancelWithContext2 } from "@dxos/context";
|
|
800
848
|
import { warnAfterTimeout } from "@dxos/debug";
|
|
801
849
|
import { SpaceDocVersion } from "@dxos/echo-protocol";
|
|
802
|
-
import { invariant as
|
|
850
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
803
851
|
import { log as log2 } from "@dxos/log";
|
|
804
852
|
import { trace as trace2 } from "@dxos/tracing";
|
|
805
853
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
@@ -834,32 +882,32 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
834
882
|
return;
|
|
835
883
|
}
|
|
836
884
|
if (!spaceState.rootUrl) {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
this._spaceRootDocHandle = existingDocHandle;
|
|
885
|
+
throw new Error("Database opened with no rootUrl");
|
|
886
|
+
}
|
|
887
|
+
const existingDocHandle = await this._initDocHandle(ctx, spaceState.rootUrl);
|
|
888
|
+
const doc = existingDocHandle.docSync();
|
|
889
|
+
invariant3(doc, void 0, {
|
|
890
|
+
F: __dxlog_file4,
|
|
891
|
+
L: 84,
|
|
892
|
+
S: this,
|
|
893
|
+
A: [
|
|
894
|
+
"doc",
|
|
895
|
+
""
|
|
896
|
+
]
|
|
897
|
+
});
|
|
898
|
+
invariant3(doc.version === SpaceDocVersion.CURRENT, void 0, {
|
|
899
|
+
F: __dxlog_file4,
|
|
900
|
+
L: 85,
|
|
901
|
+
S: this,
|
|
902
|
+
A: [
|
|
903
|
+
"doc.version === SpaceDocVersion.CURRENT",
|
|
904
|
+
""
|
|
905
|
+
]
|
|
906
|
+
});
|
|
907
|
+
if (doc.access == null) {
|
|
908
|
+
this._initDocAccess(existingDocHandle);
|
|
862
909
|
}
|
|
910
|
+
this._spaceRootDocHandle = existingDocHandle;
|
|
863
911
|
}
|
|
864
912
|
loadObjectDocument(objectIdOrMany) {
|
|
865
913
|
const objectIds = Array.isArray(objectIdOrMany) ? objectIdOrMany : [
|
|
@@ -868,9 +916,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
868
916
|
let hasUrlsToLoad = false;
|
|
869
917
|
const urlsToLoad = {};
|
|
870
918
|
for (const objectId of objectIds) {
|
|
871
|
-
|
|
919
|
+
invariant3(this._spaceRootDocHandle, void 0, {
|
|
872
920
|
F: __dxlog_file4,
|
|
873
|
-
L:
|
|
921
|
+
L: 97,
|
|
874
922
|
S: this,
|
|
875
923
|
A: [
|
|
876
924
|
"this._spaceRootDocHandle",
|
|
@@ -881,9 +929,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
881
929
|
continue;
|
|
882
930
|
}
|
|
883
931
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
884
|
-
|
|
932
|
+
invariant3(spaceRootDoc, void 0, {
|
|
885
933
|
F: __dxlog_file4,
|
|
886
|
-
L:
|
|
934
|
+
L: 102,
|
|
887
935
|
S: this,
|
|
888
936
|
A: [
|
|
889
937
|
"spaceRootDoc",
|
|
@@ -897,7 +945,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
897
945
|
objectId
|
|
898
946
|
}, {
|
|
899
947
|
F: __dxlog_file4,
|
|
900
|
-
L:
|
|
948
|
+
L: 106,
|
|
901
949
|
S: this,
|
|
902
950
|
C: (f, a) => f(...a)
|
|
903
951
|
});
|
|
@@ -910,6 +958,32 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
910
958
|
this._loadLinkedObjects(urlsToLoad);
|
|
911
959
|
}
|
|
912
960
|
}
|
|
961
|
+
getObjectDocumentId(objectId) {
|
|
962
|
+
invariant3(this._spaceRootDocHandle, void 0, {
|
|
963
|
+
F: __dxlog_file4,
|
|
964
|
+
L: 118,
|
|
965
|
+
S: this,
|
|
966
|
+
A: [
|
|
967
|
+
"this._spaceRootDocHandle",
|
|
968
|
+
""
|
|
969
|
+
]
|
|
970
|
+
});
|
|
971
|
+
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
972
|
+
invariant3(spaceRootDoc, void 0, {
|
|
973
|
+
F: __dxlog_file4,
|
|
974
|
+
L: 120,
|
|
975
|
+
S: this,
|
|
976
|
+
A: [
|
|
977
|
+
"spaceRootDoc",
|
|
978
|
+
""
|
|
979
|
+
]
|
|
980
|
+
});
|
|
981
|
+
if (spaceRootDoc.objects?.[objectId]) {
|
|
982
|
+
return this._spaceRootDocHandle.documentId;
|
|
983
|
+
}
|
|
984
|
+
const documentUrl = (spaceRootDoc.links ?? {})[objectId];
|
|
985
|
+
return documentUrl && interpretAsDocumentId(documentUrl);
|
|
986
|
+
}
|
|
913
987
|
onObjectLinksUpdated(links) {
|
|
914
988
|
if (!links) {
|
|
915
989
|
return;
|
|
@@ -919,9 +993,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
919
993
|
linksAwaitingLoad.forEach(([objectId]) => this._objectsPendingDocumentLoad.delete(objectId));
|
|
920
994
|
}
|
|
921
995
|
getSpaceRootDocHandle() {
|
|
922
|
-
|
|
996
|
+
invariant3(this._spaceRootDocHandle, void 0, {
|
|
923
997
|
F: __dxlog_file4,
|
|
924
|
-
L:
|
|
998
|
+
L: 140,
|
|
925
999
|
S: this,
|
|
926
1000
|
A: [
|
|
927
1001
|
"this._spaceRootDocHandle",
|
|
@@ -931,9 +1005,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
931
1005
|
return this._spaceRootDocHandle;
|
|
932
1006
|
}
|
|
933
1007
|
createDocumentForObject(objectId) {
|
|
934
|
-
|
|
1008
|
+
invariant3(this._spaceRootDocHandle, void 0, {
|
|
935
1009
|
F: __dxlog_file4,
|
|
936
|
-
L:
|
|
1010
|
+
L: 145,
|
|
937
1011
|
S: this,
|
|
938
1012
|
A: [
|
|
939
1013
|
"this._spaceRootDocHandle",
|
|
@@ -978,7 +1052,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
978
1052
|
actualDocumentUrl: objectDocumentHandle.url
|
|
979
1053
|
}, {
|
|
980
1054
|
F: __dxlog_file4,
|
|
981
|
-
L:
|
|
1055
|
+
L: 177,
|
|
982
1056
|
S: this,
|
|
983
1057
|
C: (f, a) => f(...a)
|
|
984
1058
|
});
|
|
@@ -987,7 +1061,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
987
1061
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
988
1062
|
log2.warn("object document was already loaded", logMeta, {
|
|
989
1063
|
F: __dxlog_file4,
|
|
990
|
-
L:
|
|
1064
|
+
L: 184,
|
|
991
1065
|
S: this,
|
|
992
1066
|
C: (f, a) => f(...a)
|
|
993
1067
|
});
|
|
@@ -996,7 +1070,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
996
1070
|
const handle = this._repo.find(automergeUrl);
|
|
997
1071
|
log2.debug("document loading triggered", logMeta, {
|
|
998
1072
|
F: __dxlog_file4,
|
|
999
|
-
L:
|
|
1073
|
+
L: 188,
|
|
1000
1074
|
S: this,
|
|
1001
1075
|
C: (f, a) => f(...a)
|
|
1002
1076
|
});
|
|
@@ -1009,7 +1083,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1009
1083
|
while (true) {
|
|
1010
1084
|
try {
|
|
1011
1085
|
await warnAfterTimeout(5e3, "Automerge root doc load timeout (CoreDatabase)", async () => {
|
|
1012
|
-
await
|
|
1086
|
+
await cancelWithContext2(ctx, docHandle.whenReady());
|
|
1013
1087
|
});
|
|
1014
1088
|
break;
|
|
1015
1089
|
} catch (err) {
|
|
@@ -1019,7 +1093,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1019
1093
|
state: docHandle.state
|
|
1020
1094
|
}, {
|
|
1021
1095
|
F: __dxlog_file4,
|
|
1022
|
-
L:
|
|
1096
|
+
L: 204,
|
|
1023
1097
|
S: this,
|
|
1024
1098
|
C: (f, a) => f(...a)
|
|
1025
1099
|
});
|
|
@@ -1033,14 +1107,6 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1033
1107
|
}
|
|
1034
1108
|
return docHandle;
|
|
1035
1109
|
}
|
|
1036
|
-
_createContextBoundSpaceRootDocument(ctx) {
|
|
1037
|
-
const docHandle = this._repo.create();
|
|
1038
|
-
this._spaceRootDocHandle = docHandle;
|
|
1039
|
-
ctx.onDispose(() => {
|
|
1040
|
-
docHandle.delete();
|
|
1041
|
-
this._spaceRootDocHandle = null;
|
|
1042
|
-
});
|
|
1043
|
-
}
|
|
1044
1110
|
_initDocAccess(handle) {
|
|
1045
1111
|
handle.change((newDoc) => {
|
|
1046
1112
|
newDoc.access ??= {
|
|
@@ -1061,7 +1127,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1061
1127
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1062
1128
|
log2.info("document loaded after all listeners were removed", logMeta, {
|
|
1063
1129
|
F: __dxlog_file4,
|
|
1064
|
-
L:
|
|
1130
|
+
L: 231,
|
|
1065
1131
|
S: this,
|
|
1066
1132
|
C: (f, a) => f(...a)
|
|
1067
1133
|
});
|
|
@@ -1071,7 +1137,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1071
1137
|
if (objectDocHandle?.url !== handle.url) {
|
|
1072
1138
|
log2.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1073
1139
|
F: __dxlog_file4,
|
|
1074
|
-
L:
|
|
1140
|
+
L: 236,
|
|
1075
1141
|
S: this,
|
|
1076
1142
|
C: (f, a) => f(...a)
|
|
1077
1143
|
});
|
|
@@ -1090,7 +1156,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1090
1156
|
err
|
|
1091
1157
|
}, {
|
|
1092
1158
|
F: __dxlog_file4,
|
|
1093
|
-
L:
|
|
1159
|
+
L: 242,
|
|
1094
1160
|
S: this,
|
|
1095
1161
|
C: (f, a) => f(...a)
|
|
1096
1162
|
});
|
|
@@ -1112,7 +1178,7 @@ AutomergeDocumentLoaderImpl = _ts_decorate3([
|
|
|
1112
1178
|
// packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator.ts
|
|
1113
1179
|
import { cbor as cbor2 } from "@dxos/automerge/automerge-repo";
|
|
1114
1180
|
import { Resource as Resource2 } from "@dxos/context";
|
|
1115
|
-
import { invariant as
|
|
1181
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
1116
1182
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
1117
1183
|
import { log as log3 } from "@dxos/log";
|
|
1118
1184
|
import { AutomergeReplicator } from "@dxos/teleport-extension-automerge-replicator";
|
|
@@ -1143,7 +1209,7 @@ var MeshEchoReplicator = class {
|
|
|
1143
1209
|
this._context = null;
|
|
1144
1210
|
}
|
|
1145
1211
|
createExtension() {
|
|
1146
|
-
|
|
1212
|
+
invariant4(this._context, void 0, {
|
|
1147
1213
|
F: __dxlog_file5,
|
|
1148
1214
|
L: 54,
|
|
1149
1215
|
S: this,
|
|
@@ -1163,7 +1229,7 @@ var MeshEchoReplicator = class {
|
|
|
1163
1229
|
S: this,
|
|
1164
1230
|
C: (f, a) => f(...a)
|
|
1165
1231
|
});
|
|
1166
|
-
|
|
1232
|
+
invariant4(this._context, void 0, {
|
|
1167
1233
|
F: __dxlog_file5,
|
|
1168
1234
|
L: 60,
|
|
1169
1235
|
S: this,
|
|
@@ -1176,8 +1242,8 @@ var MeshEchoReplicator = class {
|
|
|
1176
1242
|
this._context.onConnectionAuthScopeChanged(connection);
|
|
1177
1243
|
} else {
|
|
1178
1244
|
this._connectionsPerPeer.set(connection.peerId, connection);
|
|
1179
|
-
await connection.enable();
|
|
1180
1245
|
this._context.onConnectionOpen(connection);
|
|
1246
|
+
await connection.enable();
|
|
1181
1247
|
}
|
|
1182
1248
|
},
|
|
1183
1249
|
onRemoteDisconnected: async () => {
|
|
@@ -1190,8 +1256,8 @@ var MeshEchoReplicator = class {
|
|
|
1190
1256
|
C: (f, a) => f(...a)
|
|
1191
1257
|
});
|
|
1192
1258
|
this._context?.onConnectionClosed(connection);
|
|
1193
|
-
await connection.disable();
|
|
1194
1259
|
this._connectionsPerPeer.delete(connection.peerId);
|
|
1260
|
+
await connection.disable();
|
|
1195
1261
|
this._connections.delete(connection);
|
|
1196
1262
|
},
|
|
1197
1263
|
shouldAdvertize: async (params) => {
|
|
@@ -1204,7 +1270,7 @@ var MeshEchoReplicator = class {
|
|
|
1204
1270
|
S: this,
|
|
1205
1271
|
C: (f, a) => f(...a)
|
|
1206
1272
|
});
|
|
1207
|
-
|
|
1273
|
+
invariant4(this._context, void 0, {
|
|
1208
1274
|
F: __dxlog_file5,
|
|
1209
1275
|
L: 79,
|
|
1210
1276
|
S: this,
|
|
@@ -1344,7 +1410,7 @@ var MeshReplicatorConnection = class extends Resource2 {
|
|
|
1344
1410
|
});
|
|
1345
1411
|
}
|
|
1346
1412
|
get peerId() {
|
|
1347
|
-
|
|
1413
|
+
invariant4(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1348
1414
|
F: __dxlog_file5,
|
|
1349
1415
|
L: 215,
|
|
1350
1416
|
S: this,
|
|
@@ -1363,7 +1429,7 @@ var MeshReplicatorConnection = class extends Resource2 {
|
|
|
1363
1429
|
* Call after the remote peer has connected.
|
|
1364
1430
|
*/
|
|
1365
1431
|
async enable() {
|
|
1366
|
-
|
|
1432
|
+
invariant4(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1367
1433
|
F: __dxlog_file5,
|
|
1368
1434
|
L: 228,
|
|
1369
1435
|
S: this,
|
|
@@ -1386,6 +1452,8 @@ export {
|
|
|
1386
1452
|
AuthStatus,
|
|
1387
1453
|
AutomergeDocumentLoaderImpl,
|
|
1388
1454
|
AutomergeHost,
|
|
1455
|
+
CredentialRetrieverExtension,
|
|
1456
|
+
CredentialServerExtension,
|
|
1389
1457
|
DataServiceImpl,
|
|
1390
1458
|
LevelDBStorageAdapter,
|
|
1391
1459
|
LocalHostNetworkAdapter,
|