@dxos/echo-pipeline 0.5.8 → 0.5.9-main.2d0a5e6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-GANAND63.mjs → chunk-I2J5TTHJ.mjs} +48 -23
- package/dist/lib/browser/{chunk-GANAND63.mjs.map → chunk-I2J5TTHJ.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +31 -26
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +99 -4
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/{chunk-M475BGBI.cjs → chunk-QPCNQ4ZK.cjs} +51 -25
- package/dist/lib/node/chunk-QPCNQ4ZK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +52 -47
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +107 -13
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/automerge/automerge-doc-loader.d.ts +7 -3
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/migrations.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +2 -2
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +2 -2
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +9 -1
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +2 -2
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts +18 -0
- package/dist/types/src/testing/test-network-adapter.d.ts.map +1 -0
- package/package.json +33 -33
- package/src/automerge/automerge-doc-loader.test.ts +5 -2
- package/src/automerge/automerge-doc-loader.ts +6 -4
- package/src/automerge/automerge-host.test.ts +1 -553
- package/src/automerge/automerge-host.ts +12 -5
- package/src/automerge/automerge-repo.test.ts +450 -2
- package/src/automerge/migrations.ts +2 -1
- package/src/automerge/storage-adapter.test.ts +81 -15
- package/src/space/space-manager.ts +6 -4
- package/src/space/space-protocol.test.ts +3 -3
- package/src/space/space-protocol.ts +3 -3
- package/src/space/space.ts +32 -2
- package/src/testing/index.ts +1 -0
- package/src/testing/test-agent-builder.ts +4 -4
- package/src/testing/test-network-adapter.ts +62 -0
- package/dist/lib/node/chunk-M475BGBI.cjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -18,38 +18,39 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var node_exports = {};
|
|
20
20
|
__export(node_exports, {
|
|
21
|
-
AuthExtension: () =>
|
|
22
|
-
AuthStatus: () =>
|
|
21
|
+
AuthExtension: () => import_chunk_QPCNQ4ZK.AuthExtension,
|
|
22
|
+
AuthStatus: () => import_chunk_QPCNQ4ZK.AuthStatus,
|
|
23
23
|
AutomergeDocumentLoaderImpl: () => AutomergeDocumentLoaderImpl,
|
|
24
24
|
AutomergeHost: () => AutomergeHost,
|
|
25
25
|
AutomergeStorageAdapter: () => AutomergeStorageAdapter,
|
|
26
|
-
DataServiceImpl: () =>
|
|
26
|
+
DataServiceImpl: () => import_chunk_QPCNQ4ZK.DataServiceImpl,
|
|
27
27
|
LevelDBStorageAdapter: () => LevelDBStorageAdapter,
|
|
28
28
|
LocalHostNetworkAdapter: () => LocalHostNetworkAdapter,
|
|
29
|
-
MOCK_AUTH_PROVIDER: () =>
|
|
30
|
-
MOCK_AUTH_VERIFIER: () =>
|
|
29
|
+
MOCK_AUTH_PROVIDER: () => import_chunk_QPCNQ4ZK.MOCK_AUTH_PROVIDER,
|
|
30
|
+
MOCK_AUTH_VERIFIER: () => import_chunk_QPCNQ4ZK.MOCK_AUTH_VERIFIER,
|
|
31
31
|
MeshEchoReplicator: () => MeshEchoReplicator,
|
|
32
|
-
MetadataStore: () =>
|
|
33
|
-
Pipeline: () =>
|
|
34
|
-
SnapshotManager: () =>
|
|
35
|
-
SnapshotStore: () =>
|
|
36
|
-
Space: () =>
|
|
37
|
-
SpaceManager: () =>
|
|
38
|
-
SpaceProtocol: () =>
|
|
39
|
-
SpaceProtocolSession: () =>
|
|
40
|
-
TimeframeClock: () =>
|
|
41
|
-
codec: () =>
|
|
42
|
-
|
|
32
|
+
MetadataStore: () => import_chunk_QPCNQ4ZK.MetadataStore,
|
|
33
|
+
Pipeline: () => import_chunk_QPCNQ4ZK.Pipeline,
|
|
34
|
+
SnapshotManager: () => import_chunk_QPCNQ4ZK.SnapshotManager,
|
|
35
|
+
SnapshotStore: () => import_chunk_QPCNQ4ZK.SnapshotStore,
|
|
36
|
+
Space: () => import_chunk_QPCNQ4ZK.Space,
|
|
37
|
+
SpaceManager: () => import_chunk_QPCNQ4ZK.SpaceManager,
|
|
38
|
+
SpaceProtocol: () => import_chunk_QPCNQ4ZK.SpaceProtocol,
|
|
39
|
+
SpaceProtocolSession: () => import_chunk_QPCNQ4ZK.SpaceProtocolSession,
|
|
40
|
+
TimeframeClock: () => import_chunk_QPCNQ4ZK.TimeframeClock,
|
|
41
|
+
codec: () => import_chunk_QPCNQ4ZK.codec,
|
|
42
|
+
createIdFromSpaceKey: () => import_chunk_QPCNQ4ZK.createIdFromSpaceKey,
|
|
43
|
+
createMappedFeedWriter: () => import_chunk_QPCNQ4ZK.createMappedFeedWriter,
|
|
43
44
|
encodingOptions: () => encodingOptions,
|
|
44
45
|
getSpaceKeyFromDoc: () => getSpaceKeyFromDoc,
|
|
45
|
-
hasInvitationExpired: () =>
|
|
46
|
-
mapFeedIndexesToTimeframe: () =>
|
|
47
|
-
mapTimeframeToFeedIndexes: () =>
|
|
48
|
-
startAfter: () =>
|
|
49
|
-
valueEncoding: () =>
|
|
46
|
+
hasInvitationExpired: () => import_chunk_QPCNQ4ZK.hasInvitationExpired,
|
|
47
|
+
mapFeedIndexesToTimeframe: () => import_chunk_QPCNQ4ZK.mapFeedIndexesToTimeframe,
|
|
48
|
+
mapTimeframeToFeedIndexes: () => import_chunk_QPCNQ4ZK.mapTimeframeToFeedIndexes,
|
|
49
|
+
startAfter: () => import_chunk_QPCNQ4ZK.startAfter,
|
|
50
|
+
valueEncoding: () => import_chunk_QPCNQ4ZK.valueEncoding
|
|
50
51
|
});
|
|
51
52
|
module.exports = __toCommonJS(node_exports);
|
|
52
|
-
var
|
|
53
|
+
var import_chunk_QPCNQ4ZK = require("./chunk-QPCNQ4ZK.cjs");
|
|
53
54
|
var import_async = require("@dxos/async");
|
|
54
55
|
var import_automerge = require("@dxos/automerge/automerge");
|
|
55
56
|
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
@@ -667,7 +668,7 @@ var levelMigration = async ({ db, directory }) => {
|
|
|
667
668
|
chunks: chunks.length
|
|
668
669
|
}, {
|
|
669
670
|
F: __dxlog_file3,
|
|
670
|
-
L:
|
|
671
|
+
L: 37,
|
|
671
672
|
S: void 0,
|
|
672
673
|
C: (f, a) => f(...a)
|
|
673
674
|
});
|
|
@@ -701,6 +702,7 @@ var AutomergeHost = class {
|
|
|
701
702
|
this._indexMetadataStore = indexMetadataStore;
|
|
702
703
|
}
|
|
703
704
|
async open() {
|
|
705
|
+
this._peerId = `host-${import_keys.PublicKey.random().toHex()}`;
|
|
704
706
|
this._directory && await levelMigration({
|
|
705
707
|
db: this._db,
|
|
706
708
|
directory: this._directory
|
|
@@ -713,16 +715,17 @@ var AutomergeHost = class {
|
|
|
713
715
|
}
|
|
714
716
|
});
|
|
715
717
|
await this._storage.open?.();
|
|
716
|
-
this._peerId = `host-${import_keys.PublicKey.random().toHex()}`;
|
|
717
718
|
this._clientNetwork = new LocalHostNetworkAdapter();
|
|
718
719
|
this._repo = new import_automerge_repo.Repo({
|
|
719
720
|
peerId: this._peerId,
|
|
721
|
+
sharePolicy: this._sharePolicy.bind(this),
|
|
722
|
+
storage: this._storage,
|
|
720
723
|
network: [
|
|
724
|
+
// Downstream client.
|
|
721
725
|
this._clientNetwork,
|
|
726
|
+
// Upstream swarm.
|
|
722
727
|
this._echoNetworkAdapter
|
|
723
|
-
]
|
|
724
|
-
storage: this._storage,
|
|
725
|
-
sharePolicy: this._sharePolicy.bind(this)
|
|
728
|
+
]
|
|
726
729
|
});
|
|
727
730
|
this._clientNetwork.ready();
|
|
728
731
|
await this._echoNetworkAdapter.open();
|
|
@@ -764,7 +767,7 @@ var AutomergeHost = class {
|
|
|
764
767
|
isRequested
|
|
765
768
|
}, {
|
|
766
769
|
F: __dxlog_file4,
|
|
767
|
-
L:
|
|
770
|
+
L: 156,
|
|
768
771
|
S: this,
|
|
769
772
|
C: (f, a) => f(...a)
|
|
770
773
|
});
|
|
@@ -850,7 +853,7 @@ var AutomergeHost = class {
|
|
|
850
853
|
await Promise.all(states?.map(async ({ heads, documentId }) => {
|
|
851
854
|
(0, import_invariant.invariant)(heads, "heads are required for flush", {
|
|
852
855
|
F: __dxlog_file4,
|
|
853
|
-
L:
|
|
856
|
+
L: 250,
|
|
854
857
|
S: this,
|
|
855
858
|
A: [
|
|
856
859
|
"heads",
|
|
@@ -930,9 +933,10 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
930
933
|
}
|
|
931
934
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
932
935
|
var AutomergeDocumentLoaderImpl = class {
|
|
933
|
-
constructor(
|
|
934
|
-
this.
|
|
936
|
+
constructor(_spaceId, _repo, _spaceKey) {
|
|
937
|
+
this._spaceId = _spaceId;
|
|
935
938
|
this._repo = _repo;
|
|
939
|
+
this._spaceKey = _spaceKey;
|
|
936
940
|
this._spaceRootDocHandle = null;
|
|
937
941
|
this._objectDocumentHandles = /* @__PURE__ */ new Map();
|
|
938
942
|
this._objectsPendingDocumentLoad = /* @__PURE__ */ new Set();
|
|
@@ -950,10 +954,10 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
950
954
|
}
|
|
951
955
|
if (!spaceState.rootUrl) {
|
|
952
956
|
import_log4.log.error("Database opened with no rootUrl", {
|
|
953
|
-
|
|
957
|
+
spaceId: this._spaceId
|
|
954
958
|
}, {
|
|
955
959
|
F: __dxlog_file5,
|
|
956
|
-
L:
|
|
960
|
+
L: 72,
|
|
957
961
|
S: this,
|
|
958
962
|
C: (f, a) => f(...a)
|
|
959
963
|
});
|
|
@@ -963,7 +967,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
963
967
|
const doc = existingDocHandle.docSync();
|
|
964
968
|
(0, import_invariant4.invariant)(doc, void 0, {
|
|
965
969
|
F: __dxlog_file5,
|
|
966
|
-
L:
|
|
970
|
+
L: 77,
|
|
967
971
|
S: this,
|
|
968
972
|
A: [
|
|
969
973
|
"doc",
|
|
@@ -985,7 +989,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
985
989
|
for (const objectId of objectIds) {
|
|
986
990
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
987
991
|
F: __dxlog_file5,
|
|
988
|
-
L:
|
|
992
|
+
L: 90,
|
|
989
993
|
S: this,
|
|
990
994
|
A: [
|
|
991
995
|
"this._spaceRootDocHandle",
|
|
@@ -998,7 +1002,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
998
1002
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
999
1003
|
(0, import_invariant4.invariant)(spaceRootDoc, void 0, {
|
|
1000
1004
|
F: __dxlog_file5,
|
|
1001
|
-
L:
|
|
1005
|
+
L: 95,
|
|
1002
1006
|
S: this,
|
|
1003
1007
|
A: [
|
|
1004
1008
|
"spaceRootDoc",
|
|
@@ -1012,7 +1016,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1012
1016
|
objectId
|
|
1013
1017
|
}, {
|
|
1014
1018
|
F: __dxlog_file5,
|
|
1015
|
-
L:
|
|
1019
|
+
L: 99,
|
|
1016
1020
|
S: this,
|
|
1017
1021
|
C: (f, a) => f(...a)
|
|
1018
1022
|
});
|
|
@@ -1036,7 +1040,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1036
1040
|
getSpaceRootDocHandle() {
|
|
1037
1041
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1038
1042
|
F: __dxlog_file5,
|
|
1039
|
-
L:
|
|
1043
|
+
L: 122,
|
|
1040
1044
|
S: this,
|
|
1041
1045
|
A: [
|
|
1042
1046
|
"this._spaceRootDocHandle",
|
|
@@ -1048,7 +1052,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1048
1052
|
createDocumentForObject(objectId) {
|
|
1049
1053
|
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1050
1054
|
F: __dxlog_file5,
|
|
1051
|
-
L:
|
|
1055
|
+
L: 127,
|
|
1052
1056
|
S: this,
|
|
1053
1057
|
A: [
|
|
1054
1058
|
"this._spaceRootDocHandle",
|
|
@@ -1091,7 +1095,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1091
1095
|
actualDocumentUrl: objectDocumentHandle.url
|
|
1092
1096
|
}, {
|
|
1093
1097
|
F: __dxlog_file5,
|
|
1094
|
-
L:
|
|
1098
|
+
L: 157,
|
|
1095
1099
|
S: this,
|
|
1096
1100
|
C: (f, a) => f(...a)
|
|
1097
1101
|
});
|
|
@@ -1100,7 +1104,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1100
1104
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
1101
1105
|
import_log4.log.warn("object document was already loaded", logMeta, {
|
|
1102
1106
|
F: __dxlog_file5,
|
|
1103
|
-
L:
|
|
1107
|
+
L: 164,
|
|
1104
1108
|
S: this,
|
|
1105
1109
|
C: (f, a) => f(...a)
|
|
1106
1110
|
});
|
|
@@ -1109,7 +1113,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1109
1113
|
const handle = this._repo.find(automergeUrl);
|
|
1110
1114
|
import_log4.log.debug("document loading triggered", logMeta, {
|
|
1111
1115
|
F: __dxlog_file5,
|
|
1112
|
-
L:
|
|
1116
|
+
L: 168,
|
|
1113
1117
|
S: this,
|
|
1114
1118
|
C: (f, a) => f(...a)
|
|
1115
1119
|
});
|
|
@@ -1121,7 +1125,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1121
1125
|
const docHandle = this._repo.find(url);
|
|
1122
1126
|
while (true) {
|
|
1123
1127
|
try {
|
|
1124
|
-
await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (
|
|
1128
|
+
await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (CoreDatabase)", async () => {
|
|
1125
1129
|
await (0, import_context4.cancelWithContext)(ctx, docHandle.whenReady());
|
|
1126
1130
|
});
|
|
1127
1131
|
break;
|
|
@@ -1132,7 +1136,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1132
1136
|
state: docHandle.state
|
|
1133
1137
|
}, {
|
|
1134
1138
|
F: __dxlog_file5,
|
|
1135
|
-
L:
|
|
1139
|
+
L: 184,
|
|
1136
1140
|
S: this,
|
|
1137
1141
|
C: (f, a) => f(...a)
|
|
1138
1142
|
});
|
|
@@ -1174,7 +1178,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1174
1178
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1175
1179
|
import_log4.log.info("document loaded after all listeners were removed", logMeta, {
|
|
1176
1180
|
F: __dxlog_file5,
|
|
1177
|
-
L:
|
|
1181
|
+
L: 220,
|
|
1178
1182
|
S: this,
|
|
1179
1183
|
C: (f, a) => f(...a)
|
|
1180
1184
|
});
|
|
@@ -1184,7 +1188,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1184
1188
|
if (objectDocHandle?.url !== handle.url) {
|
|
1185
1189
|
import_log4.log.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1186
1190
|
F: __dxlog_file5,
|
|
1187
|
-
L:
|
|
1191
|
+
L: 225,
|
|
1188
1192
|
S: this,
|
|
1189
1193
|
C: (f, a) => f(...a)
|
|
1190
1194
|
});
|
|
@@ -1203,7 +1207,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1203
1207
|
err
|
|
1204
1208
|
}, {
|
|
1205
1209
|
F: __dxlog_file5,
|
|
1206
|
-
L:
|
|
1210
|
+
L: 231,
|
|
1207
1211
|
S: this,
|
|
1208
1212
|
C: (f, a) => f(...a)
|
|
1209
1213
|
});
|
|
@@ -1495,6 +1499,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
|
|
|
1495
1499
|
SpaceProtocolSession,
|
|
1496
1500
|
TimeframeClock,
|
|
1497
1501
|
codec,
|
|
1502
|
+
createIdFromSpaceKey,
|
|
1498
1503
|
createMappedFeedWriter,
|
|
1499
1504
|
encodingOptions,
|
|
1500
1505
|
getSpaceKeyFromDoc,
|