@dxos/client-services 0.6.14-main.f49f251 → 0.6.14-staging.54a8bab

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 (31) hide show
  1. package/dist/lib/browser/{chunk-Z3SSMM5X.mjs → chunk-GFOAZHIO.mjs} +43 -33
  2. package/dist/lib/browser/chunk-GFOAZHIO.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-ZORMUE2S.cjs → chunk-MDM5R5PA.cjs} +46 -36
  7. package/dist/lib/node/chunk-MDM5R5PA.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-4NBD4YSD.mjs → chunk-CH4BRI7M.mjs} +43 -33
  12. package/dist/lib/node-esm/chunk-CH4BRI7M.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/devices/devices-service.d.ts +3 -1
  17. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  18. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +1 -0
  19. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  20. package/dist/types/src/version.d.ts +1 -1
  21. package/dist/types/src/version.d.ts.map +1 -1
  22. package/package.json +38 -38
  23. package/src/packlets/devices/devices-service.ts +18 -7
  24. package/src/packlets/identity/identity.test.ts +16 -5
  25. package/src/packlets/services/service-host.ts +1 -1
  26. package/src/packlets/spaces/edge-feed-replicator.test.ts +12 -7
  27. package/src/packlets/spaces/edge-feed-replicator.ts +9 -5
  28. package/src/version.ts +1 -1
  29. package/dist/lib/browser/chunk-Z3SSMM5X.mjs.map +0 -7
  30. package/dist/lib/node/chunk-ZORMUE2S.cjs.map +0 -7
  31. package/dist/lib/node-esm/chunk-4NBD4YSD.mjs.map +0 -7
@@ -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.6.14-main.f49f251";
400
+ var DXOS_VERSION = "0.6.14-staging.54a8bab";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -909,7 +909,7 @@ var EdgeFeedReplicator = class extends Resource {
909
909
  S: this,
910
910
  C: (f, a) => f(...a)
911
911
  });
