@dxos/client-services 0.5.9-next.a50ff17 → 0.6.0
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-LCPF6KL6.mjs → chunk-IC4DRPNT.mjs} +953 -527
- package/dist/lib/browser/chunk-IC4DRPNT.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -2
- 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 +10 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-L7MVHCXK.cjs → chunk-NPCEVOJK.cjs} +988 -562
- package/dist/lib/node/chunk-NPCEVOJK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +53 -42
- 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 +17 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +1 -1
- 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/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- 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/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts +2 -2
- package/dist/types/src/packlets/spaces/epoch-migrations.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/dist/types/src/version.d.ts.map +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/contacts-service.ts +85 -0
- package/src/packlets/identity/identity-service.ts +28 -22
- package/src/packlets/invitations/invitations-handler.ts +13 -5
- 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/data-space.ts +8 -6
- package/src/packlets/spaces/epoch-migrations.ts +57 -38
- package/src/packlets/spaces/spaces-service.ts +52 -2
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/profile-archive.ts +111 -0
- package/src/version.ts +5 -1
- package/dist/lib/browser/chunk-LCPF6KL6.mjs.map +0 -7
- package/dist/lib/node/chunk-L7MVHCXK.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_NPCEVOJK_exports = {};
|
|
30
|
+
__export(chunk_NPCEVOJK_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -56,7 +56,11 @@ __export(chunk_L7MVHCXK_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_L7MVHCXK_exports, {
|
|
|
66
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
67
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
68
72
|
});
|
|
69
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_NPCEVOJK_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");
|
|
@@ -212,32 +216,30 @@ var import_util7 = require("@dxos/util");
|
|
|
212
216
|
var import_async14 = require("@dxos/async");
|
|
213
217
|
var import_context11 = require("@dxos/context");
|
|
214
218
|
var import_credentials14 = require("@dxos/credentials");
|
|
215
|
-
var import_async15 = require("@dxos/async");
|
|
216
|
-
var import_automerge = require("@dxos/automerge/automerge");
|
|
217
|
-
var import_context12 = require("@dxos/context");
|
|
218
219
|
var import_echo_db = require("@dxos/echo-db");
|
|
219
|
-
var
|
|
220
|
+
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
220
221
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
221
222
|
var import_invariant13 = require("@dxos/invariant");
|
|
222
223
|
var import_log13 = require("@dxos/log");
|
|
223
224
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
224
|
-
var
|
|
225
|
-
var
|
|
226
|
-
var import_context13 = require("@dxos/context");
|
|
225
|
+
var import_async15 = require("@dxos/async");
|
|
226
|
+
var import_context12 = require("@dxos/context");
|
|
227
227
|
var import_invariant14 = require("@dxos/invariant");
|
|
228
228
|
var import_keys11 = require("@dxos/keys");
|
|
229
229
|
var import_log14 = require("@dxos/log");
|
|
230
230
|
var import_protocols10 = require("@dxos/protocols");
|
|
231
231
|
var import_teleport3 = require("@dxos/teleport");
|
|
232
|
-
var
|
|
233
|
-
var
|
|
232
|
+
var import_util8 = require("@dxos/util");
|
|
233
|
+
var import_async16 = require("@dxos/async");
|
|
234
234
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
235
|
-
var
|
|
235
|
+
var import_context13 = require("@dxos/context");
|
|
236
236
|
var import_credentials15 = require("@dxos/credentials");
|
|
237
237
|
var import_echo_db2 = require("@dxos/echo-db");
|
|
238
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
238
239
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
239
|
-
var
|
|
240
|
+
var import_echo_protocol3 = require("@dxos/echo-protocol");
|
|
240
241
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
242
|
+
var import_feed_store4 = require("@dxos/feed-store");
|
|
241
243
|
var import_invariant15 = require("@dxos/invariant");
|
|
242
244
|
var import_keys12 = require("@dxos/keys");
|
|
243
245
|
var import_log15 = require("@dxos/log");
|
|
@@ -246,28 +248,28 @@ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
246
248
|
var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
247
249
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
248
250
|
var import_tracing6 = require("@dxos/tracing");
|
|
249
|
-
var
|
|
251
|
+
var import_util9 = require("@dxos/util");
|
|
250
252
|
var import_credentials17 = require("@dxos/credentials");
|
|
251
253
|
var import_debug4 = require("@dxos/debug");
|
|
252
254
|
var import_credentials18 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
253
255
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
254
|
-
var
|
|
256
|
+
var import_async17 = require("@dxos/async");
|
|
255
257
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
256
258
|
var import_credentials19 = require("@dxos/credentials");
|
|
257
259
|
var import_debug5 = require("@dxos/debug");
|
|
258
|
-
var
|
|
260
|
+
var import_feed_store5 = require("@dxos/feed-store");
|
|
259
261
|
var import_invariant16 = require("@dxos/invariant");
|
|
260
262
|
var import_log16 = require("@dxos/log");
|
|
261
263
|
var import_protocols12 = require("@dxos/protocols");
|
|
262
264
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
263
265
|
var import_tracing7 = require("@dxos/tracing");
|
|
264
|
-
var
|
|
265
|
-
var
|
|
266
|
+
var import_async18 = require("@dxos/async");
|
|
267
|
+
var import_context14 = require("@dxos/context");
|
|
266
268
|
var import_credentials20 = require("@dxos/credentials");
|
|
267
269
|
var import_debug6 = require("@dxos/debug");
|
|
268
270
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
269
271
|
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
270
|
-
var
|
|
272
|
+
var import_feed_store6 = require("@dxos/feed-store");
|
|
271
273
|
var import_invariant17 = require("@dxos/invariant");
|
|
272
274
|
var import_keyring = require("@dxos/keyring");
|
|
273
275
|
var import_keys13 = require("@dxos/keys");
|
|
@@ -276,7 +278,7 @@ var import_protocols13 = require("@dxos/protocols");
|
|
|
276
278
|
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
277
279
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
278
280
|
var import_tracing8 = require("@dxos/tracing");
|
|
279
|
-
var
|
|
281
|
+
var import_util10 = require("@dxos/util");
|
|
280
282
|
var import_invariant18 = require("@dxos/invariant");
|
|
281
283
|
var import_lock_file = require("@dxos/lock-file");
|
|
282
284
|
var import_log18 = require("@dxos/log");
|
|
@@ -285,25 +287,30 @@ var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
|
285
287
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
286
288
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
287
289
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
288
|
-
var
|
|
290
|
+
var import_util11 = require("@dxos/util");
|
|
289
291
|
var import_node_path = __toESM(require("node:path"));
|
|
290
292
|
var import_keys14 = require("@dxos/keys");
|
|
291
293
|
var import_kv_store = require("@dxos/kv-store");
|
|
292
|
-
var
|
|
293
|
-
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
294
|
-
var import_context16 = require("@dxos/context");
|
|
294
|
+
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
295
295
|
var import_invariant19 = require("@dxos/invariant");
|
|
296
|
-
var import_keys15 = require("@dxos/keys");
|
|
297
296
|
var import_log19 = require("@dxos/log");
|
|
297
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
298
|
+
var import_util12 = require("@dxos/util");
|
|
299
|
+
var import_async19 = require("@dxos/async");
|
|
300
|
+
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
301
|
+
var import_context15 = require("@dxos/context");
|
|
302
|
+
var import_invariant20 = require("@dxos/invariant");
|
|
303
|
+
var import_keys15 = require("@dxos/keys");
|
|
304
|
+
var import_log20 = require("@dxos/log");
|
|
298
305
|
var import_messaging = require("@dxos/messaging");
|
|
299
306
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
300
|
-
var
|
|
307
|
+
var import_protocols16 = require("@dxos/protocols");
|
|
301
308
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
302
309
|
var import_tracing9 = require("@dxos/tracing");
|
|
303
310
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
304
|
-
var
|
|
311
|
+
var import_async20 = require("@dxos/async");
|
|
305
312
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
306
|
-
var
|
|
313
|
+
var import_invariant21 = require("@dxos/invariant");
|
|
307
314
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
308
315
|
var import_config3 = require("@dxos/config");
|
|
309
316
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -311,16 +318,20 @@ var import_tracing10 = require("@dxos/tracing");
|
|
|
311
318
|
var import_util13 = require("@dxos/util");
|
|
312
319
|
var import_keys16 = require("@dxos/keys");
|
|
313
320
|
var import_util14 = require("@dxos/util");
|
|
314
|
-
var
|
|
321
|
+
var import_async21 = require("@dxos/async");
|
|
315
322
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
316
323
|
var import_keys17 = require("@dxos/keys");
|
|
317
|
-
var import_log20 = require("@dxos/log");
|
|
318
|
-
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
319
324
|
var import_util15 = require("@dxos/util");
|
|
325
|
+
var import_async22 = require("@dxos/async");
|
|
320
326
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
327
|
+
var import_keys18 = require("@dxos/keys");
|
|
328
|
+
var import_log21 = require("@dxos/log");
|
|
329
|
+
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
330
|
+
var import_util16 = require("@dxos/util");
|
|
321
331
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
332
|
+
var import_codec_protobuf16 = require("@dxos/codec-protobuf");
|
|
322
333
|
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
323
|
-
var
|
|
334
|
+
var import_util17 = require("@dxos/util");
|
|
324
335
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
325
336
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
326
337
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -388,6 +399,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
388
399
|
};
|
|
389
400
|
});
|
|
390
401
|
};
|
|
402
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
391
403
|
var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
|
|
392
404
|
const update = () => {
|
|
393
405
|
try {
|
|
@@ -403,7 +415,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
|
|
|
403
415
|
update();
|
|
404
416
|
});
|
|
405
417
|
var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
|
|
406
|
-
const ctx = new import_context.Context(
|
|
418
|
+
const ctx = new import_context.Context(void 0, {
|
|
419
|
+
F: __dxlog_file,
|
|
420
|
+
L: 36
|
|
421
|
+
});
|
|
407
422
|
signalManager.onMessage.on(ctx, (message) => {
|
|
408
423
|
next({
|
|
409
424
|
message: {
|
|
@@ -631,7 +646,7 @@ var DevtoolsServiceImpl = class {
|
|
|
631
646
|
});
|
|
632
647
|
}
|
|
633
648
|
};
|
|
634
|
-
var DXOS_VERSION = "0.
|
|
649
|
+
var DXOS_VERSION = "0.6.0";
|
|
635
650
|
var getPlatform = () => {
|
|
636
651
|
if (process.browser) {
|
|
637
652
|
if (typeof window !== "undefined") {
|
|
@@ -659,7 +674,7 @@ var getPlatform = () => {
|
|
|
659
674
|
};
|
|
660
675
|
}
|
|
661
676
|
};
|
|
662
|
-
var
|
|
677
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
663
678
|
var DEFAULT_TIMEOUT = 1e3;
|
|
664
679
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
665
680
|
const diagnostics = {
|
|
@@ -676,7 +691,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
676
691
|
await Promise.all([
|
|
677
692
|
(async () => {
|
|
678
693
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
679
|
-
F:
|
|
694
|
+
F: __dxlog_file2,
|
|
680
695
|
L: 110,
|
|
681
696
|
S: void 0,
|
|
682
697
|
A: [
|
|
@@ -865,7 +880,7 @@ _ts_decorate([
|
|
|
865
880
|
ClientRpcServer = _ts_decorate([
|
|
866
881
|
import_tracing2.trace.resource()
|
|
867
882
|
], ClientRpcServer);
|
|
868
|
-
var
|
|
883
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
869
884
|
var Credential = import_protocols2.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
870
885
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
871
886
|
const credential = await signer.createCredential({
|
|
@@ -880,7 +895,10 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
880
895
|
var TrustedKeySetAuthVerifier = class {
|
|
881
896
|
constructor(_params) {
|
|
882
897
|
this._params = _params;
|
|
883
|
-
this._ctx = new import_context2.Context(
|
|
898
|
+
this._ctx = new import_context2.Context(void 0, {
|
|
899
|
+
F: __dxlog_file3,
|
|
900
|
+
L: 45
|
|
901
|
+
});
|
|
884
902
|
}
|
|
885
903
|
async close() {
|
|
886
904
|
await this._ctx.dispose();
|
|
@@ -891,7 +909,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
891
909
|
(0, import_log.log)("authenticating...", {
|
|
892
910
|
credential
|
|
893
911
|
}, {
|
|
894
|
-
F:
|
|
912
|
+
F: __dxlog_file3,
|
|
895
913
|
L: 56,
|
|
896
914
|
S: this,
|
|
897
915
|
C: (f, a) => f(...a)
|
|
@@ -901,7 +919,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
901
919
|
(0, import_log.log)("Invalid credential", {
|
|
902
920
|
result
|
|
903
921
|
}, {
|
|
904
|
-
F:
|
|
922
|
+
F: __dxlog_file3,
|
|
905
923
|
L: 60,
|
|
906
924
|
S: this,
|
|
907
925
|
C: (f, a) => f(...a)
|
|
@@ -913,7 +931,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
913
931
|
nonce,
|
|
914
932
|
credential
|
|
915
933
|
}, {
|
|
916
|
-
F:
|
|
934
|
+
F: __dxlog_file3,
|
|
917
935
|
L: 65,
|
|
918
936
|
S: this,
|
|
919
937
|
C: (f, a) => f(...a)
|
|
@@ -924,7 +942,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
924
942
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
925
943
|
key: credential.issuer
|
|
926
944
|
}, {
|
|
927
|
-
F:
|
|
945
|
+
F: __dxlog_file3,
|
|
928
946
|
L: 70,
|
|
929
947
|
S: this,
|
|
930
948
|
C: (f, a) => f(...a)
|
|
@@ -940,7 +958,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
940
958
|
(0, import_log.log)("auth success", {
|
|
941
959
|
key: credential.issuer
|
|
942
960
|
}, {
|
|
943
|
-
F:
|
|
961
|
+
F: __dxlog_file3,
|
|
944
962
|
L: 81,
|
|
945
963
|
S: this,
|
|
946
964
|
C: (f, a) => f(...a)
|
|
@@ -950,7 +968,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
950
968
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
951
969
|
key: credential.issuer
|
|
952
970
|
}, {
|
|
953
|
-
F:
|
|
971
|
+
F: __dxlog_file3,
|
|
954
972
|
L: 84,
|
|
955
973
|
S: this,
|
|
956
974
|
C: (f, a) => f(...a)
|
|
@@ -973,7 +991,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
973
991
|
return deviceSet.has(deviceKey);
|
|
974
992
|
}
|
|
975
993
|
};
|
|
976
|
-
var
|
|
994
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
977
995
|
var DefaultSpaceStateMachine = class {
|
|
978
996
|
constructor(_params) {
|
|
979
997
|
this._params = _params;
|
|
@@ -990,7 +1008,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
990
1008
|
expectedIdentity: this._params.identityKey,
|
|
991
1009
|
credential
|
|
992
1010
|
}, {
|
|
993
|
-
F:
|
|
1011
|
+
F: __dxlog_file4,
|
|
994
1012
|
L: 32,
|
|
995
1013
|
S: this,
|
|
996
1014
|
C: (f, a) => f(...a)
|
|
@@ -1001,7 +1019,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
1001
1019
|
import_log3.log.warn("Invalid default space id", {
|
|
1002
1020
|
id: assertion.spaceId
|
|
1003
1021
|
}, {
|
|
1004
|
-
F:
|
|
1022
|
+
F: __dxlog_file4,
|
|
1005
1023
|
L: 36,
|
|
1006
1024
|
S: this,
|
|
1007
1025
|
C: (f, a) => f(...a)
|
|
@@ -1024,7 +1042,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1024
1042
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1025
1043
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1026
1044
|
}
|
|
1027
|
-
var
|
|
1045
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
1028
1046
|
var Identity = class {
|
|
1029
1047
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
1030
1048
|
this.stateUpdate = new import_async6.Event();
|
|
@@ -1036,7 +1054,7 @@ var Identity = class {
|
|
|
1036
1054
|
import_log2.log.trace("dxos.halo.device", {
|
|
1037
1055
|
deviceKey
|
|
1038
1056
|
}, {
|
|
1039
|
-
F:
|
|
1057
|
+
F: __dxlog_file5,
|
|
1040
1058
|
L: 70,
|
|
1041
1059
|
S: this,
|
|
1042
1060
|
C: (f, a) => f(...a)
|
|
@@ -1115,7 +1133,7 @@ var Identity = class {
|
|
|
1115
1133
|
*/
|
|
1116
1134
|
getIdentityCredentialSigner() {
|
|
1117
1135
|
(0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
1118
|
-
F:
|
|
1136
|
+
F: __dxlog_file5,
|
|
1119
1137
|
L: 159,
|
|
1120
1138
|
S: this,
|
|
1121
1139
|
A: [
|
|
@@ -1159,7 +1177,7 @@ var Identity = class {
|
|
|
1159
1177
|
controlFeedKey,
|
|
1160
1178
|
dataFeedKey
|
|
1161
1179
|
}, {
|
|
1162
|
-
F:
|
|
1180
|
+
F: __dxlog_file5,
|
|
1163
1181
|
L: 184,
|
|
1164
1182
|
S: this,
|
|
1165
1183
|
C: (f, a) => f(...a)
|
|
@@ -1220,7 +1238,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1220
1238
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1221
1239
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1222
1240
|
}
|
|
1223
|
-
var
|
|
1241
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1224
1242
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1225
1243
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1226
1244
|
var IdentityManager = class {
|
|
@@ -1244,7 +1262,7 @@ var IdentityManager = class {
|
|
|
1244
1262
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
|
|
1245
1263
|
id: traceId
|
|
1246
1264
|
}), {
|
|
1247
|
-
F:
|
|
1265
|
+
F: __dxlog_file6,
|
|
1248
1266
|
L: 104,
|
|
1249
1267
|
S: this,
|
|
1250
1268
|
C: (f, a) => f(...a)
|
|
@@ -1253,7 +1271,7 @@ var IdentityManager = class {
|
|
|
1253
1271
|
(0, import_log4.log)("identity record", {
|
|
1254
1272
|
identityRecord
|
|
1255
1273
|
}, {
|
|
1256
|
-
F:
|
|
1274
|
+
F: __dxlog_file6,
|
|
1257
1275
|
L: 107,
|
|
1258
1276
|
S: this,
|
|
1259
1277
|
C: (f, a) => f(...a)
|
|
@@ -1266,7 +1284,7 @@ var IdentityManager = class {
|
|
|
1266
1284
|
identityKey: identityRecord.identityKey,
|
|
1267
1285
|
displayName: this._identity.profileDocument?.displayName
|
|
1268
1286
|
}, {
|
|
1269
|
-
F:
|
|
1287
|
+
F: __dxlog_file6,
|
|
1270
1288
|
L: 112,
|
|
1271
1289
|
S: this,
|
|
1272
1290
|
C: (f, a) => f(...a)
|
|
@@ -1276,18 +1294,21 @@ var IdentityManager = class {
|
|
|
1276
1294
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
|
|
1277
1295
|
id: traceId
|
|
1278
1296
|
}), {
|
|
1279
|
-
F:
|
|
1297
|
+
F: __dxlog_file6,
|
|
1280
1298
|
L: 119,
|
|
1281
1299
|
S: this,
|
|
1282
1300
|
C: (f, a) => f(...a)
|
|
1283
1301
|
});
|
|
1284
1302
|
}
|
|
1285
1303
|
async close() {
|
|
1286
|
-
await this._identity?.close(new import_context3.Context(
|
|
1304
|
+
await this._identity?.close(new import_context3.Context(void 0, {
|
|
1305
|
+
F: __dxlog_file6,
|
|
1306
|
+
L: 123
|
|
1307
|
+
}));
|
|
1287
1308
|
}
|
|
1288
1309
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1289
1310
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1290
|
-
F:
|
|
1311
|
+
F: __dxlog_file6,
|
|
1291
1312
|
L: 128,
|
|
1292
1313
|
S: this,
|
|
1293
1314
|
A: [
|
|
@@ -1296,7 +1317,7 @@ var IdentityManager = class {
|
|
|
1296
1317
|
]
|
|
1297
1318
|
});
|
|
1298
1319
|
(0, import_log4.log)("creating identity...", void 0, {
|
|
1299
|
-
F:
|
|
1320
|
+
F: __dxlog_file6,
|
|
1300
1321
|
L: 129,
|
|
1301
1322
|
S: this,
|
|
1302
1323
|
C: (f, a) => f(...a)
|
|
@@ -1313,11 +1334,14 @@ var IdentityManager = class {
|
|
|
1313
1334
|
}
|
|
1314
1335
|
};
|
|
1315
1336
|
const identity = await this._constructIdentity(identityRecord);
|
|
1316
|
-
await identity.open(new import_context3.Context(
|
|
1337
|
+
await identity.open(new import_context3.Context(void 0, {
|
|
1338
|
+
F: __dxlog_file6,
|
|
1339
|
+
L: 144
|
|
1340
|
+
}));
|
|
1317
1341
|
{
|
|
1318
1342
|
const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1319
1343
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1320
|
-
F:
|
|
1344
|
+
F: __dxlog_file6,
|
|
1321
1345
|
L: 148,
|
|
1322
1346
|
S: this,
|
|
1323
1347
|
A: [
|
|
@@ -1326,7 +1350,7 @@ var IdentityManager = class {
|
|
|
1326
1350
|
]
|
|
1327
1351
|
});
|
|
1328
1352
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1329
|
-
F:
|
|
1353
|
+
F: __dxlog_file6,
|
|
1330
1354
|
L: 149,
|
|
1331
1355
|
S: this,
|
|
1332
1356
|
A: [
|
|
@@ -1365,7 +1389,7 @@ var IdentityManager = class {
|
|
|
1365
1389
|
identityKey: identityRecord.identityKey,
|
|
1366
1390
|
displayName: this._identity.profileDocument?.displayName
|
|
1367
1391
|
}, {
|
|
1368
|
-
F:
|
|
1392
|
+
F: __dxlog_file6,
|
|
1369
1393
|
L: 191,
|
|
1370
1394
|
S: this,
|
|
1371
1395
|
C: (f, a) => f(...a)
|
|
@@ -1376,7 +1400,7 @@ var IdentityManager = class {
|
|
|
1376
1400
|
deviceKey: identity.deviceKey,
|
|
1377
1401
|
profile: identity.profileDocument
|
|
1378
1402
|
}, {
|
|
1379
|
-
F:
|
|
1403
|
+
F: __dxlog_file6,
|
|
1380
1404
|
L: 197,
|
|
1381
1405
|
S: this,
|
|
1382
1406
|
C: (f, a) => f(...a)
|
|
@@ -1413,13 +1437,13 @@ var IdentityManager = class {
|
|
|
1413
1437
|
(0, import_log4.log)("accepting identity", {
|
|
1414
1438
|
params
|
|
1415
1439
|
}, {
|
|
1416
|
-
F:
|
|
1440
|
+
F: __dxlog_file6,
|
|
1417
1441
|
L: 235,
|
|
1418
1442
|
S: this,
|
|
1419
1443
|
C: (f, a) => f(...a)
|
|
1420
1444
|
});
|
|
1421
1445
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1422
|
-
F:
|
|
1446
|
+
F: __dxlog_file6,
|
|
1423
1447
|
L: 236,
|
|
1424
1448
|
S: this,
|
|
1425
1449
|
A: [
|
|
@@ -1439,7 +1463,10 @@ var IdentityManager = class {
|
|
|
1439
1463
|
}
|
|
1440
1464
|
};
|
|
1441
1465
|
const identity = await this._constructIdentity(identityRecord);
|
|
1442
|
-
await identity.open(new import_context3.Context(
|
|
1466
|
+
await identity.open(new import_context3.Context(void 0, {
|
|
1467
|
+
F: __dxlog_file6,
|
|
1468
|
+
L: 251
|
|
1469
|
+
}));
|
|
1443
1470
|
this._identity = identity;
|
|
1444
1471
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1445
1472
|
await this._identity.ready();
|
|
@@ -1447,7 +1474,7 @@ var IdentityManager = class {
|
|
|
1447
1474
|
identityKey: identityRecord.identityKey,
|
|
1448
1475
|
displayName: this._identity.profileDocument?.displayName
|
|
1449
1476
|
}, {
|
|
1450
|
-
F:
|
|
1477
|
+
F: __dxlog_file6,
|
|
1451
1478
|
L: 255,
|
|
1452
1479
|
S: this,
|
|
1453
1480
|
C: (f, a) => f(...a)
|
|
@@ -1461,7 +1488,7 @@ var IdentityManager = class {
|
|
|
1461
1488
|
identityKey: identity.identityKey,
|
|
1462
1489
|
deviceKey: identity.deviceKey
|
|
1463
1490
|
}, {
|
|
1464
|
-
F:
|
|
1491
|
+
F: __dxlog_file6,
|
|
1465
1492
|
L: 265,
|
|
1466
1493
|
S: this,
|
|
1467
1494
|
C: (f, a) => f(...a)
|
|
@@ -1473,7 +1500,7 @@ var IdentityManager = class {
|
|
|
1473
1500
|
*/
|
|
1474
1501
|
async updateProfile(profile) {
|
|
1475
1502
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1476
|
-
F:
|
|
1503
|
+
F: __dxlog_file6,
|
|
1477
1504
|
L: 273,
|
|
1478
1505
|
S: this,
|
|
1479
1506
|
A: [
|
|
@@ -1504,7 +1531,7 @@ var IdentityManager = class {
|
|
|
1504
1531
|
}
|
|
1505
1532
|
async updateDeviceProfile(profile) {
|
|
1506
1533
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1507
|
-
F:
|
|
1534
|
+
F: __dxlog_file6,
|
|
1508
1535
|
L: 290,
|
|
1509
1536
|
S: this,
|
|
1510
1537
|
A: [
|
|
@@ -1540,7 +1567,7 @@ var IdentityManager = class {
|
|
|
1540
1567
|
}
|
|
1541
1568
|
async _constructIdentity(identityRecord) {
|
|
1542
1569
|
(0, import_invariant3.invariant)(!this._identity, void 0, {
|
|
1543
|
-
F:
|
|
1570
|
+
F: __dxlog_file6,
|
|
1544
1571
|
L: 316,
|
|
1545
1572
|
S: this,
|
|
1546
1573
|
A: [
|
|
@@ -1551,7 +1578,7 @@ var IdentityManager = class {
|
|
|
1551
1578
|
(0, import_log4.log)("constructing identity", {
|
|
1552
1579
|
identityRecord
|
|
1553
1580
|
}, {
|
|
1554
|
-
F:
|
|
1581
|
+
F: __dxlog_file6,
|
|
1555
1582
|
L: 317,
|
|
1556
1583
|
S: this,
|
|
1557
1584
|
C: (f, a) => f(...a)
|
|
@@ -1566,7 +1593,7 @@ var IdentityManager = class {
|
|
|
1566
1593
|
gossip
|
|
1567
1594
|
});
|
|
1568
1595
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1569
|
-
F:
|
|
1596
|
+
F: __dxlog_file6,
|
|
1570
1597
|
L: 330,
|
|
1571
1598
|
S: this,
|
|
1572
1599
|
A: [
|
|
@@ -1578,7 +1605,7 @@ var IdentityManager = class {
|
|
|
1578
1605
|
writable: true
|
|
1579
1606
|
});
|
|
1580
1607
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1581
|
-
F:
|
|
1608
|
+
F: __dxlog_file6,
|
|
1582
1609
|
L: 334,
|
|
1583
1610
|
S: this,
|
|
1584
1611
|
A: [
|
|
@@ -1612,7 +1639,7 @@ var IdentityManager = class {
|
|
|
1612
1639
|
(0, import_log4.log)("done", {
|
|
1613
1640
|
identityKey: identityRecord.identityKey
|
|
1614
1641
|
}, {
|
|
1615
|
-
F:
|
|
1642
|
+
F: __dxlog_file6,
|
|
1616
1643
|
L: 360,
|
|
1617
1644
|
S: this,
|
|
1618
1645
|
C: (f, a) => f(...a)
|
|
@@ -1637,7 +1664,7 @@ var IdentityManager = class {
|
|
|
1637
1664
|
},
|
|
1638
1665
|
onAuthFailure: () => {
|
|
1639
1666
|
import_log4.log.warn("auth failure", void 0, {
|
|
1640
|
-
F:
|
|
1667
|
+
F: __dxlog_file6,
|
|
1641
1668
|
L: 385,
|
|
1642
1669
|
S: this,
|
|
1643
1670
|
C: (f, a) => f(...a)
|
|
@@ -1659,7 +1686,7 @@ _ts_decorate3([
|
|
|
1659
1686
|
IdentityManager = _ts_decorate3([
|
|
1660
1687
|
import_tracing4.trace.resource()
|
|
1661
1688
|
], IdentityManager);
|
|
1662
|
-
var
|
|
1689
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1663
1690
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1664
1691
|
var IdentityServiceImpl = class extends import_context4.Resource {
|
|
1665
1692
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
@@ -1689,7 +1716,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1689
1716
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1690
1717
|
const identity = this._identityManager.identity;
|
|
1691
1718
|
(0, import_invariant4.invariant)(identity, void 0, {
|
|
1692
|
-
F:
|
|
1719
|
+
F: __dxlog_file7,
|
|
1693
1720
|
L: 59,
|
|
1694
1721
|
S: this,
|
|
1695
1722
|
A: [
|
|
@@ -1723,7 +1750,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1723
1750
|
}
|
|
1724
1751
|
async updateProfile(profile) {
|
|
1725
1752
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1726
|
-
F:
|
|
1753
|
+
F: __dxlog_file7,
|
|
1727
1754
|
L: 89,
|
|
1728
1755
|
S: this,
|
|
1729
1756
|
A: [
|
|
@@ -1737,7 +1764,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1737
1764
|
}
|
|
1738
1765
|
async signPresentation({ presentation, nonce }) {
|
|
1739
1766
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1740
|
-
F:
|
|
1767
|
+
F: __dxlog_file7,
|
|
1741
1768
|
L: 96,
|
|
1742
1769
|
S: this,
|
|
1743
1770
|
A: [
|
|
@@ -1772,8 +1799,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1772
1799
|
import_log5.log.warn("Multiple default spaces found. Using the first one.", {
|
|
1773
1800
|
duplicate: space.id
|
|
1774
1801
|
}, {
|
|
1775
|
-
F:
|
|
1776
|
-
L:
|
|
1802
|
+
F: __dxlog_file7,
|
|
1803
|
+
L: 129,
|
|
1777
1804
|
S: this,
|
|
1778
1805
|
C: (f, a) => f(...a)
|
|
1779
1806
|
});
|
|
@@ -1784,6 +1811,13 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1784
1811
|
recodedDefaultSpace = true;
|
|
1785
1812
|
recordedDefaultSpaceTrigger.wake();
|
|
1786
1813
|
}
|
|
1814
|
+
}, (err) => {
|
|
1815
|
+
import_log5.log.catch(err, void 0, {
|
|
1816
|
+
F: __dxlog_file7,
|
|
1817
|
+
L: 140,
|
|
1818
|
+
S: this,
|
|
1819
|
+
C: (f, a) => f(...a)
|
|
1820
|
+
});
|
|
1787
1821
|
});
|
|
1788
1822
|
await Promise.race([
|
|
1789
1823
|
allProcessed,
|
|
@@ -1795,7 +1829,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1795
1829
|
}
|
|
1796
1830
|
}
|
|
1797
1831
|
};
|
|
1798
|
-
var
|
|
1832
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1799
1833
|
var DeviceInvitationProtocol = class {
|
|
1800
1834
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1801
1835
|
this._keyring = _keyring;
|
|
@@ -1821,7 +1855,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1821
1855
|
}
|
|
1822
1856
|
async admit(_, request) {
|
|
1823
1857
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1824
|
-
F:
|
|
1858
|
+
F: __dxlog_file8,
|
|
1825
1859
|
L: 50,
|
|
1826
1860
|
S: this,
|
|
1827
1861
|
A: [
|
|
@@ -1867,7 +1901,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1867
1901
|
}
|
|
1868
1902
|
async accept(response, request) {
|
|
1869
1903
|
(0, import_invariant5.invariant)(response.device, void 0, {
|
|
1870
|
-
F:
|
|
1904
|
+
F: __dxlog_file8,
|
|
1871
1905
|
L: 95,
|
|
1872
1906
|
S: this,
|
|
1873
1907
|
A: [
|
|
@@ -1877,7 +1911,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1877
1911
|
});
|
|
1878
1912
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1879
1913
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1880
|
-
F:
|
|
1914
|
+
F: __dxlog_file8,
|
|
1881
1915
|
L: 98,
|
|
1882
1916
|
S: this,
|
|
1883
1917
|
A: [
|
|
@@ -1916,7 +1950,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1916
1950
|
return guard;
|
|
1917
1951
|
})());
|
|
1918
1952
|
};
|
|
1919
|
-
var
|
|
1953
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1920
1954
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1921
1955
|
var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
1922
1956
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1930,7 +1964,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1930
1964
|
});
|
|
1931
1965
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1932
1966
|
this._callbacks = _callbacks;
|
|
1933
|
-
this._ctx = new import_context6.Context(
|
|
1967
|
+
this._ctx = new import_context6.Context(void 0, {
|
|
1968
|
+
F: __dxlog_file9,
|
|
1969
|
+
L: 33
|
|
1970
|
+
});
|
|
1934
1971
|
this._remoteOptionsTrigger = new import_async10.Trigger();
|
|
1935
1972
|
this._invitationFlowLock = null;
|
|
1936
1973
|
}
|
|
@@ -1942,7 +1979,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1942
1979
|
InvitationHostService: {
|
|
1943
1980
|
options: async (options) => {
|
|
1944
1981
|
(0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1945
|
-
F:
|
|
1982
|
+
F: __dxlog_file9,
|
|
1946
1983
|
L: 63,
|
|
1947
1984
|
S: this,
|
|
1948
1985
|
A: [
|
|
@@ -1969,14 +2006,14 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1969
2006
|
await super.onOpen(context);
|
|
1970
2007
|
try {
|
|
1971
2008
|
(0, import_log7.log)("guest acquire lock", void 0, {
|
|
1972
|
-
F:
|
|
2009
|
+
F: __dxlog_file9,
|
|
1973
2010
|
L: 84,
|
|
1974
2011
|
S: this,
|
|
1975
2012
|
C: (f, a) => f(...a)
|
|
1976
2013
|
});
|
|
1977
2014
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1978
2015
|
(0, import_log7.log)("guest lock acquired", void 0, {
|
|
1979
|
-
F:
|
|
2016
|
+
F: __dxlog_file9,
|
|
1980
2017
|
L: 86,
|
|
1981
2018
|
S: this,
|
|
1982
2019
|
C: (f, a) => f(...a)
|
|
@@ -1985,7 +2022,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1985
2022
|
role: import_invitations3.Options.Role.GUEST
|
|
1986
2023
|
}));
|
|
1987
2024
|
(0, import_log7.log)("options sent", void 0, {
|
|
1988
|
-
F:
|
|
2025
|
+
F: __dxlog_file9,
|
|
1989
2026
|
L: 88,
|
|
1990
2027
|
S: this,
|
|
1991
2028
|
C: (f, a) => f(...a)
|
|
@@ -1994,7 +2031,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1994
2031
|
timeout: OPTIONS_TIMEOUT
|
|
1995
2032
|
}));
|
|
1996
2033
|
(0, import_log7.log)("options received", void 0, {
|
|
1997
|
-
F:
|
|
2034
|
+
F: __dxlog_file9,
|
|
1998
2035
|
L: 90,
|
|
1999
2036
|
S: this,
|
|
2000
2037
|
C: (f, a) => f(...a)
|
|
@@ -2028,7 +2065,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2028
2065
|
this._invitationFlowLock.release();
|
|
2029
2066
|
this._invitationFlowLock = null;
|
|
2030
2067
|
(0, import_log7.log)("invitation flow lock released", void 0, {
|
|
2031
|
-
F:
|
|
2068
|
+
F: __dxlog_file9,
|
|
2032
2069
|
L: 123,
|
|
2033
2070
|
S: this,
|
|
2034
2071
|
C: (f, a) => f(...a)
|
|
@@ -2036,7 +2073,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2036
2073
|
}
|
|
2037
2074
|
}
|
|
2038
2075
|
};
|
|
2039
|
-
var
|
|
2076
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
2040
2077
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
2041
2078
|
var MAX_OTP_ATTEMPTS = 3;
|
|
2042
2079
|
var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
@@ -2051,7 +2088,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2051
2088
|
});
|
|
2052
2089
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
2053
2090
|
this._callbacks = _callbacks;
|
|
2054
|
-
this._ctx = new import_context8.Context(
|
|
2091
|
+
this._ctx = new import_context8.Context(void 0, {
|
|
2092
|
+
F: __dxlog_file10,
|
|
2093
|
+
L: 52
|
|
2094
|
+
});
|
|
2055
2095
|
this._remoteOptionsTrigger = new import_async11.Trigger();
|
|
2056
2096
|
this._challenge = void 0;
|
|
2057
2097
|
this.guestProfile = void 0;
|
|
@@ -2070,7 +2110,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2070
2110
|
InvitationHostService: {
|
|
2071
2111
|
options: async (options) => {
|
|
2072
2112
|
(0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
2073
|
-
F:
|
|
2113
|
+
F: __dxlog_file10,
|
|
2074
2114
|
L: 101,
|
|
2075
2115
|
S: this,
|
|
2076
2116
|
A: [
|
|
@@ -2087,7 +2127,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2087
2127
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
|
|
2088
2128
|
id: traceId
|
|
2089
2129
|
}), {
|
|
2090
|
-
F:
|
|
2130
|
+
F: __dxlog_file10,
|
|
2091
2131
|
L: 110,
|
|
2092
2132
|
S: this,
|
|
2093
2133
|
C: (f, a) => f(...a)
|
|
@@ -2099,7 +2139,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2099
2139
|
expected: invitation.invitationId,
|
|
2100
2140
|
actual: invitationId
|
|
2101
2141
|
}, {
|
|
2102
|
-
F:
|
|
2142
|
+
F: __dxlog_file10,
|
|
2103
2143
|
L: 116,
|
|
2104
2144
|
S: this,
|
|
2105
2145
|
C: (f, a) => f(...a)
|
|
@@ -2113,7 +2153,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2113
2153
|
(0, import_log8.log)("guest introduced themselves", {
|
|
2114
2154
|
guestProfile: profile
|
|
2115
2155
|
}, {
|
|
2116
|
-
F:
|
|
2156
|
+
F: __dxlog_file10,
|
|
2117
2157
|
L: 125,
|
|
2118
2158
|
S: this,
|
|
2119
2159
|
C: (f, a) => f(...a)
|
|
@@ -2124,7 +2164,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2124
2164
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
|
|
2125
2165
|
id: traceId
|
|
2126
2166
|
}), {
|
|
2127
|
-
F:
|
|
2167
|
+
F: __dxlog_file10,
|
|
2128
2168
|
L: 132,
|
|
2129
2169
|
S: this,
|
|
2130
2170
|
C: (f, a) => f(...a)
|
|
@@ -2139,7 +2179,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2139
2179
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
|
|
2140
2180
|
id: traceId
|
|
2141
2181
|
}), {
|
|
2142
|
-
F:
|
|
2182
|
+
F: __dxlog_file10,
|
|
2143
2183
|
L: 141,
|
|
2144
2184
|
S: this,
|
|
2145
2185
|
C: (f, a) => f(...a)
|
|
@@ -2148,7 +2188,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2148
2188
|
(0, import_log8.log)("received authentication request", {
|
|
2149
2189
|
authCode: code
|
|
2150
2190
|
}, {
|
|
2151
|
-
F:
|
|
2191
|
+
F: __dxlog_file10,
|
|
2152
2192
|
L: 144,
|
|
2153
2193
|
S: this,
|
|
2154
2194
|
C: (f, a) => f(...a)
|
|
@@ -2162,7 +2202,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2162
2202
|
switch (invitation.authMethod) {
|
|
2163
2203
|
case import_services8.Invitation.AuthMethod.NONE: {
|
|
2164
2204
|
(0, import_log8.log)("authentication not required", void 0, {
|
|
2165
|
-
F:
|
|
2205
|
+
F: __dxlog_file10,
|
|
2166
2206
|
L: 152,
|
|
2167
2207
|
S: this,
|
|
2168
2208
|
C: (f, a) => f(...a)
|
|
@@ -2200,7 +2240,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2200
2240
|
import_log8.log.error("invalid authentication method", {
|
|
2201
2241
|
authMethod: invitation.authMethod
|
|
2202
2242
|
}, {
|
|
2203
|
-
F:
|
|
2243
|
+
F: __dxlog_file10,
|
|
2204
2244
|
L: 190,
|
|
2205
2245
|
S: this,
|
|
2206
2246
|
C: (f, a) => f(...a)
|
|
@@ -2225,7 +2265,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2225
2265
|
status
|
|
2226
2266
|
}
|
|
2227
2267
|
}), {
|
|
2228
|
-
F:
|
|
2268
|
+
F: __dxlog_file10,
|
|
2229
2269
|
L: 202,
|
|
2230
2270
|
S: this,
|
|
2231
2271
|
C: (f, a) => f(...a)
|
|
@@ -2239,7 +2279,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2239
2279
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
|
|
2240
2280
|
id: traceId
|
|
2241
2281
|
}), {
|
|
2242
|
-
F:
|
|
2282
|
+
F: __dxlog_file10,
|
|
2243
2283
|
L: 208,
|
|
2244
2284
|
S: this,
|
|
2245
2285
|
C: (f, a) => f(...a)
|
|
@@ -2256,7 +2296,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2256
2296
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
|
|
2257
2297
|
id: traceId
|
|
2258
2298
|
}), {
|
|
2259
|
-
F:
|
|
2299
|
+
F: __dxlog_file10,
|
|
2260
2300
|
L: 222,
|
|
2261
2301
|
S: this,
|
|
2262
2302
|
C: (f, a) => f(...a)
|
|
@@ -2274,14 +2314,14 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2274
2314
|
await super.onOpen(context);
|
|
2275
2315
|
try {
|
|
2276
2316
|
(0, import_log8.log)("host acquire lock", void 0, {
|
|
2277
|
-
F:
|
|
2317
|
+
F: __dxlog_file10,
|
|
2278
2318
|
L: 237,
|
|
2279
2319
|
S: this,
|
|
2280
2320
|
C: (f, a) => f(...a)
|
|
2281
2321
|
});
|
|
2282
2322
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2283
2323
|
(0, import_log8.log)("host lock acquired", void 0, {
|
|
2284
|
-
F:
|
|
2324
|
+
F: __dxlog_file10,
|
|
2285
2325
|
L: 239,
|
|
2286
2326
|
S: this,
|
|
2287
2327
|
C: (f, a) => f(...a)
|
|
@@ -2292,7 +2332,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2292
2332
|
role: import_invitations4.Options.Role.HOST
|
|
2293
2333
|
});
|
|
2294
2334
|
(0, import_log8.log)("options sent", void 0, {
|
|
2295
|
-
F:
|
|
2335
|
+
F: __dxlog_file10,
|
|
2296
2336
|
L: 243,
|
|
2297
2337
|
S: this,
|
|
2298
2338
|
C: (f, a) => f(...a)
|
|
@@ -2301,7 +2341,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2301
2341
|
timeout: OPTIONS_TIMEOUT2
|
|
2302
2342
|
}));
|
|
2303
2343
|
(0, import_log8.log)("options received", void 0, {
|
|
2304
|
-
F:
|
|
2344
|
+
F: __dxlog_file10,
|
|
2305
2345
|
L: 245,
|
|
2306
2346
|
S: this,
|
|
2307
2347
|
C: (f, a) => f(...a)
|
|
@@ -2355,7 +2395,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2355
2395
|
this._invitationFlowLock?.release();
|
|
2356
2396
|
this._invitationFlowLock = null;
|
|
2357
2397
|
(0, import_log8.log)("invitation flow lock released", void 0, {
|
|
2358
|
-
F:
|
|
2398
|
+
F: __dxlog_file10,
|
|
2359
2399
|
L: 300,
|
|
2360
2400
|
S: this,
|
|
2361
2401
|
C: (f, a) => f(...a)
|
|
@@ -2364,7 +2404,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2364
2404
|
}
|
|
2365
2405
|
};
|
|
2366
2406
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services8.Invitation.AuthMethod.NONE;
|
|
2367
|
-
var
|
|
2407
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2368
2408
|
var InvitationTopology = class {
|
|
2369
2409
|
constructor(_role) {
|
|
2370
2410
|
this._role = _role;
|
|
@@ -2372,7 +2412,7 @@ var InvitationTopology = class {
|
|
|
2372
2412
|
}
|
|
2373
2413
|
init(controller) {
|
|
2374
2414
|
(0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
|
|
2375
|
-
F:
|
|
2415
|
+
F: __dxlog_file11,
|
|
2376
2416
|
L: 42,
|
|
2377
2417
|
S: this,
|
|
2378
2418
|
A: [
|
|
@@ -2384,7 +2424,7 @@ var InvitationTopology = class {
|
|
|
2384
2424
|
}
|
|
2385
2425
|
update() {
|
|
2386
2426
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2387
|
-
F:
|
|
2427
|
+
F: __dxlog_file11,
|
|
2388
2428
|
L: 47,
|
|
2389
2429
|
S: this,
|
|
2390
2430
|
A: [
|
|
@@ -2407,7 +2447,7 @@ var InvitationTopology = class {
|
|
|
2407
2447
|
ownPeerId,
|
|
2408
2448
|
remotePeerId: firstUnknownPeer
|
|
2409
2449
|
}, {
|
|
2410
|
-
F:
|
|
2450
|
+
F: __dxlog_file11,
|
|
2411
2451
|
L: 69,
|
|
2412
2452
|
S: this,
|
|
2413
2453
|
C: (f, a) => f(...a)
|
|
@@ -2418,7 +2458,7 @@ var InvitationTopology = class {
|
|
|
2418
2458
|
}
|
|
2419
2459
|
async onOffer(peer) {
|
|
2420
2460
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2421
|
-
F:
|
|
2461
|
+
F: __dxlog_file11,
|
|
2422
2462
|
L: 76,
|
|
2423
2463
|
S: this,
|
|
2424
2464
|
A: [
|
|
@@ -2435,7 +2475,7 @@ var InvitationTopology = class {
|
|
|
2435
2475
|
return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
|
|
2436
2476
|
}
|
|
2437
2477
|
};
|
|
2438
|
-
var
|
|
2478
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2439
2479
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2440
2480
|
var InvitationsHandler = class {
|
|
2441
2481
|
/**
|
|
@@ -2460,7 +2500,7 @@ var InvitationsHandler = class {
|
|
|
2460
2500
|
try {
|
|
2461
2501
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2462
2502
|
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
2463
|
-
F:
|
|
2503
|
+
F: __dxlog_file12,
|
|
2464
2504
|
L: 90,
|
|
2465
2505
|
S: this,
|
|
2466
2506
|
A: [
|
|
@@ -2489,7 +2529,7 @@ var InvitationsHandler = class {
|
|
|
2489
2529
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
2490
2530
|
id: traceId
|
|
2491
2531
|
}), {
|
|
2492
|
-
F:
|
|
2532
|
+
F: __dxlog_file12,
|
|
2493
2533
|
L: 115,
|
|
2494
2534
|
S: this,
|
|
2495
2535
|
C: (f, a) => f(...a)
|
|
@@ -2497,7 +2537,7 @@ var InvitationsHandler = class {
|
|
|
2497
2537
|
(0, import_log6.log)("connected", {
|
|
2498
2538
|
...protocol.toJSON()
|
|
2499
2539
|
}, {
|
|
2500
|
-
F:
|
|
2540
|
+
F: __dxlog_file12,
|
|
2501
2541
|
L: 116,
|
|
2502
2542
|
S: this,
|
|
2503
2543
|
C: (f, a) => f(...a)
|
|
@@ -2509,7 +2549,7 @@ var InvitationsHandler = class {
|
|
|
2509
2549
|
guest: deviceKey,
|
|
2510
2550
|
...protocol.toJSON()
|
|
2511
2551
|
}, {
|
|
2512
|
-
F:
|
|
2552
|
+
F: __dxlog_file12,
|
|
2513
2553
|
L: 118,
|
|
2514
2554
|
S: this,
|
|
2515
2555
|
C: (f, a) => f(...a)
|
|
@@ -2518,7 +2558,7 @@ var InvitationsHandler = class {
|
|
|
2518
2558
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
|
|
2519
2559
|
id: traceId
|
|
2520
2560
|
}), {
|
|
2521
|
-
F:
|
|
2561
|
+
F: __dxlog_file12,
|
|
2522
2562
|
L: 120,
|
|
2523
2563
|
S: this,
|
|
2524
2564
|
C: (f, a) => f(...a)
|
|
@@ -2533,7 +2573,7 @@ var InvitationsHandler = class {
|
|
|
2533
2573
|
(0, import_log6.log)("timeout", {
|
|
2534
2574
|
...protocol.toJSON()
|
|
2535
2575
|
}, {
|
|
2536
|
-
F:
|
|
2576
|
+
F: __dxlog_file12,
|
|
2537
2577
|
L: 129,
|
|
2538
2578
|
S: this,
|
|
2539
2579
|
C: (f, a) => f(...a)
|
|
@@ -2542,7 +2582,7 @@ var InvitationsHandler = class {
|
|
|
2542
2582
|
} else {
|
|
2543
2583
|
if (guardedState.error(extension, err)) {
|
|
2544
2584
|
import_log6.log.error("failed", err, {
|
|
2545
|
-
F:
|
|
2585
|
+
F: __dxlog_file12,
|
|
2546
2586
|
L: 133,
|
|
2547
2587
|
S: this,
|
|
2548
2588
|
C: (f, a) => f(...a)
|
|
@@ -2553,7 +2593,7 @@ var InvitationsHandler = class {
|
|
|
2553
2593
|
id: traceId,
|
|
2554
2594
|
error: err
|
|
2555
2595
|
}), {
|
|
2556
|
-
F:
|
|
2596
|
+
F: __dxlog_file12,
|
|
2557
2597
|
L: 136,
|
|
2558
2598
|
S: this,
|
|
2559
2599
|
C: (f, a) => f(...a)
|
|
@@ -2567,7 +2607,7 @@ var InvitationsHandler = class {
|
|
|
2567
2607
|
(0, import_log6.log)("invalid role", {
|
|
2568
2608
|
...err.context
|
|
2569
2609
|
}, {
|
|
2570
|
-
F:
|
|
2610
|
+
F: __dxlog_file12,
|
|
2571
2611
|
L: 144,
|
|
2572
2612
|
S: this,
|
|
2573
2613
|
C: (f, a) => f(...a)
|
|
@@ -2579,7 +2619,7 @@ var InvitationsHandler = class {
|
|
|
2579
2619
|
(0, import_log6.log)("timeout", {
|
|
2580
2620
|
err
|
|
2581
2621
|
}, {
|
|
2582
|
-
F:
|
|
2622
|
+
F: __dxlog_file12,
|
|
2583
2623
|
L: 149,
|
|
2584
2624
|
S: this,
|
|
2585
2625
|
C: (f, a) => f(...a)
|
|
@@ -2588,7 +2628,7 @@ var InvitationsHandler = class {
|
|
|
2588
2628
|
} else {
|
|
2589
2629
|
if (guardedState.error(extension, err)) {
|
|
2590
2630
|
import_log6.log.error("failed", err, {
|
|
2591
|
-
F:
|
|
2631
|
+
F: __dxlog_file12,
|
|
2592
2632
|
L: 153,
|
|
2593
2633
|
S: this,
|
|
2594
2634
|
C: (f, a) => f(...a)
|
|
@@ -2602,7 +2642,7 @@ var InvitationsHandler = class {
|
|
|
2602
2642
|
if (invitation.lifetime && invitation.created) {
|
|
2603
2643
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2604
2644
|
import_log6.log.warn("invitation has already expired", void 0, {
|
|
2605
|
-
F:
|
|
2645
|
+
F: __dxlog_file12,
|
|
2606
2646
|
L: 164,
|
|
2607
2647
|
S: this,
|
|
2608
2648
|
C: (f, a) => f(...a)
|
|
@@ -2625,7 +2665,7 @@ var InvitationsHandler = class {
|
|
|
2625
2665
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2626
2666
|
if (deviceProfile) {
|
|
2627
2667
|
(0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2628
|
-
F:
|
|
2668
|
+
F: __dxlog_file12,
|
|
2629
2669
|
L: 197,
|
|
2630
2670
|
S: this,
|
|
2631
2671
|
A: [
|
|
@@ -2643,7 +2683,7 @@ var InvitationsHandler = class {
|
|
|
2643
2683
|
invitationType: import_services6.Invitation.Type.DELEGATED,
|
|
2644
2684
|
triedPeers: triedPeersIds.size
|
|
2645
2685
|
}, {
|
|
2646
|
-
F:
|
|
2686
|
+
F: __dxlog_file12,
|
|
2647
2687
|
L: 205,
|
|
2648
2688
|
S: this,
|
|
2649
2689
|
C: (f, a) => f(...a)
|
|
@@ -2670,7 +2710,7 @@ var InvitationsHandler = class {
|
|
|
2670
2710
|
admitted,
|
|
2671
2711
|
currentState: guardedState.current.state
|
|
2672
2712
|
}, {
|
|
2673
|
-
F:
|
|
2713
|
+
F: __dxlog_file12,
|
|
2674
2714
|
L: 233,
|
|
2675
2715
|
S: this,
|
|
2676
2716
|
C: (f, a) => f(...a)
|
|
@@ -2688,7 +2728,7 @@ var InvitationsHandler = class {
|
|
|
2688
2728
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
2689
2729
|
id: traceId
|
|
2690
2730
|
}), {
|
|
2691
|
-
F:
|
|
2731
|
+
F: __dxlog_file12,
|
|
2692
2732
|
L: 245,
|
|
2693
2733
|
S: this,
|
|
2694
2734
|
C: (f, a) => f(...a)
|
|
@@ -2700,7 +2740,7 @@ var InvitationsHandler = class {
|
|
|
2700
2740
|
(0, import_log6.log)("connected", {
|
|
2701
2741
|
...protocol.toJSON()
|
|
2702
2742
|
}, {
|
|
2703
|
-
F:
|
|
2743
|
+
F: __dxlog_file12,
|
|
2704
2744
|
L: 256,
|
|
2705
2745
|
S: this,
|
|
2706
2746
|
C: (f, a) => f(...a)
|
|
@@ -2709,7 +2749,7 @@ var InvitationsHandler = class {
|
|
|
2709
2749
|
(0, import_log6.log)("introduce", {
|
|
2710
2750
|
...protocol.toJSON()
|
|
2711
2751
|
}, {
|
|
2712
|
-
F:
|
|
2752
|
+
F: __dxlog_file12,
|
|
2713
2753
|
L: 260,
|
|
2714
2754
|
S: this,
|
|
2715
2755
|
C: (f, a) => f(...a)
|
|
@@ -2722,7 +2762,7 @@ var InvitationsHandler = class {
|
|
|
2722
2762
|
...protocol.toJSON(),
|
|
2723
2763
|
response: introductionResponse
|
|
2724
2764
|
}, {
|
|
2725
|
-
F:
|
|
2765
|
+
F: __dxlog_file12,
|
|
2726
2766
|
L: 265,
|
|
2727
2767
|
S: this,
|
|
2728
2768
|
C: (f, a) => f(...a)
|
|
@@ -2743,7 +2783,7 @@ var InvitationsHandler = class {
|
|
|
2743
2783
|
(0, import_log6.log)("request admission", {
|
|
2744
2784
|
...protocol.toJSON()
|
|
2745
2785
|
}, {
|
|
2746
|
-
F:
|
|
2786
|
+
F: __dxlog_file12,
|
|
2747
2787
|
L: 291,
|
|
2748
2788
|
S: this,
|
|
2749
2789
|
C: (f, a) => f(...a)
|
|
@@ -2755,7 +2795,7 @@ var InvitationsHandler = class {
|
|
|
2755
2795
|
(0, import_log6.log)("admitted by host", {
|
|
2756
2796
|
...protocol.toJSON()
|
|
2757
2797
|
}, {
|
|
2758
|
-
F:
|
|
2798
|
+
F: __dxlog_file12,
|
|
2759
2799
|
L: 302,
|
|
2760
2800
|
S: this,
|
|
2761
2801
|
C: (f, a) => f(...a)
|
|
@@ -2768,7 +2808,7 @@ var InvitationsHandler = class {
|
|
|
2768
2808
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
|
|
2769
2809
|
id: traceId
|
|
2770
2810
|
}), {
|
|
2771
|
-
F:
|
|
2811
|
+
F: __dxlog_file12,
|
|
2772
2812
|
L: 308,
|
|
2773
2813
|
S: this,
|
|
2774
2814
|
C: (f, a) => f(...a)
|
|
@@ -2778,7 +2818,7 @@ var InvitationsHandler = class {
|
|
|
2778
2818
|
(0, import_log6.log)("timeout", {
|
|
2779
2819
|
...protocol.toJSON()
|
|
2780
2820
|
}, {
|
|
2781
|
-
F:
|
|
2821
|
+
F: __dxlog_file12,
|
|
2782
2822
|
L: 311,
|
|
2783
2823
|
S: this,
|
|
2784
2824
|
C: (f, a) => f(...a)
|
|
@@ -2786,7 +2826,7 @@ var InvitationsHandler = class {
|
|
|
2786
2826
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2787
2827
|
} else {
|
|
2788
2828
|
(0, import_log6.log)("auth failed", err, {
|
|
2789
|
-
F:
|
|
2829
|
+
F: __dxlog_file12,
|
|
2790
2830
|
L: 314,
|
|
2791
2831
|
S: this,
|
|
2792
2832
|
C: (f, a) => f(...a)
|
|
@@ -2798,7 +2838,7 @@ var InvitationsHandler = class {
|
|
|
2798
2838
|
id: traceId,
|
|
2799
2839
|
error: err
|
|
2800
2840
|
}), {
|
|
2801
|
-
F:
|
|
2841
|
+
F: __dxlog_file12,
|
|
2802
2842
|
L: 318,
|
|
2803
2843
|
S: this,
|
|
2804
2844
|
C: (f, a) => f(...a)
|
|
@@ -2814,7 +2854,7 @@ var InvitationsHandler = class {
|
|
|
2814
2854
|
(0, import_log6.log)("timeout", {
|
|
2815
2855
|
...protocol.toJSON()
|
|
2816
2856
|
}, {
|
|
2817
|
-
F:
|
|
2857
|
+
F: __dxlog_file12,
|
|
2818
2858
|
L: 327,
|
|
2819
2859
|
S: this,
|
|
2820
2860
|
C: (f, a) => f(...a)
|
|
@@ -2822,7 +2862,7 @@ var InvitationsHandler = class {
|
|
|
2822
2862
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2823
2863
|
} else {
|
|
2824
2864
|
(0, import_log6.log)("auth failed", err, {
|
|
2825
|
-
F:
|
|
2865
|
+
F: __dxlog_file12,
|
|
2826
2866
|
L: 330,
|
|
2827
2867
|
S: this,
|
|
2828
2868
|
C: (f, a) => f(...a)
|
|
@@ -2840,7 +2880,7 @@ var InvitationsHandler = class {
|
|
|
2840
2880
|
await ctx.dispose();
|
|
2841
2881
|
} else {
|
|
2842
2882
|
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2843
|
-
F:
|
|
2883
|
+
F: __dxlog_file12,
|
|
2844
2884
|
L: 345,
|
|
2845
2885
|
S: this,
|
|
2846
2886
|
A: [
|
|
@@ -2934,16 +2974,29 @@ var InvitationsHandler = class {
|
|
|
2934
2974
|
};
|
|
2935
2975
|
}
|
|
2936
2976
|
_logStateUpdate(invitation, actor, newState) {
|
|
2937
|
-
(
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2977
|
+
if (this._isNotTerminal(newState)) {
|
|
2978
|
+
(0, import_log6.log)("invitation state update", {
|
|
2979
|
+
actor: actor?.constructor.name,
|
|
2980
|
+
newState: stateToString(newState),
|
|
2981
|
+
oldState: stateToString(invitation.state)
|
|
2982
|
+
}, {
|
|
2983
|
+
F: __dxlog_file12,
|
|
2984
|
+
L: 439,
|
|
2985
|
+
S: this,
|
|
2986
|
+
C: (f, a) => f(...a)
|
|
2987
|
+
});
|
|
2988
|
+
} else {
|
|
2989
|
+
import_log6.log.info("invitation state update", {
|
|
2990
|
+
actor: actor?.constructor.name,
|
|
2991
|
+
newState: stateToString(newState),
|
|
2992
|
+
oldState: stateToString(invitation.state)
|
|
2993
|
+
}, {
|
|
2994
|
+
F: __dxlog_file12,
|
|
2995
|
+
L: 445,
|
|
2996
|
+
S: this,
|
|
2997
|
+
C: (f, a) => f(...a)
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
2947
3000
|
}
|
|
2948
3001
|
_isNotTerminal(currentState) {
|
|
2949
3002
|
return ![
|
|
@@ -2957,16 +3010,16 @@ var InvitationsHandler = class {
|
|
|
2957
3010
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2958
3011
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2959
3012
|
(0, import_log6.log)("guest waiting for authentication code...", void 0, {
|
|
2960
|
-
F:
|
|
2961
|
-
L:
|
|
3013
|
+
F: __dxlog_file12,
|
|
3014
|
+
L: 470,
|
|
2962
3015
|
S: this,
|
|
2963
3016
|
C: (f, a) => f(...a)
|
|
2964
3017
|
});
|
|
2965
3018
|
setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2966
3019
|
const authCode = await authenticated.wait(options);
|
|
2967
3020
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
2968
|
-
F:
|
|
2969
|
-
L:
|
|
3021
|
+
F: __dxlog_file12,
|
|
3022
|
+
L: 474,
|
|
2970
3023
|
S: this,
|
|
2971
3024
|
C: (f, a) => f(...a)
|
|
2972
3025
|
});
|
|
@@ -2984,8 +3037,8 @@ var InvitationsHandler = class {
|
|
|
2984
3037
|
(0, import_log6.log)("retrying invalid code", {
|
|
2985
3038
|
attempt
|
|
2986
3039
|
}, {
|
|
2987
|
-
F:
|
|
2988
|
-
L:
|
|
3040
|
+
F: __dxlog_file12,
|
|
3041
|
+
L: 485,
|
|
2989
3042
|
S: this,
|
|
2990
3043
|
C: (f, a) => f(...a)
|
|
2991
3044
|
});
|
|
@@ -3002,8 +3055,8 @@ var InvitationsHandler = class {
|
|
|
3002
3055
|
throw new Error("challenge missing in the introduction");
|
|
3003
3056
|
}
|
|
3004
3057
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3005
|
-
F:
|
|
3006
|
-
L:
|
|
3058
|
+
F: __dxlog_file12,
|
|
3059
|
+
L: 504,
|
|
3007
3060
|
S: this,
|
|
3008
3061
|
C: (f, a) => f(...a)
|
|
3009
3062
|
});
|
|
@@ -3117,7 +3170,7 @@ var InvitationsServiceImpl = class {
|
|
|
3117
3170
|
});
|
|
3118
3171
|
}
|
|
3119
3172
|
};
|
|
3120
|
-
var
|
|
3173
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3121
3174
|
var SpaceInvitationProtocol = class {
|
|
3122
3175
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3123
3176
|
this._spaceManager = _spaceManager;
|
|
@@ -3151,79 +3204,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3151
3204
|
};
|
|
3152
3205
|
}
|
|
3153
3206
|
async admit(invitation, request, guestProfile) {
|
|
3154
|
-
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3155
|
-
F:
|
|
3156
|
-
L:
|
|
3157
|
-
S: this,
|
|
3158
|
-
A: [
|
|
3159
|
-
"this._spaceKey",
|
|
3160
|
-
""
|
|
3161
|
-
]
|
|
3162
|
-
});
|
|
3163
|
-
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3164
|
-
(0, import_invariant10.invariant)(space, void 0, {
|
|
3165
|
-
F: __dxlog_file12,
|
|
3166
|
-
L: 78,
|
|
3167
|
-
S: this,
|
|
3168
|
-
A: [
|
|
3169
|
-
"space",
|
|
3170
|
-
""
|
|
3171
|
-
]
|
|
3172
|
-
});
|
|
3173
|
-
(0, import_invariant10.invariant)(request.space, void 0, {
|
|
3174
|
-
F: __dxlog_file12,
|
|
3175
|
-
L: 80,
|
|
3207
|
+
(0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
|
|
3208
|
+
F: __dxlog_file13,
|
|
3209
|
+
L: 74,
|
|
3176
3210
|
S: this,
|
|
3177
3211
|
A: [
|
|
3178
|
-
"request.space",
|
|
3212
|
+
"this._spaceKey && request.space",
|
|
3179
3213
|
""
|
|
3180
3214
|
]
|
|
3181
3215
|
});
|
|
3182
|
-
const { identityKey, deviceKey } = request.space;
|
|
3183
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
|
|
3184
|
-
throw new import_protocols8.AlreadyJoinedError();
|
|
3185
|
-
}
|
|
3186
3216
|
(0, import_log10.log)("writing guest credentials", {
|
|
3187
3217
|
host: this._signingContext.deviceKey,
|
|
3188
|
-
guest: deviceKey
|
|
3218
|
+
guest: request.space.deviceKey
|
|
3189
3219
|
}, {
|
|
3190
|
-
F:
|
|
3191
|
-
L:
|
|
3220
|
+
F: __dxlog_file13,
|
|
3221
|
+
L: 75,
|
|
3192
3222
|
S: this,
|
|
3193
3223
|
C: (f, a) => f(...a)
|
|
3194
3224
|
});
|
|
3195
|
-
const
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
"credentials[0].credential",
|
|
3202
|
-
""
|
|
3203
|
-
]
|
|
3204
|
-
});
|
|
3205
|
-
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3206
|
-
(0, import_invariant10.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3207
|
-
F: __dxlog_file12,
|
|
3208
|
-
L: 103,
|
|
3209
|
-
S: this,
|
|
3210
|
-
A: [
|
|
3211
|
-
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3212
|
-
""
|
|
3213
|
-
]
|
|
3225
|
+
const spaceMemberCredential = await this._spaceManager.admitMember({
|
|
3226
|
+
spaceKey: this._spaceKey,
|
|
3227
|
+
identityKey: request.space.identityKey,
|
|
3228
|
+
role: invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN,
|
|
3229
|
+
profile: guestProfile,
|
|
3230
|
+
delegationCredentialId: invitation.delegationCredentialId
|
|
3214
3231
|
});
|
|
3215
|
-
|
|
3232
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3216
3233
|
return {
|
|
3217
3234
|
space: {
|
|
3218
3235
|
credential: spaceMemberCredential,
|
|
3219
|
-
controlTimeframe: space
|
|
3236
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3220
3237
|
}
|
|
3221
3238
|
};
|
|
3222
3239
|
}
|
|
3223
3240
|
async delegate(invitation) {
|
|
3224
3241
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3225
|
-
F:
|
|
3226
|
-
L:
|
|
3242
|
+
F: __dxlog_file13,
|
|
3243
|
+
L: 95,
|
|
3227
3244
|
S: this,
|
|
3228
3245
|
A: [
|
|
3229
3246
|
"this._spaceKey",
|
|
@@ -3232,8 +3249,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3232
3249
|
});
|
|
3233
3250
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3234
3251
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3235
|
-
F:
|
|
3236
|
-
L:
|
|
3252
|
+
F: __dxlog_file13,
|
|
3253
|
+
L: 97,
|
|
3237
3254
|
S: this,
|
|
3238
3255
|
A: [
|
|
3239
3256
|
"space",
|
|
@@ -3242,8 +3259,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3242
3259
|
});
|
|
3243
3260
|
if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3244
3261
|
(0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
3245
|
-
F:
|
|
3246
|
-
L:
|
|
3262
|
+
F: __dxlog_file13,
|
|
3263
|
+
L: 99,
|
|
3247
3264
|
S: this,
|
|
3248
3265
|
A: [
|
|
3249
3266
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3255,8 +3272,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3255
3272
|
host: this._signingContext.deviceKey,
|
|
3256
3273
|
id: invitation.invitationId
|
|
3257
3274
|
}, {
|
|
3258
|
-
F:
|
|
3259
|
-
L:
|
|
3275
|
+
F: __dxlog_file13,
|
|
3276
|
+
L: 102,
|
|
3260
3277
|
S: this,
|
|
3261
3278
|
C: (f, a) => f(...a)
|
|
3262
3279
|
});
|
|
@@ -3270,8 +3287,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3270
3287
|
guestKey: invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3271
3288
|
});
|
|
3272
3289
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3273
|
-
F:
|
|
3274
|
-
L:
|
|
3290
|
+
F: __dxlog_file13,
|
|
3291
|
+
L: 122,
|
|
3275
3292
|
S: this,
|
|
3276
3293
|
A: [
|
|
3277
3294
|
"credential.credential",
|
|
@@ -3285,8 +3302,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3285
3302
|
}
|
|
3286
3303
|
async cancelDelegation(invitation) {
|
|
3287
3304
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3288
|
-
F:
|
|
3289
|
-
L:
|
|
3305
|
+
F: __dxlog_file13,
|
|
3306
|
+
L: 128,
|
|
3290
3307
|
S: this,
|
|
3291
3308
|
A: [
|
|
3292
3309
|
"this._spaceKey",
|
|
@@ -3294,8 +3311,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3294
3311
|
]
|
|
3295
3312
|
});
|
|
3296
3313
|
(0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3297
|
-
F:
|
|
3298
|
-
L:
|
|
3314
|
+
F: __dxlog_file13,
|
|
3315
|
+
L: 129,
|
|
3299
3316
|
S: this,
|
|
3300
3317
|
A: [
|
|
3301
3318
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3304,8 +3321,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3304
3321
|
});
|
|
3305
3322
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3306
3323
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3307
|
-
F:
|
|
3308
|
-
L:
|
|
3324
|
+
F: __dxlog_file13,
|
|
3325
|
+
L: 131,
|
|
3309
3326
|
S: this,
|
|
3310
3327
|
A: [
|
|
3311
3328
|
"space",
|
|
@@ -3316,15 +3333,15 @@ var SpaceInvitationProtocol = class {
|
|
|
3316
3333
|
host: this._signingContext.deviceKey,
|
|
3317
3334
|
id: invitation.invitationId
|
|
3318
3335
|
}, {
|
|
3319
|
-
F:
|
|
3320
|
-
L:
|
|
3336
|
+
F: __dxlog_file13,
|
|
3337
|
+
L: 133,
|
|
3321
3338
|
S: this,
|
|
3322
3339
|
C: (f, a) => f(...a)
|
|
3323
3340
|
});
|
|
3324
3341
|
const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3325
3342
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3326
|
-
F:
|
|
3327
|
-
L:
|
|
3343
|
+
F: __dxlog_file13,
|
|
3344
|
+
L: 140,
|
|
3328
3345
|
S: this,
|
|
3329
3346
|
A: [
|
|
3330
3347
|
"credential.credential",
|
|
@@ -3362,8 +3379,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3362
3379
|
}
|
|
3363
3380
|
async accept(response) {
|
|
3364
3381
|
(0, import_invariant10.invariant)(response.space, void 0, {
|
|
3365
|
-
F:
|
|
3366
|
-
L:
|
|
3382
|
+
F: __dxlog_file13,
|
|
3383
|
+
L: 175,
|
|
3367
3384
|
S: this,
|
|
3368
3385
|
A: [
|
|
3369
3386
|
"response.space",
|
|
@@ -3373,8 +3390,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3373
3390
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3374
3391
|
const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
|
|
3375
3392
|
(0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3376
|
-
F:
|
|
3377
|
-
L:
|
|
3393
|
+
F: __dxlog_file13,
|
|
3394
|
+
L: 178,
|
|
3378
3395
|
S: this,
|
|
3379
3396
|
A: [
|
|
3380
3397
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3382,8 +3399,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3382
3399
|
]
|
|
3383
3400
|
});
|
|
3384
3401
|
(0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3385
|
-
F:
|
|
3386
|
-
L:
|
|
3402
|
+
F: __dxlog_file13,
|
|
3403
|
+
L: 179,
|
|
3387
3404
|
S: this,
|
|
3388
3405
|
A: [
|
|
3389
3406
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3405,7 +3422,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3405
3422
|
};
|
|
3406
3423
|
}
|
|
3407
3424
|
};
|
|
3408
|
-
var
|
|
3425
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3409
3426
|
var InvitationsManager = class {
|
|
3410
3427
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3411
3428
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3448,7 +3465,7 @@ var InvitationsManager = class {
|
|
|
3448
3465
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3449
3466
|
} catch (err) {
|
|
3450
3467
|
import_log11.log.catch(err, void 0, {
|
|
3451
|
-
F:
|
|
3468
|
+
F: __dxlog_file14,
|
|
3452
3469
|
L: 82,
|
|
3453
3470
|
S: this,
|
|
3454
3471
|
C: (f, a) => f(...a)
|
|
@@ -3471,7 +3488,7 @@ var InvitationsManager = class {
|
|
|
3471
3488
|
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
3472
3489
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3473
3490
|
(0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3474
|
-
F:
|
|
3491
|
+
F: __dxlog_file14,
|
|
3475
3492
|
L: 103,
|
|
3476
3493
|
S: this,
|
|
3477
3494
|
A: [
|
|
@@ -3490,7 +3507,7 @@ var InvitationsManager = class {
|
|
|
3490
3507
|
};
|
|
3491
3508
|
} catch (err) {
|
|
3492
3509
|
import_log11.log.catch(err, void 0, {
|
|
3493
|
-
F:
|
|
3510
|
+
F: __dxlog_file14,
|
|
3494
3511
|
L: 110,
|
|
3495
3512
|
S: this,
|
|
3496
3513
|
C: (f, a) => f(...a)
|
|
@@ -3522,13 +3539,13 @@ var InvitationsManager = class {
|
|
|
3522
3539
|
}
|
|
3523
3540
|
async authenticate({ invitationId, authCode }) {
|
|
3524
3541
|
(0, import_log11.log)("authenticating...", void 0, {
|
|
3525
|
-
F:
|
|
3542
|
+
F: __dxlog_file14,
|
|
3526
3543
|
L: 140,
|
|
3527
3544
|
S: this,
|
|
3528
3545
|
C: (f, a) => f(...a)
|
|
3529
3546
|
});
|
|
3530
3547
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3531
|
-
F:
|
|
3548
|
+
F: __dxlog_file14,
|
|
3532
3549
|
L: 141,
|
|
3533
3550
|
S: this,
|
|
3534
3551
|
A: [
|
|
@@ -3541,7 +3558,7 @@ var InvitationsManager = class {
|
|
|
3541
3558
|
import_log11.log.warn("invalid invitation", {
|
|
3542
3559
|
invitationId
|
|
3543
3560
|
}, {
|
|
3544
|
-
F:
|
|
3561
|
+
F: __dxlog_file14,
|
|
3545
3562
|
L: 144,
|
|
3546
3563
|
S: this,
|
|
3547
3564
|
C: (f, a) => f(...a)
|
|
@@ -3554,13 +3571,13 @@ var InvitationsManager = class {
|
|
|
3554
3571
|
(0, import_log11.log)("cancelInvitation...", {
|
|
3555
3572
|
invitationId
|
|
3556
3573
|
}, {
|
|
3557
|
-
F:
|
|
3574
|
+
F: __dxlog_file14,
|
|
3558
3575
|
L: 151,
|
|
3559
3576
|
S: this,
|
|
3560
3577
|
C: (f, a) => f(...a)
|
|
3561
3578
|
});
|
|
3562
3579
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3563
|
-
F:
|
|
3580
|
+
F: __dxlog_file14,
|
|
3564
3581
|
L: 152,
|
|
3565
3582
|
S: this,
|
|
3566
3583
|
A: [
|
|
@@ -3634,12 +3651,15 @@ var InvitationsManager = class {
|
|
|
3634
3651
|
stream.error(err);
|
|
3635
3652
|
void ctx.dispose();
|
|
3636
3653
|
}
|
|
3654
|
+
}, {
|
|
3655
|
+
F: __dxlog_file14,
|
|
3656
|
+
L: 234
|
|
3637
3657
|
});
|
|
3638
3658
|
ctx.onDispose(() => {
|
|
3639
3659
|
(0, import_log11.log)("complete", {
|
|
3640
3660
|
...handler.toJSON()
|
|
3641
3661
|
}, {
|
|
3642
|
-
F:
|
|
3662
|
+
F: __dxlog_file14,
|
|
3643
3663
|
L: 241,
|
|
3644
3664
|
S: this,
|
|
3645
3665
|
C: (f, a) => f(...a)
|
|
@@ -3672,7 +3692,7 @@ var InvitationsManager = class {
|
|
|
3672
3692
|
(0, import_log11.log)("timeout", {
|
|
3673
3693
|
...handler.toJSON()
|
|
3674
3694
|
}, {
|
|
3675
|
-
F:
|
|
3695
|
+
F: __dxlog_file14,
|
|
3676
3696
|
L: 261,
|
|
3677
3697
|
S: this,
|
|
3678
3698
|
C: (f, a) => f(...a)
|
|
@@ -3683,7 +3703,7 @@ var InvitationsManager = class {
|
|
|
3683
3703
|
});
|
|
3684
3704
|
} else {
|
|
3685
3705
|
import_log11.log.warn("auth failed", err, {
|
|
3686
|
-
F:
|
|
3706
|
+
F: __dxlog_file14,
|
|
3687
3707
|
L: 264,
|
|
3688
3708
|
S: this,
|
|
3689
3709
|
C: (f, a) => f(...a)
|
|
@@ -3695,12 +3715,15 @@ var InvitationsManager = class {
|
|
|
3695
3715
|
}
|
|
3696
3716
|
void ctx.dispose();
|
|
3697
3717
|
}
|
|
3718
|
+
}, {
|
|
3719
|
+
F: __dxlog_file14,
|
|
3720
|
+
L: 258
|
|
3698
3721
|
});
|
|
3699
3722
|
ctx.onDispose(() => {
|
|
3700
3723
|
(0, import_log11.log)("complete", {
|
|
3701
3724
|
...handler.toJSON()
|
|
3702
3725
|
}, {
|
|
3703
|
-
F:
|
|
3726
|
+
F: __dxlog_file14,
|
|
3704
3727
|
L: 271,
|
|
3705
3728
|
S: this,
|
|
3706
3729
|
C: (f, a) => f(...a)
|
|
@@ -3745,7 +3768,7 @@ var InvitationsManager = class {
|
|
|
3745
3768
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3746
3769
|
} catch (err) {
|
|
3747
3770
|
import_log11.log.catch(err, void 0, {
|
|
3748
|
-
F:
|
|
3771
|
+
F: __dxlog_file14,
|
|
3749
3772
|
L: 307,
|
|
3750
3773
|
S: this,
|
|
3751
3774
|
C: (f, a) => f(...a)
|
|
@@ -3798,12 +3821,13 @@ var AutomergeSpaceState = class extends import_context11.Resource {
|
|
|
3798
3821
|
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3799
3822
|
}
|
|
3800
3823
|
};
|
|
3801
|
-
var
|
|
3824
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
3825
|
+
var LOAD_DOC_TIMEOUT = 1e4;
|
|
3802
3826
|
var runEpochMigration = async (ctx, context) => {
|
|
3803
3827
|
switch (context.migration) {
|
|
3804
3828
|
case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3805
|
-
const document = context.
|
|
3806
|
-
await context.
|
|
3829
|
+
const document = context.echoHost.createDoc();
|
|
3830
|
+
await context.echoHost.flush();
|
|
3807
3831
|
return {
|
|
3808
3832
|
newRoot: document.url
|
|
3809
3833
|
};
|
|
@@ -3812,77 +3836,88 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3812
3836
|
if (!context.currentRoot) {
|
|
3813
3837
|
throw new Error("Space does not have an automerge root");
|
|
3814
3838
|
}
|
|
3815
|
-
const rootHandle = context.
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3839
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
|
|
3840
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3841
|
+
});
|
|
3842
|
+
const newRoot = context.echoHost.createDoc(rootHandle.docSync());
|
|
3843
|
+
await context.echoHost.flush();
|
|
3819
3844
|
return {
|
|
3820
3845
|
newRoot: newRoot.url
|
|
3821
3846
|
};
|
|
3822
3847
|
}
|
|
3823
3848
|
case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3824
3849
|
import_log13.log.info("Fragmenting", void 0, {
|
|
3825
|
-
F:
|
|
3826
|
-
L:
|
|
3850
|
+
F: __dxlog_file15,
|
|
3851
|
+
L: 64,
|
|
3827
3852
|
S: void 0,
|
|
3828
3853
|
C: (f, a) => f(...a)
|
|
3829
3854
|
});
|
|
3830
3855
|
const currentRootUrl = context.currentRoot;
|
|
3831
|
-
const rootHandle = context.
|
|
3832
|
-
|
|
3856
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3857
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3858
|
+
});
|
|
3833
3859
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3834
3860
|
const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
|
|
3835
3861
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3836
3862
|
(0, import_invariant13.invariant)(properties, "Properties not found", {
|
|
3837
|
-
F:
|
|
3838
|
-
L:
|
|
3863
|
+
F: __dxlog_file15,
|
|
3864
|
+
L: 75,
|
|
3839
3865
|
S: void 0,
|
|
3840
3866
|
A: [
|
|
3841
3867
|
"properties",
|
|
3842
3868
|
"'Properties not found'"
|
|
3843
3869
|
]
|
|
3844
3870
|
});
|
|
3845
|
-
const
|
|
3871
|
+
const newRoot = context.echoHost.createDoc({
|
|
3846
3872
|
...rootHandle.docSync(),
|
|
3847
3873
|
objects: Object.fromEntries([
|
|
3848
3874
|
properties
|
|
3849
3875
|
])
|
|
3850
|
-
};
|
|
3851
|
-
const newRoot = context.repo.create(newSpaceDoc);
|
|
3876
|
+
});
|
|
3852
3877
|
(0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3853
|
-
F:
|
|
3854
|
-
L:
|
|
3878
|
+
F: __dxlog_file15,
|
|
3879
|
+
L: 82,
|
|
3855
3880
|
S: void 0,
|
|
3856
3881
|
A: [
|
|
3857
3882
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3858
3883
|
""
|
|
3859
3884
|
]
|
|
3860
3885
|
});
|
|
3861
|
-
const
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
], value);
|
|
3886
|
+
const newLinks = [];
|
|
3887
|
+
for (const [id, objData] of otherObjects) {
|
|
3888
|
+
const handle = context.echoHost.createDoc({
|
|
3889
|
+
version: import_echo_protocol2.SpaceDocVersion.CURRENT,
|
|
3890
|
+
access: {
|
|
3891
|
+
spaceKey: context.spaceKey.toHex()
|
|
3892
|
+
},
|
|
3893
|
+
objects: {
|
|
3894
|
+
[id]: objData
|
|
3895
|
+
}
|
|
3872
3896
|
});
|
|
3897
|
+
newLinks.push([
|
|
3898
|
+
id,
|
|
3899
|
+
handle.url
|
|
3900
|
+
]);
|
|
3901
|
+
}
|
|
3902
|
+
newRoot.change((doc) => {
|
|
3903
|
+
doc.links ??= {};
|
|
3904
|
+
for (const [id, url] of newLinks) {
|
|
3905
|
+
doc.links[id] = url;
|
|
3906
|
+
}
|
|
3873
3907
|
});
|
|
3874
|
-
await context.
|
|
3908
|
+
await context.echoHost.flush();
|
|
3875
3909
|
return {
|
|
3876
3910
|
newRoot: newRoot.url
|
|
3877
3911
|
};
|
|
3878
3912
|
}
|
|
3879
3913
|
case import_services13.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
3880
3914
|
const currentRootUrl = context.currentRoot;
|
|
3881
|
-
const rootHandle = context.
|
|
3882
|
-
|
|
3915
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3916
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3917
|
+
});
|
|
3883
3918
|
(0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
|
|
3884
|
-
F:
|
|
3885
|
-
L:
|
|
3919
|
+
F: __dxlog_file15,
|
|
3920
|
+
L: 115,
|
|
3886
3921
|
S: void 0,
|
|
3887
3922
|
A: [
|
|
3888
3923
|
"rootHandle.docSync()",
|
|
@@ -3891,40 +3926,59 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3891
3926
|
});
|
|
3892
3927
|
const newRootContent = await (0, import_echo_db.convertLegacySpaceRootDoc)(structuredClone(rootHandle.docSync()));
|
|
3893
3928
|
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3929
|
+
try {
|
|
3930
|
+
const handle = await context.echoHost.loadDoc(ctx, url, {
|
|
3931
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3932
|
+
});
|
|
3933
|
+
(0, import_invariant13.invariant)(handle.docSync(), void 0, {
|
|
3934
|
+
F: __dxlog_file15,
|
|
3935
|
+
L: 122,
|
|
3936
|
+
S: void 0,
|
|
3937
|
+
A: [
|
|
3938
|
+
"handle.docSync()",
|
|
3939
|
+
""
|
|
3940
|
+
]
|
|
3941
|
+
});
|
|
3942
|
+
const newDoc = await (0, import_echo_db.convertLegacyReferences)(structuredClone(handle.docSync()));
|
|
3943
|
+
const migratedDoc = (0, import_echo_db.migrateDocument)(handle.docSync(), newDoc);
|
|
3944
|
+
const newHandle = context.echoHost.createDoc(migratedDoc, {
|
|
3945
|
+
preserveHistory: true
|
|
3946
|
+
});
|
|
3947
|
+
newRootContent.links[id] = newHandle.url;
|
|
3948
|
+
} catch (err) {
|
|
3949
|
+
import_log13.log.warn("Failed to migrate reference", {
|
|
3950
|
+
id,
|
|
3951
|
+
url,
|
|
3952
|
+
error: err
|
|
3953
|
+
}, {
|
|
3954
|
+
F: __dxlog_file15,
|
|
3955
|
+
L: 128,
|
|
3956
|
+
S: void 0,
|
|
3957
|
+
C: (f, a) => f(...a)
|
|
3958
|
+
});
|
|
3959
|
+
delete newRootContent.links[id];
|
|
3960
|
+
}
|
|
3909
3961
|
}
|
|
3910
3962
|
const migratedRoot = (0, import_echo_db.migrateDocument)(rootHandle.docSync(), newRootContent);
|
|
3911
|
-
const newRoot = context.
|
|
3912
|
-
|
|
3963
|
+
const newRoot = context.echoHost.createDoc(migratedRoot, {
|
|
3964
|
+
preserveHistory: true
|
|
3965
|
+
});
|
|
3966
|
+
await context.echoHost.flush();
|
|
3913
3967
|
return {
|
|
3914
3968
|
newRoot: newRoot.url
|
|
3915
3969
|
};
|
|
3916
3970
|
}
|
|
3917
3971
|
case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3918
3972
|
(0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
|
|
3919
|
-
F:
|
|
3920
|
-
L:
|
|
3973
|
+
F: __dxlog_file15,
|
|
3974
|
+
L: 143,
|
|
3921
3975
|
S: void 0,
|
|
3922
3976
|
A: [
|
|
3923
3977
|
"context.newAutomergeRoot",
|
|
3924
3978
|
""
|
|
3925
3979
|
]
|
|
3926
3980
|
});
|
|
3927
|
-
await context.
|
|
3981
|
+
await context.echoHost.flush();
|
|
3928
3982
|
return {
|
|
3929
3983
|
newRoot: context.newAutomergeRoot
|
|
3930
3984
|
};
|
|
@@ -3932,18 +3986,21 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3932
3986
|
}
|
|
3933
3987
|
return {};
|
|
3934
3988
|
};
|
|
3935
|
-
var
|
|
3989
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3936
3990
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3937
3991
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3938
3992
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3939
3993
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3940
3994
|
var NotarizationPlugin = class {
|
|
3941
3995
|
constructor() {
|
|
3942
|
-
this._ctx = new
|
|
3943
|
-
|
|
3996
|
+
this._ctx = new import_context12.Context(void 0, {
|
|
3997
|
+
F: __dxlog_file16,
|
|
3998
|
+
L: 62
|
|
3999
|
+
});
|
|
4000
|
+
this._extensionOpened = new import_async15.Event();
|
|
3944
4001
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3945
|
-
this._processedCredentials = new
|
|
3946
|
-
this._processCredentialsTriggers = new
|
|
4002
|
+
this._processedCredentials = new import_util8.ComplexSet(import_keys11.PublicKey.hash);
|
|
4003
|
+
this._processCredentialsTriggers = new import_util8.ComplexMap(import_keys11.PublicKey.hash);
|
|
3947
4004
|
}
|
|
3948
4005
|
get hasWriter() {
|
|
3949
4006
|
return !!this._writer;
|
|
@@ -3960,13 +4017,13 @@ var NotarizationPlugin = class {
|
|
|
3960
4017
|
(0, import_log14.log)("notarize", {
|
|
3961
4018
|
credentials
|
|
3962
4019
|
}, {
|
|
3963
|
-
F:
|
|
4020
|
+
F: __dxlog_file16,
|
|
3964
4021
|
L: 90,
|
|
3965
4022
|
S: this,
|
|
3966
4023
|
C: (f, a) => f(...a)
|
|
3967
4024
|
});
|
|
3968
4025
|
(0, import_invariant14.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
3969
|
-
F:
|
|
4026
|
+
F: __dxlog_file16,
|
|
3970
4027
|
L: 91,
|
|
3971
4028
|
S: this,
|
|
3972
4029
|
A: [
|
|
@@ -3974,13 +4031,13 @@ var NotarizationPlugin = class {
|
|
|
3974
4031
|
"'Credentials must have an id'"
|
|
3975
4032
|
]
|
|
3976
4033
|
});
|
|
3977
|
-
const errors = new
|
|
4034
|
+
const errors = new import_async15.Trigger();
|
|
3978
4035
|
const ctx = this._ctx.derive({
|
|
3979
4036
|
onError: (err) => {
|
|
3980
4037
|
import_log14.log.warn("Notarization error", {
|
|
3981
4038
|
err
|
|
3982
4039
|
}, {
|
|
3983
|
-
F:
|
|
4040
|
+
F: __dxlog_file16,
|
|
3984
4041
|
L: 99,
|
|
3985
4042
|
S: this,
|
|
3986
4043
|
C: (f, a) => f(...a)
|
|
@@ -3991,23 +4048,23 @@ var NotarizationPlugin = class {
|
|
|
3991
4048
|
});
|
|
3992
4049
|
opCtx?.onDispose(() => ctx.dispose());
|
|
3993
4050
|
if (timeout !== 0) {
|
|
3994
|
-
(0,
|
|
4051
|
+
(0, import_async15.scheduleTask)(ctx, () => {
|
|
3995
4052
|
import_log14.log.warn("Notarization timeout", {
|
|
3996
4053
|
timeout,
|
|
3997
4054
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3998
4055
|
}, {
|
|
3999
|
-
F:
|
|
4056
|
+
F: __dxlog_file16,
|
|
4000
4057
|
L: 111,
|
|
4001
4058
|
S: this,
|
|
4002
4059
|
C: (f, a) => f(...a)
|
|
4003
4060
|
});
|
|
4004
4061
|
void ctx.dispose();
|
|
4005
|
-
errors.throw(new
|
|
4062
|
+
errors.throw(new import_async15.TimeoutError(timeout, "Notarization timed out"));
|
|
4006
4063
|
}, timeout);
|
|
4007
4064
|
}
|
|
4008
4065
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
4009
4066
|
const peersTried = /* @__PURE__ */ new Set();
|
|
4010
|
-
const notarizeTask = new
|
|
4067
|
+
const notarizeTask = new import_async15.DeferredTask(ctx, async () => {
|
|
4011
4068
|
try {
|
|
4012
4069
|
if (this._extensions.size === 0) {
|
|
4013
4070
|
return;
|
|
@@ -4019,13 +4076,13 @@ var NotarizationPlugin = class {
|
|
|
4019
4076
|
import_log14.log.info("Exhausted all peers to notarize with", {
|
|
4020
4077
|
retryIn: retryTimeout
|
|
4021
4078
|
}, {
|
|
4022
|
-
F:
|
|
4079
|
+
F: __dxlog_file16,
|
|
4023
4080
|
L: 136,
|
|
4024
4081
|
S: this,
|
|
4025
4082
|
C: (f, a) => f(...a)
|
|
4026
4083
|
});
|
|
4027
4084
|
peersTried.clear();
|
|
4028
|
-
(0,
|
|
4085
|
+
(0, import_async15.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
4029
4086
|
return;
|
|
4030
4087
|
}
|
|
4031
4088
|
peersTried.add(peer);
|
|
@@ -4033,7 +4090,7 @@ var NotarizationPlugin = class {
|
|
|
4033
4090
|
peer: peer.localPeerId,
|
|
4034
4091
|
credentialId: credentials.map((credential) => credential.id)
|
|
4035
4092
|
}, {
|
|
4036
|
-
F:
|
|
4093
|
+
F: __dxlog_file16,
|
|
4037
4094
|
L: 143,
|
|
4038
4095
|
S: this,
|
|
4039
4096
|
C: (f, a) => f(...a)
|
|
@@ -4042,16 +4099,16 @@ var NotarizationPlugin = class {
|
|
|
4042
4099
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4043
4100
|
});
|
|
4044
4101
|
(0, import_log14.log)("success", void 0, {
|
|
4045
|
-
F:
|
|
4102
|
+
F: __dxlog_file16,
|
|
4046
4103
|
L: 147,
|
|
4047
4104
|
S: this,
|
|
4048
4105
|
C: (f, a) => f(...a)
|
|
4049
4106
|
});
|
|
4050
|
-
await (0,
|
|
4107
|
+
await (0, import_async15.sleep)(successDelay);
|
|
4051
4108
|
} catch (err) {
|
|
4052
4109
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4053
4110
|
import_log14.log.info("error notarizing (recoverable)", err, {
|
|
4054
|
-
F:
|
|
4111
|
+
F: __dxlog_file16,
|
|
4055
4112
|
L: 151,
|
|
4056
4113
|
S: this,
|
|
4057
4114
|
C: (f, a) => f(...a)
|
|
@@ -4064,12 +4121,12 @@ var NotarizationPlugin = class {
|
|
|
4064
4121
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
4065
4122
|
try {
|
|
4066
4123
|
await Promise.race([
|
|
4067
|
-
(0,
|
|
4124
|
+
(0, import_context12.rejectOnDispose)(ctx),
|
|
4068
4125
|
allNotarized,
|
|
4069
4126
|
errors.wait()
|
|
4070
4127
|
]);
|
|
4071
4128
|
(0, import_log14.log)("done", void 0, {
|
|
4072
|
-
F:
|
|
4129
|
+
F: __dxlog_file16,
|
|
4073
4130
|
L: 162,
|
|
4074
4131
|
S: this,
|
|
4075
4132
|
C: (f, a) => f(...a)
|
|
@@ -4091,7 +4148,7 @@ var NotarizationPlugin = class {
|
|
|
4091
4148
|
}
|
|
4092
4149
|
setWriter(writer) {
|
|
4093
4150
|
(0, import_invariant14.invariant)(!this._writer, "Writer already set.", {
|
|
4094
|
-
F:
|
|
4151
|
+
F: __dxlog_file16,
|
|
4095
4152
|
L: 181,
|
|
4096
4153
|
S: this,
|
|
4097
4154
|
A: [
|
|
@@ -4105,7 +4162,7 @@ var NotarizationPlugin = class {
|
|
|
4105
4162
|
if (this._processedCredentials.has(id)) {
|
|
4106
4163
|
return;
|
|
4107
4164
|
}
|
|
4108
|
-
await (0,
|
|
4165
|
+
await (0, import_util8.entry)(this._processCredentialsTriggers, id).orInsert(new import_async15.Trigger()).value.wait();
|
|
4109
4166
|
}
|
|
4110
4167
|
/**
|
|
4111
4168
|
* Requests from other peers to notarize credentials.
|
|
@@ -4116,7 +4173,7 @@ var NotarizationPlugin = class {
|
|
|
4116
4173
|
}
|
|
4117
4174
|
for (const credential of request.credentials ?? []) {
|
|
4118
4175
|
(0, import_invariant14.invariant)(credential.id, "Credential must have an id", {
|
|
4119
|
-
F:
|
|
4176
|
+
F: __dxlog_file16,
|
|
4120
4177
|
L: 200,
|
|
4121
4178
|
S: this,
|
|
4122
4179
|
A: [
|
|
@@ -4136,7 +4193,7 @@ var NotarizationPlugin = class {
|
|
|
4136
4193
|
(0, import_log14.log)("extension opened", {
|
|
4137
4194
|
peer: extension.localPeerId
|
|
4138
4195
|
}, {
|
|
4139
|
-
F:
|
|
4196
|
+
F: __dxlog_file16,
|
|
4140
4197
|
L: 211,
|
|
4141
4198
|
S: this,
|
|
4142
4199
|
C: (f, a) => f(...a)
|
|
@@ -4148,7 +4205,7 @@ var NotarizationPlugin = class {
|
|
|
4148
4205
|
(0, import_log14.log)("extension closed", {
|
|
4149
4206
|
peer: extension.localPeerId
|
|
4150
4207
|
}, {
|
|
4151
|
-
F:
|
|
4208
|
+
F: __dxlog_file16,
|
|
4152
4209
|
L: 216,
|
|
4153
4210
|
S: this,
|
|
4154
4211
|
C: (f, a) => f(...a)
|
|
@@ -4263,10 +4320,13 @@ function _using_ctx() {
|
|
|
4263
4320
|
}
|
|
4264
4321
|
};
|
|
4265
4322
|
}
|
|
4266
|
-
var
|
|
4323
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4267
4324
|
var DataSpace = class {
|
|
4268
4325
|
constructor(params) {
|
|
4269
|
-
this._ctx = new import_context10.Context(
|
|
4326
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4327
|
+
F: __dxlog_file17,
|
|
4328
|
+
L: 84
|
|
4329
|
+
});
|
|
4270
4330
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4271
4331
|
this._cache = void 0;
|
|
4272
4332
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
@@ -4296,7 +4356,7 @@ var DataSpace = class {
|
|
|
4296
4356
|
(0, import_log12.log)("new state", {
|
|
4297
4357
|
state: import_services12.SpaceState[this._state]
|
|
4298
4358
|
}, {
|
|
4299
|
-
F:
|
|
4359
|
+
F: __dxlog_file17,
|
|
4300
4360
|
L: 146,
|
|
4301
4361
|
S: this,
|
|
4302
4362
|
C: (f, a) => f(...a)
|
|
@@ -4351,12 +4411,15 @@ var DataSpace = class {
|
|
|
4351
4411
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4352
4412
|
await this._automergeSpaceState.open();
|
|
4353
4413
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4354
|
-
await this._inner.open(new import_context10.Context(
|
|
4414
|
+
await this._inner.open(new import_context10.Context(void 0, {
|
|
4415
|
+
F: __dxlog_file17,
|
|
4416
|
+
L: 215
|
|
4417
|
+
}));
|
|
4355
4418
|
this._state = import_services12.SpaceState.CONTROL_ONLY;
|
|
4356
4419
|
(0, import_log12.log)("new state", {
|
|
4357
4420
|
state: import_services12.SpaceState[this._state]
|
|
4358
4421
|
}, {
|
|
4359
|
-
F:
|
|
4422
|
+
F: __dxlog_file17,
|
|
4360
4423
|
L: 217,
|
|
4361
4424
|
S: this,
|
|
4362
4425
|
C: (f, a) => f(...a)
|
|
@@ -4374,13 +4437,16 @@ var DataSpace = class {
|
|
|
4374
4437
|
(0, import_log12.log)("new state", {
|
|
4375
4438
|
state: import_services12.SpaceState[this._state]
|
|
4376
4439
|
}, {
|
|
4377
|
-
F:
|
|
4440
|
+
F: __dxlog_file17,
|
|
4378
4441
|
L: 231,
|
|
4379
4442
|
S: this,
|
|
4380
4443
|
C: (f, a) => f(...a)
|
|
4381
4444
|
});
|
|
4382
4445
|
await this._ctx.dispose();
|
|
4383
|
-
this._ctx = new import_context10.Context(
|
|
4446
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4447
|
+
F: __dxlog_file17,
|
|
4448
|
+
L: 233
|
|
4449
|
+
});
|
|
4384
4450
|
await this.authVerifier.close();
|
|
4385
4451
|
await this._inner.close();
|
|
4386
4452
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
@@ -4407,7 +4473,7 @@ var DataSpace = class {
|
|
|
4407
4473
|
} catch (err) {
|
|
4408
4474
|
if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
|
|
4409
4475
|
(0, import_log12.log)("data pipeline initialization cancelled", err, {
|
|
4410
|
-
F:
|
|
4476
|
+
F: __dxlog_file17,
|
|
4411
4477
|
L: 265,
|
|
4412
4478
|
S: this,
|
|
4413
4479
|
C: (f, a) => f(...a)
|
|
@@ -4415,7 +4481,7 @@ var DataSpace = class {
|
|
|
4415
4481
|
return;
|
|
4416
4482
|
}
|
|
4417
4483
|
import_log12.log.error("Error initializing data pipeline", err, {
|
|
4418
|
-
F:
|
|
4484
|
+
F: __dxlog_file17,
|
|
4419
4485
|
L: 269,
|
|
4420
4486
|
S: this,
|
|
4421
4487
|
C: (f, a) => f(...a)
|
|
@@ -4424,7 +4490,7 @@ var DataSpace = class {
|
|
|
4424
4490
|
(0, import_log12.log)("new state", {
|
|
4425
4491
|
state: import_services12.SpaceState[this._state]
|
|
4426
4492
|
}, {
|
|
4427
|
-
F:
|
|
4493
|
+
F: __dxlog_file17,
|
|
4428
4494
|
L: 271,
|
|
4429
4495
|
S: this,
|
|
4430
4496
|
C: (f, a) => f(...a)
|
|
@@ -4444,7 +4510,7 @@ var DataSpace = class {
|
|
|
4444
4510
|
(0, import_log12.log)("new state", {
|
|
4445
4511
|
state: import_services12.SpaceState[this._state]
|
|
4446
4512
|
}, {
|
|
4447
|
-
F:
|
|
4513
|
+
F: __dxlog_file17,
|
|
4448
4514
|
L: 287,
|
|
4449
4515
|
S: this,
|
|
4450
4516
|
C: (f, a) => f(...a)
|
|
@@ -4461,7 +4527,7 @@ var DataSpace = class {
|
|
|
4461
4527
|
(0, import_log12.log)("new state", {
|
|
4462
4528
|
state: import_services12.SpaceState[this._state]
|
|
4463
4529
|
}, {
|
|
4464
|
-
F:
|
|
4530
|
+
F: __dxlog_file17,
|
|
4465
4531
|
L: 306,
|
|
4466
4532
|
S: this,
|
|
4467
4533
|
C: (f, a) => f(...a)
|
|
@@ -4477,7 +4543,7 @@ var DataSpace = class {
|
|
|
4477
4543
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4478
4544
|
await this._createWritableFeeds();
|
|
4479
4545
|
(0, import_log12.log)("writable feeds created", void 0, {
|
|
4480
|
-
F:
|
|
4546
|
+
F: __dxlog_file17,
|
|
4481
4547
|
L: 322,
|
|
4482
4548
|
S: this,
|
|
4483
4549
|
C: (f, a) => f(...a)
|
|
@@ -4540,12 +4606,11 @@ var DataSpace = class {
|
|
|
4540
4606
|
space: this.key,
|
|
4541
4607
|
rootUrl
|
|
4542
4608
|
}, {
|
|
4543
|
-
F:
|
|
4609
|
+
F: __dxlog_file17,
|
|
4544
4610
|
L: 388,
|
|
4545
4611
|
S: this,
|
|
4546
4612
|
C: (f, a) => f(...a)
|
|
4547
4613
|
});
|
|
4548
|
-
this._echoHost.replicateDocument(rootUrl);
|
|
4549
4614
|
const handle = this._echoHost.automergeRepo.find(rootUrl);
|
|
4550
4615
|
queueMicrotask(async () => {
|
|
4551
4616
|
try {
|
|
@@ -4572,8 +4637,10 @@ var DataSpace = class {
|
|
|
4572
4637
|
const root = await this._echoHost.openSpaceRoot(handle.url);
|
|
4573
4638
|
this._databaseRoot = root;
|
|
4574
4639
|
if (root.getVersion() !== import_echo_protocol.SpaceDocVersion.CURRENT) {
|
|
4575
|
-
this._state
|
|
4576
|
-
|
|
4640
|
+
if (this._state !== import_services12.SpaceState.REQUIRES_MIGRATION) {
|
|
4641
|
+
this._state = import_services12.SpaceState.REQUIRES_MIGRATION;
|
|
4642
|
+
this.stateUpdate.emit();
|
|
4643
|
+
}
|
|
4577
4644
|
} else {
|
|
4578
4645
|
if (this._state !== import_services12.SpaceState.READY) {
|
|
4579
4646
|
await this._enterReadyState();
|
|
@@ -4593,8 +4660,8 @@ var DataSpace = class {
|
|
|
4593
4660
|
rootUrl,
|
|
4594
4661
|
err
|
|
4595
4662
|
}, {
|
|
4596
|
-
F:
|
|
4597
|
-
L:
|
|
4663
|
+
F: __dxlog_file17,
|
|
4664
|
+
L: 433,
|
|
4598
4665
|
S: this,
|
|
4599
4666
|
C: (f, a) => f(...a)
|
|
4600
4667
|
});
|
|
@@ -4622,7 +4689,7 @@ var DataSpace = class {
|
|
|
4622
4689
|
return null;
|
|
4623
4690
|
}
|
|
4624
4691
|
const { newRoot } = await runEpochMigration(ctx, {
|
|
4625
|
-
|
|
4692
|
+
echoHost: this._echoHost,
|
|
4626
4693
|
spaceId: this.id,
|
|
4627
4694
|
spaceKey: this.key,
|
|
4628
4695
|
migration: options.migration,
|
|
@@ -4679,8 +4746,8 @@ var DataSpace = class {
|
|
|
4679
4746
|
(0, import_log12.log)("new state", {
|
|
4680
4747
|
state: import_services12.SpaceState[this._state]
|
|
4681
4748
|
}, {
|
|
4682
|
-
F:
|
|
4683
|
-
L:
|
|
4749
|
+
F: __dxlog_file17,
|
|
4750
|
+
L: 514,
|
|
4684
4751
|
S: this,
|
|
4685
4752
|
C: (f, a) => f(...a)
|
|
4686
4753
|
});
|
|
@@ -4809,7 +4876,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4809
4876
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4810
4877
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4811
4878
|
}
|
|
4812
|
-
var
|
|
4879
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4813
4880
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4814
4881
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4815
4882
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4823,9 +4890,12 @@ var DataSpaceManager = class {
|
|
|
4823
4890
|
this._echoHost = _echoHost;
|
|
4824
4891
|
this._invitationsManager = _invitationsManager;
|
|
4825
4892
|
this._params = _params;
|
|
4826
|
-
this._ctx = new
|
|
4827
|
-
|
|
4828
|
-
|
|
4893
|
+
this._ctx = new import_context13.Context(void 0, {
|
|
4894
|
+
F: __dxlog_file18,
|
|
4895
|
+
L: 104
|
|
4896
|
+
});
|
|
4897
|
+
this.updated = new import_async16.Event();
|
|
4898
|
+
this._spaces = new import_util9.ComplexMap(import_keys12.PublicKey.hash);
|
|
4829
4899
|
this._isOpen = false;
|
|
4830
4900
|
this._instanceId = import_keys12.PublicKey.random().toHex();
|
|
4831
4901
|
import_tracing6.trace.diagnostic({
|
|
@@ -4857,34 +4927,34 @@ var DataSpaceManager = class {
|
|
|
4857
4927
|
}
|
|
4858
4928
|
async open() {
|
|
4859
4929
|
(0, import_log15.log)("open", void 0, {
|
|
4860
|
-
F:
|
|
4861
|
-
L:
|
|
4930
|
+
F: __dxlog_file18,
|
|
4931
|
+
L: 156,
|
|
4862
4932
|
S: this,
|
|
4863
4933
|
C: (f, a) => f(...a)
|
|
4864
4934
|
});
|
|
4865
4935
|
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
|
|
4866
4936
|
id: this._instanceId
|
|
4867
4937
|
}), {
|
|
4868
|
-
F:
|
|
4869
|
-
L:
|
|
4938
|
+
F: __dxlog_file18,
|
|
4939
|
+
L: 157,
|
|
4870
4940
|
S: this,
|
|
4871
4941
|
C: (f, a) => f(...a)
|
|
4872
4942
|
});
|
|
4873
4943
|
(0, import_log15.log)("metadata loaded", {
|
|
4874
4944
|
spaces: this._metadataStore.spaces.length
|
|
4875
4945
|
}, {
|
|
4876
|
-
F:
|
|
4877
|
-
L:
|
|
4946
|
+
F: __dxlog_file18,
|
|
4947
|
+
L: 158,
|
|
4878
4948
|
S: this,
|
|
4879
4949
|
C: (f, a) => f(...a)
|
|
4880
4950
|
});
|
|
4881
|
-
await (0,
|
|
4951
|
+
await (0, import_util9.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
4882
4952
|
try {
|
|
4883
4953
|
(0, import_log15.log)("load space", {
|
|
4884
4954
|
spaceMetadata
|
|
4885
4955
|
}, {
|
|
4886
|
-
F:
|
|
4887
|
-
L:
|
|
4956
|
+
F: __dxlog_file18,
|
|
4957
|
+
L: 162,
|
|
4888
4958
|
S: this,
|
|
4889
4959
|
C: (f, a) => f(...a)
|
|
4890
4960
|
});
|
|
@@ -4894,8 +4964,8 @@ var DataSpaceManager = class {
|
|
|
4894
4964
|
spaceMetadata,
|
|
4895
4965
|
err
|
|
4896
4966
|
}, {
|
|
4897
|
-
F:
|
|
4898
|
-
L:
|
|
4967
|
+
F: __dxlog_file18,
|
|
4968
|
+
L: 165,
|
|
4899
4969
|
S: this,
|
|
4900
4970
|
C: (f, a) => f(...a)
|
|
4901
4971
|
});
|
|
@@ -4906,16 +4976,16 @@ var DataSpaceManager = class {
|
|
|
4906
4976
|
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
|
|
4907
4977
|
id: this._instanceId
|
|
4908
4978
|
}), {
|
|
4909
|
-
F:
|
|
4910
|
-
L:
|
|
4979
|
+
F: __dxlog_file18,
|
|
4980
|
+
L: 172,
|
|
4911
4981
|
S: this,
|
|
4912
4982
|
C: (f, a) => f(...a)
|
|
4913
4983
|
});
|
|
4914
4984
|
}
|
|
4915
4985
|
async close() {
|
|
4916
4986
|
(0, import_log15.log)("close", void 0, {
|
|
4917
|
-
F:
|
|
4918
|
-
L:
|
|
4987
|
+
F: __dxlog_file18,
|
|
4988
|
+
L: 177,
|
|
4919
4989
|
S: this,
|
|
4920
4990
|
C: (f, a) => f(...a)
|
|
4921
4991
|
});
|
|
@@ -4931,8 +5001,8 @@ var DataSpaceManager = class {
|
|
|
4931
5001
|
*/
|
|
4932
5002
|
async createSpace() {
|
|
4933
5003
|
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
4934
|
-
F:
|
|
4935
|
-
L:
|
|
5004
|
+
F: __dxlog_file18,
|
|
5005
|
+
L: 191,
|
|
4936
5006
|
S: this,
|
|
4937
5007
|
A: [
|
|
4938
5008
|
"this._isOpen",
|
|
@@ -4952,8 +5022,8 @@ var DataSpaceManager = class {
|
|
|
4952
5022
|
(0, import_log15.log)("creating space...", {
|
|
4953
5023
|
spaceKey
|
|
4954
5024
|
}, {
|
|
4955
|
-
F:
|
|
4956
|
-
L:
|
|
5025
|
+
F: __dxlog_file18,
|
|
5026
|
+
L: 203,
|
|
4957
5027
|
S: this,
|
|
4958
5028
|
C: (f, a) => f(...a)
|
|
4959
5029
|
});
|
|
@@ -4964,8 +5034,8 @@ var DataSpaceManager = class {
|
|
|
4964
5034
|
await this._metadataStore.addSpace(metadata);
|
|
4965
5035
|
const memberCredential = credentials[1];
|
|
4966
5036
|
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4967
|
-
F:
|
|
4968
|
-
L:
|
|
5037
|
+
F: __dxlog_file18,
|
|
5038
|
+
L: 213,
|
|
4969
5039
|
S: this,
|
|
4970
5040
|
A: [
|
|
4971
5041
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -4982,13 +5052,13 @@ var DataSpaceManager = class {
|
|
|
4982
5052
|
return false;
|
|
4983
5053
|
}
|
|
4984
5054
|
switch (space.databaseRoot.getVersion()) {
|
|
4985
|
-
case
|
|
5055
|
+
case import_echo_protocol3.SpaceDocVersion.CURRENT: {
|
|
4986
5056
|
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_echo_schema2.TYPE_PROPERTIES) ?? [];
|
|
4987
5057
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
4988
5058
|
}
|
|
4989
|
-
case
|
|
5059
|
+
case import_echo_protocol3.SpaceDocVersion.LEGACY: {
|
|
4990
5060
|
const convertedDoc = await (0, import_echo_db2.convertLegacyReferences)(space.databaseRoot.docSync());
|
|
4991
|
-
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc,
|
|
5061
|
+
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc, import_echo_protocol3.LEGACY_TYPE_PROPERTIES) ?? [];
|
|
4992
5062
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
4993
5063
|
}
|
|
4994
5064
|
default:
|
|
@@ -4996,8 +5066,8 @@ var DataSpaceManager = class {
|
|
|
4996
5066
|
version: space.databaseRoot.getVersion(),
|
|
4997
5067
|
spaceId: space.id
|
|
4998
5068
|
}, {
|
|
4999
|
-
F:
|
|
5000
|
-
L:
|
|
5069
|
+
F: __dxlog_file18,
|
|
5070
|
+
L: 238,
|
|
5001
5071
|
S: this,
|
|
5002
5072
|
C: (f, a) => f(...a)
|
|
5003
5073
|
});
|
|
@@ -5009,7 +5079,7 @@ var DataSpaceManager = class {
|
|
|
5009
5079
|
const document = await this._getSpaceRootDocument(space);
|
|
5010
5080
|
const properties = {
|
|
5011
5081
|
system: {
|
|
5012
|
-
type: (0,
|
|
5082
|
+
type: (0, import_echo_protocol3.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
|
|
5013
5083
|
},
|
|
5014
5084
|
data: {
|
|
5015
5085
|
[DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
|
|
@@ -5020,7 +5090,7 @@ var DataSpaceManager = class {
|
|
|
5020
5090
|
};
|
|
5021
5091
|
const propertiesId = (0, import_echo_schema2.generateEchoId)();
|
|
5022
5092
|
document.change((doc) => {
|
|
5023
|
-
(0,
|
|
5093
|
+
(0, import_util9.assignDeep)(doc, [
|
|
5024
5094
|
"objects",
|
|
5025
5095
|
propertiesId
|
|
5026
5096
|
], properties);
|
|
@@ -5031,8 +5101,8 @@ var DataSpaceManager = class {
|
|
|
5031
5101
|
async _getSpaceRootDocument(space) {
|
|
5032
5102
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5033
5103
|
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5034
|
-
F:
|
|
5035
|
-
L:
|
|
5104
|
+
F: __dxlog_file18,
|
|
5105
|
+
L: 271,
|
|
5036
5106
|
S: this,
|
|
5037
5107
|
A: [
|
|
5038
5108
|
"automergeIndex",
|
|
@@ -5048,14 +5118,14 @@ var DataSpaceManager = class {
|
|
|
5048
5118
|
(0, import_log15.log)("accept space", {
|
|
5049
5119
|
opts
|
|
5050
5120
|
}, {
|
|
5051
|
-
F:
|
|
5052
|
-
L:
|
|
5121
|
+
F: __dxlog_file18,
|
|
5122
|
+
L: 280,
|
|
5053
5123
|
S: this,
|
|
5054
5124
|
C: (f, a) => f(...a)
|
|
5055
5125
|
});
|
|
5056
5126
|
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
5057
|
-
F:
|
|
5058
|
-
L:
|
|
5127
|
+
F: __dxlog_file18,
|
|
5128
|
+
L: 281,
|
|
5059
5129
|
S: this,
|
|
5060
5130
|
A: [
|
|
5061
5131
|
"this._isOpen",
|
|
@@ -5063,8 +5133,8 @@ var DataSpaceManager = class {
|
|
|
5063
5133
|
]
|
|
5064
5134
|
});
|
|
5065
5135
|
(0, import_invariant15.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5066
|
-
F:
|
|
5067
|
-
L:
|
|
5136
|
+
F: __dxlog_file18,
|
|
5137
|
+
L: 282,
|
|
5068
5138
|
S: this,
|
|
5069
5139
|
A: [
|
|
5070
5140
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -5084,23 +5154,72 @@ var DataSpaceManager = class {
|
|
|
5084
5154
|
this.updated.emit();
|
|
5085
5155
|
return space;
|
|
5086
5156
|
}
|
|
5157
|
+
async admitMember(options) {
|
|
5158
|
+
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5159
|
+
(0, import_invariant15.invariant)(space, void 0, {
|
|
5160
|
+
F: __dxlog_file18,
|
|
5161
|
+
L: 302,
|
|
5162
|
+
S: this,
|
|
5163
|
+
A: [
|
|
5164
|
+
"space",
|
|
5165
|
+
""
|
|
5166
|
+
]
|
|
5167
|
+
});
|
|
5168
|
+
if (space.spaceState.getMemberRole(options.identityKey) !== import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5169
|
+
throw new import_protocols11.AlreadyJoinedError();
|
|
5170
|
+
}
|
|
5171
|
+
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);
|
|
5172
|
+
(0, import_invariant15.invariant)(credentials[0].credential, void 0, {
|
|
5173
|
+
F: __dxlog_file18,
|
|
5174
|
+
L: 321,
|
|
5175
|
+
S: this,
|
|
5176
|
+
A: [
|
|
5177
|
+
"credentials[0].credential",
|
|
5178
|
+
""
|
|
5179
|
+
]
|
|
5180
|
+
});
|
|
5181
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5182
|
+
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5183
|
+
F: __dxlog_file18,
|
|
5184
|
+
L: 323,
|
|
5185
|
+
S: this,
|
|
5186
|
+
A: [
|
|
5187
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5188
|
+
""
|
|
5189
|
+
]
|
|
5190
|
+
});
|
|
5191
|
+
await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5192
|
+
return spaceMemberCredential;
|
|
5193
|
+
}
|
|
5087
5194
|
/**
|
|
5088
5195
|
* Wait until the space data pipeline is fully initialized.
|
|
5089
5196
|
* Used by invitation handler.
|
|
5090
5197
|
* TODO(dmaretskyi): Consider removing.
|
|
5091
5198
|
*/
|
|
5092
5199
|
async waitUntilSpaceReady(spaceKey) {
|
|
5093
|
-
await (0,
|
|
5200
|
+
await (0, import_context13.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
5094
5201
|
const space = this._spaces.get(spaceKey);
|
|
5095
5202
|
return !!space && space.state === import_services14.SpaceState.READY;
|
|
5096
5203
|
}));
|
|
5097
5204
|
}
|
|
5205
|
+
async requestSpaceAdmissionCredential(spaceKey) {
|
|
5206
|
+
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
5207
|
+
spaceKey,
|
|
5208
|
+
identityKey: this._signingContext.identityKey,
|
|
5209
|
+
timeout: 15e3,
|
|
5210
|
+
swarmIdentity: {
|
|
5211
|
+
peerKey: this._signingContext.deviceKey,
|
|
5212
|
+
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5213
|
+
credentialAuthenticator: async () => true
|
|
5214
|
+
}
|
|
5215
|
+
});
|
|
5216
|
+
}
|
|
5098
5217
|
async _constructSpace(metadata) {
|
|
5099
5218
|
(0, import_log15.log)("construct space", {
|
|
5100
5219
|
metadata
|
|
5101
5220
|
}, {
|
|
5102
|
-
F:
|
|
5103
|
-
L:
|
|
5221
|
+
F: __dxlog_file18,
|
|
5222
|
+
L: 358,
|
|
5104
5223
|
S: this,
|
|
5105
5224
|
C: (f, a) => f(...a)
|
|
5106
5225
|
});
|
|
@@ -5125,9 +5244,10 @@ var DataSpaceManager = class {
|
|
|
5125
5244
|
swarmIdentity: {
|
|
5126
5245
|
peerKey: this._signingContext.deviceKey,
|
|
5127
5246
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5128
|
-
credentialAuthenticator: (0,
|
|
5247
|
+
credentialAuthenticator: (0, import_util9.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
5129
5248
|
},
|
|
5130
5249
|
onAuthorizedConnection: (session) => {
|
|
5250
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline4.CredentialServerExtension(space));
|
|
5131
5251
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5132
5252
|
remotePeerId: session.remotePeerId
|
|
5133
5253
|
}));
|
|
@@ -5137,8 +5257,8 @@ var DataSpaceManager = class {
|
|
|
5137
5257
|
},
|
|
5138
5258
|
onAuthFailure: () => {
|
|
5139
5259
|
import_log15.log.warn("auth failure", void 0, {
|
|
5140
|
-
F:
|
|
5141
|
-
L:
|
|
5260
|
+
F: __dxlog_file18,
|
|
5261
|
+
L: 396,
|
|
5142
5262
|
S: this,
|
|
5143
5263
|
C: (f, a) => f(...a)
|
|
5144
5264
|
});
|
|
@@ -5170,8 +5290,8 @@ var DataSpaceManager = class {
|
|
|
5170
5290
|
(0, import_log15.log)("before space ready", {
|
|
5171
5291
|
space: space.key
|
|
5172
5292
|
}, {
|
|
5173
|
-
F:
|
|
5174
|
-
L:
|
|
5293
|
+
F: __dxlog_file18,
|
|
5294
|
+
L: 423,
|
|
5175
5295
|
S: this,
|
|
5176
5296
|
C: (f, a) => f(...a)
|
|
5177
5297
|
});
|
|
@@ -5181,8 +5301,8 @@ var DataSpaceManager = class {
|
|
|
5181
5301
|
space: space.key,
|
|
5182
5302
|
open: this._isOpen
|
|
5183
5303
|
}, {
|
|
5184
|
-
F:
|
|
5185
|
-
L:
|
|
5304
|
+
F: __dxlog_file18,
|
|
5305
|
+
L: 426,
|
|
5186
5306
|
S: this,
|
|
5187
5307
|
C: (f, a) => f(...a)
|
|
5188
5308
|
});
|
|
@@ -5200,8 +5320,8 @@ var DataSpaceManager = class {
|
|
|
5200
5320
|
(0, import_log15.log)("before space close", {
|
|
5201
5321
|
space: space.key
|
|
5202
5322
|
}, {
|
|
5203
|
-
F:
|
|
5204
|
-
L:
|
|
5323
|
+
F: __dxlog_file18,
|
|
5324
|
+
L: 434,
|
|
5205
5325
|
S: this,
|
|
5206
5326
|
C: (f, a) => f(...a)
|
|
5207
5327
|
});
|
|
@@ -5229,7 +5349,7 @@ var DataSpaceManager = class {
|
|
|
5229
5349
|
const peers = presence.getPeersByIdentityKey(member.key);
|
|
5230
5350
|
const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
|
|
5231
5351
|
const sessionsToClose = sessions.filter((s) => {
|
|
5232
|
-
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus ===
|
|
5352
|
+
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
|
|
5233
5353
|
});
|
|
5234
5354
|
sessionsToClose.forEach((session) => {
|
|
5235
5355
|
void session.close().catch(import_log15.log.error);
|
|
@@ -5241,8 +5361,8 @@ var DataSpaceManager = class {
|
|
|
5241
5361
|
peersOnline: presence.getPeersOnline().length,
|
|
5242
5362
|
closedSessions
|
|
5243
5363
|
}, {
|
|
5244
|
-
F:
|
|
5245
|
-
L:
|
|
5364
|
+
F: __dxlog_file18,
|
|
5365
|
+
L: 470,
|
|
5246
5366
|
S: this,
|
|
5247
5367
|
C: (f, a) => f(...a)
|
|
5248
5368
|
});
|
|
@@ -5256,8 +5376,8 @@ var DataSpaceManager = class {
|
|
|
5256
5376
|
(0, import_log15.log)("closing a session with a removed peer", {
|
|
5257
5377
|
peerId: peerState.peerId
|
|
5258
5378
|
}, {
|
|
5259
|
-
F:
|
|
5260
|
-
L:
|
|
5379
|
+
F: __dxlog_file18,
|
|
5380
|
+
L: 484,
|
|
5261
5381
|
S: this,
|
|
5262
5382
|
C: (f, a) => f(...a)
|
|
5263
5383
|
});
|
|
@@ -5302,21 +5422,21 @@ var DataSpaceManager = class {
|
|
|
5302
5422
|
}
|
|
5303
5423
|
};
|
|
5304
5424
|
_ts_decorate5([
|
|
5305
|
-
|
|
5425
|
+
import_async16.synchronized
|
|
5306
5426
|
], DataSpaceManager.prototype, "open", null);
|
|
5307
5427
|
_ts_decorate5([
|
|
5308
|
-
|
|
5428
|
+
import_async16.synchronized
|
|
5309
5429
|
], DataSpaceManager.prototype, "close", null);
|
|
5310
5430
|
_ts_decorate5([
|
|
5311
|
-
|
|
5431
|
+
import_async16.synchronized
|
|
5312
5432
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
5313
5433
|
_ts_decorate5([
|
|
5314
|
-
|
|
5434
|
+
import_async16.synchronized
|
|
5315
5435
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
5316
5436
|
DataSpaceManager = _ts_decorate5([
|
|
5317
|
-
(0,
|
|
5437
|
+
(0, import_async16.trackLeaks)("open", "close")
|
|
5318
5438
|
], DataSpaceManager);
|
|
5319
|
-
var
|
|
5439
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5320
5440
|
var SpacesServiceImpl = class {
|
|
5321
5441
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5322
5442
|
this._identityManager = _identityManager;
|
|
@@ -5360,8 +5480,8 @@ var SpacesServiceImpl = class {
|
|
|
5360
5480
|
}
|
|
5361
5481
|
const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5362
5482
|
(0, import_invariant16.invariant)(credentials[0].credential, void 0, {
|
|
5363
|
-
F:
|
|
5364
|
-
L:
|
|
5483
|
+
F: __dxlog_file19,
|
|
5484
|
+
L: 102,
|
|
5365
5485
|
S: this,
|
|
5366
5486
|
A: [
|
|
5367
5487
|
"credentials[0].credential",
|
|
@@ -5370,26 +5490,26 @@ var SpacesServiceImpl = class {
|
|
|
5370
5490
|
});
|
|
5371
5491
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5372
5492
|
(0, import_invariant16.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5373
|
-
F:
|
|
5374
|
-
L:
|
|
5493
|
+
F: __dxlog_file19,
|
|
5494
|
+
L: 104,
|
|
5375
5495
|
S: this,
|
|
5376
5496
|
A: [
|
|
5377
5497
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5378
5498
|
""
|
|
5379
5499
|
]
|
|
5380
5500
|
});
|
|
5381
|
-
await (0,
|
|
5501
|
+
await (0, import_feed_store5.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5382
5502
|
}
|
|
5383
5503
|
querySpaces() {
|
|
5384
5504
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
5385
|
-
const scheduler = new
|
|
5505
|
+
const scheduler = new import_async17.UpdateScheduler(ctx, async () => {
|
|
5386
5506
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5387
5507
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
5388
5508
|
(0, import_log16.log)("update", {
|
|
5389
5509
|
spaces
|
|
5390
5510
|
}, {
|
|
5391
|
-
F:
|
|
5392
|
-
L:
|
|
5511
|
+
F: __dxlog_file19,
|
|
5512
|
+
L: 115,
|
|
5393
5513
|
S: this,
|
|
5394
5514
|
C: (f, a) => f(...a)
|
|
5395
5515
|
});
|
|
@@ -5400,14 +5520,22 @@ var SpacesServiceImpl = class {
|
|
|
5400
5520
|
}, {
|
|
5401
5521
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
5402
5522
|
});
|
|
5403
|
-
(0,
|
|
5523
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5404
5524
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5405
|
-
const subscriptions = new
|
|
5525
|
+
const subscriptions = new import_async17.EventSubscriptions();
|
|
5406
5526
|
ctx.onDispose(() => subscriptions.clear());
|
|
5407
5527
|
const subscribeSpaces = () => {
|
|
5408
5528
|
subscriptions.clear();
|
|
5409
5529
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
5410
|
-
|
|
5530
|
+
let lastState;
|
|
5531
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => {
|
|
5532
|
+
if (space.state !== lastState) {
|
|
5533
|
+
scheduler.forceTrigger();
|
|
5534
|
+
} else {
|
|
5535
|
+
scheduler.trigger();
|
|
5536
|
+
}
|
|
5537
|
+
lastState = space.state;
|
|
5538
|
+
}));
|
|
5411
5539
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
5412
5540
|
subscriptions.add(space.automergeSpaceState.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
5413
5541
|
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
@@ -5434,7 +5562,7 @@ var SpacesServiceImpl = class {
|
|
|
5434
5562
|
}
|
|
5435
5563
|
subscribeMessages({ spaceKey, channel }) {
|
|
5436
5564
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
5437
|
-
(0,
|
|
5565
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5438
5566
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5439
5567
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5440
5568
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -5453,7 +5581,7 @@ var SpacesServiceImpl = class {
|
|
|
5453
5581
|
}
|
|
5454
5582
|
};
|
|
5455
5583
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
5456
|
-
(0,
|
|
5584
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5457
5585
|
await space.spaceState.addCredentialProcessor(processor);
|
|
5458
5586
|
if (noTail) {
|
|
5459
5587
|
close();
|
|
@@ -5472,8 +5600,8 @@ var SpacesServiceImpl = class {
|
|
|
5472
5600
|
});
|
|
5473
5601
|
} else {
|
|
5474
5602
|
(0, import_invariant16.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5475
|
-
F:
|
|
5476
|
-
L:
|
|
5603
|
+
F: __dxlog_file19,
|
|
5604
|
+
L: 213,
|
|
5477
5605
|
S: this,
|
|
5478
5606
|
A: [
|
|
5479
5607
|
"!credential.id",
|
|
@@ -5481,8 +5609,8 @@ var SpacesServiceImpl = class {
|
|
|
5481
5609
|
]
|
|
5482
5610
|
});
|
|
5483
5611
|
(0, import_invariant16.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
5484
|
-
F:
|
|
5485
|
-
L:
|
|
5612
|
+
F: __dxlog_file19,
|
|
5613
|
+
L: 214,
|
|
5486
5614
|
S: this,
|
|
5487
5615
|
A: [
|
|
5488
5616
|
"this._identityManager.identity",
|
|
@@ -5491,8 +5619,8 @@ var SpacesServiceImpl = class {
|
|
|
5491
5619
|
});
|
|
5492
5620
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5493
5621
|
(0, import_invariant16.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5494
|
-
F:
|
|
5495
|
-
L:
|
|
5622
|
+
F: __dxlog_file19,
|
|
5623
|
+
L: 216,
|
|
5496
5624
|
S: this,
|
|
5497
5625
|
A: [
|
|
5498
5626
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5522,6 +5650,59 @@ var SpacesServiceImpl = class {
|
|
|
5522
5650
|
epochCredential: credential ?? void 0
|
|
5523
5651
|
};
|
|
5524
5652
|
}
|
|
5653
|
+
async admitContact(request) {
|
|
5654
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5655
|
+
await dataSpaceManager.admitMember({
|
|
5656
|
+
spaceKey: request.spaceKey,
|
|
5657
|
+
identityKey: request.contact.identityKey,
|
|
5658
|
+
role: request.role
|
|
5659
|
+
});
|
|
5660
|
+
}
|
|
5661
|
+
async joinBySpaceKey({ spaceKey }) {
|
|
5662
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5663
|
+
const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
|
|
5664
|
+
return this._joinByAdmission({
|
|
5665
|
+
credential
|
|
5666
|
+
});
|
|
5667
|
+
}
|
|
5668
|
+
async _joinByAdmission({ credential }) {
|
|
5669
|
+
const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
|
|
5670
|
+
(0, import_invariant16.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
5671
|
+
F: __dxlog_file19,
|
|
5672
|
+
L: 250,
|
|
5673
|
+
S: this,
|
|
5674
|
+
A: [
|
|
5675
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5676
|
+
"'Invalid credential'"
|
|
5677
|
+
]
|
|
5678
|
+
});
|
|
5679
|
+
const myIdentity = this._identityManager.identity;
|
|
5680
|
+
(0, import_invariant16.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
5681
|
+
F: __dxlog_file19,
|
|
5682
|
+
L: 252,
|
|
5683
|
+
S: this,
|
|
5684
|
+
A: [
|
|
5685
|
+
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
5686
|
+
""
|
|
5687
|
+
]
|
|
5688
|
+
});
|
|
5689
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5690
|
+
let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
|
|
5691
|
+
if (!dataSpace) {
|
|
5692
|
+
dataSpace = await dataSpaceManager.acceptSpace({
|
|
5693
|
+
spaceKey: assertion.spaceKey,
|
|
5694
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
5695
|
+
});
|
|
5696
|
+
await myIdentity.controlPipeline.writer.write({
|
|
5697
|
+
credential: {
|
|
5698
|
+
credential
|
|
5699
|
+
}
|
|
5700
|
+
});
|
|
5701
|
+
}
|
|
5702
|
+
return {
|
|
5703
|
+
space: this._serializeSpace(dataSpace)
|
|
5704
|
+
};
|
|
5705
|
+
}
|
|
5525
5706
|
_serializeSpace(space) {
|
|
5526
5707
|
return {
|
|
5527
5708
|
id: space.id,
|
|
@@ -5539,7 +5720,8 @@ var SpacesServiceImpl = class {
|
|
|
5539
5720
|
startDataTimeframe: void 0,
|
|
5540
5721
|
currentDataTimeframe: void 0,
|
|
5541
5722
|
targetDataTimeframe: void 0,
|
|
5542
|
-
totalDataTimeframe: void 0
|
|
5723
|
+
totalDataTimeframe: void 0,
|
|
5724
|
+
spaceRootUrl: space.databaseRoot?.url
|
|
5543
5725
|
},
|
|
5544
5726
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
5545
5727
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
@@ -5591,8 +5773,8 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5591
5773
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5592
5774
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5593
5775
|
}
|
|
5594
|
-
var
|
|
5595
|
-
var ServiceContext = class extends
|
|
5776
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5777
|
+
var ServiceContext = class extends import_context14.Resource {
|
|
5596
5778
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5597
5779
|
super();
|
|
5598
5780
|
this.storage = storage;
|
|
@@ -5600,15 +5782,15 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5600
5782
|
this.networkManager = networkManager;
|
|
5601
5783
|
this.signalManager = signalManager;
|
|
5602
5784
|
this._runtimeParams = _runtimeParams;
|
|
5603
|
-
this.initialized = new
|
|
5785
|
+
this.initialized = new import_async18.Trigger();
|
|
5604
5786
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5605
5787
|
this._instanceId = import_keys13.PublicKey.random().toHex();
|
|
5606
5788
|
this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
|
|
5607
5789
|
this.snapshotStore = new import_echo_pipeline5.SnapshotStore(storage.createDirectory("snapshots"));
|
|
5608
5790
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
5609
5791
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
5610
|
-
this.feedStore = new
|
|
5611
|
-
factory: new
|
|
5792
|
+
this.feedStore = new import_feed_store6.FeedStore({
|
|
5793
|
+
factory: new import_feed_store6.FeedFactory({
|
|
5612
5794
|
root: storage.createDirectory("feeds"),
|
|
5613
5795
|
signer: this.keyring,
|
|
5614
5796
|
hypercore: {
|
|
@@ -5635,7 +5817,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5635
5817
|
async _open(ctx) {
|
|
5636
5818
|
await this._checkStorageVersion();
|
|
5637
5819
|
(0, import_log17.log)("opening...", void 0, {
|
|
5638
|
-
F:
|
|
5820
|
+
F: __dxlog_file20,
|
|
5639
5821
|
L: 149,
|
|
5640
5822
|
S: this,
|
|
5641
5823
|
C: (f, a) => f(...a)
|
|
@@ -5643,7 +5825,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5643
5825
|
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
|
|
5644
5826
|
id: this._instanceId
|
|
5645
5827
|
}), {
|
|
5646
|
-
F:
|
|
5828
|
+
F: __dxlog_file20,
|
|
5647
5829
|
L: 150,
|
|
5648
5830
|
S: this,
|
|
5649
5831
|
C: (f, a) => f(...a)
|
|
@@ -5661,7 +5843,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5661
5843
|
(0, import_log17.log)("loaded persistent invitations", {
|
|
5662
5844
|
count: loadedInvitations.invitations?.length
|
|
5663
5845
|
}, {
|
|
5664
|
-
F:
|
|
5846
|
+
F: __dxlog_file20,
|
|
5665
5847
|
L: 163,
|
|
5666
5848
|
S: this,
|
|
5667
5849
|
C: (f, a) => f(...a)
|
|
@@ -5669,13 +5851,13 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5669
5851
|
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
|
|
5670
5852
|
id: this._instanceId
|
|
5671
5853
|
}), {
|
|
5672
|
-
F:
|
|
5854
|
+
F: __dxlog_file20,
|
|
5673
5855
|
L: 165,
|
|
5674
5856
|
S: this,
|
|
5675
5857
|
C: (f, a) => f(...a)
|
|
5676
5858
|
});
|
|
5677
5859
|
(0, import_log17.log)("opened", void 0, {
|
|
5678
|
-
F:
|
|
5860
|
+
F: __dxlog_file20,
|
|
5679
5861
|
L: 166,
|
|
5680
5862
|
S: this,
|
|
5681
5863
|
C: (f, a) => f(...a)
|
|
@@ -5683,7 +5865,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5683
5865
|
}
|
|
5684
5866
|
async _close(ctx) {
|
|
5685
5867
|
(0, import_log17.log)("closing...", void 0, {
|
|
5686
|
-
F:
|
|
5868
|
+
F: __dxlog_file20,
|
|
5687
5869
|
L: 170,
|
|
5688
5870
|
S: this,
|
|
5689
5871
|
C: (f, a) => f(...a)
|
|
@@ -5700,7 +5882,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5700
5882
|
await this.networkManager.close();
|
|
5701
5883
|
await this.signalManager.close();
|
|
5702
5884
|
(0, import_log17.log)("closed", void 0, {
|
|
5703
|
-
F:
|
|
5885
|
+
F: __dxlog_file20,
|
|
5704
5886
|
L: 182,
|
|
5705
5887
|
S: this,
|
|
5706
5888
|
C: (f, a) => f(...a)
|
|
@@ -5708,13 +5890,16 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5708
5890
|
}
|
|
5709
5891
|
async createIdentity(params = {}) {
|
|
5710
5892
|
const identity = await this.identityManager.createIdentity(params);
|
|
5711
|
-
await this._initialize(new
|
|
5893
|
+
await this._initialize(new import_context14.Context(void 0, {
|
|
5894
|
+
F: __dxlog_file20,
|
|
5895
|
+
L: 187
|
|
5896
|
+
}));
|
|
5712
5897
|
return identity;
|
|
5713
5898
|
}
|
|
5714
5899
|
getInvitationHandler(invitation) {
|
|
5715
5900
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5716
5901
|
(0, import_invariant17.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5717
|
-
F:
|
|
5902
|
+
F: __dxlog_file20,
|
|
5718
5903
|
L: 193,
|
|
5719
5904
|
S: this,
|
|
5720
5905
|
A: [
|
|
@@ -5734,7 +5919,10 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5734
5919
|
}
|
|
5735
5920
|
async _acceptIdentity(params) {
|
|
5736
5921
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5737
|
-
await this._initialize(new
|
|
5922
|
+
await this._initialize(new import_context14.Context(void 0, {
|
|
5923
|
+
F: __dxlog_file20,
|
|
5924
|
+
L: 209
|
|
5925
|
+
}));
|
|
5738
5926
|
return identity;
|
|
5739
5927
|
}
|
|
5740
5928
|
async _checkStorageVersion() {
|
|
@@ -5746,7 +5934,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5746
5934
|
// Called when identity is created.
|
|
5747
5935
|
async _initialize(ctx) {
|
|
5748
5936
|
(0, import_log17.log)("initializing spaces...", void 0, {
|
|
5749
|
-
F:
|
|
5937
|
+
F: __dxlog_file20,
|
|
5750
5938
|
L: 224,
|
|
5751
5939
|
S: this,
|
|
5752
5940
|
C: (f, a) => f(...a)
|
|
@@ -5769,7 +5957,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5769
5957
|
await this.dataSpaceManager.open();
|
|
5770
5958
|
this._handlerFactories.set(import_services16.Invitation.Kind.SPACE, (invitation) => {
|
|
5771
5959
|
(0, import_invariant17.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5772
|
-
F:
|
|
5960
|
+
F: __dxlog_file20,
|
|
5773
5961
|
L: 249,
|
|
5774
5962
|
S: this,
|
|
5775
5963
|
A: [
|
|
@@ -5793,7 +5981,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5793
5981
|
(0, import_log17.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5794
5982
|
details: assertion
|
|
5795
5983
|
}, {
|
|
5796
|
-
F:
|
|
5984
|
+
F: __dxlog_file20,
|
|
5797
5985
|
L: 265,
|
|
5798
5986
|
S: this,
|
|
5799
5987
|
C: (f, a) => f(...a)
|
|
@@ -5804,7 +5992,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5804
5992
|
(0, import_log17.log)("space already exists, ignoring space admission", {
|
|
5805
5993
|
details: assertion
|
|
5806
5994
|
}, {
|
|
5807
|
-
F:
|
|
5995
|
+
F: __dxlog_file20,
|
|
5808
5996
|
L: 269,
|
|
5809
5997
|
S: this,
|
|
5810
5998
|
C: (f, a) => f(...a)
|
|
@@ -5815,7 +6003,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5815
6003
|
(0, import_log17.log)("accepting space recorded in halo", {
|
|
5816
6004
|
details: assertion
|
|
5817
6005
|
}, {
|
|
5818
|
-
F:
|
|
6006
|
+
F: __dxlog_file20,
|
|
5819
6007
|
L: 274,
|
|
5820
6008
|
S: this,
|
|
5821
6009
|
C: (f, a) => f(...a)
|
|
@@ -5826,7 +6014,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5826
6014
|
});
|
|
5827
6015
|
} catch (err) {
|
|
5828
6016
|
import_log17.log.catch(err, void 0, {
|
|
5829
|
-
F:
|
|
6017
|
+
F: __dxlog_file20,
|
|
5830
6018
|
L: 280,
|
|
5831
6019
|
S: this,
|
|
5832
6020
|
C: (f, a) => f(...a)
|
|
@@ -5844,7 +6032,7 @@ _ts_decorate6([
|
|
|
5844
6032
|
import_tracing8.trace.span()
|
|
5845
6033
|
], ServiceContext.prototype, "_initialize", null);
|
|
5846
6034
|
ServiceContext = _ts_decorate6([
|
|
5847
|
-
(0,
|
|
6035
|
+
(0, import_util10.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
5848
6036
|
import_tracing8.trace.resource()
|
|
5849
6037
|
], ServiceContext);
|
|
5850
6038
|
var ServiceRegistry = class {
|
|
@@ -5879,7 +6067,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5879
6067
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5880
6068
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5881
6069
|
}
|
|
5882
|
-
var
|
|
6070
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
5883
6071
|
var Lock = class {
|
|
5884
6072
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
5885
6073
|
this._lockPath = lockPath;
|
|
@@ -5891,7 +6079,7 @@ var Lock = class {
|
|
|
5891
6079
|
}
|
|
5892
6080
|
async acquire() {
|
|
5893
6081
|
(0, import_log18.log)("acquiring lock...", void 0, {
|
|
5894
|
-
F:
|
|
6082
|
+
F: __dxlog_file21,
|
|
5895
6083
|
L: 32,
|
|
5896
6084
|
S: this,
|
|
5897
6085
|
C: (f, a) => f(...a)
|
|
@@ -5899,7 +6087,7 @@ var Lock = class {
|
|
|
5899
6087
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
5900
6088
|
await this._onAcquire?.();
|
|
5901
6089
|
(0, import_log18.log)("acquired lock", void 0, {
|
|
5902
|
-
F:
|
|
6090
|
+
F: __dxlog_file21,
|
|
5903
6091
|
L: 37,
|
|
5904
6092
|
S: this,
|
|
5905
6093
|
C: (f, a) => f(...a)
|
|
@@ -5908,7 +6096,7 @@ var Lock = class {
|
|
|
5908
6096
|
async release() {
|
|
5909
6097
|
await this._onRelease?.();
|
|
5910
6098
|
(0, import_invariant18.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
5911
|
-
F:
|
|
6099
|
+
F: __dxlog_file21,
|
|
5912
6100
|
L: 42,
|
|
5913
6101
|
S: this,
|
|
5914
6102
|
A: [
|
|
@@ -5924,7 +6112,7 @@ _ts_decorate7([
|
|
|
5924
6112
|
], Lock.prototype, "lockKey", null);
|
|
5925
6113
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
5926
6114
|
var getRootPath = (config) => {
|
|
5927
|
-
const { dataRoot = (0,
|
|
6115
|
+
const { dataRoot = (0, import_util11.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5928
6116
|
return `${dataRoot}/`;
|
|
5929
6117
|
};
|
|
5930
6118
|
var isPersistent = (config) => {
|
|
@@ -5980,7 +6168,159 @@ var createLevel = async (config) => {
|
|
|
5980
6168
|
await level.open();
|
|
5981
6169
|
return level;
|
|
5982
6170
|
};
|
|
5983
|
-
var
|
|
6171
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6172
|
+
var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
|
|
6173
|
+
var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
|
|
6174
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
6175
|
+
const archive = {
|
|
6176
|
+
storage: [],
|
|
6177
|
+
meta: {
|
|
6178
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6179
|
+
}
|
|
6180
|
+
};
|
|
6181
|
+
{
|
|
6182
|
+
const directory = await storage.createDirectory();
|
|
6183
|
+
const files = await directory.list();
|
|
6184
|
+
import_log19.log.info("begin exporting files", {
|
|
6185
|
+
count: files.length
|
|
6186
|
+
}, {
|
|
6187
|
+
F: __dxlog_file22,
|
|
6188
|
+
L: 30,
|
|
6189
|
+
S: void 0,
|
|
6190
|
+
C: (f, a) => f(...a)
|
|
6191
|
+
});
|
|
6192
|
+
for (const filename of files) {
|
|
6193
|
+
const file = await directory.getOrCreateFile(filename);
|
|
6194
|
+
const { size } = await file.stat();
|
|
6195
|
+
const data = await file.read(0, size);
|
|
6196
|
+
archive.storage.push({
|
|
6197
|
+
type: import_protocols15.ProfileArchiveEntryType.FILE,
|
|
6198
|
+
key: filename,
|
|
6199
|
+
value: data
|
|
6200
|
+
});
|
|
6201
|
+
}
|
|
6202
|
+
import_log19.log.info("done exporting files", {
|
|
6203
|
+
count: files.length
|
|
6204
|
+
}, {
|
|
6205
|
+
F: __dxlog_file22,
|
|
6206
|
+
L: 41,
|
|
6207
|
+
S: void 0,
|
|
6208
|
+
C: (f, a) => f(...a)
|
|
6209
|
+
});
|
|
6210
|
+
}
|
|
6211
|
+
{
|
|
6212
|
+
import_log19.log.info("begin exporting kv pairs", void 0, {
|
|
6213
|
+
F: __dxlog_file22,
|
|
6214
|
+
L: 45,
|
|
6215
|
+
S: void 0,
|
|
6216
|
+
C: (f, a) => f(...a)
|
|
6217
|
+
});
|
|
6218
|
+
const iter = await level.iterator({
|
|
6219
|
+
keyEncoding: "binary",
|
|
6220
|
+
valueEncoding: "binary"
|
|
6221
|
+
});
|
|
6222
|
+
let count = 0;
|
|
6223
|
+
for await (const [key, value] of iter) {
|
|
6224
|
+
archive.storage.push({
|
|
6225
|
+
type: import_protocols15.ProfileArchiveEntryType.KEY_VALUE,
|
|
6226
|
+
key,
|
|
6227
|
+
value
|
|
6228
|
+
});
|
|
6229
|
+
count++;
|
|
6230
|
+
}
|
|
6231
|
+
import_log19.log.info("done exporting kv pairs", {
|
|
6232
|
+
count
|
|
6233
|
+
}, {
|
|
6234
|
+
F: __dxlog_file22,
|
|
6235
|
+
L: 56,
|
|
6236
|
+
S: void 0,
|
|
6237
|
+
C: (f, a) => f(...a)
|
|
6238
|
+
});
|
|
6239
|
+
}
|
|
6240
|
+
return archive;
|
|
6241
|
+
};
|
|
6242
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
6243
|
+
let batch = level.batch();
|
|
6244
|
+
let count = 0;
|
|
6245
|
+
for (const entry2 of archive.storage) {
|
|
6246
|
+
switch (entry2.type) {
|
|
6247
|
+
case import_protocols15.ProfileArchiveEntryType.FILE: {
|
|
6248
|
+
const directory = await storage.createDirectory();
|
|
6249
|
+
(0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
6250
|
+
F: __dxlog_file22,
|
|
6251
|
+
L: 79,
|
|
6252
|
+
S: void 0,
|
|
6253
|
+
A: [
|
|
6254
|
+
"typeof entry.key === 'string'",
|
|
6255
|
+
"'Invalid key type'"
|
|
6256
|
+
]
|
|
6257
|
+
});
|
|
6258
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
6259
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6260
|
+
F: __dxlog_file22,
|
|
6261
|
+
L: 81,
|
|
6262
|
+
S: void 0,
|
|
6263
|
+
A: [
|
|
6264
|
+
"entry.value instanceof Uint8Array",
|
|
6265
|
+
"'Invalid value type'"
|
|
6266
|
+
]
|
|
6267
|
+
});
|
|
6268
|
+
await file.write(0, (0, import_util12.arrayToBuffer)(entry2.value));
|
|
6269
|
+
await file.close();
|
|
6270
|
+
break;
|
|
6271
|
+
}
|
|
6272
|
+
case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
|
|
6273
|
+
(0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6274
|
+
F: __dxlog_file22,
|
|
6275
|
+
L: 87,
|
|
6276
|
+
S: void 0,
|
|
6277
|
+
A: [
|
|
6278
|
+
"entry.key instanceof Uint8Array",
|
|
6279
|
+
"'Invalid key type'"
|
|
6280
|
+
]
|
|
6281
|
+
});
|
|
6282
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6283
|
+
F: __dxlog_file22,
|
|
6284
|
+
L: 88,
|
|
6285
|
+
S: void 0,
|
|
6286
|
+
A: [
|
|
6287
|
+
"entry.value instanceof Uint8Array",
|
|
6288
|
+
"'Invalid value type'"
|
|
6289
|
+
]
|
|
6290
|
+
});
|
|
6291
|
+
batch.put(entry2.key, entry2.value, {
|
|
6292
|
+
keyEncoding: "binary",
|
|
6293
|
+
valueEncoding: "binary"
|
|
6294
|
+
});
|
|
6295
|
+
break;
|
|
6296
|
+
}
|
|
6297
|
+
default:
|
|
6298
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6299
|
+
}
|
|
6300
|
+
if (++count % 1e3 === 0) {
|
|
6301
|
+
await batch.write();
|
|
6302
|
+
batch = level.batch();
|
|
6303
|
+
import_log19.log.info("importing", {
|
|
6304
|
+
count,
|
|
6305
|
+
total: archive.storage.length,
|
|
6306
|
+
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
6307
|
+
}, {
|
|
6308
|
+
F: __dxlog_file22,
|
|
6309
|
+
L: 101,
|
|
6310
|
+
S: void 0,
|
|
6311
|
+
C: (f, a) => f(...a)
|
|
6312
|
+
});
|
|
6313
|
+
}
|
|
6314
|
+
}
|
|
6315
|
+
import_log19.log.info("committing changes..", void 0, {
|
|
6316
|
+
F: __dxlog_file22,
|
|
6317
|
+
L: 109,
|
|
6318
|
+
S: void 0,
|
|
6319
|
+
C: (f, a) => f(...a)
|
|
6320
|
+
});
|
|
6321
|
+
await batch.write();
|
|
6322
|
+
};
|
|
6323
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
5984
6324
|
var DevicesServiceImpl = class {
|
|
5985
6325
|
constructor(_identityManager) {
|
|
5986
6326
|
this._identityManager = _identityManager;
|
|
@@ -5997,8 +6337,8 @@ var DevicesServiceImpl = class {
|
|
|
5997
6337
|
devices: []
|
|
5998
6338
|
});
|
|
5999
6339
|
} else {
|
|
6000
|
-
(0,
|
|
6001
|
-
F:
|
|
6340
|
+
(0, import_invariant21.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
6341
|
+
F: __dxlog_file23,
|
|
6002
6342
|
L: 32,
|
|
6003
6343
|
S: this,
|
|
6004
6344
|
A: [
|
|
@@ -6039,7 +6379,7 @@ var DevicesServiceImpl = class {
|
|
|
6039
6379
|
presenceSubscribed = true;
|
|
6040
6380
|
}
|
|
6041
6381
|
};
|
|
6042
|
-
const subscriptions = new
|
|
6382
|
+
const subscriptions = new import_async20.EventSubscriptions();
|
|
6043
6383
|
if (this._identityManager.identity) {
|
|
6044
6384
|
subscribeIdentity();
|
|
6045
6385
|
subscribePresence();
|
|
@@ -6091,33 +6431,110 @@ var findConfigs = () => {
|
|
|
6091
6431
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
6092
6432
|
return configs.map((r) => r.instance.deref()).filter(import_util13.nonNullable);
|
|
6093
6433
|
};
|
|
6434
|
+
var ContactsServiceImpl = class {
|
|
6435
|
+
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
6436
|
+
this._identityManager = _identityManager;
|
|
6437
|
+
this._spaceManager = _spaceManager;
|
|
6438
|
+
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
6439
|
+
}
|
|
6440
|
+
async getContacts() {
|
|
6441
|
+
const identity = this._identityManager.identity;
|
|
6442
|
+
if (identity == null) {
|
|
6443
|
+
return {
|
|
6444
|
+
contacts: []
|
|
6445
|
+
};
|
|
6446
|
+
}
|
|
6447
|
+
const contacts = [
|
|
6448
|
+
...this._spaceManager.spaces.values()
|
|
6449
|
+
].flatMap((s) => [
|
|
6450
|
+
...s.spaceState.members.values()
|
|
6451
|
+
].map((m) => [
|
|
6452
|
+
s.key,
|
|
6453
|
+
m
|
|
6454
|
+
])).reduce((acc, v) => {
|
|
6455
|
+
const [spaceKey, memberInfo] = v;
|
|
6456
|
+
if (memberInfo.key.equals(identity.identityKey)) {
|
|
6457
|
+
return acc;
|
|
6458
|
+
}
|
|
6459
|
+
const existing = acc.get(memberInfo.key);
|
|
6460
|
+
if (existing != null) {
|
|
6461
|
+
existing.profile ??= memberInfo.profile;
|
|
6462
|
+
existing.commonSpaces?.push(spaceKey);
|
|
6463
|
+
} else {
|
|
6464
|
+
acc.set(memberInfo.key, {
|
|
6465
|
+
identityKey: memberInfo.key,
|
|
6466
|
+
profile: memberInfo.profile,
|
|
6467
|
+
commonSpaces: [
|
|
6468
|
+
spaceKey
|
|
6469
|
+
]
|
|
6470
|
+
});
|
|
6471
|
+
}
|
|
6472
|
+
return acc;
|
|
6473
|
+
}, new import_util15.ComplexMap(import_keys17.PublicKey.hash));
|
|
6474
|
+
return {
|
|
6475
|
+
contacts: [
|
|
6476
|
+
...contacts.values()
|
|
6477
|
+
]
|
|
6478
|
+
};
|
|
6479
|
+
}
|
|
6480
|
+
queryContacts() {
|
|
6481
|
+
const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys17.PublicKey.hash);
|
|
6482
|
+
return new import_codec_protobuf13.Stream(({ next, ctx }) => {
|
|
6483
|
+
const pushUpdateTask = new import_async21.UpdateScheduler(ctx, async () => {
|
|
6484
|
+
const contacts = await this.getContacts();
|
|
6485
|
+
next(contacts);
|
|
6486
|
+
}, {
|
|
6487
|
+
maxFrequency: 2
|
|
6488
|
+
});
|
|
6489
|
+
(0, import_async21.scheduleTask)(ctx, async () => {
|
|
6490
|
+
const subscriptions = new import_async21.EventSubscriptions();
|
|
6491
|
+
ctx.onDispose(() => subscriptions.clear());
|
|
6492
|
+
const subscribeToSpaceAndUpdate = () => {
|
|
6493
|
+
const oldSetSize = subscribedSpaceKeySet.size;
|
|
6494
|
+
for (const space of this._spaceManager.spaces.values()) {
|
|
6495
|
+
if (!subscribedSpaceKeySet.has(space.key)) {
|
|
6496
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
|
|
6497
|
+
subscribedSpaceKeySet.add(space.key);
|
|
6498
|
+
}
|
|
6499
|
+
}
|
|
6500
|
+
if (oldSetSize !== subscribedSpaceKeySet.size) {
|
|
6501
|
+
pushUpdateTask.trigger();
|
|
6502
|
+
}
|
|
6503
|
+
};
|
|
6504
|
+
const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
|
|
6505
|
+
ctx.onDispose(unsubscribe);
|
|
6506
|
+
subscribeToSpaceAndUpdate();
|
|
6507
|
+
});
|
|
6508
|
+
});
|
|
6509
|
+
}
|
|
6510
|
+
};
|
|
6094
6511
|
var LoggingServiceImpl = class {
|
|
6095
6512
|
constructor() {
|
|
6096
6513
|
this._logs = new import_async22.Event();
|
|
6097
6514
|
this._started = Date.now();
|
|
6098
|
-
this._sessionId =
|
|
6515
|
+
this._sessionId = import_keys18.PublicKey.random().toHex();
|
|
6099
6516
|
this._logProcessor = (_config, entry2) => {
|
|
6100
6517
|
this._logs.emit(entry2);
|
|
6101
6518
|
};
|
|
6102
6519
|
}
|
|
6103
6520
|
async open() {
|
|
6104
|
-
|
|
6521
|
+
import_log21.log.runtimeConfig.processors.push(this._logProcessor);
|
|
6105
6522
|
}
|
|
6106
6523
|
async close() {
|
|
6107
|
-
const index =
|
|
6108
|
-
|
|
6524
|
+
const index = import_log21.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6525
|
+
import_log21.log.runtimeConfig.processors.splice(index, 1);
|
|
6109
6526
|
}
|
|
6110
6527
|
async controlMetrics({ reset, record }) {
|
|
6111
6528
|
if (reset) {
|
|
6112
|
-
|
|
6529
|
+
import_util16.tracer.clear();
|
|
6113
6530
|
}
|
|
6114
6531
|
if (record === true) {
|
|
6115
|
-
|
|
6532
|
+
import_util16.tracer.start();
|
|
6116
6533
|
} else if (record === false) {
|
|
6117
|
-
|
|
6534
|
+
import_util16.tracer.stop();
|
|
6118
6535
|
}
|
|
6119
6536
|
return {
|
|
6120
|
-
recording:
|
|
6537
|
+
recording: import_util16.tracer.recording
|
|
6121
6538
|
};
|
|
6122
6539
|
}
|
|
6123
6540
|
/**
|
|
@@ -6125,13 +6542,13 @@ var LoggingServiceImpl = class {
|
|
|
6125
6542
|
*/
|
|
6126
6543
|
queryMetrics({ interval = 5e3 }) {
|
|
6127
6544
|
const getNumericalValues = (key) => {
|
|
6128
|
-
const events =
|
|
6545
|
+
const events = import_util16.tracer.get(key) ?? [];
|
|
6129
6546
|
return {
|
|
6130
6547
|
key,
|
|
6131
|
-
stats: (0,
|
|
6548
|
+
stats: (0, import_util16.numericalValues)(events, "duration")
|
|
6132
6549
|
};
|
|
6133
6550
|
};
|
|
6134
|
-
return new
|
|
6551
|
+
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
6135
6552
|
const update = () => {
|
|
6136
6553
|
const metrics = {
|
|
6137
6554
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6153,7 +6570,7 @@ var LoggingServiceImpl = class {
|
|
|
6153
6570
|
});
|
|
6154
6571
|
}
|
|
6155
6572
|
queryLogs(request) {
|
|
6156
|
-
return new
|
|
6573
|
+
return new import_codec_protobuf14.Stream(({ ctx, next }) => {
|
|
6157
6574
|
const handler = (entry2) => {
|
|
6158
6575
|
if (LOG_PROCESSING > 0) {
|
|
6159
6576
|
return;
|
|
@@ -6166,7 +6583,7 @@ var LoggingServiceImpl = class {
|
|
|
6166
6583
|
}
|
|
6167
6584
|
const record = {
|
|
6168
6585
|
...entry2,
|
|
6169
|
-
context: (0,
|
|
6586
|
+
context: (0, import_util16.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
|
|
6170
6587
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6171
6588
|
meta: {
|
|
6172
6589
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -6175,7 +6592,7 @@ var LoggingServiceImpl = class {
|
|
|
6175
6592
|
scope: {
|
|
6176
6593
|
hostSessionId: this._sessionId,
|
|
6177
6594
|
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
6178
|
-
name: (0,
|
|
6595
|
+
name: (0, import_util16.getDebugName)(entry2.meta?.S)
|
|
6179
6596
|
}
|
|
6180
6597
|
}
|
|
6181
6598
|
};
|
|
@@ -6213,7 +6630,7 @@ var NetworkServiceImpl = class {
|
|
|
6213
6630
|
this.signalManager = signalManager;
|
|
6214
6631
|
}
|
|
6215
6632
|
queryStatus() {
|
|
6216
|
-
return new
|
|
6633
|
+
return new import_codec_protobuf15.Stream(({ next }) => {
|
|
6217
6634
|
const update = () => {
|
|
6218
6635
|
next({
|
|
6219
6636
|
swarm: this.networkManager.connectionState,
|
|
@@ -6256,7 +6673,7 @@ var SystemServiceImpl = class {
|
|
|
6256
6673
|
const diagnostics = await this._getDiagnostics();
|
|
6257
6674
|
return {
|
|
6258
6675
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6259
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6676
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
|
|
6260
6677
|
truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
6261
6678
|
humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
6262
6679
|
})))
|
|
@@ -6270,7 +6687,7 @@ var SystemServiceImpl = class {
|
|
|
6270
6687
|
}
|
|
6271
6688
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6272
6689
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6273
|
-
return new
|
|
6690
|
+
return new import_codec_protobuf16.Stream(({ next }) => {
|
|
6274
6691
|
const update = () => {
|
|
6275
6692
|
next({
|
|
6276
6693
|
status: this._getCurrentStatus()
|
|
@@ -6299,7 +6716,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6299
6716
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6300
6717
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6301
6718
|
}
|
|
6302
|
-
var
|
|
6719
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6303
6720
|
var ClientServicesHost = class {
|
|
6304
6721
|
constructor({
|
|
6305
6722
|
config,
|
|
@@ -6313,7 +6730,7 @@ var ClientServicesHost = class {
|
|
|
6313
6730
|
runtimeParams
|
|
6314
6731
|
} = {}) {
|
|
6315
6732
|
this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
|
|
6316
|
-
this._statusUpdate = new
|
|
6733
|
+
this._statusUpdate = new import_async19.Event();
|
|
6317
6734
|
this._opening = false;
|
|
6318
6735
|
this._open = false;
|
|
6319
6736
|
this._storage = storage;
|
|
@@ -6332,7 +6749,10 @@ var ClientServicesHost = class {
|
|
|
6332
6749
|
lockKey,
|
|
6333
6750
|
onAcquire: () => {
|
|
6334
6751
|
if (!this._opening) {
|
|
6335
|
-
void this.open(new
|
|
6752
|
+
void this.open(new import_context15.Context(void 0, {
|
|
6753
|
+
F: __dxlog_file24,
|
|
6754
|
+
L: 121
|
|
6755
|
+
}));
|
|
6336
6756
|
}
|
|
6337
6757
|
},
|
|
6338
6758
|
onRelease: () => this.close()
|
|
@@ -6387,25 +6807,25 @@ var ClientServicesHost = class {
|
|
|
6387
6807
|
* Can only be called once.
|
|
6388
6808
|
*/
|
|
6389
6809
|
initialize({ config, ...options }) {
|
|
6390
|
-
(0,
|
|
6391
|
-
F:
|
|
6392
|
-
L:
|
|
6810
|
+
(0, import_invariant20.invariant)(!this._open, "service host is open", {
|
|
6811
|
+
F: __dxlog_file24,
|
|
6812
|
+
L: 187,
|
|
6393
6813
|
S: this,
|
|
6394
6814
|
A: [
|
|
6395
6815
|
"!this._open",
|
|
6396
6816
|
"'service host is open'"
|
|
6397
6817
|
]
|
|
6398
6818
|
});
|
|
6399
|
-
(0,
|
|
6400
|
-
F:
|
|
6401
|
-
L:
|
|
6819
|
+
(0, import_log20.log)("initializing...", void 0, {
|
|
6820
|
+
F: __dxlog_file24,
|
|
6821
|
+
L: 188,
|
|
6402
6822
|
S: this,
|
|
6403
6823
|
C: (f, a) => f(...a)
|
|
6404
6824
|
});
|
|
6405
6825
|
if (config) {
|
|
6406
|
-
(0,
|
|
6407
|
-
F:
|
|
6408
|
-
L:
|
|
6826
|
+
(0, import_invariant20.invariant)(!this._config, "config already set", {
|
|
6827
|
+
F: __dxlog_file24,
|
|
6828
|
+
L: 191,
|
|
6409
6829
|
S: this,
|
|
6410
6830
|
A: [
|
|
6411
6831
|
"!this._config",
|
|
@@ -6418,9 +6838,9 @@ var ClientServicesHost = class {
|
|
|
6418
6838
|
}
|
|
6419
6839
|
}
|
|
6420
6840
|
if (!options.signalManager) {
|
|
6421
|
-
|
|
6422
|
-
F:
|
|
6423
|
-
L:
|
|
6841
|
+
import_log20.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
6842
|
+
F: __dxlog_file24,
|
|
6843
|
+
L: 199,
|
|
6424
6844
|
S: this,
|
|
6425
6845
|
C: (f, a) => f(...a)
|
|
6426
6846
|
});
|
|
@@ -6429,9 +6849,9 @@ var ClientServicesHost = class {
|
|
|
6429
6849
|
iceServers: this._config?.get("runtime.services.ice")
|
|
6430
6850
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6431
6851
|
this._signalManager = signalManager;
|
|
6432
|
-
(0,
|
|
6433
|
-
F:
|
|
6434
|
-
L:
|
|
6852
|
+
(0, import_invariant20.invariant)(!this._networkManager, "network manager already set", {
|
|
6853
|
+
F: __dxlog_file24,
|
|
6854
|
+
L: 210,
|
|
6435
6855
|
S: this,
|
|
6436
6856
|
A: [
|
|
6437
6857
|
"!this._networkManager",
|
|
@@ -6443,9 +6863,9 @@ var ClientServicesHost = class {
|
|
|
6443
6863
|
transportFactory,
|
|
6444
6864
|
signalManager
|
|
6445
6865
|
});
|
|
6446
|
-
(0,
|
|
6447
|
-
F:
|
|
6448
|
-
L:
|
|
6866
|
+
(0, import_log20.log)("initialized", void 0, {
|
|
6867
|
+
F: __dxlog_file24,
|
|
6868
|
+
L: 217,
|
|
6449
6869
|
S: this,
|
|
6450
6870
|
C: (f, a) => f(...a)
|
|
6451
6871
|
});
|
|
@@ -6455,44 +6875,44 @@ var ClientServicesHost = class {
|
|
|
6455
6875
|
return;
|
|
6456
6876
|
}
|
|
6457
6877
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6458
|
-
|
|
6878
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.begin({
|
|
6459
6879
|
id: traceId
|
|
6460
6880
|
}), {
|
|
6461
|
-
F:
|
|
6462
|
-
L:
|
|
6881
|
+
F: __dxlog_file24,
|
|
6882
|
+
L: 228,
|
|
6463
6883
|
S: this,
|
|
6464
6884
|
C: (f, a) => f(...a)
|
|
6465
6885
|
});
|
|
6466
|
-
(0,
|
|
6467
|
-
F:
|
|
6468
|
-
L:
|
|
6886
|
+
(0, import_invariant20.invariant)(this._config, "config not set", {
|
|
6887
|
+
F: __dxlog_file24,
|
|
6888
|
+
L: 230,
|
|
6469
6889
|
S: this,
|
|
6470
6890
|
A: [
|
|
6471
6891
|
"this._config",
|
|
6472
6892
|
"'config not set'"
|
|
6473
6893
|
]
|
|
6474
6894
|
});
|
|
6475
|
-
(0,
|
|
6476
|
-
F:
|
|
6477
|
-
L:
|
|
6895
|
+
(0, import_invariant20.invariant)(this._storage, "storage not set", {
|
|
6896
|
+
F: __dxlog_file24,
|
|
6897
|
+
L: 231,
|
|
6478
6898
|
S: this,
|
|
6479
6899
|
A: [
|
|
6480
6900
|
"this._storage",
|
|
6481
6901
|
"'storage not set'"
|
|
6482
6902
|
]
|
|
6483
6903
|
});
|
|
6484
|
-
(0,
|
|
6485
|
-
F:
|
|
6486
|
-
L:
|
|
6904
|
+
(0, import_invariant20.invariant)(this._signalManager, "signal manager not set", {
|
|
6905
|
+
F: __dxlog_file24,
|
|
6906
|
+
L: 232,
|
|
6487
6907
|
S: this,
|
|
6488
6908
|
A: [
|
|
6489
6909
|
"this._signalManager",
|
|
6490
6910
|
"'signal manager not set'"
|
|
6491
6911
|
]
|
|
6492
6912
|
});
|
|
6493
|
-
(0,
|
|
6494
|
-
F:
|
|
6495
|
-
L:
|
|
6913
|
+
(0, import_invariant20.invariant)(this._networkManager, "network manager not set", {
|
|
6914
|
+
F: __dxlog_file24,
|
|
6915
|
+
L: 233,
|
|
6496
6916
|
S: this,
|
|
6497
6917
|
A: [
|
|
6498
6918
|
"this._networkManager",
|
|
@@ -6500,11 +6920,11 @@ var ClientServicesHost = class {
|
|
|
6500
6920
|
]
|
|
6501
6921
|
});
|
|
6502
6922
|
this._opening = true;
|
|
6503
|
-
(0,
|
|
6923
|
+
(0, import_log20.log)("opening...", {
|
|
6504
6924
|
lockKey: this._resourceLock?.lockKey
|
|
6505
6925
|
}, {
|
|
6506
|
-
F:
|
|
6507
|
-
L:
|
|
6926
|
+
F: __dxlog_file24,
|
|
6927
|
+
L: 236,
|
|
6508
6928
|
S: this,
|
|
6509
6929
|
C: (f, a) => f(...a)
|
|
6510
6930
|
});
|
|
@@ -6515,16 +6935,18 @@ var ClientServicesHost = class {
|
|
|
6515
6935
|
await this._level.open();
|
|
6516
6936
|
await this._loggingService.open();
|
|
6517
6937
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
6938
|
+
const dataSpaceManagerProvider = async () => {
|
|
6939
|
+
await this._serviceContext.initialized.wait();
|
|
6940
|
+
return this._serviceContext.dataSpaceManager;
|
|
6941
|
+
};
|
|
6518
6942
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6519
6943
|
this._serviceRegistry.setServices({
|
|
6520
6944
|
SystemService: this._systemService,
|
|
6521
6945
|
IdentityService: identityService,
|
|
6946
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6522
6947
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6523
6948
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6524
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6525
|
-
await this._serviceContext.initialized.wait();
|
|
6526
|
-
return this._serviceContext.dataSpaceManager;
|
|
6527
|
-
}),
|
|
6949
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6528
6950
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6529
6951
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6530
6952
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6554,19 +6976,19 @@ var ClientServicesHost = class {
|
|
|
6554
6976
|
this._open = true;
|
|
6555
6977
|
this._statusUpdate.emit();
|
|
6556
6978
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6557
|
-
(0,
|
|
6979
|
+
(0, import_log20.log)("opened", {
|
|
6558
6980
|
deviceKey
|
|
6559
6981
|
}, {
|
|
6560
|
-
F:
|
|
6561
|
-
L:
|
|
6982
|
+
F: __dxlog_file24,
|
|
6983
|
+
L: 322,
|
|
6562
6984
|
S: this,
|
|
6563
6985
|
C: (f, a) => f(...a)
|
|
6564
6986
|
});
|
|
6565
|
-
|
|
6987
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.end({
|
|
6566
6988
|
id: traceId
|
|
6567
6989
|
}), {
|
|
6568
|
-
F:
|
|
6569
|
-
L:
|
|
6990
|
+
F: __dxlog_file24,
|
|
6991
|
+
L: 323,
|
|
6570
6992
|
S: this,
|
|
6571
6993
|
C: (f, a) => f(...a)
|
|
6572
6994
|
});
|
|
@@ -6576,11 +6998,11 @@ var ClientServicesHost = class {
|
|
|
6576
6998
|
return;
|
|
6577
6999
|
}
|
|
6578
7000
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6579
|
-
(0,
|
|
7001
|
+
(0, import_log20.log)("closing...", {
|
|
6580
7002
|
deviceKey
|
|
6581
7003
|
}, {
|
|
6582
|
-
F:
|
|
6583
|
-
L:
|
|
7004
|
+
F: __dxlog_file24,
|
|
7005
|
+
L: 334,
|
|
6584
7006
|
S: this,
|
|
6585
7007
|
C: (f, a) => f(...a)
|
|
6586
7008
|
});
|
|
@@ -6594,44 +7016,44 @@ var ClientServicesHost = class {
|
|
|
6594
7016
|
await this._level?.close();
|
|
6595
7017
|
this._open = false;
|
|
6596
7018
|
this._statusUpdate.emit();
|
|
6597
|
-
(0,
|
|
7019
|
+
(0, import_log20.log)("closed", {
|
|
6598
7020
|
deviceKey
|
|
6599
7021
|
}, {
|
|
6600
|
-
F:
|
|
6601
|
-
L:
|
|
7022
|
+
F: __dxlog_file24,
|
|
7023
|
+
L: 343,
|
|
6602
7024
|
S: this,
|
|
6603
7025
|
C: (f, a) => f(...a)
|
|
6604
7026
|
});
|
|
6605
7027
|
}
|
|
6606
7028
|
async reset() {
|
|
6607
7029
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6608
|
-
|
|
7030
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.begin({
|
|
6609
7031
|
id: traceId
|
|
6610
7032
|
}), {
|
|
6611
|
-
F:
|
|
6612
|
-
L:
|
|
7033
|
+
F: __dxlog_file24,
|
|
7034
|
+
L: 348,
|
|
6613
7035
|
S: this,
|
|
6614
7036
|
C: (f, a) => f(...a)
|
|
6615
7037
|
});
|
|
6616
|
-
|
|
6617
|
-
F:
|
|
6618
|
-
L:
|
|
7038
|
+
import_log20.log.info("resetting...", void 0, {
|
|
7039
|
+
F: __dxlog_file24,
|
|
7040
|
+
L: 350,
|
|
6619
7041
|
S: this,
|
|
6620
7042
|
C: (f, a) => f(...a)
|
|
6621
7043
|
});
|
|
6622
7044
|
await this._serviceContext?.close();
|
|
6623
7045
|
await this._storage.reset();
|
|
6624
|
-
|
|
6625
|
-
F:
|
|
6626
|
-
L:
|
|
7046
|
+
import_log20.log.info("reset", void 0, {
|
|
7047
|
+
F: __dxlog_file24,
|
|
7048
|
+
L: 353,
|
|
6627
7049
|
S: this,
|
|
6628
7050
|
C: (f, a) => f(...a)
|
|
6629
7051
|
});
|
|
6630
|
-
|
|
7052
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.end({
|
|
6631
7053
|
id: traceId
|
|
6632
7054
|
}), {
|
|
6633
|
-
F:
|
|
6634
|
-
L:
|
|
7055
|
+
F: __dxlog_file24,
|
|
7056
|
+
L: 354,
|
|
6635
7057
|
S: this,
|
|
6636
7058
|
C: (f, a) => f(...a)
|
|
6637
7059
|
});
|
|
@@ -6650,11 +7072,11 @@ _ts_decorate8([
|
|
|
6650
7072
|
import_tracing9.trace.info()
|
|
6651
7073
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
6652
7074
|
_ts_decorate8([
|
|
6653
|
-
|
|
7075
|
+
import_async19.synchronized,
|
|
6654
7076
|
import_tracing9.trace.span()
|
|
6655
7077
|
], ClientServicesHost.prototype, "open", null);
|
|
6656
7078
|
_ts_decorate8([
|
|
6657
|
-
|
|
7079
|
+
import_async19.synchronized,
|
|
6658
7080
|
import_tracing9.trace.span()
|
|
6659
7081
|
], ClientServicesHost.prototype, "close", null);
|
|
6660
7082
|
ClientServicesHost = _ts_decorate8([
|
|
@@ -6690,7 +7112,11 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6690
7112
|
createDiagnostics,
|
|
6691
7113
|
createLevel,
|
|
6692
7114
|
createStorageObjects,
|
|
7115
|
+
decodeProfileArchive,
|
|
7116
|
+
encodeProfileArchive,
|
|
7117
|
+
exportProfileData,
|
|
6693
7118
|
getNetworkPeers,
|
|
7119
|
+
importProfileData,
|
|
6694
7120
|
isLocked,
|
|
6695
7121
|
subscribeToFeedBlocks,
|
|
6696
7122
|
subscribeToFeeds,
|
|
@@ -6700,4 +7126,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6700
7126
|
subscribeToSpaces,
|
|
6701
7127
|
subscribeToSwarmInfo
|
|
6702
7128
|
});
|
|
6703
|
-
//# sourceMappingURL=chunk-
|
|
7129
|
+
//# sourceMappingURL=chunk-NPCEVOJK.cjs.map
|