@dxos/client-services 0.1.50 → 0.1.51-main.0e88376

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.
@@ -1417,7 +1417,7 @@ var InvitationsHandler = class {
1417
1417
  ...protocol.toJSON()
1418
1418
  }, {
1419
1419
  file: "invitations-handler.ts",
1420
- line: 100,
1420
+ line: 99,
1421
1421
  scope: this,
1422
1422
  callSite: (f, a) => f(...a)
1423
1423
  });
@@ -1458,7 +1458,7 @@ var InvitationsHandler = class {
1458
1458
  id: traceId
1459
1459
  }), {
1460
1460
  file: "invitations-handler.ts",
1461
- line: 139,
1461
+ line: 138,
1462
1462
  scope: this,
1463
1463
  callSite: (f, a) => f(...a)
1464
1464
  });
@@ -1466,7 +1466,7 @@ var InvitationsHandler = class {
1466
1466
  ...protocol.toJSON()
1467
1467
  }, {
1468
1468
  file: "invitations-handler.ts",
1469
- line: 140,
1469
+ line: 139,
1470
1470
  scope: this,
1471
1471
  callSite: (f, a) => f(...a)
1472
1472
  });
@@ -1482,7 +1482,7 @@ var InvitationsHandler = class {
1482
1482
  ...protocol.toJSON()
1483
1483
  }, {
1484
1484
  file: "invitations-handler.ts",
1485
- line: 143,
1485
+ line: 142,
1486
1486
  scope: this,
1487
1487
  callSite: (f, a) => f(...a)
1488
1488
  });
@@ -1494,7 +1494,7 @@ var InvitationsHandler = class {
1494
1494
  id: traceId
1495
1495
  }), {
1496
1496
  file: "invitations-handler.ts",
1497
- line: 145,
1497
+ line: 144,
1498
1498
  scope: this,
1499
1499
  callSite: (f, a) => f(...a)
1500
1500
  });
@@ -1504,7 +1504,7 @@ var InvitationsHandler = class {
1504
1504
  ...protocol.toJSON()
1505
1505
  }, {
1506
1506
  file: "invitations-handler.ts",
1507
- line: 148,
1507
+ line: 147,
1508
1508
  scope: this,
1509
1509
  callSite: (f, a) => f(...a)
1510
1510
  });
@@ -1515,7 +1515,7 @@ var InvitationsHandler = class {
1515
1515
  } else {
1516
1516
  import_log5.log.error("failed", err, {
1517
1517
  file: "invitations-handler.ts",
1518
- line: 151,
1518
+ line: 150,
1519
1519
  scope: this,
1520
1520
  callSite: (f, a) => f(...a)
1521
1521
  });
@@ -1526,13 +1526,13 @@ var InvitationsHandler = class {
1526
1526
  error: err
1527
1527
  }), {
1528
1528
  file: "invitations-handler.ts",
1529
- line: 154,
1529
+ line: 153,
1530
1530
  scope: this,
1531
1531
  callSite: (f, a) => f(...a)
1532
1532
  });
1533
1533
  } finally {
1534
1534
  if (type !== import_services4.Invitation.Type.MULTIUSE) {
1535
- await (0, import_async9.sleep)(import_client_protocol2.ON_CLOSE_DELAY);
1535
+ await swarmConnection.close();
1536
1536
  await ctx.dispose();
1537
1537
  }
1538
1538
  }
@@ -1568,9 +1568,10 @@ var InvitationsHandler = class {
1568
1568
  });
1569
1569
  return extension;
1570
1570
  };
