@dxos/client-services 0.3.2-main.d77d2bc → 0.3.2-main.ec06501

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.
@@ -635,6 +635,7 @@ Identity = _ts_decorate([
635
635
  ], Identity);
636
636
 
637
637
  // packages/sdk/client-services/src/packlets/identity/identity-manager.ts
638
+ import platform from "platform";
638
639
  import { Event as Event2 } from "@dxos/async";
639
640
  import { Context as Context3 } from "@dxos/context";
640
641
  import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator } from "@dxos/credentials";
@@ -676,7 +677,7 @@ var IdentityManager = class IdentityManager2 {
676
677
  id: traceId
677
678
  }), {
678
679
  F: __dxlog_file3,
679
- L: 73,
680
+ L: 75,
680
681
  S: this,
681
682
  C: (f, a) => f(...a)
682
683
  });
@@ -685,7 +686,7 @@ var IdentityManager = class IdentityManager2 {
685
686
  identityRecord
686
687
  }, {
687
688
  F: __dxlog_file3,
688
- L: 76,
689
+ L: 78,
689
690
  S: this,
690
691
  C: (f, a) => f(...a)
691
692
  });
@@ -698,7 +699,7 @@ var IdentityManager = class IdentityManager2 {
698
699
  displayName: this._identity.profileDocument?.displayName
699
700
  }, {
700
701
  F: __dxlog_file3,
701
- L: 81,
702
+ L: 83,
702
703
  S: this,
703
704
  C: (f, a) => f(...a)
704
705
  });
@@ -708,7 +709,7 @@ var IdentityManager = class IdentityManager2 {
708
709
  id: traceId
709
710
  }), {
710
711
  F: __dxlog_file3,
711
- L: 87,
712
+ L: 89,
712
713
  S: this,
713
714
  C: (f, a) => f(...a)
714
715
  });
