@dxos/client-services 0.4.10-main.d2a7fe7 → 0.4.10-main.d3d33d7

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 (45) hide show
  1. package/dist/lib/browser/{chunk-5YFNO6CM.mjs → chunk-F647VGTE.mjs} +109 -71
  2. package/dist/lib/browser/{chunk-5YFNO6CM.mjs.map → chunk-F647VGTE.mjs.map} +4 -4
  3. package/dist/lib/browser/index.mjs +3 -1
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +6 -4
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-3CGMNOA3.cjs → chunk-LYFRWNBG.cjs} +101 -68
  9. package/dist/lib/node/chunk-LYFRWNBG.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +39 -37
  11. package/dist/lib/node/index.cjs.map +1 -1
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +10 -8
  14. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  15. package/dist/types/src/packlets/services/service-context.d.ts +7 -5
  16. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  17. package/dist/types/src/packlets/services/service-host.d.ts +1 -0
  18. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  19. package/dist/types/src/packlets/storage/index.d.ts +1 -0
  20. package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
  21. package/dist/types/src/packlets/storage/level.d.ts +4 -0
  22. package/dist/types/src/packlets/storage/level.d.ts.map +1 -0
  23. package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
  24. package/dist/types/src/packlets/storage/util.d.ts +4 -0
  25. package/dist/types/src/packlets/storage/util.d.ts.map +1 -0
  26. package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
  27. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  28. package/dist/types/src/version.d.ts +1 -1
  29. package/package.json +35 -34
  30. package/src/packlets/devices/devices-service.test.ts +1 -1
  31. package/src/packlets/identity/identity-service.test.ts +1 -1
  32. package/src/packlets/invitations/device-invitation-protocol.test.ts +1 -1
  33. package/src/packlets/network/network-service.test.ts +1 -1
  34. package/src/packlets/services/service-context.test.ts +5 -5
  35. package/src/packlets/services/service-context.ts +10 -5
  36. package/src/packlets/services/service-host.ts +29 -12
  37. package/src/packlets/services/service-registry.test.ts +1 -1
  38. package/src/packlets/spaces/spaces-service.test.ts +1 -1
  39. package/src/packlets/storage/index.ts +1 -0
  40. package/src/packlets/storage/level.ts +19 -0
  41. package/src/packlets/storage/storage.ts +3 -9
  42. package/src/packlets/storage/util.ts +19 -0
  43. package/src/packlets/testing/test-builder.ts +5 -3
  44. package/src/version.ts +1 -1
  45. package/dist/lib/node/chunk-3CGMNOA3.cjs.map +0 -7
