@dxos/client-services 0.3.5-main.d53523e → 0.3.5-main.d8a95f3

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 (34) hide show
  1. package/dist/lib/browser/{chunk-JH47XLVT.mjs → chunk-3ITXWBCY.mjs} +68 -43
  2. package/dist/lib/browser/chunk-3ITXWBCY.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +3 -2
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/index.cjs +67 -42
  8. package/dist/lib/node/index.cjs.map +3 -3
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/packlets/testing/index.cjs +69 -43
  11. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  12. package/dist/types/src/packlets/identity/identity-service.d.ts +2 -1
  13. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  14. package/dist/types/src/packlets/services/service-context.d.ts +2 -0
  15. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  16. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  17. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -1
  18. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  19. package/dist/types/src/packlets/spaces/data-space.d.ts +2 -0
  20. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  21. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  22. package/dist/types/src/version.d.ts +1 -1
  23. package/package.json +35 -35
  24. package/src/packlets/identity/identity-service.ts +2 -0
  25. package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
  26. package/src/packlets/services/service-context.ts +12 -2
  27. package/src/packlets/services/service-host.ts +1 -0
  28. package/src/packlets/spaces/data-space-manager.ts +2 -1
  29. package/src/packlets/spaces/data-space.ts +13 -1
  30. package/src/packlets/spaces/genesis.ts +1 -1
  31. package/src/packlets/spaces/spaces-service.ts +1 -1
  32. package/src/packlets/testing/test-builder.ts +1 -0
  33. package/src/version.ts +1 -1
  34. package/dist/lib/browser/chunk-JH47XLVT.mjs.map +0 -7
@@ -185,7 +185,7 @@ var getPlatform = () => {
185
185
  };
186
186
 
187
187
  // packages/sdk/client-services/src/version.ts
188
- var DXOS_VERSION = "0.3.5-main.d53523e";
188
+ var DXOS_VERSION = "0.3.5-main.d8a95f3";
189
189
 
190
190
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
191
191
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -1008,10 +1008,11 @@ var import_debug3 = require("@dxos/debug");
1008
1008
  var import_invariant4 = require("@dxos/invariant");
1009
1009
  var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1010
1010
  var IdentityServiceImpl = class {
1011
- constructor(_createIdentity, _identityManager, _keyring) {
1011
+ constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
1012
1012
  this._createIdentity = _createIdentity;
1013
1013
  this._identityManager = _identityManager;
1014
1014
  this._keyring = _keyring;
1015
+ this._onProfileUpdate = _onProfileUpdate;
1015
1016
  }
1016
1017
  async createIdentity(request) {
1017
1018
  await this._createIdentity(request);
@@ -1042,7 +1043,7 @@ var IdentityServiceImpl = class {
1042
1043
  async updateProfile(profile) {
1043
1044
  (0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
1044
1045
  F: __dxlog_file5,
1045
- L: 59,
1046
+ L: 60,
1046
1047
  S: this,
1047
1048
  A: [
1048
1049
  "this._identityManager.identity",
@@ -1050,12 +1051,13 @@ var IdentityServiceImpl = class {
1050
1051
  ]
1051
1052
  });
1052
1053
  await this._identityManager.updateProfile(profile);
1054
+ await this._onProfileUpdate?.(this._identityManager.identity.profileDocument);
1053
1055
  return this._getIdentity();
1054
1056
  }
1055
1057
  async signPresentation({ presentation, nonce }) {
1056
1058
  (0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
1057
1059
  F: __dxlog_file5,
1058
- L: 65,
1060
+ L: 67,
1059
1061
  S: this,
1060
1062
  A: [
1061
1063
  "this._identityManager.identity",
@@ -2343,7 +2345,7 @@ var SpaceInvitationProtocol = class {
2343
2345
  }
2344
2346
  createIntroduction() {
2345
2347
  return {
2346
- profile: this._signingContext.profile
2348
+ profile: this._signingContext.getProfile()
2347
2349
  };
2348
2350
  }
2349
2351
  async createAdmissionRequest() {
@@ -2974,6 +2976,21 @@ var DataSpace = class DataSpace2 {
2974
2976
  await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
2975
2977
  }
2976
2978
  }
2979
+ // TODO(dmaretskyi): Use profile from signing context.
2980
+ async updateOwnProfile(profile) {
2981
+ const credential = await this._signingContext.credentialSigner.createCredential({
2982
+ subject: this._signingContext.identityKey,
2983
+ assertion: {
2984
+ "@type": "dxos.halo.credentials.MemberProfile",
2985
+ profile
2986
+ }
2987
+ });
2988
+ await this.inner.controlPipeline.writer.write({
2989
+ credential: {
2990
+ credential
2991
+ }
2992
+ });
2993
+ }
2977
2994
  async createEpoch() {
2978
2995
  const epoch = await this.dataPipeline.createEpoch();
2979
2996
  const receipt = await this.inner.controlPipeline.writer.write({
@@ -3022,7 +3039,7 @@ var DataSpace = class DataSpace2 {
3022
3039
  state: import_services7.SpaceState[this._state]
3023
3040
  }, {
3024
3041
  F: __dxlog_file12,
3025
- L: 392,
3042
+ L: 404,
3026
3043
  S: this,
3027
3044
  C: (f, a) => f(...a)
3028
3045
  });
@@ -3082,7 +3099,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
3082
3099
  "@type": "dxos.halo.credentials.SpaceMember",
3083
3100
  spaceKey: space.key,
3084
3101
  role: import_credentials13.SpaceMember.Role.ADMIN,
3085
- profile: signingContext.profile,
3102
+ profile: signingContext.getProfile(),
3086
3103
  genesisFeedKey: space.controlFeedKey ?? (0, import_debug5.failUndefined)()
3087
3104
  }
3088
3105
  }),
@@ -3162,7 +3179,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3162
3179
  async open() {
3163
3180
  (0, import_log11.log)("open", void 0, {
3164
3181
  F: __dxlog_file13,
3165
- L: 82,
3182
+ L: 83,
3166
3183
  S: this,
3167
3184
  C: (f, a) => f(...a)
3168
3185
  });
@@ -3170,7 +3187,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3170
3187
  id: this._instanceId
3171
3188
  }), {
3172
3189
  F: __dxlog_file13,
3173
- L: 83,
3190
+ L: 84,
3174
3191
  S: this,
3175
3192
  C: (f, a) => f(...a)
3176
3193
  });
@@ -3178,7 +3195,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3178
3195
  spaces: this._metadataStore.spaces.length
3179
3196
  }, {
3180
3197
  F: __dxlog_file13,
3181
- L: 84,
3198
+ L: 85,
3182
3199
  S: this,
3183
3200
  C: (f, a) => f(...a)
3184
3201
  });
@@ -3188,7 +3205,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3188
3205
  spaceMetadata
3189
3206
  }, {
3190
3207
  F: __dxlog_file13,
3191
- L: 88,
3208
+ L: 89,
3192
3209
  S: this,
3193
3210
  C: (f, a) => f(...a)
3194
3211
  });
