@dxos/client-services 0.7.4 → 0.7.5-feature-compute.4d9d99a

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 (33) hide show
  1. package/dist/lib/browser/{chunk-423GRVVV.mjs → chunk-AFWOS726.mjs} +132 -89
  2. package/dist/lib/browser/chunk-AFWOS726.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +1 -1
  6. package/dist/lib/node/{chunk-ZS24HRVA.cjs → chunk-Y6DGVTBD.cjs} +135 -92
  7. package/dist/lib/node/chunk-Y6DGVTBD.cjs.map +7 -0
  8. package/dist/lib/node/index.cjs +47 -47
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +8 -8
  11. package/dist/lib/node-esm/{chunk-OQOXRHWF.mjs → chunk-IYBUWLEV.mjs} +132 -89
  12. package/dist/lib/node-esm/chunk-IYBUWLEV.mjs.map +7 -0
  13. package/dist/lib/node-esm/index.mjs +1 -1
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/testing/index.mjs +1 -1
  16. package/dist/types/src/packlets/network/network-service.d.ts +8 -1
  17. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  18. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  19. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  20. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +3 -0
  21. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  22. package/dist/types/src/version.d.ts +1 -1
  23. package/dist/types/src/version.d.ts.map +1 -1
  24. package/dist/types/tsconfig.tsbuildinfo +1 -0
  25. package/package.json +38 -38
  26. package/src/packlets/network/network-service.ts +38 -0
  27. package/src/packlets/services/service-context.ts +3 -1
  28. package/src/packlets/spaces/edge-feed-replicator.ts +11 -5
  29. package/src/packlets/spaces/notarization-plugin.ts +32 -17
  30. package/src/version.ts +1 -5
  31. package/dist/lib/browser/chunk-423GRVVV.mjs.map +0 -7
  32. package/dist/lib/node/chunk-ZS24HRVA.cjs.map +0 -7
  33. package/dist/lib/node-esm/chunk-OQOXRHWF.mjs.map +0 -7
@@ -6,7 +6,7 @@ import {
6
6
  InvitationsManager,
7
7
  ServiceContext,
8
8
  SpaceInvitationProtocol
9
- } from "../chunk-423GRVVV.mjs";
9
+ } from "../chunk-AFWOS726.mjs";
10
10
 
11
11
  // packages/sdk/client-services/src/packlets/testing/credential-utils.ts
12
12
  import { createCredential } from "@dxos/credentials";
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_ZS24HRVA_exports = {};
30
- __export(chunk_ZS24HRVA_exports, {
29
+ var chunk_Y6DGVTBD_exports = {};
30
+ __export(chunk_Y6DGVTBD_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -72,7 +72,7 @@ __export(chunk_ZS24HRVA_exports, {
72
72
  subscribeToSpaces: () => subscribeToSpaces,
73
73
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
74
74
  });
75
- module.exports = __toCommonJS(chunk_ZS24HRVA_exports);
75
+ module.exports = __toCommonJS(chunk_Y6DGVTBD_exports);
76
76
  var import_async = require("@dxos/async");
77
77
  var import_codec_protobuf = require("@dxos/codec-protobuf");
78
78
  var import_feed_store = require("@dxos/feed-store");
@@ -735,7 +735,7 @@ var DevtoolsServiceImpl = class {
735
735
  });
736
736
  }
737
737
  };
738
- var DXOS_VERSION = "0.7.4";
738
+ var DXOS_VERSION = "0.7.5-feature-compute.4d9d99a";
739
739
  var getPlatform = () => {
740
740
  if (process.browser) {
741
741
  if (typeof window !== "undefined") {
@@ -1256,21 +1256,20 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1256
1256
  });
1257
1257
  return;
1258
1258
  }
