@dxos/echo-pipeline 0.5.8-main.f69e6e4 → 0.5.8

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