@@ -3199,7 +3216,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3199
3216
  err
3200
3217
  }, {
3201
3218
  F: __dxlog_file13,
3202
- L: 91,
3219
+ L: 92,
3203
3220
  S: this,
3204
3221
  C: (f, a) => f(...a)
3205
3222
  });
@@ -3216,7 +3233,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3216
3233
  id: this._instanceId
3217
3234
  }), {
3218
3235
  F: __dxlog_file13,
3219
- L: 104,
3236
+ L: 105,
3220
3237
  S: this,
3221
3238
  C: (f, a) => f(...a)
3222
3239
  });
@@ -3224,7 +3241,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3224
3241
  async close() {
3225
3242
  (0, import_log11.log)("close", void 0, {
3226
3243
  F: __dxlog_file13,
3227
- L: 109,
3244
+ L: 110,
3228
3245
  S: this,
3229
3246
  C: (f, a) => f(...a)
3230
3247
  });
@@ -3240,7 +3257,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3240
3257
  async createSpace() {
3241
3258
  (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3242
3259
  F: __dxlog_file13,
3243
- L: 122,
3260
+ L: 123,
3244
3261
  S: this,
3245
3262
  A: [
3246
3263
  "this._isOpen",
@@ -3261,7 +3278,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3261
3278
  spaceKey
3262
3279
  }, {
3263
3280
  F: __dxlog_file13,
3264
- L: 134,
3281
+ L: 135,
3265
3282
  S: this,
3266
3283
  C: (f, a) => f(...a)
3267
3284
  });
@@ -3271,7 +3288,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3271
3288
  const memberCredential = credentials[1];
3272
3289
  (0, import_invariant11.invariant)((0, import_credentials14.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3273
3290
  F: __dxlog_file13,
3274
- L: 141,
3291
+ L: 142,
3275
3292
  S: this,
3276
3293
  A: [
3277
3294
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3289,13 +3306,13 @@ var DataSpaceManager = class DataSpaceManager2 {
3289
3306
  opts
3290
3307
  }, {
3291
3308
  F: __dxlog_file13,
3292
- L: 153,
3309
+ L: 154,
3293
3310
  S: this,
3294
3311
  C: (f, a) => f(...a)
3295
3312
  });
3296
3313
  (0, import_invariant11.invariant)(this._isOpen, "Not open.", {
3297
3314
  F: __dxlog_file13,
3298
- L: 154,
3315
+ L: 155,
3299
3316
  S: this,
3300
3317
  A: [
3301
3318
  "this._isOpen",
@@ -3304,7 +3321,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3304
3321
  });
3305
3322
  (0, import_invariant11.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3306
3323
  F: __dxlog_file13,
3307
- L: 155,
3324
+ L: 156,
3308
3325
  S: this,
3309
3326
  A: [
3310
3327
  "!this._spaces.has(opts.spaceKey)",
@@ -3339,7 +3356,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3339
3356
  metadata
3340
3357
  }, {
3341
3358
  F: __dxlog_file13,
3342
- L: 188,
3359
+ L: 189,
3343
3360
  S: this,
3344
3361
  C: (f, a) => f(...a)
3345
3362
  });
@@ -3375,7 +3392,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3375
3392
  onAuthFailure: () => {
3376
3393
  import_log11.log.warn("auth failure", void 0, {
3377
3394
  F: __dxlog_file13,
3378
- L: 223,
3395
+ L: 224,
3379
3396
  S: this,
3380
3397
  C: (f, a) => f(...a)
3381
3398
  });
@@ -3399,7 +3416,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3399
3416
  space: space.key
3400
3417
  }, {
3401
3418
  F: __dxlog_file13,
3402
- L: 241,
3419
+ L: 242,
3403
3420
  S: this,
3404
3421
  C: (f, a) => f(...a)
3405
3422
  });
@@ -3411,7 +3428,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3411
3428
  open: this._isOpen
3412
3429
  }, {
3413
3430
  F: __dxlog_file13,
3414
- L: 248,
3431
+ L: 249,
3415
3432
  S: this,
3416
3433
  C: (f, a) => f(...a)
3417
3434
  });
@@ -3424,7 +3441,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3424
3441
  space: space.key
3425
3442
  }, {
3426
3443
  F: __dxlog_file13,
3427
- L: 254,
3444
+ L: 255,
3428
3445
  S: this,
3429
3446
  C: (f, a) => f(...a)
3430
3447
  });