1259
- const logPayload = message.type === "data" ? {
1260
- feedKey: message.feedKey,
1261
- blocks: message.blocks.map((b) => b.index)
1262
- } : {
1263
- message
1264
- };
1265
- import_log3.log.info("sending message", logPayload, {
1266
- F: __dxlog_file5,
1267
- L: 152,
1268
- S: this,
1269
- C: (f, a) => f(...a)
1270
- });
1259
+ if (message.type === "data") {
1260
+ import_log3.log.info("sending blocks", {
1261
+ feedKey: message.feedKey,
1262
+ blocks: message.blocks.map((b) => b.index)
1263
+ }, {
1264
+ F: __dxlog_file5,
1265
+ L: 151,
1266
+ S: this,
1267
+ C: (f, a) => f(...a)
1268
+ });
1269
+ }
1271
1270
  (0, import_invariant2.invariant)(message.feedKey, void 0, {
1272
1271
  F: __dxlog_file5,
1273
- L: 154,
1272
+ L: 157,
1274
1273
  S: this,
1275
1274
  A: [
1276
1275
  "message.feedKey",
@@ -1282,7 +1281,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1282
1281
  type: message.type
1283
1282
  }, {
1284
1283
  F: __dxlog_file5,
1285
- L: 157,
1284
+ L: 160,
1286
1285
  S: this,
1287
1286
  C: (f, a) => f(...a)
1288
1287
  });
@@ -1301,7 +1300,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1301
1300
  if (!this._connectionCtx) {
1302
1301
  import_log3.log.warn("received message after connection context was disposed", void 0, {
1303
1302
  F: __dxlog_file5,
1304
- L: 172,
1303
+ L: 175,
1305
1304
  S: this,
1306
1305
  C: (f, a) => f(...a)
1307
1306
  });
@@ -1312,14 +1311,6 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1312
1311
  case "metadata": {
1313
1312
  try {
1314
1313
  var _usingCtx = _using_ctx();
1315
- import_log3.log.info("received metadata", {
1316
- message
1317
- }, {
1318
- F: __dxlog_file5,
1319
- L: 178,
1320
- S: this,
1321
- C: (f, a) => f(...a)
1322
- });
1323
1314
  const feedKey = import_keys3.PublicKey.fromHex(message.feedKey);
1324
1315
  const feed = this._feeds.get(feedKey);
1325
1316
  if (!feed) {
@@ -1327,7 +1318,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1327
1318
  feedKey
1328
1319
  }, {
1329
1320
  F: __dxlog_file5,
1330
- L: 183,
1321
+ L: 184,
1331
1322
  S: this,
1332
1323
  C: (f, a) => f(...a)
1333
1324
  });
@@ -1335,7 +1326,18 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1335
1326
  }
1336
1327
  const _guard = _usingCtx.u(await this._getPushMutex(feed.key).acquire());
1337
1328
  this._remoteLength.set(feedKey, message.length);
1329
+ const logMeta = {
1330
+ localLength: feed.length,
1331
+ remoteLength: message.length,
1332
+ feedKey
1333
+ };
1338
1334
  if (message.length > feed.length) {
1335
+ import_log3.log.info("requesting missing blocks", logMeta, {
1336
+ F: __dxlog_file5,
1337
+ L: 194,
1338
+ S: this,
1339
+ C: (f, a) => f(...a)
1340
+ });
1339
1341
  await this._sendMessage({
1340
1342
  type: "request",
1341
1343
  feedKey: feedKey.toHex(),
@@ -1345,6 +1347,12 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1345
1347
  }
1346
1348
  });
1347
1349
  } else if (message.length < feed.length) {
1350
+ import_log3.log.info("pushing blocks to remote", logMeta, {
1351
+ F: __dxlog_file5,
1352
+ L: 202,
1353
+ S: this,
1354
+ C: (f, a) => f(...a)
1355
+ });
1348
1356
  await this._pushBlocks(feed, message.length, feed.length);
1349
1357
  }
1350
1358
  break;
@@ -1360,7 +1368,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1360
1368
  blocks: message.blocks.map((b) => b.index)
1361
1369
  }, {
1362
1370
  F: __dxlog_file5,
1363
- L: 205,
1371
+ L: 211,
1364
1372
  S: this,
1365
1373
  C: (f, a) => f(...a)
1366
1374
  });
