@dxos/client-services 0.3.2-main.648180e → 0.3.2-main.bc9cb77
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-DUT4WEQ5.mjs → chunk-7YWLHBWL.mjs} +131 -67
- package/dist/lib/browser/chunk-7YWLHBWL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +190 -126
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +164 -100
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +4 -0
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/devices/devices-service.ts +16 -3
- package/src/packlets/identity/identity-manager.test.ts +11 -0
- package/src/packlets/identity/identity-manager.ts +20 -0
- package/src/packlets/identity/identity.test.ts +2 -2
- package/src/packlets/identity/identity.ts +3 -3
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-DUT4WEQ5.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -519,9 +519,11 @@ var import_credentials2 = require("@dxos/credentials");
|
|
|
519
519
|
var import_debug = require("@dxos/debug");
|
|
520
520
|
var import_feed_store2 = require("@dxos/feed-store");
|
|
521
521
|
var import_invariant = require("@dxos/invariant");
|
|
522
|
+
var import_keys4 = require("@dxos/keys");
|
|
522
523
|
var import_log2 = require("@dxos/log");
|
|
523
524
|
var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
524
525
|
var import_tracing = require("@dxos/tracing");
|
|
526
|
+
var import_util2 = require("@dxos/util");
|
|
525
527
|
function _ts_decorate(decorators, target, key, desc) {
|
|
526
528
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
527
529
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -550,7 +552,7 @@ var Identity = class Identity2 {
|
|
|
550
552
|
onUpdate: () => this.stateUpdate.emit()
|
|
551
553
|
});
|
|
552
554
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
553
|
-
trustedKeysProvider: () => this.authorizedDeviceKeys,
|
|
555
|
+
trustedKeysProvider: () => new import_util2.ComplexSet(import_keys4.PublicKey.hash, this.authorizedDeviceKeys.keys()),
|
|
554
556
|
update: this.stateUpdate,
|
|
555
557
|
authTimeout: import_client_protocol.AUTH_TIMEOUT
|
|
556
558
|
});
|
|
@@ -688,13 +690,13 @@ var import_async6 = require("@dxos/async");
|
|
|
688
690
|
var import_context3 = require("@dxos/context");
|
|
689
691
|
var import_credentials4 = require("@dxos/credentials");
|
|
690
692
|
var import_invariant2 = require("@dxos/invariant");
|
|
691
|
-
var
|
|
693
|
+
var import_keys5 = require("@dxos/keys");
|
|
692
694
|
var import_log3 = require("@dxos/log");
|
|
693
695
|
var import_protocols2 = require("@dxos/protocols");
|
|
694
696
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
695
697
|
var import_timeframe = require("@dxos/timeframe");
|
|
696
698
|
var import_tracing2 = require("@dxos/tracing");
|
|
697
|
-
var
|
|
699
|
+
var import_util3 = require("@dxos/util");
|
|
698
700
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
699
701
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
700
702
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -720,7 +722,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
720
722
|
return this._identity;
|
|
721
723
|
}
|
|
722
724
|
async open(ctx) {
|
|
723
|
-
const traceId =
|
|
725
|
+
const traceId = import_keys5.PublicKey.random().toHex();
|
|
724
726
|
import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.begin({
|
|
725
727
|
id: traceId
|
|
726
728
|
}), {
|
|
@@ -950,10 +952,51 @@ var IdentityManager = class IdentityManager2 {
|
|
|
950
952
|
this.stateUpdate.emit();
|
|
951
953
|
return profile;
|
|
952
954
|
}
|
|
955
|
+
async updateDevice({ deviceKey, profile }) {
|
|
956
|
+
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
957
|
+
F: __dxlog_file3,
|
|
958
|
+
L: 216,
|
|
959
|
+
S: this,
|
|
960
|
+
A: [
|
|
961
|
+
"this._identity",
|
|
962
|
+
"'Identity not initialized.'"
|
|
963
|
+
]
|
|
964
|
+
});
|
|
965
|
+
(0, import_invariant2.invariant)(this._identity.authorizedDeviceKeys.has(deviceKey), "Device not authorized.", {
|
|
966
|
+
F: __dxlog_file3,
|
|
967
|
+
L: 218,
|
|
968
|
+
S: this,
|
|
969
|
+
A: [
|
|
970
|
+
"this._identity.authorizedDeviceKeys.has(deviceKey)",
|
|
971
|
+
"'Device not authorized.'"
|
|
972
|
+
]
|
|
973
|
+
});
|
|
974
|
+
const credential = await this._identity.getIdentityCredentialSigner().createCredential({
|
|
975
|
+
subject: this._identity.identityKey,
|
|
976
|
+
assertion: {
|
|
977
|
+
"@type": "dxos.halo.credentials.DeviceProfile",
|
|
978
|
+
deviceKey,
|
|
979
|
+
profile
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
const receipt = await this._identity.controlPipeline.writer.write({
|
|
983
|
+
credential: {
|
|
984
|
+
credential
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
988
|
+
[
|
|
989
|
+
receipt.feedKey,
|
|
990
|
+
receipt.seq
|
|
991
|
+
]
|
|
992
|
+
]));
|
|
993
|
+
this.stateUpdate.emit();
|
|
994
|
+
return profile;
|
|
995
|
+
}
|
|
953
996
|
async _constructIdentity(identityRecord) {
|
|
954
997
|
(0, import_invariant2.invariant)(!this._identity, void 0, {
|
|
955
998
|
F: __dxlog_file3,
|
|
956
|
-
L:
|
|
999
|
+
L: 236,
|
|
957
1000
|
S: this,
|
|
958
1001
|
A: [
|
|
959
1002
|
"!this._identity",
|
|
@@ -964,13 +1007,13 @@ var IdentityManager = class IdentityManager2 {
|
|
|
964
1007
|
identityRecord
|
|
965
1008
|
}, {
|
|
966
1009
|
F: __dxlog_file3,
|
|
967
|
-
L:
|
|
1010
|
+
L: 237,
|
|
968
1011
|
S: this,
|
|
969
1012
|
C: (f, a) => f(...a)
|
|
970
1013
|
});
|
|
971
1014
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
972
1015
|
F: __dxlog_file3,
|
|
973
|
-
L:
|
|
1016
|
+
L: 240,
|
|
974
1017
|
S: this,
|
|
975
1018
|
A: [
|
|
976
1019
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -982,7 +1025,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
982
1025
|
});
|
|
983
1026
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
984
1027
|
F: __dxlog_file3,
|
|
985
|
-
L:
|
|
1028
|
+
L: 244,
|
|
986
1029
|
S: this,
|
|
987
1030
|
A: [
|
|
988
1031
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -998,7 +1041,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
998
1041
|
swarmIdentity: {
|
|
999
1042
|
peerKey: identityRecord.deviceKey,
|
|
1000
1043
|
credentialProvider: createAuthProvider((0, import_credentials4.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
|
|
1001
|
-
credentialAuthenticator: (0,
|
|
1044
|
+
credentialAuthenticator: (0, import_util3.deferFunction)(() => identity.authVerifier.verifier)
|
|
1002
1045
|
},
|
|
1003
1046
|
identityKey: identityRecord.identityKey
|
|
1004
1047
|
});
|
|
@@ -1014,7 +1057,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
1014
1057
|
identityKey: identityRecord.identityKey
|
|
1015
1058
|
}, {
|
|
1016
1059
|
F: __dxlog_file3,
|
|
1017
|
-
L:
|
|
1060
|
+
L: 268,
|
|
1018
1061
|
S: this,
|
|
1019
1062
|
C: (f, a) => f(...a)
|
|
1020
1063
|
});
|
|
@@ -1035,7 +1078,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
1035
1078
|
onAuthFailure: () => {
|
|
1036
1079
|
import_log3.log.warn("auth failure", void 0, {
|
|
1037
1080
|
F: __dxlog_file3,
|
|
1038
|
-
L:
|
|
1081
|
+
L: 287,
|
|
1039
1082
|
S: this,
|
|
1040
1083
|
C: (f, a) => f(...a)
|
|
1041
1084
|
});
|
|
@@ -1220,7 +1263,7 @@ var import_client_protocol2 = require("@dxos/client-protocol");
|
|
|
1220
1263
|
var import_context5 = require("@dxos/context");
|
|
1221
1264
|
var import_credentials7 = require("@dxos/credentials");
|
|
1222
1265
|
var import_invariant6 = require("@dxos/invariant");
|
|
1223
|
-
var
|
|
1266
|
+
var import_keys7 = require("@dxos/keys");
|
|
1224
1267
|
var import_log5 = require("@dxos/log");
|
|
1225
1268
|
var import_network_manager = require("@dxos/network-manager");
|
|
1226
1269
|
var import_protocols4 = require("@dxos/protocols");
|
|
@@ -1231,7 +1274,7 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
|
|
|
1231
1274
|
var import_async7 = require("@dxos/async");
|
|
1232
1275
|
var import_context4 = require("@dxos/context");
|
|
1233
1276
|
var import_invariant5 = require("@dxos/invariant");
|
|
1234
|
-
var
|
|
1277
|
+
var import_keys6 = require("@dxos/keys");
|
|
1235
1278
|
var import_log4 = require("@dxos/log");
|
|
1236
1279
|
var import_protocols3 = require("@dxos/protocols");
|
|
1237
1280
|
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -1279,7 +1322,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1279
1322
|
},
|
|
1280
1323
|
introduce: async (request) => {
|
|
1281
1324
|
const { profile, invitationId } = request;
|
|
1282
|
-
const traceId =
|
|
1325
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1283
1326
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
|
|
1284
1327
|
id: traceId
|
|
1285
1328
|
}), {
|
|
@@ -1331,7 +1374,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1331
1374
|
};
|
|
1332
1375
|
},
|
|
1333
1376
|
authenticate: async ({ authCode: code }) => {
|
|
1334
|
-
const traceId =
|
|
1377
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1335
1378
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
|
|
1336
1379
|
id: traceId
|
|
1337
1380
|
}), {
|
|
@@ -1411,7 +1454,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1411
1454
|
};
|
|
1412
1455
|
},
|
|
1413
1456
|
admit: async (request) => {
|
|
1414
|
-
const traceId =
|
|
1457
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1415
1458
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
|
|
1416
1459
|
id: traceId
|
|
1417
1460
|
}), {
|
|
@@ -1577,7 +1620,7 @@ var InvitationsHandler = class {
|
|
|
1577
1620
|
this._networkManager = _networkManager;
|
|
1578
1621
|
}
|
|
1579
1622
|
createInvitation(protocol, options) {
|
|
1580
|
-
const { invitationId =
|
|
1623
|
+
const { invitationId = import_keys7.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys7.PublicKey.random() } = options ?? {};
|
|
1581
1624
|
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1582
1625
|
(0, import_invariant6.invariant)(protocol, void 0, {
|
|
1583
1626
|
F: __dxlog_file7,
|
|
@@ -1652,7 +1695,7 @@ var InvitationsHandler = class {
|
|
|
1652
1695
|
},
|
|
1653
1696
|
onOpen: () => {
|
|
1654
1697
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
1655
|
-
const traceId =
|
|
1698
|
+
const traceId = import_keys7.PublicKey.random().toHex();
|
|
1656
1699
|
try {
|
|
1657
1700
|
import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
1658
1701
|
id: traceId
|
|
@@ -1885,7 +1928,7 @@ var InvitationsHandler = class {
|
|
|
1885
1928
|
}
|
|
1886
1929
|
});
|
|
1887
1930
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
1888
|
-
const traceId =
|
|
1931
|
+
const traceId = import_keys7.PublicKey.random().toHex();
|
|
1889
1932
|
try {
|
|
1890
1933
|
import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
1891
1934
|
id: traceId
|
|
@@ -2092,7 +2135,7 @@ var InvitationsHandler = class {
|
|
|
2092
2135
|
const topic = invitation.swarmKey;
|
|
2093
2136
|
const swarmConnection = await this._networkManager.joinSwarm({
|
|
2094
2137
|
topic,
|
|
2095
|
-
peerId:
|
|
2138
|
+
peerId: import_keys7.PublicKey.random(),
|
|
2096
2139
|
protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
|
|
2097
2140
|
teleport.addExtension("dxos.halo.invitations", createExtension());
|
|
2098
2141
|
}),
|
|
@@ -2557,7 +2600,7 @@ var getPlatform = () => {
|
|
|
2557
2600
|
};
|
|
2558
2601
|
|
|
2559
2602
|
// packages/sdk/client-services/src/version.ts
|
|
2560
|
-
var DXOS_VERSION = "0.3.2-main.
|
|
2603
|
+
var DXOS_VERSION = "0.3.2-main.bc9cb77";
|
|
2561
2604
|
|
|
2562
2605
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2563
2606
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -2686,25 +2729,25 @@ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
|
2686
2729
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
2687
2730
|
var import_invariant13 = require("@dxos/invariant");
|
|
2688
2731
|
var import_keyring = require("@dxos/keyring");
|
|
2689
|
-
var
|
|
2732
|
+
var import_keys11 = require("@dxos/keys");
|
|
2690
2733
|
var import_log13 = require("@dxos/log");
|
|
2691
2734
|
var import_protocols10 = require("@dxos/protocols");
|
|
2692
2735
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2693
2736
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
2694
2737
|
var import_tracing4 = require("@dxos/tracing");
|
|
2695
|
-
var
|
|
2738
|
+
var import_util7 = require("@dxos/util");
|
|
2696
2739
|
|
|
2697
2740
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2698
2741
|
var import_async12 = require("@dxos/async");
|
|
2699
2742
|
var import_context8 = require("@dxos/context");
|
|
2700
2743
|
var import_credentials13 = require("@dxos/credentials");
|
|
2701
2744
|
var import_invariant11 = require("@dxos/invariant");
|
|
2702
|
-
var
|
|
2745
|
+
var import_keys10 = require("@dxos/keys");
|
|
2703
2746
|
var import_log11 = require("@dxos/log");
|
|
2704
2747
|
var import_protocols8 = require("@dxos/protocols");
|
|
2705
2748
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2706
2749
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
2707
|
-
var
|
|
2750
|
+
var import_util6 = require("@dxos/util");
|
|
2708
2751
|
|
|
2709
2752
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2710
2753
|
var import_async11 = require("@dxos/async");
|
|
@@ -2712,24 +2755,24 @@ var import_client_protocol3 = require("@dxos/client-protocol");
|
|
|
2712
2755
|
var import_context7 = require("@dxos/context");
|
|
2713
2756
|
var import_debug4 = require("@dxos/debug");
|
|
2714
2757
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
2715
|
-
var
|
|
2758
|
+
var import_keys9 = require("@dxos/keys");
|
|
2716
2759
|
var import_log10 = require("@dxos/log");
|
|
2717
2760
|
var import_protocols7 = require("@dxos/protocols");
|
|
2718
2761
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2719
2762
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2720
2763
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
2721
2764
|
var import_tracing3 = require("@dxos/tracing");
|
|
2722
|
-
var
|
|
2765
|
+
var import_util5 = require("@dxos/util");
|
|
2723
2766
|
|
|
2724
2767
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2725
2768
|
var import_async10 = require("@dxos/async");
|
|
2726
2769
|
var import_context6 = require("@dxos/context");
|
|
2727
2770
|
var import_invariant10 = require("@dxos/invariant");
|
|
2728
|
-
var
|
|
2771
|
+
var import_keys8 = require("@dxos/keys");
|
|
2729
2772
|
var import_log9 = require("@dxos/log");
|
|
2730
2773
|
var import_protocols6 = require("@dxos/protocols");
|
|
2731
2774
|
var import_teleport2 = require("@dxos/teleport");
|
|
2732
|
-
var
|
|
2775
|
+
var import_util4 = require("@dxos/util");
|
|
2733
2776
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
2734
2777
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
2735
2778
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
@@ -2740,8 +2783,8 @@ var NotarizationPlugin = class {
|
|
|
2740
2783
|
this._ctx = new import_context6.Context();
|
|
2741
2784
|
this._extensionOpened = new import_async10.Event();
|
|
2742
2785
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2743
|
-
this._processedCredentials = new
|
|
2744
|
-
this._processCredentialsTriggers = new
|
|
2786
|
+
this._processedCredentials = new import_util4.ComplexSet(import_keys8.PublicKey.hash);
|
|
2787
|
+
this._processCredentialsTriggers = new import_util4.ComplexMap(import_keys8.PublicKey.hash);
|
|
2745
2788
|
}
|
|
2746
2789
|
get hasWriter() {
|
|
2747
2790
|
return !!this._writer;
|
|
@@ -2903,7 +2946,7 @@ var NotarizationPlugin = class {
|
|
|
2903
2946
|
if (this._processedCredentials.has(id)) {
|
|
2904
2947
|
return;
|
|
2905
2948
|
}
|
|
2906
|
-
await (0,
|
|
2949
|
+
await (0, import_util4.entry)(this._processCredentialsTriggers, id).orInsert(new import_async10.Trigger()).value.wait();
|
|
2907
2950
|
}
|
|
2908
2951
|
/**
|
|
2909
2952
|
* Requests from other peers to notarize credentials.
|
|
@@ -3023,7 +3066,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3023
3066
|
this._signingContext = params.signingContext;
|
|
3024
3067
|
this._callbacks = params.callbacks ?? {};
|
|
3025
3068
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
3026
|
-
trustedKeysProvider: () => new
|
|
3069
|
+
trustedKeysProvider: () => new import_util5.ComplexSet(import_keys9.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
|
|
3027
3070
|
update: this._inner.stateUpdate,
|
|
3028
3071
|
authTimeout: import_client_protocol3.AUTH_TIMEOUT
|
|
3029
3072
|
});
|
|
@@ -3442,9 +3485,9 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3442
3485
|
this._feedStore = _feedStore;
|
|
3443
3486
|
this._ctx = new import_context8.Context();
|
|
3444
3487
|
this.updated = new import_async12.Event();
|
|
3445
|
-
this._spaces = new
|
|
3488
|
+
this._spaces = new import_util6.ComplexMap(import_keys10.PublicKey.hash);
|
|
3446
3489
|
this._isOpen = false;
|
|
3447
|
-
this._instanceId =
|
|
3490
|
+
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
3448
3491
|
}
|
|
3449
3492
|
// TODO(burdon): Remove.
|
|
3450
3493
|
get spaces() {
|
|
@@ -3473,7 +3516,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3473
3516
|
S: this,
|
|
3474
3517
|
C: (f, a) => f(...a)
|
|
3475
3518
|
});
|
|
3476
|
-
await (0,
|
|
3519
|
+
await (0, import_util6.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
3477
3520
|
try {
|
|
3478
3521
|
(0, import_log11.log)("load space", {
|
|
3479
3522
|
spaceMetadata
|
|
@@ -3655,7 +3698,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3655
3698
|
swarmIdentity: {
|
|
3656
3699
|
peerKey: this._signingContext.deviceKey,
|
|
3657
3700
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
3658
|
-
credentialAuthenticator: (0,
|
|
3701
|
+
credentialAuthenticator: (0, import_util6.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
3659
3702
|
},
|
|
3660
3703
|
onNetworkConnection: (session) => {
|
|
3661
3704
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
@@ -3995,7 +4038,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3995
4038
|
this.initialized = new import_async14.Trigger();
|
|
3996
4039
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
3997
4040
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
3998
|
-
this._instanceId =
|
|
4041
|
+
this._instanceId = import_keys11.PublicKey.random().toHex();
|
|
3999
4042
|
this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
|
|
4000
4043
|
this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4001
4044
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
@@ -4216,7 +4259,7 @@ _ts_decorate5([
|
|
|
4216
4259
|
import_tracing4.trace.span()
|
|
4217
4260
|
], ServiceContext.prototype, "_initialize", null);
|
|
4218
4261
|
ServiceContext = _ts_decorate5([
|
|
4219
|
-
(0,
|
|
4262
|
+
(0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
4220
4263
|
import_tracing4.trace.resource()
|
|
4221
4264
|
], ServiceContext);
|
|
4222
4265
|
|
|
@@ -4227,8 +4270,8 @@ var import_context10 = require("@dxos/context");
|
|
|
4227
4270
|
var import_document_model2 = require("@dxos/document-model");
|
|
4228
4271
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
4229
4272
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
4230
|
-
var
|
|
4231
|
-
var
|
|
4273
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
4274
|
+
var import_keys12 = require("@dxos/keys");
|
|
4232
4275
|
var import_log16 = require("@dxos/log");
|
|
4233
4276
|
var import_messaging = require("@dxos/messaging");
|
|
4234
4277
|
var import_model_factory = require("@dxos/model-factory");
|
|
@@ -4266,13 +4309,33 @@ var ServiceRegistry = class {
|
|
|
4266
4309
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
4267
4310
|
var import_async15 = require("@dxos/async");
|
|
4268
4311
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
4312
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
4269
4313
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4314
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4270
4315
|
var DevicesServiceImpl = class {
|
|
4271
4316
|
constructor(_identityManager) {
|
|
4272
4317
|
this._identityManager = _identityManager;
|
|
4273
4318
|
}
|
|
4274
|
-
updateDevice(
|
|
4275
|
-
|
|
4319
|
+
async updateDevice(profile) {
|
|
4320
|
+
(0, import_invariant14.invariant)(this._identityManager.identity, "Identity not initialized", {
|
|
4321
|
+
F: __dxlog_file16,
|
|
4322
|
+
L: 17,
|
|
4323
|
+
S: this,
|
|
4324
|
+
A: [
|
|
4325
|
+
"this._identityManager.identity",
|
|
4326
|
+
"'Identity not initialized'"
|
|
4327
|
+
]
|
|
4328
|
+
});
|
|
4329
|
+
const deviceKey = this._identityManager.identity.deviceKey;
|
|
4330
|
+
await this._identityManager.updateDevice({
|
|
4331
|
+
deviceKey,
|
|
4332
|
+
profile
|
|
4333
|
+
});
|
|
4334
|
+
return {
|
|
4335
|
+
deviceKey,
|
|
4336
|
+
kind: import_services11.DeviceKind.CURRENT,
|
|
4337
|
+
profile
|
|
4338
|
+
};
|
|
4276
4339
|
}
|
|
4277
4340
|
queryDevices() {
|
|
4278
4341
|
return new import_codec_protobuf12.Stream(({ next }) => {
|
|
@@ -4284,9 +4347,10 @@ var DevicesServiceImpl = class {
|
|
|
4284
4347
|
});
|
|
4285
4348
|
} else {
|
|
4286
4349
|
next({
|
|
4287
|
-
devices: Array.from(deviceKeys.
|
|
4350
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
|
|
4288
4351
|
deviceKey: key,
|
|
4289
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED
|
|
4352
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED,
|
|
4353
|
+
profile
|
|
4290
4354
|
}))
|
|
4291
4355
|
});
|
|
4292
4356
|
}
|
|
@@ -4307,7 +4371,7 @@ var DevicesServiceImpl = class {
|
|
|
4307
4371
|
};
|
|
4308
4372
|
|
|
4309
4373
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
4310
|
-
var
|
|
4374
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
4311
4375
|
var import_lock_file = require("@dxos/lock-file");
|
|
4312
4376
|
var import_log14 = require("@dxos/log");
|
|
4313
4377
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
@@ -4320,7 +4384,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4320
4384
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4321
4385
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4322
4386
|
}
|
|
4323
|
-
var
|
|
4387
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
4324
4388
|
var Lock = class {
|
|
4325
4389
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
4326
4390
|
this._lockPath = lockPath;
|
|
@@ -4332,7 +4396,7 @@ var Lock = class {
|
|
|
4332
4396
|
}
|
|
4333
4397
|
async acquire() {
|
|
4334
4398
|
(0, import_log14.log)("acquiring lock...", void 0, {
|
|
4335
|
-
F:
|
|
4399
|
+
F: __dxlog_file17,
|
|
4336
4400
|
L: 32,
|
|
4337
4401
|
S: this,
|
|
4338
4402
|
C: (f, a) => f(...a)
|
|
@@ -4340,7 +4404,7 @@ var Lock = class {
|
|
|
4340
4404
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
4341
4405
|
await this._onAcquire?.();
|
|
4342
4406
|
(0, import_log14.log)("acquired lock", void 0, {
|
|
4343
|
-
F:
|
|
4407
|
+
F: __dxlog_file17,
|
|
4344
4408
|
L: 37,
|
|
4345
4409
|
S: this,
|
|
4346
4410
|
C: (f, a) => f(...a)
|
|
@@ -4348,8 +4412,8 @@ var Lock = class {
|
|
|
4348
4412
|
}
|
|
4349
4413
|
async release() {
|
|
4350
4414
|
await this._onRelease?.();
|
|
4351
|
-
(0,
|
|
4352
|
-
F:
|
|
4415
|
+
(0, import_invariant15.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
4416
|
+
F: __dxlog_file17,
|
|
4353
4417
|
L: 42,
|
|
4354
4418
|
S: this,
|
|
4355
4419
|
A: [
|
|
@@ -4370,7 +4434,7 @@ var import_async16 = require("@dxos/async");
|
|
|
4370
4434
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
4371
4435
|
var import_log15 = require("@dxos/log");
|
|
4372
4436
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4373
|
-
var
|
|
4437
|
+
var import_util8 = require("@dxos/util");
|
|
4374
4438
|
var LoggingServiceImpl = class {
|
|
4375
4439
|
constructor() {
|
|
4376
4440
|
this._logs = new import_async16.Event();
|
|
@@ -4388,15 +4452,15 @@ var LoggingServiceImpl = class {
|
|
|
4388
4452
|
}
|
|
4389
4453
|
async controlMetrics({ reset, record }) {
|
|
4390
4454
|
if (reset) {
|
|
4391
|
-
|
|
4455
|
+
import_util8.tracer.clear();
|
|
4392
4456
|
}
|
|
4393
4457
|
if (record === true) {
|
|
4394
|
-
|
|
4458
|
+
import_util8.tracer.start();
|
|
4395
4459
|
} else if (record === false) {
|
|
4396
|
-
|
|
4460
|
+
import_util8.tracer.stop();
|
|
4397
4461
|
}
|
|
4398
4462
|
return {
|
|
4399
|
-
recording:
|
|
4463
|
+
recording: import_util8.tracer.recording
|
|
4400
4464
|
};
|
|
4401
4465
|
}
|
|
4402
4466
|
/**
|
|
@@ -4404,10 +4468,10 @@ var LoggingServiceImpl = class {
|
|
|
4404
4468
|
*/
|
|
4405
4469
|
queryMetrics({ interval = 5e3 }) {
|
|
4406
4470
|
const getNumericalValues = (key) => {
|
|
4407
|
-
const events =
|
|
4471
|
+
const events = import_util8.tracer.get(key) ?? [];
|
|
4408
4472
|
return {
|
|
4409
4473
|
key,
|
|
4410
|
-
stats: (0,
|
|
4474
|
+
stats: (0, import_util8.numericalValues)(events, "duration")
|
|
4411
4475
|
};
|
|
4412
4476
|
};
|
|
4413
4477
|
return new import_codec_protobuf13.Stream(({ next }) => {
|
|
@@ -4445,7 +4509,7 @@ var LoggingServiceImpl = class {
|
|
|
4445
4509
|
}
|
|
4446
4510
|
const record = {
|
|
4447
4511
|
...entry2,
|
|
4448
|
-
context: (0,
|
|
4512
|
+
context: (0, import_util8.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
|
|
4449
4513
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4450
4514
|
meta: {
|
|
4451
4515
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -4519,10 +4583,10 @@ var import_client_protocol4 = require("@dxos/client-protocol");
|
|
|
4519
4583
|
var import_protocols11 = require("@dxos/protocols");
|
|
4520
4584
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
4521
4585
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
4522
|
-
var
|
|
4586
|
+
var import_util9 = require("@dxos/util");
|
|
4523
4587
|
var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
4524
4588
|
var createStorageObjects = (config) => {
|
|
4525
|
-
const { persistent = false, keyStore, dataStore, dataRoot = (0,
|
|
4589
|
+
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util9.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4526
4590
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4527
4591
|
throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4528
4592
|
}
|
|
@@ -4566,7 +4630,7 @@ var toStorageType = (type) => {
|
|
|
4566
4630
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
4567
4631
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
4568
4632
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4569
|
-
var
|
|
4633
|
+
var import_util10 = require("@dxos/util");
|
|
4570
4634
|
var SystemServiceImpl = class {
|
|
4571
4635
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
4572
4636
|
this._config = config;
|
|
@@ -4586,7 +4650,7 @@ var SystemServiceImpl = class {
|
|
|
4586
4650
|
const diagnostics = await this._getDiagnostics();
|
|
4587
4651
|
return {
|
|
4588
4652
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4589
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
4653
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
|
|
4590
4654
|
truncate: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
4591
4655
|
humanize: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
4592
4656
|
})))
|
|
@@ -4628,7 +4692,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
4628
4692
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4629
4693
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4630
4694
|
}
|
|
4631
|
-
var
|
|
4695
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
4632
4696
|
var createDefaultModelFactory = () => {
|
|
4633
4697
|
return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
|
|
4634
4698
|
};
|
|
@@ -4728,8 +4792,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4728
4792
|
* Can only be called once.
|
|
4729
4793
|
*/
|
|
4730
4794
|
initialize({ config, ...options }) {
|
|
4731
|
-
(0,
|
|
4732
|
-
F:
|
|
4795
|
+
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
4796
|
+
F: __dxlog_file18,
|
|
4733
4797
|
L: 201,
|
|
4734
4798
|
S: this,
|
|
4735
4799
|
A: [
|
|
@@ -4738,14 +4802,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4738
4802
|
]
|
|
4739
4803
|
});
|
|
4740
4804
|
(0, import_log16.log)("initializing...", void 0, {
|
|
4741
|
-
F:
|
|
4805
|
+
F: __dxlog_file18,
|
|
4742
4806
|
L: 202,
|
|
4743
4807
|
S: this,
|
|
4744
4808
|
C: (f, a) => f(...a)
|
|
4745
4809
|
});
|
|
4746
4810
|
if (config) {
|
|
4747
|
-
(0,
|
|
4748
|
-
F:
|
|
4811
|
+
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
4812
|
+
F: __dxlog_file18,
|
|
4749
4813
|
L: 205,
|
|
4750
4814
|
S: this,
|
|
4751
4815
|
A: [
|
|
@@ -4762,8 +4826,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4762
4826
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4763
4827
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4764
4828
|
this._signalManager = signalManager;
|
|
4765
|
-
(0,
|
|
4766
|
-
F:
|
|
4829
|
+
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
4830
|
+
F: __dxlog_file18,
|
|
4767
4831
|
L: 221,
|
|
4768
4832
|
S: this,
|
|
4769
4833
|
A: [
|
|
@@ -4777,7 +4841,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4777
4841
|
signalManager
|
|
4778
4842
|
});
|
|
4779
4843
|
(0, import_log16.log)("initialized", void 0, {
|
|
4780
|
-
F:
|
|
4844
|
+
F: __dxlog_file18,
|
|
4781
4845
|
L: 228,
|
|
4782
4846
|
S: this,
|
|
4783
4847
|
C: (f, a) => f(...a)
|
|
@@ -4787,17 +4851,17 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4787
4851
|
if (this._open) {
|
|
4788
4852
|
return;
|
|
4789
4853
|
}
|
|
4790
|
-
const traceId =
|
|
4854
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
4791
4855
|
import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
|
|
4792
4856
|
id: traceId
|
|
4793
4857
|
}), {
|
|
4794
|
-
F:
|
|
4858
|
+
F: __dxlog_file18,
|
|
4795
4859
|
L: 239,
|
|
4796
4860
|
S: this,
|
|
4797
4861
|
C: (f, a) => f(...a)
|
|
4798
4862
|
});
|
|
4799
|
-
(0,
|
|
4800
|
-
F:
|
|
4863
|
+
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
4864
|
+
F: __dxlog_file18,
|
|
4801
4865
|
L: 241,
|
|
4802
4866
|
S: this,
|
|
4803
4867
|
A: [
|
|
@@ -4805,8 +4869,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4805
4869
|
"'config not set'"
|
|
4806
4870
|
]
|
|
4807
4871
|
});
|
|
4808
|
-
(0,
|
|
4809
|
-
F:
|
|
4872
|
+
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
4873
|
+
F: __dxlog_file18,
|
|
4810
4874
|
L: 242,
|
|
4811
4875
|
S: this,
|
|
4812
4876
|
A: [
|
|
@@ -4814,8 +4878,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4814
4878
|
"'storage not set'"
|
|
4815
4879
|
]
|
|
4816
4880
|
});
|
|
4817
|
-
(0,
|
|
4818
|
-
F:
|
|
4881
|
+
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
4882
|
+
F: __dxlog_file18,
|
|
4819
4883
|
L: 243,
|
|
4820
4884
|
S: this,
|
|
4821
4885
|
A: [
|
|
@@ -4823,8 +4887,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4823
4887
|
"'signal manager not set'"
|
|
4824
4888
|
]
|
|
4825
4889
|
});
|
|
4826
|
-
(0,
|
|
4827
|
-
F:
|
|
4890
|
+
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
4891
|
+
F: __dxlog_file18,
|
|
4828
4892
|
L: 244,
|
|
4829
4893
|
S: this,
|
|
4830
4894
|
A: [
|
|
@@ -4836,7 +4900,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4836
4900
|
(0, import_log16.log)("opening...", {
|
|
4837
4901
|
lockKey: this._resourceLock?.lockKey
|
|
4838
4902
|
}, {
|
|
4839
|
-
F:
|
|
4903
|
+
F: __dxlog_file18,
|
|
4840
4904
|
L: 247,
|
|
4841
4905
|
S: this,
|
|
4842
4906
|
C: (f, a) => f(...a)
|
|
@@ -4882,7 +4946,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4882
4946
|
(0, import_log16.log)("opened", {
|
|
4883
4947
|
deviceKey
|
|
4884
4948
|
}, {
|
|
4885
|
-
F:
|
|
4949
|
+
F: __dxlog_file18,
|
|
4886
4950
|
L: 316,
|
|
4887
4951
|
S: this,
|
|
4888
4952
|
C: (f, a) => f(...a)
|
|
@@ -4890,7 +4954,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4890
4954
|
import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
|
|
4891
4955
|
id: traceId
|
|
4892
4956
|
}), {
|
|
4893
|
-
F:
|
|
4957
|
+
F: __dxlog_file18,
|
|
4894
4958
|
L: 317,
|
|
4895
4959
|
S: this,
|
|
4896
4960
|
C: (f, a) => f(...a)
|
|
@@ -4904,7 +4968,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4904
4968
|
(0, import_log16.log)("closing...", {
|
|
4905
4969
|
deviceKey
|
|
4906
4970
|
}, {
|
|
4907
|
-
F:
|
|
4971
|
+
F: __dxlog_file18,
|
|
4908
4972
|
L: 328,
|
|
4909
4973
|
S: this,
|
|
4910
4974
|
C: (f, a) => f(...a)
|
|
@@ -4920,24 +4984,24 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4920
4984
|
(0, import_log16.log)("closed", {
|
|
4921
4985
|
deviceKey
|
|
4922
4986
|
}, {
|
|
4923
|
-
F:
|
|
4987
|
+
F: __dxlog_file18,
|
|
4924
4988
|
L: 335,
|
|
4925
4989
|
S: this,
|
|
4926
4990
|
C: (f, a) => f(...a)
|
|
4927
4991
|
});
|
|
4928
4992
|
}
|
|
4929
4993
|
async reset() {
|
|
4930
|
-
const traceId =
|
|
4994
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
4931
4995
|
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
|
|
4932
4996
|
id: traceId
|
|
4933
4997
|
}), {
|
|
4934
|
-
F:
|
|
4998
|
+
F: __dxlog_file18,
|
|
4935
4999
|
L: 340,
|
|
4936
5000
|
S: this,
|
|
4937
5001
|
C: (f, a) => f(...a)
|
|
4938
5002
|
});
|
|
4939
5003
|
(0, import_log16.log)("resetting...", void 0, {
|
|
4940
|
-
F:
|
|
5004
|
+
F: __dxlog_file18,
|
|
4941
5005
|
L: 342,
|
|
4942
5006
|
S: this,
|
|
4943
5007
|
C: (f, a) => f(...a)
|
|
@@ -4945,7 +5009,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4945
5009
|
await this._serviceContext?.close();
|
|
4946
5010
|
await this._storage.reset();
|
|
4947
5011
|
(0, import_log16.log)("reset", void 0, {
|
|
4948
|
-
F:
|
|
5012
|
+
F: __dxlog_file18,
|
|
4949
5013
|
L: 345,
|
|
4950
5014
|
S: this,
|
|
4951
5015
|
C: (f, a) => f(...a)
|
|
@@ -4953,7 +5017,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4953
5017
|
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
|
|
4954
5018
|
id: traceId
|
|
4955
5019
|
}), {
|
|
4956
|
-
F:
|
|
5020
|
+
F: __dxlog_file18,
|
|
4957
5021
|
L: 346,
|
|
4958
5022
|
S: this,
|
|
4959
5023
|
C: (f, a) => f(...a)
|
|
@@ -5005,15 +5069,15 @@ var import_context11 = require("@dxos/context");
|
|
|
5005
5069
|
var import_log17 = require("@dxos/log");
|
|
5006
5070
|
var import_messaging2 = require("@dxos/messaging");
|
|
5007
5071
|
var import_network_manager3 = require("@dxos/network-manager");
|
|
5008
|
-
var
|
|
5072
|
+
var import_util11 = require("@dxos/util");
|
|
5009
5073
|
|
|
5010
5074
|
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
5011
5075
|
var import_async18 = require("@dxos/async");
|
|
5012
5076
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
5013
|
-
var
|
|
5077
|
+
var import_invariant17 = require("@dxos/invariant");
|
|
5014
5078
|
var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
|
|
5015
5079
|
var import_rpc2 = require("@dxos/rpc");
|
|
5016
|
-
var
|
|
5080
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
|
|
5017
5081
|
var ShellRuntimeImpl = class {
|
|
5018
5082
|
constructor(_port) {
|
|
5019
5083
|
this._port = _port;
|
|
@@ -5040,8 +5104,8 @@ var ShellRuntimeImpl = class {
|
|
|
5040
5104
|
});
|
|
5041
5105
|
}
|
|
5042
5106
|
async setAppContext(context) {
|
|
5043
|
-
(0,
|
|
5044
|
-
F:
|
|
5107
|
+
(0, import_invariant17.invariant)(this._appRpc, "runtime not open", {
|
|
5108
|
+
F: __dxlog_file19,
|
|
5045
5109
|
L: 44,
|
|
5046
5110
|
S: this,
|
|
5047
5111
|
A: [
|
|
@@ -5086,7 +5150,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
5086
5150
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5087
5151
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5088
5152
|
}
|
|
5089
|
-
var
|
|
5153
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
|
|
5090
5154
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
5091
5155
|
var IFrameHostRuntime = class {
|
|
5092
5156
|
constructor({ config, origin, appPort, shellPort }) {
|
|
@@ -5107,13 +5171,13 @@ var IFrameHostRuntime = class {
|
|
|
5107
5171
|
}
|
|
5108
5172
|
async start() {
|
|
5109
5173
|
(0, import_log17.log)("starting...", void 0, {
|
|
5110
|
-
F:
|
|
5174
|
+
F: __dxlog_file20,
|
|
5111
5175
|
L: 71,
|
|
5112
5176
|
S: this,
|
|
5113
5177
|
C: (f, a) => f(...a)
|
|
5114
5178
|
});
|
|
5115
5179
|
try {
|
|
5116
|
-
this._config = await (0,
|
|
5180
|
+
this._config = await (0, import_util11.getAsyncValue)(this._configProvider);
|
|
5117
5181
|
this._transportFactory = (0, import_network_manager3.createSimplePeerTransportFactory)({
|
|
5118
5182
|
iceServers: this._config.get("runtime.services.ice")
|
|
5119
5183
|
});
|
|
@@ -5156,7 +5220,7 @@ var IFrameHostRuntime = class {
|
|
|
5156
5220
|
]);
|
|
5157
5221
|
this._ready.wake(void 0);
|
|
5158
5222
|
(0, import_log17.log)("started", void 0, {
|
|
5159
|
-
F:
|
|
5223
|
+
F: __dxlog_file20,
|
|
5160
5224
|
L: 114,
|
|
5161
5225
|
S: this,
|
|
5162
5226
|
C: (f, a) => f(...a)
|
|
@@ -5164,7 +5228,7 @@ var IFrameHostRuntime = class {
|
|
|
5164
5228
|
} catch (err) {
|
|
5165
5229
|
this._ready.wake(err);
|
|
5166
5230
|
import_log17.log.catch(err, void 0, {
|
|
5167
|
-
F:
|
|
5231
|
+
F: __dxlog_file20,
|
|
5168
5232
|
L: 117,
|
|
5169
5233
|
S: this,
|
|
5170
5234
|
C: (f, a) => f(...a)
|
|
@@ -5173,7 +5237,7 @@ var IFrameHostRuntime = class {
|
|
|
5173
5237
|
}
|
|
5174
5238
|
async stop() {
|
|
5175
5239
|
(0, import_log17.log)("stopping...", void 0, {
|
|
5176
|
-
F:
|
|
5240
|
+
F: __dxlog_file20,
|
|
5177
5241
|
L: 122,
|
|
5178
5242
|
S: this,
|
|
5179
5243
|
C: (f, a) => f(...a)
|
|
@@ -5182,7 +5246,7 @@ var IFrameHostRuntime = class {
|
|
|
5182
5246
|
await this._clientServices.close();
|
|
5183
5247
|
await this._shellRuntime?.close();
|
|
5184
5248
|
(0, import_log17.log)("stopped", void 0, {
|
|
5185
|
-
F:
|
|
5249
|
+
F: __dxlog_file20,
|
|
5186
5250
|
L: 126,
|
|
5187
5251
|
S: this,
|
|
5188
5252
|
C: (f, a) => f(...a)
|
|
@@ -5200,8 +5264,8 @@ var import_log18 = require("@dxos/log");
|
|
|
5200
5264
|
var import_network_manager4 = require("@dxos/network-manager");
|
|
5201
5265
|
var import_protocols13 = require("@dxos/protocols");
|
|
5202
5266
|
var import_rpc3 = require("@dxos/rpc");
|
|
5203
|
-
var
|
|
5204
|
-
var
|
|
5267
|
+
var import_util12 = require("@dxos/util");
|
|
5268
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
|
|
5205
5269
|
var IFrameProxyRuntime = class {
|
|
5206
5270
|
constructor({ config, systemPort, shellPort }) {
|
|
5207
5271
|
this._id = String(Math.floor(Math.random() * 1e6));
|
|
@@ -5217,7 +5281,7 @@ var IFrameProxyRuntime = class {
|
|
|
5217
5281
|
return this._shellRuntime;
|
|
5218
5282
|
}
|
|
5219
5283
|
async open(origin) {
|
|
5220
|
-
this._config = await (0,
|
|
5284
|
+
this._config = await (0, import_util12.getAsyncValue)(this._configProvider);
|
|
5221
5285
|
this._transportService = new import_network_manager4.SimplePeerTransportService({
|
|
5222
5286
|
iceServers: this._config.get("runtime.services.ice")
|
|
5223
5287
|
});
|
|
@@ -5249,7 +5313,7 @@ var IFrameProxyRuntime = class {
|
|
|
5249
5313
|
});
|
|
5250
5314
|
} catch (err) {
|
|
5251
5315
|
import_log18.log.catch(err, void 0, {
|
|
5252
|
-
F:
|
|
5316
|
+
F: __dxlog_file21,
|
|
5253
5317
|
L: 85,
|
|
5254
5318
|
S: this,
|
|
5255
5319
|
C: (f, a) => f(...a)
|
|
@@ -5279,10 +5343,10 @@ var import_network_manager5 = require("@dxos/network-manager");
|
|
|
5279
5343
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
5280
5344
|
var import_async21 = require("@dxos/async");
|
|
5281
5345
|
var import_client_protocol9 = require("@dxos/client-protocol");
|
|
5282
|
-
var
|
|
5346
|
+
var import_invariant18 = require("@dxos/invariant");
|
|
5283
5347
|
var import_log19 = require("@dxos/log");
|
|
5284
5348
|
var import_rpc4 = require("@dxos/rpc");
|
|
5285
|
-
var
|
|
5349
|
+
var import_util13 = require("@dxos/util");
|
|
5286
5350
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
5287
5351
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5288
5352
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -5293,13 +5357,13 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
5293
5357
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5294
5358
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5295
5359
|
}
|
|
5296
|
-
var
|
|
5360
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
|
|
5297
5361
|
var WorkerSession = class {
|
|
5298
5362
|
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
|
|
5299
5363
|
this._startTrigger = new import_async21.Trigger();
|
|
5300
|
-
this.onClose = new
|
|
5301
|
-
(0,
|
|
5302
|
-
F:
|
|
5364
|
+
this.onClose = new import_util13.Callback();
|
|
5365
|
+
(0, import_invariant18.invariant)(serviceHost, void 0, {
|
|
5366
|
+
F: __dxlog_file22,
|
|
5303
5367
|
L: 49,
|
|
5304
5368
|
S: this,
|
|
5305
5369
|
A: [
|
|
@@ -5354,7 +5418,7 @@ var WorkerSession = class {
|
|
|
5354
5418
|
await this.close();
|
|
5355
5419
|
} catch (err) {
|
|
5356
5420
|
import_log19.log.catch(err, void 0, {
|
|
5357
|
-
F:
|
|
5421
|
+
F: __dxlog_file22,
|
|
5358
5422
|
L: 99,
|
|
5359
5423
|
S: this,
|
|
5360
5424
|
C: (f, a) => f(...a)
|
|
@@ -5371,7 +5435,7 @@ var WorkerSession = class {
|
|
|
5371
5435
|
}
|
|
5372
5436
|
async open() {
|
|
5373
5437
|
import_log19.log.info("opening...", void 0, {
|
|
5374
|
-
F:
|
|
5438
|
+
F: __dxlog_file22,
|
|
5375
5439
|
L: 113,
|
|
5376
5440
|
S: this,
|
|
5377
5441
|
C: (f, a) => f(...a)
|
|
@@ -5388,7 +5452,7 @@ var WorkerSession = class {
|
|
|
5388
5452
|
void this._afterLockReleases(this.lockKey, () => this.close());
|
|
5389
5453
|
}
|
|
5390
5454
|
import_log19.log.info("opened", void 0, {
|
|
5391
|
-
F:
|
|
5455
|
+
F: __dxlog_file22,
|
|
5392
5456
|
L: 124,
|
|
5393
5457
|
S: this,
|
|
5394
5458
|
C: (f, a) => f(...a)
|
|
@@ -5396,7 +5460,7 @@ var WorkerSession = class {
|
|
|
5396
5460
|
}
|
|
5397
5461
|
async close() {
|
|
5398
5462
|
import_log19.log.info("closing...", void 0, {
|
|
5399
|
-
F:
|
|
5463
|
+
F: __dxlog_file22,
|
|
5400
5464
|
L: 128,
|
|
5401
5465
|
S: this,
|
|
5402
5466
|
C: (f, a) => f(...a)
|
|
@@ -5405,7 +5469,7 @@ var WorkerSession = class {
|
|
|
5405
5469
|
await this.onClose.callIfSet();
|
|
5406
5470
|
} catch (err) {
|
|
5407
5471
|
import_log19.log.catch(err, void 0, {
|
|
5408
|
-
F:
|
|
5472
|
+
F: __dxlog_file22,
|
|
5409
5473
|
L: 132,
|
|
5410
5474
|
S: this,
|
|
5411
5475
|
C: (f, a) => f(...a)
|
|
@@ -5416,7 +5480,7 @@ var WorkerSession = class {
|
|
|
5416
5480
|
this._iframeRpc.close()
|
|
5417
5481
|
]);
|
|
5418
5482
|
import_log19.log.info("closed", void 0, {
|
|
5419
|
-
F:
|
|
5483
|
+
F: __dxlog_file22,
|
|
5420
5484
|
L: 136,
|
|
5421
5485
|
S: this,
|
|
5422
5486
|
C: (f, a) => f(...a)
|
|
@@ -5427,7 +5491,7 @@ var WorkerSession = class {
|
|
|
5427
5491
|
await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
5428
5492
|
} catch {
|
|
5429
5493
|
import_log19.log.info("No shell connected.", void 0, {
|
|
5430
|
-
F:
|
|
5494
|
+
F: __dxlog_file22,
|
|
5431
5495
|
L: 143,
|
|
5432
5496
|
S: this,
|
|
5433
5497
|
C: (f, a) => f(...a)
|
|
@@ -5447,7 +5511,7 @@ _ts_decorate9([
|
|
|
5447
5511
|
], WorkerSession.prototype, "lockKey", void 0);
|
|
5448
5512
|
|
|
5449
5513
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
5450
|
-
var
|
|
5514
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
|
|
5451
5515
|
var WorkerRuntime = class {
|
|
5452
5516
|
constructor(_configProvider) {
|
|
5453
5517
|
this._configProvider = _configProvider;
|
|
@@ -5467,7 +5531,7 @@ var WorkerRuntime = class {
|
|
|
5467
5531
|
}
|
|
5468
5532
|
async start() {
|
|
5469
5533
|
(0, import_log20.log)("starting...", void 0, {
|
|
5470
|
-
F:
|
|
5534
|
+
F: __dxlog_file23,
|
|
5471
5535
|
L: 52,
|
|
5472
5536
|
S: this,
|
|
5473
5537
|
C: (f, a) => f(...a)
|
|
@@ -5483,7 +5547,7 @@ var WorkerRuntime = class {
|
|
|
5483
5547
|
await this._clientServices.open(new import_context12.Context());
|
|
5484
5548
|
this._ready.wake(void 0);
|
|
5485
5549
|
(0, import_log20.log)("started", void 0, {
|
|
5486
|
-
F:
|
|
5550
|
+
F: __dxlog_file23,
|
|
5487
5551
|
L: 66,
|
|
5488
5552
|
S: this,
|
|
5489
5553
|
C: (f, a) => f(...a)
|
|
@@ -5491,7 +5555,7 @@ var WorkerRuntime = class {
|
|
|
5491
5555
|
} catch (err) {
|
|
5492
5556
|
this._ready.wake(err);
|
|
5493
5557
|
import_log20.log.error("starting", err, {
|
|
5494
|
-
F:
|
|
5558
|
+
F: __dxlog_file23,
|
|
5495
5559
|
L: 69,
|
|
5496
5560
|
S: this,
|
|
5497
5561
|
C: (f, a) => f(...a)
|
|
@@ -5525,7 +5589,7 @@ var WorkerRuntime = class {
|
|
|
5525
5589
|
*/
|
|
5526
5590
|
_reconnectWebrtc() {
|
|
5527
5591
|
(0, import_log20.log)("reconnecting webrtc...", void 0, {
|
|
5528
|
-
F:
|
|
5592
|
+
F: __dxlog_file23,
|
|
5529
5593
|
L: 106,
|
|
5530
5594
|
S: this,
|
|
5531
5595
|
C: (f, a) => f(...a)
|