@dxos/client-services 0.3.2-main.648180e → 0.3.2-main.988f99c
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-3GWSYNJC.mjs} +141 -69
- package/dist/lib/browser/chunk-3GWSYNJC.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 +200 -128
- 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 +174 -102
- 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 +5 -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")
|
|
@@ -540,6 +542,14 @@ var Identity = class Identity2 {
|
|
|
540
542
|
this._signer = signer;
|
|
541
543
|
this.identityKey = identityKey;
|
|
542
544
|
this.deviceKey = deviceKey;
|
|
545
|
+
import_log2.log.trace("dxos.halo.device", {
|
|
546
|
+
deviceKey
|
|
547
|
+
}, {
|
|
548
|
+
F: __dxlog_file2,
|
|
549
|
+
L: 60,
|
|
550
|
+
S: this,
|
|
551
|
+
C: (f, a) => f(...a)
|
|
552
|
+
});
|
|
543
553
|
this._deviceStateMachine = new import_credentials2.DeviceStateMachine({
|
|
544
554
|
identityKey: this.identityKey,
|
|
545
555
|
deviceKey: this.deviceKey,
|
|
@@ -550,7 +560,7 @@ var Identity = class Identity2 {
|
|
|
550
560
|
onUpdate: () => this.stateUpdate.emit()
|
|
551
561
|
});
|
|
552
562
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
553
|
-
trustedKeysProvider: () => this.authorizedDeviceKeys,
|
|
563
|
+
trustedKeysProvider: () => new import_util2.ComplexSet(import_keys4.PublicKey.hash, this.authorizedDeviceKeys.keys()),
|
|
554
564
|
update: this.stateUpdate,
|
|
555
565
|
authTimeout: import_client_protocol.AUTH_TIMEOUT
|
|
556
566
|
});
|
|
@@ -608,7 +618,7 @@ var Identity = class Identity2 {
|
|
|
608
618
|
getIdentityCredentialSigner() {
|
|
609
619
|
(0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
610
620
|
F: __dxlog_file2,
|
|
611
|
-
L:
|
|
621
|
+
L: 141,
|
|
612
622
|
S: this,
|
|
613
623
|
A: [
|
|
614
624
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -632,7 +642,7 @@ var Identity = class Identity2 {
|
|
|
632
642
|
dataFeedKey
|
|
633
643
|
}, {
|
|
634
644
|
F: __dxlog_file2,
|
|
635
|
-
L:
|
|
645
|
+
L: 157,
|
|
636
646
|
S: this,
|
|
637
647
|
C: (f, a) => f(...a)
|
|
638
648
|
});
|
|
@@ -688,13 +698,13 @@ var import_async6 = require("@dxos/async");
|
|
|
688
698
|
var import_context3 = require("@dxos/context");
|
|
689
699
|
var import_credentials4 = require("@dxos/credentials");
|
|
690
700
|
var import_invariant2 = require("@dxos/invariant");
|
|
691
|
-
var
|
|
701
|
+
var import_keys5 = require("@dxos/keys");
|
|
692
702
|
var import_log3 = require("@dxos/log");
|
|
693
703
|
var import_protocols2 = require("@dxos/protocols");
|
|
694
704
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
695
705
|
var import_timeframe = require("@dxos/timeframe");
|
|
696
706
|
var import_tracing2 = require("@dxos/tracing");
|
|
697
|
-
var
|
|
707
|
+
var import_util3 = require("@dxos/util");
|
|
698
708
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
699
709
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
700
710
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -720,7 +730,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
720
730
|
return this._identity;
|
|
721
731
|
}
|
|
722
732
|
async open(ctx) {
|
|
723
|
-
const traceId =
|
|
733
|
+
const traceId = import_keys5.PublicKey.random().toHex();
|
|
724
734
|
import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.begin({
|
|
725
735
|
id: traceId
|
|
726
736
|
}), {
|
|
@@ -950,10 +960,51 @@ var IdentityManager = class IdentityManager2 {
|
|
|
950
960
|
this.stateUpdate.emit();
|
|
951
961
|
return profile;
|
|
952
962
|
}
|
|
963
|
+
async updateDevice({ deviceKey, profile }) {
|
|
964
|
+
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
965
|
+
F: __dxlog_file3,
|
|
966
|
+
L: 216,
|
|
967
|
+
S: this,
|
|
968
|
+
A: [
|
|
969
|
+
"this._identity",
|
|
970
|
+
"'Identity not initialized.'"
|
|
971
|
+
]
|
|
972
|
+
});
|
|
973
|
+
(0, import_invariant2.invariant)(this._identity.authorizedDeviceKeys.has(deviceKey), "Device not authorized.", {
|
|
974
|
+
F: __dxlog_file3,
|
|
975
|
+
L: 218,
|
|
976
|
+
S: this,
|
|
977
|
+
A: [
|
|
978
|
+
"this._identity.authorizedDeviceKeys.has(deviceKey)",
|
|
979
|
+
"'Device not authorized.'"
|
|
980
|
+
]
|
|
981
|
+
});
|
|
982
|
+
const credential = await this._identity.getIdentityCredentialSigner().createCredential({
|
|
983
|
+
subject: this._identity.identityKey,
|
|
984
|
+
assertion: {
|
|
985
|
+
"@type": "dxos.halo.credentials.DeviceProfile",
|
|
986
|
+
deviceKey,
|
|
987
|
+
profile
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
const receipt = await this._identity.controlPipeline.writer.write({
|
|
991
|
+
credential: {
|
|
992
|
+
credential
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
996
|
+
[
|
|
997
|
+
receipt.feedKey,
|
|
998
|
+
receipt.seq
|
|
999
|
+
]
|
|
1000
|
+
]));
|
|
1001
|
+
this.stateUpdate.emit();
|
|
1002
|
+
return profile;
|
|
1003
|
+
}
|
|
953
1004
|
async _constructIdentity(identityRecord) {
|
|
954
1005
|
(0, import_invariant2.invariant)(!this._identity, void 0, {
|
|
955
1006
|
F: __dxlog_file3,
|
|
956
|
-
L:
|
|
1007
|
+
L: 236,
|
|
957
1008
|
S: this,
|
|
958
1009
|
A: [
|
|
959
1010
|
"!this._identity",
|
|
@@ -964,13 +1015,13 @@ var IdentityManager = class IdentityManager2 {
|
|
|
964
1015
|
identityRecord
|
|
965
1016
|
}, {
|
|
966
1017
|
F: __dxlog_file3,
|
|
967
|
-
L:
|
|
1018
|
+
L: 237,
|
|
968
1019
|
S: this,
|
|
969
1020
|
C: (f, a) => f(...a)
|
|
970
1021
|
});
|
|
971
1022
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
972
1023
|
F: __dxlog_file3,
|
|
973
|
-
L:
|
|
1024
|
+
L: 240,
|
|
974
1025
|
S: this,
|
|
975
1026
|
A: [
|
|
976
1027
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -982,7 +1033,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
982
1033
|
});
|
|
983
1034
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
984
1035
|
F: __dxlog_file3,
|
|
985
|
-
L:
|
|
1036
|
+
L: 244,
|
|
986
1037
|
S: this,
|
|
987
1038
|
A: [
|
|
988
1039
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -998,7 +1049,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
998
1049
|
swarmIdentity: {
|
|
999
1050
|
peerKey: identityRecord.deviceKey,
|
|
1000
1051
|
credentialProvider: createAuthProvider((0, import_credentials4.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
|
|
1001
|
-
credentialAuthenticator: (0,
|
|
1052
|
+
credentialAuthenticator: (0, import_util3.deferFunction)(() => identity.authVerifier.verifier)
|
|
1002
1053
|
},
|
|
1003
1054
|
identityKey: identityRecord.identityKey
|
|
1004
1055
|
});
|
|
@@ -1014,7 +1065,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
1014
1065
|
identityKey: identityRecord.identityKey
|
|
1015
1066
|
}, {
|
|
1016
1067
|
F: __dxlog_file3,
|
|
1017
|
-
L:
|
|
1068
|
+
L: 268,
|
|
1018
1069
|
S: this,
|
|
1019
1070
|
C: (f, a) => f(...a)
|
|
1020
1071
|
});
|
|
@@ -1035,7 +1086,7 @@ var IdentityManager = class IdentityManager2 {
|
|
|
1035
1086
|
onAuthFailure: () => {
|
|
1036
1087
|
import_log3.log.warn("auth failure", void 0, {
|
|
1037
1088
|
F: __dxlog_file3,
|
|
1038
|
-
L:
|
|
1089
|
+
L: 287,
|
|
1039
1090
|
S: this,
|
|
1040
1091
|
C: (f, a) => f(...a)
|
|
1041
1092
|
});
|
|
@@ -1220,7 +1271,7 @@ var import_client_protocol2 = require("@dxos/client-protocol");
|
|
|
1220
1271
|
var import_context5 = require("@dxos/context");
|
|
1221
1272
|
var import_credentials7 = require("@dxos/credentials");
|
|
1222
1273
|
var import_invariant6 = require("@dxos/invariant");
|
|
1223
|
-
var
|
|
1274
|
+
var import_keys7 = require("@dxos/keys");
|
|
1224
1275
|
var import_log5 = require("@dxos/log");
|
|
1225
1276
|
var import_network_manager = require("@dxos/network-manager");
|
|
1226
1277
|
var import_protocols4 = require("@dxos/protocols");
|
|
@@ -1231,7 +1282,7 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
|
|
|
1231
1282
|
var import_async7 = require("@dxos/async");
|
|
1232
1283
|
var import_context4 = require("@dxos/context");
|
|
1233
1284
|
var import_invariant5 = require("@dxos/invariant");
|
|
1234
|
-
var
|
|
1285
|
+
var import_keys6 = require("@dxos/keys");
|
|
1235
1286
|
var import_log4 = require("@dxos/log");
|
|
1236
1287
|
var import_protocols3 = require("@dxos/protocols");
|
|
1237
1288
|
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -1279,7 +1330,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1279
1330
|
},
|
|
1280
1331
|
introduce: async (request) => {
|
|
1281
1332
|
const { profile, invitationId } = request;
|
|
1282
|
-
const traceId =
|
|
1333
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1283
1334
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
|
|
1284
1335
|
id: traceId
|
|
1285
1336
|
}), {
|
|
@@ -1331,7 +1382,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1331
1382
|
};
|
|
1332
1383
|
},
|
|
1333
1384
|
authenticate: async ({ authCode: code }) => {
|
|
1334
|
-
const traceId =
|
|
1385
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1335
1386
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
|
|
1336
1387
|
id: traceId
|
|
1337
1388
|
}), {
|
|
@@ -1411,7 +1462,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1411
1462
|
};
|
|
1412
1463
|
},
|
|
1413
1464
|
admit: async (request) => {
|
|
1414
|
-
const traceId =
|
|
1465
|
+
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1415
1466
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
|
|
1416
1467
|
id: traceId
|
|
1417
1468
|
}), {
|
|
@@ -1577,7 +1628,7 @@ var InvitationsHandler = class {
|
|
|
1577
1628
|
this._networkManager = _networkManager;
|
|
1578
1629
|
}
|
|
1579
1630
|
createInvitation(protocol, options) {
|
|
1580
|
-
const { invitationId =
|
|
1631
|
+
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
1632
|
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1582
1633
|
(0, import_invariant6.invariant)(protocol, void 0, {
|
|
1583
1634
|
F: __dxlog_file7,
|
|
@@ -1652,7 +1703,7 @@ var InvitationsHandler = class {
|
|
|
1652
1703
|
},
|
|
1653
1704
|
onOpen: () => {
|
|
1654
1705
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
1655
|
-
const traceId =
|
|
1706
|
+
const traceId = import_keys7.PublicKey.random().toHex();
|
|
1656
1707
|
try {
|
|
1657
1708
|
import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
1658
1709
|
id: traceId
|
|
@@ -1885,7 +1936,7 @@ var InvitationsHandler = class {
|
|
|
1885
1936
|
}
|
|
1886
1937
|
});
|
|
1887
1938
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
1888
|
-
const traceId =
|
|
1939
|
+
const traceId = import_keys7.PublicKey.random().toHex();
|
|
1889
1940
|
try {
|
|
1890
1941
|
import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
1891
1942
|
id: traceId
|
|
@@ -2092,7 +2143,7 @@ var InvitationsHandler = class {
|
|
|
2092
2143
|
const topic = invitation.swarmKey;
|
|
2093
2144
|
const swarmConnection = await this._networkManager.joinSwarm({
|
|
2094
2145
|
topic,
|
|
2095
|
-
peerId:
|
|
2146
|
+
peerId: import_keys7.PublicKey.random(),
|
|
2096
2147
|
protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
|
|
2097
2148
|
teleport.addExtension("dxos.halo.invitations", createExtension());
|
|
2098
2149
|
}),
|
|
@@ -2557,7 +2608,7 @@ var getPlatform = () => {
|
|
|
2557
2608
|
};
|
|
2558
2609
|
|
|
2559
2610
|
// packages/sdk/client-services/src/version.ts
|
|
2560
|
-
var DXOS_VERSION = "0.3.2-main.
|
|
2611
|
+
var DXOS_VERSION = "0.3.2-main.988f99c";
|
|
2561
2612
|
|
|
2562
2613
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2563
2614
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -2686,25 +2737,25 @@ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
|
2686
2737
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
2687
2738
|
var import_invariant13 = require("@dxos/invariant");
|
|
2688
2739
|
var import_keyring = require("@dxos/keyring");
|
|
2689
|
-
var
|
|
2740
|
+
var import_keys11 = require("@dxos/keys");
|
|
2690
2741
|
var import_log13 = require("@dxos/log");
|
|
2691
2742
|
var import_protocols10 = require("@dxos/protocols");
|
|
2692
2743
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2693
2744
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
2694
2745
|
var import_tracing4 = require("@dxos/tracing");
|
|
2695
|
-
var
|
|
2746
|
+
var import_util7 = require("@dxos/util");
|
|
2696
2747
|
|
|
2697
2748
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2698
2749
|
var import_async12 = require("@dxos/async");
|
|
2699
2750
|
var import_context8 = require("@dxos/context");
|
|
2700
2751
|
var import_credentials13 = require("@dxos/credentials");
|
|
2701
2752
|
var import_invariant11 = require("@dxos/invariant");
|
|
2702
|
-
var
|
|
2753
|
+
var import_keys10 = require("@dxos/keys");
|
|
2703
2754
|
var import_log11 = require("@dxos/log");
|
|
2704
2755
|
var import_protocols8 = require("@dxos/protocols");
|
|
2705
2756
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2706
2757
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
2707
|
-
var
|
|
2758
|
+
var import_util6 = require("@dxos/util");
|
|
2708
2759
|
|
|
2709
2760
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2710
2761
|
var import_async11 = require("@dxos/async");
|
|
@@ -2712,24 +2763,24 @@ var import_client_protocol3 = require("@dxos/client-protocol");
|
|
|
2712
2763
|
var import_context7 = require("@dxos/context");
|
|
2713
2764
|
var import_debug4 = require("@dxos/debug");
|
|
2714
2765
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
2715
|
-
var
|
|
2766
|
+
var import_keys9 = require("@dxos/keys");
|
|
2716
2767
|
var import_log10 = require("@dxos/log");
|
|
2717
2768
|
var import_protocols7 = require("@dxos/protocols");
|
|
2718
2769
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2719
2770
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2720
2771
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
2721
2772
|
var import_tracing3 = require("@dxos/tracing");
|
|
2722
|
-
var
|
|
2773
|
+
var import_util5 = require("@dxos/util");
|
|
2723
2774
|
|
|
2724
2775
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2725
2776
|
var import_async10 = require("@dxos/async");
|
|
2726
2777
|
var import_context6 = require("@dxos/context");
|
|
2727
2778
|
var import_invariant10 = require("@dxos/invariant");
|
|
2728
|
-
var
|
|
2779
|
+
var import_keys8 = require("@dxos/keys");
|
|
2729
2780
|
var import_log9 = require("@dxos/log");
|
|
2730
2781
|
var import_protocols6 = require("@dxos/protocols");
|
|
2731
2782
|
var import_teleport2 = require("@dxos/teleport");
|
|
2732
|
-
var
|
|
2783
|
+
var import_util4 = require("@dxos/util");
|
|
2733
2784
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
2734
2785
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
2735
2786
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
@@ -2740,8 +2791,8 @@ var NotarizationPlugin = class {
|
|
|
2740
2791
|
this._ctx = new import_context6.Context();
|
|
2741
2792
|
this._extensionOpened = new import_async10.Event();
|
|
2742
2793
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2743
|
-
this._processedCredentials = new
|
|
2744
|
-
this._processCredentialsTriggers = new
|
|
2794
|
+
this._processedCredentials = new import_util4.ComplexSet(import_keys8.PublicKey.hash);
|
|
2795
|
+
this._processCredentialsTriggers = new import_util4.ComplexMap(import_keys8.PublicKey.hash);
|
|
2745
2796
|
}
|
|
2746
2797
|
get hasWriter() {
|
|
2747
2798
|
return !!this._writer;
|
|
@@ -2903,7 +2954,7 @@ var NotarizationPlugin = class {
|
|
|
2903
2954
|
if (this._processedCredentials.has(id)) {
|
|
2904
2955
|
return;
|
|
2905
2956
|
}
|
|
2906
|
-
await (0,
|
|
2957
|
+
await (0, import_util4.entry)(this._processCredentialsTriggers, id).orInsert(new import_async10.Trigger()).value.wait();
|
|
2907
2958
|
}
|
|
2908
2959
|
/**
|
|
2909
2960
|
* Requests from other peers to notarize credentials.
|
|
@@ -3023,7 +3074,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3023
3074
|
this._signingContext = params.signingContext;
|
|
3024
3075
|
this._callbacks = params.callbacks ?? {};
|
|
3025
3076
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
3026
|
-
trustedKeysProvider: () => new
|
|
3077
|
+
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
3078
|
update: this._inner.stateUpdate,
|
|
3028
3079
|
authTimeout: import_client_protocol3.AUTH_TIMEOUT
|
|
3029
3080
|
});
|
|
@@ -3442,9 +3493,9 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3442
3493
|
this._feedStore = _feedStore;
|
|
3443
3494
|
this._ctx = new import_context8.Context();
|
|
3444
3495
|
this.updated = new import_async12.Event();
|
|
3445
|
-
this._spaces = new
|
|
3496
|
+
this._spaces = new import_util6.ComplexMap(import_keys10.PublicKey.hash);
|
|
3446
3497
|
this._isOpen = false;
|
|
3447
|
-
this._instanceId =
|
|
3498
|
+
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
3448
3499
|
}
|
|
3449
3500
|
// TODO(burdon): Remove.
|
|
3450
3501
|
get spaces() {
|
|
@@ -3473,7 +3524,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3473
3524
|
S: this,
|
|
3474
3525
|
C: (f, a) => f(...a)
|
|
3475
3526
|
});
|
|
3476
|
-
await (0,
|
|
3527
|
+
await (0, import_util6.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
3477
3528
|
try {
|
|
3478
3529
|
(0, import_log11.log)("load space", {
|
|
3479
3530
|
spaceMetadata
|
|
@@ -3655,7 +3706,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3655
3706
|
swarmIdentity: {
|
|
3656
3707
|
peerKey: this._signingContext.deviceKey,
|
|
3657
3708
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
3658
|
-
credentialAuthenticator: (0,
|
|
3709
|
+
credentialAuthenticator: (0, import_util6.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
3659
3710
|
},
|
|
3660
3711
|
onNetworkConnection: (session) => {
|
|
3661
3712
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
@@ -3995,7 +4046,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3995
4046
|
this.initialized = new import_async14.Trigger();
|
|
3996
4047
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
3997
4048
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
3998
|
-
this._instanceId =
|
|
4049
|
+
this._instanceId = import_keys11.PublicKey.random().toHex();
|
|
3999
4050
|
this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
|
|
4000
4051
|
this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4001
4052
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
@@ -4216,7 +4267,7 @@ _ts_decorate5([
|
|
|
4216
4267
|
import_tracing4.trace.span()
|
|
4217
4268
|
], ServiceContext.prototype, "_initialize", null);
|
|
4218
4269
|
ServiceContext = _ts_decorate5([
|
|
4219
|
-
(0,
|
|
4270
|
+
(0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
4220
4271
|
import_tracing4.trace.resource()
|
|
4221
4272
|
], ServiceContext);
|
|
4222
4273
|
|
|
@@ -4227,8 +4278,8 @@ var import_context10 = require("@dxos/context");
|
|
|
4227
4278
|
var import_document_model2 = require("@dxos/document-model");
|
|
4228
4279
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
4229
4280
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
4230
|
-
var
|
|
4231
|
-
var
|
|
4281
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
4282
|
+
var import_keys12 = require("@dxos/keys");
|
|
4232
4283
|
var import_log16 = require("@dxos/log");
|
|
4233
4284
|
var import_messaging = require("@dxos/messaging");
|
|
4234
4285
|
var import_model_factory = require("@dxos/model-factory");
|
|
@@ -4266,13 +4317,33 @@ var ServiceRegistry = class {
|
|
|
4266
4317
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
4267
4318
|
var import_async15 = require("@dxos/async");
|
|
4268
4319
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
4320
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
4269
4321
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4322
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4270
4323
|
var DevicesServiceImpl = class {
|
|
4271
4324
|
constructor(_identityManager) {
|
|
4272
4325
|
this._identityManager = _identityManager;
|
|
4273
4326
|
}
|
|
4274
|
-
updateDevice(
|
|
4275
|
-
|
|
4327
|
+
async updateDevice(profile) {
|
|
4328
|
+
(0, import_invariant14.invariant)(this._identityManager.identity, "Identity not initialized", {
|
|
4329
|
+
F: __dxlog_file16,
|
|
4330
|
+
L: 17,
|
|
4331
|
+
S: this,
|
|
4332
|
+
A: [
|
|
4333
|
+
"this._identityManager.identity",
|
|
4334
|
+
"'Identity not initialized'"
|
|
4335
|
+
]
|
|
4336
|
+
});
|
|
4337
|
+
const deviceKey = this._identityManager.identity.deviceKey;
|
|
4338
|
+
await this._identityManager.updateDevice({
|
|
4339
|
+
deviceKey,
|
|
4340
|
+
profile
|
|
4341
|
+
});
|
|
4342
|
+
return {
|
|
4343
|
+
deviceKey,
|
|
4344
|
+
kind: import_services11.DeviceKind.CURRENT,
|
|
4345
|
+
profile
|
|
4346
|
+
};
|
|
4276
4347
|
}
|
|
4277
4348
|
queryDevices() {
|
|
4278
4349
|
return new import_codec_protobuf12.Stream(({ next }) => {
|
|
@@ -4284,9 +4355,10 @@ var DevicesServiceImpl = class {
|
|
|
4284
4355
|
});
|
|
4285
4356
|
} else {
|
|
4286
4357
|
next({
|
|
4287
|
-
devices: Array.from(deviceKeys.
|
|
4358
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
|
|
4288
4359
|
deviceKey: key,
|
|
4289
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED
|
|
4360
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED,
|
|
4361
|
+
profile
|
|
4290
4362
|
}))
|
|
4291
4363
|
});
|
|
4292
4364
|
}
|
|
@@ -4307,7 +4379,7 @@ var DevicesServiceImpl = class {
|
|
|
4307
4379
|
};
|
|
4308
4380
|
|
|
4309
4381
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
4310
|
-
var
|
|
4382
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
4311
4383
|
var import_lock_file = require("@dxos/lock-file");
|
|
4312
4384
|
var import_log14 = require("@dxos/log");
|
|
4313
4385
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
@@ -4320,7 +4392,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4320
4392
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4321
4393
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4322
4394
|
}
|
|
4323
|
-
var
|
|
4395
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
4324
4396
|
var Lock = class {
|
|
4325
4397
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
4326
4398
|
this._lockPath = lockPath;
|
|
@@ -4332,7 +4404,7 @@ var Lock = class {
|
|
|
4332
4404
|
}
|
|
4333
4405
|
async acquire() {
|
|
4334
4406
|
(0, import_log14.log)("acquiring lock...", void 0, {
|
|
4335
|
-
F:
|
|
4407
|
+
F: __dxlog_file17,
|
|
4336
4408
|
L: 32,
|
|
4337
4409
|
S: this,
|
|
4338
4410
|
C: (f, a) => f(...a)
|
|
@@ -4340,7 +4412,7 @@ var Lock = class {
|
|
|
4340
4412
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
4341
4413
|
await this._onAcquire?.();
|
|
4342
4414
|
(0, import_log14.log)("acquired lock", void 0, {
|
|
4343
|
-
F:
|
|
4415
|
+
F: __dxlog_file17,
|
|
4344
4416
|
L: 37,
|
|
4345
4417
|
S: this,
|
|
4346
4418
|
C: (f, a) => f(...a)
|
|
@@ -4348,8 +4420,8 @@ var Lock = class {
|
|
|
4348
4420
|
}
|
|
4349
4421
|
async release() {
|
|
4350
4422
|
await this._onRelease?.();
|
|
4351
|
-
(0,
|
|
4352
|
-
F:
|
|
4423
|
+
(0, import_invariant15.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
4424
|
+
F: __dxlog_file17,
|
|
4353
4425
|
L: 42,
|
|
4354
4426
|
S: this,
|
|
4355
4427
|
A: [
|
|
@@ -4370,7 +4442,7 @@ var import_async16 = require("@dxos/async");
|
|
|
4370
4442
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
4371
4443
|
var import_log15 = require("@dxos/log");
|
|
4372
4444
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4373
|
-
var
|
|
4445
|
+
var import_util8 = require("@dxos/util");
|
|
4374
4446
|
var LoggingServiceImpl = class {
|
|
4375
4447
|
constructor() {
|
|
4376
4448
|
this._logs = new import_async16.Event();
|
|
@@ -4388,15 +4460,15 @@ var LoggingServiceImpl = class {
|
|
|
4388
4460
|
}
|
|
4389
4461
|
async controlMetrics({ reset, record }) {
|
|
4390
4462
|
if (reset) {
|
|
4391
|
-
|
|
4463
|
+
import_util8.tracer.clear();
|
|
4392
4464
|
}
|
|
4393
4465
|
if (record === true) {
|
|
4394
|
-
|
|
4466
|
+
import_util8.tracer.start();
|
|
4395
4467
|
} else if (record === false) {
|
|
4396
|
-
|
|
4468
|
+
import_util8.tracer.stop();
|
|
4397
4469
|
}
|
|
4398
4470
|
return {
|
|
4399
|
-
recording:
|
|
4471
|
+
recording: import_util8.tracer.recording
|
|
4400
4472
|
};
|
|
4401
4473
|
}
|
|
4402
4474
|
/**
|
|
@@ -4404,10 +4476,10 @@ var LoggingServiceImpl = class {
|
|
|
4404
4476
|
*/
|
|
4405
4477
|
queryMetrics({ interval = 5e3 }) {
|
|
4406
4478
|
const getNumericalValues = (key) => {
|
|
4407
|
-
const events =
|
|
4479
|
+
const events = import_util8.tracer.get(key) ?? [];
|
|
4408
4480
|
return {
|
|
4409
4481
|
key,
|
|
4410
|
-
stats: (0,
|
|
4482
|
+
stats: (0, import_util8.numericalValues)(events, "duration")
|
|
4411
4483
|
};
|
|
4412
4484
|
};
|
|
4413
4485
|
return new import_codec_protobuf13.Stream(({ next }) => {
|
|
@@ -4445,7 +4517,7 @@ var LoggingServiceImpl = class {
|
|
|
4445
4517
|
}
|
|
4446
4518
|
const record = {
|
|
4447
4519
|
...entry2,
|
|
4448
|
-
context: (0,
|
|
4520
|
+
context: (0, import_util8.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
|
|
4449
4521
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4450
4522
|
meta: {
|
|
4451
4523
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -4519,10 +4591,10 @@ var import_client_protocol4 = require("@dxos/client-protocol");
|
|
|
4519
4591
|
var import_protocols11 = require("@dxos/protocols");
|
|
4520
4592
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
4521
4593
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
4522
|
-
var
|
|
4594
|
+
var import_util9 = require("@dxos/util");
|
|
4523
4595
|
var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
4524
4596
|
var createStorageObjects = (config) => {
|
|
4525
|
-
const { persistent = false, keyStore, dataStore, dataRoot = (0,
|
|
4597
|
+
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util9.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4526
4598
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4527
4599
|
throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4528
4600
|
}
|
|
@@ -4566,7 +4638,7 @@ var toStorageType = (type) => {
|
|
|
4566
4638
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
4567
4639
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
4568
4640
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4569
|
-
var
|
|
4641
|
+
var import_util10 = require("@dxos/util");
|
|
4570
4642
|
var SystemServiceImpl = class {
|
|
4571
4643
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
4572
4644
|
this._config = config;
|
|
@@ -4586,7 +4658,7 @@ var SystemServiceImpl = class {
|
|
|
4586
4658
|
const diagnostics = await this._getDiagnostics();
|
|
4587
4659
|
return {
|
|
4588
4660
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4589
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
4661
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
|
|
4590
4662
|
truncate: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
4591
4663
|
humanize: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
4592
4664
|
})))
|
|
@@ -4628,7 +4700,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
4628
4700
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4629
4701
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4630
4702
|
}
|
|
4631
|
-
var
|
|
4703
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
4632
4704
|
var createDefaultModelFactory = () => {
|
|
4633
4705
|
return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
|
|
4634
4706
|
};
|
|
@@ -4728,8 +4800,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4728
4800
|
* Can only be called once.
|
|
4729
4801
|
*/
|
|
4730
4802
|
initialize({ config, ...options }) {
|
|
4731
|
-
(0,
|
|
4732
|
-
F:
|
|
4803
|
+
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
4804
|
+
F: __dxlog_file18,
|
|
4733
4805
|
L: 201,
|
|
4734
4806
|
S: this,
|
|
4735
4807
|
A: [
|
|
@@ -4738,14 +4810,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4738
4810
|
]
|
|
4739
4811
|
});
|
|
4740
4812
|
(0, import_log16.log)("initializing...", void 0, {
|
|
4741
|
-
F:
|
|
4813
|
+
F: __dxlog_file18,
|
|
4742
4814
|
L: 202,
|
|
4743
4815
|
S: this,
|
|
4744
4816
|
C: (f, a) => f(...a)
|
|
4745
4817
|
});
|
|
4746
4818
|
if (config) {
|
|
4747
|
-
(0,
|
|
4748
|
-
F:
|
|
4819
|
+
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
4820
|
+
F: __dxlog_file18,
|
|
4749
4821
|
L: 205,
|
|
4750
4822
|
S: this,
|
|
4751
4823
|
A: [
|
|
@@ -4762,8 +4834,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4762
4834
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4763
4835
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4764
4836
|
this._signalManager = signalManager;
|
|
4765
|
-
(0,
|
|
4766
|
-
F:
|
|
4837
|
+
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
4838
|
+
F: __dxlog_file18,
|
|
4767
4839
|
L: 221,
|
|
4768
4840
|
S: this,
|
|
4769
4841
|
A: [
|
|
@@ -4777,7 +4849,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4777
4849
|
signalManager
|
|
4778
4850
|
});
|
|
4779
4851
|
(0, import_log16.log)("initialized", void 0, {
|
|
4780
|
-
F:
|
|
4852
|
+
F: __dxlog_file18,
|
|
4781
4853
|
L: 228,
|
|
4782
4854
|
S: this,
|
|
4783
4855
|
C: (f, a) => f(...a)
|
|
@@ -4787,17 +4859,17 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4787
4859
|
if (this._open) {
|
|
4788
4860
|
return;
|
|
4789
4861
|
}
|
|
4790
|
-
const traceId =
|
|
4862
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
4791
4863
|
import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
|
|
4792
4864
|
id: traceId
|
|
4793
4865
|
}), {
|
|
4794
|
-
F:
|
|
4866
|
+
F: __dxlog_file18,
|
|
4795
4867
|
L: 239,
|
|
4796
4868
|
S: this,
|
|
4797
4869
|
C: (f, a) => f(...a)
|
|
4798
4870
|
});
|
|
4799
|
-
(0,
|
|
4800
|
-
F:
|
|
4871
|
+
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
4872
|
+
F: __dxlog_file18,
|
|
4801
4873
|
L: 241,
|
|
4802
4874
|
S: this,
|
|
4803
4875
|
A: [
|
|
@@ -4805,8 +4877,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4805
4877
|
"'config not set'"
|
|
4806
4878
|
]
|
|
4807
4879
|
});
|
|
4808
|
-
(0,
|
|
4809
|
-
F:
|
|
4880
|
+
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
4881
|
+
F: __dxlog_file18,
|
|
4810
4882
|
L: 242,
|
|
4811
4883
|
S: this,
|
|
4812
4884
|
A: [
|
|
@@ -4814,8 +4886,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4814
4886
|
"'storage not set'"
|
|
4815
4887
|
]
|
|
4816
4888
|
});
|
|
4817
|
-
(0,
|
|
4818
|
-
F:
|
|
4889
|
+
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
4890
|
+
F: __dxlog_file18,
|
|
4819
4891
|
L: 243,
|
|
4820
4892
|
S: this,
|
|
4821
4893
|
A: [
|
|
@@ -4823,8 +4895,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4823
4895
|
"'signal manager not set'"
|
|
4824
4896
|
]
|
|
4825
4897
|
});
|
|
4826
|
-
(0,
|
|
4827
|
-
F:
|
|
4898
|
+
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
4899
|
+
F: __dxlog_file18,
|
|
4828
4900
|
L: 244,
|
|
4829
4901
|
S: this,
|
|
4830
4902
|
A: [
|
|
@@ -4836,7 +4908,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4836
4908
|
(0, import_log16.log)("opening...", {
|
|
4837
4909
|
lockKey: this._resourceLock?.lockKey
|
|
4838
4910
|
}, {
|
|
4839
|
-
F:
|
|
4911
|
+
F: __dxlog_file18,
|
|
4840
4912
|
L: 247,
|
|
4841
4913
|
S: this,
|
|
4842
4914
|
C: (f, a) => f(...a)
|
|
@@ -4882,7 +4954,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4882
4954
|
(0, import_log16.log)("opened", {
|
|
4883
4955
|
deviceKey
|
|
4884
4956
|
}, {
|
|
4885
|
-
F:
|
|
4957
|
+
F: __dxlog_file18,
|
|
4886
4958
|
L: 316,
|
|
4887
4959
|
S: this,
|
|
4888
4960
|
C: (f, a) => f(...a)
|
|
@@ -4890,7 +4962,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4890
4962
|
import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
|
|
4891
4963
|
id: traceId
|
|
4892
4964
|
}), {
|
|
4893
|
-
F:
|
|
4965
|
+
F: __dxlog_file18,
|
|
4894
4966
|
L: 317,
|
|
4895
4967
|
S: this,
|
|
4896
4968
|
C: (f, a) => f(...a)
|
|
@@ -4904,7 +4976,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4904
4976
|
(0, import_log16.log)("closing...", {
|
|
4905
4977
|
deviceKey
|
|
4906
4978
|
}, {
|
|
4907
|
-
F:
|
|
4979
|
+
F: __dxlog_file18,
|
|
4908
4980
|
L: 328,
|
|
4909
4981
|
S: this,
|
|
4910
4982
|
C: (f, a) => f(...a)
|
|
@@ -4920,24 +4992,24 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4920
4992
|
(0, import_log16.log)("closed", {
|
|
4921
4993
|
deviceKey
|
|
4922
4994
|
}, {
|
|
4923
|
-
F:
|
|
4995
|
+
F: __dxlog_file18,
|
|
4924
4996
|
L: 335,
|
|
4925
4997
|
S: this,
|
|
4926
4998
|
C: (f, a) => f(...a)
|
|
4927
4999
|
});
|
|
4928
5000
|
}
|
|
4929
5001
|
async reset() {
|
|
4930
|
-
const traceId =
|
|
5002
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
4931
5003
|
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
|
|
4932
5004
|
id: traceId
|
|
4933
5005
|
}), {
|
|
4934
|
-
F:
|
|
5006
|
+
F: __dxlog_file18,
|
|
4935
5007
|
L: 340,
|
|
4936
5008
|
S: this,
|
|
4937
5009
|
C: (f, a) => f(...a)
|
|
4938
5010
|
});
|
|
4939
5011
|
(0, import_log16.log)("resetting...", void 0, {
|
|
4940
|
-
F:
|
|
5012
|
+
F: __dxlog_file18,
|
|
4941
5013
|
L: 342,
|
|
4942
5014
|
S: this,
|
|
4943
5015
|
C: (f, a) => f(...a)
|
|
@@ -4945,7 +5017,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4945
5017
|
await this._serviceContext?.close();
|
|
4946
5018
|
await this._storage.reset();
|
|
4947
5019
|
(0, import_log16.log)("reset", void 0, {
|
|
4948
|
-
F:
|
|
5020
|
+
F: __dxlog_file18,
|
|
4949
5021
|
L: 345,
|
|
4950
5022
|
S: this,
|
|
4951
5023
|
C: (f, a) => f(...a)
|
|
@@ -4953,7 +5025,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4953
5025
|
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
|
|
4954
5026
|
id: traceId
|
|
4955
5027
|
}), {
|
|
4956
|
-
F:
|
|
5028
|
+
F: __dxlog_file18,
|
|
4957
5029
|
L: 346,
|
|
4958
5030
|
S: this,
|
|
4959
5031
|
C: (f, a) => f(...a)
|
|
@@ -5005,15 +5077,15 @@ var import_context11 = require("@dxos/context");
|
|
|
5005
5077
|
var import_log17 = require("@dxos/log");
|
|
5006
5078
|
var import_messaging2 = require("@dxos/messaging");
|
|
5007
5079
|
var import_network_manager3 = require("@dxos/network-manager");
|
|
5008
|
-
var
|
|
5080
|
+
var import_util11 = require("@dxos/util");
|
|
5009
5081
|
|
|
5010
5082
|
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
5011
5083
|
var import_async18 = require("@dxos/async");
|
|
5012
5084
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
5013
|
-
var
|
|
5085
|
+
var import_invariant17 = require("@dxos/invariant");
|
|
5014
5086
|
var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
|
|
5015
5087
|
var import_rpc2 = require("@dxos/rpc");
|
|
5016
|
-
var
|
|
5088
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
|
|
5017
5089
|
var ShellRuntimeImpl = class {
|
|
5018
5090
|
constructor(_port) {
|
|
5019
5091
|
this._port = _port;
|
|
@@ -5040,8 +5112,8 @@ var ShellRuntimeImpl = class {
|
|
|
5040
5112
|
});
|
|
5041
5113
|
}
|
|
5042
5114
|
async setAppContext(context) {
|
|
5043
|
-
(0,
|
|
5044
|
-
F:
|
|
5115
|
+
(0, import_invariant17.invariant)(this._appRpc, "runtime not open", {
|
|
5116
|
+
F: __dxlog_file19,
|
|
5045
5117
|
L: 44,
|
|
5046
5118
|
S: this,
|
|
5047
5119
|
A: [
|
|
@@ -5086,7 +5158,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
5086
5158
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5087
5159
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5088
5160
|
}
|
|
5089
|
-
var
|
|
5161
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
|
|
5090
5162
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
5091
5163
|
var IFrameHostRuntime = class {
|
|
5092
5164
|
constructor({ config, origin, appPort, shellPort }) {
|
|
@@ -5107,13 +5179,13 @@ var IFrameHostRuntime = class {
|
|
|
5107
5179
|
}
|
|
5108
5180
|
async start() {
|
|
5109
5181
|
(0, import_log17.log)("starting...", void 0, {
|
|
5110
|
-
F:
|
|
5182
|
+
F: __dxlog_file20,
|
|
5111
5183
|
L: 71,
|
|
5112
5184
|
S: this,
|
|
5113
5185
|
C: (f, a) => f(...a)
|
|
5114
5186
|
});
|
|
5115
5187
|
try {
|
|
5116
|
-
this._config = await (0,
|
|
5188
|
+
this._config = await (0, import_util11.getAsyncValue)(this._configProvider);
|
|
5117
5189
|
this._transportFactory = (0, import_network_manager3.createSimplePeerTransportFactory)({
|
|
5118
5190
|
iceServers: this._config.get("runtime.services.ice")
|
|
5119
5191
|
});
|
|
@@ -5156,7 +5228,7 @@ var IFrameHostRuntime = class {
|
|
|
5156
5228
|
]);
|
|
5157
5229
|
this._ready.wake(void 0);
|
|
5158
5230
|
(0, import_log17.log)("started", void 0, {
|
|
5159
|
-
F:
|
|
5231
|
+
F: __dxlog_file20,
|
|
5160
5232
|
L: 114,
|
|
5161
5233
|
S: this,
|
|
5162
5234
|
C: (f, a) => f(...a)
|
|
@@ -5164,7 +5236,7 @@ var IFrameHostRuntime = class {
|
|
|
5164
5236
|
} catch (err) {
|
|
5165
5237
|
this._ready.wake(err);
|
|
5166
5238
|
import_log17.log.catch(err, void 0, {
|
|
5167
|
-
F:
|
|
5239
|
+
F: __dxlog_file20,
|
|
5168
5240
|
L: 117,
|
|
5169
5241
|
S: this,
|
|
5170
5242
|
C: (f, a) => f(...a)
|
|
@@ -5173,7 +5245,7 @@ var IFrameHostRuntime = class {
|
|
|
5173
5245
|
}
|
|
5174
5246
|
async stop() {
|
|
5175
5247
|
(0, import_log17.log)("stopping...", void 0, {
|
|
5176
|
-
F:
|
|
5248
|
+
F: __dxlog_file20,
|
|
5177
5249
|
L: 122,
|
|
5178
5250
|
S: this,
|
|
5179
5251
|
C: (f, a) => f(...a)
|
|
@@ -5182,7 +5254,7 @@ var IFrameHostRuntime = class {
|
|
|
5182
5254
|
await this._clientServices.close();
|
|
5183
5255
|
await this._shellRuntime?.close();
|
|
5184
5256
|
(0, import_log17.log)("stopped", void 0, {
|
|
5185
|
-
F:
|
|
5257
|
+
F: __dxlog_file20,
|
|
5186
5258
|
L: 126,
|
|
5187
5259
|
S: this,
|
|
5188
5260
|
C: (f, a) => f(...a)
|
|
@@ -5200,8 +5272,8 @@ var import_log18 = require("@dxos/log");
|
|
|
5200
5272
|
var import_network_manager4 = require("@dxos/network-manager");
|
|
5201
5273
|
var import_protocols13 = require("@dxos/protocols");
|
|
5202
5274
|
var import_rpc3 = require("@dxos/rpc");
|
|
5203
|
-
var
|
|
5204
|
-
var
|
|
5275
|
+
var import_util12 = require("@dxos/util");
|
|
5276
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
|
|
5205
5277
|
var IFrameProxyRuntime = class {
|
|
5206
5278
|
constructor({ config, systemPort, shellPort }) {
|
|
5207
5279
|
this._id = String(Math.floor(Math.random() * 1e6));
|
|
@@ -5217,7 +5289,7 @@ var IFrameProxyRuntime = class {
|
|
|
5217
5289
|
return this._shellRuntime;
|
|
5218
5290
|
}
|
|
5219
5291
|
async open(origin) {
|
|
5220
|
-
this._config = await (0,
|
|
5292
|
+
this._config = await (0, import_util12.getAsyncValue)(this._configProvider);
|
|
5221
5293
|
this._transportService = new import_network_manager4.SimplePeerTransportService({
|
|
5222
5294
|
iceServers: this._config.get("runtime.services.ice")
|
|
5223
5295
|
});
|
|
@@ -5249,7 +5321,7 @@ var IFrameProxyRuntime = class {
|
|
|
5249
5321
|
});
|
|
5250
5322
|
} catch (err) {
|
|
5251
5323
|
import_log18.log.catch(err, void 0, {
|
|
5252
|
-
F:
|
|
5324
|
+
F: __dxlog_file21,
|
|
5253
5325
|
L: 85,
|
|
5254
5326
|
S: this,
|
|
5255
5327
|
C: (f, a) => f(...a)
|
|
@@ -5279,10 +5351,10 @@ var import_network_manager5 = require("@dxos/network-manager");
|
|
|
5279
5351
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
5280
5352
|
var import_async21 = require("@dxos/async");
|
|
5281
5353
|
var import_client_protocol9 = require("@dxos/client-protocol");
|
|
5282
|
-
var
|
|
5354
|
+
var import_invariant18 = require("@dxos/invariant");
|
|
5283
5355
|
var import_log19 = require("@dxos/log");
|
|
5284
5356
|
var import_rpc4 = require("@dxos/rpc");
|
|
5285
|
-
var
|
|
5357
|
+
var import_util13 = require("@dxos/util");
|
|
5286
5358
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
5287
5359
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5288
5360
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -5293,13 +5365,13 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
5293
5365
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5294
5366
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5295
5367
|
}
|
|
5296
|
-
var
|
|
5368
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
|
|
5297
5369
|
var WorkerSession = class {
|
|
5298
5370
|
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
|
|
5299
5371
|
this._startTrigger = new import_async21.Trigger();
|
|
5300
|
-
this.onClose = new
|
|
5301
|
-
(0,
|
|
5302
|
-
F:
|
|
5372
|
+
this.onClose = new import_util13.Callback();
|
|
5373
|
+
(0, import_invariant18.invariant)(serviceHost, void 0, {
|
|
5374
|
+
F: __dxlog_file22,
|
|
5303
5375
|
L: 49,
|
|
5304
5376
|
S: this,
|
|
5305
5377
|
A: [
|
|
@@ -5354,7 +5426,7 @@ var WorkerSession = class {
|
|
|
5354
5426
|
await this.close();
|
|
5355
5427
|
} catch (err) {
|
|
5356
5428
|
import_log19.log.catch(err, void 0, {
|
|
5357
|
-
F:
|
|
5429
|
+
F: __dxlog_file22,
|
|
5358
5430
|
L: 99,
|
|
5359
5431
|
S: this,
|
|
5360
5432
|
C: (f, a) => f(...a)
|
|
@@ -5371,7 +5443,7 @@ var WorkerSession = class {
|
|
|
5371
5443
|
}
|
|
5372
5444
|
async open() {
|
|
5373
5445
|
import_log19.log.info("opening...", void 0, {
|
|
5374
|
-
F:
|
|
5446
|
+
F: __dxlog_file22,
|
|
5375
5447
|
L: 113,
|
|
5376
5448
|
S: this,
|
|
5377
5449
|
C: (f, a) => f(...a)
|
|
@@ -5388,7 +5460,7 @@ var WorkerSession = class {
|
|
|
5388
5460
|
void this._afterLockReleases(this.lockKey, () => this.close());
|
|
5389
5461
|
}
|
|
5390
5462
|
import_log19.log.info("opened", void 0, {
|
|
5391
|
-
F:
|
|
5463
|
+
F: __dxlog_file22,
|
|
5392
5464
|
L: 124,
|
|
5393
5465
|
S: this,
|
|
5394
5466
|
C: (f, a) => f(...a)
|
|
@@ -5396,7 +5468,7 @@ var WorkerSession = class {
|
|
|
5396
5468
|
}
|
|
5397
5469
|
async close() {
|
|
5398
5470
|
import_log19.log.info("closing...", void 0, {
|
|
5399
|
-
F:
|
|
5471
|
+
F: __dxlog_file22,
|
|
5400
5472
|
L: 128,
|
|
5401
5473
|
S: this,
|
|
5402
5474
|
C: (f, a) => f(...a)
|
|
@@ -5405,7 +5477,7 @@ var WorkerSession = class {
|
|
|
5405
5477
|
await this.onClose.callIfSet();
|
|
5406
5478
|
} catch (err) {
|
|
5407
5479
|
import_log19.log.catch(err, void 0, {
|
|
5408
|
-
F:
|
|
5480
|
+
F: __dxlog_file22,
|
|
5409
5481
|
L: 132,
|
|
5410
5482
|
S: this,
|
|
5411
5483
|
C: (f, a) => f(...a)
|
|
@@ -5416,7 +5488,7 @@ var WorkerSession = class {
|
|
|
5416
5488
|
this._iframeRpc.close()
|
|
5417
5489
|
]);
|
|
5418
5490
|
import_log19.log.info("closed", void 0, {
|
|
5419
|
-
F:
|
|
5491
|
+
F: __dxlog_file22,
|
|
5420
5492
|
L: 136,
|
|
5421
5493
|
S: this,
|
|
5422
5494
|
C: (f, a) => f(...a)
|
|
@@ -5427,7 +5499,7 @@ var WorkerSession = class {
|
|
|
5427
5499
|
await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
5428
5500
|
} catch {
|
|
5429
5501
|
import_log19.log.info("No shell connected.", void 0, {
|
|
5430
|
-
F:
|
|
5502
|
+
F: __dxlog_file22,
|
|
5431
5503
|
L: 143,
|
|
5432
5504
|
S: this,
|
|
5433
5505
|
C: (f, a) => f(...a)
|
|
@@ -5447,7 +5519,7 @@ _ts_decorate9([
|
|
|
5447
5519
|
], WorkerSession.prototype, "lockKey", void 0);
|
|
5448
5520
|
|
|
5449
5521
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
5450
|
-
var
|
|
5522
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
|
|
5451
5523
|
var WorkerRuntime = class {
|
|
5452
5524
|
constructor(_configProvider) {
|
|
5453
5525
|
this._configProvider = _configProvider;
|
|
@@ -5467,7 +5539,7 @@ var WorkerRuntime = class {
|
|
|
5467
5539
|
}
|
|
5468
5540
|
async start() {
|
|
5469
5541
|
(0, import_log20.log)("starting...", void 0, {
|
|
5470
|
-
F:
|
|
5542
|
+
F: __dxlog_file23,
|
|
5471
5543
|
L: 52,
|
|
5472
5544
|
S: this,
|
|
5473
5545
|
C: (f, a) => f(...a)
|
|
@@ -5483,7 +5555,7 @@ var WorkerRuntime = class {
|
|
|
5483
5555
|
await this._clientServices.open(new import_context12.Context());
|
|
5484
5556
|
this._ready.wake(void 0);
|
|
5485
5557
|
(0, import_log20.log)("started", void 0, {
|
|
5486
|
-
F:
|
|
5558
|
+
F: __dxlog_file23,
|
|
5487
5559
|
L: 66,
|
|
5488
5560
|
S: this,
|
|
5489
5561
|
C: (f, a) => f(...a)
|
|
@@ -5491,7 +5563,7 @@ var WorkerRuntime = class {
|
|
|
5491
5563
|
} catch (err) {
|
|
5492
5564
|
this._ready.wake(err);
|
|
5493
5565
|
import_log20.log.error("starting", err, {
|
|
5494
|
-
F:
|
|
5566
|
+
F: __dxlog_file23,
|
|
5495
5567
|
L: 69,
|
|
5496
5568
|
S: this,
|
|
5497
5569
|
C: (f, a) => f(...a)
|
|
@@ -5525,7 +5597,7 @@ var WorkerRuntime = class {
|
|
|
5525
5597
|
*/
|
|
5526
5598
|
_reconnectWebrtc() {
|
|
5527
5599
|
(0, import_log20.log)("reconnecting webrtc...", void 0, {
|
|
5528
|
-
F:
|
|
5600
|
+
F: __dxlog_file23,
|
|
5529
5601
|
L: 106,
|
|
5530
5602
|
S: this,
|
|
5531
5603
|
C: (f, a) => f(...a)
|