@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.
@@ -1394,7 +1394,7 @@ var InvitationsHandler = class {
1394
1394
  ...protocol.toJSON()
1395
1395
  }, {
1396
1396
  file: "invitations-handler.ts",
1397
- line: 100,
1397
+ line: 99,
1398
1398
  scope: this,
1399
1399
  callSite: (f, a) => f(...a)
1400
1400
  });
@@ -1435,7 +1435,7 @@ var InvitationsHandler = class {
1435
1435
  id: traceId
1436
1436
  }), {
1437
1437
  file: "invitations-handler.ts",
1438
- line: 139,
1438
+ line: 138,
1439
1439
  scope: this,
1440
1440
  callSite: (f, a) => f(...a)
1441
1441
  });
@@ -1443,7 +1443,7 @@ var InvitationsHandler = class {
1443
1443
  ...protocol.toJSON()
1444
1444
  }, {
1445
1445
  file: "invitations-handler.ts",
1446
- line: 140,
1446
+ line: 139,
1447
1447
  scope: this,
1448
1448
  callSite: (f, a) => f(...a)
1449
1449
  });
@@ -1459,7 +1459,7 @@ var InvitationsHandler = class {
1459
1459
  ...protocol.toJSON()
1460
1460
  }, {
1461
1461
  file: "invitations-handler.ts",
1462
- line: 143,
1462
+ line: 142,
1463
1463
  scope: this,
1464
1464
  callSite: (f, a) => f(...a)
1465
1465
  });
@@ -1471,7 +1471,7 @@ var InvitationsHandler = class {
1471
1471
  id: traceId
1472
1472
  }), {
1473
1473
  file: "invitations-handler.ts",
1474
- line: 145,
1474
+ line: 144,
1475
1475
  scope: this,
1476
1476
  callSite: (f, a) => f(...a)
1477
1477
  });
@@ -1481,7 +1481,7 @@ var InvitationsHandler = class {
1481
1481
  ...protocol.toJSON()
1482
1482
  }, {
1483
1483
  file: "invitations-handler.ts",
1484
- line: 148,
1484
+ line: 147,
1485
1485
  scope: this,
1486
1486
  callSite: (f, a) => f(...a)
1487
1487
  });
@@ -1492,7 +1492,7 @@ var InvitationsHandler = class {
1492
1492
  } else {
1493
1493
  import_log5.log.error("failed", err, {
1494
1494
  file: "invitations-handler.ts",
1495
- line: 151,
1495
+ line: 150,
1496
1496
  scope: this,
1497
1497
  callSite: (f, a) => f(...a)
1498
1498
  });
@@ -1503,13 +1503,13 @@ var InvitationsHandler = class {
1503
1503
  error: err
1504
1504
  }), {
1505
1505
  file: "invitations-handler.ts",
1506
- line: 154,
1506
+ line: 153,
1507
1507
  scope: this,
1508
1508
  callSite: (f, a) => f(...a)
1509
1509
  });
1510
1510
  } finally {
1511
1511
  if (type !== import_services3.Invitation.Type.MULTIUSE) {
1512
- await (0, import_async8.sleep)(import_client_protocol2.ON_CLOSE_DELAY);
1512
+ await swarmConnection.close();
1513
1513
  await ctx.dispose();
1514
1514
  }
1515
1515
  }
@@ -1545,9 +1545,10 @@ var InvitationsHandler = class {
1545
1545
  });
1546
1546
  return extension;
1547
1547
  };