@@ -719,7 +720,7 @@ var IdentityManager = class IdentityManager2 {
719
720
  async createIdentity({ displayName } = {}) {
720
721
  invariant2(!this._identity, "Identity already exists.", {
721
722
  F: __dxlog_file3,
722
- L: 95,
723
+ L: 97,
723
724
  S: this,
724
725
  A: [
725
726
  "!this._identity",
@@ -728,7 +729,7 @@ var IdentityManager = class IdentityManager2 {
728
729
  });
729
730
  log3("creating identity...", void 0, {
730
731
  F: __dxlog_file3,
731
- L: 96,
732
+ L: 98,
732
733
  S: this,
733
734
  C: (f, a) => f(...a)
734
735
  });
@@ -749,7 +750,7 @@ var IdentityManager = class IdentityManager2 {
749
750
  const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
750
751
  invariant2(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
751
752
  F: __dxlog_file3,
752
- L: 115,
753
+ L: 117,
753
754
  S: this,
754
755
  A: [
755
756
  "identityRecord.haloSpace.genesisFeedKey",
@@ -758,7 +759,7 @@ var IdentityManager = class IdentityManager2 {
758
759
  });
759
760
  invariant2(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
760
761
  F: __dxlog_file3,
761
- L: 116,
762
+ L: 118,
762
763
  S: this,
763
764
  A: [
764
765
  "identityRecord.haloSpace.dataFeedKey",
@@ -777,6 +778,13 @@ var IdentityManager = class IdentityManager2 {
777
778
  }));
778
779
  }
779
780
  credentials.push(await generator.createDeviceAuthorization(identityRecord.deviceKey));
781
+ credentials.push(await generator.createDeviceProfile({
782
+ platform: platform.name,
783
+ platformVersion: platform.version,
784
+ architecture: typeof platform.os?.architecture === "number" ? String(platform.os.architecture) : void 0,
785
+ os: platform.os?.family,
786
+ osVersion: platform.os?.version
787
+ }));
780
788
  for (const credential of credentials) {
781
789
  await identity.controlPipeline.writer.write({
782
790
  credential: {
@@ -793,7 +801,7 @@ var IdentityManager = class IdentityManager2 {
793
801
  displayName: this._identity.profileDocument?.displayName
794
802
  }, {
795
803
  F: __dxlog_file3,
796
- L: 151,
804
+ L: 163,
797
805
  S: this,
798
806
  C: (f, a) => f(...a)
799
807
  });
@@ -803,7 +811,7 @@ var IdentityManager = class IdentityManager2 {
803
811
  deviceKey: identity.deviceKey
804
812
  }, {
805
813
  F: __dxlog_file3,
806
- L: 157,
814
+ L: 169,
807
815
  S: this,
808
816
  C: (f, a) => f(...a)
809
817
  });
@@ -817,13 +825,13 @@ var IdentityManager = class IdentityManager2 {
817
825
  params
818
826
  }, {
819
827
  F: __dxlog_file3,
820
- L: 165,
828
+ L: 177,
821
829
  S: this,
822
830
  C: (f, a) => f(...a)
823
831
  });
824
832
  invariant2(!this._identity, "Identity already exists.", {
825
833
  F: __dxlog_file3,
826
- L: 166,
834
+ L: 178,
827
835
  S: this,
828
836
  A: [
829
837
  "!this._identity",
@@ -851,7 +859,7 @@ var IdentityManager = class IdentityManager2 {
851
859
  displayName: this._identity.profileDocument?.displayName
852
860
  }, {
853
861
  F: __dxlog_file3,
854
- L: 185,
862
+ L: 197,
855
863
  S: this,
856
864
  C: (f, a) => f(...a)
857
865
  });
@@ -861,7 +869,7 @@ var IdentityManager = class IdentityManager2 {
861
869
  deviceKey: identity.deviceKey
862
870
  }, {
863
871
  F: __dxlog_file3,
864
- L: 191,
872
+ L: 203,
865
873
  S: this,
866
874
  C: (f, a) => f(...a)
867
875
  });
@@ -873,7 +881,7 @@ var IdentityManager = class IdentityManager2 {
873
881
  async updateProfile(profile) {
874
882
  invariant2(this._identity, "Identity not initialized.", {
875
883
  F: __dxlog_file3,
876
- L: 199,
884
+ L: 211,
877
885
  S: this,
878
886
  A: [
879
887
  "this._identity",
@@ -901,51 +909,10 @@ var IdentityManager = class IdentityManager2 {
901
909
  this.stateUpdate.emit();
902
910
  return profile;
903
911
  }
904
- async updateDevice({ deviceKey, profile }) {
905
- invariant2(this._identity, "Identity not initialized.", {
906
- F: __dxlog_file3,
907
- L: 216,
908
- S: this,
909
- A: [
910
- "this._identity",
911
- "'Identity not initialized.'"
912
- ]
913
- });
914
- invariant2(this._identity.authorizedDeviceKeys.has(deviceKey), "Device not authorized.", {
915
- F: __dxlog_file3,
916
- L: 218,
917
- S: this,
918
- A: [
919
- "this._identity.authorizedDeviceKeys.has(deviceKey)",
920
- "'Device not authorized.'"
921
- ]
922
- });
923
- const credential = await this._identity.getIdentityCredentialSigner().createCredential({
924
- subject: this._identity.identityKey,
925
- assertion: {
926
- "@type": "dxos.halo.credentials.DeviceProfile",
927
- deviceKey,
928
- profile
929
- }
930
- });
931
- const receipt = await this._identity.controlPipeline.writer.write({
932
- credential: {
933
- credential
934
- }
935
- });
936
- await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([
937
- [
938
- receipt.feedKey,
939
- receipt.seq
940
- ]
941
- ]));
942
- this.stateUpdate.emit();
943
- return profile;
944
- }
945
912
  async _constructIdentity(identityRecord) {
946
913
  invariant2(!this._identity, void 0, {
947
914
  F: __dxlog_file3,
948
- L: 236,
915
+ L: 228,
949
916
  S: this,
950
917
  A: [
951
918
  "!this._identity",
@@ -956,13 +923,13 @@ var IdentityManager = class IdentityManager2 {
956
923
  identityRecord
957
924
  }, {
958
925
  F: __dxlog_file3,
959
- L: 237,
926
+ L: 229,
960
927
  S: this,
961
928
  C: (f, a) => f(...a)
962
929
  });
963
930
  invariant2(identityRecord.haloSpace.controlFeedKey, void 0, {
964
931
  F: __dxlog_file3,
965
- L: 240,
932
+ L: 232,
966
933
  S: this,
967
934
  A: [
968
935
  "identityRecord.haloSpace.controlFeedKey",
@@ -974,7 +941,7 @@ var IdentityManager = class IdentityManager2 {
974
941
  });
975
942
  invariant2(identityRecord.haloSpace.dataFeedKey, void 0, {
976
943
  F: __dxlog_file3,
977
- L: 244,
944
+ L: 236,
978
945
  S: this,
979
946
  A: [
980
947
  "identityRecord.haloSpace.dataFeedKey",
@@ -1006,7 +973,7 @@ var IdentityManager = class IdentityManager2 {
1006
973
  identityKey: identityRecord.identityKey
1007
974
  }, {
1008
975
  F: __dxlog_file3,
1009
- L: 268,
976
+ L: 260,
1010
977
  S: this,
1011
978
  C: (f, a) => f(...a)
1012
979
  });
@@ -1027,7 +994,7 @@ var IdentityManager = class IdentityManager2 {
1027
994
  onAuthFailure: () => {
1028
995
  log3.warn("auth failure", void 0, {
1029
996
  F: __dxlog_file3,
1030
- L: 287,
997
+ L: 279,
1031
998
  S: this,
1032
999
  C: (f, a) => f(...a)
1033
1000
  });
@@ -2528,10 +2495,10 @@ var getPlatform = () => {
2528
2495
  };
2529
2496
  }
2530
2497
  } else {
2531
- const { platform, version, arch } = process;
2498
+ const { platform: platform2, version, arch } = process;
2532
2499
  return {
2533
2500
  type: "node",
2534
- platform: `${platform} ${version} ${arch}`,
2501
+ platform: `${platform2} ${version} ${arch}`,
2535
2502
  runtime: process.version,
2536
2503
  uptime: Math.floor(process.uptime()),
2537
2504
  memory: process.memoryUsage()
@@ -2540,7 +2507,7 @@ var getPlatform = () => {
2540
2507
  };
2541
2508
 
2542
2509
  // packages/sdk/client-services/src/version.ts
2543
- var DXOS_VERSION = "0.3.2-main.d77d2bc";
2510
+ var DXOS_VERSION = "0.3.2-main.ec06501";
2544
2511
 
2545
2512
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2546
2513
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -4405,7 +4372,7 @@ import { Context as Context10 } from "@dxos/context";
4405
4372
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4406
4373
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4407
4374
  import { base } from "@dxos/echo-schema";
4408
- import { invariant as invariant15 } from "@dxos/invariant";
4375
+ import { invariant as invariant14 } from "@dxos/invariant";
4409
4376
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4410
4377
  import { log as log16 } from "@dxos/log";
4411
4378
  import { WebsocketSignalManager } from "@dxos/messaging";
@@ -4420,33 +4387,13 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4420
4387
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4421
4388
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
4422
4389
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
4423
- import { invariant as invariant14 } from "@dxos/invariant";
4424
4390
  import { DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
4425
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
4426
4391
  var DevicesServiceImpl = class {
4427
4392
  constructor(_identityManager) {
4428
4393
  this._identityManager = _identityManager;
4429
4394
  }
4430
4395
  async updateDevice(profile) {
4431
- invariant14(this._identityManager.identity, "Identity not initialized", {
4432
- F: __dxlog_file17,
4433
- L: 17,
4434
- S: this,
4435
- A: [
4436
- "this._identityManager.identity",
4437
- "'Identity not initialized'"
4438
- ]
4439
- });
4440
- const deviceKey = this._identityManager.identity.deviceKey;
4441
- await this._identityManager.updateDevice({
4442
- deviceKey,
4443
- profile
4444
- });
4445
- return {
4446
- deviceKey,
4447
- kind: DeviceKind.CURRENT,
4448
- profile
4449
- };
4396
+ throw new Error("Method not implemented.");
4450
4397
  }
4451
4398
  queryDevices() {
4452
4399
  return new Stream11(({ next }) => {
@@ -4695,7 +4642,7 @@ function _ts_decorate7(decorators, target, key, desc) {
4695
4642
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4696
4643
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4697
4644
  }
4698
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4645
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4699
4646
  var createDefaultModelFactory = () => {
4700
4647
  return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
4701
4648
  };
@@ -4795,8 +4742,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4795
4742
  * Can only be called once.
4796
4743
  */
4797
4744
  initialize({ config, ...options }) {
4798
- invariant15(!this._open, "service host is open", {
4799
- F: __dxlog_file18,
4745
+ invariant14(!this._open, "service host is open", {
4746
+ F: __dxlog_file17,
4800
4747
  L: 201,
4801
4748
  S: this,
4802
4749
  A: [
@@ -4805,14 +4752,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4805
4752
  ]
4806
4753
  });
4807
4754
  log16("initializing...", void 0, {
4808
- F: __dxlog_file18,
4755
+ F: __dxlog_file17,
4809
4756
  L: 202,
4810
4757
  S: this,
4811
4758
  C: (f, a) => f(...a)
4812
4759
  });
4813
4760
  if (config) {
4814
- invariant15(!this._config, "config already set", {
4815
- F: __dxlog_file18,
4761
+ invariant14(!this._config, "config already set", {
4762
+ F: __dxlog_file17,
4816
4763
  L: 205,
4817
4764
  S: this,
4818
4765
  A: [
@@ -4829,8 +4776,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4829
4776
  iceServers: this._config?.get("runtime.services.ice")
4830
4777
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4831
4778
  this._signalManager = signalManager;
4832
- invariant15(!this._networkManager, "network manager already set", {
4833
- F: __dxlog_file18,
4779
+ invariant14(!this._networkManager, "network manager already set", {
4780
+ F: __dxlog_file17,
4834
4781
  L: 221,
4835
4782
  S: this,
4836
4783
  A: [
@@ -4844,7 +4791,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4844
4791
  signalManager
4845
4792
  });
4846
4793
  log16("initialized", void 0, {
4847
- F: __dxlog_file18,
4794
+ F: __dxlog_file17,
4848
4795
  L: 228,
4849
4796
  S: this,
4850
4797
  C: (f, a) => f(...a)
@@ -4858,13 +4805,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4858
4805
  log16.trace("dxos.client-services.host.open", trace8.begin({
4859
4806
  id: traceId
4860
4807
  }), {
4861
- F: __dxlog_file18,
4808
+ F: __dxlog_file17,
4862
4809
  L: 239,
4863
4810
  S: this,
4864
4811
  C: (f, a) => f(...a)
4865
4812
  });
4866
- invariant15(this._config, "config not set", {
4867
- F: __dxlog_file18,
4813
+ invariant14(this._config, "config not set", {
4814
+ F: __dxlog_file17,
4868
4815
  L: 241,
4869
4816
  S: this,
4870
4817
  A: [
@@ -4872,8 +4819,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4872
4819
  "'config not set'"
4873
4820
  ]
4874
4821
  });
4875
- invariant15(this._storage, "storage not set", {
4876
- F: __dxlog_file18,
4822
+ invariant14(this._storage, "storage not set", {
4823
+ F: __dxlog_file17,
4877
4824
  L: 242,
4878
4825
  S: this,
4879
4826
  A: [
@@ -4881,8 +4828,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4881
4828
  "'storage not set'"
4882
4829
  ]
4883
4830
  });
4884
- invariant15(this._signalManager, "signal manager not set", {
4885
- F: __dxlog_file18,
4831
+ invariant14(this._signalManager, "signal manager not set", {
4832
+ F: __dxlog_file17,
4886
4833
  L: 243,
4887
4834
  S: this,
4888
4835
  A: [
@@ -4890,8 +4837,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4890
4837
  "'signal manager not set'"
4891
4838
  ]
4892
4839
  });
4893
- invariant15(this._networkManager, "network manager not set", {
4894
- F: __dxlog_file18,
4840
+ invariant14(this._networkManager, "network manager not set", {
4841
+ F: __dxlog_file17,
4895
4842
  L: 244,
4896
4843
  S: this,
4897
4844
  A: [
@@ -4903,7 +4850,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4903
4850
  log16("opening...", {
4904
4851
  lockKey: this._resourceLock?.lockKey
4905
4852
  }, {
4906
- F: __dxlog_file18,
4853
+ F: __dxlog_file17,
4907
4854
  L: 247,
4908
4855
  S: this,
4909
4856
  C: (f, a) => f(...a)
@@ -4949,7 +4896,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4949
4896
  log16("opened", {
4950
4897
  deviceKey
4951
4898
  }, {
4952
- F: __dxlog_file18,
4899
+ F: __dxlog_file17,
4953
4900
  L: 316,
4954
4901
  S: this,
4955
4902
  C: (f, a) => f(...a)
@@ -4957,7 +4904,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4957
4904
  log16.trace("dxos.client-services.host.open", trace8.end({
4958
4905
  id: traceId
4959
4906
  }), {
4960
- F: __dxlog_file18,
4907
+ F: __dxlog_file17,
4961
4908
  L: 317,
4962
4909
  S: this,
4963
4910
  C: (f, a) => f(...a)
@@ -4971,7 +4918,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4971
4918
  log16("closing...", {
4972
4919
  deviceKey
4973
4920
  }, {
4974
- F: __dxlog_file18,
4921
+ F: __dxlog_file17,
4975
4922
  L: 328,
4976
4923
  S: this,
4977
4924
  C: (f, a) => f(...a)
@@ -4987,7 +4934,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4987
4934
  log16("closed", {
4988
4935
  deviceKey
4989
4936
  }, {
4990
- F: __dxlog_file18,
4937
+ F: __dxlog_file17,
4991
4938
  L: 335,
4992
4939
  S: this,
4993
4940
  C: (f, a) => f(...a)
@@ -4998,13 +4945,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4998
4945
  log16.trace("dxos.sdk.client-services-host.reset", trace8.begin({
4999
4946
  id: traceId
5000
4947
  }), {
5001
- F: __dxlog_file18,
4948
+ F: __dxlog_file17,
5002
4949
  L: 340,
5003
4950
  S: this,
5004
4951
  C: (f, a) => f(...a)
5005
4952
  });
5006
4953
  log16("resetting...", void 0, {
5007
- F: __dxlog_file18,
4954
+ F: __dxlog_file17,
5008
4955
  L: 342,
5009
4956
  S: this,
5010
4957
  C: (f, a) => f(...a)
@@ -5012,7 +4959,7 @@ var ClientServicesHost = class ClientServicesHost2 {
5012
4959
  await this._serviceContext?.close();
5013
4960
  await this._storage.reset();
5014
4961
  log16("reset", void 0, {
5015
- F: __dxlog_file18,
4962
+ F: __dxlog_file17,
5016
4963
  L: 345,
5017
4964
  S: this,
5018
4965
  C: (f, a) => f(...a)
@@ -5020,7 +4967,7 @@ var ClientServicesHost = class ClientServicesHost2 {
5020
4967
  log16.trace("dxos.sdk.client-services-host.reset", trace8.end({
5021
4968
  id: traceId
5022
4969
  }), {
5023
- F: __dxlog_file18,
4970
+ F: __dxlog_file17,
5024
4971
  L: 346,
5025
4972
  S: this,
5026
4973
  C: (f, a) => f(...a)
@@ -5098,4 +5045,4 @@ export {
5098
5045
  createDefaultModelFactory,
5099
5046
  ClientServicesHost
5100
5047
  };
5101
- //# sourceMappingURL=chunk-WOH6JPED.mjs.map
5048
+ //# sourceMappingURL=chunk-KLSDV4XQ.mjs.map