@dxos/client-services 0.5.1-next.ed1615e → 0.5.2-main.2408cc7

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 (30) hide show
  1. package/dist/lib/browser/{chunk-2OVWTOUO.mjs → chunk-SEUHDCKP.mjs} +144 -123
  2. package/dist/lib/browser/chunk-SEUHDCKP.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 +1 -1
  6. package/dist/lib/node/{chunk-E4YEV4RS.cjs → chunk-C3Q243UW.cjs} +166 -145
  7. package/dist/lib/node/chunk-C3Q243UW.cjs.map +7 -0
  8. package/dist/lib/node/index.cjs +43 -43
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/packlets/testing/index.cjs +8 -8
  11. package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -1
  12. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
  13. package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
  14. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  15. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  16. package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -1
  17. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  18. package/dist/types/src/version.d.ts +1 -1
  19. package/package.json +36 -36
  20. package/src/packlets/diagnostics/diagnostics-collector.ts +14 -9
  21. package/src/packlets/diagnostics/diagnostics.ts +78 -68
  22. package/src/packlets/invitations/invitations-manager.ts +3 -0
  23. package/src/packlets/invitations/space-invitation-protocol.ts +4 -2
  24. package/src/packlets/services/service-host.ts +2 -2
  25. package/src/packlets/spaces/data-space.ts +2 -1
  26. package/src/packlets/spaces/genesis.ts +1 -1
  27. package/src/packlets/spaces/spaces-service.ts +12 -6
  28. package/src/version.ts +1 -1
  29. package/dist/lib/browser/chunk-2OVWTOUO.mjs.map +0 -7
  30. package/dist/lib/node/chunk-E4YEV4RS.cjs.map +0 -7
@@ -2594,7 +2594,7 @@ var SpaceInvitationProtocol = class {
2594
2594
  ""
2595
2595
  ]
2596
2596
  });