1548
+ let swarmConnection;
1548
1549
  (0, import_async8.scheduleTask)(ctx, async () => {
1549
1550
  const topic = invitation.swarmKey;
1550
- const swarmConnection = await this._networkManager.joinSwarm({
1551
+ swarmConnection = await this._networkManager.joinSwarm({
1551
1552
  topic,
1552
1553
  peerId: topic,
1553
1554
  protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
@@ -1578,6 +1579,7 @@ var InvitationsHandler = class {
1578
1579
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1579
1580
  (0, import_node_assert6.default)(protocol);
1580
1581
  const authenticated = new import_async8.Trigger();
1582
+ let admitted = false;
1581
1583
  let currentState;
1582
1584
  const stream = new import_async8.PushStream();
1583
1585
  const setState = (newData) => {
@@ -1595,7 +1597,7 @@ var InvitationsHandler = class {
1595
1597
  ...protocol.toJSON()
1596
1598
  }, {
1597
1599
  file: "invitations-handler.ts",
1598
- line: 225,
1600
+ line: 230,
1599
1601
  scope: this,
1600
1602
  callSite: (f, a) => f(...a)
1601
1603
  });
@@ -1605,7 +1607,7 @@ var InvitationsHandler = class {
1605
1607
  } else {
1606
1608
  import_log5.log.warn("auth failed", err, {
1607
1609
  file: "invitations-handler.ts",
1608
- line: 228,
1610
+ line: 233,
1609
1611
  scope: this,
1610
1612
  callSite: (f, a) => f(...a)
1611
1613
  });
@@ -1619,7 +1621,7 @@ var InvitationsHandler = class {
1619
1621
  ...protocol.toJSON()
1620
1622
  }, {
1621
1623
  file: "invitations-handler.ts",
1622
- line: 236,
1624
+ line: 241,
1623
1625
  scope: this,
1624
1626
  callSite: (f, a) => f(...a)
1625
1627
  });
@@ -1634,11 +1636,11 @@ var InvitationsHandler = class {
1634
1636
  currentState
1635
1637
  }, {
1636
1638
  file: "invitations-handler.ts",
1637
- line: 246,
1639
+ line: 251,
1638
1640
  scope: this,
1639
1641
  callSite: (f, a) => f(...a)
1640
1642
  });
1641
- if (currentState !== import_services3.Invitation.State.SUCCESS) {
1643
+ if (!admitted) {
1642
1644
  stream.error(new Error("Remote peer disconnected."));
1643
1645
  }
1644
1646
  });
@@ -1649,7 +1651,7 @@ var InvitationsHandler = class {
1649
1651
  id: traceId
1650
1652
  }), {
1651
1653
  file: "invitations-handler.ts",
1652
- line: 255,
1654
+ line: 260,
1653
1655
  scope: this,
1654
1656
  callSite: (f, a) => f(...a)
1655
1657
  });
@@ -1661,7 +1663,7 @@ var InvitationsHandler = class {
1661
1663
  ...protocol.toJSON()
1662
1664
  }, {
1663
1665
  file: "invitations-handler.ts",
1664
- line: 263,
1666
+ line: 268,
1665
1667
  scope: this,
1666
1668
  callSite: (f, a) => f(...a)
1667
1669
  });
@@ -1672,7 +1674,7 @@ var InvitationsHandler = class {
1672
1674
  ...protocol.toJSON()
1673
1675
  }, {
1674
1676
  file: "invitations-handler.ts",
1675
- line: 267,
1677
+ line: 272,
1676
1678
  scope: this,
1677
1679
  callSite: (f, a) => f(...a)
1678
1680
  });
@@ -1682,7 +1684,7 @@ var InvitationsHandler = class {
1682
1684
  response: introductionResponse
1683
1685
  }, {
1684
1686
  file: "invitations-handler.ts",
1685
- line: 271,
1687
+ line: 276,
1686
1688
  scope: this,
1687
1689
  callSite: (f, a) => f(...a)
1688
1690
  });
@@ -1694,7 +1696,7 @@ var InvitationsHandler = class {
1694
1696
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1695
1697
  (0, import_log5.log)("guest waiting for authentication code...", {}, {
1696
1698
  file: "invitations-handler.ts",
1697
- line: 280,
1699
+ line: 285,
1698
1700
  scope: this,
1699
1701
  callSite: (f, a) => f(...a)
1700
1702
  });
@@ -1706,7 +1708,7 @@ var InvitationsHandler = class {
1706
1708
  });
1707
1709
  (0, import_log5.log)("sending authentication request", {}, {
1708
1710
  file: "invitations-handler.ts",
1709
- line: 284,
1711
+ line: 289,
1710
1712
  scope: this,
1711
1713
  callSite: (f, a) => f(...a)
1712
1714
  });