@@ -3668,7 +3685,7 @@ var SpacesServiceImpl = class {
3668
3685
  identity: {
3669
3686
  identityKey: member.key,
3670
3687
  profile: {
3671
- displayName: member.assertion.profile?.displayName
3688
+ displayName: member.profile?.displayName
3672
3689
  }
3673
3690
  },
3674
3691
  presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
@@ -3813,6 +3830,14 @@ var ServiceContext = class ServiceContext2 {
3813
3830
  });
3814
3831
  return factory(invitation);
3815
3832
  }
3833
+ async broadcastProfileUpdate(profile) {
3834
+ if (!profile || !this.dataSpaceManager) {
3835
+ return;
3836
+ }
3837
+ for (const space of this.dataSpaceManager.spaces.values()) {
3838
+ await space.updateOwnProfile(profile);
3839
+ }
3840
+ }
3816
3841
  async _acceptIdentity(params) {
3817
3842
  const identity = await this.identityManager.acceptIdentity(params);
3818
3843
  await this._initialize(new import_context8.Context());
@@ -3828,7 +3853,7 @@ var ServiceContext = class ServiceContext2 {
3828
3853
  async _initialize(ctx) {
3829
3854
  (0, import_log13.log)("initializing spaces...", void 0, {
3830
3855
  F: __dxlog_file15,
3831
- L: 189,
3856
+ L: 199,
3832
3857
  S: this,
3833
3858
  C: (f, a) => f(...a)
3834
3859
  });
@@ -3837,7 +3862,7 @@ var ServiceContext = class ServiceContext2 {
3837
3862
  credentialSigner: identity.getIdentityCredentialSigner(),
3838
3863
  identityKey: identity.identityKey,
3839
3864
  deviceKey: identity.deviceKey,
3840
- profile: identity.profileDocument,
3865
+ getProfile: () => identity.profileDocument,
3841
3866
  recordCredential: async (credential) => {
3842
3867
  await identity.controlPipeline.writer.write({
3843
3868
  credential: {
@@ -3851,7 +3876,7 @@ var ServiceContext = class ServiceContext2 {
3851
3876
  this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3852
3877
  (0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
3853
3878
  F: __dxlog_file15,
3854
- L: 212,
3879
+ L: 222,
3855
3880
  S: this,
3856
3881
  A: [
3857
3882
  "this.dataSpaceManager",
@@ -3875,7 +3900,7 @@ var ServiceContext = class ServiceContext2 {
3875
3900
  details: assertion
3876
3901
  }, {
3877
3902
  F: __dxlog_file15,
3878
- L: 228,
3903
+ L: 238,
3879
3904
  S: this,
3880
3905
  C: (f, a) => f(...a)
3881
3906
  });
@@ -3886,7 +3911,7 @@ var ServiceContext = class ServiceContext2 {
3886
3911
  details: assertion
3887
3912
  }, {
3888
3913
  F: __dxlog_file15,
3889
- L: 232,
3914
+ L: 242,
3890
3915
  S: this,
3891
3916
  C: (f, a) => f(...a)
3892
3917
  });
@@ -3897,7 +3922,7 @@ var ServiceContext = class ServiceContext2 {
3897
3922
  details: assertion
3898
3923
  }, {
3899
3924
  F: __dxlog_file15,
3900
- L: 237,
3925
+ L: 247,
3901
3926
  S: this,
3902
3927
  C: (f, a) => f(...a)
3903
3928
  });
@@ -3908,7 +3933,7 @@ var ServiceContext = class ServiceContext2 {
3908
3933
  } catch (err) {
3909
3934
  import_log13.log.catch(err, void 0, {
3910
3935
  F: __dxlog_file15,
3911
- L: 243,
3936
+ L: 253,
3912
3937
  S: this,
3913
3938
  C: (f, a) => f(...a)
3914
3939
  });
@@ -4863,7 +4888,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4863
4888
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4864
4889
  this._serviceRegistry.setServices({
4865
4890
  SystemService: this._systemService,
4866
- IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
4891
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
4867
4892
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4868
4893
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4869
4894
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
@@ -4900,7 +4925,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4900
4925
  deviceKey
4901
4926
  }, {
4902
4927
  F: __dxlog_file17,
4903
- L: 316,
4928
+ L: 317,
4904
4929
  S: this,
4905
4930
  C: (f, a) => f(...a)
4906
4931
  });
@@ -4908,7 +4933,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4908
4933
  id: traceId
4909
4934
  }), {
4910
4935
  F: __dxlog_file17,
4911
- L: 317,
4936
+ L: 318,
4912
4937
  S: this,
4913
4938
  C: (f, a) => f(...a)
4914
4939
  });
@@ -4922,7 +4947,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4922
4947
  deviceKey
4923
4948
  }, {
4924
4949
  F: __dxlog_file17,
4925
- L: 328,
4950
+ L: 329,
4926
4951
  S: this,
4927
4952
  C: (f, a) => f(...a)
4928
4953
  });
@@ -4938,7 +4963,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4938
4963
  deviceKey
4939
4964
  }, {
4940
4965
  F: __dxlog_file17,
4941
- L: 335,
4966
+ L: 336,
4942
4967
  S: this,
4943
4968
  C: (f, a) => f(...a)
4944
4969
  });
@@ -4949,13 +4974,13 @@ var ClientServicesHost = class ClientServicesHost2 {
4949
4974
  id: traceId
4950
4975
  }), {
4951
4976
  F: __dxlog_file17,
4952
- L: 340,
4977
+ L: 341,
4953
4978
  S: this,
4954
4979
  C: (f, a) => f(...a)
4955
4980
  });
