@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.
@@ -2557,7 +2557,7 @@ var getPlatform = () => {
2557
2557
  };
2558
2558
 
2559
2559
  // packages/sdk/client-services/src/version.ts
2560
- var DXOS_VERSION = "0.1.58-main.ca7a0bc";
2560
+ var DXOS_VERSION = "0.1.58-main.d647118";
2561
2561
 
2562
2562
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2563
2563
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -4226,6 +4226,7 @@ var import_client_protocol5 = require("@dxos/client-protocol");
4226
4226
  var import_context10 = require("@dxos/context");
4227
4227
  var import_document_model2 = require("@dxos/document-model");
4228
4228
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
4229
+ var import_echo_schema = require("@dxos/echo-schema");
4229
4230
  var import_invariant15 = require("@dxos/invariant");
4230
4231
  var import_keys11 = require("@dxos/keys");
4231
4232
  var import_log16 = require("@dxos/log");
@@ -4631,6 +4632,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4631
4632
  var createDefaultModelFactory = () => {
4632
4633
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4633
4634
  };
4635
+ var createGenesisMutationFromTypedObject = (obj) => {
4636
+ const snapshot = obj[import_echo_schema.base]._createSnapshot();
4637
+ return {
4638
+ objectId: obj[import_echo_schema.base]._id,
4639
+ genesis: {
4640
+ modelType: obj[import_echo_schema.base]._modelConstructor.meta.type
4641
+ },
4642
+ snapshot: {
4643
+ model: snapshot
4644
+ }
4645
+ };
4646
+ };
4634
4647
  var ClientServicesHost = class ClientServicesHost2 {
4635
4648
  constructor({
4636
4649
  config,
@@ -4717,7 +4730,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4717
4730
  initialize({ config, ...options }) {
4718
4731
  (0, import_invariant15.invariant)(!this._open, "service host is open", {
4719
4732
  F: __dxlog_file17,
4720
- L: 184,
4733
+ L: 201,
4721
4734
  S: this,
4722
4735
  A: [
4723
4736
  "!this._open",
@@ -4726,14 +4739,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4726
4739
  });
4727
4740
  (0, import_log16.log)("initializing...", void 0, {
4728
4741
  F: __dxlog_file17,
4729
- L: 185,
4742
+ L: 202,
4730
4743
  S: this,
4731
4744
  C: (f, a) => f(...a)
4732
4745
  });
4733
4746
  if (config) {
4734
4747
  (0, import_invariant15.invariant)(!this._config, "config already set", {
4735
4748
  F: __dxlog_file17,
4736
- L: 188,
4749
+ L: 205,
4737
4750
  S: this,
4738
4751
  A: [
4739
4752
  "!this._config",
@@ -4751,7 +4764,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4751
4764
  this._signalManager = signalManager;
4752
4765
  (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4753
4766
  F: __dxlog_file17,
4754
- L: 204,
4767
+ L: 221,
4755
4768
  S: this,
4756
4769
  A: [
4757
4770
  "!this._networkManager",
@@ -4765,7 +4778,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4765
4778
  });
4766
4779
  (0, import_log16.log)("initialized", void 0, {
4767
4780
  F: __dxlog_file17,
4768
- L: 211,
4781
+ L: 228,
4769
4782
  S: this,
4770
4783
  C: (f, a) => f(...a)
4771
4784
  });
@@ -4779,13 +4792,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4779
4792
  id: traceId
4780
4793
  }), {
4781
4794
  F: __dxlog_file17,
4782
- L: 222,
4795
+ L: 239,
4783
4796
  S: this,
4784
4797
  C: (f, a) => f(...a)
4785
4798
  });
4786
4799
  (0, import_invariant15.invariant)(this._config, "config not set", {
4787
4800
  F: __dxlog_file17,
4788
- L: 224,
4801
+ L: 241,
4789
4802
  S: this,
4790
4803
  A: [
4791
4804
  "this._config",
@@ -4794,7 +4807,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4794
4807
  });
4795
4808
  (0, import_invariant15.invariant)(this._storage, "storage not set", {
4796
4809
  F: __dxlog_file17,
4797
- L: 225,
4810
+ L: 242,
4798
4811
  S: this,
4799
4812
  A: [
4800
4813
  "this._storage",
@@ -4803,7 +4816,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4803
4816
  });
4804
4817
  (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4805
4818
  F: __dxlog_file17,
4806
- L: 226,
4819
+ L: 243,
4807
4820
  S: this,
4808
4821
  A: [
4809
4822
  "this._signalManager",
@@ -4812,7 +4825,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4812
4825
  });
4813
4826
  (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4814
4827
  F: __dxlog_file17,
4815
- L: 227,
4828
+ L: 244,
4816
4829
  S: this,
4817
4830
  A: [
4818
4831
  "this._networkManager",
@@ -4824,7 +4837,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4824
4837
  lockKey: this._resourceLock?.lockKey
4825
4838
  }, {
4826
4839
  F: __dxlog_file17,
4827
- L: 230,
4840
+ L: 247,
4828
4841
  S: this,
4829
4842
  C: (f, a) => f(...a)
4830
4843
  });
@@ -4833,7 +4846,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4833
4846
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4834
4847
  this._serviceRegistry.setServices({
4835
4848
  SystemService: this._systemService,
4836
- IdentityService: new IdentityServiceImpl((params) => this._serviceContext.createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4849
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4837
4850
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4838
4851
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4839
4852
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
@@ -4870,7 +4883,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4870
4883
  deviceKey
4871
4884
  }, {
4872
4885
  F: __dxlog_file17,
4873
- L: 299,
4886
+ L: 316,
4874
4887
  S: this,
4875
4888
  C: (f, a) => f(...a)
4876
4889
  });
@@ -4878,7 +4891,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4878
4891
  id: traceId
4879
4892
  }), {
4880
4893
  F: __dxlog_file17,
4881
- L: 300,
4894
+ L: 317,
4882
4895
  S: this,
4883
4896
  C: (f, a) => f(...a)
4884
4897
  });
@@ -4892,7 +4905,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4892
4905
  deviceKey
4893
4906
  }, {
4894
4907
  F: __dxlog_file17,
4895
- L: 311,
4908
+ L: 328,
4896
4909
  S: this,
4897
4910
  C: (f, a) => f(...a)
4898
4911
  });
@@ -4908,7 +4921,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4908
4921
  deviceKey
4909
4922
  }, {
4910
4923
  F: __dxlog_file17,
4911
- L: 318,
4924
+ L: 335,
4912
4925
  S: this,
4913
4926
  C: (f, a) => f(...a)
4914
4927
  });
@@ -4919,13 +4932,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4919
4932
  id: traceId
4920
4933
  }), {
4921
4934
  F: __dxlog_file17,
4922
- L: 323,
4935
+ L: 340,
4923
4936
  S: this,
4924
4937
  C: (f, a) => f(...a)
4925
4938
  });