@@ -1727,7 +1729,7 @@ var InvitationsHandler = class {
1727
1729
  attempt
1728
1730
  }, {
1729
1731
  file: "invitations-handler.ts",
1730
- line: 295,
1732
+ line: 300,
1731
1733
  scope: this,
1732
1734
  callSite: (f, a) => f(...a)
1733
1735
  });
@@ -1744,18 +1746,19 @@ var InvitationsHandler = class {
1744
1746
  ...protocol.toJSON()
1745
1747
  }, {
1746
1748
  file: "invitations-handler.ts",
1747
- line: 306,
1749
+ line: 311,
1748
1750
  scope: this,
1749
1751
  callSite: (f, a) => f(...a)
1750
1752
  });
1751
1753
  const admissionRequest = await protocol.createAdmissionRequest();
1752
1754
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
1755
+ admitted = true;
1753
1756
  const result = await protocol.accept(admissionResponse, admissionRequest);
1754
1757
  (0, import_log5.log)("admitted by host", {
1755
1758
  ...protocol.toJSON()
1756
1759
  }, {
1757
1760
  file: "invitations-handler.ts",
1758
- line: 314,
1761
+ line: 322,
1759
1762
  scope: this,
1760
1763
  callSite: (f, a) => f(...a)
1761
1764
  });
@@ -1767,7 +1770,7 @@ var InvitationsHandler = class {
1767
1770
  id: traceId
1768
1771
  }), {
1769
1772
  file: "invitations-handler.ts",
1770
- line: 316,
1773
+ line: 324,
1771
1774
  scope: this,
1772
1775
  callSite: (f, a) => f(...a)
1773
1776
  });
@@ -1777,7 +1780,7 @@ var InvitationsHandler = class {
1777
1780
  ...protocol.toJSON()
1778
1781
  }, {
1779
1782
  file: "invitations-handler.ts",
1780
- line: 319,
1783
+ line: 327,
1781
1784
  scope: this,
1782
1785
  callSite: (f, a) => f(...a)
1783
1786
  });
@@ -1787,7 +1790,7 @@ var InvitationsHandler = class {
1787
1790
  } else {
1788
1791
  (0, import_log5.log)("auth failed", err, {
1789
1792
  file: "invitations-handler.ts",
1790
- line: 322,
1793
+ line: 330,
1791
1794
  scope: this,
1792
1795
  callSite: (f, a) => f(...a)
1793
1796
  });
@@ -1798,7 +1801,7 @@ var InvitationsHandler = class {
1798
1801
  error: err
1799
1802
  }), {
1800
1803
  file: "invitations-handler.ts",
1801
- line: 325,
1804
+ line: 333,
1802
1805
  scope: this,
1803
1806
  callSite: (f, a) => f(...a)
1804
1807
  });
@@ -1816,7 +1819,7 @@ var InvitationsHandler = class {
1816
1819
  ...protocol.toJSON()
1817
1820
  }, {
1818
1821
  file: "invitations-handler.ts",
1819
- line: 336,
1822
+ line: 344,
1820
1823
  scope: this,
1821
1824
  callSite: (f, a) => f(...a)
1822
1825
  });
