@dxos/echo-pipeline 0.1.45 → 0.1.46-next.c3cc04c

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.
@@ -792,7 +792,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
792
792
  // packages/core/echo/echo-pipeline/src/space/space.ts
793
793
  var import_node_assert9 = __toESM(require("node:assert"));
794
794
  var import_async7 = require("@dxos/async");
795
- var import_log9 = require("@dxos/log");
795
+ var import_log10 = require("@dxos/log");
796
796
  var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
797
797
  var import_util5 = require("@dxos/util");
798
798
 
@@ -917,7 +917,7 @@ var import_async6 = require("@dxos/async");
917
917
  var import_context3 = require("@dxos/context");
918
918
  var import_credentials3 = require("@dxos/credentials");
919
919
  var import_echo_db3 = require("@dxos/echo-db");
920
- var import_log8 = require("@dxos/log");
920
+ var import_log9 = require("@dxos/log");
921
921
  var import_timeframe3 = require("@dxos/timeframe");
922
922
 
923
923
  // packages/core/echo/echo-pipeline/src/dbhost/data-service-host.ts
@@ -1060,6 +1060,8 @@ var DatabaseHost = class {
1060
1060
 
1061
1061
  // packages/core/echo/echo-pipeline/src/dbhost/snapshot-manager.ts
1062
1062
  var import_async5 = require("@dxos/async");
1063
+ var import_debug4 = require("@dxos/debug");
1064
+ var import_log7 = require("@dxos/log");
1063
1065
  var import_protocols4 = require("@dxos/protocols");
1064
1066
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
1065
1067
  var __decorate4 = function(decorators, target, key, desc) {
@@ -1079,6 +1081,15 @@ var SnapshotManager = class SnapshotManager2 {
1079
1081
  this._objectSync = new import_teleport_extension_object_sync.ObjectSync({
1080
1082
  getObject: async (id) => {
1081
1083
  const snapshot = await this._snapshotStore.loadSnapshot(id);
1084
+ (0, import_log7.log)("getObject", {
1085
+ id,
1086
+ snapshot
1087
+ }, {
1088
+ file: "snapshot-manager.ts",
1089
+ line: 30,
1090
+ scope: this,
1091
+ callSite: (f, a) => f(...a)
1092
+ });
1082
1093
  if (!snapshot) {
1083
1094
  return void 0;
1084
1095
  }
@@ -1088,7 +1099,15 @@ var SnapshotManager = class SnapshotManager2 {
1088
1099
  };
1089
1100
  },
1090
1101
  setObject: async (data) => {
1091
- const snapshot = import_protocols4.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(data.payload);
1102
+ (0, import_log7.log)("setObject", {
1103
+ data
1104
+ }, {
1105
+ file: "snapshot-manager.ts",
1106
+ line: 40,
1107
+ scope: this,
1108
+ callSite: (f, a) => f(...a)
1109
+ });
1110
+ const snapshot = import_protocols4.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(data.payload.value);
1092
1111
  await this._snapshotStore.saveSnapshot(snapshot);
1093
1112
  }
1094
1113
  });
@@ -1108,13 +1127,16 @@ var SnapshotManager = class SnapshotManager2 {
1108
1127
  return local;
1109
1128
  }
1110
1129
  const remote = await this._objectSync.download(id);
1111
- return import_protocols4.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(remote.payload);
1130
+ return import_protocols4.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(remote.payload.value);
1112
1131
  }
1113
1132
  async store(snapshot) {
1114
1133
  const id = await this._snapshotStore.saveSnapshot(snapshot);
1115
1134
  return id;
1116
1135
  }
1117
1136
  };
1137
+ __decorate4([
1138
+ (0, import_debug4.timed)(1e4)
1139
+ ], SnapshotManager.prototype, "load", null);
1118
1140
  SnapshotManager = __decorate4([
1119
1141
  (0, import_async5.trackLeaks)("open", "close")
1120
1142
  ], SnapshotManager);
@@ -1166,9 +1188,9 @@ var SnapshotStore = class {
1166
1188
 
1167
1189
  // packages/core/echo/echo-pipeline/src/dbhost/data-service.ts
1168
1190
  var import_node_assert7 = __toESM(require("node:assert"));
1169
- var import_debug4 = require("@dxos/debug");
1191
+ var import_debug5 = require("@dxos/debug");
1170
1192
  var import_keys3 = require("@dxos/keys");
1171
- var import_log7 = require("@dxos/log");
1193
+ var import_log8 = require("@dxos/log");
1172
1194
  var import_util4 = require("@dxos/util");
1173
1195
  var DataServiceSubscriptions = class {
1174
1196
  constructor() {
@@ -1178,7 +1200,7 @@ var DataServiceSubscriptions = class {
1178
1200
  this._spaces.clear();
1179
1201
  }
1180
1202
  registerSpace(spaceKey, host) {
1181
- (0, import_log7.log)("Registering space", {
1203
+ (0, import_log8.log)("Registering space", {
1182
1204
  spaceKey
1183
1205
  }, {
1184
1206
  file: "data-service.ts",
@@ -1189,7 +1211,7 @@ var DataServiceSubscriptions = class {
1189
1211
  this._spaces.set(spaceKey, host);
1190
1212
  }
1191
1213
  unregisterSpace(spaceKey) {
1192
- (0, import_log7.log)("Unregistering space", {
1214
+ (0, import_log8.log)("Unregistering space", {
1193
1215
  spaceKey
1194
1216
  }, {
1195
1217
  file: "data-service.ts",
@@ -1210,14 +1232,14 @@ var DataServiceImpl = class {
1210
1232
  subscribe(request) {
1211
1233
  var _a;
1212
1234
  (0, import_node_assert7.default)(request.spaceKey);
1213
- const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug4.raise)(new Error(`space not found: ${request.spaceKey}`));
1235
+ const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug5.raise)(new Error(`space not found: ${request.spaceKey}`));
1214
1236
  return host.subscribe();
1215
1237
  }
1216
1238
  write(request) {
1217
1239
  var _a;
1218
1240
  (0, import_node_assert7.default)(request.spaceKey);
1219
1241
  (0, import_node_assert7.default)(request.batch);
1220
- const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug4.raise)(new Error(`space not found: ${request.spaceKey}`));
1242
+ const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug5.raise)(new Error(`space not found: ${request.spaceKey}`));
1221
1243
  return host.write(request);
1222
1244
  }
1223
1245
  };
@@ -1268,7 +1290,7 @@ var DataPipeline = class DataPipeline2 {
1268
1290
  if (assertion["@type"] !== "dxos.halo.credentials.Epoch") {
1269
1291
  return;
1270
1292
  }
1271
- (0, import_log8.log)("new epoch", {
1293
+ (0, import_log9.log)("new epoch", {
1272
1294
  credential
1273
1295
  }, {
1274
1296
  file: "data-pipeline.ts",
@@ -1315,7 +1337,7 @@ var DataPipeline = class DataPipeline2 {
1315
1337
  if (!this._isOpen) {
1316
1338
  return;
1317
1339
  }
1318
- (0, import_log8.log)("close", {}, {
1340
+ (0, import_log9.log)("close", {}, {
1319
1341
  file: "data-pipeline.ts",
1320
1342
  line: 162,
1321
1343
  scope: this,
@@ -1330,7 +1352,7 @@ var DataPipeline = class DataPipeline2 {
1330
1352
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
1331
1353
  }
1332
1354
  } catch (err) {
1333
- import_log8.log.catch(err, {}, {
1355
+ import_log9.log.catch(err, {}, {
1334
1356
  file: "data-pipeline.ts",
1335
1357
  line: 175,
1336
1358
  scope: this,
@@ -1345,7 +1367,7 @@ var DataPipeline = class DataPipeline2 {
1345
1367
  (0, import_node_assert8.default)(this._pipeline, "Pipeline is not initialized.");
1346
1368
  for await (const msg of this._pipeline.consume()) {
1347
1369
  const { feedKey, seq, data } = msg;
1348
- (0, import_log8.log)("processing message", {
1370
+ (0, import_log9.log)("processing message", {
1349
1371
  feedKey,
1350
1372
  seq
1351
1373
  }, {
@@ -1358,7 +1380,7 @@ var DataPipeline = class DataPipeline2 {
1358
1380
  if (data.payload.data) {
1359
1381
  const feedInfo = this._params.feedInfoProvider(feedKey);
1360
1382
  if (!feedInfo) {
1361
- import_log8.log.error("Could not find feed.", {
1383
+ import_log9.log.error("Could not find feed.", {
1362
1384
  feedKey
1363
1385
  }, {
1364
1386
  file: "data-pipeline.ts",
@@ -1380,7 +1402,7 @@ var DataPipeline = class DataPipeline2 {
1380
1402
  await this._noteTargetStateIfNeeded(this._pipeline.state.pendingTimeframe);
1381
1403
  }
1382
1404
  } catch (err) {
1383
- import_log8.log.catch(err, {}, {
1405
+ import_log9.log.catch(err, {}, {
1384
1406
  file: "data-pipeline.ts",
1385
1407
  line: 211,
1386
1408
  scope: this,
@@ -1415,7 +1437,7 @@ var DataPipeline = class DataPipeline2 {
1415
1437
  cache.properties = (_a = (0, import_echo_db3.getStateMachineFromItem)(propertiesItem)) == null ? void 0 : _a.snapshot();
1416
1438
  }
1417
1439
  } catch (err) {
1418
- import_log8.log.warn("Failed to cache properties", err, {
1440
+ import_log9.log.warn("Failed to cache properties", err, {
1419
1441
  file: "data-pipeline.ts",
1420
1442
  line: 245,
1421
1443
  scope: this,
@@ -1436,10 +1458,24 @@ var DataPipeline = class DataPipeline2 {
1436
1458
  async _processEpoch(epoch) {
1437
1459
  (0, import_node_assert8.default)(this._isOpen);
1438
1460
  (0, import_node_assert8.default)(this._pipeline);
1461
+ (0, import_log9.log)("Processing epoch", {
1462
+ epoch
1463
+ }, {
1464
+ file: "data-pipeline.ts",
1465
+ line: 274,
1466
+ scope: this,
1467
+ callSite: (f, a) => f(...a)
1468
+ });
1439
1469
  if (epoch.snapshotCid) {
1440
1470
  const snapshot = await this._params.snapshotManager.load(epoch.snapshotCid);
1441
1471
  this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
1442
1472
  }
1473
+ (0, import_log9.log)("restarting pipeline for epoch", {}, {
1474
+ file: "data-pipeline.ts",
1475
+ line: 282,
1476
+ scope: this,
1477
+ callSite: (f, a) => f(...a)
1478
+ });
1443
1479
  await this._pipeline.pause();
1444
1480
  await this._pipeline.setCursor(epoch.timeframe);
1445
1481
  await this._pipeline.unpause();
@@ -1528,7 +1564,7 @@ var Space = class Space2 {
1528
1564
  });
1529
1565
  this._controlPipeline.onCredentialProcessed.set(async (credential) => {
1530
1566
  await this.onCredentialProcessed.callIfSet(credential);
1531
- (0, import_log9.log)("onCredentialProcessed", {
1567
+ (0, import_log10.log)("onCredentialProcessed", {
1532
1568
  credential
1533
1569
  }, {
1534
1570
  file: "space.ts",
@@ -1620,7 +1656,7 @@ var Space = class Space2 {
1620
1656
  // return this._dataPipeline?.getFeeds();
1621
1657
  // }
1622
1658
  async open() {
1623
- (0, import_log9.log)("opening...", {}, {
1659
+ (0, import_log10.log)("opening...", {}, {
1624
1660
  file: "space.ts",
1625
1661
  line: 208,
1626
1662
  scope: this,
@@ -1633,7 +1669,7 @@ var Space = class Space2 {
1633
1669
  await this.protocol.start();
1634
1670
  this._dataPipelineCredentialConsumer = this._controlPipeline.spaceState.registerProcessor(this._dataPipeline.createCredentialProcessor());
1635
1671
  this._isOpen = true;
1636
- (0, import_log9.log)("opened", {}, {
1672
+ (0, import_log10.log)("opened", {}, {
1637
1673
  file: "space.ts",
1638
1674
  line: 222,
1639
1675
  scope: this,
@@ -1642,7 +1678,7 @@ var Space = class Space2 {
1642
1678
  }
1643
1679
  async close() {
1644
1680
  var _a;
1645
- (0, import_log9.log)("closing...", {
1681
+ (0, import_log10.log)("closing...", {
1646
1682
  key: this._key
1647
1683
  }, {
1648
1684
  file: "space.ts",
@@ -1659,7 +1695,7 @@ var Space = class Space2 {
1659
1695
  await this.protocol.stop();
1660
1696
  await this._controlPipeline.stop();
1661
1697
  this._isOpen = false;
1662
- (0, import_log9.log)("closed", {}, {
1698
+ (0, import_log10.log)("closed", {}, {
1663
1699
  file: "space.ts",
1664
1700
  line: 241,
1665
1701
  scope: this,
@@ -1667,7 +1703,7 @@ var Space = class Space2 {
1667
1703
  });
1668
1704
  }
1669
1705
  async initializeDataPipeline() {
1670
- import_log9.log.info("initializeDataPipeline", {}, {
1706
+ import_log10.log.info("initializeDataPipeline", {}, {
1671
1707
  file: "space.ts",
1672
1708
  line: 245,
1673
1709
  scope: this,
@@ -1679,7 +1715,7 @@ var Space = class Space2 {
1679
1715
  }
1680
1716
  };
1681
1717
  __decorate6([
1682
- import_log9.logInfo
1718
+ import_log10.logInfo
1683
1719
  ], Space.prototype, "key", null);
1684
1720
  __decorate6([
1685
1721
  import_async7.synchronized
@@ -1693,16 +1729,16 @@ Space = __decorate6([
1693
1729
 
1694
1730
  // packages/core/echo/echo-pipeline/src/space/space-manager.ts
1695
1731
  var import_async8 = require("@dxos/async");
1696
- var import_debug5 = require("@dxos/debug");
1732
+ var import_debug6 = require("@dxos/debug");
1697
1733
  var import_keys5 = require("@dxos/keys");
1698
- var import_log11 = require("@dxos/log");
1734
+ var import_log12 = require("@dxos/log");
1699
1735
  var import_protocols6 = require("@dxos/protocols");
1700
1736
  var import_util7 = require("@dxos/util");
1701
1737
 
1702
1738
  // packages/core/echo/echo-pipeline/src/space/space-protocol.ts
1703
1739
  var import_crypto3 = require("@dxos/crypto");
1704
1740
  var import_keys4 = require("@dxos/keys");
1705
- var import_log10 = require("@dxos/log");
1741
+ var import_log11 = require("@dxos/log");
1706
1742
  var import_network_manager = require("@dxos/network-manager");
1707
1743
  var import_teleport2 = require("@dxos/teleport");
1708
1744
  var import_teleport_extension_replicator = require("@dxos/teleport-extension-replicator");
@@ -1739,7 +1775,7 @@ var SpaceProtocol = class {
1739
1775
  }
1740
1776
  // TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
1741
1777
  addFeed(feed) {
1742
- (0, import_log10.log)("addFeed", {
1778
+ (0, import_log11.log)("addFeed", {
1743
1779
  key: feed.key
1744
1780
  }, {
1745
1781
  file: "space-protocol.ts",
@@ -1762,7 +1798,7 @@ var SpaceProtocol = class {
1762
1798
  maxPeers: 10,
1763
1799
  sampleSize: 20
1764
1800
  };
1765
- (0, import_log10.log)("starting...", {}, {
1801
+ (0, import_log11.log)("starting...", {}, {
1766
1802
  file: "space-protocol.ts",
1767
1803
  line: 107,
1768
1804
  scope: this,
@@ -1775,7 +1811,7 @@ var SpaceProtocol = class {
1775
1811
  topology: new import_network_manager.MMSTTopology(topologyConfig),
1776
1812
  label: `Protocol swarm: ${this._topic}`
1777
1813
  });
1778
- (0, import_log10.log)("started", {}, {
1814
+ (0, import_log11.log)("started", {}, {
1779
1815
  file: "space-protocol.ts",
1780
1816
  line: 116,
1781
1817
  scope: this,
@@ -1784,14 +1820,14 @@ var SpaceProtocol = class {
1784
1820
  }
1785
1821
  async stop() {
1786
1822
  if (this._connection) {
1787
- (0, import_log10.log)("stopping...", {}, {
1823
+ (0, import_log11.log)("stopping...", {}, {
1788
1824
  file: "space-protocol.ts",
1789
1825
  line: 121,
1790
1826
  scope: this,
1791
1827
  callSite: (f, a) => f(...a)
1792
1828
  });
1793
1829
  await this._connection.close();
1794
- (0, import_log10.log)("stopped", {}, {
1830
+ (0, import_log11.log)("stopped", {}, {
1795
1831
  file: "space-protocol.ts",
1796
1832
  line: 123,
1797
1833
  scope: this,
@@ -1815,10 +1851,10 @@ var SpaceProtocol = class {
1815
1851
  }
1816
1852
  };
1817
1853
  __decorate7([
1818
- import_log10.logInfo
1854
+ import_log11.logInfo
1819
1855
  ], SpaceProtocol.prototype, "_topic", void 0);
1820
1856
  __decorate7([
1821
- import_log10.logInfo
1857
+ import_log11.logInfo
1822
1858
  ], SpaceProtocol.prototype, "_ownPeerKey", null);
1823
1859
  var AuthStatus;
1824
1860
  (function(AuthStatus2) {
@@ -1853,7 +1889,7 @@ var SpaceProtocolSession = class {
1853
1889
  onAuthSuccess: () => {
1854
1890
  var _a;
1855
1891
  this._authStatus = AuthStatus.SUCCESS;
1856
- (0, import_log10.log)("Peer authenticated", {}, {
1892
+ (0, import_log11.log)("Peer authenticated", {}, {
1857
1893
  file: "space-protocol.ts",
1858
1894
  line: 206,
1859
1895
  scope: this,
@@ -1862,7 +1898,7 @@ var SpaceProtocolSession = class {
1862
1898
  (_a = this._onSessionAuth) == null ? void 0 : _a.call(this, this._teleport);
1863
1899
  },
1864
1900
  onAuthFailure: () => {
1865
- import_log10.log.warn("Auth failed", {}, {
1901
+ import_log11.log.warn("Auth failed", {}, {
1866
1902
  file: "space-protocol.ts",
1867
1903
  line: 211,
1868
1904
  scope: this,
@@ -1878,10 +1914,10 @@ var SpaceProtocolSession = class {
1878
1914
  }
1879
1915
  };
1880
1916
  __decorate7([
1881
- import_log10.logInfo
1917
+ import_log11.logInfo
1882
1918
  ], SpaceProtocolSession.prototype, "_wireParams", void 0);
1883
1919
  __decorate7([
1884
- import_log10.logInfo
1920
+ import_log11.logInfo
1885
1921
  ], SpaceProtocolSession.prototype, "authStatus", null);
1886
1922
 
1887
1923
  // packages/core/echo/echo-pipeline/src/space/space-manager.ts
@@ -1918,7 +1954,7 @@ var SpaceManager = class SpaceManager2 {
1918
1954
  }
1919
1955
  async constructSpace({ metadata, swarmIdentity, onNetworkConnection, memberKey }) {
1920
1956
  var _a;
1921
- import_log11.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.begin({
1957
+ import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.begin({
1922
1958
  id: this._instanceId
1923
1959
  }), {
1924
1960
  file: "space-manager.ts",
@@ -1926,7 +1962,7 @@ var SpaceManager = class SpaceManager2 {
1926
1962
  scope: this,
1927
1963
  callSite: (f, a) => f(...a)
1928
1964
  });
1929
- (0, import_log11.log)("constructing space...", {
1965
+ (0, import_log12.log)("constructing space...", {
1930
1966
  spaceKey: metadata.genesisFeedKey
1931
1967
  }, {
1932
1968
  file: "space-manager.ts",
@@ -1934,7 +1970,7 @@ var SpaceManager = class SpaceManager2 {
1934
1970
  scope: this,
1935
1971
  callSite: (f, a) => f(...a)
1936
1972
  });
1937
- const genesisFeed = await this._feedStore.openFeed((_a = metadata.genesisFeedKey) != null ? _a : (0, import_debug5.failUndefined)());
1973
+ const genesisFeed = await this._feedStore.openFeed((_a = metadata.genesisFeedKey) != null ? _a : (0, import_debug6.failUndefined)());
1938
1974
  const spaceKey = metadata.key;
1939
1975
  const protocol = new SpaceProtocol({
1940
1976
  topic: spaceKey,
@@ -1954,7 +1990,7 @@ var SpaceManager = class SpaceManager2 {
1954
1990
  memberKey
1955
1991
  });
1956
1992
  this._spaces.set(space.key, space);
1957
- import_log11.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.end({
1993
+ import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.end({
1958
1994
  id: this._instanceId
1959
1995
  }), {
1960
1996
  file: "space-manager.ts",