@dxos/client-services 0.5.9-main.eacfffa → 0.5.9-main.f099efe
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-J4DDMC6A.mjs → chunk-H3XJK6ZN.mjs} +483 -187
- package/dist/lib/browser/{chunk-J4DDMC6A.mjs.map → chunk-H3XJK6ZN.mjs.map} +4 -4
- package/dist/lib/browser/index.mjs +9 -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-6HFQ2SQ5.cjs → chunk-JRDM7NQS.cjs} +502 -206
- package/dist/lib/node/chunk-JRDM7NQS.cjs.map +7 -0
- package/dist/lib/node/index.cjs +49 -41
- 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/identity/contacts-service.d.ts +14 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +4 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/index.d.ts +1 -0
- package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts +14 -0
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -0
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/contacts-service.ts +85 -0
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -32
- package/src/packlets/services/service-host.ts +12 -4
- package/src/packlets/spaces/data-space-manager.ts +55 -2
- package/src/packlets/spaces/spaces-service.ts +38 -0
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/profile-archive.ts +97 -0
- package/src/version.ts +1 -1
- package/dist/lib/node/chunk-6HFQ2SQ5.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_JRDM7NQS_exports = {};
|
|
30
|
+
__export(chunk_JRDM7NQS_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -56,7 +56,11 @@ __export(chunk_6HFQ2SQ5_exports, {
|
|
|
56
56
|
createDiagnostics: () => createDiagnostics,
|
|
57
57
|
createLevel: () => createLevel,
|
|
58
58
|
createStorageObjects: () => createStorageObjects,
|
|
59
|
+
decodeProfileArchive: () => decodeProfileArchive,
|
|
60
|
+
encodeProfileArchive: () => encodeProfileArchive,
|
|
61
|
+
exportProfileData: () => exportProfileData,
|
|
59
62
|
getNetworkPeers: () => getNetworkPeers,
|
|
63
|
+
importProfileData: () => importProfileData,
|
|
60
64
|
isLocked: () => isLocked,
|
|
61
65
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
62
66
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
@@ -66,7 +70,7 @@ __export(chunk_6HFQ2SQ5_exports, {
|
|
|
66
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
67
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
68
72
|
});
|
|
69
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_JRDM7NQS_exports);
|
|
70
74
|
var import_async = require("@dxos/async");
|
|
71
75
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
72
76
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -236,8 +240,10 @@ var import_context14 = require("@dxos/context");
|
|
|
236
240
|
var import_credentials15 = require("@dxos/credentials");
|
|
237
241
|
var import_echo_db2 = require("@dxos/echo-db");
|
|
238
242
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
243
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
239
244
|
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
240
245
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
246
|
+
var import_feed_store4 = require("@dxos/feed-store");
|
|
241
247
|
var import_invariant15 = require("@dxos/invariant");
|
|
242
248
|
var import_keys12 = require("@dxos/keys");
|
|
243
249
|
var import_log15 = require("@dxos/log");
|
|
@@ -255,7 +261,7 @@ var import_async18 = require("@dxos/async");
|
|
|
255
261
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
256
262
|
var import_credentials19 = require("@dxos/credentials");
|
|
257
263
|
var import_debug5 = require("@dxos/debug");
|
|
258
|
-
var
|
|
264
|
+
var import_feed_store5 = require("@dxos/feed-store");
|
|
259
265
|
var import_invariant16 = require("@dxos/invariant");
|
|
260
266
|
var import_log16 = require("@dxos/log");
|
|
261
267
|
var import_protocols12 = require("@dxos/protocols");
|
|
@@ -266,8 +272,8 @@ var import_context15 = require("@dxos/context");
|
|
|
266
272
|
var import_credentials20 = require("@dxos/credentials");
|
|
267
273
|
var import_debug6 = require("@dxos/debug");
|
|
268
274
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
269
|
-
var
|
|
270
|
-
var
|
|
275
|
+
var import_echo_pipeline6 = require("@dxos/echo-pipeline");
|
|
276
|
+
var import_feed_store6 = require("@dxos/feed-store");
|
|
271
277
|
var import_invariant17 = require("@dxos/invariant");
|
|
272
278
|
var import_keyring = require("@dxos/keyring");
|
|
273
279
|
var import_keys13 = require("@dxos/keys");
|
|
@@ -289,38 +295,47 @@ var import_util12 = require("@dxos/util");
|
|
|
289
295
|
var import_node_path = __toESM(require("node:path"));
|
|
290
296
|
var import_keys14 = require("@dxos/keys");
|
|
291
297
|
var import_kv_store = require("@dxos/kv-store");
|
|
298
|
+
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
299
|
+
var import_invariant19 = require("@dxos/invariant");
|
|
300
|
+
var import_log19 = require("@dxos/log");
|
|
301
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
302
|
+
var import_util13 = require("@dxos/util");
|
|
292
303
|
var import_async20 = require("@dxos/async");
|
|
293
304
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
294
305
|
var import_context16 = require("@dxos/context");
|
|
295
|
-
var
|
|
306
|
+
var import_invariant20 = require("@dxos/invariant");
|
|
296
307
|
var import_keys15 = require("@dxos/keys");
|
|
297
|
-
var
|
|
308
|
+
var import_log20 = require("@dxos/log");
|
|
298
309
|
var import_messaging = require("@dxos/messaging");
|
|
299
310
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
300
|
-
var
|
|
311
|
+
var import_protocols16 = require("@dxos/protocols");
|
|
301
312
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
302
313
|
var import_tracing9 = require("@dxos/tracing");
|
|
303
314
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
304
315
|
var import_async21 = require("@dxos/async");
|
|
305
316
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
306
|
-
var
|
|
317
|
+
var import_invariant21 = require("@dxos/invariant");
|
|
307
318
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
308
319
|
var import_config3 = require("@dxos/config");
|
|
309
320
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
310
321
|
var import_tracing10 = require("@dxos/tracing");
|
|
311
|
-
var import_util13 = require("@dxos/util");
|
|
312
|
-
var import_keys16 = require("@dxos/keys");
|
|
313
322
|
var import_util14 = require("@dxos/util");
|
|
323
|
+
var import_keys16 = require("@dxos/keys");
|
|
324
|
+
var import_util15 = require("@dxos/util");
|
|
314
325
|
var import_async22 = require("@dxos/async");
|
|
315
326
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
316
327
|
var import_keys17 = require("@dxos/keys");
|
|
317
|
-
var
|
|
318
|
-
var
|
|
319
|
-
var import_util15 = require("@dxos/util");
|
|
328
|
+
var import_util16 = require("@dxos/util");
|
|
329
|
+
var import_async23 = require("@dxos/async");
|
|
320
330
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
331
|
+
var import_keys18 = require("@dxos/keys");
|
|
332
|
+
var import_log21 = require("@dxos/log");
|
|
333
|
+
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
334
|
+
var import_util17 = require("@dxos/util");
|
|
321
335
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
336
|
+
var import_codec_protobuf16 = require("@dxos/codec-protobuf");
|
|
322
337
|
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
323
|
-
var
|
|
338
|
+
var import_util18 = require("@dxos/util");
|
|
324
339
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
325
340
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
326
341
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -635,7 +650,7 @@ var DevtoolsServiceImpl = class {
|
|
|
635
650
|
});
|
|
636
651
|
}
|
|
637
652
|
};
|
|
638
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
653
|
+
var DXOS_VERSION = "0.5.9-main.f099efe";
|
|
639
654
|
var getPlatform = () => {
|
|
640
655
|
if (process.browser) {
|
|
641
656
|
if (typeof window !== "undefined") {
|
|
@@ -3186,79 +3201,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3186
3201
|
};
|
|
3187
3202
|
}
|
|
3188
3203
|
async admit(invitation, request, guestProfile) {
|
|
3189
|
-
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3190
|
-
F: __dxlog_file13,
|
|
3191
|
-
L: 76,
|
|
3192
|
-
S: this,
|
|
3193
|
-
A: [
|
|
3194
|
-
"this._spaceKey",
|
|
3195
|
-
""
|
|
3196
|
-
]
|
|
3197
|
-
});
|
|
3198
|
-
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3199
|
-
(0, import_invariant10.invariant)(space, void 0, {
|
|
3204
|
+
(0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
|
|
3200
3205
|
F: __dxlog_file13,
|
|
3201
|
-
L:
|
|
3206
|
+
L: 74,
|
|
3202
3207
|
S: this,
|
|
3203
3208
|
A: [
|
|
3204
|
-
"space",
|
|
3209
|
+
"this._spaceKey && request.space",
|
|
3205
3210
|
""
|
|
3206
3211
|
]
|
|
3207
3212
|
});
|
|
3208
|
-
(0, import_invariant10.invariant)(request.space, void 0, {
|
|
3209
|
-
F: __dxlog_file13,
|
|
3210
|
-
L: 80,
|
|
3211
|
-
S: this,
|
|
3212
|
-
A: [
|
|
3213
|
-
"request.space",
|
|
3214
|
-
""
|
|
3215
|
-
]
|
|
3216
|
-
});
|
|
3217
|
-
const { identityKey, deviceKey } = request.space;
|
|
3218
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
|
|
3219
|
-
throw new import_protocols8.AlreadyJoinedError();
|
|
3220
|
-
}
|
|
3221
3213
|
(0, import_log10.log)("writing guest credentials", {
|
|
3222
3214
|
host: this._signingContext.deviceKey,
|
|
3223
|
-
guest: deviceKey
|
|
3215
|
+
guest: request.space.deviceKey
|
|
3224
3216
|
}, {
|
|
3225
3217
|
F: __dxlog_file13,
|
|
3226
|
-
L:
|
|
3218
|
+
L: 75,
|
|
3227
3219
|
S: this,
|
|
3228
3220
|
C: (f, a) => f(...a)
|
|
3229
3221
|
});
|
|
3230
|
-
const
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
"credentials[0].credential",
|
|
3237
|
-
""
|
|
3238
|
-
]
|
|
3239
|
-
});
|
|
3240
|
-
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3241
|
-
(0, import_invariant10.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3242
|
-
F: __dxlog_file13,
|
|
3243
|
-
L: 103,
|
|
3244
|
-
S: this,
|
|
3245
|
-
A: [
|
|
3246
|
-
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3247
|
-
""
|
|
3248
|
-
]
|
|
3222
|
+
const spaceMemberCredential = await this._spaceManager.admitMember({
|
|
3223
|
+
spaceKey: this._spaceKey,
|
|
3224
|
+
identityKey: request.space.identityKey,
|
|
3225
|
+
role: invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN,
|
|
3226
|
+
profile: guestProfile,
|
|
3227
|
+
delegationCredentialId: invitation.delegationCredentialId
|
|
3249
3228
|
});
|
|
3250
|
-
|
|
3229
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3251
3230
|
return {
|
|
3252
3231
|
space: {
|
|
3253
3232
|
credential: spaceMemberCredential,
|
|
3254
|
-
controlTimeframe: space
|
|
3233
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3255
3234
|
}
|
|
3256
3235
|
};
|
|
3257
3236
|
}
|
|
3258
3237
|
async delegate(invitation) {
|
|
3259
3238
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3260
3239
|
F: __dxlog_file13,
|
|
3261
|
-
L:
|
|
3240
|
+
L: 95,
|
|
3262
3241
|
S: this,
|
|
3263
3242
|
A: [
|
|
3264
3243
|
"this._spaceKey",
|
|
@@ -3268,7 +3247,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3268
3247
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3269
3248
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3270
3249
|
F: __dxlog_file13,
|
|
3271
|
-
L:
|
|
3250
|
+
L: 97,
|
|
3272
3251
|
S: this,
|
|
3273
3252
|
A: [
|
|
3274
3253
|
"space",
|
|
@@ -3278,7 +3257,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3278
3257
|
if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3279
3258
|
(0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
3280
3259
|
F: __dxlog_file13,
|
|
3281
|
-
L:
|
|
3260
|
+
L: 99,
|
|
3282
3261
|
S: this,
|
|
3283
3262
|
A: [
|
|
3284
3263
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3291,7 +3270,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3291
3270
|
id: invitation.invitationId
|
|
3292
3271
|
}, {
|
|
3293
3272
|
F: __dxlog_file13,
|
|
3294
|
-
L:
|
|
3273
|
+
L: 102,
|
|
3295
3274
|
S: this,
|
|
3296
3275
|
C: (f, a) => f(...a)
|
|
3297
3276
|
});
|
|
@@ -3306,7 +3285,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3306
3285
|
});
|
|
3307
3286
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3308
3287
|
F: __dxlog_file13,
|
|
3309
|
-
L:
|
|
3288
|
+
L: 122,
|
|
3310
3289
|
S: this,
|
|
3311
3290
|
A: [
|
|
3312
3291
|
"credential.credential",
|
|
@@ -3321,7 +3300,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3321
3300
|
async cancelDelegation(invitation) {
|
|
3322
3301
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3323
3302
|
F: __dxlog_file13,
|
|
3324
|
-
L:
|
|
3303
|
+
L: 128,
|
|
3325
3304
|
S: this,
|
|
3326
3305
|
A: [
|
|
3327
3306
|
"this._spaceKey",
|
|
@@ -3330,7 +3309,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3330
3309
|
});
|
|
3331
3310
|
(0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3332
3311
|
F: __dxlog_file13,
|
|
3333
|
-
L:
|
|
3312
|
+
L: 129,
|
|
3334
3313
|
S: this,
|
|
3335
3314
|
A: [
|
|
3336
3315
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3340,7 +3319,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3340
3319
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3341
3320
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3342
3321
|
F: __dxlog_file13,
|
|
3343
|
-
L:
|
|
3322
|
+
L: 131,
|
|
3344
3323
|
S: this,
|
|
3345
3324
|
A: [
|
|
3346
3325
|
"space",
|
|
@@ -3352,14 +3331,14 @@ var SpaceInvitationProtocol = class {
|
|
|
3352
3331
|
id: invitation.invitationId
|
|
3353
3332
|
}, {
|
|
3354
3333
|
F: __dxlog_file13,
|
|
3355
|
-
L:
|
|
3334
|
+
L: 133,
|
|
3356
3335
|
S: this,
|
|
3357
3336
|
C: (f, a) => f(...a)
|
|
3358
3337
|
});
|
|
3359
3338
|
const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3360
3339
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3361
3340
|
F: __dxlog_file13,
|
|
3362
|
-
L:
|
|
3341
|
+
L: 140,
|
|
3363
3342
|
S: this,
|
|
3364
3343
|
A: [
|
|
3365
3344
|
"credential.credential",
|
|
@@ -3398,7 +3377,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3398
3377
|
async accept(response) {
|
|
3399
3378
|
(0, import_invariant10.invariant)(response.space, void 0, {
|
|
3400
3379
|
F: __dxlog_file13,
|
|
3401
|
-
L:
|
|
3380
|
+
L: 175,
|
|
3402
3381
|
S: this,
|
|
3403
3382
|
A: [
|
|
3404
3383
|
"response.space",
|
|
@@ -3409,7 +3388,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3409
3388
|
const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
|
|
3410
3389
|
(0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3411
3390
|
F: __dxlog_file13,
|
|
3412
|
-
L:
|
|
3391
|
+
L: 178,
|
|
3413
3392
|
S: this,
|
|
3414
3393
|
A: [
|
|
3415
3394
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3418,7 +3397,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3418
3397
|
});
|
|
3419
3398
|
(0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3420
3399
|
F: __dxlog_file13,
|
|
3421
|
-
L:
|
|
3400
|
+
L: 179,
|
|
3422
3401
|
S: this,
|
|
3423
3402
|
A: [
|
|
3424
3403
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -4879,7 +4858,7 @@ var DataSpaceManager = class {
|
|
|
4879
4858
|
this._params = _params;
|
|
4880
4859
|
this._ctx = new import_context14.Context(void 0, {
|
|
4881
4860
|
F: __dxlog_file18,
|
|
4882
|
-
L:
|
|
4861
|
+
L: 104
|
|
4883
4862
|
});
|
|
4884
4863
|
this.updated = new import_async17.Event();
|
|
4885
4864
|
this._spaces = new import_util10.ComplexMap(import_keys12.PublicKey.hash);
|
|
@@ -4915,7 +4894,7 @@ var DataSpaceManager = class {
|
|
|
4915
4894
|
async open() {
|
|
4916
4895
|
(0, import_log15.log)("open", void 0, {
|
|
4917
4896
|
F: __dxlog_file18,
|
|
4918
|
-
L:
|
|
4897
|
+
L: 156,
|
|
4919
4898
|
S: this,
|
|
4920
4899
|
C: (f, a) => f(...a)
|
|
4921
4900
|
});
|
|
@@ -4923,7 +4902,7 @@ var DataSpaceManager = class {
|
|
|
4923
4902
|
id: this._instanceId
|
|
4924
4903
|
}), {
|
|
4925
4904
|
F: __dxlog_file18,
|
|
4926
|
-
L:
|
|
4905
|
+
L: 157,
|
|
4927
4906
|
S: this,
|
|
4928
4907
|
C: (f, a) => f(...a)
|
|
4929
4908
|
});
|
|
@@ -4931,7 +4910,7 @@ var DataSpaceManager = class {
|
|
|
4931
4910
|
spaces: this._metadataStore.spaces.length
|
|
4932
4911
|
}, {
|
|
4933
4912
|
F: __dxlog_file18,
|
|
4934
|
-
L:
|
|
4913
|
+
L: 158,
|
|
4935
4914
|
S: this,
|
|
4936
4915
|
C: (f, a) => f(...a)
|
|
4937
4916
|
});
|
|
@@ -4941,7 +4920,7 @@ var DataSpaceManager = class {
|
|
|
4941
4920
|
spaceMetadata
|
|
4942
4921
|
}, {
|
|
4943
4922
|
F: __dxlog_file18,
|
|
4944
|
-
L:
|
|
4923
|
+
L: 162,
|
|
4945
4924
|
S: this,
|
|
4946
4925
|
C: (f, a) => f(...a)
|
|
4947
4926
|
});
|
|
@@ -4952,7 +4931,7 @@ var DataSpaceManager = class {
|
|
|
4952
4931
|
err
|
|
4953
4932
|
}, {
|
|
4954
4933
|
F: __dxlog_file18,
|
|
4955
|
-
L:
|
|
4934
|
+
L: 165,
|
|
4956
4935
|
S: this,
|
|
4957
4936
|
C: (f, a) => f(...a)
|
|
4958
4937
|
});
|
|
@@ -4964,7 +4943,7 @@ var DataSpaceManager = class {
|
|
|
4964
4943
|
id: this._instanceId
|
|
4965
4944
|
}), {
|
|
4966
4945
|
F: __dxlog_file18,
|
|
4967
|
-
L:
|
|
4946
|
+
L: 172,
|
|
4968
4947
|
S: this,
|
|
4969
4948
|
C: (f, a) => f(...a)
|
|
4970
4949
|
});
|
|
@@ -4972,7 +4951,7 @@ var DataSpaceManager = class {
|
|
|
4972
4951
|
async close() {
|
|
4973
4952
|
(0, import_log15.log)("close", void 0, {
|
|
4974
4953
|
F: __dxlog_file18,
|
|
4975
|
-
L:
|
|
4954
|
+
L: 177,
|
|
4976
4955
|
S: this,
|
|
4977
4956
|
C: (f, a) => f(...a)
|
|
4978
4957
|
});
|
|
@@ -4989,7 +4968,7 @@ var DataSpaceManager = class {
|
|
|
4989
4968
|
async createSpace() {
|
|
4990
4969
|
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
4991
4970
|
F: __dxlog_file18,
|
|
4992
|
-
L:
|
|
4971
|
+
L: 191,
|
|
4993
4972
|
S: this,
|
|
4994
4973
|
A: [
|
|
4995
4974
|
"this._isOpen",
|
|
@@ -5010,7 +4989,7 @@ var DataSpaceManager = class {
|
|
|
5010
4989
|
spaceKey
|
|
5011
4990
|
}, {
|
|
5012
4991
|
F: __dxlog_file18,
|
|
5013
|
-
L:
|
|
4992
|
+
L: 203,
|
|
5014
4993
|
S: this,
|
|
5015
4994
|
C: (f, a) => f(...a)
|
|
5016
4995
|
});
|
|
@@ -5022,7 +5001,7 @@ var DataSpaceManager = class {
|
|
|
5022
5001
|
const memberCredential = credentials[1];
|
|
5023
5002
|
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5024
5003
|
F: __dxlog_file18,
|
|
5025
|
-
L:
|
|
5004
|
+
L: 213,
|
|
5026
5005
|
S: this,
|
|
5027
5006
|
A: [
|
|
5028
5007
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -5054,7 +5033,7 @@ var DataSpaceManager = class {
|
|
|
5054
5033
|
spaceId: space.id
|
|
5055
5034
|
}, {
|
|
5056
5035
|
F: __dxlog_file18,
|
|
5057
|
-
L:
|
|
5036
|
+
L: 238,
|
|
5058
5037
|
S: this,
|
|
5059
5038
|
C: (f, a) => f(...a)
|
|
5060
5039
|
});
|
|
@@ -5089,7 +5068,7 @@ var DataSpaceManager = class {
|
|
|
5089
5068
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5090
5069
|
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5091
5070
|
F: __dxlog_file18,
|
|
5092
|
-
L:
|
|
5071
|
+
L: 271,
|
|
5093
5072
|
S: this,
|
|
5094
5073
|
A: [
|
|
5095
5074
|
"automergeIndex",
|
|
@@ -5106,13 +5085,13 @@ var DataSpaceManager = class {
|
|
|
5106
5085
|
opts
|
|
5107
5086
|
}, {
|
|
5108
5087
|
F: __dxlog_file18,
|
|
5109
|
-
L:
|
|
5088
|
+
L: 280,
|
|
5110
5089
|
S: this,
|
|
5111
5090
|
C: (f, a) => f(...a)
|
|
5112
5091
|
});
|
|
5113
5092
|
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
5114
5093
|
F: __dxlog_file18,
|
|
5115
|
-
L:
|
|
5094
|
+
L: 281,
|
|
5116
5095
|
S: this,
|
|
5117
5096
|
A: [
|
|
5118
5097
|
"this._isOpen",
|
|
@@ -5121,7 +5100,7 @@ var DataSpaceManager = class {
|
|
|
5121
5100
|
});
|
|
5122
5101
|
(0, import_invariant15.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5123
5102
|
F: __dxlog_file18,
|
|
5124
|
-
L:
|
|
5103
|
+
L: 282,
|
|
5125
5104
|
S: this,
|
|
5126
5105
|
A: [
|
|
5127
5106
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -5141,6 +5120,43 @@ var DataSpaceManager = class {
|
|
|
5141
5120
|
this.updated.emit();
|
|
5142
5121
|
return space;
|
|
5143
5122
|
}
|
|
5123
|
+
async admitMember(options) {
|
|
5124
|
+
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5125
|
+
(0, import_invariant15.invariant)(space, void 0, {
|
|
5126
|
+
F: __dxlog_file18,
|
|
5127
|
+
L: 302,
|
|
5128
|
+
S: this,
|
|
5129
|
+
A: [
|
|
5130
|
+
"space",
|
|
5131
|
+
""
|
|
5132
|
+
]
|
|
5133
|
+
});
|
|
5134
|
+
if (space.spaceState.getMemberRole(options.identityKey) !== import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5135
|
+
throw new import_protocols11.AlreadyJoinedError();
|
|
5136
|
+
}
|
|
5137
|
+
const credentials = await (0, import_credentials15.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5138
|
+
(0, import_invariant15.invariant)(credentials[0].credential, void 0, {
|
|
5139
|
+
F: __dxlog_file18,
|
|
5140
|
+
L: 321,
|
|
5141
|
+
S: this,
|
|
5142
|
+
A: [
|
|
5143
|
+
"credentials[0].credential",
|
|
5144
|
+
""
|
|
5145
|
+
]
|
|
5146
|
+
});
|
|
5147
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5148
|
+
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5149
|
+
F: __dxlog_file18,
|
|
5150
|
+
L: 323,
|
|
5151
|
+
S: this,
|
|
5152
|
+
A: [
|
|
5153
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5154
|
+
""
|
|
5155
|
+
]
|
|
5156
|
+
});
|
|
5157
|
+
await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5158
|
+
return spaceMemberCredential;
|
|
5159
|
+
}
|
|
5144
5160
|
/**
|
|
5145
5161
|
* Wait until the space data pipeline is fully initialized.
|
|
5146
5162
|
* Used by invitation handler.
|
|
@@ -5152,12 +5168,24 @@ var DataSpaceManager = class {
|
|
|
5152
5168
|
return !!space && space.state === import_services14.SpaceState.READY;
|
|
5153
5169
|
}));
|
|
5154
5170
|
}
|
|
5171
|
+
async requestSpaceAdmissionCredential(spaceKey) {
|
|
5172
|
+
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
5173
|
+
spaceKey,
|
|
5174
|
+
identityKey: this._signingContext.identityKey,
|
|
5175
|
+
timeout: 15e3,
|
|
5176
|
+
swarmIdentity: {
|
|
5177
|
+
peerKey: this._signingContext.deviceKey,
|
|
5178
|
+
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5179
|
+
credentialAuthenticator: async () => true
|
|
5180
|
+
}
|
|
5181
|
+
});
|
|
5182
|
+
}
|
|
5155
5183
|
async _constructSpace(metadata) {
|
|
5156
5184
|
(0, import_log15.log)("construct space", {
|
|
5157
5185
|
metadata
|
|
5158
5186
|
}, {
|
|
5159
5187
|
F: __dxlog_file18,
|
|
5160
|
-
L:
|
|
5188
|
+
L: 358,
|
|
5161
5189
|
S: this,
|
|
5162
5190
|
C: (f, a) => f(...a)
|
|
5163
5191
|
});
|
|
@@ -5185,6 +5213,7 @@ var DataSpaceManager = class {
|
|
|
5185
5213
|
credentialAuthenticator: (0, import_util10.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
5186
5214
|
},
|
|
5187
5215
|
onAuthorizedConnection: (session) => {
|
|
5216
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline5.CredentialServerExtension(space));
|
|
5188
5217
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5189
5218
|
remotePeerId: session.remotePeerId
|
|
5190
5219
|
}));
|
|
@@ -5195,7 +5224,7 @@ var DataSpaceManager = class {
|
|
|
5195
5224
|
onAuthFailure: () => {
|
|
5196
5225
|
import_log15.log.warn("auth failure", void 0, {
|
|
5197
5226
|
F: __dxlog_file18,
|
|
5198
|
-
L:
|
|
5227
|
+
L: 396,
|
|
5199
5228
|
S: this,
|
|
5200
5229
|
C: (f, a) => f(...a)
|
|
5201
5230
|
});
|
|
@@ -5228,7 +5257,7 @@ var DataSpaceManager = class {
|
|
|
5228
5257
|
space: space.key
|
|
5229
5258
|
}, {
|
|
5230
5259
|
F: __dxlog_file18,
|
|
5231
|
-
L:
|
|
5260
|
+
L: 423,
|
|
5232
5261
|
S: this,
|
|
5233
5262
|
C: (f, a) => f(...a)
|
|
5234
5263
|
});
|
|
@@ -5239,7 +5268,7 @@ var DataSpaceManager = class {
|
|
|
5239
5268
|
open: this._isOpen
|
|
5240
5269
|
}, {
|
|
5241
5270
|
F: __dxlog_file18,
|
|
5242
|
-
L:
|
|
5271
|
+
L: 426,
|
|
5243
5272
|
S: this,
|
|
5244
5273
|
C: (f, a) => f(...a)
|
|
5245
5274
|
});
|
|
@@ -5258,7 +5287,7 @@ var DataSpaceManager = class {
|
|
|
5258
5287
|
space: space.key
|
|
5259
5288
|
}, {
|
|
5260
5289
|
F: __dxlog_file18,
|
|
5261
|
-
L:
|
|
5290
|
+
L: 434,
|
|
5262
5291
|
S: this,
|
|
5263
5292
|
C: (f, a) => f(...a)
|
|
5264
5293
|
});
|
|
@@ -5299,7 +5328,7 @@ var DataSpaceManager = class {
|
|
|
5299
5328
|
closedSessions
|
|
5300
5329
|
}, {
|
|
5301
5330
|
F: __dxlog_file18,
|
|
5302
|
-
L:
|
|
5331
|
+
L: 470,
|
|
5303
5332
|
S: this,
|
|
5304
5333
|
C: (f, a) => f(...a)
|
|
5305
5334
|
});
|
|
@@ -5314,7 +5343,7 @@ var DataSpaceManager = class {
|
|
|
5314
5343
|
peerId: peerState.peerId
|
|
5315
5344
|
}, {
|
|
5316
5345
|
F: __dxlog_file18,
|
|
5317
|
-
L:
|
|
5346
|
+
L: 484,
|
|
5318
5347
|
S: this,
|
|
5319
5348
|
C: (f, a) => f(...a)
|
|
5320
5349
|
});
|
|
@@ -5418,7 +5447,7 @@ var SpacesServiceImpl = class {
|
|
|
5418
5447
|
const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5419
5448
|
(0, import_invariant16.invariant)(credentials[0].credential, void 0, {
|
|
5420
5449
|
F: __dxlog_file19,
|
|
5421
|
-
L:
|
|
5450
|
+
L: 102,
|
|
5422
5451
|
S: this,
|
|
5423
5452
|
A: [
|
|
5424
5453
|
"credentials[0].credential",
|
|
@@ -5428,14 +5457,14 @@ var SpacesServiceImpl = class {
|
|
|
5428
5457
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5429
5458
|
(0, import_invariant16.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5430
5459
|
F: __dxlog_file19,
|
|
5431
|
-
L:
|
|
5460
|
+
L: 104,
|
|
5432
5461
|
S: this,
|
|
5433
5462
|
A: [
|
|
5434
5463
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5435
5464
|
""
|
|
5436
5465
|
]
|
|
5437
5466
|
});
|
|
5438
|
-
await (0,
|
|
5467
|
+
await (0, import_feed_store5.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5439
5468
|
}
|
|
5440
5469
|
querySpaces() {
|
|
5441
5470
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
@@ -5446,7 +5475,7 @@ var SpacesServiceImpl = class {
|
|
|
5446
5475
|
spaces
|
|
5447
5476
|
}, {
|
|
5448
5477
|
F: __dxlog_file19,
|
|
5449
|
-
L:
|
|
5478
|
+
L: 115,
|
|
5450
5479
|
S: this,
|
|
5451
5480
|
C: (f, a) => f(...a)
|
|
5452
5481
|
});
|
|
@@ -5538,7 +5567,7 @@ var SpacesServiceImpl = class {
|
|
|
5538
5567
|
} else {
|
|
5539
5568
|
(0, import_invariant16.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5540
5569
|
F: __dxlog_file19,
|
|
5541
|
-
L:
|
|
5570
|
+
L: 213,
|
|
5542
5571
|
S: this,
|
|
5543
5572
|
A: [
|
|
5544
5573
|
"!credential.id",
|
|
@@ -5547,7 +5576,7 @@ var SpacesServiceImpl = class {
|
|
|
5547
5576
|
});
|
|
5548
5577
|
(0, import_invariant16.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
5549
5578
|
F: __dxlog_file19,
|
|
5550
|
-
L:
|
|
5579
|
+
L: 214,
|
|
5551
5580
|
S: this,
|
|
5552
5581
|
A: [
|
|
5553
5582
|
"this._identityManager.identity",
|
|
@@ -5557,7 +5586,7 @@ var SpacesServiceImpl = class {
|
|
|
5557
5586
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5558
5587
|
(0, import_invariant16.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5559
5588
|
F: __dxlog_file19,
|
|
5560
|
-
L:
|
|
5589
|
+
L: 216,
|
|
5561
5590
|
S: this,
|
|
5562
5591
|
A: [
|
|
5563
5592
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5587,6 +5616,59 @@ var SpacesServiceImpl = class {
|
|
|
5587
5616
|
epochCredential: credential ?? void 0
|
|
5588
5617
|
};
|
|
5589
5618
|
}
|
|
5619
|
+
async admitContact(request) {
|
|
5620
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5621
|
+
await dataSpaceManager.admitMember({
|
|
5622
|
+
spaceKey: request.spaceKey,
|
|
5623
|
+
identityKey: request.contact.identityKey,
|
|
5624
|
+
role: request.role
|
|
5625
|
+
});
|
|
5626
|
+
}
|
|
5627
|
+
async joinBySpaceKey({ spaceKey }) {
|
|
5628
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5629
|
+
const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
|
|
5630
|
+
return this._joinByAdmission({
|
|
5631
|
+
credential
|
|
5632
|
+
});
|
|
5633
|
+
}
|
|
5634
|
+
async _joinByAdmission({ credential }) {
|
|
5635
|
+
const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
|
|
5636
|
+
(0, import_invariant16.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
5637
|
+
F: __dxlog_file19,
|
|
5638
|
+
L: 250,
|
|
5639
|
+
S: this,
|
|
5640
|
+
A: [
|
|
5641
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5642
|
+
"'Invalid credential'"
|
|
5643
|
+
]
|
|
5644
|
+
});
|
|
5645
|
+
const myIdentity = this._identityManager.identity;
|
|
5646
|
+
(0, import_invariant16.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
5647
|
+
F: __dxlog_file19,
|
|
5648
|
+
L: 252,
|
|
5649
|
+
S: this,
|
|
5650
|
+
A: [
|
|
5651
|
+
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
5652
|
+
""
|
|
5653
|
+
]
|
|
5654
|
+
});
|
|
5655
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5656
|
+
let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
|
|
5657
|
+
if (!dataSpace) {
|
|
5658
|
+
dataSpace = await dataSpaceManager.acceptSpace({
|
|
5659
|
+
spaceKey: assertion.spaceKey,
|
|
5660
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
5661
|
+
});
|
|
5662
|
+
await myIdentity.controlPipeline.writer.write({
|
|
5663
|
+
credential: {
|
|
5664
|
+
credential
|
|
5665
|
+
}
|
|
5666
|
+
});
|
|
5667
|
+
}
|
|
5668
|
+
return {
|
|
5669
|
+
space: this._serializeSpace(dataSpace)
|
|
5670
|
+
};
|
|
5671
|
+
}
|
|
5590
5672
|
_serializeSpace(space) {
|
|
5591
5673
|
return {
|
|
5592
5674
|
id: space.id,
|
|
@@ -5668,21 +5750,21 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5668
5750
|
this.initialized = new import_async19.Trigger();
|
|
5669
5751
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5670
5752
|
this._instanceId = import_keys13.PublicKey.random().toHex();
|
|
5671
|
-
this.metadataStore = new
|
|
5672
|
-
this.snapshotStore = new
|
|
5753
|
+
this.metadataStore = new import_echo_pipeline6.MetadataStore(storage.createDirectory("metadata"));
|
|
5754
|
+
this.snapshotStore = new import_echo_pipeline6.SnapshotStore(storage.createDirectory("snapshots"));
|
|
5673
5755
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
5674
5756
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
5675
|
-
this.feedStore = new
|
|
5676
|
-
factory: new
|
|
5757
|
+
this.feedStore = new import_feed_store6.FeedStore({
|
|
5758
|
+
factory: new import_feed_store6.FeedFactory({
|
|
5677
5759
|
root: storage.createDirectory("feeds"),
|
|
5678
5760
|
signer: this.keyring,
|
|
5679
5761
|
hypercore: {
|
|
5680
|
-
valueEncoding:
|
|
5762
|
+
valueEncoding: import_echo_pipeline6.valueEncoding,
|
|
5681
5763
|
stats: true
|
|
5682
5764
|
}
|
|
5683
5765
|
})
|
|
5684
5766
|
});
|
|
5685
|
-
this.spaceManager = new
|
|
5767
|
+
this.spaceManager = new import_echo_pipeline6.SpaceManager({
|
|
5686
5768
|
feedStore: this.feedStore,
|
|
5687
5769
|
networkManager: this.networkManager,
|
|
5688
5770
|
blobStore: this.blobStore,
|
|
@@ -6051,7 +6133,138 @@ var createLevel = async (config) => {
|
|
|
6051
6133
|
await level.open();
|
|
6052
6134
|
return level;
|
|
6053
6135
|
};
|
|
6054
|
-
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/
|
|
6136
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6137
|
+
var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
|
|
6138
|
+
var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
|
|
6139
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
6140
|
+
const archive = {
|
|
6141
|
+
storage: [],
|
|
6142
|
+
meta: {
|
|
6143
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6144
|
+
}
|
|
6145
|
+
};
|
|
6146
|
+
{
|
|
6147
|
+
const directory = await storage.createDirectory();
|
|
6148
|
+
const files = await directory.list();
|
|
6149
|
+
import_log19.log.info("begin exporting files", {
|
|
6150
|
+
count: files.length
|
|
6151
|
+
}, {
|
|
6152
|
+
F: __dxlog_file22,
|
|
6153
|
+
L: 30,
|
|
6154
|
+
S: void 0,
|
|
6155
|
+
C: (f, a) => f(...a)
|
|
6156
|
+
});
|
|
6157
|
+
for (const filename of files) {
|
|
6158
|
+
const file = await directory.getOrCreateFile(filename);
|
|
6159
|
+
const { size } = await file.stat();
|
|
6160
|
+
const data = await file.read(0, size);
|
|
6161
|
+
archive.storage.push({
|
|
6162
|
+
type: import_protocols15.ProfileArchiveEntryType.FILE,
|
|
6163
|
+
key: filename,
|
|
6164
|
+
value: data
|
|
6165
|
+
});
|
|
6166
|
+
}
|
|
6167
|
+
import_log19.log.info("done exporting files", {
|
|
6168
|
+
count: files.length
|
|
6169
|
+
}, {
|
|
6170
|
+
F: __dxlog_file22,
|
|
6171
|
+
L: 41,
|
|
6172
|
+
S: void 0,
|
|
6173
|
+
C: (f, a) => f(...a)
|
|
6174
|
+
});
|
|
6175
|
+
}
|
|
6176
|
+
{
|
|
6177
|
+
import_log19.log.info("begin exporting kv pairs", void 0, {
|
|
6178
|
+
F: __dxlog_file22,
|
|
6179
|
+
L: 45,
|
|
6180
|
+
S: void 0,
|
|
6181
|
+
C: (f, a) => f(...a)
|
|
6182
|
+
});
|
|
6183
|
+
const iter = await level.iterator({
|
|
6184
|
+
keyEncoding: "binary",
|
|
6185
|
+
valueEncoding: "binary"
|
|
6186
|
+
});
|
|
6187
|
+
let count = 0;
|
|
6188
|
+
for await (const [key, value] of iter) {
|
|
6189
|
+
archive.storage.push({
|
|
6190
|
+
type: import_protocols15.ProfileArchiveEntryType.KEY_VALUE,
|
|
6191
|
+
key,
|
|
6192
|
+
value
|
|
6193
|
+
});
|
|
6194
|
+
count++;
|
|
6195
|
+
}
|
|
6196
|
+
import_log19.log.info("done exporting kv pairs", {
|
|
6197
|
+
count
|
|
6198
|
+
}, {
|
|
6199
|
+
F: __dxlog_file22,
|
|
6200
|
+
L: 56,
|
|
6201
|
+
S: void 0,
|
|
6202
|
+
C: (f, a) => f(...a)
|
|
6203
|
+
});
|
|
6204
|
+
}
|
|
6205
|
+
return archive;
|
|
6206
|
+
};
|
|
6207
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
6208
|
+
const batch = level.batch();
|
|
6209
|
+
for (const entry2 of archive.storage) {
|
|
6210
|
+
switch (entry2.type) {
|
|
6211
|
+
case import_protocols15.ProfileArchiveEntryType.FILE: {
|
|
6212
|
+
const directory = await storage.createDirectory();
|
|
6213
|
+
(0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
6214
|
+
F: __dxlog_file22,
|
|
6215
|
+
L: 78,
|
|
6216
|
+
S: void 0,
|
|
6217
|
+
A: [
|
|
6218
|
+
"typeof entry.key === 'string'",
|
|
6219
|
+
"'Invalid key type'"
|
|
6220
|
+
]
|
|
6221
|
+
});
|
|
6222
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
6223
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6224
|
+
F: __dxlog_file22,
|
|
6225
|
+
L: 80,
|
|
6226
|
+
S: void 0,
|
|
6227
|
+
A: [
|
|
6228
|
+
"entry.value instanceof Uint8Array",
|
|
6229
|
+
"'Invalid value type'"
|
|
6230
|
+
]
|
|
6231
|
+
});
|
|
6232
|
+
await file.write(0, (0, import_util13.arrayToBuffer)(entry2.value));
|
|
6233
|
+
await file.close();
|
|
6234
|
+
break;
|
|
6235
|
+
}
|
|
6236
|
+
case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
|
|
6237
|
+
(0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6238
|
+
F: __dxlog_file22,
|
|
6239
|
+
L: 86,
|
|
6240
|
+
S: void 0,
|
|
6241
|
+
A: [
|
|
6242
|
+
"entry.key instanceof Uint8Array",
|
|
6243
|
+
"'Invalid key type'"
|
|
6244
|
+
]
|
|
6245
|
+
});
|
|
6246
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6247
|
+
F: __dxlog_file22,
|
|
6248
|
+
L: 87,
|
|
6249
|
+
S: void 0,
|
|
6250
|
+
A: [
|
|
6251
|
+
"entry.value instanceof Uint8Array",
|
|
6252
|
+
"'Invalid value type'"
|
|
6253
|
+
]
|
|
6254
|
+
});
|
|
6255
|
+
batch.put(entry2.key, entry2.value, {
|
|
6256
|
+
keyEncoding: "binary",
|
|
6257
|
+
valueEncoding: "binary"
|
|
6258
|
+
});
|
|
6259
|
+
break;
|
|
6260
|
+
}
|
|
6261
|
+
default:
|
|
6262
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6263
|
+
}
|
|
6264
|
+
}
|
|
6265
|
+
await batch.write();
|
|
6266
|
+
};
|
|
6267
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
6055
6268
|
var DevicesServiceImpl = class {
|
|
6056
6269
|
constructor(_identityManager) {
|
|
6057
6270
|
this._identityManager = _identityManager;
|
|
@@ -6068,8 +6281,8 @@ var DevicesServiceImpl = class {
|
|
|
6068
6281
|
devices: []
|
|
6069
6282
|
});
|
|
6070
6283
|
} else {
|
|
6071
|
-
(0,
|
|
6072
|
-
F:
|
|
6284
|
+
(0, import_invariant21.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
6285
|
+
F: __dxlog_file23,
|
|
6073
6286
|
L: 32,
|
|
6074
6287
|
S: this,
|
|
6075
6288
|
A: [
|
|
@@ -6150,7 +6363,7 @@ var DiagnosticsCollector = class {
|
|
|
6150
6363
|
client: clientDiagnostics,
|
|
6151
6364
|
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
6152
6365
|
};
|
|
6153
|
-
return JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6366
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util14.jsonKeyReplacer)(options)));
|
|
6154
6367
|
}
|
|
6155
6368
|
};
|
|
6156
6369
|
var findSystemServiceProvider = () => {
|
|
@@ -6160,35 +6373,112 @@ var findSystemServiceProvider = () => {
|
|
|
6160
6373
|
};
|
|
6161
6374
|
var findConfigs = () => {
|
|
6162
6375
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
6163
|
-
return configs.map((r) => r.instance.deref()).filter(
|
|
6376
|
+
return configs.map((r) => r.instance.deref()).filter(import_util14.nonNullable);
|
|
6377
|
+
};
|
|
6378
|
+
var ContactsServiceImpl = class {
|
|
6379
|
+
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
6380
|
+
this._identityManager = _identityManager;
|
|
6381
|
+
this._spaceManager = _spaceManager;
|
|
6382
|
+
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
6383
|
+
}
|
|
6384
|
+
async getContacts() {
|
|
6385
|
+
const identity = this._identityManager.identity;
|
|
6386
|
+
if (identity == null) {
|
|
6387
|
+
return {
|
|
6388
|
+
contacts: []
|
|
6389
|
+
};
|
|
6390
|
+
}
|
|
6391
|
+
const contacts = [
|
|
6392
|
+
...this._spaceManager.spaces.values()
|
|
6393
|
+
].flatMap((s) => [
|
|
6394
|
+
...s.spaceState.members.values()
|
|
6395
|
+
].map((m) => [
|
|
6396
|
+
s.key,
|
|
6397
|
+
m
|
|
6398
|
+
])).reduce((acc, v) => {
|
|
6399
|
+
const [spaceKey, memberInfo] = v;
|
|
6400
|
+
if (memberInfo.key.equals(identity.identityKey)) {
|
|
6401
|
+
return acc;
|
|
6402
|
+
}
|
|
6403
|
+
const existing = acc.get(memberInfo.key);
|
|
6404
|
+
if (existing != null) {
|
|
6405
|
+
existing.profile ??= memberInfo.profile;
|
|
6406
|
+
existing.commonSpaces?.push(spaceKey);
|
|
6407
|
+
} else {
|
|
6408
|
+
acc.set(memberInfo.key, {
|
|
6409
|
+
identityKey: memberInfo.key,
|
|
6410
|
+
profile: memberInfo.profile,
|
|
6411
|
+
commonSpaces: [
|
|
6412
|
+
spaceKey
|
|
6413
|
+
]
|
|
6414
|
+
});
|
|
6415
|
+
}
|
|
6416
|
+
return acc;
|
|
6417
|
+
}, new import_util16.ComplexMap(import_keys17.PublicKey.hash));
|
|
6418
|
+
return {
|
|
6419
|
+
contacts: [
|
|
6420
|
+
...contacts.values()
|
|
6421
|
+
]
|
|
6422
|
+
};
|
|
6423
|
+
}
|
|
6424
|
+
queryContacts() {
|
|
6425
|
+
const subscribedSpaceKeySet = new import_util16.ComplexSet(import_keys17.PublicKey.hash);
|
|
6426
|
+
return new import_codec_protobuf13.Stream(({ next, ctx }) => {
|
|
6427
|
+
const pushUpdateTask = new import_async22.UpdateScheduler(ctx, async () => {
|
|
6428
|
+
const contacts = await this.getContacts();
|
|
6429
|
+
next(contacts);
|
|
6430
|
+
}, {
|
|
6431
|
+
maxFrequency: 2
|
|
6432
|
+
});
|
|
6433
|
+
(0, import_async22.scheduleTask)(ctx, async () => {
|
|
6434
|
+
const subscriptions = new import_async22.EventSubscriptions();
|
|
6435
|
+
ctx.onDispose(() => subscriptions.clear());
|
|
6436
|
+
const subscribeToSpaceAndUpdate = () => {
|
|
6437
|
+
const oldSetSize = subscribedSpaceKeySet.size;
|
|
6438
|
+
for (const space of this._spaceManager.spaces.values()) {
|
|
6439
|
+
if (!subscribedSpaceKeySet.has(space.key)) {
|
|
6440
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
|
|
6441
|
+
subscribedSpaceKeySet.add(space.key);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
if (oldSetSize !== subscribedSpaceKeySet.size) {
|
|
6445
|
+
pushUpdateTask.trigger();
|
|
6446
|
+
}
|
|
6447
|
+
};
|
|
6448
|
+
const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
|
|
6449
|
+
ctx.onDispose(unsubscribe);
|
|
6450
|
+
subscribeToSpaceAndUpdate();
|
|
6451
|
+
});
|
|
6452
|
+
});
|
|
6453
|
+
}
|
|
6164
6454
|
};
|
|
6165
6455
|
var LoggingServiceImpl = class {
|
|
6166
6456
|
constructor() {
|
|
6167
|
-
this._logs = new
|
|
6457
|
+
this._logs = new import_async23.Event();
|
|
6168
6458
|
this._started = Date.now();
|
|
6169
|
-
this._sessionId =
|
|
6459
|
+
this._sessionId = import_keys18.PublicKey.random().toHex();
|
|
6170
6460
|
this._logProcessor = (_config, entry2) => {
|
|
6171
6461
|
this._logs.emit(entry2);
|
|
6172
6462
|
};
|
|
6173
6463
|
}
|
|
6174
6464
|
async open() {
|
|
6175
|
-
|
|
6465
|
+
import_log21.log.runtimeConfig.processors.push(this._logProcessor);
|
|
6176
6466
|
}
|
|
6177
6467
|
async close() {
|
|
6178
|
-
const index =
|
|
6179
|
-
|
|
6468
|
+
const index = import_log21.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6469
|
+
import_log21.log.runtimeConfig.processors.splice(index, 1);
|
|
6180
6470
|
}
|
|
6181
6471
|
async controlMetrics({ reset, record }) {
|
|
6182
6472
|
if (reset) {
|
|
6183
|
-
|
|
6473
|
+
import_util17.tracer.clear();
|
|
6184
6474
|
}
|
|
6185
6475
|
if (record === true) {
|
|
6186
|
-
|
|
6476
|
+
import_util17.tracer.start();
|
|
6187
6477
|
} else if (record === false) {
|
|
6188
|
-
|
|
6478
|
+
import_util17.tracer.stop();
|
|
6189
6479
|
}
|
|
6190
6480
|
return {
|
|
6191
|
-
recording:
|
|
6481
|
+
recording: import_util17.tracer.recording
|
|
6192
6482
|
};
|
|
6193
6483
|
}
|
|
6194
6484
|
/**
|
|
@@ -6196,13 +6486,13 @@ var LoggingServiceImpl = class {
|
|
|
6196
6486
|
*/
|
|
6197
6487
|
queryMetrics({ interval = 5e3 }) {
|
|
6198
6488
|
const getNumericalValues = (key) => {
|
|
6199
|
-
const events =
|
|
6489
|
+
const events = import_util17.tracer.get(key) ?? [];
|
|
6200
6490
|
return {
|
|
6201
6491
|
key,
|
|
6202
|
-
stats: (0,
|
|
6492
|
+
stats: (0, import_util17.numericalValues)(events, "duration")
|
|
6203
6493
|
};
|
|
6204
6494
|
};
|
|
6205
|
-
return new
|
|
6495
|
+
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
6206
6496
|
const update = () => {
|
|
6207
6497
|
const metrics = {
|
|
6208
6498
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6224,7 +6514,7 @@ var LoggingServiceImpl = class {
|
|
|
6224
6514
|
});
|
|
6225
6515
|
}
|
|
6226
6516
|
queryLogs(request) {
|
|
6227
|
-
return new
|
|
6517
|
+
return new import_codec_protobuf14.Stream(({ ctx, next }) => {
|
|
6228
6518
|
const handler = (entry2) => {
|
|
6229
6519
|
if (LOG_PROCESSING > 0) {
|
|
6230
6520
|
return;
|
|
@@ -6237,7 +6527,7 @@ var LoggingServiceImpl = class {
|
|
|
6237
6527
|
}
|
|
6238
6528
|
const record = {
|
|
6239
6529
|
...entry2,
|
|
6240
|
-
context: (0,
|
|
6530
|
+
context: (0, import_util17.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
|
|
6241
6531
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6242
6532
|
meta: {
|
|
6243
6533
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -6246,7 +6536,7 @@ var LoggingServiceImpl = class {
|
|
|
6246
6536
|
scope: {
|
|
6247
6537
|
hostSessionId: this._sessionId,
|
|
6248
6538
|
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
6249
|
-
name: (0,
|
|
6539
|
+
name: (0, import_util17.getDebugName)(entry2.meta?.S)
|
|
6250
6540
|
}
|
|
6251
6541
|
}
|
|
6252
6542
|
};
|
|
@@ -6284,7 +6574,7 @@ var NetworkServiceImpl = class {
|
|
|
6284
6574
|
this.signalManager = signalManager;
|
|
6285
6575
|
}
|
|
6286
6576
|
queryStatus() {
|
|
6287
|
-
return new
|
|
6577
|
+
return new import_codec_protobuf15.Stream(({ next }) => {
|
|
6288
6578
|
const update = () => {
|
|
6289
6579
|
next({
|
|
6290
6580
|
swarm: this.networkManager.connectionState,
|
|
@@ -6327,7 +6617,7 @@ var SystemServiceImpl = class {
|
|
|
6327
6617
|
const diagnostics = await this._getDiagnostics();
|
|
6328
6618
|
return {
|
|
6329
6619
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6330
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6620
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util18.jsonKeyReplacer)({
|
|
6331
6621
|
truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
6332
6622
|
humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
6333
6623
|
})))
|
|
@@ -6341,7 +6631,7 @@ var SystemServiceImpl = class {
|
|
|
6341
6631
|
}
|
|
6342
6632
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6343
6633
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6344
|
-
return new
|
|
6634
|
+
return new import_codec_protobuf16.Stream(({ next }) => {
|
|
6345
6635
|
const update = () => {
|
|
6346
6636
|
next({
|
|
6347
6637
|
status: this._getCurrentStatus()
|
|
@@ -6370,7 +6660,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6370
6660
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6371
6661
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6372
6662
|
}
|
|
6373
|
-
var
|
|
6663
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6374
6664
|
var ClientServicesHost = class {
|
|
6375
6665
|
constructor({
|
|
6376
6666
|
config,
|
|
@@ -6404,8 +6694,8 @@ var ClientServicesHost = class {
|
|
|
6404
6694
|
onAcquire: () => {
|
|
6405
6695
|
if (!this._opening) {
|
|
6406
6696
|
void this.open(new import_context16.Context(void 0, {
|
|
6407
|
-
F:
|
|
6408
|
-
L:
|
|
6697
|
+
F: __dxlog_file24,
|
|
6698
|
+
L: 121
|
|
6409
6699
|
}));
|
|
6410
6700
|
}
|
|
6411
6701
|
},
|
|
@@ -6461,25 +6751,25 @@ var ClientServicesHost = class {
|
|
|
6461
6751
|
* Can only be called once.
|
|
6462
6752
|
*/
|
|
6463
6753
|
initialize({ config, ...options }) {
|
|
6464
|
-
(0,
|
|
6465
|
-
F:
|
|
6466
|
-
L:
|
|
6754
|
+
(0, import_invariant20.invariant)(!this._open, "service host is open", {
|
|
6755
|
+
F: __dxlog_file24,
|
|
6756
|
+
L: 187,
|
|
6467
6757
|
S: this,
|
|
6468
6758
|
A: [
|
|
6469
6759
|
"!this._open",
|
|
6470
6760
|
"'service host is open'"
|
|
6471
6761
|
]
|
|
6472
6762
|
});
|
|
6473
|
-
(0,
|
|
6474
|
-
F:
|
|
6475
|
-
L:
|
|
6763
|
+
(0, import_log20.log)("initializing...", void 0, {
|
|
6764
|
+
F: __dxlog_file24,
|
|
6765
|
+
L: 188,
|
|
6476
6766
|
S: this,
|
|
6477
6767
|
C: (f, a) => f(...a)
|
|
6478
6768
|
});
|
|
6479
6769
|
if (config) {
|
|
6480
|
-
(0,
|
|
6481
|
-
F:
|
|
6482
|
-
L:
|
|
6770
|
+
(0, import_invariant20.invariant)(!this._config, "config already set", {
|
|
6771
|
+
F: __dxlog_file24,
|
|
6772
|
+
L: 191,
|
|
6483
6773
|
S: this,
|
|
6484
6774
|
A: [
|
|
6485
6775
|
"!this._config",
|
|
@@ -6492,9 +6782,9 @@ var ClientServicesHost = class {
|
|
|
6492
6782
|
}
|
|
6493
6783
|
}
|
|
6494
6784
|
if (!options.signalManager) {
|
|
6495
|
-
|
|
6496
|
-
F:
|
|
6497
|
-
L:
|
|
6785
|
+
import_log20.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
6786
|
+
F: __dxlog_file24,
|
|
6787
|
+
L: 199,
|
|
6498
6788
|
S: this,
|
|
6499
6789
|
C: (f, a) => f(...a)
|
|
6500
6790
|
});
|
|
@@ -6503,9 +6793,9 @@ var ClientServicesHost = class {
|
|
|
6503
6793
|
iceServers: this._config?.get("runtime.services.ice")
|
|
6504
6794
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6505
6795
|
this._signalManager = signalManager;
|
|
6506
|
-
(0,
|
|
6507
|
-
F:
|
|
6508
|
-
L:
|
|
6796
|
+
(0, import_invariant20.invariant)(!this._networkManager, "network manager already set", {
|
|
6797
|
+
F: __dxlog_file24,
|
|
6798
|
+
L: 210,
|
|
6509
6799
|
S: this,
|
|
6510
6800
|
A: [
|
|
6511
6801
|
"!this._networkManager",
|
|
@@ -6517,9 +6807,9 @@ var ClientServicesHost = class {
|
|
|
6517
6807
|
transportFactory,
|
|
6518
6808
|
signalManager
|
|
6519
6809
|
});
|
|
6520
|
-
(0,
|
|
6521
|
-
F:
|
|
6522
|
-
L:
|
|
6810
|
+
(0, import_log20.log)("initialized", void 0, {
|
|
6811
|
+
F: __dxlog_file24,
|
|
6812
|
+
L: 217,
|
|
6523
6813
|
S: this,
|
|
6524
6814
|
C: (f, a) => f(...a)
|
|
6525
6815
|
});
|
|
@@ -6529,44 +6819,44 @@ var ClientServicesHost = class {
|
|
|
6529
6819
|
return;
|
|
6530
6820
|
}
|
|
6531
6821
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6532
|
-
|
|
6822
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.begin({
|
|
6533
6823
|
id: traceId
|
|
6534
6824
|
}), {
|
|
6535
|
-
F:
|
|
6536
|
-
L:
|
|
6825
|
+
F: __dxlog_file24,
|
|
6826
|
+
L: 228,
|
|
6537
6827
|
S: this,
|
|
6538
6828
|
C: (f, a) => f(...a)
|
|
6539
6829
|
});
|
|
6540
|
-
(0,
|
|
6541
|
-
F:
|
|
6542
|
-
L:
|
|
6830
|
+
(0, import_invariant20.invariant)(this._config, "config not set", {
|
|
6831
|
+
F: __dxlog_file24,
|
|
6832
|
+
L: 230,
|
|
6543
6833
|
S: this,
|
|
6544
6834
|
A: [
|
|
6545
6835
|
"this._config",
|
|
6546
6836
|
"'config not set'"
|
|
6547
6837
|
]
|
|
6548
6838
|
});
|
|
6549
|
-
(0,
|
|
6550
|
-
F:
|
|
6551
|
-
L:
|
|
6839
|
+
(0, import_invariant20.invariant)(this._storage, "storage not set", {
|
|
6840
|
+
F: __dxlog_file24,
|
|
6841
|
+
L: 231,
|
|
6552
6842
|
S: this,
|
|
6553
6843
|
A: [
|
|
6554
6844
|
"this._storage",
|
|
6555
6845
|
"'storage not set'"
|
|
6556
6846
|
]
|
|
6557
6847
|
});
|
|
6558
|
-
(0,
|
|
6559
|
-
F:
|
|
6560
|
-
L:
|
|
6848
|
+
(0, import_invariant20.invariant)(this._signalManager, "signal manager not set", {
|
|
6849
|
+
F: __dxlog_file24,
|
|
6850
|
+
L: 232,
|
|
6561
6851
|
S: this,
|
|
6562
6852
|
A: [
|
|
6563
6853
|
"this._signalManager",
|
|
6564
6854
|
"'signal manager not set'"
|
|
6565
6855
|
]
|
|
6566
6856
|
});
|
|
6567
|
-
(0,
|
|
6568
|
-
F:
|
|
6569
|
-
L:
|
|
6857
|
+
(0, import_invariant20.invariant)(this._networkManager, "network manager not set", {
|
|
6858
|
+
F: __dxlog_file24,
|
|
6859
|
+
L: 233,
|
|
6570
6860
|
S: this,
|
|
6571
6861
|
A: [
|
|
6572
6862
|
"this._networkManager",
|
|
@@ -6574,11 +6864,11 @@ var ClientServicesHost = class {
|
|
|
6574
6864
|
]
|
|
6575
6865
|
});
|
|
6576
6866
|
this._opening = true;
|
|
6577
|
-
(0,
|
|
6867
|
+
(0, import_log20.log)("opening...", {
|
|
6578
6868
|
lockKey: this._resourceLock?.lockKey
|
|
6579
6869
|
}, {
|
|
6580
|
-
F:
|
|
6581
|
-
L:
|
|
6870
|
+
F: __dxlog_file24,
|
|
6871
|
+
L: 236,
|
|
6582
6872
|
S: this,
|
|
6583
6873
|
C: (f, a) => f(...a)
|
|
6584
6874
|
});
|
|
@@ -6589,16 +6879,18 @@ var ClientServicesHost = class {
|
|
|
6589
6879
|
await this._level.open();
|
|
6590
6880
|
await this._loggingService.open();
|
|
6591
6881
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
6882
|
+
const dataSpaceManagerProvider = async () => {
|
|
6883
|
+
await this._serviceContext.initialized.wait();
|
|
6884
|
+
return this._serviceContext.dataSpaceManager;
|
|
6885
|
+
};
|
|
6592
6886
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6593
6887
|
this._serviceRegistry.setServices({
|
|
6594
6888
|
SystemService: this._systemService,
|
|
6595
6889
|
IdentityService: identityService,
|
|
6890
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6596
6891
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6597
6892
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6598
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6599
|
-
await this._serviceContext.initialized.wait();
|
|
6600
|
-
return this._serviceContext.dataSpaceManager;
|
|
6601
|
-
}),
|
|
6893
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6602
6894
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6603
6895
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6604
6896
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6628,19 +6920,19 @@ var ClientServicesHost = class {
|
|
|
6628
6920
|
this._open = true;
|
|
6629
6921
|
this._statusUpdate.emit();
|
|
6630
6922
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6631
|
-
(0,
|
|
6923
|
+
(0, import_log20.log)("opened", {
|
|
6632
6924
|
deviceKey
|
|
6633
6925
|
}, {
|
|
6634
|
-
F:
|
|
6635
|
-
L:
|
|
6926
|
+
F: __dxlog_file24,
|
|
6927
|
+
L: 322,
|
|
6636
6928
|
S: this,
|
|
6637
6929
|
C: (f, a) => f(...a)
|
|
6638
6930
|
});
|
|
6639
|
-
|
|
6931
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.end({
|
|
6640
6932
|
id: traceId
|
|
6641
6933
|
}), {
|
|
6642
|
-
F:
|
|
6643
|
-
L:
|
|
6934
|
+
F: __dxlog_file24,
|
|
6935
|
+
L: 323,
|
|
6644
6936
|
S: this,
|
|
6645
6937
|
C: (f, a) => f(...a)
|
|
6646
6938
|
});
|
|
@@ -6650,11 +6942,11 @@ var ClientServicesHost = class {
|
|
|
6650
6942
|
return;
|
|
6651
6943
|
}
|
|
6652
6944
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6653
|
-
(0,
|
|
6945
|
+
(0, import_log20.log)("closing...", {
|
|
6654
6946
|
deviceKey
|
|
6655
6947
|
}, {
|
|
6656
|
-
F:
|
|
6657
|
-
L:
|
|
6948
|
+
F: __dxlog_file24,
|
|
6949
|
+
L: 334,
|
|
6658
6950
|
S: this,
|
|
6659
6951
|
C: (f, a) => f(...a)
|
|
6660
6952
|
});
|
|
@@ -6668,44 +6960,44 @@ var ClientServicesHost = class {
|
|
|
6668
6960
|
await this._level?.close();
|
|
6669
6961
|
this._open = false;
|
|
6670
6962
|
this._statusUpdate.emit();
|
|
6671
|
-
(0,
|
|
6963
|
+
(0, import_log20.log)("closed", {
|
|
6672
6964
|
deviceKey
|
|
6673
6965
|
}, {
|
|
6674
|
-
F:
|
|
6675
|
-
L:
|
|
6966
|
+
F: __dxlog_file24,
|
|
6967
|
+
L: 343,
|
|
6676
6968
|
S: this,
|
|
6677
6969
|
C: (f, a) => f(...a)
|
|
6678
6970
|
});
|
|
6679
6971
|
}
|
|
6680
6972
|
async reset() {
|
|
6681
6973
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6682
|
-
|
|
6974
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.begin({
|
|
6683
6975
|
id: traceId
|
|
6684
6976
|
}), {
|
|
6685
|
-
F:
|
|
6686
|
-
L:
|
|
6977
|
+
F: __dxlog_file24,
|
|
6978
|
+
L: 348,
|
|
6687
6979
|
S: this,
|
|
6688
6980
|
C: (f, a) => f(...a)
|
|
6689
6981
|
});
|
|
6690
|
-
|
|
6691
|
-
F:
|
|
6692
|
-
L:
|
|
6982
|
+
import_log20.log.info("resetting...", void 0, {
|
|
6983
|
+
F: __dxlog_file24,
|
|
6984
|
+
L: 350,
|
|
6693
6985
|
S: this,
|
|
6694
6986
|
C: (f, a) => f(...a)
|
|
6695
6987
|
});
|
|
6696
6988
|
await this._serviceContext?.close();
|
|
6697
6989
|
await this._storage.reset();
|
|
6698
|
-
|
|
6699
|
-
F:
|
|
6700
|
-
L:
|
|
6990
|
+
import_log20.log.info("reset", void 0, {
|
|
6991
|
+
F: __dxlog_file24,
|
|
6992
|
+
L: 353,
|
|
6701
6993
|
S: this,
|
|
6702
6994
|
C: (f, a) => f(...a)
|
|
6703
6995
|
});
|
|
6704
|
-
|
|
6996
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.end({
|
|
6705
6997
|
id: traceId
|
|
6706
6998
|
}), {
|
|
6707
|
-
F:
|
|
6708
|
-
L:
|
|
6999
|
+
F: __dxlog_file24,
|
|
7000
|
+
L: 354,
|
|
6709
7001
|
S: this,
|
|
6710
7002
|
C: (f, a) => f(...a)
|
|
6711
7003
|
});
|
|
@@ -6764,7 +7056,11 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6764
7056
|
createDiagnostics,
|
|
6765
7057
|
createLevel,
|
|
6766
7058
|
createStorageObjects,
|
|
7059
|
+
decodeProfileArchive,
|
|
7060
|
+
encodeProfileArchive,
|
|
7061
|
+
exportProfileData,
|
|
6767
7062
|
getNetworkPeers,
|
|
7063
|
+
importProfileData,
|
|
6768
7064
|
isLocked,
|
|
6769
7065
|
subscribeToFeedBlocks,
|
|
6770
7066
|
subscribeToFeeds,
|
|
@@ -6774,4 +7070,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6774
7070
|
subscribeToSpaces,
|
|
6775
7071
|
subscribeToSwarmInfo
|
|
6776
7072
|
});
|
|
6777
|
-
//# sourceMappingURL=chunk-
|
|
7073
|
+
//# sourceMappingURL=chunk-JRDM7NQS.cjs.map
|