@dxos/client-services 0.4.4-next.e0df51e → 0.4.5-main.181e1ed
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-GJSXXOWH.mjs → chunk-TMTT6YWW.mjs} +106 -96
- package/dist/lib/browser/chunk-TMTT6YWW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-CQJYPSCX.cjs → chunk-HVNAYEDC.cjs} +218 -208
- package/dist/lib/node/chunk-HVNAYEDC.cjs.map +7 -0
- package/dist/lib/node/index.cjs +37 -37
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/identity/identity-manager.d.ts +3 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.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 +12 -1
- package/src/packlets/devices/devices-service.ts +1 -1
- package/src/packlets/identity/identity-manager.test.ts +19 -0
- package/src/packlets/identity/identity-manager.ts +27 -1
- package/src/packlets/identity/identity-service.ts +2 -4
- package/src/packlets/services/service-host.ts +13 -40
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-GJSXXOWH.mjs.map +0 -7
- package/dist/lib/node/chunk-CQJYPSCX.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_HVNAYEDC_exports = {};
|
|
30
|
+
__export(chunk_HVNAYEDC_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -60,7 +60,7 @@ __export(chunk_CQJYPSCX_exports, {
|
|
|
60
60
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
61
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
62
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
63
|
+
module.exports = __toCommonJS(chunk_HVNAYEDC_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");
|
|
@@ -99,6 +99,7 @@ var import_invariant2 = require("@dxos/invariant");
|
|
|
99
99
|
var import_keys4 = require("@dxos/keys");
|
|
100
100
|
var import_log3 = require("@dxos/log");
|
|
101
101
|
var import_protocols2 = require("@dxos/protocols");
|
|
102
|
+
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
102
103
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
103
104
|
var import_timeframe = require("@dxos/timeframe");
|
|
104
105
|
var import_tracing2 = require("@dxos/tracing");
|
|
@@ -109,7 +110,7 @@ var import_debug2 = require("@dxos/debug");
|
|
|
109
110
|
var import_invariant3 = require("@dxos/invariant");
|
|
110
111
|
var import_invariant4 = require("@dxos/invariant");
|
|
111
112
|
var import_protocols3 = require("@dxos/protocols");
|
|
112
|
-
var
|
|
113
|
+
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
113
114
|
var import_async7 = require("@dxos/async");
|
|
114
115
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
115
116
|
var import_context4 = require("@dxos/context");
|
|
@@ -119,7 +120,7 @@ var import_keys5 = require("@dxos/keys");
|
|
|
119
120
|
var import_log4 = require("@dxos/log");
|
|
120
121
|
var import_network_manager = require("@dxos/network-manager");
|
|
121
122
|
var import_protocols4 = require("@dxos/protocols");
|
|
122
|
-
var
|
|
123
|
+
var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
123
124
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
124
125
|
var import_async8 = require("@dxos/async");
|
|
125
126
|
var import_context5 = require("@dxos/context");
|
|
@@ -127,20 +128,20 @@ var import_invariant6 = require("@dxos/invariant");
|
|
|
127
128
|
var import_keys6 = require("@dxos/keys");
|
|
128
129
|
var import_log5 = require("@dxos/log");
|
|
129
130
|
var import_protocols5 = require("@dxos/protocols");
|
|
130
|
-
var
|
|
131
|
+
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
131
132
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
132
133
|
var import_teleport = require("@dxos/teleport");
|
|
133
134
|
var import_async9 = require("@dxos/async");
|
|
134
135
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
135
136
|
var import_invariant7 = require("@dxos/invariant");
|
|
136
137
|
var import_log6 = require("@dxos/log");
|
|
137
|
-
var
|
|
138
|
+
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
138
139
|
var import_credentials8 = require("@dxos/credentials");
|
|
139
140
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
140
141
|
var import_invariant8 = require("@dxos/invariant");
|
|
141
142
|
var import_log7 = require("@dxos/log");
|
|
142
143
|
var import_protocols6 = require("@dxos/protocols");
|
|
143
|
-
var
|
|
144
|
+
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
144
145
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
145
146
|
var import_debug3 = require("@dxos/debug");
|
|
146
147
|
var import_rpc = require("@dxos/rpc");
|
|
@@ -152,9 +153,9 @@ var import_echo_db = require("@dxos/echo-db");
|
|
|
152
153
|
var import_invariant9 = require("@dxos/invariant");
|
|
153
154
|
var import_log8 = require("@dxos/log");
|
|
154
155
|
var import_protocols7 = require("@dxos/protocols");
|
|
155
|
-
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
156
|
-
var import_tracing4 = require("@dxos/tracing");
|
|
157
156
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
157
|
+
var import_tracing4 = require("@dxos/tracing");
|
|
158
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
158
159
|
var import_async10 = require("@dxos/async");
|
|
159
160
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
160
161
|
var import_context6 = require("@dxos/context");
|
|
@@ -164,7 +165,7 @@ var import_invariant10 = require("@dxos/invariant");
|
|
|
164
165
|
var import_keys7 = require("@dxos/keys");
|
|
165
166
|
var import_log9 = require("@dxos/log");
|
|
166
167
|
var import_protocols8 = require("@dxos/protocols");
|
|
167
|
-
var
|
|
168
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
168
169
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
169
170
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
170
171
|
var import_tracing5 = require("@dxos/tracing");
|
|
@@ -185,7 +186,7 @@ var import_invariant12 = require("@dxos/invariant");
|
|
|
185
186
|
var import_keys9 = require("@dxos/keys");
|
|
186
187
|
var import_log11 = require("@dxos/log");
|
|
187
188
|
var import_protocols10 = require("@dxos/protocols");
|
|
188
|
-
var
|
|
189
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
189
190
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
190
191
|
var import_util6 = require("@dxos/util");
|
|
191
192
|
var import_credentials13 = require("@dxos/credentials");
|
|
@@ -198,7 +199,7 @@ var import_debug6 = require("@dxos/debug");
|
|
|
198
199
|
var import_invariant13 = require("@dxos/invariant");
|
|
199
200
|
var import_log12 = require("@dxos/log");
|
|
200
201
|
var import_protocols11 = require("@dxos/protocols");
|
|
201
|
-
var
|
|
202
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
202
203
|
var import_async14 = require("@dxos/async");
|
|
203
204
|
var import_context9 = require("@dxos/context");
|
|
204
205
|
var import_credentials15 = require("@dxos/credentials");
|
|
@@ -210,7 +211,7 @@ var import_keyring = require("@dxos/keyring");
|
|
|
210
211
|
var import_keys10 = require("@dxos/keys");
|
|
211
212
|
var import_log13 = require("@dxos/log");
|
|
212
213
|
var import_protocols12 = require("@dxos/protocols");
|
|
213
|
-
var
|
|
214
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
214
215
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
215
216
|
var import_tracing6 = require("@dxos/tracing");
|
|
216
217
|
var import_util7 = require("@dxos/util");
|
|
@@ -235,22 +236,23 @@ var import_messaging = require("@dxos/messaging");
|
|
|
235
236
|
var import_model_factory = require("@dxos/model-factory");
|
|
236
237
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
237
238
|
var import_protocols14 = require("@dxos/protocols");
|
|
238
|
-
var
|
|
239
|
+
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
239
240
|
var import_text_model = require("@dxos/text-model");
|
|
240
241
|
var import_tracing7 = require("@dxos/tracing");
|
|
242
|
+
var import_util9 = require("@dxos/util");
|
|
241
243
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
242
244
|
var import_async16 = require("@dxos/async");
|
|
243
245
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
244
|
-
var
|
|
246
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
245
247
|
var import_async17 = require("@dxos/async");
|
|
246
248
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
247
249
|
var import_log16 = require("@dxos/log");
|
|
248
|
-
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
249
|
-
var import_util9 = require("@dxos/util");
|
|
250
|
-
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
251
|
-
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
252
250
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
253
251
|
var import_util10 = require("@dxos/util");
|
|
252
|
+
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
253
|
+
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
254
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
255
|
+
var import_util11 = require("@dxos/util");
|
|
254
256
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
255
257
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
256
258
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -867,7 +869,7 @@ var IdentityManager = class {
|
|
|
867
869
|
id: traceId
|
|
868
870
|
}), {
|
|
869
871
|
F: __dxlog_file3,
|
|
870
|
-
L:
|
|
872
|
+
L: 80,
|
|
871
873
|
S: this,
|
|
872
874
|
C: (f, a) => f(...a)
|
|
873
875
|
});
|
|
@@ -876,7 +878,7 @@ var IdentityManager = class {
|
|
|
876
878
|
identityRecord
|
|
877
879
|
}, {
|
|
878
880
|
F: __dxlog_file3,
|
|
879
|
-
L:
|
|
881
|
+
L: 83,
|
|
880
882
|
S: this,
|
|
881
883
|
C: (f, a) => f(...a)
|
|
882
884
|
});
|
|
@@ -889,7 +891,7 @@ var IdentityManager = class {
|
|
|
889
891
|
displayName: this._identity.profileDocument?.displayName
|
|
890
892
|
}, {
|
|
891
893
|
F: __dxlog_file3,
|
|
892
|
-
L:
|
|
894
|
+
L: 88,
|
|
893
895
|
S: this,
|
|
894
896
|
C: (f, a) => f(...a)
|
|
895
897
|
});
|
|
@@ -899,7 +901,7 @@ var IdentityManager = class {
|
|
|
899
901
|
id: traceId
|
|
900
902
|
}), {
|
|
901
903
|
F: __dxlog_file3,
|
|
902
|
-
L:
|
|
904
|
+
L: 94,
|
|
903
905
|
S: this,
|
|
904
906
|
C: (f, a) => f(...a)
|
|
905
907
|
});
|
|
@@ -910,7 +912,7 @@ var IdentityManager = class {
|
|
|
910
912
|
async createIdentity({ displayName } = {}) {
|
|
911
913
|
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
912
914
|
F: __dxlog_file3,
|
|
913
|
-
L:
|
|
915
|
+
L: 102,
|
|
914
916
|
S: this,
|
|
915
917
|
A: [
|
|
916
918
|
"!this._identity",
|
|
@@ -919,7 +921,7 @@ var IdentityManager = class {
|
|
|
919
921
|
});
|
|
920
922
|
(0, import_log3.log)("creating identity...", void 0, {
|
|
921
923
|
F: __dxlog_file3,
|
|
922
|
-
L:
|
|
924
|
+
L: 103,
|
|
923
925
|
S: this,
|
|
924
926
|
C: (f, a) => f(...a)
|
|
925
927
|
});
|
|
@@ -940,7 +942,7 @@ var IdentityManager = class {
|
|
|
940
942
|
const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
941
943
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
942
944
|
F: __dxlog_file3,
|
|
943
|
-
L:
|
|
945
|
+
L: 122,
|
|
944
946
|
S: this,
|
|
945
947
|
A: [
|
|
946
948
|
"identityRecord.haloSpace.genesisFeedKey",
|
|
@@ -949,7 +951,7 @@ var IdentityManager = class {
|
|
|
949
951
|
});
|
|
950
952
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
951
953
|
F: __dxlog_file3,
|
|
952
|
-
L:
|
|
954
|
+
L: 123,
|
|
953
955
|
S: this,
|
|
954
956
|
A: [
|
|
955
957
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -991,7 +993,7 @@ var IdentityManager = class {
|
|
|
991
993
|
displayName: this._identity.profileDocument?.displayName
|
|
992
994
|
}, {
|
|
993
995
|
F: __dxlog_file3,
|
|
994
|
-
L:
|
|
996
|
+
L: 168,
|
|
995
997
|
S: this,
|
|
996
998
|
C: (f, a) => f(...a)
|
|
997
999
|
});
|
|
@@ -1001,7 +1003,7 @@ var IdentityManager = class {
|
|
|
1001
1003
|
deviceKey: identity.deviceKey
|
|
1002
1004
|
}, {
|
|
1003
1005
|
F: __dxlog_file3,
|
|
1004
|
-
L:
|
|
1006
|
+
L: 174,
|
|
1005
1007
|
S: this,
|
|
1006
1008
|
C: (f, a) => f(...a)
|
|
1007
1009
|
});
|
|
@@ -1015,13 +1017,13 @@ var IdentityManager = class {
|
|
|
1015
1017
|
params
|
|
1016
1018
|
}, {
|
|
1017
1019
|
F: __dxlog_file3,
|
|
1018
|
-
L:
|
|
1020
|
+
L: 182,
|
|
1019
1021
|
S: this,
|
|
1020
1022
|
C: (f, a) => f(...a)
|
|
1021
1023
|
});
|
|
1022
1024
|
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
1023
1025
|
F: __dxlog_file3,
|
|
1024
|
-
L:
|
|
1026
|
+
L: 183,
|
|
1025
1027
|
S: this,
|
|
1026
1028
|
A: [
|
|
1027
1029
|
"!this._identity",
|
|
@@ -1049,7 +1051,7 @@ var IdentityManager = class {
|
|
|
1049
1051
|
displayName: this._identity.profileDocument?.displayName
|
|
1050
1052
|
}, {
|
|
1051
1053
|
F: __dxlog_file3,
|
|
1052
|
-
L:
|
|
1054
|
+
L: 202,
|
|
1053
1055
|
S: this,
|
|
1054
1056
|
C: (f, a) => f(...a)
|
|
1055
1057
|
});
|
|
@@ -1059,7 +1061,7 @@ var IdentityManager = class {
|
|
|
1059
1061
|
deviceKey: identity.deviceKey
|
|
1060
1062
|
}, {
|
|
1061
1063
|
F: __dxlog_file3,
|
|
1062
|
-
L:
|
|
1064
|
+
L: 208,
|
|
1063
1065
|
S: this,
|
|
1064
1066
|
C: (f, a) => f(...a)
|
|
1065
1067
|
});
|
|
@@ -1071,7 +1073,7 @@ var IdentityManager = class {
|
|
|
1071
1073
|
async updateProfile(profile) {
|
|
1072
1074
|
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
1073
1075
|
F: __dxlog_file3,
|
|
1074
|
-
L:
|
|
1076
|
+
L: 216,
|
|
1075
1077
|
S: this,
|
|
1076
1078
|
A: [
|
|
1077
1079
|
"this._identity",
|
|
@@ -1099,10 +1101,45 @@ var IdentityManager = class {
|
|
|
1099
1101
|
this.stateUpdate.emit();
|
|
1100
1102
|
return profile;
|
|
1101
1103
|
}
|
|
1104
|
+
async updateDeviceProfile(profile) {
|
|
1105
|
+
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
1106
|
+
F: __dxlog_file3,
|
|
1107
|
+
L: 233,
|
|
1108
|
+
S: this,
|
|
1109
|
+
A: [
|
|
1110
|
+
"this._identity",
|
|
1111
|
+
"'Identity not initialized.'"
|
|
1112
|
+
]
|
|
1113
|
+
});
|
|
1114
|
+
const credential = await this._identity.getIdentityCredentialSigner().createCredential({
|
|
1115
|
+
subject: this._identity.deviceKey,
|
|
1116
|
+
assertion: {
|
|
1117
|
+
"@type": "dxos.halo.credentials.DeviceProfile",
|
|
1118
|
+
profile
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
const receipt = await this._identity.controlPipeline.writer.write({
|
|
1122
|
+
credential: {
|
|
1123
|
+
credential
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
1127
|
+
[
|
|
1128
|
+
receipt.feedKey,
|
|
1129
|
+
receipt.seq
|
|
1130
|
+
]
|
|
1131
|
+
]));
|
|
1132
|
+
this.stateUpdate.emit();
|
|
1133
|
+
return {
|
|
1134
|
+
deviceKey: this._identity.deviceKey,
|
|
1135
|
+
kind: import_services.DeviceKind.CURRENT,
|
|
1136
|
+
profile
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1102
1139
|
async _constructIdentity(identityRecord) {
|
|
1103
1140
|
(0, import_invariant2.invariant)(!this._identity, void 0, {
|
|
1104
1141
|
F: __dxlog_file3,
|
|
1105
|
-
L:
|
|
1142
|
+
L: 254,
|
|
1106
1143
|
S: this,
|
|
1107
1144
|
A: [
|
|
1108
1145
|
"!this._identity",
|
|
@@ -1113,13 +1150,13 @@ var IdentityManager = class {
|
|
|
1113
1150
|
identityRecord
|
|
1114
1151
|
}, {
|
|
1115
1152
|
F: __dxlog_file3,
|
|
1116
|
-
L:
|
|
1153
|
+
L: 255,
|
|
1117
1154
|
S: this,
|
|
1118
1155
|
C: (f, a) => f(...a)
|
|
1119
1156
|
});
|
|
1120
1157
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1121
1158
|
F: __dxlog_file3,
|
|
1122
|
-
L:
|
|
1159
|
+
L: 258,
|
|
1123
1160
|
S: this,
|
|
1124
1161
|
A: [
|
|
1125
1162
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -1131,7 +1168,7 @@ var IdentityManager = class {
|
|
|
1131
1168
|
});
|
|
1132
1169
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1133
1170
|
F: __dxlog_file3,
|
|
1134
|
-
L:
|
|
1171
|
+
L: 262,
|
|
1135
1172
|
S: this,
|
|
1136
1173
|
A: [
|
|
1137
1174
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -1163,7 +1200,7 @@ var IdentityManager = class {
|
|
|
1163
1200
|
identityKey: identityRecord.identityKey
|
|
1164
1201
|
}, {
|
|
1165
1202
|
F: __dxlog_file3,
|
|
1166
|
-
L:
|
|
1203
|
+
L: 286,
|
|
1167
1204
|
S: this,
|
|
1168
1205
|
C: (f, a) => f(...a)
|
|
1169
1206
|
});
|
|
@@ -1184,7 +1221,7 @@ var IdentityManager = class {
|
|
|
1184
1221
|
onAuthFailure: () => {
|
|
1185
1222
|
import_log3.log.warn("auth failure", void 0, {
|
|
1186
1223
|
F: __dxlog_file3,
|
|
1187
|
-
L:
|
|
1224
|
+
L: 305,
|
|
1188
1225
|
S: this,
|
|
1189
1226
|
C: (f, a) => f(...a)
|
|
1190
1227
|
});
|
|
@@ -1202,7 +1239,6 @@ IdentityManager = _ts_decorate2([
|
|
|
1202
1239
|
import_tracing2.trace.resource()
|
|
1203
1240
|
], IdentityManager);
|
|
1204
1241
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1205
|
-
var CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT = true;
|
|
1206
1242
|
var IdentityServiceImpl = class {
|
|
1207
1243
|
constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
|
|
1208
1244
|
this._createIdentity = _createIdentity;
|
|
@@ -1211,7 +1247,7 @@ var IdentityServiceImpl = class {
|
|
|
1211
1247
|
this._onProfileUpdate = _onProfileUpdate;
|
|
1212
1248
|
}
|
|
1213
1249
|
async createIdentity(request) {
|
|
1214
|
-
await this._createIdentity(request.profile ?? {}
|
|
1250
|
+
await this._createIdentity(request.profile ?? {});
|
|
1215
1251
|
return this._getIdentity();
|
|
1216
1252
|
}
|
|
1217
1253
|
async recoverIdentity(request) {
|
|
@@ -1239,7 +1275,7 @@ var IdentityServiceImpl = class {
|
|
|
1239
1275
|
async updateProfile(profile) {
|
|
1240
1276
|
(0, import_invariant3.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1241
1277
|
F: __dxlog_file4,
|
|
1242
|
-
L:
|
|
1278
|
+
L: 61,
|
|
1243
1279
|
S: this,
|
|
1244
1280
|
A: [
|
|
1245
1281
|
"this._identityManager.identity",
|
|
@@ -1253,7 +1289,7 @@ var IdentityServiceImpl = class {
|
|
|
1253
1289
|
async signPresentation({ presentation, nonce }) {
|
|
1254
1290
|
(0, import_invariant3.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1255
1291
|
F: __dxlog_file4,
|
|
1256
|
-
L:
|
|
1292
|
+
L: 68,
|
|
1257
1293
|
S: this,
|
|
1258
1294
|
A: [
|
|
1259
1295
|
"this._identityManager.identity",
|
|
@@ -1281,7 +1317,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1281
1317
|
}
|
|
1282
1318
|
getInvitationContext() {
|
|
1283
1319
|
return {
|
|
1284
|
-
kind:
|
|
1320
|
+
kind: import_services2.Invitation.Kind.DEVICE
|
|
1285
1321
|
};
|
|
1286
1322
|
}
|
|
1287
1323
|
async admit(request) {
|
|
@@ -1427,7 +1463,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1427
1463
|
});
|
|
1428
1464
|
this._callbacks.onError(new Error("Invitation not found."));
|
|
1429
1465
|
return {
|
|
1430
|
-
authMethod:
|
|
1466
|
+
authMethod: import_services4.Invitation.AuthMethod.NONE
|
|
1431
1467
|
};
|
|
1432
1468
|
}
|
|
1433
1469
|
this.invitation = invitation;
|
|
@@ -1442,7 +1478,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1442
1478
|
this.guestProfile = profile;
|
|
1443
1479
|
this._callbacks.onStateUpdate({
|
|
1444
1480
|
...this.invitation,
|
|
1445
|
-
state:
|
|
1481
|
+
state: import_services4.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1446
1482
|
});
|
|
1447
1483
|
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.end({
|
|
1448
1484
|
id: traceId
|
|
@@ -1485,7 +1521,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1485
1521
|
]
|
|
1486
1522
|
});
|
|
1487
1523
|
switch (this.invitation.authMethod) {
|
|
1488
|
-
case
|
|
1524
|
+
case import_services4.Invitation.AuthMethod.NONE: {
|
|
1489
1525
|
(0, import_log5.log)("authentication not required", void 0, {
|
|
1490
1526
|
F: __dxlog_file6,
|
|
1491
1527
|
L: 131,
|
|
@@ -1496,7 +1532,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1496
1532
|
status: import_invitations2.AuthenticationResponse.Status.OK
|
|
1497
1533
|
};
|
|
1498
1534
|
}
|
|
1499
|
-
case
|
|
1535
|
+
case import_services4.Invitation.AuthMethod.SHARED_SECRET: {
|
|
1500
1536
|
if (this.invitation.authCode) {
|
|
1501
1537
|
if (this.authenticationRetry++ > MAX_OTP_ATTEMPTS) {
|
|
1502
1538
|
status = import_invitations2.AuthenticationResponse.Status.INVALID_OPT_ATTEMPTS;
|
|
@@ -1691,7 +1727,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1691
1727
|
await this._ctx.dispose();
|
|
1692
1728
|
}
|
|
1693
1729
|
};
|
|
1694
|
-
var isAuthenticationRequired = (invitation) => invitation.authMethod !==
|
|
1730
|
+
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services4.Invitation.AuthMethod.NONE;
|
|
1695
1731
|
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
1696
1732
|
var InvitationsHandler = class {
|
|
1697
1733
|
/**
|
|
@@ -1701,8 +1737,8 @@ var InvitationsHandler = class {
|
|
|
1701
1737
|
this._networkManager = _networkManager;
|
|
1702
1738
|
}
|
|
1703
1739
|
createInvitation(protocol, options) {
|
|
1704
|
-
const { invitationId = import_keys5.PublicKey.random().toHex(), type =
|
|
1705
|
-
const authCode = options?.authCode ?? (authMethod ===
|
|
1740
|
+
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random() } = options ?? {};
|
|
1741
|
+
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1706
1742
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
1707
1743
|
F: __dxlog_file7,
|
|
1708
1744
|
L: 80,
|
|
@@ -1745,7 +1781,7 @@ var InvitationsHandler = class {
|
|
|
1745
1781
|
onStateUpdate: (invitation2) => {
|
|
1746
1782
|
stream.next({
|
|
1747
1783
|
...invitation2,
|
|
1748
|
-
state:
|
|
1784
|
+
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1749
1785
|
});
|
|
1750
1786
|
},
|
|
1751
1787
|
resolveInvitation: async ({ invitationId: invitationId2 }) => {
|
|
@@ -1796,7 +1832,7 @@ var InvitationsHandler = class {
|
|
|
1796
1832
|
});
|
|
1797
1833
|
stream.next({
|
|
1798
1834
|
...invitation,
|
|
1799
|
-
state:
|
|
1835
|
+
state: import_services3.Invitation.State.CONNECTED
|
|
1800
1836
|
});
|
|
1801
1837
|
const deviceKey = await extension.completedTrigger.wait({
|
|
1802
1838
|
timeout
|
|
@@ -1812,7 +1848,7 @@ var InvitationsHandler = class {
|
|
|
1812
1848
|
});
|
|
1813
1849
|
stream.next({
|
|
1814
1850
|
...invitation,
|
|
1815
|
-
state:
|
|
1851
|
+
state: import_services3.Invitation.State.SUCCESS
|
|
1816
1852
|
});
|
|
1817
1853
|
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
1818
1854
|
id: traceId
|
|
@@ -1834,7 +1870,7 @@ var InvitationsHandler = class {
|
|
|
1834
1870
|
});
|
|
1835
1871
|
stream.next({
|
|
1836
1872
|
...invitation,
|
|
1837
|
-
state:
|
|
1873
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
1838
1874
|
});
|
|
1839
1875
|
} else {
|
|
1840
1876
|
import_log4.log.error("failed", err, {
|
|
@@ -1855,7 +1891,7 @@ var InvitationsHandler = class {
|
|
|
1855
1891
|
C: (f, a) => f(...a)
|
|
1856
1892
|
});
|
|
1857
1893
|
} finally {
|
|
1858
|
-
if (type !==
|
|
1894
|
+
if (type !== import_services3.Invitation.Type.MULTIUSE) {
|
|
1859
1895
|
await swarmConnection.close();
|
|
1860
1896
|
await ctx.dispose();
|
|
1861
1897
|
}
|
|
@@ -1877,7 +1913,7 @@ var InvitationsHandler = class {
|
|
|
1877
1913
|
});
|
|
1878
1914
|
stream.next({
|
|
1879
1915
|
...invitation,
|
|
1880
|
-
state:
|
|
1916
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
1881
1917
|
});
|
|
1882
1918
|
} else {
|
|
1883
1919
|
import_log4.log.error("failed", err, {
|
|
@@ -1907,7 +1943,7 @@ var InvitationsHandler = class {
|
|
|
1907
1943
|
ctx.onDispose(() => swarmConnection.close());
|
|
1908
1944
|
stream.next({
|
|
1909
1945
|
...invitation,
|
|
1910
|
-
state:
|
|
1946
|
+
state: import_services3.Invitation.State.CONNECTING
|
|
1911
1947
|
});
|
|
1912
1948
|
});
|
|
1913
1949
|
const observable = new import_client_protocol2.CancellableInvitation({
|
|
@@ -1916,7 +1952,7 @@ var InvitationsHandler = class {
|
|
|
1916
1952
|
onCancel: async () => {
|
|
1917
1953
|
stream.next({
|
|
1918
1954
|
...invitation,
|
|
1919
|
-
state:
|
|
1955
|
+
state: import_services3.Invitation.State.CANCELLED
|
|
1920
1956
|
});
|
|
1921
1957
|
await ctx.dispose();
|
|
1922
1958
|
}
|
|
@@ -1966,7 +2002,7 @@ var InvitationsHandler = class {
|
|
|
1966
2002
|
C: (f, a) => f(...a)
|
|
1967
2003
|
});
|
|
1968
2004
|
setState({
|
|
1969
|
-
state:
|
|
2005
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
1970
2006
|
});
|
|
1971
2007
|
} else {
|
|
1972
2008
|
import_log4.log.warn("auth failed", err, {
|
|
@@ -2032,7 +2068,7 @@ var InvitationsHandler = class {
|
|
|
2032
2068
|
C: (f, a) => f(...a)
|
|
2033
2069
|
});
|
|
2034
2070
|
setState({
|
|
2035
|
-
state:
|
|
2071
|
+
state: import_services3.Invitation.State.CONNECTED
|
|
2036
2072
|
});
|
|
2037
2073
|
(0, import_log4.log)("introduce", {
|
|
2038
2074
|
...protocol.toJSON()
|
|
@@ -2062,7 +2098,7 @@ var InvitationsHandler = class {
|
|
|
2062
2098
|
C: (f, a) => f(...a)
|
|
2063
2099
|
});
|
|
2064
2100
|
setState({
|
|
2065
|
-
state:
|
|
2101
|
+
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2066
2102
|
});
|
|
2067
2103
|
const authCode = await authenticated.wait({
|
|
2068
2104
|
timeout
|
|
@@ -2074,7 +2110,7 @@ var InvitationsHandler = class {
|
|
|
2074
2110
|
C: (f, a) => f(...a)
|
|
2075
2111
|
});
|
|
2076
2112
|
setState({
|
|
2077
|
-
state:
|
|
2113
|
+
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2078
2114
|
});
|
|
2079
2115
|
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2080
2116
|
authCode
|
|
@@ -2122,7 +2158,7 @@ var InvitationsHandler = class {
|
|
|
2122
2158
|
setState({
|
|
2123
2159
|
...result,
|
|
2124
2160
|
target: invitation.target,
|
|
2125
|
-
state:
|
|
2161
|
+
state: import_services3.Invitation.State.SUCCESS
|
|
2126
2162
|
});
|
|
2127
2163
|
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
2128
2164
|
id: traceId
|
|
@@ -2143,7 +2179,7 @@ var InvitationsHandler = class {
|
|
|
2143
2179
|
C: (f, a) => f(...a)
|
|
2144
2180
|
});
|
|
2145
2181
|
setState({
|
|
2146
|
-
state:
|
|
2182
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
2147
2183
|
});
|
|
2148
2184
|
} else {
|
|
2149
2185
|
(0, import_log4.log)("auth failed", err, {
|
|
@@ -2182,7 +2218,7 @@ var InvitationsHandler = class {
|
|
|
2182
2218
|
C: (f, a) => f(...a)
|
|
2183
2219
|
});
|
|
2184
2220
|
setState({
|
|
2185
|
-
state:
|
|
2221
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
2186
2222
|
});
|
|
2187
2223
|
} else {
|
|
2188
2224
|
(0, import_log4.log)("auth failed", err, {
|
|
@@ -2223,7 +2259,7 @@ var InvitationsHandler = class {
|
|
|
2223
2259
|
});
|
|
2224
2260
|
ctx.onDispose(() => swarmConnection.close());
|
|
2225
2261
|
setState({
|
|
2226
|
-
state:
|
|
2262
|
+
state: import_services3.Invitation.State.CONNECTING
|
|
2227
2263
|
});
|
|
2228
2264
|
}
|
|
2229
2265
|
});
|
|
@@ -2232,7 +2268,7 @@ var InvitationsHandler = class {
|
|
|
2232
2268
|
subscriber: stream.observable,
|
|
2233
2269
|
onCancel: async () => {
|
|
2234
2270
|
setState({
|
|
2235
|
-
state:
|
|
2271
|
+
state: import_services3.Invitation.State.CANCELLED
|
|
2236
2272
|
});
|
|
2237
2273
|
await ctx.dispose();
|
|
2238
2274
|
},
|
|
@@ -2278,7 +2314,7 @@ var InvitationsServiceImpl = class {
|
|
|
2278
2314
|
}, () => {
|
|
2279
2315
|
close();
|
|
2280
2316
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
2281
|
-
if (invitation.get().type !==
|
|
2317
|
+
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2282
2318
|
this._removedCreated.emit(invitation.get());
|
|
2283
2319
|
}
|
|
2284
2320
|
});
|
|
@@ -2303,7 +2339,7 @@ var InvitationsServiceImpl = class {
|
|
|
2303
2339
|
}, () => {
|
|
2304
2340
|
close();
|
|
2305
2341
|
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2306
|
-
if (invitation.get().type !==
|
|
2342
|
+
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2307
2343
|
this._removedAccepted.emit(invitation.get());
|
|
2308
2344
|
}
|
|
2309
2345
|
});
|
|
@@ -2371,8 +2407,8 @@ var InvitationsServiceImpl = class {
|
|
|
2371
2407
|
return new import_codec_protobuf8.Stream(({ next, ctx }) => {
|
|
2372
2408
|
this._invitationCreated.on(ctx, (invitation) => {
|
|
2373
2409
|
next({
|
|
2374
|
-
action:
|
|
2375
|
-
type:
|
|
2410
|
+
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2411
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2376
2412
|
invitations: [
|
|
2377
2413
|
invitation
|
|
2378
2414
|
]
|
|
@@ -2380,8 +2416,8 @@ var InvitationsServiceImpl = class {
|
|
|
2380
2416
|
});
|
|
2381
2417
|
this._invitationAccepted.on(ctx, (invitation) => {
|
|
2382
2418
|
next({
|
|
2383
|
-
action:
|
|
2384
|
-
type:
|
|
2419
|
+
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2420
|
+
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2385
2421
|
invitations: [
|
|
2386
2422
|
invitation
|
|
2387
2423
|
]
|
|
@@ -2389,8 +2425,8 @@ var InvitationsServiceImpl = class {
|
|
|
2389
2425
|
});
|
|
2390
2426
|
this._removedCreated.on(ctx, (invitation) => {
|
|
2391
2427
|
next({
|
|
2392
|
-
action:
|
|
2393
|
-
type:
|
|
2428
|
+
action: import_services5.QueryInvitationsResponse.Action.REMOVED,
|
|
2429
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2394
2430
|
invitations: [
|
|
2395
2431
|
invitation
|
|
2396
2432
|
]
|
|
@@ -2398,21 +2434,21 @@ var InvitationsServiceImpl = class {
|
|
|
2398
2434
|
});
|
|
2399
2435
|
this._removedAccepted.on(ctx, (invitation) => {
|
|
2400
2436
|
next({
|
|
2401
|
-
action:
|
|
2402
|
-
type:
|
|
2437
|
+
action: import_services5.QueryInvitationsResponse.Action.REMOVED,
|
|
2438
|
+
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2403
2439
|
invitations: [
|
|
2404
2440
|
invitation
|
|
2405
2441
|
]
|
|
2406
2442
|
});
|
|
2407
2443
|
});
|
|
2408
2444
|
next({
|
|
2409
|
-
action:
|
|
2410
|
-
type:
|
|
2445
|
+
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2446
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2411
2447
|
invitations: Array.from(this._createInvitations.values()).map((invitation) => invitation.get())
|
|
2412
2448
|
});
|
|
2413
2449
|
next({
|
|
2414
|
-
action:
|
|
2415
|
-
type:
|
|
2450
|
+
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2451
|
+
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2416
2452
|
invitations: Array.from(this._acceptInvitations.values()).map((invitation) => invitation.get())
|
|
2417
2453
|
});
|
|
2418
2454
|
});
|
|
@@ -2434,7 +2470,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2434
2470
|
}
|
|
2435
2471
|
getInvitationContext() {
|
|
2436
2472
|
return {
|
|
2437
|
-
kind:
|
|
2473
|
+
kind: import_services6.Invitation.Kind.SPACE,
|
|
2438
2474
|
spaceKey: this._spaceKey
|
|
2439
2475
|
};
|
|
2440
2476
|
}
|
|
@@ -2653,20 +2689,20 @@ var getPlatform = () => {
|
|
|
2653
2689
|
if (typeof window !== "undefined") {
|
|
2654
2690
|
const { userAgent } = window.navigator;
|
|
2655
2691
|
return {
|
|
2656
|
-
type:
|
|
2692
|
+
type: import_services8.Platform.PLATFORM_TYPE.BROWSER,
|
|
2657
2693
|
userAgent,
|
|
2658
2694
|
uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
|
|
2659
2695
|
};
|
|
2660
2696
|
} else {
|
|
2661
2697
|
return {
|
|
2662
|
-
type:
|
|
2698
|
+
type: import_services8.Platform.PLATFORM_TYPE.SHARED_WORKER,
|
|
2663
2699
|
uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
|
|
2664
2700
|
};
|
|
2665
2701
|
}
|
|
2666
2702
|
} else {
|
|
2667
2703
|
const { platform: platform2, version, arch } = process;
|
|
2668
2704
|
return {
|
|
2669
|
-
type:
|
|
2705
|
+
type: import_services8.Platform.PLATFORM_TYPE.NODE,
|
|
2670
2706
|
platform: platform2,
|
|
2671
2707
|
arch,
|
|
2672
2708
|
runtime: version,
|
|
@@ -2675,7 +2711,7 @@ var getPlatform = () => {
|
|
|
2675
2711
|
};
|
|
2676
2712
|
}
|
|
2677
2713
|
};
|
|
2678
|
-
var DXOS_VERSION = "0.4.
|
|
2714
|
+
var DXOS_VERSION = "0.4.5-main.181e1ed";
|
|
2679
2715
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2680
2716
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2681
2717
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -2781,7 +2817,7 @@ var getSpaceStats = async (space) => {
|
|
|
2781
2817
|
displayName: member.assertion.profile?.displayName
|
|
2782
2818
|
}
|
|
2783
2819
|
},
|
|
2784
|
-
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ?
|
|
2820
|
+
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services7.SpaceMember.PresenceState.ONLINE : import_services7.SpaceMember.PresenceState.OFFLINE
|
|
2785
2821
|
})),
|
|
2786
2822
|
pipeline: {
|
|
2787
2823
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
@@ -3106,7 +3142,7 @@ var DataSpace = class {
|
|
|
3106
3142
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3107
3143
|
this._cache = void 0;
|
|
3108
3144
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
3109
|
-
this._state =
|
|
3145
|
+
this._state = import_services9.SpaceState.CLOSED;
|
|
3110
3146
|
this.error = void 0;
|
|
3111
3147
|
this.stateUpdate = new import_async10.Event();
|
|
3112
3148
|
this.metrics = {};
|
|
@@ -3128,7 +3164,7 @@ var DataSpace = class {
|
|
|
3128
3164
|
this._cache = params.cache;
|
|
3129
3165
|
this._state = params.initialState;
|
|
3130
3166
|
(0, import_log9.log)("new state", {
|
|
3131
|
-
state:
|
|
3167
|
+
state: import_services9.SpaceState[this._state]
|
|
3132
3168
|
}, {
|
|
3133
3169
|
F: __dxlog_file12,
|
|
3134
3170
|
L: 141,
|
|
@@ -3179,9 +3215,9 @@ var DataSpace = class {
|
|
|
3179
3215
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3180
3216
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3181
3217
|
await this._inner.open(new import_context6.Context());
|
|
3182
|
-
this._state =
|
|
3218
|
+
this._state = import_services9.SpaceState.CONTROL_ONLY;
|
|
3183
3219
|
(0, import_log9.log)("new state", {
|
|
3184
|
-
state:
|
|
3220
|
+
state: import_services9.SpaceState[this._state]
|
|
3185
3221
|
}, {
|
|
3186
3222
|
F: __dxlog_file12,
|
|
3187
3223
|
L: 203,
|
|
@@ -3197,9 +3233,9 @@ var DataSpace = class {
|
|
|
3197
3233
|
}
|
|
3198
3234
|
async _close() {
|
|
3199
3235
|
await this._callbacks.beforeClose?.();
|
|
3200
|
-
this._state =
|
|
3236
|
+
this._state = import_services9.SpaceState.CLOSED;
|
|
3201
3237
|
(0, import_log9.log)("new state", {
|
|
3202
|
-
state:
|
|
3238
|
+
state: import_services9.SpaceState[this._state]
|
|
3203
3239
|
}, {
|
|
3204
3240
|
F: __dxlog_file12,
|
|
3205
3241
|
L: 217,
|
|
@@ -3246,9 +3282,9 @@ var DataSpace = class {
|
|
|
3246
3282
|
S: this,
|
|
3247
3283
|
C: (f, a) => f(...a)
|
|
3248
3284
|
});
|
|
3249
|
-
this._state =
|
|
3285
|
+
this._state = import_services9.SpaceState.ERROR;
|
|
3250
3286
|
(0, import_log9.log)("new state", {
|
|
3251
|
-
state:
|
|
3287
|
+
state: import_services9.SpaceState[this._state]
|
|
3252
3288
|
}, {
|
|
3253
3289
|
F: __dxlog_file12,
|
|
3254
3290
|
L: 256,
|
|
@@ -3263,12 +3299,12 @@ var DataSpace = class {
|
|
|
3263
3299
|
});
|
|
3264
3300
|
}
|
|
3265
3301
|
async initializeDataPipeline() {
|
|
3266
|
-
if (this._state !==
|
|
3302
|
+
if (this._state !== import_services9.SpaceState.CONTROL_ONLY) {
|
|
3267
3303
|
throw new import_protocols8.SystemError("Invalid operation");
|
|
3268
3304
|
}
|
|
3269
|
-
this._state =
|
|
3305
|
+
this._state = import_services9.SpaceState.INITIALIZING;
|
|
3270
3306
|
(0, import_log9.log)("new state", {
|
|
3271
|
-
state:
|
|
3307
|
+
state: import_services9.SpaceState[this._state]
|
|
3272
3308
|
}, {
|
|
3273
3309
|
F: __dxlog_file12,
|
|
3274
3310
|
L: 272,
|
|
@@ -3298,9 +3334,9 @@ var DataSpace = class {
|
|
|
3298
3334
|
C: (f, a) => f(...a)
|
|
3299
3335
|
});
|
|
3300
3336
|
await this._callbacks.beforeReady?.();
|
|
3301
|
-
this._state =
|
|
3337
|
+
this._state = import_services9.SpaceState.READY;
|
|
3302
3338
|
(0, import_log9.log)("new state", {
|
|
3303
|
-
state:
|
|
3339
|
+
state: import_services9.SpaceState[this._state]
|
|
3304
3340
|
}, {
|
|
3305
3341
|
F: __dxlog_file12,
|
|
3306
3342
|
L: 298,
|
|
@@ -3438,12 +3474,12 @@ var DataSpace = class {
|
|
|
3438
3474
|
let epoch;
|
|
3439
3475
|
switch (options?.migration) {
|
|
3440
3476
|
case void 0:
|
|
3441
|
-
case
|
|
3477
|
+
case import_services9.CreateEpochRequest.Migration.NONE:
|
|
3442
3478
|
{
|
|
3443
3479
|
epoch = await this.dataPipeline.createEpoch();
|
|
3444
3480
|
}
|
|
3445
3481
|
break;
|
|
3446
|
-
case
|
|
3482
|
+
case import_services9.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3447
3483
|
const document = this._automergeHost.repo.create();
|
|
3448
3484
|
epoch = {
|
|
3449
3485
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
@@ -3484,22 +3520,22 @@ var DataSpace = class {
|
|
|
3484
3520
|
}
|
|
3485
3521
|
}
|
|
3486
3522
|
async activate() {
|
|
3487
|
-
if (this._state !==
|
|
3523
|
+
if (this._state !== import_services9.SpaceState.INACTIVE) {
|
|
3488
3524
|
return;
|
|
3489
3525
|
}
|
|
3490
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3526
|
+
await this._metadataStore.setSpaceState(this.key, import_services9.SpaceState.ACTIVE);
|
|
3491
3527
|
await this._open();
|
|
3492
3528
|
this.initializeDataPipelineAsync();
|
|
3493
3529
|
}
|
|
3494
3530
|
async deactivate() {
|
|
3495
|
-
if (this._state ===
|
|
3531
|
+
if (this._state === import_services9.SpaceState.INACTIVE) {
|
|
3496
3532
|
return;
|
|
3497
3533
|
}
|
|
3498
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3534
|
+
await this._metadataStore.setSpaceState(this.key, import_services9.SpaceState.INACTIVE);
|
|
3499
3535
|
await this._close();
|
|
3500
|
-
this._state =
|
|
3536
|
+
this._state = import_services9.SpaceState.INACTIVE;
|
|
3501
3537
|
(0, import_log9.log)("new state", {
|
|
3502
|
-
state:
|
|
3538
|
+
state: import_services9.SpaceState[this._state]
|
|
3503
3539
|
}, {
|
|
3504
3540
|
F: __dxlog_file12,
|
|
3505
3541
|
L: 492,
|
|
@@ -3517,7 +3553,7 @@ _ts_decorate4([
|
|
|
3517
3553
|
], DataSpace.prototype, "key", null);
|
|
3518
3554
|
_ts_decorate4([
|
|
3519
3555
|
import_tracing5.trace.info({
|
|
3520
|
-
enum:
|
|
3556
|
+
enum: import_services9.SpaceState
|
|
3521
3557
|
})
|
|
3522
3558
|
], DataSpace.prototype, "state", null);
|
|
3523
3559
|
_ts_decorate4([
|
|
@@ -3699,7 +3735,7 @@ var DataSpaceManager = class {
|
|
|
3699
3735
|
this._isOpen = true;
|
|
3700
3736
|
this.updated.emit();
|
|
3701
3737
|
for (const space of this._spaces.values()) {
|
|
3702
|
-
if (space.state !==
|
|
3738
|
+
if (space.state !== import_services10.SpaceState.INACTIVE) {
|
|
3703
3739
|
space.initializeDataPipelineAsync();
|
|
3704
3740
|
}
|
|
3705
3741
|
}
|
|
@@ -3746,7 +3782,7 @@ var DataSpaceManager = class {
|
|
|
3746
3782
|
genesisFeedKey: controlFeedKey,
|
|
3747
3783
|
controlFeedKey,
|
|
3748
3784
|
dataFeedKey,
|
|
3749
|
-
state:
|
|
3785
|
+
state: import_services10.SpaceState.ACTIVE
|
|
3750
3786
|
};
|
|
3751
3787
|
(0, import_log11.log)("creating space...", {
|
|
3752
3788
|
spaceKey
|
|
@@ -3826,7 +3862,7 @@ var DataSpaceManager = class {
|
|
|
3826
3862
|
async waitUntilSpaceReady(spaceKey) {
|
|
3827
3863
|
await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
3828
3864
|
const space = this._spaces.get(spaceKey);
|
|
3829
|
-
return !!space && space.state ===
|
|
3865
|
+
return !!space && space.state === import_services10.SpaceState.READY;
|
|
3830
3866
|
}));
|
|
3831
3867
|
}
|
|
3832
3868
|
async _constructSpace(metadata) {
|
|
@@ -3883,7 +3919,7 @@ var DataSpaceManager = class {
|
|
|
3883
3919
|
dataFeed && space.setDataFeed(dataFeed);
|
|
3884
3920
|
const dataSpace = new DataSpace({
|
|
3885
3921
|
inner: space,
|
|
3886
|
-
initialState: metadata.state ===
|
|
3922
|
+
initialState: metadata.state === import_services10.SpaceState.INACTIVE ? import_services10.SpaceState.INACTIVE : import_services10.SpaceState.CLOSED,
|
|
3887
3923
|
metadataStore: this._metadataStore,
|
|
3888
3924
|
gossip,
|
|
3889
3925
|
presence,
|
|
@@ -3931,7 +3967,7 @@ var DataSpaceManager = class {
|
|
|
3931
3967
|
cache: metadata.cache,
|
|
3932
3968
|
automergeHost: this._automergeHost
|
|
3933
3969
|
});
|
|
3934
|
-
if (metadata.state !==
|
|
3970
|
+
if (metadata.state !== import_services10.SpaceState.INACTIVE) {
|
|
3935
3971
|
await dataSpace.open();
|
|
3936
3972
|
}
|
|
3937
3973
|
if (metadata.controlTimeframe) {
|
|
@@ -3980,10 +4016,10 @@ var SpacesServiceImpl = class {
|
|
|
3980
4016
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3981
4017
|
if (state) {
|
|
3982
4018
|
switch (state) {
|
|
3983
|
-
case
|
|
4019
|
+
case import_services11.SpaceState.ACTIVE:
|
|
3984
4020
|
await space.activate();
|
|
3985
4021
|
break;
|
|
3986
|
-
case
|
|
4022
|
+
case import_services11.SpaceState.INACTIVE:
|
|
3987
4023
|
await space.deactivate();
|
|
3988
4024
|
break;
|
|
3989
4025
|
default:
|
|
@@ -4160,7 +4196,7 @@ var SpacesServiceImpl = class {
|
|
|
4160
4196
|
displayName: member.profile?.displayName
|
|
4161
4197
|
}
|
|
4162
4198
|
},
|
|
4163
|
-
presence: member.removed ?
|
|
4199
|
+
presence: member.removed ? import_services11.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services11.SpaceMember.PresenceState.ONLINE : import_services11.SpaceMember.PresenceState.OFFLINE,
|
|
4164
4200
|
peerStates: peers
|
|
4165
4201
|
};
|
|
4166
4202
|
}),
|
|
@@ -4217,7 +4253,7 @@ var ServiceContext = class {
|
|
|
4217
4253
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
4218
4254
|
this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
|
|
4219
4255
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4220
|
-
this._handlerFactories.set(
|
|
4256
|
+
this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug7.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4221
4257
|
}
|
|
4222
4258
|
async open(ctx) {
|
|
4223
4259
|
await this._checkStorageVersion();
|
|
@@ -4345,7 +4381,7 @@ var ServiceContext = class {
|
|
|
4345
4381
|
};
|
|
4346
4382
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4347
4383
|
await this.dataSpaceManager.open();
|
|
4348
|
-
this._handlerFactories.set(
|
|
4384
|
+
this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
|
|
4349
4385
|
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4350
4386
|
F: __dxlog_file15,
|
|
4351
4387
|
L: 228,
|
|
@@ -4548,7 +4584,7 @@ var DevicesServiceImpl = class {
|
|
|
4548
4584
|
this._identityManager = _identityManager;
|
|
4549
4585
|
}
|
|
4550
4586
|
async updateDevice(profile) {
|
|
4551
|
-
|
|
4587
|
+
return this._identityManager.updateDeviceProfile(profile);
|
|
4552
4588
|
}
|
|
4553
4589
|
queryDevices() {
|
|
4554
4590
|
return new import_codec_protobuf12.Stream(({ next }) => {
|
|
@@ -4562,7 +4598,7 @@ var DevicesServiceImpl = class {
|
|
|
4562
4598
|
next({
|
|
4563
4599
|
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
|
|
4564
4600
|
deviceKey: key,
|
|
4565
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
4601
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services14.DeviceKind.CURRENT : import_services14.DeviceKind.TRUSTED,
|
|
4566
4602
|
profile
|
|
4567
4603
|
}))
|
|
4568
4604
|
});
|
|
@@ -4599,15 +4635,15 @@ var LoggingServiceImpl = class {
|
|
|
4599
4635
|
}
|
|
4600
4636
|
async controlMetrics({ reset, record }) {
|
|
4601
4637
|
if (reset) {
|
|
4602
|
-
|
|
4638
|
+
import_util10.tracer.clear();
|
|
4603
4639
|
}
|
|
4604
4640
|
if (record === true) {
|
|
4605
|
-
|
|
4641
|
+
import_util10.tracer.start();
|
|
4606
4642
|
} else if (record === false) {
|
|
4607
|
-
|
|
4643
|
+
import_util10.tracer.stop();
|
|
4608
4644
|
}
|
|
4609
4645
|
return {
|
|
4610
|
-
recording:
|
|
4646
|
+
recording: import_util10.tracer.recording
|
|
4611
4647
|
};
|
|
4612
4648
|
}
|
|
4613
4649
|
/**
|
|
@@ -4615,10 +4651,10 @@ var LoggingServiceImpl = class {
|
|
|
4615
4651
|
*/
|
|
4616
4652
|
queryMetrics({ interval = 5e3 }) {
|
|
4617
4653
|
const getNumericalValues = (key) => {
|
|
4618
|
-
const events =
|
|
4654
|
+
const events = import_util10.tracer.get(key) ?? [];
|
|
4619
4655
|
return {
|
|
4620
4656
|
key,
|
|
4621
|
-
stats: (0,
|
|
4657
|
+
stats: (0, import_util10.numericalValues)(events, "duration")
|
|
4622
4658
|
};
|
|
4623
4659
|
};
|
|
4624
4660
|
return new import_codec_protobuf13.Stream(({ next }) => {
|
|
@@ -4656,7 +4692,7 @@ var LoggingServiceImpl = class {
|
|
|
4656
4692
|
}
|
|
4657
4693
|
const record = {
|
|
4658
4694
|
...entry2,
|
|
4659
|
-
context: (0,
|
|
4695
|
+
context: (0, import_util10.jsonify)((0, import_log16.getContextFromEntry)(entry2)),
|
|
4660
4696
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4661
4697
|
meta: {
|
|
4662
4698
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -4677,16 +4713,16 @@ var LoggingServiceImpl = class {
|
|
|
4677
4713
|
};
|
|
4678
4714
|
var matchFilter = (filter, level, path, options) => {
|
|
4679
4715
|
switch (options) {
|
|
4680
|
-
case
|
|
4716
|
+
case import_services15.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
4681
4717
|
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
4682
|
-
case
|
|
4718
|
+
case import_services15.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
4683
4719
|
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
4684
4720
|
}
|
|
4685
4721
|
};
|
|
4686
4722
|
var shouldLog = (entry2, request) => {
|
|
4687
|
-
const options = request.options ??
|
|
4723
|
+
const options = request.options ?? import_services15.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
4688
4724
|
if (request.filters === void 0) {
|
|
4689
|
-
return options ===
|
|
4725
|
+
return options === import_services15.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
4690
4726
|
} else {
|
|
4691
4727
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
4692
4728
|
}
|
|
@@ -4741,9 +4777,9 @@ var SystemServiceImpl = class {
|
|
|
4741
4777
|
const diagnostics = await this._getDiagnostics();
|
|
4742
4778
|
return {
|
|
4743
4779
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4744
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
4745
|
-
truncate: keys ===
|
|
4746
|
-
humanize: keys ===
|
|
4780
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util11.jsonKeyReplacer)({
|
|
4781
|
+
truncate: keys === import_services16.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
4782
|
+
humanize: keys === import_services16.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
4747
4783
|
})))
|
|
4748
4784
|
};
|
|
4749
4785
|
}
|
|
@@ -4788,18 +4824,6 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
4788
4824
|
var createDefaultModelFactory = () => {
|
|
4789
4825
|
return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
|
|
4790
4826
|
};
|
|
4791
|
-
var createGenesisMutationFromTypedObject = (obj) => {
|
|
4792
|
-
const snapshot = obj[import_echo_schema.base]._createSnapshot();
|
|
4793
|
-
return {
|
|
4794
|
-
objectId: obj[import_echo_schema.base]._id,
|
|
4795
|
-
genesis: {
|
|
4796
|
-
modelType: obj[import_echo_schema.base]._modelConstructor.meta.type
|
|
4797
|
-
},
|
|
4798
|
-
snapshot: {
|
|
4799
|
-
model: snapshot
|
|
4800
|
-
}
|
|
4801
|
-
};
|
|
4802
|
-
};
|
|
4803
4827
|
var ClientServicesHost = class {
|
|
4804
4828
|
constructor({
|
|
4805
4829
|
config,
|
|
@@ -4839,14 +4863,14 @@ var ClientServicesHost = class {
|
|
|
4839
4863
|
this._systemService = new SystemServiceImpl({
|
|
4840
4864
|
config: () => this._config,
|
|
4841
4865
|
statusUpdate: this._statusUpdate,
|
|
4842
|
-
getCurrentStatus: () => this.isOpen ?
|
|
4866
|
+
getCurrentStatus: () => this.isOpen ? import_services13.SystemStatus.ACTIVE : import_services13.SystemStatus.INACTIVE,
|
|
4843
4867
|
getDiagnostics: () => {
|
|
4844
4868
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
4845
4869
|
},
|
|
4846
4870
|
onUpdateStatus: async (status) => {
|
|
4847
|
-
if (!this.isOpen && status ===
|
|
4871
|
+
if (!this.isOpen && status === import_services13.SystemStatus.ACTIVE) {
|
|
4848
4872
|
await this._resourceLock?.acquire();
|
|
4849
|
-
} else if (this.isOpen && status ===
|
|
4873
|
+
} else if (this.isOpen && status === import_services13.SystemStatus.INACTIVE) {
|
|
4850
4874
|
await this._resourceLock?.release();
|
|
4851
4875
|
}
|
|
4852
4876
|
},
|
|
@@ -4886,7 +4910,7 @@ var ClientServicesHost = class {
|
|
|
4886
4910
|
initialize({ config, ...options }) {
|
|
4887
4911
|
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
4888
4912
|
F: __dxlog_file17,
|
|
4889
|
-
L:
|
|
4913
|
+
L: 186,
|
|
4890
4914
|
S: this,
|
|
4891
4915
|
A: [
|
|
4892
4916
|
"!this._open",
|
|
@@ -4895,14 +4919,14 @@ var ClientServicesHost = class {
|
|
|
4895
4919
|
});
|
|
4896
4920
|
(0, import_log15.log)("initializing...", void 0, {
|
|
4897
4921
|
F: __dxlog_file17,
|
|
4898
|
-
L:
|
|
4922
|
+
L: 187,
|
|
4899
4923
|
S: this,
|
|
4900
4924
|
C: (f, a) => f(...a)
|
|
4901
4925
|
});
|
|
4902
4926
|
if (config) {
|
|
4903
4927
|
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
4904
4928
|
F: __dxlog_file17,
|
|
4905
|
-
L:
|
|
4929
|
+
L: 190,
|
|
4906
4930
|
S: this,
|
|
4907
4931
|
A: [
|
|
4908
4932
|
"!this._config",
|
|
@@ -4920,7 +4944,7 @@ var ClientServicesHost = class {
|
|
|
4920
4944
|
this._signalManager = signalManager;
|
|
4921
4945
|
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
4922
4946
|
F: __dxlog_file17,
|
|
4923
|
-
L:
|
|
4947
|
+
L: 206,
|
|
4924
4948
|
S: this,
|
|
4925
4949
|
A: [
|
|
4926
4950
|
"!this._networkManager",
|
|
@@ -4934,7 +4958,7 @@ var ClientServicesHost = class {
|
|
|
4934
4958
|
});
|
|
4935
4959
|
(0, import_log15.log)("initialized", void 0, {
|
|
4936
4960
|
F: __dxlog_file17,
|
|
4937
|
-
L:
|
|
4961
|
+
L: 213,
|
|
4938
4962
|
S: this,
|
|
4939
4963
|
C: (f, a) => f(...a)
|
|
4940
4964
|
});
|
|
@@ -4948,13 +4972,13 @@ var ClientServicesHost = class {
|
|
|
4948
4972
|
id: traceId
|
|
4949
4973
|
}), {
|
|
4950
4974
|
F: __dxlog_file17,
|
|
4951
|
-
L:
|
|
4975
|
+
L: 224,
|
|
4952
4976
|
S: this,
|
|
4953
4977
|
C: (f, a) => f(...a)
|
|
4954
4978
|
});
|
|
4955
4979
|
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
4956
4980
|
F: __dxlog_file17,
|
|
4957
|
-
L:
|
|
4981
|
+
L: 226,
|
|
4958
4982
|
S: this,
|
|
4959
4983
|
A: [
|
|
4960
4984
|
"this._config",
|
|
@@ -4963,7 +4987,7 @@ var ClientServicesHost = class {
|
|
|
4963
4987
|
});
|
|
4964
4988
|
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
4965
4989
|
F: __dxlog_file17,
|
|
4966
|
-
L:
|
|
4990
|
+
L: 227,
|
|
4967
4991
|
S: this,
|
|
4968
4992
|
A: [
|
|
4969
4993
|
"this._storage",
|
|
@@ -4972,7 +4996,7 @@ var ClientServicesHost = class {
|
|
|
4972
4996
|
});
|
|
4973
4997
|
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
4974
4998
|
F: __dxlog_file17,
|
|
4975
|
-
L:
|
|
4999
|
+
L: 228,
|
|
4976
5000
|
S: this,
|
|
4977
5001
|
A: [
|
|
4978
5002
|
"this._signalManager",
|
|
@@ -4981,7 +5005,7 @@ var ClientServicesHost = class {
|
|
|
4981
5005
|
});
|
|
4982
5006
|
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
4983
5007
|
F: __dxlog_file17,
|
|
4984
|
-
L:
|
|
5008
|
+
L: 229,
|
|
4985
5009
|
S: this,
|
|
4986
5010
|
A: [
|
|
4987
5011
|
"this._networkManager",
|
|
@@ -4993,7 +5017,7 @@ var ClientServicesHost = class {
|
|
|
4993
5017
|
lockKey: this._resourceLock?.lockKey
|
|
4994
5018
|
}, {
|
|
4995
5019
|
F: __dxlog_file17,
|
|
4996
|
-
L:
|
|
5020
|
+
L: 232,
|
|
4997
5021
|
S: this,
|
|
4998
5022
|
C: (f, a) => f(...a)
|
|
4999
5023
|
});
|
|
@@ -5002,7 +5026,7 @@ var ClientServicesHost = class {
|
|
|
5002
5026
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
5003
5027
|
this._serviceRegistry.setServices({
|
|
5004
5028
|
SystemService: this._systemService,
|
|
5005
|
-
IdentityService: new IdentityServiceImpl((params
|
|
5029
|
+
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
5006
5030
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
5007
5031
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
5008
5032
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
@@ -5039,7 +5063,7 @@ var ClientServicesHost = class {
|
|
|
5039
5063
|
deviceKey
|
|
5040
5064
|
}, {
|
|
5041
5065
|
F: __dxlog_file17,
|
|
5042
|
-
L:
|
|
5066
|
+
L: 305,
|
|
5043
5067
|
S: this,
|
|
5044
5068
|
C: (f, a) => f(...a)
|
|
5045
5069
|
});
|
|
@@ -5047,7 +5071,7 @@ var ClientServicesHost = class {
|
|
|
5047
5071
|
id: traceId
|
|
5048
5072
|
}), {
|
|
5049
5073
|
F: __dxlog_file17,
|
|
5050
|
-
L:
|
|
5074
|
+
L: 306,
|
|
5051
5075
|
S: this,
|
|
5052
5076
|
C: (f, a) => f(...a)
|
|
5053
5077
|
});
|
|
@@ -5061,7 +5085,7 @@ var ClientServicesHost = class {
|
|
|
5061
5085
|
deviceKey
|
|
5062
5086
|
}, {
|
|
5063
5087
|
F: __dxlog_file17,
|
|
5064
|
-
L:
|
|
5088
|
+
L: 317,
|
|
5065
5089
|
S: this,
|
|
5066
5090
|
C: (f, a) => f(...a)
|
|
5067
5091
|
});
|
|
@@ -5077,7 +5101,7 @@ var ClientServicesHost = class {
|
|
|
5077
5101
|
deviceKey
|
|
5078
5102
|
}, {
|
|
5079
5103
|
F: __dxlog_file17,
|
|
5080
|
-
L:
|
|
5104
|
+
L: 324,
|
|
5081
5105
|
S: this,
|
|
5082
5106
|
C: (f, a) => f(...a)
|
|
5083
5107
|
});
|
|
@@ -5088,13 +5112,13 @@ var ClientServicesHost = class {
|
|
|
5088
5112
|
id: traceId
|
|
5089
5113
|
}), {
|
|
5090
5114
|
F: __dxlog_file17,
|
|
5091
|
-
L:
|
|
5115
|
+
L: 329,
|
|
5092
5116
|
S: this,
|
|
5093
5117
|
C: (f, a) => f(...a)
|
|
5094
5118
|
});
|
|
5095
5119
|
(0, import_log15.log)("resetting...", void 0, {
|
|
5096
5120
|
F: __dxlog_file17,
|
|
5097
|
-
L:
|
|
5121
|
+
L: 331,
|
|
5098
5122
|
S: this,
|
|
5099
5123
|
C: (f, a) => f(...a)
|
|
5100
5124
|
});
|
|
@@ -5102,7 +5126,7 @@ var ClientServicesHost = class {
|
|
|
5102
5126
|
await this._storage.reset();
|
|
5103
5127
|
(0, import_log15.log)("reset", void 0, {
|
|
5104
5128
|
F: __dxlog_file17,
|
|
5105
|
-
L:
|
|
5129
|
+
L: 334,
|
|
5106
5130
|
S: this,
|
|
5107
5131
|
C: (f, a) => f(...a)
|
|
5108
5132
|
});
|
|
@@ -5110,50 +5134,36 @@ var ClientServicesHost = class {
|
|
|
5110
5134
|
id: traceId
|
|
5111
5135
|
}), {
|
|
5112
5136
|
F: __dxlog_file17,
|
|
5113
|
-
L:
|
|
5137
|
+
L: 335,
|
|
5114
5138
|
S: this,
|
|
5115
5139
|
C: (f, a) => f(...a)
|
|
5116
5140
|
});
|
|
5117
5141
|
await this._callbacks?.onReset?.();
|
|
5118
5142
|
}
|
|
5119
|
-
async _createIdentity(params
|
|
5143
|
+
async _createIdentity(params) {
|
|
5120
5144
|
const identity = await this._serviceContext.createIdentity(params);
|
|
5121
5145
|
await this._serviceContext.initialized.wait();
|
|
5122
5146
|
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
5123
|
-
const obj = new import_client_protocol5.Properties(void 0
|
|
5124
|
-
automerge: useAutomerge
|
|
5125
|
-
});
|
|
5147
|
+
const obj = new import_client_protocol5.Properties(void 0);
|
|
5126
5148
|
obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
A: [
|
|
5146
|
-
"automergeIndex",
|
|
5147
|
-
""
|
|
5148
|
-
]
|
|
5149
|
-
});
|
|
5150
|
-
const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
|
|
5151
|
-
await document.whenReady();
|
|
5152
|
-
document.change((doc) => {
|
|
5153
|
-
doc.objects ??= {};
|
|
5154
|
-
doc.objects[obj[import_echo_schema.base]._id] = (0, import_echo_schema.getRawDoc)(obj).handle.docSync();
|
|
5155
|
-
});
|
|
5156
|
-
}
|
|
5149
|
+
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5150
|
+
(0, import_invariant16.invariant)(automergeIndex, void 0, {
|
|
5151
|
+
F: __dxlog_file17,
|
|
5152
|
+
L: 350,
|
|
5153
|
+
S: this,
|
|
5154
|
+
A: [
|
|
5155
|
+
"automergeIndex",
|
|
5156
|
+
""
|
|
5157
|
+
]
|
|
5158
|
+
});
|
|
5159
|
+
const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
|
|
5160
|
+
await document.whenReady();
|
|
5161
|
+
document.change((doc) => {
|
|
5162
|
+
(0, import_util9.assignDeep)(doc, [
|
|
5163
|
+
"objects",
|
|
5164
|
+
obj[import_echo_schema.base]._id
|
|
5165
|
+
], (0, import_echo_schema.getRawDoc)(obj).handle.docSync());
|
|
5166
|
+
});
|
|
5157
5167
|
return identity;
|
|
5158
5168
|
}
|
|
5159
5169
|
};
|
|
@@ -5208,4 +5218,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5208
5218
|
subscribeToSpaces,
|
|
5209
5219
|
subscribeToSwarmInfo
|
|
5210
5220
|
});
|
|
5211
|
-
//# sourceMappingURL=chunk-
|
|
5221
|
+
//# sourceMappingURL=chunk-HVNAYEDC.cjs.map
|