@dxos/client-services 0.5.3-main.f752aaa → 0.5.3-main.fffc127
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-3ZUGGKNX.mjs → chunk-OYIJIAJI.mjs} +293 -120
- package/dist/lib/browser/chunk-OYIJIAJI.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-TQQUIYBW.cjs → chunk-FIKOGQP2.cjs} +293 -119
- package/dist/lib/node/chunk-FIKOGQP2.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 +35 -8
- package/src/packlets/spaces/spaces-service.ts +46 -15
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-3ZUGGKNX.mjs.map +0 -7
- package/dist/lib/node/chunk-TQQUIYBW.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,19 @@ var DataSpace = class {
|
|
|
3906
3932
|
};
|
|
3907
3933
|
});
|
|
3908
3934
|
}
|
|
3935
|
+
if (!this._echoHost.roots.has(handle.documentId)) {
|
|
3936
|
+
await this._echoHost.openSpaceRoot(handle.url);
|
|
3937
|
+
} else {
|
|
3938
|
+
log11.warn("echo database root already exists", {
|
|
3939
|
+
space: this.key,
|
|
3940
|
+
rootUrl
|
|
3941
|
+
}, {
|
|
3942
|
+
F: __dxlog_file13,
|
|
3943
|
+
L: 393,
|
|
3944
|
+
S: this,
|
|
3945
|
+
C: (f, a) => f(...a)
|
|
3946
|
+
});
|
|
3947
|
+
}
|
|
3909
3948
|
} catch (err) {
|
|
3910
3949
|
if (err instanceof ContextDisposedError3) {
|
|
3911
3950
|
return;
|
|
@@ -3916,7 +3955,7 @@ var DataSpace = class {
|
|
|
3916
3955
|
err
|
|
3917
3956
|
}, {
|
|
3918
3957
|
F: __dxlog_file13,
|
|
3919
|
-
L:
|
|
3958
|
+
L: 399,
|
|
3920
3959
|
S: this,
|
|
3921
3960
|
C: (f, a) => f(...a)
|
|
3922
3961
|
});
|
|
@@ -3971,7 +4010,7 @@ var DataSpace = class {
|
|
|
3971
4010
|
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
3972
4011
|
invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3973
4012
|
F: __dxlog_file13,
|
|
3974
|
-
L:
|
|
4013
|
+
L: 449,
|
|
3975
4014
|
S: this,
|
|
3976
4015
|
A: [
|
|
3977
4016
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -3990,7 +4029,7 @@ var DataSpace = class {
|
|
|
3990
4029
|
{
|
|
3991
4030
|
log11.info("Fragmenting", void 0, {
|
|
3992
4031
|
F: __dxlog_file13,
|
|
3993
|
-
L:
|
|
4032
|
+
L: 461,
|
|
3994
4033
|
S: this,
|
|
3995
4034
|
C: (f, a) => f(...a)
|
|
3996
4035
|
});
|
|
@@ -3998,11 +4037,11 @@ var DataSpace = class {
|
|
|
3998
4037
|
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
3999
4038
|
await cancelWithContext4(this._ctx, asyncTimeout(rootHandle.whenReady(), 1e4));
|
|
4000
4039
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
4001
|
-
const properties =
|
|
4040
|
+
const properties = findPropertiesObject(rootHandle.docSync());
|
|
4002
4041
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4003
4042
|
invariant12(properties, "Properties not found", {
|
|
4004
4043
|
F: __dxlog_file13,
|
|
4005
|
-
L:
|
|
4044
|
+
L: 471,
|
|
4006
4045
|
S: this,
|
|
4007
4046
|
A: [
|
|
4008
4047
|
"properties",
|
|
@@ -4018,7 +4057,7 @@ var DataSpace = class {
|
|
|
4018
4057
|
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
4019
4058
|
invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4020
4059
|
F: __dxlog_file13,
|
|
4021
|
-
L:
|
|
4060
|
+
L: 476,
|
|
4022
4061
|
S: this,
|
|
4023
4062
|
A: [
|
|
4024
4063
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -4087,7 +4126,7 @@ var DataSpace = class {
|
|
|
4087
4126
|
state: SpaceState[this._state]
|
|
4088
4127
|
}, {
|
|
4089
4128
|
F: __dxlog_file13,
|
|
4090
|
-
L:
|
|
4129
|
+
L: 542,
|
|
4091
4130
|
S: this,
|
|
4092
4131
|
C: (f, a) => f(...a)
|
|
4093
4132
|
});
|
|
@@ -4139,17 +4178,32 @@ DataSpace = _ts_decorate4([
|
|
|
4139
4178
|
trackLeaks("open", "close"),
|
|
4140
4179
|
trace6.resource()
|
|
4141
4180
|
], DataSpace);
|
|
4181
|
+
var findPropertiesObject = (spaceDoc) => {
|
|
4182
|
+
for (const id in spaceDoc.objects ?? {}) {
|
|
4183
|
+
const obj = spaceDoc.objects[id];
|
|
4184
|
+
if (obj.system.type?.itemId === TYPE_PROPERTIES) {
|
|
4185
|
+
return [
|
|
4186
|
+
id,
|
|
4187
|
+
obj
|
|
4188
|
+
];
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
return void 0;
|
|
4192
|
+
};
|
|
4142
4193
|
|
|
4143
4194
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
4144
4195
|
import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
4145
|
-
import {
|
|
4196
|
+
import { cancelWithContext as cancelWithContext5, Context as Context9 } from "@dxos/context";
|
|
4146
4197
|
import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
4198
|
+
import { AuthStatus } from "@dxos/echo-pipeline";
|
|
4147
4199
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
4148
4200
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4149
4201
|
import { log as log12 } from "@dxos/log";
|
|
4150
|
-
import { trace as
|
|
4202
|
+
import { trace as Trace2 } from "@dxos/protocols";
|
|
4151
4203
|
import { Invitation as Invitation7, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4204
|
+
import { SpaceMember as SpaceMember5 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
4152
4205
|
import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
|
|
4206
|
+
import { trace as trace7 } from "@dxos/tracing";
|
|
4153
4207
|
import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
|
|
4154
4208
|
|
|
4155
4209
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
@@ -4253,6 +4307,28 @@ var DataSpaceManager = class {
|
|
|
4253
4307
|
const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
|
|
4254
4308
|
this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
|
|
4255
4309
|
this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
|
|
4310
|
+
trace7.diagnostic({
|
|
4311
|
+
id: "spaces",
|
|
4312
|
+
name: "Spaces",
|
|
4313
|
+
fetch: async () => {
|
|
4314
|
+
return Array.from(this._spaces.values()).map((space) => {
|
|
4315
|
+
const rootUrl = space.automergeSpaceState.rootUrl;
|
|
4316
|
+
const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
|
|
4317
|
+
const rootDoc = rootHandle?.docSync();
|
|
4318
|
+
const properties = rootDoc && findPropertiesObject(rootDoc);
|
|
4319
|
+
return {
|
|
4320
|
+
key: space.key.toHex(),
|
|
4321
|
+
state: SpaceState2[space.state],
|
|
4322
|
+
name: properties?.[1].data.name ?? null,
|
|
4323
|
+
inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
|
|
4324
|
+
linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
|
|
4325
|
+
credentials: space.inner.spaceState.credentials.length,
|
|
4326
|
+
members: space.inner.spaceState.members.size,
|
|
4327
|
+
rootUrl
|
|
4328
|
+
};
|
|
4329
|
+
});
|
|
4330
|
+
}
|
|
4331
|
+
});
|
|
4256
4332
|
}
|
|
4257
4333
|
// TODO(burdon): Remove.
|
|
4258
4334
|
get spaces() {
|
|
@@ -4261,15 +4337,15 @@ var DataSpaceManager = class {
|
|
|
4261
4337
|
async open() {
|
|
4262
4338
|
log12("open", void 0, {
|
|
4263
4339
|
F: __dxlog_file14,
|
|
4264
|
-
L:
|
|
4340
|
+
L: 144,
|
|
4265
4341
|
S: this,
|
|
4266
4342
|
C: (f, a) => f(...a)
|
|
4267
4343
|
});
|
|
4268
|
-
log12.trace("dxos.echo.data-space-manager.open",
|
|
4344
|
+
log12.trace("dxos.echo.data-space-manager.open", Trace2.begin({
|
|
4269
4345
|
id: this._instanceId
|
|
4270
4346
|
}), {
|
|
4271
4347
|
F: __dxlog_file14,
|
|
4272
|
-
L:
|
|
4348
|
+
L: 145,
|
|
4273
4349
|
S: this,
|
|
4274
4350
|
C: (f, a) => f(...a)
|
|
4275
4351
|
});
|
|
@@ -4277,7 +4353,7 @@ var DataSpaceManager = class {
|
|
|
4277
4353
|
spaces: this._metadataStore.spaces.length
|
|
4278
4354
|
}, {
|
|
4279
4355
|
F: __dxlog_file14,
|
|
4280
|
-
L:
|
|
4356
|
+
L: 146,
|
|
4281
4357
|
S: this,
|
|
4282
4358
|
C: (f, a) => f(...a)
|
|
4283
4359
|
});
|
|
@@ -4287,7 +4363,7 @@ var DataSpaceManager = class {
|
|
|
4287
4363
|
spaceMetadata
|
|
4288
4364
|
}, {
|
|
4289
4365
|
F: __dxlog_file14,
|
|
4290
|
-
L:
|
|
4366
|
+
L: 150,
|
|
4291
4367
|
S: this,
|
|
4292
4368
|
C: (f, a) => f(...a)
|
|
4293
4369
|
});
|
|
@@ -4298,7 +4374,7 @@ var DataSpaceManager = class {
|
|
|
4298
4374
|
err
|
|
4299
4375
|
}, {
|
|
4300
4376
|
F: __dxlog_file14,
|
|
4301
|
-
L:
|
|
4377
|
+
L: 153,
|
|
4302
4378
|
S: this,
|
|
4303
4379
|
C: (f, a) => f(...a)
|
|
4304
4380
|
});
|
|
@@ -4311,11 +4387,11 @@ var DataSpaceManager = class {
|
|
|
4311
4387
|
space.initializeDataPipelineAsync();
|
|
4312
4388
|
}
|
|
4313
4389
|
}
|
|
4314
|
-
log12.trace("dxos.echo.data-space-manager.open",
|
|
4390
|
+
log12.trace("dxos.echo.data-space-manager.open", Trace2.end({
|
|
4315
4391
|
id: this._instanceId
|
|
4316
4392
|
}), {
|
|
4317
4393
|
F: __dxlog_file14,
|
|
4318
|
-
L:
|
|
4394
|
+
L: 166,
|
|
4319
4395
|
S: this,
|
|
4320
4396
|
C: (f, a) => f(...a)
|
|
4321
4397
|
});
|
|
@@ -4323,7 +4399,7 @@ var DataSpaceManager = class {
|
|
|
4323
4399
|
async close() {
|
|
4324
4400
|
log12("close", void 0, {
|
|
4325
4401
|
F: __dxlog_file14,
|
|
4326
|
-
L:
|
|
4402
|
+
L: 171,
|
|
4327
4403
|
S: this,
|
|
4328
4404
|
C: (f, a) => f(...a)
|
|
4329
4405
|
});
|
|
@@ -4339,7 +4415,7 @@ var DataSpaceManager = class {
|
|
|
4339
4415
|
async createSpace() {
|
|
4340
4416
|
invariant13(this._isOpen, "Not open.", {
|
|
4341
4417
|
F: __dxlog_file14,
|
|
4342
|
-
L:
|
|
4418
|
+
L: 184,
|
|
4343
4419
|
S: this,
|
|
4344
4420
|
A: [
|
|
4345
4421
|
"this._isOpen",
|
|
@@ -4360,18 +4436,18 @@ var DataSpaceManager = class {
|
|
|
4360
4436
|
spaceKey
|
|
4361
4437
|
}, {
|
|
4362
4438
|
F: __dxlog_file14,
|
|
4363
|
-
L:
|
|
4439
|
+
L: 196,
|
|
4364
4440
|
S: this,
|
|
4365
4441
|
C: (f, a) => f(...a)
|
|
4366
4442
|
});
|
|
4367
|
-
const
|
|
4443
|
+
const root = await this._echoHost.createSpaceRoot(spaceKey);
|
|
4368
4444
|
const space = await this._constructSpace(metadata);
|
|
4369
|
-
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner,
|
|
4445
|
+
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
|
|
4370
4446
|
await this._metadataStore.addSpace(metadata);
|
|
4371
4447
|
const memberCredential = credentials[1];
|
|
4372
4448
|
invariant13(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4373
4449
|
F: __dxlog_file14,
|
|
4374
|
-
L:
|
|
4450
|
+
L: 205,
|
|
4375
4451
|
S: this,
|
|
4376
4452
|
A: [
|
|
4377
4453
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -4389,13 +4465,13 @@ var DataSpaceManager = class {
|
|
|
4389
4465
|
opts
|
|
4390
4466
|
}, {
|
|
4391
4467
|
F: __dxlog_file14,
|
|
4392
|
-
L:
|
|
4468
|
+
L: 217,
|
|
4393
4469
|
S: this,
|
|
4394
4470
|
C: (f, a) => f(...a)
|
|
4395
4471
|
});
|
|
4396
4472
|
invariant13(this._isOpen, "Not open.", {
|
|
4397
4473
|
F: __dxlog_file14,
|
|
4398
|
-
L:
|
|
4474
|
+
L: 218,
|
|
4399
4475
|
S: this,
|
|
4400
4476
|
A: [
|
|
4401
4477
|
"this._isOpen",
|
|
@@ -4404,7 +4480,7 @@ var DataSpaceManager = class {
|
|
|
4404
4480
|
});
|
|
4405
4481
|
invariant13(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
4406
4482
|
F: __dxlog_file14,
|
|
4407
|
-
L:
|
|
4483
|
+
L: 219,
|
|
4408
4484
|
S: this,
|
|
4409
4485
|
A: [
|
|
4410
4486
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -4439,7 +4515,7 @@ var DataSpaceManager = class {
|
|
|
4439
4515
|
metadata
|
|
4440
4516
|
}, {
|
|
4441
4517
|
F: __dxlog_file14,
|
|
4442
|
-
L:
|
|
4518
|
+
L: 252,
|
|
4443
4519
|
S: this,
|
|
4444
4520
|
C: (f, a) => f(...a)
|
|
4445
4521
|
});
|
|
@@ -4477,11 +4553,16 @@ var DataSpaceManager = class {
|
|
|
4477
4553
|
onAuthFailure: () => {
|
|
4478
4554
|
log12.warn("auth failure", void 0, {
|
|
4479
4555
|
F: __dxlog_file14,
|
|
4480
|
-
L:
|
|
4556
|
+
L: 289,
|
|
4481
4557
|
S: this,
|
|
4482
4558
|
C: (f, a) => f(...a)
|
|
4483
4559
|
});
|
|
4484
4560
|
},
|
|
4561
|
+
onMemberRolesChanged: async (members) => {
|
|
4562
|
+
if (dataSpace?.state === SpaceState2.READY) {
|
|
4563
|
+
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
4564
|
+
}
|
|
4565
|
+
},
|
|
4485
4566
|
memberKey: this._signingContext.identityKey,
|
|
4486
4567
|
onDelegatedInvitationStatusChange: (invitation, isActive) => {
|
|
4487
4568
|
return this._handleInvitationStatusChange(dataSpace, invitation, isActive);
|
|
@@ -4505,7 +4586,7 @@ var DataSpaceManager = class {
|
|
|
4505
4586
|
space: space.key
|
|
4506
4587
|
}, {
|
|
4507
4588
|
F: __dxlog_file14,
|
|
4508
|
-
L:
|
|
4589
|
+
L: 316,
|
|
4509
4590
|
S: this,
|
|
4510
4591
|
C: (f, a) => f(...a)
|
|
4511
4592
|
});
|
|
@@ -4516,7 +4597,7 @@ var DataSpaceManager = class {
|
|
|
4516
4597
|
open: this._isOpen
|
|
4517
4598
|
}, {
|
|
4518
4599
|
F: __dxlog_file14,
|
|
4519
|
-
L:
|
|
4600
|
+
L: 319,
|
|
4520
4601
|
S: this,
|
|
4521
4602
|
C: (f, a) => f(...a)
|
|
4522
4603
|
});
|
|
@@ -4524,6 +4605,9 @@ var DataSpaceManager = class {
|
|
|
4524
4605
|
await this._createDelegatedInvitations(dataSpace, [
|
|
4525
4606
|
...space.spaceState.invitations.entries()
|
|
4526
4607
|
]);
|
|
4608
|
+
this._handleMemberRoleChanges(presence, space.protocol, [
|
|
4609
|
+
...space.spaceState.members.values()
|
|
4610
|
+
]);
|
|
4527
4611
|
this.updated.emit();
|
|
4528
4612
|
}
|
|
4529
4613
|
},
|
|
@@ -4532,7 +4616,7 @@ var DataSpaceManager = class {
|
|
|
4532
4616
|
space: space.key
|
|
4533
4617
|
}, {
|
|
4534
4618
|
F: __dxlog_file14,
|
|
4535
|
-
L:
|
|
4619
|
+
L: 327,
|
|
4536
4620
|
S: this,
|
|
4537
4621
|
C: (f, a) => f(...a)
|
|
4538
4622
|
});
|
|
@@ -4540,6 +4624,11 @@ var DataSpaceManager = class {
|
|
|
4540
4624
|
},
|
|
4541
4625
|
cache: metadata.cache
|
|
4542
4626
|
});
|
|
4627
|
+
presence.newPeer.on((peerState) => {
|
|
4628
|
+
if (dataSpace.state === SpaceState2.READY) {
|
|
4629
|
+
this._handleNewPeerConnected(space, peerState);
|
|
4630
|
+
}
|
|
4631
|
+
});
|
|
4543
4632
|
if (metadata.state !== SpaceState2.INACTIVE) {
|
|
4544
4633
|
await dataSpace.open();
|
|
4545
4634
|
}
|
|
@@ -4549,6 +4638,51 @@ var DataSpaceManager = class {
|
|
|
4549
4638
|
this._spaces.set(metadata.key, dataSpace);
|
|
4550
4639
|
return dataSpace;
|
|
4551
4640
|
}
|
|
4641
|
+
_handleMemberRoleChanges(presence, spaceProtocol, memberInfo) {
|
|
4642
|
+
let closedSessions = 0;
|
|
4643
|
+
for (const member of memberInfo) {
|
|
4644
|
+
if (member.key.equals(presence.getLocalState().identityKey)) {
|
|
4645
|
+
continue;
|
|
4646
|
+
}
|
|
4647
|
+
const peers = presence.getPeersByIdentityKey(member.key);
|
|
4648
|
+
const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
|
|
4649
|
+
const sessionsToClose = sessions.filter((s) => {
|
|
4650
|
+
return (s && member.role === SpaceMember5.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
|
|
4651
|
+
});
|
|
4652
|
+
sessionsToClose.forEach((session) => {
|
|
4653
|
+
void session.close().catch(log12.error);
|
|
4654
|
+
});
|
|
4655
|
+
closedSessions += sessionsToClose.length;
|
|
4656
|
+
}
|
|
4657
|
+
log12("processed member role changes", {
|
|
4658
|
+
roleChangeCount: memberInfo.length,
|
|
4659
|
+
peersOnline: presence.getPeersOnline().length,
|
|
4660
|
+
closedSessions
|
|
4661
|
+
}, {
|
|
4662
|
+
F: __dxlog_file14,
|
|
4663
|
+
L: 367,
|
|
4664
|
+
S: this,
|
|
4665
|
+
C: (f, a) => f(...a)
|
|
4666
|
+
});
|
|
4667
|
+
spaceProtocol.updateTopology();
|
|
4668
|
+
}
|
|
4669
|
+
_handleNewPeerConnected(space, peerState) {
|
|
4670
|
+
const role = space.spaceState.getMemberRole(peerState.identityKey);
|
|
4671
|
+
if (role === SpaceMember5.Role.REMOVED) {
|
|
4672
|
+
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
4673
|
+
if (session != null) {
|
|
4674
|
+
log12("closing a session with a removed peer", {
|
|
4675
|
+
peerId: peerState.peerId
|
|
4676
|
+
}, {
|
|
4677
|
+
F: __dxlog_file14,
|
|
4678
|
+
L: 381,
|
|
4679
|
+
S: this,
|
|
4680
|
+
C: (f, a) => f(...a)
|
|
4681
|
+
});
|
|
4682
|
+
void session.close().catch(log12.error);
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4552
4686
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
4553
4687
|
if (dataSpace?.state !== SpaceState2.READY) {
|
|
4554
4688
|
return;
|
|
@@ -4604,12 +4738,13 @@ DataSpaceManager = _ts_decorate5([
|
|
|
4604
4738
|
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
4605
4739
|
import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask6 } from "@dxos/async";
|
|
4606
4740
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
4741
|
+
import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
4607
4742
|
import { raise as raise2 } from "@dxos/debug";
|
|
4743
|
+
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
4608
4744
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4609
4745
|
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";
|
|
4746
|
+
import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
|
|
4747
|
+
import { SpaceMember as SpaceMember6, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4613
4748
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
4614
4749
|
var SpacesServiceImpl = class {
|
|
4615
4750
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
@@ -4618,16 +4753,14 @@ var SpacesServiceImpl = class {
|
|
|
4618
4753
|
this._getDataSpaceManager = _getDataSpaceManager;
|
|
4619
4754
|
}
|
|
4620
4755
|
async createSpace() {
|
|
4621
|
-
|
|
4622
|
-
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo");
|
|
4623
|
-
}
|
|
4756
|
+
this._requireIdentity();
|
|
4624
4757
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4625
4758
|
const space = await dataSpaceManager.createSpace();
|
|
4626
4759
|
return this._serializeSpace(space);
|
|
4627
4760
|
}
|
|
4628
4761
|
async updateSpace({ spaceKey, state }) {
|
|
4629
4762
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4630
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4763
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4631
4764
|
if (state) {
|
|
4632
4765
|
switch (state) {
|
|
4633
4766
|
case SpaceState3.ACTIVE:
|
|
@@ -4641,8 +4774,39 @@ var SpacesServiceImpl = class {
|
|
|
4641
4774
|
}
|
|
4642
4775
|
}
|
|
4643
4776
|
}
|
|
4644
|
-
async updateMemberRole(
|
|
4645
|
-
|
|
4777
|
+
async updateMemberRole(request) {
|
|
4778
|
+
const identity = this._requireIdentity();
|
|
4779
|
+
const space = this._spaceManager.spaces.get(request.spaceKey);
|
|
4780
|
+
if (space == null) {
|
|
4781
|
+
throw new SpaceNotFoundError2(request.spaceKey);
|
|
4782
|
+
}
|
|
4783
|
+
if (!space.spaceState.hasMembershipManagementPermission(identity.identityKey)) {
|
|
4784
|
+
throw new AuthorizationError2("No member management permission.", {
|
|
4785
|
+
spaceKey: space.key,
|
|
4786
|
+
role: space.spaceState.getMemberRole(identity.identityKey)
|
|
4787
|
+
});
|
|
4788
|
+
}
|
|
4789
|
+
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
4790
|
+
invariant14(credentials[0].credential, void 0, {
|
|
4791
|
+
F: __dxlog_file15,
|
|
4792
|
+
L: 95,
|
|
4793
|
+
S: this,
|
|
4794
|
+
A: [
|
|
4795
|
+
"credentials[0].credential",
|
|
4796
|
+
""
|
|
4797
|
+
]
|
|
4798
|
+
});
|
|
4799
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
4800
|
+
invariant14(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4801
|
+
F: __dxlog_file15,
|
|
4802
|
+
L: 97,
|
|
4803
|
+
S: this,
|
|
4804
|
+
A: [
|
|
4805
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
4806
|
+
""
|
|
4807
|
+
]
|
|
4808
|
+
});
|
|
4809
|
+
await writeMessages3(space.controlPipeline.writer, credentials);
|
|
4646
4810
|
}
|
|
4647
4811
|
querySpaces() {
|
|
4648
4812
|
return new Stream10(({ next, ctx }) => {
|
|
@@ -4653,7 +4817,7 @@ var SpacesServiceImpl = class {
|
|
|
4653
4817
|
spaces
|
|
4654
4818
|
}, {
|
|
4655
4819
|
F: __dxlog_file15,
|
|
4656
|
-
L:
|
|
4820
|
+
L: 108,
|
|
4657
4821
|
S: this,
|
|
4658
4822
|
C: (f, a) => f(...a)
|
|
4659
4823
|
});
|
|
@@ -4692,14 +4856,14 @@ var SpacesServiceImpl = class {
|
|
|
4692
4856
|
}
|
|
4693
4857
|
async postMessage({ spaceKey, channel, message }) {
|
|
4694
4858
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4695
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4859
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4696
4860
|
await space.postMessage(getChannelId(channel), message);
|
|
4697
4861
|
}
|
|
4698
4862
|
subscribeMessages({ spaceKey, channel }) {
|
|
4699
4863
|
return new Stream10(({ ctx, next }) => {
|
|
4700
4864
|
scheduleTask6(ctx, async () => {
|
|
4701
4865
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4702
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4866
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4703
4867
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
4704
4868
|
next(message);
|
|
4705
4869
|
});
|
|
@@ -4709,7 +4873,7 @@ var SpacesServiceImpl = class {
|
|
|
4709
4873
|
}
|
|
4710
4874
|
queryCredentials({ spaceKey, noTail }) {
|
|
4711
4875
|
return new Stream10(({ ctx, next, close }) => {
|
|
4712
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4876
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4713
4877
|
const processor = {
|
|
4714
4878
|
processCredential: async (credential) => {
|
|
4715
4879
|
next(credential);
|
|
@@ -4725,7 +4889,7 @@ var SpacesServiceImpl = class {
|
|
|
4725
4889
|
});
|
|
4726
4890
|
}
|
|
4727
4891
|
async writeCredentials({ spaceKey, credentials }) {
|
|
4728
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4892
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4729
4893
|
for (const credential of credentials ?? []) {
|
|
4730
4894
|
if (credential.proof) {
|
|
4731
4895
|
await space.controlPipeline.writer.write({
|
|
@@ -4736,7 +4900,7 @@ var SpacesServiceImpl = class {
|
|
|
4736
4900
|
} else {
|
|
4737
4901
|
invariant14(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
4738
4902
|
F: __dxlog_file15,
|
|
4739
|
-
L:
|
|
4903
|
+
L: 195,
|
|
4740
4904
|
S: this,
|
|
4741
4905
|
A: [
|
|
4742
4906
|
"!credential.id",
|
|
@@ -4745,7 +4909,7 @@ var SpacesServiceImpl = class {
|
|
|
4745
4909
|
});
|
|
4746
4910
|
invariant14(this._identityManager.identity, "Identity is not available", {
|
|
4747
4911
|
F: __dxlog_file15,
|
|
4748
|
-
L:
|
|
4912
|
+
L: 196,
|
|
4749
4913
|
S: this,
|
|
4750
4914
|
A: [
|
|
4751
4915
|
"this._identityManager.identity",
|
|
@@ -4755,7 +4919,7 @@ var SpacesServiceImpl = class {
|
|
|
4755
4919
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
4756
4920
|
invariant14(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
4757
4921
|
F: __dxlog_file15,
|
|
4758
|
-
L:
|
|
4922
|
+
L: 198,
|
|
4759
4923
|
S: this,
|
|
4760
4924
|
A: [
|
|
4761
4925
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -4776,7 +4940,7 @@ var SpacesServiceImpl = class {
|
|
|
4776
4940
|
}
|
|
4777
4941
|
async createEpoch({ spaceKey, migration }) {
|
|
4778
4942
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4779
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new
|
|
4943
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
4780
4944
|
await space.createEpoch({
|
|
4781
4945
|
migration
|
|
4782
4946
|
});
|
|
@@ -4810,7 +4974,8 @@ var SpacesServiceImpl = class {
|
|
|
4810
4974
|
identityKey: member.key,
|
|
4811
4975
|
profile: member.profile ?? {}
|
|
4812
4976
|
},
|
|
4813
|
-
|
|
4977
|
+
role: member.role,
|
|
4978
|
+
presence: peers.length > 0 ? SpaceMember6.PresenceState.ONLINE : SpaceMember6.PresenceState.OFFLINE,
|
|
4814
4979
|
peerStates: peers
|
|
4815
4980
|
};
|
|
4816
4981
|
}),
|
|
@@ -4819,13 +4984,19 @@ var SpacesServiceImpl = class {
|
|
|
4819
4984
|
metrics: space.metrics
|
|
4820
4985
|
};
|
|
4821
4986
|
}
|
|
4987
|
+
_requireIdentity() {
|
|
4988
|
+
if (!this._identityManager.identity) {
|
|
4989
|
+
throw new IdentityNotInitializedError("This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo");
|
|
4990
|
+
}
|
|
4991
|
+
return this._identityManager.identity;
|
|
4992
|
+
}
|
|
4822
4993
|
};
|
|
4823
4994
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
4824
4995
|
|
|
4825
4996
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
4826
4997
|
import { Trigger as Trigger6 } from "@dxos/async";
|
|
4827
4998
|
import { Context as Context10, Resource } from "@dxos/context";
|
|
4828
|
-
import { getCredentialAssertion as
|
|
4999
|
+
import { getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
|
|
4829
5000
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
4830
5001
|
import { EchoHost } from "@dxos/echo-db";
|
|
4831
5002
|
import { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
|
|
@@ -4837,7 +5008,7 @@ import { log as log14 } from "@dxos/log";
|
|
|
4837
5008
|
import { InvalidStorageVersionError, STORAGE_VERSION, trace as trace8 } from "@dxos/protocols";
|
|
4838
5009
|
import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4839
5010
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
4840
|
-
import { trace as
|
|
5011
|
+
import { trace as Trace3 } from "@dxos/tracing";
|
|
4841
5012
|
import { safeInstanceof } from "@dxos/util";
|
|
4842
5013
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
4843
5014
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -5041,7 +5212,7 @@ var ServiceContext = class extends Resource {
|
|
|
5041
5212
|
this.initialized.wake();
|
|
5042
5213
|
this._deviceSpaceSync = {
|
|
5043
5214
|
processCredential: async (credential) => {
|
|
5044
|
-
const assertion =
|
|
5215
|
+
const assertion = getCredentialAssertion4(credential);
|
|
5045
5216
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
5046
5217
|
return;
|
|
5047
5218
|
}
|
|
@@ -5097,14 +5268,14 @@ var ServiceContext = class extends Resource {
|
|
|
5097
5268
|
}
|
|
5098
5269
|
};
|
|
5099
5270
|
_ts_decorate6([
|
|
5100
|
-
|
|
5271
|
+
Trace3.span()
|
|
5101
5272
|
], ServiceContext.prototype, "_open", null);
|
|
5102
5273
|
_ts_decorate6([
|
|
5103
|
-
|
|
5274
|
+
Trace3.span()
|
|
5104
5275
|
], ServiceContext.prototype, "_initialize", null);
|
|
5105
5276
|
ServiceContext = _ts_decorate6([
|
|
5106
5277
|
safeInstanceof("dxos.client-services.ServiceContext"),
|
|
5107
|
-
|
|
5278
|
+
Trace3.resource()
|
|
5108
5279
|
], ServiceContext);
|
|
5109
5280
|
|
|
5110
5281
|
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
@@ -5137,11 +5308,11 @@ import { getFirstStreamValue } from "@dxos/codec-protobuf";
|
|
|
5137
5308
|
import { credentialTypeFilter } from "@dxos/credentials";
|
|
5138
5309
|
import { invariant as invariant16 } from "@dxos/invariant";
|
|
5139
5310
|
import { STORAGE_VERSION as STORAGE_VERSION2 } from "@dxos/protocols";
|
|
5140
|
-
import { SpaceMember as
|
|
5311
|
+
import { SpaceMember as SpaceMember7 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5141
5312
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
5142
5313
|
|
|
5143
5314
|
// packages/sdk/client-services/src/version.ts
|
|
5144
|
-
var DXOS_VERSION = "0.5.3-main.
|
|
5315
|
+
var DXOS_VERSION = "0.5.3-main.fffc127";
|
|
5145
5316
|
|
|
5146
5317
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
5147
5318
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -5249,13 +5420,14 @@ var getSpaceStats = async (space) => {
|
|
|
5249
5420
|
id: credential.id
|
|
5250
5421
|
})),
|
|
5251
5422
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
5423
|
+
role: member.role,
|
|
5252
5424
|
identity: {
|
|
5253
5425
|
identityKey: member.key,
|
|
5254
5426
|
profile: {
|
|
5255
5427
|
displayName: member.assertion.profile?.displayName
|
|
5256
5428
|
}
|
|
5257
5429
|
},
|
|
5258
|
-
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ?
|
|
5430
|
+
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember7.PresenceState.ONLINE : SpaceMember7.PresenceState.OFFLINE
|
|
5259
5431
|
})),
|
|
5260
5432
|
pipeline: {
|
|
5261
5433
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
@@ -5404,7 +5576,7 @@ import { WebsocketSignalManager } from "@dxos/messaging";
|
|
|
5404
5576
|
import { NetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
5405
5577
|
import { trace as trace9 } from "@dxos/protocols";
|
|
5406
5578
|
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
5407
|
-
import { TRACE_PROCESSOR as TRACE_PROCESSOR2, trace as
|
|
5579
|
+
import { TRACE_PROCESSOR as TRACE_PROCESSOR2, trace as Trace4 } from "@dxos/tracing";
|
|
5408
5580
|
import { assignDeep as assignDeep2 } from "@dxos/util";
|
|
5409
5581
|
import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
5410
5582
|
|
|
@@ -6288,21 +6460,21 @@ var ClientServicesHost = class {
|
|
|
6288
6460
|
}
|
|
6289
6461
|
};
|
|
6290
6462
|
_ts_decorate8([
|
|
6291
|
-
|
|
6463
|
+
Trace4.info()
|
|
6292
6464
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
6293
6465
|
_ts_decorate8([
|
|
6294
|
-
|
|
6466
|
+
Trace4.info()
|
|
6295
6467
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
6296
6468
|
_ts_decorate8([
|
|
6297
6469
|
synchronized3,
|
|
6298
|
-
|
|
6470
|
+
Trace4.span()
|
|
6299
6471
|
], ClientServicesHost.prototype, "open", null);
|
|
6300
6472
|
_ts_decorate8([
|
|
6301
6473
|
synchronized3,
|
|
6302
|
-
|
|
6474
|
+
Trace4.span()
|
|
6303
6475
|
], ClientServicesHost.prototype, "close", null);
|
|
6304
6476
|
ClientServicesHost = _ts_decorate8([
|
|
6305
|
-
|
|
6477
|
+
Trace4.resource()
|
|
6306
6478
|
], ClientServicesHost);
|
|
6307
6479
|
|
|
6308
6480
|
// packages/sdk/client-services/src/packlets/services/util.ts
|
|
@@ -6371,6 +6543,7 @@ export {
|
|
|
6371
6543
|
InvitationsManager,
|
|
6372
6544
|
ClientRpcServer,
|
|
6373
6545
|
DataSpace,
|
|
6546
|
+
findPropertiesObject,
|
|
6374
6547
|
DataSpaceManager,
|
|
6375
6548
|
SpacesServiceImpl,
|
|
6376
6549
|
ServiceContext,
|
|
@@ -6386,4 +6559,4 @@ export {
|
|
|
6386
6559
|
ClientServicesHost,
|
|
6387
6560
|
ClientServicesProviderResource
|
|
6388
6561
|
};
|
|
6389
|
-
//# sourceMappingURL=chunk-
|
|
6562
|
+
//# sourceMappingURL=chunk-OYIJIAJI.mjs.map
|