4956
4981
  (0, import_log16.log)("resetting...", void 0, {
4957
4982
  F: __dxlog_file17,
4958
- L: 342,
4983
+ L: 343,
4959
4984
  S: this,
4960
4985
  C: (f, a) => f(...a)
4961
4986
  });
@@ -4963,7 +4988,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4963
4988
  await this._storage.reset();
4964
4989
  (0, import_log16.log)("reset", void 0, {
4965
4990
  F: __dxlog_file17,
4966
- L: 345,
4991
+ L: 346,
4967
4992
  S: this,
4968
4993
  C: (f, a) => f(...a)
4969
4994
  });
@@ -4971,7 +4996,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4971
4996
  id: traceId
4972
4997
  }), {
4973
4998
  F: __dxlog_file17,
4974
- L: 346,
4999
+ L: 347,
4975
5000
  S: this,
4976
5001
  C: (f, a) => f(...a)
4977
5002
  });
@@ -5332,7 +5357,8 @@ var createSigningContext = async (keyring) => {
5332
5357
  credential: await new import_credentials16.CredentialGenerator(keyring, identityKey, deviceKey).createDeviceAuthorization(deviceKey)
5333
5358
  }, deviceKey),
5334
5359
  recordCredential: async () => {
5335
- }
5360
+ },
5361
+ getProfile: () => void 0
5336
5362
  };
5337
5363
  };
5338
5364
  // Annotate the CommonJS export names for ESM import in node: