@dxos/client-services 0.5.1-next.638da00 → 0.5.1-next.65aaa36

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-L2CWGONQ.mjs → chunk-2MPSJHTS.mjs} +123 -144
  2. package/dist/lib/browser/chunk-2MPSJHTS.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-2PGHNVRY.cjs → chunk-ITFB7UCR.cjs} +145 -166
  7. package/dist/lib/node/chunk-ITFB7UCR.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 +1 -2
  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 +9 -14
  21. package/src/packlets/diagnostics/diagnostics.ts +68 -78
  22. package/src/packlets/invitations/invitations-manager.ts +0 -3
  23. package/src/packlets/invitations/space-invitation-protocol.ts +2 -4
  24. package/src/packlets/services/service-host.ts +2 -2
  25. package/src/packlets/spaces/data-space.ts +1 -2
  26. package/src/packlets/spaces/genesis.ts +1 -1
  27. package/src/packlets/spaces/spaces-service.ts +6 -12
  28. package/src/version.ts +1 -1
  29. package/dist/lib/browser/chunk-L2CWGONQ.mjs.map +0 -7
  30. package/dist/lib/node/chunk-2PGHNVRY.cjs.map +0 -7
@@ -2594,7 +2594,7 @@ var SpaceInvitationProtocol = class {
2594
2594
  ""
2595
2595
  ]
2596
2596
  });
