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