@dxos/client-services 0.4.7-main.e015b9e → 0.4.7-main.ea67fec
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-M3HBHYHU.mjs → chunk-2L2NQNED.mjs} +205 -136
- package/dist/lib/browser/chunk-2L2NQNED.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/{chunk-UPGNRF2T.cjs → chunk-5HSF6RSJ.cjs} +196 -127
- package/dist/lib/node/chunk-5HSF6RSJ.cjs.map +7 -0
- package/dist/lib/node/index.cjs +37 -37
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- 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 +8 -2
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +5 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +5 -3
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +4 -2
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +7 -1
- package/dist/types/src/packlets/spaces/data-space-manager.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.test.ts +8 -4
- package/src/packlets/devices/devices-service.ts +47 -11
- package/src/packlets/identity/identity-manager.ts +48 -6
- package/src/packlets/identity/identity.ts +9 -1
- package/src/packlets/services/service-context.ts +17 -3
- package/src/packlets/services/service-host.ts +8 -3
- package/src/packlets/spaces/data-space-manager.ts +18 -3
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-M3HBHYHU.mjs.map +0 -7
- package/dist/lib/node/chunk-UPGNRF2T.cjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_5HSF6RSJ_exports = {};
|
|
30
|
+
__export(chunk_5HSF6RSJ_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -60,7 +60,7 @@ __export(chunk_UPGNRF2T_exports, {
|
|
|
60
60
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
61
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
62
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
63
|
+
module.exports = __toCommonJS(chunk_5HSF6RSJ_exports);
|
|
64
64
|
var import_async = require("@dxos/async");
|
|
65
65
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
66
66
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -100,6 +100,7 @@ var import_log3 = require("@dxos/log");
|
|
|
100
100
|
var import_protocols2 = require("@dxos/protocols");
|
|
101
101
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
102
102
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
103
|
+
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
103
104
|
var import_timeframe = require("@dxos/timeframe");
|
|
104
105
|
var import_tracing2 = require("@dxos/tracing");
|
|
105
106
|
var import_util3 = require("@dxos/util");
|
|
@@ -186,7 +187,7 @@ var import_keys9 = require("@dxos/keys");
|
|
|
186
187
|
var import_log11 = require("@dxos/log");
|
|
187
188
|
var import_protocols10 = require("@dxos/protocols");
|
|
188
189
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
189
|
-
var
|
|
190
|
+
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
190
191
|
var import_util6 = require("@dxos/util");
|
|
191
192
|
var import_credentials13 = require("@dxos/credentials");
|
|
192
193
|
var import_debug4 = require("@dxos/debug");
|
|
@@ -242,6 +243,7 @@ var import_util9 = require("@dxos/util");
|
|
|
242
243
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
243
244
|
var import_async16 = require("@dxos/async");
|
|
244
245
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
246
|
+
var import_invariant17 = require("@dxos/invariant");
|
|
245
247
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
246
248
|
var import_async17 = require("@dxos/async");
|
|
247
249
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
@@ -682,17 +684,18 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
682
684
|
}
|
|
683
685
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
684
686
|
var Identity = class {
|
|
685
|
-
constructor({ space, signer, identityKey, deviceKey }) {
|
|
687
|
+
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
686
688
|
this.stateUpdate = new import_async5.Event();
|
|
687
689
|
this.space = space;
|
|
688
690
|
this._signer = signer;
|
|
691
|
+
this._presence = presence;
|
|
689
692
|
this.identityKey = identityKey;
|
|
690
693
|
this.deviceKey = deviceKey;
|
|
691
694
|
import_log2.log.trace("dxos.halo.device", {
|
|
692
695
|
deviceKey
|
|
693
696
|
}, {
|
|
694
697
|
F: __dxlog_file2,
|
|
695
|
-
L:
|
|
698
|
+
L: 67,
|
|
696
699
|
S: this,
|
|
697
700
|
C: (f, a) => f(...a)
|
|
698
701
|
});
|
|
@@ -750,6 +753,9 @@ var Identity = class {
|
|
|
750
753
|
get deviceCredentialChain() {
|
|
751
754
|
return this._deviceStateMachine.deviceCredentialChain;
|
|
752
755
|
}
|
|
756
|
+
get presence() {
|
|
757
|
+
return this._presence;
|
|
758
|
+
}
|
|
753
759
|
/**
|
|
754
760
|
* Issues credentials as identity.
|
|
755
761
|
* Requires identity to be ready.
|
|
@@ -757,7 +763,7 @@ var Identity = class {
|
|
|
757
763
|
getIdentityCredentialSigner() {
|
|
758
764
|
(0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
759
765
|
F: __dxlog_file2,
|
|
760
|
-
L:
|
|
766
|
+
L: 144,
|
|
761
767
|
S: this,
|
|
762
768
|
A: [
|
|
763
769
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -781,7 +787,7 @@ var Identity = class {
|
|
|
781
787
|
dataFeedKey
|
|
782
788
|
}, {
|
|
783
789
|
F: __dxlog_file2,
|
|
784
|
-
L:
|
|
790
|
+
L: 160,
|
|
785
791
|
S: this,
|
|
786
792
|
C: (f, a) => f(...a)
|
|
787
793
|
});
|
|
@@ -842,15 +848,20 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
842
848
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
843
849
|
}
|
|
844
850
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
851
|
+
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
852
|
+
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
845
853
|
var IdentityManager = class {
|
|
846
854
|
// TODO(burdon): IdentityManagerParams.
|
|
847
855
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
848
|
-
constructor(_metadataStore, _keyring, _feedStore, _spaceManager) {
|
|
856
|
+
constructor(_metadataStore, _keyring, _feedStore, _spaceManager, params) {
|
|
849
857
|
this._metadataStore = _metadataStore;
|
|
850
858
|
this._keyring = _keyring;
|
|
851
859
|
this._feedStore = _feedStore;
|
|
852
860
|
this._spaceManager = _spaceManager;
|
|
853
861
|
this.stateUpdate = new import_async6.Event();
|
|
862
|
+
const { devicePresenceAnnounceInterval = DEVICE_PRESENCE_ANNOUNCE_INTERVAL, devicePresenceOfflineTimeout = DEVICE_PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
|
|
863
|
+
this._devicePresenceAnnounceInterval = devicePresenceAnnounceInterval;
|
|
864
|
+
this._devicePresenceOfflineTimeout = devicePresenceOfflineTimeout;
|
|
854
865
|
}
|
|
855
866
|
get identity() {
|
|
856
867
|
return this._identity;
|
|
@@ -861,7 +872,7 @@ var IdentityManager = class {
|
|
|
861
872
|
id: traceId
|
|
862
873
|
}), {
|
|
863
874
|
F: __dxlog_file3,
|
|
864
|
-
L:
|
|
875
|
+
L: 104,
|
|
865
876
|
S: this,
|
|
866
877
|
C: (f, a) => f(...a)
|
|
867
878
|
});
|
|
@@ -870,7 +881,7 @@ var IdentityManager = class {
|
|
|
870
881
|
identityRecord
|
|
871
882
|
}, {
|
|
872
883
|
F: __dxlog_file3,
|
|
873
|
-
L:
|
|
884
|
+
L: 107,
|
|
874
885
|
S: this,
|
|
875
886
|
C: (f, a) => f(...a)
|
|
876
887
|
});
|
|
@@ -883,7 +894,7 @@ var IdentityManager = class {
|
|
|
883
894
|
displayName: this._identity.profileDocument?.displayName
|
|
884
895
|
}, {
|
|
885
896
|
F: __dxlog_file3,
|
|
886
|
-
L:
|
|
897
|
+
L: 112,
|
|
887
898
|
S: this,
|
|
888
899
|
C: (f, a) => f(...a)
|
|
889
900
|
});
|
|
@@ -893,7 +904,7 @@ var IdentityManager = class {
|
|
|
893
904
|
id: traceId
|
|
894
905
|
}), {
|
|
895
906
|
F: __dxlog_file3,
|
|
896
|
-
L:
|
|
907
|
+
L: 119,
|
|
897
908
|
S: this,
|
|
898
909
|
C: (f, a) => f(...a)
|
|
899
910
|
});
|
|
@@ -904,7 +915,7 @@ var IdentityManager = class {
|
|
|
904
915
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
905
916
|
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
906
917
|
F: __dxlog_file3,
|
|
907
|
-
L:
|
|
918
|
+
L: 128,
|
|
908
919
|
S: this,
|
|
909
920
|
A: [
|
|
910
921
|
"!this._identity",
|
|
@@ -913,7 +924,7 @@ var IdentityManager = class {
|
|
|
913
924
|
});
|
|
914
925
|
(0, import_log3.log)("creating identity...", void 0, {
|
|
915
926
|
F: __dxlog_file3,
|
|
916
|
-
L:
|
|
927
|
+
L: 129,
|
|
917
928
|
S: this,
|
|
918
929
|
C: (f, a) => f(...a)
|
|
919
930
|
});
|
|
@@ -934,7 +945,7 @@ var IdentityManager = class {
|
|
|
934
945
|
const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
935
946
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
936
947
|
F: __dxlog_file3,
|
|
937
|
-
L:
|
|
948
|
+
L: 148,
|
|
938
949
|
S: this,
|
|
939
950
|
A: [
|
|
940
951
|
"identityRecord.haloSpace.genesisFeedKey",
|
|
@@ -943,7 +954,7 @@ var IdentityManager = class {
|
|
|
943
954
|
});
|
|
944
955
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
945
956
|
F: __dxlog_file3,
|
|
946
|
-
L:
|
|
957
|
+
L: 149,
|
|
947
958
|
S: this,
|
|
948
959
|
A: [
|
|
949
960
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -982,7 +993,7 @@ var IdentityManager = class {
|
|
|
982
993
|
displayName: this._identity.profileDocument?.displayName
|
|
983
994
|
}, {
|
|
984
995
|
F: __dxlog_file3,
|
|
985
|
-
L:
|
|
996
|
+
L: 191,
|
|
986
997
|
S: this,
|
|
987
998
|
C: (f, a) => f(...a)
|
|
988
999
|
});
|
|
@@ -993,7 +1004,7 @@ var IdentityManager = class {
|
|
|
993
1004
|
profile: identity.profileDocument
|
|
994
1005
|
}, {
|
|
995
1006
|
F: __dxlog_file3,
|
|
996
|
-
L:
|
|
1007
|
+
L: 197,
|
|
997
1008
|
S: this,
|
|
998
1009
|
C: (f, a) => f(...a)
|
|
999
1010
|
});
|
|
@@ -1030,13 +1041,13 @@ var IdentityManager = class {
|
|
|
1030
1041
|
params
|
|
1031
1042
|
}, {
|
|
1032
1043
|
F: __dxlog_file3,
|
|
1033
|
-
L:
|
|
1044
|
+
L: 235,
|
|
1034
1045
|
S: this,
|
|
1035
1046
|
C: (f, a) => f(...a)
|
|
1036
1047
|
});
|
|
1037
1048
|
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
1038
1049
|
F: __dxlog_file3,
|
|
1039
|
-
L:
|
|
1050
|
+
L: 236,
|
|
1040
1051
|
S: this,
|
|
1041
1052
|
A: [
|
|
1042
1053
|
"!this._identity",
|
|
@@ -1064,7 +1075,7 @@ var IdentityManager = class {
|
|
|
1064
1075
|
displayName: this._identity.profileDocument?.displayName
|
|
1065
1076
|
}, {
|
|
1066
1077
|
F: __dxlog_file3,
|
|
1067
|
-
L:
|
|
1078
|
+
L: 255,
|
|
1068
1079
|
S: this,
|
|
1069
1080
|
C: (f, a) => f(...a)
|
|
1070
1081
|
});
|
|
@@ -1078,7 +1089,7 @@ var IdentityManager = class {
|
|
|
1078
1089
|
deviceKey: identity.deviceKey
|
|
1079
1090
|
}, {
|
|
1080
1091
|
F: __dxlog_file3,
|
|
1081
|
-
L:
|
|
1092
|
+
L: 265,
|
|
1082
1093
|
S: this,
|
|
1083
1094
|
C: (f, a) => f(...a)
|
|
1084
1095
|
});
|
|
@@ -1090,7 +1101,7 @@ var IdentityManager = class {
|
|
|
1090
1101
|
async updateProfile(profile) {
|
|
1091
1102
|
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
1092
1103
|
F: __dxlog_file3,
|
|
1093
|
-
L:
|
|
1104
|
+
L: 273,
|
|
1094
1105
|
S: this,
|
|
1095
1106
|
A: [
|
|
1096
1107
|
"this._identity",
|
|
@@ -1121,7 +1132,7 @@ var IdentityManager = class {
|
|
|
1121
1132
|
async updateDeviceProfile(profile) {
|
|
1122
1133
|
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
1123
1134
|
F: __dxlog_file3,
|
|
1124
|
-
L:
|
|
1135
|
+
L: 290,
|
|
1125
1136
|
S: this,
|
|
1126
1137
|
A: [
|
|
1127
1138
|
"this._identity",
|
|
@@ -1150,13 +1161,14 @@ var IdentityManager = class {
|
|
|
1150
1161
|
return {
|
|
1151
1162
|
deviceKey: this._identity.deviceKey,
|
|
1152
1163
|
kind: import_services.DeviceKind.CURRENT,
|
|
1164
|
+
presence: import_services.Device.PresenceState.ONLINE,
|
|
1153
1165
|
profile
|
|
1154
1166
|
};
|
|
1155
1167
|
}
|
|
1156
1168
|
async _constructIdentity(identityRecord) {
|
|
1157
1169
|
(0, import_invariant2.invariant)(!this._identity, void 0, {
|
|
1158
1170
|
F: __dxlog_file3,
|
|
1159
|
-
L:
|
|
1171
|
+
L: 316,
|
|
1160
1172
|
S: this,
|
|
1161
1173
|
A: [
|
|
1162
1174
|
"!this._identity",
|
|
@@ -1167,13 +1179,22 @@ var IdentityManager = class {
|
|
|
1167
1179
|
identityRecord
|
|
1168
1180
|
}, {
|
|
1169
1181
|
F: __dxlog_file3,
|
|
1170
|
-
L:
|
|
1182
|
+
L: 317,
|
|
1171
1183
|
S: this,
|
|
1172
1184
|
C: (f, a) => f(...a)
|
|
1173
1185
|
});
|
|
1186
|
+
const gossip = new import_teleport_extension_gossip.Gossip({
|
|
1187
|
+
localPeerId: identityRecord.deviceKey
|
|
1188
|
+
});
|
|
1189
|
+
const presence = new import_teleport_extension_gossip.Presence({
|
|
1190
|
+
announceInterval: this._devicePresenceAnnounceInterval,
|
|
1191
|
+
offlineTimeout: this._devicePresenceOfflineTimeout,
|
|
1192
|
+
identityKey: identityRecord.deviceKey,
|
|
1193
|
+
gossip
|
|
1194
|
+
});
|
|
1174
1195
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1175
1196
|
F: __dxlog_file3,
|
|
1176
|
-
L:
|
|
1197
|
+
L: 330,
|
|
1177
1198
|
S: this,
|
|
1178
1199
|
A: [
|
|
1179
1200
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -1185,7 +1206,7 @@ var IdentityManager = class {
|
|
|
1185
1206
|
});
|
|
1186
1207
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1187
1208
|
F: __dxlog_file3,
|
|
1188
|
-
L:
|
|
1209
|
+
L: 334,
|
|
1189
1210
|
S: this,
|
|
1190
1211
|
A: [
|
|
1191
1212
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -1203,12 +1224,14 @@ var IdentityManager = class {
|
|
|
1203
1224
|
credentialProvider: createAuthProvider((0, import_credentials4.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
|
|
1204
1225
|
credentialAuthenticator: (0, import_util3.deferFunction)(() => identity.authVerifier.verifier)
|
|
1205
1226
|
},
|
|
1227
|
+
gossip,
|
|
1206
1228
|
identityKey: identityRecord.identityKey
|
|
1207
1229
|
});
|
|
1208
1230
|
await space.setControlFeed(controlFeed);
|
|
1209
|
-
space.setDataFeed(dataFeed);
|
|
1231
|
+
void space.setDataFeed(dataFeed);
|
|
1210
1232
|
const identity = new Identity({
|
|
1211
1233
|
space,
|
|
1234
|
+
presence,
|
|
1212
1235
|
signer: this._keyring,
|
|
1213
1236
|
identityKey: identityRecord.identityKey,
|
|
1214
1237
|
deviceKey: identityRecord.deviceKey
|
|
@@ -1217,7 +1240,7 @@ var IdentityManager = class {
|
|
|
1217
1240
|
identityKey: identityRecord.identityKey
|
|
1218
1241
|
}, {
|
|
1219
1242
|
F: __dxlog_file3,
|
|
1220
|
-
L:
|
|
1243
|
+
L: 360,
|
|
1221
1244
|
S: this,
|
|
1222
1245
|
C: (f, a) => f(...a)
|
|
1223
1246
|
});
|
|
@@ -1227,19 +1250,22 @@ var IdentityManager = class {
|
|
|
1227
1250
|
identity.stateUpdate.on(() => this.stateUpdate.emit());
|
|
1228
1251
|
return identity;
|
|
1229
1252
|
}
|
|
1230
|
-
async _constructSpace({ spaceRecord, swarmIdentity, identityKey }) {
|
|
1253
|
+
async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }) {
|
|
1231
1254
|
return this._spaceManager.constructSpace({
|
|
1232
1255
|
metadata: {
|
|
1233
1256
|
key: spaceRecord.key,
|
|
1234
1257
|
genesisFeedKey: spaceRecord.genesisFeedKey
|
|
1235
1258
|
},
|
|
1236
1259
|
swarmIdentity,
|
|
1237
|
-
onAuthorizedConnection: () => {
|
|
1260
|
+
onAuthorizedConnection: (session) => {
|
|
1261
|
+
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
1262
|
+
remotePeerId: session.remotePeerId
|
|
1263
|
+
}));
|
|
1238
1264
|
},
|
|
1239
1265
|
onAuthFailure: () => {
|
|
1240
1266
|
import_log3.log.warn("auth failure", void 0, {
|
|
1241
1267
|
F: __dxlog_file3,
|
|
1242
|
-
L:
|
|
1268
|
+
L: 385,
|
|
1243
1269
|
S: this,
|
|
1244
1270
|
C: (f, a) => f(...a)
|
|
1245
1271
|
});
|
|
@@ -2756,7 +2782,7 @@ var getPlatform = () => {
|
|
|
2756
2782
|
};
|
|
2757
2783
|
}
|
|
2758
2784
|
};
|
|
2759
|
-
var DXOS_VERSION = "0.4.7-main.
|
|
2785
|
+
var DXOS_VERSION = "0.4.7-main.ea67fec";
|
|
2760
2786
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2761
2787
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2762
2788
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -3715,7 +3741,7 @@ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
3715
3741
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3716
3742
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3717
3743
|
var DataSpaceManager = class {
|
|
3718
|
-
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost) {
|
|
3744
|
+
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost, params) {
|
|
3719
3745
|
this._spaceManager = _spaceManager;
|
|
3720
3746
|
this._metadataStore = _metadataStore;
|
|
3721
3747
|
this._dataServiceSubscriptions = _dataServiceSubscriptions;
|
|
@@ -3728,6 +3754,9 @@ var DataSpaceManager = class {
|
|
|
3728
3754
|
this._spaces = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
|
|
3729
3755
|
this._isOpen = false;
|
|
3730
3756
|
this._instanceId = import_keys9.PublicKey.random().toHex();
|
|
3757
|
+
const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
|
|
3758
|
+
this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
|
|
3759
|
+
this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
|
|
3731
3760
|
}
|
|
3732
3761
|
// TODO(burdon): Remove.
|
|
3733
3762
|
get spaces() {
|
|
@@ -3736,7 +3765,7 @@ var DataSpaceManager = class {
|
|
|
3736
3765
|
async open() {
|
|
3737
3766
|
(0, import_log11.log)("open", void 0, {
|
|
3738
3767
|
F: __dxlog_file13,
|
|
3739
|
-
L:
|
|
3768
|
+
L: 105,
|
|
3740
3769
|
S: this,
|
|
3741
3770
|
C: (f, a) => f(...a)
|
|
3742
3771
|
});
|
|
@@ -3744,7 +3773,7 @@ var DataSpaceManager = class {
|
|
|
3744
3773
|
id: this._instanceId
|
|
3745
3774
|
}), {
|
|
3746
3775
|
F: __dxlog_file13,
|
|
3747
|
-
L:
|
|
3776
|
+
L: 106,
|
|
3748
3777
|
S: this,
|
|
3749
3778
|
C: (f, a) => f(...a)
|
|
3750
3779
|
});
|
|
@@ -3752,7 +3781,7 @@ var DataSpaceManager = class {
|
|
|
3752
3781
|
spaces: this._metadataStore.spaces.length
|
|
3753
3782
|
}, {
|
|
3754
3783
|
F: __dxlog_file13,
|
|
3755
|
-
L:
|
|
3784
|
+
L: 107,
|
|
3756
3785
|
S: this,
|
|
3757
3786
|
C: (f, a) => f(...a)
|
|
3758
3787
|
});
|
|
@@ -3762,7 +3791,7 @@ var DataSpaceManager = class {
|
|
|
3762
3791
|
spaceMetadata
|
|
3763
3792
|
}, {
|
|
3764
3793
|
F: __dxlog_file13,
|
|
3765
|
-
L:
|
|
3794
|
+
L: 111,
|
|
3766
3795
|
S: this,
|
|
3767
3796
|
C: (f, a) => f(...a)
|
|
3768
3797
|
});
|
|
@@ -3773,7 +3802,7 @@ var DataSpaceManager = class {
|
|
|
3773
3802
|
err
|
|
3774
3803
|
}, {
|
|
3775
3804
|
F: __dxlog_file13,
|
|
3776
|
-
L:
|
|
3805
|
+
L: 114,
|
|
3777
3806
|
S: this,
|
|
3778
3807
|
C: (f, a) => f(...a)
|
|
3779
3808
|
});
|
|
@@ -3790,7 +3819,7 @@ var DataSpaceManager = class {
|
|
|
3790
3819
|
id: this._instanceId
|
|
3791
3820
|
}), {
|
|
3792
3821
|
F: __dxlog_file13,
|
|
3793
|
-
L:
|
|
3822
|
+
L: 127,
|
|
3794
3823
|
S: this,
|
|
3795
3824
|
C: (f, a) => f(...a)
|
|
3796
3825
|
});
|
|
@@ -3798,7 +3827,7 @@ var DataSpaceManager = class {
|
|
|
3798
3827
|
async close() {
|
|
3799
3828
|
(0, import_log11.log)("close", void 0, {
|
|
3800
3829
|
F: __dxlog_file13,
|
|
3801
|
-
L:
|
|
3830
|
+
L: 132,
|
|
3802
3831
|
S: this,
|
|
3803
3832
|
C: (f, a) => f(...a)
|
|
3804
3833
|
});
|
|
@@ -3814,7 +3843,7 @@ var DataSpaceManager = class {
|
|
|
3814
3843
|
async createSpace() {
|
|
3815
3844
|
(0, import_invariant12.invariant)(this._isOpen, "Not open.", {
|
|
3816
3845
|
F: __dxlog_file13,
|
|
3817
|
-
L:
|
|
3846
|
+
L: 145,
|
|
3818
3847
|
S: this,
|
|
3819
3848
|
A: [
|
|
3820
3849
|
"this._isOpen",
|
|
@@ -3835,7 +3864,7 @@ var DataSpaceManager = class {
|
|
|
3835
3864
|
spaceKey
|
|
3836
3865
|
}, {
|
|
3837
3866
|
F: __dxlog_file13,
|
|
3838
|
-
L:
|
|
3867
|
+
L: 157,
|
|
3839
3868
|
S: this,
|
|
3840
3869
|
C: (f, a) => f(...a)
|
|
3841
3870
|
});
|
|
@@ -3851,7 +3880,7 @@ var DataSpaceManager = class {
|
|
|
3851
3880
|
const memberCredential = credentials[1];
|
|
3852
3881
|
(0, import_invariant12.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3853
3882
|
F: __dxlog_file13,
|
|
3854
|
-
L:
|
|
3883
|
+
L: 170,
|
|
3855
3884
|
S: this,
|
|
3856
3885
|
A: [
|
|
3857
3886
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3869,13 +3898,13 @@ var DataSpaceManager = class {
|
|
|
3869
3898
|
opts
|
|
3870
3899
|
}, {
|
|
3871
3900
|
F: __dxlog_file13,
|
|
3872
|
-
L:
|
|
3901
|
+
L: 182,
|
|
3873
3902
|
S: this,
|
|
3874
3903
|
C: (f, a) => f(...a)
|
|
3875
3904
|
});
|
|
3876
3905
|
(0, import_invariant12.invariant)(this._isOpen, "Not open.", {
|
|
3877
3906
|
F: __dxlog_file13,
|
|
3878
|
-
L:
|
|
3907
|
+
L: 183,
|
|
3879
3908
|
S: this,
|
|
3880
3909
|
A: [
|
|
3881
3910
|
"this._isOpen",
|
|
@@ -3884,7 +3913,7 @@ var DataSpaceManager = class {
|
|
|
3884
3913
|
});
|
|
3885
3914
|
(0, import_invariant12.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
3886
3915
|
F: __dxlog_file13,
|
|
3887
|
-
L:
|
|
3916
|
+
L: 184,
|
|
3888
3917
|
S: this,
|
|
3889
3918
|
A: [
|
|
3890
3919
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -3919,16 +3948,16 @@ var DataSpaceManager = class {
|
|
|
3919
3948
|
metadata
|
|
3920
3949
|
}, {
|
|
3921
3950
|
F: __dxlog_file13,
|
|
3922
|
-
L:
|
|
3951
|
+
L: 217,
|
|
3923
3952
|
S: this,
|
|
3924
3953
|
C: (f, a) => f(...a)
|
|
3925
3954
|
});
|
|
3926
|
-
const gossip = new
|
|
3955
|
+
const gossip = new import_teleport_extension_gossip2.Gossip({
|
|
3927
3956
|
localPeerId: this._signingContext.deviceKey
|
|
3928
3957
|
});
|
|
3929
|
-
const presence = new
|
|
3930
|
-
announceInterval:
|
|
3931
|
-
offlineTimeout:
|
|
3958
|
+
const presence = new import_teleport_extension_gossip2.Presence({
|
|
3959
|
+
announceInterval: this._spaceMemberPresenceAnnounceInterval,
|
|
3960
|
+
offlineTimeout: this._spaceMemberPresenceOfflineTimeout,
|
|
3932
3961
|
identityKey: this._signingContext.identityKey,
|
|
3933
3962
|
gossip
|
|
3934
3963
|
});
|
|
@@ -3957,7 +3986,7 @@ var DataSpaceManager = class {
|
|
|
3957
3986
|
onAuthFailure: () => {
|
|
3958
3987
|
import_log11.log.warn("auth failure", void 0, {
|
|
3959
3988
|
F: __dxlog_file13,
|
|
3960
|
-
L:
|
|
3989
|
+
L: 254,
|
|
3961
3990
|
S: this,
|
|
3962
3991
|
C: (f, a) => f(...a)
|
|
3963
3992
|
});
|
|
@@ -3981,7 +4010,7 @@ var DataSpaceManager = class {
|
|
|
3981
4010
|
space: space.key
|
|
3982
4011
|
}, {
|
|
3983
4012
|
F: __dxlog_file13,
|
|
3984
|
-
L:
|
|
4013
|
+
L: 272,
|
|
3985
4014
|
S: this,
|
|
3986
4015
|
C: (f, a) => f(...a)
|
|
3987
4016
|
});
|
|
@@ -3993,7 +4022,7 @@ var DataSpaceManager = class {
|
|
|
3993
4022
|
open: this._isOpen
|
|
3994
4023
|
}, {
|
|
3995
4024
|
F: __dxlog_file13,
|
|
3996
|
-
L:
|
|
4025
|
+
L: 279,
|
|
3997
4026
|
S: this,
|
|
3998
4027
|
C: (f, a) => f(...a)
|
|
3999
4028
|
});
|
|
@@ -4006,7 +4035,7 @@ var DataSpaceManager = class {
|
|
|
4006
4035
|
space: space.key
|
|
4007
4036
|
}, {
|
|
4008
4037
|
F: __dxlog_file13,
|
|
4009
|
-
L:
|
|
4038
|
+
L: 285,
|
|
4010
4039
|
S: this,
|
|
4011
4040
|
C: (f, a) => f(...a)
|
|
4012
4041
|
});
|
|
@@ -4268,11 +4297,12 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4268
4297
|
}
|
|
4269
4298
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4270
4299
|
var ServiceContext = class {
|
|
4271
|
-
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
4300
|
+
constructor(storage, networkManager, signalManager, modelFactory, _runtimeParams) {
|
|
4272
4301
|
this.storage = storage;
|
|
4273
4302
|
this.networkManager = networkManager;
|
|
4274
4303
|
this.signalManager = signalManager;
|
|
4275
4304
|
this.modelFactory = modelFactory;
|
|
4305
|
+
this._runtimeParams = _runtimeParams;
|
|
4276
4306
|
this.initialized = new import_async14.Trigger();
|
|
4277
4307
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
4278
4308
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
@@ -4299,7 +4329,7 @@ var ServiceContext = class {
|
|
|
4299
4329
|
modelFactory: this.modelFactory,
|
|
4300
4330
|
snapshotStore: this.snapshotStore
|
|
4301
4331
|
});
|
|
4302
|
-
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
4332
|
+
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
4303
4333
|
this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
|
|
4304
4334
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4305
4335
|
this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
@@ -4308,7 +4338,7 @@ var ServiceContext = class {
|
|
|
4308
4338
|
await this._checkStorageVersion();
|
|
4309
4339
|
(0, import_log13.log)("opening...", void 0, {
|
|
4310
4340
|
F: __dxlog_file15,
|
|
4311
|
-
L:
|
|
4341
|
+
L: 146,
|
|
4312
4342
|
S: this,
|
|
4313
4343
|
C: (f, a) => f(...a)
|
|
4314
4344
|
});
|
|
@@ -4316,7 +4346,7 @@ var ServiceContext = class {
|
|
|
4316
4346
|
id: this._instanceId
|
|
4317
4347
|
}), {
|
|
4318
4348
|
F: __dxlog_file15,
|
|
4319
|
-
L:
|
|
4349
|
+
L: 147,
|
|
4320
4350
|
S: this,
|
|
4321
4351
|
C: (f, a) => f(...a)
|
|
4322
4352
|
});
|
|
@@ -4332,13 +4362,13 @@ var ServiceContext = class {
|
|
|
4332
4362
|
id: this._instanceId
|
|
4333
4363
|
}), {
|
|
4334
4364
|
F: __dxlog_file15,
|
|
4335
|
-
L:
|
|
4365
|
+
L: 157,
|
|
4336
4366
|
S: this,
|
|
4337
4367
|
C: (f, a) => f(...a)
|
|
4338
4368
|
});
|
|
4339
4369
|
(0, import_log13.log)("opened", void 0, {
|
|
4340
4370
|
F: __dxlog_file15,
|
|
4341
|
-
L:
|
|
4371
|
+
L: 158,
|
|
4342
4372
|
S: this,
|
|
4343
4373
|
C: (f, a) => f(...a)
|
|
4344
4374
|
});
|
|
@@ -4346,7 +4376,7 @@ var ServiceContext = class {
|
|
|
4346
4376
|
async close() {
|
|
4347
4377
|
(0, import_log13.log)("closing...", void 0, {
|
|
4348
4378
|
F: __dxlog_file15,
|
|
4349
|
-
L:
|
|
4379
|
+
L: 162,
|
|
4350
4380
|
S: this,
|
|
4351
4381
|
C: (f, a) => f(...a)
|
|
4352
4382
|
});
|
|
@@ -4364,7 +4394,7 @@ var ServiceContext = class {
|
|
|
4364
4394
|
await this.metadataStore.close();
|
|
4365
4395
|
(0, import_log13.log)("closed", void 0, {
|
|
4366
4396
|
F: __dxlog_file15,
|
|
4367
|
-
L:
|
|
4397
|
+
L: 175,
|
|
4368
4398
|
S: this,
|
|
4369
4399
|
C: (f, a) => f(...a)
|
|
4370
4400
|
});
|
|
@@ -4378,7 +4408,7 @@ var ServiceContext = class {
|
|
|
4378
4408
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4379
4409
|
(0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4380
4410
|
F: __dxlog_file15,
|
|
4381
|
-
L:
|
|
4411
|
+
L: 186,
|
|
4382
4412
|
S: this,
|
|
4383
4413
|
A: [
|
|
4384
4414
|
"factory",
|
|
@@ -4410,7 +4440,7 @@ var ServiceContext = class {
|
|
|
4410
4440
|
async _initialize(ctx) {
|
|
4411
4441
|
(0, import_log13.log)("initializing spaces...", void 0, {
|
|
4412
4442
|
F: __dxlog_file15,
|
|
4413
|
-
L:
|
|
4443
|
+
L: 217,
|
|
4414
4444
|
S: this,
|
|
4415
4445
|
C: (f, a) => f(...a)
|
|
4416
4446
|
});
|
|
@@ -4428,12 +4458,12 @@ var ServiceContext = class {
|
|
|
4428
4458
|
});
|
|
4429
4459
|
}
|
|
4430
4460
|
};
|
|
4431
|
-
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4461
|
+
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
|
|
4432
4462
|
await this.dataSpaceManager.open();
|
|
4433
4463
|
this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
|
|
4434
4464
|
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4435
4465
|
F: __dxlog_file15,
|
|
4436
|
-
L:
|
|
4466
|
+
L: 242,
|
|
4437
4467
|
S: this,
|
|
4438
4468
|
A: [
|
|
4439
4469
|
"this.dataSpaceManager",
|
|
@@ -4457,7 +4487,7 @@ var ServiceContext = class {
|
|
|
4457
4487
|
details: assertion
|
|
4458
4488
|
}, {
|
|
4459
4489
|
F: __dxlog_file15,
|
|
4460
|
-
L:
|
|
4490
|
+
L: 258,
|
|
4461
4491
|
S: this,
|
|
4462
4492
|
C: (f, a) => f(...a)
|
|
4463
4493
|
});
|
|
@@ -4468,7 +4498,7 @@ var ServiceContext = class {
|
|
|
4468
4498
|
details: assertion
|
|
4469
4499
|
}, {
|
|
4470
4500
|
F: __dxlog_file15,
|
|
4471
|
-
L:
|
|
4501
|
+
L: 262,
|
|
4472
4502
|
S: this,
|
|
4473
4503
|
C: (f, a) => f(...a)
|
|
4474
4504
|
});
|
|
@@ -4479,7 +4509,7 @@ var ServiceContext = class {
|
|
|
4479
4509
|
details: assertion
|
|
4480
4510
|
}, {
|
|
4481
4511
|
F: __dxlog_file15,
|
|
4482
|
-
L:
|
|
4512
|
+
L: 267,
|
|
4483
4513
|
S: this,
|
|
4484
4514
|
C: (f, a) => f(...a)
|
|
4485
4515
|
});
|
|
@@ -4490,7 +4520,7 @@ var ServiceContext = class {
|
|
|
4490
4520
|
} catch (err) {
|
|
4491
4521
|
import_log13.log.catch(err, void 0, {
|
|
4492
4522
|
F: __dxlog_file15,
|
|
4493
|
-
L:
|
|
4523
|
+
L: 273,
|
|
4494
4524
|
S: this,
|
|
4495
4525
|
C: (f, a) => f(...a)
|
|
4496
4526
|
});
|
|
@@ -4628,6 +4658,7 @@ var toStorageType = (type) => {
|
|
|
4628
4658
|
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
4629
4659
|
}
|
|
4630
4660
|
};
|
|
4661
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4631
4662
|
var DevicesServiceImpl = class {
|
|
4632
4663
|
constructor(_identityManager) {
|
|
4633
4664
|
this._identityManager = _identityManager;
|
|
@@ -4644,22 +4675,58 @@ var DevicesServiceImpl = class {
|
|
|
4644
4675
|
devices: []
|
|
4645
4676
|
});
|
|
4646
4677
|
} else {
|
|
4678
|
+
(0, import_invariant17.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
4679
|
+
F: __dxlog_file17,
|
|
4680
|
+
L: 32,
|
|
4681
|
+
S: this,
|
|
4682
|
+
A: [
|
|
4683
|
+
"this._identityManager.identity?.presence",
|
|
4684
|
+
"'presence not present'"
|
|
4685
|
+
]
|
|
4686
|
+
});
|
|
4687
|
+
const peers = this._identityManager.identity.presence.getPeersOnline();
|
|
4647
4688
|
next({
|
|
4648
|
-
devices: Array.from(deviceKeys.entries()).map(([key, profile]) =>
|
|
4649
|
-
deviceKey
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4689
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
|
|
4690
|
+
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
4691
|
+
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
4692
|
+
return {
|
|
4693
|
+
deviceKey: key,
|
|
4694
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services14.DeviceKind.CURRENT : import_services14.DeviceKind.TRUSTED,
|
|
4695
|
+
profile,
|
|
4696
|
+
presence: isMe ? import_services14.Device.PresenceState.ONLINE : peerState ? import_services14.Device.PresenceState.ONLINE : import_services14.Device.PresenceState.OFFLINE
|
|
4697
|
+
};
|
|
4698
|
+
})
|
|
4699
|
+
});
|
|
4700
|
+
}
|
|
4701
|
+
};
|
|
4702
|
+
let identitySubscribed = false;
|
|
4703
|
+
let presenceSubscribed = false;
|
|
4704
|
+
const subscribeIdentity = () => {
|
|
4705
|
+
if (!identitySubscribed) {
|
|
4706
|
+
this._identityManager.identity?.stateUpdate.on(() => {
|
|
4707
|
+
update();
|
|
4653
4708
|
});
|
|
4709
|
+
identitySubscribed = true;
|
|
4710
|
+
}
|
|
4711
|
+
};
|
|
4712
|
+
const subscribePresence = () => {
|
|
4713
|
+
if (!presenceSubscribed) {
|
|
4714
|
+
this._identityManager.identity?.presence?.updated.on(() => {
|
|
4715
|
+
update();
|
|
4716
|
+
});
|
|
4717
|
+
presenceSubscribed = true;
|
|
4654
4718
|
}
|
|
4655
4719
|
};
|
|
4656
4720
|
const subscriptions = new import_async16.EventSubscriptions();
|
|
4721
|
+
if (this._identityManager.identity) {
|
|
4722
|
+
subscribeIdentity();
|
|
4723
|
+
subscribePresence();
|
|
4724
|
+
}
|
|
4657
4725
|
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
4658
4726
|
update();
|
|
4659
4727
|
if (this._identityManager.identity) {
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
}));
|
|
4728
|
+
subscribeIdentity();
|
|
4729
|
+
subscribePresence();
|
|
4663
4730
|
}
|
|
4664
4731
|
}));
|
|
4665
4732
|
update();
|
|
@@ -4869,7 +4936,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
4869
4936
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4870
4937
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4871
4938
|
}
|
|
4872
|
-
var
|
|
4939
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
4873
4940
|
var createDefaultModelFactory = () => {
|
|
4874
4941
|
return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
|
|
4875
4942
|
};
|
|
@@ -4882,7 +4949,8 @@ var ClientServicesHost = class {
|
|
|
4882
4949
|
storage,
|
|
4883
4950
|
// TODO(wittjosiah): Turn this on by default.
|
|
4884
4951
|
lockKey,
|
|
4885
|
-
callbacks
|
|
4952
|
+
callbacks,
|
|
4953
|
+
runtimeParams
|
|
4886
4954
|
} = {}) {
|
|
4887
4955
|
this._tracingService = import_tracing7.TRACE_PROCESSOR.createTraceSender();
|
|
4888
4956
|
this._statusUpdate = new import_async15.Event();
|
|
@@ -4891,6 +4959,7 @@ var ClientServicesHost = class {
|
|
|
4891
4959
|
this._storage = storage;
|
|
4892
4960
|
this._modelFactory = modelFactory;
|
|
4893
4961
|
this._callbacks = callbacks;
|
|
4962
|
+
this._runtimeParams = runtimeParams;
|
|
4894
4963
|
if (config) {
|
|
4895
4964
|
this.initialize({
|
|
4896
4965
|
config,
|
|
@@ -4958,8 +5027,8 @@ var ClientServicesHost = class {
|
|
|
4958
5027
|
*/
|
|
4959
5028
|
initialize({ config, ...options }) {
|
|
4960
5029
|
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
4961
|
-
F:
|
|
4962
|
-
L:
|
|
5030
|
+
F: __dxlog_file18,
|
|
5031
|
+
L: 190,
|
|
4963
5032
|
S: this,
|
|
4964
5033
|
A: [
|
|
4965
5034
|
"!this._open",
|
|
@@ -4967,15 +5036,15 @@ var ClientServicesHost = class {
|
|
|
4967
5036
|
]
|
|
4968
5037
|
});
|
|
4969
5038
|
(0, import_log15.log)("initializing...", void 0, {
|
|
4970
|
-
F:
|
|
4971
|
-
L:
|
|
5039
|
+
F: __dxlog_file18,
|
|
5040
|
+
L: 191,
|
|
4972
5041
|
S: this,
|
|
4973
5042
|
C: (f, a) => f(...a)
|
|
4974
5043
|
});
|
|
4975
5044
|
if (config) {
|
|
4976
5045
|
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
4977
|
-
F:
|
|
4978
|
-
L:
|
|
5046
|
+
F: __dxlog_file18,
|
|
5047
|
+
L: 194,
|
|
4979
5048
|
S: this,
|
|
4980
5049
|
A: [
|
|
4981
5050
|
"!this._config",
|
|
@@ -4992,8 +5061,8 @@ var ClientServicesHost = class {
|
|
|
4992
5061
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4993
5062
|
this._signalManager = signalManager;
|
|
4994
5063
|
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
4995
|
-
F:
|
|
4996
|
-
L:
|
|
5064
|
+
F: __dxlog_file18,
|
|
5065
|
+
L: 210,
|
|
4997
5066
|
S: this,
|
|
4998
5067
|
A: [
|
|
4999
5068
|
"!this._networkManager",
|
|
@@ -5006,8 +5075,8 @@ var ClientServicesHost = class {
|
|
|
5006
5075
|
signalManager
|
|
5007
5076
|
});
|
|
5008
5077
|
(0, import_log15.log)("initialized", void 0, {
|
|
5009
|
-
F:
|
|
5010
|
-
L:
|
|
5078
|
+
F: __dxlog_file18,
|
|
5079
|
+
L: 217,
|
|
5011
5080
|
S: this,
|
|
5012
5081
|
C: (f, a) => f(...a)
|
|
5013
5082
|
});
|
|
@@ -5020,14 +5089,14 @@ var ClientServicesHost = class {
|
|
|
5020
5089
|
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.begin({
|
|
5021
5090
|
id: traceId
|
|
5022
5091
|
}), {
|
|
5023
|
-
F:
|
|
5024
|
-
L:
|
|
5092
|
+
F: __dxlog_file18,
|
|
5093
|
+
L: 228,
|
|
5025
5094
|
S: this,
|
|
5026
5095
|
C: (f, a) => f(...a)
|
|
5027
5096
|
});
|
|
5028
5097
|
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
5029
|
-
F:
|
|
5030
|
-
L:
|
|
5098
|
+
F: __dxlog_file18,
|
|
5099
|
+
L: 230,
|
|
5031
5100
|
S: this,
|
|
5032
5101
|
A: [
|
|
5033
5102
|
"this._config",
|
|
@@ -5035,8 +5104,8 @@ var ClientServicesHost = class {
|
|
|
5035
5104
|
]
|
|
5036
5105
|
});
|
|
5037
5106
|
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
5038
|
-
F:
|
|
5039
|
-
L:
|
|
5107
|
+
F: __dxlog_file18,
|
|
5108
|
+
L: 231,
|
|
5040
5109
|
S: this,
|
|
5041
5110
|
A: [
|
|
5042
5111
|
"this._storage",
|
|
@@ -5044,8 +5113,8 @@ var ClientServicesHost = class {
|
|
|
5044
5113
|
]
|
|
5045
5114
|
});
|
|
5046
5115
|
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
5047
|
-
F:
|
|
5048
|
-
L:
|
|
5116
|
+
F: __dxlog_file18,
|
|
5117
|
+
L: 232,
|
|
5049
5118
|
S: this,
|
|
5050
5119
|
A: [
|
|
5051
5120
|
"this._signalManager",
|
|
@@ -5053,8 +5122,8 @@ var ClientServicesHost = class {
|
|
|
5053
5122
|
]
|
|
5054
5123
|
});
|
|
5055
5124
|
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
5056
|
-
F:
|
|
5057
|
-
L:
|
|
5125
|
+
F: __dxlog_file18,
|
|
5126
|
+
L: 233,
|
|
5058
5127
|
S: this,
|
|
5059
5128
|
A: [
|
|
5060
5129
|
"this._networkManager",
|
|
@@ -5065,14 +5134,14 @@ var ClientServicesHost = class {
|
|
|
5065
5134
|
(0, import_log15.log)("opening...", {
|
|
5066
5135
|
lockKey: this._resourceLock?.lockKey
|
|
5067
5136
|
}, {
|
|
5068
|
-
F:
|
|
5069
|
-
L:
|
|
5137
|
+
F: __dxlog_file18,
|
|
5138
|
+
L: 236,
|
|
5070
5139
|
S: this,
|
|
5071
5140
|
C: (f, a) => f(...a)
|
|
5072
5141
|
});
|
|
5073
5142
|
await this._resourceLock?.acquire();
|
|
5074
5143
|
await this._loggingService.open();
|
|
5075
|
-
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
5144
|
+
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory, this._runtimeParams);
|
|
5076
5145
|
this._serviceRegistry.setServices({
|
|
5077
5146
|
SystemService: this._systemService,
|
|
5078
5147
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
@@ -5111,16 +5180,16 @@ var ClientServicesHost = class {
|
|
|
5111
5180
|
(0, import_log15.log)("opened", {
|
|
5112
5181
|
deviceKey
|
|
5113
5182
|
}, {
|
|
5114
|
-
F:
|
|
5115
|
-
L:
|
|
5183
|
+
F: __dxlog_file18,
|
|
5184
|
+
L: 310,
|
|
5116
5185
|
S: this,
|
|
5117
5186
|
C: (f, a) => f(...a)
|
|
5118
5187
|
});
|
|
5119
5188
|
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.end({
|
|
5120
5189
|
id: traceId
|
|
5121
5190
|
}), {
|
|
5122
|
-
F:
|
|
5123
|
-
L:
|
|
5191
|
+
F: __dxlog_file18,
|
|
5192
|
+
L: 311,
|
|
5124
5193
|
S: this,
|
|
5125
5194
|
C: (f, a) => f(...a)
|
|
5126
5195
|
});
|
|
@@ -5133,8 +5202,8 @@ var ClientServicesHost = class {
|
|
|
5133
5202
|
(0, import_log15.log)("closing...", {
|
|
5134
5203
|
deviceKey
|
|
5135
5204
|
}, {
|
|
5136
|
-
F:
|
|
5137
|
-
L:
|
|
5205
|
+
F: __dxlog_file18,
|
|
5206
|
+
L: 322,
|
|
5138
5207
|
S: this,
|
|
5139
5208
|
C: (f, a) => f(...a)
|
|
5140
5209
|
});
|
|
@@ -5149,8 +5218,8 @@ var ClientServicesHost = class {
|
|
|
5149
5218
|
(0, import_log15.log)("closed", {
|
|
5150
5219
|
deviceKey
|
|
5151
5220
|
}, {
|
|
5152
|
-
F:
|
|
5153
|
-
L:
|
|
5221
|
+
F: __dxlog_file18,
|
|
5222
|
+
L: 329,
|
|
5154
5223
|
S: this,
|
|
5155
5224
|
C: (f, a) => f(...a)
|
|
5156
5225
|
});
|
|
@@ -5160,30 +5229,30 @@ var ClientServicesHost = class {
|
|
|
5160
5229
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.begin({
|
|
5161
5230
|
id: traceId
|
|
5162
5231
|
}), {
|
|
5163
|
-
F:
|
|
5164
|
-
L:
|
|
5232
|
+
F: __dxlog_file18,
|
|
5233
|
+
L: 334,
|
|
5165
5234
|
S: this,
|
|
5166
5235
|
C: (f, a) => f(...a)
|
|
5167
5236
|
});
|
|
5168
5237
|
(0, import_log15.log)("resetting...", void 0, {
|
|
5169
|
-
F:
|
|
5170
|
-
L:
|
|
5238
|
+
F: __dxlog_file18,
|
|
5239
|
+
L: 336,
|
|
5171
5240
|
S: this,
|
|
5172
5241
|
C: (f, a) => f(...a)
|
|
5173
5242
|
});
|
|
5174
5243
|
await this._serviceContext?.close();
|
|
5175
5244
|
await this._storage.reset();
|
|
5176
5245
|
(0, import_log15.log)("reset", void 0, {
|
|
5177
|
-
F:
|
|
5178
|
-
L:
|
|
5246
|
+
F: __dxlog_file18,
|
|
5247
|
+
L: 339,
|
|
5179
5248
|
S: this,
|
|
5180
5249
|
C: (f, a) => f(...a)
|
|
5181
5250
|
});
|
|
5182
5251
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.end({
|
|
5183
5252
|
id: traceId
|
|
5184
5253
|
}), {
|
|
5185
|
-
F:
|
|
5186
|
-
L:
|
|
5254
|
+
F: __dxlog_file18,
|
|
5255
|
+
L: 340,
|
|
5187
5256
|
S: this,
|
|
5188
5257
|
C: (f, a) => f(...a)
|
|
5189
5258
|
});
|
|
@@ -5197,8 +5266,8 @@ var ClientServicesHost = class {
|
|
|
5197
5266
|
obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
|
|
5198
5267
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5199
5268
|
(0, import_invariant16.invariant)(automergeIndex, void 0, {
|
|
5200
|
-
F:
|
|
5201
|
-
L:
|
|
5269
|
+
F: __dxlog_file18,
|
|
5270
|
+
L: 355,
|
|
5202
5271
|
S: this,
|
|
5203
5272
|
A: [
|
|
5204
5273
|
"automergeIndex",
|
|
@@ -5210,7 +5279,7 @@ var ClientServicesHost = class {
|
|
|
5210
5279
|
document.change((doc) => {
|
|
5211
5280
|
(0, import_util9.assignDeep)(doc, [
|
|
5212
5281
|
"objects",
|
|
5213
|
-
|
|
5282
|
+
(0, import_echo_schema.getAutomergeObjectCore)(obj).id
|
|
5214
5283
|
], (0, import_echo_schema.getRawDoc)(obj).handle.docSync());
|
|
5215
5284
|
});
|
|
5216
5285
|
return identity;
|
|
@@ -5267,4 +5336,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5267
5336
|
subscribeToSpaces,
|
|
5268
5337
|
subscribeToSwarmInfo
|
|
5269
5338
|
});
|
|
5270
|
-
//# sourceMappingURL=chunk-
|
|
5339
|
+
//# sourceMappingURL=chunk-5HSF6RSJ.cjs.map
|