@dxos/client-services 0.5.9-main.b06c86b → 0.5.9-main.b78d4f4
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-2JCI5YEM.mjs → chunk-SPEYMJJE.mjs} +780 -432
- package/dist/lib/browser/chunk-SPEYMJJE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -2
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +10 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-HRQTR7UW.cjs → chunk-DDCTAJOJ.cjs} +792 -444
- package/dist/lib/node/chunk-DDCTAJOJ.cjs.map +7 -0
- package/dist/lib/node/index.cjs +53 -42
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +17 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +14 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +4 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/index.d.ts +1 -0
- package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts +14 -0
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -0
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/contacts-service.ts +85 -0
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -32
- package/src/packlets/services/service-host.ts +12 -4
- package/src/packlets/spaces/data-space-manager.ts +55 -2
- package/src/packlets/spaces/spaces-service.ts +38 -0
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/profile-archive.ts +97 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-2JCI5YEM.mjs.map +0 -7
- package/dist/lib/node/chunk-HRQTR7UW.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_DDCTAJOJ_exports = {};
|
|
30
|
+
__export(chunk_DDCTAJOJ_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -56,7 +56,11 @@ __export(chunk_HRQTR7UW_exports, {
|
|
|
56
56
|
createDiagnostics: () => createDiagnostics,
|
|
57
57
|
createLevel: () => createLevel,
|
|
58
58
|
createStorageObjects: () => createStorageObjects,
|
|
59
|
+
decodeProfileArchive: () => decodeProfileArchive,
|
|
60
|
+
encodeProfileArchive: () => encodeProfileArchive,
|
|
61
|
+
exportProfileData: () => exportProfileData,
|
|
59
62
|
getNetworkPeers: () => getNetworkPeers,
|
|
63
|
+
importProfileData: () => importProfileData,
|
|
60
64
|
isLocked: () => isLocked,
|
|
61
65
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
62
66
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
@@ -66,7 +70,7 @@ __export(chunk_HRQTR7UW_exports, {
|
|
|
66
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
67
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
68
72
|
});
|
|
69
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_DDCTAJOJ_exports);
|
|
70
74
|
var import_async = require("@dxos/async");
|
|
71
75
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
72
76
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -236,8 +240,10 @@ var import_context14 = require("@dxos/context");
|
|
|
236
240
|
var import_credentials15 = require("@dxos/credentials");
|
|
237
241
|
var import_echo_db2 = require("@dxos/echo-db");
|
|
238
242
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
243
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
239
244
|
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
240
245
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
246
|
+
var import_feed_store4 = require("@dxos/feed-store");
|
|
241
247
|
var import_invariant15 = require("@dxos/invariant");
|
|
242
248
|
var import_keys12 = require("@dxos/keys");
|
|
243
249
|
var import_log15 = require("@dxos/log");
|
|
@@ -255,7 +261,7 @@ var import_async18 = require("@dxos/async");
|
|
|
255
261
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
256
262
|
var import_credentials19 = require("@dxos/credentials");
|
|
257
263
|
var import_debug5 = require("@dxos/debug");
|
|
258
|
-
var
|
|
264
|
+
var import_feed_store5 = require("@dxos/feed-store");
|
|
259
265
|
var import_invariant16 = require("@dxos/invariant");
|
|
260
266
|
var import_log16 = require("@dxos/log");
|
|
261
267
|
var import_protocols12 = require("@dxos/protocols");
|
|
@@ -266,8 +272,8 @@ var import_context15 = require("@dxos/context");
|
|
|
266
272
|
var import_credentials20 = require("@dxos/credentials");
|
|
267
273
|
var import_debug6 = require("@dxos/debug");
|
|
268
274
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
269
|
-
var
|
|
270
|
-
var
|
|
275
|
+
var import_echo_pipeline6 = require("@dxos/echo-pipeline");
|
|
276
|
+
var import_feed_store6 = require("@dxos/feed-store");
|
|
271
277
|
var import_invariant17 = require("@dxos/invariant");
|
|
272
278
|
var import_keyring = require("@dxos/keyring");
|
|
273
279
|
var import_keys13 = require("@dxos/keys");
|
|
@@ -289,38 +295,47 @@ var import_util12 = require("@dxos/util");
|
|
|
289
295
|
var import_node_path = __toESM(require("node:path"));
|
|
290
296
|
var import_keys14 = require("@dxos/keys");
|
|
291
297
|
var import_kv_store = require("@dxos/kv-store");
|
|
298
|
+
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
299
|
+
var import_invariant19 = require("@dxos/invariant");
|
|
300
|
+
var import_log19 = require("@dxos/log");
|
|
301
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
302
|
+
var import_util13 = require("@dxos/util");
|
|
292
303
|
var import_async20 = require("@dxos/async");
|
|
293
304
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
294
305
|
var import_context16 = require("@dxos/context");
|
|
295
|
-
var
|
|
306
|
+
var import_invariant20 = require("@dxos/invariant");
|
|
296
307
|
var import_keys15 = require("@dxos/keys");
|
|
297
|
-
var
|
|
308
|
+
var import_log20 = require("@dxos/log");
|
|
298
309
|
var import_messaging = require("@dxos/messaging");
|
|
299
310
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
300
|
-
var
|
|
311
|
+
var import_protocols16 = require("@dxos/protocols");
|
|
301
312
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
302
313
|
var import_tracing9 = require("@dxos/tracing");
|
|
303
314
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
304
315
|
var import_async21 = require("@dxos/async");
|
|
305
316
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
306
|
-
var
|
|
317
|
+
var import_invariant21 = require("@dxos/invariant");
|
|
307
318
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
308
319
|
var import_config3 = require("@dxos/config");
|
|
309
320
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
310
321
|
var import_tracing10 = require("@dxos/tracing");
|
|
311
|
-
var import_util13 = require("@dxos/util");
|
|
312
|
-
var import_keys16 = require("@dxos/keys");
|
|
313
322
|
var import_util14 = require("@dxos/util");
|
|
323
|
+
var import_keys16 = require("@dxos/keys");
|
|
324
|
+
var import_util15 = require("@dxos/util");
|
|
314
325
|
var import_async22 = require("@dxos/async");
|
|
315
326
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
316
327
|
var import_keys17 = require("@dxos/keys");
|
|
317
|
-
var
|
|
318
|
-
var
|
|
319
|
-
var import_util15 = require("@dxos/util");
|
|
328
|
+
var import_util16 = require("@dxos/util");
|
|
329
|
+
var import_async23 = require("@dxos/async");
|
|
320
330
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
331
|
+
var import_keys18 = require("@dxos/keys");
|
|
332
|
+
var import_log21 = require("@dxos/log");
|
|
333
|
+
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
334
|
+
var import_util17 = require("@dxos/util");
|
|
321
335
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
336
|
+
var import_codec_protobuf16 = require("@dxos/codec-protobuf");
|
|
322
337
|
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
323
|
-
var
|
|
338
|
+
var import_util18 = require("@dxos/util");
|
|
324
339
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
325
340
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
326
341
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -388,6 +403,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
388
403
|
};
|
|
389
404
|
});
|
|
390
405
|
};
|
|
406
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
391
407
|
var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
|
|
392
408
|
const update = () => {
|
|
393
409
|
try {
|
|
@@ -403,7 +419,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
|
|
|
403
419
|
update();
|
|
404
420
|
});
|
|
405
421
|
var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
|
|
406
|
-
const ctx = new import_context.Context(
|
|
422
|
+
const ctx = new import_context.Context(void 0, {
|
|
423
|
+
F: __dxlog_file,
|
|
424
|
+
L: 36
|
|
425
|
+
});
|
|
407
426
|
signalManager.onMessage.on(ctx, (message) => {
|
|
408
427
|
next({
|
|
409
428
|
message: {
|
|
@@ -631,7 +650,7 @@ var DevtoolsServiceImpl = class {
|
|
|
631
650
|
});
|
|
632
651
|
}
|
|
633
652
|
};
|
|
634
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
653
|
+
var DXOS_VERSION = "0.5.9-main.b78d4f4";
|
|
635
654
|
var getPlatform = () => {
|
|
636
655
|
if (process.browser) {
|
|
637
656
|
if (typeof window !== "undefined") {
|
|
@@ -659,7 +678,7 @@ var getPlatform = () => {
|
|
|
659
678
|
};
|
|
660
679
|
}
|
|
661
680
|
};
|
|
662
|
-
var
|
|
681
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
663
682
|
var DEFAULT_TIMEOUT = 1e3;
|
|
664
683
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
665
684
|
const diagnostics = {
|
|
@@ -676,7 +695,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
676
695
|
await Promise.all([
|
|
677
696
|
(async () => {
|
|
678
697
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
679
|
-
F:
|
|
698
|
+
F: __dxlog_file2,
|
|
680
699
|
L: 110,
|
|
681
700
|
S: void 0,
|
|
682
701
|
A: [
|
|
@@ -865,7 +884,7 @@ _ts_decorate([
|
|
|
865
884
|
ClientRpcServer = _ts_decorate([
|
|
866
885
|
import_tracing2.trace.resource()
|
|
867
886
|
], ClientRpcServer);
|
|
868
|
-
var
|
|
887
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
869
888
|
var Credential = import_protocols2.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
870
889
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
871
890
|
const credential = await signer.createCredential({
|
|
@@ -880,7 +899,10 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
880
899
|
var TrustedKeySetAuthVerifier = class {
|
|
881
900
|
constructor(_params) {
|
|
882
901
|
this._params = _params;
|
|
883
|
-
this._ctx = new import_context2.Context(
|
|
902
|
+
this._ctx = new import_context2.Context(void 0, {
|
|
903
|
+
F: __dxlog_file3,
|
|
904
|
+
L: 45
|
|
905
|
+
});
|
|
884
906
|
}
|
|
885
907
|
async close() {
|
|
886
908
|
await this._ctx.dispose();
|
|
@@ -891,7 +913,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
891
913
|
(0, import_log.log)("authenticating...", {
|
|
892
914
|
credential
|
|
893
915
|
}, {
|
|
894
|
-
F:
|
|
916
|
+
F: __dxlog_file3,
|
|
895
917
|
L: 56,
|
|
896
918
|
S: this,
|
|
897
919
|
C: (f, a) => f(...a)
|
|
@@ -901,7 +923,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
901
923
|
(0, import_log.log)("Invalid credential", {
|
|
902
924
|
result
|
|
903
925
|
}, {
|
|
904
|
-
F:
|
|
926
|
+
F: __dxlog_file3,
|
|
905
927
|
L: 60,
|
|
906
928
|
S: this,
|
|
907
929
|
C: (f, a) => f(...a)
|
|
@@ -913,7 +935,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
913
935
|
nonce,
|
|
914
936
|
credential
|
|
915
937
|
}, {
|
|
916
|
-
F:
|
|
938
|
+
F: __dxlog_file3,
|
|
917
939
|
L: 65,
|
|
918
940
|
S: this,
|
|
919
941
|
C: (f, a) => f(...a)
|
|
@@ -924,7 +946,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
924
946
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
925
947
|
key: credential.issuer
|
|
926
948
|
}, {
|
|
927
|
-
F:
|
|
949
|
+
F: __dxlog_file3,
|
|
928
950
|
L: 70,
|
|
929
951
|
S: this,
|
|
930
952
|
C: (f, a) => f(...a)
|
|
@@ -940,7 +962,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
940
962
|
(0, import_log.log)("auth success", {
|
|
941
963
|
key: credential.issuer
|
|
942
964
|
}, {
|
|
943
|
-
F:
|
|
965
|
+
F: __dxlog_file3,
|
|
944
966
|
L: 81,
|
|
945
967
|
S: this,
|
|
946
968
|
C: (f, a) => f(...a)
|
|
@@ -950,7 +972,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
950
972
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
951
973
|
key: credential.issuer
|
|
952
974
|
}, {
|
|
953
|
-
F:
|
|
975
|
+
F: __dxlog_file3,
|
|
954
976
|
L: 84,
|
|
955
977
|
S: this,
|
|
956
978
|
C: (f, a) => f(...a)
|
|
@@ -973,7 +995,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
973
995
|
return deviceSet.has(deviceKey);
|
|
974
996
|
}
|
|
975
997
|
};
|
|
976
|
-
var
|
|
998
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
977
999
|
var DefaultSpaceStateMachine = class {
|
|
978
1000
|
constructor(_params) {
|
|
979
1001
|
this._params = _params;
|
|
@@ -990,7 +1012,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
990
1012
|
expectedIdentity: this._params.identityKey,
|
|
991
1013
|
credential
|
|
992
1014
|
}, {
|
|
993
|
-
F:
|
|
1015
|
+
F: __dxlog_file4,
|
|
994
1016
|
L: 32,
|
|
995
1017
|
S: this,
|
|
996
1018
|
C: (f, a) => f(...a)
|
|
@@ -1001,7 +1023,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
1001
1023
|
import_log3.log.warn("Invalid default space id", {
|
|
1002
1024
|
id: assertion.spaceId
|
|
1003
1025
|
}, {
|
|
1004
|
-
F:
|
|
1026
|
+
F: __dxlog_file4,
|
|
1005
1027
|
L: 36,
|
|
1006
1028
|
S: this,
|
|
1007
1029
|
C: (f, a) => f(...a)
|
|
@@ -1024,7 +1046,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1024
1046
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1025
1047
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1026
1048
|
}
|
|
1027
|
-
var
|
|
1049
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
1028
1050
|
var Identity = class {
|
|
1029
1051
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
1030
1052
|
this.stateUpdate = new import_async6.Event();
|
|
@@ -1036,7 +1058,7 @@ var Identity = class {
|
|
|
1036
1058
|
import_log2.log.trace("dxos.halo.device", {
|
|
1037
1059
|
deviceKey
|
|
1038
1060
|
}, {
|
|
1039
|
-
F:
|
|
1061
|
+
F: __dxlog_file5,
|
|
1040
1062
|
L: 70,
|
|
1041
1063
|
S: this,
|
|
1042
1064
|
C: (f, a) => f(...a)
|
|
@@ -1115,7 +1137,7 @@ var Identity = class {
|
|
|
1115
1137
|
*/
|
|
1116
1138
|
getIdentityCredentialSigner() {
|
|
1117
1139
|
(0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
1118
|
-
F:
|
|
1140
|
+
F: __dxlog_file5,
|
|
1119
1141
|
L: 159,
|
|
1120
1142
|
S: this,
|
|
1121
1143
|
A: [
|
|
@@ -1159,7 +1181,7 @@ var Identity = class {
|
|
|
1159
1181
|
controlFeedKey,
|
|
1160
1182
|
dataFeedKey
|
|
1161
1183
|
}, {
|
|
1162
|
-
F:
|
|
1184
|
+
F: __dxlog_file5,
|
|
1163
1185
|
L: 184,
|
|
1164
1186
|
S: this,
|
|
1165
1187
|
C: (f, a) => f(...a)
|
|
@@ -1220,7 +1242,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1220
1242
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1221
1243
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1222
1244
|
}
|
|
1223
|
-
var
|
|
1245
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1224
1246
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1225
1247
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1226
1248
|
var IdentityManager = class {
|
|
@@ -1244,7 +1266,7 @@ var IdentityManager = class {
|
|
|
1244
1266
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
|
|
1245
1267
|
id: traceId
|
|
1246
1268
|
}), {
|
|
1247
|
-
F:
|
|
1269
|
+
F: __dxlog_file6,
|
|
1248
1270
|
L: 104,
|
|
1249
1271
|
S: this,
|
|
1250
1272
|
C: (f, a) => f(...a)
|
|
@@ -1253,7 +1275,7 @@ var IdentityManager = class {
|
|
|
1253
1275
|
(0, import_log4.log)("identity record", {
|
|
1254
1276
|
identityRecord
|
|
1255
1277
|
}, {
|
|
1256
|
-
F:
|
|
1278
|
+
F: __dxlog_file6,
|
|
1257
1279
|
L: 107,
|
|
1258
1280
|
S: this,
|
|
1259
1281
|
C: (f, a) => f(...a)
|
|
@@ -1266,7 +1288,7 @@ var IdentityManager = class {
|
|
|
1266
1288
|
identityKey: identityRecord.identityKey,
|
|
1267
1289
|
displayName: this._identity.profileDocument?.displayName
|
|
1268
1290
|
}, {
|
|
1269
|
-
F:
|
|
1291
|
+
F: __dxlog_file6,
|
|
1270
1292
|
L: 112,
|
|
1271
1293
|
S: this,
|
|
1272
1294
|
C: (f, a) => f(...a)
|
|
@@ -1276,18 +1298,21 @@ var IdentityManager = class {
|
|
|
1276
1298
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
|
|
1277
1299
|
id: traceId
|
|
1278
1300
|
}), {
|
|
1279
|
-
F:
|
|
1301
|
+
F: __dxlog_file6,
|
|
1280
1302
|
L: 119,
|
|
1281
1303
|
S: this,
|
|
1282
1304
|
C: (f, a) => f(...a)
|
|
1283
1305
|
});
|
|
1284
1306
|
}
|
|
1285
1307
|
async close() {
|
|
1286
|
-
await this._identity?.close(new import_context3.Context(
|
|
1308
|
+
await this._identity?.close(new import_context3.Context(void 0, {
|
|
1309
|
+
F: __dxlog_file6,
|
|
1310
|
+
L: 123
|
|
1311
|
+
}));
|
|
1287
1312
|
}
|
|
1288
1313
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1289
1314
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1290
|
-
F:
|
|
1315
|
+
F: __dxlog_file6,
|
|
1291
1316
|
L: 128,
|
|
1292
1317
|
S: this,
|
|
1293
1318
|
A: [
|
|
@@ -1296,7 +1321,7 @@ var IdentityManager = class {
|
|
|
1296
1321
|
]
|
|
1297
1322
|
});
|
|
1298
1323
|
(0, import_log4.log)("creating identity...", void 0, {
|
|
1299
|
-
F:
|
|
1324
|
+
F: __dxlog_file6,
|
|
1300
1325
|
L: 129,
|
|
1301
1326
|
S: this,
|
|
1302
1327
|
C: (f, a) => f(...a)
|
|
@@ -1313,11 +1338,14 @@ var IdentityManager = class {
|
|
|
1313
1338
|
}
|
|
1314
1339
|
};
|
|
1315
1340
|
const identity = await this._constructIdentity(identityRecord);
|
|
1316
|
-
await identity.open(new import_context3.Context(
|
|
1341
|
+
await identity.open(new import_context3.Context(void 0, {
|
|
1342
|
+
F: __dxlog_file6,
|
|
1343
|
+
L: 144
|
|
1344
|
+
}));
|
|
1317
1345
|
{
|
|
1318
1346
|
const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1319
1347
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1320
|
-
F:
|
|
1348
|
+
F: __dxlog_file6,
|
|
1321
1349
|
L: 148,
|
|
1322
1350
|
S: this,
|
|
1323
1351
|
A: [
|
|
@@ -1326,7 +1354,7 @@ var IdentityManager = class {
|
|
|
1326
1354
|
]
|
|
1327
1355
|
});
|
|
1328
1356
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1329
|
-
F:
|
|
1357
|
+
F: __dxlog_file6,
|
|
1330
1358
|
L: 149,
|
|
1331
1359
|
S: this,
|
|
1332
1360
|
A: [
|
|
@@ -1365,7 +1393,7 @@ var IdentityManager = class {
|
|
|
1365
1393
|
identityKey: identityRecord.identityKey,
|
|
1366
1394
|
displayName: this._identity.profileDocument?.displayName
|
|
1367
1395
|
}, {
|
|
1368
|
-
F:
|
|
1396
|
+
F: __dxlog_file6,
|
|
1369
1397
|
L: 191,
|
|
1370
1398
|
S: this,
|
|
1371
1399
|
C: (f, a) => f(...a)
|
|
@@ -1376,7 +1404,7 @@ var IdentityManager = class {
|
|
|
1376
1404
|
deviceKey: identity.deviceKey,
|
|
1377
1405
|
profile: identity.profileDocument
|
|
1378
1406
|
}, {
|
|
1379
|
-
F:
|
|
1407
|
+
F: __dxlog_file6,
|
|
1380
1408
|
L: 197,
|
|
1381
1409
|
S: this,
|
|
1382
1410
|
C: (f, a) => f(...a)
|
|
@@ -1413,13 +1441,13 @@ var IdentityManager = class {
|
|
|
1413
1441
|
(0, import_log4.log)("accepting identity", {
|
|
1414
1442
|
params
|
|
1415
1443
|
}, {
|
|
1416
|
-
F:
|
|
1444
|
+
F: __dxlog_file6,
|
|
1417
1445
|
L: 235,
|
|
1418
1446
|
S: this,
|
|
1419
1447
|
C: (f, a) => f(...a)
|
|
1420
1448
|
});
|
|
1421
1449
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1422
|
-
F:
|
|
1450
|
+
F: __dxlog_file6,
|
|
1423
1451
|
L: 236,
|
|
1424
1452
|
S: this,
|
|
1425
1453
|
A: [
|
|
@@ -1439,7 +1467,10 @@ var IdentityManager = class {
|
|
|
1439
1467
|
}
|
|
1440
1468
|
};
|
|
1441
1469
|
const identity = await this._constructIdentity(identityRecord);
|
|
1442
|
-
await identity.open(new import_context3.Context(
|
|
1470
|
+
await identity.open(new import_context3.Context(void 0, {
|
|
1471
|
+
F: __dxlog_file6,
|
|
1472
|
+
L: 251
|
|
1473
|
+
}));
|
|
1443
1474
|
this._identity = identity;
|
|
1444
1475
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1445
1476
|
await this._identity.ready();
|
|
@@ -1447,7 +1478,7 @@ var IdentityManager = class {
|
|
|
1447
1478
|
identityKey: identityRecord.identityKey,
|
|
1448
1479
|
displayName: this._identity.profileDocument?.displayName
|
|
1449
1480
|
}, {
|
|
1450
|
-
F:
|
|
1481
|
+
F: __dxlog_file6,
|
|
1451
1482
|
L: 255,
|
|
1452
1483
|
S: this,
|
|
1453
1484
|
C: (f, a) => f(...a)
|
|
@@ -1461,7 +1492,7 @@ var IdentityManager = class {
|
|
|
1461
1492
|
identityKey: identity.identityKey,
|
|
1462
1493
|
deviceKey: identity.deviceKey
|
|
1463
1494
|
}, {
|
|
1464
|
-
F:
|
|
1495
|
+
F: __dxlog_file6,
|
|
1465
1496
|
L: 265,
|
|
1466
1497
|
S: this,
|
|
1467
1498
|
C: (f, a) => f(...a)
|
|
@@ -1473,7 +1504,7 @@ var IdentityManager = class {
|
|
|
1473
1504
|
*/
|
|
1474
1505
|
async updateProfile(profile) {
|
|
1475
1506
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1476
|
-
F:
|
|
1507
|
+
F: __dxlog_file6,
|
|
1477
1508
|
L: 273,
|
|
1478
1509
|
S: this,
|
|
1479
1510
|
A: [
|
|
@@ -1504,7 +1535,7 @@ var IdentityManager = class {
|
|
|
1504
1535
|
}
|
|
1505
1536
|
async updateDeviceProfile(profile) {
|
|
1506
1537
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1507
|
-
F:
|
|
1538
|
+
F: __dxlog_file6,
|
|
1508
1539
|
L: 290,
|
|
1509
1540
|
S: this,
|
|
1510
1541
|
A: [
|
|
@@ -1540,7 +1571,7 @@ var IdentityManager = class {
|
|
|
1540
1571
|
}
|
|
1541
1572
|
async _constructIdentity(identityRecord) {
|
|
1542
1573
|
(0, import_invariant3.invariant)(!this._identity, void 0, {
|
|
1543
|
-
F:
|
|
1574
|
+
F: __dxlog_file6,
|
|
1544
1575
|
L: 316,
|
|
1545
1576
|
S: this,
|
|
1546
1577
|
A: [
|
|
@@ -1551,7 +1582,7 @@ var IdentityManager = class {
|
|
|
1551
1582
|
(0, import_log4.log)("constructing identity", {
|
|
1552
1583
|
identityRecord
|
|
1553
1584
|
}, {
|
|
1554
|
-
F:
|
|
1585
|
+
F: __dxlog_file6,
|
|
1555
1586
|
L: 317,
|
|
1556
1587
|
S: this,
|
|
1557
1588
|
C: (f, a) => f(...a)
|
|
@@ -1566,7 +1597,7 @@ var IdentityManager = class {
|
|
|
1566
1597
|
gossip
|
|
1567
1598
|
});
|
|
1568
1599
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1569
|
-
F:
|
|
1600
|
+
F: __dxlog_file6,
|
|
1570
1601
|
L: 330,
|
|
1571
1602
|
S: this,
|
|
1572
1603
|
A: [
|
|
@@ -1578,7 +1609,7 @@ var IdentityManager = class {
|
|
|
1578
1609
|
writable: true
|
|
1579
1610
|
});
|
|
1580
1611
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1581
|
-
F:
|
|
1612
|
+
F: __dxlog_file6,
|
|
1582
1613
|
L: 334,
|
|
1583
1614
|
S: this,
|
|
1584
1615
|
A: [
|
|
@@ -1612,7 +1643,7 @@ var IdentityManager = class {
|
|
|
1612
1643
|
(0, import_log4.log)("done", {
|
|
1613
1644
|
identityKey: identityRecord.identityKey
|
|
1614
1645
|
}, {
|
|
1615
|
-
F:
|
|
1646
|
+
F: __dxlog_file6,
|
|
1616
1647
|
L: 360,
|
|
1617
1648
|
S: this,
|
|
1618
1649
|
C: (f, a) => f(...a)
|
|
@@ -1637,7 +1668,7 @@ var IdentityManager = class {
|
|
|
1637
1668
|
},
|
|
1638
1669
|
onAuthFailure: () => {
|
|
1639
1670
|
import_log4.log.warn("auth failure", void 0, {
|
|
1640
|
-
F:
|
|
1671
|
+
F: __dxlog_file6,
|
|
1641
1672
|
L: 385,
|
|
1642
1673
|
S: this,
|
|
1643
1674
|
C: (f, a) => f(...a)
|
|
@@ -1659,7 +1690,7 @@ _ts_decorate3([
|
|
|
1659
1690
|
IdentityManager = _ts_decorate3([
|
|
1660
1691
|
import_tracing4.trace.resource()
|
|
1661
1692
|
], IdentityManager);
|
|
1662
|
-
var
|
|
1693
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1663
1694
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1664
1695
|
var IdentityServiceImpl = class extends import_context4.Resource {
|
|
1665
1696
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
@@ -1689,7 +1720,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1689
1720
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1690
1721
|
const identity = this._identityManager.identity;
|
|
1691
1722
|
(0, import_invariant4.invariant)(identity, void 0, {
|
|
1692
|
-
F:
|
|
1723
|
+
F: __dxlog_file7,
|
|
1693
1724
|
L: 59,
|
|
1694
1725
|
S: this,
|
|
1695
1726
|
A: [
|
|
@@ -1723,7 +1754,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1723
1754
|
}
|
|
1724
1755
|
async updateProfile(profile) {
|
|
1725
1756
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1726
|
-
F:
|
|
1757
|
+
F: __dxlog_file7,
|
|
1727
1758
|
L: 89,
|
|
1728
1759
|
S: this,
|
|
1729
1760
|
A: [
|
|
@@ -1737,7 +1768,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1737
1768
|
}
|
|
1738
1769
|
async signPresentation({ presentation, nonce }) {
|
|
1739
1770
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1740
|
-
F:
|
|
1771
|
+
F: __dxlog_file7,
|
|
1741
1772
|
L: 96,
|
|
1742
1773
|
S: this,
|
|
1743
1774
|
A: [
|
|
@@ -1772,7 +1803,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1772
1803
|
import_log5.log.warn("Multiple default spaces found. Using the first one.", {
|
|
1773
1804
|
duplicate: space.id
|
|
1774
1805
|
}, {
|
|
1775
|
-
F:
|
|
1806
|
+
F: __dxlog_file7,
|
|
1776
1807
|
L: 127,
|
|
1777
1808
|
S: this,
|
|
1778
1809
|
C: (f, a) => f(...a)
|
|
@@ -1795,7 +1826,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1795
1826
|
}
|
|
1796
1827
|
}
|
|
1797
1828
|
};
|
|
1798
|
-
var
|
|
1829
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1799
1830
|
var DeviceInvitationProtocol = class {
|
|
1800
1831
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1801
1832
|
this._keyring = _keyring;
|
|
@@ -1821,7 +1852,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1821
1852
|
}
|
|
1822
1853
|
async admit(_, request) {
|
|
1823
1854
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1824
|
-
F:
|
|
1855
|
+
F: __dxlog_file8,
|
|
1825
1856
|
L: 50,
|
|
1826
1857
|
S: this,
|
|
1827
1858
|
A: [
|
|
@@ -1867,7 +1898,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1867
1898
|
}
|
|
1868
1899
|
async accept(response, request) {
|
|
1869
1900
|
(0, import_invariant5.invariant)(response.device, void 0, {
|
|
1870
|
-
F:
|
|
1901
|
+
F: __dxlog_file8,
|
|
1871
1902
|
L: 95,
|
|
1872
1903
|
S: this,
|
|
1873
1904
|
A: [
|
|
@@ -1877,7 +1908,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1877
1908
|
});
|
|
1878
1909
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1879
1910
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1880
|
-
F:
|
|
1911
|
+
F: __dxlog_file8,
|
|
1881
1912
|
L: 98,
|
|
1882
1913
|
S: this,
|
|
1883
1914
|
A: [
|
|
@@ -1916,7 +1947,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1916
1947
|
return guard;
|
|
1917
1948
|
})());
|
|
1918
1949
|
};
|
|
1919
|
-
var
|
|
1950
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1920
1951
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1921
1952
|
var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
1922
1953
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1930,7 +1961,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1930
1961
|
});
|
|
1931
1962
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1932
1963
|
this._callbacks = _callbacks;
|
|
1933
|
-
this._ctx = new import_context6.Context(
|
|
1964
|
+
this._ctx = new import_context6.Context(void 0, {
|
|
1965
|
+
F: __dxlog_file9,
|
|
1966
|
+
L: 33
|
|
1967
|
+
});
|
|
1934
1968
|
this._remoteOptionsTrigger = new import_async10.Trigger();
|
|
1935
1969
|
this._invitationFlowLock = null;
|
|
1936
1970
|
}
|
|
@@ -1942,7 +1976,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1942
1976
|
InvitationHostService: {
|
|
1943
1977
|
options: async (options) => {
|
|
1944
1978
|
(0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1945
|
-
F:
|
|
1979
|
+
F: __dxlog_file9,
|
|
1946
1980
|
L: 63,
|
|
1947
1981
|
S: this,
|
|
1948
1982
|
A: [
|
|
@@ -1969,14 +2003,14 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1969
2003
|
await super.onOpen(context);
|
|
1970
2004
|
try {
|
|
1971
2005
|
(0, import_log7.log)("guest acquire lock", void 0, {
|
|
1972
|
-
F:
|
|
2006
|
+
F: __dxlog_file9,
|
|
1973
2007
|
L: 84,
|
|
1974
2008
|
S: this,
|
|
1975
2009
|
C: (f, a) => f(...a)
|
|
1976
2010
|
});
|
|
1977
2011
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1978
2012
|
(0, import_log7.log)("guest lock acquired", void 0, {
|
|
1979
|
-
F:
|
|
2013
|
+
F: __dxlog_file9,
|
|
1980
2014
|
L: 86,
|
|
1981
2015
|
S: this,
|
|
1982
2016
|
C: (f, a) => f(...a)
|
|
@@ -1985,7 +2019,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1985
2019
|
role: import_invitations3.Options.Role.GUEST
|
|
1986
2020
|
}));
|
|
1987
2021
|
(0, import_log7.log)("options sent", void 0, {
|
|
1988
|
-
F:
|
|
2022
|
+
F: __dxlog_file9,
|
|
1989
2023
|
L: 88,
|
|
1990
2024
|
S: this,
|
|
1991
2025
|
C: (f, a) => f(...a)
|
|
@@ -1994,7 +2028,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1994
2028
|
timeout: OPTIONS_TIMEOUT
|
|
1995
2029
|
}));
|
|
1996
2030
|
(0, import_log7.log)("options received", void 0, {
|
|
1997
|
-
F:
|
|
2031
|
+
F: __dxlog_file9,
|
|
1998
2032
|
L: 90,
|
|
1999
2033
|
S: this,
|
|
2000
2034
|
C: (f, a) => f(...a)
|
|
@@ -2028,7 +2062,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2028
2062
|
this._invitationFlowLock.release();
|
|
2029
2063
|
this._invitationFlowLock = null;
|
|
2030
2064
|
(0, import_log7.log)("invitation flow lock released", void 0, {
|
|
2031
|
-
F:
|
|
2065
|
+
F: __dxlog_file9,
|
|
2032
2066
|
L: 123,
|
|
2033
2067
|
S: this,
|
|
2034
2068
|
C: (f, a) => f(...a)
|
|
@@ -2036,7 +2070,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2036
2070
|
}
|
|
2037
2071
|
}
|
|
2038
2072
|
};
|
|
2039
|
-
var
|
|
2073
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
2040
2074
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
2041
2075
|
var MAX_OTP_ATTEMPTS = 3;
|
|
2042
2076
|
var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
@@ -2051,7 +2085,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2051
2085
|
});
|
|
2052
2086
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
2053
2087
|
this._callbacks = _callbacks;
|
|
2054
|
-
this._ctx = new import_context8.Context(
|
|
2088
|
+
this._ctx = new import_context8.Context(void 0, {
|
|
2089
|
+
F: __dxlog_file10,
|
|
2090
|
+
L: 52
|
|
2091
|
+
});
|
|
2055
2092
|
this._remoteOptionsTrigger = new import_async11.Trigger();
|
|
2056
2093
|
this._challenge = void 0;
|
|
2057
2094
|
this.guestProfile = void 0;
|
|
@@ -2070,7 +2107,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2070
2107
|
InvitationHostService: {
|
|
2071
2108
|
options: async (options) => {
|
|
2072
2109
|
(0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
2073
|
-
F:
|
|
2110
|
+
F: __dxlog_file10,
|
|
2074
2111
|
L: 101,
|
|
2075
2112
|
S: this,
|
|
2076
2113
|
A: [
|
|
@@ -2087,7 +2124,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2087
2124
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
|
|
2088
2125
|
id: traceId
|
|
2089
2126
|
}), {
|
|
2090
|
-
F:
|
|
2127
|
+
F: __dxlog_file10,
|
|
2091
2128
|
L: 110,
|
|
2092
2129
|
S: this,
|
|
2093
2130
|
C: (f, a) => f(...a)
|
|
@@ -2099,7 +2136,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2099
2136
|
expected: invitation.invitationId,
|
|
2100
2137
|
actual: invitationId
|
|
2101
2138
|
}, {
|
|
2102
|
-
F:
|
|
2139
|
+
F: __dxlog_file10,
|
|
2103
2140
|
L: 116,
|
|
2104
2141
|
S: this,
|
|
2105
2142
|
C: (f, a) => f(...a)
|
|
@@ -2113,7 +2150,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2113
2150
|
(0, import_log8.log)("guest introduced themselves", {
|
|
2114
2151
|
guestProfile: profile
|
|
2115
2152
|
}, {
|
|
2116
|
-
F:
|
|
2153
|
+
F: __dxlog_file10,
|
|
2117
2154
|
L: 125,
|
|
2118
2155
|
S: this,
|
|
2119
2156
|
C: (f, a) => f(...a)
|
|
@@ -2124,7 +2161,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2124
2161
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
|
|
2125
2162
|
id: traceId
|
|
2126
2163
|
}), {
|
|
2127
|
-
F:
|
|
2164
|
+
F: __dxlog_file10,
|
|
2128
2165
|
L: 132,
|
|
2129
2166
|
S: this,
|
|
2130
2167
|
C: (f, a) => f(...a)
|
|
@@ -2139,7 +2176,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2139
2176
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
|
|
2140
2177
|
id: traceId
|
|
2141
2178
|
}), {
|
|
2142
|
-
F:
|
|
2179
|
+
F: __dxlog_file10,
|
|
2143
2180
|
L: 141,
|
|
2144
2181
|
S: this,
|
|
2145
2182
|
C: (f, a) => f(...a)
|
|
@@ -2148,7 +2185,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2148
2185
|
(0, import_log8.log)("received authentication request", {
|
|
2149
2186
|
authCode: code
|
|
2150
2187
|
}, {
|
|
2151
|
-
F:
|
|
2188
|
+
F: __dxlog_file10,
|
|
2152
2189
|
L: 144,
|
|
2153
2190
|
S: this,
|
|
2154
2191
|
C: (f, a) => f(...a)
|
|
@@ -2162,7 +2199,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2162
2199
|
switch (invitation.authMethod) {
|
|
2163
2200
|
case import_services8.Invitation.AuthMethod.NONE: {
|
|
2164
2201
|
(0, import_log8.log)("authentication not required", void 0, {
|
|
2165
|
-
F:
|
|
2202
|
+
F: __dxlog_file10,
|
|
2166
2203
|
L: 152,
|
|
2167
2204
|
S: this,
|
|
2168
2205
|
C: (f, a) => f(...a)
|
|
@@ -2200,7 +2237,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2200
2237
|
import_log8.log.error("invalid authentication method", {
|
|
2201
2238
|
authMethod: invitation.authMethod
|
|
2202
2239
|
}, {
|
|
2203
|
-
F:
|
|
2240
|
+
F: __dxlog_file10,
|
|
2204
2241
|
L: 190,
|
|
2205
2242
|
S: this,
|
|
2206
2243
|
C: (f, a) => f(...a)
|
|
@@ -2225,7 +2262,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2225
2262
|
status
|
|
2226
2263
|
}
|
|
2227
2264
|
}), {
|
|
2228
|
-
F:
|
|
2265
|
+
F: __dxlog_file10,
|
|
2229
2266
|
L: 202,
|
|
2230
2267
|
S: this,
|
|
2231
2268
|
C: (f, a) => f(...a)
|
|
@@ -2239,7 +2276,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2239
2276
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
|
|
2240
2277
|
id: traceId
|
|
2241
2278
|
}), {
|
|
2242
|
-
F:
|
|
2279
|
+
F: __dxlog_file10,
|
|
2243
2280
|
L: 208,
|
|
2244
2281
|
S: this,
|
|
2245
2282
|
C: (f, a) => f(...a)
|
|
@@ -2256,7 +2293,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2256
2293
|
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
|
|
2257
2294
|
id: traceId
|
|
2258
2295
|
}), {
|
|
2259
|
-
F:
|
|
2296
|
+
F: __dxlog_file10,
|
|
2260
2297
|
L: 222,
|
|
2261
2298
|
S: this,
|
|
2262
2299
|
C: (f, a) => f(...a)
|
|
@@ -2274,14 +2311,14 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2274
2311
|
await super.onOpen(context);
|
|
2275
2312
|
try {
|
|
2276
2313
|
(0, import_log8.log)("host acquire lock", void 0, {
|
|
2277
|
-
F:
|
|
2314
|
+
F: __dxlog_file10,
|
|
2278
2315
|
L: 237,
|
|
2279
2316
|
S: this,
|
|
2280
2317
|
C: (f, a) => f(...a)
|
|
2281
2318
|
});
|
|
2282
2319
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2283
2320
|
(0, import_log8.log)("host lock acquired", void 0, {
|
|
2284
|
-
F:
|
|
2321
|
+
F: __dxlog_file10,
|
|
2285
2322
|
L: 239,
|
|
2286
2323
|
S: this,
|
|
2287
2324
|
C: (f, a) => f(...a)
|
|
@@ -2292,7 +2329,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2292
2329
|
role: import_invitations4.Options.Role.HOST
|
|
2293
2330
|
});
|
|
2294
2331
|
(0, import_log8.log)("options sent", void 0, {
|
|
2295
|
-
F:
|
|
2332
|
+
F: __dxlog_file10,
|
|
2296
2333
|
L: 243,
|
|
2297
2334
|
S: this,
|
|
2298
2335
|
C: (f, a) => f(...a)
|
|
@@ -2301,7 +2338,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2301
2338
|
timeout: OPTIONS_TIMEOUT2
|
|
2302
2339
|
}));
|
|
2303
2340
|
(0, import_log8.log)("options received", void 0, {
|
|
2304
|
-
F:
|
|
2341
|
+
F: __dxlog_file10,
|
|
2305
2342
|
L: 245,
|
|
2306
2343
|
S: this,
|
|
2307
2344
|
C: (f, a) => f(...a)
|
|
@@ -2355,7 +2392,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2355
2392
|
this._invitationFlowLock?.release();
|
|
2356
2393
|
this._invitationFlowLock = null;
|
|
2357
2394
|
(0, import_log8.log)("invitation flow lock released", void 0, {
|
|
2358
|
-
F:
|
|
2395
|
+
F: __dxlog_file10,
|
|
2359
2396
|
L: 300,
|
|
2360
2397
|
S: this,
|
|
2361
2398
|
C: (f, a) => f(...a)
|
|
@@ -2364,7 +2401,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2364
2401
|
}
|
|
2365
2402
|
};
|
|
2366
2403
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services8.Invitation.AuthMethod.NONE;
|
|
2367
|
-
var
|
|
2404
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2368
2405
|
var InvitationTopology = class {
|
|
2369
2406
|
constructor(_role) {
|
|
2370
2407
|
this._role = _role;
|
|
@@ -2372,7 +2409,7 @@ var InvitationTopology = class {
|
|
|
2372
2409
|
}
|
|
2373
2410
|
init(controller) {
|
|
2374
2411
|
(0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
|
|
2375
|
-
F:
|
|
2412
|
+
F: __dxlog_file11,
|
|
2376
2413
|
L: 42,
|
|
2377
2414
|
S: this,
|
|
2378
2415
|
A: [
|
|
@@ -2384,7 +2421,7 @@ var InvitationTopology = class {
|
|
|
2384
2421
|
}
|
|
2385
2422
|
update() {
|
|
2386
2423
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2387
|
-
F:
|
|
2424
|
+
F: __dxlog_file11,
|
|
2388
2425
|
L: 47,
|
|
2389
2426
|
S: this,
|
|
2390
2427
|
A: [
|
|
@@ -2407,7 +2444,7 @@ var InvitationTopology = class {
|
|
|
2407
2444
|
ownPeerId,
|
|
2408
2445
|
remotePeerId: firstUnknownPeer
|
|
2409
2446
|
}, {
|
|
2410
|
-
F:
|
|
2447
|
+
F: __dxlog_file11,
|
|
2411
2448
|
L: 69,
|
|
2412
2449
|
S: this,
|
|
2413
2450
|
C: (f, a) => f(...a)
|
|
@@ -2418,7 +2455,7 @@ var InvitationTopology = class {
|
|
|
2418
2455
|
}
|
|
2419
2456
|
async onOffer(peer) {
|
|
2420
2457
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2421
|
-
F:
|
|
2458
|
+
F: __dxlog_file11,
|
|
2422
2459
|
L: 76,
|
|
2423
2460
|
S: this,
|
|
2424
2461
|
A: [
|
|
@@ -2435,7 +2472,7 @@ var InvitationTopology = class {
|
|
|
2435
2472
|
return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
|
|
2436
2473
|
}
|
|
2437
2474
|
};
|
|
2438
|
-
var
|
|
2475
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2439
2476
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2440
2477
|
var InvitationsHandler = class {
|
|
2441
2478
|
/**
|
|
@@ -2460,7 +2497,7 @@ var InvitationsHandler = class {
|
|
|
2460
2497
|
try {
|
|
2461
2498
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2462
2499
|
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
2463
|
-
F:
|
|
2500
|
+
F: __dxlog_file12,
|
|
2464
2501
|
L: 90,
|
|
2465
2502
|
S: this,
|
|
2466
2503
|
A: [
|
|
@@ -2489,7 +2526,7 @@ var InvitationsHandler = class {
|
|
|
2489
2526
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
2490
2527
|
id: traceId
|
|
2491
2528
|
}), {
|
|
2492
|
-
F:
|
|
2529
|
+
F: __dxlog_file12,
|
|
2493
2530
|
L: 115,
|
|
2494
2531
|
S: this,
|
|
2495
2532
|
C: (f, a) => f(...a)
|
|
@@ -2497,7 +2534,7 @@ var InvitationsHandler = class {
|
|
|
2497
2534
|
(0, import_log6.log)("connected", {
|
|
2498
2535
|
...protocol.toJSON()
|
|
2499
2536
|
}, {
|
|
2500
|
-
F:
|
|
2537
|
+
F: __dxlog_file12,
|
|
2501
2538
|
L: 116,
|
|
2502
2539
|
S: this,
|
|
2503
2540
|
C: (f, a) => f(...a)
|
|
@@ -2509,7 +2546,7 @@ var InvitationsHandler = class {
|
|
|
2509
2546
|
guest: deviceKey,
|
|
2510
2547
|
...protocol.toJSON()
|
|
2511
2548
|
}, {
|
|
2512
|
-
F:
|
|
2549
|
+
F: __dxlog_file12,
|
|
2513
2550
|
L: 118,
|
|
2514
2551
|
S: this,
|
|
2515
2552
|
C: (f, a) => f(...a)
|
|
@@ -2518,7 +2555,7 @@ var InvitationsHandler = class {
|
|
|
2518
2555
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
|
|
2519
2556
|
id: traceId
|
|
2520
2557
|
}), {
|
|
2521
|
-
F:
|
|
2558
|
+
F: __dxlog_file12,
|
|
2522
2559
|
L: 120,
|
|
2523
2560
|
S: this,
|
|
2524
2561
|
C: (f, a) => f(...a)
|
|
@@ -2533,7 +2570,7 @@ var InvitationsHandler = class {
|
|
|
2533
2570
|
(0, import_log6.log)("timeout", {
|
|
2534
2571
|
...protocol.toJSON()
|
|
2535
2572
|
}, {
|
|
2536
|
-
F:
|
|
2573
|
+
F: __dxlog_file12,
|
|
2537
2574
|
L: 129,
|
|
2538
2575
|
S: this,
|
|
2539
2576
|
C: (f, a) => f(...a)
|
|
@@ -2542,7 +2579,7 @@ var InvitationsHandler = class {
|
|
|
2542
2579
|
} else {
|
|
2543
2580
|
if (guardedState.error(extension, err)) {
|
|
2544
2581
|
import_log6.log.error("failed", err, {
|
|
2545
|
-
F:
|
|
2582
|
+
F: __dxlog_file12,
|
|
2546
2583
|
L: 133,
|
|
2547
2584
|
S: this,
|
|
2548
2585
|
C: (f, a) => f(...a)
|
|
@@ -2553,7 +2590,7 @@ var InvitationsHandler = class {
|
|
|
2553
2590
|
id: traceId,
|
|
2554
2591
|
error: err
|
|
2555
2592
|
}), {
|
|
2556
|
-
F:
|
|
2593
|
+
F: __dxlog_file12,
|
|
2557
2594
|
L: 136,
|
|
2558
2595
|
S: this,
|
|
2559
2596
|
C: (f, a) => f(...a)
|
|
@@ -2567,7 +2604,7 @@ var InvitationsHandler = class {
|
|
|
2567
2604
|
(0, import_log6.log)("invalid role", {
|
|
2568
2605
|
...err.context
|
|
2569
2606
|
}, {
|
|
2570
|
-
F:
|
|
2607
|
+
F: __dxlog_file12,
|
|
2571
2608
|
L: 144,
|
|
2572
2609
|
S: this,
|
|
2573
2610
|
C: (f, a) => f(...a)
|
|
@@ -2579,7 +2616,7 @@ var InvitationsHandler = class {
|
|
|
2579
2616
|
(0, import_log6.log)("timeout", {
|
|
2580
2617
|
err
|
|
2581
2618
|
}, {
|
|
2582
|
-
F:
|
|
2619
|
+
F: __dxlog_file12,
|
|
2583
2620
|
L: 149,
|
|
2584
2621
|
S: this,
|
|
2585
2622
|
C: (f, a) => f(...a)
|
|
@@ -2588,7 +2625,7 @@ var InvitationsHandler = class {
|
|
|
2588
2625
|
} else {
|
|
2589
2626
|
if (guardedState.error(extension, err)) {
|
|
2590
2627
|
import_log6.log.error("failed", err, {
|
|
2591
|
-
F:
|
|
2628
|
+
F: __dxlog_file12,
|
|
2592
2629
|
L: 153,
|
|
2593
2630
|
S: this,
|
|
2594
2631
|
C: (f, a) => f(...a)
|
|
@@ -2602,7 +2639,7 @@ var InvitationsHandler = class {
|
|
|
2602
2639
|
if (invitation.lifetime && invitation.created) {
|
|
2603
2640
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2604
2641
|
import_log6.log.warn("invitation has already expired", void 0, {
|
|
2605
|
-
F:
|
|
2642
|
+
F: __dxlog_file12,
|
|
2606
2643
|
L: 164,
|
|
2607
2644
|
S: this,
|
|
2608
2645
|
C: (f, a) => f(...a)
|
|
@@ -2625,7 +2662,7 @@ var InvitationsHandler = class {
|
|
|
2625
2662
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2626
2663
|
if (deviceProfile) {
|
|
2627
2664
|
(0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2628
|
-
F:
|
|
2665
|
+
F: __dxlog_file12,
|
|
2629
2666
|
L: 197,
|
|
2630
2667
|
S: this,
|
|
2631
2668
|
A: [
|
|
@@ -2643,7 +2680,7 @@ var InvitationsHandler = class {
|
|
|
2643
2680
|
invitationType: import_services6.Invitation.Type.DELEGATED,
|
|
2644
2681
|
triedPeers: triedPeersIds.size
|
|
2645
2682
|
}, {
|
|
2646
|
-
F:
|
|
2683
|
+
F: __dxlog_file12,
|
|
2647
2684
|
L: 205,
|
|
2648
2685
|
S: this,
|
|
2649
2686
|
C: (f, a) => f(...a)
|
|
@@ -2670,7 +2707,7 @@ var InvitationsHandler = class {
|
|
|
2670
2707
|
admitted,
|
|
2671
2708
|
currentState: guardedState.current.state
|
|
2672
2709
|
}, {
|
|
2673
|
-
F:
|
|
2710
|
+
F: __dxlog_file12,
|
|
2674
2711
|
L: 233,
|
|
2675
2712
|
S: this,
|
|
2676
2713
|
C: (f, a) => f(...a)
|
|
@@ -2688,7 +2725,7 @@ var InvitationsHandler = class {
|
|
|
2688
2725
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
2689
2726
|
id: traceId
|
|
2690
2727
|
}), {
|
|
2691
|
-
F:
|
|
2728
|
+
F: __dxlog_file12,
|
|
2692
2729
|
L: 245,
|
|
2693
2730
|
S: this,
|
|
2694
2731
|
C: (f, a) => f(...a)
|
|
@@ -2700,7 +2737,7 @@ var InvitationsHandler = class {
|
|
|
2700
2737
|
(0, import_log6.log)("connected", {
|
|
2701
2738
|
...protocol.toJSON()
|
|
2702
2739
|
}, {
|
|
2703
|
-
F:
|
|
2740
|
+
F: __dxlog_file12,
|
|
2704
2741
|
L: 256,
|
|
2705
2742
|
S: this,
|
|
2706
2743
|
C: (f, a) => f(...a)
|
|
@@ -2709,7 +2746,7 @@ var InvitationsHandler = class {
|
|
|
2709
2746
|
(0, import_log6.log)("introduce", {
|
|
2710
2747
|
...protocol.toJSON()
|
|
2711
2748
|
}, {
|
|
2712
|
-
F:
|
|
2749
|
+
F: __dxlog_file12,
|
|
2713
2750
|
L: 260,
|
|
2714
2751
|
S: this,
|
|
2715
2752
|
C: (f, a) => f(...a)
|
|
@@ -2722,7 +2759,7 @@ var InvitationsHandler = class {
|
|
|
2722
2759
|
...protocol.toJSON(),
|
|
2723
2760
|
response: introductionResponse
|
|
2724
2761
|
}, {
|
|
2725
|
-
F:
|
|
2762
|
+
F: __dxlog_file12,
|
|
2726
2763
|
L: 265,
|
|
2727
2764
|
S: this,
|
|
2728
2765
|
C: (f, a) => f(...a)
|
|
@@ -2743,7 +2780,7 @@ var InvitationsHandler = class {
|
|
|
2743
2780
|
(0, import_log6.log)("request admission", {
|
|
2744
2781
|
...protocol.toJSON()
|
|
2745
2782
|
}, {
|
|
2746
|
-
F:
|
|
2783
|
+
F: __dxlog_file12,
|
|
2747
2784
|
L: 291,
|
|
2748
2785
|
S: this,
|
|
2749
2786
|
C: (f, a) => f(...a)
|
|
@@ -2755,7 +2792,7 @@ var InvitationsHandler = class {
|
|
|
2755
2792
|
(0, import_log6.log)("admitted by host", {
|
|
2756
2793
|
...protocol.toJSON()
|
|
2757
2794
|
}, {
|
|
2758
|
-
F:
|
|
2795
|
+
F: __dxlog_file12,
|
|
2759
2796
|
L: 302,
|
|
2760
2797
|
S: this,
|
|
2761
2798
|
C: (f, a) => f(...a)
|
|
@@ -2768,7 +2805,7 @@ var InvitationsHandler = class {
|
|
|
2768
2805
|
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
|
|
2769
2806
|
id: traceId
|
|
2770
2807
|
}), {
|
|
2771
|
-
F:
|
|
2808
|
+
F: __dxlog_file12,
|
|
2772
2809
|
L: 308,
|
|
2773
2810
|
S: this,
|
|
2774
2811
|
C: (f, a) => f(...a)
|
|
@@ -2778,7 +2815,7 @@ var InvitationsHandler = class {
|
|
|
2778
2815
|
(0, import_log6.log)("timeout", {
|
|
2779
2816
|
...protocol.toJSON()
|
|
2780
2817
|
}, {
|
|
2781
|
-
F:
|
|
2818
|
+
F: __dxlog_file12,
|
|
2782
2819
|
L: 311,
|
|
2783
2820
|
S: this,
|
|
2784
2821
|
C: (f, a) => f(...a)
|
|
@@ -2786,7 +2823,7 @@ var InvitationsHandler = class {
|
|
|
2786
2823
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2787
2824
|
} else {
|
|
2788
2825
|
(0, import_log6.log)("auth failed", err, {
|
|
2789
|
-
F:
|
|
2826
|
+
F: __dxlog_file12,
|
|
2790
2827
|
L: 314,
|
|
2791
2828
|
S: this,
|
|
2792
2829
|
C: (f, a) => f(...a)
|
|
@@ -2798,7 +2835,7 @@ var InvitationsHandler = class {
|
|
|
2798
2835
|
id: traceId,
|
|
2799
2836
|
error: err
|
|
2800
2837
|
}), {
|
|
2801
|
-
F:
|
|
2838
|
+
F: __dxlog_file12,
|
|
2802
2839
|
L: 318,
|
|
2803
2840
|
S: this,
|
|
2804
2841
|
C: (f, a) => f(...a)
|
|
@@ -2814,7 +2851,7 @@ var InvitationsHandler = class {
|
|
|
2814
2851
|
(0, import_log6.log)("timeout", {
|
|
2815
2852
|
...protocol.toJSON()
|
|
2816
2853
|
}, {
|
|
2817
|
-
F:
|
|
2854
|
+
F: __dxlog_file12,
|
|
2818
2855
|
L: 327,
|
|
2819
2856
|
S: this,
|
|
2820
2857
|
C: (f, a) => f(...a)
|
|
@@ -2822,7 +2859,7 @@ var InvitationsHandler = class {
|
|
|
2822
2859
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2823
2860
|
} else {
|
|
2824
2861
|
(0, import_log6.log)("auth failed", err, {
|
|
2825
|
-
F:
|
|
2862
|
+
F: __dxlog_file12,
|
|
2826
2863
|
L: 330,
|
|
2827
2864
|
S: this,
|
|
2828
2865
|
C: (f, a) => f(...a)
|
|
@@ -2840,7 +2877,7 @@ var InvitationsHandler = class {
|
|
|
2840
2877
|
await ctx.dispose();
|
|
2841
2878
|
} else {
|
|
2842
2879
|
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2843
|
-
F:
|
|
2880
|
+
F: __dxlog_file12,
|
|
2844
2881
|
L: 345,
|
|
2845
2882
|
S: this,
|
|
2846
2883
|
A: [
|
|
@@ -2940,7 +2977,7 @@ var InvitationsHandler = class {
|
|
|
2940
2977
|
newState: stateToString(newState),
|
|
2941
2978
|
oldState: stateToString(invitation.state)
|
|
2942
2979
|
}, {
|
|
2943
|
-
F:
|
|
2980
|
+
F: __dxlog_file12,
|
|
2944
2981
|
L: 439,
|
|
2945
2982
|
S: this,
|
|
2946
2983
|
C: (f, a) => f(...a)
|
|
@@ -2951,7 +2988,7 @@ var InvitationsHandler = class {
|
|
|
2951
2988
|
newState: stateToString(newState),
|
|
2952
2989
|
oldState: stateToString(invitation.state)
|
|
2953
2990
|
}, {
|
|
2954
|
-
F:
|
|
2991
|
+
F: __dxlog_file12,
|
|
2955
2992
|
L: 445,
|
|
2956
2993
|
S: this,
|
|
2957
2994
|
C: (f, a) => f(...a)
|
|
@@ -2970,7 +3007,7 @@ var InvitationsHandler = class {
|
|
|
2970
3007
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2971
3008
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2972
3009
|
(0, import_log6.log)("guest waiting for authentication code...", void 0, {
|
|
2973
|
-
F:
|
|
3010
|
+
F: __dxlog_file12,
|
|
2974
3011
|
L: 470,
|
|
2975
3012
|
S: this,
|
|
2976
3013
|
C: (f, a) => f(...a)
|
|
@@ -2978,7 +3015,7 @@ var InvitationsHandler = class {
|
|
|
2978
3015
|
setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2979
3016
|
const authCode = await authenticated.wait(options);
|
|
2980
3017
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
2981
|
-
F:
|
|
3018
|
+
F: __dxlog_file12,
|
|
2982
3019
|
L: 474,
|
|
2983
3020
|
S: this,
|
|
2984
3021
|
C: (f, a) => f(...a)
|
|
@@ -2997,7 +3034,7 @@ var InvitationsHandler = class {
|
|
|
2997
3034
|
(0, import_log6.log)("retrying invalid code", {
|
|
2998
3035
|
attempt
|
|
2999
3036
|
}, {
|
|
3000
|
-
F:
|
|
3037
|
+
F: __dxlog_file12,
|
|
3001
3038
|
L: 485,
|
|
3002
3039
|
S: this,
|
|
3003
3040
|
C: (f, a) => f(...a)
|
|
@@ -3015,7 +3052,7 @@ var InvitationsHandler = class {
|
|
|
3015
3052
|
throw new Error("challenge missing in the introduction");
|
|
3016
3053
|
}
|
|
3017
3054
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3018
|
-
F:
|
|
3055
|
+
F: __dxlog_file12,
|
|
3019
3056
|
L: 504,
|
|
3020
3057
|
S: this,
|
|
3021
3058
|
C: (f, a) => f(...a)
|
|
@@ -3130,7 +3167,7 @@ var InvitationsServiceImpl = class {
|
|
|
3130
3167
|
});
|
|
3131
3168
|
}
|
|
3132
3169
|
};
|
|
3133
|
-
var
|
|
3170
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3134
3171
|
var SpaceInvitationProtocol = class {
|
|
3135
3172
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3136
3173
|
this._spaceManager = _spaceManager;
|
|
@@ -3164,79 +3201,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3164
3201
|
};
|
|
3165
3202
|
}
|
|
3166
3203
|
async admit(invitation, request, guestProfile) {
|
|
3167
|
-
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3168
|
-
F:
|
|
3169
|
-
L:
|
|
3170
|
-
S: this,
|
|
3171
|
-
A: [
|
|
3172
|
-
"this._spaceKey",
|
|
3173
|
-
""
|
|
3174
|
-
]
|
|
3175
|
-
});
|
|
3176
|
-
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3177
|
-
(0, import_invariant10.invariant)(space, void 0, {
|
|
3178
|
-
F: __dxlog_file12,
|
|
3179
|
-
L: 78,
|
|
3180
|
-
S: this,
|
|
3181
|
-
A: [
|
|
3182
|
-
"space",
|
|
3183
|
-
""
|
|
3184
|
-
]
|
|
3185
|
-
});
|
|
3186
|
-
(0, import_invariant10.invariant)(request.space, void 0, {
|
|
3187
|
-
F: __dxlog_file12,
|
|
3188
|
-
L: 80,
|
|
3204
|
+
(0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
|
|
3205
|
+
F: __dxlog_file13,
|
|
3206
|
+
L: 74,
|
|
3189
3207
|
S: this,
|
|
3190
3208
|
A: [
|
|
3191
|
-
"request.space",
|
|
3209
|
+
"this._spaceKey && request.space",
|
|
3192
3210
|
""
|
|
3193
3211
|
]
|
|
3194
3212
|
});
|
|
3195
|
-
const { identityKey, deviceKey } = request.space;
|
|
3196
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
|
|
3197
|
-
throw new import_protocols8.AlreadyJoinedError();
|
|
3198
|
-
}
|
|
3199
3213
|
(0, import_log10.log)("writing guest credentials", {
|
|
3200
3214
|
host: this._signingContext.deviceKey,
|
|
3201
|
-
guest: deviceKey
|
|
3215
|
+
guest: request.space.deviceKey
|
|
3202
3216
|
}, {
|
|
3203
|
-
F:
|
|
3204
|
-
L:
|
|
3217
|
+
F: __dxlog_file13,
|
|
3218
|
+
L: 75,
|
|
3205
3219
|
S: this,
|
|
3206
3220
|
C: (f, a) => f(...a)
|
|
3207
3221
|
});
|
|
3208
|
-
const
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
"credentials[0].credential",
|
|
3215
|
-
""
|
|
3216
|
-
]
|
|
3217
|
-
});
|
|
3218
|
-
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3219
|
-
(0, import_invariant10.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3220
|
-
F: __dxlog_file12,
|
|
3221
|
-
L: 103,
|
|
3222
|
-
S: this,
|
|
3223
|
-
A: [
|
|
3224
|
-
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3225
|
-
""
|
|
3226
|
-
]
|
|
3222
|
+
const spaceMemberCredential = await this._spaceManager.admitMember({
|
|
3223
|
+
spaceKey: this._spaceKey,
|
|
3224
|
+
identityKey: request.space.identityKey,
|
|
3225
|
+
role: invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN,
|
|
3226
|
+
profile: guestProfile,
|
|
3227
|
+
delegationCredentialId: invitation.delegationCredentialId
|
|
3227
3228
|
});
|
|
3228
|
-
|
|
3229
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3229
3230
|
return {
|
|
3230
3231
|
space: {
|
|
3231
3232
|
credential: spaceMemberCredential,
|
|
3232
|
-
controlTimeframe: space
|
|
3233
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3233
3234
|
}
|
|
3234
3235
|
};
|
|
3235
3236
|
}
|
|
3236
3237
|
async delegate(invitation) {
|
|
3237
3238
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3238
|
-
F:
|
|
3239
|
-
L:
|
|
3239
|
+
F: __dxlog_file13,
|
|
3240
|
+
L: 95,
|
|
3240
3241
|
S: this,
|
|
3241
3242
|
A: [
|
|
3242
3243
|
"this._spaceKey",
|
|
@@ -3245,8 +3246,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3245
3246
|
});
|
|
3246
3247
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3247
3248
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3248
|
-
F:
|
|
3249
|
-
L:
|
|
3249
|
+
F: __dxlog_file13,
|
|
3250
|
+
L: 97,
|
|
3250
3251
|
S: this,
|
|
3251
3252
|
A: [
|
|
3252
3253
|
"space",
|
|
@@ -3255,8 +3256,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3255
3256
|
});
|
|
3256
3257
|
if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3257
3258
|
(0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
3258
|
-
F:
|
|
3259
|
-
L:
|
|
3259
|
+
F: __dxlog_file13,
|
|
3260
|
+
L: 99,
|
|
3260
3261
|
S: this,
|
|
3261
3262
|
A: [
|
|
3262
3263
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3268,8 +3269,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3268
3269
|
host: this._signingContext.deviceKey,
|
|
3269
3270
|
id: invitation.invitationId
|
|
3270
3271
|
}, {
|
|
3271
|
-
F:
|
|
3272
|
-
L:
|
|
3272
|
+
F: __dxlog_file13,
|
|
3273
|
+
L: 102,
|
|
3273
3274
|
S: this,
|
|
3274
3275
|
C: (f, a) => f(...a)
|
|
3275
3276
|
});
|
|
@@ -3283,8 +3284,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3283
3284
|
guestKey: invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3284
3285
|
});
|
|
3285
3286
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3286
|
-
F:
|
|
3287
|
-
L:
|
|
3287
|
+
F: __dxlog_file13,
|
|
3288
|
+
L: 122,
|
|
3288
3289
|
S: this,
|
|
3289
3290
|
A: [
|
|
3290
3291
|
"credential.credential",
|
|
@@ -3298,8 +3299,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3298
3299
|
}
|
|
3299
3300
|
async cancelDelegation(invitation) {
|
|
3300
3301
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3301
|
-
F:
|
|
3302
|
-
L:
|
|
3302
|
+
F: __dxlog_file13,
|
|
3303
|
+
L: 128,
|
|
3303
3304
|
S: this,
|
|
3304
3305
|
A: [
|
|
3305
3306
|
"this._spaceKey",
|
|
@@ -3307,8 +3308,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3307
3308
|
]
|
|
3308
3309
|
});
|
|
3309
3310
|
(0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3310
|
-
F:
|
|
3311
|
-
L:
|
|
3311
|
+
F: __dxlog_file13,
|
|
3312
|
+
L: 129,
|
|
3312
3313
|
S: this,
|
|
3313
3314
|
A: [
|
|
3314
3315
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3317,8 +3318,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3317
3318
|
});
|
|
3318
3319
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3319
3320
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3320
|
-
F:
|
|
3321
|
-
L:
|
|
3321
|
+
F: __dxlog_file13,
|
|
3322
|
+
L: 131,
|
|
3322
3323
|
S: this,
|
|
3323
3324
|
A: [
|
|
3324
3325
|
"space",
|
|
@@ -3329,15 +3330,15 @@ var SpaceInvitationProtocol = class {
|
|
|
3329
3330
|
host: this._signingContext.deviceKey,
|
|
3330
3331
|
id: invitation.invitationId
|
|
3331
3332
|
}, {
|
|
3332
|
-
F:
|
|
3333
|
-
L:
|
|
3333
|
+
F: __dxlog_file13,
|
|
3334
|
+
L: 133,
|
|
3334
3335
|
S: this,
|
|
3335
3336
|
C: (f, a) => f(...a)
|
|
3336
3337
|
});
|
|
3337
3338
|
const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3338
3339
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3339
|
-
F:
|
|
3340
|
-
L:
|
|
3340
|
+
F: __dxlog_file13,
|
|
3341
|
+
L: 140,
|
|
3341
3342
|
S: this,
|
|
3342
3343
|
A: [
|
|
3343
3344
|
"credential.credential",
|
|
@@ -3375,8 +3376,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3375
3376
|
}
|
|
3376
3377
|
async accept(response) {
|
|
3377
3378
|
(0, import_invariant10.invariant)(response.space, void 0, {
|
|
3378
|
-
F:
|
|
3379
|
-
L:
|
|
3379
|
+
F: __dxlog_file13,
|
|
3380
|
+
L: 175,
|
|
3380
3381
|
S: this,
|
|
3381
3382
|
A: [
|
|
3382
3383
|
"response.space",
|
|
@@ -3386,8 +3387,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3386
3387
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3387
3388
|
const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
|
|
3388
3389
|
(0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3389
|
-
F:
|
|
3390
|
-
L:
|
|
3390
|
+
F: __dxlog_file13,
|
|
3391
|
+
L: 178,
|
|
3391
3392
|
S: this,
|
|
3392
3393
|
A: [
|
|
3393
3394
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3395,8 +3396,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3395
3396
|
]
|
|
3396
3397
|
});
|
|
3397
3398
|
(0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3398
|
-
F:
|
|
3399
|
-
L:
|
|
3399
|
+
F: __dxlog_file13,
|
|
3400
|
+
L: 179,
|
|
3400
3401
|
S: this,
|
|
3401
3402
|
A: [
|
|
3402
3403
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3418,7 +3419,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3418
3419
|
};
|
|
3419
3420
|
}
|
|
3420
3421
|
};
|
|
3421
|
-
var
|
|
3422
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3422
3423
|
var InvitationsManager = class {
|
|
3423
3424
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3424
3425
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3461,7 +3462,7 @@ var InvitationsManager = class {
|
|
|
3461
3462
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3462
3463
|
} catch (err) {
|
|
3463
3464
|
import_log11.log.catch(err, void 0, {
|
|
3464
|
-
F:
|
|
3465
|
+
F: __dxlog_file14,
|
|
3465
3466
|
L: 82,
|
|
3466
3467
|
S: this,
|
|
3467
3468
|
C: (f, a) => f(...a)
|
|
@@ -3484,7 +3485,7 @@ var InvitationsManager = class {
|
|
|
3484
3485
|
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
3485
3486
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3486
3487
|
(0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3487
|
-
F:
|
|
3488
|
+
F: __dxlog_file14,
|
|
3488
3489
|
L: 103,
|
|
3489
3490
|
S: this,
|
|
3490
3491
|
A: [
|
|
@@ -3503,7 +3504,7 @@ var InvitationsManager = class {
|
|
|
3503
3504
|
};
|
|
3504
3505
|
} catch (err) {
|
|
3505
3506
|
import_log11.log.catch(err, void 0, {
|
|
3506
|
-
F:
|
|
3507
|
+
F: __dxlog_file14,
|
|
3507
3508
|
L: 110,
|
|
3508
3509
|
S: this,
|
|
3509
3510
|
C: (f, a) => f(...a)
|
|
@@ -3535,13 +3536,13 @@ var InvitationsManager = class {
|
|
|
3535
3536
|
}
|
|
3536
3537
|
async authenticate({ invitationId, authCode }) {
|
|
3537
3538
|
(0, import_log11.log)("authenticating...", void 0, {
|
|
3538
|
-
F:
|
|
3539
|
+
F: __dxlog_file14,
|
|
3539
3540
|
L: 140,
|
|
3540
3541
|
S: this,
|
|
3541
3542
|
C: (f, a) => f(...a)
|
|
3542
3543
|
});
|
|
3543
3544
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3544
|
-
F:
|
|
3545
|
+
F: __dxlog_file14,
|
|
3545
3546
|
L: 141,
|
|
3546
3547
|
S: this,
|
|
3547
3548
|
A: [
|
|
@@ -3554,7 +3555,7 @@ var InvitationsManager = class {
|
|
|
3554
3555
|
import_log11.log.warn("invalid invitation", {
|
|
3555
3556
|
invitationId
|
|
3556
3557
|
}, {
|
|
3557
|
-
F:
|
|
3558
|
+
F: __dxlog_file14,
|
|
3558
3559
|
L: 144,
|
|
3559
3560
|
S: this,
|
|
3560
3561
|
C: (f, a) => f(...a)
|
|
@@ -3567,13 +3568,13 @@ var InvitationsManager = class {
|
|
|
3567
3568
|
(0, import_log11.log)("cancelInvitation...", {
|
|
3568
3569
|
invitationId
|
|
3569
3570
|
}, {
|
|
3570
|
-
F:
|
|
3571
|
+
F: __dxlog_file14,
|
|
3571
3572
|
L: 151,
|
|
3572
3573
|
S: this,
|
|
3573
3574
|
C: (f, a) => f(...a)
|
|
3574
3575
|
});
|
|
3575
3576
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3576
|
-
F:
|
|
3577
|
+
F: __dxlog_file14,
|
|
3577
3578
|
L: 152,
|
|
3578
3579
|
S: this,
|
|
3579
3580
|
A: [
|
|
@@ -3647,12 +3648,15 @@ var InvitationsManager = class {
|
|
|
3647
3648
|
stream.error(err);
|
|
3648
3649
|
void ctx.dispose();
|
|
3649
3650
|
}
|
|
3651
|
+
}, {
|
|
3652
|
+
F: __dxlog_file14,
|
|
3653
|
+
L: 234
|
|
3650
3654
|
});
|
|
3651
3655
|
ctx.onDispose(() => {
|
|
3652
3656
|
(0, import_log11.log)("complete", {
|
|
3653
3657
|
...handler.toJSON()
|
|
3654
3658
|
}, {
|
|
3655
|
-
F:
|
|
3659
|
+
F: __dxlog_file14,
|
|
3656
3660
|
L: 241,
|
|
3657
3661
|
S: this,
|
|
3658
3662
|
C: (f, a) => f(...a)
|
|
@@ -3685,7 +3689,7 @@ var InvitationsManager = class {
|
|
|
3685
3689
|
(0, import_log11.log)("timeout", {
|
|
3686
3690
|
...handler.toJSON()
|
|
3687
3691
|
}, {
|
|
3688
|
-
F:
|
|
3692
|
+
F: __dxlog_file14,
|
|
3689
3693
|
L: 261,
|
|
3690
3694
|
S: this,
|
|
3691
3695
|
C: (f, a) => f(...a)
|
|
@@ -3696,7 +3700,7 @@ var InvitationsManager = class {
|
|
|
3696
3700
|
});
|
|
3697
3701
|
} else {
|
|
3698
3702
|
import_log11.log.warn("auth failed", err, {
|
|
3699
|
-
F:
|
|
3703
|
+
F: __dxlog_file14,
|
|
3700
3704
|
L: 264,
|
|
3701
3705
|
S: this,
|
|
3702
3706
|
C: (f, a) => f(...a)
|
|
@@ -3708,12 +3712,15 @@ var InvitationsManager = class {
|
|
|
3708
3712
|
}
|
|
3709
3713
|
void ctx.dispose();
|
|
3710
3714
|
}
|
|
3715
|
+
}, {
|
|
3716
|
+
F: __dxlog_file14,
|
|
3717
|
+
L: 258
|
|
3711
3718
|
});
|
|
3712
3719
|
ctx.onDispose(() => {
|
|
3713
3720
|
(0, import_log11.log)("complete", {
|
|
3714
3721
|
...handler.toJSON()
|
|
3715
3722
|
}, {
|
|
3716
|
-
F:
|
|
3723
|
+
F: __dxlog_file14,
|
|
3717
3724
|
L: 271,
|
|
3718
3725
|
S: this,
|
|
3719
3726
|
C: (f, a) => f(...a)
|
|
@@ -3758,7 +3765,7 @@ var InvitationsManager = class {
|
|
|
3758
3765
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3759
3766
|
} catch (err) {
|
|
3760
3767
|
import_log11.log.catch(err, void 0, {
|
|
3761
|
-
F:
|
|
3768
|
+
F: __dxlog_file14,
|
|
3762
3769
|
L: 307,
|
|
3763
3770
|
S: this,
|
|
3764
3771
|
C: (f, a) => f(...a)
|
|
@@ -3811,7 +3818,7 @@ var AutomergeSpaceState = class extends import_context11.Resource {
|
|
|
3811
3818
|
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3812
3819
|
}
|
|
3813
3820
|
};
|
|
3814
|
-
var
|
|
3821
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
3815
3822
|
var runEpochMigration = async (ctx, context) => {
|
|
3816
3823
|
switch (context.migration) {
|
|
3817
3824
|
case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
@@ -3835,7 +3842,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3835
3842
|
}
|
|
3836
3843
|
case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3837
3844
|
import_log13.log.info("Fragmenting", void 0, {
|
|
3838
|
-
F:
|
|
3845
|
+
F: __dxlog_file15,
|
|
3839
3846
|
L: 63,
|
|
3840
3847
|
S: void 0,
|
|
3841
3848
|
C: (f, a) => f(...a)
|
|
@@ -3847,7 +3854,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3847
3854
|
const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
|
|
3848
3855
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3849
3856
|
(0, import_invariant13.invariant)(properties, "Properties not found", {
|
|
3850
|
-
F:
|
|
3857
|
+
F: __dxlog_file15,
|
|
3851
3858
|
L: 73,
|
|
3852
3859
|
S: void 0,
|
|
3853
3860
|
A: [
|
|
@@ -3863,7 +3870,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3863
3870
|
};
|
|
3864
3871
|
const newRoot = context.repo.create(newSpaceDoc);
|
|
3865
3872
|
(0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3866
|
-
F:
|
|
3873
|
+
F: __dxlog_file15,
|
|
3867
3874
|
L: 78,
|
|
3868
3875
|
S: void 0,
|
|
3869
3876
|
A: [
|
|
@@ -3894,7 +3901,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3894
3901
|
const rootHandle = context.repo.find(currentRootUrl);
|
|
3895
3902
|
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3896
3903
|
(0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
|
|
3897
|
-
F:
|
|
3904
|
+
F: __dxlog_file15,
|
|
3898
3905
|
L: 100,
|
|
3899
3906
|
S: void 0,
|
|
3900
3907
|
A: [
|
|
@@ -3907,7 +3914,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3907
3914
|
const handle = context.repo.find(url);
|
|
3908
3915
|
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(handle.whenReady(), 1e4));
|
|
3909
3916
|
(0, import_invariant13.invariant)(handle.docSync(), "Doc not found", {
|
|
3910
|
-
F:
|
|
3917
|
+
F: __dxlog_file15,
|
|
3911
3918
|
L: 107,
|
|
3912
3919
|
S: void 0,
|
|
3913
3920
|
A: [
|
|
@@ -3929,7 +3936,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3929
3936
|
}
|
|
3930
3937
|
case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3931
3938
|
(0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
|
|
3932
|
-
F:
|
|
3939
|
+
F: __dxlog_file15,
|
|
3933
3940
|
L: 124,
|
|
3934
3941
|
S: void 0,
|
|
3935
3942
|
A: [
|
|
@@ -3945,14 +3952,17 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3945
3952
|
}
|
|
3946
3953
|
return {};
|
|
3947
3954
|
};
|
|
3948
|
-
var
|
|
3955
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3949
3956
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3950
3957
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3951
3958
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3952
3959
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3953
3960
|
var NotarizationPlugin = class {
|
|
3954
3961
|
constructor() {
|
|
3955
|
-
this._ctx = new import_context13.Context(
|
|
3962
|
+
this._ctx = new import_context13.Context(void 0, {
|
|
3963
|
+
F: __dxlog_file16,
|
|
3964
|
+
L: 62
|
|
3965
|
+
});
|
|
3956
3966
|
this._extensionOpened = new import_async16.Event();
|
|
3957
3967
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3958
3968
|
this._processedCredentials = new import_util9.ComplexSet(import_keys11.PublicKey.hash);
|
|
@@ -3973,13 +3983,13 @@ var NotarizationPlugin = class {
|
|
|
3973
3983
|
(0, import_log14.log)("notarize", {
|
|
3974
3984
|
credentials
|
|
3975
3985
|
}, {
|
|
3976
|
-
F:
|
|
3986
|
+
F: __dxlog_file16,
|
|
3977
3987
|
L: 90,
|
|
3978
3988
|
S: this,
|
|
3979
3989
|
C: (f, a) => f(...a)
|
|
3980
3990
|
});
|
|
3981
3991
|
(0, import_invariant14.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
3982
|
-
F:
|
|
3992
|
+
F: __dxlog_file16,
|
|
3983
3993
|
L: 91,
|
|
3984
3994
|
S: this,
|
|
3985
3995
|
A: [
|
|
@@ -3993,7 +4003,7 @@ var NotarizationPlugin = class {
|
|
|
3993
4003
|
import_log14.log.warn("Notarization error", {
|
|
3994
4004
|
err
|
|
3995
4005
|
}, {
|
|
3996
|
-
F:
|
|
4006
|
+
F: __dxlog_file16,
|
|
3997
4007
|
L: 99,
|
|
3998
4008
|
S: this,
|
|
3999
4009
|
C: (f, a) => f(...a)
|
|
@@ -4009,7 +4019,7 @@ var NotarizationPlugin = class {
|
|
|
4009
4019
|
timeout,
|
|
4010
4020
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
4011
4021
|
}, {
|
|
4012
|
-
F:
|
|
4022
|
+
F: __dxlog_file16,
|
|
4013
4023
|
L: 111,
|
|
4014
4024
|
S: this,
|
|
4015
4025
|
C: (f, a) => f(...a)
|
|
@@ -4032,7 +4042,7 @@ var NotarizationPlugin = class {
|
|
|
4032
4042
|
import_log14.log.info("Exhausted all peers to notarize with", {
|
|
4033
4043
|
retryIn: retryTimeout
|
|
4034
4044
|
}, {
|
|
4035
|
-
F:
|
|
4045
|
+
F: __dxlog_file16,
|
|
4036
4046
|
L: 136,
|
|
4037
4047
|
S: this,
|
|
4038
4048
|
C: (f, a) => f(...a)
|
|
@@ -4046,7 +4056,7 @@ var NotarizationPlugin = class {
|
|
|
4046
4056
|
peer: peer.localPeerId,
|
|
4047
4057
|
credentialId: credentials.map((credential) => credential.id)
|
|
4048
4058
|
}, {
|
|
4049
|
-
F:
|
|
4059
|
+
F: __dxlog_file16,
|
|
4050
4060
|
L: 143,
|
|
4051
4061
|
S: this,
|
|
4052
4062
|
C: (f, a) => f(...a)
|
|
@@ -4055,7 +4065,7 @@ var NotarizationPlugin = class {
|
|
|
4055
4065
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4056
4066
|
});
|
|
4057
4067
|
(0, import_log14.log)("success", void 0, {
|
|
4058
|
-
F:
|
|
4068
|
+
F: __dxlog_file16,
|
|
4059
4069
|
L: 147,
|
|
4060
4070
|
S: this,
|
|
4061
4071
|
C: (f, a) => f(...a)
|
|
@@ -4064,7 +4074,7 @@ var NotarizationPlugin = class {
|
|
|
4064
4074
|
} catch (err) {
|
|
4065
4075
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4066
4076
|
import_log14.log.info("error notarizing (recoverable)", err, {
|
|
4067
|
-
F:
|
|
4077
|
+
F: __dxlog_file16,
|
|
4068
4078
|
L: 151,
|
|
4069
4079
|
S: this,
|
|
4070
4080
|
C: (f, a) => f(...a)
|
|
@@ -4082,7 +4092,7 @@ var NotarizationPlugin = class {
|
|
|
4082
4092
|
errors.wait()
|
|
4083
4093
|
]);
|
|
4084
4094
|
(0, import_log14.log)("done", void 0, {
|
|
4085
|
-
F:
|
|
4095
|
+
F: __dxlog_file16,
|
|
4086
4096
|
L: 162,
|
|
4087
4097
|
S: this,
|
|
4088
4098
|
C: (f, a) => f(...a)
|
|
@@ -4104,7 +4114,7 @@ var NotarizationPlugin = class {
|
|
|
4104
4114
|
}
|
|
4105
4115
|
setWriter(writer) {
|
|
4106
4116
|
(0, import_invariant14.invariant)(!this._writer, "Writer already set.", {
|
|
4107
|
-
F:
|
|
4117
|
+
F: __dxlog_file16,
|
|
4108
4118
|
L: 181,
|
|
4109
4119
|
S: this,
|
|
4110
4120
|
A: [
|
|
@@ -4129,7 +4139,7 @@ var NotarizationPlugin = class {
|
|
|
4129
4139
|
}
|
|
4130
4140
|
for (const credential of request.credentials ?? []) {
|
|
4131
4141
|
(0, import_invariant14.invariant)(credential.id, "Credential must have an id", {
|
|
4132
|
-
F:
|
|
4142
|
+
F: __dxlog_file16,
|
|
4133
4143
|
L: 200,
|
|
4134
4144
|
S: this,
|
|
4135
4145
|
A: [
|
|
@@ -4149,7 +4159,7 @@ var NotarizationPlugin = class {
|
|
|
4149
4159
|
(0, import_log14.log)("extension opened", {
|
|
4150
4160
|
peer: extension.localPeerId
|
|
4151
4161
|
}, {
|
|
4152
|
-
F:
|
|
4162
|
+
F: __dxlog_file16,
|
|
4153
4163
|
L: 211,
|
|
4154
4164
|
S: this,
|
|
4155
4165
|
C: (f, a) => f(...a)
|
|
@@ -4161,7 +4171,7 @@ var NotarizationPlugin = class {
|
|
|
4161
4171
|
(0, import_log14.log)("extension closed", {
|
|
4162
4172
|
peer: extension.localPeerId
|
|
4163
4173
|
}, {
|
|
4164
|
-
F:
|
|
4174
|
+
F: __dxlog_file16,
|
|
4165
4175
|
L: 216,
|
|
4166
4176
|
S: this,
|
|
4167
4177
|
C: (f, a) => f(...a)
|
|
@@ -4276,10 +4286,13 @@ function _using_ctx() {
|
|
|
4276
4286
|
}
|
|
4277
4287
|
};
|
|
4278
4288
|
}
|
|
4279
|
-
var
|
|
4289
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4280
4290
|
var DataSpace = class {
|
|
4281
4291
|
constructor(params) {
|
|
4282
|
-
this._ctx = new import_context10.Context(
|
|
4292
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4293
|
+
F: __dxlog_file17,
|
|
4294
|
+
L: 84
|
|
4295
|
+
});
|
|
4283
4296
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4284
4297
|
this._cache = void 0;
|
|
4285
4298
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
@@ -4309,7 +4322,7 @@ var DataSpace = class {
|
|
|
4309
4322
|
(0, import_log12.log)("new state", {
|
|
4310
4323
|
state: import_services12.SpaceState[this._state]
|
|
4311
4324
|
}, {
|
|
4312
|
-
F:
|
|
4325
|
+
F: __dxlog_file17,
|
|
4313
4326
|
L: 146,
|
|
4314
4327
|
S: this,
|
|
4315
4328
|
C: (f, a) => f(...a)
|
|
@@ -4364,12 +4377,15 @@ var DataSpace = class {
|
|
|
4364
4377
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4365
4378
|
await this._automergeSpaceState.open();
|
|
4366
4379
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4367
|
-
await this._inner.open(new import_context10.Context(
|
|
4380
|
+
await this._inner.open(new import_context10.Context(void 0, {
|
|
4381
|
+
F: __dxlog_file17,
|
|
4382
|
+
L: 215
|
|
4383
|
+
}));
|
|
4368
4384
|
this._state = import_services12.SpaceState.CONTROL_ONLY;
|
|
4369
4385
|
(0, import_log12.log)("new state", {
|
|
4370
4386
|
state: import_services12.SpaceState[this._state]
|
|
4371
4387
|
}, {
|
|
4372
|
-
F:
|
|
4388
|
+
F: __dxlog_file17,
|
|
4373
4389
|
L: 217,
|
|
4374
4390
|
S: this,
|
|
4375
4391
|
C: (f, a) => f(...a)
|
|
@@ -4387,13 +4403,16 @@ var DataSpace = class {
|
|
|
4387
4403
|
(0, import_log12.log)("new state", {
|
|
4388
4404
|
state: import_services12.SpaceState[this._state]
|
|
4389
4405
|
}, {
|
|
4390
|
-
F:
|
|
4406
|
+
F: __dxlog_file17,
|
|
4391
4407
|
L: 231,
|
|
4392
4408
|
S: this,
|
|
4393
4409
|
C: (f, a) => f(...a)
|
|
4394
4410
|
});
|
|
4395
4411
|
await this._ctx.dispose();
|
|
4396
|
-
this._ctx = new import_context10.Context(
|
|
4412
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4413
|
+
F: __dxlog_file17,
|
|
4414
|
+
L: 233
|
|
4415
|
+
});
|
|
4397
4416
|
await this.authVerifier.close();
|
|
4398
4417
|
await this._inner.close();
|
|
4399
4418
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
@@ -4420,7 +4439,7 @@ var DataSpace = class {
|
|
|
4420
4439
|
} catch (err) {
|
|
4421
4440
|
if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
|
|
4422
4441
|
(0, import_log12.log)("data pipeline initialization cancelled", err, {
|
|
4423
|
-
F:
|
|
4442
|
+
F: __dxlog_file17,
|
|
4424
4443
|
L: 265,
|
|
4425
4444
|
S: this,
|
|
4426
4445
|
C: (f, a) => f(...a)
|
|
@@ -4428,7 +4447,7 @@ var DataSpace = class {
|
|
|
4428
4447
|
return;
|
|
4429
4448
|
}
|
|
4430
4449
|
import_log12.log.error("Error initializing data pipeline", err, {
|
|
4431
|
-
F:
|
|
4450
|
+
F: __dxlog_file17,
|
|
4432
4451
|
L: 269,
|
|
4433
4452
|
S: this,
|
|
4434
4453
|
C: (f, a) => f(...a)
|
|
@@ -4437,7 +4456,7 @@ var DataSpace = class {
|
|
|
4437
4456
|
(0, import_log12.log)("new state", {
|
|
4438
4457
|
state: import_services12.SpaceState[this._state]
|
|
4439
4458
|
}, {
|
|
4440
|
-
F:
|
|
4459
|
+
F: __dxlog_file17,
|
|
4441
4460
|
L: 271,
|
|
4442
4461
|
S: this,
|
|
4443
4462
|
C: (f, a) => f(...a)
|
|
@@ -4457,7 +4476,7 @@ var DataSpace = class {
|
|
|
4457
4476
|
(0, import_log12.log)("new state", {
|
|
4458
4477
|
state: import_services12.SpaceState[this._state]
|
|
4459
4478
|
}, {
|
|
4460
|
-
F:
|
|
4479
|
+
F: __dxlog_file17,
|
|
4461
4480
|
L: 287,
|
|
4462
4481
|
S: this,
|
|
4463
4482
|
C: (f, a) => f(...a)
|
|
@@ -4474,7 +4493,7 @@ var DataSpace = class {
|
|
|
4474
4493
|
(0, import_log12.log)("new state", {
|
|
4475
4494
|
state: import_services12.SpaceState[this._state]
|
|
4476
4495
|
}, {
|
|
4477
|
-
F:
|
|
4496
|
+
F: __dxlog_file17,
|
|
4478
4497
|
L: 306,
|
|
4479
4498
|
S: this,
|
|
4480
4499
|
C: (f, a) => f(...a)
|
|
@@ -4490,7 +4509,7 @@ var DataSpace = class {
|
|
|
4490
4509
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4491
4510
|
await this._createWritableFeeds();
|
|
4492
4511
|
(0, import_log12.log)("writable feeds created", void 0, {
|
|
4493
|
-
F:
|
|
4512
|
+
F: __dxlog_file17,
|
|
4494
4513
|
L: 322,
|
|
4495
4514
|
S: this,
|
|
4496
4515
|
C: (f, a) => f(...a)
|
|
@@ -4553,7 +4572,7 @@ var DataSpace = class {
|
|
|
4553
4572
|
space: this.key,
|
|
4554
4573
|
rootUrl
|
|
4555
4574
|
}, {
|
|
4556
|
-
F:
|
|
4575
|
+
F: __dxlog_file17,
|
|
4557
4576
|
L: 388,
|
|
4558
4577
|
S: this,
|
|
4559
4578
|
C: (f, a) => f(...a)
|
|
@@ -4607,7 +4626,7 @@ var DataSpace = class {
|
|
|
4607
4626
|
rootUrl,
|
|
4608
4627
|
err
|
|
4609
4628
|
}, {
|
|
4610
|
-
F:
|
|
4629
|
+
F: __dxlog_file17,
|
|
4611
4630
|
L: 431,
|
|
4612
4631
|
S: this,
|
|
4613
4632
|
C: (f, a) => f(...a)
|
|
@@ -4693,7 +4712,7 @@ var DataSpace = class {
|
|
|
4693
4712
|
(0, import_log12.log)("new state", {
|
|
4694
4713
|
state: import_services12.SpaceState[this._state]
|
|
4695
4714
|
}, {
|
|
4696
|
-
F:
|
|
4715
|
+
F: __dxlog_file17,
|
|
4697
4716
|
L: 512,
|
|
4698
4717
|
S: this,
|
|
4699
4718
|
C: (f, a) => f(...a)
|
|
@@ -4823,7 +4842,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4823
4842
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4824
4843
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4825
4844
|
}
|
|
4826
|
-
var
|
|
4845
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4827
4846
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4828
4847
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4829
4848
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4837,7 +4856,10 @@ var DataSpaceManager = class {
|
|
|
4837
4856
|
this._echoHost = _echoHost;
|
|
4838
4857
|
this._invitationsManager = _invitationsManager;
|
|
4839
4858
|
this._params = _params;
|
|
4840
|
-
this._ctx = new import_context14.Context(
|
|
4859
|
+
this._ctx = new import_context14.Context(void 0, {
|
|
4860
|
+
F: __dxlog_file18,
|
|
4861
|
+
L: 104
|
|
4862
|
+
});
|
|
4841
4863
|
this.updated = new import_async17.Event();
|
|
4842
4864
|
this._spaces = new import_util10.ComplexMap(import_keys12.PublicKey.hash);
|
|
4843
4865
|
this._isOpen = false;
|
|
@@ -4871,24 +4893,24 @@ var DataSpaceManager = class {
|
|
|
4871
4893
|
}
|
|
4872
4894
|
async open() {
|
|
4873
4895
|
(0, import_log15.log)("open", void 0, {
|
|
4874
|
-
F:
|
|
4875
|
-
L:
|
|
4896
|
+
F: __dxlog_file18,
|
|
4897
|
+
L: 156,
|
|
4876
4898
|
S: this,
|
|
4877
4899
|
C: (f, a) => f(...a)
|
|
4878
4900
|
});
|
|
4879
4901
|
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
|
|
4880
4902
|
id: this._instanceId
|
|
4881
4903
|
}), {
|
|
4882
|
-
F:
|
|
4883
|
-
L:
|
|
4904
|
+
F: __dxlog_file18,
|
|
4905
|
+
L: 157,
|
|
4884
4906
|
S: this,
|
|
4885
4907
|
C: (f, a) => f(...a)
|
|
4886
4908
|
});
|
|
4887
4909
|
(0, import_log15.log)("metadata loaded", {
|
|
4888
4910
|
spaces: this._metadataStore.spaces.length
|
|
4889
4911
|
}, {
|
|
4890
|
-
F:
|
|
4891
|
-
L:
|
|
4912
|
+
F: __dxlog_file18,
|
|
4913
|
+
L: 158,
|
|
4892
4914
|
S: this,
|
|
4893
4915
|
C: (f, a) => f(...a)
|
|
4894
4916
|
});
|
|
@@ -4897,8 +4919,8 @@ var DataSpaceManager = class {
|
|
|
4897
4919
|
(0, import_log15.log)("load space", {
|
|
4898
4920
|
spaceMetadata
|
|
4899
4921
|
}, {
|
|
4900
|
-
F:
|
|
4901
|
-
L:
|
|
4922
|
+
F: __dxlog_file18,
|
|
4923
|
+
L: 162,
|
|
4902
4924
|
S: this,
|
|
4903
4925
|
C: (f, a) => f(...a)
|
|
4904
4926
|
});
|
|
@@ -4908,8 +4930,8 @@ var DataSpaceManager = class {
|
|
|
4908
4930
|
spaceMetadata,
|
|
4909
4931
|
err
|
|
4910
4932
|
}, {
|
|
4911
|
-
F:
|
|
4912
|
-
L:
|
|
4933
|
+
F: __dxlog_file18,
|
|
4934
|
+
L: 165,
|
|
4913
4935
|
S: this,
|
|
4914
4936
|
C: (f, a) => f(...a)
|
|
4915
4937
|
});
|
|
@@ -4920,16 +4942,16 @@ var DataSpaceManager = class {
|
|
|
4920
4942
|
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
|
|
4921
4943
|
id: this._instanceId
|
|
4922
4944
|
}), {
|
|
4923
|
-
F:
|
|
4924
|
-
L:
|
|
4945
|
+
F: __dxlog_file18,
|
|
4946
|
+
L: 172,
|
|
4925
4947
|
S: this,
|
|
4926
4948
|
C: (f, a) => f(...a)
|
|
4927
4949
|
});
|
|
4928
4950
|
}
|
|
4929
4951
|
async close() {
|
|
4930
4952
|
(0, import_log15.log)("close", void 0, {
|
|
4931
|
-
F:
|
|
4932
|
-
L:
|
|
4953
|
+
F: __dxlog_file18,
|
|
4954
|
+
L: 177,
|
|
4933
4955
|
S: this,
|
|
4934
4956
|
C: (f, a) => f(...a)
|
|
4935
4957
|
});
|
|
@@ -4945,8 +4967,8 @@ var DataSpaceManager = class {
|
|
|
4945
4967
|
*/
|
|
4946
4968
|
async createSpace() {
|
|
4947
4969
|
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
4948
|
-
F:
|
|
4949
|
-
L:
|
|
4970
|
+
F: __dxlog_file18,
|
|
4971
|
+
L: 191,
|
|
4950
4972
|
S: this,
|
|
4951
4973
|
A: [
|
|
4952
4974
|
"this._isOpen",
|
|
@@ -4966,8 +4988,8 @@ var DataSpaceManager = class {
|
|
|
4966
4988
|
(0, import_log15.log)("creating space...", {
|
|
4967
4989
|
spaceKey
|
|
4968
4990
|
}, {
|
|
4969
|
-
F:
|
|
4970
|
-
L:
|
|
4991
|
+
F: __dxlog_file18,
|
|
4992
|
+
L: 203,
|
|
4971
4993
|
S: this,
|
|
4972
4994
|
C: (f, a) => f(...a)
|
|
4973
4995
|
});
|
|
@@ -4978,8 +5000,8 @@ var DataSpaceManager = class {
|
|
|
4978
5000
|
await this._metadataStore.addSpace(metadata);
|
|
4979
5001
|
const memberCredential = credentials[1];
|
|
4980
5002
|
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4981
|
-
F:
|
|
4982
|
-
L:
|
|
5003
|
+
F: __dxlog_file18,
|
|
5004
|
+
L: 213,
|
|
4983
5005
|
S: this,
|
|
4984
5006
|
A: [
|
|
4985
5007
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -5010,8 +5032,8 @@ var DataSpaceManager = class {
|
|
|
5010
5032
|
version: space.databaseRoot.getVersion(),
|
|
5011
5033
|
spaceId: space.id
|
|
5012
5034
|
}, {
|
|
5013
|
-
F:
|
|
5014
|
-
L:
|
|
5035
|
+
F: __dxlog_file18,
|
|
5036
|
+
L: 238,
|
|
5015
5037
|
S: this,
|
|
5016
5038
|
C: (f, a) => f(...a)
|
|
5017
5039
|
});
|
|
@@ -5045,8 +5067,8 @@ var DataSpaceManager = class {
|
|
|
5045
5067
|
async _getSpaceRootDocument(space) {
|
|
5046
5068
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5047
5069
|
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5048
|
-
F:
|
|
5049
|
-
L:
|
|
5070
|
+
F: __dxlog_file18,
|
|
5071
|
+
L: 271,
|
|
5050
5072
|
S: this,
|
|
5051
5073
|
A: [
|
|
5052
5074
|
"automergeIndex",
|
|
@@ -5062,14 +5084,14 @@ var DataSpaceManager = class {
|
|
|
5062
5084
|
(0, import_log15.log)("accept space", {
|
|
5063
5085
|
opts
|
|
5064
5086
|
}, {
|
|
5065
|
-
F:
|
|
5066
|
-
L:
|
|
5087
|
+
F: __dxlog_file18,
|
|
5088
|
+
L: 280,
|
|
5067
5089
|
S: this,
|
|
5068
5090
|
C: (f, a) => f(...a)
|
|
5069
5091
|
});
|
|
5070
5092
|
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
5071
|
-
F:
|
|
5072
|
-
L:
|
|
5093
|
+
F: __dxlog_file18,
|
|
5094
|
+
L: 281,
|
|
5073
5095
|
S: this,
|
|
5074
5096
|
A: [
|
|
5075
5097
|
"this._isOpen",
|
|
@@ -5077,8 +5099,8 @@ var DataSpaceManager = class {
|
|
|
5077
5099
|
]
|
|
5078
5100
|
});
|
|
5079
5101
|
(0, import_invariant15.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5080
|
-
F:
|
|
5081
|
-
L:
|
|
5102
|
+
F: __dxlog_file18,
|
|
5103
|
+
L: 282,
|
|
5082
5104
|
S: this,
|
|
5083
5105
|
A: [
|
|
5084
5106
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -5098,6 +5120,43 @@ var DataSpaceManager = class {
|
|
|
5098
5120
|
this.updated.emit();
|
|
5099
5121
|
return space;
|
|
5100
5122
|
}
|
|
5123
|
+
async admitMember(options) {
|
|
5124
|
+
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5125
|
+
(0, import_invariant15.invariant)(space, void 0, {
|
|
5126
|
+
F: __dxlog_file18,
|
|
5127
|
+
L: 302,
|
|
5128
|
+
S: this,
|
|
5129
|
+
A: [
|
|
5130
|
+
"space",
|
|
5131
|
+
""
|
|
5132
|
+
]
|
|
5133
|
+
});
|
|
5134
|
+
if (space.spaceState.getMemberRole(options.identityKey) !== import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5135
|
+
throw new import_protocols11.AlreadyJoinedError();
|
|
5136
|
+
}
|
|
5137
|
+
const credentials = await (0, import_credentials15.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5138
|
+
(0, import_invariant15.invariant)(credentials[0].credential, void 0, {
|
|
5139
|
+
F: __dxlog_file18,
|
|
5140
|
+
L: 321,
|
|
5141
|
+
S: this,
|
|
5142
|
+
A: [
|
|
5143
|
+
"credentials[0].credential",
|
|
5144
|
+
""
|
|
5145
|
+
]
|
|
5146
|
+
});
|
|
5147
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5148
|
+
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5149
|
+
F: __dxlog_file18,
|
|
5150
|
+
L: 323,
|
|
5151
|
+
S: this,
|
|
5152
|
+
A: [
|
|
5153
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5154
|
+
""
|
|
5155
|
+
]
|
|
5156
|
+
});
|
|
5157
|
+
await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5158
|
+
return spaceMemberCredential;
|
|
5159
|
+
}
|
|
5101
5160
|
/**
|
|
5102
5161
|
* Wait until the space data pipeline is fully initialized.
|
|
5103
5162
|
* Used by invitation handler.
|
|
@@ -5109,12 +5168,24 @@ var DataSpaceManager = class {
|
|
|
5109
5168
|
return !!space && space.state === import_services14.SpaceState.READY;
|
|
5110
5169
|
}));
|
|
5111
5170
|
}
|
|
5171
|
+
async requestSpaceAdmissionCredential(spaceKey) {
|
|
5172
|
+
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
5173
|
+
spaceKey,
|
|
5174
|
+
identityKey: this._signingContext.identityKey,
|
|
5175
|
+
timeout: 15e3,
|
|
5176
|
+
swarmIdentity: {
|
|
5177
|
+
peerKey: this._signingContext.deviceKey,
|
|
5178
|
+
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5179
|
+
credentialAuthenticator: async () => true
|
|
5180
|
+
}
|
|
5181
|
+
});
|
|
5182
|
+
}
|
|
5112
5183
|
async _constructSpace(metadata) {
|
|
5113
5184
|
(0, import_log15.log)("construct space", {
|
|
5114
5185
|
metadata
|
|
5115
5186
|
}, {
|
|
5116
|
-
F:
|
|
5117
|
-
L:
|
|
5187
|
+
F: __dxlog_file18,
|
|
5188
|
+
L: 358,
|
|
5118
5189
|
S: this,
|
|
5119
5190
|
C: (f, a) => f(...a)
|
|
5120
5191
|
});
|
|
@@ -5142,6 +5213,7 @@ var DataSpaceManager = class {
|
|
|
5142
5213
|
credentialAuthenticator: (0, import_util10.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
5143
5214
|
},
|
|
5144
5215
|
onAuthorizedConnection: (session) => {
|
|
5216
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline5.CredentialServerExtension(space));
|
|
5145
5217
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5146
5218
|
remotePeerId: session.remotePeerId
|
|
5147
5219
|
}));
|
|
@@ -5151,8 +5223,8 @@ var DataSpaceManager = class {
|
|
|
5151
5223
|
},
|
|
5152
5224
|
onAuthFailure: () => {
|
|
5153
5225
|
import_log15.log.warn("auth failure", void 0, {
|
|
5154
|
-
F:
|
|
5155
|
-
L:
|
|
5226
|
+
F: __dxlog_file18,
|
|
5227
|
+
L: 396,
|
|
5156
5228
|
S: this,
|
|
5157
5229
|
C: (f, a) => f(...a)
|
|
5158
5230
|
});
|
|
@@ -5184,8 +5256,8 @@ var DataSpaceManager = class {
|
|
|
5184
5256
|
(0, import_log15.log)("before space ready", {
|
|
5185
5257
|
space: space.key
|
|
5186
5258
|
}, {
|
|
5187
|
-
F:
|
|
5188
|
-
L:
|
|
5259
|
+
F: __dxlog_file18,
|
|
5260
|
+
L: 423,
|
|
5189
5261
|
S: this,
|
|
5190
5262
|
C: (f, a) => f(...a)
|
|
5191
5263
|
});
|
|
@@ -5195,8 +5267,8 @@ var DataSpaceManager = class {
|
|
|
5195
5267
|
space: space.key,
|
|
5196
5268
|
open: this._isOpen
|
|
5197
5269
|
}, {
|
|
5198
|
-
F:
|
|
5199
|
-
L:
|
|
5270
|
+
F: __dxlog_file18,
|
|
5271
|
+
L: 426,
|
|
5200
5272
|
S: this,
|
|
5201
5273
|
C: (f, a) => f(...a)
|
|
5202
5274
|
});
|
|
@@ -5214,8 +5286,8 @@ var DataSpaceManager = class {
|
|
|
5214
5286
|
(0, import_log15.log)("before space close", {
|
|
5215
5287
|
space: space.key
|
|
5216
5288
|
}, {
|
|
5217
|
-
F:
|
|
5218
|
-
L:
|
|
5289
|
+
F: __dxlog_file18,
|
|
5290
|
+
L: 434,
|
|
5219
5291
|
S: this,
|
|
5220
5292
|
C: (f, a) => f(...a)
|
|
5221
5293
|
});
|
|
@@ -5255,8 +5327,8 @@ var DataSpaceManager = class {
|
|
|
5255
5327
|
peersOnline: presence.getPeersOnline().length,
|
|
5256
5328
|
closedSessions
|
|
5257
5329
|
}, {
|
|
5258
|
-
F:
|
|
5259
|
-
L:
|
|
5330
|
+
F: __dxlog_file18,
|
|
5331
|
+
L: 470,
|
|
5260
5332
|
S: this,
|
|
5261
5333
|
C: (f, a) => f(...a)
|
|
5262
5334
|
});
|
|
@@ -5270,8 +5342,8 @@ var DataSpaceManager = class {
|
|
|
5270
5342
|
(0, import_log15.log)("closing a session with a removed peer", {
|
|
5271
5343
|
peerId: peerState.peerId
|
|
5272
5344
|
}, {
|
|
5273
|
-
F:
|
|
5274
|
-
L:
|
|
5345
|
+
F: __dxlog_file18,
|
|
5346
|
+
L: 484,
|
|
5275
5347
|
S: this,
|
|
5276
5348
|
C: (f, a) => f(...a)
|
|
5277
5349
|
});
|
|
@@ -5330,7 +5402,7 @@ _ts_decorate5([
|
|
|
5330
5402
|
DataSpaceManager = _ts_decorate5([
|
|
5331
5403
|
(0, import_async17.trackLeaks)("open", "close")
|
|
5332
5404
|
], DataSpaceManager);
|
|
5333
|
-
var
|
|
5405
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5334
5406
|
var SpacesServiceImpl = class {
|
|
5335
5407
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5336
5408
|
this._identityManager = _identityManager;
|
|
@@ -5374,8 +5446,8 @@ var SpacesServiceImpl = class {
|
|
|
5374
5446
|
}
|
|
5375
5447
|
const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5376
5448
|
(0, import_invariant16.invariant)(credentials[0].credential, void 0, {
|
|
5377
|
-
F:
|
|
5378
|
-
L:
|
|
5449
|
+
F: __dxlog_file19,
|
|
5450
|
+
L: 102,
|
|
5379
5451
|
S: this,
|
|
5380
5452
|
A: [
|
|
5381
5453
|
"credentials[0].credential",
|
|
@@ -5384,15 +5456,15 @@ var SpacesServiceImpl = class {
|
|
|
5384
5456
|
});
|
|
5385
5457
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5386
5458
|
(0, import_invariant16.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5387
|
-
F:
|
|
5388
|
-
L:
|
|
5459
|
+
F: __dxlog_file19,
|
|
5460
|
+
L: 104,
|
|
5389
5461
|
S: this,
|
|
5390
5462
|
A: [
|
|
5391
5463
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5392
5464
|
""
|
|
5393
5465
|
]
|
|
5394
5466
|
});
|
|
5395
|
-
await (0,
|
|
5467
|
+
await (0, import_feed_store5.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5396
5468
|
}
|
|
5397
5469
|
querySpaces() {
|
|
5398
5470
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
@@ -5402,8 +5474,8 @@ var SpacesServiceImpl = class {
|
|
|
5402
5474
|
(0, import_log16.log)("update", {
|
|
5403
5475
|
spaces
|
|
5404
5476
|
}, {
|
|
5405
|
-
F:
|
|
5406
|
-
L:
|
|
5477
|
+
F: __dxlog_file19,
|
|
5478
|
+
L: 115,
|
|
5407
5479
|
S: this,
|
|
5408
5480
|
C: (f, a) => f(...a)
|
|
5409
5481
|
});
|
|
@@ -5494,8 +5566,8 @@ var SpacesServiceImpl = class {
|
|
|
5494
5566
|
});
|
|
5495
5567
|
} else {
|
|
5496
5568
|
(0, import_invariant16.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5497
|
-
F:
|
|
5498
|
-
L:
|
|
5569
|
+
F: __dxlog_file19,
|
|
5570
|
+
L: 213,
|
|
5499
5571
|
S: this,
|
|
5500
5572
|
A: [
|
|
5501
5573
|
"!credential.id",
|
|
@@ -5503,8 +5575,8 @@ var SpacesServiceImpl = class {
|
|
|
5503
5575
|
]
|
|
5504
5576
|
});
|
|
5505
5577
|
(0, import_invariant16.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
5506
|
-
F:
|
|
5507
|
-
L:
|
|
5578
|
+
F: __dxlog_file19,
|
|
5579
|
+
L: 214,
|
|
5508
5580
|
S: this,
|
|
5509
5581
|
A: [
|
|
5510
5582
|
"this._identityManager.identity",
|
|
@@ -5513,8 +5585,8 @@ var SpacesServiceImpl = class {
|
|
|
5513
5585
|
});
|
|
5514
5586
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5515
5587
|
(0, import_invariant16.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5516
|
-
F:
|
|
5517
|
-
L:
|
|
5588
|
+
F: __dxlog_file19,
|
|
5589
|
+
L: 216,
|
|
5518
5590
|
S: this,
|
|
5519
5591
|
A: [
|
|
5520
5592
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5544,6 +5616,59 @@ var SpacesServiceImpl = class {
|
|
|
5544
5616
|
epochCredential: credential ?? void 0
|
|
5545
5617
|
};
|
|
5546
5618
|
}
|
|
5619
|
+
async admitContact(request) {
|
|
5620
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5621
|
+
await dataSpaceManager.admitMember({
|
|
5622
|
+
spaceKey: request.spaceKey,
|
|
5623
|
+
identityKey: request.contact.identityKey,
|
|
5624
|
+
role: request.role
|
|
5625
|
+
});
|
|
5626
|
+
}
|
|
5627
|
+
async joinBySpaceKey({ spaceKey }) {
|
|
5628
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5629
|
+
const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
|
|
5630
|
+
return this._joinByAdmission({
|
|
5631
|
+
credential
|
|
5632
|
+
});
|
|
5633
|
+
}
|
|
5634
|
+
async _joinByAdmission({ credential }) {
|
|
5635
|
+
const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
|
|
5636
|
+
(0, import_invariant16.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
5637
|
+
F: __dxlog_file19,
|
|
5638
|
+
L: 250,
|
|
5639
|
+
S: this,
|
|
5640
|
+
A: [
|
|
5641
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5642
|
+
"'Invalid credential'"
|
|
5643
|
+
]
|
|
5644
|
+
});
|
|
5645
|
+
const myIdentity = this._identityManager.identity;
|
|
5646
|
+
(0, import_invariant16.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
5647
|
+
F: __dxlog_file19,
|
|
5648
|
+
L: 252,
|
|
5649
|
+
S: this,
|
|
5650
|
+
A: [
|
|
5651
|
+
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
5652
|
+
""
|
|
5653
|
+
]
|
|
5654
|
+
});
|
|
5655
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5656
|
+
let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
|
|
5657
|
+
if (!dataSpace) {
|
|
5658
|
+
dataSpace = await dataSpaceManager.acceptSpace({
|
|
5659
|
+
spaceKey: assertion.spaceKey,
|
|
5660
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
5661
|
+
});
|
|
5662
|
+
await myIdentity.controlPipeline.writer.write({
|
|
5663
|
+
credential: {
|
|
5664
|
+
credential
|
|
5665
|
+
}
|
|
5666
|
+
});
|
|
5667
|
+
}
|
|
5668
|
+
return {
|
|
5669
|
+
space: this._serializeSpace(dataSpace)
|
|
5670
|
+
};
|
|
5671
|
+
}
|
|
5547
5672
|
_serializeSpace(space) {
|
|
5548
5673
|
return {
|
|
5549
5674
|
id: space.id,
|
|
@@ -5613,7 +5738,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5613
5738
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5614
5739
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5615
5740
|
}
|
|
5616
|
-
var
|
|
5741
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5617
5742
|
var ServiceContext = class extends import_context15.Resource {
|
|
5618
5743
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5619
5744
|
super();
|
|
@@ -5625,21 +5750,21 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5625
5750
|
this.initialized = new import_async19.Trigger();
|
|
5626
5751
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5627
5752
|
this._instanceId = import_keys13.PublicKey.random().toHex();
|
|
5628
|
-
this.metadataStore = new
|
|
5629
|
-
this.snapshotStore = new
|
|
5753
|
+
this.metadataStore = new import_echo_pipeline6.MetadataStore(storage.createDirectory("metadata"));
|
|
5754
|
+
this.snapshotStore = new import_echo_pipeline6.SnapshotStore(storage.createDirectory("snapshots"));
|
|
5630
5755
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
5631
5756
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
5632
|
-
this.feedStore = new
|
|
5633
|
-
factory: new
|
|
5757
|
+
this.feedStore = new import_feed_store6.FeedStore({
|
|
5758
|
+
factory: new import_feed_store6.FeedFactory({
|
|
5634
5759
|
root: storage.createDirectory("feeds"),
|
|
5635
5760
|
signer: this.keyring,
|
|
5636
5761
|
hypercore: {
|
|
5637
|
-
valueEncoding:
|
|
5762
|
+
valueEncoding: import_echo_pipeline6.valueEncoding,
|
|
5638
5763
|
stats: true
|
|
5639
5764
|
}
|
|
5640
5765
|
})
|
|
5641
5766
|
});
|
|
5642
|
-
this.spaceManager = new
|
|
5767
|
+
this.spaceManager = new import_echo_pipeline6.SpaceManager({
|
|
5643
5768
|
feedStore: this.feedStore,
|
|
5644
5769
|
networkManager: this.networkManager,
|
|
5645
5770
|
blobStore: this.blobStore,
|
|
@@ -5657,7 +5782,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5657
5782
|
async _open(ctx) {
|
|
5658
5783
|
await this._checkStorageVersion();
|
|
5659
5784
|
(0, import_log17.log)("opening...", void 0, {
|
|
5660
|
-
F:
|
|
5785
|
+
F: __dxlog_file20,
|
|
5661
5786
|
L: 149,
|
|
5662
5787
|
S: this,
|
|
5663
5788
|
C: (f, a) => f(...a)
|
|
@@ -5665,7 +5790,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5665
5790
|
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
|
|
5666
5791
|
id: this._instanceId
|
|
5667
5792
|
}), {
|
|
5668
|
-
F:
|
|
5793
|
+
F: __dxlog_file20,
|
|
5669
5794
|
L: 150,
|
|
5670
5795
|
S: this,
|
|
5671
5796
|
C: (f, a) => f(...a)
|
|
@@ -5683,7 +5808,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5683
5808
|
(0, import_log17.log)("loaded persistent invitations", {
|
|
5684
5809
|
count: loadedInvitations.invitations?.length
|
|
5685
5810
|
}, {
|
|
5686
|
-
F:
|
|
5811
|
+
F: __dxlog_file20,
|
|
5687
5812
|
L: 163,
|
|
5688
5813
|
S: this,
|
|
5689
5814
|
C: (f, a) => f(...a)
|
|
@@ -5691,13 +5816,13 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5691
5816
|
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
|
|
5692
5817
|
id: this._instanceId
|
|
5693
5818
|
}), {
|
|
5694
|
-
F:
|
|
5819
|
+
F: __dxlog_file20,
|
|
5695
5820
|
L: 165,
|
|
5696
5821
|
S: this,
|
|
5697
5822
|
C: (f, a) => f(...a)
|
|
5698
5823
|
});
|
|
5699
5824
|
(0, import_log17.log)("opened", void 0, {
|
|
5700
|
-
F:
|
|
5825
|
+
F: __dxlog_file20,
|
|
5701
5826
|
L: 166,
|
|
5702
5827
|
S: this,
|
|
5703
5828
|
C: (f, a) => f(...a)
|
|
@@ -5705,7 +5830,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5705
5830
|
}
|
|
5706
5831
|
async _close(ctx) {
|
|
5707
5832
|
(0, import_log17.log)("closing...", void 0, {
|
|
5708
|
-
F:
|
|
5833
|
+
F: __dxlog_file20,
|
|
5709
5834
|
L: 170,
|
|
5710
5835
|
S: this,
|
|
5711
5836
|
C: (f, a) => f(...a)
|
|
@@ -5722,7 +5847,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5722
5847
|
await this.networkManager.close();
|
|
5723
5848
|
await this.signalManager.close();
|
|
5724
5849
|
(0, import_log17.log)("closed", void 0, {
|
|
5725
|
-
F:
|
|
5850
|
+
F: __dxlog_file20,
|
|
5726
5851
|
L: 182,
|
|
5727
5852
|
S: this,
|
|
5728
5853
|
C: (f, a) => f(...a)
|
|
@@ -5730,13 +5855,16 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5730
5855
|
}
|
|
5731
5856
|
async createIdentity(params = {}) {
|
|
5732
5857
|
const identity = await this.identityManager.createIdentity(params);
|
|
5733
|
-
await this._initialize(new import_context15.Context(
|
|
5858
|
+
await this._initialize(new import_context15.Context(void 0, {
|
|
5859
|
+
F: __dxlog_file20,
|
|
5860
|
+
L: 187
|
|
5861
|
+
}));
|
|
5734
5862
|
return identity;
|
|
5735
5863
|
}
|
|
5736
5864
|
getInvitationHandler(invitation) {
|
|
5737
5865
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5738
5866
|
(0, import_invariant17.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5739
|
-
F:
|
|
5867
|
+
F: __dxlog_file20,
|
|
5740
5868
|
L: 193,
|
|
5741
5869
|
S: this,
|
|
5742
5870
|
A: [
|
|
@@ -5756,7 +5884,10 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5756
5884
|
}
|
|
5757
5885
|
async _acceptIdentity(params) {
|
|
5758
5886
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5759
|
-
await this._initialize(new import_context15.Context(
|
|
5887
|
+
await this._initialize(new import_context15.Context(void 0, {
|
|
5888
|
+
F: __dxlog_file20,
|
|
5889
|
+
L: 209
|
|
5890
|
+
}));
|
|
5760
5891
|
return identity;
|
|
5761
5892
|
}
|
|
5762
5893
|
async _checkStorageVersion() {
|
|
@@ -5768,7 +5899,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5768
5899
|
// Called when identity is created.
|
|
5769
5900
|
async _initialize(ctx) {
|
|
5770
5901
|
(0, import_log17.log)("initializing spaces...", void 0, {
|
|
5771
|
-
F:
|
|
5902
|
+
F: __dxlog_file20,
|
|
5772
5903
|
L: 224,
|
|
5773
5904
|
S: this,
|
|
5774
5905
|
C: (f, a) => f(...a)
|
|
@@ -5791,7 +5922,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5791
5922
|
await this.dataSpaceManager.open();
|
|
5792
5923
|
this._handlerFactories.set(import_services16.Invitation.Kind.SPACE, (invitation) => {
|
|
5793
5924
|
(0, import_invariant17.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5794
|
-
F:
|
|
5925
|
+
F: __dxlog_file20,
|
|
5795
5926
|
L: 249,
|
|
5796
5927
|
S: this,
|
|
5797
5928
|
A: [
|
|
@@ -5815,7 +5946,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5815
5946
|
(0, import_log17.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5816
5947
|
details: assertion
|
|
5817
5948
|
}, {
|
|
5818
|
-
F:
|
|
5949
|
+
F: __dxlog_file20,
|
|
5819
5950
|
L: 265,
|
|
5820
5951
|
S: this,
|
|
5821
5952
|
C: (f, a) => f(...a)
|
|
@@ -5826,7 +5957,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5826
5957
|
(0, import_log17.log)("space already exists, ignoring space admission", {
|
|
5827
5958
|
details: assertion
|
|
5828
5959
|
}, {
|
|
5829
|
-
F:
|
|
5960
|
+
F: __dxlog_file20,
|
|
5830
5961
|
L: 269,
|
|
5831
5962
|
S: this,
|
|
5832
5963
|
C: (f, a) => f(...a)
|
|
@@ -5837,7 +5968,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5837
5968
|
(0, import_log17.log)("accepting space recorded in halo", {
|
|
5838
5969
|
details: assertion
|
|
5839
5970
|
}, {
|
|
5840
|
-
F:
|
|
5971
|
+
F: __dxlog_file20,
|
|
5841
5972
|
L: 274,
|
|
5842
5973
|
S: this,
|
|
5843
5974
|
C: (f, a) => f(...a)
|
|
@@ -5848,7 +5979,7 @@ var ServiceContext = class extends import_context15.Resource {
|
|
|
5848
5979
|
});
|
|
5849
5980
|
} catch (err) {
|
|
5850
5981
|
import_log17.log.catch(err, void 0, {
|
|
5851
|
-
F:
|
|
5982
|
+
F: __dxlog_file20,
|
|
5852
5983
|
L: 280,
|
|
5853
5984
|
S: this,
|
|
5854
5985
|
C: (f, a) => f(...a)
|
|
@@ -5901,7 +6032,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5901
6032
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5902
6033
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5903
6034
|
}
|
|
5904
|
-
var
|
|
6035
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
5905
6036
|
var Lock = class {
|
|
5906
6037
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
5907
6038
|
this._lockPath = lockPath;
|
|
@@ -5913,7 +6044,7 @@ var Lock = class {
|
|
|
5913
6044
|
}
|
|
5914
6045
|
async acquire() {
|
|
5915
6046
|
(0, import_log18.log)("acquiring lock...", void 0, {
|
|
5916
|
-
F:
|
|
6047
|
+
F: __dxlog_file21,
|
|
5917
6048
|
L: 32,
|
|
5918
6049
|
S: this,
|
|
5919
6050
|
C: (f, a) => f(...a)
|
|
@@ -5921,7 +6052,7 @@ var Lock = class {
|
|
|
5921
6052
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
5922
6053
|
await this._onAcquire?.();
|
|
5923
6054
|
(0, import_log18.log)("acquired lock", void 0, {
|
|
5924
|
-
F:
|
|
6055
|
+
F: __dxlog_file21,
|
|
5925
6056
|
L: 37,
|
|
5926
6057
|
S: this,
|
|
5927
6058
|
C: (f, a) => f(...a)
|
|
@@ -5930,7 +6061,7 @@ var Lock = class {
|
|
|
5930
6061
|
async release() {
|
|
5931
6062
|
await this._onRelease?.();
|
|
5932
6063
|
(0, import_invariant18.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
5933
|
-
F:
|
|
6064
|
+
F: __dxlog_file21,
|
|
5934
6065
|
L: 42,
|
|
5935
6066
|
S: this,
|
|
5936
6067
|
A: [
|
|
@@ -6002,7 +6133,138 @@ var createLevel = async (config) => {
|
|
|
6002
6133
|
await level.open();
|
|
6003
6134
|
return level;
|
|
6004
6135
|
};
|
|
6005
|
-
var
|
|
6136
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6137
|
+
var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
|
|
6138
|
+
var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
|
|
6139
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
6140
|
+
const archive = {
|
|
6141
|
+
storage: [],
|
|
6142
|
+
meta: {
|
|
6143
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6144
|
+
}
|
|
6145
|
+
};
|
|
6146
|
+
{
|
|
6147
|
+
const directory = await storage.createDirectory();
|
|
6148
|
+
const files = await directory.list();
|
|
6149
|
+
import_log19.log.info("begin exporting files", {
|
|
6150
|
+
count: files.length
|
|
6151
|
+
}, {
|
|
6152
|
+
F: __dxlog_file22,
|
|
6153
|
+
L: 30,
|
|
6154
|
+
S: void 0,
|
|
6155
|
+
C: (f, a) => f(...a)
|
|
6156
|
+
});
|
|
6157
|
+
for (const filename of files) {
|
|
6158
|
+
const file = await directory.getOrCreateFile(filename);
|
|
6159
|
+
const { size } = await file.stat();
|
|
6160
|
+
const data = await file.read(0, size);
|
|
6161
|
+
archive.storage.push({
|
|
6162
|
+
type: import_protocols15.ProfileArchiveEntryType.FILE,
|
|
6163
|
+
key: filename,
|
|
6164
|
+
value: data
|
|
6165
|
+
});
|
|
6166
|
+
}
|
|
6167
|
+
import_log19.log.info("done exporting files", {
|
|
6168
|
+
count: files.length
|
|
6169
|
+
}, {
|
|
6170
|
+
F: __dxlog_file22,
|
|
6171
|
+
L: 41,
|
|
6172
|
+
S: void 0,
|
|
6173
|
+
C: (f, a) => f(...a)
|
|
6174
|
+
});
|
|
6175
|
+
}
|
|
6176
|
+
{
|
|
6177
|
+
import_log19.log.info("begin exporting kv pairs", void 0, {
|
|
6178
|
+
F: __dxlog_file22,
|
|
6179
|
+
L: 45,
|
|
6180
|
+
S: void 0,
|
|
6181
|
+
C: (f, a) => f(...a)
|
|
6182
|
+
});
|
|
6183
|
+
const iter = await level.iterator({
|
|
6184
|
+
keyEncoding: "binary",
|
|
6185
|
+
valueEncoding: "binary"
|
|
6186
|
+
});
|
|
6187
|
+
let count = 0;
|
|
6188
|
+
for await (const [key, value] of iter) {
|
|
6189
|
+
archive.storage.push({
|
|
6190
|
+
type: import_protocols15.ProfileArchiveEntryType.KEY_VALUE,
|
|
6191
|
+
key,
|
|
6192
|
+
value
|
|
6193
|
+
});
|
|
6194
|
+
count++;
|
|
6195
|
+
}
|
|
6196
|
+
import_log19.log.info("done exporting kv pairs", {
|
|
6197
|
+
count
|
|
6198
|
+
}, {
|
|
6199
|
+
F: __dxlog_file22,
|
|
6200
|
+
L: 56,
|
|
6201
|
+
S: void 0,
|
|
6202
|
+
C: (f, a) => f(...a)
|
|
6203
|
+
});
|
|
6204
|
+
}
|
|
6205
|
+
return archive;
|
|
6206
|
+
};
|
|
6207
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
6208
|
+
const batch = level.batch();
|
|
6209
|
+
for (const entry2 of archive.storage) {
|
|
6210
|
+
switch (entry2.type) {
|
|
6211
|
+
case import_protocols15.ProfileArchiveEntryType.FILE: {
|
|
6212
|
+
const directory = await storage.createDirectory();
|
|
6213
|
+
(0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
6214
|
+
F: __dxlog_file22,
|
|
6215
|
+
L: 78,
|
|
6216
|
+
S: void 0,
|
|
6217
|
+
A: [
|
|
6218
|
+
"typeof entry.key === 'string'",
|
|
6219
|
+
"'Invalid key type'"
|
|
6220
|
+
]
|
|
6221
|
+
});
|
|
6222
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
6223
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6224
|
+
F: __dxlog_file22,
|
|
6225
|
+
L: 80,
|
|
6226
|
+
S: void 0,
|
|
6227
|
+
A: [
|
|
6228
|
+
"entry.value instanceof Uint8Array",
|
|
6229
|
+
"'Invalid value type'"
|
|
6230
|
+
]
|
|
6231
|
+
});
|
|
6232
|
+
await file.write(0, (0, import_util13.arrayToBuffer)(entry2.value));
|
|
6233
|
+
await file.close();
|
|
6234
|
+
break;
|
|
6235
|
+
}
|
|
6236
|
+
case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
|
|
6237
|
+
(0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6238
|
+
F: __dxlog_file22,
|
|
6239
|
+
L: 86,
|
|
6240
|
+
S: void 0,
|
|
6241
|
+
A: [
|
|
6242
|
+
"entry.key instanceof Uint8Array",
|
|
6243
|
+
"'Invalid key type'"
|
|
6244
|
+
]
|
|
6245
|
+
});
|
|
6246
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6247
|
+
F: __dxlog_file22,
|
|
6248
|
+
L: 87,
|
|
6249
|
+
S: void 0,
|
|
6250
|
+
A: [
|
|
6251
|
+
"entry.value instanceof Uint8Array",
|
|
6252
|
+
"'Invalid value type'"
|
|
6253
|
+
]
|
|
6254
|
+
});
|
|
6255
|
+
batch.put(entry2.key, entry2.value, {
|
|
6256
|
+
keyEncoding: "binary",
|
|
6257
|
+
valueEncoding: "binary"
|
|
6258
|
+
});
|
|
6259
|
+
break;
|
|
6260
|
+
}
|
|
6261
|
+
default:
|
|
6262
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6263
|
+
}
|
|
6264
|
+
}
|
|
6265
|
+
await batch.write();
|
|
6266
|
+
};
|
|
6267
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
6006
6268
|
var DevicesServiceImpl = class {
|
|
6007
6269
|
constructor(_identityManager) {
|
|
6008
6270
|
this._identityManager = _identityManager;
|
|
@@ -6019,8 +6281,8 @@ var DevicesServiceImpl = class {
|
|
|
6019
6281
|
devices: []
|
|
6020
6282
|
});
|
|
6021
6283
|
} else {
|
|
6022
|
-
(0,
|
|
6023
|
-
F:
|
|
6284
|
+
(0, import_invariant21.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
6285
|
+
F: __dxlog_file23,
|
|
6024
6286
|
L: 32,
|
|
6025
6287
|
S: this,
|
|
6026
6288
|
A: [
|
|
@@ -6101,7 +6363,7 @@ var DiagnosticsCollector = class {
|
|
|
6101
6363
|
client: clientDiagnostics,
|
|
6102
6364
|
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
6103
6365
|
};
|
|
6104
|
-
return JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6366
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util14.jsonKeyReplacer)(options)));
|
|
6105
6367
|
}
|
|
6106
6368
|
};
|
|
6107
6369
|
var findSystemServiceProvider = () => {
|
|
@@ -6111,35 +6373,112 @@ var findSystemServiceProvider = () => {
|
|
|
6111
6373
|
};
|
|
6112
6374
|
var findConfigs = () => {
|
|
6113
6375
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
6114
|
-
return configs.map((r) => r.instance.deref()).filter(
|
|
6376
|
+
return configs.map((r) => r.instance.deref()).filter(import_util14.nonNullable);
|
|
6377
|
+
};
|
|
6378
|
+
var ContactsServiceImpl = class {
|
|
6379
|
+
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
6380
|
+
this._identityManager = _identityManager;
|
|
6381
|
+
this._spaceManager = _spaceManager;
|
|
6382
|
+
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
6383
|
+
}
|
|
6384
|
+
async getContacts() {
|
|
6385
|
+
const identity = this._identityManager.identity;
|
|
6386
|
+
if (identity == null) {
|
|
6387
|
+
return {
|
|
6388
|
+
contacts: []
|
|
6389
|
+
};
|
|
6390
|
+
}
|
|
6391
|
+
const contacts = [
|
|
6392
|
+
...this._spaceManager.spaces.values()
|
|
6393
|
+
].flatMap((s) => [
|
|
6394
|
+
...s.spaceState.members.values()
|
|
6395
|
+
].map((m) => [
|
|
6396
|
+
s.key,
|
|
6397
|
+
m
|
|
6398
|
+
])).reduce((acc, v) => {
|
|
6399
|
+
const [spaceKey, memberInfo] = v;
|
|
6400
|
+
if (memberInfo.key.equals(identity.identityKey)) {
|
|
6401
|
+
return acc;
|
|
6402
|
+
}
|
|
6403
|
+
const existing = acc.get(memberInfo.key);
|
|
6404
|
+
if (existing != null) {
|
|
6405
|
+
existing.profile ??= memberInfo.profile;
|
|
6406
|
+
existing.commonSpaces?.push(spaceKey);
|
|
6407
|
+
} else {
|
|
6408
|
+
acc.set(memberInfo.key, {
|
|
6409
|
+
identityKey: memberInfo.key,
|
|
6410
|
+
profile: memberInfo.profile,
|
|
6411
|
+
commonSpaces: [
|
|
6412
|
+
spaceKey
|
|
6413
|
+
]
|
|
6414
|
+
});
|
|
6415
|
+
}
|
|
6416
|
+
return acc;
|
|
6417
|
+
}, new import_util16.ComplexMap(import_keys17.PublicKey.hash));
|
|
6418
|
+
return {
|
|
6419
|
+
contacts: [
|
|
6420
|
+
...contacts.values()
|
|
6421
|
+
]
|
|
6422
|
+
};
|
|
6423
|
+
}
|
|
6424
|
+
queryContacts() {
|
|
6425
|
+
const subscribedSpaceKeySet = new import_util16.ComplexSet(import_keys17.PublicKey.hash);
|
|
6426
|
+
return new import_codec_protobuf13.Stream(({ next, ctx }) => {
|
|
6427
|
+
const pushUpdateTask = new import_async22.UpdateScheduler(ctx, async () => {
|
|
6428
|
+
const contacts = await this.getContacts();
|
|
6429
|
+
next(contacts);
|
|
6430
|
+
}, {
|
|
6431
|
+
maxFrequency: 2
|
|
6432
|
+
});
|
|
6433
|
+
(0, import_async22.scheduleTask)(ctx, async () => {
|
|
6434
|
+
const subscriptions = new import_async22.EventSubscriptions();
|
|
6435
|
+
ctx.onDispose(() => subscriptions.clear());
|
|
6436
|
+
const subscribeToSpaceAndUpdate = () => {
|
|
6437
|
+
const oldSetSize = subscribedSpaceKeySet.size;
|
|
6438
|
+
for (const space of this._spaceManager.spaces.values()) {
|
|
6439
|
+
if (!subscribedSpaceKeySet.has(space.key)) {
|
|
6440
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
|
|
6441
|
+
subscribedSpaceKeySet.add(space.key);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
if (oldSetSize !== subscribedSpaceKeySet.size) {
|
|
6445
|
+
pushUpdateTask.trigger();
|
|
6446
|
+
}
|
|
6447
|
+
};
|
|
6448
|
+
const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
|
|
6449
|
+
ctx.onDispose(unsubscribe);
|
|
6450
|
+
subscribeToSpaceAndUpdate();
|
|
6451
|
+
});
|
|
6452
|
+
});
|
|
6453
|
+
}
|
|
6115
6454
|
};
|
|
6116
6455
|
var LoggingServiceImpl = class {
|
|
6117
6456
|
constructor() {
|
|
6118
|
-
this._logs = new
|
|
6457
|
+
this._logs = new import_async23.Event();
|
|
6119
6458
|
this._started = Date.now();
|
|
6120
|
-
this._sessionId =
|
|
6459
|
+
this._sessionId = import_keys18.PublicKey.random().toHex();
|
|
6121
6460
|
this._logProcessor = (_config, entry2) => {
|
|
6122
6461
|
this._logs.emit(entry2);
|
|
6123
6462
|
};
|
|
6124
6463
|
}
|
|
6125
6464
|
async open() {
|
|
6126
|
-
|
|
6465
|
+
import_log21.log.runtimeConfig.processors.push(this._logProcessor);
|
|
6127
6466
|
}
|
|
6128
6467
|
async close() {
|
|
6129
|
-
const index =
|
|
6130
|
-
|
|
6468
|
+
const index = import_log21.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6469
|
+
import_log21.log.runtimeConfig.processors.splice(index, 1);
|
|
6131
6470
|
}
|
|
6132
6471
|
async controlMetrics({ reset, record }) {
|
|
6133
6472
|
if (reset) {
|
|
6134
|
-
|
|
6473
|
+
import_util17.tracer.clear();
|
|
6135
6474
|
}
|
|
6136
6475
|
if (record === true) {
|
|
6137
|
-
|
|
6476
|
+
import_util17.tracer.start();
|
|
6138
6477
|
} else if (record === false) {
|
|
6139
|
-
|
|
6478
|
+
import_util17.tracer.stop();
|
|
6140
6479
|
}
|
|
6141
6480
|
return {
|
|
6142
|
-
recording:
|
|
6481
|
+
recording: import_util17.tracer.recording
|
|
6143
6482
|
};
|
|
6144
6483
|
}
|
|
6145
6484
|
/**
|
|
@@ -6147,13 +6486,13 @@ var LoggingServiceImpl = class {
|
|
|
6147
6486
|
*/
|
|
6148
6487
|
queryMetrics({ interval = 5e3 }) {
|
|
6149
6488
|
const getNumericalValues = (key) => {
|
|
6150
|
-
const events =
|
|
6489
|
+
const events = import_util17.tracer.get(key) ?? [];
|
|
6151
6490
|
return {
|
|
6152
6491
|
key,
|
|
6153
|
-
stats: (0,
|
|
6492
|
+
stats: (0, import_util17.numericalValues)(events, "duration")
|
|
6154
6493
|
};
|
|
6155
6494
|
};
|
|
6156
|
-
return new
|
|
6495
|
+
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
6157
6496
|
const update = () => {
|
|
6158
6497
|
const metrics = {
|
|
6159
6498
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6175,7 +6514,7 @@ var LoggingServiceImpl = class {
|
|
|
6175
6514
|
});
|
|
6176
6515
|
}
|
|
6177
6516
|
queryLogs(request) {
|
|
6178
|
-
return new
|
|
6517
|
+
return new import_codec_protobuf14.Stream(({ ctx, next }) => {
|
|
6179
6518
|
const handler = (entry2) => {
|
|
6180
6519
|
if (LOG_PROCESSING > 0) {
|
|
6181
6520
|
return;
|
|
@@ -6188,7 +6527,7 @@ var LoggingServiceImpl = class {
|
|
|
6188
6527
|
}
|
|
6189
6528
|
const record = {
|
|
6190
6529
|
...entry2,
|
|
6191
|
-
context: (0,
|
|
6530
|
+
context: (0, import_util17.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
|
|
6192
6531
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6193
6532
|
meta: {
|
|
6194
6533
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -6197,7 +6536,7 @@ var LoggingServiceImpl = class {
|
|
|
6197
6536
|
scope: {
|
|
6198
6537
|
hostSessionId: this._sessionId,
|
|
6199
6538
|
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
6200
|
-
name: (0,
|
|
6539
|
+
name: (0, import_util17.getDebugName)(entry2.meta?.S)
|
|
6201
6540
|
}
|
|
6202
6541
|
}
|
|
6203
6542
|
};
|
|
@@ -6235,7 +6574,7 @@ var NetworkServiceImpl = class {
|
|
|
6235
6574
|
this.signalManager = signalManager;
|
|
6236
6575
|
}
|
|
6237
6576
|
queryStatus() {
|
|
6238
|
-
return new
|
|
6577
|
+
return new import_codec_protobuf15.Stream(({ next }) => {
|
|
6239
6578
|
const update = () => {
|
|
6240
6579
|
next({
|
|
6241
6580
|
swarm: this.networkManager.connectionState,
|
|
@@ -6278,7 +6617,7 @@ var SystemServiceImpl = class {
|
|
|
6278
6617
|
const diagnostics = await this._getDiagnostics();
|
|
6279
6618
|
return {
|
|
6280
6619
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6281
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6620
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util18.jsonKeyReplacer)({
|
|
6282
6621
|
truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
6283
6622
|
humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
6284
6623
|
})))
|
|
@@ -6292,7 +6631,7 @@ var SystemServiceImpl = class {
|
|
|
6292
6631
|
}
|
|
6293
6632
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6294
6633
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6295
|
-
return new
|
|
6634
|
+
return new import_codec_protobuf16.Stream(({ next }) => {
|
|
6296
6635
|
const update = () => {
|
|
6297
6636
|
next({
|
|
6298
6637
|
status: this._getCurrentStatus()
|
|
@@ -6321,7 +6660,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6321
6660
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6322
6661
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6323
6662
|
}
|
|
6324
|
-
var
|
|
6663
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6325
6664
|
var ClientServicesHost = class {
|
|
6326
6665
|
constructor({
|
|
6327
6666
|
config,
|
|
@@ -6354,7 +6693,10 @@ var ClientServicesHost = class {
|
|
|
6354
6693
|
lockKey,
|
|
6355
6694
|
onAcquire: () => {
|
|
6356
6695
|
if (!this._opening) {
|
|
6357
|
-
void this.open(new import_context16.Context(
|
|
6696
|
+
void this.open(new import_context16.Context(void 0, {
|
|
6697
|
+
F: __dxlog_file24,
|
|
6698
|
+
L: 121
|
|
6699
|
+
}));
|
|
6358
6700
|
}
|
|
6359
6701
|
},
|
|
6360
6702
|
onRelease: () => this.close()
|
|
@@ -6409,25 +6751,25 @@ var ClientServicesHost = class {
|
|
|
6409
6751
|
* Can only be called once.
|
|
6410
6752
|
*/
|
|
6411
6753
|
initialize({ config, ...options }) {
|
|
6412
|
-
(0,
|
|
6413
|
-
F:
|
|
6414
|
-
L:
|
|
6754
|
+
(0, import_invariant20.invariant)(!this._open, "service host is open", {
|
|
6755
|
+
F: __dxlog_file24,
|
|
6756
|
+
L: 187,
|
|
6415
6757
|
S: this,
|
|
6416
6758
|
A: [
|
|
6417
6759
|
"!this._open",
|
|
6418
6760
|
"'service host is open'"
|
|
6419
6761
|
]
|
|
6420
6762
|
});
|
|
6421
|
-
(0,
|
|
6422
|
-
F:
|
|
6423
|
-
L:
|
|
6763
|
+
(0, import_log20.log)("initializing...", void 0, {
|
|
6764
|
+
F: __dxlog_file24,
|
|
6765
|
+
L: 188,
|
|
6424
6766
|
S: this,
|
|
6425
6767
|
C: (f, a) => f(...a)
|
|
6426
6768
|
});
|
|
6427
6769
|
if (config) {
|
|
6428
|
-
(0,
|
|
6429
|
-
F:
|
|
6430
|
-
L:
|
|
6770
|
+
(0, import_invariant20.invariant)(!this._config, "config already set", {
|
|
6771
|
+
F: __dxlog_file24,
|
|
6772
|
+
L: 191,
|
|
6431
6773
|
S: this,
|
|
6432
6774
|
A: [
|
|
6433
6775
|
"!this._config",
|
|
@@ -6440,9 +6782,9 @@ var ClientServicesHost = class {
|
|
|
6440
6782
|
}
|
|
6441
6783
|
}
|
|
6442
6784
|
if (!options.signalManager) {
|
|
6443
|
-
|
|
6444
|
-
F:
|
|
6445
|
-
L:
|
|
6785
|
+
import_log20.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
6786
|
+
F: __dxlog_file24,
|
|
6787
|
+
L: 199,
|
|
6446
6788
|
S: this,
|
|
6447
6789
|
C: (f, a) => f(...a)
|
|
6448
6790
|
});
|
|
@@ -6451,9 +6793,9 @@ var ClientServicesHost = class {
|
|
|
6451
6793
|
iceServers: this._config?.get("runtime.services.ice")
|
|
6452
6794
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6453
6795
|
this._signalManager = signalManager;
|
|
6454
|
-
(0,
|
|
6455
|
-
F:
|
|
6456
|
-
L:
|
|
6796
|
+
(0, import_invariant20.invariant)(!this._networkManager, "network manager already set", {
|
|
6797
|
+
F: __dxlog_file24,
|
|
6798
|
+
L: 210,
|
|
6457
6799
|
S: this,
|
|
6458
6800
|
A: [
|
|
6459
6801
|
"!this._networkManager",
|
|
@@ -6465,9 +6807,9 @@ var ClientServicesHost = class {
|
|
|
6465
6807
|
transportFactory,
|
|
6466
6808
|
signalManager
|
|
6467
6809
|
});
|
|
6468
|
-
(0,
|
|
6469
|
-
F:
|
|
6470
|
-
L:
|
|
6810
|
+
(0, import_log20.log)("initialized", void 0, {
|
|
6811
|
+
F: __dxlog_file24,
|
|
6812
|
+
L: 217,
|
|
6471
6813
|
S: this,
|
|
6472
6814
|
C: (f, a) => f(...a)
|
|
6473
6815
|
});
|
|
@@ -6477,44 +6819,44 @@ var ClientServicesHost = class {
|
|
|
6477
6819
|
return;
|
|
6478
6820
|
}
|
|
6479
6821
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6480
|
-
|
|
6822
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.begin({
|
|
6481
6823
|
id: traceId
|
|
6482
6824
|
}), {
|
|
6483
|
-
F:
|
|
6484
|
-
L:
|
|
6825
|
+
F: __dxlog_file24,
|
|
6826
|
+
L: 228,
|
|
6485
6827
|
S: this,
|
|
6486
6828
|
C: (f, a) => f(...a)
|
|
6487
6829
|
});
|
|
6488
|
-
(0,
|
|
6489
|
-
F:
|
|
6490
|
-
L:
|
|
6830
|
+
(0, import_invariant20.invariant)(this._config, "config not set", {
|
|
6831
|
+
F: __dxlog_file24,
|
|
6832
|
+
L: 230,
|
|
6491
6833
|
S: this,
|
|
6492
6834
|
A: [
|
|
6493
6835
|
"this._config",
|
|
6494
6836
|
"'config not set'"
|
|
6495
6837
|
]
|
|
6496
6838
|
});
|
|
6497
|
-
(0,
|
|
6498
|
-
F:
|
|
6499
|
-
L:
|
|
6839
|
+
(0, import_invariant20.invariant)(this._storage, "storage not set", {
|
|
6840
|
+
F: __dxlog_file24,
|
|
6841
|
+
L: 231,
|
|
6500
6842
|
S: this,
|
|
6501
6843
|
A: [
|
|
6502
6844
|
"this._storage",
|
|
6503
6845
|
"'storage not set'"
|
|
6504
6846
|
]
|
|
6505
6847
|
});
|
|
6506
|
-
(0,
|
|
6507
|
-
F:
|
|
6508
|
-
L:
|
|
6848
|
+
(0, import_invariant20.invariant)(this._signalManager, "signal manager not set", {
|
|
6849
|
+
F: __dxlog_file24,
|
|
6850
|
+
L: 232,
|
|
6509
6851
|
S: this,
|
|
6510
6852
|
A: [
|
|
6511
6853
|
"this._signalManager",
|
|
6512
6854
|
"'signal manager not set'"
|
|
6513
6855
|
]
|
|
6514
6856
|
});
|
|
6515
|
-
(0,
|
|
6516
|
-
F:
|
|
6517
|
-
L:
|
|
6857
|
+
(0, import_invariant20.invariant)(this._networkManager, "network manager not set", {
|
|
6858
|
+
F: __dxlog_file24,
|
|
6859
|
+
L: 233,
|
|
6518
6860
|
S: this,
|
|
6519
6861
|
A: [
|
|
6520
6862
|
"this._networkManager",
|
|
@@ -6522,11 +6864,11 @@ var ClientServicesHost = class {
|
|
|
6522
6864
|
]
|
|
6523
6865
|
});
|
|
6524
6866
|
this._opening = true;
|
|
6525
|
-
(0,
|
|
6867
|
+
(0, import_log20.log)("opening...", {
|
|
6526
6868
|
lockKey: this._resourceLock?.lockKey
|
|
6527
6869
|
}, {
|
|
6528
|
-
F:
|
|
6529
|
-
L:
|
|
6870
|
+
F: __dxlog_file24,
|
|
6871
|
+
L: 236,
|
|
6530
6872
|
S: this,
|
|
6531
6873
|
C: (f, a) => f(...a)
|
|
6532
6874
|
});
|
|
@@ -6537,16 +6879,18 @@ var ClientServicesHost = class {
|
|
|
6537
6879
|
await this._level.open();
|
|
6538
6880
|
await this._loggingService.open();
|
|
6539
6881
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
6882
|
+
const dataSpaceManagerProvider = async () => {
|
|
6883
|
+
await this._serviceContext.initialized.wait();
|
|
6884
|
+
return this._serviceContext.dataSpaceManager;
|
|
6885
|
+
};
|
|
6540
6886
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6541
6887
|
this._serviceRegistry.setServices({
|
|
6542
6888
|
SystemService: this._systemService,
|
|
6543
6889
|
IdentityService: identityService,
|
|
6890
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6544
6891
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6545
6892
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6546
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6547
|
-
await this._serviceContext.initialized.wait();
|
|
6548
|
-
return this._serviceContext.dataSpaceManager;
|
|
6549
|
-
}),
|
|
6893
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6550
6894
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6551
6895
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6552
6896
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6576,19 +6920,19 @@ var ClientServicesHost = class {
|
|
|
6576
6920
|
this._open = true;
|
|
6577
6921
|
this._statusUpdate.emit();
|
|
6578
6922
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6579
|
-
(0,
|
|
6923
|
+
(0, import_log20.log)("opened", {
|
|
6580
6924
|
deviceKey
|
|
6581
6925
|
}, {
|
|
6582
|
-
F:
|
|
6583
|
-
L:
|
|
6926
|
+
F: __dxlog_file24,
|
|
6927
|
+
L: 322,
|
|
6584
6928
|
S: this,
|
|
6585
6929
|
C: (f, a) => f(...a)
|
|
6586
6930
|
});
|
|
6587
|
-
|
|
6931
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.end({
|
|
6588
6932
|
id: traceId
|
|
6589
6933
|
}), {
|
|
6590
|
-
F:
|
|
6591
|
-
L:
|
|
6934
|
+
F: __dxlog_file24,
|
|
6935
|
+
L: 323,
|
|
6592
6936
|
S: this,
|
|
6593
6937
|
C: (f, a) => f(...a)
|
|
6594
6938
|
});
|
|
@@ -6598,11 +6942,11 @@ var ClientServicesHost = class {
|
|
|
6598
6942
|
return;
|
|
6599
6943
|
}
|
|
6600
6944
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6601
|
-
(0,
|
|
6945
|
+
(0, import_log20.log)("closing...", {
|
|
6602
6946
|
deviceKey
|
|
6603
6947
|
}, {
|
|
6604
|
-
F:
|
|
6605
|
-
L:
|
|
6948
|
+
F: __dxlog_file24,
|
|
6949
|
+
L: 334,
|
|
6606
6950
|
S: this,
|
|
6607
6951
|
C: (f, a) => f(...a)
|
|
6608
6952
|
});
|
|
@@ -6616,44 +6960,44 @@ var ClientServicesHost = class {
|
|
|
6616
6960
|
await this._level?.close();
|
|
6617
6961
|
this._open = false;
|
|
6618
6962
|
this._statusUpdate.emit();
|
|
6619
|
-
(0,
|
|
6963
|
+
(0, import_log20.log)("closed", {
|
|
6620
6964
|
deviceKey
|
|
6621
6965
|
}, {
|
|
6622
|
-
F:
|
|
6623
|
-
L:
|
|
6966
|
+
F: __dxlog_file24,
|
|
6967
|
+
L: 343,
|
|
6624
6968
|
S: this,
|
|
6625
6969
|
C: (f, a) => f(...a)
|
|
6626
6970
|
});
|
|
6627
6971
|
}
|
|
6628
6972
|
async reset() {
|
|
6629
6973
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6630
|
-
|
|
6974
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.begin({
|
|
6631
6975
|
id: traceId
|
|
6632
6976
|
}), {
|
|
6633
|
-
F:
|
|
6634
|
-
L:
|
|
6977
|
+
F: __dxlog_file24,
|
|
6978
|
+
L: 348,
|
|
6635
6979
|
S: this,
|
|
6636
6980
|
C: (f, a) => f(...a)
|
|
6637
6981
|
});
|
|
6638
|
-
|
|
6639
|
-
F:
|
|
6640
|
-
L:
|
|
6982
|
+
import_log20.log.info("resetting...", void 0, {
|
|
6983
|
+
F: __dxlog_file24,
|
|
6984
|
+
L: 350,
|
|
6641
6985
|
S: this,
|
|
6642
6986
|
C: (f, a) => f(...a)
|
|
6643
6987
|
});
|
|
6644
6988
|
await this._serviceContext?.close();
|
|
6645
6989
|
await this._storage.reset();
|
|
6646
|
-
|
|
6647
|
-
F:
|
|
6648
|
-
L:
|
|
6990
|
+
import_log20.log.info("reset", void 0, {
|
|
6991
|
+
F: __dxlog_file24,
|
|
6992
|
+
L: 353,
|
|
6649
6993
|
S: this,
|
|
6650
6994
|
C: (f, a) => f(...a)
|
|
6651
6995
|
});
|
|
6652
|
-
|
|
6996
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.end({
|
|
6653
6997
|
id: traceId
|
|
6654
6998
|
}), {
|
|
6655
|
-
F:
|
|
6656
|
-
L:
|
|
6999
|
+
F: __dxlog_file24,
|
|
7000
|
+
L: 354,
|
|
6657
7001
|
S: this,
|
|
6658
7002
|
C: (f, a) => f(...a)
|
|
6659
7003
|
});
|
|
@@ -6712,7 +7056,11 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6712
7056
|
createDiagnostics,
|
|
6713
7057
|
createLevel,
|
|
6714
7058
|
createStorageObjects,
|
|
7059
|
+
decodeProfileArchive,
|
|
7060
|
+
encodeProfileArchive,
|
|
7061
|
+
exportProfileData,
|
|
6715
7062
|
getNetworkPeers,
|
|
7063
|
+
importProfileData,
|
|
6716
7064
|
isLocked,
|
|
6717
7065
|
subscribeToFeedBlocks,
|
|
6718
7066
|
subscribeToFeeds,
|
|
@@ -6722,4 +7070,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6722
7070
|
subscribeToSpaces,
|
|
6723
7071
|
subscribeToSwarmInfo
|
|
6724
7072
|
});
|
|
6725
|
-
//# sourceMappingURL=chunk-
|
|
7073
|
+
//# sourceMappingURL=chunk-DDCTAJOJ.cjs.map
|