@dxos/echo-pipeline 0.6.1-main.babcd84 → 0.6.1-main.c52e5db
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-O3MAK5PY.mjs → chunk-A2LCXJVD.mjs} +4 -1
- package/dist/lib/browser/chunk-A2LCXJVD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +121 -67
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-QATBVT6S.cjs → chunk-GHBIMYZK.cjs} +7 -4
- package/dist/lib/node/chunk-GHBIMYZK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +171 -117
- package/dist/lib/node/index.cjs.map +3 -3
- 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 -0
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/db-host/data-service.d.ts +3 -2
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-host.ts +26 -4
- package/src/automerge/automerge-repo.test.ts +76 -1
- package/src/db-host/data-service.ts +6 -1
- package/dist/lib/browser/chunk-O3MAK5PY.mjs.map +0 -7
- package/dist/lib/node/chunk-QATBVT6S.cjs.map +0 -7
|
@@ -25,14 +25,16 @@ import {
|
|
|
25
25
|
mapTimeframeToFeedIndexes,
|
|
26
26
|
startAfter,
|
|
27
27
|
valueEncoding
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-A2LCXJVD.mjs";
|
|
29
29
|
|
|
30
30
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts
|
|
31
31
|
import { Event, asyncTimeout } from "@dxos/async";
|
|
32
32
|
import { next as automerge, getBackend, getHeads, isAutomerge, save } from "@dxos/automerge/automerge";
|
|
33
33
|
import { Repo } from "@dxos/automerge/automerge-repo";
|
|
34
34
|
import { Resource as Resource2, cancelWithContext } from "@dxos/context";
|
|
35
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
35
36
|
import { PublicKey } from "@dxos/keys";
|
|
37
|
+
import { log as log2 } from "@dxos/log";
|
|
36
38
|
import { objectPointerCodec } from "@dxos/protocols";
|
|
37
39
|
import { trace } from "@dxos/tracing";
|
|
38
40
|
import { mapValues } from "@dxos/util";
|
|
@@ -602,12 +604,14 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
602
604
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
603
605
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
604
606
|
}
|
|
607
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
|
|
605
608
|
var AutomergeHost = class extends Resource2 {
|
|
606
609
|
constructor({ db, indexMetadataStore }) {
|
|
607
610
|
super();
|
|
608
611
|
this._echoNetworkAdapter = new EchoNetworkAdapter({
|
|
609
612
|
getContainingSpaceForDocument: this._getContainingSpaceForDocument.bind(this)
|
|
610
613
|
});
|
|
614
|
+
this._db = db;
|
|
611
615
|
this._storage = new LevelDBStorageAdapter({
|
|
612
616
|
db: db.sublevel("automerge"),
|
|
613
617
|
callbacks: {
|
|
@@ -691,6 +695,56 @@ var AutomergeHost = class extends Resource2 {
|
|
|
691
695
|
return this._repo.create(initialValue);
|
|
692
696
|
}
|
|
693
697
|
}
|
|
698
|
+
async reIndexHeads(documentIds) {
|
|
699
|
+
for (const documentId of documentIds) {
|
|
700
|
+
log2.info("reindexing heads for document", {
|
|
701
|
+
documentId
|
|
702
|
+
}, {
|
|
703
|
+
F: __dxlog_file3,
|
|
704
|
+
L: 191,
|
|
705
|
+
S: this,
|
|
706
|
+
C: (f, a) => f(...a)
|
|
707
|
+
});
|
|
708
|
+
const handle = this._repo.find(documentId);
|
|
709
|
+
await handle.whenReady([
|
|
710
|
+
"ready",
|
|
711
|
+
"requesting"
|
|
712
|
+
]);
|
|
713
|
+
if (handle.inState([
|
|
714
|
+
"requesting"
|
|
715
|
+
])) {
|
|
716
|
+
log2.warn("document is not available locally, skipping", {
|
|
717
|
+
documentId
|
|
718
|
+
}, {
|
|
719
|
+
F: __dxlog_file3,
|
|
720
|
+
L: 195,
|
|
721
|
+
S: this,
|
|
722
|
+
C: (f, a) => f(...a)
|
|
723
|
+
});
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
const doc = handle.docSync();
|
|
727
|
+
invariant3(doc, void 0, {
|
|
728
|
+
F: __dxlog_file3,
|
|
729
|
+
L: 200,
|
|
730
|
+
S: this,
|
|
731
|
+
A: [
|
|
732
|
+
"doc",
|
|
733
|
+
""
|
|
734
|
+
]
|
|
735
|
+
});
|
|
736
|
+
const heads = getHeads(doc);
|
|
737
|
+
const batch = this._db.batch();
|
|
738
|
+
this._headsStore.setHeads(documentId, heads, batch);
|
|
739
|
+
await batch.write();
|
|
740
|
+
}
|
|
741
|
+
log2.info("done reindexing heads", void 0, {
|
|
742
|
+
F: __dxlog_file3,
|
|
743
|
+
L: 207,
|
|
744
|
+
S: this,
|
|
745
|
+
C: (f, a) => f(...a)
|
|
746
|
+
});
|
|
747
|
+
}
|
|
694
748
|
// TODO(dmaretskyi): Share based on HALO permissions and space affinity.
|
|
695
749
|
// Hosts, running in the worker, don't share documents unless requested by other peers.
|
|
696
750
|
// NOTE: If both peers return sharePolicy=false the replication will not happen
|
|
@@ -875,8 +929,8 @@ import { interpretAsDocumentId } from "@dxos/automerge/automerge-repo";
|
|
|
875
929
|
import { cancelWithContext as cancelWithContext2 } from "@dxos/context";
|
|
876
930
|
import { warnAfterTimeout } from "@dxos/debug";
|
|
877
931
|
import { SpaceDocVersion } from "@dxos/echo-protocol";
|
|
878
|
-
import { invariant as
|
|
879
|
-
import { log as
|
|
932
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
933
|
+
import { log as log3 } from "@dxos/log";
|
|
880
934
|
import { trace as trace2 } from "@dxos/tracing";
|
|
881
935
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
882
936
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -888,7 +942,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
888
942
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
889
943
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
890
944
|
}
|
|
891
|
-
var
|
|
945
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
892
946
|
var AutomergeDocumentLoaderImpl = class {
|
|
893
947
|
constructor(_spaceId, _repo, _spaceKey) {
|
|
894
948
|
this._spaceId = _spaceId;
|
|
@@ -914,8 +968,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
914
968
|
}
|
|
915
969
|
const existingDocHandle = await this._initDocHandle(ctx, spaceState.rootUrl);
|
|
916
970
|
const doc = existingDocHandle.docSync();
|
|
917
|
-
|
|
918
|
-
F:
|
|
971
|
+
invariant4(doc, void 0, {
|
|
972
|
+
F: __dxlog_file4,
|
|
919
973
|
L: 84,
|
|
920
974
|
S: this,
|
|
921
975
|
A: [
|
|
@@ -923,8 +977,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
923
977
|
""
|
|
924
978
|
]
|
|
925
979
|
});
|
|
926
|
-
|
|
927
|
-
F:
|
|
980
|
+
invariant4(doc.version === SpaceDocVersion.CURRENT, void 0, {
|
|
981
|
+
F: __dxlog_file4,
|
|
928
982
|
L: 85,
|
|
929
983
|
S: this,
|
|
930
984
|
A: [
|
|
@@ -944,8 +998,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
944
998
|
let hasUrlsToLoad = false;
|
|
945
999
|
const urlsToLoad = {};
|
|
946
1000
|
for (const objectId of objectIds) {
|
|
947
|
-
|
|
948
|
-
F:
|
|
1001
|
+
invariant4(this._spaceRootDocHandle, void 0, {
|
|
1002
|
+
F: __dxlog_file4,
|
|
949
1003
|
L: 97,
|
|
950
1004
|
S: this,
|
|
951
1005
|
A: [
|
|
@@ -957,8 +1011,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
957
1011
|
continue;
|
|
958
1012
|
}
|
|
959
1013
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
960
|
-
|
|
961
|
-
F:
|
|
1014
|
+
invariant4(spaceRootDoc, void 0, {
|
|
1015
|
+
F: __dxlog_file4,
|
|
962
1016
|
L: 102,
|
|
963
1017
|
S: this,
|
|
964
1018
|
A: [
|
|
@@ -969,10 +1023,10 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
969
1023
|
const documentUrl = (spaceRootDoc.links ?? {})[objectId];
|
|
970
1024
|
if (documentUrl == null) {
|
|
971
1025
|
this._objectsPendingDocumentLoad.add(objectId);
|
|
972
|
-
|
|
1026
|
+
log3.info("loading delayed until object links are initialized", {
|
|
973
1027
|
objectId
|
|
974
1028
|
}, {
|
|
975
|
-
F:
|
|
1029
|
+
F: __dxlog_file4,
|
|
976
1030
|
L: 106,
|
|
977
1031
|
S: this,
|
|
978
1032
|
C: (f, a) => f(...a)
|
|
@@ -987,8 +1041,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
987
1041
|
}
|
|
988
1042
|
}
|
|
989
1043
|
getObjectDocumentId(objectId) {
|
|
990
|
-
|
|
991
|
-
F:
|
|
1044
|
+
invariant4(this._spaceRootDocHandle, void 0, {
|
|
1045
|
+
F: __dxlog_file4,
|
|
992
1046
|
L: 118,
|
|
993
1047
|
S: this,
|
|
994
1048
|
A: [
|
|
@@ -997,8 +1051,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
997
1051
|
]
|
|
998
1052
|
});
|
|
999
1053
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
1000
|
-
|
|
1001
|
-
F:
|
|
1054
|
+
invariant4(spaceRootDoc, void 0, {
|
|
1055
|
+
F: __dxlog_file4,
|
|
1002
1056
|
L: 120,
|
|
1003
1057
|
S: this,
|
|
1004
1058
|
A: [
|
|
@@ -1021,8 +1075,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1021
1075
|
linksAwaitingLoad.forEach(([objectId]) => this._objectsPendingDocumentLoad.delete(objectId));
|
|
1022
1076
|
}
|
|
1023
1077
|
getSpaceRootDocHandle() {
|
|
1024
|
-
|
|
1025
|
-
F:
|
|
1078
|
+
invariant4(this._spaceRootDocHandle, void 0, {
|
|
1079
|
+
F: __dxlog_file4,
|
|
1026
1080
|
L: 140,
|
|
1027
1081
|
S: this,
|
|
1028
1082
|
A: [
|
|
@@ -1033,8 +1087,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1033
1087
|
return this._spaceRootDocHandle;
|
|
1034
1088
|
}
|
|
1035
1089
|
createDocumentForObject(objectId) {
|
|
1036
|
-
|
|
1037
|
-
F:
|
|
1090
|
+
invariant4(this._spaceRootDocHandle, void 0, {
|
|
1091
|
+
F: __dxlog_file4,
|
|
1038
1092
|
L: 145,
|
|
1039
1093
|
S: this,
|
|
1040
1094
|
A: [
|
|
@@ -1075,11 +1129,11 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1075
1129
|
};
|
|
1076
1130
|
const objectDocumentHandle = this._objectDocumentHandles.get(objectId);
|
|
1077
1131
|
if (objectDocumentHandle != null && objectDocumentHandle.url !== automergeUrl) {
|
|
1078
|
-
|
|
1132
|
+
log3.warn("object already inlined in a different document, ignoring the link", {
|
|
1079
1133
|
...logMeta,
|
|
1080
1134
|
actualDocumentUrl: objectDocumentHandle.url
|
|
1081
1135
|
}, {
|
|
1082
|
-
F:
|
|
1136
|
+
F: __dxlog_file4,
|
|
1083
1137
|
L: 177,
|
|
1084
1138
|
S: this,
|
|
1085
1139
|
C: (f, a) => f(...a)
|
|
@@ -1087,8 +1141,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1087
1141
|
continue;
|
|
1088
1142
|
}
|
|
1089
1143
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
1090
|
-
|
|
1091
|
-
F:
|
|
1144
|
+
log3.warn("object document was already loaded", logMeta, {
|
|
1145
|
+
F: __dxlog_file4,
|
|
1092
1146
|
L: 184,
|
|
1093
1147
|
S: this,
|
|
1094
1148
|
C: (f, a) => f(...a)
|
|
@@ -1096,8 +1150,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1096
1150
|
continue;
|
|
1097
1151
|
}
|
|
1098
1152
|
const handle = this._repo.find(automergeUrl);
|
|
1099
|
-
|
|
1100
|
-
F:
|
|
1153
|
+
log3.debug("document loading triggered", logMeta, {
|
|
1154
|
+
F: __dxlog_file4,
|
|
1101
1155
|
L: 188,
|
|
1102
1156
|
S: this,
|
|
1103
1157
|
C: (f, a) => f(...a)
|
|
@@ -1116,11 +1170,11 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1116
1170
|
break;
|
|
1117
1171
|
} catch (err) {
|
|
1118
1172
|
if (`${err}`.includes("Timeout")) {
|
|
1119
|
-
|
|
1173
|
+
log3.info("wraparound", {
|
|
1120
1174
|
id: docHandle.documentId,
|
|
1121
1175
|
state: docHandle.state
|
|
1122
1176
|
}, {
|
|
1123
|
-
F:
|
|
1177
|
+
F: __dxlog_file4,
|
|
1124
1178
|
L: 204,
|
|
1125
1179
|
S: this,
|
|
1126
1180
|
C: (f, a) => f(...a)
|
|
@@ -1151,8 +1205,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1151
1205
|
docUrl: handle.url
|
|
1152
1206
|
};
|
|
1153
1207
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1154
|
-
|
|
1155
|
-
F:
|
|
1208
|
+
log3.info("document loaded after all listeners were removed", logMeta, {
|
|
1209
|
+
F: __dxlog_file4,
|
|
1156
1210
|
L: 231,
|
|
1157
1211
|
S: this,
|
|
1158
1212
|
C: (f, a) => f(...a)
|
|
@@ -1161,8 +1215,8 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1161
1215
|
}
|
|
1162
1216
|
const objectDocHandle = this._objectDocumentHandles.get(objectId);
|
|
1163
1217
|
if (objectDocHandle?.url !== handle.url) {
|
|
1164
|
-
|
|
1165
|
-
F:
|
|
1218
|
+
log3.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1219
|
+
F: __dxlog_file4,
|
|
1166
1220
|
L: 236,
|
|
1167
1221
|
S: this,
|
|
1168
1222
|
C: (f, a) => f(...a)
|
|
@@ -1175,13 +1229,13 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1175
1229
|
});
|
|
1176
1230
|
} catch (err) {
|
|
1177
1231
|
const shouldRetryLoading = this.onObjectDocumentLoaded.listenerCount() > 0;
|
|
1178
|
-
|
|
1232
|
+
log3.warn("failed to load a document", {
|
|
1179
1233
|
objectId,
|
|
1180
1234
|
automergeUrl: handle.url,
|
|
1181
1235
|
retryLoading: shouldRetryLoading,
|
|
1182
1236
|
err
|
|
1183
1237
|
}, {
|
|
1184
|
-
F:
|
|
1238
|
+
F: __dxlog_file4,
|
|
1185
1239
|
L: 242,
|
|
1186
1240
|
S: this,
|
|
1187
1241
|
C: (f, a) => f(...a)
|
|
@@ -1204,12 +1258,12 @@ AutomergeDocumentLoaderImpl = _ts_decorate3([
|
|
|
1204
1258
|
// packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator.ts
|
|
1205
1259
|
import { cbor as cbor2 } from "@dxos/automerge/automerge-repo";
|
|
1206
1260
|
import { Resource as Resource3 } from "@dxos/context";
|
|
1207
|
-
import { invariant as
|
|
1261
|
+
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1208
1262
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
1209
|
-
import { log as
|
|
1263
|
+
import { log as log4 } from "@dxos/log";
|
|
1210
1264
|
import { AutomergeReplicator } from "@dxos/teleport-extension-automerge-replicator";
|
|
1211
1265
|
import { ComplexMap, ComplexSet, defaultMap } from "@dxos/util";
|
|
1212
|
-
var
|
|
1266
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/mesh-echo-replicator.ts";
|
|
1213
1267
|
var MeshEchoReplicator = class {
|
|
1214
1268
|
constructor() {
|
|
1215
1269
|
this._connections = /* @__PURE__ */ new Set();
|
|
@@ -1235,8 +1289,8 @@ var MeshEchoReplicator = class {
|
|
|
1235
1289
|
this._context = null;
|
|
1236
1290
|
}
|
|
1237
1291
|
createExtension() {
|
|
1238
|
-
|
|
1239
|
-
F:
|
|
1292
|
+
invariant5(this._context, void 0, {
|
|
1293
|
+
F: __dxlog_file5,
|
|
1240
1294
|
L: 54,
|
|
1241
1295
|
S: this,
|
|
1242
1296
|
A: [
|
|
@@ -1247,16 +1301,16 @@ var MeshEchoReplicator = class {
|
|
|
1247
1301
|
const connection = new MeshReplicatorConnection({
|
|
1248
1302
|
ownPeerId: this._context.peerId,
|
|
1249
1303
|
onRemoteConnected: async () => {
|
|
1250
|
-
|
|
1304
|
+
log4("onRemoteConnected", {
|
|
1251
1305
|
peerId: connection.peerId
|
|
1252
1306
|
}, {
|
|
1253
|
-
F:
|
|
1307
|
+
F: __dxlog_file5,
|
|
1254
1308
|
L: 59,
|
|
1255
1309
|
S: this,
|
|
1256
1310
|
C: (f, a) => f(...a)
|
|
1257
1311
|
});
|
|
1258
|
-
|
|
1259
|
-
F:
|
|
1312
|
+
invariant5(this._context, void 0, {
|
|
1313
|
+
F: __dxlog_file5,
|
|
1260
1314
|
L: 60,
|
|
1261
1315
|
S: this,
|
|
1262
1316
|
A: [
|
|
@@ -1273,10 +1327,10 @@ var MeshEchoReplicator = class {
|
|
|
1273
1327
|
}
|
|
1274
1328
|
},
|
|
1275
1329
|
onRemoteDisconnected: async () => {
|
|
1276
|
-
|
|
1330
|
+
log4("onRemoteDisconnected", {
|
|
1277
1331
|
peerId: connection.peerId
|
|
1278
1332
|
}, {
|
|
1279
|
-
F:
|
|
1333
|
+
F: __dxlog_file5,
|
|
1280
1334
|
L: 71,
|
|
1281
1335
|
S: this,
|
|
1282
1336
|
C: (f, a) => f(...a)
|
|
@@ -1287,17 +1341,17 @@ var MeshEchoReplicator = class {
|
|
|
1287
1341
|
this._connections.delete(connection);
|
|
1288
1342
|
},
|
|
1289
1343
|
shouldAdvertize: async (params) => {
|
|
1290
|
-
|
|
1344
|
+
log4("shouldAdvertize", {
|
|
1291
1345
|
peerId: connection.peerId,
|
|
1292
1346
|
documentId: params.documentId
|
|
1293
1347
|
}, {
|
|
1294
|
-
F:
|
|
1348
|
+
F: __dxlog_file5,
|
|
1295
1349
|
L: 78,
|
|
1296
1350
|
S: this,
|
|
1297
1351
|
C: (f, a) => f(...a)
|
|
1298
1352
|
});
|
|
1299
|
-
|
|
1300
|
-
F:
|
|
1353
|
+
invariant5(this._context, void 0, {
|
|
1354
|
+
F: __dxlog_file5,
|
|
1301
1355
|
L: 79,
|
|
1302
1356
|
S: this,
|
|
1303
1357
|
A: [
|
|
@@ -1308,11 +1362,11 @@ var MeshEchoReplicator = class {
|
|
|
1308
1362
|
try {
|
|
1309
1363
|
const spaceKey = await this._context.getContainingSpaceForDocument(params.documentId);
|
|
1310
1364
|
if (!spaceKey) {
|
|
1311
|
-
|
|
1365
|
+
log4("space key not found for share policy check", {
|
|
1312
1366
|
peerId: connection.peerId,
|
|
1313
1367
|
documentId: params.documentId
|
|
1314
1368
|
}, {
|
|
1315
|
-
F:
|
|
1369
|
+
F: __dxlog_file5,
|
|
1316
1370
|
L: 83,
|
|
1317
1371
|
S: this,
|
|
1318
1372
|
C: (f, a) => f(...a)
|
|
@@ -1321,11 +1375,11 @@ var MeshEchoReplicator = class {
|
|
|
1321
1375
|
}
|
|
1322
1376
|
const authorizedDevices = this._authorizedDevices.get(spaceKey);
|
|
1323
1377
|
if (!connection.remoteDeviceKey) {
|
|
1324
|
-
|
|
1378
|
+
log4("device key not found for share policy check", {
|
|
1325
1379
|
peerId: connection.peerId,
|
|
1326
1380
|
documentId: params.documentId
|
|
1327
1381
|
}, {
|
|
1328
|
-
F:
|
|
1382
|
+
F: __dxlog_file5,
|
|
1329
1383
|
L: 93,
|
|
1330
1384
|
S: this,
|
|
1331
1385
|
C: (f, a) => f(...a)
|
|
@@ -1333,7 +1387,7 @@ var MeshEchoReplicator = class {
|
|
|
1333
1387
|
return false;
|
|
1334
1388
|
}
|
|
1335
1389
|
const isAuthorized = authorizedDevices?.has(connection.remoteDeviceKey) ?? false;
|
|
1336
|
-
|
|
1390
|
+
log4("share policy check", {
|
|
1337
1391
|
localPeer: this._context.peerId,
|
|
1338
1392
|
remotePeer: connection.peerId,
|
|
1339
1393
|
documentId: params.documentId,
|
|
@@ -1341,15 +1395,15 @@ var MeshEchoReplicator = class {
|
|
|
1341
1395
|
spaceKey,
|
|
1342
1396
|
isAuthorized
|
|
1343
1397
|
}, {
|
|
1344
|
-
F:
|
|
1398
|
+
F: __dxlog_file5,
|
|
1345
1399
|
L: 101,
|
|
1346
1400
|
S: this,
|
|
1347
1401
|
C: (f, a) => f(...a)
|
|
1348
1402
|
});
|
|
1349
1403
|
return isAuthorized;
|
|
1350
1404
|
} catch (err) {
|
|
1351
|
-
|
|
1352
|
-
F:
|
|
1405
|
+
log4.catch(err, void 0, {
|
|
1406
|
+
F: __dxlog_file5,
|
|
1353
1407
|
L: 111,
|
|
1354
1408
|
S: this,
|
|
1355
1409
|
C: (f, a) => f(...a)
|
|
@@ -1362,11 +1416,11 @@ var MeshEchoReplicator = class {
|
|
|
1362
1416
|
return connection.replicatorExtension;
|
|
1363
1417
|
}
|
|
1364
1418
|
authorizeDevice(spaceKey, deviceKey) {
|
|
1365
|
-
|
|
1419
|
+
log4("authorizeDevice", {
|
|
1366
1420
|
spaceKey,
|
|
1367
1421
|
deviceKey
|
|
1368
1422
|
}, {
|
|
1369
|
-
F:
|
|
1423
|
+
F: __dxlog_file5,
|
|
1370
1424
|
L: 122,
|
|
1371
1425
|
S: this,
|
|
1372
1426
|
C: (f, a) => f(...a)
|
|
@@ -1408,12 +1462,12 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1408
1462
|
onStartReplication: async (info, remotePeerId) => {
|
|
1409
1463
|
this.remoteDeviceKey = remotePeerId;
|
|
1410
1464
|
this._remotePeerId = info.id;
|
|
1411
|
-
|
|
1465
|
+
log4("onStartReplication", {
|
|
1412
1466
|
id: info.id,
|
|
1413
1467
|
thisPeerId: this.peerId,
|
|
1414
1468
|
remotePeerId: remotePeerId.toHex()
|
|
1415
1469
|
}, {
|
|
1416
|
-
F:
|
|
1470
|
+
F: __dxlog_file5,
|
|
1417
1471
|
L: 192,
|
|
1418
1472
|
S: this,
|
|
1419
1473
|
C: (f, a) => f(...a)
|
|
@@ -1436,8 +1490,8 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1436
1490
|
});
|
|
1437
1491
|
}
|
|
1438
1492
|
get peerId() {
|
|
1439
|
-
|
|
1440
|
-
F:
|
|
1493
|
+
invariant5(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1494
|
+
F: __dxlog_file5,
|
|
1441
1495
|
L: 215,
|
|
1442
1496
|
S: this,
|
|
1443
1497
|
A: [
|
|
@@ -1455,8 +1509,8 @@ var MeshReplicatorConnection = class extends Resource3 {
|
|
|
1455
1509
|
* Call after the remote peer has connected.
|
|
1456
1510
|
*/
|
|
1457
1511
|
async enable() {
|
|
1458
|
-
|
|
1459
|
-
F:
|
|
1512
|
+
invariant5(this._remotePeerId != null, "Remote peer has not connected yet.", {
|
|
1513
|
+
F: __dxlog_file5,
|
|
1460
1514
|
L: 228,
|
|
1461
1515
|
S: this,
|
|
1462
1516
|
A: [
|