@@ -1826,7 +1829,7 @@ var InvitationsHandler = class {
1826
1829
  } else {
1827
1830
  (0, import_log5.log)("auth failed", err, {
1828
1831
  file: "invitations-handler.ts",
1829
- line: 339,
1832
+ line: 347,
1830
1833
  scope: this,
1831
1834
  callSite: (f, a) => f(...a)
1832
1835
  });
@@ -2345,6 +2348,7 @@ var import_keys8 = require("@dxos/keys");
2345
2348
  var import_log11 = require("@dxos/log");
2346
2349
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2347
2350
  var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
2351
+ var import_timeframe = require("@dxos/timeframe");
2348
2352
  var import_util5 = require("@dxos/util");
2349
2353
 
2350
2354
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
@@ -2687,7 +2691,7 @@ var DataSpace = class DataSpace2 {
2687
2691
  if (err instanceof import_errors3.CancelledError) {
2688
2692
  (0, import_log11.log)("Data pipeline initialization cancelled", err, {
2689
2693
  file: "data-space.ts",
2690
- line: 172,
2694
+ line: 173,
2691
2695
  scope: this,
2692
2696
  callSite: (f, a) => f(...a)
2693
2697
  });
@@ -2695,7 +2699,7 @@ var DataSpace = class DataSpace2 {
2695
2699
  }
2696
2700
  import_log11.log.error("Error initializing data pipeline", err, {
2697
2701
  file: "data-space.ts",
2698
- line: 176,
2702
+ line: 177,
2699
2703
  scope: this,
2700
2704
  callSite: (f, a) => f(...a)
2701
2705
  });
@@ -2802,7 +2806,7 @@ var DataSpace = class DataSpace2 {
2802
2806
  async createEpoch() {
2803
2807
  var _a, _b;
2804
2808
  const epoch = await this.dataPipeline.createEpoch();
2805
- await this.inner.controlPipeline.writer.write({
2809
+ const receipt = await this.inner.controlPipeline.writer.write({
2806
2810
  credential: {
2807
2811
  credential: await this._signingContext.credentialSigner.createCredential({
2808
2812
  subject: this.key,
@@ -2813,6 +2817,12 @@ var DataSpace = class DataSpace2 {
2813
2817
  })
2814
2818
  }
2815
2819
  });
2820
+ await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
2821
+ [
2822
+ receipt.feedKey,
2823
+ receipt.seq
2824
+ ]
2825
+ ]));
2816
2826
  for (const feed of (_b = (_a = this.inner.dataPipeline.pipelineState) == null ? void 0 : _a.feeds) != null ? _b : []) {
2817
2827
  const indexBeforeEpoch = epoch.timeframe.get(feed.key);
2818
2828
  if (indexBeforeEpoch) {
@@ -2832,7 +2842,7 @@ DataSpace = __decorate2([
2832
2842
  var import_credentials10 = require("@dxos/credentials");
2833
2843
  var import_debug4 = require("@dxos/debug");
2834
2844
  var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
2835
- var import_timeframe = require("@dxos/timeframe");
2845
+ var import_timeframe2 = require("@dxos/timeframe");
2836
2846
  var spaceGenesis = async (keyring, signingContext, space) => {
2837
2847
  var _a, _b, _c, _d;
2838
2848
  const credentials = [
@@ -2883,7 +2893,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
2883
2893
  "@type": "dxos.halo.credentials.Epoch",
2884
2894
  number: 0,
2885
2895
  previousId: void 0,
2886
- timeframe: new import_timeframe.Timeframe(),
2896
+ timeframe: new import_timeframe2.Timeframe(),
2887
2897
  snapshotCid: void 0
2888
2898
  }
2889
2899
  })
@@ -3217,7 +3227,7 @@ var SpacesServiceImpl = class {
3217
3227
  spaces
3218
3228
  }, {
3219
3229
  file: "spaces-service.ts",
3220
- line: 59,
3230
+ line: 60,
3221
3231
  scope: this,
3222
3232
  callSite: (f, a) => f(...a)
3223
3233
  });
@@ -3304,12 +3314,13 @@ var SpacesServiceImpl = class {
3304
3314
  await space.createEpoch();
3305
3315
  }
3306
3316
  _transformSpace(space) {
3307
- var _a, _b, _c, _d, _e;
3317
+ var _a, _b, _c, _d, _e, _f;
3308
3318
  return {
3309
3319
  spaceKey: space.key,
3310
3320
  state: space.state,
3311
3321
  error: space.error ? (0, import_protocols7.encodeError)(space.error) : void 0,
3312
3322
  pipeline: {
3323
+ currentEpoch: space.dataPipeline.currentEpoch,
3313
3324
  controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
3314
3325
  currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
3315
3326
  targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
@@ -3331,6 +3342,7 @@ var SpacesServiceImpl = class {
3331
3342
  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
3332
3343
  };
3333
3344
  }),
3345
+ creator: (_f = space.inner.spaceState.creator) == null ? void 0 : _f.key,
3334
3346
  cache: space.cache,
3335
3347
  metrics: space.metrics
3336
3348
  };