4926
4939
  (0, import_log16.log)("resetting...", void 0, {
4927
4940
  F: __dxlog_file17,
4928
- L: 325,
4941
+ L: 342,
4929
4942
  S: this,
4930
4943
  C: (f, a) => f(...a)
4931
4944
  });
@@ -4933,7 +4946,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4933
4946
  await this._storage.reset();
4934
4947
  (0, import_log16.log)("reset", void 0, {
4935
4948
  F: __dxlog_file17,
4936
- L: 328,
4949
+ L: 345,
4937
4950
  S: this,
4938
4951
  C: (f, a) => f(...a)
4939
4952
  });
@@ -4941,12 +4954,31 @@ var ClientServicesHost = class ClientServicesHost2 {
4941
4954
  id: traceId
4942
4955
  }), {
4943
4956
  F: __dxlog_file17,
4944
- L: 329,
4957
+ L: 346,
4945
4958
  S: this,
4946
4959
  C: (f, a) => f(...a)
4947
4960
  });
4948
4961
  await this._callbacks?.onReset?.();
4949
4962
  }
4963
+ async _createIdentity(params) {
4964
+ const identity = await this._serviceContext.createIdentity(params);
4965
+ await this._serviceContext.initialized.wait();
4966
+ const space = await this._serviceContext.dataSpaceManager.createSpace();
4967
+ const obj = new import_client_protocol5.Properties();
4968
+ obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
4969
+ await this._serviceRegistry.services.DataService.write({
4970
+ spaceKey: space.key,
4971
+ batch: {
4972
+ objects: [
4973
+ createGenesisMutationFromTypedObject(obj)
4974
+ ]
4975
+ }
4976
+ });
4977
+ await this._serviceRegistry.services.DataService.flush({
4978
+ spaceKey: space.key
4979
+ });
4980
+ return identity;
4981
+ }
4950
4982
  };
4951
4983
  _ts_decorate7([
4952
4984
  import_tracing5.trace.info()