2597
- const space = await this._spaceManager.spaces.get(this._spaceKey);
2597
+ const space = this._spaceManager.spaces.get(this._spaceKey);
2598
2598
  invariant9(space, void 0, {
2599
2599
  F: __dxlog_file10,
2600
2600
  L: 58,
@@ -2623,10 +2623,10 @@ var SpaceInvitationProtocol = class {
2623
2623
  S: this,
2624
2624
  C: (f, a) => f(...a)
2625
2625
  });
2626
- const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile, invitation.delegationCredentialId);
2626
+ const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, invitation.role ?? SpaceMember.Role.ADMIN, space.inner.spaceState.membershipChainHeads, guestProfile, invitation.delegationCredentialId);
2627
2627
  invariant9(credentials[0].credential, void 0, {
2628
2628
  F: __dxlog_file10,
2629
- L: 75,
2629
+ L: 77,
2630
2630
  S: this,
2631
2631
  A: [
2632
2632
  "credentials[0].credential",
@@ -2636,7 +2636,7 @@ var SpaceInvitationProtocol = class {
2636
2636
  const spaceMemberCredential = credentials[0].credential.credential;
2637
2637
  invariant9(getCredentialAssertion(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2638
2638
  F: __dxlog_file10,
2639
- L: 77,
2639
+ L: 79,
2640
2640
  S: this,
2641
2641
  A: [
2642
2642
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2654,7 +2654,7 @@ var SpaceInvitationProtocol = class {
2654
2654
  async delegate(invitation) {
2655
2655
  invariant9(this._spaceKey, void 0, {
2656
2656
  F: __dxlog_file10,
2657
- L: 90,
2657
+ L: 92,
2658
2658
  S: this,
2659
2659
  A: [
2660
2660
  "this._spaceKey",
@@ -2664,7 +2664,7 @@ var SpaceInvitationProtocol = class {
2664
2664
  const space = this._spaceManager.spaces.get(this._spaceKey);
2665
2665
  invariant9(space, void 0, {
2666
2666
  F: __dxlog_file10,
2667
- L: 92,
2667
+ L: 94,
2668
2668
  S: this,
2669
2669
  A: [
2670
2670
  "space",
@@ -2674,7 +2674,7 @@ var SpaceInvitationProtocol = class {
2674
2674
  if (invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY) {
2675
2675
  invariant9(invitation.guestKeypair?.publicKey, void 0, {
2676
2676
  F: __dxlog_file10,
2677
- L: 94,
2677
+ L: 96,
2678
2678
  S: this,
2679
2679
  A: [
2680
2680
  "invitation.guestKeypair?.publicKey",
@@ -2687,7 +2687,7 @@ var SpaceInvitationProtocol = class {
2687
2687
  id: invitation.invitationId
2688
2688
  }, {
2689
2689
  F: __dxlog_file10,
2690
- L: 97,
2690
+ L: 99,
2691
2691
  S: this,
2692
2692
  C: (f, a) => f(...a)
2693
2693
  });
@@ -2695,14 +2695,14 @@ var SpaceInvitationProtocol = class {
2695
2695
  invitationId: invitation.invitationId,
2696
2696
  authMethod: invitation.authMethod,
2697
2697
  swarmKey: invitation.swarmKey,
2698
- role: SpaceMember.Role.ADMIN,
2698
+ role: invitation.role ?? SpaceMember.Role.ADMIN,
2699
2699
  expiresOn: invitation.lifetime ? new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime) : void 0,
2700
2700
  multiUse: invitation.multiUse ?? false,
2701
2701
  guestKey: invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
2702
2702
  });
2703
2703
  invariant9(credential.credential, void 0, {
2704
2704
  F: __dxlog_file10,
2705
- L: 117,
2705
+ L: 119,
2706
2706
  S: this,
2707
2707
  A: [
2708
2708
  "credential.credential",
@@ -2717,7 +2717,7 @@ var SpaceInvitationProtocol = class {
2717
2717
  async cancelDelegation(invitation) {
2718
2718
  invariant9(this._spaceKey, void 0, {
2719
2719
  F: __dxlog_file10,
2720
- L: 123,
2720
+ L: 125,
2721
2721
  S: this,
2722
2722
  A: [
2723
2723
  "this._spaceKey",
@@ -2726,7 +2726,7 @@ var SpaceInvitationProtocol = class {
2726
2726
  });
2727
2727
  invariant9(invitation.type === Invitation5.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
2728
2728
  F: __dxlog_file10,
2729
- L: 124,
2729
+ L: 126,
2730
2730
  S: this,
2731
2731
  A: [
2732
2732
  "invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
@@ -2736,7 +2736,7 @@ var SpaceInvitationProtocol = class {
2736
2736
  const space = this._spaceManager.spaces.get(this._spaceKey);
2737
2737
  invariant9(space, void 0, {
2738
2738
  F: __dxlog_file10,
2739
- L: 126,
2739
+ L: 128,
2740
2740
  S: this,
2741
2741
  A: [
2742
2742
  "space",
@@ -2748,14 +2748,14 @@ var SpaceInvitationProtocol = class {
2748
2748
  id: invitation.invitationId
2749
2749
  }, {
2750
2750
  F: __dxlog_file10,
2751
- L: 128,
2751
+ L: 130,
2752
2752
  S: this,
2753
2753
  C: (f, a) => f(...a)
2754
2754
  });
2755
2755
  const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
2756
2756
  invariant9(credential.credential, void 0, {
2757
2757
  F: __dxlog_file10,
2758
- L: 135,
2758
+ L: 137,
2759
2759
  S: this,
2760
2760
  A: [
2761
2761
  "credential.credential",
@@ -2791,7 +2791,7 @@ var SpaceInvitationProtocol = class {
2791
2791
  async accept(response) {
2792
2792
  invariant9(response.space, void 0, {
2793
2793
  F: __dxlog_file10,
2794
- L: 167,
2794
+ L: 169,
2795
2795
  S: this,
2796
2796
  A: [
2797
2797
  "response.space",
@@ -2802,7 +2802,7 @@ var SpaceInvitationProtocol = class {
2802
2802
  const assertion = getCredentialAssertion(credential);
2803
2803
  invariant9(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
2804
2804
  F: __dxlog_file10,
2805
- L: 170,
2805
+ L: 172,
2806
2806
  S: this,
2807
2807
  A: [
2808
2808
  "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2811,7 +2811,7 @@ var SpaceInvitationProtocol = class {
2811
2811
  });
2812
2812
  invariant9(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
2813
2813
  F: __dxlog_file10,
2814
- L: 171,
2814
+ L: 173,
2815
2815
  S: this,
2816
2816
  A: [
2817
2817
  "credential.subject.id.equals(this._signingContext.identityKey)",
@@ -2844,6 +2844,7 @@ import { invariant as invariant10 } from "@dxos/invariant";
2844
2844
  import { PublicKey as PublicKey8 } from "@dxos/keys";
2845
2845
  import { log as log9 } from "@dxos/log";
2846
2846
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
2847
+ import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
2847
2848
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
2848
2849
  var InvitationsManager = class {
2849
2850
  constructor(_invitationsHandler, _getHandler, _metadataStore) {
@@ -2884,7 +2885,7 @@ var InvitationsManager = class {
2884
2885
  } catch (err) {
2885
2886
  log9.catch(err, void 0, {
2886
2887
  F: __dxlog_file11,
2887
- L: 76,
2888
+ L: 77,
2888
2889
  S: this,
2889
2890
  C: (f, a) => f(...a)
2890
2891
  });
@@ -2907,7 +2908,7 @@ var InvitationsManager = class {
2907
2908
  const loadTasks = freshInvitations.map((persistentInvitation) => {
2908
2909
  invariant10(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
2909
2910
  F: __dxlog_file11,
2910
- L: 97,
2911
+ L: 98,
2911
2912
  S: this,
2912
2913
  A: [
2913
2914
  "!this._createInvitations.get(persistentInvitation.invitationId)",
@@ -2926,7 +2927,7 @@ var InvitationsManager = class {
2926
2927
  } catch (err) {
2927
2928
  log9.catch(err, void 0, {
2928
2929
  F: __dxlog_file11,
2929
- L: 104,
2930
+ L: 105,
2930
2931
  S: this,
2931
2932
  C: (f, a) => f(...a)
2932
2933
  });
@@ -2958,13 +2959,13 @@ var InvitationsManager = class {
2958
2959
  async authenticate({ invitationId, authCode }) {
2959
2960
  log9("authenticating...", void 0, {
2960
2961
  F: __dxlog_file11,
2961
- L: 134,
2962
+ L: 135,
2962
2963
  S: this,
2963
2964
  C: (f, a) => f(...a)
2964
2965
  });
2965
2966
  invariant10(invitationId, void 0, {
2966
2967
  F: __dxlog_file11,
2967
- L: 135,
2968
+ L: 136,
2968
2969
  S: this,
2969
2970
  A: [
2970
2971
  "invitationId",
@@ -2977,7 +2978,7 @@ var InvitationsManager = class {
2977
2978
  invitationId
2978
2979
  }, {
2979
2980
  F: __dxlog_file11,
2980
- L: 138,
2981
+ L: 139,
2981
2982
  S: this,
2982
2983
  C: (f, a) => f(...a)
2983
2984
  });
@@ -2990,13 +2991,13 @@ var InvitationsManager = class {
2990
2991
  invitationId
2991
2992
  }, {
2992
2993
  F: __dxlog_file11,
2993
- L: 145,
2994
+ L: 146,
2994
2995
  S: this,
2995
2996
  C: (f, a) => f(...a)
2996
2997
  });
2997
2998
  invariant10(invitationId, void 0, {
2998
2999
  F: __dxlog_file11,
2999
- L: 146,
3000
+ L: 147,
3000
3001
  S: this,
3001
3002
  A: [
3002
3003
  "invitationId",
@@ -3042,7 +3043,7 @@ var InvitationsManager = class {
3042
3043
  }
3043
3044
  }
3044
3045
  _createInvitation(protocol, options) {
3045
- const { invitationId = PublicKey8.random().toHex(), type = Invitation6.Type.INTERACTIVE, authMethod = Invitation6.AuthMethod.SHARED_SECRET, state = Invitation6.State.INIT, timeout = INVITATION_TIMEOUT2, swarmKey = PublicKey8.random(), persistent = options?.authMethod !== Invitation6.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, lifetime = 86400, multiUse = false } = options ?? {};
3046
+ const { invitationId = PublicKey8.random().toHex(), type = Invitation6.Type.INTERACTIVE, authMethod = Invitation6.AuthMethod.SHARED_SECRET, state = Invitation6.State.INIT, timeout = INVITATION_TIMEOUT2, swarmKey = PublicKey8.random(), persistent = options?.authMethod !== Invitation6.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = SpaceMember2.Role.ADMIN, lifetime = 86400, multiUse = false } = options ?? {};
3046
3047
  const authCode = options?.authCode ?? (authMethod === Invitation6.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
3047
3048
  return {
3048
3049
  invitationId,
@@ -3056,6 +3057,7 @@ var InvitationsManager = class {
3056
3057
  guestKeypair: guestKeypair ?? (authMethod === Invitation6.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
3057
3058
  created,
3058
3059
  lifetime,
3060
+ role,
3059
3061
  multiUse,
3060
3062
  delegationCredentialId: options?.delegationCredentialId,
3061
3063
  ...protocol.getInvitationContext()
@@ -3074,7 +3076,7 @@ var InvitationsManager = class {
3074
3076
  ...handler.toJSON()
3075
3077
  }, {
3076
3078
  F: __dxlog_file11,
3077
- L: 233,
3079
+ L: 236,
3078
3080
  S: this,
3079
3081
  C: (f, a) => f(...a)
3080
3082
  });
@@ -3107,7 +3109,7 @@ var InvitationsManager = class {
3107
3109
  ...handler.toJSON()
3108
3110
  }, {
3109
3111
  F: __dxlog_file11,
3110
- L: 253,
3112
+ L: 256,
3111
3113
  S: this,
3112
3114
  C: (f, a) => f(...a)
3113
3115
  });
@@ -3118,7 +3120,7 @@ var InvitationsManager = class {
3118
3120
  } else {
3119
3121
  log9.warn("auth failed", err, {
3120
3122
  F: __dxlog_file11,
3121
- L: 256,
3123
+ L: 259,
3122
3124
  S: this,
3123
3125
  C: (f, a) => f(...a)
3124
3126
  });
@@ -3135,7 +3137,7 @@ var InvitationsManager = class {
3135
3137
  ...handler.toJSON()
3136
3138
  }, {
3137
3139
  F: __dxlog_file11,
3138
- L: 263,
3140
+ L: 266,
3139
3141
  S: this,
3140
3142
  C: (f, a) => f(...a)
3141
3143
  });
@@ -3180,7 +3182,7 @@ var InvitationsManager = class {
3180
3182
  } catch (err) {
3181
3183
  log9.catch(err, void 0, {
3182
3184
  F: __dxlog_file11,
3183
- L: 299,
3185
+ L: 302,
3184
3186
  S: this,
3185
3187
  C: (f, a) => f(...a)
3186
3188
  });
@@ -3287,6 +3289,7 @@ import { PublicKey as PublicKey10 } from "@dxos/keys";
3287
3289
  import { log as log11 } from "@dxos/log";
3288
3290
  import { CancelledError, SystemError } from "@dxos/protocols";
3289
3291
  import { SpaceState, CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
3292
+ import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
3290
3293
  import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
3291
3294
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
3292
3295
  import { trace as trace6 } from "@dxos/tracing";
@@ -3635,7 +3638,7 @@ var DataSpace = class {
3635
3638
  this._callbacks = params.callbacks ?? {};
3636
3639
  this._echoHost = params.echoHost;
3637
3640
  this.authVerifier = new TrustedKeySetAuthVerifier({
3638
- trustedKeysProvider: () => new ComplexSet5(PublicKey10.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
3641
+ trustedKeysProvider: () => new ComplexSet5(PublicKey10.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== SpaceMember3.Role.REMOVED).map((member) => member.key)),
3639
3642
  update: this._inner.stateUpdate,
3640
3643
  authTimeout: AUTH_TIMEOUT2
3641
3644
  });
@@ -3645,7 +3648,7 @@ var DataSpace = class {
3645
3648
  state: SpaceState[this._state]
3646
3649
  }, {
3647
3650
  F: __dxlog_file13,
3648
- L: 136,
3651
+ L: 137,
3649
3652
  S: this,
3650
3653
  C: (f, a) => f(...a)
3651
3654
  });
@@ -3695,7 +3698,7 @@ var DataSpace = class {
3695
3698
  state: SpaceState[this._state]
3696
3699
  }, {
3697
3700
  F: __dxlog_file13,
3698
- L: 194,
3701
+ L: 195,
3699
3702
  S: this,
3700
3703
  C: (f, a) => f(...a)
3701
3704
  });
@@ -3713,7 +3716,7 @@ var DataSpace = class {
3713
3716
  state: SpaceState[this._state]
3714
3717
  }, {
3715
3718
  F: __dxlog_file13,
3716
- L: 208,
3719
+ L: 209,
3717
3720
  S: this,
3718
3721
  C: (f, a) => f(...a)
3719
3722
  });
@@ -3745,7 +3748,7 @@ var DataSpace = class {
3745
3748
  if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
3746
3749
  log11("data pipeline initialization cancelled", err, {
3747
3750
  F: __dxlog_file13,
3748
- L: 241,
3751
+ L: 242,
3749
3752
  S: this,
3750
3753
  C: (f, a) => f(...a)
3751
3754
  });
@@ -3753,7 +3756,7 @@ var DataSpace = class {
3753
3756
  }
3754
3757
  log11.error("Error initializing data pipeline", err, {
3755
3758
  F: __dxlog_file13,
3756
- L: 245,
3759
+ L: 246,
3757
3760
  S: this,
3758
3761
  C: (f, a) => f(...a)
3759
3762
  });
@@ -3762,7 +3765,7 @@ var DataSpace = class {
3762
3765
  state: SpaceState[this._state]
3763
3766
  }, {
3764
3767
  F: __dxlog_file13,
3765
- L: 247,
3768
+ L: 248,
3766
3769
  S: this,
3767
3770
  C: (f, a) => f(...a)
3768
3771
  });
@@ -3782,7 +3785,7 @@ var DataSpace = class {
3782
3785
  state: SpaceState[this._state]
3783
3786
  }, {
3784
3787
  F: __dxlog_file13,
3785
- L: 263,
3788
+ L: 264,
3786
3789
  S: this,
3787
3790
  C: (f, a) => f(...a)
3788
3791
  });
@@ -3792,7 +3795,7 @@ var DataSpace = class {
3792
3795
  await cancelWithContext4(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3793
3796
  log11("data pipeline ready", void 0, {
3794
3797
  F: __dxlog_file13,
3795
- L: 275,
3798
+ L: 276,
3796
3799
  S: this,
3797
3800
  C: (f, a) => f(...a)
3798
3801
  });
@@ -3802,7 +3805,7 @@ var DataSpace = class {
3802
3805
  state: SpaceState[this._state]
3803
3806
  }, {
3804
3807
  F: __dxlog_file13,
3805
- L: 279,
3808
+ L: 280,
3806
3809
  S: this,
3807
3810
  C: (f, a) => f(...a)
3808
3811
  });
@@ -3818,7 +3821,7 @@ var DataSpace = class {
3818
3821
  await this._createWritableFeeds();
3819
3822
  log11("writable feeds created", void 0, {
3820
3823
  F: __dxlog_file13,
3821
- L: 295,
3824
+ L: 296,
3822
3825
  S: this,
3823
3826
  C: (f, a) => f(...a)
3824
3827
  });
@@ -3881,7 +3884,7 @@ var DataSpace = class {
3881
3884
  rootUrl
3882
3885
  }, {
3883
3886
  F: __dxlog_file13,
3884
- L: 361,
3887
+ L: 362,
3885
3888
  S: this,
3886
3889
  C: (f, a) => f(...a)
3887
3890
  });
@@ -3913,7 +3916,7 @@ var DataSpace = class {
3913
3916
  err
3914
3917
  }, {
3915
3918
  F: __dxlog_file13,
3916
- L: 384,
3919
+ L: 385,
3917
3920
  S: this,
3918
3921
  C: (f, a) => f(...a)
3919
3922
  });
@@ -3968,7 +3971,7 @@ var DataSpace = class {
3968
3971
  const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
3969
3972
  invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3970
3973
  F: __dxlog_file13,
3971
- L: 434,
3974
+ L: 435,
3972
3975
  S: this,
3973
3976
  A: [
3974
3977
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -3987,7 +3990,7 @@ var DataSpace = class {
3987
3990
  {
3988
3991
  log11.info("Fragmenting", void 0, {
3989
3992
  F: __dxlog_file13,
3990
- L: 446,
3993
+ L: 447,
3991
3994
  S: this,
3992
3995
  C: (f, a) => f(...a)
3993
3996
  });
@@ -3999,7 +4002,7 @@ var DataSpace = class {
3999
4002
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
4000
4003
  invariant12(properties, "Properties not found", {
4001
4004
  F: __dxlog_file13,
4002
- L: 456,
4005
+ L: 457,
4003
4006
  S: this,
4004
4007
  A: [
4005
4008
  "properties",
@@ -4015,7 +4018,7 @@ var DataSpace = class {
4015
4018
  const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
4016
4019
  invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4017
4020
  F: __dxlog_file13,
4018
- L: 461,
4021
+ L: 462,
4019
4022
  S: this,
4020
4023
  A: [
4021
4024
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4084,7 +4087,7 @@ var DataSpace = class {
4084
4087
  state: SpaceState[this._state]
4085
4088
  }, {
4086
4089
  F: __dxlog_file13,
4087
- L: 527,
4090
+ L: 528,
4088
4091
  S: this,
4089
4092
  C: (f, a) => f(...a)
4090
4093
  });
@@ -4152,7 +4155,7 @@ import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsyn
4152
4155
  // packages/sdk/client-services/src/packlets/spaces/genesis.ts
4153
4156
  import { createCredential } from "@dxos/credentials";
4154
4157
  import { failUndefined } from "@dxos/debug";
4155
- import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
4158
+ import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember4 } from "@dxos/protocols/proto/dxos/halo/credentials";
4156
4159
  import { Timeframe as Timeframe3 } from "@dxos/timeframe";
4157
4160
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4158
4161
  const credentials = [
@@ -4172,7 +4175,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4172
4175
  assertion: {
4173
4176
  "@type": "dxos.halo.credentials.SpaceMember",
4174
4177
  spaceKey: space.key,
4175
- role: SpaceMember2.Role.ADMIN,
4178
+ role: SpaceMember4.Role.OWNER,
4176
4179
  profile: signingContext.getProfile(),
4177
4180
  genesisFeedKey: space.controlFeedKey ?? failUndefined()
4178
4181
  }
@@ -4605,7 +4608,8 @@ import { raise as raise2 } from "@dxos/debug";
4605
4608
  import { invariant as invariant14 } from "@dxos/invariant";
4606
4609
  import { log as log13 } from "@dxos/log";
4607
4610
  import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
4608
- import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
4611
+ import { SpaceMember as SpaceMember5, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
4612
+ import { SpaceMember as HaloSpaceMember } from "@dxos/protocols/proto/dxos/halo/credentials";
4609
4613
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
4610
4614
  var SpacesServiceImpl = class {
4611
4615
  constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
@@ -4637,6 +4641,9 @@ var SpacesServiceImpl = class {
4637
4641
  }
4638
4642
  }
4639
4643
  }
4644
+ async updateMemberRole(_) {
4645
+ throw new Error("not implemented");
4646
+ }
4640
4647
  querySpaces() {
4641
4648
  return new Stream10(({ next, ctx }) => {
4642
4649
  const scheduler = new UpdateScheduler(ctx, async () => {
@@ -4646,7 +4653,7 @@ var SpacesServiceImpl = class {
4646
4653
  spaces
4647
4654
  }, {
4648
4655
  F: __dxlog_file15,
4649
- L: 77,
4656
+ L: 82,
4650
4657
  S: this,
4651
4658
  C: (f, a) => f(...a)
4652
4659
  });
@@ -4729,7 +4736,7 @@ var SpacesServiceImpl = class {
4729
4736
  } else {
4730
4737
  invariant14(!credential.id, "Id on unsigned credentials is not allowed", {
4731
4738
  F: __dxlog_file15,
4732
- L: 164,
4739
+ L: 169,
4733
4740
  S: this,
4734
4741
  A: [
4735
4742
  "!credential.id",
@@ -4738,7 +4745,7 @@ var SpacesServiceImpl = class {
4738
4745
  });
4739
4746
  invariant14(this._identityManager.identity, "Identity is not available", {
4740
4747
  F: __dxlog_file15,
4741
- L: 165,
4748
+ L: 170,
4742
4749
  S: this,
4743
4750
  A: [
4744
4751
  "this._identityManager.identity",
@@ -4748,7 +4755,7 @@ var SpacesServiceImpl = class {
4748
4755
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
4749
4756
  invariant14(credential.issuer.equals(signer.getIssuer()), void 0, {
4750
4757
  F: __dxlog_file15,
4751
- L: 167,
4758
+ L: 172,
4752
4759
  S: this,
4753
4760
  A: [
4754
4761
  "credential.issuer.equals(signer.getIssuer())",
@@ -4803,7 +4810,7 @@ var SpacesServiceImpl = class {
4803
4810
  identityKey: member.key,
4804
4811
  profile: member.profile ?? {}
4805
4812
  },
4806
- presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
4813
+ presence: member.role === HaloSpaceMember.Role.REMOVED ? SpaceMember5.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember5.PresenceState.ONLINE : SpaceMember5.PresenceState.OFFLINE,
4807
4814
  peerStates: peers
4808
4815
  };
4809
4816
  }),
@@ -5125,15 +5132,16 @@ var ServiceRegistry = class {
5125
5132
  };
5126
5133
 
5127
5134
  // packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts
5135
+ import { asyncTimeout as asyncTimeout2 } from "@dxos/async";
5128
5136
  import { getFirstStreamValue } from "@dxos/codec-protobuf";
5129
5137
  import { credentialTypeFilter } from "@dxos/credentials";
5130
5138
  import { invariant as invariant16 } from "@dxos/invariant";
5131
5139
  import { STORAGE_VERSION as STORAGE_VERSION2 } from "@dxos/protocols";
5132
- import { SpaceMember as SpaceMember4 } from "@dxos/protocols/proto/dxos/client/services";
5140
+ import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/client/services";
5133
5141
  import { TRACE_PROCESSOR } from "@dxos/tracing";
5134
5142
 
5135
5143
  // packages/sdk/client-services/src/version.ts
5136
- var DXOS_VERSION = "0.5.1-next.ed1615e";
5144
+ var DXOS_VERSION = "0.5.2-main.2408cc7";
5137
5145
 
5138
5146
  // packages/sdk/client-services/src/packlets/services/platform.ts
5139
5147
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -5180,63 +5188,55 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
5180
5188
  },
5181
5189
  trace: TRACE_PROCESSOR.getDiagnostics()
5182
5190
  };
5183
- {
5184
- invariant16(clientServices.LoggingService, "SystemService is not available.", {
5185
- F: __dxlog_file17,
5186
- L: 108,
5187
- S: void 0,
5188
- A: [
5189
- "clientServices.LoggingService",
5190
- "'SystemService is not available.'"
5191
- ]
5192
- });
5193
- diagnostics.metrics = await getFirstStreamValue(clientServices.LoggingService.queryMetrics({}), {
5194
- timeout: DEFAULT_TIMEOUT
5195
- }).catch(() => void 0);
5196
- }
5197
- if (typeof navigator !== "undefined" && navigator.storage) {
5198
- const map = /* @__PURE__ */ new Map();
5199
- const dir = await navigator.storage.getDirectory();
5200
- for await (const filename of dir?.keys()) {
5201
- const idx = filename.indexOf("-", filename.indexOf("-") + 1);
5202
- if (idx === -1) {
5203
- continue;
5191
+ await Promise.all([
5192
+ (async () => {
5193
+ invariant16(clientServices.LoggingService, "SystemService is not available.", {
5194
+ F: __dxlog_file17,
5195
+ L: 110,
5196
+ S: void 0,
5197
+ A: [
5198
+ "clientServices.LoggingService",
5199
+ "'SystemService is not available.'"
5200
+ ]
5201
+ });
5202
+ diagnostics.metrics = await getFirstStreamValue(clientServices.LoggingService.queryMetrics({}), {
5203
+ timeout: DEFAULT_TIMEOUT
5204
+ }).catch(() => void 0);
5205
+ })(),
5206
+ (async () => {
5207
+ diagnostics.storage = await asyncTimeout2(getStorageDiagnostics(), DEFAULT_TIMEOUT).catch(() => void 0);
5208
+ })(),
5209
+ async () => {
5210
+ const identity = serviceContext.identityManager.identity;
5211
+ if (identity) {
5212
+ diagnostics.identity = {
5213
+ identityKey: identity.identityKey,
5214
+ spaceKey: identity.space.key,
5215
+ profile: identity.profileDocument
5216
+ };
5217
+ const { devices } = await getFirstStreamValue(clientServices.DevicesService.queryDevices(), {
5218
+ timeout: DEFAULT_TIMEOUT
5219
+ }).catch(() => void 0) ?? {};
5220
+ diagnostics.devices = devices;
5221
+ if (serviceContext.dataSpaceManager) {
5222
+ diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
5223
+ }
5224
+ const { feeds = [] } = await getFirstStreamValue(clientServices.DevtoolsHost.subscribeToFeeds({}), {
5225
+ timeout: DEFAULT_TIMEOUT
5226
+ }).catch(() => void 0) ?? {};
5227
+ diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
5228
+ feedKey,
5229
+ bytes,
5230
+ length
5231
+ }));
5232
+ const status = await getFirstStreamValue(clientServices.NetworkService.queryStatus(), {
5233
+ timeout: DEFAULT_TIMEOUT
5234
+ }).catch(() => void 0);
5235
+ diagnostics.networkStatus = status;
5236
+ diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
5204
5237
  }
5205
- map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
5206
5238
  }
5207
- diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
5208
- file,
5209
- count
5210
- }));
5211
- }
5212
- const identity = serviceContext.identityManager.identity;
5213
- if (identity) {
5214
- diagnostics.identity = {
5215
- identityKey: identity.identityKey,
5216
- spaceKey: identity.space.key,
5217
- profile: identity.profileDocument
5218
- };
5219
- const { devices } = await getFirstStreamValue(clientServices.DevicesService.queryDevices(), {
5220
- timeout: DEFAULT_TIMEOUT
5221
- }).catch(() => void 0) ?? {};
5222
- diagnostics.devices = devices;
5223
- if (serviceContext.dataSpaceManager) {
5224
- diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
5225
- }
5226
- const { feeds = [] } = await getFirstStreamValue(clientServices.DevtoolsHost.subscribeToFeeds({}), {
5227
- timeout: DEFAULT_TIMEOUT
5228
- }).catch(() => void 0) ?? {};
5229
- diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
5230
- feedKey,
5231
- bytes,
5232
- length
5233
- }));
5234
- const status = await getFirstStreamValue(clientServices.NetworkService.queryStatus(), {
5235
- timeout: DEFAULT_TIMEOUT
5236
- }).catch(() => void 0);
5237
- diagnostics.networkStatus = status;
5238
- diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
5239
- }
5239
+ ]);
5240
5240
  diagnostics.config = config.values;
5241
5241
  return diagnostics;
5242
5242
  };
@@ -5255,7 +5255,7 @@ var getSpaceStats = async (space) => {
5255
5255
  displayName: member.assertion.profile?.displayName
5256
5256
  }
5257
5257
  },
5258
- presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember4.PresenceState.ONLINE : SpaceMember4.PresenceState.OFFLINE
5258
+ presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember6.PresenceState.ONLINE : SpaceMember6.PresenceState.OFFLINE
5259
5259
  })),
5260
5260
  pipeline: {
5261
5261
  // TODO(burdon): Pick properties from credentials if needed.
@@ -5273,6 +5273,24 @@ var getSpaceStats = async (space) => {
5273
5273
  }
5274
5274
  return stats;
5275
5275
  };
5276
+ var getStorageDiagnostics = async () => {
5277
+ if (typeof navigator === "undefined" || !navigator.storage) {
5278
+ return void 0;
5279
+ }
5280
+ const map = /* @__PURE__ */ new Map();
5281
+ const dir = await navigator.storage.getDirectory();
5282
+ for await (const filename of dir?.keys()) {
5283
+ const idx = filename.indexOf("-", filename.indexOf("-") + 1);
5284
+ if (idx === -1) {
5285
+ continue;
5286
+ }
5287
+ map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
5288
+ }
5289
+ return Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
5290
+ file,
5291
+ count
5292
+ }));
5293
+ };
5276
5294
 
5277
5295
  // packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts
5278
5296
  import { Trigger as Trigger7 } from "@dxos/async";
@@ -5473,7 +5491,7 @@ var DevicesServiceImpl = class {
5473
5491
  };
5474
5492
 
5475
5493
  // packages/sdk/client-services/src/packlets/locks/browser.ts
5476
- import { asyncTimeout as asyncTimeout2, Trigger as Trigger8 } from "@dxos/async";
5494
+ import { asyncTimeout as asyncTimeout3, Trigger as Trigger8 } from "@dxos/async";
5477
5495
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
5478
5496
  import { log as log16, logInfo } from "@dxos/log";
5479
5497
  function _ts_decorate7(decorators, target, key, desc) {
@@ -5514,7 +5532,7 @@ var Lock = class {
5514
5532
  S: this,
5515
5533
  C: (f, a) => f(...a)
5516
5534
  });
5517
- await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
5535
+ await asyncTimeout3(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
5518
5536
  log16("acquired lock", void 0, {
5519
5537
  F: __dxlog_file20,
5520
5538
  L: 44,
@@ -6207,7 +6225,7 @@ var ClientServicesHost = class {
6207
6225
  S: this,
6208
6226
  C: (f, a) => f(...a)
6209
6227
  });
6210
- log18("resetting...", void 0, {
6228
+ log18.info("resetting...", void 0, {
6211
6229
  F: __dxlog_file21,
6212
6230
  L: 342,
6213
6231
  S: this,
@@ -6215,7 +6233,7 @@ var ClientServicesHost = class {
6215
6233
  });
6216
6234
  await this._serviceContext?.close();
6217
6235
  await this._storage.reset();
6218
- log18("reset", void 0, {
6236
+ log18.info("reset", void 0, {
6219
6237
  F: __dxlog_file21,
6220
6238
  L: 345,
6221
6239
  S: this,
@@ -6293,6 +6311,7 @@ import { humanize } from "@dxos/util";
6293
6311
  var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
6294
6312
 
6295
6313
  // packages/sdk/client-services/src/packlets/diagnostics/diagnostics-collector.ts
6314
+ var GET_DIAGNOSTICS_RPC_TIMEOUT = 1e4;
6296
6315
  var DiagnosticsCollector = class {
6297
6316
  static {
6298
6317
  this.broadcastSender = createCollectDiagnosticsBroadcastSender();
@@ -6300,6 +6319,8 @@ var DiagnosticsCollector = class {
6300
6319
  static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
6301
6320
  const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
6302
6321
  keys: options.humanize ? GetDiagnosticsRequest2.KEY_OPTION.HUMANIZE : options.truncate ? GetDiagnosticsRequest2.KEY_OPTION.TRUNCATE : void 0
6322
+ }, {
6323
+ timeout: GET_DIAGNOSTICS_RPC_TIMEOUT
6303
6324
  });
6304
6325
  const clientDiagnostics = {
6305
6326
  config,
@@ -6316,12 +6337,12 @@ var DiagnosticsCollector = class {
6316
6337
  }
6317
6338
  };
6318
6339
  var findSystemServiceProvider = () => {
6319
- const serviceProviders = TRACE_PROCESSOR3.findByAnnotation(ClientServicesProviderResource);
6340
+ const serviceProviders = TRACE_PROCESSOR3.findResourcesByAnnotation(ClientServicesProviderResource);
6320
6341
  const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
6321
6342
  return providerResource?.instance?.deref() ?? null;
6322
6343
  };
6323
6344
  var findConfigs = () => {
6324
- const configs = TRACE_PROCESSOR3.findByAnnotation(ConfigResource);
6345
+ const configs = TRACE_PROCESSOR3.findResourcesByAnnotation(ConfigResource);
6325
6346
  return configs.map((r) => r.instance.deref()).filter(nonNullable);
6326
6347
  };
6327
6348
 
@@ -6365,4 +6386,4 @@ export {
6365
6386
  ClientServicesHost,
6366
6387
  ClientServicesProviderResource
6367
6388
  };
6368
- //# sourceMappingURL=chunk-2OVWTOUO.mjs.map
6389
+ //# sourceMappingURL=chunk-SEUHDCKP.mjs.map