@dxos/client-services 0.8.2-main.f11618f → 0.8.2-staging.7ac8446

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 (37) hide show
  1. package/dist/lib/browser/{chunk-R24OWGT7.mjs → chunk-2TKMQ2UP.mjs} +71 -61
  2. package/dist/lib/browser/chunk-2TKMQ2UP.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-ZIKA2DAN.cjs → chunk-HUMVSL5Y.cjs} +242 -232
  7. package/dist/lib/node/chunk-HUMVSL5Y.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-QLUXYSIC.mjs → chunk-DQCPFIVI.mjs} +71 -61
  12. package/dist/lib/node-esm/chunk-DQCPFIVI.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/agents/edge-agent-service.d.ts +1 -1
  17. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  18. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  19. package/dist/types/src/packlets/network/network-service.d.ts +1 -3
  20. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  22. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  23. package/dist/types/src/version.d.ts +1 -1
  24. package/dist/types/src/version.d.ts.map +1 -1
  25. package/package.json +38 -38
  26. package/src/packlets/agents/edge-agent-service.ts +11 -8
  27. package/src/packlets/devices/devices-service.ts +3 -5
  28. package/src/packlets/identity/identity.test.ts +6 -9
  29. package/src/packlets/network/network-service.ts +15 -9
  30. package/src/packlets/services/service-host.ts +1 -5
  31. package/src/packlets/spaces/data-space-manager.ts +2 -2
  32. package/src/packlets/spaces/edge-feed-replicator.test.ts +1 -2
  33. package/src/packlets/spaces/edge-feed-replicator.ts +1 -2
  34. package/src/version.ts +1 -1
  35. package/dist/lib/browser/chunk-R24OWGT7.mjs.map +0 -7
  36. package/dist/lib/node/chunk-ZIKA2DAN.cjs.map +0 -7
  37. package/dist/lib/node-esm/chunk-QLUXYSIC.mjs.map +0 -7
@@ -32,7 +32,7 @@ __export(testing_exports, {
32
32
  sanitizeInvitation: () => sanitizeInvitation
33
33
  });
34
34
  module.exports = __toCommonJS(testing_exports);
35
- var import_chunk_ZIKA2DAN = require("../chunk-ZIKA2DAN.cjs");
35
+ var import_chunk_HUMVSL5Y = require("../chunk-HUMVSL5Y.cjs");
36
36
  var import_credentials = require("@dxos/credentials");
37
37
  var import_keys = require("@dxos/keys");
38
38
  var import_async = require("@dxos/async");
@@ -235,7 +235,7 @@ var createInvitation = async (host, options) => {
235
235
  authMethod: import_services.Invitation.AuthMethod.NONE,
236
236
  ...options ?? {}
237
237
  };