@@ -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_3CGMNOA3_exports = {};
30
- __export(chunk_3CGMNOA3_exports, {
29
+ var chunk_LYFRWNBG_exports = {};
30
+ __export(chunk_LYFRWNBG_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -48,6 +48,7 @@ __export(chunk_3CGMNOA3_exports, {
48
48
  TrustedKeySetAuthVerifier: () => TrustedKeySetAuthVerifier,
49
49
  createAuthProvider: () => createAuthProvider,
50
50
  createDiagnostics: () => createDiagnostics,
51
+ createLevel: () => createLevel,
51
52
  createStorageObjects: () => createStorageObjects,
52
53
  getNetworkPeers: () => getNetworkPeers,
53
54
  invitationExpired: () => invitationExpired,
@@ -60,7 +61,7 @@ __export(chunk_3CGMNOA3_exports, {
60
61
  subscribeToSpaces: () => subscribeToSpaces,
61
62
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
63
  });
63
- module.exports = __toCommonJS(chunk_3CGMNOA3_exports);
64
+ module.exports = __toCommonJS(chunk_LYFRWNBG_exports);
64
65
  var import_async = require("@dxos/async");
65
66
  var import_codec_protobuf = require("@dxos/codec-protobuf");
66
67
  var import_feed_store = require("@dxos/feed-store");
@@ -223,20 +224,23 @@ var import_protocols13 = require("@dxos/protocols");
223
224
  var import_invariant15 = require("@dxos/invariant");
224
225
  var import_lock_file = require("@dxos/lock-file");
225
226
  var import_log13 = require("@dxos/log");
226
- var import_client_protocol4 = require("@dxos/client-protocol");
227
227
  var import_protocols14 = require("@dxos/protocols");
228
228
  var import_config = require("@dxos/protocols/proto/dxos/config");
229
229
  var import_random_access_storage = require("@dxos/random-access-storage");
230
+ var import_client_protocol4 = require("@dxos/client-protocol");
231
+ var import_config2 = require("@dxos/protocols/proto/dxos/config");
230
232
  var import_util8 = require("@dxos/util");
233
+ var import_level = require("level");
234
+ var import_node_path = __toESM(require("node:path"));
235
+ var import_keys11 = require("@dxos/keys");
231
236
  var import_async16 = require("@dxos/async");
232
237
  var import_client_protocol5 = require("@dxos/client-protocol");
233
238
  var import_context11 = require("@dxos/context");
234
239
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
235
240
  var E = __toESM(require("@dxos/echo-schema"));
236
- var import_echo_schema = require("@dxos/echo-schema");
237
241
  var import_indexing2 = require("@dxos/indexing");
238
242
  var import_invariant16 = require("@dxos/invariant");
239
- var import_keys11 = require("@dxos/keys");
243
+ var import_keys12 = require("@dxos/keys");
240
244
  var import_log14 = require("@dxos/log");
241
245
  var import_messaging = require("@dxos/messaging");
242
246
  var import_network_manager2 = require("@dxos/network-manager");
@@ -251,7 +255,7 @@ var import_invariant17 = require("@dxos/invariant");
251
255
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
252
256
  var import_async18 = require("@dxos/async");
253
257
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
254
- var import_keys12 = require("@dxos/keys");
258
+ var import_keys13 = require("@dxos/keys");
255
259
  var import_log15 = require("@dxos/log");
256
260
  var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
257
261
  var import_util10 = require("@dxos/util");
@@ -2887,7 +2891,7 @@ var getPlatform = () => {
2887
2891
  };
2888
2892
  }
2889
2893
  };
2890
- var DXOS_VERSION = "0.4.10-main.d2a7fe7";
2894
+ var DXOS_VERSION = "0.4.10-main.d3d33d7";
2891
2895
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2892
2896
  var DEFAULT_TIMEOUT = 1e3;
2893
2897
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -4517,9 +4521,11 @@ function _ts_decorate6(decorators, target, key, desc) {
4517
4521
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4518
4522
  }
4519
4523
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4520
- var ServiceContext = class {
4521
- constructor(storage, networkManager, signalManager, _runtimeParams) {
4524
+ var ServiceContext = class extends import_context10.Resource {
4525
+ constructor(storage, level, networkManager, signalManager, _runtimeParams) {
4526
+ super();
4522
4527
  this.storage = storage;
4528
+ this.level = level;
4523
4529
  this.networkManager = networkManager;
4524
4530
  this.signalManager = signalManager;
4525
4531
  this._runtimeParams = _runtimeParams;
@@ -4549,7 +4555,7 @@ var ServiceContext = class {
4549
4555
  });
4550
4556
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
4551
4557
  this.indexMetadata = new import_indexing.IndexMetadataStore({
4552
- directory: storage.createDirectory("index-metadata")
4558
+ db: level.sublevel("index-metadata")
4553
4559
  });
4554
4560
  this.automergeHost = new import_echo_pipeline3.AutomergeHost({
4555
4561
  directory: storage.createDirectory("automerge"),
@@ -4566,11 +4572,11 @@ var ServiceContext = class {
4566
4572
  this.invitations = new InvitationsHandler(this.networkManager);
4567
4573
  this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
4568
4574
  }
4569
- async open(ctx) {
4575
+ async _open(ctx) {
4570
4576
  await this._checkStorageVersion();
4571
4577
  (0, import_log12.log)("opening...", void 0, {
4572
4578
  F: __dxlog_file15,
4573
- L: 151,
4579
+ L: 156,
4574
4580
  S: this,
4575
4581
  C: (f, a) => f(...a)
4576
4582
  });
@@ -4578,7 +4584,7 @@ var ServiceContext = class {
4578
4584
  id: this._instanceId
4579
4585
  }), {
4580
4586
  F: __dxlog_file15,
4581
- L: 152,
4587
+ L: 157,
4582
4588
  S: this,
4583
4589
  C: (f, a) => f(...a)
4584
4590
  });
@@ -4594,21 +4600,21 @@ var ServiceContext = class {
4594
4600
  id: this._instanceId
4595
4601
  }), {
4596
4602
  F: __dxlog_file15,
4597
- L: 162,
4603
+ L: 167,
4598
4604
  S: this,
4599
4605
  C: (f, a) => f(...a)
4600
4606
  });
4601
4607
  (0, import_log12.log)("opened", void 0, {
4602
4608
  F: __dxlog_file15,
4603
- L: 163,
4609
+ L: 168,
4604
4610
  S: this,
4605
4611
  C: (f, a) => f(...a)
4606
4612
  });
4607
4613
  }
4608
- async close() {
4614
+ async _close() {
4609
4615
  (0, import_log12.log)("closing...", void 0, {
4610
4616
  F: __dxlog_file15,
4611
- L: 167,
4617
+ L: 172,
4612
4618
  S: this,
4613
4619
  C: (f, a) => f(...a)
4614
4620
  });
@@ -4626,7 +4632,7 @@ var ServiceContext = class {
4626
4632
  await this.indexer.destroy();
4627
4633
  (0, import_log12.log)("closed", void 0, {
4628
4634
  F: __dxlog_file15,
4629
- L: 180,
4635
+ L: 185,
4630
4636
  S: this,
4631
4637
  C: (f, a) => f(...a)
4632
4638
  });
@@ -4640,7 +4646,7 @@ var ServiceContext = class {
4640
4646
  const factory = this._handlerFactories.get(invitation.kind);
4641
4647
  (0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4642
4648
  F: __dxlog_file15,
4643
- L: 191,
4649
+ L: 196,
4644
4650
  S: this,
4645
4651
  A: [
4646
4652
  "factory",
@@ -4672,7 +4678,7 @@ var ServiceContext = class {
4672
4678
  async _initialize(ctx) {
4673
4679
  (0, import_log12.log)("initializing spaces...", void 0, {
4674
4680
  F: __dxlog_file15,
4675
- L: 222,
4681
+ L: 227,
4676
4682
  S: this,
4677
4683
  C: (f, a) => f(...a)
4678
4684
  });
@@ -4695,7 +4701,7 @@ var ServiceContext = class {
4695
4701
  this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
4696
4702
  (0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4697
4703
  F: __dxlog_file15,
4698
- L: 246,
4704
+ L: 251,
4699
4705
  S: this,
4700
4706
  A: [
4701
4707
  "this.dataSpaceManager",
@@ -4719,7 +4725,7 @@ var ServiceContext = class {
4719
4725
  details: assertion
4720
4726
  }, {
4721
4727
  F: __dxlog_file15,
4722
- L: 262,
4728
+ L: 267,
4723
4729
  S: this,
4724
4730
  C: (f, a) => f(...a)
4725
4731
  });
@@ -4730,7 +4736,7 @@ var ServiceContext = class {
4730
4736
  details: assertion
4731
4737
  }, {
4732
4738
  F: __dxlog_file15,
4733
- L: 266,
4739
+ L: 271,
4734
4740
  S: this,
4735
4741
  C: (f, a) => f(...a)
4736
4742
  });
@@ -4741,7 +4747,7 @@ var ServiceContext = class {
4741
4747
  details: assertion
4742
4748
  }, {
4743
4749
  F: __dxlog_file15,
4744
- L: 271,
4750
+ L: 276,
4745
4751
  S: this,
4746
4752
  C: (f, a) => f(...a)
4747
4753
  });
@@ -4752,7 +4758,7 @@ var ServiceContext = class {
4752
4758
  } catch (err) {
4753
4759
  import_log12.log.catch(err, void 0, {
4754
4760
  F: __dxlog_file15,
4755
- L: 277,
4761
+ L: 282,
4756
4762
  S: this,
4757
4763
  C: (f, a) => f(...a)
4758
4764
  });
@@ -4764,7 +4770,7 @@ var ServiceContext = class {
4764
4770
  };
4765
4771
  _ts_decorate6([
4766
4772
  import_tracing6.trace.span()
4767
- ], ServiceContext.prototype, "open", null);
4773
+ ], ServiceContext.prototype, "_open", null);
4768
4774
  _ts_decorate6([
4769
4775
  import_tracing6.trace.span()
4770
4776
  ], ServiceContext.prototype, "_initialize", null);
@@ -4848,9 +4854,17 @@ _ts_decorate7([
4848
4854
  import_log13.logInfo
4849
4855
  ], Lock.prototype, "lockKey", null);
4850
4856
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
4857
+ var getRootPath = (config) => {
4858
+ const { dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
4859
+ return `${dataRoot}/`;
4860
+ };
4861
+ var isPersistent = (config) => {
4862
+ const { persistent = false } = config ?? {};
4863
+ return config.dataStore !== void 0 && config.dataStore !== import_config2.Runtime.Client.Storage.StorageDriver.RAM || persistent;
4864
+ };
4851
4865
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4852
4866
  var createStorageObjects = (config) => {
4853
- const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
4867
+ const { persistent = false, keyStore, dataStore } = config ?? {};
4854
4868
  if (persistent && dataStore === StorageDriver.RAM) {
4855
4869
  throw new import_protocols14.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4856
4870
  }
@@ -4866,7 +4880,7 @@ var createStorageObjects = (config) => {
4866
4880
  return {
4867
4881
  storage: (0, import_random_access_storage.createStorage)({
4868
4882
  type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
4869
- root: `${dataRoot}/`
4883
+ root: getRootPath(config)
4870
4884
  })
4871
4885
  };
4872
4886
  };
@@ -4890,6 +4904,13 @@ var toStorageType = (type) => {
4890
4904
  throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
4891
4905
  }
4892
4906
  };
4907
+ var createLevel = async (config) => {
4908
+ const persistent = isPersistent(config);
4909
+ const storagePath = persistent ? getRootPath(config) : import_node_path.default.join("tmp", "level", import_keys11.PublicKey.random().toHex());
4910
+ const level = new import_level.Level(storagePath);
4911
+ await level.open();
4912
+ return level;
4913
+ };
4893
4914
  var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
4894
4915
  var DevicesServiceImpl = class {
4895
4916
  constructor(_identityManager) {
@@ -4970,7 +4991,7 @@ var LoggingServiceImpl = class {
4970
4991
  constructor() {
4971
4992
  this._logs = new import_async18.Event();
4972
4993
  this._started = Date.now();
4973
- this._sessionId = import_keys12.PublicKey.random().toHex();
4994
+ this._sessionId = import_keys13.PublicKey.random().toHex();
4974
4995
  this._logProcessor = (_config, entry2) => {
4975
4996
  this._logs.emit(entry2);
4976
4997
  };
@@ -5065,12 +5086,12 @@ var LoggingServiceImpl = class {
5065
5086
  });
5066
5087
  }
5067
5088
  };
5068
- var matchFilter = (filter, level, path, options) => {
5089
+ var matchFilter = (filter, level, path2, options) => {
5069
5090
  switch (options) {
5070
5091
  case import_services15.QueryLogsRequest.MatchingOptions.INCLUSIVE:
5071
- return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
5092
+ return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
5072
5093
  case import_services15.QueryLogsRequest.MatchingOptions.EXPLICIT:
5073
- return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
5094
+ return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
5074
5095
  }
5075
5096
  };
5076
5097
  var shouldLog = (entry2, request) => {
@@ -5261,7 +5282,7 @@ var ClientServicesHost = class {
5261
5282
  initialize({ config, ...options }) {
5262
5283
  (0, import_invariant16.invariant)(!this._open, "service host is open", {
5263
5284
  F: __dxlog_file18,
5264
- L: 180,
5285
+ L: 182,
5265
5286
  S: this,
5266
5287
  A: [
5267
5288
  "!this._open",
@@ -5270,14 +5291,14 @@ var ClientServicesHost = class {
5270
5291
  });
5271
5292
  (0, import_log14.log)("initializing...", void 0, {
5272
5293
  F: __dxlog_file18,
5273
- L: 181,
5294
+ L: 183,
5274
5295
  S: this,
5275
5296
  C: (f, a) => f(...a)
5276
5297
  });
5277
5298
  if (config) {
5278
5299
  (0, import_invariant16.invariant)(!this._config, "config already set", {
5279
5300
  F: __dxlog_file18,
5280
- L: 184,
5301
+ L: 186,
5281
5302
  S: this,
5282
5303
  A: [
5283
5304
  "!this._config",
@@ -5292,7 +5313,7 @@ var ClientServicesHost = class {
5292
5313
  if (!options.signalManager) {
5293
5314
  import_log14.log.warn("running signaling without telemetry metadata.", void 0, {
5294
5315
  F: __dxlog_file18,
5295
- L: 192,
5316
+ L: 194,
5296
5317
  S: this,
5297
5318
  C: (f, a) => f(...a)
5298
5319
  });
@@ -5303,7 +5324,7 @@ var ClientServicesHost = class {
5303
5324
  this._signalManager = signalManager;
5304
5325
  (0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
5305
5326
  F: __dxlog_file18,
5306
- L: 203,
5327
+ L: 205,
5307
5328
  S: this,
5308
5329
  A: [
5309
5330
  "!this._networkManager",
@@ -5317,7 +5338,7 @@ var ClientServicesHost = class {
5317
5338
  });
5318
5339
  (0, import_log14.log)("initialized", void 0, {
5319
5340
  F: __dxlog_file18,
5320
- L: 210,
5341
+ L: 212,
5321
5342
  S: this,
5322
5343
  C: (f, a) => f(...a)
5323
5344
  });
@@ -5326,18 +5347,18 @@ var ClientServicesHost = class {
5326
5347
  if (this._open) {
5327
5348
  return;
5328
5349
  }
5329
- const traceId = import_keys11.PublicKey.random().toHex();
5350
+ const traceId = import_keys12.PublicKey.random().toHex();
5330
5351
  import_log14.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
5331
5352
  id: traceId
5332
5353
  }), {
5333
5354
  F: __dxlog_file18,
5334
- L: 221,
5355
+ L: 223,
5335
5356
  S: this,
5336
5357
  C: (f, a) => f(...a)
5337
5358
  });
5338
5359
  (0, import_invariant16.invariant)(this._config, "config not set", {
5339
5360
  F: __dxlog_file18,
5340
- L: 223,
5361
+ L: 225,
5341
5362
  S: this,
5342
5363
  A: [
5343
5364
  "this._config",
@@ -5346,7 +5367,7 @@ var ClientServicesHost = class {
5346
5367
  });
5347
5368
  (0, import_invariant16.invariant)(this._storage, "storage not set", {
5348
5369
  F: __dxlog_file18,
5349
- L: 224,
5370
+ L: 226,
5350
5371
  S: this,
5351
5372
  A: [
5352
5373
  "this._storage",
@@ -5355,7 +5376,7 @@ var ClientServicesHost = class {
5355
5376
  });
5356
5377
  (0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
5357
5378
  F: __dxlog_file18,
5358
- L: 225,
5379
+ L: 227,
5359
5380
  S: this,
5360
5381
  A: [
5361
5382
  "this._signalManager",
@@ -5364,7 +5385,7 @@ var ClientServicesHost = class {
5364
5385
  });
5365
5386
  (0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
5366
5387
  F: __dxlog_file18,
5367
- L: 226,
5388
+ L: 228,
5368
5389
  S: this,
5369
5390
  A: [
5370
5391
  "this._networkManager",
@@ -5376,13 +5397,16 @@ var ClientServicesHost = class {
5376
5397
  lockKey: this._resourceLock?.lockKey
5377
5398
  }, {
5378
5399
  F: __dxlog_file18,
5379
- L: 229,
5400
+ L: 231,
5380
5401
  S: this,
5381
5402
  C: (f, a) => f(...a)
5382
5403
  });
5404
+ if (!this._level) {
5405
+ this._level = await createLevel(this._config.get("runtime.client.storage", {}));
5406
+ }
5383
5407
  await this._resourceLock?.acquire();
5384
5408
  await this._loggingService.open();
5385
- this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._runtimeParams);
5409
+ this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
5386
5410
  this._serviceRegistry.setServices({
5387
5411
  SystemService: this._systemService,
5388
5412
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
@@ -5410,7 +5434,7 @@ var ClientServicesHost = class {
5410
5434
  await this._serviceContext.open(ctx);
5411
5435
  (0, import_invariant16.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
5412
5436
  F: __dxlog_file18,
5413
- L: 290,
5437
+ L: 297,
5414
5438
  S: this,
5415
5439
  A: [
5416
5440
  "this.serviceRegistry.services.InvitationsService",
@@ -5422,7 +5446,7 @@ var ClientServicesHost = class {
5422
5446
  count: loadedInvitations.invitations?.length
5423
5447
  }, {
5424
5448
  F: __dxlog_file18,
5425
- L: 293,
5449
+ L: 300,
5426
5450
  S: this,
5427
5451
  C: (f, a) => f(...a)
5428
5452
  });
@@ -5444,7 +5468,7 @@ var ClientServicesHost = class {
5444
5468
  deviceKey
5445
5469
  }, {
5446
5470
  F: __dxlog_file18,
5447
- L: 310,
5471
+ L: 317,
5448
5472
  S: this,
5449
5473
  C: (f, a) => f(...a)
5450
5474
  });
@@ -5452,7 +5476,7 @@ var ClientServicesHost = class {
5452
5476
  id: traceId
5453
5477
  }), {
5454
5478
  F: __dxlog_file18,
5455
- L: 311,
5479
+ L: 318,
5456
5480
  S: this,
5457
5481
  C: (f, a) => f(...a)
5458
5482
  });
@@ -5466,7 +5490,7 @@ var ClientServicesHost = class {
5466
5490
  deviceKey
5467
5491
  }, {
5468
5492
  F: __dxlog_file18,
5469
- L: 322,
5493
+ L: 329,
5470
5494
  S: this,
5471
5495
  C: (f, a) => f(...a)
5472
5496
  });
@@ -5476,30 +5500,31 @@ var ClientServicesHost = class {
5476
5500
  });
5477
5501
  await this._loggingService.close();
5478
5502
  await this._serviceContext.close();
5503
+ await this._level?.close();
5479
5504
  this._open = false;
5480
5505
  this._statusUpdate.emit();
5481
5506
  (0, import_log14.log)("closed", {
5482
5507
  deviceKey
5483
5508
  }, {
5484
5509
  F: __dxlog_file18,
5485
- L: 329,
5510
+ L: 337,
5486
5511
  S: this,
5487
5512
  C: (f, a) => f(...a)
5488
5513
  });
5489
5514
  }
5490
5515
  async reset() {
5491
- const traceId = import_keys11.PublicKey.random().toHex();
5516
+ const traceId = import_keys12.PublicKey.random().toHex();
5492
5517
  import_log14.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
5493
5518
  id: traceId
5494
5519
  }), {
5495
5520
  F: __dxlog_file18,
5496
- L: 334,
5521
+ L: 342,
5497
5522
  S: this,
5498
5523
  C: (f, a) => f(...a)
5499
5524
  });
5500
5525
  (0, import_log14.log)("resetting...", void 0, {
5501
5526
  F: __dxlog_file18,
5502
- L: 336,
5527
+ L: 344,
5503
5528
  S: this,
5504
5529
  C: (f, a) => f(...a)
5505
5530
  });
@@ -5507,7 +5532,7 @@ var ClientServicesHost = class {
5507
5532
  await this._storage.reset();
5508
5533
  (0, import_log14.log)("reset", void 0, {
5509
5534
  F: __dxlog_file18,
5510
- L: 339,
5535
+ L: 347,
5511
5536
  S: this,
5512
5537
  C: (f, a) => f(...a)
5513
5538
  });
@@ -5515,7 +5540,7 @@ var ClientServicesHost = class {
5515
5540
  id: traceId
5516
5541
  }), {
5517
5542
  F: __dxlog_file18,
5518
- L: 340,
5543
+ L: 348,
5519
5544
  S: this,
5520
5545
  C: (f, a) => f(...a)
5521
5546
  });
@@ -5528,7 +5553,7 @@ var ClientServicesHost = class {
5528
5553
  const automergeIndex = space.automergeSpaceState.rootUrl;
5529
5554
  (0, import_invariant16.invariant)(automergeIndex, void 0, {
5530
5555
  F: __dxlog_file18,
5531
- L: 352,
5556
+ L: 360,
5532
5557
  S: this,
5533
5558
  A: [
5534
5559
  "automergeIndex",
@@ -5537,18 +5562,25 @@ var ClientServicesHost = class {
5537
5562
  });
5538
5563
  const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5539
5564
  await document.whenReady();
5540
- const objectDocument = (0, import_echo_schema.createRawObjectDoc)({
5541
- [import_client_protocol5.defaultKey]: identity.identityKey.toHex()
5542
- }, {
5543
- type: E.getTypeReference(import_client_protocol5.PropertiesSchema)
5544
- });
5565
+ const properties = {
5566
+ system: {
5567
+ type: (0, import_echo_pipeline4.encodeReference)(E.getTypeReference(import_client_protocol5.Properties))
5568
+ },
5569
+ data: {
5570
+ [import_client_protocol5.defaultKey]: identity.identityKey.toHex()
5571
+ },
5572
+ meta: {
5573
+ keys: []
5574
+ }
5575
+ };
5576
+ const propertiesId = import_keys12.PublicKey.random().toHex();
5545
5577
  document.change((doc) => {
5546
5578
  (0, import_util9.assignDeep)(doc, [
5547
5579
  "objects",
5548
- objectDocument.id
5549
- ], objectDocument.handle.docSync());
5580
+ propertiesId
5581
+ ], properties);
5550
5582
  });
5551
- await (0, import_async16.sleep)(200);
5583
+ await this._serviceContext.automergeHost.repo.flush();
5552
5584
  return identity;
5553
5585
  }
5554
5586
  };
@@ -5591,6 +5623,7 @@ ClientServicesHost = _ts_decorate8([
5591
5623
  TrustedKeySetAuthVerifier,
5592
5624
  createAuthProvider,
5593
5625
  createDiagnostics,
5626
+ createLevel,
5594
5627
  createStorageObjects,
5595
5628
  getNetworkPeers,
5596
5629
  invitationExpired,
@@ -5603,4 +5636,4 @@ ClientServicesHost = _ts_decorate8([
5603
5636
  subscribeToSpaces,
5604
5637
  subscribeToSwarmInfo
5605
5638
  });
5606
- //# sourceMappingURL=chunk-3CGMNOA3.cjs.map
5639
+ //# sourceMappingURL=chunk-LYFRWNBG.cjs.map