@dxos/client-services 0.5.3-main.5a4243f → 0.5.3-main.5eb30e6
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.
- package/dist/lib/browser/{chunk-25A3RELK.mjs → chunk-W6NTTNM6.mjs} +281 -120
- package/dist/lib/browser/chunk-W6NTTNM6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-UJ6ZJVX6.cjs → chunk-A4SFXPEF.cjs} +281 -119
- package/dist/lib/node/chunk-A4SFXPEF.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -43
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +2 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +1 -0
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +1 -0
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +3 -2
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/services/util.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +2 -0
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +6 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/credential-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +2 -2
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/diagnostics/diagnostics.ts +1 -0
- package/src/packlets/identity/identity-manager.ts +1 -0
- package/src/packlets/identity/identity.test.ts +3 -0
- package/src/packlets/invitations/device-invitation-protocol.ts +5 -1
- package/src/packlets/invitations/invitation-protocol.ts +2 -0
- package/src/packlets/invitations/invitations-manager.ts +5 -0
- package/src/packlets/invitations/space-invitation-protocol.ts +29 -2
- package/src/packlets/spaces/data-space-manager.ts +100 -10
- package/src/packlets/spaces/data-space.ts +31 -8
- package/src/packlets/spaces/spaces-service.ts +46 -15
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-25A3RELK.mjs.map +0 -7
- package/dist/lib/node/chunk-UJ6ZJVX6.cjs.map +0 -7
|
@@ -1088,6 +1088,8 @@ var IdentityManager = class {
|
|
|
1088
1088
|
},
|
|
1089
1089
|
memberKey: identityKey,
|
|
1090
1090
|
onDelegatedInvitationStatusChange: async () => {
|
|
1091
|
+
},
|
|
1092
|
+
onMemberRolesChanged: async () => {
|
|
1091
1093
|
}
|
|
1092
1094
|
});
|
|
1093
1095
|
}
|
|
@@ -1191,6 +1193,9 @@ var DeviceInvitationProtocol = class {
|
|
|
1191
1193
|
toJSON() {
|
|
1192
1194
|
return {};
|
|
1193
1195
|
}
|
|
1196
|
+
checkCanInviteNewMembers() {
|
|
1197
|
+
return void 0;
|
|
1198
|
+
}
|
|
1194
1199
|
getInvitationContext() {
|
|
1195
1200
|
return {
|
|
1196
1201
|
kind: Invitation.Kind.DEVICE
|
|
@@ -1205,7 +1210,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1205
1210
|
async admit(_, request) {
|
|
1206
1211
|
invariant4(request.device, void 0, {
|
|
1207
1212
|
F: __dxlog_file5,
|
|
1208
|
-
L:
|
|
1213
|
+
L: 50,
|
|
1209
1214
|
S: this,
|
|
1210
1215
|
A: [
|
|
1211
1216
|
"request.device",
|
|
@@ -1251,7 +1256,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1251
1256
|
async accept(response, request) {
|
|
1252
1257
|
invariant4(response.device, void 0, {
|
|
1253
1258
|
F: __dxlog_file5,
|
|
1254
|
-
L:
|
|
1259
|
+
L: 95,
|
|
1255
1260
|
S: this,
|
|
1256
1261
|
A: [
|
|
1257
1262
|
"response.device",
|
|
@@ -1261,7 +1266,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1261
1266
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1262
1267
|
invariant4(request.device, void 0, {
|
|
1263
1268
|
F: __dxlog_file5,
|
|
1264
|
-
L:
|
|
1269
|
+
L: 98,
|
|
1265
1270
|
S: this,
|
|
1266
1271
|
A: [
|
|
1267
1272
|
"request.device",
|
|
@@ -2561,7 +2566,7 @@ import { createAdmissionCredentials, createCancelDelegatedSpaceInvitationCredent
|
|
|
2561
2566
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
2562
2567
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
2563
2568
|
import { log as log8 } from "@dxos/log";
|
|
2564
|
-
import { AlreadyJoinedError as AlreadyJoinedError2 } from "@dxos/protocols";
|
|
2569
|
+
import { AlreadyJoinedError as AlreadyJoinedError2, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from "@dxos/protocols";
|
|
2565
2570
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
2566
2571
|
import { SpaceMember } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2567
2572
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
@@ -2578,6 +2583,19 @@ var SpaceInvitationProtocol = class {
|
|
|
2578
2583
|
spaceKey: this._spaceKey
|
|
2579
2584
|
};
|
|
2580
2585
|
}
|
|
2586
|
+
checkCanInviteNewMembers() {
|
|
2587
|
+
if (this._spaceKey == null) {
|
|
2588
|
+
return new InvalidInvitationError("No spaceKey was provided for a space invitation.");
|
|
2589
|
+
}
|
|
2590
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
2591
|
+
if (space == null) {
|
|
2592
|
+
return new SpaceNotFoundError(this._spaceKey);
|
|
2593
|
+
}
|
|
2594
|
+
if (!space?.inner.spaceState.hasMembershipManagementPermission(this._signingContext.identityKey)) {
|
|
2595
|
+
return new AuthorizationError("No member management permission.");
|
|
2596
|
+
}
|
|
2597
|
+
return void 0;
|
|
2598
|
+
}
|
|
2581
2599
|
getInvitationContext() {
|
|
2582
2600
|
return {
|
|
2583
2601
|
kind: Invitation5.Kind.SPACE,
|
|
@@ -2587,7 +2605,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2587
2605
|
async admit(invitation, request, guestProfile) {
|
|
2588
2606
|
invariant9(this._spaceKey, void 0, {
|
|
2589
2607
|
F: __dxlog_file10,
|
|
2590
|
-
L:
|
|
2608
|
+
L: 76,
|
|
2591
2609
|
S: this,
|
|
2592
2610
|
A: [
|
|
2593
2611
|
"this._spaceKey",
|
|
@@ -2597,7 +2615,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2597
2615
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
2598
2616
|
invariant9(space, void 0, {
|
|
2599
2617
|
F: __dxlog_file10,
|
|
2600
|
-
L:
|
|
2618
|
+
L: 78,
|
|
2601
2619
|
S: this,
|
|
2602
2620
|
A: [
|
|
2603
2621
|
"space",
|
|
@@ -2606,7 +2624,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2606
2624
|
});
|
|
2607
2625
|
invariant9(request.space, void 0, {
|
|
2608
2626
|
F: __dxlog_file10,
|
|
2609
|
-
L:
|
|
2627
|
+
L: 80,
|
|
2610
2628
|
S: this,
|
|
2611
2629
|
A: [
|
|
2612
2630
|
"request.space",
|
|
@@ -2614,19 +2632,22 @@ var SpaceInvitationProtocol = class {
|
|
|
2614
2632
|
]
|
|
2615
2633
|
});
|
|
2616
2634
|
const { identityKey, deviceKey } = request.space;
|
|
2635
|
+
if (space.inner.spaceState.getMemberRole(identityKey) !== SpaceMember.Role.REMOVED) {
|
|
2636
|
+
throw new AlreadyJoinedError2();
|
|
2637
|
+
}
|
|
2617
2638
|
log8("writing guest credentials", {
|
|
2618
2639
|
host: this._signingContext.deviceKey,
|
|
2619
2640
|
guest: deviceKey
|
|
2620
2641
|
}, {
|
|
2621
2642
|
F: __dxlog_file10,
|
|
2622
|
-
L:
|
|
2643
|
+
L: 87,
|
|
2623
2644
|
S: this,
|
|
2624
2645
|
C: (f, a) => f(...a)
|
|
2625
2646
|
});
|
|
2626
2647
|
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
2648
|
invariant9(credentials[0].credential, void 0, {
|
|
2628
2649
|
F: __dxlog_file10,
|
|
2629
|
-
L:
|
|
2650
|
+
L: 101,
|
|
2630
2651
|
S: this,
|
|
2631
2652
|
A: [
|
|
2632
2653
|
"credentials[0].credential",
|
|
@@ -2636,7 +2657,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2636
2657
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2637
2658
|
invariant9(getCredentialAssertion(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2638
2659
|
F: __dxlog_file10,
|
|
2639
|
-
L:
|
|
2660
|
+
L: 103,
|
|
2640
2661
|
S: this,
|
|
2641
2662
|
A: [
|
|
2642
2663
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2654,7 +2675,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2654
2675
|
async delegate(invitation) {
|
|
2655
2676
|
invariant9(this._spaceKey, void 0, {
|
|
2656
2677
|
F: __dxlog_file10,
|
|
2657
|
-
L:
|
|
2678
|
+
L: 116,
|
|
2658
2679
|
S: this,
|
|
2659
2680
|
A: [
|
|
2660
2681
|
"this._spaceKey",
|
|
@@ -2664,7 +2685,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2664
2685
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
2665
2686
|
invariant9(space, void 0, {
|
|
2666
2687
|
F: __dxlog_file10,
|
|
2667
|
-
L:
|
|
2688
|
+
L: 118,
|
|
2668
2689
|
S: this,
|
|
2669
2690
|
A: [
|
|
2670
2691
|
"space",
|
|
@@ -2674,7 +2695,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2674
2695
|
if (invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
2675
2696
|
invariant9(invitation.guestKeypair?.publicKey, void 0, {
|
|
2676
2697
|
F: __dxlog_file10,
|
|
2677
|
-
L:
|
|
2698
|
+
L: 120,
|
|
2678
2699
|
S: this,
|
|
2679
2700
|
A: [
|
|
2680
2701
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -2687,7 +2708,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2687
2708
|
id: invitation.invitationId
|
|
2688
2709
|
}, {
|
|
2689
2710
|
F: __dxlog_file10,
|
|
2690
|
-
L:
|
|
2711
|
+
L: 123,
|
|
2691
2712
|
S: this,
|
|
2692
2713
|
C: (f, a) => f(...a)
|
|
2693
2714
|
});
|
|
@@ -2702,7 +2723,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2702
2723
|
});
|
|
2703
2724
|
invariant9(credential.credential, void 0, {
|
|
2704
2725
|
F: __dxlog_file10,
|
|
2705
|
-
L:
|
|
2726
|
+
L: 143,
|
|
2706
2727
|
S: this,
|
|
2707
2728
|
A: [
|
|
2708
2729
|
"credential.credential",
|
|
@@ -2717,7 +2738,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2717
2738
|
async cancelDelegation(invitation) {
|
|
2718
2739
|
invariant9(this._spaceKey, void 0, {
|
|
2719
2740
|
F: __dxlog_file10,
|
|
2720
|
-
L:
|
|
2741
|
+
L: 149,
|
|
2721
2742
|
S: this,
|
|
2722
2743
|
A: [
|
|
2723
2744
|
"this._spaceKey",
|
|
@@ -2726,7 +2747,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2726
2747
|
});
|
|
2727
2748
|
invariant9(invitation.type === Invitation5.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
2728
2749
|
F: __dxlog_file10,
|
|
2729
|
-
L:
|
|
2750
|
+
L: 150,
|
|
2730
2751
|
S: this,
|
|
2731
2752
|
A: [
|
|
2732
2753
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -2736,7 +2757,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2736
2757
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
2737
2758
|
invariant9(space, void 0, {
|
|
2738
2759
|
F: __dxlog_file10,
|
|
2739
|
-
L:
|
|
2760
|
+
L: 152,
|
|
2740
2761
|
S: this,
|
|
2741
2762
|
A: [
|
|
2742
2763
|
"space",
|
|
@@ -2748,14 +2769,14 @@ var SpaceInvitationProtocol = class {
|
|
|
2748
2769
|
id: invitation.invitationId
|
|
2749
2770
|
}, {
|
|
2750
2771
|
F: __dxlog_file10,
|
|
2751
|
-
L:
|
|
2772
|
+
L: 154,
|
|
2752
2773
|
S: this,
|
|
2753
2774
|
C: (f, a) => f(...a)
|
|
2754
2775
|
});
|
|
2755
2776
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
2756
2777
|
invariant9(credential.credential, void 0, {
|
|
2757
2778
|
F: __dxlog_file10,
|
|
2758
|
-
L:
|
|
2779
|
+
L: 161,
|
|
2759
2780
|
S: this,
|
|
2760
2781
|
A: [
|
|
2761
2782
|
"credential.credential",
|
|
@@ -2767,7 +2788,10 @@ var SpaceInvitationProtocol = class {
|
|
|
2767
2788
|
]);
|
|
2768
2789
|
}
|
|
2769
2790
|
checkInvitation(invitation) {
|
|
2770
|
-
if (invitation.spaceKey
|
|
2791
|
+
if (invitation.spaceKey == null) {
|
|
2792
|
+
return new InvalidInvitationError("No spaceKey was provided for a space invitation.");
|
|
2793
|
+
}
|
|
2794
|
+
if (this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
2771
2795
|
return new AlreadyJoinedError2("Already joined space.");
|
|
2772
2796
|
}
|
|
2773
2797
|
}
|
|
@@ -2791,7 +2815,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2791
2815
|
async accept(response) {
|
|
2792
2816
|
invariant9(response.space, void 0, {
|
|
2793
2817
|
F: __dxlog_file10,
|
|
2794
|
-
L:
|
|
2818
|
+
L: 196,
|
|
2795
2819
|
S: this,
|
|
2796
2820
|
A: [
|
|
2797
2821
|
"response.space",
|
|
@@ -2802,7 +2826,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2802
2826
|
const assertion = getCredentialAssertion(credential);
|
|
2803
2827
|
invariant9(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2804
2828
|
F: __dxlog_file10,
|
|
2805
|
-
L:
|
|
2829
|
+
L: 199,
|
|
2806
2830
|
S: this,
|
|
2807
2831
|
A: [
|
|
2808
2832
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2811,7 +2835,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2811
2835
|
});
|
|
2812
2836
|
invariant9(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2813
2837
|
F: __dxlog_file10,
|
|
2814
|
-
L:
|
|
2838
|
+
L: 200,
|
|
2815
2839
|
S: this,
|
|
2816
2840
|
A: [
|
|
2817
2841
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -2869,6 +2893,10 @@ var InvitationsManager = class {
|
|
|
2869
2893
|
}
|
|
2870
2894
|
}
|
|
2871
2895
|
const handler = this._getHandler(options);
|
|
2896
|
+
const invitationError = handler.checkCanInviteNewMembers();
|
|
2897
|
+
if (invitationError != null) {
|
|
2898
|
+
throw invitationError;
|
|
2899
|
+
}
|
|
2872
2900
|
const invitation = this._createInvitation(handler, options);
|
|
2873
2901
|
const { ctx, stream, observableInvitation } = this._createObservableInvitation(handler, invitation);
|
|
2874
2902
|
this._createInvitations.set(invitation.invitationId, observableInvitation);
|
|
@@ -2885,7 +2913,7 @@ var InvitationsManager = class {
|
|
|
2885
2913
|
} catch (err) {
|
|
2886
2914
|
log9.catch(err, void 0, {
|
|
2887
2915
|
F: __dxlog_file11,
|
|
2888
|
-
L:
|
|
2916
|
+
L: 82,
|
|
2889
2917
|
S: this,
|
|
2890
2918
|
C: (f, a) => f(...a)
|
|
2891
2919
|
});
|
|
@@ -2908,7 +2936,7 @@ var InvitationsManager = class {
|
|
|
2908
2936
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
2909
2937
|
invariant10(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
2910
2938
|
F: __dxlog_file11,
|
|
2911
|
-
L:
|
|
2939
|
+
L: 103,
|
|
2912
2940
|
S: this,
|
|
2913
2941
|
A: [
|
|
2914
2942
|
"!this._createInvitations.get(persistentInvitation.invitationId)",
|
|
@@ -2927,7 +2955,7 @@ var InvitationsManager = class {
|
|
|
2927
2955
|
} catch (err) {
|
|
2928
2956
|
log9.catch(err, void 0, {
|
|
2929
2957
|
F: __dxlog_file11,
|
|
2930
|
-
L:
|
|
2958
|
+
L: 110,
|
|
2931
2959
|
S: this,
|
|
2932
2960
|
C: (f, a) => f(...a)
|
|
2933
2961
|
});
|
|
@@ -2959,13 +2987,13 @@ var InvitationsManager = class {
|
|
|
2959
2987
|
async authenticate({ invitationId, authCode }) {
|
|
2960
2988
|
log9("authenticating...", void 0, {
|
|
2961
2989
|
F: __dxlog_file11,
|
|
2962
|
-
L:
|
|
2990
|
+
L: 140,
|
|
2963
2991
|
S: this,
|
|
2964
2992
|
C: (f, a) => f(...a)
|
|
2965
2993
|
});
|
|
2966
2994
|
invariant10(invitationId, void 0, {
|
|
2967
2995
|
F: __dxlog_file11,
|
|
2968
|
-
L:
|
|
2996
|
+
L: 141,
|
|
2969
2997
|
S: this,
|
|
2970
2998
|
A: [
|
|
2971
2999
|
"invitationId",
|
|
@@ -2978,7 +3006,7 @@ var InvitationsManager = class {
|
|
|
2978
3006
|
invitationId
|
|
2979
3007
|
}, {
|
|
2980
3008
|
F: __dxlog_file11,
|
|
2981
|
-
L:
|
|
3009
|
+
L: 144,
|
|
2982
3010
|
S: this,
|
|
2983
3011
|
C: (f, a) => f(...a)
|
|
2984
3012
|
});
|
|
@@ -2991,13 +3019,13 @@ var InvitationsManager = class {
|
|
|
2991
3019
|
invitationId
|
|
2992
3020
|
}, {
|
|
2993
3021
|
F: __dxlog_file11,
|
|
2994
|
-
L:
|
|
3022
|
+
L: 151,
|
|
2995
3023
|
S: this,
|
|
2996
3024
|
C: (f, a) => f(...a)
|
|
2997
3025
|
});
|
|
2998
3026
|
invariant10(invitationId, void 0, {
|
|
2999
3027
|
F: __dxlog_file11,
|
|
3000
|
-
L:
|
|
3028
|
+
L: 152,
|
|
3001
3029
|
S: this,
|
|
3002
3030
|
A: [
|
|
3003
3031
|
"invitationId",
|
|
@@ -3076,7 +3104,7 @@ var InvitationsManager = class {
|
|
|
3076
3104
|
...handler.toJSON()
|
|
3077
3105
|
}, {
|
|
3078
3106
|
F: __dxlog_file11,
|
|
3079
|
-
L:
|
|
3107
|
+
L: 241,
|
|
3080
3108
|
S: this,
|
|
3081
3109
|
C: (f, a) => f(...a)
|
|
3082
3110
|
});
|
|
@@ -3109,7 +3137,7 @@ var InvitationsManager = class {
|
|
|
3109
3137
|
...handler.toJSON()
|
|
3110
3138
|
}, {
|
|
3111
3139
|
F: __dxlog_file11,
|
|
3112
|
-
L:
|
|
3140
|
+
L: 261,
|
|
3113
3141
|
S: this,
|
|
3114
3142
|
C: (f, a) => f(...a)
|
|
3115
3143
|
});
|
|
@@ -3120,7 +3148,7 @@ var InvitationsManager = class {
|
|
|
3120
3148
|
} else {
|
|
3121
3149
|
log9.warn("auth failed", err, {
|
|
3122
3150
|
F: __dxlog_file11,
|
|
3123
|
-
L:
|
|
3151
|
+
L: 264,
|
|
3124
3152
|
S: this,
|
|
3125
3153
|
C: (f, a) => f(...a)
|
|
3126
3154
|
});
|
|
@@ -3137,7 +3165,7 @@ var InvitationsManager = class {
|
|
|
3137
3165
|
...handler.toJSON()
|
|
3138
3166
|
}, {
|
|
3139
3167
|
F: __dxlog_file11,
|
|
3140
|
-
L:
|
|
3168
|
+
L: 271,
|
|
3141
3169
|
S: this,
|
|
3142
3170
|
C: (f, a) => f(...a)
|
|
3143
3171
|
});
|
|
@@ -3182,7 +3210,7 @@ var InvitationsManager = class {
|
|
|
3182
3210
|
} catch (err) {
|
|
3183
3211
|
log9.catch(err, void 0, {
|
|
3184
3212
|
F: __dxlog_file11,
|
|
3185
|
-
L:
|
|
3213
|
+
L: 307,
|
|
3186
3214
|
S: this,
|
|
3187
3215
|
C: (f, a) => f(...a)
|
|
3188
3216
|
});
|
|
@@ -3279,18 +3307,16 @@ ClientRpcServer = _ts_decorate3([
|
|
|
3279
3307
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
3280
3308
|
import { Event as Event6, asyncTimeout, scheduleTask as scheduleTask5, sleep as sleep2, synchronized, trackLeaks } from "@dxos/async";
|
|
3281
3309
|
import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
|
|
3282
|
-
import {
|
|
3310
|
+
import { Context as Context8, ContextDisposedError as ContextDisposedError3, cancelWithContext as cancelWithContext4 } from "@dxos/context";
|
|
3283
3311
|
import { timed, warnAfterTimeout } from "@dxos/debug";
|
|
3284
|
-
import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
3285
|
-
import { AutomergeDocumentLoaderImpl } from "@dxos/echo-pipeline";
|
|
3312
|
+
import { AutomergeDocumentLoaderImpl, createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
3286
3313
|
import { TYPE_PROPERTIES } from "@dxos/echo-schema";
|
|
3287
3314
|
import { failedInvariant, invariant as invariant12 } from "@dxos/invariant";
|
|
3288
3315
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
3289
3316
|
import { log as log11 } from "@dxos/log";
|
|
3290
3317
|
import { CancelledError, SystemError } from "@dxos/protocols";
|
|
3291
|
-
import {
|
|
3292
|
-
import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3293
|
-
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3318
|
+
import { CreateEpochRequest, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
3319
|
+
import { AdmittedFeed as AdmittedFeed3, SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3294
3320
|
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
3295
3321
|
import { trace as trace6 } from "@dxos/tracing";
|
|
3296
3322
|
import { ComplexSet as ComplexSet5, assignDeep } from "@dxos/util";
|
|
@@ -3648,7 +3674,7 @@ var DataSpace = class {
|
|
|
3648
3674
|
state: SpaceState[this._state]
|
|
3649
3675
|
}, {
|
|
3650
3676
|
F: __dxlog_file13,
|
|
3651
|
-
L:
|
|
3677
|
+
L: 141,
|
|
3652
3678
|
S: this,
|
|
3653
3679
|
C: (f, a) => f(...a)
|
|
3654
3680
|
});
|
|
@@ -3698,7 +3724,7 @@ var DataSpace = class {
|
|
|
3698
3724
|
state: SpaceState[this._state]
|
|
3699
3725
|
}, {
|
|
3700
3726
|
F: __dxlog_file13,
|
|
3701
|
-
L:
|
|
3727
|
+
L: 199,
|
|
3702
3728
|
S: this,
|
|
3703
3729
|
C: (f, a) => f(...a)
|
|
3704
3730
|
});
|
|
@@ -3716,7 +3742,7 @@ var DataSpace = class {
|
|
|
3716
3742
|
state: SpaceState[this._state]
|
|
3717
3743
|
}, {
|
|
3718
3744
|
F: __dxlog_file13,
|
|
3719
|
-
L:
|
|
3745
|
+
L: 213,
|
|
3720
3746
|
S: this,
|
|
3721
3747
|
C: (f, a) => f(...a)
|
|
3722
3748
|
});
|
|
@@ -3748,7 +3774,7 @@ var DataSpace = class {
|
|
|
3748
3774
|
if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
|
|
3749
3775
|
log11("data pipeline initialization cancelled", err, {
|
|
3750
3776
|
F: __dxlog_file13,
|
|
3751
|
-
L:
|
|
3777
|
+
L: 246,
|
|
3752
3778
|
S: this,
|
|
3753
3779
|
C: (f, a) => f(...a)
|
|
3754
3780
|
});
|
|
@@ -3756,7 +3782,7 @@ var DataSpace = class {
|
|
|
3756
3782
|
}
|
|
3757
3783
|
log11.error("Error initializing data pipeline", err, {
|
|
3758
3784
|
F: __dxlog_file13,
|
|
3759
|
-
L:
|
|
3785
|
+
L: 250,
|
|
3760
3786
|
S: this,
|
|
3761
3787
|
C: (f, a) => f(...a)
|
|
3762
3788
|
});
|
|
@@ -3765,7 +3791,7 @@ var DataSpace = class {
|
|
|
3765
3791
|
state: SpaceState[this._state]
|
|
3766
3792
|
}, {
|
|
3767
3793
|
F: __dxlog_file13,
|
|
3768
|
-
L:
|
|
3794
|
+
L: 252,
|
|
3769
3795
|
S: this,
|
|
3770
3796
|
C: (f, a) => f(...a)
|
|
3771
3797
|
});
|
|
@@ -3785,7 +3811,7 @@ var DataSpace = class {
|
|
|
3785
3811
|
state: SpaceState[this._state]
|
|
3786
3812
|
}, {
|
|
3787
3813
|
F: __dxlog_file13,
|
|
3788
|
-
L:
|
|
3814
|
+
L: 268,
|
|
3789
3815
|
S: this,
|
|
3790
3816
|
C: (f, a) => f(...a)
|
|
3791
3817
|
});
|
|
@@ -3795,7 +3821,7 @@ var DataSpace = class {
|
|
|
3795
3821
|
await cancelWithContext4(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3796
3822
|
log11("data pipeline ready", void 0, {
|
|
3797
3823
|
F: __dxlog_file13,
|
|
3798
|
-
L:
|
|
3824
|
+
L: 280,
|
|
3799
3825
|
S: this,
|
|
3800
3826
|
C: (f, a) => f(...a)
|
|
3801
3827
|
});
|
|
@@ -3805,7 +3831,7 @@ var DataSpace = class {
|
|
|
3805
3831
|
state: SpaceState[this._state]
|
|
3806
3832
|
}, {
|
|
3807
3833
|
F: __dxlog_file13,
|
|
3808
|
-
L:
|
|
3834
|
+
L: 284,
|
|
3809
3835
|
S: this,
|
|
3810
3836
|
C: (f, a) => f(...a)
|
|
3811
3837
|
});
|
|
@@ -3821,7 +3847,7 @@ var DataSpace = class {
|
|
|
3821
3847
|
await this._createWritableFeeds();
|
|
3822
3848
|
log11("writable feeds created", void 0, {
|
|
3823
3849
|
F: __dxlog_file13,
|
|
3824
|
-
L:
|
|
3850
|
+
L: 300,
|
|
3825
3851
|
S: this,
|
|
3826
3852
|
C: (f, a) => f(...a)
|
|
3827
3853
|
});
|
|
@@ -3884,7 +3910,7 @@ var DataSpace = class {
|
|
|
3884
3910
|
rootUrl
|
|
3885
3911
|
}, {
|
|
3886
3912
|
F: __dxlog_file13,
|
|
3887
|
-
L:
|
|
3913
|
+
L: 366,
|
|
3888
3914
|
S: this,
|
|
3889
3915
|
C: (f, a) => f(...a)
|
|
3890
3916
|
});
|
|
@@ -3906,6 +3932,7 @@ var DataSpace = class {
|
|
|
3906
3932
|
};
|
|
3907
3933
|
});
|
|
3908
3934
|
}
|
|
3935
|
+
await this._echoHost.openSpaceRoot(handle.url);
|
|
3909
3936
|
} catch (err) {
|
|
3910
3937
|
if (err instanceof ContextDisposedError3) {
|
|
3911
3938
|
return;
|
|
@@ -3916,7 +3943,7 @@ var DataSpace = class {
|
|
|
3916
3943
|
err
|
|
3917
3944
|
}, {
|
|
3918
3945
|
F: __dxlog_file13,
|
|
3919
|
-
L:
|
|
3946
|
+
L: 395,
|
|
3920
3947
|
S: this,
|
|
3921
3948
|
C: (f, a) => f(...a)
|
|
3922
3949
|
});
|
|
@@ -3971,7 +3998,7 @@ var DataSpace = class {
|
|
|
3971
3998
|
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
3972
3999
|
invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3973
4000
|
F: __dxlog_file13,
|
|
3974
|
-
L:
|
|
4001
|
+
L: 445,
|
|
3975
4002
|
S: this,
|
|
3976
4003
|
A: [
|
|
3977
4004
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -3990,7 +4017,7 @@ var DataSpace = class {
|
|
|
3990
4017
|
{
|
|
3991
4018
|
log11.info("Fragmenting", void 0, {
|
|
3992
4019
|
F: __dxlog_file13,
|
|
3993
|
-
L:
|
|
4020
|
+
L: 457,
|
|
3994
4021
|
S: this,
|
|
3995
4022
|
C: (f, a) => f(...a)
|
|
3996
4023
|
});
|
|
@@ -3998,11 +4025,11 @@ var DataSpace = class {
|
|
|
3998
4025
|
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
3999
4026
|
await cancelWithContext4(this._ctx, asyncTimeout(rootHandle.whenReady(), 1e4));
|
|
4000
4027
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
4001
|
-
const properties =
|
|
4028
|
+
const properties = findPropertiesObject(rootHandle.docSync());
|
|
4002
4029
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4003
4030
|
invariant12(properties, "Properties not found", {
|
|
4004
4031
|
F: __dxlog_file13,
|
|
4005
|
-
L:
|
|
4032
|
+
L: 467,
|
|
4006
4033
|
S: this,
|
|
4007
4034
|
A: [
|
|
4008
4035
|
"properties",
|
|
@@ -4018,7 +4045,7 @@ var DataSpace = class {
|
|
|
4018
4045
|
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
4019
4046
|
invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4020
4047
|
F: __dxlog_file13,
|
|
4021
|
-
L:
|
|
4048
|
+
L: 472,
|
|
4022
4049
|
S: this,
|
|
4023
4050
|
A: [
|
|
4024
4051
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -4087,7 +4114,7 @@ var DataSpace = class {
|
|
|
4087
4114
|
state: SpaceState[this._state]
|
|
4088
4115
|
}, {
|
|
4089
4116
|
F: __dxlog_file13,
|
|
4090
|
-
L:
|
|
4117
|
+
L: 538,
|
|
4091
4118
|
S: this,
|
|
4092
4119
|
C: (f, a) => f(...a)
|
|
4093
4120
|
});
|
|
@@ -4139,17 +4166,32 @@ DataSpace = _ts_decorate4([
|
|
|
4139
4166
|
trackLeaks("open", "close"),
|
|
4140
4167
|
trace6.resource()
|
|
4141
4168
|
], DataSpace);
|
|
4169
|
+
var findPropertiesObject = (spaceDoc) => {
|
|
4170
|
+
for (const id in spaceDoc.objects ?? {}) {
|
|
4171
|
+
const obj = spaceDoc.objects[id];
|
|
4172
|
+
if (obj.system.type?.itemId === TYPE_PROPERTIES) {
|
|
4173
|
+
return [
|
|
4174
|
+
id,
|
|
4175
|
+
obj
|
|
4176
|
+
];
|
|
4177
|
+
}
|
|
4178
|
+
}
|
|
4179
|
+
return void 0;
|
|
4180
|
+
};
|
|
4142
4181
|
|
|
4143
4182
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
4144
4183
|
import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
4145
|
-
import {
|
|
4184
|
+
import { cancelWithContext as cancelWithContext5, Context as Context9 } from "@dxos/context";
|
|
4146
4185
|
import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
4186
|
+
import { AuthStatus } from "@dxos/echo-pipeline";
|
|
4147
4187
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
4148
4188
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4149
4189
|
import { log as log12 } from "@dxos/log";
|
|
4150
|
-
import { trace as
|
|
4190
|
+
import { trace as Trace2 } from "@dxos/protocols";
|
|
4151
4191
|
import { Invitation as Invitation7, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4192
|
+
import { SpaceMember as SpaceMember5 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
4152
4193
|
import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
|
|
4194
|
+
import { trace as trace7 } from "@dxos/tracing";
|
|
4153
4195
|
import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
|
|
4154
4196
|
|
|
4155
4197
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
@@ -4253,6 +4295,28 @@ var DataSpaceManager = class {
|
|
|
4253
4295
|
const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
|
|
4254
4296
|
this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
|
|
4255
4297
|
this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
|
|
4298
|
+
trace7.diagnostic({
|
|
4299
|
+
id: "spaces",
|
|
4300
|
+
name: "Spaces",
|
|
4301
|
+
fetch: async () => {
|
|
4302
|
+
return Array.from(this._spaces.values()).map((space) => {
|
|
4303
|
+
const rootUrl = space.automergeSpaceState.rootUrl;
|
|
4304
|
+
const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
|
|
4305
|
+
const rootDoc = rootHandle?.docSync();
|
|
4306
|
+
const properties = rootDoc && findPropertiesObject(rootDoc);
|
|
4307
|
+
return {
|
|
4308
|
+
key: space.key.toHex(),
|
|
4309
|
+
state: SpaceState2[space.state],
|
|
4310
|
+
name: properties?.[1].data.name ?? null,
|
|
4311
|
+
inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
|
|
4312
|
+
linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
|
|
4313
|
+
credentials: space.inner.spaceState.credentials.length,
|
|
4314
|
+
members: space.inner.spaceState.members.size,
|
|
4315
|
+
rootUrl
|
|
4316
|
+
};
|
|
4317
|
+
});
|
|
4318
|
+
}
|
|
4319
|
+
});
|
|
4256
4320
|
}
|
|
4257
4321
|
// TODO(burdon): Remove.
|
|
4258
4322
|
get spaces() {
|
|
@@ -4261,15 +4325,15 @@ var DataSpaceManager = class {
|
|
|
4261
4325
|
async open() {
|
|
4262
4326
|
log12("open", void 0, {
|
|
4263
4327
|
F: __dxlog_file14,
|
|
4264
|
-
L:
|
|
4328
|
+
L: 144,
|
|
4265
4329
|
S: this,
|
|
4266
4330
|
C: (f, a) => f(...a)
|
|
4267
4331
|
});
|
|
4268
|
-
log12.trace("dxos.echo.data-space-manager.open",
|
|
4332
|
+
log12.trace("dxos.echo.data-space-manager.open", Trace2.begin({
|
|
4269
4333
|
id: this._instanceId
|
|
4270
4334
|
}), {
|
|
4271
4335
|
F: __dxlog_file14,
|
|
4272
|
-
L:
|
|
4336
|
+
L: 145,
|
|
4273
4337
|
S: this,
|
|
4274
4338
|
C: (f, a) => f(...a)
|
|
4275
4339
|
});
|
|
@@ -4277,7 +4341,7 @@ var DataSpaceManager = class {
|
|
|
4277
4341
|
spaces: this._metadataStore.spaces.length
|
|
4278
4342
|
}, {
|
|
4279
4343
|
F: __dxlog_file14,
|
|
4280
|
-
L:
|
|
4344
|
+
L: 146,
|
|
4281
4345
|
S: this,
|
|
4282
4346
|
C: (f, a) => f(...a)
|
|
4283
4347
|
});
|
|
@@ -4287,7 +4351,7 @@ var DataSpaceManager = class {
|
|
|
4287
4351
|
spaceMetadata
|
|
4288
4352
|
}, {
|
|
4289
4353
|
F: __dxlog_file14,
|
|
4290
|
-
L:
|
|
4354
|
+
L: 150,
|
|
4291
4355
|
S: this,
|
|
4292
4356
|
C: (f, a) => f(...a)
|
|
4293
4357
|
});
|
|
@@ -4298,7 +4362,7 @@ var DataSpaceManager = class {
|
|
|
4298
4362
|
err
|
|
4299
4363
|
}, {
|
|
4300
4364
|
F: __dxlog_file14,
|
|
4301
|
-
L:
|
|
4365
|
+
L: 153,
|
|
4302
4366
|
S: this,
|
|
4303
4367
|
C: (f, a) => f(...a)
|
|
4304
4368
|
});
|
|
@@ -4311,11 +4375,11 @@ var DataSpaceManager = class {
|
|
|
4311
4375
|
space.initializeDataPipelineAsync();
|
|
4312
4376
|
}
|
|
4313
4377
|
}
|
|
4314
|
-
log12.trace("dxos.echo.data-space-manager.open",
|
|
4378
|
+
log12.trace("dxos.echo.data-space-manager.open", Trace2.end({
|
|
4315
4379
|
id: this._instanceId
|
|
4316
4380
|
}), {
|
|
4317
4381
|
F: __dxlog_file14,
|
|
4318
|
-
L:
|
|
4382
|
+
L: 166,
|
|
4319
4383
|
S: this,
|
|
4320
4384
|
C: (f, a) => f(...a)
|
|
4321
4385
|
});
|
|
@@ -4323,7 +4387,7 @@ var DataSpaceManager = class {
|
|
|
4323
4387
|
async close() {
|
|
4324
4388
|
log12("close", void 0, {
|
|
4325
4389
|
F: __dxlog_file14,
|
|
4326
|
-
L:
|
|
4390
|
+
L: 171,
|
|
4327
4391
|
S: this,
|
|
4328
4392
|
C: (f, a) => f(...a)
|
|
4329
4393
|
});
|
|
@@ -4339,7 +4403,7 @@ var DataSpaceManager = class {
|
|
|
4339
4403
|
async createSpace() {
|
|
4340
4404
|
invariant13(this._isOpen, "Not open.", {
|
|
4341
4405
|
F: __dxlog_file14,
|
|
4342
|
-
L:
|
|
4406
|
+
L: 184,
|
|
4343
4407
|
S: this,
|
|
4344
4408
|
A: [
|
|
4345
4409
|
"this._isOpen",
|
|
@@ -4360,18 +4424,18 @@ var DataSpaceManager = class {
|
|
|
4360
4424
|
spaceKey
|
|
4361
4425
|
}, {
|
|
4362
4426
|
F: __dxlog_file14,
|
|
4363
|
-
L:
|
|
4427
|
+
L: 196,
|
|
4364
4428
|
S: this,
|
|
4365
4429
|
C: (f, a) => f(...a)
|
|
4366
4430
|
});
|
|
4367
|
-
const
|
|
4431
|
+
const root = await this._echoHost.createSpaceRoot(spaceKey);
|
|
4368
4432
|
const space = await this._constructSpace(metadata);
|
|
4369
|
-
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner,
|
|
4433
|
+
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
|
|
4370
4434
|
await this._metadataStore.addSpace(metadata);
|
|
4371
4435
|
const memberCredential = credentials[1];
|
|
4372
4436
|
invariant13(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4373
4437
|
F: __dxlog_file14,
|
|
4374
|
-
L:
|
|
4438
|
+
L: 205,
|
|
4375
4439
|
S: this,
|
|
4376
4440
|
A: [
|
|
4377
4441
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -4389,13 +4453,13 @@ var DataSpaceManager = class {
|
|
|
4389
4453
|
opts
|
|
4390
4454
|
}, {
|
|
4391
4455
|
F: __dxlog_file14,
|
|
4392
|
-
L:
|
|
4456
|
+
L: 217,
|
|
4393
4457
|
S: this,
|
|
4394
4458
|
C: (f, a) => f(...a)
|
|
4395
4459
|
});
|
|
4396
4460
|
invariant13(this._isOpen, "Not open.", {
|
|
4397
4461
|
F: __dxlog_file14,
|
|
4398
|
-
L:
|
|
4462
|
+
L: 218,
|
|
4399
4463
|
S: this,
|
|
4400
4464
|
A: [
|
|
4401
4465
|
"this._isOpen",
|
|
@@ -4404,7 +4468,7 @@ var DataSpaceManager = class {
|
|
|
4404
4468
|
});
|
|
4405
4469
|
invariant13(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
4406
4470
|
F: __dxlog_file14,
|
|
4407
|
-
L:
|
|
4471
|
+
L: 219,
|
|
4408
4472
|
S: this,
|
|
4409
4473
|
A: [
|
|
4410
4474
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -4439,7 +4503,7 @@ var DataSpaceManager = class {
|
|
|
4439
4503
|
metadata
|
|
4440
4504
|
}, {
|
|
4441
4505
|
F: __dxlog_file14,
|
|
4442
|
-
L:
|
|
4506
|
+
L: 252,
|
|
4443
4507
|
S: this,
|
|
4444
4508
|
C: (f, a) => f(...a)
|
|
4445
4509
|
});
|
|
@@ -4477,11 +4541,16 @@ var DataSpaceManager = class {
|
|
|
4477
4541
|
onAuthFailure: () => {
|
|
4478
4542
|
log12.warn("auth failure", void 0, {
|
|
4479
4543
|
F: __dxlog_file14,
|
|
4480
|
-
L:
|
|
4544
|
+
L: 289,
|
|
4481
4545
|
S: this,
|
|
4482
4546
|
C: (f, a) => f(...a)
|
|
4483
4547
|
});
|
|
4484
4548
|
},
|
|
4549
|
+
onMemberRolesChanged: async (members) => {
|
|
4550
|
+
if (dataSpace?.state === SpaceState2.READY) {
|
|
4551
|
+
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
4552
|
+
}
|
|
4553
|
+
},
|
|
4485
4554
|
memberKey: this._signingContext.identityKey,
|
|
4486
4555
|
onDelegatedInvitationStatusChange: (invitation, isActive) => {
|
|
4487
4556
|
return this._handleInvitationStatusChange(dataSpace, invitation, isActive);
|
|
@@ -4505,7 +4574,7 @@ var DataSpaceManager = class {
|
|
|
4505
4574
|
space: space.key
|
|
4506
4575
|
}, {
|
|
4507
4576
|
F: __dxlog_file14,
|
|
4508
|
-
L:
|
|
4577
|
+
L: 316,
|
|
4509
4578
|
S: this,
|
|
4510
4579
|
C: (f, a) => f(...a)
|
|
4511
4580
|
});
|
|
@@ -4516,7 +4585,7 @@ var DataSpaceManager = class {
|
|
|
4516
4585
|
open: this._isOpen
|
|
4517
4586
|
}, {
|
|
4518
4587
|
F: __dxlog_file14,
|
|
4519
|
-
L:
|
|
4588
|
+
L: 319,
|
|
4520
4589
|
S: this,
|
|
4521
4590
|
C: (f, a) => f(...a)
|
|
4522
4591
|
});
|
|
@@ -4524,6 +4593,9 @@ var DataSpaceManager = class {
|
|
|
4524
4593
|
await this._createDelegatedInvitations(dataSpace, [
|
|
4525
4594
|
...space.spaceState.invitations.entries()
|
|
4526
4595
|
]);
|
|
4596
|
+
this._handleMemberRoleChanges(presence, space.protocol, [
|
|
4597
|
+
...space.spaceState.members.values()
|
|
4598
|
+
]);
|
|
4527
4599
|
this.updated.emit();
|
|
4528
4600
|
}
|
|
4529
4601
|
},
|
|
@@ -4532,7 +4604,7 @@ var DataSpaceManager = class {
|
|
|
4532
4604
|
space: space.key
|
|
4533
4605
|
}, {
|
|
4534
4606
|
F: __dxlog_file14,
|
|
4535
|
-
L:
|
|
4607
|
+
L: 327,
|
|
4536
4608
|
S: this,
|
|
4537
4609
|
C: (f, a) => f(...a)
|
|
4538
4610
|
});
|
|
@@ -4540,6 +4612,11 @@ var DataSpaceManager = class {
|
|
|
4540
4612
|
},
|
|
4541
4613
|
cache: metadata.cache
|
|
4542
4614
|
});
|
|
4615
|
+
presence.newPeer.on((peerState) => {
|
|
4616
|
+
if (dataSpace.state === SpaceState2.READY) {
|
|
4617
|
+
this._handleNewPeerConnected(space, peerState);
|
|
4618
|
+
}
|
|
4619
|
+
});
|
|
4543
4620
|
if (metadata.state !== SpaceState2.INACTIVE) {
|
|
4544
4621
|
await dataSpace.open();
|
|
4545
4622
|
}
|
|
@@ -4549,6 +4626,51 @@ var DataSpaceManager = class {
|
|
|
4549
4626
|
this._spaces.set(metadata.key, dataSpace);
|
|
4550
4627
|
return dataSpace;
|
|
4551
4628
|
}
|
|
4629
|
+
_handleMemberRoleChanges(presence, spaceProtocol, memberInfo) {
|
|
4630
|
+
let closedSessions = 0;
|
|
4631
|
+
for (const member of memberInfo) {
|
|
4632
|
+
if (member.key.equals(presence.getLocalState().identityKey)) {
|
|
4633
|
+
continue;
|
|
4634
|
+
}
|
|
4635
|
+
const peers = presence.getPeersByIdentityKey(member.key);
|
|
4636
|
+
const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
|
|
4637
|
+
const sessionsToClose = sessions.filter((s) => {
|
|
4638
|
+
return (s && member.role === SpaceMember5.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
|
|
4639
|
+
});
|
|
4640
|
+
sessionsToClose.forEach((session) => {
|
|
4641
|
+
void session.close().catch(log12.error);
|
|
4642
|
+
});
|
|
4643
|
+
closedSessions += sessionsToClose.length;
|
|
4644
|
+
}
|
|
4645
|
+
log12("processed member role changes", {
|
|
4646
|
+
roleChangeCount: memberInfo.length,
|
|
4647
|
+
peersOnline: presence.getPeersOnline().length,
|
|
4648
|
+
closedSessions
|
|
4649
|
+
}, {
|
|
4650
|
+
F: __dxlog_file14,
|
|
4651
|
+
L: 367,
|
|
4652
|
+
S: this,
|
|
4653
|
+
C: (f, a) => f(...a)
|
|
4654
|
+
});
|
|
4655
|
+
spaceProtocol.updateTopology();
|
|
4656
|
+
}
|
|
4657
|
+
_handleNewPeerConnected(space, peerState) {
|
|
4658
|
+
const role = space.spaceState.getMemberRole(peerState.identityKey);
|
|
4659
|
+
if (role === SpaceMember5.Role.REMOVED) {
|
|
4660
|
+
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
4661
|
+
if (session != null) {
|
|
4662
|
+
log12("closing a session with a removed peer", {
|
|
4663
|
+
peerId: peerState.peerId
|
|
4664
|
+
}, {
|
|
4665
|
+
F: __dxlog_file14,
|
|
4666
|
+
L: 381,
|
|
4667
|
+
S: this,
|
|
4668
|
+
C: (f, a) => f(...a)
|
|
4669
|
+
});
|
|
4670
|
+
void session.close().catch(log12.error);
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
}
|
|
4552
4674
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
4553
4675
|
if (dataSpace?.state !== SpaceState2.READY) {
|
|
4554
4676
|
return;
|
|
@@ -4604,12 +4726,13 @@ DataSpaceManager = _ts_decorate5([
|
|
|
4604
4726
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
4605
4727
|
import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask6 } from "@dxos/async";
|
|
4606
4728
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
4729
|
+
import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
4607
4730
|
import { raise as raise2 } from "@dxos/debug";
|
|
4731
|
+
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
4608
4732
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4609
4733
|
import { log as log13 } from "@dxos/log";
|
|
4610
|
-
import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
|
|
4611
|
-
import { SpaceMember as
|
|
4612
|
-
import { SpaceMember as HaloSpaceMember } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
4734
|
+
import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
|
|
4735
|
+
import { SpaceMember as SpaceMember6, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4613
4736
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
4614
4737
|
var SpacesServiceImpl = class {
|
|
4615
4738
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
@@ -4618,16 +4741,14 @@ var SpacesServiceImpl = class {
|
|
|
4618
4741
|
this._getDataSpaceManager = _getDataSpaceManager;
|
|
4619
4742
|
}
|
|
4620
4743
|
async createSpace() {
|
|
4621
|
-
|
|
4622
|
-
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo");
|
|
4623
|
-
}
|
|
4744
|
+
this._requireIdentity();
|
|
4624
4745
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4625
4746
|
const space = await dataSpaceManager.createSpace();
|
|
4626
4747
|
return this._serializeSpace(space);
|
|
4627
4748
|
}
|
|
4628
4749
|
async updateSpace({ spaceKey, state }) {
|
|
4629
4750
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4630
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4751
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4631
4752
|
if (state) {
|
|
4632
4753
|
switch (state) {
|
|
4633
4754
|
case SpaceState3.ACTIVE:
|
|
@@ -4641,8 +4762,39 @@ var SpacesServiceImpl = class {
|
|
|
4641
4762
|
}
|
|
4642
4763
|
}
|
|
4643
4764
|
}
|
|
4644
|
-
async updateMemberRole(
|
|
4645
|
-
|
|
4765
|
+
async updateMemberRole(request) {
|
|
4766
|
+
const identity = this._requireIdentity();
|
|
4767
|
+
const space = this._spaceManager.spaces.get(request.spaceKey);
|
|
4768
|
+
if (space == null) {
|
|
4769
|
+
throw new SpaceNotFoundError2(request.spaceKey);
|
|
4770
|
+
}
|
|
4771
|
+
if (!space.spaceState.hasMembershipManagementPermission(identity.identityKey)) {
|
|
4772
|
+
throw new AuthorizationError2("No member management permission.", {
|
|
4773
|
+
spaceKey: space.key,
|
|
4774
|
+
role: space.spaceState.getMemberRole(identity.identityKey)
|
|
4775
|
+
});
|
|
4776
|
+
}
|
|
4777
|
+
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
4778
|
+
invariant14(credentials[0].credential, void 0, {
|
|
4779
|
+
F: __dxlog_file15,
|
|
4780
|
+
L: 95,
|
|
4781
|
+
S: this,
|
|
4782
|
+
A: [
|
|
4783
|
+
"credentials[0].credential",
|
|
4784
|
+
""
|
|
4785
|
+
]
|
|
4786
|
+
});
|
|
4787
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
4788
|
+
invariant14(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4789
|
+
F: __dxlog_file15,
|
|
4790
|
+
L: 97,
|
|
4791
|
+
S: this,
|
|
4792
|
+
A: [
|
|
4793
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
4794
|
+
""
|
|
4795
|
+
]
|
|
4796
|
+
});
|
|
4797
|
+
await writeMessages3(space.controlPipeline.writer, credentials);
|
|
4646
4798
|
}
|
|
4647
4799
|
querySpaces() {
|
|
4648
4800
|
return new Stream10(({ next, ctx }) => {
|
|
@@ -4653,7 +4805,7 @@ var SpacesServiceImpl = class {
|
|
|
4653
4805
|
spaces
|
|
4654
4806
|
}, {
|
|
4655
4807
|
F: __dxlog_file15,
|
|
4656
|
-
L:
|
|
4808
|
+
L: 108,
|
|
4657
4809
|
S: this,
|
|
4658
4810
|
C: (f, a) => f(...a)
|
|
4659
4811
|
});
|
|
@@ -4692,14 +4844,14 @@ var SpacesServiceImpl = class {
|
|
|
4692
4844
|
}
|
|
4693
4845
|
async postMessage({ spaceKey, channel, message }) {
|
|
4694
4846
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4695
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4847
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4696
4848
|
await space.postMessage(getChannelId(channel), message);
|
|
4697
4849
|
}
|
|
4698
4850
|
subscribeMessages({ spaceKey, channel }) {
|
|
4699
4851
|
return new Stream10(({ ctx, next }) => {
|
|
4700
4852
|
scheduleTask6(ctx, async () => {
|
|
4701
4853
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4702
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4854
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4703
4855
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
4704
4856
|
next(message);
|
|
4705
4857
|
});
|
|
@@ -4709,7 +4861,7 @@ var SpacesServiceImpl = class {
|
|
|
4709
4861
|
}
|
|
4710
4862
|
queryCredentials({ spaceKey, noTail }) {
|
|
4711
4863
|
return new Stream10(({ ctx, next, close }) => {
|
|
4712
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4864
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4713
4865
|
const processor = {
|
|
4714
4866
|
processCredential: async (credential) => {
|
|
4715
4867
|
next(credential);
|
|
@@ -4725,7 +4877,7 @@ var SpacesServiceImpl = class {
|
|
|
4725
4877
|
});
|
|
4726
4878
|
}
|
|
4727
4879
|
async writeCredentials({ spaceKey, credentials }) {
|
|
4728
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4880
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4729
4881
|
for (const credential of credentials ?? []) {
|
|
4730
4882
|
if (credential.proof) {
|
|
4731
4883
|
await space.controlPipeline.writer.write({
|
|
@@ -4736,7 +4888,7 @@ var SpacesServiceImpl = class {
|
|
|
4736
4888
|
} else {
|
|
4737
4889
|
invariant14(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
4738
4890
|
F: __dxlog_file15,
|
|
4739
|
-
L:
|
|
4891
|
+
L: 195,
|
|
4740
4892
|
S: this,
|
|
4741
4893
|
A: [
|
|
4742
4894
|
"!credential.id",
|
|
@@ -4745,7 +4897,7 @@ var SpacesServiceImpl = class {
|
|
|
4745
4897
|
});
|
|
4746
4898
|
invariant14(this._identityManager.identity, "Identity is not available", {
|
|
4747
4899
|
F: __dxlog_file15,
|
|
4748
|
-
L:
|
|
4900
|
+
L: 196,
|
|
4749
4901
|
S: this,
|
|
4750
4902
|
A: [
|
|
4751
4903
|
"this._identityManager.identity",
|
|
@@ -4755,7 +4907,7 @@ var SpacesServiceImpl = class {
|
|
|
4755
4907
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
4756
4908
|
invariant14(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
4757
4909
|
F: __dxlog_file15,
|
|
4758
|
-
L:
|
|
4910
|
+
L: 198,
|
|
4759
4911
|
S: this,
|
|
4760
4912
|
A: [
|
|
4761
4913
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -4776,7 +4928,7 @@ var SpacesServiceImpl = class {
|
|
|
4776
4928
|
}
|
|
4777
4929
|
async createEpoch({ spaceKey, migration }) {
|
|
4778
4930
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4779
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4931
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4780
4932
|
await space.createEpoch({
|
|
4781
4933
|
migration
|
|
4782
4934
|
});
|
|
@@ -4810,7 +4962,8 @@ var SpacesServiceImpl = class {
|
|
|
4810
4962
|
identityKey: member.key,
|
|
4811
4963
|
profile: member.profile ?? {}
|
|
4812
4964
|
},
|
|
4813
|
-
|
|
4965
|
+
role: member.role,
|
|
4966
|
+
presence: peers.length > 0 ? SpaceMember6.PresenceState.ONLINE : SpaceMember6.PresenceState.OFFLINE,
|
|
4814
4967
|
peerStates: peers
|
|
4815
4968
|
};
|
|
4816
4969
|
}),
|
|
@@ -4819,13 +4972,19 @@ var SpacesServiceImpl = class {
|
|
|
4819
4972
|
metrics: space.metrics
|
|
4820
4973
|
};
|
|
4821
4974
|
}
|
|
4975
|
+
_requireIdentity() {
|
|
4976
|
+
if (!this._identityManager.identity) {
|
|
4977
|
+
throw new IdentityNotInitializedError("This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo");
|
|
4978
|
+
}
|
|
4979
|
+
return this._identityManager.identity;
|
|
4980
|
+
}
|
|
4822
4981
|
};
|
|
4823
4982
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
4824
4983
|
|
|
4825
4984
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
4826
4985
|
import { Trigger as Trigger6 } from "@dxos/async";
|
|
4827
4986
|
import { Context as Context10, Resource } from "@dxos/context";
|
|
4828
|
-
import { getCredentialAssertion as
|
|
4987
|
+
import { getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
|
|
4829
4988
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
4830
4989
|
import { EchoHost } from "@dxos/echo-db";
|
|
4831
4990
|
import { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
|
|
@@ -4837,7 +4996,7 @@ import { log as log14 } from "@dxos/log";
|
|
|
4837
4996
|
import { InvalidStorageVersionError, STORAGE_VERSION, trace as trace8 } from "@dxos/protocols";
|
|
4838
4997
|
import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4839
4998
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
4840
|
-
import { trace as
|
|
4999
|
+
import { trace as Trace3 } from "@dxos/tracing";
|
|
4841
5000
|
import { safeInstanceof } from "@dxos/util";
|
|
4842
5001
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
4843
5002
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -5041,7 +5200,7 @@ var ServiceContext = class extends Resource {
|
|
|
5041
5200
|
this.initialized.wake();
|
|
5042
5201
|
this._deviceSpaceSync = {
|
|
5043
5202
|
processCredential: async (credential) => {
|
|
5044
|
-
const assertion =
|
|
5203
|
+
const assertion = getCredentialAssertion4(credential);
|
|
5045
5204
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
5046
5205
|
return;
|
|
5047
5206
|
}
|
|
@@ -5097,14 +5256,14 @@ var ServiceContext = class extends Resource {
|
|
|
5097
5256
|
}
|
|
5098
5257
|
};
|
|
5099
5258
|
_ts_decorate6([
|
|
5100
|
-
|
|
5259
|
+
Trace3.span()
|
|
5101
5260
|
], ServiceContext.prototype, "_open", null);
|
|
5102
5261
|
_ts_decorate6([
|
|
5103
|
-
|
|
5262
|
+
Trace3.span()
|
|
5104
5263
|
], ServiceContext.prototype, "_initialize", null);
|
|
5105
5264
|
ServiceContext = _ts_decorate6([
|
|
5106
5265
|
safeInstanceof("dxos.client-services.ServiceContext"),
|
|
5107
|
-
|
|
5266
|
+
Trace3.resource()
|
|
5108
5267
|
], ServiceContext);
|
|
5109
5268
|
|
|
5110
5269
|
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
@@ -5137,11 +5296,11 @@ import { getFirstStreamValue } from "@dxos/codec-protobuf";
|
|
|
5137
5296
|
import { credentialTypeFilter } from "@dxos/credentials";
|
|
5138
5297
|
import { invariant as invariant16 } from "@dxos/invariant";
|
|
5139
5298
|
import { STORAGE_VERSION as STORAGE_VERSION2 } from "@dxos/protocols";
|
|
5140
|
-
import { SpaceMember as
|
|
5299
|
+
import { SpaceMember as SpaceMember7 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5141
5300
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
5142
5301
|
|
|
5143
5302
|
// packages/sdk/client-services/src/version.ts
|
|
5144
|
-
var DXOS_VERSION = "0.5.3-main.
|
|
5303
|
+
var DXOS_VERSION = "0.5.3-main.5eb30e6";
|
|
5145
5304
|
|
|
5146
5305
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
5147
5306
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -5249,13 +5408,14 @@ var getSpaceStats = async (space) => {
|
|
|
5249
5408
|
id: credential.id
|
|
5250
5409
|
})),
|
|
5251
5410
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
5411
|
+
role: member.role,
|
|
5252
5412
|
identity: {
|
|
5253
5413
|
identityKey: member.key,
|
|
5254
5414
|
profile: {
|
|
5255
5415
|
displayName: member.assertion.profile?.displayName
|
|
5256
5416
|
}
|
|
5257
5417
|
},
|
|
5258
|
-
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ?
|
|
5418
|
+
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember7.PresenceState.ONLINE : SpaceMember7.PresenceState.OFFLINE
|
|
5259
5419
|
})),
|
|
5260
5420
|
pipeline: {
|
|
5261
5421
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
@@ -5404,7 +5564,7 @@ import { WebsocketSignalManager } from "@dxos/messaging";
|
|
|
5404
5564
|
import { NetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
5405
5565
|
import { trace as trace9 } from "@dxos/protocols";
|
|
5406
5566
|
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
5407
|
-
import { TRACE_PROCESSOR as TRACE_PROCESSOR2, trace as
|
|
5567
|
+
import { TRACE_PROCESSOR as TRACE_PROCESSOR2, trace as Trace4 } from "@dxos/tracing";
|
|
5408
5568
|
import { assignDeep as assignDeep2 } from "@dxos/util";
|
|
5409
5569
|
import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
5410
5570
|
|
|
@@ -6288,21 +6448,21 @@ var ClientServicesHost = class {
|
|
|
6288
6448
|
}
|
|
6289
6449
|
};
|
|
6290
6450
|
_ts_decorate8([
|
|
6291
|
-
|
|
6451
|
+
Trace4.info()
|
|
6292
6452
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
6293
6453
|
_ts_decorate8([
|
|
6294
|
-
|
|
6454
|
+
Trace4.info()
|
|
6295
6455
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
6296
6456
|
_ts_decorate8([
|
|
6297
6457
|
synchronized3,
|
|
6298
|
-
|
|
6458
|
+
Trace4.span()
|
|
6299
6459
|
], ClientServicesHost.prototype, "open", null);
|
|
6300
6460
|
_ts_decorate8([
|
|
6301
6461
|
synchronized3,
|
|
6302
|
-
|
|
6462
|
+
Trace4.span()
|
|
6303
6463
|
], ClientServicesHost.prototype, "close", null);
|
|
6304
6464
|
ClientServicesHost = _ts_decorate8([
|
|
6305
|
-
|
|
6465
|
+
Trace4.resource()
|
|
6306
6466
|
], ClientServicesHost);
|
|
6307
6467
|
|
|
6308
6468
|
// packages/sdk/client-services/src/packlets/services/util.ts
|
|
@@ -6371,6 +6531,7 @@ export {
|
|
|
6371
6531
|
InvitationsManager,
|
|
6372
6532
|
ClientRpcServer,
|
|
6373
6533
|
DataSpace,
|
|
6534
|
+
findPropertiesObject,
|
|
6374
6535
|
DataSpaceManager,
|
|
6375
6536
|
SpacesServiceImpl,
|
|
6376
6537
|
ServiceContext,
|
|
@@ -6386,4 +6547,4 @@ export {
|
|
|
6386
6547
|
ClientServicesHost,
|
|
6387
6548
|
ClientServicesProviderResource
|
|
6388
6549
|
};
|
|
6389
|
-
//# sourceMappingURL=chunk-
|
|
6550
|
+
//# sourceMappingURL=chunk-W6NTTNM6.mjs.map
|