1571
+ let swarmConnection;
1571
1572
  (0, import_async9.scheduleTask)(ctx, async () => {
1572
1573
  const topic = invitation.swarmKey;
1573
- const swarmConnection = await this._networkManager.joinSwarm({
1574
+ swarmConnection = await this._networkManager.joinSwarm({
1574
1575
  topic,
1575
1576
  peerId: topic,
1576
1577
  protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
@@ -1601,6 +1602,7 @@ var InvitationsHandler = class {
1601
1602
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1602
1603
  (0, import_node_assert6.default)(protocol);
1603
1604
  const authenticated = new import_async9.Trigger();
1605
+ let admitted = false;
1604
1606
  let currentState;
1605
1607
  const stream = new import_async9.PushStream();
1606
1608
  const setState = (newData) => {
@@ -1618,7 +1620,7 @@ var InvitationsHandler = class {
1618
1620
  ...protocol.toJSON()
1619
1621
  }, {
1620
1622
  file: "invitations-handler.ts",
1621
- line: 225,
1623
+ line: 230,
1622
1624
  scope: this,
1623
1625
  callSite: (f, a) => f(...a)
1624
1626
  });
@@ -1628,7 +1630,7 @@ var InvitationsHandler = class {
1628
1630
  } else {
1629
1631
  import_log5.log.warn("auth failed", err, {
1630
1632
  file: "invitations-handler.ts",
1631
- line: 228,
1633
+ line: 233,
1632
1634
  scope: this,
1633
1635
  callSite: (f, a) => f(...a)
1634
1636
  });
@@ -1642,7 +1644,7 @@ var InvitationsHandler = class {
1642
1644
  ...protocol.toJSON()
1643
1645
  }, {
1644
1646
  file: "invitations-handler.ts",
1645
- line: 236,
1647
+ line: 241,
1646
1648
  scope: this,
1647
1649
  callSite: (f, a) => f(...a)
1648
1650
  });
@@ -1657,11 +1659,11 @@ var InvitationsHandler = class {
1657
1659
  currentState
1658
1660
  }, {
1659
1661
  file: "invitations-handler.ts",
1660
- line: 246,
1662
+ line: 251,
1661
1663
  scope: this,
1662
1664
  callSite: (f, a) => f(...a)
1663
1665
  });
1664
- if (currentState !== import_services4.Invitation.State.SUCCESS) {
1666
+ if (!admitted) {
1665
1667
  stream.error(new Error("Remote peer disconnected."));
1666
1668
  }
1667
1669
  });
@@ -1672,7 +1674,7 @@ var InvitationsHandler = class {
1672
1674
  id: traceId
1673
1675
  }), {
1674
1676
  file: "invitations-handler.ts",
1675
- line: 255,
1677
+ line: 260,
1676
1678
  scope: this,
1677
1679
  callSite: (f, a) => f(...a)
1678
1680
  });
@@ -1684,7 +1686,7 @@ var InvitationsHandler = class {
1684
1686
  ...protocol.toJSON()
1685
1687
  }, {
1686
1688
  file: "invitations-handler.ts",
1687
- line: 263,
1689
+ line: 268,
1688
1690
  scope: this,
1689
1691
  callSite: (f, a) => f(...a)
1690
1692
  });
@@ -1695,7 +1697,7 @@ var InvitationsHandler = class {
1695
1697
  ...protocol.toJSON()
1696
1698
  }, {
1697
1699
  file: "invitations-handler.ts",
1698
- line: 267,
1700
+ line: 272,
1699
1701
  scope: this,
1700
1702
  callSite: (f, a) => f(...a)
1701
1703
  });
@@ -1705,7 +1707,7 @@ var InvitationsHandler = class {
1705
1707
  response: introductionResponse
1706
1708
  }, {
1707
1709
  file: "invitations-handler.ts",
1708
- line: 271,
1710
+ line: 276,
1709
1711
  scope: this,
1710
1712
  callSite: (f, a) => f(...a)
1711
1713
  });
@@ -1717,7 +1719,7 @@ var InvitationsHandler = class {
1717
1719
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1718
1720
  (0, import_log5.log)("guest waiting for authentication code...", {}, {
1719
1721
  file: "invitations-handler.ts",
1720
- line: 280,
1722
+ line: 285,
1721
1723
  scope: this,
1722
1724
  callSite: (f, a) => f(...a)
1723
1725
  });
@@ -1729,7 +1731,7 @@ var InvitationsHandler = class {
1729
1731
  });
1730
1732
  (0, import_log5.log)("sending authentication request", {}, {
1731
1733
  file: "invitations-handler.ts",
1732
- line: 284,
1734
+ line: 289,
1733
1735
  scope: this,
1734
1736
  callSite: (f, a) => f(...a)
1735
1737
  });
