@dxos/client-services 0.4.6 → 0.4.7-main.06facb4
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-NVX5DORM.mjs → chunk-WFFCVLUR.mjs} +206 -139
- package/dist/lib/browser/chunk-WFFCVLUR.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2 -2
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-JQTJTW5S.cjs → chunk-4JAI4X5H.cjs} +197 -130
- package/dist/lib/node/chunk-4JAI4X5H.cjs.map +7 -0
- package/dist/lib/node/index.cjs +38 -38
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +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/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +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/packlets/spaces/spaces-service.ts +1 -3
- package/src/packlets/vault/shared-worker-connection.ts +1 -1
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-NVX5DORM.mjs.map +0 -7
- package/dist/lib/node/chunk-JQTJTW5S.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_4JAI4X5H_exports = {};
|
|
30
|
+
__export(chunk_4JAI4X5H_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -60,7 +60,7 @@ __export(chunk_JQTJTW5S_exports, {
|
|
|
60
60
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
61
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
62
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
63
|
+
module.exports = __toCommonJS(chunk_4JAI4X5H_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.
|
|
2785
|
+
var DXOS_VERSION = "0.4.7-main.06facb4";
|
|
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
|
});
|
|
@@ -4241,9 +4270,7 @@ var SpacesServiceImpl = class {
|
|
|
4241
4270
|
return {
|
|
4242
4271
|
identity: {
|
|
4243
4272
|
identityKey: member.key,
|
|
4244
|
-
profile: {
|
|
4245
|
-
displayName: member.profile?.displayName
|
|
4246
|
-
}
|
|
4273
|
+
profile: member.profile ?? {}
|
|
4247
4274
|
},
|
|
4248
4275
|
presence: member.removed ? import_services11.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services11.SpaceMember.PresenceState.ONLINE : import_services11.SpaceMember.PresenceState.OFFLINE,
|
|
4249
4276
|
peerStates: peers
|
|
@@ -4268,11 +4295,12 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4268
4295
|
}
|
|
4269
4296
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4270
4297
|
var ServiceContext = class {
|
|
4271
|
-
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
4298
|
+
constructor(storage, networkManager, signalManager, modelFactory, _runtimeParams) {
|
|
4272
4299
|
this.storage = storage;
|
|
4273
4300
|
this.networkManager = networkManager;
|
|
4274
4301
|
this.signalManager = signalManager;
|
|
4275
4302
|
this.modelFactory = modelFactory;
|
|
4303
|
+
this._runtimeParams = _runtimeParams;
|
|
4276
4304
|
this.initialized = new import_async14.Trigger();
|
|
4277
4305
|
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
4278
4306
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
@@ -4299,7 +4327,7 @@ var ServiceContext = class {
|
|
|
4299
4327
|
modelFactory: this.modelFactory,
|
|
4300
4328
|
snapshotStore: this.snapshotStore
|
|
4301
4329
|
});
|
|
4302
|
-
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
4330
|
+
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
4303
4331
|
this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
|
|
4304
4332
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4305
4333
|
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 +4336,7 @@ var ServiceContext = class {
|
|
|
4308
4336
|
await this._checkStorageVersion();
|
|
4309
4337
|
(0, import_log13.log)("opening...", void 0, {
|
|
4310
4338
|
F: __dxlog_file15,
|
|
4311
|
-
L:
|
|
4339
|
+
L: 146,
|
|
4312
4340
|
S: this,
|
|
4313
4341
|
C: (f, a) => f(...a)
|
|
4314
4342
|
});
|
|
@@ -4316,7 +4344,7 @@ var ServiceContext = class {
|
|
|
4316
4344
|
id: this._instanceId
|
|
4317
4345
|
}), {
|
|
4318
4346
|
F: __dxlog_file15,
|
|
4319
|
-
L:
|
|
4347
|
+
L: 147,
|
|
4320
4348
|
S: this,
|
|
4321
4349
|
C: (f, a) => f(...a)
|
|
4322
4350
|
});
|
|
@@ -4332,13 +4360,13 @@ var ServiceContext = class {
|
|
|
4332
4360
|
id: this._instanceId
|
|
4333
4361
|
}), {
|
|
4334
4362
|
F: __dxlog_file15,
|
|
4335
|
-
L:
|
|
4363
|
+
L: 157,
|
|
4336
4364
|
S: this,
|
|
4337
4365
|
C: (f, a) => f(...a)
|
|
4338
4366
|
});
|
|
4339
4367
|
(0, import_log13.log)("opened", void 0, {
|
|
4340
4368
|
F: __dxlog_file15,
|
|
4341
|
-
L:
|
|
4369
|
+
L: 158,
|
|
4342
4370
|
S: this,
|
|
4343
4371
|
C: (f, a) => f(...a)
|
|
4344
4372
|
});
|
|
@@ -4346,7 +4374,7 @@ var ServiceContext = class {
|
|
|
4346
4374
|
async close() {
|
|
4347
4375
|
(0, import_log13.log)("closing...", void 0, {
|
|
4348
4376
|
F: __dxlog_file15,
|
|
4349
|
-
L:
|
|
4377
|
+
L: 162,
|
|
4350
4378
|
S: this,
|
|
4351
4379
|
C: (f, a) => f(...a)
|
|
4352
4380
|
});
|
|
@@ -4364,7 +4392,7 @@ var ServiceContext = class {
|
|
|
4364
4392
|
await this.metadataStore.close();
|
|
4365
4393
|
(0, import_log13.log)("closed", void 0, {
|
|
4366
4394
|
F: __dxlog_file15,
|
|
4367
|
-
L:
|
|
4395
|
+
L: 175,
|
|
4368
4396
|
S: this,
|
|
4369
4397
|
C: (f, a) => f(...a)
|
|
4370
4398
|
});
|
|
@@ -4378,7 +4406,7 @@ var ServiceContext = class {
|
|
|
4378
4406
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4379
4407
|
(0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4380
4408
|
F: __dxlog_file15,
|
|
4381
|
-
L:
|
|
4409
|
+
L: 186,
|
|
4382
4410
|
S: this,
|
|
4383
4411
|
A: [
|
|
4384
4412
|
"factory",
|
|
@@ -4410,7 +4438,7 @@ var ServiceContext = class {
|
|
|
4410
4438
|
async _initialize(ctx) {
|
|
4411
4439
|
(0, import_log13.log)("initializing spaces...", void 0, {
|
|
4412
4440
|
F: __dxlog_file15,
|
|
4413
|
-
L:
|
|
4441
|
+
L: 217,
|
|
4414
4442
|
S: this,
|
|
4415
4443
|
C: (f, a) => f(...a)
|
|
4416
4444
|
});
|
|
@@ -4428,12 +4456,12 @@ var ServiceContext = class {
|
|
|
4428
4456
|
});
|
|
4429
4457
|
}
|
|
4430
4458
|
};
|
|
4431
|
-
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4459
|
+
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
|
|
4432
4460
|
await this.dataSpaceManager.open();
|
|
4433
4461
|
this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
|
|
4434
4462
|
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4435
4463
|
F: __dxlog_file15,
|
|
4436
|
-
L:
|
|
4464
|
+
L: 242,
|
|
4437
4465
|
S: this,
|
|
4438
4466
|
A: [
|
|
4439
4467
|
"this.dataSpaceManager",
|
|
@@ -4457,7 +4485,7 @@ var ServiceContext = class {
|
|
|
4457
4485
|
details: assertion
|
|
4458
4486
|
}, {
|
|
4459
4487
|
F: __dxlog_file15,
|
|
4460
|
-
L:
|
|
4488
|
+
L: 258,
|
|
4461
4489
|
S: this,
|
|
4462
4490
|
C: (f, a) => f(...a)
|
|
4463
4491
|
});
|
|
@@ -4468,7 +4496,7 @@ var ServiceContext = class {
|
|
|
4468
4496
|
details: assertion
|
|
4469
4497
|
}, {
|
|
4470
4498
|
F: __dxlog_file15,
|
|
4471
|
-
L:
|
|
4499
|
+
L: 262,
|
|
4472
4500
|
S: this,
|
|
4473
4501
|
C: (f, a) => f(...a)
|
|
4474
4502
|
});
|
|
@@ -4479,7 +4507,7 @@ var ServiceContext = class {
|
|
|
4479
4507
|
details: assertion
|
|
4480
4508
|
}, {
|
|
4481
4509
|
F: __dxlog_file15,
|
|
4482
|
-
L:
|
|
4510
|
+
L: 267,
|
|
4483
4511
|
S: this,
|
|
4484
4512
|
C: (f, a) => f(...a)
|
|
4485
4513
|
});
|
|
@@ -4490,7 +4518,7 @@ var ServiceContext = class {
|
|
|
4490
4518
|
} catch (err) {
|
|
4491
4519
|
import_log13.log.catch(err, void 0, {
|
|
4492
4520
|
F: __dxlog_file15,
|
|
4493
|
-
L:
|
|
4521
|
+
L: 273,
|
|
4494
4522
|
S: this,
|
|
4495
4523
|
C: (f, a) => f(...a)
|
|
4496
4524
|
});
|
|
@@ -4628,6 +4656,7 @@ var toStorageType = (type) => {
|
|
|
4628
4656
|
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
4629
4657
|
}
|
|
4630
4658
|
};
|
|
4659
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4631
4660
|
var DevicesServiceImpl = class {
|
|
4632
4661
|
constructor(_identityManager) {
|
|
4633
4662
|
this._identityManager = _identityManager;
|
|
@@ -4644,22 +4673,58 @@ var DevicesServiceImpl = class {
|
|
|
4644
4673
|
devices: []
|
|
4645
4674
|
});
|
|
4646
4675
|
} else {
|
|
4676
|
+
(0, import_invariant17.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
4677
|
+
F: __dxlog_file17,
|
|
4678
|
+
L: 32,
|
|
4679
|
+
S: this,
|
|
4680
|
+
A: [
|
|
4681
|
+
"this._identityManager.identity?.presence",
|
|
4682
|
+
"'presence not present'"
|
|
4683
|
+
]
|
|
4684
|
+
});
|
|
4685
|
+
const peers = this._identityManager.identity.presence.getPeersOnline();
|
|
4647
4686
|
next({
|
|
4648
|
-
devices: Array.from(deviceKeys.entries()).map(([key, profile]) =>
|
|
4649
|
-
deviceKey
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4687
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
|
|
4688
|
+
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
4689
|
+
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
4690
|
+
return {
|
|
4691
|
+
deviceKey: key,
|
|
4692
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services14.DeviceKind.CURRENT : import_services14.DeviceKind.TRUSTED,
|
|
4693
|
+
profile,
|
|
4694
|
+
presence: isMe ? import_services14.Device.PresenceState.ONLINE : peerState ? import_services14.Device.PresenceState.ONLINE : import_services14.Device.PresenceState.OFFLINE
|
|
4695
|
+
};
|
|
4696
|
+
})
|
|
4697
|
+
});
|
|
4698
|
+
}
|
|
4699
|
+
};
|
|
4700
|
+
let identitySubscribed = false;
|
|
4701
|
+
let presenceSubscribed = false;
|
|
4702
|
+
const subscribeIdentity = () => {
|
|
4703
|
+
if (!identitySubscribed) {
|
|
4704
|
+
this._identityManager.identity?.stateUpdate.on(() => {
|
|
4705
|
+
update();
|
|
4653
4706
|
});
|
|
4707
|
+
identitySubscribed = true;
|
|
4708
|
+
}
|
|
4709
|
+
};
|
|
4710
|
+
const subscribePresence = () => {
|
|
4711
|
+
if (!presenceSubscribed) {
|
|
4712
|
+
this._identityManager.identity?.presence?.updated.on(() => {
|
|
4713
|
+
update();
|
|
4714
|
+
});
|
|
4715
|
+
presenceSubscribed = true;
|
|
4654
4716
|
}
|
|
4655
4717
|
};
|
|
4656
4718
|
const subscriptions = new import_async16.EventSubscriptions();
|
|
4719
|
+
if (this._identityManager.identity) {
|
|
4720
|
+
subscribeIdentity();
|
|
4721
|
+
subscribePresence();
|
|
4722
|
+
}
|
|
4657
4723
|
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
4658
4724
|
update();
|
|
4659
4725
|
if (this._identityManager.identity) {
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
}));
|
|
4726
|
+
subscribeIdentity();
|
|
4727
|
+
subscribePresence();
|
|
4663
4728
|
}
|
|
4664
4729
|
}));
|
|
4665
4730
|
update();
|
|
@@ -4869,7 +4934,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
4869
4934
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4870
4935
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4871
4936
|
}
|
|
4872
|
-
var
|
|
4937
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
4873
4938
|
var createDefaultModelFactory = () => {
|
|
4874
4939
|
return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
|
|
4875
4940
|
};
|
|
@@ -4882,7 +4947,8 @@ var ClientServicesHost = class {
|
|
|
4882
4947
|
storage,
|
|
4883
4948
|
// TODO(wittjosiah): Turn this on by default.
|
|
4884
4949
|
lockKey,
|
|
4885
|
-
callbacks
|
|
4950
|
+
callbacks,
|
|
4951
|
+
runtimeParams
|
|
4886
4952
|
} = {}) {
|
|
4887
4953
|
this._tracingService = import_tracing7.TRACE_PROCESSOR.createTraceSender();
|
|
4888
4954
|
this._statusUpdate = new import_async15.Event();
|
|
@@ -4891,6 +4957,7 @@ var ClientServicesHost = class {
|
|
|
4891
4957
|
this._storage = storage;
|
|
4892
4958
|
this._modelFactory = modelFactory;
|
|
4893
4959
|
this._callbacks = callbacks;
|
|
4960
|
+
this._runtimeParams = runtimeParams;
|
|
4894
4961
|
if (config) {
|
|
4895
4962
|
this.initialize({
|
|
4896
4963
|
config,
|
|
@@ -4958,8 +5025,8 @@ var ClientServicesHost = class {
|
|
|
4958
5025
|
*/
|
|
4959
5026
|
initialize({ config, ...options }) {
|
|
4960
5027
|
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
4961
|
-
F:
|
|
4962
|
-
L:
|
|
5028
|
+
F: __dxlog_file18,
|
|
5029
|
+
L: 190,
|
|
4963
5030
|
S: this,
|
|
4964
5031
|
A: [
|
|
4965
5032
|
"!this._open",
|
|
@@ -4967,15 +5034,15 @@ var ClientServicesHost = class {
|
|
|
4967
5034
|
]
|
|
4968
5035
|
});
|
|
4969
5036
|
(0, import_log15.log)("initializing...", void 0, {
|
|
4970
|
-
F:
|
|
4971
|
-
L:
|
|
5037
|
+
F: __dxlog_file18,
|
|
5038
|
+
L: 191,
|
|
4972
5039
|
S: this,
|
|
4973
5040
|
C: (f, a) => f(...a)
|
|
4974
5041
|
});
|
|
4975
5042
|
if (config) {
|
|
4976
5043
|
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
4977
|
-
F:
|
|
4978
|
-
L:
|
|
5044
|
+
F: __dxlog_file18,
|
|
5045
|
+
L: 194,
|
|
4979
5046
|
S: this,
|
|
4980
5047
|
A: [
|
|
4981
5048
|
"!this._config",
|
|
@@ -4992,8 +5059,8 @@ var ClientServicesHost = class {
|
|
|
4992
5059
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4993
5060
|
this._signalManager = signalManager;
|
|
4994
5061
|
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
4995
|
-
F:
|
|
4996
|
-
L:
|
|
5062
|
+
F: __dxlog_file18,
|
|
5063
|
+
L: 210,
|
|
4997
5064
|
S: this,
|
|
4998
5065
|
A: [
|
|
4999
5066
|
"!this._networkManager",
|
|
@@ -5006,8 +5073,8 @@ var ClientServicesHost = class {
|
|
|
5006
5073
|
signalManager
|
|
5007
5074
|
});
|
|
5008
5075
|
(0, import_log15.log)("initialized", void 0, {
|
|
5009
|
-
F:
|
|
5010
|
-
L:
|
|
5076
|
+
F: __dxlog_file18,
|
|
5077
|
+
L: 217,
|
|
5011
5078
|
S: this,
|
|
5012
5079
|
C: (f, a) => f(...a)
|
|
5013
5080
|
});
|
|
@@ -5020,14 +5087,14 @@ var ClientServicesHost = class {
|
|
|
5020
5087
|
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.begin({
|
|
5021
5088
|
id: traceId
|
|
5022
5089
|
}), {
|
|
5023
|
-
F:
|
|
5024
|
-
L:
|
|
5090
|
+
F: __dxlog_file18,
|
|
5091
|
+
L: 228,
|
|
5025
5092
|
S: this,
|
|
5026
5093
|
C: (f, a) => f(...a)
|
|
5027
5094
|
});
|
|
5028
5095
|
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
5029
|
-
F:
|
|
5030
|
-
L:
|
|
5096
|
+
F: __dxlog_file18,
|
|
5097
|
+
L: 230,
|
|
5031
5098
|
S: this,
|
|
5032
5099
|
A: [
|
|
5033
5100
|
"this._config",
|
|
@@ -5035,8 +5102,8 @@ var ClientServicesHost = class {
|
|
|
5035
5102
|
]
|
|
5036
5103
|
});
|
|
5037
5104
|
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
5038
|
-
F:
|
|
5039
|
-
L:
|
|
5105
|
+
F: __dxlog_file18,
|
|
5106
|
+
L: 231,
|
|
5040
5107
|
S: this,
|
|
5041
5108
|
A: [
|
|
5042
5109
|
"this._storage",
|
|
@@ -5044,8 +5111,8 @@ var ClientServicesHost = class {
|
|
|
5044
5111
|
]
|
|
5045
5112
|
});
|
|
5046
5113
|
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
5047
|
-
F:
|
|
5048
|
-
L:
|
|
5114
|
+
F: __dxlog_file18,
|
|
5115
|
+
L: 232,
|
|
5049
5116
|
S: this,
|
|
5050
5117
|
A: [
|
|
5051
5118
|
"this._signalManager",
|
|
@@ -5053,8 +5120,8 @@ var ClientServicesHost = class {
|
|
|
5053
5120
|
]
|
|
5054
5121
|
});
|
|
5055
5122
|
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
5056
|
-
F:
|
|
5057
|
-
L:
|
|
5123
|
+
F: __dxlog_file18,
|
|
5124
|
+
L: 233,
|
|
5058
5125
|
S: this,
|
|
5059
5126
|
A: [
|
|
5060
5127
|
"this._networkManager",
|
|
@@ -5065,14 +5132,14 @@ var ClientServicesHost = class {
|
|
|
5065
5132
|
(0, import_log15.log)("opening...", {
|
|
5066
5133
|
lockKey: this._resourceLock?.lockKey
|
|
5067
5134
|
}, {
|
|
5068
|
-
F:
|
|
5069
|
-
L:
|
|
5135
|
+
F: __dxlog_file18,
|
|
5136
|
+
L: 236,
|
|
5070
5137
|
S: this,
|
|
5071
5138
|
C: (f, a) => f(...a)
|
|
5072
5139
|
});
|
|
5073
5140
|
await this._resourceLock?.acquire();
|
|
5074
5141
|
await this._loggingService.open();
|
|
5075
|
-
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
5142
|
+
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory, this._runtimeParams);
|
|
5076
5143
|
this._serviceRegistry.setServices({
|
|
5077
5144
|
SystemService: this._systemService,
|
|
5078
5145
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
@@ -5111,16 +5178,16 @@ var ClientServicesHost = class {
|
|
|
5111
5178
|
(0, import_log15.log)("opened", {
|
|
5112
5179
|
deviceKey
|
|
5113
5180
|
}, {
|
|
5114
|
-
F:
|
|
5115
|
-
L:
|
|
5181
|
+
F: __dxlog_file18,
|
|
5182
|
+
L: 310,
|
|
5116
5183
|
S: this,
|
|
5117
5184
|
C: (f, a) => f(...a)
|
|
5118
5185
|
});
|
|
5119
5186
|
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.end({
|
|
5120
5187
|
id: traceId
|
|
5121
5188
|
}), {
|
|
5122
|
-
F:
|
|
5123
|
-
L:
|
|
5189
|
+
F: __dxlog_file18,
|
|
5190
|
+
L: 311,
|
|
5124
5191
|
S: this,
|
|
5125
5192
|
C: (f, a) => f(...a)
|
|
5126
5193
|
});
|
|
@@ -5133,8 +5200,8 @@ var ClientServicesHost = class {
|
|
|
5133
5200
|
(0, import_log15.log)("closing...", {
|
|
5134
5201
|
deviceKey
|
|
5135
5202
|
}, {
|
|
5136
|
-
F:
|
|
5137
|
-
L:
|
|
5203
|
+
F: __dxlog_file18,
|
|
5204
|
+
L: 322,
|
|
5138
5205
|
S: this,
|
|
5139
5206
|
C: (f, a) => f(...a)
|
|
5140
5207
|
});
|
|
@@ -5149,8 +5216,8 @@ var ClientServicesHost = class {
|
|
|
5149
5216
|
(0, import_log15.log)("closed", {
|
|
5150
5217
|
deviceKey
|
|
5151
5218
|
}, {
|
|
5152
|
-
F:
|
|
5153
|
-
L:
|
|
5219
|
+
F: __dxlog_file18,
|
|
5220
|
+
L: 329,
|
|
5154
5221
|
S: this,
|
|
5155
5222
|
C: (f, a) => f(...a)
|
|
5156
5223
|
});
|
|
@@ -5160,30 +5227,30 @@ var ClientServicesHost = class {
|
|
|
5160
5227
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.begin({
|
|
5161
5228
|
id: traceId
|
|
5162
5229
|
}), {
|
|
5163
|
-
F:
|
|
5164
|
-
L:
|
|
5230
|
+
F: __dxlog_file18,
|
|
5231
|
+
L: 334,
|
|
5165
5232
|
S: this,
|
|
5166
5233
|
C: (f, a) => f(...a)
|
|
5167
5234
|
});
|
|
5168
5235
|
(0, import_log15.log)("resetting...", void 0, {
|
|
5169
|
-
F:
|
|
5170
|
-
L:
|
|
5236
|
+
F: __dxlog_file18,
|
|
5237
|
+
L: 336,
|
|
5171
5238
|
S: this,
|
|
5172
5239
|
C: (f, a) => f(...a)
|
|
5173
5240
|
});
|
|
5174
5241
|
await this._serviceContext?.close();
|
|
5175
5242
|
await this._storage.reset();
|
|
5176
5243
|
(0, import_log15.log)("reset", void 0, {
|
|
5177
|
-
F:
|
|
5178
|
-
L:
|
|
5244
|
+
F: __dxlog_file18,
|
|
5245
|
+
L: 339,
|
|
5179
5246
|
S: this,
|
|
5180
5247
|
C: (f, a) => f(...a)
|
|
5181
5248
|
});
|
|
5182
5249
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.end({
|
|
5183
5250
|
id: traceId
|
|
5184
5251
|
}), {
|
|
5185
|
-
F:
|
|
5186
|
-
L:
|
|
5252
|
+
F: __dxlog_file18,
|
|
5253
|
+
L: 340,
|
|
5187
5254
|
S: this,
|
|
5188
5255
|
C: (f, a) => f(...a)
|
|
5189
5256
|
});
|
|
@@ -5197,8 +5264,8 @@ var ClientServicesHost = class {
|
|
|
5197
5264
|
obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
|
|
5198
5265
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5199
5266
|
(0, import_invariant16.invariant)(automergeIndex, void 0, {
|
|
5200
|
-
F:
|
|
5201
|
-
L:
|
|
5267
|
+
F: __dxlog_file18,
|
|
5268
|
+
L: 355,
|
|
5202
5269
|
S: this,
|
|
5203
5270
|
A: [
|
|
5204
5271
|
"automergeIndex",
|
|
@@ -5210,7 +5277,7 @@ var ClientServicesHost = class {
|
|
|
5210
5277
|
document.change((doc) => {
|
|
5211
5278
|
(0, import_util9.assignDeep)(doc, [
|
|
5212
5279
|
"objects",
|
|
5213
|
-
|
|
5280
|
+
(0, import_echo_schema.getAutomergeObjectCore)(obj).id
|
|
5214
5281
|
], (0, import_echo_schema.getRawDoc)(obj).handle.docSync());
|
|
5215
5282
|
});
|
|
5216
5283
|
return identity;
|
|
@@ -5267,4 +5334,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5267
5334
|
subscribeToSpaces,
|
|
5268
5335
|
subscribeToSwarmInfo
|
|
5269
5336
|
});
|
|
5270
|
-
//# sourceMappingURL=chunk-
|
|
5337
|
+
//# sourceMappingURL=chunk-4JAI4X5H.cjs.map
|