@@ -1371,7 +1379,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1371
1379
  feedKey
1372
1380
  }, {
1373
1381
  F: __dxlog_file5,
1374
- L: 210,
1382
+ L: 216,
1375
1383
  S: this,
1376
1384
  C: (f, a) => f(...a)
1377
1385
  });
@@ -1385,7 +1393,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1385
1393
  ...message
1386
1394
  }, {
1387
1395
  F: __dxlog_file5,
1388
- L: 219,
1396
+ L: 225,
1389
1397
  S: this,
1390
1398
  C: (f, a) => f(...a)
1391
1399
  });
@@ -1400,7 +1408,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1400
1408
  to
1401
1409
  }, {
1402
1410
  F: __dxlog_file5,
1403
- L: 226,
1411
+ L: 232,
1404
1412
  S: this,
1405
1413
  C: (f, a) => f(...a)
1406
1414
  });
@@ -1410,7 +1418,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1410
1418
  });
1411
1419
  (0, import_invariant2.invariant)(data instanceof Uint8Array, void 0, {
1412
1420
  F: __dxlog_file5,
1413
- L: 231,
1421
+ L: 237,
1414
1422
  S: this,
1415
1423
  A: [
1416
1424
  "data instanceof Uint8Array",
@@ -1438,7 +1446,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1438
1446
  blocks: blocks.length
1439
1447
  }, {
1440
1448
  F: __dxlog_file5,
1441
- L: 252,
1449
+ L: 258,
1442
1450
  S: this,
1443
1451
  C: (f, a) => f(...a)
1444
1452
  });
@@ -1460,7 +1468,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1460
1468
  if (!this._remoteLength.has(feed.key)) {
1461
1469
  (0, import_log3.log)("blocks not pushed because remote length is unknown", void 0, {
1462
1470
  F: __dxlog_file5,
1463
- L: 273,
1471
+ L: 279,
1464
1472
  S: this,
1465
1473
  C: (f, a) => f(...a)
1466
1474
  });
@@ -1485,7 +1493,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1485
1493
  if (err instanceof import_edge_client.EdgeIdentityChangedError || err instanceof import_edge_client.EdgeConnectionClosedError) {
1486
1494
  (0, import_log3.log)("resetting on reconnect", void 0, {
1487
1495
  F: __dxlog_file5,
1488
- L: 290,
1496
+ L: 296,
1489
1497
  S: this,
1490
1498
  C: (f, a) => f(...a)
1491
1499
  });
@@ -1496,7 +1504,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1496
1504
  }
1497
1505
  }, {
1498
1506
  F: __dxlog_file5,
1499
- L: 284
1507
+ L: 290
1500
1508
  });
1501
1509
  return connectionCtx;
1502
1510
  }
@@ -1625,6 +1633,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1625
1633
  this._processedCredentials = new import_util5.ComplexSet(import_keys5.PublicKey.hash);
1626
1634
  this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys5.PublicKey.hash);
1627
1635
  this._activeEdgePollingIntervalHandle = void 0;
1636
+ this._activeEdgePollingEnabled = false;
1628
1637
  this._spaceId = params.spaceId;
1629
1638
  this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
1630
1639
  if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
@@ -1632,15 +1641,6 @@ var NotarizationPlugin = class extends import_context6.Resource {
1632
1641
  }
1633
1642
  }