@@ -1750,7 +1752,7 @@ var InvitationsHandler = class {
1750
1752
  attempt
1751
1753
  }, {
1752
1754
  file: "invitations-handler.ts",
1753
- line: 295,
1755
+ line: 300,
1754
1756
  scope: this,
1755
1757
  callSite: (f, a) => f(...a)
1756
1758
  });
@@ -1767,18 +1769,19 @@ var InvitationsHandler = class {
1767
1769
  ...protocol.toJSON()
1768
1770
  }, {
1769
1771
  file: "invitations-handler.ts",
1770
- line: 306,
1772
+ line: 311,
1771
1773
  scope: this,
1772
1774
  callSite: (f, a) => f(...a)
1773
1775
  });
1774
1776
  const admissionRequest = await protocol.createAdmissionRequest();
1775
1777
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
1778
+ admitted = true;
1776
1779
  const result = await protocol.accept(admissionResponse, admissionRequest);
1777
1780
  (0, import_log5.log)("admitted by host", {
1778
1781
  ...protocol.toJSON()
1779
1782
  }, {
1780
1783
  file: "invitations-handler.ts",
1781
- line: 314,
1784
+ line: 322,
1782
1785
  scope: this,
1783
1786
  callSite: (f, a) => f(...a)
1784
1787
  });
@@ -1790,7 +1793,7 @@ var InvitationsHandler = class {
1790
1793
  id: traceId
1791
1794
  }), {
1792
1795
  file: "invitations-handler.ts",
1793
- line: 316,
1796
+ line: 324,
1794
1797
  scope: this,
1795
1798
  callSite: (f, a) => f(...a)
1796
1799
  });
@@ -1800,7 +1803,7 @@ var InvitationsHandler = class {
1800
1803
  ...protocol.toJSON()
1801
1804
  }, {
1802
1805
  file: "invitations-handler.ts",
1803
- line: 319,
1806
+ line: 327,
1804
1807
  scope: this,
1805
1808
  callSite: (f, a) => f(...a)
1806
1809
  });
@@ -1810,7 +1813,7 @@ var InvitationsHandler = class {
1810
1813
  } else {
1811
1814
  (0, import_log5.log)("auth failed", err, {
1812
1815
  file: "invitations-handler.ts",
1813
- line: 322,
1816
+ line: 330,
1814
1817
  scope: this,
1815
1818
  callSite: (f, a) => f(...a)
1816
1819
  });
@@ -1821,7 +1824,7 @@ var InvitationsHandler = class {
1821
1824
  error: err
1822
1825
  }), {
1823
1826
  file: "invitations-handler.ts",
1824
- line: 325,
1827
+ line: 333,
1825
1828
  scope: this,
1826
1829
  callSite: (f, a) => f(...a)
1827
1830
  });
@@ -1839,7 +1842,7 @@ var InvitationsHandler = class {
1839
1842
  ...protocol.toJSON()
1840
1843
  }, {
1841
1844
  file: "invitations-handler.ts",
1842
- line: 336,
1845
+ line: 344,
1843
1846
  scope: this,
1844
1847
  callSite: (f, a) => f(...a)
1845
1848
  });
