@dxos/client-services 0.7.5-main.499c70c → 0.7.5-main.9cb18ac

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.
@@ -397,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
397
397
  import { TRACE_PROCESSOR } from "@dxos/tracing";
398
398
 
399
399
  // packages/sdk/client-services/src/version.ts
400
- var DXOS_VERSION = "0.7.5-main.499c70c";
400
+ var DXOS_VERSION = "0.7.5-main.9cb18ac";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -1451,6 +1451,7 @@ var NotarizationPlugin = class extends Resource3 {
1451
1451
  this._processedCredentials = new ComplexSet(PublicKey4.hash);
1452
1452
  this._processCredentialsTriggers = new ComplexMap3(PublicKey4.hash);
1453
1453
  this._activeEdgePollingIntervalHandle = void 0;
1454
+ this._activeEdgePollingEnabled = false;
1454
1455
  this._spaceId = params.spaceId;
1455
1456
  this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
1456
1457
  if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
@@ -1458,15 +1459,6 @@ var NotarizationPlugin = class extends Resource3 {
1458
1459
  }
1459
1460
  }
1460
1461
  setActiveEdgePollingEnabled(enabled) {
1461
- invariant4(this.isOpen, void 0, {
1462
- F: __dxlog_file8,
1463
- L: 109,
1464
- S: this,
1465
- A: [
1466
- "this.isOpen",
1467
- ""
1468
- ]
1469
- });
1470
1462
  const client = this._edgeClient;
1471
1463
  invariant4(client, void 0, {
1472
1464
  F: __dxlog_file8,
@@ -1477,30 +1469,30 @@ var NotarizationPlugin = class extends Resource3 {
1477
1469
  ""
1478
1470
  ]
1479
1471
  });
1480
- if (enabled && !this._activeEdgePollingIntervalHandle) {
1481
- this._activeEdgePollingIntervalHandle = setInterval(() => {
1482
- if (this._writer) {
1483
- this._notarizePendingEdgeCredentials(client, this._writer);
1484
- }
1485
- }, this._activeEdgePollingInterval);
1486
- } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1487
- clearInterval(this._activeEdgePollingIntervalHandle);
1488
- this._activeEdgePollingIntervalHandle = void 0;
1472
+ this._activeEdgePollingEnabled = enabled;
1473
+ if (this.isOpen) {
1474
+ if (enabled && !this._activeEdgePollingIntervalHandle) {
1475
+ this._startPeriodicEdgePolling(client);
1476
+ } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1477
+ this._stopPeriodicEdgePolling();
1478
+ }
1489
1479
  }
1490
1480
  }
1491
1481
  get hasWriter() {
1492
1482
  return !!this._writer;
1493
1483
  }
