@dxos/client-services 0.4.10-main.f68a1ca → 0.4.10-main.fd4f2a3

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 (46) hide show
  1. package/dist/lib/browser/{chunk-B4JZEXRB.mjs → chunk-V2ALN47T.mjs} +111 -73
  2. package/dist/lib/browser/{chunk-B4JZEXRB.mjs.map → chunk-V2ALN47T.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-EC2QGJ2V.cjs → chunk-7WXQVUAE.cjs} +103 -70
  9. package/dist/lib/node/chunk-7WXQVUAE.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/indexing/util.ts +1 -1
  33. package/src/packlets/invitations/device-invitation-protocol.test.ts +1 -1
  34. package/src/packlets/network/network-service.test.ts +1 -1
  35. package/src/packlets/services/service-context.test.ts +5 -5
  36. package/src/packlets/services/service-context.ts +10 -5
  37. package/src/packlets/services/service-host.ts +29 -12
  38. package/src/packlets/services/service-registry.test.ts +1 -1
  39. package/src/packlets/spaces/spaces-service.test.ts +1 -1
  40. package/src/packlets/storage/index.ts +1 -0
  41. package/src/packlets/storage/level.ts +19 -0
  42. package/src/packlets/storage/storage.ts +3 -9
  43. package/src/packlets/storage/util.ts +19 -0
  44. package/src/packlets/testing/test-builder.ts +5 -3
  45. package/src/version.ts +1 -1
  46. package/dist/lib/node/chunk-EC2QGJ2V.cjs.map +0 -7
@@ -2769,7 +2769,7 @@ var getPlatform = () => {
2769
2769
  };
2770
2770
 
2771
2771
  // packages/sdk/client-services/src/version.ts
2772
- var DXOS_VERSION = "0.4.10-main.f68a1ca";
2772
+ var DXOS_VERSION = "0.4.10-main.fd4f2a3";
2773
2773
 
2774
2774
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2775
2775
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -4386,7 +4386,7 @@ var getChannelId = (channel) => `user-channel/${channel}`;
4386
4386
 
4387
4387
  // packages/sdk/client-services/src/packlets/services/service-context.ts
4388
4388
  import { Trigger as Trigger5 } from "@dxos/async";
4389
- import { Context as Context10 } from "@dxos/context";
4389
+ import { Context as Context10, Resource } from "@dxos/context";
4390
4390
  import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
4391
4391
  import { failUndefined as failUndefined2 } from "@dxos/debug";
4392
4392
  import { AutomergeHost, MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
@@ -4419,13 +4419,13 @@ var createSelectedDocumentsIterator = (automergeHost) => (
4419
4419
  await warnAfterTimeout2(5e3, "to long to load doc", () => handle.whenReady());
4420
4420
  const doc = handle.docSync();
4421
4421
  const hash = getHeads(doc).join("");
4422
- yield [
4422
+ yield doc.objects?.[objectId] ? [
4423
4423
  {
4424
4424
  id,
4425
4425
  object: doc.objects[objectId],
4426
4426
  currentHash: hash
4427
4427
  }
4428
- ];
4428
+ ] : [];
4429
4429
  }
4430
4430
  }
4431
4431
  );
@@ -4493,9 +4493,11 @@ function _ts_decorate6(decorators, target, key, desc) {
4493
4493
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4494
4494
  }