@@ -1849,7 +1852,7 @@ var InvitationsHandler = class {
1849
1852
  } else {
1850
1853
  (0, import_log5.log)("auth failed", err, {
1851
1854
  file: "invitations-handler.ts",
1852
- line: 339,
1855
+ line: 347,
1853
1856
  scope: this,
1854
1857
  callSite: (f, a) => f(...a)
1855
1858
  });
@@ -2308,6 +2311,7 @@ var import_keys9 = require("@dxos/keys");
2308
2311
  var import_log11 = require("@dxos/log");
2309
2312
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2310
2313
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2314
+ var import_timeframe = require("@dxos/timeframe");
2311
2315
  var import_util5 = require("@dxos/util");
2312
2316
 
2313
2317
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
@@ -2650,7 +2654,7 @@ var DataSpace = class DataSpace2 {
2650
2654
  if (err instanceof import_errors3.CancelledError) {
2651
2655
  (0, import_log11.log)("Data pipeline initialization cancelled", err, {
2652
2656
  file: "data-space.ts",
2653
- line: 172,
2657
+ line: 173,
2654
2658
  scope: this,
2655
2659
  callSite: (f, a) => f(...a)
2656
2660
  });
@@ -2658,7 +2662,7 @@ var DataSpace = class DataSpace2 {
2658
2662
  }
2659
2663
  import_log11.log.error("Error initializing data pipeline", err, {
2660
2664
  file: "data-space.ts",
2661
- line: 176,
2665
+ line: 177,
2662
2666
  scope: this,
2663
2667
  callSite: (f, a) => f(...a)
2664
2668
  });
@@ -2765,7 +2769,7 @@ var DataSpace = class DataSpace2 {
2765
2769
  async createEpoch() {
2766
2770
  var _a, _b;
2767
2771
  const epoch = await this.dataPipeline.createEpoch();
2768
- await this.inner.controlPipeline.writer.write({
2772
+ const receipt = await this.inner.controlPipeline.writer.write({
2769
2773
  credential: {
2770
2774
  credential: await this._signingContext.credentialSigner.createCredential({
2771
2775
  subject: this.key,
@@ -2776,6 +2780,12 @@ var DataSpace = class DataSpace2 {
2776
2780
  })
2777
2781
  }
2778
2782
  });
2783
+ await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
2784
+ [
2785
+ receipt.feedKey,
2786
+ receipt.seq
2787
+ ]
2788
+ ]));
2779
2789
  for (const feed of (_b = (_a = this.inner.dataPipeline.pipelineState) == null ? void 0 : _a.feeds) != null ? _b : []) {
2780
2790
  const indexBeforeEpoch = epoch.timeframe.get(feed.key);
2781
2791
  if (indexBeforeEpoch) {
@@ -2795,7 +2805,7 @@ DataSpace = __decorate2([
2795
2805
  var import_credentials11 = require("@dxos/credentials");
2796
2806
  var import_debug4 = require("@dxos/debug");
2797
2807
  var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
2798
- var import_timeframe = require("@dxos/timeframe");
2808
+ var import_timeframe2 = require("@dxos/timeframe");
2799
2809
  var spaceGenesis = async (keyring, signingContext, space) => {
2800
2810
  var _a, _b, _c, _d;
2801
2811
  const credentials = [
@@ -2846,7 +2856,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
2846
2856
  "@type": "dxos.halo.credentials.Epoch",
2847
2857
  number: 0,
2848
2858
  previousId: void 0,
2849
- timeframe: new import_timeframe.Timeframe(),
2859
+ timeframe: new import_timeframe2.Timeframe(),
2850
2860
  snapshotCid: void 0
2851
2861
  }
2852
2862
  })
@@ -3180,7 +3190,7 @@ var SpacesServiceImpl = class {
3180
3190
  spaces
3181
3191
  }, {
3182
3192
  file: "spaces-service.ts",
3183
- line: 59,
3193
+ line: 60,
3184
3194
  scope: this,
3185
3195
  callSite: (f, a) => f(...a)
3186
3196
  });
@@ -3267,12 +3277,13 @@ var SpacesServiceImpl = class {
3267
3277
  await space.createEpoch();
3268
3278
  }
3269
3279
  _transformSpace(space) {
3270
- var _a, _b, _c, _d, _e;
3280
+ var _a, _b, _c, _d, _e, _f;
3271
3281
  return {
3272
3282
  spaceKey: space.key,
3273
3283
  state: space.state,
3274
3284
  error: space.error ? (0, import_protocols7.encodeError)(space.error) : void 0,
3275
3285
  pipeline: {
3286
+ currentEpoch: space.dataPipeline.currentEpoch,
3276
3287
  controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
3277
3288
  currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
3278
3289
  targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
@@ -3294,6 +3305,7 @@ var SpacesServiceImpl = class {
3294
3305
  presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE
3295
3306
  };
3296
3307
  }),
3308
+ creator: (_f = space.inner.spaceState.creator) == null ? void 0 : _f.key,
3297
3309
  cache: space.cache,
3298
3310
  metrics: space.metrics
3299
3311
  };