1494
1484
  async _open() {
1495
- if (this._edgeClient && this._writer) {
1496
- this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
1485
+ if (this._edgeClient) {
1486
+ if (this._activeEdgePollingEnabled) {
1487
+ this._startPeriodicEdgePolling(this._edgeClient);
1488
+ }
1489
+ if (this._writer) {
1490
+ this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
1491
+ }
1497
1492
  }
1498
1493
  }
1499
1494
  async _close() {
1500
- if (this._activeEdgePollingIntervalHandle) {
1501
- clearInterval(this._activeEdgePollingIntervalHandle);
1502
- this._activeEdgePollingIntervalHandle = void 0;
1503
- }
1495
+ this._stopPeriodicEdgePolling();
1504
1496
  await this._ctx.dispose();
1505
1497
  }
1506
1498
  /**
@@ -1678,10 +1670,23 @@ var NotarizationPlugin = class extends Resource3 {
1678
1670
  ]
1679
1671
  });
1680
1672
  this._writer = writer;
1681
- if (this._edgeClient) {
1673
+ if (this._edgeClient && this.isOpen) {
1682
1674
  this._notarizePendingEdgeCredentials(this._edgeClient, writer);
1683
1675
  }
1684
1676
  }
1677
+ _startPeriodicEdgePolling(client) {
1678
+ this._activeEdgePollingIntervalHandle = setInterval(() => {
1679
+ if (this._writer) {
1680
+ this._notarizePendingEdgeCredentials(client, this._writer);
1681
+ }
1682
+ }, this._activeEdgePollingInterval);
1683
+ }
1684
+ _stopPeriodicEdgePolling() {
1685
+ if (this._activeEdgePollingIntervalHandle) {
1686
+ clearInterval(this._activeEdgePollingIntervalHandle);
1687
+ this._activeEdgePollingIntervalHandle = void 0;
1688
+ }
1689
+ }
1685
1690
  /**
1686
1691
  * The method is used only for adding agent feeds to spaces.
1687
1692
  * When an agent is created we can admit them into all the existing spaces. In case the operation fails
@@ -1700,7 +1705,7 @@ var NotarizationPlugin = class extends Resource3 {
1700
1705
  if (!credentials.length) {
1701
1706
  log5("edge did not return credentials for notarization", void 0, {
1702
1707
  F: __dxlog_file8,
1703
- L: 296,
1708
+ L: 311,
1704
1709
  S: this,
1705
1710
  C: (f, a) => f(...a)
1706
1711
  });
@@ -1710,7 +1715,7 @@ var NotarizationPlugin = class extends Resource3 {
1710
1715
  count: credentials.length
1711
1716
  }, {
1712
1717
  F: __dxlog_file8,
1713
- L: 300,
1718
+ L: 315,
1714
1719
  S: this,
1715
1720
  C: (f, a) => f(...a)
1716
1721
  });
@@ -1723,7 +1728,7 @@ var NotarizationPlugin = class extends Resource3 {
1723
1728
  count: decodedCredentials.length
1724
1729
  }, {
1725
1730
  F: __dxlog_file8,
1726
- L: 309,
1731
+ L: 324,
1727
1732
  S: this,
1728
1733
  C: (f, a) => f(...a)
1729
1734
  });
@@ -1751,7 +1756,7 @@ var NotarizationPlugin = class extends Resource3 {
1751
1756
  for (const credential of credentials) {
1752
1757
  invariant4(credential.id, "Credential must have an id", {
1753
1758
  F: __dxlog_file8,
1754
- L: 335,
1759
+ L: 350,
1755
1760
  S: this,
1756
1761
  A: [
1757
1762
  "credential.id",
@@ -1775,7 +1780,7 @@ var NotarizationPlugin = class extends Resource3 {
1775
1780
  peer: extension.localPeerId
1776
1781
  }, {
1777
1782
  F: __dxlog_file8,
1778
- L: 350,
1783
+ L: 365,
1779
1784
  S: this,
1780
1785
  C: (f, a) => f(...a)
1781
1786
  });
@@ -1787,7 +1792,7 @@ var NotarizationPlugin = class extends Resource3 {
1787
1792
  peer: extension.localPeerId
1788
1793
  }, {
1789
1794
  F: __dxlog_file8,
1790
- L: 355,
1795
+ L: 370,
1791
1796
  S: this,
1792
1797
  C: (f, a) => f(...a)
1793
1798
  });
@@ -1804,7 +1809,7 @@ var NotarizationPlugin = class extends Resource3 {
1804
1809
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
1805
1810
  }, {
1806
1811
  F: __dxlog_file8,
1807
- L: 367,
1812
+ L: 382,
1808
1813
  S: this,
1809
1814
  C: (f, a) => f(...a)
1810
1815
  });
@@ -1820,7 +1825,7 @@ var handleEdgeError = (error) => {
1820
1825
  if (!(error instanceof EdgeCallFailedError) || error.errorData) {
1821
1826
  log5.catch(error, void 0, {
1822
1827
  F: __dxlog_file8,
1823
- L: 381,
1828
+ L: 396,
1824
1829
  S: void 0,
1825
1830
  C: (f, a) => f(...a)
1826
1831
  });
@@ -1829,7 +1834,7 @@ var handleEdgeError = (error) => {
1829
1834
  reason: error.reason
1830
1835
  }, {
1831
1836
  F: __dxlog_file8,
1832
- L: 383,
1837
+ L: 398,
1833
1838
  S: void 0,
1834
1839
  C: (f, a) => f(...a)
1835
1840
  });
@@ -7630,7 +7635,8 @@ var ServiceContext = class extends Resource7 {
7630
7635
  this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
7631
7636
  this.echoHost = new EchoHost({
7632
7637
  kv: this.level,
7633
- peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
7638
+ peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
7639
+ getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key
7634
7640
  });
7635
7641
  this._meshReplicator = new MeshEchoReplicator();
7636
7642
  this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
@@ -7649,7 +7655,7 @@ var ServiceContext = class extends Resource7 {
7649
7655
  await this._checkStorageVersion();
7650
7656
  log24("opening...", void 0, {
7651
7657
  F: __dxlog_file28,
7652
- L: 198,
7658
+ L: 199,
7653
7659
  S: this,
7654
7660
  C: (f, a) => f(...a)
7655
7661
  });
@@ -7657,7 +7663,7 @@ var ServiceContext = class extends Resource7 {
7657
7663
  id: this._instanceId
7658
7664
  }), {
7659
7665
  F: __dxlog_file28,
7660
- L: 199,
7666
+ L: 200,
7661
7667
  S: this,
7662
7668
  C: (f, a) => f(...a)
7663
7669
  });
@@ -7684,7 +7690,7 @@ var ServiceContext = class extends Resource7 {
7684
7690
  count: loadedInvitations.invitations?.length
7685
7691
  }, {
7686
7692
  F: __dxlog_file28,
7687
- L: 227,
7693
+ L: 228,
7688
7694
  S: this,
7689
7695
  C: (f, a) => f(...a)
7690
7696
  });
@@ -7692,13 +7698,13 @@ var ServiceContext = class extends Resource7 {
7692
7698
  id: this._instanceId
7693
7699
  }), {
7694
7700
  F: __dxlog_file28,
7695
- L: 229,
7701
+ L: 230,
7696
7702
  S: this,
7697
7703
  C: (f, a) => f(...a)
7698
7704
  });
7699
7705
  log24("opened", void 0, {
7700
7706
  F: __dxlog_file28,
7701
- L: 230,
7707
+ L: 231,
7702
7708
  S: this,
7703
7709
  C: (f, a) => f(...a)
7704
7710
  });
@@ -7706,7 +7712,7 @@ var ServiceContext = class extends Resource7 {
7706
7712
  async _close(ctx) {
7707
7713
  log24("closing...", void 0, {
7708
7714
  F: __dxlog_file28,
7709
- L: 234,
7715
+ L: 235,
7710
7716
  S: this,
7711
7717
  C: (f, a) => f(...a)
7712
7718
  });
@@ -7725,7 +7731,7 @@ var ServiceContext = class extends Resource7 {
7725
7731
  await this._edgeConnection?.close();
7726
7732
  log24("closed", void 0, {
7727
7733
  F: __dxlog_file28,
7728
- L: 250,
7734
+ L: 251,
7729
7735
  S: this,
7730
7736
  C: (f, a) => f(...a)
7731
7737
  });
@@ -7736,7 +7742,7 @@ var ServiceContext = class extends Resource7 {
7736
7742
  await identity.joinNetwork();
7737
7743
  await this._initialize(new Context9(void 0, {
7738
7744
  F: __dxlog_file28,
7739
- L: 257
7745
+ L: 258
7740
7746
  }));
7741
7747
  return identity;
7742
7748
  }
@@ -7747,7 +7753,7 @@ var ServiceContext = class extends Resource7 {
7747
7753
  const factory = this._handlerFactories.get(invitation.kind);
7748
7754
  invariant20(factory, `Unknown invitation kind: ${invitation.kind}`, {
7749
7755
  F: __dxlog_file28,
7750
- L: 266,
7756
+ L: 267,
7751
7757
  S: this,
7752
7758
  A: [
7753
7759
  "factory",
@@ -7773,7 +7779,7 @@ var ServiceContext = class extends Resource7 {
7773
7779
  await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7774
7780
  await this._initialize(new Context9(void 0, {
7775
7781
  F: __dxlog_file28,
7776
- L: 285
7782
+ L: 286
7777
7783
  }));
7778
7784
  return identity;
7779
7785
  }
@@ -7787,7 +7793,7 @@ var ServiceContext = class extends Resource7 {
7787
7793
  async _initialize(ctx) {
7788
7794
  log24("initializing spaces...", void 0, {
7789
7795
  F: __dxlog_file28,
7790
- L: 300,
7796
+ L: 301,
7791
7797
  S: this,
7792
7798
  C: (f, a) => f(...a)
7793
7799
  });
@@ -7826,7 +7832,7 @@ var ServiceContext = class extends Resource7 {
7826
7832
  this._handlerFactories.set(Invitation10.Kind.SPACE, (invitation) => {
7827
7833
  invariant20(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7828
7834
  F: __dxlog_file28,
7829
- L: 338,
7835
+ L: 339,
7830
7836
  S: this,
7831
7837
  A: [
7832
7838
  "this.dataSpaceManager",
@@ -7850,7 +7856,7 @@ var ServiceContext = class extends Resource7 {
7850
7856
  details: assertion
7851
7857
  }, {
7852
7858
  F: __dxlog_file28,
7853
- L: 354,
7859
+ L: 355,
7854
7860
  S: this,
7855
7861
  C: (f, a) => f(...a)
7856
7862
  });
@@ -7861,7 +7867,7 @@ var ServiceContext = class extends Resource7 {
7861
7867
  details: assertion
7862
7868
  }, {
7863
7869
  F: __dxlog_file28,
7864
- L: 358,
7870
+ L: 359,
7865
7871
  S: this,
7866
7872
  C: (f, a) => f(...a)
7867
7873
  });
@@ -7872,7 +7878,7 @@ var ServiceContext = class extends Resource7 {
7872
7878
  details: assertion
7873
7879
  }, {
7874
7880
  F: __dxlog_file28,
7875
- L: 363,
7881
+ L: 364,
7876
7882
  S: this,
7877
7883
  C: (f, a) => f(...a)
7878
7884
  });
@@ -7883,7 +7889,7 @@ var ServiceContext = class extends Resource7 {
7883
7889
  } catch (err) {
7884
7890
  log24.catch(err, void 0, {
7885
7891
  F: __dxlog_file28,
7886
- L: 369,
7892
+ L: 370,
7887
7893
  S: this,
7888
7894
  C: (f, a) => f(...a)
7889
7895
  });
@@ -7904,7 +7910,7 @@ var ServiceContext = class extends Resource7 {
7904
7910
  swarms: this.networkManager.topics
7905
7911
  }, {
7906
7912
  F: __dxlog_file28,
7907
- L: 383,
7913
+ L: 384,
7908
7914
  S: this,
7909
7915
  C: (f, a) => f(...a)
7910
7916
  });
@@ -7918,7 +7924,7 @@ var ServiceContext = class extends Resource7 {
7918
7924
  });
7919
7925
  invariant20(identity.deviceCredentialChain, void 0, {
7920
7926
  F: __dxlog_file28,
7921
- L: 402,
7927
+ L: 403,
7922
7928
  S: this,
7923
7929
  A: [
7924
7930
  "identity.deviceCredentialChain",
@@ -9061,4 +9067,4 @@ export {
9061
9067
  importProfileData,
9062
9068
  ClientServicesHost
9063
9069
  };
9064
- //# sourceMappingURL=chunk-BXVZXTZM.mjs.map
9070
+ //# sourceMappingURL=chunk-2VSGKKFD.mjs.map