@dxos/client-services 0.5.9-next.728078d → 0.5.9-next.73dcc17
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-Q2PH3QCC.mjs → chunk-LSW6EPSX.mjs} +784 -509
- package/dist/lib/browser/chunk-LSW6EPSX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -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-XZHIBOD3.cjs → chunk-LIWLWYC3.cjs} +812 -539
- package/dist/lib/node/chunk-LIWLWYC3.cjs.map +7 -0
- package/dist/lib/node/index.cjs +49 -46
- 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/profile-archive.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/contacts-service.ts +85 -0
- package/src/packlets/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 +3 -1
- package/src/packlets/spaces/epoch-migrations.ts +57 -38
- package/src/packlets/spaces/spaces-service.ts +40 -0
- package/src/packlets/storage/profile-archive.ts +15 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-Q2PH3QCC.mjs.map +0 -7
- package/dist/lib/node/chunk-XZHIBOD3.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_LIWLWYC3_exports = {};
|
|
30
|
+
__export(chunk_LIWLWYC3_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -70,7 +70,7 @@ __export(chunk_XZHIBOD3_exports, {
|
|
|
70
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
71
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
72
72
|
});
|
|
73
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_LIWLWYC3_exports);
|
|
74
74
|
var import_async = require("@dxos/async");
|
|
75
75
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
76
76
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -216,32 +216,30 @@ var import_util7 = require("@dxos/util");
|
|
|
216
216
|
var import_async14 = require("@dxos/async");
|
|
217
217
|
var import_context11 = require("@dxos/context");
|
|
218
218
|
var import_credentials14 = require("@dxos/credentials");
|
|
219
|
-
var import_async15 = require("@dxos/async");
|
|
220
|
-
var import_automerge = require("@dxos/automerge/automerge");
|
|
221
|
-
var import_context12 = require("@dxos/context");
|
|
222
219
|
var import_echo_db = require("@dxos/echo-db");
|
|
223
|
-
var
|
|
220
|
+
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
224
221
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
225
222
|
var import_invariant13 = require("@dxos/invariant");
|
|
226
223
|
var import_log13 = require("@dxos/log");
|
|
227
224
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
228
|
-
var
|
|
229
|
-
var
|
|
230
|
-
var import_context13 = require("@dxos/context");
|
|
225
|
+
var import_async15 = require("@dxos/async");
|
|
226
|
+
var import_context12 = require("@dxos/context");
|
|
231
227
|
var import_invariant14 = require("@dxos/invariant");
|
|
232
228
|
var import_keys11 = require("@dxos/keys");
|
|
233
229
|
var import_log14 = require("@dxos/log");
|
|
234
230
|
var import_protocols10 = require("@dxos/protocols");
|
|
235
231
|
var import_teleport3 = require("@dxos/teleport");
|
|
236
|
-
var
|
|
237
|
-
var
|
|
232
|
+
var import_util8 = require("@dxos/util");
|
|
233
|
+
var import_async16 = require("@dxos/async");
|
|
238
234
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
239
|
-
var
|
|
235
|
+
var import_context13 = require("@dxos/context");
|
|
240
236
|
var import_credentials15 = require("@dxos/credentials");
|
|
241
237
|
var import_echo_db2 = require("@dxos/echo-db");
|
|
238
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
242
239
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
243
|
-
var
|
|
240
|
+
var import_echo_protocol3 = require("@dxos/echo-protocol");
|
|
244
241
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
242
|
+
var import_feed_store4 = require("@dxos/feed-store");
|
|
245
243
|
var import_invariant15 = require("@dxos/invariant");
|
|
246
244
|
var import_keys12 = require("@dxos/keys");
|
|
247
245
|
var import_log15 = require("@dxos/log");
|
|
@@ -250,28 +248,28 @@ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
250
248
|
var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
251
249
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
252
250
|
var import_tracing6 = require("@dxos/tracing");
|
|
253
|
-
var
|
|
251
|
+
var import_util9 = require("@dxos/util");
|
|
254
252
|
var import_credentials17 = require("@dxos/credentials");
|
|
255
253
|
var import_debug4 = require("@dxos/debug");
|
|
256
254
|
var import_credentials18 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
257
255
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
258
|
-
var
|
|
256
|
+
var import_async17 = require("@dxos/async");
|
|
259
257
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
260
258
|
var import_credentials19 = require("@dxos/credentials");
|
|
261
259
|
var import_debug5 = require("@dxos/debug");
|
|
262
|
-
var
|
|
260
|
+
var import_feed_store5 = require("@dxos/feed-store");
|
|
263
261
|
var import_invariant16 = require("@dxos/invariant");
|
|
264
262
|
var import_log16 = require("@dxos/log");
|
|
265
263
|
var import_protocols12 = require("@dxos/protocols");
|
|
266
264
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
267
265
|
var import_tracing7 = require("@dxos/tracing");
|
|
268
|
-
var
|
|
269
|
-
var
|
|
266
|
+
var import_async18 = require("@dxos/async");
|
|
267
|
+
var import_context14 = require("@dxos/context");
|
|
270
268
|
var import_credentials20 = require("@dxos/credentials");
|
|
271
269
|
var import_debug6 = require("@dxos/debug");
|
|
272
270
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
273
271
|
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
274
|
-
var
|
|
272
|
+
var import_feed_store6 = require("@dxos/feed-store");
|
|
275
273
|
var import_invariant17 = require("@dxos/invariant");
|
|
276
274
|
var import_keyring = require("@dxos/keyring");
|
|
277
275
|
var import_keys13 = require("@dxos/keys");
|
|
@@ -280,7 +278,7 @@ var import_protocols13 = require("@dxos/protocols");
|
|
|
280
278
|
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
281
279
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
282
280
|
var import_tracing8 = require("@dxos/tracing");
|
|
283
|
-
var
|
|
281
|
+
var import_util10 = require("@dxos/util");
|
|
284
282
|
var import_invariant18 = require("@dxos/invariant");
|
|
285
283
|
var import_lock_file = require("@dxos/lock-file");
|
|
286
284
|
var import_log18 = require("@dxos/log");
|
|
@@ -289,7 +287,7 @@ var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
|
289
287
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
290
288
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
291
289
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
292
|
-
var
|
|
290
|
+
var import_util11 = require("@dxos/util");
|
|
293
291
|
var import_node_path = __toESM(require("node:path"));
|
|
294
292
|
var import_keys14 = require("@dxos/keys");
|
|
295
293
|
var import_kv_store = require("@dxos/kv-store");
|
|
@@ -297,10 +295,10 @@ var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
|
297
295
|
var import_invariant19 = require("@dxos/invariant");
|
|
298
296
|
var import_log19 = require("@dxos/log");
|
|
299
297
|
var import_protocols15 = require("@dxos/protocols");
|
|
300
|
-
var
|
|
301
|
-
var
|
|
298
|
+
var import_util12 = require("@dxos/util");
|
|
299
|
+
var import_async19 = require("@dxos/async");
|
|
302
300
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
303
|
-
var
|
|
301
|
+
var import_context15 = require("@dxos/context");
|
|
304
302
|
var import_invariant20 = require("@dxos/invariant");
|
|
305
303
|
var import_keys15 = require("@dxos/keys");
|
|
306
304
|
var import_log20 = require("@dxos/log");
|
|
@@ -310,24 +308,28 @@ var import_protocols16 = require("@dxos/protocols");
|
|
|
310
308
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
311
309
|
var import_tracing9 = require("@dxos/tracing");
|
|
312
310
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
313
|
-
var
|
|
311
|
+
var import_async20 = require("@dxos/async");
|
|
314
312
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
315
313
|
var import_invariant21 = require("@dxos/invariant");
|
|
316
314
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
317
315
|
var import_config3 = require("@dxos/config");
|
|
318
316
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
319
317
|
var import_tracing10 = require("@dxos/tracing");
|
|
320
|
-
var
|
|
318
|
+
var import_util13 = require("@dxos/util");
|
|
321
319
|
var import_keys16 = require("@dxos/keys");
|
|
322
|
-
var
|
|
323
|
-
var
|
|
320
|
+
var import_util14 = require("@dxos/util");
|
|
321
|
+
var import_async21 = require("@dxos/async");
|
|
324
322
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
325
323
|
var import_keys17 = require("@dxos/keys");
|
|
324
|
+
var import_util15 = require("@dxos/util");
|
|
325
|
+
var import_async22 = require("@dxos/async");
|
|
326
|
+
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
327
|
+
var import_keys18 = require("@dxos/keys");
|
|
326
328
|
var import_log21 = require("@dxos/log");
|
|
327
329
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
328
330
|
var import_util16 = require("@dxos/util");
|
|
329
|
-
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
330
331
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
332
|
+
var import_codec_protobuf16 = require("@dxos/codec-protobuf");
|
|
331
333
|
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
332
334
|
var import_util17 = require("@dxos/util");
|
|
333
335
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
@@ -397,6 +399,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
397
399
|
};
|
|
398
400
|
});
|
|
399
401
|
};
|
|
402
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
400
403
|
var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
|
|
401
404
|
const update = () => {
|
|
402
405
|
try {
|
|
@@ -412,7 +415,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
|
|
|
412
415
|
update();
|
|
413
416
|
});
|
|
414
417
|
var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
|
|
415
|
-
const ctx = new import_context.Context(
|
|
418
|
+
const ctx = new import_context.Context(void 0, {
|
|
419
|
+
F: __dxlog_file,
|
|
420
|
+
L: 36
|
|
421
|
+
});
|
|
416
422
|
signalManager.onMessage.on(ctx, (message) => {
|
|
417
423
|
next({
|
|
418
424
|
message: {
|
|
@@ -640,7 +646,7 @@ var DevtoolsServiceImpl = class {
|
|
|
640
646
|
});
|
|
641
647
|
}
|
|
642
648
|
};
|
|
643
|
-
var DXOS_VERSION = "0.5.9-next.
|
|
649
|
+
var DXOS_VERSION = "0.5.9-next.73dcc17";
|
|
644
650
|
var getPlatform = () => {
|
|
645
651
|
if (process.browser) {
|
|
646
652
|
if (typeof window !== "undefined") {
|
|
@@ -668,7 +674,7 @@ var getPlatform = () => {
|
|
|
668
674
|
};
|
|
669
675
|
}
|
|
670
676
|
};
|
|
671
|
-
var
|
|
677
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
672
678
|
var DEFAULT_TIMEOUT = 1e3;
|
|
673
679
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
674
680
|
const diagnostics = {
|
|
@@ -685,7 +691,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
685
691
|
await Promise.all([
|
|
686
692
|
(async () => {
|
|
687
693
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
688
|
-
F:
|
|
694
|
+
F: __dxlog_file2,
|
|
689
695
|
L: 110,
|
|
690
696
|
S: void 0,
|
|
691
697
|
A: [
|
|
@@ -874,7 +880,7 @@ _ts_decorate([
|
|
|
874
880
|
ClientRpcServer = _ts_decorate([
|
|
875
881
|
import_tracing2.trace.resource()
|
|
876
882
|
], ClientRpcServer);
|
|
877
|
-
var
|
|
883
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
878
884
|
var Credential = import_protocols2.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
879
885
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
880
886
|
const credential = await signer.createCredential({
|
|
@@ -889,7 +895,10 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
889
895
|
var TrustedKeySetAuthVerifier = class {
|
|
890
896
|
constructor(_params) {
|
|
891
897
|
this._params = _params;
|
|
892
|
-
this._ctx = new import_context2.Context(
|
|
898
|
+
this._ctx = new import_context2.Context(void 0, {
|
|
899
|
+
F: __dxlog_file3,
|
|
900
|
+
L: 45
|
|
901
|
+
});
|
|
893
902
|
}
|
|
894
903
|
async close() {
|
|
895
904
|
await this._ctx.dispose();
|
|
@@ -900,7 +909,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
900
909
|
(0, import_log.log)("authenticating...", {
|
|
901
910
|
credential
|
|
902
911
|
}, {
|
|
903
|
-
F:
|
|
912
|
+
F: __dxlog_file3,
|
|
904
913
|
L: 56,
|
|
905
914
|
S: this,
|
|
906
915
|
C: (f, a) => f(...a)
|
|
@@ -910,7 +919,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
910
919
|
(0, import_log.log)("Invalid credential", {
|
|
911
920
|
result
|
|
912
921
|
}, {
|
|
913
|
-
F:
|
|
922
|
+
F: __dxlog_file3,
|
|
914
923
|
L: 60,
|
|
915
924
|
S: this,
|
|
916
925
|
C: (f, a) => f(...a)
|
|
@@ -922,7 +931,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
922
931
|
nonce,
|
|
923
932
|
credential
|
|
924
933
|
}, {
|
|
925
|
-
F:
|
|
934
|
+
F: __dxlog_file3,
|
|
926
935
|
L: 65,
|
|
927
936
|
S: this,
|
|
928
937
|
C: (f, a) => f(...a)
|
|
@@ -933,7 +942,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
933
942
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
934
943
|
key: credential.issuer
|
|
935
944
|
}, {
|
|
936
|
-
F:
|
|
945
|
+
F: __dxlog_file3,
|
|
937
946
|
L: 70,
|
|
938
947
|
S: this,
|
|
939
948
|
C: (f, a) => f(...a)
|
|
@@ -949,7 +958,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
949
958
|
(0, import_log.log)("auth success", {
|
|
950
959
|
key: credential.issuer
|
|
951
960
|
}, {
|
|
952
|
-
F:
|
|
961
|
+
F: __dxlog_file3,
|
|
953
962
|
L: 81,
|
|
954
963
|
S: this,
|
|
955
964
|
C: (f, a) => f(...a)
|
|
@@ -959,7 +968,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
959
968
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
960
969
|
key: credential.issuer
|
|
961
970
|
}, {
|
|
962
|
-
F:
|
|
971
|
+
F: __dxlog_file3,
|
|
963
972
|
L: 84,
|
|
964
973
|
S: this,
|
|
965
974
|
C: (f, a) => f(...a)
|
|
@@ -982,7 +991,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
982
991
|
return deviceSet.has(deviceKey);
|
|
983
992
|
}
|
|
984
993
|
};
|
|
985
|
-
var
|
|
994
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
986
995
|
var DefaultSpaceStateMachine = class {
|
|
987
996
|
constructor(_params) {
|
|
988
997
|
this._params = _params;
|
|
@@ -999,7 +1008,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
999
1008
|
expectedIdentity: this._params.identityKey,
|
|
1000
1009
|
credential
|
|
1001
1010
|
}, {
|
|
1002
|
-
F:
|
|
1011
|
+
F: __dxlog_file4,
|
|
1003
1012
|
L: 32,
|
|
1004
1013
|
S: this,
|
|
1005
1014
|
C: (f, a) => f(...a)
|
|
@@ -1010,7 +1019,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
1010
1019
|
import_log3.log.warn("Invalid default space id", {
|
|
1011
1020
|
id: assertion.spaceId
|
|
1012
1021
|
}, {
|
|
1013
|
-
F:
|
|
1022
|
+
F: __dxlog_file4,
|
|
1014
1023
|
L: 36,
|
|
1015
1024
|
S: this,
|
|
1016
1025
|
C: (f, a) => f(...a)
|
|
@@ -1033,7 +1042,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1033
1042
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1034
1043
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1035
1044
|
}
|
|
1036
|
-
var
|
|
1045
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
1037
1046
|
var Identity = class {
|
|
1038
1047
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
1039
1048
|
this.stateUpdate = new import_async6.Event();
|
|
@@ -1045,7 +1054,7 @@ var Identity = class {
|
|
|
1045
1054
|
import_log2.log.trace("dxos.halo.device", {
|
|
1046
1055
|
deviceKey
|
|
1047
1056
|
}, {
|
|
1048
|
-
F:
|
|
1057
|
+
F: __dxlog_file5,
|
|
1049
1058
|
L: 70,
|
|
1050
1059
|
S: this,
|
|
1051
1060
|
C: (f, a) => f(...a)
|
|
@@ -1124,7 +1133,7 @@ var Identity = class {
|
|
|
1124
1133
|
*/
|
|
1125
1134
|
getIdentityCredentialSigner() {
|
|
1126
1135
|
(0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
1127
|
-
F:
|
|
1136
|
+
F: __dxlog_file5,
|
|
1128
1137
|
L: 159,
|
|
1129
1138
|
S: this,
|
|
1130
1139
|
A: [
|
|
@@ -1168,7 +1177,7 @@ var Identity = class {
|
|
|
1168
1177
|
controlFeedKey,
|
|
1169
1178
|
dataFeedKey
|
|
1170
1179
|
}, {
|
|
1171
|
-
F:
|
|
1180
|
+
F: __dxlog_file5,
|
|
1172
1181
|
L: 184,
|
|
1173
1182
|
S: this,
|
|
1174
1183
|
C: (f, a) => f(...a)
|
|
@@ -1229,7 +1238,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1229
1238
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1230
1239
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1231
1240
|
}
|
|
1232
|
-
var
|
|
1241
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1233
1242
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1234
1243
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1235
1244
|
var IdentityManager = class {
|
|
@@ -1253,7 +1262,7 @@ var IdentityManager = class {
|
|
|
1253
1262
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
|
|
1254
1263
|
id: traceId
|
|
1255
1264
|
}), {
|
|
1256
|
-
F:
|
|
1265
|
+
F: __dxlog_file6,
|
|
1257
1266
|
L: 104,
|
|
1258
1267
|
S: this,
|
|
1259
1268
|
C: (f, a) => f(...a)
|
|
@@ -1262,7 +1271,7 @@ var IdentityManager = class {
|
|
|
1262
1271
|
(0, import_log4.log)("identity record", {
|
|
1263
1272
|
identityRecord
|
|
1264
1273
|
}, {
|
|
1265
|
-
F:
|
|
1274
|
+
F: __dxlog_file6,
|
|
1266
1275
|
L: 107,
|
|
1267
1276
|
S: this,
|
|
1268
1277
|
C: (f, a) => f(...a)
|
|
@@ -1275,7 +1284,7 @@ var IdentityManager = class {
|
|
|
1275
1284
|
identityKey: identityRecord.identityKey,
|
|
1276
1285
|
displayName: this._identity.profileDocument?.displayName
|
|
1277
1286
|
}, {
|
|
1278
|
-
F:
|
|
1287
|
+
F: __dxlog_file6,
|
|
1279
1288
|
L: 112,
|
|
1280
1289
|
S: this,
|
|
1281
1290
|
C: (f, a) => f(...a)
|
|
@@ -1285,18 +1294,21 @@ var IdentityManager = class {
|
|
|
1285
1294
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
|
|
1286
1295
|
id: traceId
|
|
1287
1296
|
}), {
|
|
1288
|
-
F:
|
|
1297
|
+
F: __dxlog_file6,
|
|
1289
1298
|
L: 119,
|
|
1290
1299
|
S: this,
|
|
1291
1300
|
C: (f, a) => f(...a)
|
|
1292
1301
|
});
|
|
1293
1302
|
}
|
|
1294
1303
|
async close() {
|
|
1295
|
-
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
|
+
}));
|
|
1296
1308
|
}
|
|
1297
1309
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1298
1310
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1299
|
-
F:
|
|
1311
|
+
F: __dxlog_file6,
|
|
1300
1312
|
L: 128,
|
|
1301
1313
|
S: this,
|
|
1302
1314
|
A: [
|
|
@@ -1305,7 +1317,7 @@ var IdentityManager = class {
|
|
|
1305
1317
|
]
|
|
1306
1318
|
});
|
|
1307
1319
|
(0, import_log4.log)("creating identity...", void 0, {
|
|
1308
|
-
F:
|
|
1320
|
+
F: __dxlog_file6,
|
|
1309
1321
|
L: 129,
|
|
1310
1322
|
S: this,
|
|
1311
1323
|
C: (f, a) => f(...a)
|
|
@@ -1322,11 +1334,14 @@ var IdentityManager = class {
|
|
|
1322
1334
|
}
|
|
1323
1335
|
};
|
|
1324
1336
|
const identity = await this._constructIdentity(identityRecord);
|
|
1325
|
-
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
|
+
}));
|
|
1326
1341
|
{
|
|
1327
1342
|
const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1328
1343
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1329
|
-
F:
|
|
1344
|
+
F: __dxlog_file6,
|
|
1330
1345
|
L: 148,
|
|
1331
1346
|
S: this,
|
|
1332
1347
|
A: [
|
|
@@ -1335,7 +1350,7 @@ var IdentityManager = class {
|
|
|
1335
1350
|
]
|
|
1336
1351
|
});
|
|
1337
1352
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1338
|
-
F:
|
|
1353
|
+
F: __dxlog_file6,
|
|
1339
1354
|
L: 149,
|
|
1340
1355
|
S: this,
|
|
1341
1356
|
A: [
|
|
@@ -1374,7 +1389,7 @@ var IdentityManager = class {
|
|
|
1374
1389
|
identityKey: identityRecord.identityKey,
|
|
1375
1390
|
displayName: this._identity.profileDocument?.displayName
|
|
1376
1391
|
}, {
|
|
1377
|
-
F:
|
|
1392
|
+
F: __dxlog_file6,
|
|
1378
1393
|
L: 191,
|
|
1379
1394
|
S: this,
|
|
1380
1395
|
C: (f, a) => f(...a)
|
|
@@ -1385,7 +1400,7 @@ var IdentityManager = class {
|
|
|
1385
1400
|
deviceKey: identity.deviceKey,
|
|
1386
1401
|
profile: identity.profileDocument
|
|
1387
1402
|
}, {
|
|
1388
|
-
F:
|
|
1403
|
+
F: __dxlog_file6,
|
|
1389
1404
|
L: 197,
|
|
1390
1405
|
S: this,
|
|
1391
1406
|
C: (f, a) => f(...a)
|
|
@@ -1422,13 +1437,13 @@ var IdentityManager = class {
|
|
|
1422
1437
|
(0, import_log4.log)("accepting identity", {
|
|
1423
1438
|
params
|
|
1424
1439
|
}, {
|
|
1425
|
-
F:
|
|
1440
|
+
F: __dxlog_file6,
|
|
1426
1441
|
L: 235,
|
|
1427
1442
|
S: this,
|
|
1428
1443
|
C: (f, a) => f(...a)
|
|
1429
1444
|
});
|
|
1430
1445
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1431
|
-
F:
|
|
1446
|
+
F: __dxlog_file6,
|
|
1432
1447
|
L: 236,
|
|
1433
1448
|
S: this,
|
|
1434
1449
|
A: [
|
|
@@ -1448,7 +1463,10 @@ var IdentityManager = class {
|
|
|
1448
1463
|
}
|
|
1449
1464
|
};
|
|
1450
1465
|
const identity = await this._constructIdentity(identityRecord);
|
|
1451
|
-
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
|
+
}));
|
|
1452
1470
|
this._identity = identity;
|
|
1453
1471
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1454
1472
|
await this._identity.ready();
|
|
@@ -1456,7 +1474,7 @@ var IdentityManager = class {
|
|
|
1456
1474
|
identityKey: identityRecord.identityKey,
|
|
1457
1475
|
displayName: this._identity.profileDocument?.displayName
|
|
1458
1476
|
}, {
|
|
1459
|
-
F:
|
|
1477
|
+
F: __dxlog_file6,
|
|
1460
1478
|
L: 255,
|
|
1461
1479
|
S: this,
|
|
1462
1480
|
C: (f, a) => f(...a)
|
|
@@ -1470,7 +1488,7 @@ var IdentityManager = class {
|
|
|
1470
1488
|
identityKey: identity.identityKey,
|
|
1471
1489
|
deviceKey: identity.deviceKey
|
|
1472
1490
|
}, {
|
|
1473
|
-
F:
|
|
1491
|
+
F: __dxlog_file6,
|
|
1474
1492
|
L: 265,
|
|
1475
1493
|
S: this,
|
|
1476
1494
|
C: (f, a) => f(...a)
|
|
@@ -1482,7 +1500,7 @@ var IdentityManager = class {
|
|
|
1482
1500
|
*/
|
|
1483
1501
|
async updateProfile(profile) {
|
|
1484
1502
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1485
|
-
F:
|
|
1503
|
+
F: __dxlog_file6,
|
|
1486
1504
|
L: 273,
|
|
1487
1505
|
S: this,
|
|
1488
1506
|
A: [
|
|
@@ -1513,7 +1531,7 @@ var IdentityManager = class {
|
|
|
1513
1531
|
}
|
|
1514
1532
|
async updateDeviceProfile(profile) {
|
|
1515
1533
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1516
|
-
F:
|
|
1534
|
+
F: __dxlog_file6,
|
|
1517
1535
|
L: 290,
|
|
1518
1536
|
S: this,
|
|
1519
1537
|
A: [
|
|
@@ -1549,7 +1567,7 @@ var IdentityManager = class {
|
|
|
1549
1567
|
}
|
|
1550
1568
|
async _constructIdentity(identityRecord) {
|
|
1551
1569
|
(0, import_invariant3.invariant)(!this._identity, void 0, {
|
|
1552
|
-
F:
|
|
1570
|
+
F: __dxlog_file6,
|
|
1553
1571
|
L: 316,
|
|
1554
1572
|
S: this,
|
|
1555
1573
|
A: [
|
|
@@ -1560,7 +1578,7 @@ var IdentityManager = class {
|
|
|
1560
1578
|
(0, import_log4.log)("constructing identity", {
|
|
1561
1579
|
identityRecord
|
|
1562
1580
|
}, {
|
|
1563
|
-
F:
|
|
1581
|
+
F: __dxlog_file6,
|
|
1564
1582
|
L: 317,
|
|
1565
1583
|
S: this,
|
|
1566
1584
|
C: (f, a) => f(...a)
|
|
@@ -1575,7 +1593,7 @@ var IdentityManager = class {
|
|
|
1575
1593
|
gossip
|
|
1576
1594
|
});
|
|
1577
1595
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1578
|
-
F:
|
|
1596
|
+
F: __dxlog_file6,
|
|
1579
1597
|
L: 330,
|
|
1580
1598
|
S: this,
|
|
1581
1599
|
A: [
|
|
@@ -1587,7 +1605,7 @@ var IdentityManager = class {
|
|
|
1587
1605
|
writable: true
|
|
1588
1606
|
});
|
|
1589
1607
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1590
|
-
F:
|
|
1608
|
+
F: __dxlog_file6,
|
|
1591
1609
|
L: 334,
|
|
1592
1610
|
S: this,
|
|
1593
1611
|
A: [
|
|
@@ -1621,7 +1639,7 @@ var IdentityManager = class {
|
|
|
1621
1639
|
(0, import_log4.log)("done", {
|
|
1622
1640
|
identityKey: identityRecord.identityKey
|
|
1623
1641
|
}, {
|
|
1624
|
-
F:
|
|
1642
|
+
F: __dxlog_file6,
|
|
1625
1643
|
L: 360,
|
|
1626
1644
|
S: this,
|
|
1627
1645
|
C: (f, a) => f(...a)
|
|
@@ -1646,7 +1664,7 @@ var IdentityManager = class {
|
|
|
1646
1664
|
},
|
|
1647
1665
|
onAuthFailure: () => {
|
|
1648
1666
|
import_log4.log.warn("auth failure", void 0, {
|
|
1649
|
-
F:
|
|
1667
|
+
F: __dxlog_file6,
|
|
1650
1668
|
L: 385,
|
|
1651
1669
|
S: this,
|
|
1652
1670
|
C: (f, a) => f(...a)
|
|
@@ -1668,7 +1686,7 @@ _ts_decorate3([
|
|
|
1668
1686
|
IdentityManager = _ts_decorate3([
|
|
1669
1687
|
import_tracing4.trace.resource()
|
|
1670
1688
|
], IdentityManager);
|
|
1671
|
-
var
|
|
1689
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1672
1690
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1673
1691
|
var IdentityServiceImpl = class extends import_context4.Resource {
|
|
1674
1692
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
@@ -1698,7 +1716,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1698
1716
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1699
1717
|
const identity = this._identityManager.identity;
|
|
1700
1718
|
(0, import_invariant4.invariant)(identity, void 0, {
|
|
1701
|
-
F:
|
|
1719
|
+
F: __dxlog_file7,
|
|
1702
1720
|
L: 59,
|
|
1703
1721
|
S: this,
|
|
1704
1722
|
A: [
|
|
@@ -1732,7 +1750,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1732
1750
|
}
|
|
1733
1751
|
async updateProfile(profile) {
|
|
1734
1752
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1735
|
-
F:
|
|
1753
|
+
F: __dxlog_file7,
|
|
1736
1754
|
L: 89,
|
|
1737
1755
|
S: this,
|
|
1738
1756
|
A: [
|
|
@@ -1746,7 +1764,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1746
1764
|
}
|
|
1747
1765
|
async signPresentation({ presentation, nonce }) {
|
|
1748
1766
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1749
|
-
F:
|
|
1767
|
+
F: __dxlog_file7,
|
|
1750
1768
|
L: 96,
|
|
1751
1769
|
S: this,
|
|
1752
1770
|
A: [
|
|
@@ -1781,8 +1799,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1781
1799
|
import_log5.log.warn("Multiple default spaces found. Using the first one.", {
|
|
1782
1800
|
duplicate: space.id
|
|
1783
1801
|
}, {
|
|
1784
|
-
F:
|
|
1785
|
-
L:
|
|
1802
|
+
F: __dxlog_file7,
|
|
1803
|
+
L: 129,
|
|
1786
1804
|
S: this,
|
|
1787
1805
|
C: (f, a) => f(...a)
|
|
1788
1806
|
});
|
|
@@ -1793,6 +1811,13 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1793
1811
|
recodedDefaultSpace = true;
|
|
1794
1812
|
recordedDefaultSpaceTrigger.wake();
|
|
1795
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
|
+
});
|
|
1796
1821
|
});
|
|
1797
1822
|
await Promise.race([
|
|
1798
1823
|
allProcessed,
|
|
@@ -1804,7 +1829,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1804
1829
|
}
|
|
1805
1830
|
}
|
|
1806
1831
|
};
|
|
1807
|
-
var
|
|
1832
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1808
1833
|
var DeviceInvitationProtocol = class {
|
|
1809
1834
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1810
1835
|
this._keyring = _keyring;
|
|
@@ -1830,7 +1855,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1830
1855
|
}
|
|
1831
1856
|
async admit(_, request) {
|
|
1832
1857
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1833
|
-
F:
|
|
1858
|
+
F: __dxlog_file8,
|
|
1834
1859
|
L: 50,
|
|
1835
1860
|
S: this,
|
|
1836
1861
|
A: [
|
|
@@ -1876,7 +1901,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1876
1901
|
}
|
|
1877
1902
|
async accept(response, request) {
|
|
1878
1903
|
(0, import_invariant5.invariant)(response.device, void 0, {
|
|
1879
|
-
F:
|
|
1904
|
+
F: __dxlog_file8,
|
|
1880
1905
|
L: 95,
|
|
1881
1906
|
S: this,
|
|
1882
1907
|
A: [
|
|
@@ -1886,7 +1911,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1886
1911
|
});
|
|
1887
1912
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1888
1913
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1889
|
-
F:
|
|
1914
|
+
F: __dxlog_file8,
|
|
1890
1915
|
L: 98,
|
|
1891
1916
|
S: this,
|
|
1892
1917
|
A: [
|
|
@@ -1925,7 +1950,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1925
1950
|
return guard;
|
|
1926
1951
|
})());
|
|
1927
1952
|
};
|
|
1928
|
-
var
|
|
1953
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1929
1954
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1930
1955
|
var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
1931
1956
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1939,7 +1964,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1939
1964
|
});
|
|
1940
1965
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1941
1966
|
this._callbacks = _callbacks;
|
|
1942
|
-
this._ctx = new import_context6.Context(
|
|
1967
|
+
this._ctx = new import_context6.Context(void 0, {
|
|
1968
|
+
F: __dxlog_file9,
|
|
1969
|
+
L: 33
|
|
1970
|
+
});
|
|
1943
1971
|
this._remoteOptionsTrigger = new import_async10.Trigger();
|
|
1944
1972
|
this._invitationFlowLock = null;
|
|
1945
1973
|
}
|
|
@@ -1951,7 +1979,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1951
1979
|
InvitationHostService: {
|
|
1952
1980
|
options: async (options) => {
|
|
1953
1981
|
(0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1954
|
-
F:
|
|
1982
|
+
F: __dxlog_file9,
|
|
1955
1983
|
L: 63,
|
|
1956
1984
|
S: this,
|
|
1957
1985
|
A: [
|
|
@@ -1978,14 +2006,14 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1978
2006
|
await super.onOpen(context);
|
|
1979
2007
|
try {
|
|
1980
2008
|
(0, import_log7.log)("guest acquire lock", void 0, {
|
|
1981
|
-
F:
|
|
2009
|
+
F: __dxlog_file9,
|
|
1982
2010
|
L: 84,
|
|
1983
2011
|
S: this,
|
|
1984
2012
|
C: (f, a) => f(...a)
|
|
1985
2013
|
});
|
|
1986
2014
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1987
2015
|
(0, import_log7.log)("guest lock acquired", void 0, {
|
|
1988
|
-
F:
|
|
2016
|
+
F: __dxlog_file9,
|
|
1989
2017
|
L: 86,
|
|
1990
2018
|
S: this,
|
|
1991
2019
|
C: (f, a) => f(...a)
|
|
@@ -1994,7 +2022,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1994
2022
|
role: import_invitations3.Options.Role.GUEST
|
|
1995
2023
|
}));
|
|
1996
2024
|
(0, import_log7.log)("options sent", void 0, {
|
|
1997
|
-
F:
|
|
2025
|
+
F: __dxlog_file9,
|
|
1998
2026
|
L: 88,
|
|
1999
2027
|
S: this,
|
|
2000
2028
|
C: (f, a) => f(...a)
|
|
@@ -2003,7 +2031,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2003
2031
|
timeout: OPTIONS_TIMEOUT
|
|
2004
2032
|
}));
|
|
2005
2033
|
(0, import_log7.log)("options received", void 0, {
|
|
2006
|
-
F:
|
|
2034
|
+
F: __dxlog_file9,
|
|
2007
2035
|
L: 90,
|
|
2008
2036
|
S: this,
|
|
2009
2037
|
C: (f, a) => f(...a)
|
|
@@ -2037,7 +2065,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2037
2065
|
this._invitationFlowLock.release();
|
|
2038
2066
|
this._invitationFlowLock = null;
|
|
2039
2067
|
(0, import_log7.log)("invitation flow lock released", void 0, {
|
|
2040
|
-
F:
|
|
2068
|
+
F: __dxlog_file9,
|
|
2041
2069
|
L: 123,
|
|
2042
2070
|
S: this,
|
|
2043
2071
|
C: (f, a) => f(...a)
|
|
@@ -2045,7 +2073,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2045
2073
|
}
|
|
2046
2074
|
}
|
|
2047
2075
|
};
|
|
2048
|
-
var
|
|
2076
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
2049
2077
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
2050
2078
|
var MAX_OTP_ATTEMPTS = 3;
|
|
2051
2079
|
var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
@@ -2060,7 +2088,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2060
2088
|
});
|
|
2061
2089
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
2062
2090
|
this._callbacks = _callbacks;
|
|
2063
|
-
this._ctx = new import_context8.Context(
|
|
2091
|
+
this._ctx = new import_context8.Context(void 0, {
|
|
2092
|
+
F: __dxlog_file10,
|
|
2093
|
+
L: 52
|
|
2094
|
+
});
|
|
2064
2095
|
this._remoteOptionsTrigger = new import_async11.Trigger();
|
|
2065
2096
|
this._challenge = void 0;
|
|
2066
2097
|
this.guestProfile = void 0;
|
|
@@ -2079,7 +2110,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2079
2110
|
InvitationHostService: {
|
|
2080
2111
|
options: async (options) => {
|
|
2081
2112
|
(0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
2082
|
-
F:
|
|
2113
|
+
F: __dxlog_file10,
|
|
2083
2114
|
L: 101,
|
|
2084
2115
|
S: this,
|
|
2085
2116
|
A: [
|
|
@@ -2096,7 +2127,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2096
2127
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
|
|
2097
2128
|
id: traceId
|
|
2098
2129
|
}), {
|
|
2099
|
-
F:
|
|
2130
|
+
F: __dxlog_file10,
|
|
2100
2131
|
L: 110,
|
|
2101
2132
|
S: this,
|
|
2102
2133
|
C: (f, a) => f(...a)
|
|
@@ -2108,7 +2139,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2108
2139
|
expected: invitation.invitationId,
|
|
2109
2140
|
actual: invitationId
|
|
2110
2141
|
}, {
|
|
2111
|
-
F:
|
|
2142
|
+
F: __dxlog_file10,
|
|
2112
2143
|
L: 116,
|
|
2113
2144
|
S: this,
|
|
2114
2145
|
C: (f, a) => f(...a)
|
|
@@ -2122,7 +2153,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2122
2153
|
(0, import_log8.log)("guest introduced themselves", {
|
|
2123
2154
|
guestProfile: profile
|
|
2124
2155
|
}, {
|
|
2125
|
-
F:
|
|
2156
|
+
F: __dxlog_file10,
|
|
2126
2157
|
L: 125,
|
|
2127
2158
|
S: this,
|
|
2128
2159
|
C: (f, a) => f(...a)
|
|
@@ -2133,7 +2164,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2133
2164
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
|
|
2134
2165
|
id: traceId
|
|
2135
2166
|
}), {
|
|
2136
|
-
F:
|
|
2167
|
+
F: __dxlog_file10,
|
|
2137
2168
|
L: 132,
|
|
2138
2169
|
S: this,
|
|
2139
2170
|
C: (f, a) => f(...a)
|
|
@@ -2148,7 +2179,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2148
2179
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
|
|
2149
2180
|
id: traceId
|
|
2150
2181
|
}), {
|
|
2151
|
-
F:
|
|
2182
|
+
F: __dxlog_file10,
|
|
2152
2183
|
L: 141,
|
|
2153
2184
|
S: this,
|
|
2154
2185
|
C: (f, a) => f(...a)
|
|
@@ -2157,7 +2188,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2157
2188
|
(0, import_log8.log)("received authentication request", {
|
|
2158
2189
|
authCode: code
|
|
2159
2190
|
}, {
|
|
2160
|
-
F:
|
|
2191
|
+
F: __dxlog_file10,
|
|
2161
2192
|
L: 144,
|
|
2162
2193
|
S: this,
|
|
2163
2194
|
C: (f, a) => f(...a)
|
|
@@ -2171,7 +2202,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2171
2202
|
switch (invitation.authMethod) {
|
|
2172
2203
|
case import_services8.Invitation.AuthMethod.NONE: {
|
|
2173
2204
|
(0, import_log8.log)("authentication not required", void 0, {
|
|
2174
|
-
F:
|
|
2205
|
+
F: __dxlog_file10,
|
|
2175
2206
|
L: 152,
|
|
2176
2207
|
S: this,
|
|
2177
2208
|
C: (f, a) => f(...a)
|
|
@@ -2209,7 +2240,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2209
2240
|
import_log8.log.error("invalid authentication method", {
|
|
2210
2241
|
authMethod: invitation.authMethod
|
|
2211
2242
|
}, {
|
|
2212
|
-
F:
|
|
2243
|
+
F: __dxlog_file10,
|
|
2213
2244
|
L: 190,
|
|
2214
2245
|
S: this,
|
|
2215
2246
|
C: (f, a) => f(...a)
|
|
@@ -2234,7 +2265,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2234
2265
|
status
|
|
2235
2266
|
}
|
|
2236
2267
|
}), {
|
|
2237
|
-
F:
|
|
2268
|
+
F: __dxlog_file10,
|
|
2238
2269
|
L: 202,
|
|
2239
2270
|
S: this,
|
|
2240
2271
|
C: (f, a) => f(...a)
|
|
@@ -2248,7 +2279,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2248
2279
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
|
|
2249
2280
|
id: traceId
|
|
2250
2281
|
}), {
|
|
2251
|
-
F:
|
|
2282
|
+
F: __dxlog_file10,
|
|
2252
2283
|
L: 208,
|
|
2253
2284
|
S: this,
|
|
2254
2285
|
C: (f, a) => f(...a)
|
|
@@ -2265,7 +2296,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2265
2296
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
|
|
2266
2297
|
id: traceId
|
|
2267
2298
|
}), {
|
|
2268
|
-
F:
|
|
2299
|
+
F: __dxlog_file10,
|
|
2269
2300
|
L: 222,
|
|
2270
2301
|
S: this,
|
|
2271
2302
|
C: (f, a) => f(...a)
|
|
@@ -2283,14 +2314,14 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2283
2314
|
await super.onOpen(context);
|
|
2284
2315
|
try {
|
|
2285
2316
|
(0, import_log8.log)("host acquire lock", void 0, {
|
|
2286
|
-
F:
|
|
2317
|
+
F: __dxlog_file10,
|
|
2287
2318
|
L: 237,
|
|
2288
2319
|
S: this,
|
|
2289
2320
|
C: (f, a) => f(...a)
|
|
2290
2321
|
});
|
|
2291
2322
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2292
2323
|
(0, import_log8.log)("host lock acquired", void 0, {
|
|
2293
|
-
F:
|
|
2324
|
+
F: __dxlog_file10,
|
|
2294
2325
|
L: 239,
|
|
2295
2326
|
S: this,
|
|
2296
2327
|
C: (f, a) => f(...a)
|
|
@@ -2301,7 +2332,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2301
2332
|
role: import_invitations4.Options.Role.HOST
|
|
2302
2333
|
});
|
|
2303
2334
|
(0, import_log8.log)("options sent", void 0, {
|
|
2304
|
-
F:
|
|
2335
|
+
F: __dxlog_file10,
|
|
2305
2336
|
L: 243,
|
|
2306
2337
|
S: this,
|
|
2307
2338
|
C: (f, a) => f(...a)
|
|
@@ -2310,7 +2341,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2310
2341
|
timeout: OPTIONS_TIMEOUT2
|
|
2311
2342
|
}));
|
|
2312
2343
|
(0, import_log8.log)("options received", void 0, {
|
|
2313
|
-
F:
|
|
2344
|
+
F: __dxlog_file10,
|
|
2314
2345
|
L: 245,
|
|
2315
2346
|
S: this,
|
|
2316
2347
|
C: (f, a) => f(...a)
|
|
@@ -2364,7 +2395,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2364
2395
|
this._invitationFlowLock?.release();
|
|
2365
2396
|
this._invitationFlowLock = null;
|
|
2366
2397
|
(0, import_log8.log)("invitation flow lock released", void 0, {
|
|
2367
|
-
F:
|
|
2398
|
+
F: __dxlog_file10,
|
|
2368
2399
|
L: 300,
|
|
2369
2400
|
S: this,
|
|
2370
2401
|
C: (f, a) => f(...a)
|
|
@@ -2373,7 +2404,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2373
2404
|
}
|
|
2374
2405
|
};
|
|
2375
2406
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services8.Invitation.AuthMethod.NONE;
|
|
2376
|
-
var
|
|
2407
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2377
2408
|
var InvitationTopology = class {
|
|
2378
2409
|
constructor(_role) {
|
|
2379
2410
|
this._role = _role;
|
|
@@ -2381,7 +2412,7 @@ var InvitationTopology = class {
|
|
|
2381
2412
|
}
|
|
2382
2413
|
init(controller) {
|
|
2383
2414
|
(0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
|
|
2384
|
-
F:
|
|
2415
|
+
F: __dxlog_file11,
|
|
2385
2416
|
L: 42,
|
|
2386
2417
|
S: this,
|
|
2387
2418
|
A: [
|
|
@@ -2393,7 +2424,7 @@ var InvitationTopology = class {
|
|
|
2393
2424
|
}
|
|
2394
2425
|
update() {
|
|
2395
2426
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2396
|
-
F:
|
|
2427
|
+
F: __dxlog_file11,
|
|
2397
2428
|
L: 47,
|
|
2398
2429
|
S: this,
|
|
2399
2430
|
A: [
|
|
@@ -2416,7 +2447,7 @@ var InvitationTopology = class {
|
|
|
2416
2447
|
ownPeerId,
|
|
2417
2448
|
remotePeerId: firstUnknownPeer
|
|
2418
2449
|
}, {
|
|
2419
|
-
F:
|
|
2450
|
+
F: __dxlog_file11,
|
|
2420
2451
|
L: 69,
|
|
2421
2452
|
S: this,
|
|
2422
2453
|
C: (f, a) => f(...a)
|
|
@@ -2427,7 +2458,7 @@ var InvitationTopology = class {
|
|
|
2427
2458
|
}
|
|
2428
2459
|
async onOffer(peer) {
|
|
2429
2460
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2430
|
-
F:
|
|
2461
|
+
F: __dxlog_file11,
|
|
2431
2462
|
L: 76,
|
|
2432
2463
|
S: this,
|
|
2433
2464
|
A: [
|
|
@@ -2444,7 +2475,7 @@ var InvitationTopology = class {
|
|
|
2444
2475
|
return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
|
|
2445
2476
|
}
|
|
2446
2477
|
};
|
|
2447
|
-
var
|
|
2478
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2448
2479
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2449
2480
|
var InvitationsHandler = class {
|
|
2450
2481
|
/**
|
|
@@ -2469,7 +2500,7 @@ var InvitationsHandler = class {
|
|
|
2469
2500
|
try {
|
|
2470
2501
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2471
2502
|
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
2472
|
-
F:
|
|
2503
|
+
F: __dxlog_file12,
|
|
2473
2504
|
L: 90,
|
|
2474
2505
|
S: this,
|
|
2475
2506
|
A: [
|
|
@@ -2498,7 +2529,7 @@ var InvitationsHandler = class {
|
|
|
2498
2529
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
2499
2530
|
id: traceId
|
|
2500
2531
|
}), {
|
|
2501
|
-
F:
|
|
2532
|
+
F: __dxlog_file12,
|
|
2502
2533
|
L: 115,
|
|
2503
2534
|
S: this,
|
|
2504
2535
|
C: (f, a) => f(...a)
|
|
@@ -2506,7 +2537,7 @@ var InvitationsHandler = class {
|
|
|
2506
2537
|
(0, import_log6.log)("connected", {
|
|
2507
2538
|
...protocol.toJSON()
|
|
2508
2539
|
}, {
|
|
2509
|
-
F:
|
|
2540
|
+
F: __dxlog_file12,
|
|
2510
2541
|
L: 116,
|
|
2511
2542
|
S: this,
|
|
2512
2543
|
C: (f, a) => f(...a)
|
|
@@ -2518,7 +2549,7 @@ var InvitationsHandler = class {
|
|
|
2518
2549
|
guest: deviceKey,
|
|
2519
2550
|
...protocol.toJSON()
|
|
2520
2551
|
}, {
|
|
2521
|
-
F:
|
|
2552
|
+
F: __dxlog_file12,
|
|
2522
2553
|
L: 118,
|
|
2523
2554
|
S: this,
|
|
2524
2555
|
C: (f, a) => f(...a)
|
|
@@ -2527,7 +2558,7 @@ var InvitationsHandler = class {
|
|
|
2527
2558
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
|
|
2528
2559
|
id: traceId
|
|
2529
2560
|
}), {
|
|
2530
|
-
F:
|
|
2561
|
+
F: __dxlog_file12,
|
|
2531
2562
|
L: 120,
|
|
2532
2563
|
S: this,
|
|
2533
2564
|
C: (f, a) => f(...a)
|
|
@@ -2542,7 +2573,7 @@ var InvitationsHandler = class {
|
|
|
2542
2573
|
(0, import_log6.log)("timeout", {
|
|
2543
2574
|
...protocol.toJSON()
|
|
2544
2575
|
}, {
|
|
2545
|
-
F:
|
|
2576
|
+
F: __dxlog_file12,
|
|
2546
2577
|
L: 129,
|
|
2547
2578
|
S: this,
|
|
2548
2579
|
C: (f, a) => f(...a)
|
|
@@ -2551,7 +2582,7 @@ var InvitationsHandler = class {
|
|
|
2551
2582
|
} else {
|
|
2552
2583
|
if (guardedState.error(extension, err)) {
|
|
2553
2584
|
import_log6.log.error("failed", err, {
|
|
2554
|
-
F:
|
|
2585
|
+
F: __dxlog_file12,
|
|
2555
2586
|
L: 133,
|
|
2556
2587
|
S: this,
|
|
2557
2588
|
C: (f, a) => f(...a)
|
|
@@ -2562,7 +2593,7 @@ var InvitationsHandler = class {
|
|
|
2562
2593
|
id: traceId,
|
|
2563
2594
|
error: err
|
|
2564
2595
|
}), {
|
|
2565
|
-
F:
|
|
2596
|
+
F: __dxlog_file12,
|
|
2566
2597
|
L: 136,
|
|
2567
2598
|
S: this,
|
|
2568
2599
|
C: (f, a) => f(...a)
|
|
@@ -2576,7 +2607,7 @@ var InvitationsHandler = class {
|
|
|
2576
2607
|
(0, import_log6.log)("invalid role", {
|
|
2577
2608
|
...err.context
|
|
2578
2609
|
}, {
|
|
2579
|
-
F:
|
|
2610
|
+
F: __dxlog_file12,
|
|
2580
2611
|
L: 144,
|
|
2581
2612
|
S: this,
|
|
2582
2613
|
C: (f, a) => f(...a)
|
|
@@ -2588,7 +2619,7 @@ var InvitationsHandler = class {
|
|
|
2588
2619
|
(0, import_log6.log)("timeout", {
|
|
2589
2620
|
err
|
|
2590
2621
|
}, {
|
|
2591
|
-
F:
|
|
2622
|
+
F: __dxlog_file12,
|
|
2592
2623
|
L: 149,
|
|
2593
2624
|
S: this,
|
|
2594
2625
|
C: (f, a) => f(...a)
|
|
@@ -2597,7 +2628,7 @@ var InvitationsHandler = class {
|
|
|
2597
2628
|
} else {
|
|
2598
2629
|
if (guardedState.error(extension, err)) {
|
|
2599
2630
|
import_log6.log.error("failed", err, {
|
|
2600
|
-
F:
|
|
2631
|
+
F: __dxlog_file12,
|
|
2601
2632
|
L: 153,
|
|
2602
2633
|
S: this,
|
|
2603
2634
|
C: (f, a) => f(...a)
|
|
@@ -2611,7 +2642,7 @@ var InvitationsHandler = class {
|
|
|
2611
2642
|
if (invitation.lifetime && invitation.created) {
|
|
2612
2643
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2613
2644
|
import_log6.log.warn("invitation has already expired", void 0, {
|
|
2614
|
-
F:
|
|
2645
|
+
F: __dxlog_file12,
|
|
2615
2646
|
L: 164,
|
|
2616
2647
|
S: this,
|
|
2617
2648
|
C: (f, a) => f(...a)
|
|
@@ -2634,7 +2665,7 @@ var InvitationsHandler = class {
|
|
|
2634
2665
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2635
2666
|
if (deviceProfile) {
|
|
2636
2667
|
(0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2637
|
-
F:
|
|
2668
|
+
F: __dxlog_file12,
|
|
2638
2669
|
L: 197,
|
|
2639
2670
|
S: this,
|
|
2640
2671
|
A: [
|
|
@@ -2652,7 +2683,7 @@ var InvitationsHandler = class {
|
|
|
2652
2683
|
invitationType: import_services6.Invitation.Type.DELEGATED,
|
|
2653
2684
|
triedPeers: triedPeersIds.size
|
|
2654
2685
|
}, {
|
|
2655
|
-
F:
|
|
2686
|
+
F: __dxlog_file12,
|
|
2656
2687
|
L: 205,
|
|
2657
2688
|
S: this,
|
|
2658
2689
|
C: (f, a) => f(...a)
|
|
@@ -2679,7 +2710,7 @@ var InvitationsHandler = class {
|
|
|
2679
2710
|
admitted,
|
|
2680
2711
|
currentState: guardedState.current.state
|
|
2681
2712
|
}, {
|
|
2682
|
-
F:
|
|
2713
|
+
F: __dxlog_file12,
|
|
2683
2714
|
L: 233,
|
|
2684
2715
|
S: this,
|
|
2685
2716
|
C: (f, a) => f(...a)
|
|
@@ -2697,7 +2728,7 @@ var InvitationsHandler = class {
|
|
|
2697
2728
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
2698
2729
|
id: traceId
|
|
2699
2730
|
}), {
|
|
2700
|
-
F:
|
|
2731
|
+
F: __dxlog_file12,
|
|
2701
2732
|
L: 245,
|
|
2702
2733
|
S: this,
|
|
2703
2734
|
C: (f, a) => f(...a)
|
|
@@ -2709,7 +2740,7 @@ var InvitationsHandler = class {
|
|
|
2709
2740
|
(0, import_log6.log)("connected", {
|
|
2710
2741
|
...protocol.toJSON()
|
|
2711
2742
|
}, {
|
|
2712
|
-
F:
|
|
2743
|
+
F: __dxlog_file12,
|
|
2713
2744
|
L: 256,
|
|
2714
2745
|
S: this,
|
|
2715
2746
|
C: (f, a) => f(...a)
|
|
@@ -2718,7 +2749,7 @@ var InvitationsHandler = class {
|
|
|
2718
2749
|
(0, import_log6.log)("introduce", {
|
|
2719
2750
|
...protocol.toJSON()
|
|
2720
2751
|
}, {
|
|
2721
|
-
F:
|
|
2752
|
+
F: __dxlog_file12,
|
|
2722
2753
|
L: 260,
|
|
2723
2754
|
S: this,
|
|
2724
2755
|
C: (f, a) => f(...a)
|
|
@@ -2731,7 +2762,7 @@ var InvitationsHandler = class {
|
|
|
2731
2762
|
...protocol.toJSON(),
|
|
2732
2763
|
response: introductionResponse
|
|
2733
2764
|
}, {
|
|
2734
|
-
F:
|
|
2765
|
+
F: __dxlog_file12,
|
|
2735
2766
|
L: 265,
|
|
2736
2767
|
S: this,
|
|
2737
2768
|
C: (f, a) => f(...a)
|
|
@@ -2752,7 +2783,7 @@ var InvitationsHandler = class {
|
|
|
2752
2783
|
(0, import_log6.log)("request admission", {
|
|
2753
2784
|
...protocol.toJSON()
|
|
2754
2785
|
}, {
|
|
2755
|
-
F:
|
|
2786
|
+
F: __dxlog_file12,
|
|
2756
2787
|
L: 291,
|
|
2757
2788
|
S: this,
|
|
2758
2789
|
C: (f, a) => f(...a)
|
|
@@ -2764,7 +2795,7 @@ var InvitationsHandler = class {
|
|
|
2764
2795
|
(0, import_log6.log)("admitted by host", {
|
|
2765
2796
|
...protocol.toJSON()
|
|
2766
2797
|
}, {
|
|
2767
|
-
F:
|
|
2798
|
+
F: __dxlog_file12,
|
|
2768
2799
|
L: 302,
|
|
2769
2800
|
S: this,
|
|
2770
2801
|
C: (f, a) => f(...a)
|
|
@@ -2777,7 +2808,7 @@ var InvitationsHandler = class {
|
|
|
2777
2808
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
|
|
2778
2809
|
id: traceId
|
|
2779
2810
|
}), {
|
|
2780
|
-
F:
|
|
2811
|
+
F: __dxlog_file12,
|
|
2781
2812
|
L: 308,
|
|
2782
2813
|
S: this,
|
|
2783
2814
|
C: (f, a) => f(...a)
|
|
@@ -2787,7 +2818,7 @@ var InvitationsHandler = class {
|
|
|
2787
2818
|
(0, import_log6.log)("timeout", {
|
|
2788
2819
|
...protocol.toJSON()
|
|
2789
2820
|
}, {
|
|
2790
|
-
F:
|
|
2821
|
+
F: __dxlog_file12,
|
|
2791
2822
|
L: 311,
|
|
2792
2823
|
S: this,
|
|
2793
2824
|
C: (f, a) => f(...a)
|
|
@@ -2795,7 +2826,7 @@ var InvitationsHandler = class {
|
|
|
2795
2826
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2796
2827
|
} else {
|
|
2797
2828
|
(0, import_log6.log)("auth failed", err, {
|
|
2798
|
-
F:
|
|
2829
|
+
F: __dxlog_file12,
|
|
2799
2830
|
L: 314,
|
|
2800
2831
|
S: this,
|
|
2801
2832
|
C: (f, a) => f(...a)
|
|
@@ -2807,7 +2838,7 @@ var InvitationsHandler = class {
|
|
|
2807
2838
|
id: traceId,
|
|
2808
2839
|
error: err
|
|
2809
2840
|
}), {
|
|
2810
|
-
F:
|
|
2841
|
+
F: __dxlog_file12,
|
|
2811
2842
|
L: 318,
|
|
2812
2843
|
S: this,
|
|
2813
2844
|
C: (f, a) => f(...a)
|
|
@@ -2823,7 +2854,7 @@ var InvitationsHandler = class {
|
|
|
2823
2854
|
(0, import_log6.log)("timeout", {
|
|
2824
2855
|
...protocol.toJSON()
|
|
2825
2856
|
}, {
|
|
2826
|
-
F:
|
|
2857
|
+
F: __dxlog_file12,
|
|
2827
2858
|
L: 327,
|
|
2828
2859
|
S: this,
|
|
2829
2860
|
C: (f, a) => f(...a)
|
|
@@ -2831,7 +2862,7 @@ var InvitationsHandler = class {
|
|
|
2831
2862
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2832
2863
|
} else {
|
|
2833
2864
|
(0, import_log6.log)("auth failed", err, {
|
|
2834
|
-
F:
|
|
2865
|
+
F: __dxlog_file12,
|
|
2835
2866
|
L: 330,
|
|
2836
2867
|
S: this,
|
|
2837
2868
|
C: (f, a) => f(...a)
|
|
@@ -2849,7 +2880,7 @@ var InvitationsHandler = class {
|
|
|
2849
2880
|
await ctx.dispose();
|
|
2850
2881
|
} else {
|
|
2851
2882
|
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2852
|
-
F:
|
|
2883
|
+
F: __dxlog_file12,
|
|
2853
2884
|
L: 345,
|
|
2854
2885
|
S: this,
|
|
2855
2886
|
A: [
|
|
@@ -2943,16 +2974,29 @@ var InvitationsHandler = class {
|
|
|
2943
2974
|
};
|
|
2944
2975
|
}
|
|
2945
2976
|
_logStateUpdate(invitation, actor, newState) {
|
|
2946
|
-
(
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
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
|
+
}
|
|
2956
3000
|
}
|
|
2957
3001
|
_isNotTerminal(currentState) {
|
|
2958
3002
|
return ![
|
|
@@ -2966,16 +3010,16 @@ var InvitationsHandler = class {
|
|
|
2966
3010
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2967
3011
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2968
3012
|
(0, import_log6.log)("guest waiting for authentication code...", void 0, {
|
|
2969
|
-
F:
|
|
2970
|
-
L:
|
|
3013
|
+
F: __dxlog_file12,
|
|
3014
|
+
L: 470,
|
|
2971
3015
|
S: this,
|
|
2972
3016
|
C: (f, a) => f(...a)
|
|
2973
3017
|
});
|
|
2974
3018
|
setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2975
3019
|
const authCode = await authenticated.wait(options);
|
|
2976
3020
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
2977
|
-
F:
|
|
2978
|
-
L:
|
|
3021
|
+
F: __dxlog_file12,
|
|
3022
|
+
L: 474,
|
|
2979
3023
|
S: this,
|
|
2980
3024
|
C: (f, a) => f(...a)
|
|
2981
3025
|
});
|
|
@@ -2993,8 +3037,8 @@ var InvitationsHandler = class {
|
|
|
2993
3037
|
(0, import_log6.log)("retrying invalid code", {
|
|
2994
3038
|
attempt
|
|
2995
3039
|
}, {
|
|
2996
|
-
F:
|
|
2997
|
-
L:
|
|
3040
|
+
F: __dxlog_file12,
|
|
3041
|
+
L: 485,
|
|
2998
3042
|
S: this,
|
|
2999
3043
|
C: (f, a) => f(...a)
|
|
3000
3044
|
});
|
|
@@ -3011,8 +3055,8 @@ var InvitationsHandler = class {
|
|
|
3011
3055
|
throw new Error("challenge missing in the introduction");
|
|
3012
3056
|
}
|
|
3013
3057
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3014
|
-
F:
|
|
3015
|
-
L:
|
|
3058
|
+
F: __dxlog_file12,
|
|
3059
|
+
L: 504,
|
|
3016
3060
|
S: this,
|
|
3017
3061
|
C: (f, a) => f(...a)
|
|
3018
3062
|
});
|
|
@@ -3126,7 +3170,7 @@ var InvitationsServiceImpl = class {
|
|
|
3126
3170
|
});
|
|
3127
3171
|
}
|
|
3128
3172
|
};
|
|
3129
|
-
var
|
|
3173
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3130
3174
|
var SpaceInvitationProtocol = class {
|
|
3131
3175
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3132
3176
|
this._spaceManager = _spaceManager;
|
|
@@ -3160,79 +3204,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3160
3204
|
};
|
|
3161
3205
|
}
|
|
3162
3206
|
async admit(invitation, request, guestProfile) {
|
|
3163
|
-
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3164
|
-
F:
|
|
3165
|
-
L:
|
|
3166
|
-
S: this,
|
|
3167
|
-
A: [
|
|
3168
|
-
"this._spaceKey",
|
|
3169
|
-
""
|
|
3170
|
-
]
|
|
3171
|
-
});
|
|
3172
|
-
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3173
|
-
(0, import_invariant10.invariant)(space, void 0, {
|
|
3174
|
-
F: __dxlog_file12,
|
|
3175
|
-
L: 78,
|
|
3176
|
-
S: this,
|
|
3177
|
-
A: [
|
|
3178
|
-
"space",
|
|
3179
|
-
""
|
|
3180
|
-
]
|
|
3181
|
-
});
|
|
3182
|
-
(0, import_invariant10.invariant)(request.space, void 0, {
|
|
3183
|
-
F: __dxlog_file12,
|
|
3184
|
-
L: 80,
|
|
3207
|
+
(0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
|
|
3208
|
+
F: __dxlog_file13,
|
|
3209
|
+
L: 74,
|
|
3185
3210
|
S: this,
|
|
3186
3211
|
A: [
|
|
3187
|
-
"request.space",
|
|
3212
|
+
"this._spaceKey && request.space",
|
|
3188
3213
|
""
|
|
3189
3214
|
]
|
|
3190
3215
|
});
|
|
3191
|
-
const { identityKey, deviceKey } = request.space;
|
|
3192
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
|
|
3193
|
-
throw new import_protocols8.AlreadyJoinedError();
|
|
3194
|
-
}
|
|
3195
3216
|
(0, import_log10.log)("writing guest credentials", {
|
|
3196
3217
|
host: this._signingContext.deviceKey,
|
|
3197
|
-
guest: deviceKey
|
|
3218
|
+
guest: request.space.deviceKey
|
|
3198
3219
|
}, {
|
|
3199
|
-
F:
|
|
3200
|
-
L:
|
|
3220
|
+
F: __dxlog_file13,
|
|
3221
|
+
L: 75,
|
|
3201
3222
|
S: this,
|
|
3202
3223
|
C: (f, a) => f(...a)
|
|
3203
3224
|
});
|
|
3204
|
-
const
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
"credentials[0].credential",
|
|
3211
|
-
""
|
|
3212
|
-
]
|
|
3213
|
-
});
|
|
3214
|
-
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3215
|
-
(0, import_invariant10.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3216
|
-
F: __dxlog_file12,
|
|
3217
|
-
L: 103,
|
|
3218
|
-
S: this,
|
|
3219
|
-
A: [
|
|
3220
|
-
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3221
|
-
""
|
|
3222
|
-
]
|
|
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
|
|
3223
3231
|
});
|
|
3224
|
-
|
|
3232
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3225
3233
|
return {
|
|
3226
3234
|
space: {
|
|
3227
3235
|
credential: spaceMemberCredential,
|
|
3228
|
-
controlTimeframe: space
|
|
3236
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3229
3237
|
}
|
|
3230
3238
|
};
|
|
3231
3239
|
}
|
|
3232
3240
|
async delegate(invitation) {
|
|
3233
3241
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3234
|
-
F:
|
|
3235
|
-
L:
|
|
3242
|
+
F: __dxlog_file13,
|
|
3243
|
+
L: 95,
|
|
3236
3244
|
S: this,
|
|
3237
3245
|
A: [
|
|
3238
3246
|
"this._spaceKey",
|
|
@@ -3241,8 +3249,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3241
3249
|
});
|
|
3242
3250
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3243
3251
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3244
|
-
F:
|
|
3245
|
-
L:
|
|
3252
|
+
F: __dxlog_file13,
|
|
3253
|
+
L: 97,
|
|
3246
3254
|
S: this,
|
|
3247
3255
|
A: [
|
|
3248
3256
|
"space",
|
|
@@ -3251,8 +3259,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3251
3259
|
});
|
|
3252
3260
|
if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3253
3261
|
(0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
3254
|
-
F:
|
|
3255
|
-
L:
|
|
3262
|
+
F: __dxlog_file13,
|
|
3263
|
+
L: 99,
|
|
3256
3264
|
S: this,
|
|
3257
3265
|
A: [
|
|
3258
3266
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3264,8 +3272,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3264
3272
|
host: this._signingContext.deviceKey,
|
|
3265
3273
|
id: invitation.invitationId
|
|
3266
3274
|
}, {
|
|
3267
|
-
F:
|
|
3268
|
-
L:
|
|
3275
|
+
F: __dxlog_file13,
|
|
3276
|
+
L: 102,
|
|
3269
3277
|
S: this,
|
|
3270
3278
|
C: (f, a) => f(...a)
|
|
3271
3279
|
});
|
|
@@ -3279,8 +3287,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3279
3287
|
guestKey: invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3280
3288
|
});
|
|
3281
3289
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3282
|
-
F:
|
|
3283
|
-
L:
|
|
3290
|
+
F: __dxlog_file13,
|
|
3291
|
+
L: 122,
|
|
3284
3292
|
S: this,
|
|
3285
3293
|
A: [
|
|
3286
3294
|
"credential.credential",
|
|
@@ -3294,8 +3302,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3294
3302
|
}
|
|
3295
3303
|
async cancelDelegation(invitation) {
|
|
3296
3304
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3297
|
-
F:
|
|
3298
|
-
L:
|
|
3305
|
+
F: __dxlog_file13,
|
|
3306
|
+
L: 128,
|
|
3299
3307
|
S: this,
|
|
3300
3308
|
A: [
|
|
3301
3309
|
"this._spaceKey",
|
|
@@ -3303,8 +3311,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3303
3311
|
]
|
|
3304
3312
|
});
|
|
3305
3313
|
(0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3306
|
-
F:
|
|
3307
|
-
L:
|
|
3314
|
+
F: __dxlog_file13,
|
|
3315
|
+
L: 129,
|
|
3308
3316
|
S: this,
|
|
3309
3317
|
A: [
|
|
3310
3318
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3313,8 +3321,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3313
3321
|
});
|
|
3314
3322
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3315
3323
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3316
|
-
F:
|
|
3317
|
-
L:
|
|
3324
|
+
F: __dxlog_file13,
|
|
3325
|
+
L: 131,
|
|
3318
3326
|
S: this,
|
|
3319
3327
|
A: [
|
|
3320
3328
|
"space",
|
|
@@ -3325,15 +3333,15 @@ var SpaceInvitationProtocol = class {
|
|
|
3325
3333
|
host: this._signingContext.deviceKey,
|
|
3326
3334
|
id: invitation.invitationId
|
|
3327
3335
|
}, {
|
|
3328
|
-
F:
|
|
3329
|
-
L:
|
|
3336
|
+
F: __dxlog_file13,
|
|
3337
|
+
L: 133,
|
|
3330
3338
|
S: this,
|
|
3331
3339
|
C: (f, a) => f(...a)
|
|
3332
3340
|
});
|
|
3333
3341
|
const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3334
3342
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3335
|
-
F:
|
|
3336
|
-
L:
|
|
3343
|
+
F: __dxlog_file13,
|
|
3344
|
+
L: 140,
|
|
3337
3345
|
S: this,
|
|
3338
3346
|
A: [
|
|
3339
3347
|
"credential.credential",
|
|
@@ -3371,8 +3379,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3371
3379
|
}
|
|
3372
3380
|
async accept(response) {
|
|
3373
3381
|
(0, import_invariant10.invariant)(response.space, void 0, {
|
|
3374
|
-
F:
|
|
3375
|
-
L:
|
|
3382
|
+
F: __dxlog_file13,
|
|
3383
|
+
L: 175,
|
|
3376
3384
|
S: this,
|
|
3377
3385
|
A: [
|
|
3378
3386
|
"response.space",
|
|
@@ -3382,8 +3390,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3382
3390
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3383
3391
|
const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
|
|
3384
3392
|
(0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3385
|
-
F:
|
|
3386
|
-
L:
|
|
3393
|
+
F: __dxlog_file13,
|
|
3394
|
+
L: 178,
|
|
3387
3395
|
S: this,
|
|
3388
3396
|
A: [
|
|
3389
3397
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3391,8 +3399,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3391
3399
|
]
|
|
3392
3400
|
});
|
|
3393
3401
|
(0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3394
|
-
F:
|
|
3395
|
-
L:
|
|
3402
|
+
F: __dxlog_file13,
|
|
3403
|
+
L: 179,
|
|
3396
3404
|
S: this,
|
|
3397
3405
|
A: [
|
|
3398
3406
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3414,7 +3422,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3414
3422
|
};
|
|
3415
3423
|
}
|
|
3416
3424
|
};
|
|
3417
|
-
var
|
|
3425
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3418
3426
|
var InvitationsManager = class {
|
|
3419
3427
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3420
3428
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3457,7 +3465,7 @@ var InvitationsManager = class {
|
|
|
3457
3465
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3458
3466
|
} catch (err) {
|
|
3459
3467
|
import_log11.log.catch(err, void 0, {
|
|
3460
|
-
F:
|
|
3468
|
+
F: __dxlog_file14,
|
|
3461
3469
|
L: 82,
|
|
3462
3470
|
S: this,
|
|
3463
3471
|
C: (f, a) => f(...a)
|
|
@@ -3480,7 +3488,7 @@ var InvitationsManager = class {
|
|
|
3480
3488
|
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
3481
3489
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3482
3490
|
(0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3483
|
-
F:
|
|
3491
|
+
F: __dxlog_file14,
|
|
3484
3492
|
L: 103,
|
|
3485
3493
|
S: this,
|
|
3486
3494
|
A: [
|
|
@@ -3499,7 +3507,7 @@ var InvitationsManager = class {
|
|
|
3499
3507
|
};
|
|
3500
3508
|
} catch (err) {
|
|
3501
3509
|
import_log11.log.catch(err, void 0, {
|
|
3502
|
-
F:
|
|
3510
|
+
F: __dxlog_file14,
|
|
3503
3511
|
L: 110,
|
|
3504
3512
|
S: this,
|
|
3505
3513
|
C: (f, a) => f(...a)
|
|
@@ -3531,13 +3539,13 @@ var InvitationsManager = class {
|
|
|
3531
3539
|
}
|
|
3532
3540
|
async authenticate({ invitationId, authCode }) {
|
|
3533
3541
|
(0, import_log11.log)("authenticating...", void 0, {
|
|
3534
|
-
F:
|
|
3542
|
+
F: __dxlog_file14,
|
|
3535
3543
|
L: 140,
|
|
3536
3544
|
S: this,
|
|
3537
3545
|
C: (f, a) => f(...a)
|
|
3538
3546
|
});
|
|
3539
3547
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3540
|
-
F:
|
|
3548
|
+
F: __dxlog_file14,
|
|
3541
3549
|
L: 141,
|
|
3542
3550
|
S: this,
|
|
3543
3551
|
A: [
|
|
@@ -3550,7 +3558,7 @@ var InvitationsManager = class {
|
|
|
3550
3558
|
import_log11.log.warn("invalid invitation", {
|
|
3551
3559
|
invitationId
|
|
3552
3560
|
}, {
|
|
3553
|
-
F:
|
|
3561
|
+
F: __dxlog_file14,
|
|
3554
3562
|
L: 144,
|
|
3555
3563
|
S: this,
|
|
3556
3564
|
C: (f, a) => f(...a)
|
|
@@ -3563,13 +3571,13 @@ var InvitationsManager = class {
|
|
|
3563
3571
|
(0, import_log11.log)("cancelInvitation...", {
|
|
3564
3572
|
invitationId
|
|
3565
3573
|
}, {
|
|
3566
|
-
F:
|
|
3574
|
+
F: __dxlog_file14,
|
|
3567
3575
|
L: 151,
|
|
3568
3576
|
S: this,
|
|
3569
3577
|
C: (f, a) => f(...a)
|
|
3570
3578
|
});
|
|
3571
3579
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3572
|
-
F:
|
|
3580
|
+
F: __dxlog_file14,
|
|
3573
3581
|
L: 152,
|
|
3574
3582
|
S: this,
|
|
3575
3583
|
A: [
|
|
@@ -3643,12 +3651,15 @@ var InvitationsManager = class {
|
|
|
3643
3651
|
stream.error(err);
|
|
3644
3652
|
void ctx.dispose();
|
|
3645
3653
|
}
|
|
3654
|
+
}, {
|
|
3655
|
+
F: __dxlog_file14,
|
|
3656
|
+
L: 234
|
|
3646
3657
|
});
|
|
3647
3658
|
ctx.onDispose(() => {
|
|
3648
3659
|
(0, import_log11.log)("complete", {
|
|
3649
3660
|
...handler.toJSON()
|
|
3650
3661
|
}, {
|
|
3651
|
-
F:
|
|
3662
|
+
F: __dxlog_file14,
|
|
3652
3663
|
L: 241,
|
|
3653
3664
|
S: this,
|
|
3654
3665
|
C: (f, a) => f(...a)
|
|
@@ -3681,7 +3692,7 @@ var InvitationsManager = class {
|
|
|
3681
3692
|
(0, import_log11.log)("timeout", {
|
|
3682
3693
|
...handler.toJSON()
|
|
3683
3694
|
}, {
|
|
3684
|
-
F:
|
|
3695
|
+
F: __dxlog_file14,
|
|
3685
3696
|
L: 261,
|
|
3686
3697
|
S: this,
|
|
3687
3698
|
C: (f, a) => f(...a)
|
|
@@ -3692,7 +3703,7 @@ var InvitationsManager = class {
|
|
|
3692
3703
|
});
|
|
3693
3704
|
} else {
|
|
3694
3705
|
import_log11.log.warn("auth failed", err, {
|
|
3695
|
-
F:
|
|
3706
|
+
F: __dxlog_file14,
|
|
3696
3707
|
L: 264,
|
|
3697
3708
|
S: this,
|
|
3698
3709
|
C: (f, a) => f(...a)
|
|
@@ -3704,12 +3715,15 @@ var InvitationsManager = class {
|
|
|
3704
3715
|
}
|
|
3705
3716
|
void ctx.dispose();
|
|
3706
3717
|
}
|
|
3718
|
+
}, {
|
|
3719
|
+
F: __dxlog_file14,
|
|
3720
|
+
L: 258
|
|
3707
3721
|
});
|
|
3708
3722
|
ctx.onDispose(() => {
|
|
3709
3723
|
(0, import_log11.log)("complete", {
|
|
3710
3724
|
...handler.toJSON()
|
|
3711
3725
|
}, {
|
|
3712
|
-
F:
|
|
3726
|
+
F: __dxlog_file14,
|
|
3713
3727
|
L: 271,
|
|
3714
3728
|
S: this,
|
|
3715
3729
|
C: (f, a) => f(...a)
|
|
@@ -3754,7 +3768,7 @@ var InvitationsManager = class {
|
|
|
3754
3768
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3755
3769
|
} catch (err) {
|
|
3756
3770
|
import_log11.log.catch(err, void 0, {
|
|
3757
|
-
F:
|
|
3771
|
+
F: __dxlog_file14,
|
|
3758
3772
|
L: 307,
|
|
3759
3773
|
S: this,
|
|
3760
3774
|
C: (f, a) => f(...a)
|
|
@@ -3807,12 +3821,13 @@ var AutomergeSpaceState = class extends import_context11.Resource {
|
|
|
3807
3821
|
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3808
3822
|
}
|
|
3809
3823
|
};
|
|
3810
|
-
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;
|
|
3811
3826
|
var runEpochMigration = async (ctx, context) => {
|
|
3812
3827
|
switch (context.migration) {
|
|
3813
3828
|
case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3814
|
-
const document = context.
|
|
3815
|
-
await context.
|
|
3829
|
+
const document = context.echoHost.createDoc();
|
|
3830
|
+
await context.echoHost.flush();
|
|
3816
3831
|
return {
|
|
3817
3832
|
newRoot: document.url
|
|
3818
3833
|
};
|
|
@@ -3821,77 +3836,88 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3821
3836
|
if (!context.currentRoot) {
|
|
3822
3837
|
throw new Error("Space does not have an automerge root");
|
|
3823
3838
|
}
|
|
3824
|
-
const rootHandle = context.
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
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();
|
|
3828
3844
|
return {
|
|
3829
3845
|
newRoot: newRoot.url
|
|
3830
3846
|
};
|
|
3831
3847
|
}
|
|
3832
3848
|
case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3833
3849
|
import_log13.log.info("Fragmenting", void 0, {
|
|
3834
|
-
F:
|
|
3835
|
-
L:
|
|
3850
|
+
F: __dxlog_file15,
|
|
3851
|
+
L: 64,
|
|
3836
3852
|
S: void 0,
|
|
3837
3853
|
C: (f, a) => f(...a)
|
|
3838
3854
|
});
|
|
3839
3855
|
const currentRootUrl = context.currentRoot;
|
|
3840
|
-
const rootHandle = context.
|
|
3841
|
-
|
|
3856
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3857
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3858
|
+
});
|
|
3842
3859
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3843
3860
|
const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
|
|
3844
3861
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3845
3862
|
(0, import_invariant13.invariant)(properties, "Properties not found", {
|
|
3846
|
-
F:
|
|
3847
|
-
L:
|
|
3863
|
+
F: __dxlog_file15,
|
|
3864
|
+
L: 75,
|
|
3848
3865
|
S: void 0,
|
|
3849
3866
|
A: [
|
|
3850
3867
|
"properties",
|
|
3851
3868
|
"'Properties not found'"
|
|
3852
3869
|
]
|
|
3853
3870
|
});
|
|
3854
|
-
const
|
|
3871
|
+
const newRoot = context.echoHost.createDoc({
|
|
3855
3872
|
...rootHandle.docSync(),
|
|
3856
3873
|
objects: Object.fromEntries([
|
|
3857
3874
|
properties
|
|
3858
3875
|
])
|
|
3859
|
-
};
|
|
3860
|
-
const newRoot = context.repo.create(newSpaceDoc);
|
|
3876
|
+
});
|
|
3861
3877
|
(0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3862
|
-
F:
|
|
3863
|
-
L:
|
|
3878
|
+
F: __dxlog_file15,
|
|
3879
|
+
L: 82,
|
|
3864
3880
|
S: void 0,
|
|
3865
3881
|
A: [
|
|
3866
3882
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3867
3883
|
""
|
|
3868
3884
|
]
|
|
3869
3885
|
});
|
|
3870
|
-
const
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
], 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
|
+
}
|
|
3881
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
|
+
}
|
|
3882
3907
|
});
|
|
3883
|
-
await context.
|
|
3908
|
+
await context.echoHost.flush();
|
|
3884
3909
|
return {
|
|
3885
3910
|
newRoot: newRoot.url
|
|
3886
3911
|
};
|
|
3887
3912
|
}
|
|
3888
3913
|
case import_services13.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
3889
3914
|
const currentRootUrl = context.currentRoot;
|
|
3890
|
-
const rootHandle = context.
|
|
3891
|
-
|
|
3915
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3916
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3917
|
+
});
|
|
3892
3918
|
(0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
|
|
3893
|
-
F:
|
|
3894
|
-
L:
|
|
3919
|
+
F: __dxlog_file15,
|
|
3920
|
+
L: 115,
|
|
3895
3921
|
S: void 0,
|
|
3896
3922
|
A: [
|
|
3897
3923
|
"rootHandle.docSync()",
|
|
@@ -3900,40 +3926,59 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3900
3926
|
});
|
|
3901
3927
|
const newRootContent = await (0, import_echo_db.convertLegacySpaceRootDoc)(structuredClone(rootHandle.docSync()));
|
|
3902
3928
|
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
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
|
+
}
|
|
3918
3961
|
}
|
|
3919
3962
|
const migratedRoot = (0, import_echo_db.migrateDocument)(rootHandle.docSync(), newRootContent);
|
|
3920
|
-
const newRoot = context.
|
|
3921
|
-
|
|
3963
|
+
const newRoot = context.echoHost.createDoc(migratedRoot, {
|
|
3964
|
+
preserveHistory: true
|
|
3965
|
+
});
|
|
3966
|
+
await context.echoHost.flush();
|
|
3922
3967
|
return {
|
|
3923
3968
|
newRoot: newRoot.url
|
|
3924
3969
|
};
|
|
3925
3970
|
}
|
|
3926
3971
|
case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3927
3972
|
(0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
|
|
3928
|
-
F:
|
|
3929
|
-
L:
|
|
3973
|
+
F: __dxlog_file15,
|
|
3974
|
+
L: 143,
|
|
3930
3975
|
S: void 0,
|
|
3931
3976
|
A: [
|
|
3932
3977
|
"context.newAutomergeRoot",
|
|
3933
3978
|
""
|
|
3934
3979
|
]
|
|
3935
3980
|
});
|
|
3936
|
-
await context.
|
|
3981
|
+
await context.echoHost.flush();
|
|
3937
3982
|
return {
|
|
3938
3983
|
newRoot: context.newAutomergeRoot
|
|
3939
3984
|
};
|
|
@@ -3941,18 +3986,21 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3941
3986
|
}
|
|
3942
3987
|
return {};
|
|
3943
3988
|
};
|
|
3944
|
-
var
|
|
3989
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3945
3990
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3946
3991
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3947
3992
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3948
3993
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3949
3994
|
var NotarizationPlugin = class {
|
|
3950
3995
|
constructor() {
|
|
3951
|
-
this._ctx = new
|
|
3952
|
-
|
|
3996
|
+
this._ctx = new import_context12.Context(void 0, {
|
|
3997
|
+
F: __dxlog_file16,
|
|
3998
|
+
L: 62
|
|
3999
|
+
});
|
|
4000
|
+
this._extensionOpened = new import_async15.Event();
|
|
3953
4001
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3954
|
-
this._processedCredentials = new
|
|
3955
|
-
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);
|
|
3956
4004
|
}
|
|
3957
4005
|
get hasWriter() {
|
|
3958
4006
|
return !!this._writer;
|
|
@@ -3969,13 +4017,13 @@ var NotarizationPlugin = class {
|
|
|
3969
4017
|
(0, import_log14.log)("notarize", {
|
|
3970
4018
|
credentials
|
|
3971
4019
|
}, {
|
|
3972
|
-
F:
|
|
4020
|
+
F: __dxlog_file16,
|
|
3973
4021
|
L: 90,
|
|
3974
4022
|
S: this,
|
|
3975
4023
|
C: (f, a) => f(...a)
|
|
3976
4024
|
});
|
|
3977
4025
|
(0, import_invariant14.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
3978
|
-
F:
|
|
4026
|
+
F: __dxlog_file16,
|
|
3979
4027
|
L: 91,
|
|
3980
4028
|
S: this,
|
|
3981
4029
|
A: [
|
|
@@ -3983,13 +4031,13 @@ var NotarizationPlugin = class {
|
|
|
3983
4031
|
"'Credentials must have an id'"
|
|
3984
4032
|
]
|
|
3985
4033
|
});
|
|
3986
|
-
const errors = new
|
|
4034
|
+
const errors = new import_async15.Trigger();
|
|
3987
4035
|
const ctx = this._ctx.derive({
|
|
3988
4036
|
onError: (err) => {
|
|
3989
4037
|
import_log14.log.warn("Notarization error", {
|
|
3990
4038
|
err
|
|
3991
4039
|
}, {
|
|
3992
|
-
F:
|
|
4040
|
+
F: __dxlog_file16,
|
|
3993
4041
|
L: 99,
|
|
3994
4042
|
S: this,
|
|
3995
4043
|
C: (f, a) => f(...a)
|
|
@@ -4000,23 +4048,23 @@ var NotarizationPlugin = class {
|
|
|
4000
4048
|
});
|
|
4001
4049
|
opCtx?.onDispose(() => ctx.dispose());
|
|
4002
4050
|
if (timeout !== 0) {
|
|
4003
|
-
(0,
|
|
4051
|
+
(0, import_async15.scheduleTask)(ctx, () => {
|
|
4004
4052
|
import_log14.log.warn("Notarization timeout", {
|
|
4005
4053
|
timeout,
|
|
4006
4054
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
4007
4055
|
}, {
|
|
4008
|
-
F:
|
|
4056
|
+
F: __dxlog_file16,
|
|
4009
4057
|
L: 111,
|
|
4010
4058
|
S: this,
|
|
4011
4059
|
C: (f, a) => f(...a)
|
|
4012
4060
|
});
|
|
4013
4061
|
void ctx.dispose();
|
|
4014
|
-
errors.throw(new
|
|
4062
|
+
errors.throw(new import_async15.TimeoutError(timeout, "Notarization timed out"));
|
|
4015
4063
|
}, timeout);
|
|
4016
4064
|
}
|
|
4017
4065
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
4018
4066
|
const peersTried = /* @__PURE__ */ new Set();
|
|
4019
|
-
const notarizeTask = new
|
|
4067
|
+
const notarizeTask = new import_async15.DeferredTask(ctx, async () => {
|
|
4020
4068
|
try {
|
|
4021
4069
|
if (this._extensions.size === 0) {
|
|
4022
4070
|
return;
|
|
@@ -4028,13 +4076,13 @@ var NotarizationPlugin = class {
|
|
|
4028
4076
|
import_log14.log.info("Exhausted all peers to notarize with", {
|
|
4029
4077
|
retryIn: retryTimeout
|
|
4030
4078
|
}, {
|
|
4031
|
-
F:
|
|
4079
|
+
F: __dxlog_file16,
|
|
4032
4080
|
L: 136,
|
|
4033
4081
|
S: this,
|
|
4034
4082
|
C: (f, a) => f(...a)
|
|
4035
4083
|
});
|
|
4036
4084
|
peersTried.clear();
|
|
4037
|
-
(0,
|
|
4085
|
+
(0, import_async15.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
4038
4086
|
return;
|
|
4039
4087
|
}
|
|
4040
4088
|
peersTried.add(peer);
|
|
@@ -4042,7 +4090,7 @@ var NotarizationPlugin = class {
|
|
|
4042
4090
|
peer: peer.localPeerId,
|
|
4043
4091
|
credentialId: credentials.map((credential) => credential.id)
|
|
4044
4092
|
}, {
|
|
4045
|
-
F:
|
|
4093
|
+
F: __dxlog_file16,
|
|
4046
4094
|
L: 143,
|
|
4047
4095
|
S: this,
|
|
4048
4096
|
C: (f, a) => f(...a)
|
|
@@ -4051,16 +4099,16 @@ var NotarizationPlugin = class {
|
|
|
4051
4099
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4052
4100
|
});
|
|
4053
4101
|
(0, import_log14.log)("success", void 0, {
|
|
4054
|
-
F:
|
|
4102
|
+
F: __dxlog_file16,
|
|
4055
4103
|
L: 147,
|
|
4056
4104
|
S: this,
|
|
4057
4105
|
C: (f, a) => f(...a)
|
|
4058
4106
|
});
|
|
4059
|
-
await (0,
|
|
4107
|
+
await (0, import_async15.sleep)(successDelay);
|
|
4060
4108
|
} catch (err) {
|
|
4061
4109
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4062
4110
|
import_log14.log.info("error notarizing (recoverable)", err, {
|
|
4063
|
-
F:
|
|
4111
|
+
F: __dxlog_file16,
|
|
4064
4112
|
L: 151,
|
|
4065
4113
|
S: this,
|
|
4066
4114
|
C: (f, a) => f(...a)
|
|
@@ -4073,12 +4121,12 @@ var NotarizationPlugin = class {
|
|
|
4073
4121
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
4074
4122
|
try {
|
|
4075
4123
|
await Promise.race([
|
|
4076
|
-
(0,
|
|
4124
|
+
(0, import_context12.rejectOnDispose)(ctx),
|
|
4077
4125
|
allNotarized,
|
|
4078
4126
|
errors.wait()
|
|
4079
4127
|
]);
|
|
4080
4128
|
(0, import_log14.log)("done", void 0, {
|
|
4081
|
-
F:
|
|
4129
|
+
F: __dxlog_file16,
|
|
4082
4130
|
L: 162,
|
|
4083
4131
|
S: this,
|
|
4084
4132
|
C: (f, a) => f(...a)
|
|
@@ -4100,7 +4148,7 @@ var NotarizationPlugin = class {
|
|
|
4100
4148
|
}
|
|
4101
4149
|
setWriter(writer) {
|
|
4102
4150
|
(0, import_invariant14.invariant)(!this._writer, "Writer already set.", {
|
|
4103
|
-
F:
|
|
4151
|
+
F: __dxlog_file16,
|
|
4104
4152
|
L: 181,
|
|
4105
4153
|
S: this,
|
|
4106
4154
|
A: [
|
|
@@ -4114,7 +4162,7 @@ var NotarizationPlugin = class {
|
|
|
4114
4162
|
if (this._processedCredentials.has(id)) {
|
|
4115
4163
|
return;
|
|
4116
4164
|
}
|
|
4117
|
-
await (0,
|
|
4165
|
+
await (0, import_util8.entry)(this._processCredentialsTriggers, id).orInsert(new import_async15.Trigger()).value.wait();
|
|
4118
4166
|
}
|
|
4119
4167
|
/**
|
|
4120
4168
|
* Requests from other peers to notarize credentials.
|
|
@@ -4125,7 +4173,7 @@ var NotarizationPlugin = class {
|
|
|
4125
4173
|
}
|
|
4126
4174
|
for (const credential of request.credentials ?? []) {
|
|
4127
4175
|
(0, import_invariant14.invariant)(credential.id, "Credential must have an id", {
|
|
4128
|
-
F:
|
|
4176
|
+
F: __dxlog_file16,
|
|
4129
4177
|
L: 200,
|
|
4130
4178
|
S: this,
|
|
4131
4179
|
A: [
|
|
@@ -4145,7 +4193,7 @@ var NotarizationPlugin = class {
|
|
|
4145
4193
|
(0, import_log14.log)("extension opened", {
|
|
4146
4194
|
peer: extension.localPeerId
|
|
4147
4195
|
}, {
|
|
4148
|
-
F:
|
|
4196
|
+
F: __dxlog_file16,
|
|
4149
4197
|
L: 211,
|
|
4150
4198
|
S: this,
|
|
4151
4199
|
C: (f, a) => f(...a)
|
|
@@ -4157,7 +4205,7 @@ var NotarizationPlugin = class {
|
|
|
4157
4205
|
(0, import_log14.log)("extension closed", {
|
|
4158
4206
|
peer: extension.localPeerId
|
|
4159
4207
|
}, {
|
|
4160
|
-
F:
|
|
4208
|
+
F: __dxlog_file16,
|
|
4161
4209
|
L: 216,
|
|
4162
4210
|
S: this,
|
|
4163
4211
|
C: (f, a) => f(...a)
|
|
@@ -4272,10 +4320,13 @@ function _using_ctx() {
|
|
|
4272
4320
|
}
|
|
4273
4321
|
};
|
|
4274
4322
|
}
|
|
4275
|
-
var
|
|
4323
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4276
4324
|
var DataSpace = class {
|
|
4277
4325
|
constructor(params) {
|
|
4278
|
-
this._ctx = new import_context10.Context(
|
|
4326
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4327
|
+
F: __dxlog_file17,
|
|
4328
|
+
L: 84
|
|
4329
|
+
});
|
|
4279
4330
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4280
4331
|
this._cache = void 0;
|
|
4281
4332
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
@@ -4305,7 +4356,7 @@ var DataSpace = class {
|
|
|
4305
4356
|
(0, import_log12.log)("new state", {
|
|
4306
4357
|
state: import_services12.SpaceState[this._state]
|
|
4307
4358
|
}, {
|
|
4308
|
-
F:
|
|
4359
|
+
F: __dxlog_file17,
|
|
4309
4360
|
L: 146,
|
|
4310
4361
|
S: this,
|
|
4311
4362
|
C: (f, a) => f(...a)
|
|
@@ -4360,12 +4411,15 @@ var DataSpace = class {
|
|
|
4360
4411
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4361
4412
|
await this._automergeSpaceState.open();
|
|
4362
4413
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4363
|
-
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
|
+
}));
|
|
4364
4418
|
this._state = import_services12.SpaceState.CONTROL_ONLY;
|
|
4365
4419
|
(0, import_log12.log)("new state", {
|
|
4366
4420
|
state: import_services12.SpaceState[this._state]
|
|
4367
4421
|
}, {
|
|
4368
|
-
F:
|
|
4422
|
+
F: __dxlog_file17,
|
|
4369
4423
|
L: 217,
|
|
4370
4424
|
S: this,
|
|
4371
4425
|
C: (f, a) => f(...a)
|
|
@@ -4383,13 +4437,16 @@ var DataSpace = class {
|
|
|
4383
4437
|
(0, import_log12.log)("new state", {
|
|
4384
4438
|
state: import_services12.SpaceState[this._state]
|
|
4385
4439
|
}, {
|
|
4386
|
-
F:
|
|
4440
|
+
F: __dxlog_file17,
|
|
4387
4441
|
L: 231,
|
|
4388
4442
|
S: this,
|
|
4389
4443
|
C: (f, a) => f(...a)
|
|
4390
4444
|
});
|
|
4391
4445
|
await this._ctx.dispose();
|
|
4392
|
-
this._ctx = new import_context10.Context(
|
|
4446
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4447
|
+
F: __dxlog_file17,
|
|
4448
|
+
L: 233
|
|
4449
|
+
});
|
|
4393
4450
|
await this.authVerifier.close();
|
|
4394
4451
|
await this._inner.close();
|
|
4395
4452
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
@@ -4416,7 +4473,7 @@ var DataSpace = class {
|
|
|
4416
4473
|
} catch (err) {
|
|
4417
4474
|
if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
|
|
4418
4475
|
(0, import_log12.log)("data pipeline initialization cancelled", err, {
|
|
4419
|
-
F:
|
|
4476
|
+
F: __dxlog_file17,
|
|
4420
4477
|
L: 265,
|
|
4421
4478
|
S: this,
|
|
4422
4479
|
C: (f, a) => f(...a)
|
|
@@ -4424,7 +4481,7 @@ var DataSpace = class {
|
|
|
4424
4481
|
return;
|
|
4425
4482
|
}
|
|
4426
4483
|
import_log12.log.error("Error initializing data pipeline", err, {
|
|
4427
|
-
F:
|
|
4484
|
+
F: __dxlog_file17,
|
|
4428
4485
|
L: 269,
|
|
4429
4486
|
S: this,
|
|
4430
4487
|
C: (f, a) => f(...a)
|
|
@@ -4433,7 +4490,7 @@ var DataSpace = class {
|
|
|
4433
4490
|
(0, import_log12.log)("new state", {
|
|
4434
4491
|
state: import_services12.SpaceState[this._state]
|
|
4435
4492
|
}, {
|
|
4436
|
-
F:
|
|
4493
|
+
F: __dxlog_file17,
|
|
4437
4494
|
L: 271,
|
|
4438
4495
|
S: this,
|
|
4439
4496
|
C: (f, a) => f(...a)
|
|
@@ -4453,7 +4510,7 @@ var DataSpace = class {
|
|
|
4453
4510
|
(0, import_log12.log)("new state", {
|
|
4454
4511
|
state: import_services12.SpaceState[this._state]
|
|
4455
4512
|
}, {
|
|
4456
|
-
F:
|
|
4513
|
+
F: __dxlog_file17,
|
|
4457
4514
|
L: 287,
|
|
4458
4515
|
S: this,
|
|
4459
4516
|
C: (f, a) => f(...a)
|
|
@@ -4470,7 +4527,7 @@ var DataSpace = class {
|
|
|
4470
4527
|
(0, import_log12.log)("new state", {
|
|
4471
4528
|
state: import_services12.SpaceState[this._state]
|
|
4472
4529
|
}, {
|
|
4473
|
-
F:
|
|
4530
|
+
F: __dxlog_file17,
|
|
4474
4531
|
L: 306,
|
|
4475
4532
|
S: this,
|
|
4476
4533
|
C: (f, a) => f(...a)
|
|
@@ -4486,7 +4543,7 @@ var DataSpace = class {
|
|
|
4486
4543
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4487
4544
|
await this._createWritableFeeds();
|
|
4488
4545
|
(0, import_log12.log)("writable feeds created", void 0, {
|
|
4489
|
-
F:
|
|
4546
|
+
F: __dxlog_file17,
|
|
4490
4547
|
L: 322,
|
|
4491
4548
|
S: this,
|
|
4492
4549
|
C: (f, a) => f(...a)
|
|
@@ -4549,7 +4606,7 @@ var DataSpace = class {
|
|
|
4549
4606
|
space: this.key,
|
|
4550
4607
|
rootUrl
|
|
4551
4608
|
}, {
|
|
4552
|
-
F:
|
|
4609
|
+
F: __dxlog_file17,
|
|
4553
4610
|
L: 388,
|
|
4554
4611
|
S: this,
|
|
4555
4612
|
C: (f, a) => f(...a)
|
|
@@ -4603,8 +4660,8 @@ var DataSpace = class {
|
|
|
4603
4660
|
rootUrl,
|
|
4604
4661
|
err
|
|
4605
4662
|
}, {
|
|
4606
|
-
F:
|
|
4607
|
-
L:
|
|
4663
|
+
F: __dxlog_file17,
|
|
4664
|
+
L: 433,
|
|
4608
4665
|
S: this,
|
|
4609
4666
|
C: (f, a) => f(...a)
|
|
4610
4667
|
});
|
|
@@ -4632,7 +4689,7 @@ var DataSpace = class {
|
|
|
4632
4689
|
return null;
|
|
4633
4690
|
}
|
|
4634
4691
|
const { newRoot } = await runEpochMigration(ctx, {
|
|
4635
|
-
|
|
4692
|
+
echoHost: this._echoHost,
|
|
4636
4693
|
spaceId: this.id,
|
|
4637
4694
|
spaceKey: this.key,
|
|
4638
4695
|
migration: options.migration,
|
|
@@ -4689,8 +4746,8 @@ var DataSpace = class {
|
|
|
4689
4746
|
(0, import_log12.log)("new state", {
|
|
4690
4747
|
state: import_services12.SpaceState[this._state]
|
|
4691
4748
|
}, {
|
|
4692
|
-
F:
|
|
4693
|
-
L:
|
|
4749
|
+
F: __dxlog_file17,
|
|
4750
|
+
L: 514,
|
|
4694
4751
|
S: this,
|
|
4695
4752
|
C: (f, a) => f(...a)
|
|
4696
4753
|
});
|
|
@@ -4819,7 +4876,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4819
4876
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4820
4877
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4821
4878
|
}
|
|
4822
|
-
var
|
|
4879
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4823
4880
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4824
4881
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4825
4882
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4833,9 +4890,12 @@ var DataSpaceManager = class {
|
|
|
4833
4890
|
this._echoHost = _echoHost;
|
|
4834
4891
|
this._invitationsManager = _invitationsManager;
|
|
4835
4892
|
this._params = _params;
|
|
4836
|
-
this._ctx = new
|
|
4837
|
-
|
|
4838
|
-
|
|
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);
|
|
4839
4899
|
this._isOpen = false;
|
|
4840
4900
|
this._instanceId = import_keys12.PublicKey.random().toHex();
|
|
4841
4901
|
import_tracing6.trace.diagnostic({
|
|
@@ -4867,34 +4927,34 @@ var DataSpaceManager = class {
|
|
|
4867
4927
|
}
|
|
4868
4928
|
async open() {
|
|
4869
4929
|
(0, import_log15.log)("open", void 0, {
|
|
4870
|
-
F:
|
|
4871
|
-
L:
|
|
4930
|
+
F: __dxlog_file18,
|
|
4931
|
+
L: 156,
|
|
4872
4932
|
S: this,
|
|
4873
4933
|
C: (f, a) => f(...a)
|
|
4874
4934
|
});
|
|
4875
4935
|
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
|
|
4876
4936
|
id: this._instanceId
|
|
4877
4937
|
}), {
|
|
4878
|
-
F:
|
|
4879
|
-
L:
|
|
4938
|
+
F: __dxlog_file18,
|
|
4939
|
+
L: 157,
|
|
4880
4940
|
S: this,
|
|
4881
4941
|
C: (f, a) => f(...a)
|
|
4882
4942
|
});
|
|
4883
4943
|
(0, import_log15.log)("metadata loaded", {
|
|
4884
4944
|
spaces: this._metadataStore.spaces.length
|
|
4885
4945
|
}, {
|
|
4886
|
-
F:
|
|
4887
|
-
L:
|
|
4946
|
+
F: __dxlog_file18,
|
|
4947
|
+
L: 158,
|
|
4888
4948
|
S: this,
|
|
4889
4949
|
C: (f, a) => f(...a)
|
|
4890
4950
|
});
|
|
4891
|
-
await (0,
|
|
4951
|
+
await (0, import_util9.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
4892
4952
|
try {
|
|
4893
4953
|
(0, import_log15.log)("load space", {
|
|
4894
4954
|
spaceMetadata
|
|
4895
4955
|
}, {
|
|
4896
|
-
F:
|
|
4897
|
-
L:
|
|
4956
|
+
F: __dxlog_file18,
|
|
4957
|
+
L: 162,
|
|
4898
4958
|
S: this,
|
|
4899
4959
|
C: (f, a) => f(...a)
|
|
4900
4960
|
});
|
|
@@ -4904,8 +4964,8 @@ var DataSpaceManager = class {
|
|
|
4904
4964
|
spaceMetadata,
|
|
4905
4965
|
err
|
|
4906
4966
|
}, {
|
|
4907
|
-
F:
|
|
4908
|
-
L:
|
|
4967
|
+
F: __dxlog_file18,
|
|
4968
|
+
L: 165,
|
|
4909
4969
|
S: this,
|
|
4910
4970
|
C: (f, a) => f(...a)
|
|
4911
4971
|
});
|
|
@@ -4916,16 +4976,16 @@ var DataSpaceManager = class {
|
|
|
4916
4976
|
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
|
|
4917
4977
|
id: this._instanceId
|
|
4918
4978
|
}), {
|
|
4919
|
-
F:
|
|
4920
|
-
L:
|
|
4979
|
+
F: __dxlog_file18,
|
|
4980
|
+
L: 172,
|
|
4921
4981
|
S: this,
|
|
4922
4982
|
C: (f, a) => f(...a)
|
|
4923
4983
|
});
|
|
4924
4984
|
}
|
|
4925
4985
|
async close() {
|
|
4926
4986
|
(0, import_log15.log)("close", void 0, {
|
|
4927
|
-
F:
|
|
4928
|
-
L:
|
|
4987
|
+
F: __dxlog_file18,
|
|
4988
|
+
L: 177,
|
|
4929
4989
|
S: this,
|
|
4930
4990
|
C: (f, a) => f(...a)
|
|
4931
4991
|
});
|
|
@@ -4941,8 +5001,8 @@ var DataSpaceManager = class {
|
|
|
4941
5001
|
*/
|
|
4942
5002
|
async createSpace() {
|
|
4943
5003
|
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
4944
|
-
F:
|
|
4945
|
-
L:
|
|
5004
|
+
F: __dxlog_file18,
|
|
5005
|
+
L: 191,
|
|
4946
5006
|
S: this,
|
|
4947
5007
|
A: [
|
|
4948
5008
|
"this._isOpen",
|
|
@@ -4962,8 +5022,8 @@ var DataSpaceManager = class {
|
|
|
4962
5022
|
(0, import_log15.log)("creating space...", {
|
|
4963
5023
|
spaceKey
|
|
4964
5024
|
}, {
|
|
4965
|
-
F:
|
|
4966
|
-
L:
|
|
5025
|
+
F: __dxlog_file18,
|
|
5026
|
+
L: 203,
|
|
4967
5027
|
S: this,
|
|
4968
5028
|
C: (f, a) => f(...a)
|
|
4969
5029
|
});
|
|
@@ -4974,8 +5034,8 @@ var DataSpaceManager = class {
|
|
|
4974
5034
|
await this._metadataStore.addSpace(metadata);
|
|
4975
5035
|
const memberCredential = credentials[1];
|
|
4976
5036
|
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4977
|
-
F:
|
|
4978
|
-
L:
|
|
5037
|
+
F: __dxlog_file18,
|
|
5038
|
+
L: 213,
|
|
4979
5039
|
S: this,
|
|
4980
5040
|
A: [
|
|
4981
5041
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -4992,13 +5052,13 @@ var DataSpaceManager = class {
|
|
|
4992
5052
|
return false;
|
|
4993
5053
|
}
|
|
4994
5054
|
switch (space.databaseRoot.getVersion()) {
|
|
4995
|
-
case
|
|
5055
|
+
case import_echo_protocol3.SpaceDocVersion.CURRENT: {
|
|
4996
5056
|
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_echo_schema2.TYPE_PROPERTIES) ?? [];
|
|
4997
5057
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
4998
5058
|
}
|
|
4999
|
-
case
|
|
5059
|
+
case import_echo_protocol3.SpaceDocVersion.LEGACY: {
|
|
5000
5060
|
const convertedDoc = await (0, import_echo_db2.convertLegacyReferences)(space.databaseRoot.docSync());
|
|
5001
|
-
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc,
|
|
5061
|
+
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc, import_echo_protocol3.LEGACY_TYPE_PROPERTIES) ?? [];
|
|
5002
5062
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5003
5063
|
}
|
|
5004
5064
|
default:
|
|
@@ -5006,8 +5066,8 @@ var DataSpaceManager = class {
|
|
|
5006
5066
|
version: space.databaseRoot.getVersion(),
|
|
5007
5067
|
spaceId: space.id
|
|
5008
5068
|
}, {
|
|
5009
|
-
F:
|
|
5010
|
-
L:
|
|
5069
|
+
F: __dxlog_file18,
|
|
5070
|
+
L: 238,
|
|
5011
5071
|
S: this,
|
|
5012
5072
|
C: (f, a) => f(...a)
|
|
5013
5073
|
});
|
|
@@ -5019,7 +5079,7 @@ var DataSpaceManager = class {
|
|
|
5019
5079
|
const document = await this._getSpaceRootDocument(space);
|
|
5020
5080
|
const properties = {
|
|
5021
5081
|
system: {
|
|
5022
|
-
type: (0,
|
|
5082
|
+
type: (0, import_echo_protocol3.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
|
|
5023
5083
|
},
|
|
5024
5084
|
data: {
|
|
5025
5085
|
[DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
|
|
@@ -5030,7 +5090,7 @@ var DataSpaceManager = class {
|
|
|
5030
5090
|
};
|
|
5031
5091
|
const propertiesId = (0, import_echo_schema2.generateEchoId)();
|
|
5032
5092
|
document.change((doc) => {
|
|
5033
|
-
(0,
|
|
5093
|
+
(0, import_util9.assignDeep)(doc, [
|
|
5034
5094
|
"objects",
|
|
5035
5095
|
propertiesId
|
|
5036
5096
|
], properties);
|
|
@@ -5041,8 +5101,8 @@ var DataSpaceManager = class {
|
|
|
5041
5101
|
async _getSpaceRootDocument(space) {
|
|
5042
5102
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5043
5103
|
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5044
|
-
F:
|
|
5045
|
-
L:
|
|
5104
|
+
F: __dxlog_file18,
|
|
5105
|
+
L: 271,
|
|
5046
5106
|
S: this,
|
|
5047
5107
|
A: [
|
|
5048
5108
|
"automergeIndex",
|
|
@@ -5058,14 +5118,14 @@ var DataSpaceManager = class {
|
|
|
5058
5118
|
(0, import_log15.log)("accept space", {
|
|
5059
5119
|
opts
|
|
5060
5120
|
}, {
|
|
5061
|
-
F:
|
|
5062
|
-
L:
|
|
5121
|
+
F: __dxlog_file18,
|
|
5122
|
+
L: 280,
|
|
5063
5123
|
S: this,
|
|
5064
5124
|
C: (f, a) => f(...a)
|
|
5065
5125
|
});
|
|
5066
5126
|
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
5067
|
-
F:
|
|
5068
|
-
L:
|
|
5127
|
+
F: __dxlog_file18,
|
|
5128
|
+
L: 281,
|
|
5069
5129
|
S: this,
|
|
5070
5130
|
A: [
|
|
5071
5131
|
"this._isOpen",
|
|
@@ -5073,8 +5133,8 @@ var DataSpaceManager = class {
|
|
|
5073
5133
|
]
|
|
5074
5134
|
});
|
|
5075
5135
|
(0, import_invariant15.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5076
|
-
F:
|
|
5077
|
-
L:
|
|
5136
|
+
F: __dxlog_file18,
|
|
5137
|
+
L: 282,
|
|
5078
5138
|
S: this,
|
|
5079
5139
|
A: [
|
|
5080
5140
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -5094,23 +5154,72 @@ var DataSpaceManager = class {
|
|
|
5094
5154
|
this.updated.emit();
|
|
5095
5155
|
return space;
|
|
5096
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
|
+
}
|
|
5097
5194
|
/**
|
|
5098
5195
|
* Wait until the space data pipeline is fully initialized.
|
|
5099
5196
|
* Used by invitation handler.
|
|
5100
5197
|
* TODO(dmaretskyi): Consider removing.
|
|
5101
5198
|
*/
|
|
5102
5199
|
async waitUntilSpaceReady(spaceKey) {
|
|
5103
|
-
await (0,
|
|
5200
|
+
await (0, import_context13.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
5104
5201
|
const space = this._spaces.get(spaceKey);
|
|
5105
5202
|
return !!space && space.state === import_services14.SpaceState.READY;
|
|
5106
5203
|
}));
|
|
5107
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
|
+
}
|
|
5108
5217
|
async _constructSpace(metadata) {
|
|
5109
5218
|
(0, import_log15.log)("construct space", {
|
|
5110
5219
|
metadata
|
|
5111
5220
|
}, {
|
|
5112
|
-
F:
|
|
5113
|
-
L:
|
|
5221
|
+
F: __dxlog_file18,
|
|
5222
|
+
L: 358,
|
|
5114
5223
|
S: this,
|
|
5115
5224
|
C: (f, a) => f(...a)
|
|
5116
5225
|
});
|
|
@@ -5135,9 +5244,10 @@ var DataSpaceManager = class {
|
|
|
5135
5244
|
swarmIdentity: {
|
|
5136
5245
|
peerKey: this._signingContext.deviceKey,
|
|
5137
5246
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5138
|
-
credentialAuthenticator: (0,
|
|
5247
|
+
credentialAuthenticator: (0, import_util9.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
5139
5248
|
},
|
|
5140
5249
|
onAuthorizedConnection: (session) => {
|
|
5250
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline4.CredentialServerExtension(space));
|
|
5141
5251
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5142
5252
|
remotePeerId: session.remotePeerId
|
|
5143
5253
|
}));
|
|
@@ -5147,8 +5257,8 @@ var DataSpaceManager = class {
|
|
|
5147
5257
|
},
|
|
5148
5258
|
onAuthFailure: () => {
|
|
5149
5259
|
import_log15.log.warn("auth failure", void 0, {
|
|
5150
|
-
F:
|
|
5151
|
-
L:
|
|
5260
|
+
F: __dxlog_file18,
|
|
5261
|
+
L: 396,
|
|
5152
5262
|
S: this,
|
|
5153
5263
|
C: (f, a) => f(...a)
|
|
5154
5264
|
});
|
|
@@ -5180,8 +5290,8 @@ var DataSpaceManager = class {
|
|
|
5180
5290
|
(0, import_log15.log)("before space ready", {
|
|
5181
5291
|
space: space.key
|
|
5182
5292
|
}, {
|
|
5183
|
-
F:
|
|
5184
|
-
L:
|
|
5293
|
+
F: __dxlog_file18,
|
|
5294
|
+
L: 423,
|
|
5185
5295
|
S: this,
|
|
5186
5296
|
C: (f, a) => f(...a)
|
|
5187
5297
|
});
|
|
@@ -5191,8 +5301,8 @@ var DataSpaceManager = class {
|
|
|
5191
5301
|
space: space.key,
|
|
5192
5302
|
open: this._isOpen
|
|
5193
5303
|
}, {
|
|
5194
|
-
F:
|
|
5195
|
-
L:
|
|
5304
|
+
F: __dxlog_file18,
|
|
5305
|
+
L: 426,
|
|
5196
5306
|
S: this,
|
|
5197
5307
|
C: (f, a) => f(...a)
|
|
5198
5308
|
});
|
|
@@ -5210,8 +5320,8 @@ var DataSpaceManager = class {
|
|
|
5210
5320
|
(0, import_log15.log)("before space close", {
|
|
5211
5321
|
space: space.key
|
|
5212
5322
|
}, {
|
|
5213
|
-
F:
|
|
5214
|
-
L:
|
|
5323
|
+
F: __dxlog_file18,
|
|
5324
|
+
L: 434,
|
|
5215
5325
|
S: this,
|
|
5216
5326
|
C: (f, a) => f(...a)
|
|
5217
5327
|
});
|
|
@@ -5239,7 +5349,7 @@ var DataSpaceManager = class {
|
|
|
5239
5349
|
const peers = presence.getPeersByIdentityKey(member.key);
|
|
5240
5350
|
const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
|
|
5241
5351
|
const sessionsToClose = sessions.filter((s) => {
|
|
5242
|
-
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;
|
|
5243
5353
|
});
|
|
5244
5354
|
sessionsToClose.forEach((session) => {
|
|
5245
5355
|
void session.close().catch(import_log15.log.error);
|
|
@@ -5251,8 +5361,8 @@ var DataSpaceManager = class {
|
|
|
5251
5361
|
peersOnline: presence.getPeersOnline().length,
|
|
5252
5362
|
closedSessions
|
|
5253
5363
|
}, {
|
|
5254
|
-
F:
|
|
5255
|
-
L:
|
|
5364
|
+
F: __dxlog_file18,
|
|
5365
|
+
L: 470,
|
|
5256
5366
|
S: this,
|
|
5257
5367
|
C: (f, a) => f(...a)
|
|
5258
5368
|
});
|
|
@@ -5266,8 +5376,8 @@ var DataSpaceManager = class {
|
|
|
5266
5376
|
(0, import_log15.log)("closing a session with a removed peer", {
|
|
5267
5377
|
peerId: peerState.peerId
|
|
5268
5378
|
}, {
|
|
5269
|
-
F:
|
|
5270
|
-
L:
|
|
5379
|
+
F: __dxlog_file18,
|
|
5380
|
+
L: 484,
|
|
5271
5381
|
S: this,
|
|
5272
5382
|
C: (f, a) => f(...a)
|
|
5273
5383
|
});
|
|
@@ -5312,21 +5422,21 @@ var DataSpaceManager = class {
|
|
|
5312
5422
|
}
|
|
5313
5423
|
};
|
|
5314
5424
|
_ts_decorate5([
|
|
5315
|
-
|
|
5425
|
+
import_async16.synchronized
|
|
5316
5426
|
], DataSpaceManager.prototype, "open", null);
|
|
5317
5427
|
_ts_decorate5([
|
|
5318
|
-
|
|
5428
|
+
import_async16.synchronized
|
|
5319
5429
|
], DataSpaceManager.prototype, "close", null);
|
|
5320
5430
|
_ts_decorate5([
|
|
5321
|
-
|
|
5431
|
+
import_async16.synchronized
|
|
5322
5432
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
5323
5433
|
_ts_decorate5([
|
|
5324
|
-
|
|
5434
|
+
import_async16.synchronized
|
|
5325
5435
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
5326
5436
|
DataSpaceManager = _ts_decorate5([
|
|
5327
|
-
(0,
|
|
5437
|
+
(0, import_async16.trackLeaks)("open", "close")
|
|
5328
5438
|
], DataSpaceManager);
|
|
5329
|
-
var
|
|
5439
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5330
5440
|
var SpacesServiceImpl = class {
|
|
5331
5441
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5332
5442
|
this._identityManager = _identityManager;
|
|
@@ -5370,8 +5480,8 @@ var SpacesServiceImpl = class {
|
|
|
5370
5480
|
}
|
|
5371
5481
|
const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5372
5482
|
(0, import_invariant16.invariant)(credentials[0].credential, void 0, {
|
|
5373
|
-
F:
|
|
5374
|
-
L:
|
|
5483
|
+
F: __dxlog_file19,
|
|
5484
|
+
L: 102,
|
|
5375
5485
|
S: this,
|
|
5376
5486
|
A: [
|
|
5377
5487
|
"credentials[0].credential",
|
|
@@ -5380,26 +5490,26 @@ var SpacesServiceImpl = class {
|
|
|
5380
5490
|
});
|
|
5381
5491
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5382
5492
|
(0, import_invariant16.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5383
|
-
F:
|
|
5384
|
-
L:
|
|
5493
|
+
F: __dxlog_file19,
|
|
5494
|
+
L: 104,
|
|
5385
5495
|
S: this,
|
|
5386
5496
|
A: [
|
|
5387
5497
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5388
5498
|
""
|
|
5389
5499
|
]
|
|
5390
5500
|
});
|
|
5391
|
-
await (0,
|
|
5501
|
+
await (0, import_feed_store5.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5392
5502
|
}
|
|
5393
5503
|
querySpaces() {
|
|
5394
5504
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
5395
|
-
const scheduler = new
|
|
5505
|
+
const scheduler = new import_async17.UpdateScheduler(ctx, async () => {
|
|
5396
5506
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5397
5507
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
5398
5508
|
(0, import_log16.log)("update", {
|
|
5399
5509
|
spaces
|
|
5400
5510
|
}, {
|
|
5401
|
-
F:
|
|
5402
|
-
L:
|
|
5511
|
+
F: __dxlog_file19,
|
|
5512
|
+
L: 115,
|
|
5403
5513
|
S: this,
|
|
5404
5514
|
C: (f, a) => f(...a)
|
|
5405
5515
|
});
|
|
@@ -5410,9 +5520,9 @@ var SpacesServiceImpl = class {
|
|
|
5410
5520
|
}, {
|
|
5411
5521
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
5412
5522
|
});
|
|
5413
|
-
(0,
|
|
5523
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5414
5524
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5415
|
-
const subscriptions = new
|
|
5525
|
+
const subscriptions = new import_async17.EventSubscriptions();
|
|
5416
5526
|
ctx.onDispose(() => subscriptions.clear());
|
|
5417
5527
|
const subscribeSpaces = () => {
|
|
5418
5528
|
subscriptions.clear();
|
|
@@ -5452,7 +5562,7 @@ var SpacesServiceImpl = class {
|
|
|
5452
5562
|
}
|
|
5453
5563
|
subscribeMessages({ spaceKey, channel }) {
|
|
5454
5564
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
5455
|
-
(0,
|
|
5565
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5456
5566
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5457
5567
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5458
5568
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -5471,7 +5581,7 @@ var SpacesServiceImpl = class {
|
|
|
5471
5581
|
}
|
|
5472
5582
|
};
|
|
5473
5583
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
5474
|
-
(0,
|
|
5584
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5475
5585
|
await space.spaceState.addCredentialProcessor(processor);
|
|
5476
5586
|
if (noTail) {
|
|
5477
5587
|
close();
|
|
@@ -5490,8 +5600,8 @@ var SpacesServiceImpl = class {
|
|
|
5490
5600
|
});
|
|
5491
5601
|
} else {
|
|
5492
5602
|
(0, import_invariant16.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5493
|
-
F:
|
|
5494
|
-
L:
|
|
5603
|
+
F: __dxlog_file19,
|
|
5604
|
+
L: 213,
|
|
5495
5605
|
S: this,
|
|
5496
5606
|
A: [
|
|
5497
5607
|
"!credential.id",
|
|
@@ -5499,8 +5609,8 @@ var SpacesServiceImpl = class {
|
|
|
5499
5609
|
]
|
|
5500
5610
|
});
|
|
5501
5611
|
(0, import_invariant16.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
5502
|
-
F:
|
|
5503
|
-
L:
|
|
5612
|
+
F: __dxlog_file19,
|
|
5613
|
+
L: 214,
|
|
5504
5614
|
S: this,
|
|
5505
5615
|
A: [
|
|
5506
5616
|
"this._identityManager.identity",
|
|
@@ -5509,8 +5619,8 @@ var SpacesServiceImpl = class {
|
|
|
5509
5619
|
});
|
|
5510
5620
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5511
5621
|
(0, import_invariant16.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5512
|
-
F:
|
|
5513
|
-
L:
|
|
5622
|
+
F: __dxlog_file19,
|
|
5623
|
+
L: 216,
|
|
5514
5624
|
S: this,
|
|
5515
5625
|
A: [
|
|
5516
5626
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5540,6 +5650,59 @@ var SpacesServiceImpl = class {
|
|
|
5540
5650
|
epochCredential: credential ?? void 0
|
|
5541
5651
|
};
|
|
5542
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
|
+
}
|
|
5543
5706
|
_serializeSpace(space) {
|
|
5544
5707
|
return {
|
|
5545
5708
|
id: space.id,
|
|
@@ -5557,7 +5720,8 @@ var SpacesServiceImpl = class {
|
|
|
5557
5720
|
startDataTimeframe: void 0,
|
|
5558
5721
|
currentDataTimeframe: void 0,
|
|
5559
5722
|
targetDataTimeframe: void 0,
|
|
5560
|
-
totalDataTimeframe: void 0
|
|
5723
|
+
totalDataTimeframe: void 0,
|
|
5724
|
+
spaceRootUrl: space.databaseRoot?.url
|
|
5561
5725
|
},
|
|
5562
5726
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
5563
5727
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
@@ -5609,8 +5773,8 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5609
5773
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5610
5774
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5611
5775
|
}
|
|
5612
|
-
var
|
|
5613
|
-
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 {
|
|
5614
5778
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5615
5779
|
super();
|
|
5616
5780
|
this.storage = storage;
|
|
@@ -5618,15 +5782,15 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5618
5782
|
this.networkManager = networkManager;
|
|
5619
5783
|
this.signalManager = signalManager;
|
|
5620
5784
|
this._runtimeParams = _runtimeParams;
|
|
5621
|
-
this.initialized = new
|
|
5785
|
+
this.initialized = new import_async18.Trigger();
|
|
5622
5786
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5623
5787
|
this._instanceId = import_keys13.PublicKey.random().toHex();
|
|
5624
5788
|
this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
|
|
5625
5789
|
this.snapshotStore = new import_echo_pipeline5.SnapshotStore(storage.createDirectory("snapshots"));
|
|
5626
5790
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
5627
5791
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
5628
|
-
this.feedStore = new
|
|
5629
|
-
factory: new
|
|
5792
|
+
this.feedStore = new import_feed_store6.FeedStore({
|
|
5793
|
+
factory: new import_feed_store6.FeedFactory({
|
|
5630
5794
|
root: storage.createDirectory("feeds"),
|
|
5631
5795
|
signer: this.keyring,
|
|
5632
5796
|
hypercore: {
|
|
@@ -5653,7 +5817,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5653
5817
|
async _open(ctx) {
|
|
5654
5818
|
await this._checkStorageVersion();
|
|
5655
5819
|
(0, import_log17.log)("opening...", void 0, {
|
|
5656
|
-
F:
|
|
5820
|
+
F: __dxlog_file20,
|
|
5657
5821
|
L: 149,
|
|
5658
5822
|
S: this,
|
|
5659
5823
|
C: (f, a) => f(...a)
|
|
@@ -5661,7 +5825,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5661
5825
|
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
|
|
5662
5826
|
id: this._instanceId
|
|
5663
5827
|
}), {
|
|
5664
|
-
F:
|
|
5828
|
+
F: __dxlog_file20,
|
|
5665
5829
|
L: 150,
|
|
5666
5830
|
S: this,
|
|
5667
5831
|
C: (f, a) => f(...a)
|
|
@@ -5679,7 +5843,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5679
5843
|
(0, import_log17.log)("loaded persistent invitations", {
|
|
5680
5844
|
count: loadedInvitations.invitations?.length
|
|
5681
5845
|
}, {
|
|
5682
|
-
F:
|
|
5846
|
+
F: __dxlog_file20,
|
|
5683
5847
|
L: 163,
|
|
5684
5848
|
S: this,
|
|
5685
5849
|
C: (f, a) => f(...a)
|
|
@@ -5687,13 +5851,13 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5687
5851
|
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
|
|
5688
5852
|
id: this._instanceId
|
|
5689
5853
|
}), {
|
|
5690
|
-
F:
|
|
5854
|
+
F: __dxlog_file20,
|
|
5691
5855
|
L: 165,
|
|
5692
5856
|
S: this,
|
|
5693
5857
|
C: (f, a) => f(...a)
|
|
5694
5858
|
});
|
|
5695
5859
|
(0, import_log17.log)("opened", void 0, {
|
|
5696
|
-
F:
|
|
5860
|
+
F: __dxlog_file20,
|
|
5697
5861
|
L: 166,
|
|
5698
5862
|
S: this,
|
|
5699
5863
|
C: (f, a) => f(...a)
|
|
@@ -5701,7 +5865,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5701
5865
|
}
|
|
5702
5866
|
async _close(ctx) {
|
|
5703
5867
|
(0, import_log17.log)("closing...", void 0, {
|
|
5704
|
-
F:
|
|
5868
|
+
F: __dxlog_file20,
|
|
5705
5869
|
L: 170,
|
|
5706
5870
|
S: this,
|
|
5707
5871
|
C: (f, a) => f(...a)
|
|
@@ -5718,7 +5882,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5718
5882
|
await this.networkManager.close();
|
|
5719
5883
|
await this.signalManager.close();
|
|
5720
5884
|
(0, import_log17.log)("closed", void 0, {
|
|
5721
|
-
F:
|
|
5885
|
+
F: __dxlog_file20,
|
|
5722
5886
|
L: 182,
|
|
5723
5887
|
S: this,
|
|
5724
5888
|
C: (f, a) => f(...a)
|
|
@@ -5726,13 +5890,16 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5726
5890
|
}
|
|
5727
5891
|
async createIdentity(params = {}) {
|
|
5728
5892
|
const identity = await this.identityManager.createIdentity(params);
|
|
5729
|
-
await this._initialize(new
|
|
5893
|
+
await this._initialize(new import_context14.Context(void 0, {
|
|
5894
|
+
F: __dxlog_file20,
|
|
5895
|
+
L: 187
|
|
5896
|
+
}));
|
|
5730
5897
|
return identity;
|
|
5731
5898
|
}
|
|
5732
5899
|
getInvitationHandler(invitation) {
|
|
5733
5900
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5734
5901
|
(0, import_invariant17.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5735
|
-
F:
|
|
5902
|
+
F: __dxlog_file20,
|
|
5736
5903
|
L: 193,
|
|
5737
5904
|
S: this,
|
|
5738
5905
|
A: [
|
|
@@ -5752,7 +5919,10 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5752
5919
|
}
|
|
5753
5920
|
async _acceptIdentity(params) {
|
|
5754
5921
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5755
|
-
await this._initialize(new
|
|
5922
|
+
await this._initialize(new import_context14.Context(void 0, {
|
|
5923
|
+
F: __dxlog_file20,
|
|
5924
|
+
L: 209
|
|
5925
|
+
}));
|
|
5756
5926
|
return identity;
|
|
5757
5927
|
}
|
|
5758
5928
|
async _checkStorageVersion() {
|
|
@@ -5764,7 +5934,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5764
5934
|
// Called when identity is created.
|
|
5765
5935
|
async _initialize(ctx) {
|
|
5766
5936
|
(0, import_log17.log)("initializing spaces...", void 0, {
|
|
5767
|
-
F:
|
|
5937
|
+
F: __dxlog_file20,
|
|
5768
5938
|
L: 224,
|
|
5769
5939
|
S: this,
|
|
5770
5940
|
C: (f, a) => f(...a)
|
|
@@ -5787,7 +5957,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5787
5957
|
await this.dataSpaceManager.open();
|
|
5788
5958
|
this._handlerFactories.set(import_services16.Invitation.Kind.SPACE, (invitation) => {
|
|
5789
5959
|
(0, import_invariant17.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5790
|
-
F:
|
|
5960
|
+
F: __dxlog_file20,
|
|
5791
5961
|
L: 249,
|
|
5792
5962
|
S: this,
|
|
5793
5963
|
A: [
|
|
@@ -5811,7 +5981,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5811
5981
|
(0, import_log17.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5812
5982
|
details: assertion
|
|
5813
5983
|
}, {
|
|
5814
|
-
F:
|
|
5984
|
+
F: __dxlog_file20,
|
|
5815
5985
|
L: 265,
|
|
5816
5986
|
S: this,
|
|
5817
5987
|
C: (f, a) => f(...a)
|
|
@@ -5822,7 +5992,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5822
5992
|
(0, import_log17.log)("space already exists, ignoring space admission", {
|
|
5823
5993
|
details: assertion
|
|
5824
5994
|
}, {
|
|
5825
|
-
F:
|
|
5995
|
+
F: __dxlog_file20,
|
|
5826
5996
|
L: 269,
|
|
5827
5997
|
S: this,
|
|
5828
5998
|
C: (f, a) => f(...a)
|
|
@@ -5833,7 +6003,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5833
6003
|
(0, import_log17.log)("accepting space recorded in halo", {
|
|
5834
6004
|
details: assertion
|
|
5835
6005
|
}, {
|
|
5836
|
-
F:
|
|
6006
|
+
F: __dxlog_file20,
|
|
5837
6007
|
L: 274,
|
|
5838
6008
|
S: this,
|
|
5839
6009
|
C: (f, a) => f(...a)
|
|
@@ -5844,7 +6014,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5844
6014
|
});
|
|
5845
6015
|
} catch (err) {
|
|
5846
6016
|
import_log17.log.catch(err, void 0, {
|
|
5847
|
-
F:
|
|
6017
|
+
F: __dxlog_file20,
|
|
5848
6018
|
L: 280,
|
|
5849
6019
|
S: this,
|
|
5850
6020
|
C: (f, a) => f(...a)
|
|
@@ -5862,7 +6032,7 @@ _ts_decorate6([
|
|
|
5862
6032
|
import_tracing8.trace.span()
|
|
5863
6033
|
], ServiceContext.prototype, "_initialize", null);
|
|
5864
6034
|
ServiceContext = _ts_decorate6([
|
|
5865
|
-
(0,
|
|
6035
|
+
(0, import_util10.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
5866
6036
|
import_tracing8.trace.resource()
|
|
5867
6037
|
], ServiceContext);
|
|
5868
6038
|
var ServiceRegistry = class {
|
|
@@ -5897,7 +6067,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5897
6067
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5898
6068
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5899
6069
|
}
|
|
5900
|
-
var
|
|
6070
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
5901
6071
|
var Lock = class {
|
|
5902
6072
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
5903
6073
|
this._lockPath = lockPath;
|
|
@@ -5909,7 +6079,7 @@ var Lock = class {
|
|
|
5909
6079
|
}
|
|
5910
6080
|
async acquire() {
|
|
5911
6081
|
(0, import_log18.log)("acquiring lock...", void 0, {
|
|
5912
|
-
F:
|
|
6082
|
+
F: __dxlog_file21,
|
|
5913
6083
|
L: 32,
|
|
5914
6084
|
S: this,
|
|
5915
6085
|
C: (f, a) => f(...a)
|
|
@@ -5917,7 +6087,7 @@ var Lock = class {
|
|
|
5917
6087
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
5918
6088
|
await this._onAcquire?.();
|
|
5919
6089
|
(0, import_log18.log)("acquired lock", void 0, {
|
|
5920
|
-
F:
|
|
6090
|
+
F: __dxlog_file21,
|
|
5921
6091
|
L: 37,
|
|
5922
6092
|
S: this,
|
|
5923
6093
|
C: (f, a) => f(...a)
|
|
@@ -5926,7 +6096,7 @@ var Lock = class {
|
|
|
5926
6096
|
async release() {
|
|
5927
6097
|
await this._onRelease?.();
|
|
5928
6098
|
(0, import_invariant18.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
5929
|
-
F:
|
|
6099
|
+
F: __dxlog_file21,
|
|
5930
6100
|
L: 42,
|
|
5931
6101
|
S: this,
|
|
5932
6102
|
A: [
|
|
@@ -5942,7 +6112,7 @@ _ts_decorate7([
|
|
|
5942
6112
|
], Lock.prototype, "lockKey", null);
|
|
5943
6113
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
5944
6114
|
var getRootPath = (config) => {
|
|
5945
|
-
const { dataRoot = (0,
|
|
6115
|
+
const { dataRoot = (0, import_util11.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5946
6116
|
return `${dataRoot}/`;
|
|
5947
6117
|
};
|
|
5948
6118
|
var isPersistent = (config) => {
|
|
@@ -5998,7 +6168,7 @@ var createLevel = async (config) => {
|
|
|
5998
6168
|
await level.open();
|
|
5999
6169
|
return level;
|
|
6000
6170
|
};
|
|
6001
|
-
var
|
|
6171
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6002
6172
|
var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
|
|
6003
6173
|
var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
|
|
6004
6174
|
var exportProfileData = async ({ storage, level }) => {
|
|
@@ -6014,7 +6184,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6014
6184
|
import_log19.log.info("begin exporting files", {
|
|
6015
6185
|
count: files.length
|
|
6016
6186
|
}, {
|
|
6017
|
-
F:
|
|
6187
|
+
F: __dxlog_file22,
|
|
6018
6188
|
L: 30,
|
|
6019
6189
|
S: void 0,
|
|
6020
6190
|
C: (f, a) => f(...a)
|
|
@@ -6032,7 +6202,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6032
6202
|
import_log19.log.info("done exporting files", {
|
|
6033
6203
|
count: files.length
|
|
6034
6204
|
}, {
|
|
6035
|
-
F:
|
|
6205
|
+
F: __dxlog_file22,
|
|
6036
6206
|
L: 41,
|
|
6037
6207
|
S: void 0,
|
|
6038
6208
|
C: (f, a) => f(...a)
|
|
@@ -6040,7 +6210,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6040
6210
|
}
|
|
6041
6211
|
{
|
|
6042
6212
|
import_log19.log.info("begin exporting kv pairs", void 0, {
|
|
6043
|
-
F:
|
|
6213
|
+
F: __dxlog_file22,
|
|
6044
6214
|
L: 45,
|
|
6045
6215
|
S: void 0,
|
|
6046
6216
|
C: (f, a) => f(...a)
|
|
@@ -6061,7 +6231,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6061
6231
|
import_log19.log.info("done exporting kv pairs", {
|
|
6062
6232
|
count
|
|
6063
6233
|
}, {
|
|
6064
|
-
F:
|
|
6234
|
+
F: __dxlog_file22,
|
|
6065
6235
|
L: 56,
|
|
6066
6236
|
S: void 0,
|
|
6067
6237
|
C: (f, a) => f(...a)
|
|
@@ -6070,14 +6240,15 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6070
6240
|
return archive;
|
|
6071
6241
|
};
|
|
6072
6242
|
var importProfileData = async ({ storage, level }, archive) => {
|
|
6073
|
-
|
|
6243
|
+
let batch = level.batch();
|
|
6244
|
+
let count = 0;
|
|
6074
6245
|
for (const entry2 of archive.storage) {
|
|
6075
6246
|
switch (entry2.type) {
|
|
6076
6247
|
case import_protocols15.ProfileArchiveEntryType.FILE: {
|
|
6077
6248
|
const directory = await storage.createDirectory();
|
|
6078
6249
|
(0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
6079
|
-
F:
|
|
6080
|
-
L:
|
|
6250
|
+
F: __dxlog_file22,
|
|
6251
|
+
L: 79,
|
|
6081
6252
|
S: void 0,
|
|
6082
6253
|
A: [
|
|
6083
6254
|
"typeof entry.key === 'string'",
|
|
@@ -6086,22 +6257,22 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6086
6257
|
});
|
|
6087
6258
|
const file = await directory.getOrCreateFile(entry2.key);
|
|
6088
6259
|
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6089
|
-
F:
|
|
6090
|
-
L:
|
|
6260
|
+
F: __dxlog_file22,
|
|
6261
|
+
L: 81,
|
|
6091
6262
|
S: void 0,
|
|
6092
6263
|
A: [
|
|
6093
6264
|
"entry.value instanceof Uint8Array",
|
|
6094
6265
|
"'Invalid value type'"
|
|
6095
6266
|
]
|
|
6096
6267
|
});
|
|
6097
|
-
await file.write(0, (0,
|
|
6268
|
+
await file.write(0, (0, import_util12.arrayToBuffer)(entry2.value));
|
|
6098
6269
|
await file.close();
|
|
6099
6270
|
break;
|
|
6100
6271
|
}
|
|
6101
6272
|
case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
|
|
6102
6273
|
(0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6103
|
-
F:
|
|
6104
|
-
L:
|
|
6274
|
+
F: __dxlog_file22,
|
|
6275
|
+
L: 87,
|
|
6105
6276
|
S: void 0,
|
|
6106
6277
|
A: [
|
|
6107
6278
|
"entry.key instanceof Uint8Array",
|
|
@@ -6109,8 +6280,8 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6109
6280
|
]
|
|
6110
6281
|
});
|
|
6111
6282
|
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6112
|
-
F:
|
|
6113
|
-
L:
|
|
6283
|
+
F: __dxlog_file22,
|
|
6284
|
+
L: 88,
|
|
6114
6285
|
S: void 0,
|
|
6115
6286
|
A: [
|
|
6116
6287
|
"entry.value instanceof Uint8Array",
|
|
@@ -6126,10 +6297,30 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6126
6297
|
default:
|
|
6127
6298
|
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6128
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
|
+
}
|
|
6129
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
|
+
});
|
|
6130
6321
|
await batch.write();
|
|
6131
6322
|
};
|
|
6132
|
-
var
|
|
6323
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
6133
6324
|
var DevicesServiceImpl = class {
|
|
6134
6325
|
constructor(_identityManager) {
|
|
6135
6326
|
this._identityManager = _identityManager;
|
|
@@ -6147,7 +6338,7 @@ var DevicesServiceImpl = class {
|
|
|
6147
6338
|
});
|
|
6148
6339
|
} else {
|
|
6149
6340
|
(0, import_invariant21.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
6150
|
-
F:
|
|
6341
|
+
F: __dxlog_file23,
|
|
6151
6342
|
L: 32,
|
|
6152
6343
|
S: this,
|
|
6153
6344
|
A: [
|
|
@@ -6188,7 +6379,7 @@ var DevicesServiceImpl = class {
|
|
|
6188
6379
|
presenceSubscribed = true;
|
|
6189
6380
|
}
|
|
6190
6381
|
};
|
|
6191
|
-
const subscriptions = new
|
|
6382
|
+
const subscriptions = new import_async20.EventSubscriptions();
|
|
6192
6383
|
if (this._identityManager.identity) {
|
|
6193
6384
|
subscribeIdentity();
|
|
6194
6385
|
subscribePresence();
|
|
@@ -6228,7 +6419,7 @@ var DiagnosticsCollector = class {
|
|
|
6228
6419
|
client: clientDiagnostics,
|
|
6229
6420
|
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
6230
6421
|
};
|
|
6231
|
-
return JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6422
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util13.jsonKeyReplacer)(options)));
|
|
6232
6423
|
}
|
|
6233
6424
|
};
|
|
6234
6425
|
var findSystemServiceProvider = () => {
|
|
@@ -6238,13 +6429,90 @@ var findSystemServiceProvider = () => {
|
|
|
6238
6429
|
};
|
|
6239
6430
|
var findConfigs = () => {
|
|
6240
6431
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
6241
|
-
return configs.map((r) => r.instance.deref()).filter(
|
|
6432
|
+
return configs.map((r) => r.instance.deref()).filter(import_util13.nonNullable);
|
|
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
|
+
}
|
|
6242
6510
|
};
|
|
6243
6511
|
var LoggingServiceImpl = class {
|
|
6244
6512
|
constructor() {
|
|
6245
6513
|
this._logs = new import_async22.Event();
|
|
6246
6514
|
this._started = Date.now();
|
|
6247
|
-
this._sessionId =
|
|
6515
|
+
this._sessionId = import_keys18.PublicKey.random().toHex();
|
|
6248
6516
|
this._logProcessor = (_config, entry2) => {
|
|
6249
6517
|
this._logs.emit(entry2);
|
|
6250
6518
|
};
|
|
@@ -6280,7 +6548,7 @@ var LoggingServiceImpl = class {
|
|
|
6280
6548
|
stats: (0, import_util16.numericalValues)(events, "duration")
|
|
6281
6549
|
};
|
|
6282
6550
|
};
|
|
6283
|
-
return new
|
|
6551
|
+
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
6284
6552
|
const update = () => {
|
|
6285
6553
|
const metrics = {
|
|
6286
6554
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6302,7 +6570,7 @@ var LoggingServiceImpl = class {
|
|
|
6302
6570
|
});
|
|
6303
6571
|
}
|
|
6304
6572
|
queryLogs(request) {
|
|
6305
|
-
return new
|
|
6573
|
+
return new import_codec_protobuf14.Stream(({ ctx, next }) => {
|
|
6306
6574
|
const handler = (entry2) => {
|
|
6307
6575
|
if (LOG_PROCESSING > 0) {
|
|
6308
6576
|
return;
|
|
@@ -6362,7 +6630,7 @@ var NetworkServiceImpl = class {
|
|
|
6362
6630
|
this.signalManager = signalManager;
|
|
6363
6631
|
}
|
|
6364
6632
|
queryStatus() {
|
|
6365
|
-
return new
|
|
6633
|
+
return new import_codec_protobuf15.Stream(({ next }) => {
|
|
6366
6634
|
const update = () => {
|
|
6367
6635
|
next({
|
|
6368
6636
|
swarm: this.networkManager.connectionState,
|
|
@@ -6419,7 +6687,7 @@ var SystemServiceImpl = class {
|
|
|
6419
6687
|
}
|
|
6420
6688
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6421
6689
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6422
|
-
return new
|
|
6690
|
+
return new import_codec_protobuf16.Stream(({ next }) => {
|
|
6423
6691
|
const update = () => {
|
|
6424
6692
|
next({
|
|
6425
6693
|
status: this._getCurrentStatus()
|
|
@@ -6448,7 +6716,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6448
6716
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6449
6717
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6450
6718
|
}
|
|
6451
|
-
var
|
|
6719
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6452
6720
|
var ClientServicesHost = class {
|
|
6453
6721
|
constructor({
|
|
6454
6722
|
config,
|
|
@@ -6462,7 +6730,7 @@ var ClientServicesHost = class {
|
|
|
6462
6730
|
runtimeParams
|
|
6463
6731
|
} = {}) {
|
|
6464
6732
|
this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
|
|
6465
|
-
this._statusUpdate = new
|
|
6733
|
+
this._statusUpdate = new import_async19.Event();
|
|
6466
6734
|
this._opening = false;
|
|
6467
6735
|
this._open = false;
|
|
6468
6736
|
this._storage = storage;
|
|
@@ -6481,7 +6749,10 @@ var ClientServicesHost = class {
|
|
|
6481
6749
|
lockKey,
|
|
6482
6750
|
onAcquire: () => {
|
|
6483
6751
|
if (!this._opening) {
|
|
6484
|
-
void this.open(new
|
|
6752
|
+
void this.open(new import_context15.Context(void 0, {
|
|
6753
|
+
F: __dxlog_file24,
|
|
6754
|
+
L: 121
|
|
6755
|
+
}));
|
|
6485
6756
|
}
|
|
6486
6757
|
},
|
|
6487
6758
|
onRelease: () => this.close()
|
|
@@ -6537,8 +6808,8 @@ var ClientServicesHost = class {
|
|
|
6537
6808
|
*/
|
|
6538
6809
|
initialize({ config, ...options }) {
|
|
6539
6810
|
(0, import_invariant20.invariant)(!this._open, "service host is open", {
|
|
6540
|
-
F:
|
|
6541
|
-
L:
|
|
6811
|
+
F: __dxlog_file24,
|
|
6812
|
+
L: 187,
|
|
6542
6813
|
S: this,
|
|
6543
6814
|
A: [
|
|
6544
6815
|
"!this._open",
|
|
@@ -6546,15 +6817,15 @@ var ClientServicesHost = class {
|
|
|
6546
6817
|
]
|
|
6547
6818
|
});
|
|
6548
6819
|
(0, import_log20.log)("initializing...", void 0, {
|
|
6549
|
-
F:
|
|
6550
|
-
L:
|
|
6820
|
+
F: __dxlog_file24,
|
|
6821
|
+
L: 188,
|
|
6551
6822
|
S: this,
|
|
6552
6823
|
C: (f, a) => f(...a)
|
|
6553
6824
|
});
|
|
6554
6825
|
if (config) {
|
|
6555
6826
|
(0, import_invariant20.invariant)(!this._config, "config already set", {
|
|
6556
|
-
F:
|
|
6557
|
-
L:
|
|
6827
|
+
F: __dxlog_file24,
|
|
6828
|
+
L: 191,
|
|
6558
6829
|
S: this,
|
|
6559
6830
|
A: [
|
|
6560
6831
|
"!this._config",
|
|
@@ -6568,8 +6839,8 @@ var ClientServicesHost = class {
|
|
|
6568
6839
|
}
|
|
6569
6840
|
if (!options.signalManager) {
|
|
6570
6841
|
import_log20.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
6571
|
-
F:
|
|
6572
|
-
L:
|
|
6842
|
+
F: __dxlog_file24,
|
|
6843
|
+
L: 199,
|
|
6573
6844
|
S: this,
|
|
6574
6845
|
C: (f, a) => f(...a)
|
|
6575
6846
|
});
|
|
@@ -6579,8 +6850,8 @@ var ClientServicesHost = class {
|
|
|
6579
6850
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6580
6851
|
this._signalManager = signalManager;
|
|
6581
6852
|
(0, import_invariant20.invariant)(!this._networkManager, "network manager already set", {
|
|
6582
|
-
F:
|
|
6583
|
-
L:
|
|
6853
|
+
F: __dxlog_file24,
|
|
6854
|
+
L: 210,
|
|
6584
6855
|
S: this,
|
|
6585
6856
|
A: [
|
|
6586
6857
|
"!this._networkManager",
|
|
@@ -6593,8 +6864,8 @@ var ClientServicesHost = class {
|
|
|
6593
6864
|
signalManager
|
|
6594
6865
|
});
|
|
6595
6866
|
(0, import_log20.log)("initialized", void 0, {
|
|
6596
|
-
F:
|
|
6597
|
-
L:
|
|
6867
|
+
F: __dxlog_file24,
|
|
6868
|
+
L: 217,
|
|
6598
6869
|
S: this,
|
|
6599
6870
|
C: (f, a) => f(...a)
|
|
6600
6871
|
});
|
|
@@ -6607,14 +6878,14 @@ var ClientServicesHost = class {
|
|
|
6607
6878
|
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.begin({
|
|
6608
6879
|
id: traceId
|
|
6609
6880
|
}), {
|
|
6610
|
-
F:
|
|
6611
|
-
L:
|
|
6881
|
+
F: __dxlog_file24,
|
|
6882
|
+
L: 228,
|
|
6612
6883
|
S: this,
|
|
6613
6884
|
C: (f, a) => f(...a)
|
|
6614
6885
|
});
|
|
6615
6886
|
(0, import_invariant20.invariant)(this._config, "config not set", {
|
|
6616
|
-
F:
|
|
6617
|
-
L:
|
|
6887
|
+
F: __dxlog_file24,
|
|
6888
|
+
L: 230,
|
|
6618
6889
|
S: this,
|
|
6619
6890
|
A: [
|
|
6620
6891
|
"this._config",
|
|
@@ -6622,8 +6893,8 @@ var ClientServicesHost = class {
|
|
|
6622
6893
|
]
|
|
6623
6894
|
});
|
|
6624
6895
|
(0, import_invariant20.invariant)(this._storage, "storage not set", {
|
|
6625
|
-
F:
|
|
6626
|
-
L:
|
|
6896
|
+
F: __dxlog_file24,
|
|
6897
|
+
L: 231,
|
|
6627
6898
|
S: this,
|
|
6628
6899
|
A: [
|
|
6629
6900
|
"this._storage",
|
|
@@ -6631,8 +6902,8 @@ var ClientServicesHost = class {
|
|
|
6631
6902
|
]
|
|
6632
6903
|
});
|
|
6633
6904
|
(0, import_invariant20.invariant)(this._signalManager, "signal manager not set", {
|
|
6634
|
-
F:
|
|
6635
|
-
L:
|
|
6905
|
+
F: __dxlog_file24,
|
|
6906
|
+
L: 232,
|
|
6636
6907
|
S: this,
|
|
6637
6908
|
A: [
|
|
6638
6909
|
"this._signalManager",
|
|
@@ -6640,8 +6911,8 @@ var ClientServicesHost = class {
|
|
|
6640
6911
|
]
|
|
6641
6912
|
});
|
|
6642
6913
|
(0, import_invariant20.invariant)(this._networkManager, "network manager not set", {
|
|
6643
|
-
F:
|
|
6644
|
-
L:
|
|
6914
|
+
F: __dxlog_file24,
|
|
6915
|
+
L: 233,
|
|
6645
6916
|
S: this,
|
|
6646
6917
|
A: [
|
|
6647
6918
|
"this._networkManager",
|
|
@@ -6652,8 +6923,8 @@ var ClientServicesHost = class {
|
|
|
6652
6923
|
(0, import_log20.log)("opening...", {
|
|
6653
6924
|
lockKey: this._resourceLock?.lockKey
|
|
6654
6925
|
}, {
|
|
6655
|
-
F:
|
|
6656
|
-
L:
|
|
6926
|
+
F: __dxlog_file24,
|
|
6927
|
+
L: 236,
|
|
6657
6928
|
S: this,
|
|
6658
6929
|
C: (f, a) => f(...a)
|
|
6659
6930
|
});
|
|
@@ -6664,16 +6935,18 @@ var ClientServicesHost = class {
|
|
|
6664
6935
|
await this._level.open();
|
|
6665
6936
|
await this._loggingService.open();
|
|
6666
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
|
+
};
|
|
6667
6942
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6668
6943
|
this._serviceRegistry.setServices({
|
|
6669
6944
|
SystemService: this._systemService,
|
|
6670
6945
|
IdentityService: identityService,
|
|
6946
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6671
6947
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6672
6948
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6673
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6674
|
-
await this._serviceContext.initialized.wait();
|
|
6675
|
-
return this._serviceContext.dataSpaceManager;
|
|
6676
|
-
}),
|
|
6949
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6677
6950
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6678
6951
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6679
6952
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6706,16 +6979,16 @@ var ClientServicesHost = class {
|
|
|
6706
6979
|
(0, import_log20.log)("opened", {
|
|
6707
6980
|
deviceKey
|
|
6708
6981
|
}, {
|
|
6709
|
-
F:
|
|
6710
|
-
L:
|
|
6982
|
+
F: __dxlog_file24,
|
|
6983
|
+
L: 322,
|
|
6711
6984
|
S: this,
|
|
6712
6985
|
C: (f, a) => f(...a)
|
|
6713
6986
|
});
|
|
6714
6987
|
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.end({
|
|
6715
6988
|
id: traceId
|
|
6716
6989
|
}), {
|
|
6717
|
-
F:
|
|
6718
|
-
L:
|
|
6990
|
+
F: __dxlog_file24,
|
|
6991
|
+
L: 323,
|
|
6719
6992
|
S: this,
|
|
6720
6993
|
C: (f, a) => f(...a)
|
|
6721
6994
|
});
|
|
@@ -6728,8 +7001,8 @@ var ClientServicesHost = class {
|
|
|
6728
7001
|
(0, import_log20.log)("closing...", {
|
|
6729
7002
|
deviceKey
|
|
6730
7003
|
}, {
|
|
6731
|
-
F:
|
|
6732
|
-
L:
|
|
7004
|
+
F: __dxlog_file24,
|
|
7005
|
+
L: 334,
|
|
6733
7006
|
S: this,
|
|
6734
7007
|
C: (f, a) => f(...a)
|
|
6735
7008
|
});
|
|
@@ -6746,8 +7019,8 @@ var ClientServicesHost = class {
|
|
|
6746
7019
|
(0, import_log20.log)("closed", {
|
|
6747
7020
|
deviceKey
|
|
6748
7021
|
}, {
|
|
6749
|
-
F:
|
|
6750
|
-
L:
|
|
7022
|
+
F: __dxlog_file24,
|
|
7023
|
+
L: 343,
|
|
6751
7024
|
S: this,
|
|
6752
7025
|
C: (f, a) => f(...a)
|
|
6753
7026
|
});
|
|
@@ -6757,30 +7030,30 @@ var ClientServicesHost = class {
|
|
|
6757
7030
|
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.begin({
|
|
6758
7031
|
id: traceId
|
|
6759
7032
|
}), {
|
|
6760
|
-
F:
|
|
6761
|
-
L:
|
|
7033
|
+
F: __dxlog_file24,
|
|
7034
|
+
L: 348,
|
|
6762
7035
|
S: this,
|
|
6763
7036
|
C: (f, a) => f(...a)
|
|
6764
7037
|
});
|
|
6765
7038
|
import_log20.log.info("resetting...", void 0, {
|
|
6766
|
-
F:
|
|
6767
|
-
L:
|
|
7039
|
+
F: __dxlog_file24,
|
|
7040
|
+
L: 350,
|
|
6768
7041
|
S: this,
|
|
6769
7042
|
C: (f, a) => f(...a)
|
|
6770
7043
|
});
|
|
6771
7044
|
await this._serviceContext?.close();
|
|
6772
7045
|
await this._storage.reset();
|
|
6773
7046
|
import_log20.log.info("reset", void 0, {
|
|
6774
|
-
F:
|
|
6775
|
-
L:
|
|
7047
|
+
F: __dxlog_file24,
|
|
7048
|
+
L: 353,
|
|
6776
7049
|
S: this,
|
|
6777
7050
|
C: (f, a) => f(...a)
|
|
6778
7051
|
});
|
|
6779
7052
|
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.end({
|
|
6780
7053
|
id: traceId
|
|
6781
7054
|
}), {
|
|
6782
|
-
F:
|
|
6783
|
-
L:
|
|
7055
|
+
F: __dxlog_file24,
|
|
7056
|
+
L: 354,
|
|
6784
7057
|
S: this,
|
|
6785
7058
|
C: (f, a) => f(...a)
|
|
6786
7059
|
});
|
|
@@ -6799,11 +7072,11 @@ _ts_decorate8([
|
|
|
6799
7072
|
import_tracing9.trace.info()
|
|
6800
7073
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
6801
7074
|
_ts_decorate8([
|
|
6802
|
-
|
|
7075
|
+
import_async19.synchronized,
|
|
6803
7076
|
import_tracing9.trace.span()
|
|
6804
7077
|
], ClientServicesHost.prototype, "open", null);
|
|
6805
7078
|
_ts_decorate8([
|
|
6806
|
-
|
|
7079
|
+
import_async19.synchronized,
|
|
6807
7080
|
import_tracing9.trace.span()
|
|
6808
7081
|
], ClientServicesHost.prototype, "close", null);
|
|
6809
7082
|
ClientServicesHost = _ts_decorate8([
|
|
@@ -6853,4 +7126,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6853
7126
|
subscribeToSpaces,
|
|
6854
7127
|
subscribeToSwarmInfo
|
|
6855
7128
|
});
|
|
6856
|
-
//# sourceMappingURL=chunk-
|
|
7129
|
+
//# sourceMappingURL=chunk-LIWLWYC3.cjs.map
|