238
- if (host instanceof import_chunk_ZIKA2DAN.ServiceContext) {
238
+ if (host instanceof import_chunk_HUMVSL5Y.ServiceContext) {
239
239
  return host.invitationsManager.createInvitation({
240
240
  kind: import_services.Invitation.Kind.SPACE,
241
241
  ...options
@@ -245,7 +245,7 @@ var createInvitation = async (host, options) => {
245
245
  };
246
246
  var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
247
247
  invitation = sanitizeInvitation(invitation);
248
- if (guest instanceof import_chunk_ZIKA2DAN.ServiceContext) {
248
+ if (guest instanceof import_chunk_HUMVSL5Y.ServiceContext) {
249
249
  return guest.invitationsManager.acceptInvitation({
250
250
  invitation,
251
251
  deviceProfile: guestDeviceProfile
@@ -255,7 +255,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
255
255
  };
256
256
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/test-builder.ts";
257
257
  var createServiceHost = (config, signalManagerContext) => {
258
- return new import_chunk_ZIKA2DAN.ClientServicesHost({
258
+ return new import_chunk_HUMVSL5Y.ClientServicesHost({
259
259
  config,
260
260
  signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
261
261
  transportFactory: import_network_manager.MemoryTransportFactory
@@ -274,7 +274,7 @@ var createServiceContext = async ({ signalManagerFactory = async () => {
274
274
  });
275
275
  const level = (0, import_testing.createTestLevel)();
276
276
  await level.open();
277
- return new import_chunk_ZIKA2DAN.ServiceContext(storage, level, networkManager, signalManager, void 0, void 0, {
277
+ return new import_chunk_HUMVSL5Y.ServiceContext(storage, level, networkManager, signalManager, void 0, void 0, {
278
278
  invitationConnectionDefaultParams: {
279
279
  teleport: {
280
280
  controlHeartbeatInterval: 200
@@ -385,7 +385,7 @@ var TestPeer = class {
385
385
  return this._props.meshEchoReplicator ??= new import_echo_pipeline.MeshEchoReplicator();
386
386
  }
387
387
  get dataSpaceManager() {
388
- return this._props.dataSpaceManager ??= new import_chunk_ZIKA2DAN.DataSpaceManager({
388
+ return this._props.dataSpaceManager ??= new import_chunk_HUMVSL5Y.DataSpaceManager({
389
389
  spaceManager: this.spaceManager,
390
390
  metadataStore: this.metadataStore,
391
391
  keyring: this.keyring,
@@ -400,9 +400,9 @@ var TestPeer = class {
400
400
  });
401
401
  }
402
402
  get invitationsManager() {
403
- return this._props.invitationsManager ??= new import_chunk_ZIKA2DAN.InvitationsManager(new import_chunk_ZIKA2DAN.InvitationsHandler(this.networkManager), (invitation) => {
403
+ return this._props.invitationsManager ??= new import_chunk_HUMVSL5Y.InvitationsManager(new import_chunk_HUMVSL5Y.InvitationsHandler(this.networkManager), (invitation) => {
404
404
  if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
405
- return new import_chunk_ZIKA2DAN.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
405
+ return new import_chunk_HUMVSL5Y.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
406
406
  } else {
407
407
  throw new Error("not implemented");
408
408
  }
@@ -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.8.2-main.f11618f";
400
+ var DXOS_VERSION = "0.8.2-staging.7ac8446";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -739,7 +739,6 @@ import { log as log3, logInfo } from "@dxos/log";
739
739
  import { EdgeService } from "@dxos/protocols";
740
740
  import { buf } from "@dxos/protocols/buf";
741
741
  import { MessageSchema as RouterMessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
742
- import { EdgeStatus } from "@dxos/protocols/proto/dxos/client/services";
743
742
  import { ComplexMap as ComplexMap2, arrayToBuffer, bufferToArray, defaultMap, rangeFromTo } from "@dxos/util";
744
743
  function _ts_decorate(decorators, target, key, desc) {
745
744
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -830,7 +829,7 @@ var EdgeFeedReplicator = class extends Resource {
830
829
  async _open() {
831
830
  log3("open", void 0, {
832
831
  F: __dxlog_file5,
833
- L: 57,
832
+ L: 56,
834
833
  S: this,
835
834
  C: (f, a) => f(...a)
836
835
  });
@@ -849,7 +848,7 @@ var EdgeFeedReplicator = class extends Resource {
849
848
  _spaceId: this._spaceId
850
849
  }, {
851
850
  F: __dxlog_file5,
852
- L: 71,
851
+ L: 70,
853
852
  S: this,
854
853
  C: (f, a) => f(...a)
855
854
  });
@@ -862,7 +861,7 @@ var EdgeFeedReplicator = class extends Resource {
862
861
  type: payload.type
863
862
  }, {
864
863
  F: __dxlog_file5,
865
- L: 76,
864
+ L: 75,
866
865
  S: this,
867
866
  C: (f, a) => f(...a)
868
867
  });
@@ -874,14 +873,14 @@ var EdgeFeedReplicator = class extends Resource {
874
873
  }
875
874
  async _handleReconnect() {
876
875
  await this._resetConnection();
877
- if (this._messenger.status === EdgeStatus.CONNECTED) {
876
+ if (this._messenger.isConnected) {
878
877
  this._startReplication();
879
878
  }
880
879
  }
881
880
  async _close() {
882
881
  log3("close", void 0, {
883
882
  F: __dxlog_file5,
884
- L: 96,
883
+ L: 95,
885
884
  S: this,
886
885
  C: (f, a) => f(...a)
887
886
  });
@@ -893,7 +892,7 @@ var EdgeFeedReplicator = class extends Resource {
893
892
  this._connectionCtx = connectionCtx;
894
893
  log3("connection context created", void 0, {
895
894
  F: __dxlog_file5,
896
- L: 104,
895
+ L: 103,
897
896
  S: this,
898
897
  C: (f, a) => f(...a)
899
898
  });
@@ -906,7 +905,7 @@ var EdgeFeedReplicator = class extends Resource {
906
905
  async _resetConnection() {
907
906
  log3("resetConnection", void 0, {
908
907
  F: __dxlog_file5,
909
- L: 113,
908
+ L: 112,
910
909
  S: this,
911
910
  C: (f, a) => f(...a)
912
911
  });
@@ -922,7 +921,7 @@ var EdgeFeedReplicator = class extends Resource {
922
921
  hasConnectionCtx: !!this._connectionCtx
923
922
  }, {
924
923
  F: __dxlog_file5,
925
- L: 121,
924
+ L: 120,
926
925
  S: this,
927
926
  C: (f, a) => f(...a)
928
927
  });
@@ -939,7 +938,7 @@ var EdgeFeedReplicator = class extends Resource {
939
938
  key: feed.key
940
939
  }, {
941
940
  F: __dxlog_file5,
942
- L: 134,
941
+ L: 133,
943
942
  S: this,
944
943
  C: (f, a) => f(...a)
945
944
  });
@@ -955,7 +954,7 @@ var EdgeFeedReplicator = class extends Resource {
955
954
  if (!this._connectionCtx) {
956
955
  log3("message dropped because connection was disposed", void 0, {
957
956
  F: __dxlog_file5,
958
- L: 147,
957
+ L: 146,
959
958
  S: this,
960
959
  C: (f, a) => f(...a)
961
960
  });
@@ -967,14 +966,14 @@ var EdgeFeedReplicator = class extends Resource {
967
966
  blocks: message.blocks.map((b) => b.index)
968
967
  }, {
969
968
  F: __dxlog_file5,
970
- L: 152,
969
+ L: 151,
971
970
  S: this,
972
971
  C: (f, a) => f(...a)
973
972
  });
974
973
  }
975
974
  invariant2(message.feedKey, void 0, {
976
975
  F: __dxlog_file5,
977
- L: 158,
976
+ L: 157,
978
977
  S: this,
979
978
  A: [
980
979
  "message.feedKey",
@@ -986,7 +985,7 @@ var EdgeFeedReplicator = class extends Resource {
986
985
  type: message.type
987
986
  }, {
988
987
  F: __dxlog_file5,
989
- L: 161,
988
+ L: 160,
990
989
  S: this,
991
990
  C: (f, a) => f(...a)
992
991
  });
@@ -1005,7 +1004,7 @@ var EdgeFeedReplicator = class extends Resource {
1005
1004
  if (!this._connectionCtx) {
1006
1005
  log3.warn("received message after connection context was disposed", void 0, {
1007
1006
  F: __dxlog_file5,
1008
- L: 176,
1007
+ L: 175,
1009
1008
  S: this,
1010
1009
  C: (f, a) => f(...a)
1011
1010
  });
@@ -1023,7 +1022,7 @@ var EdgeFeedReplicator = class extends Resource {
1023
1022
  feedKey
1024
1023
  }, {
1025
1024
  F: __dxlog_file5,
1026
- L: 185,
1025
+ L: 184,
1027
1026
  S: this,
1028
1027
  C: (f, a) => f(...a)
1029
1028
  });
@@ -1039,7 +1038,7 @@ var EdgeFeedReplicator = class extends Resource {
1039
1038
  if (message.length > feed.length) {
1040
1039
  log3("requesting missing blocks", logMeta, {
1041
1040
  F: __dxlog_file5,
1042
- L: 195,
1041
+ L: 194,
1043
1042
  S: this,
1044
1043
  C: (f, a) => f(...a)
1045
1044
  });
@@ -1054,7 +1053,7 @@ var EdgeFeedReplicator = class extends Resource {
1054
1053
  } else if (message.length < feed.length) {
1055
1054
  log3("pushing blocks to remote", logMeta, {
1056
1055
  F: __dxlog_file5,
1057
- L: 203,
1056
+ L: 202,
1058
1057
  S: this,
1059
1058
  C: (f, a) => f(...a)
1060
1059
  });
@@ -1073,7 +1072,7 @@ var EdgeFeedReplicator = class extends Resource {
1073
1072
  blocks: message.blocks.map((b) => b.index)
1074
1073
  }, {
1075
1074
  F: __dxlog_file5,
1076
- L: 212,
1075
+ L: 211,
1077
1076
  S: this,
1078
1077
  C: (f, a) => f(...a)
1079
1078
  });
@@ -1084,7 +1083,7 @@ var EdgeFeedReplicator = class extends Resource {
1084
1083
  feedKey
1085
1084
  }, {
1086
1085
  F: __dxlog_file5,
1087
- L: 217,
1086
+ L: 216,
1088
1087
  S: this,
1089
1088
  C: (f, a) => f(...a)
1090
1089
  });
@@ -1098,7 +1097,7 @@ var EdgeFeedReplicator = class extends Resource {
1098
1097
  ...message
1099
1098
  }, {
1100
1099
  F: __dxlog_file5,
1101
- L: 226,
1100
+ L: 225,
1102
1101
  S: this,
1103
1102
  C: (f, a) => f(...a)
1104
1103
  });
@@ -1113,7 +1112,7 @@ var EdgeFeedReplicator = class extends Resource {
1113
1112
  to
1114
1113
  }, {
1115
1114
  F: __dxlog_file5,
1116
- L: 233,
1115
+ L: 232,
1117
1116
  S: this,
1118
1117
  C: (f, a) => f(...a)
1119
1118
  });
@@ -1123,7 +1122,7 @@ var EdgeFeedReplicator = class extends Resource {
1123
1122
  });
1124
1123
  invariant2(data instanceof Uint8Array, void 0, {
1125
1124
  F: __dxlog_file5,
1126
- L: 238,
1125
+ L: 237,
1127
1126
  S: this,
1128
1127
  A: [
1129
1128
  "data instanceof Uint8Array",
@@ -1151,7 +1150,7 @@ var EdgeFeedReplicator = class extends Resource {
1151
1150
  blocks: blocks.length
1152
1151
  }, {
1153
1152
  F: __dxlog_file5,
1154
- L: 259,
1153
+ L: 258,
1155
1154
  S: this,
1156
1155
  C: (f, a) => f(...a)
1157
1156
  });
@@ -1173,7 +1172,7 @@ var EdgeFeedReplicator = class extends Resource {
1173
1172
  if (!this._remoteLength.has(feed.key)) {
1174
1173
  log3("blocks not pushed because remote length is unknown", void 0, {
1175
1174
  F: __dxlog_file5,
1176
- L: 280,
1175
+ L: 279,
1177
1176
  S: this,
1178
1177
  C: (f, a) => f(...a)
1179
1178
  });
@@ -1198,7 +1197,7 @@ var EdgeFeedReplicator = class extends Resource {
1198
1197
  if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
1199
1198
  log3("resetting on reconnect", void 0, {
1200
1199
  F: __dxlog_file5,
1201
- L: 297,
1200
+ L: 296,
1202
1201
  S: this,
1203
1202
  C: (f, a) => f(...a)
1204
1203
  });
@@ -1209,7 +1208,7 @@ var EdgeFeedReplicator = class extends Resource {
1209
1208
  }
1210
1209
  }, {
1211
1210
  F: __dxlog_file5,
1212
- L: 291
1211
+ L: 290
1213
1212
  });
1214
1213
  return connectionCtx;
1215
1214
  }
@@ -1864,7 +1863,7 @@ import { Context as Context4, LifecycleState, Resource as Resource4, cancelWithC
1864
1863
  import { createAdmissionCredentials, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
1865
1864
  import { DatabaseRoot, findInlineObjectOfType, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
1866
1865
  import { SpaceDocVersion, createIdFromSpaceKey, encodeReference } from "@dxos/echo-protocol";
1867
- import { ObjectId, getTypeReference } from "@dxos/echo-schema";
1866
+ import { createObjectId, getTypeReference } from "@dxos/echo-schema";
1868
1867
  import { writeMessages } from "@dxos/feed-store";
1869
1868
  import { assertArgument, assertState, failedInvariant, invariant as invariant5 } from "@dxos/invariant";
1870
1869
  import { PublicKey as PublicKey5 } from "@dxos/keys";
@@ -2238,7 +2237,7 @@ var DataSpaceManager = class extends Resource4 {
2238
2237
  keys: []
2239
2238
  }
2240
2239
  };
2241
- const propertiesId = ObjectId.random();
2240
+ const propertiesId = createObjectId();
2242
2241
  document.change((doc) => {
2243
2242
  setDeep(doc, [
2244
2243
  "objects",
@@ -7504,22 +7503,28 @@ _ts_decorate9([
7504
7503
  // packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
7505
7504
  import { Stream as Stream11 } from "@dxos/codec-protobuf/stream";
7506
7505
  import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
7507
- import { QueryAgentStatusResponse, EdgeStatus as EdgeStatus2 } from "@dxos/protocols/proto/dxos/client/services";
7506
+ import { QueryAgentStatusResponse, QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
7508
7507
  var EdgeAgentServiceImpl = class {
7509
7508
  constructor(_agentManagerProvider, _edgeConnection) {
7510
7509
  this._agentManagerProvider = _agentManagerProvider;
7511
7510
  this._edgeConnection = _edgeConnection;
7512
7511
  }
7513
- // TODO(mykola): Reconcile with NetworkService.queryStatus.
7514
7512
  queryEdgeStatus() {
7515
7513
  return new Stream11(({ ctx, next }) => {
7516
- const update = () => {
7517
- next({
7518
- status: this._edgeConnection?.status ?? EdgeStatus2.NOT_CONNECTED
7519
- });
7520
- };
7521
- this._edgeConnection?.statusChanged.on(ctx, update);
7522
- update();
7514
+ next({
7515
+ status: QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
7516
+ });
7517
+ if (!this._edgeConnection) {
7518
+ return;
7519
+ }
7520
+ ctx.onDispose(
7521
+ // TODO(wittjosiah): EdgeConnection should include a disconnected event as well.
7522
+ this._edgeConnection.onReconnected(() => {
7523
+ next({
7524
+ status: QueryEdgeStatusResponse.EdgeStatus.CONNECTED
7525
+ });
7526
+ })
7527
+ );
7523
7528
  });
7524
7529
  }
7525
7530
  async createAgent() {
@@ -8511,7 +8516,7 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
8511
8516
  import { SubscriptionList as SubscriptionList3 } from "@dxos/async";
8512
8517
  import { Stream as Stream12 } from "@dxos/codec-protobuf/stream";
8513
8518
  import { invariant as invariant25 } from "@dxos/invariant";
8514
- import { Device as Device2, DeviceKind as DeviceKind2, EdgeStatus as EdgeStatus3 } from "@dxos/protocols/proto/dxos/client/services";
8519
+ import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
8515
8520
  var __dxlog_file30 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
8516
8521
  var DevicesServiceImpl = class {
8517
8522
  constructor(_identityManager, _edgeConnection) {
@@ -8532,7 +8537,7 @@ var DevicesServiceImpl = class {
8532
8537
  } else {
8533
8538
  invariant25(this._identityManager.identity?.presence, "presence not present", {
8534
8539
  F: __dxlog_file30,
8535
- L: 37,
8540
+ L: 36,
8536
8541
  S: this,
8537
8542
  A: [
8538
8543
  "this._identityManager.identity?.presence",
@@ -8547,7 +8552,7 @@ var DevicesServiceImpl = class {
8547
8552
  if (isMe) {
8548
8553
  presence = Device2.PresenceState.ONLINE;
8549
8554
  } else if (profile.os?.toUpperCase() === "EDGE") {
8550
- presence = this._edgeConnection?.status === EdgeStatus3.CONNECTED ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
8555
+ presence = this._edgeConnection?.isConnected ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
8551
8556
  } else {
8552
8557
  presence = peers.some((peer) => peer.identityKey.equals(key)) ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
8553
8558
  }
@@ -8807,13 +8812,12 @@ var LOG_PROCESSING = 0;
8807
8812
  // packages/sdk/client-services/src/packlets/network/network-service.ts
8808
8813
  import { Stream as Stream15 } from "@dxos/codec-protobuf/stream";
8809
8814
  var NetworkServiceImpl = class {
8810
- constructor(networkManager, signalManager, edgeConnection) {
8815
+ constructor(networkManager, signalManager) {
8811
8816
  this.networkManager = networkManager;
8812
8817
  this.signalManager = signalManager;
8813
- this.edgeConnection = edgeConnection;
8814
8818
  }
8815
8819
  queryStatus() {
8816
- return new Stream15(({ ctx, next }) => {
8820
+ return new Stream15(({ next }) => {
8817
8821
  const update = () => {
8818
8822
  next({
8819
8823
  swarm: this.networkManager.connectionState,
@@ -8824,9 +8828,13 @@ var NetworkServiceImpl = class {
8824
8828
  }))
8825
8829
  });
8826
8830
  };
8827
- this.networkManager.connectionStateChanged.on(ctx, () => update());
8828
- this.signalManager.statusChanged?.on(ctx, () => update());
8831
+ const unsubscribeSwarm = this.networkManager.connectionStateChanged.on(() => update());
8832
+ const unsubscribeSignal = this.signalManager.statusChanged?.on(() => update());
8829
8833
  update();
8834
+ return () => {
8835
+ unsubscribeSwarm();
8836
+ unsubscribeSignal?.();
8837
+ };
8830
8838
  });
8831
8839
  }
8832
8840
  async updateConfig(request) {
@@ -8842,24 +8850,26 @@ var NetworkServiceImpl = class {
8842
8850
  return this.signalManager.query(request);
8843
8851
  }
8844
8852
  subscribeSwarmState(request) {
8845
- return new Stream15(({ ctx, next }) => {
8846
- this.signalManager.swarmState?.on(ctx, (state) => {
8853
+ return new Stream15(({ next }) => {
8854
+ const unsubscribe = this.signalManager.swarmState?.on((state) => {
8847
8855
  if (request.topic.equals(state.swarmKey)) {
8848
8856
  next(state);
8849
8857
  }
8850
8858
  });
8859
+ return unsubscribe;
8851
8860
  });
8852
8861
  }
8853
8862
  async sendMessage(message) {
8854
8863
  return this.signalManager.sendMessage(message);
8855
8864
  }
8856
8865
  subscribeMessages(peer) {
8857
- return new Stream15(({ ctx, next }) => {
8858
- this.signalManager.onMessage.on(ctx, (message) => {
8866
+ return new Stream15(({ next }) => {
8867
+ const unsubscribe = this.signalManager.onMessage.on((message) => {
8859
8868
  if (message.recipient.peerKey === peer.peerKey) {
8860
8869
  next(message);
8861
8870
  }
8862
8871
  });
8872
+ return unsubscribe;
8863
8873
  });
8864
8874
  }
8865
8875
  };
@@ -9184,7 +9194,7 @@ var ClientServicesHost = class {
9184
9194
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
9185
9195
  DataService: this._serviceContext.echoHost.dataService,
9186
9196
  QueryService: this._serviceContext.echoHost.queryService,
9187
- NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager, this._edgeConnection),
9197
+ NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
9188
9198
  LoggingService: this._loggingService,
9189
9199
  TracingService: this._tracingService,
9190
9200
  // TODO(burdon): Move to new protobuf definitions.
@@ -9216,7 +9226,7 @@ var ClientServicesHost = class {
9216
9226
  deviceKey
9217
9227
  }, {
9218
9228
  F: __dxlog_file31,
9219
- L: 370,
9229
+ L: 366,
9220
9230
  S: this,
9221
9231
  C: (f, a) => f(...a)
9222
9232
  });
@@ -9224,7 +9234,7 @@ var ClientServicesHost = class {
9224
9234
  id: traceId
9225
9235
  }), {
9226
9236
  F: __dxlog_file31,
9227
- L: 371,
9237
+ L: 367,
9228
9238
  S: this,
9229
9239
  C: (f, a) => f(...a)
9230
9240
  });
@@ -9238,7 +9248,7 @@ var ClientServicesHost = class {
9238
9248
  deviceKey
9239
9249
  }, {
9240
9250
  F: __dxlog_file31,
9241
- L: 382,
9251
+ L: 378,
9242
9252
  S: this,
9243
9253
  C: (f, a) => f(...a)
9244
9254
  });
@@ -9256,7 +9266,7 @@ var ClientServicesHost = class {
9256
9266
  deviceKey
9257
9267
  }, {
9258
9268
  F: __dxlog_file31,
9259
- L: 391,
9269
+ L: 387,
9260
9270
  S: this,
9261
9271
  C: (f, a) => f(...a)
9262
9272
  });
@@ -9267,13 +9277,13 @@ var ClientServicesHost = class {
9267
9277
  id: traceId
9268
9278
  }), {
9269
9279
  F: __dxlog_file31,
9270
- L: 396,
9280
+ L: 392,
9271
9281
  S: this,
9272
9282
  C: (f, a) => f(...a)
9273
9283
  });
9274
9284
  log27.info("resetting...", void 0, {
9275
9285
  F: __dxlog_file31,
9276
- L: 398,
9286
+ L: 394,
9277
9287
  S: this,
9278
9288
  C: (f, a) => f(...a)
9279
9289
  });
@@ -9283,7 +9293,7 @@ var ClientServicesHost = class {
9283
9293
  await this._storage.reset();
9284
9294
  log27.info("reset", void 0, {
9285
9295
  F: __dxlog_file31,
9286
- L: 405,
9296
+ L: 401,
9287
9297
  S: this,
9288
9298
  C: (f, a) => f(...a)
9289
9299
  });
@@ -9291,7 +9301,7 @@ var ClientServicesHost = class {
9291
9301
  id: traceId
9292
9302
  }), {
9293
9303
  F: __dxlog_file31,
9294
- L: 406,
9304
+ L: 402,
9295
9305
  S: this,
9296
9306
  C: (f, a) => f(...a)
9297
9307
  });
@@ -9369,4 +9379,4 @@ export {
9369
9379
  importProfileData,
9370
9380
  ClientServicesHost
9371
9381
  };
9372
- //# sourceMappingURL=chunk-QLUXYSIC.mjs.map
9382
+ //# sourceMappingURL=chunk-DQCPFIVI.mjs.map