@dxos/client-services 0.3.2-main.14bd43d → 0.3.2-main.1fea52c

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
  });
@@ -2241,15 +2208,6 @@ var InvitationsServiceImpl = class {
2241
2208
  await accepted.cancel();
2242
2209
  this._acceptInvitations.delete(invitationId);
2243
2210
  this._removedAccepted.emit(accepted.get());
2244
- } else {
2245
- log6.warn("invalid invitation", {
2246
- invitationId
2247
- }, {
2248
- F: __dxlog_file8,
2249
- L: 132,
2250
- S: this,
2251
- C: (f, a) => f(...a)
2252
- });
2253
2211
  }
2254
2212
  }
2255
2213
  queryInvitations() {
@@ -2537,10 +2495,10 @@ var getPlatform = () => {
2537
2495
  };
2538
2496
  }
2539
2497
  } else {
2540
- const { platform, version, arch } = process;
2498
+ const { platform: platform2, version, arch } = process;
2541
2499
  return {
2542
2500
  type: "node",
2543
- platform: `${platform} ${version} ${arch}`,
2501
+ platform: `${platform2} ${version} ${arch}`,
2544
2502
  runtime: process.version,
2545
2503
  uptime: Math.floor(process.uptime()),
2546
2504
  memory: process.memoryUsage()
@@ -2549,7 +2507,7 @@ var getPlatform = () => {
2549
2507
  };
2550
2508
 
2551
2509
  // packages/sdk/client-services/src/version.ts
2552
- var DXOS_VERSION = "0.3.2-main.14bd43d";
2510
+ var DXOS_VERSION = "0.3.2-main.1fea52c";
2553
2511
 
2554
2512
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2555
2513
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -4414,7 +4372,7 @@ import { Context as Context10 } from "@dxos/context";
4414
4372
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4415
4373
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4416
4374
  import { base } from "@dxos/echo-schema";
4417
- import { invariant as invariant15 } from "@dxos/invariant";
4375
+ import { invariant as invariant14 } from "@dxos/invariant";
4418
4376
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4419
4377
  import { log as log16 } from "@dxos/log";
4420
4378
  import { WebsocketSignalManager } from "@dxos/messaging";
@@ -4429,33 +4387,13 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4429
4387
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4430
4388
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
4431
4389
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
4432
- import { invariant as invariant14 } from "@dxos/invariant";
4433
4390
  import { DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
4434
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
4435
4391
  var DevicesServiceImpl = class {
4436
4392
  constructor(_identityManager) {
4437
4393
  this._identityManager = _identityManager;
4438
4394
  }
4439
4395
  async updateDevice(profile) {
4440
- invariant14(this._identityManager.identity, "Identity not initialized", {
4441
- F: __dxlog_file17,
4442
- L: 17,
4443
- S: this,
4444
- A: [
4445
- "this._identityManager.identity",
4446
- "'Identity not initialized'"
4447
- ]
4448
- });
4449
- const deviceKey = this._identityManager.identity.deviceKey;
4450
- await this._identityManager.updateDevice({
4451
- deviceKey,
4452
- profile
4453
- });
4454
- return {
4455
- deviceKey,
4456
- kind: DeviceKind.CURRENT,
4457
- profile
4458
- };
4396
+ throw new Error("Method not implemented.");
4459
4397
  }
4460
4398
  queryDevices() {
4461
4399
  return new Stream11(({ next }) => {
@@ -4704,7 +4642,7 @@ function _ts_decorate7(decorators, target, key, desc) {
4704
4642
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4705
4643
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4706
4644
  }
4707
- 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";
4708
4646
  var createDefaultModelFactory = () => {
4709
4647
  return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
4710
4648
  };
@@ -4804,8 +4742,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4804
4742
  * Can only be called once.
4805
4743
  */
4806
4744
  initialize({ config, ...options }) {
4807
- invariant15(!this._open, "service host is open", {
4808
- F: __dxlog_file18,
4745
+ invariant14(!this._open, "service host is open", {
4746
+ F: __dxlog_file17,
4809
4747
  L: 201,
4810
4748
  S: this,
4811
4749
  A: [
@@ -4814,14 +4752,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4814
4752
  ]
4815
4753
  });
4816
4754
  log16("initializing...", void 0, {
4817
- F: __dxlog_file18,
4755
+ F: __dxlog_file17,
4818
4756
  L: 202,
4819
4757
  S: this,
4820
4758
  C: (f, a) => f(...a)
4821
4759
  });
4822
4760
  if (config) {
4823
- invariant15(!this._config, "config already set", {
4824
- F: __dxlog_file18,
4761
+ invariant14(!this._config, "config already set", {
4762
+ F: __dxlog_file17,
4825
4763
  L: 205,
4826
4764
  S: this,
4827
4765
  A: [
@@ -4838,8 +4776,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4838
4776
  iceServers: this._config?.get("runtime.services.ice")
4839
4777
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4840
4778
  this._signalManager = signalManager;
4841
- invariant15(!this._networkManager, "network manager already set", {
4842
- F: __dxlog_file18,
4779
+ invariant14(!this._networkManager, "network manager already set", {
4780
+ F: __dxlog_file17,
4843
4781
  L: 221,
4844
4782
  S: this,
4845
4783
  A: [
@@ -4853,7 +4791,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4853
4791
  signalManager
4854
4792
  });
4855
4793
  log16("initialized", void 0, {
4856
- F: __dxlog_file18,
4794
+ F: __dxlog_file17,
4857
4795
  L: 228,
4858
4796
  S: this,
4859
4797
  C: (f, a) => f(...a)
@@ -4867,13 +4805,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4867
4805
  log16.trace("dxos.client-services.host.open", trace8.begin({
4868
4806
  id: traceId
4869
4807
  }), {
4870
- F: __dxlog_file18,
4808
+ F: __dxlog_file17,
4871
4809
  L: 239,
4872
4810
  S: this,
4873
4811
  C: (f, a) => f(...a)
4874
4812
  });
4875
- invariant15(this._config, "config not set", {
4876
- F: __dxlog_file18,
4813
+ invariant14(this._config, "config not set", {
4814
+ F: __dxlog_file17,
4877
4815
  L: 241,
4878
4816
  S: this,
4879
4817
  A: [
@@ -4881,8 +4819,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4881
4819
  "'config not set'"
4882
4820
  ]
4883
4821
  });
4884
- invariant15(this._storage, "storage not set", {
4885
- F: __dxlog_file18,
4822
+ invariant14(this._storage, "storage not set", {
4823
+ F: __dxlog_file17,
4886
4824
  L: 242,
4887
4825
  S: this,
4888
4826
  A: [
@@ -4890,8 +4828,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4890
4828
  "'storage not set'"
4891
4829
  ]
4892
4830
  });
4893
- invariant15(this._signalManager, "signal manager not set", {
4894
- F: __dxlog_file18,
4831
+ invariant14(this._signalManager, "signal manager not set", {
4832
+ F: __dxlog_file17,
4895
4833
  L: 243,
4896
4834
  S: this,
4897
4835
  A: [
@@ -4899,8 +4837,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4899
4837
  "'signal manager not set'"
4900
4838
  ]
4901
4839
  });
4902
- invariant15(this._networkManager, "network manager not set", {
4903
- F: __dxlog_file18,
4840
+ invariant14(this._networkManager, "network manager not set", {
4841
+ F: __dxlog_file17,
4904
4842
  L: 244,
4905
4843
  S: this,
4906
4844
  A: [
@@ -4912,7 +4850,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4912
4850
  log16("opening...", {
4913
4851
  lockKey: this._resourceLock?.lockKey
4914
4852
  }, {
4915
- F: __dxlog_file18,
4853
+ F: __dxlog_file17,
4916
4854
  L: 247,
4917
4855
  S: this,
4918
4856
  C: (f, a) => f(...a)
@@ -4958,7 +4896,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4958
4896
  log16("opened", {
4959
4897
  deviceKey
4960
4898
  }, {
4961
- F: __dxlog_file18,
4899
+ F: __dxlog_file17,
4962
4900
  L: 316,
4963
4901
  S: this,
4964
4902
  C: (f, a) => f(...a)
@@ -4966,7 +4904,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4966
4904
  log16.trace("dxos.client-services.host.open", trace8.end({
4967
4905
  id: traceId
4968
4906
  }), {
4969
- F: __dxlog_file18,
4907
+ F: __dxlog_file17,
4970
4908
  L: 317,
4971
4909
  S: this,
4972
4910
  C: (f, a) => f(...a)
@@ -4980,7 +4918,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4980
4918
  log16("closing...", {
4981
4919
  deviceKey
4982
4920
  }, {
4983
- F: __dxlog_file18,
4921
+ F: __dxlog_file17,
4984
4922
  L: 328,
4985
4923
  S: this,
4986
4924
  C: (f, a) => f(...a)
@@ -4996,7 +4934,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4996
4934
  log16("closed", {
4997
4935
  deviceKey
4998
4936
  }, {
4999
- F: __dxlog_file18,
4937
+ F: __dxlog_file17,
5000
4938
  L: 335,
5001
4939
  S: this,
5002
4940
  C: (f, a) => f(...a)
@@ -5007,13 +4945,13 @@ var ClientServicesHost = class ClientServicesHost2 {
5007
4945
  log16.trace("dxos.sdk.client-services-host.reset", trace8.begin({
5008
4946
  id: traceId
5009
4947
  }), {
5010
- F: __dxlog_file18,
4948
+ F: __dxlog_file17,
5011
4949
  L: 340,
5012
4950
  S: this,
5013
4951
  C: (f, a) => f(...a)
5014
4952
  });
5015
4953
  log16("resetting...", void 0, {
5016
- F: __dxlog_file18,
4954
+ F: __dxlog_file17,
5017
4955
  L: 342,
5018
4956
  S: this,
5019
4957
  C: (f, a) => f(...a)
@@ -5021,7 +4959,7 @@ var ClientServicesHost = class ClientServicesHost2 {
5021
4959
  await this._serviceContext?.close();
5022
4960
  await this._storage.reset();
5023
4961
  log16("reset", void 0, {
5024
- F: __dxlog_file18,
4962
+ F: __dxlog_file17,
5025
4963
  L: 345,
5026
4964
  S: this,
5027
4965
  C: (f, a) => f(...a)
@@ -5029,7 +4967,7 @@ var ClientServicesHost = class ClientServicesHost2 {
5029
4967
  log16.trace("dxos.sdk.client-services-host.reset", trace8.end({
5030
4968
  id: traceId
5031
4969
  }), {
5032
- F: __dxlog_file18,
4970
+ F: __dxlog_file17,
5033
4971
  L: 346,
5034
4972
  S: this,
5035
4973
  C: (f, a) => f(...a)
@@ -5107,4 +5045,4 @@ export {
5107
5045
  createDefaultModelFactory,
5108
5046
  ClientServicesHost
5109
5047
  };
5110
- //# sourceMappingURL=chunk-D5YLUKQN.mjs.map
5048
+ //# sourceMappingURL=chunk-OOUZHR3C.mjs.map