912
- this._ctx.onDispose(this._messenger.addListener((message) => {
912
+ this._ctx.onDispose(this._messenger.onMessage((message) => {
913
913
  if (!message.serviceId) {
914
914
  return;
915
915
  }
@@ -943,10 +943,12 @@ var EdgeFeedReplicator = class extends Resource {
943
943
  });
944
944
  this._onMessage(payload);
945
945
  }));
946
- this._messenger.connected.on(this._ctx, async () => {
947
- await this._resetConnection();
948
- this._startReplication();
949
- });
946
+ this._ctx.onDispose(this._messenger.onReconnected(() => {
947
+ scheduleMicroTask(this._ctx, () => this._handleReconnect());
948
+ }));
949
+ }
950
+ async _handleReconnect() {
951
+ await this._resetConnection();
950
952
  if (this._messenger.isConnected) {
951
953
  this._startReplication();
952
954
  }
@@ -954,7 +956,7 @@ var EdgeFeedReplicator = class extends Resource {
954
956
  async _close() {
955
957
  log4("close", void 0, {
956
958
  F: __dxlog_file6,
957
- L: 91,
959
+ L: 95,
958
960
  S: this,
959
961
  C: (f, a) => f(...a)
960
962
  });
@@ -966,7 +968,7 @@ var EdgeFeedReplicator = class extends Resource {
966
968
  this._connectionCtx = connectionCtx;
967
969
  log4("connection context created", void 0, {
968
970
  F: __dxlog_file6,
969
- L: 99,
971
+ L: 103,
970
972
  S: this,
971
973
  C: (f, a) => f(...a)
972
974
  });
@@ -979,7 +981,7 @@ var EdgeFeedReplicator = class extends Resource {
979
981
  async _resetConnection() {
980
982
  log4("resetConnection", void 0, {
981
983
  F: __dxlog_file6,
982
- L: 108,
984
+ L: 112,
983
985
  S: this,
984
986
  C: (f, a) => f(...a)
985
987
  });
@@ -995,7 +997,7 @@ var EdgeFeedReplicator = class extends Resource {
995
997
  hasConnectionCtx: !!this._connectionCtx
996
998
  }, {
997
999
  F: __dxlog_file6,
998
- L: 116,
1000
+ L: 120,
999
1001
  S: this,
1000
1002
  C: (f, a) => f(...a)
1001
1003
  });
@@ -1012,7 +1014,7 @@ var EdgeFeedReplicator = class extends Resource {
1012
1014
  key: feed.key
1013
1015
  }, {
1014
1016
  F: __dxlog_file6,
1015
- L: 129,
1017
+ L: 133,
1016
1018
  S: this,
1017
1019
  C: (f, a) => f(...a)
1018
1020
  });
@@ -1028,7 +1030,7 @@ var EdgeFeedReplicator = class extends Resource {
1028
1030
  if (!this._connectionCtx) {
1029
1031
  log4.info("message dropped because connection was disposed", void 0, {
1030
1032
  F: __dxlog_file6,
1031
- L: 142,
1033
+ L: 146,
1032
1034
  S: this,
1033
1035
  C: (f, a) => f(...a)
1034
1036
  });
@@ -1042,13 +1044,13 @@ var EdgeFeedReplicator = class extends Resource {
1042
1044
  };
1043
1045
  log4.info("sending message", logPayload, {
1044
1046
  F: __dxlog_file6,
1045
- L: 148,
1047
+ L: 152,
1046
1048
  S: this,
1047
1049
  C: (f, a) => f(...a)
1048
1050
  });
1049
1051
  invariant2(message.feedKey, void 0, {
1050
1052
  F: __dxlog_file6,
1051
- L: 150,
1053
+ L: 154,
1052
1054
  S: this,
1053
1055
  A: [
1054
1056
  "message.feedKey",
@@ -1060,7 +1062,7 @@ var EdgeFeedReplicator = class extends Resource {
1060
1062
  type: message.type
1061
1063
  }, {
1062
1064
  F: __dxlog_file6,
1063
- L: 153,
1065
+ L: 157,
1064
1066
  S: this,
1065
1067
  C: (f, a) => f(...a)
1066
1068
  });
@@ -1079,7 +1081,7 @@ var EdgeFeedReplicator = class extends Resource {
1079
1081
  if (!this._connectionCtx) {
1080
1082
  log4.warn("received message after connection context was disposed", void 0, {
1081
1083
  F: __dxlog_file6,
1082
- L: 168,
1084
+ L: 172,
1083
1085
  S: this,
1084
1086
  C: (f, a) => f(...a)
1085
1087
  });
@@ -1094,7 +1096,7 @@ var EdgeFeedReplicator = class extends Resource {
1094
1096
  message
1095
1097
  }, {
1096
1098
  F: __dxlog_file6,
1097
- L: 174,
1099
+ L: 178,
1098
1100
  S: this,
1099
1101
  C: (f, a) => f(...a)
1100
1102
  });
@@ -1105,7 +1107,7 @@ var EdgeFeedReplicator = class extends Resource {
1105
1107
  feedKey
1106
1108
  }, {
1107
1109
  F: __dxlog_file6,
1108
- L: 179,
1110
+ L: 183,
1109
1111
  S: this,
1110
1112
  C: (f, a) => f(...a)
1111
1113
  });
@@ -1138,7 +1140,7 @@ var EdgeFeedReplicator = class extends Resource {
1138
1140
  blocks: message.blocks.map((b) => b.index)
1139
1141
  }, {
1140
1142
  F: __dxlog_file6,
1141
- L: 201,
1143
+ L: 205,
1142
1144
  S: this,
1143
1145
  C: (f, a) => f(...a)
1144
1146
  });
@@ -1149,7 +1151,7 @@ var EdgeFeedReplicator = class extends Resource {
1149
1151
  feedKey
1150
1152
  }, {
1151
1153
  F: __dxlog_file6,
1152
- L: 206,
1154
+ L: 210,
1153
1155
  S: this,
1154
1156
  C: (f, a) => f(...a)
1155
1157
  });
@@ -1163,7 +1165,7 @@ var EdgeFeedReplicator = class extends Resource {
1163
1165
  ...message
1164
1166
  }, {
1165
1167
  F: __dxlog_file6,
1166
- L: 215,
1168
+ L: 219,
1167
1169
  S: this,
1168
1170
  C: (f, a) => f(...a)
1169
1171
  });
@@ -1178,7 +1180,7 @@ var EdgeFeedReplicator = class extends Resource {
1178
1180
  to
1179
1181
  }, {
1180
1182
  F: __dxlog_file6,
1181
- L: 222,
1183
+ L: 226,
1182
1184
  S: this,
1183
1185
  C: (f, a) => f(...a)
1184
1186
  });
@@ -1188,7 +1190,7 @@ var EdgeFeedReplicator = class extends Resource {
1188
1190
  });
1189
1191
  invariant2(data instanceof Uint8Array, void 0, {
1190
1192
  F: __dxlog_file6,
1191
- L: 227,
1193
+ L: 231,
1192
1194
  S: this,
1193
1195
  A: [
1194
1196
  "data instanceof Uint8Array",
@@ -1216,7 +1218,7 @@ var EdgeFeedReplicator = class extends Resource {
1216
1218
  blocks: blocks.length
1217
1219
  }, {
1218
1220
  F: __dxlog_file6,
1219
- L: 248,
1221
+ L: 252,
1220
1222
  S: this,
1221
1223
  C: (f, a) => f(...a)
1222
1224
  });
@@ -1238,7 +1240,7 @@ var EdgeFeedReplicator = class extends Resource {
1238
1240
  if (!this._remoteLength.has(feed.key)) {
1239
1241
  log4("blocks not pushed because remote length is unknown", void 0, {
1240
1242
  F: __dxlog_file6,
1241
- L: 269,
1243
+ L: 273,
1242
1244
  S: this,
1243
1245
  C: (f, a) => f(...a)
1244
1246
  });
@@ -1263,7 +1265,7 @@ var EdgeFeedReplicator = class extends Resource {
1263
1265
  if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
1264
1266
  log4("resetting on reconnect", void 0, {
1265
1267
  F: __dxlog_file6,
1266
- L: 286,
1268
+ L: 290,
1267
1269
  S: this,
1268
1270
  C: (f, a) => f(...a)
1269
1271
  });
@@ -1274,7 +1276,7 @@ var EdgeFeedReplicator = class extends Resource {
1274
1276
  }
1275
1277
  }, {
1276
1278
  F: __dxlog_file6,
1277
- L: 280
1279
+ L: 284
1278
1280
  });
1279
1281
  return connectionCtx;
1280
1282
  }
@@ -8276,8 +8278,9 @@ import { invariant as invariant22 } from "@dxos/invariant";
8276
8278
  import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
8277
8279
  var __dxlog_file30 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
8278
8280
  var DevicesServiceImpl = class {
8279
- constructor(_identityManager) {
8281
+ constructor(_identityManager, _edgeConnection) {
8280
8282
  this._identityManager = _identityManager;
8283
+ this._edgeConnection = _edgeConnection;
8281
8284
  }
8282
8285
  async updateDevice(profile) {
8283
8286
  return this._identityManager.updateDeviceProfile(profile);
@@ -8293,7 +8296,7 @@ var DevicesServiceImpl = class {
8293
8296
  } else {
8294
8297
  invariant22(this._identityManager.identity?.presence, "presence not present", {
8295
8298
  F: __dxlog_file30,
8296
- L: 32,
8299
+ L: 36,
8297
8300
  S: this,
8298
8301
  A: [
8299
8302
  "this._identityManager.identity?.presence",
@@ -8304,12 +8307,19 @@ var DevicesServiceImpl = class {
8304
8307
  next({
8305
8308
  devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
8306
8309
  const isMe = this._identityManager.identity?.deviceKey.equals(key);
8307
- const peerState = peers.find((peer) => peer.identityKey.equals(key));
8310
+ let presence;
8311
+ if (isMe) {
8312
+ presence = Device2.PresenceState.ONLINE;
8313
+ } else if (profile.os?.toUpperCase() === "EDGE") {
8314
+ presence = this._edgeConnection?.isConnected ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
8315
+ } else {
8316
+ presence = peers.some((peer) => peer.identityKey.equals(key)) ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
8317
+ }
8308
8318
  return {
8309
8319
  deviceKey: key,
8310
8320
  kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind2.CURRENT : DeviceKind2.TRUSTED,
8311
8321
  profile,
8312
- presence: isMe ? Device2.PresenceState.ONLINE : peerState ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE
8322
+ presence
8313
8323
  };
8314
8324
  })
8315
8325
  });
@@ -8907,7 +8917,7 @@ var ClientServicesHost = class {
8907
8917
  IdentityService: identityService,
8908
8918
  ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
8909
8919
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
8910
- DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
8920
+ DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager, this._edgeConnection),
8911
8921
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
8912
8922
  DataService: this._serviceContext.echoHost.dataService,
8913
8923
  QueryService: this._serviceContext.echoHost.queryService,
@@ -9096,4 +9106,4 @@ export {
9096
9106
  importProfileData,
9097
9107
  ClientServicesHost
9098
9108
  };
9099
- //# sourceMappingURL=chunk-Z3SSMM5X.mjs.map
9109
+ //# sourceMappingURL=chunk-GFOAZHIO.mjs.map