@dxos/client-services 0.1.58-main.ca7a0bc → 0.1.58-main.d647118

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.
@@ -99,7 +99,7 @@ var getPlatform = () => {
99
99
  };
100
100
 
101
101
  // packages/sdk/client-services/src/version.ts
102
- var DXOS_VERSION = "0.1.58-main.ca7a0bc";
102
+ var DXOS_VERSION = "0.1.58-main.d647118";
103
103
 
104
104
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
105
105
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -3837,6 +3837,7 @@ var import_client_protocol5 = require("@dxos/client-protocol");
3837
3837
  var import_context10 = require("@dxos/context");
3838
3838
  var import_document_model2 = require("@dxos/document-model");
3839
3839
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
3840
+ var import_echo_schema = require("@dxos/echo-schema");
3840
3841
  var import_invariant15 = require("@dxos/invariant");
3841
3842
  var import_keys12 = require("@dxos/keys");
3842
3843
  var import_log16 = require("@dxos/log");
@@ -4549,6 +4550,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4549
4550
  var createDefaultModelFactory = () => {
4550
4551
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4551
4552
  };
4553
+ var createGenesisMutationFromTypedObject = (obj) => {
4554
+ const snapshot = obj[import_echo_schema.base]._createSnapshot();
4555
+ return {
4556
+ objectId: obj[import_echo_schema.base]._id,
4557
+ genesis: {
4558
+ modelType: obj[import_echo_schema.base]._modelConstructor.meta.type
4559
+ },
4560
+ snapshot: {
4561
+ model: snapshot
4562
+ }
4563
+ };
4564
+ };
4552
4565
  var ClientServicesHost = class ClientServicesHost2 {
4553
4566
  constructor({
4554
4567
  config,
@@ -4635,7 +4648,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4635
4648
  initialize({ config, ...options }) {
4636
4649
  (0, import_invariant15.invariant)(!this._open, "service host is open", {
4637
4650
  F: __dxlog_file17,
4638
- L: 184,
4651
+ L: 201,
4639
4652
  S: this,
4640
4653
  A: [
4641
4654
  "!this._open",
@@ -4644,14 +4657,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4644
4657
  });
4645
4658
  (0, import_log16.log)("initializing...", void 0, {
4646
4659
  F: __dxlog_file17,
4647
- L: 185,
4660
+ L: 202,
4648
4661
  S: this,
4649
4662
  C: (f, a) => f(...a)
4650
4663
  });
4651
4664
  if (config) {
4652
4665
  (0, import_invariant15.invariant)(!this._config, "config already set", {
4653
4666
  F: __dxlog_file17,
4654
- L: 188,
4667
+ L: 205,
4655
4668
  S: this,
4656
4669
  A: [
4657
4670
  "!this._config",
@@ -4669,7 +4682,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4669
4682
  this._signalManager = signalManager;
4670
4683
  (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4671
4684
  F: __dxlog_file17,
4672
- L: 204,
4685
+ L: 221,
4673
4686
  S: this,
4674
4687
  A: [
4675
4688
  "!this._networkManager",
@@ -4683,7 +4696,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4683
4696
  });
4684
4697
  (0, import_log16.log)("initialized", void 0, {
4685
4698
  F: __dxlog_file17,
4686
- L: 211,
4699
+ L: 228,
4687
4700
  S: this,
4688
4701
  C: (f, a) => f(...a)
4689
4702
  });
@@ -4697,13 +4710,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4697
4710
  id: traceId
4698
4711
  }), {
4699
4712
  F: __dxlog_file17,
4700
- L: 222,
4713
+ L: 239,
4701
4714
  S: this,
4702
4715
  C: (f, a) => f(...a)
4703
4716
  });
4704
4717
  (0, import_invariant15.invariant)(this._config, "config not set", {
4705
4718
  F: __dxlog_file17,
4706
- L: 224,
4719
+ L: 241,
4707
4720
  S: this,
4708
4721
  A: [
4709
4722
  "this._config",
@@ -4712,7 +4725,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4712
4725
  });
4713
4726
  (0, import_invariant15.invariant)(this._storage, "storage not set", {
4714
4727
  F: __dxlog_file17,
4715
- L: 225,
4728
+ L: 242,
4716
4729
  S: this,
4717
4730
  A: [
4718
4731
  "this._storage",
@@ -4721,7 +4734,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4721
4734
  });
4722
4735
  (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4723
4736
  F: __dxlog_file17,
4724
- L: 226,
4737
+ L: 243,
4725
4738
  S: this,
4726
4739
  A: [
4727
4740
  "this._signalManager",
@@ -4730,7 +4743,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4730
4743
  });
4731
4744
  (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4732
4745
  F: __dxlog_file17,
4733
- L: 227,
4746
+ L: 244,
4734
4747
  S: this,
4735
4748
  A: [
4736
4749
  "this._networkManager",
@@ -4742,7 +4755,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4742
4755
  lockKey: this._resourceLock?.lockKey
4743
4756
  }, {
4744
4757
  F: __dxlog_file17,
4745
- L: 230,
4758
+ L: 247,
4746
4759
  S: this,
4747
4760
  C: (f, a) => f(...a)
4748
4761
  });
@@ -4751,7 +4764,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4751
4764
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4752
4765
  this._serviceRegistry.setServices({
4753
4766
  SystemService: this._systemService,
4754
- IdentityService: new IdentityServiceImpl((params) => this._serviceContext.createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4767
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4755
4768
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4756
4769
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4757
4770
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
@@ -4788,7 +4801,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4788
4801
  deviceKey
4789
4802
  }, {
4790
4803
  F: __dxlog_file17,
4791
- L: 299,
4804
+ L: 316,
4792
4805
  S: this,
4793
4806
  C: (f, a) => f(...a)
4794
4807
  });
@@ -4796,7 +4809,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4796
4809
  id: traceId
4797
4810
  }), {
4798
4811
  F: __dxlog_file17,
4799
- L: 300,
4812
+ L: 317,
4800
4813
  S: this,
4801
4814
  C: (f, a) => f(...a)
4802
4815
  });
@@ -4810,7 +4823,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4810
4823
  deviceKey
4811
4824
  }, {
4812
4825
  F: __dxlog_file17,
4813
- L: 311,
4826
+ L: 328,
4814
4827
  S: this,
4815
4828
  C: (f, a) => f(...a)
4816
4829
  });
@@ -4826,7 +4839,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4826
4839
  deviceKey
4827
4840
  }, {
4828
4841
  F: __dxlog_file17,
4829
- L: 318,
4842
+ L: 335,
4830
4843
  S: this,
4831
4844
  C: (f, a) => f(...a)
4832
4845
  });
@@ -4837,13 +4850,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4837
4850
  id: traceId
4838
4851
  }), {
4839
4852
  F: __dxlog_file17,
4840
- L: 323,
4853
+ L: 340,
4841
4854
  S: this,
4842
4855
  C: (f, a) => f(...a)
4843
4856
  });