2597
- const space = this._spaceManager.spaces.get(this._spaceKey);
2597
+ const space = await 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, invitation.role ?? SpaceMember.Role.ADMIN, space.inner.spaceState.membershipChainHeads, guestProfile, invitation.delegationCredentialId);
2626
+ const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile, invitation.delegationCredentialId);
2627
2627
  invariant9(credentials[0].credential, void 0, {
2628
2628
  F: __dxlog_file10,
2629
- L: 77,
2629
+ L: 75,
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: 79,
2639
+ L: 77,
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: 92,
2657
+ L: 90,
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: 94,
2667
+ L: 92,
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: 96,
2677
+ L: 94,
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: 99,
2690
+ L: 97,
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: invitation.role ?? SpaceMember.Role.ADMIN,
2698
+ 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: 119,
2705
+ L: 117,
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: 125,
2720
+ L: 123,
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: 126,
2729
+ L: 124,
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: 128,
2739
+ L: 126,
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: 130,
2751
+ L: 128,
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: 137,
2758
+ L: 135,
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: 169,
2794
+ L: 167,
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: 172,
2805
+ L: 170,
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: 173,
2814
+ L: 171,
2815
2815
  S: this,
2816
2816
  A: [
2817
2817
  "credential.subject.id.equals(this._signingContext.identityKey)",
@@ -2844,7 +2844,6 @@ 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";
2848
2847
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
2849
2848
  var InvitationsManager = class {
2850
2849
  constructor(_invitationsHandler, _getHandler, _metadataStore) {
@@ -2885,7 +2884,7 @@ var InvitationsManager = class {
2885
2884
  } catch (err) {
2886
2885
  log9.catch(err, void 0, {
2887
2886
  F: __dxlog_file11,
2888
- L: 77,
2887
+ L: 76,
2889
2888
  S: this,
2890
2889
  C: (f, a) => f(...a)
2891
2890
  });
@@ -2908,7 +2907,7 @@ var InvitationsManager = class {
2908
2907
  const loadTasks = freshInvitations.map((persistentInvitation) => {
2909
2908
  invariant10(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
2910
2909
  F: __dxlog_file11,
2911
- L: 98,
2910
+ L: 97,
2912
2911
  S: this,
2913
2912
  A: [
2914
2913
  "!this._createInvitations.get(persistentInvitation.invitationId)",
@@ -2927,7 +2926,7 @@ var InvitationsManager = class {
2927
2926
  } catch (err) {
2928
2927
  log9.catch(err, void 0, {
2929
2928
  F: __dxlog_file11,
2930
- L: 105,
2929
+ L: 104,
2931
2930
  S: this,
2932
2931
  C: (f, a) => f(...a)
2933
2932
  });
@@ -2959,13 +2958,13 @@ var InvitationsManager = class {
2959
2958
  async authenticate({ invitationId, authCode }) {
2960
2959
  log9("authenticating...", void 0, {
2961
2960
  F: __dxlog_file11,
2962
- L: 135,
2961
+ L: 134,
2963
2962
  S: this,
2964
2963
  C: (f, a) => f(...a)
2965
2964
  });
2966
2965
  invariant10(invitationId, void 0, {
2967
2966
  F: __dxlog_file11,
2968
- L: 136,
2967
+ L: 135,
2969
2968
  S: this,
2970
2969
  A: [
2971
2970
  "invitationId",
@@ -2978,7 +2977,7 @@ var InvitationsManager = class {
2978
2977
  invitationId
2979
2978
  }, {
2980
2979
  F: __dxlog_file11,
2981
- L: 139,
2980
+ L: 138,
2982
2981
  S: this,
2983
2982
  C: (f, a) => f(...a)
2984
2983
  });
@@ -2991,13 +2990,13 @@ var InvitationsManager = class {
2991
2990
  invitationId
2992
2991
  }, {
2993
2992
  F: __dxlog_file11,
2994
- L: 146,
2993
+ L: 145,
2995
2994
  S: this,
2996
2995
  C: (f, a) => f(...a)
2997
2996
  });
2998
2997
  invariant10(invitationId, void 0, {
2999
2998
  F: __dxlog_file11,
3000
- L: 147,
2999
+ L: 146,
3001
3000
  S: this,
3002
3001
  A: [
3003
3002
  "invitationId",
@@ -3043,7 +3042,7 @@ var InvitationsManager = class {
3043
3042
  }
3044
3043
  }
3045
3044
  _createInvitation(protocol, 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 ?? {};
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 ?? {};
3047
3046
  const authCode = options?.authCode ?? (authMethod === Invitation6.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
3048
3047
  return {
3049
3048
  invitationId,
@@ -3057,7 +3056,6 @@ var InvitationsManager = class {
3057
3056
  guestKeypair: guestKeypair ?? (authMethod === Invitation6.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
3058
3057
  created,
3059
3058
  lifetime,
3060
- role,
3061
3059
  multiUse,
3062
3060
  delegationCredentialId: options?.delegationCredentialId,
3063
3061
  ...protocol.getInvitationContext()
@@ -3076,7 +3074,7 @@ var InvitationsManager = class {
3076
3074
  ...handler.toJSON()
3077
3075
  }, {
3078
3076
  F: __dxlog_file11,
3079
- L: 236,
3077
+ L: 233,
3080
3078
  S: this,
3081
3079
  C: (f, a) => f(...a)
3082
3080
  });
@@ -3109,7 +3107,7 @@ var InvitationsManager = class {
3109
3107
  ...handler.toJSON()
3110
3108
  }, {
3111
3109
  F: __dxlog_file11,
3112
- L: 256,
3110
+ L: 253,
3113
3111
  S: this,
3114
3112
  C: (f, a) => f(...a)
3115
3113
  });
@@ -3120,7 +3118,7 @@ var InvitationsManager = class {
3120
3118
  } else {
3121
3119
  log9.warn("auth failed", err, {
3122
3120
  F: __dxlog_file11,
3123
- L: 259,
3121
+ L: 256,
3124
3122
  S: this,
3125
3123
  C: (f, a) => f(...a)
3126
3124
  });
@@ -3137,7 +3135,7 @@ var InvitationsManager = class {
3137
3135
  ...handler.toJSON()
3138
3136
  }, {
3139
3137
  F: __dxlog_file11,
3140
- L: 266,
3138
+ L: 263,
3141
3139
  S: this,
3142
3140
  C: (f, a) => f(...a)
3143
3141
  });
@@ -3182,7 +3180,7 @@ var InvitationsManager = class {
3182
3180
  } catch (err) {
3183
3181
  log9.catch(err, void 0, {
3184
3182
  F: __dxlog_file11,
3185
- L: 302,
3183
+ L: 299,
3186
3184
  S: this,
3187
3185
  C: (f, a) => f(...a)
3188
3186
  });
@@ -3289,7 +3287,6 @@ import { PublicKey as PublicKey10 } from "@dxos/keys";
3289
3287
  import { log as log11 } from "@dxos/log";
3290
3288
  import { CancelledError, SystemError } from "@dxos/protocols";
3291
3289
  import { SpaceState, CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
3292
- import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
3293
3290
  import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
3294
3291
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
3295
3292
  import { trace as trace6 } from "@dxos/tracing";
@@ -3638,7 +3635,7 @@ var DataSpace = class {
3638
3635
  this._callbacks = params.callbacks ?? {};
3639
3636
  this._echoHost = params.echoHost;
3640
3637
  this.authVerifier = new TrustedKeySetAuthVerifier({
3641
- trustedKeysProvider: () => new ComplexSet5(PublicKey10.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== SpaceMember3.Role.REMOVED).map((member) => member.key)),
3638
+ trustedKeysProvider: () => new ComplexSet5(PublicKey10.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
3642
3639
  update: this._inner.stateUpdate,
3643
3640
  authTimeout: AUTH_TIMEOUT2
3644
3641
  });
@@ -3648,7 +3645,7 @@ var DataSpace = class {
3648
3645
  state: SpaceState[this._state]
3649
3646
  }, {
3650
3647
  F: __dxlog_file13,
3651
- L: 137,
3648
+ L: 136,
3652
3649
  S: this,
3653
3650
  C: (f, a) => f(...a)
3654
3651
  });
@@ -3698,7 +3695,7 @@ var DataSpace = class {
3698
3695
  state: SpaceState[this._state]
3699
3696
  }, {
3700
3697
  F: __dxlog_file13,
3701
- L: 195,
3698
+ L: 194,
3702
3699
  S: this,
3703
3700
  C: (f, a) => f(...a)
3704
3701
  });
@@ -3716,7 +3713,7 @@ var DataSpace = class {
3716
3713
  state: SpaceState[this._state]
3717
3714
  }, {
3718
3715
  F: __dxlog_file13,
3719
- L: 209,
3716
+ L: 208,
3720
3717
  S: this,
3721
3718
  C: (f, a) => f(...a)
3722
3719
  });
@@ -3748,7 +3745,7 @@ var DataSpace = class {
3748
3745
  if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
3749
3746
  log11("data pipeline initialization cancelled", err, {
3750
3747
  F: __dxlog_file13,
3751
- L: 242,
3748
+ L: 241,
3752
3749
  S: this,
3753
3750
  C: (f, a) => f(...a)
3754
3751
  });
@@ -3756,7 +3753,7 @@ var DataSpace = class {
3756
3753
  }
3757
3754
  log11.error("Error initializing data pipeline", err, {
3758
3755
  F: __dxlog_file13,
3759
- L: 246,
3756
+ L: 245,
3760
3757
  S: this,
3761
3758
  C: (f, a) => f(...a)
3762
3759
  });
@@ -3765,7 +3762,7 @@ var DataSpace = class {
3765
3762
  state: SpaceState[this._state]
3766
3763
  }, {
3767
3764
  F: __dxlog_file13,
3768
- L: 248,
3765
+ L: 247,
3769
3766
  S: this,
3770
3767
  C: (f, a) => f(...a)
3771
3768
  });
@@ -3785,7 +3782,7 @@ var DataSpace = class {
3785
3782
  state: SpaceState[this._state]
3786
3783
  }, {
3787
3784
  F: __dxlog_file13,
3788
- L: 264,
3785
+ L: 263,
3789
3786
  S: this,
3790
3787
  C: (f, a) => f(...a)
3791
3788
  });
@@ -3795,7 +3792,7 @@ var DataSpace = class {
3795
3792
  await cancelWithContext4(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3796
3793
  log11("data pipeline ready", void 0, {
3797
3794
  F: __dxlog_file13,
3798
- L: 276,
3795
+ L: 275,
3799
3796
  S: this,
3800
3797
  C: (f, a) => f(...a)
3801
3798
  });
@@ -3805,7 +3802,7 @@ var DataSpace = class {
3805
3802
  state: SpaceState[this._state]
3806
3803
  }, {
3807
3804
  F: __dxlog_file13,
3808
- L: 280,
3805
+ L: 279,
3809
3806
  S: this,
3810
3807
  C: (f, a) => f(...a)
3811
3808
  });
@@ -3821,7 +3818,7 @@ var DataSpace = class {
3821
3818
  await this._createWritableFeeds();
3822
3819
  log11("writable feeds created", void 0, {
3823
3820
  F: __dxlog_file13,
3824
- L: 296,
3821
+ L: 295,
3825
3822
  S: this,
3826
3823
  C: (f, a) => f(...a)
3827
3824
  });
@@ -3884,7 +3881,7 @@ var DataSpace = class {
3884
3881
  rootUrl
3885
3882
  }, {
3886
3883
  F: __dxlog_file13,
3887
- L: 362,
3884
+ L: 361,
3888
3885
  S: this,
3889
3886
  C: (f, a) => f(...a)
3890
3887
  });
@@ -3916,7 +3913,7 @@ var DataSpace = class {
3916
3913
  err
3917
3914
  }, {
3918
3915
  F: __dxlog_file13,
3919
- L: 385,
3916
+ L: 384,
3920
3917
  S: this,
3921
3918
  C: (f, a) => f(...a)
3922
3919
  });
@@ -3971,7 +3968,7 @@ var DataSpace = class {
3971
3968
  const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
3972
3969
  invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3973
3970
  F: __dxlog_file13,
3974
- L: 435,
3971
+ L: 434,
3975
3972
  S: this,
3976
3973
  A: [
3977
3974
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -3990,7 +3987,7 @@ var DataSpace = class {
3990
3987
  {
3991
3988
  log11.info("Fragmenting", void 0, {
3992
3989
  F: __dxlog_file13,
3993
- L: 447,
3990
+ L: 446,
3994
3991
  S: this,
3995
3992
  C: (f, a) => f(...a)
3996
3993
  });
@@ -4002,7 +3999,7 @@ var DataSpace = class {
4002
3999
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
4003
4000
  invariant12(properties, "Properties not found", {
4004
4001
  F: __dxlog_file13,
4005
- L: 457,
4002
+ L: 456,
4006
4003
  S: this,
4007
4004
  A: [
4008
4005
  "properties",
@@ -4018,7 +4015,7 @@ var DataSpace = class {
4018
4015
  const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
4019
4016
  invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4020
4017
  F: __dxlog_file13,
4021
- L: 462,
4018
+ L: 461,
4022
4019
  S: this,
4023
4020
  A: [
4024
4021
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4087,7 +4084,7 @@ var DataSpace = class {
4087
4084
  state: SpaceState[this._state]
4088
4085
  }, {
4089
4086
  F: __dxlog_file13,
4090
- L: 528,
4087
+ L: 527,
4091
4088
  S: this,
4092
4089
  C: (f, a) => f(...a)
4093
4090
  });
@@ -4155,7 +4152,7 @@ import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsyn
4155
4152
  // packages/sdk/client-services/src/packlets/spaces/genesis.ts
4156
4153
  import { createCredential } from "@dxos/credentials";
4157
4154
  import { failUndefined } from "@dxos/debug";
4158
- import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember4 } from "@dxos/protocols/proto/dxos/halo/credentials";
4155
+ import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
4159
4156
  import { Timeframe as Timeframe3 } from "@dxos/timeframe";
4160
4157
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4161
4158
  const credentials = [
@@ -4175,7 +4172,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4175
4172
  assertion: {
4176
4173
  "@type": "dxos.halo.credentials.SpaceMember",
4177
4174
  spaceKey: space.key,
4178
- role: SpaceMember4.Role.OWNER,
4175
+ role: SpaceMember2.Role.ADMIN,
4179
4176
  profile: signingContext.getProfile(),
4180
4177
  genesisFeedKey: space.controlFeedKey ?? failUndefined()
4181
4178
  }
@@ -4608,8 +4605,7 @@ import { raise as raise2 } from "@dxos/debug";
4608
4605
  import { invariant as invariant14 } from "@dxos/invariant";
4609
4606
  import { log as log13 } from "@dxos/log";
4610
4607
  import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
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";
4608
+ import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
4613
4609
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
4614
4610
  var SpacesServiceImpl = class {
4615
4611
  constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
@@ -4641,9 +4637,6 @@ var SpacesServiceImpl = class {
4641
4637
  }
4642
4638
  }
4643
4639
  }
4644
- async updateMemberRole(_) {
4645
- throw new Error("not implemented");
4646
- }
4647
4640
  querySpaces() {
4648
4641
  return new Stream10(({ next, ctx }) => {
4649
4642
  const scheduler = new UpdateScheduler(ctx, async () => {
@@ -4653,7 +4646,7 @@ var SpacesServiceImpl = class {
4653
4646
  spaces
4654
4647
  }, {
4655
4648
  F: __dxlog_file15,
4656
- L: 82,
4649
+ L: 77,
4657
4650
  S: this,
4658
4651
  C: (f, a) => f(...a)
4659
4652
  });
@@ -4736,7 +4729,7 @@ var SpacesServiceImpl = class {
4736
4729
  } else {
4737
4730
  invariant14(!credential.id, "Id on unsigned credentials is not allowed", {
4738
4731
  F: __dxlog_file15,
4739
- L: 169,
4732
+ L: 164,
4740
4733
  S: this,
4741
4734
  A: [
4742
4735
  "!credential.id",
@@ -4745,7 +4738,7 @@ var SpacesServiceImpl = class {
4745
4738
  });
4746
4739
  invariant14(this._identityManager.identity, "Identity is not available", {
4747
4740
  F: __dxlog_file15,
4748
- L: 170,
4741
+ L: 165,
4749
4742
  S: this,
4750
4743
  A: [
4751
4744
  "this._identityManager.identity",
@@ -4755,7 +4748,7 @@ var SpacesServiceImpl = class {
4755
4748
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
4756
4749
  invariant14(credential.issuer.equals(signer.getIssuer()), void 0, {
4757
4750
  F: __dxlog_file15,
4758
- L: 172,
4751
+ L: 167,
4759
4752
  S: this,
4760
4753
  A: [
4761
4754
  "credential.issuer.equals(signer.getIssuer())",
@@ -4810,7 +4803,7 @@ var SpacesServiceImpl = class {
4810
4803
  identityKey: member.key,
4811
4804
  profile: member.profile ?? {}
4812
4805
  },
4813
- presence: member.role === HaloSpaceMember.Role.REMOVED ? SpaceMember5.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember5.PresenceState.ONLINE : SpaceMember5.PresenceState.OFFLINE,
4806
+ presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
4814
4807
  peerStates: peers
4815
4808
  };
4816
4809
  }),
@@ -5132,16 +5125,15 @@ var ServiceRegistry = class {
5132
5125
  };
5133
5126
 
5134
5127
  // packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts
5135
- import { asyncTimeout as asyncTimeout2 } from "@dxos/async";
5136
5128
  import { getFirstStreamValue } from "@dxos/codec-protobuf";
5137
5129
  import { credentialTypeFilter } from "@dxos/credentials";
5138
5130
  import { invariant as invariant16 } from "@dxos/invariant";
5139
5131
  import { STORAGE_VERSION as STORAGE_VERSION2 } from "@dxos/protocols";
5140
- import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/client/services";
5132
+ import { SpaceMember as SpaceMember4 } from "@dxos/protocols/proto/dxos/client/services";
5141
5133
  import { TRACE_PROCESSOR } from "@dxos/tracing";
5142
5134
 
5143
5135
  // packages/sdk/client-services/src/version.ts
5144
- var DXOS_VERSION = "0.5.1-next.638da00";
5136
+ var DXOS_VERSION = "0.5.1-next.65aaa36";
5145
5137
 
5146
5138
  // packages/sdk/client-services/src/packlets/services/platform.ts
5147
5139
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -5188,55 +5180,63 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
5188
5180
  },
5189
5181
  trace: TRACE_PROCESSOR.getDiagnostics()
5190
5182
  };
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;
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;
5237
5204
  }
5205
+ map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
5238
5206
  }
5239
- ]);
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
+ }
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 ? SpaceMember6.PresenceState.ONLINE : SpaceMember6.PresenceState.OFFLINE
5258
+ presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember4.PresenceState.ONLINE : SpaceMember4.PresenceState.OFFLINE
5259
5259
  })),
5260
5260
  pipeline: {
5261
5261
  // TODO(burdon): Pick properties from credentials if needed.
@@ -5273,24 +5273,6 @@ 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
- };
5294
5276
 
5295
5277
  // packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts
5296
5278
  import { Trigger as Trigger7 } from "@dxos/async";
@@ -5491,7 +5473,7 @@ var DevicesServiceImpl = class {
5491
5473
  };
5492
5474
 
5493
5475
  // packages/sdk/client-services/src/packlets/locks/browser.ts
5494
- import { asyncTimeout as asyncTimeout3, Trigger as Trigger8 } from "@dxos/async";
5476
+ import { asyncTimeout as asyncTimeout2, Trigger as Trigger8 } from "@dxos/async";
5495
5477
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
5496
5478
  import { log as log16, logInfo } from "@dxos/log";
5497
5479
  function _ts_decorate7(decorators, target, key, desc) {
@@ -5532,7 +5514,7 @@ var Lock = class {
5532
5514
  S: this,
5533
5515
  C: (f, a) => f(...a)
5534
5516
  });
5535
- await asyncTimeout3(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
5517
+ await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
5536
5518
  log16("acquired lock", void 0, {
5537
5519
  F: __dxlog_file20,
5538
5520
  L: 44,
@@ -6225,7 +6207,7 @@ var ClientServicesHost = class {
6225
6207
  S: this,
6226
6208
  C: (f, a) => f(...a)
6227
6209
  });
6228
- log18.info("resetting...", void 0, {
6210
+ log18("resetting...", void 0, {
6229
6211
  F: __dxlog_file21,
6230
6212
  L: 342,
6231
6213
  S: this,
@@ -6233,7 +6215,7 @@ var ClientServicesHost = class {
6233
6215
  });
6234
6216
  await this._serviceContext?.close();
6235
6217
  await this._storage.reset();
6236
- log18.info("reset", void 0, {
6218
+ log18("reset", void 0, {
6237
6219
  F: __dxlog_file21,
6238
6220
  L: 345,
6239
6221
  S: this,
@@ -6311,7 +6293,6 @@ import { humanize } from "@dxos/util";
6311
6293
  var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
6312
6294
 
6313
6295
  // packages/sdk/client-services/src/packlets/diagnostics/diagnostics-collector.ts
6314
- var GET_DIAGNOSTICS_RPC_TIMEOUT = 1e4;
6315
6296
  var DiagnosticsCollector = class {
6316
6297
  static {
6317
6298
  this.broadcastSender = createCollectDiagnosticsBroadcastSender();
@@ -6319,8 +6300,6 @@ var DiagnosticsCollector = class {
6319
6300
  static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
6320
6301
  const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
6321
6302
  keys: options.humanize ? GetDiagnosticsRequest2.KEY_OPTION.HUMANIZE : options.truncate ? GetDiagnosticsRequest2.KEY_OPTION.TRUNCATE : void 0
6322
- }, {
6323
- timeout: GET_DIAGNOSTICS_RPC_TIMEOUT
6324
6303
  });
6325
6304
  const clientDiagnostics = {
6326
6305
  config,
@@ -6337,12 +6316,12 @@ var DiagnosticsCollector = class {
6337
6316
  }
6338
6317
  };
6339
6318
  var findSystemServiceProvider = () => {
6340
- const serviceProviders = TRACE_PROCESSOR3.findResourcesByAnnotation(ClientServicesProviderResource);
6319
+ const serviceProviders = TRACE_PROCESSOR3.findByAnnotation(ClientServicesProviderResource);
6341
6320
  const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
6342
6321
  return providerResource?.instance?.deref() ?? null;
6343
6322
  };
6344
6323
  var findConfigs = () => {
6345
- const configs = TRACE_PROCESSOR3.findResourcesByAnnotation(ConfigResource);
6324
+ const configs = TRACE_PROCESSOR3.findByAnnotation(ConfigResource);
6346
6325
  return configs.map((r) => r.instance.deref()).filter(nonNullable);
6347
6326
  };
6348
6327
 
@@ -6386,4 +6365,4 @@ export {
6386
6365
  ClientServicesHost,
6387
6366
  ClientServicesProviderResource
6388
6367
  };
6389
- //# sourceMappingURL=chunk-L2CWGONQ.mjs.map
6368
+ //# sourceMappingURL=chunk-2MPSJHTS.mjs.map