@dxos/client-services 0.5.1-next.bb5476b → 0.5.1-next.d0efa9a
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-E7BDB5EP.mjs → chunk-AZWKEPKJ.mjs} +144 -123
- package/dist/lib/browser/chunk-AZWKEPKJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +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-BXCXQ2GH.cjs → chunk-R5JDCL3F.cjs} +166 -145
- package/dist/lib/node/chunk-R5JDCL3F.cjs.map +7 -0
- package/dist/lib/node/index.cjs +43 -43
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.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.map +1 -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/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/diagnostics/diagnostics-collector.ts +14 -9
- package/src/packlets/diagnostics/diagnostics.ts +78 -68
- package/src/packlets/invitations/invitations-manager.ts +3 -0
- package/src/packlets/invitations/space-invitation-protocol.ts +4 -2
- package/src/packlets/services/service-host.ts +2 -2
- package/src/packlets/spaces/data-space.ts +2 -1
- package/src/packlets/spaces/genesis.ts +1 -1
- package/src/packlets/spaces/spaces-service.ts +12 -6
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-E7BDB5EP.mjs.map +0 -7
- package/dist/lib/node/chunk-BXCXQ2GH.cjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_R5JDCL3F_exports = {};
|
|
30
|
+
__export(chunk_R5JDCL3F_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -66,7 +66,7 @@ __export(chunk_BXCXQ2GH_exports, {
|
|
|
66
66
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
67
67
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
68
68
|
});
|
|
69
|
-
module.exports = __toCommonJS(
|
|
69
|
+
module.exports = __toCommonJS(chunk_R5JDCL3F_exports);
|
|
70
70
|
var import_async = require("@dxos/async");
|
|
71
71
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
72
72
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -172,6 +172,7 @@ var import_invariant10 = require("@dxos/invariant");
|
|
|
172
172
|
var import_keys8 = require("@dxos/keys");
|
|
173
173
|
var import_log9 = require("@dxos/log");
|
|
174
174
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
175
|
+
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
175
176
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
176
177
|
var import_debug2 = require("@dxos/debug");
|
|
177
178
|
var import_rpc = require("@dxos/rpc");
|
|
@@ -188,12 +189,13 @@ var import_keys9 = require("@dxos/keys");
|
|
|
188
189
|
var import_log10 = require("@dxos/log");
|
|
189
190
|
var import_protocols8 = require("@dxos/protocols");
|
|
190
191
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
191
|
-
var
|
|
192
|
+
var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
193
|
+
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
192
194
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
193
195
|
var import_tracing4 = require("@dxos/tracing");
|
|
194
196
|
var import_util6 = require("@dxos/util");
|
|
195
197
|
var import_async12 = require("@dxos/async");
|
|
196
|
-
var
|
|
198
|
+
var import_credentials13 = require("@dxos/credentials");
|
|
197
199
|
var import_async13 = require("@dxos/async");
|
|
198
200
|
var import_context10 = require("@dxos/context");
|
|
199
201
|
var import_invariant12 = require("@dxos/invariant");
|
|
@@ -204,7 +206,7 @@ var import_teleport3 = require("@dxos/teleport");
|
|
|
204
206
|
var import_util7 = require("@dxos/util");
|
|
205
207
|
var import_async14 = require("@dxos/async");
|
|
206
208
|
var import_context11 = require("@dxos/context");
|
|
207
|
-
var
|
|
209
|
+
var import_credentials14 = require("@dxos/credentials");
|
|
208
210
|
var import_invariant13 = require("@dxos/invariant");
|
|
209
211
|
var import_keys11 = require("@dxos/keys");
|
|
210
212
|
var import_log12 = require("@dxos/log");
|
|
@@ -212,9 +214,9 @@ var import_protocols10 = require("@dxos/protocols");
|
|
|
212
214
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
213
215
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
214
216
|
var import_util8 = require("@dxos/util");
|
|
215
|
-
var
|
|
217
|
+
var import_credentials15 = require("@dxos/credentials");
|
|
216
218
|
var import_debug4 = require("@dxos/debug");
|
|
217
|
-
var
|
|
219
|
+
var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
218
220
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
219
221
|
var import_async15 = require("@dxos/async");
|
|
220
222
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
@@ -223,9 +225,10 @@ var import_invariant14 = require("@dxos/invariant");
|
|
|
223
225
|
var import_log13 = require("@dxos/log");
|
|
224
226
|
var import_protocols11 = require("@dxos/protocols");
|
|
225
227
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
228
|
+
var import_credentials17 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
226
229
|
var import_async16 = require("@dxos/async");
|
|
227
230
|
var import_context12 = require("@dxos/context");
|
|
228
|
-
var
|
|
231
|
+
var import_credentials18 = require("@dxos/credentials");
|
|
229
232
|
var import_debug6 = require("@dxos/debug");
|
|
230
233
|
var import_echo_db = require("@dxos/echo-db");
|
|
231
234
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
@@ -239,8 +242,9 @@ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
239
242
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
240
243
|
var import_tracing5 = require("@dxos/tracing");
|
|
241
244
|
var import_util9 = require("@dxos/util");
|
|
245
|
+
var import_async17 = require("@dxos/async");
|
|
242
246
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
243
|
-
var
|
|
247
|
+
var import_credentials19 = require("@dxos/credentials");
|
|
244
248
|
var import_invariant16 = require("@dxos/invariant");
|
|
245
249
|
var import_protocols13 = require("@dxos/protocols");
|
|
246
250
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -250,7 +254,7 @@ var import_config = require("@dxos/config");
|
|
|
250
254
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
251
255
|
var import_tracing7 = require("@dxos/tracing");
|
|
252
256
|
var import_util10 = require("@dxos/util");
|
|
253
|
-
var
|
|
257
|
+
var import_async18 = require("@dxos/async");
|
|
254
258
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
255
259
|
var import_context13 = require("@dxos/context");
|
|
256
260
|
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
@@ -265,14 +269,14 @@ var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
265
269
|
var import_tracing8 = require("@dxos/tracing");
|
|
266
270
|
var import_util11 = require("@dxos/util");
|
|
267
271
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
268
|
-
var
|
|
272
|
+
var import_async19 = require("@dxos/async");
|
|
269
273
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
270
274
|
var import_invariant18 = require("@dxos/invariant");
|
|
271
275
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
272
276
|
var import_invariant19 = require("@dxos/invariant");
|
|
273
277
|
var import_lock_file = require("@dxos/lock-file");
|
|
274
278
|
var import_log16 = require("@dxos/log");
|
|
275
|
-
var
|
|
279
|
+
var import_async20 = require("@dxos/async");
|
|
276
280
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
277
281
|
var import_keys14 = require("@dxos/keys");
|
|
278
282
|
var import_log17 = require("@dxos/log");
|
|
@@ -2743,7 +2747,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2743
2747
|
""
|
|
2744
2748
|
]
|
|
2745
2749
|
});
|
|
2746
|
-
const space =
|
|
2750
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
2747
2751
|
(0, import_invariant9.invariant)(space, void 0, {
|
|
2748
2752
|
F: __dxlog_file10,
|
|
2749
2753
|
L: 58,
|
|
@@ -2772,10 +2776,10 @@ var SpaceInvitationProtocol = class {
|
|
|
2772
2776
|
S: this,
|
|
2773
2777
|
C: (f, a) => f(...a)
|
|
2774
2778
|
});
|
|
2775
|
-
const credentials = await (0, import_credentials7.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile, invitation.delegationCredentialId);
|
|
2779
|
+
const credentials = await (0, import_credentials7.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, invitation.role ?? import_credentials8.SpaceMember.Role.ADMIN, space.inner.spaceState.membershipChainHeads, guestProfile, invitation.delegationCredentialId);
|
|
2776
2780
|
(0, import_invariant9.invariant)(credentials[0].credential, void 0, {
|
|
2777
2781
|
F: __dxlog_file10,
|
|
2778
|
-
L:
|
|
2782
|
+
L: 77,
|
|
2779
2783
|
S: this,
|
|
2780
2784
|
A: [
|
|
2781
2785
|
"credentials[0].credential",
|
|
@@ -2785,7 +2789,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2785
2789
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2786
2790
|
(0, import_invariant9.invariant)((0, import_credentials7.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2787
2791
|
F: __dxlog_file10,
|
|
2788
|
-
L:
|
|
2792
|
+
L: 79,
|
|
2789
2793
|
S: this,
|
|
2790
2794
|
A: [
|
|
2791
2795
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2803,7 +2807,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2803
2807
|
async delegate(invitation) {
|
|
2804
2808
|
(0, import_invariant9.invariant)(this._spaceKey, void 0, {
|
|
2805
2809
|
F: __dxlog_file10,
|
|
2806
|
-
L:
|
|
2810
|
+
L: 92,
|
|
2807
2811
|
S: this,
|
|
2808
2812
|
A: [
|
|
2809
2813
|
"this._spaceKey",
|
|
@@ -2813,7 +2817,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2813
2817
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
2814
2818
|
(0, import_invariant9.invariant)(space, void 0, {
|
|
2815
2819
|
F: __dxlog_file10,
|
|
2816
|
-
L:
|
|
2820
|
+
L: 94,
|
|
2817
2821
|
S: this,
|
|
2818
2822
|
A: [
|
|
2819
2823
|
"space",
|
|
@@ -2823,7 +2827,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2823
2827
|
if (invitation.authMethod === import_services7.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
2824
2828
|
(0, import_invariant9.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
2825
2829
|
F: __dxlog_file10,
|
|
2826
|
-
L:
|
|
2830
|
+
L: 96,
|
|
2827
2831
|
S: this,
|
|
2828
2832
|
A: [
|
|
2829
2833
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -2836,7 +2840,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2836
2840
|
id: invitation.invitationId
|
|
2837
2841
|
}, {
|
|
2838
2842
|
F: __dxlog_file10,
|
|
2839
|
-
L:
|
|
2843
|
+
L: 99,
|
|
2840
2844
|
S: this,
|
|
2841
2845
|
C: (f, a) => f(...a)
|
|
2842
2846
|
});
|
|
@@ -2844,14 +2848,14 @@ var SpaceInvitationProtocol = class {
|
|
|
2844
2848
|
invitationId: invitation.invitationId,
|
|
2845
2849
|
authMethod: invitation.authMethod,
|
|
2846
2850
|
swarmKey: invitation.swarmKey,
|
|
2847
|
-
role: import_credentials8.SpaceMember.Role.ADMIN,
|
|
2851
|
+
role: invitation.role ?? import_credentials8.SpaceMember.Role.ADMIN,
|
|
2848
2852
|
expiresOn: invitation.lifetime ? new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime) : void 0,
|
|
2849
2853
|
multiUse: invitation.multiUse ?? false,
|
|
2850
2854
|
guestKey: invitation.authMethod === import_services7.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
2851
2855
|
});
|
|
2852
2856
|
(0, import_invariant9.invariant)(credential.credential, void 0, {
|
|
2853
2857
|
F: __dxlog_file10,
|
|
2854
|
-
L:
|
|
2858
|
+
L: 119,
|
|
2855
2859
|
S: this,
|
|
2856
2860
|
A: [
|
|
2857
2861
|
"credential.credential",
|
|
@@ -2866,7 +2870,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2866
2870
|
async cancelDelegation(invitation) {
|
|
2867
2871
|
(0, import_invariant9.invariant)(this._spaceKey, void 0, {
|
|
2868
2872
|
F: __dxlog_file10,
|
|
2869
|
-
L:
|
|
2873
|
+
L: 125,
|
|
2870
2874
|
S: this,
|
|
2871
2875
|
A: [
|
|
2872
2876
|
"this._spaceKey",
|
|
@@ -2875,7 +2879,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2875
2879
|
});
|
|
2876
2880
|
(0, import_invariant9.invariant)(invitation.type === import_services7.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
2877
2881
|
F: __dxlog_file10,
|
|
2878
|
-
L:
|
|
2882
|
+
L: 126,
|
|
2879
2883
|
S: this,
|
|
2880
2884
|
A: [
|
|
2881
2885
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -2885,7 +2889,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2885
2889
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
2886
2890
|
(0, import_invariant9.invariant)(space, void 0, {
|
|
2887
2891
|
F: __dxlog_file10,
|
|
2888
|
-
L:
|
|
2892
|
+
L: 128,
|
|
2889
2893
|
S: this,
|
|
2890
2894
|
A: [
|
|
2891
2895
|
"space",
|
|
@@ -2897,14 +2901,14 @@ var SpaceInvitationProtocol = class {
|
|
|
2897
2901
|
id: invitation.invitationId
|
|
2898
2902
|
}, {
|
|
2899
2903
|
F: __dxlog_file10,
|
|
2900
|
-
L:
|
|
2904
|
+
L: 130,
|
|
2901
2905
|
S: this,
|
|
2902
2906
|
C: (f, a) => f(...a)
|
|
2903
2907
|
});
|
|
2904
2908
|
const credential = await (0, import_credentials7.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
2905
2909
|
(0, import_invariant9.invariant)(credential.credential, void 0, {
|
|
2906
2910
|
F: __dxlog_file10,
|
|
2907
|
-
L:
|
|
2911
|
+
L: 137,
|
|
2908
2912
|
S: this,
|
|
2909
2913
|
A: [
|
|
2910
2914
|
"credential.credential",
|
|
@@ -2940,7 +2944,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2940
2944
|
async accept(response) {
|
|
2941
2945
|
(0, import_invariant9.invariant)(response.space, void 0, {
|
|
2942
2946
|
F: __dxlog_file10,
|
|
2943
|
-
L:
|
|
2947
|
+
L: 169,
|
|
2944
2948
|
S: this,
|
|
2945
2949
|
A: [
|
|
2946
2950
|
"response.space",
|
|
@@ -2951,7 +2955,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2951
2955
|
const assertion = (0, import_credentials7.getCredentialAssertion)(credential);
|
|
2952
2956
|
(0, import_invariant9.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2953
2957
|
F: __dxlog_file10,
|
|
2954
|
-
L:
|
|
2958
|
+
L: 172,
|
|
2955
2959
|
S: this,
|
|
2956
2960
|
A: [
|
|
2957
2961
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2960,7 +2964,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2960
2964
|
});
|
|
2961
2965
|
(0, import_invariant9.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2962
2966
|
F: __dxlog_file10,
|
|
2963
|
-
L:
|
|
2967
|
+
L: 173,
|
|
2964
2968
|
S: this,
|
|
2965
2969
|
A: [
|
|
2966
2970
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3022,7 +3026,7 @@ var InvitationsManager = class {
|
|
|
3022
3026
|
} catch (err) {
|
|
3023
3027
|
import_log9.log.catch(err, void 0, {
|
|
3024
3028
|
F: __dxlog_file11,
|
|
3025
|
-
L:
|
|
3029
|
+
L: 77,
|
|
3026
3030
|
S: this,
|
|
3027
3031
|
C: (f, a) => f(...a)
|
|
3028
3032
|
});
|
|
@@ -3045,7 +3049,7 @@ var InvitationsManager = class {
|
|
|
3045
3049
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3046
3050
|
(0, import_invariant10.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3047
3051
|
F: __dxlog_file11,
|
|
3048
|
-
L:
|
|
3052
|
+
L: 98,
|
|
3049
3053
|
S: this,
|
|
3050
3054
|
A: [
|
|
3051
3055
|
"!this._createInvitations.get(persistentInvitation.invitationId)",
|
|
@@ -3064,7 +3068,7 @@ var InvitationsManager = class {
|
|
|
3064
3068
|
} catch (err) {
|
|
3065
3069
|
import_log9.log.catch(err, void 0, {
|
|
3066
3070
|
F: __dxlog_file11,
|
|
3067
|
-
L:
|
|
3071
|
+
L: 105,
|
|
3068
3072
|
S: this,
|
|
3069
3073
|
C: (f, a) => f(...a)
|
|
3070
3074
|
});
|
|
@@ -3096,13 +3100,13 @@ var InvitationsManager = class {
|
|
|
3096
3100
|
async authenticate({ invitationId, authCode }) {
|
|
3097
3101
|
(0, import_log9.log)("authenticating...", void 0, {
|
|
3098
3102
|
F: __dxlog_file11,
|
|
3099
|
-
L:
|
|
3103
|
+
L: 135,
|
|
3100
3104
|
S: this,
|
|
3101
3105
|
C: (f, a) => f(...a)
|
|
3102
3106
|
});
|
|
3103
3107
|
(0, import_invariant10.invariant)(invitationId, void 0, {
|
|
3104
3108
|
F: __dxlog_file11,
|
|
3105
|
-
L:
|
|
3109
|
+
L: 136,
|
|
3106
3110
|
S: this,
|
|
3107
3111
|
A: [
|
|
3108
3112
|
"invitationId",
|
|
@@ -3115,7 +3119,7 @@ var InvitationsManager = class {
|
|
|
3115
3119
|
invitationId
|
|
3116
3120
|
}, {
|
|
3117
3121
|
F: __dxlog_file11,
|
|
3118
|
-
L:
|
|
3122
|
+
L: 139,
|
|
3119
3123
|
S: this,
|
|
3120
3124
|
C: (f, a) => f(...a)
|
|
3121
3125
|
});
|
|
@@ -3128,13 +3132,13 @@ var InvitationsManager = class {
|
|
|
3128
3132
|
invitationId
|
|
3129
3133
|
}, {
|
|
3130
3134
|
F: __dxlog_file11,
|
|
3131
|
-
L:
|
|
3135
|
+
L: 146,
|
|
3132
3136
|
S: this,
|
|
3133
3137
|
C: (f, a) => f(...a)
|
|
3134
3138
|
});
|
|
3135
3139
|
(0, import_invariant10.invariant)(invitationId, void 0, {
|
|
3136
3140
|
F: __dxlog_file11,
|
|
3137
|
-
L:
|
|
3141
|
+
L: 147,
|
|
3138
3142
|
S: this,
|
|
3139
3143
|
A: [
|
|
3140
3144
|
"invitationId",
|
|
@@ -3180,7 +3184,7 @@ var InvitationsManager = class {
|
|
|
3180
3184
|
}
|
|
3181
3185
|
}
|
|
3182
3186
|
_createInvitation(protocol, options) {
|
|
3183
|
-
const { invitationId = import_keys8.PublicKey.random().toHex(), type = import_services8.Invitation.Type.INTERACTIVE, authMethod = import_services8.Invitation.AuthMethod.SHARED_SECRET, state = import_services8.Invitation.State.INIT, timeout = import_client_protocol3.INVITATION_TIMEOUT, swarmKey = import_keys8.PublicKey.random(), persistent = options?.authMethod !== import_services8.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, lifetime = 86400, multiUse = false } = options ?? {};
|
|
3187
|
+
const { invitationId = import_keys8.PublicKey.random().toHex(), type = import_services8.Invitation.Type.INTERACTIVE, authMethod = import_services8.Invitation.AuthMethod.SHARED_SECRET, state = import_services8.Invitation.State.INIT, timeout = import_client_protocol3.INVITATION_TIMEOUT, swarmKey = import_keys8.PublicKey.random(), persistent = options?.authMethod !== import_services8.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials10.SpaceMember.Role.ADMIN, lifetime = 86400, multiUse = false } = options ?? {};
|
|
3184
3188
|
const authCode = options?.authCode ?? (authMethod === import_services8.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials9.generatePasscode)(import_client_protocol3.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
3185
3189
|
return {
|
|
3186
3190
|
invitationId,
|
|
@@ -3194,6 +3198,7 @@ var InvitationsManager = class {
|
|
|
3194
3198
|
guestKeypair: guestKeypair ?? (authMethod === import_services8.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
|
|
3195
3199
|
created,
|
|
3196
3200
|
lifetime,
|
|
3201
|
+
role,
|
|
3197
3202
|
multiUse,
|
|
3198
3203
|
delegationCredentialId: options?.delegationCredentialId,
|
|
3199
3204
|
...protocol.getInvitationContext()
|
|
@@ -3212,7 +3217,7 @@ var InvitationsManager = class {
|
|
|
3212
3217
|
...handler.toJSON()
|
|
3213
3218
|
}, {
|
|
3214
3219
|
F: __dxlog_file11,
|
|
3215
|
-
L:
|
|
3220
|
+
L: 236,
|
|
3216
3221
|
S: this,
|
|
3217
3222
|
C: (f, a) => f(...a)
|
|
3218
3223
|
});
|
|
@@ -3245,7 +3250,7 @@ var InvitationsManager = class {
|
|
|
3245
3250
|
...handler.toJSON()
|
|
3246
3251
|
}, {
|
|
3247
3252
|
F: __dxlog_file11,
|
|
3248
|
-
L:
|
|
3253
|
+
L: 256,
|
|
3249
3254
|
S: this,
|
|
3250
3255
|
C: (f, a) => f(...a)
|
|
3251
3256
|
});
|
|
@@ -3256,7 +3261,7 @@ var InvitationsManager = class {
|
|
|
3256
3261
|
} else {
|
|
3257
3262
|
import_log9.log.warn("auth failed", err, {
|
|
3258
3263
|
F: __dxlog_file11,
|
|
3259
|
-
L:
|
|
3264
|
+
L: 259,
|
|
3260
3265
|
S: this,
|
|
3261
3266
|
C: (f, a) => f(...a)
|
|
3262
3267
|
});
|
|
@@ -3273,7 +3278,7 @@ var InvitationsManager = class {
|
|
|
3273
3278
|
...handler.toJSON()
|
|
3274
3279
|
}, {
|
|
3275
3280
|
F: __dxlog_file11,
|
|
3276
|
-
L:
|
|
3281
|
+
L: 266,
|
|
3277
3282
|
S: this,
|
|
3278
3283
|
C: (f, a) => f(...a)
|
|
3279
3284
|
});
|
|
@@ -3318,7 +3323,7 @@ var InvitationsManager = class {
|
|
|
3318
3323
|
} catch (err) {
|
|
3319
3324
|
import_log9.log.catch(err, void 0, {
|
|
3320
3325
|
F: __dxlog_file11,
|
|
3321
|
-
L:
|
|
3326
|
+
L: 302,
|
|
3322
3327
|
S: this,
|
|
3323
3328
|
C: (f, a) => f(...a)
|
|
3324
3329
|
});
|
|
@@ -3414,7 +3419,7 @@ var AutomergeSpaceState = class {
|
|
|
3414
3419
|
this._isProcessingRootDocs = false;
|
|
3415
3420
|
}
|
|
3416
3421
|
async processCredential(credential) {
|
|
3417
|
-
if (!(0,
|
|
3422
|
+
if (!(0, import_credentials13.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
|
|
3418
3423
|
return;
|
|
3419
3424
|
}
|
|
3420
3425
|
this.lastEpoch = credential;
|
|
@@ -3729,7 +3734,7 @@ var DataSpace = class {
|
|
|
3729
3734
|
this._callbacks = params.callbacks ?? {};
|
|
3730
3735
|
this._echoHost = params.echoHost;
|
|
3731
3736
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
3732
|
-
trustedKeysProvider: () => new import_util6.ComplexSet(import_keys9.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) =>
|
|
3737
|
+
trustedKeysProvider: () => new import_util6.ComplexSet(import_keys9.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== import_credentials11.SpaceMember.Role.REMOVED).map((member) => member.key)),
|
|
3733
3738
|
update: this._inner.stateUpdate,
|
|
3734
3739
|
authTimeout: import_client_protocol4.AUTH_TIMEOUT
|
|
3735
3740
|
});
|
|
@@ -3739,7 +3744,7 @@ var DataSpace = class {
|
|
|
3739
3744
|
state: import_services9.SpaceState[this._state]
|
|
3740
3745
|
}, {
|
|
3741
3746
|
F: __dxlog_file13,
|
|
3742
|
-
L:
|
|
3747
|
+
L: 137,
|
|
3743
3748
|
S: this,
|
|
3744
3749
|
C: (f, a) => f(...a)
|
|
3745
3750
|
});
|
|
@@ -3789,7 +3794,7 @@ var DataSpace = class {
|
|
|
3789
3794
|
state: import_services9.SpaceState[this._state]
|
|
3790
3795
|
}, {
|
|
3791
3796
|
F: __dxlog_file13,
|
|
3792
|
-
L:
|
|
3797
|
+
L: 195,
|
|
3793
3798
|
S: this,
|
|
3794
3799
|
C: (f, a) => f(...a)
|
|
3795
3800
|
});
|
|
@@ -3807,7 +3812,7 @@ var DataSpace = class {
|
|
|
3807
3812
|
state: import_services9.SpaceState[this._state]
|
|
3808
3813
|
}, {
|
|
3809
3814
|
F: __dxlog_file13,
|
|
3810
|
-
L:
|
|
3815
|
+
L: 209,
|
|
3811
3816
|
S: this,
|
|
3812
3817
|
C: (f, a) => f(...a)
|
|
3813
3818
|
});
|
|
@@ -3839,7 +3844,7 @@ var DataSpace = class {
|
|
|
3839
3844
|
if (err instanceof import_protocols8.CancelledError || err instanceof import_context9.ContextDisposedError) {
|
|
3840
3845
|
(0, import_log10.log)("data pipeline initialization cancelled", err, {
|
|
3841
3846
|
F: __dxlog_file13,
|
|
3842
|
-
L:
|
|
3847
|
+
L: 242,
|
|
3843
3848
|
S: this,
|
|
3844
3849
|
C: (f, a) => f(...a)
|
|
3845
3850
|
});
|
|
@@ -3847,7 +3852,7 @@ var DataSpace = class {
|
|
|
3847
3852
|
}
|
|
3848
3853
|
import_log10.log.error("Error initializing data pipeline", err, {
|
|
3849
3854
|
F: __dxlog_file13,
|
|
3850
|
-
L:
|
|
3855
|
+
L: 246,
|
|
3851
3856
|
S: this,
|
|
3852
3857
|
C: (f, a) => f(...a)
|
|
3853
3858
|
});
|
|
@@ -3856,7 +3861,7 @@ var DataSpace = class {
|
|
|
3856
3861
|
state: import_services9.SpaceState[this._state]
|
|
3857
3862
|
}, {
|
|
3858
3863
|
F: __dxlog_file13,
|
|
3859
|
-
L:
|
|
3864
|
+
L: 248,
|
|
3860
3865
|
S: this,
|
|
3861
3866
|
C: (f, a) => f(...a)
|
|
3862
3867
|
});
|
|
@@ -3876,7 +3881,7 @@ var DataSpace = class {
|
|
|
3876
3881
|
state: import_services9.SpaceState[this._state]
|
|
3877
3882
|
}, {
|
|
3878
3883
|
F: __dxlog_file13,
|
|
3879
|
-
L:
|
|
3884
|
+
L: 264,
|
|
3880
3885
|
S: this,
|
|
3881
3886
|
C: (f, a) => f(...a)
|
|
3882
3887
|
});
|
|
@@ -3886,7 +3891,7 @@ var DataSpace = class {
|
|
|
3886
3891
|
await (0, import_context9.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3887
3892
|
(0, import_log10.log)("data pipeline ready", void 0, {
|
|
3888
3893
|
F: __dxlog_file13,
|
|
3889
|
-
L:
|
|
3894
|
+
L: 276,
|
|
3890
3895
|
S: this,
|
|
3891
3896
|
C: (f, a) => f(...a)
|
|
3892
3897
|
});
|
|
@@ -3896,7 +3901,7 @@ var DataSpace = class {
|
|
|
3896
3901
|
state: import_services9.SpaceState[this._state]
|
|
3897
3902
|
}, {
|
|
3898
3903
|
F: __dxlog_file13,
|
|
3899
|
-
L:
|
|
3904
|
+
L: 280,
|
|
3900
3905
|
S: this,
|
|
3901
3906
|
C: (f, a) => f(...a)
|
|
3902
3907
|
});
|
|
@@ -3912,7 +3917,7 @@ var DataSpace = class {
|
|
|
3912
3917
|
await this._createWritableFeeds();
|
|
3913
3918
|
(0, import_log10.log)("writable feeds created", void 0, {
|
|
3914
3919
|
F: __dxlog_file13,
|
|
3915
|
-
L:
|
|
3920
|
+
L: 296,
|
|
3916
3921
|
S: this,
|
|
3917
3922
|
C: (f, a) => f(...a)
|
|
3918
3923
|
});
|
|
@@ -3939,7 +3944,7 @@ var DataSpace = class {
|
|
|
3939
3944
|
spaceKey: this.key,
|
|
3940
3945
|
deviceKey: this._signingContext.deviceKey,
|
|
3941
3946
|
identityKey: this._signingContext.identityKey,
|
|
3942
|
-
designation:
|
|
3947
|
+
designation: import_credentials12.AdmittedFeed.Designation.CONTROL
|
|
3943
3948
|
}
|
|
3944
3949
|
}));
|
|
3945
3950
|
}
|
|
@@ -3956,7 +3961,7 @@ var DataSpace = class {
|
|
|
3956
3961
|
spaceKey: this.key,
|
|
3957
3962
|
deviceKey: this._signingContext.deviceKey,
|
|
3958
3963
|
identityKey: this._signingContext.identityKey,
|
|
3959
|
-
designation:
|
|
3964
|
+
designation: import_credentials12.AdmittedFeed.Designation.DATA
|
|
3960
3965
|
}
|
|
3961
3966
|
}));
|
|
3962
3967
|
}
|
|
@@ -3975,7 +3980,7 @@ var DataSpace = class {
|
|
|
3975
3980
|
rootUrl
|
|
3976
3981
|
}, {
|
|
3977
3982
|
F: __dxlog_file13,
|
|
3978
|
-
L:
|
|
3983
|
+
L: 362,
|
|
3979
3984
|
S: this,
|
|
3980
3985
|
C: (f, a) => f(...a)
|
|
3981
3986
|
});
|
|
@@ -4007,7 +4012,7 @@ var DataSpace = class {
|
|
|
4007
4012
|
err
|
|
4008
4013
|
}, {
|
|
4009
4014
|
F: __dxlog_file13,
|
|
4010
|
-
L:
|
|
4015
|
+
L: 385,
|
|
4011
4016
|
S: this,
|
|
4012
4017
|
C: (f, a) => f(...a)
|
|
4013
4018
|
});
|
|
@@ -4062,7 +4067,7 @@ var DataSpace = class {
|
|
|
4062
4067
|
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
4063
4068
|
(0, import_invariant11.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4064
4069
|
F: __dxlog_file13,
|
|
4065
|
-
L:
|
|
4070
|
+
L: 435,
|
|
4066
4071
|
S: this,
|
|
4067
4072
|
A: [
|
|
4068
4073
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -4081,7 +4086,7 @@ var DataSpace = class {
|
|
|
4081
4086
|
{
|
|
4082
4087
|
import_log10.log.info("Fragmenting", void 0, {
|
|
4083
4088
|
F: __dxlog_file13,
|
|
4084
|
-
L:
|
|
4089
|
+
L: 447,
|
|
4085
4090
|
S: this,
|
|
4086
4091
|
C: (f, a) => f(...a)
|
|
4087
4092
|
});
|
|
@@ -4093,7 +4098,7 @@ var DataSpace = class {
|
|
|
4093
4098
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4094
4099
|
(0, import_invariant11.invariant)(properties, "Properties not found", {
|
|
4095
4100
|
F: __dxlog_file13,
|
|
4096
|
-
L:
|
|
4101
|
+
L: 457,
|
|
4097
4102
|
S: this,
|
|
4098
4103
|
A: [
|
|
4099
4104
|
"properties",
|
|
@@ -4109,7 +4114,7 @@ var DataSpace = class {
|
|
|
4109
4114
|
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
4110
4115
|
(0, import_invariant11.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4111
4116
|
F: __dxlog_file13,
|
|
4112
|
-
L:
|
|
4117
|
+
L: 462,
|
|
4113
4118
|
S: this,
|
|
4114
4119
|
A: [
|
|
4115
4120
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
@@ -4178,7 +4183,7 @@ var DataSpace = class {
|
|
|
4178
4183
|
state: import_services9.SpaceState[this._state]
|
|
4179
4184
|
}, {
|
|
4180
4185
|
F: __dxlog_file13,
|
|
4181
|
-
L:
|
|
4186
|
+
L: 528,
|
|
4182
4187
|
S: this,
|
|
4183
4188
|
C: (f, a) => f(...a)
|
|
4184
4189
|
});
|
|
@@ -4232,7 +4237,7 @@ DataSpace = _ts_decorate4([
|
|
|
4232
4237
|
], DataSpace);
|
|
4233
4238
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
4234
4239
|
const credentials = [
|
|
4235
|
-
await (0,
|
|
4240
|
+
await (0, import_credentials15.createCredential)({
|
|
4236
4241
|
signer: keyring,
|
|
4237
4242
|
issuer: space.key,
|
|
4238
4243
|
subject: space.key,
|
|
@@ -4241,14 +4246,14 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
4241
4246
|
spaceKey: space.key
|
|
4242
4247
|
}
|
|
4243
4248
|
}),
|
|
4244
|
-
await (0,
|
|
4249
|
+
await (0, import_credentials15.createCredential)({
|
|
4245
4250
|
signer: keyring,
|
|
4246
4251
|
issuer: space.key,
|
|
4247
4252
|
subject: signingContext.identityKey,
|
|
4248
4253
|
assertion: {
|
|
4249
4254
|
"@type": "dxos.halo.credentials.SpaceMember",
|
|
4250
4255
|
spaceKey: space.key,
|
|
4251
|
-
role:
|
|
4256
|
+
role: import_credentials16.SpaceMember.Role.OWNER,
|
|
4252
4257
|
profile: signingContext.getProfile(),
|
|
4253
4258
|
genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
|
|
4254
4259
|
}
|
|
@@ -4260,7 +4265,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
4260
4265
|
spaceKey: space.key,
|
|
4261
4266
|
identityKey: signingContext.identityKey,
|
|
4262
4267
|
deviceKey: signingContext.deviceKey,
|
|
4263
|
-
designation:
|
|
4268
|
+
designation: import_credentials16.AdmittedFeed.Designation.CONTROL
|
|
4264
4269
|
}
|
|
4265
4270
|
}),
|
|
4266
4271
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -4270,7 +4275,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
4270
4275
|
spaceKey: space.key,
|
|
4271
4276
|
identityKey: signingContext.identityKey,
|
|
4272
4277
|
deviceKey: signingContext.deviceKey,
|
|
4273
|
-
designation:
|
|
4278
|
+
designation: import_credentials16.AdmittedFeed.Designation.DATA
|
|
4274
4279
|
}
|
|
4275
4280
|
}),
|
|
4276
4281
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -4440,7 +4445,7 @@ var DataSpaceManager = class {
|
|
|
4440
4445
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRootUrl);
|
|
4441
4446
|
await this._metadataStore.addSpace(metadata);
|
|
4442
4447
|
const memberCredential = credentials[1];
|
|
4443
|
-
(0, import_invariant13.invariant)((0,
|
|
4448
|
+
(0, import_invariant13.invariant)((0, import_credentials14.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4444
4449
|
F: __dxlog_file14,
|
|
4445
4450
|
L: 163,
|
|
4446
4451
|
S: this,
|
|
@@ -4702,6 +4707,9 @@ var SpacesServiceImpl = class {
|
|
|
4702
4707
|
}
|
|
4703
4708
|
}
|
|
4704
4709
|
}
|
|
4710
|
+
async updateMemberRole(_) {
|
|
4711
|
+
throw new Error("not implemented");
|
|
4712
|
+
}
|
|
4705
4713
|
querySpaces() {
|
|
4706
4714
|
return new import_codec_protobuf10.Stream(({ next, ctx }) => {
|
|
4707
4715
|
const scheduler = new import_async15.UpdateScheduler(ctx, async () => {
|
|
@@ -4711,7 +4719,7 @@ var SpacesServiceImpl = class {
|
|
|
4711
4719
|
spaces
|
|
4712
4720
|
}, {
|
|
4713
4721
|
F: __dxlog_file15,
|
|
4714
|
-
L:
|
|
4722
|
+
L: 82,
|
|
4715
4723
|
S: this,
|
|
4716
4724
|
C: (f, a) => f(...a)
|
|
4717
4725
|
});
|
|
@@ -4794,7 +4802,7 @@ var SpacesServiceImpl = class {
|
|
|
4794
4802
|
} else {
|
|
4795
4803
|
(0, import_invariant14.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
4796
4804
|
F: __dxlog_file15,
|
|
4797
|
-
L:
|
|
4805
|
+
L: 169,
|
|
4798
4806
|
S: this,
|
|
4799
4807
|
A: [
|
|
4800
4808
|
"!credential.id",
|
|
@@ -4803,7 +4811,7 @@ var SpacesServiceImpl = class {
|
|
|
4803
4811
|
});
|
|
4804
4812
|
(0, import_invariant14.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
4805
4813
|
F: __dxlog_file15,
|
|
4806
|
-
L:
|
|
4814
|
+
L: 170,
|
|
4807
4815
|
S: this,
|
|
4808
4816
|
A: [
|
|
4809
4817
|
"this._identityManager.identity",
|
|
@@ -4813,7 +4821,7 @@ var SpacesServiceImpl = class {
|
|
|
4813
4821
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
4814
4822
|
(0, import_invariant14.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
4815
4823
|
F: __dxlog_file15,
|
|
4816
|
-
L:
|
|
4824
|
+
L: 172,
|
|
4817
4825
|
S: this,
|
|
4818
4826
|
A: [
|
|
4819
4827
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -4868,7 +4876,7 @@ var SpacesServiceImpl = class {
|
|
|
4868
4876
|
identityKey: member.key,
|
|
4869
4877
|
profile: member.profile ?? {}
|
|
4870
4878
|
},
|
|
4871
|
-
presence: member.
|
|
4879
|
+
presence: member.role === import_credentials17.SpaceMember.Role.REMOVED ? import_services11.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services11.SpaceMember.PresenceState.ONLINE : import_services11.SpaceMember.PresenceState.OFFLINE,
|
|
4872
4880
|
peerStates: peers
|
|
4873
4881
|
};
|
|
4874
4882
|
}),
|
|
@@ -5081,7 +5089,7 @@ var ServiceContext = class extends import_context12.Resource {
|
|
|
5081
5089
|
this.initialized.wake();
|
|
5082
5090
|
this._deviceSpaceSync = {
|
|
5083
5091
|
processCredential: async (credential) => {
|
|
5084
|
-
const assertion = (0,
|
|
5092
|
+
const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
|
|
5085
5093
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
5086
5094
|
return;
|
|
5087
5095
|
}
|
|
@@ -5168,7 +5176,7 @@ var ServiceRegistry = class {
|
|
|
5168
5176
|
delete this._handlers[name];
|
|
5169
5177
|
}
|
|
5170
5178
|
};
|
|
5171
|
-
var DXOS_VERSION = "0.5.1-next.
|
|
5179
|
+
var DXOS_VERSION = "0.5.1-next.d0efa9a";
|
|
5172
5180
|
var getPlatform = () => {
|
|
5173
5181
|
if (process.browser) {
|
|
5174
5182
|
if (typeof window !== "undefined") {
|
|
@@ -5210,63 +5218,55 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
5210
5218
|
},
|
|
5211
5219
|
trace: import_tracing6.TRACE_PROCESSOR.getDiagnostics()
|
|
5212
5220
|
};
|
|
5213
|
-
|
|
5214
|
-
(
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5221
|
+
await Promise.all([
|
|
5222
|
+
(async () => {
|
|
5223
|
+
(0, import_invariant16.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
5224
|
+
F: __dxlog_file17,
|
|
5225
|
+
L: 110,
|
|
5226
|
+
S: void 0,
|
|
5227
|
+
A: [
|
|
5228
|
+
"clientServices.LoggingService",
|
|
5229
|
+
"'SystemService is not available.'"
|
|
5230
|
+
]
|
|
5231
|
+
});
|
|
5232
|
+
diagnostics.metrics = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
|
|
5233
|
+
timeout: DEFAULT_TIMEOUT
|
|
5234
|
+
}).catch(() => void 0);
|
|
5235
|
+
})(),
|
|
5236
|
+
(async () => {
|
|
5237
|
+
diagnostics.storage = await (0, import_async17.asyncTimeout)(getStorageDiagnostics(), DEFAULT_TIMEOUT).catch(() => void 0);
|
|
5238
|
+
})(),
|
|
5239
|
+
async () => {
|
|
5240
|
+
const identity = serviceContext.identityManager.identity;
|
|
5241
|
+
if (identity) {
|
|
5242
|
+
diagnostics.identity = {
|
|
5243
|
+
identityKey: identity.identityKey,
|
|
5244
|
+
spaceKey: identity.space.key,
|
|
5245
|
+
profile: identity.profileDocument
|
|
5246
|
+
};
|
|
5247
|
+
const { devices } = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
|
|
5248
|
+
timeout: DEFAULT_TIMEOUT
|
|
5249
|
+
}).catch(() => void 0) ?? {};
|
|
5250
|
+
diagnostics.devices = devices;
|
|
5251
|
+
if (serviceContext.dataSpaceManager) {
|
|
5252
|
+
diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
|
|
5253
|
+
}
|
|
5254
|
+
const { feeds = [] } = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
|
|
5255
|
+
timeout: DEFAULT_TIMEOUT
|
|
5256
|
+
}).catch(() => void 0) ?? {};
|
|
5257
|
+
diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
|
|
5258
|
+
feedKey,
|
|
5259
|
+
bytes,
|
|
5260
|
+
length
|
|
5261
|
+
}));
|
|
5262
|
+
const status = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
|
|
5263
|
+
timeout: DEFAULT_TIMEOUT
|
|
5264
|
+
}).catch(() => void 0);
|
|
5265
|
+
diagnostics.networkStatus = status;
|
|
5266
|
+
diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
5234
5267
|
}
|
|
5235
|
-
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
5236
|
-
}
|
|
5237
|
-
diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
|
|
5238
|
-
file,
|
|
5239
|
-
count
|
|
5240
|
-
}));
|
|
5241
|
-
}
|
|
5242
|
-
const identity = serviceContext.identityManager.identity;
|
|
5243
|
-
if (identity) {
|
|
5244
|
-
diagnostics.identity = {
|
|
5245
|
-
identityKey: identity.identityKey,
|
|
5246
|
-
spaceKey: identity.space.key,
|
|
5247
|
-
profile: identity.profileDocument
|
|
5248
|
-
};
|
|
5249
|
-
const { devices } = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
|
|
5250
|
-
timeout: DEFAULT_TIMEOUT
|
|
5251
|
-
}).catch(() => void 0) ?? {};
|
|
5252
|
-
diagnostics.devices = devices;
|
|
5253
|
-
if (serviceContext.dataSpaceManager) {
|
|
5254
|
-
diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
|
|
5255
5268
|
}
|
|
5256
|
-
|
|
5257
|
-
timeout: DEFAULT_TIMEOUT
|
|
5258
|
-
}).catch(() => void 0) ?? {};
|
|
5259
|
-
diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
|
|
5260
|
-
feedKey,
|
|
5261
|
-
bytes,
|
|
5262
|
-
length
|
|
5263
|
-
}));
|
|
5264
|
-
const status = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
|
|
5265
|
-
timeout: DEFAULT_TIMEOUT
|
|
5266
|
-
}).catch(() => void 0);
|
|
5267
|
-
diagnostics.networkStatus = status;
|
|
5268
|
-
diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
5269
|
-
}
|
|
5269
|
+
]);
|
|
5270
5270
|
diagnostics.config = config.values;
|
|
5271
5271
|
return diagnostics;
|
|
5272
5272
|
};
|
|
@@ -5274,7 +5274,7 @@ var getSpaceStats = async (space) => {
|
|
|
5274
5274
|
const stats = {
|
|
5275
5275
|
key: space.key,
|
|
5276
5276
|
metrics: space.metrics,
|
|
5277
|
-
epochs: space.inner.spaceState.credentials.filter((0,
|
|
5277
|
+
epochs: space.inner.spaceState.credentials.filter((0, import_credentials19.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
|
|
5278
5278
|
...credential.subject.assertion,
|
|
5279
5279
|
id: credential.id
|
|
5280
5280
|
})),
|
|
@@ -5303,6 +5303,24 @@ var getSpaceStats = async (space) => {
|
|
|
5303
5303
|
}
|
|
5304
5304
|
return stats;
|
|
5305
5305
|
};
|
|
5306
|
+
var getStorageDiagnostics = async () => {
|
|
5307
|
+
if (typeof navigator === "undefined" || !navigator.storage) {
|
|
5308
|
+
return void 0;
|
|
5309
|
+
}
|
|
5310
|
+
const map = /* @__PURE__ */ new Map();
|
|
5311
|
+
const dir = await navigator.storage.getDirectory();
|
|
5312
|
+
for await (const filename of dir?.keys()) {
|
|
5313
|
+
const idx = filename.indexOf("-", filename.indexOf("-") + 1);
|
|
5314
|
+
if (idx === -1) {
|
|
5315
|
+
continue;
|
|
5316
|
+
}
|
|
5317
|
+
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
5318
|
+
}
|
|
5319
|
+
return Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
|
|
5320
|
+
file,
|
|
5321
|
+
count
|
|
5322
|
+
}));
|
|
5323
|
+
};
|
|
5306
5324
|
var createCollectDiagnosticsBroadcastSender = () => {
|
|
5307
5325
|
return {
|
|
5308
5326
|
broadcastDiagnosticsRequest: async () => void 0
|
|
@@ -5375,7 +5393,7 @@ var DevicesServiceImpl = class {
|
|
|
5375
5393
|
presenceSubscribed = true;
|
|
5376
5394
|
}
|
|
5377
5395
|
};
|
|
5378
|
-
const subscriptions = new
|
|
5396
|
+
const subscriptions = new import_async19.EventSubscriptions();
|
|
5379
5397
|
if (this._identityManager.identity) {
|
|
5380
5398
|
subscribeIdentity();
|
|
5381
5399
|
subscribePresence();
|
|
@@ -5448,7 +5466,7 @@ _ts_decorate7([
|
|
|
5448
5466
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
5449
5467
|
var LoggingServiceImpl = class {
|
|
5450
5468
|
constructor() {
|
|
5451
|
-
this._logs = new
|
|
5469
|
+
this._logs = new import_async20.Event();
|
|
5452
5470
|
this._started = Date.now();
|
|
5453
5471
|
this._sessionId = import_keys14.PublicKey.random().toHex();
|
|
5454
5472
|
this._logProcessor = (_config, entry2) => {
|
|
@@ -5725,7 +5743,7 @@ var ClientServicesHost = class {
|
|
|
5725
5743
|
runtimeParams
|
|
5726
5744
|
} = {}) {
|
|
5727
5745
|
this._tracingService = import_tracing8.TRACE_PROCESSOR.createTraceSender();
|
|
5728
|
-
this._statusUpdate = new
|
|
5746
|
+
this._statusUpdate = new import_async18.Event();
|
|
5729
5747
|
this._opening = false;
|
|
5730
5748
|
this._open = false;
|
|
5731
5749
|
this._storage = storage;
|
|
@@ -6023,7 +6041,7 @@ var ClientServicesHost = class {
|
|
|
6023
6041
|
S: this,
|
|
6024
6042
|
C: (f, a) => f(...a)
|
|
6025
6043
|
});
|
|
6026
|
-
|
|
6044
|
+
import_log15.log.info("resetting...", void 0, {
|
|
6027
6045
|
F: __dxlog_file20,
|
|
6028
6046
|
L: 342,
|
|
6029
6047
|
S: this,
|
|
@@ -6031,7 +6049,7 @@ var ClientServicesHost = class {
|
|
|
6031
6049
|
});
|
|
6032
6050
|
await this._serviceContext?.close();
|
|
6033
6051
|
await this._storage.reset();
|
|
6034
|
-
|
|
6052
|
+
import_log15.log.info("reset", void 0, {
|
|
6035
6053
|
F: __dxlog_file20,
|
|
6036
6054
|
L: 345,
|
|
6037
6055
|
S: this,
|
|
@@ -6092,17 +6110,18 @@ _ts_decorate8([
|
|
|
6092
6110
|
import_tracing8.trace.info()
|
|
6093
6111
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
6094
6112
|
_ts_decorate8([
|
|
6095
|
-
|
|
6113
|
+
import_async18.synchronized,
|
|
6096
6114
|
import_tracing8.trace.span()
|
|
6097
6115
|
], ClientServicesHost.prototype, "open", null);
|
|
6098
6116
|
_ts_decorate8([
|
|
6099
|
-
|
|
6117
|
+
import_async18.synchronized,
|
|
6100
6118
|
import_tracing8.trace.span()
|
|
6101
6119
|
], ClientServicesHost.prototype, "close", null);
|
|
6102
6120
|
ClientServicesHost = _ts_decorate8([
|
|
6103
6121
|
import_tracing8.trace.resource()
|
|
6104
6122
|
], ClientServicesHost);
|
|
6105
6123
|
var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
|
|
6124
|
+
var GET_DIAGNOSTICS_RPC_TIMEOUT = 1e4;
|
|
6106
6125
|
var DiagnosticsCollector = class {
|
|
6107
6126
|
static {
|
|
6108
6127
|
this.broadcastSender = createCollectDiagnosticsBroadcastSender();
|
|
@@ -6110,6 +6129,8 @@ var DiagnosticsCollector = class {
|
|
|
6110
6129
|
static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
|
|
6111
6130
|
const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
|
|
6112
6131
|
keys: options.humanize ? import_services15.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services15.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
|
|
6132
|
+
}, {
|
|
6133
|
+
timeout: GET_DIAGNOSTICS_RPC_TIMEOUT
|
|
6113
6134
|
});
|
|
6114
6135
|
const clientDiagnostics = {
|
|
6115
6136
|
config,
|
|
@@ -6126,12 +6147,12 @@ var DiagnosticsCollector = class {
|
|
|
6126
6147
|
}
|
|
6127
6148
|
};
|
|
6128
6149
|
var findSystemServiceProvider = () => {
|
|
6129
|
-
const serviceProviders = import_tracing7.TRACE_PROCESSOR.
|
|
6150
|
+
const serviceProviders = import_tracing7.TRACE_PROCESSOR.findResourcesByAnnotation(ClientServicesProviderResource);
|
|
6130
6151
|
const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
|
|
6131
6152
|
return providerResource?.instance?.deref() ?? null;
|
|
6132
6153
|
};
|
|
6133
6154
|
var findConfigs = () => {
|
|
6134
|
-
const configs = import_tracing7.TRACE_PROCESSOR.
|
|
6155
|
+
const configs = import_tracing7.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
|
|
6135
6156
|
return configs.map((r) => r.instance.deref()).filter(import_util10.nonNullable);
|
|
6136
6157
|
};
|
|
6137
6158
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -6174,4 +6195,4 @@ var findConfigs = () => {
|
|
|
6174
6195
|
subscribeToSpaces,
|
|
6175
6196
|
subscribeToSwarmInfo
|
|
6176
6197
|
});
|
|
6177
|
-
//# sourceMappingURL=chunk-
|
|
6198
|
+
//# sourceMappingURL=chunk-R5JDCL3F.cjs.map
|