4844
4857
  (0, import_log16.log)("resetting...", void 0, {
4845
4858
  F: __dxlog_file17,
4846
- L: 325,
4859
+ L: 342,
4847
4860
  S: this,
4848
4861
  C: (f, a) => f(...a)
4849
4862
  });
@@ -4851,7 +4864,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4851
4864
  await this._storage.reset();
4852
4865
  (0, import_log16.log)("reset", void 0, {
4853
4866
  F: __dxlog_file17,
4854
- L: 328,
4867
+ L: 345,
4855
4868
  S: this,
4856
4869
  C: (f, a) => f(...a)
4857
4870
  });
@@ -4859,12 +4872,31 @@ var ClientServicesHost = class ClientServicesHost2 {
4859
4872
  id: traceId
4860
4873
  }), {
4861
4874
  F: __dxlog_file17,
4862
- L: 329,
4875
+ L: 346,
4863
4876
  S: this,
4864
4877
  C: (f, a) => f(...a)
4865
4878
  });
4866
4879
  await this._callbacks?.onReset?.();
4867
4880
  }
4881
+ async _createIdentity(params) {
4882
+ const identity = await this._serviceContext.createIdentity(params);
4883
+ await this._serviceContext.initialized.wait();
4884
+ const space = await this._serviceContext.dataSpaceManager.createSpace();
4885
+ const obj = new import_client_protocol5.Properties();
4886
+ obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
4887
+ await this._serviceRegistry.services.DataService.write({
4888
+ spaceKey: space.key,
4889
+ batch: {
4890
+ objects: [
4891
+ createGenesisMutationFromTypedObject(obj)
4892
+ ]
4893
+ }
4894
+ });
4895
+ await this._serviceRegistry.services.DataService.flush({
4896
+ spaceKey: space.key
4897
+ });
4898
+ return identity;
4899
+ }
4868
4900
  };
4869
4901
  _ts_decorate7([
4870
4902
  import_tracing5.trace.info()