4495
4495
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4496
- var ServiceContext = class {
4497
- constructor(storage, networkManager, signalManager, _runtimeParams) {
4496
+ var ServiceContext = class extends Resource {
4497
+ constructor(storage, level, networkManager, signalManager, _runtimeParams) {
4498
+ super();
4498
4499
  this.storage = storage;
4500
+ this.level = level;
4499
4501
  this.networkManager = networkManager;
4500
4502
  this.signalManager = signalManager;
4501
4503
  this._runtimeParams = _runtimeParams;
@@ -4525,7 +4527,7 @@ var ServiceContext = class {
4525
4527
  });
4526
4528
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
4527
4529
  this.indexMetadata = new IndexMetadataStore({
4528
- directory: storage.createDirectory("index-metadata")
4530
+ db: level.sublevel("index-metadata")
4529
4531
  });
4530
4532
  this.automergeHost = new AutomergeHost({
4531
4533
  directory: storage.createDirectory("automerge"),
@@ -4542,11 +4544,11 @@ var ServiceContext = class {
4542
4544
  this.invitations = new InvitationsHandler(this.networkManager);
4543
4545
  this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
4544
4546
  }
4545
- async open(ctx) {
4547
+ async _open(ctx) {
4546
4548
  await this._checkStorageVersion();
4547
4549
  log12("opening...", void 0, {
4548
4550
  F: __dxlog_file15,
4549
- L: 151,
4551
+ L: 156,
4550
4552
  S: this,
4551
4553
  C: (f, a) => f(...a)
4552
4554
  });
@@ -4554,7 +4556,7 @@ var ServiceContext = class {
4554
4556
  id: this._instanceId
4555
4557
  }), {
4556
4558
  F: __dxlog_file15,
4557
- L: 152,
4559
+ L: 157,
4558
4560
  S: this,
4559
4561
  C: (f, a) => f(...a)
4560
4562
  });
@@ -4570,21 +4572,21 @@ var ServiceContext = class {
4570
4572
  id: this._instanceId
4571
4573
  }), {
4572
4574
  F: __dxlog_file15,
4573
- L: 162,
4575
+ L: 167,
4574
4576
  S: this,
4575
4577
  C: (f, a) => f(...a)
4576
4578
  });
4577
4579
  log12("opened", void 0, {
4578
4580
  F: __dxlog_file15,
4579
- L: 163,
4581
+ L: 168,
4580
4582
  S: this,
4581
4583
  C: (f, a) => f(...a)
4582
4584
  });
4583
4585
  }
4584
- async close() {
4586
+ async _close() {
4585
4587
  log12("closing...", void 0, {
4586
4588
  F: __dxlog_file15,
4587
- L: 167,
4589
+ L: 172,
4588
4590
  S: this,
4589
4591
  C: (f, a) => f(...a)
4590
4592
  });
@@ -4602,7 +4604,7 @@ var ServiceContext = class {
4602
4604
  await this.indexer.destroy();
4603
4605
  log12("closed", void 0, {
4604
4606
  F: __dxlog_file15,
4605
- L: 180,
4607
+ L: 185,
4606
4608
  S: this,
4607
4609
  C: (f, a) => f(...a)
4608
4610
  });
@@ -4616,7 +4618,7 @@ var ServiceContext = class {
4616
4618
  const factory = this._handlerFactories.get(invitation.kind);
4617
4619
  invariant14(factory, `Unknown invitation kind: ${invitation.kind}`, {
4618
4620
  F: __dxlog_file15,
4619
- L: 191,
4621
+ L: 196,
4620
4622
  S: this,
4621
4623
  A: [
4622
4624
  "factory",
@@ -4648,7 +4650,7 @@ var ServiceContext = class {
4648
4650
  async _initialize(ctx) {
4649
4651
  log12("initializing spaces...", void 0, {
4650
4652
  F: __dxlog_file15,
4651
- L: 222,
4653
+ L: 227,
4652
4654
  S: this,
4653
4655
  C: (f, a) => f(...a)
4654
4656
  });
@@ -4671,7 +4673,7 @@ var ServiceContext = class {
4671
4673
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4672
4674
  invariant14(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4673
4675
  F: __dxlog_file15,
4674
- L: 246,
4676
+ L: 251,
4675
4677
  S: this,
4676
4678
  A: [
4677
4679
  "this.dataSpaceManager",
@@ -4695,7 +4697,7 @@ var ServiceContext = class {
4695
4697
  details: assertion
4696
4698
  }, {
4697
4699
  F: __dxlog_file15,
4698
- L: 262,
4700
+ L: 267,
4699
4701
  S: this,
4700
4702
  C: (f, a) => f(...a)
4701
4703
  });
@@ -4706,7 +4708,7 @@ var ServiceContext = class {
4706
4708
  details: assertion
4707
4709
  }, {
4708
4710
  F: __dxlog_file15,
4709
- L: 266,
4711
+ L: 271,
4710
4712
  S: this,
4711
4713
  C: (f, a) => f(...a)
4712
4714
  });
@@ -4717,7 +4719,7 @@ var ServiceContext = class {
4717
4719
  details: assertion
4718
4720
  }, {
4719
4721
  F: __dxlog_file15,
4720
- L: 271,
4722
+ L: 276,
4721
4723
  S: this,
4722
4724
  C: (f, a) => f(...a)
4723
4725
  });
@@ -4728,7 +4730,7 @@ var ServiceContext = class {
4728
4730
  } catch (err) {
4729
4731
  log12.catch(err, void 0, {
4730
4732
  F: __dxlog_file15,
4731
- L: 277,
4733
+ L: 282,
4732
4734
  S: this,
4733
4735
  C: (f, a) => f(...a)
4734
4736
  });
@@ -4740,7 +4742,7 @@ var ServiceContext = class {
4740
4742
  };
4741
4743
  _ts_decorate6([
4742
4744
  Trace2.span()
4743
- ], ServiceContext.prototype, "open", null);
4745
+ ], ServiceContext.prototype, "_open", null);
4744
4746
  _ts_decorate6([
4745
4747
  Trace2.span()
4746
4748
  ], ServiceContext.prototype, "_initialize", null);
@@ -4898,14 +4900,27 @@ var isLocked = (lockPath) => {
4898
4900
  };
4899
4901
 
4900
4902
  // packages/sdk/client-services/src/packlets/storage/storage.ts
4901
- import { DX_DATA } from "@dxos/client-protocol";
4902
4903
  import { InvalidConfigError } from "@dxos/protocols";
4903
- import { Runtime } from "@dxos/protocols/proto/dxos/config";
4904
+ import { Runtime as Runtime2 } from "@dxos/protocols/proto/dxos/config";
4904
4905
  import { createStorage, StorageType } from "@dxos/random-access-storage";
4906
+
4907
+ // packages/sdk/client-services/src/packlets/storage/util.ts
4908
+ import { DX_DATA } from "@dxos/client-protocol";
4909
+ import { Runtime } from "@dxos/protocols/proto/dxos/config";
4905
4910
  import { isNode as isNode2 } from "@dxos/util";
4906
- var StorageDriver = Runtime.Client.Storage.StorageDriver;
4911
+ var getRootPath = (config) => {
4912
+ const { dataRoot = isNode2() ? DX_DATA : "dxos/storage" } = config ?? {};
4913
+ return `${dataRoot}/`;
4914
+ };
4915
+ var isPersistent = (config) => {
4916
+ const { persistent = false } = config ?? {};
4917
+ return config.dataStore !== void 0 && config.dataStore !== Runtime.Client.Storage.StorageDriver.RAM || persistent;
4918
+ };
4919
+
4920
+ // packages/sdk/client-services/src/packlets/storage/storage.ts
4921
+ var StorageDriver = Runtime2.Client.Storage.StorageDriver;
4907
4922
  var createStorageObjects = (config) => {
4908
- const { persistent = false, keyStore, dataStore, dataRoot = isNode2() ? DX_DATA : "dxos/storage" } = config ?? {};
4923
+ const { persistent = false, keyStore, dataStore } = config ?? {};
4909
4924
  if (persistent && dataStore === StorageDriver.RAM) {
4910
4925
  throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
4911
4926
  }
@@ -4921,7 +4936,7 @@ var createStorageObjects = (config) => {
4921
4936
  return {
4922
4937
  storage: createStorage({
4923
4938
  type: persistent ? toStorageType(dataStore) : StorageType.RAM,
4924
- root: `${dataRoot}/`
4939
+ root: getRootPath(config)
4925
4940
  })
4926
4941
  };
4927
4942
  };
@@ -4946,16 +4961,27 @@ var toStorageType = (type) => {
4946
4961
  }
4947
4962
  };
4948
4963
 
4964
+ // packages/sdk/client-services/src/packlets/storage/level.ts
4965
+ import { Level } from "level";
4966
+ import path from "@dxos/node-std/path";
4967
+ import { PublicKey as PublicKey11 } from "@dxos/keys";
4968
+ var createLevel = async (config) => {
4969
+ const persistent = isPersistent(config);
4970
+ const storagePath = persistent ? getRootPath(config) : path.join("tmp", "level", PublicKey11.random().toHex());
4971
+ const level = new Level(storagePath);
4972
+ await level.open();
4973
+ return level;
4974
+ };
4975
+
4949
4976
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4950
- import { Event as Event9, sleep as sleep3, synchronized as synchronized3 } from "@dxos/async";
4951
- import { clientServiceBundle, defaultKey, PropertiesSchema } from "@dxos/client-protocol";
4977
+ import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
4978
+ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protocol";
4952
4979
  import { Context as Context11 } from "@dxos/context";
4953
- import { DataServiceImpl } from "@dxos/echo-pipeline";
4980
+ import { DataServiceImpl, encodeReference } from "@dxos/echo-pipeline";
4954
4981
  import * as E from "@dxos/echo-schema";
4955
- import { createRawObjectDoc } from "@dxos/echo-schema";
4956
4982
  import { IndexServiceImpl } from "@dxos/indexing";
4957
4983
  import { invariant as invariant16 } from "@dxos/invariant";
4958
- import { PublicKey as PublicKey12 } from "@dxos/keys";
4984
+ import { PublicKey as PublicKey13 } from "@dxos/keys";
4959
4985
  import { log as log15 } from "@dxos/log";
4960
4986
  import { WebsocketSignalManager } from "@dxos/messaging";
4961
4987
  import { NetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
@@ -5050,7 +5076,7 @@ var DevicesServiceImpl = class {
5050
5076
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
5051
5077
  import { Event as Event8 } from "@dxos/async";
5052
5078
  import { Stream as Stream12 } from "@dxos/codec-protobuf";
5053
- import { PublicKey as PublicKey11 } from "@dxos/keys";
5079
+ import { PublicKey as PublicKey12 } from "@dxos/keys";
5054
5080
  import { getContextFromEntry, log as log14 } from "@dxos/log";
5055
5081
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
5056
5082
  import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
@@ -5058,7 +5084,7 @@ var LoggingServiceImpl = class {
5058
5084
  constructor() {
5059
5085
  this._logs = new Event8();
5060
5086
  this._started = Date.now();
5061
- this._sessionId = PublicKey11.random().toHex();
5087
+ this._sessionId = PublicKey12.random().toHex();
5062
5088
  this._logProcessor = (_config, entry2) => {
5063
5089
  this._logs.emit(entry2);
5064
5090
  };
@@ -5153,12 +5179,12 @@ var LoggingServiceImpl = class {
5153
5179
  });
5154
5180
  }
5155
5181
  };
5156
- var matchFilter = (filter, level, path, options) => {
5182
+ var matchFilter = (filter, level, path2, options) => {
5157
5183
  switch (options) {
5158
5184
  case QueryLogsRequest.MatchingOptions.INCLUSIVE:
5159
- return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
5185
+ return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
5160
5186
  case QueryLogsRequest.MatchingOptions.EXPLICIT:
5161
- return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
5187
+ return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
5162
5188
  }
5163
5189
  };
5164
5190
  var shouldLog = (entry2, request) => {
@@ -5359,7 +5385,7 @@ var ClientServicesHost = class {
5359
5385
  initialize({ config, ...options }) {
5360
5386
  invariant16(!this._open, "service host is open", {
5361
5387
  F: __dxlog_file18,
5362
- L: 180,
5388
+ L: 182,
5363
5389
  S: this,
5364
5390
  A: [
5365
5391
  "!this._open",
@@ -5368,14 +5394,14 @@ var ClientServicesHost = class {
5368
5394
  });
5369
5395
  log15("initializing...", void 0, {
5370
5396
  F: __dxlog_file18,
5371
- L: 181,
5397
+ L: 183,
5372
5398
  S: this,
5373
5399
  C: (f, a) => f(...a)
5374
5400
  });
5375
5401
  if (config) {
5376
5402
  invariant16(!this._config, "config already set", {
5377
5403
  F: __dxlog_file18,
5378
- L: 184,
5404
+ L: 186,
5379
5405
  S: this,
5380
5406
  A: [
5381
5407
  "!this._config",
@@ -5390,7 +5416,7 @@ var ClientServicesHost = class {
5390
5416
  if (!options.signalManager) {
5391
5417
  log15.warn("running signaling without telemetry metadata.", void 0, {
5392
5418
  F: __dxlog_file18,
5393
- L: 192,
5419
+ L: 194,
5394
5420
  S: this,
5395
5421
  C: (f, a) => f(...a)
5396
5422
  });
@@ -5401,7 +5427,7 @@ var ClientServicesHost = class {
5401
5427
  this._signalManager = signalManager;
5402
5428
  invariant16(!this._networkManager, "network manager already set", {
5403
5429
  F: __dxlog_file18,
5404
- L: 203,
5430
+ L: 205,
5405
5431
  S: this,
5406
5432
  A: [
5407
5433
  "!this._networkManager",
@@ -5415,7 +5441,7 @@ var ClientServicesHost = class {
5415
5441
  });
5416
5442
  log15("initialized", void 0, {
5417
5443
  F: __dxlog_file18,
5418
- L: 210,
5444
+ L: 212,
5419
5445
  S: this,
5420
5446
  C: (f, a) => f(...a)
5421
5447
  });
@@ -5424,18 +5450,18 @@ var ClientServicesHost = class {
5424
5450
  if (this._open) {
5425
5451
  return;
5426
5452
  }
5427
- const traceId = PublicKey12.random().toHex();
5453
+ const traceId = PublicKey13.random().toHex();
5428
5454
  log15.trace("dxos.client-services.host.open", trace9.begin({
5429
5455
  id: traceId
5430
5456
  }), {
5431
5457
  F: __dxlog_file18,
5432
- L: 221,
5458
+ L: 223,
5433
5459
  S: this,
5434
5460
  C: (f, a) => f(...a)
5435
5461
  });
5436
5462
  invariant16(this._config, "config not set", {
5437
5463
  F: __dxlog_file18,
5438
- L: 223,
5464
+ L: 225,
5439
5465
  S: this,
5440
5466
  A: [
5441
5467
  "this._config",
@@ -5444,7 +5470,7 @@ var ClientServicesHost = class {
5444
5470
  });
5445
5471
  invariant16(this._storage, "storage not set", {
5446
5472
  F: __dxlog_file18,
5447
- L: 224,
5473
+ L: 226,
5448
5474
  S: this,
5449
5475
  A: [
5450
5476
  "this._storage",
@@ -5453,7 +5479,7 @@ var ClientServicesHost = class {
5453
5479
  });
5454
5480
  invariant16(this._signalManager, "signal manager not set", {
5455
5481
  F: __dxlog_file18,
5456
- L: 225,
5482
+ L: 227,
5457
5483
  S: this,
5458
5484
  A: [
5459
5485
  "this._signalManager",
@@ -5462,7 +5488,7 @@ var ClientServicesHost = class {
5462
5488
  });
5463
5489
  invariant16(this._networkManager, "network manager not set", {
5464
5490
  F: __dxlog_file18,
5465
- L: 226,
5491
+ L: 228,
5466
5492
  S: this,
5467
5493
  A: [
5468
5494
  "this._networkManager",
@@ -5474,13 +5500,16 @@ var ClientServicesHost = class {
5474
5500
  lockKey: this._resourceLock?.lockKey
5475
5501
  }, {
5476
5502
  F: __dxlog_file18,
5477
- L: 229,
5503
+ L: 231,
5478
5504
  S: this,
5479
5505
  C: (f, a) => f(...a)
5480
5506
  });
5507
+ if (!this._level) {
5508
+ this._level = await createLevel(this._config.get("runtime.client.storage", {}));
5509
+ }
5481
5510
  await this._resourceLock?.acquire();
5482
5511
  await this._loggingService.open();
5483
- this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._runtimeParams);
5512
+ this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
5484
5513
  this._serviceRegistry.setServices({
5485
5514
  SystemService: this._systemService,
5486
5515
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
@@ -5508,7 +5537,7 @@ var ClientServicesHost = class {
5508
5537
  await this._serviceContext.open(ctx);
5509
5538
  invariant16(this.serviceRegistry.services.InvitationsService, void 0, {
5510
5539
  F: __dxlog_file18,
5511
- L: 290,
5540
+ L: 297,
5512
5541
  S: this,
5513
5542
  A: [
5514
5543
  "this.serviceRegistry.services.InvitationsService",
@@ -5520,7 +5549,7 @@ var ClientServicesHost = class {
5520
5549
  count: loadedInvitations.invitations?.length
5521
5550
  }, {
5522
5551
  F: __dxlog_file18,
5523
- L: 293,
5552
+ L: 300,
5524
5553
  S: this,
5525
5554
  C: (f, a) => f(...a)
5526
5555
  });
@@ -5542,7 +5571,7 @@ var ClientServicesHost = class {
5542
5571
  deviceKey
5543
5572
  }, {
5544
5573
  F: __dxlog_file18,
5545
- L: 310,
5574
+ L: 317,
5546
5575
  S: this,
5547
5576
  C: (f, a) => f(...a)
5548
5577
  });
@@ -5550,7 +5579,7 @@ var ClientServicesHost = class {
5550
5579
  id: traceId
5551
5580
  }), {
5552
5581
  F: __dxlog_file18,
5553
- L: 311,
5582
+ L: 318,
5554
5583
  S: this,
5555
5584
  C: (f, a) => f(...a)
5556
5585
  });
@@ -5564,7 +5593,7 @@ var ClientServicesHost = class {
5564
5593
  deviceKey
5565
5594
  }, {
5566
5595
  F: __dxlog_file18,
5567
- L: 322,
5596
+ L: 329,
5568
5597
  S: this,
5569
5598
  C: (f, a) => f(...a)
5570
5599
  });
@@ -5574,30 +5603,31 @@ var ClientServicesHost = class {
5574
5603
  });
5575
5604
  await this._loggingService.close();
5576
5605
  await this._serviceContext.close();
5606
+ await this._level?.close();
5577
5607
  this._open = false;
5578
5608
  this._statusUpdate.emit();
5579
5609
  log15("closed", {
5580
5610
  deviceKey
5581
5611
  }, {
5582
5612
  F: __dxlog_file18,
5583
- L: 329,
5613
+ L: 337,
5584
5614
  S: this,
5585
5615
  C: (f, a) => f(...a)
5586
5616
  });
5587
5617
  }
5588
5618
  async reset() {
5589
- const traceId = PublicKey12.random().toHex();
5619
+ const traceId = PublicKey13.random().toHex();
5590
5620
  log15.trace("dxos.sdk.client-services-host.reset", trace9.begin({
5591
5621
  id: traceId
5592
5622
  }), {
5593
5623
  F: __dxlog_file18,
5594
- L: 334,
5624
+ L: 342,
5595
5625
  S: this,
5596
5626
  C: (f, a) => f(...a)
5597
5627
  });
5598
5628
  log15("resetting...", void 0, {
5599
5629
  F: __dxlog_file18,
5600
- L: 336,
5630
+ L: 344,
5601
5631
  S: this,
5602
5632
  C: (f, a) => f(...a)
5603
5633
  });
@@ -5605,7 +5635,7 @@ var ClientServicesHost = class {
5605
5635
  await this._storage.reset();
5606
5636
  log15("reset", void 0, {
5607
5637
  F: __dxlog_file18,
5608
- L: 339,
5638
+ L: 347,
5609
5639
  S: this,
5610
5640
  C: (f, a) => f(...a)
5611
5641
  });
@@ -5613,7 +5643,7 @@ var ClientServicesHost = class {
5613
5643
  id: traceId
5614
5644
  }), {
5615
5645
  F: __dxlog_file18,
5616
- L: 340,
5646
+ L: 348,
5617
5647
  S: this,
5618
5648
  C: (f, a) => f(...a)
5619
5649
  });
@@ -5626,7 +5656,7 @@ var ClientServicesHost = class {
5626
5656
  const automergeIndex = space.automergeSpaceState.rootUrl;
5627
5657
  invariant16(automergeIndex, void 0, {
5628
5658
  F: __dxlog_file18,
5629
- L: 352,
5659
+ L: 360,
5630
5660
  S: this,
5631
5661
  A: [
5632
5662
  "automergeIndex",
@@ -5635,18 +5665,25 @@ var ClientServicesHost = class {
5635
5665
  });
5636
5666
  const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5637
5667
  await document.whenReady();
5638
- const objectDocument = createRawObjectDoc({
5639
- [defaultKey]: identity.identityKey.toHex()
5640
- }, {
5641
- type: E.getTypeReference(PropertiesSchema)
5642
- });
5668
+ const properties = {
5669
+ system: {
5670
+ type: encodeReference(E.getTypeReference(Properties))
5671
+ },
5672
+ data: {
5673
+ [defaultKey]: identity.identityKey.toHex()
5674
+ },
5675
+ meta: {
5676
+ keys: []
5677
+ }
5678
+ };
5679
+ const propertiesId = PublicKey13.random().toHex();
5643
5680
  document.change((doc) => {
5644
5681
  assignDeep2(doc, [
5645
5682
  "objects",
5646
- objectDocument.id
5647
- ], objectDocument.handle.docSync());
5683
+ propertiesId
5684
+ ], properties);
5648
5685
  });
5649
- await sleep3(200);
5686
+ await this._serviceContext.automergeHost.repo.flush();
5650
5687
  return identity;
5651
5688
  }
5652
5689
  };
@@ -5700,6 +5737,7 @@ export {
5700
5737
  Lock,
5701
5738
  isLocked,
5702
5739
  createStorageObjects,
5740
+ createLevel,
5703
5741
  ClientServicesHost
5704
5742
  };
5705
- //# sourceMappingURL=chunk-B4JZEXRB.mjs.map
5743
+ //# sourceMappingURL=chunk-V2ALN47T.mjs.map