1634
1643
  setActiveEdgePollingEnabled(enabled) {
1635
- (0, import_invariant5.invariant)(this.isOpen, void 0, {
1636
- F: __dxlog_file7,
1637
- L: 109,
1638
- S: this,
1639
- A: [
1640
- "this.isOpen",
1641
- ""
1642
- ]
1643
- });
1644
1644
  const client = this._edgeClient;
1645
1645
  (0, import_invariant5.invariant)(client, void 0, {
1646
1646
  F: __dxlog_file7,
@@ -1651,30 +1651,30 @@ var NotarizationPlugin = class extends import_context6.Resource {
1651
1651
  ""
1652
1652
  ]
1653
1653
  });
1654
- if (enabled && !this._activeEdgePollingIntervalHandle) {
1655
- this._activeEdgePollingIntervalHandle = setInterval(() => {
1656
- if (this._writer) {
1657
- this._notarizePendingEdgeCredentials(client, this._writer);
1658
- }
1659
- }, this._activeEdgePollingInterval);
1660
- } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1661
- clearInterval(this._activeEdgePollingIntervalHandle);
1662
- this._activeEdgePollingIntervalHandle = void 0;
1654
+ this._activeEdgePollingEnabled = enabled;
1655
+ if (this.isOpen) {
1656
+ if (enabled && !this._activeEdgePollingIntervalHandle) {
1657
+ this._startPeriodicEdgePolling(client);
1658
+ } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1659
+ this._stopPeriodicEdgePolling();
1660
+ }
1663
1661
  }
1664
1662
  }
1665
1663
  get hasWriter() {
1666
1664
  return !!this._writer;
1667
1665
  }
