@dxos/client-services 0.3.2-main.4164ba3 → 0.3.2-main.428886c
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-TI3I2ZZI.mjs → chunk-7ILC5J66.mjs} +141 -78
- package/dist/lib/browser/chunk-7ILC5J66.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 -137
- 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 -111
- 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/packlets/invitations/invitations-service.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/packlets/invitations/invitations-service.ts +0 -2
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-TI3I2ZZI.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
|
}),
|
|
@@ -2249,15 +2300,6 @@ var InvitationsServiceImpl = class {
|
|
|
2249
2300
|
await accepted.cancel();
|
|
2250
2301
|
this._acceptInvitations.delete(invitationId);
|
|
2251
2302
|
this._removedAccepted.emit(accepted.get());
|
|
2252
|
-
} else {
|
|
2253
|
-
import_log6.log.warn("invalid invitation", {
|
|
2254
|
-
invitationId
|
|
2255
|
-
}, {
|
|
2256
|
-
F: __dxlog_file8,
|
|
2257
|
-
L: 132,
|
|
2258
|
-
S: this,
|
|
2259
|
-
C: (f, a) => f(...a)
|
|
2260
|
-
});
|
|
2261
2303
|
}
|
|
2262
2304
|
}
|
|
2263
2305
|
queryInvitations() {
|
|
@@ -2557,7 +2599,7 @@ var getPlatform = () => {
|
|
|
2557
2599
|
};
|
|
2558
2600
|
|
|
2559
2601
|
// packages/sdk/client-services/src/version.ts
|
|
2560
|
-
var DXOS_VERSION = "0.3.2-main.
|
|
2602
|
+
var DXOS_VERSION = "0.3.2-main.428886c";
|
|
2561
2603
|
|
|
2562
2604
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2563
2605
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -2686,25 +2728,25 @@ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
|
2686
2728
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
2687
2729
|
var import_invariant13 = require("@dxos/invariant");
|
|
2688
2730
|
var import_keyring = require("@dxos/keyring");
|
|
2689
|
-
var
|
|
2731
|
+
var import_keys11 = require("@dxos/keys");
|
|
2690
2732
|
var import_log13 = require("@dxos/log");
|
|
2691
2733
|
var import_protocols10 = require("@dxos/protocols");
|
|
2692
2734
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2693
2735
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
2694
2736
|
var import_tracing4 = require("@dxos/tracing");
|
|
2695
|
-
var
|
|
2737
|
+
var import_util7 = require("@dxos/util");
|
|
2696
2738
|
|
|
2697
2739
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2698
2740
|
var import_async12 = require("@dxos/async");
|
|
2699
2741
|
var import_context8 = require("@dxos/context");
|
|
2700
2742
|
var import_credentials13 = require("@dxos/credentials");
|
|
2701
2743
|
var import_invariant11 = require("@dxos/invariant");
|
|
2702
|
-
var
|
|
2744
|
+
var import_keys10 = require("@dxos/keys");
|
|
2703
2745
|
var import_log11 = require("@dxos/log");
|
|
2704
2746
|
var import_protocols8 = require("@dxos/protocols");
|
|
2705
2747
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2706
2748
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
2707
|
-
var
|
|
2749
|
+
var import_util6 = require("@dxos/util");
|
|
2708
2750
|
|
|
2709
2751
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2710
2752
|
var import_async11 = require("@dxos/async");
|
|
@@ -2712,24 +2754,24 @@ var import_client_protocol3 = require("@dxos/client-protocol");
|
|
|
2712
2754
|
var import_context7 = require("@dxos/context");
|
|
2713
2755
|
var import_debug4 = require("@dxos/debug");
|
|
2714
2756
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
2715
|
-
var
|
|
2757
|
+
var import_keys9 = require("@dxos/keys");
|
|
2716
2758
|
var import_log10 = require("@dxos/log");
|
|
2717
2759
|
var import_protocols7 = require("@dxos/protocols");
|
|
2718
2760
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2719
2761
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2720
2762
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
2721
2763
|
var import_tracing3 = require("@dxos/tracing");
|
|
2722
|
-
var
|
|
2764
|
+
var import_util5 = require("@dxos/util");
|
|
2723
2765
|
|
|
2724
2766
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2725
2767
|
var import_async10 = require("@dxos/async");
|
|
2726
2768
|
var import_context6 = require("@dxos/context");
|
|
2727
2769
|
var import_invariant10 = require("@dxos/invariant");
|
|
2728
|
-
var
|
|
2770
|
+
var import_keys8 = require("@dxos/keys");
|
|
2729
2771
|
var import_log9 = require("@dxos/log");
|
|
2730
2772
|
var import_protocols6 = require("@dxos/protocols");
|
|
2731
2773
|
var import_teleport2 = require("@dxos/teleport");
|
|
2732
|
-
var
|
|
2774
|
+
var import_util4 = require("@dxos/util");
|
|
2733
2775
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
2734
2776
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
2735
2777
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
@@ -2740,8 +2782,8 @@ var NotarizationPlugin = class {
|
|
|
2740
2782
|
this._ctx = new import_context6.Context();
|
|
2741
2783
|
this._extensionOpened = new import_async10.Event();
|
|
2742
2784
|
this._extensions = /* @__PURE__ */ new Set();
|
|
2743
|
-
this._processedCredentials = new
|
|
2744
|
-
this._processCredentialsTriggers = new
|
|
2785
|
+
this._processedCredentials = new import_util4.ComplexSet(import_keys8.PublicKey.hash);
|
|
2786
|
+
this._processCredentialsTriggers = new import_util4.ComplexMap(import_keys8.PublicKey.hash);
|
|
2745
2787
|
}
|
|
2746
2788
|
get hasWriter() {
|
|
2747
2789
|
return !!this._writer;
|
|
@@ -2903,7 +2945,7 @@ var NotarizationPlugin = class {
|
|
|
2903
2945
|
if (this._processedCredentials.has(id)) {
|
|
2904
2946
|
return;
|
|
2905
2947
|
}
|
|
2906
|
-
await (0,
|
|
2948
|
+
await (0, import_util4.entry)(this._processCredentialsTriggers, id).orInsert(new import_async10.Trigger()).value.wait();
|
|
2907
2949
|
}
|
|
2908
2950
|
/**
|
|
2909
2951
|
* Requests from other peers to notarize credentials.
|
|
@@ -3023,7 +3065,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3023
3065
|
this._signingContext = params.signingContext;
|
|
3024
3066
|
this._callbacks = params.callbacks ?? {};
|
|
3025
3067
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
3026
|
-
trustedKeysProvider: () => new
|
|
3068
|
+
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
3069
|
update: this._inner.stateUpdate,
|
|
3028
3070
|
authTimeout: import_client_protocol3.AUTH_TIMEOUT
|
|
3029
3071
|
});
|
|
@@ -3442,9 +3484,9 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3442
3484
|
this._feedStore = _feedStore;
|
|
3443
3485
|
this._ctx = new import_context8.Context();
|
|
3444
3486
|
this.updated = new import_async12.Event();
|
|
3445
|
-
this._spaces = new
|
|
3487
|
+
this._spaces = new import_util6.ComplexMap(import_keys10.PublicKey.hash);
|
|
3446
3488
|
this._isOpen = false;
|
|
3447
|
-
this._instanceId =
|
|
3489
|
+
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
3448
3490
|
}
|
|
3449
3491
|
// TODO(burdon): Remove.
|
|
3450
3492
|
get spaces() {
|
|
@@ -3473,7 +3515,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3473
3515
|
S: this,
|
|
3474
3516
|
C: (f, a) => f(...a)
|
|
3475
3517
|
});
|
|
3476
|
-
await (0,
|
|
3518
|
+
await (0, import_util6.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
3477
3519
|
try {
|
|
3478
3520
|
(0, import_log11.log)("load space", {
|
|
3479
3521
|
spaceMetadata
|
|
@@ -3655,7 +3697,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3655
3697
|
swarmIdentity: {
|
|
3656
3698
|
peerKey: this._signingContext.deviceKey,
|
|
3657
3699
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
3658
|
-
credentialAuthenticator: (0,
|
|
3700
|
+
credentialAuthenticator: (0, import_util6.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
3659
3701
|
},
|
|
3660
3702
|
onNetworkConnection: (session) => {
|
|
3661
3703
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
@@ -3995,7 +4037,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3995
4037
|
this.initialized = new import_async14.Trigger();
|
|
3996
4038
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
3997
4039
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
3998
|
-
this._instanceId =
|
|
4040
|
+
this._instanceId = import_keys11.PublicKey.random().toHex();
|
|
3999
4041
|
this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
|
|
4000
4042
|
this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4001
4043
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
@@ -4216,7 +4258,7 @@ _ts_decorate5([
|
|
|
4216
4258
|
import_tracing4.trace.span()
|
|
4217
4259
|
], ServiceContext.prototype, "_initialize", null);
|
|
4218
4260
|
ServiceContext = _ts_decorate5([
|
|
4219
|
-
(0,
|
|
4261
|
+
(0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
4220
4262
|
import_tracing4.trace.resource()
|
|
4221
4263
|
], ServiceContext);
|
|
4222
4264
|
|
|
@@ -4227,8 +4269,8 @@ var import_context10 = require("@dxos/context");
|
|
|
4227
4269
|
var import_document_model2 = require("@dxos/document-model");
|
|
4228
4270
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
4229
4271
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
4230
|
-
var
|
|
4231
|
-
var
|
|
4272
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
4273
|
+
var import_keys12 = require("@dxos/keys");
|
|
4232
4274
|
var import_log16 = require("@dxos/log");
|
|
4233
4275
|
var import_messaging = require("@dxos/messaging");
|
|
4234
4276
|
var import_model_factory = require("@dxos/model-factory");
|
|
@@ -4266,13 +4308,33 @@ var ServiceRegistry = class {
|
|
|
4266
4308
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
4267
4309
|
var import_async15 = require("@dxos/async");
|
|
4268
4310
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
4311
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
4269
4312
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4313
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4270
4314
|
var DevicesServiceImpl = class {
|
|
4271
4315
|
constructor(_identityManager) {
|
|
4272
4316
|
this._identityManager = _identityManager;
|
|
4273
4317
|
}
|
|
4274
|
-
updateDevice(
|
|
4275
|
-
|
|
4318
|
+
async updateDevice(profile) {
|
|
4319
|
+
(0, import_invariant14.invariant)(this._identityManager.identity, "Identity not initialized", {
|
|
4320
|
+
F: __dxlog_file16,
|
|
4321
|
+
L: 17,
|
|
4322
|
+
S: this,
|
|
4323
|
+
A: [
|
|
4324
|
+
"this._identityManager.identity",
|
|
4325
|
+
"'Identity not initialized'"
|
|
4326
|
+
]
|
|
4327
|
+
});
|
|
4328
|
+
const deviceKey = this._identityManager.identity.deviceKey;
|
|
4329
|
+
await this._identityManager.updateDevice({
|
|
4330
|
+
deviceKey,
|
|
4331
|
+
profile
|
|
4332
|
+
});
|
|
4333
|
+
return {
|
|
4334
|
+
deviceKey,
|
|
4335
|
+
kind: import_services11.DeviceKind.CURRENT,
|
|
4336
|
+
profile
|
|
4337
|
+
};
|
|
4276
4338
|
}
|
|
4277
4339
|
queryDevices() {
|
|
4278
4340
|
return new import_codec_protobuf12.Stream(({ next }) => {
|
|
@@ -4284,9 +4346,10 @@ var DevicesServiceImpl = class {
|
|
|
4284
4346
|
});
|
|
4285
4347
|
} else {
|
|
4286
4348
|
next({
|
|
4287
|
-
devices: Array.from(deviceKeys.
|
|
4349
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
|
|
4288
4350
|
deviceKey: key,
|
|
4289
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED
|
|
4351
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED,
|
|
4352
|
+
profile
|
|
4290
4353
|
}))
|
|
4291
4354
|
});
|
|
4292
4355
|
}
|
|
@@ -4307,7 +4370,7 @@ var DevicesServiceImpl = class {
|
|
|
4307
4370
|
};
|
|
4308
4371
|
|
|
4309
4372
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
4310
|
-
var
|
|
4373
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
4311
4374
|
var import_lock_file = require("@dxos/lock-file");
|
|
4312
4375
|
var import_log14 = require("@dxos/log");
|
|
4313
4376
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
@@ -4320,7 +4383,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4320
4383
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4321
4384
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4322
4385
|
}
|
|
4323
|
-
var
|
|
4386
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
4324
4387
|
var Lock = class {
|
|
4325
4388
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
4326
4389
|
this._lockPath = lockPath;
|
|
@@ -4332,7 +4395,7 @@ var Lock = class {
|
|
|
4332
4395
|
}
|
|
4333
4396
|
async acquire() {
|
|
4334
4397
|
(0, import_log14.log)("acquiring lock...", void 0, {
|
|
4335
|
-
F:
|
|
4398
|
+
F: __dxlog_file17,
|
|
4336
4399
|
L: 32,
|
|
4337
4400
|
S: this,
|
|
4338
4401
|
C: (f, a) => f(...a)
|
|
@@ -4340,7 +4403,7 @@ var Lock = class {
|
|
|
4340
4403
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
4341
4404
|
await this._onAcquire?.();
|
|
4342
4405
|
(0, import_log14.log)("acquired lock", void 0, {
|
|
4343
|
-
F:
|
|
4406
|
+
F: __dxlog_file17,
|
|
4344
4407
|
L: 37,
|
|
4345
4408
|
S: this,
|
|
4346
4409
|
C: (f, a) => f(...a)
|
|
@@ -4348,8 +4411,8 @@ var Lock = class {
|
|
|
4348
4411
|
}
|
|
4349
4412
|
async release() {
|
|
4350
4413
|
await this._onRelease?.();
|
|
4351
|
-
(0,
|
|
4352
|
-
F:
|
|
4414
|
+
(0, import_invariant15.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
4415
|
+
F: __dxlog_file17,
|
|
4353
4416
|
L: 42,
|
|
4354
4417
|
S: this,
|
|
4355
4418
|
A: [
|
|
@@ -4370,7 +4433,7 @@ var import_async16 = require("@dxos/async");
|
|
|
4370
4433
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
4371
4434
|
var import_log15 = require("@dxos/log");
|
|
4372
4435
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4373
|
-
var
|
|
4436
|
+
var import_util8 = require("@dxos/util");
|
|
4374
4437
|
var LoggingServiceImpl = class {
|
|
4375
4438
|
constructor() {
|
|
4376
4439
|
this._logs = new import_async16.Event();
|
|
@@ -4388,15 +4451,15 @@ var LoggingServiceImpl = class {
|
|
|
4388
4451
|
}
|
|
4389
4452
|
async controlMetrics({ reset, record }) {
|
|
4390
4453
|
if (reset) {
|
|
4391
|
-
|
|
4454
|
+
import_util8.tracer.clear();
|
|
4392
4455
|
}
|
|
4393
4456
|
if (record === true) {
|
|
4394
|
-
|
|
4457
|
+
import_util8.tracer.start();
|
|
4395
4458
|
} else if (record === false) {
|
|
4396
|
-
|
|
4459
|
+
import_util8.tracer.stop();
|
|
4397
4460
|
}
|
|
4398
4461
|
return {
|
|
4399
|
-
recording:
|
|
4462
|
+
recording: import_util8.tracer.recording
|
|
4400
4463
|
};
|
|
4401
4464
|
}
|
|
4402
4465
|
/**
|
|
@@ -4404,10 +4467,10 @@ var LoggingServiceImpl = class {
|
|
|
4404
4467
|
*/
|
|
4405
4468
|
queryMetrics({ interval = 5e3 }) {
|
|
4406
4469
|
const getNumericalValues = (key) => {
|
|
4407
|
-
const events =
|
|
4470
|
+
const events = import_util8.tracer.get(key) ?? [];
|
|
4408
4471
|
return {
|
|
4409
4472
|
key,
|
|
4410
|
-
stats: (0,
|
|
4473
|
+
stats: (0, import_util8.numericalValues)(events, "duration")
|
|
4411
4474
|
};
|
|
4412
4475
|
};
|
|
4413
4476
|
return new import_codec_protobuf13.Stream(({ next }) => {
|
|
@@ -4445,7 +4508,7 @@ var LoggingServiceImpl = class {
|
|
|
4445
4508
|
}
|
|
4446
4509
|
const record = {
|
|
4447
4510
|
...entry2,
|
|
4448
|
-
context: (0,
|
|
4511
|
+
context: (0, import_util8.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
|
|
4449
4512
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4450
4513
|
meta: {
|
|
4451
4514
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -4519,10 +4582,10 @@ var import_client_protocol4 = require("@dxos/client-protocol");
|
|
|
4519
4582
|
var import_protocols11 = require("@dxos/protocols");
|
|
4520
4583
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
4521
4584
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
4522
|
-
var
|
|
4585
|
+
var import_util9 = require("@dxos/util");
|
|
4523
4586
|
var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
4524
4587
|
var createStorageObjects = (config) => {
|
|
4525
|
-
const { persistent = false, keyStore, dataStore, dataRoot = (0,
|
|
4588
|
+
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util9.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4526
4589
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4527
4590
|
throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4528
4591
|
}
|
|
@@ -4566,7 +4629,7 @@ var toStorageType = (type) => {
|
|
|
4566
4629
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
4567
4630
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
4568
4631
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
4569
|
-
var
|
|
4632
|
+
var import_util10 = require("@dxos/util");
|
|
4570
4633
|
var SystemServiceImpl = class {
|
|
4571
4634
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
4572
4635
|
this._config = config;
|
|
@@ -4586,7 +4649,7 @@ var SystemServiceImpl = class {
|
|
|
4586
4649
|
const diagnostics = await this._getDiagnostics();
|
|
4587
4650
|
return {
|
|
4588
4651
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4589
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
4652
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
|
|
4590
4653
|
truncate: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
4591
4654
|
humanize: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
4592
4655
|
})))
|
|
@@ -4628,7 +4691,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
4628
4691
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4629
4692
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4630
4693
|
}
|
|
4631
|
-
var
|
|
4694
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
4632
4695
|
var createDefaultModelFactory = () => {
|
|
4633
4696
|
return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
|
|
4634
4697
|
};
|
|
@@ -4728,8 +4791,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4728
4791
|
* Can only be called once.
|
|
4729
4792
|
*/
|
|
4730
4793
|
initialize({ config, ...options }) {
|
|
4731
|
-
(0,
|
|
4732
|
-
F:
|
|
4794
|
+
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
4795
|
+
F: __dxlog_file18,
|
|
4733
4796
|
L: 201,
|
|
4734
4797
|
S: this,
|
|
4735
4798
|
A: [
|
|
@@ -4738,14 +4801,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4738
4801
|
]
|
|
4739
4802
|
});
|
|
4740
4803
|
(0, import_log16.log)("initializing...", void 0, {
|
|
4741
|
-
F:
|
|
4804
|
+
F: __dxlog_file18,
|
|
4742
4805
|
L: 202,
|
|
4743
4806
|
S: this,
|
|
4744
4807
|
C: (f, a) => f(...a)
|
|
4745
4808
|
});
|
|
4746
4809
|
if (config) {
|
|
4747
|
-
(0,
|
|
4748
|
-
F:
|
|
4810
|
+
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
4811
|
+
F: __dxlog_file18,
|
|
4749
4812
|
L: 205,
|
|
4750
4813
|
S: this,
|
|
4751
4814
|
A: [
|
|
@@ -4762,8 +4825,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4762
4825
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4763
4826
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4764
4827
|
this._signalManager = signalManager;
|
|
4765
|
-
(0,
|
|
4766
|
-
F:
|
|
4828
|
+
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
4829
|
+
F: __dxlog_file18,
|
|
4767
4830
|
L: 221,
|
|
4768
4831
|
S: this,
|
|
4769
4832
|
A: [
|
|
@@ -4777,7 +4840,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4777
4840
|
signalManager
|
|
4778
4841
|
});
|
|
4779
4842
|
(0, import_log16.log)("initialized", void 0, {
|
|
4780
|
-
F:
|
|
4843
|
+
F: __dxlog_file18,
|
|
4781
4844
|
L: 228,
|
|
4782
4845
|
S: this,
|
|
4783
4846
|
C: (f, a) => f(...a)
|
|
@@ -4787,17 +4850,17 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4787
4850
|
if (this._open) {
|
|
4788
4851
|
return;
|
|
4789
4852
|
}
|
|
4790
|
-
const traceId =
|
|
4853
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
4791
4854
|
import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
|
|
4792
4855
|
id: traceId
|
|
4793
4856
|
}), {
|
|
4794
|
-
F:
|
|
4857
|
+
F: __dxlog_file18,
|
|
4795
4858
|
L: 239,
|
|
4796
4859
|
S: this,
|
|
4797
4860
|
C: (f, a) => f(...a)
|
|
4798
4861
|
});
|
|
4799
|
-
(0,
|
|
4800
|
-
F:
|
|
4862
|
+
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
4863
|
+
F: __dxlog_file18,
|
|
4801
4864
|
L: 241,
|
|
4802
4865
|
S: this,
|
|
4803
4866
|
A: [
|
|
@@ -4805,8 +4868,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4805
4868
|
"'config not set'"
|
|
4806
4869
|
]
|
|
4807
4870
|
});
|
|
4808
|
-
(0,
|
|
4809
|
-
F:
|
|
4871
|
+
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
4872
|
+
F: __dxlog_file18,
|
|
4810
4873
|
L: 242,
|
|
4811
4874
|
S: this,
|
|
4812
4875
|
A: [
|
|
@@ -4814,8 +4877,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4814
4877
|
"'storage not set'"
|
|
4815
4878
|
]
|
|
4816
4879
|
});
|
|
4817
|
-
(0,
|
|
4818
|
-
F:
|
|
4880
|
+
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
4881
|
+
F: __dxlog_file18,
|
|
4819
4882
|
L: 243,
|
|
4820
4883
|
S: this,
|
|
4821
4884
|
A: [
|
|
@@ -4823,8 +4886,8 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4823
4886
|
"'signal manager not set'"
|
|
4824
4887
|
]
|
|
4825
4888
|
});
|
|
4826
|
-
(0,
|
|
4827
|
-
F:
|
|
4889
|
+
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
4890
|
+
F: __dxlog_file18,
|
|
4828
4891
|
L: 244,
|
|
4829
4892
|
S: this,
|
|
4830
4893
|
A: [
|
|
@@ -4836,7 +4899,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4836
4899
|
(0, import_log16.log)("opening...", {
|
|
4837
4900
|
lockKey: this._resourceLock?.lockKey
|
|
4838
4901
|
}, {
|
|
4839
|
-
F:
|
|
4902
|
+
F: __dxlog_file18,
|
|
4840
4903
|
L: 247,
|
|
4841
4904
|
S: this,
|
|
4842
4905
|
C: (f, a) => f(...a)
|
|
@@ -4882,7 +4945,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4882
4945
|
(0, import_log16.log)("opened", {
|
|
4883
4946
|
deviceKey
|
|
4884
4947
|
}, {
|
|
4885
|
-
F:
|
|
4948
|
+
F: __dxlog_file18,
|
|
4886
4949
|
L: 316,
|
|
4887
4950
|
S: this,
|
|
4888
4951
|
C: (f, a) => f(...a)
|
|
@@ -4890,7 +4953,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4890
4953
|
import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
|
|
4891
4954
|
id: traceId
|
|
4892
4955
|
}), {
|
|
4893
|
-
F:
|
|
4956
|
+
F: __dxlog_file18,
|
|
4894
4957
|
L: 317,
|
|
4895
4958
|
S: this,
|
|
4896
4959
|
C: (f, a) => f(...a)
|
|
@@ -4904,7 +4967,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4904
4967
|
(0, import_log16.log)("closing...", {
|
|
4905
4968
|
deviceKey
|
|
4906
4969
|
}, {
|
|
4907
|
-
F:
|
|
4970
|
+
F: __dxlog_file18,
|
|
4908
4971
|
L: 328,
|
|
4909
4972
|
S: this,
|
|
4910
4973
|
C: (f, a) => f(...a)
|
|
@@ -4920,24 +4983,24 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4920
4983
|
(0, import_log16.log)("closed", {
|
|
4921
4984
|
deviceKey
|
|
4922
4985
|
}, {
|
|
4923
|
-
F:
|
|
4986
|
+
F: __dxlog_file18,
|
|
4924
4987
|
L: 335,
|
|
4925
4988
|
S: this,
|
|
4926
4989
|
C: (f, a) => f(...a)
|
|
4927
4990
|
});
|
|
4928
4991
|
}
|
|
4929
4992
|
async reset() {
|
|
4930
|
-
const traceId =
|
|
4993
|
+
const traceId = import_keys12.PublicKey.random().toHex();
|
|
4931
4994
|
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
|
|
4932
4995
|
id: traceId
|
|
4933
4996
|
}), {
|
|
4934
|
-
F:
|
|
4997
|
+
F: __dxlog_file18,
|
|
4935
4998
|
L: 340,
|
|
4936
4999
|
S: this,
|
|
4937
5000
|
C: (f, a) => f(...a)
|
|
4938
5001
|
});
|
|
4939
5002
|
(0, import_log16.log)("resetting...", void 0, {
|
|
4940
|
-
F:
|
|
5003
|
+
F: __dxlog_file18,
|
|
4941
5004
|
L: 342,
|
|
4942
5005
|
S: this,
|
|
4943
5006
|
C: (f, a) => f(...a)
|
|
@@ -4945,7 +5008,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4945
5008
|
await this._serviceContext?.close();
|
|
4946
5009
|
await this._storage.reset();
|
|
4947
5010
|
(0, import_log16.log)("reset", void 0, {
|
|
4948
|
-
F:
|
|
5011
|
+
F: __dxlog_file18,
|
|
4949
5012
|
L: 345,
|
|
4950
5013
|
S: this,
|
|
4951
5014
|
C: (f, a) => f(...a)
|
|
@@ -4953,7 +5016,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4953
5016
|
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
|
|
4954
5017
|
id: traceId
|
|
4955
5018
|
}), {
|
|
4956
|
-
F:
|
|
5019
|
+
F: __dxlog_file18,
|
|
4957
5020
|
L: 346,
|
|
4958
5021
|
S: this,
|
|
4959
5022
|
C: (f, a) => f(...a)
|
|
@@ -5005,15 +5068,15 @@ var import_context11 = require("@dxos/context");
|
|
|
5005
5068
|
var import_log17 = require("@dxos/log");
|
|
5006
5069
|
var import_messaging2 = require("@dxos/messaging");
|
|
5007
5070
|
var import_network_manager3 = require("@dxos/network-manager");
|
|
5008
|
-
var
|
|
5071
|
+
var import_util11 = require("@dxos/util");
|
|
5009
5072
|
|
|
5010
5073
|
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
5011
5074
|
var import_async18 = require("@dxos/async");
|
|
5012
5075
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
5013
|
-
var
|
|
5076
|
+
var import_invariant17 = require("@dxos/invariant");
|
|
5014
5077
|
var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
|
|
5015
5078
|
var import_rpc2 = require("@dxos/rpc");
|
|
5016
|
-
var
|
|
5079
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
|
|
5017
5080
|
var ShellRuntimeImpl = class {
|
|
5018
5081
|
constructor(_port) {
|
|
5019
5082
|
this._port = _port;
|
|
@@ -5040,8 +5103,8 @@ var ShellRuntimeImpl = class {
|
|
|
5040
5103
|
});
|
|
5041
5104
|
}
|
|
5042
5105
|
async setAppContext(context) {
|
|
5043
|
-
(0,
|
|
5044
|
-
F:
|
|
5106
|
+
(0, import_invariant17.invariant)(this._appRpc, "runtime not open", {
|
|
5107
|
+
F: __dxlog_file19,
|
|
5045
5108
|
L: 44,
|
|
5046
5109
|
S: this,
|
|
5047
5110
|
A: [
|
|
@@ -5086,7 +5149,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
5086
5149
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5087
5150
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5088
5151
|
}
|
|
5089
|
-
var
|
|
5152
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
|
|
5090
5153
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
5091
5154
|
var IFrameHostRuntime = class {
|
|
5092
5155
|
constructor({ config, origin, appPort, shellPort }) {
|
|
@@ -5107,13 +5170,13 @@ var IFrameHostRuntime = class {
|
|
|
5107
5170
|
}
|
|
5108
5171
|
async start() {
|
|
5109
5172
|
(0, import_log17.log)("starting...", void 0, {
|
|
5110
|
-
F:
|
|
5173
|
+
F: __dxlog_file20,
|
|
5111
5174
|
L: 71,
|
|
5112
5175
|
S: this,
|
|
5113
5176
|
C: (f, a) => f(...a)
|
|
5114
5177
|
});
|
|
5115
5178
|
try {
|
|
5116
|
-
this._config = await (0,
|
|
5179
|
+
this._config = await (0, import_util11.getAsyncValue)(this._configProvider);
|
|
5117
5180
|
this._transportFactory = (0, import_network_manager3.createSimplePeerTransportFactory)({
|
|
5118
5181
|
iceServers: this._config.get("runtime.services.ice")
|
|
5119
5182
|
});
|
|
@@ -5156,7 +5219,7 @@ var IFrameHostRuntime = class {
|
|
|
5156
5219
|
]);
|
|
5157
5220
|
this._ready.wake(void 0);
|
|
5158
5221
|
(0, import_log17.log)("started", void 0, {
|
|
5159
|
-
F:
|
|
5222
|
+
F: __dxlog_file20,
|
|
5160
5223
|
L: 114,
|
|
5161
5224
|
S: this,
|
|
5162
5225
|
C: (f, a) => f(...a)
|
|
@@ -5164,7 +5227,7 @@ var IFrameHostRuntime = class {
|
|
|
5164
5227
|
} catch (err) {
|
|
5165
5228
|
this._ready.wake(err);
|
|
5166
5229
|
import_log17.log.catch(err, void 0, {
|
|
5167
|
-
F:
|
|
5230
|
+
F: __dxlog_file20,
|
|
5168
5231
|
L: 117,
|
|
5169
5232
|
S: this,
|
|
5170
5233
|
C: (f, a) => f(...a)
|
|
@@ -5173,7 +5236,7 @@ var IFrameHostRuntime = class {
|
|
|
5173
5236
|
}
|
|
5174
5237
|
async stop() {
|
|
5175
5238
|
(0, import_log17.log)("stopping...", void 0, {
|
|
5176
|
-
F:
|
|
5239
|
+
F: __dxlog_file20,
|
|
5177
5240
|
L: 122,
|
|
5178
5241
|
S: this,
|
|
5179
5242
|
C: (f, a) => f(...a)
|
|
@@ -5182,7 +5245,7 @@ var IFrameHostRuntime = class {
|
|
|
5182
5245
|
await this._clientServices.close();
|
|
5183
5246
|
await this._shellRuntime?.close();
|
|
5184
5247
|
(0, import_log17.log)("stopped", void 0, {
|
|
5185
|
-
F:
|
|
5248
|
+
F: __dxlog_file20,
|
|
5186
5249
|
L: 126,
|
|
5187
5250
|
S: this,
|
|
5188
5251
|
C: (f, a) => f(...a)
|
|
@@ -5200,8 +5263,8 @@ var import_log18 = require("@dxos/log");
|
|
|
5200
5263
|
var import_network_manager4 = require("@dxos/network-manager");
|
|
5201
5264
|
var import_protocols13 = require("@dxos/protocols");
|
|
5202
5265
|
var import_rpc3 = require("@dxos/rpc");
|
|
5203
|
-
var
|
|
5204
|
-
var
|
|
5266
|
+
var import_util12 = require("@dxos/util");
|
|
5267
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
|
|
5205
5268
|
var IFrameProxyRuntime = class {
|
|
5206
5269
|
constructor({ config, systemPort, shellPort }) {
|
|
5207
5270
|
this._id = String(Math.floor(Math.random() * 1e6));
|
|
@@ -5217,7 +5280,7 @@ var IFrameProxyRuntime = class {
|
|
|
5217
5280
|
return this._shellRuntime;
|
|
5218
5281
|
}
|
|
5219
5282
|
async open(origin) {
|
|
5220
|
-
this._config = await (0,
|
|
5283
|
+
this._config = await (0, import_util12.getAsyncValue)(this._configProvider);
|
|
5221
5284
|
this._transportService = new import_network_manager4.SimplePeerTransportService({
|
|
5222
5285
|
iceServers: this._config.get("runtime.services.ice")
|
|
5223
5286
|
});
|
|
@@ -5249,7 +5312,7 @@ var IFrameProxyRuntime = class {
|
|
|
5249
5312
|
});
|
|
5250
5313
|
} catch (err) {
|
|
5251
5314
|
import_log18.log.catch(err, void 0, {
|
|
5252
|
-
F:
|
|
5315
|
+
F: __dxlog_file21,
|
|
5253
5316
|
L: 85,
|
|
5254
5317
|
S: this,
|
|
5255
5318
|
C: (f, a) => f(...a)
|
|
@@ -5279,10 +5342,10 @@ var import_network_manager5 = require("@dxos/network-manager");
|
|
|
5279
5342
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
5280
5343
|
var import_async21 = require("@dxos/async");
|
|
5281
5344
|
var import_client_protocol9 = require("@dxos/client-protocol");
|
|
5282
|
-
var
|
|
5345
|
+
var import_invariant18 = require("@dxos/invariant");
|
|
5283
5346
|
var import_log19 = require("@dxos/log");
|
|
5284
5347
|
var import_rpc4 = require("@dxos/rpc");
|
|
5285
|
-
var
|
|
5348
|
+
var import_util13 = require("@dxos/util");
|
|
5286
5349
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
5287
5350
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5288
5351
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -5293,13 +5356,13 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
5293
5356
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5294
5357
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5295
5358
|
}
|
|
5296
|
-
var
|
|
5359
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
|
|
5297
5360
|
var WorkerSession = class {
|
|
5298
5361
|
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
|
|
5299
5362
|
this._startTrigger = new import_async21.Trigger();
|
|
5300
|
-
this.onClose = new
|
|
5301
|
-
(0,
|
|
5302
|
-
F:
|
|
5363
|
+
this.onClose = new import_util13.Callback();
|
|
5364
|
+
(0, import_invariant18.invariant)(serviceHost, void 0, {
|
|
5365
|
+
F: __dxlog_file22,
|
|
5303
5366
|
L: 49,
|
|
5304
5367
|
S: this,
|
|
5305
5368
|
A: [
|
|
@@ -5354,7 +5417,7 @@ var WorkerSession = class {
|
|
|
5354
5417
|
await this.close();
|
|
5355
5418
|
} catch (err) {
|
|
5356
5419
|
import_log19.log.catch(err, void 0, {
|
|
5357
|
-
F:
|
|
5420
|
+
F: __dxlog_file22,
|
|
5358
5421
|
L: 99,
|
|
5359
5422
|
S: this,
|
|
5360
5423
|
C: (f, a) => f(...a)
|
|
@@ -5371,7 +5434,7 @@ var WorkerSession = class {
|
|
|
5371
5434
|
}
|
|
5372
5435
|
async open() {
|
|
5373
5436
|
import_log19.log.info("opening...", void 0, {
|
|
5374
|
-
F:
|
|
5437
|
+
F: __dxlog_file22,
|
|
5375
5438
|
L: 113,
|
|
5376
5439
|
S: this,
|
|
5377
5440
|
C: (f, a) => f(...a)
|
|
@@ -5388,7 +5451,7 @@ var WorkerSession = class {
|
|
|
5388
5451
|
void this._afterLockReleases(this.lockKey, () => this.close());
|
|
5389
5452
|
}
|
|
5390
5453
|
import_log19.log.info("opened", void 0, {
|
|
5391
|
-
F:
|
|
5454
|
+
F: __dxlog_file22,
|
|
5392
5455
|
L: 124,
|
|
5393
5456
|
S: this,
|
|
5394
5457
|
C: (f, a) => f(...a)
|
|
@@ -5396,7 +5459,7 @@ var WorkerSession = class {
|
|
|
5396
5459
|
}
|
|
5397
5460
|
async close() {
|
|
5398
5461
|
import_log19.log.info("closing...", void 0, {
|
|
5399
|
-
F:
|
|
5462
|
+
F: __dxlog_file22,
|
|
5400
5463
|
L: 128,
|
|
5401
5464
|
S: this,
|
|
5402
5465
|
C: (f, a) => f(...a)
|
|
@@ -5405,7 +5468,7 @@ var WorkerSession = class {
|
|
|
5405
5468
|
await this.onClose.callIfSet();
|
|
5406
5469
|
} catch (err) {
|
|
5407
5470
|
import_log19.log.catch(err, void 0, {
|
|
5408
|
-
F:
|
|
5471
|
+
F: __dxlog_file22,
|
|
5409
5472
|
L: 132,
|
|
5410
5473
|
S: this,
|
|
5411
5474
|
C: (f, a) => f(...a)
|
|
@@ -5416,7 +5479,7 @@ var WorkerSession = class {
|
|
|
5416
5479
|
this._iframeRpc.close()
|
|
5417
5480
|
]);
|
|
5418
5481
|
import_log19.log.info("closed", void 0, {
|
|
5419
|
-
F:
|
|
5482
|
+
F: __dxlog_file22,
|
|
5420
5483
|
L: 136,
|
|
5421
5484
|
S: this,
|
|
5422
5485
|
C: (f, a) => f(...a)
|
|
@@ -5427,7 +5490,7 @@ var WorkerSession = class {
|
|
|
5427
5490
|
await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
5428
5491
|
} catch {
|
|
5429
5492
|
import_log19.log.info("No shell connected.", void 0, {
|
|
5430
|
-
F:
|
|
5493
|
+
F: __dxlog_file22,
|
|
5431
5494
|
L: 143,
|
|
5432
5495
|
S: this,
|
|
5433
5496
|
C: (f, a) => f(...a)
|
|
@@ -5447,7 +5510,7 @@ _ts_decorate9([
|
|
|
5447
5510
|
], WorkerSession.prototype, "lockKey", void 0);
|
|
5448
5511
|
|
|
5449
5512
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
5450
|
-
var
|
|
5513
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
|
|
5451
5514
|
var WorkerRuntime = class {
|
|
5452
5515
|
constructor(_configProvider) {
|
|
5453
5516
|
this._configProvider = _configProvider;
|
|
@@ -5467,7 +5530,7 @@ var WorkerRuntime = class {
|
|
|
5467
5530
|
}
|
|
5468
5531
|
async start() {
|
|
5469
5532
|
(0, import_log20.log)("starting...", void 0, {
|
|
5470
|
-
F:
|
|
5533
|
+
F: __dxlog_file23,
|
|
5471
5534
|
L: 52,
|
|
5472
5535
|
S: this,
|
|
5473
5536
|
C: (f, a) => f(...a)
|
|
@@ -5483,7 +5546,7 @@ var WorkerRuntime = class {
|
|
|
5483
5546
|
await this._clientServices.open(new import_context12.Context());
|
|
5484
5547
|
this._ready.wake(void 0);
|
|
5485
5548
|
(0, import_log20.log)("started", void 0, {
|
|
5486
|
-
F:
|
|
5549
|
+
F: __dxlog_file23,
|
|
5487
5550
|
L: 66,
|
|
5488
5551
|
S: this,
|
|
5489
5552
|
C: (f, a) => f(...a)
|
|
@@ -5491,7 +5554,7 @@ var WorkerRuntime = class {
|
|
|
5491
5554
|
} catch (err) {
|
|
5492
5555
|
this._ready.wake(err);
|
|
5493
5556
|
import_log20.log.error("starting", err, {
|
|
5494
|
-
F:
|
|
5557
|
+
F: __dxlog_file23,
|
|
5495
5558
|
L: 69,
|
|
5496
5559
|
S: this,
|
|
5497
5560
|
C: (f, a) => f(...a)
|
|
@@ -5525,7 +5588,7 @@ var WorkerRuntime = class {
|
|
|
5525
5588
|
*/
|
|
5526
5589
|
_reconnectWebrtc() {
|
|
5527
5590
|
(0, import_log20.log)("reconnecting webrtc...", void 0, {
|
|
5528
|
-
F:
|
|
5591
|
+
F: __dxlog_file23,
|
|
5529
5592
|
L: 106,
|
|
5530
5593
|
S: this,
|
|
5531
5594
|
C: (f, a) => f(...a)
|