1668
1666
  async _open() {
1669
- if (this._edgeClient && this._writer) {
1670
- this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
1667
+ if (this._edgeClient) {
1668
+ if (this._activeEdgePollingEnabled) {
1669
+ this._startPeriodicEdgePolling(this._edgeClient);
1670
+ }
1671
+ if (this._writer) {
1672
+ this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
1673
+ }
1671
1674
  }
1672
1675
  }
1673
1676
  async _close() {
1674
- if (this._activeEdgePollingIntervalHandle) {
1675
- clearInterval(this._activeEdgePollingIntervalHandle);
1676
- this._activeEdgePollingIntervalHandle = void 0;
1677
- }
1677
+ this._stopPeriodicEdgePolling();
1678
1678
  await this._ctx.dispose();
1679
1679
  }
1680
1680
  /**
@@ -1852,10 +1852,23 @@ var NotarizationPlugin = class extends import_context6.Resource {
1852
1852
  ]
1853
1853
  });
1854
1854
  this._writer = writer;
1855
- if (this._edgeClient) {
1855
+ if (this._edgeClient && this.isOpen) {
1856
1856
  this._notarizePendingEdgeCredentials(this._edgeClient, writer);
1857
1857
  }
1858
1858
  }
1859
+ _startPeriodicEdgePolling(client) {
1860
+ this._activeEdgePollingIntervalHandle = setInterval(() => {
1861
+ if (this._writer) {
1862
+ this._notarizePendingEdgeCredentials(client, this._writer);
1863
+ }
1864
+ }, this._activeEdgePollingInterval);
1865
+ }
1866
+ _stopPeriodicEdgePolling() {
1867
+ if (this._activeEdgePollingIntervalHandle) {
1868
+ clearInterval(this._activeEdgePollingIntervalHandle);
1869
+ this._activeEdgePollingIntervalHandle = void 0;
1870
+ }
1871
+ }
1859
1872
  /**
1860
1873
  * The method is used only for adding agent feeds to spaces.
1861
1874
  * When an agent is created we can admit them into all the existing spaces. In case the operation fails
@@ -1874,7 +1887,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1874
1887
  if (!credentials.length) {
1875
1888
  (0, import_log5.log)("edge did not return credentials for notarization", void 0, {
1876
1889
  F: __dxlog_file7,
1877
- L: 296,
1890
+ L: 311,
1878
1891
  S: this,
1879
1892
  C: (f, a) => f(...a)
1880
1893
  });
@@ -1884,7 +1897,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1884
1897
  count: credentials.length
1885
1898
  }, {
1886
1899
  F: __dxlog_file7,
1887
- L: 300,
1900
+ L: 315,
1888
1901
  S: this,
1889
1902
  C: (f, a) => f(...a)
1890
1903
  });
@@ -1897,7 +1910,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1897
1910
  count: decodedCredentials.length
1898
1911
  }, {
1899
1912
  F: __dxlog_file7,
1900
- L: 309,
1913
+ L: 324,
1901
1914
  S: this,
1902
1915
  C: (f, a) => f(...a)
1903
1916
  });
@@ -1925,7 +1938,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1925
1938
  for (const credential of credentials) {
1926
1939
  (0, import_invariant5.invariant)(credential.id, "Credential must have an id", {
1927
1940
  F: __dxlog_file7,
1928
- L: 335,
1941
+ L: 350,
1929
1942
  S: this,
1930
1943
  A: [
1931
1944
  "credential.id",
@@ -1949,7 +1962,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1949
1962
  peer: extension.localPeerId
1950
1963
  }, {
1951
1964
  F: __dxlog_file7,
1952
- L: 350,
1965
+ L: 365,
1953
1966
  S: this,
1954
1967
  C: (f, a) => f(...a)
1955
1968
  });
@@ -1961,7 +1974,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1961
1974
  peer: extension.localPeerId
1962
1975
  }, {
1963
1976
  F: __dxlog_file7,
1964
- L: 355,
1977
+ L: 370,
1965
1978
  S: this,
1966
1979
  C: (f, a) => f(...a)
1967
1980
  });
@@ -1978,7 +1991,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1978
1991
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
1979
1992
  }, {
1980
1993
  F: __dxlog_file7,
1981
- L: 367,
1994
+ L: 382,
1982
1995
  S: this,
1983
1996
  C: (f, a) => f(...a)
1984
1997
  });
@@ -1994,7 +2007,7 @@ var handleEdgeError = (error) => {
1994
2007
  if (!(error instanceof import_protocols4.EdgeCallFailedError) || error.errorData) {
1995
2008
  import_log5.log.catch(error, void 0, {
1996
2009
  F: __dxlog_file7,
1997
- L: 381,
2010
+ L: 396,
1998
2011
  S: void 0,
1999
2012
  C: (f, a) => f(...a)
2000
2013
  });
@@ -2003,7 +2016,7 @@ var handleEdgeError = (error) => {
2003
2016
  reason: error.reason
2004
2017
  }, {
2005
2018
  F: __dxlog_file7,
2006
- L: 383,
2019
+ L: 398,
2007
2020
  S: void 0,
2008
2021
  C: (f, a) => f(...a)
2009
2022
  });
@@ -7490,7 +7503,8 @@ var ServiceContext = class extends import_context16.Resource {
7490
7503
  this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
7491
7504
  this.echoHost = new import_echo_pipeline4.EchoHost({
7492
7505
  kv: this.level,
7493
- peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
7506
+ peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
7507
+ getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key
7494
7508
  });
7495
7509
  this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
7496
7510
  this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
@@ -7509,7 +7523,7 @@ var ServiceContext = class extends import_context16.Resource {
7509
7523
  await this._checkStorageVersion();
7510
7524
  (0, import_log22.log)("opening...", void 0, {
7511
7525
  F: __dxlog_file27,
7512
- L: 198,
7526
+ L: 199,
7513
7527
  S: this,
7514
7528
  C: (f, a) => f(...a)
7515
7529
  });
@@ -7517,7 +7531,7 @@ var ServiceContext = class extends import_context16.Resource {
7517
7531
  id: this._instanceId
7518
7532
  }), {
7519
7533
  F: __dxlog_file27,
7520
- L: 199,
7534
+ L: 200,
7521
7535
  S: this,
7522
7536
  C: (f, a) => f(...a)
7523
7537
  });
@@ -7544,7 +7558,7 @@ var ServiceContext = class extends import_context16.Resource {
7544
7558
  count: loadedInvitations.invitations?.length
7545
7559
  }, {
7546
7560
  F: __dxlog_file27,
7547
- L: 227,
7561
+ L: 228,
7548
7562
  S: this,
7549
7563
  C: (f, a) => f(...a)
7550
7564
  });
@@ -7552,13 +7566,13 @@ var ServiceContext = class extends import_context16.Resource {
7552
7566
  id: this._instanceId
7553
7567
  }), {
7554
7568
  F: __dxlog_file27,
7555
- L: 229,
7569
+ L: 230,
7556
7570
  S: this,
7557
7571
  C: (f, a) => f(...a)
7558
7572
  });
7559
7573
  (0, import_log22.log)("opened", void 0, {
7560
7574
  F: __dxlog_file27,
7561
- L: 230,
7575
+ L: 231,
7562
7576
  S: this,
7563
7577
  C: (f, a) => f(...a)
7564
7578
  });
@@ -7566,7 +7580,7 @@ var ServiceContext = class extends import_context16.Resource {
7566
7580
  async _close(ctx) {
7567
7581
  (0, import_log22.log)("closing...", void 0, {
7568
7582
  F: __dxlog_file27,
7569
- L: 234,
7583
+ L: 235,
7570
7584
  S: this,
7571
7585
  C: (f, a) => f(...a)
7572
7586
  });
@@ -7585,7 +7599,7 @@ var ServiceContext = class extends import_context16.Resource {
7585
7599
  await this._edgeConnection?.close();
7586
7600
  (0, import_log22.log)("closed", void 0, {
7587
7601
  F: __dxlog_file27,
7588
- L: 250,
7602
+ L: 251,
7589
7603
  S: this,
7590
7604
  C: (f, a) => f(...a)
7591
7605
  });
@@ -7596,7 +7610,7 @@ var ServiceContext = class extends import_context16.Resource {
7596
7610
  await identity.joinNetwork();
7597
7611
  await this._initialize(new import_context16.Context(void 0, {
7598
7612
  F: __dxlog_file27,
7599
- L: 257
7613
+ L: 258
7600
7614
  }));
7601
7615
  return identity;
7602
7616
  }
@@ -7607,7 +7621,7 @@ var ServiceContext = class extends import_context16.Resource {
7607
7621
  const factory = this._handlerFactories.get(invitation.kind);
7608
7622
  (0, import_invariant21.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
7609
7623
  F: __dxlog_file27,
7610
- L: 266,
7624
+ L: 267,
7611
7625
  S: this,
7612
7626
  A: [
7613
7627
  "factory",
@@ -7633,7 +7647,7 @@ var ServiceContext = class extends import_context16.Resource {
7633
7647
  await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7634
7648
  await this._initialize(new import_context16.Context(void 0, {
7635
7649
  F: __dxlog_file27,
7636
- L: 285
7650
+ L: 286
7637
7651
  }));
7638
7652
  return identity;
7639
7653
  }
@@ -7647,7 +7661,7 @@ var ServiceContext = class extends import_context16.Resource {
7647
7661
  async _initialize(ctx) {
7648
7662
  (0, import_log22.log)("initializing spaces...", void 0, {
7649
7663
  F: __dxlog_file27,
7650
- L: 300,
7664
+ L: 301,
7651
7665
  S: this,
7652
7666
  C: (f, a) => f(...a)
7653
7667
  });
@@ -7686,7 +7700,7 @@ var ServiceContext = class extends import_context16.Resource {
7686
7700
  this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
7687
7701
  (0, import_invariant21.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7688
7702
  F: __dxlog_file27,
7689
- L: 338,
7703
+ L: 339,
7690
7704
  S: this,
7691
7705
  A: [
7692
7706
  "this.dataSpaceManager",
@@ -7710,7 +7724,7 @@ var ServiceContext = class extends import_context16.Resource {
7710
7724
  details: assertion
7711
7725
  }, {
7712
7726
  F: __dxlog_file27,
7713
- L: 354,
7727
+ L: 355,
7714
7728
  S: this,
7715
7729
  C: (f, a) => f(...a)
7716
7730
  });
@@ -7721,7 +7735,7 @@ var ServiceContext = class extends import_context16.Resource {
7721
7735
  details: assertion
7722
7736
  }, {
7723
7737
  F: __dxlog_file27,
7724
- L: 358,
7738
+ L: 359,
7725
7739
  S: this,
7726
7740
  C: (f, a) => f(...a)
7727
7741
  });
@@ -7732,7 +7746,7 @@ var ServiceContext = class extends import_context16.Resource {
7732
7746
  details: assertion
7733
7747
  }, {
7734
7748
  F: __dxlog_file27,
7735
- L: 363,
7749
+ L: 364,
7736
7750
  S: this,
7737
7751
  C: (f, a) => f(...a)
7738
7752
  });
@@ -7743,7 +7757,7 @@ var ServiceContext = class extends import_context16.Resource {
7743
7757
  } catch (err) {
7744
7758
  import_log22.log.catch(err, void 0, {
7745
7759
  F: __dxlog_file27,
7746
- L: 369,
7760
+ L: 370,
7747
7761
  S: this,
7748
7762
  C: (f, a) => f(...a)
7749
7763
  });
@@ -7759,12 +7773,12 @@ var ServiceContext = class extends import_context16.Resource {
7759
7773
  let edgeIdentity;
7760
7774
  const identity = this.identityManager.identity;
7761
7775
  if (identity) {
7762
- import_log22.log.info("Setting identity on edge connection", {
7776
+ (0, import_log22.log)("setting identity on edge connection", {
7763
7777
  identity: identity.identityKey.toHex(),
7764
7778
  swarms: this.networkManager.topics
7765
7779
  }, {
7766
7780
  F: __dxlog_file27,
7767
- L: 383,
7781
+ L: 384,
7768
7782
  S: this,
7769
7783
  C: (f, a) => f(...a)
7770
7784
  });
@@ -7778,7 +7792,7 @@ var ServiceContext = class extends import_context16.Resource {
7778
7792
  });
7779
7793
  (0, import_invariant21.invariant)(identity.deviceCredentialChain, void 0, {
7780
7794
  F: __dxlog_file27,
7781
- L: 401,
7795
+ L: 403,
7782
7796
  S: this,
7783
7797
  A: [
7784
7798
  "identity.deviceCredentialChain",
@@ -8350,6 +8364,35 @@ var NetworkServiceImpl = class {
8350
8364
  async updateConfig(request) {
8351
8365
  await this.networkManager.setConnectionState(request.swarm);
8352
8366
  }
8367
+ async joinSwarm(request) {
8368
+ return this.signalManager.join(request);
8369
+ }
8370
+ async leaveSwarm(request) {
8371
+ return this.signalManager.leave(request);
8372
+ }
8373
+ subscribeSwarmState(request) {
8374
+ return new import_codec_protobuf16.Stream(({ next }) => {
8375
+ const unsubscribe = this.signalManager.swarmState?.on((state) => {
8376
+ if (request.topic.equals(state.swarmKey)) {
8377
+ next(state);
8378
+ }
8379
+ });
8380
+ return unsubscribe;
8381
+ });
8382
+ }
8383
+ async sendMessage(message) {
8384
+ return this.signalManager.sendMessage(message);
8385
+ }
8386
+ subscribeMessages(peer) {
8387
+ return new import_codec_protobuf16.Stream(({ next }) => {
8388
+ const unsubscribe = this.signalManager.onMessage.on((message) => {
8389
+ if (message.recipient.peerKey === peer.peerKey) {
8390
+ next(message);
8391
+ }
8392
+ });
8393
+ return unsubscribe;
8394
+ });
8395
+ }
8353
8396
  };
8354
8397
  var SystemServiceImpl = class {
8355
8398
  constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
@@ -8850,4 +8893,4 @@ ClientServicesHost = _ts_decorate11([
8850
8893
  subscribeToSpaces,
8851
8894
  subscribeToSwarmInfo
8852
8895
  });
8853
- //# sourceMappingURL=chunk-ZS24HRVA.cjs.map
8896
+ //# sourceMappingURL=chunk-Y6DGVTBD.cjs.map