@dxos/client-services 0.5.9-main.bf0ae3e → 0.5.9-main.bf3bb8f
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-4IR3JP4U.mjs → chunk-IUSAD4RP.mjs} +1405 -824
- package/dist/lib/browser/chunk-IUSAD4RP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -4
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +10 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-ZBIDLLZ4.cjs → chunk-5PALJZPW.cjs} +1534 -956
- package/dist/lib/node/chunk-5PALJZPW.cjs.map +7 -0
- package/dist/lib/node/index.cjs +53 -44
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +17 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +14 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -0
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +4 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +9 -9
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts +23 -0
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +5 -2
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/index.d.ts +1 -0
- package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts +14 -0
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -0
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/contacts-service.ts +85 -0
- package/src/packlets/identity/identity-service.ts +45 -13
- package/src/packlets/invitations/invitations-handler.ts +13 -5
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -32
- package/src/packlets/services/service-host.ts +12 -4
- package/src/packlets/spaces/automerge-space-state.ts +11 -2
- package/src/packlets/spaces/data-space-manager.ts +90 -16
- package/src/packlets/spaces/data-space.ts +78 -148
- package/src/packlets/spaces/epoch-migrations.ts +154 -0
- package/src/packlets/spaces/spaces-service.ts +56 -4
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/profile-archive.ts +111 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-4IR3JP4U.mjs.map +0 -7
- package/dist/lib/node/chunk-ZBIDLLZ4.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_5PALJZPW_exports = {};
|
|
30
|
+
__export(chunk_5PALJZPW_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -56,8 +56,11 @@ __export(chunk_ZBIDLLZ4_exports, {
|
|
|
56
56
|
createDiagnostics: () => createDiagnostics,
|
|
57
57
|
createLevel: () => createLevel,
|
|
58
58
|
createStorageObjects: () => createStorageObjects,
|
|
59
|
-
|
|
59
|
+
decodeProfileArchive: () => decodeProfileArchive,
|
|
60
|
+
encodeProfileArchive: () => encodeProfileArchive,
|
|
61
|
+
exportProfileData: () => exportProfileData,
|
|
60
62
|
getNetworkPeers: () => getNetworkPeers,
|
|
63
|
+
importProfileData: () => importProfileData,
|
|
61
64
|
isLocked: () => isLocked,
|
|
62
65
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
63
66
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
@@ -67,7 +70,7 @@ __export(chunk_ZBIDLLZ4_exports, {
|
|
|
67
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
68
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
69
72
|
});
|
|
70
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_5PALJZPW_exports);
|
|
71
74
|
var import_async = require("@dxos/async");
|
|
72
75
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
73
76
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -127,186 +130,208 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
|
|
|
127
130
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
128
131
|
var import_tracing4 = require("@dxos/tracing");
|
|
129
132
|
var import_util3 = require("@dxos/util");
|
|
133
|
+
var import_async8 = require("@dxos/async");
|
|
130
134
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
131
135
|
var import_context4 = require("@dxos/context");
|
|
132
136
|
var import_credentials8 = require("@dxos/credentials");
|
|
133
137
|
var import_debug2 = require("@dxos/debug");
|
|
134
138
|
var import_invariant4 = require("@dxos/invariant");
|
|
139
|
+
var import_log5 = require("@dxos/log");
|
|
135
140
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
141
|
+
var import_util4 = require("@dxos/util");
|
|
136
142
|
var import_invariant5 = require("@dxos/invariant");
|
|
137
143
|
var import_protocols4 = require("@dxos/protocols");
|
|
138
144
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
139
|
-
var
|
|
145
|
+
var import_async9 = require("@dxos/async");
|
|
140
146
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
141
147
|
var import_context5 = require("@dxos/context");
|
|
142
148
|
var import_crypto = require("@dxos/crypto");
|
|
143
149
|
var import_invariant6 = require("@dxos/invariant");
|
|
144
150
|
var import_keys6 = require("@dxos/keys");
|
|
145
|
-
var
|
|
151
|
+
var import_log6 = require("@dxos/log");
|
|
146
152
|
var import_network_manager = require("@dxos/network-manager");
|
|
147
153
|
var import_protocols5 = require("@dxos/protocols");
|
|
148
154
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
149
155
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
150
156
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
151
|
-
var
|
|
152
|
-
var
|
|
157
|
+
var import_util5 = require("@dxos/util");
|
|
158
|
+
var import_async10 = require("@dxos/async");
|
|
153
159
|
var import_context6 = require("@dxos/context");
|
|
154
160
|
var import_invariant7 = require("@dxos/invariant");
|
|
155
|
-
var
|
|
161
|
+
var import_log7 = require("@dxos/log");
|
|
156
162
|
var import_protocols6 = require("@dxos/protocols");
|
|
157
163
|
var import_invitations3 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
158
164
|
var import_teleport = require("@dxos/teleport");
|
|
159
165
|
var import_context7 = require("@dxos/context");
|
|
160
166
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
161
|
-
var
|
|
167
|
+
var import_async11 = require("@dxos/async");
|
|
162
168
|
var import_context8 = require("@dxos/context");
|
|
163
169
|
var import_crypto2 = require("@dxos/crypto");
|
|
164
170
|
var import_invariant8 = require("@dxos/invariant");
|
|
165
171
|
var import_keys7 = require("@dxos/keys");
|
|
166
|
-
var
|
|
172
|
+
var import_log8 = require("@dxos/log");
|
|
167
173
|
var import_protocols7 = require("@dxos/protocols");
|
|
168
174
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
169
175
|
var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
170
176
|
var import_teleport2 = require("@dxos/teleport");
|
|
171
177
|
var import_invariant9 = require("@dxos/invariant");
|
|
172
178
|
var import_keys8 = require("@dxos/keys");
|
|
173
|
-
var
|
|
179
|
+
var import_log9 = require("@dxos/log");
|
|
174
180
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
175
|
-
var
|
|
181
|
+
var import_util6 = require("@dxos/util");
|
|
176
182
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
177
183
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
178
184
|
var import_credentials9 = require("@dxos/credentials");
|
|
179
185
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
180
186
|
var import_invariant10 = require("@dxos/invariant");
|
|
181
|
-
var
|
|
187
|
+
var import_log10 = require("@dxos/log");
|
|
182
188
|
var import_protocols8 = require("@dxos/protocols");
|
|
183
189
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
184
190
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
185
|
-
var
|
|
191
|
+
var import_async12 = require("@dxos/async");
|
|
186
192
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
187
193
|
var import_context9 = require("@dxos/context");
|
|
188
194
|
var import_credentials11 = require("@dxos/credentials");
|
|
189
195
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
190
196
|
var import_invariant11 = require("@dxos/invariant");
|
|
191
197
|
var import_keys9 = require("@dxos/keys");
|
|
192
|
-
var
|
|
198
|
+
var import_log11 = require("@dxos/log");
|
|
193
199
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
194
200
|
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
195
|
-
var
|
|
201
|
+
var import_async13 = require("@dxos/async");
|
|
196
202
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
197
203
|
var import_context10 = require("@dxos/context");
|
|
198
204
|
var import_debug3 = require("@dxos/debug");
|
|
199
205
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
200
|
-
var
|
|
206
|
+
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
201
207
|
var import_invariant12 = require("@dxos/invariant");
|
|
202
208
|
var import_keys10 = require("@dxos/keys");
|
|
203
|
-
var
|
|
209
|
+
var import_log12 = require("@dxos/log");
|
|
204
210
|
var import_protocols9 = require("@dxos/protocols");
|
|
205
211
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
206
212
|
var import_credentials13 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
207
213
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
208
214
|
var import_tracing5 = require("@dxos/tracing");
|
|
209
|
-
var
|
|
210
|
-
var import_async13 = require("@dxos/async");
|
|
211
|
-
var import_credentials14 = require("@dxos/credentials");
|
|
215
|
+
var import_util7 = require("@dxos/util");
|
|
212
216
|
var import_async14 = require("@dxos/async");
|
|
213
217
|
var import_context11 = require("@dxos/context");
|
|
218
|
+
var import_credentials14 = require("@dxos/credentials");
|
|
219
|
+
var import_echo_db = require("@dxos/echo-db");
|
|
220
|
+
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
221
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
214
222
|
var import_invariant13 = require("@dxos/invariant");
|
|
223
|
+
var import_log13 = require("@dxos/log");
|
|
224
|
+
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
225
|
+
var import_async15 = require("@dxos/async");
|
|
226
|
+
var import_context12 = require("@dxos/context");
|
|
227
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
215
228
|
var import_keys11 = require("@dxos/keys");
|
|
216
|
-
var
|
|
229
|
+
var import_log14 = require("@dxos/log");
|
|
217
230
|
var import_protocols10 = require("@dxos/protocols");
|
|
218
231
|
var import_teleport3 = require("@dxos/teleport");
|
|
219
|
-
var
|
|
220
|
-
var
|
|
232
|
+
var import_util8 = require("@dxos/util");
|
|
233
|
+
var import_async16 = require("@dxos/async");
|
|
221
234
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
222
|
-
var
|
|
235
|
+
var import_context13 = require("@dxos/context");
|
|
223
236
|
var import_credentials15 = require("@dxos/credentials");
|
|
237
|
+
var import_echo_db2 = require("@dxos/echo-db");
|
|
224
238
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
225
|
-
var
|
|
239
|
+
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
240
|
+
var import_echo_protocol3 = require("@dxos/echo-protocol");
|
|
226
241
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
227
|
-
var
|
|
242
|
+
var import_feed_store4 = require("@dxos/feed-store");
|
|
243
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
228
244
|
var import_keys12 = require("@dxos/keys");
|
|
229
|
-
var
|
|
245
|
+
var import_log15 = require("@dxos/log");
|
|
230
246
|
var import_protocols11 = require("@dxos/protocols");
|
|
231
|
-
var
|
|
247
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
232
248
|
var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
233
249
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
234
250
|
var import_tracing6 = require("@dxos/tracing");
|
|
235
|
-
var
|
|
251
|
+
var import_util9 = require("@dxos/util");
|
|
236
252
|
var import_credentials17 = require("@dxos/credentials");
|
|
237
253
|
var import_debug4 = require("@dxos/debug");
|
|
238
254
|
var import_credentials18 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
239
255
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
240
|
-
var
|
|
256
|
+
var import_async17 = require("@dxos/async");
|
|
241
257
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
242
258
|
var import_credentials19 = require("@dxos/credentials");
|
|
243
259
|
var import_debug5 = require("@dxos/debug");
|
|
244
|
-
var
|
|
245
|
-
var
|
|
246
|
-
var
|
|
260
|
+
var import_feed_store5 = require("@dxos/feed-store");
|
|
261
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
262
|
+
var import_log16 = require("@dxos/log");
|
|
247
263
|
var import_protocols12 = require("@dxos/protocols");
|
|
248
|
-
var
|
|
264
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
249
265
|
var import_tracing7 = require("@dxos/tracing");
|
|
250
|
-
var
|
|
251
|
-
var
|
|
266
|
+
var import_async18 = require("@dxos/async");
|
|
267
|
+
var import_context14 = require("@dxos/context");
|
|
252
268
|
var import_credentials20 = require("@dxos/credentials");
|
|
253
269
|
var import_debug6 = require("@dxos/debug");
|
|
254
|
-
var
|
|
255
|
-
var
|
|
256
|
-
var
|
|
257
|
-
var
|
|
270
|
+
var import_echo_db3 = require("@dxos/echo-db");
|
|
271
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
272
|
+
var import_feed_store6 = require("@dxos/feed-store");
|
|
273
|
+
var import_invariant17 = require("@dxos/invariant");
|
|
258
274
|
var import_keyring = require("@dxos/keyring");
|
|
259
275
|
var import_keys13 = require("@dxos/keys");
|
|
260
|
-
var
|
|
276
|
+
var import_log17 = require("@dxos/log");
|
|
261
277
|
var import_protocols13 = require("@dxos/protocols");
|
|
262
|
-
var
|
|
278
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
263
279
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
264
280
|
var import_tracing8 = require("@dxos/tracing");
|
|
265
|
-
var
|
|
266
|
-
var
|
|
281
|
+
var import_util10 = require("@dxos/util");
|
|
282
|
+
var import_invariant18 = require("@dxos/invariant");
|
|
267
283
|
var import_lock_file = require("@dxos/lock-file");
|
|
268
|
-
var
|
|
284
|
+
var import_log18 = require("@dxos/log");
|
|
269
285
|
var import_protocols14 = require("@dxos/protocols");
|
|
270
286
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
271
287
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
272
288
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
273
289
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
274
|
-
var
|
|
290
|
+
var import_util11 = require("@dxos/util");
|
|
275
291
|
var import_node_path = __toESM(require("node:path"));
|
|
276
292
|
var import_keys14 = require("@dxos/keys");
|
|
277
293
|
var import_kv_store = require("@dxos/kv-store");
|
|
278
|
-
var
|
|
294
|
+
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
295
|
+
var import_invariant19 = require("@dxos/invariant");
|
|
296
|
+
var import_log19 = require("@dxos/log");
|
|
297
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
298
|
+
var import_util12 = require("@dxos/util");
|
|
299
|
+
var import_async19 = require("@dxos/async");
|
|
279
300
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
280
|
-
var
|
|
281
|
-
var
|
|
301
|
+
var import_context15 = require("@dxos/context");
|
|
302
|
+
var import_invariant20 = require("@dxos/invariant");
|
|
282
303
|
var import_keys15 = require("@dxos/keys");
|
|
283
|
-
var
|
|
304
|
+
var import_log20 = require("@dxos/log");
|
|
284
305
|
var import_messaging = require("@dxos/messaging");
|
|
285
306
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
286
|
-
var
|
|
287
|
-
var
|
|
307
|
+
var import_protocols16 = require("@dxos/protocols");
|
|
308
|
+
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
288
309
|
var import_tracing9 = require("@dxos/tracing");
|
|
289
310
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
290
|
-
var
|
|
311
|
+
var import_async20 = require("@dxos/async");
|
|
291
312
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
292
|
-
var
|
|
293
|
-
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
294
|
-
var import_config3 = require("@dxos/config");
|
|
313
|
+
var import_invariant21 = require("@dxos/invariant");
|
|
295
314
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
315
|
+
var import_config3 = require("@dxos/config");
|
|
316
|
+
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
296
317
|
var import_tracing10 = require("@dxos/tracing");
|
|
297
|
-
var
|
|
318
|
+
var import_util13 = require("@dxos/util");
|
|
298
319
|
var import_keys16 = require("@dxos/keys");
|
|
299
|
-
var
|
|
300
|
-
var
|
|
320
|
+
var import_util14 = require("@dxos/util");
|
|
321
|
+
var import_async21 = require("@dxos/async");
|
|
301
322
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
302
323
|
var import_keys17 = require("@dxos/keys");
|
|
303
|
-
var
|
|
304
|
-
var
|
|
305
|
-
var import_util13 = require("@dxos/util");
|
|
324
|
+
var import_util15 = require("@dxos/util");
|
|
325
|
+
var import_async22 = require("@dxos/async");
|
|
306
326
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
307
|
-
var
|
|
327
|
+
var import_keys18 = require("@dxos/keys");
|
|
328
|
+
var import_log21 = require("@dxos/log");
|
|
308
329
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
309
|
-
var
|
|
330
|
+
var import_util16 = require("@dxos/util");
|
|
331
|
+
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
332
|
+
var import_codec_protobuf16 = require("@dxos/codec-protobuf");
|
|
333
|
+
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
334
|
+
var import_util17 = require("@dxos/util");
|
|
310
335
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
311
336
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
312
337
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -374,6 +399,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
374
399
|
};
|
|
375
400
|
});
|
|
376
401
|
};
|
|
402
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
377
403
|
var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
|
|
378
404
|
const update = () => {
|
|
379
405
|
try {
|
|
@@ -389,7 +415,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
|
|
|
389
415
|
update();
|
|
390
416
|
});
|
|
391
417
|
var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
|
|
392
|
-
const ctx = new import_context.Context(
|
|
418
|
+
const ctx = new import_context.Context(void 0, {
|
|
419
|
+
F: __dxlog_file,
|
|
420
|
+
L: 36
|
|
421
|
+
});
|
|
393
422
|
signalManager.onMessage.on(ctx, (message) => {
|
|
394
423
|
next({
|
|
395
424
|
message: {
|
|
@@ -617,7 +646,7 @@ var DevtoolsServiceImpl = class {
|
|
|
617
646
|
});
|
|
618
647
|
}
|
|
619
648
|
};
|
|
620
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
649
|
+
var DXOS_VERSION = "0.5.9-main.bf3bb8f";
|
|
621
650
|
var getPlatform = () => {
|
|
622
651
|
if (process.browser) {
|
|
623
652
|
if (typeof window !== "undefined") {
|
|
@@ -645,7 +674,7 @@ var getPlatform = () => {
|
|
|
645
674
|
};
|
|
646
675
|
}
|
|
647
676
|
};
|
|
648
|
-
var
|
|
677
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
649
678
|
var DEFAULT_TIMEOUT = 1e3;
|
|
650
679
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
651
680
|
const diagnostics = {
|
|
@@ -662,7 +691,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
662
691
|
await Promise.all([
|
|
663
692
|
(async () => {
|
|
664
693
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
665
|
-
F:
|
|
694
|
+
F: __dxlog_file2,
|
|
666
695
|
L: 110,
|
|
667
696
|
S: void 0,
|
|
668
697
|
A: [
|
|
@@ -851,7 +880,7 @@ _ts_decorate([
|
|
|
851
880
|
ClientRpcServer = _ts_decorate([
|
|
852
881
|
import_tracing2.trace.resource()
|
|
853
882
|
], ClientRpcServer);
|
|
854
|
-
var
|
|
883
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
855
884
|
var Credential = import_protocols2.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
856
885
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
857
886
|
const credential = await signer.createCredential({
|
|
@@ -866,7 +895,10 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
866
895
|
var TrustedKeySetAuthVerifier = class {
|
|
867
896
|
constructor(_params) {
|
|
868
897
|
this._params = _params;
|
|
869
|
-
this._ctx = new import_context2.Context(
|
|
898
|
+
this._ctx = new import_context2.Context(void 0, {
|
|
899
|
+
F: __dxlog_file3,
|
|
900
|
+
L: 45
|
|
901
|
+
});
|
|
870
902
|
}
|
|
871
903
|
async close() {
|
|
872
904
|
await this._ctx.dispose();
|
|
@@ -877,7 +909,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
877
909
|
(0, import_log.log)("authenticating...", {
|
|
878
910
|
credential
|
|
879
911
|
}, {
|
|
880
|
-
F:
|
|
912
|
+
F: __dxlog_file3,
|
|
881
913
|
L: 56,
|
|
882
914
|
S: this,
|
|
883
915
|
C: (f, a) => f(...a)
|
|
@@ -887,7 +919,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
887
919
|
(0, import_log.log)("Invalid credential", {
|
|
888
920
|
result
|
|
889
921
|
}, {
|
|
890
|
-
F:
|
|
922
|
+
F: __dxlog_file3,
|
|
891
923
|
L: 60,
|
|
892
924
|
S: this,
|
|
893
925
|
C: (f, a) => f(...a)
|
|
@@ -899,7 +931,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
899
931
|
nonce,
|
|
900
932
|
credential
|
|
901
933
|
}, {
|
|
902
|
-
F:
|
|
934
|
+
F: __dxlog_file3,
|
|
903
935
|
L: 65,
|
|
904
936
|
S: this,
|
|
905
937
|
C: (f, a) => f(...a)
|
|
@@ -910,7 +942,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
910
942
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
911
943
|
key: credential.issuer
|
|
912
944
|
}, {
|
|
913
|
-
F:
|
|
945
|
+
F: __dxlog_file3,
|
|
914
946
|
L: 70,
|
|
915
947
|
S: this,
|
|
916
948
|
C: (f, a) => f(...a)
|
|
@@ -926,7 +958,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
926
958
|
(0, import_log.log)("auth success", {
|
|
927
959
|
key: credential.issuer
|
|
928
960
|
}, {
|
|
929
|
-
F:
|
|
961
|
+
F: __dxlog_file3,
|
|
930
962
|
L: 81,
|
|
931
963
|
S: this,
|
|
932
964
|
C: (f, a) => f(...a)
|
|
@@ -936,7 +968,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
936
968
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
937
969
|
key: credential.issuer
|
|
938
970
|
}, {
|
|
939
|
-
F:
|
|
971
|
+
F: __dxlog_file3,
|
|
940
972
|
L: 84,
|
|
941
973
|
S: this,
|
|
942
974
|
C: (f, a) => f(...a)
|
|
@@ -959,7 +991,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
959
991
|
return deviceSet.has(deviceKey);
|
|
960
992
|
}
|
|
961
993
|
};
|
|
962
|
-
var
|
|
994
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
963
995
|
var DefaultSpaceStateMachine = class {
|
|
964
996
|
constructor(_params) {
|
|
965
997
|
this._params = _params;
|
|
@@ -976,7 +1008,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
976
1008
|
expectedIdentity: this._params.identityKey,
|
|
977
1009
|
credential
|
|
978
1010
|
}, {
|
|
979
|
-
F:
|
|
1011
|
+
F: __dxlog_file4,
|
|
980
1012
|
L: 32,
|
|
981
1013
|
S: this,
|
|
982
1014
|
C: (f, a) => f(...a)
|
|
@@ -987,7 +1019,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
987
1019
|
import_log3.log.warn("Invalid default space id", {
|
|
988
1020
|
id: assertion.spaceId
|
|
989
1021
|
}, {
|
|
990
|
-
F:
|
|
1022
|
+
F: __dxlog_file4,
|
|
991
1023
|
L: 36,
|
|
992
1024
|
S: this,
|
|
993
1025
|
C: (f, a) => f(...a)
|
|
@@ -1010,7 +1042,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1010
1042
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1011
1043
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1012
1044
|
}
|
|
1013
|
-
var
|
|
1045
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
1014
1046
|
var Identity = class {
|
|
1015
1047
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
1016
1048
|
this.stateUpdate = new import_async6.Event();
|
|
@@ -1022,7 +1054,7 @@ var Identity = class {
|
|
|
1022
1054
|
import_log2.log.trace("dxos.halo.device", {
|
|
1023
1055
|
deviceKey
|
|
1024
1056
|
}, {
|
|
1025
|
-
F:
|
|
1057
|
+
F: __dxlog_file5,
|
|
1026
1058
|
L: 70,
|
|
1027
1059
|
S: this,
|
|
1028
1060
|
C: (f, a) => f(...a)
|
|
@@ -1101,7 +1133,7 @@ var Identity = class {
|
|
|
1101
1133
|
*/
|
|
1102
1134
|
getIdentityCredentialSigner() {
|
|
1103
1135
|
(0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
1104
|
-
F:
|
|
1136
|
+
F: __dxlog_file5,
|
|
1105
1137
|
L: 159,
|
|
1106
1138
|
S: this,
|
|
1107
1139
|
A: [
|
|
@@ -1145,7 +1177,7 @@ var Identity = class {
|
|
|
1145
1177
|
controlFeedKey,
|
|
1146
1178
|
dataFeedKey
|
|
1147
1179
|
}, {
|
|
1148
|
-
F:
|
|
1180
|
+
F: __dxlog_file5,
|
|
1149
1181
|
L: 184,
|
|
1150
1182
|
S: this,
|
|
1151
1183
|
C: (f, a) => f(...a)
|
|
@@ -1206,7 +1238,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1206
1238
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1207
1239
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1208
1240
|
}
|
|
1209
|
-
var
|
|
1241
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1210
1242
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1211
1243
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1212
1244
|
var IdentityManager = class {
|
|
@@ -1230,7 +1262,7 @@ var IdentityManager = class {
|
|
|
1230
1262
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
|
|
1231
1263
|
id: traceId
|
|
1232
1264
|
}), {
|
|
1233
|
-
F:
|
|
1265
|
+
F: __dxlog_file6,
|
|
1234
1266
|
L: 104,
|
|
1235
1267
|
S: this,
|
|
1236
1268
|
C: (f, a) => f(...a)
|
|
@@ -1239,7 +1271,7 @@ var IdentityManager = class {
|
|
|
1239
1271
|
(0, import_log4.log)("identity record", {
|
|
1240
1272
|
identityRecord
|
|
1241
1273
|
}, {
|
|
1242
|
-
F:
|
|
1274
|
+
F: __dxlog_file6,
|
|
1243
1275
|
L: 107,
|
|
1244
1276
|
S: this,
|
|
1245
1277
|
C: (f, a) => f(...a)
|
|
@@ -1252,7 +1284,7 @@ var IdentityManager = class {
|
|
|
1252
1284
|
identityKey: identityRecord.identityKey,
|
|
1253
1285
|
displayName: this._identity.profileDocument?.displayName
|
|
1254
1286
|
}, {
|
|
1255
|
-
F:
|
|
1287
|
+
F: __dxlog_file6,
|
|
1256
1288
|
L: 112,
|
|
1257
1289
|
S: this,
|
|
1258
1290
|
C: (f, a) => f(...a)
|
|
@@ -1262,18 +1294,21 @@ var IdentityManager = class {
|
|
|
1262
1294
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
|
|
1263
1295
|
id: traceId
|
|
1264
1296
|
}), {
|
|
1265
|
-
F:
|
|
1297
|
+
F: __dxlog_file6,
|
|
1266
1298
|
L: 119,
|
|
1267
1299
|
S: this,
|
|
1268
1300
|
C: (f, a) => f(...a)
|
|
1269
1301
|
});
|
|
1270
1302
|
}
|
|
1271
1303
|
async close() {
|
|
1272
|
-
await this._identity?.close(new import_context3.Context(
|
|
1304
|
+
await this._identity?.close(new import_context3.Context(void 0, {
|
|
1305
|
+
F: __dxlog_file6,
|
|
1306
|
+
L: 123
|
|
1307
|
+
}));
|
|
1273
1308
|
}
|
|
1274
1309
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1275
1310
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1276
|
-
F:
|
|
1311
|
+
F: __dxlog_file6,
|
|
1277
1312
|
L: 128,
|
|
1278
1313
|
S: this,
|
|
1279
1314
|
A: [
|
|
@@ -1282,7 +1317,7 @@ var IdentityManager = class {
|
|
|
1282
1317
|
]
|
|
1283
1318
|
});
|
|
1284
1319
|
(0, import_log4.log)("creating identity...", void 0, {
|
|
1285
|
-
F:
|
|
1320
|
+
F: __dxlog_file6,
|
|
1286
1321
|
L: 129,
|
|
1287
1322
|
S: this,
|
|
1288
1323
|
C: (f, a) => f(...a)
|
|
@@ -1299,11 +1334,14 @@ var IdentityManager = class {
|
|
|
1299
1334
|
}
|
|
1300
1335
|
};
|
|
1301
1336
|
const identity = await this._constructIdentity(identityRecord);
|
|
1302
|
-
await identity.open(new import_context3.Context(
|
|
1337
|
+
await identity.open(new import_context3.Context(void 0, {
|
|
1338
|
+
F: __dxlog_file6,
|
|
1339
|
+
L: 144
|
|
1340
|
+
}));
|
|
1303
1341
|
{
|
|
1304
1342
|
const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1305
1343
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1306
|
-
F:
|
|
1344
|
+
F: __dxlog_file6,
|
|
1307
1345
|
L: 148,
|
|
1308
1346
|
S: this,
|
|
1309
1347
|
A: [
|
|
@@ -1312,7 +1350,7 @@ var IdentityManager = class {
|
|
|
1312
1350
|
]
|
|
1313
1351
|
});
|
|
1314
1352
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1315
|
-
F:
|
|
1353
|
+
F: __dxlog_file6,
|
|
1316
1354
|
L: 149,
|
|
1317
1355
|
S: this,
|
|
1318
1356
|
A: [
|
|
@@ -1351,7 +1389,7 @@ var IdentityManager = class {
|
|
|
1351
1389
|
identityKey: identityRecord.identityKey,
|
|
1352
1390
|
displayName: this._identity.profileDocument?.displayName
|
|
1353
1391
|
}, {
|
|
1354
|
-
F:
|
|
1392
|
+
F: __dxlog_file6,
|
|
1355
1393
|
L: 191,
|
|
1356
1394
|
S: this,
|
|
1357
1395
|
C: (f, a) => f(...a)
|
|
@@ -1362,7 +1400,7 @@ var IdentityManager = class {
|
|
|
1362
1400
|
deviceKey: identity.deviceKey,
|
|
1363
1401
|
profile: identity.profileDocument
|
|
1364
1402
|
}, {
|
|
1365
|
-
F:
|
|
1403
|
+
F: __dxlog_file6,
|
|
1366
1404
|
L: 197,
|
|
1367
1405
|
S: this,
|
|
1368
1406
|
C: (f, a) => f(...a)
|
|
@@ -1399,13 +1437,13 @@ var IdentityManager = class {
|
|
|
1399
1437
|
(0, import_log4.log)("accepting identity", {
|
|
1400
1438
|
params
|
|
1401
1439
|
}, {
|
|
1402
|
-
F:
|
|
1440
|
+
F: __dxlog_file6,
|
|
1403
1441
|
L: 235,
|
|
1404
1442
|
S: this,
|
|
1405
1443
|
C: (f, a) => f(...a)
|
|
1406
1444
|
});
|
|
1407
1445
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1408
|
-
F:
|
|
1446
|
+
F: __dxlog_file6,
|
|
1409
1447
|
L: 236,
|
|
1410
1448
|
S: this,
|
|
1411
1449
|
A: [
|
|
@@ -1425,7 +1463,10 @@ var IdentityManager = class {
|
|
|
1425
1463
|
}
|
|
1426
1464
|
};
|
|
1427
1465
|
const identity = await this._constructIdentity(identityRecord);
|
|
1428
|
-
await identity.open(new import_context3.Context(
|
|
1466
|
+
await identity.open(new import_context3.Context(void 0, {
|
|
1467
|
+
F: __dxlog_file6,
|
|
1468
|
+
L: 251
|
|
1469
|
+
}));
|
|
1429
1470
|
this._identity = identity;
|
|
1430
1471
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1431
1472
|
await this._identity.ready();
|
|
@@ -1433,7 +1474,7 @@ var IdentityManager = class {
|
|
|
1433
1474
|
identityKey: identityRecord.identityKey,
|
|
1434
1475
|
displayName: this._identity.profileDocument?.displayName
|
|
1435
1476
|
}, {
|
|
1436
|
-
F:
|
|
1477
|
+
F: __dxlog_file6,
|
|
1437
1478
|
L: 255,
|
|
1438
1479
|
S: this,
|
|
1439
1480
|
C: (f, a) => f(...a)
|
|
@@ -1447,7 +1488,7 @@ var IdentityManager = class {
|
|
|
1447
1488
|
identityKey: identity.identityKey,
|
|
1448
1489
|
deviceKey: identity.deviceKey
|
|
1449
1490
|
}, {
|
|
1450
|
-
F:
|
|
1491
|
+
F: __dxlog_file6,
|
|
1451
1492
|
L: 265,
|
|
1452
1493
|
S: this,
|
|
1453
1494
|
C: (f, a) => f(...a)
|
|
@@ -1459,7 +1500,7 @@ var IdentityManager = class {
|
|
|
1459
1500
|
*/
|
|
1460
1501
|
async updateProfile(profile) {
|
|
1461
1502
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1462
|
-
F:
|
|
1503
|
+
F: __dxlog_file6,
|
|
1463
1504
|
L: 273,
|
|
1464
1505
|
S: this,
|
|
1465
1506
|
A: [
|
|
@@ -1490,7 +1531,7 @@ var IdentityManager = class {
|
|
|
1490
1531
|
}
|
|
1491
1532
|
async updateDeviceProfile(profile) {
|
|
1492
1533
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1493
|
-
F:
|
|
1534
|
+
F: __dxlog_file6,
|
|
1494
1535
|
L: 290,
|
|
1495
1536
|
S: this,
|
|
1496
1537
|
A: [
|
|
@@ -1526,7 +1567,7 @@ var IdentityManager = class {
|
|
|
1526
1567
|
}
|
|
1527
1568
|
async _constructIdentity(identityRecord) {
|
|
1528
1569
|
(0, import_invariant3.invariant)(!this._identity, void 0, {
|
|
1529
|
-
F:
|
|
1570
|
+
F: __dxlog_file6,
|
|
1530
1571
|
L: 316,
|
|
1531
1572
|
S: this,
|
|
1532
1573
|
A: [
|
|
@@ -1537,7 +1578,7 @@ var IdentityManager = class {
|
|
|
1537
1578
|
(0, import_log4.log)("constructing identity", {
|
|
1538
1579
|
identityRecord
|
|
1539
1580
|
}, {
|
|
1540
|
-
F:
|
|
1581
|
+
F: __dxlog_file6,
|
|
1541
1582
|
L: 317,
|
|
1542
1583
|
S: this,
|
|
1543
1584
|
C: (f, a) => f(...a)
|
|
@@ -1552,7 +1593,7 @@ var IdentityManager = class {
|
|
|
1552
1593
|
gossip
|
|
1553
1594
|
});
|
|
1554
1595
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1555
|
-
F:
|
|
1596
|
+
F: __dxlog_file6,
|
|
1556
1597
|
L: 330,
|
|
1557
1598
|
S: this,
|
|
1558
1599
|
A: [
|
|
@@ -1564,7 +1605,7 @@ var IdentityManager = class {
|
|
|
1564
1605
|
writable: true
|
|
1565
1606
|
});
|
|
1566
1607
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1567
|
-
F:
|
|
1608
|
+
F: __dxlog_file6,
|
|
1568
1609
|
L: 334,
|
|
1569
1610
|
S: this,
|
|
1570
1611
|
A: [
|
|
@@ -1598,7 +1639,7 @@ var IdentityManager = class {
|
|
|
1598
1639
|
(0, import_log4.log)("done", {
|
|
1599
1640
|
identityKey: identityRecord.identityKey
|
|
1600
1641
|
}, {
|
|
1601
|
-
F:
|
|
1642
|
+
F: __dxlog_file6,
|
|
1602
1643
|
L: 360,
|
|
1603
1644
|
S: this,
|
|
1604
1645
|
C: (f, a) => f(...a)
|
|
@@ -1623,7 +1664,7 @@ var IdentityManager = class {
|
|
|
1623
1664
|
},
|
|
1624
1665
|
onAuthFailure: () => {
|
|
1625
1666
|
import_log4.log.warn("auth failure", void 0, {
|
|
1626
|
-
F:
|
|
1667
|
+
F: __dxlog_file6,
|
|
1627
1668
|
L: 385,
|
|
1628
1669
|
S: this,
|
|
1629
1670
|
C: (f, a) => f(...a)
|
|
@@ -1645,7 +1686,8 @@ _ts_decorate3([
|
|
|
1645
1686
|
IdentityManager = _ts_decorate3([
|
|
1646
1687
|
import_tracing4.trace.resource()
|
|
1647
1688
|
], IdentityManager);
|
|
1648
|
-
var
|
|
1689
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1690
|
+
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1649
1691
|
var IdentityServiceImpl = class extends import_context4.Resource {
|
|
1650
1692
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
1651
1693
|
super();
|
|
@@ -1674,8 +1716,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1674
1716
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1675
1717
|
const identity = this._identityManager.identity;
|
|
1676
1718
|
(0, import_invariant4.invariant)(identity, void 0, {
|
|
1677
|
-
F:
|
|
1678
|
-
L:
|
|
1719
|
+
F: __dxlog_file7,
|
|
1720
|
+
L: 59,
|
|
1679
1721
|
S: this,
|
|
1680
1722
|
A: [
|
|
1681
1723
|
"identity",
|
|
@@ -1708,8 +1750,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1708
1750
|
}
|
|
1709
1751
|
async updateProfile(profile) {
|
|
1710
1752
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1711
|
-
F:
|
|
1712
|
-
L:
|
|
1753
|
+
F: __dxlog_file7,
|
|
1754
|
+
L: 89,
|
|
1713
1755
|
S: this,
|
|
1714
1756
|
A: [
|
|
1715
1757
|
"this._identityManager.identity",
|
|
@@ -1722,8 +1764,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1722
1764
|
}
|
|
1723
1765
|
async signPresentation({ presentation, nonce }) {
|
|
1724
1766
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1725
|
-
F:
|
|
1726
|
-
L:
|
|
1767
|
+
F: __dxlog_file7,
|
|
1768
|
+
L: 96,
|
|
1727
1769
|
S: this,
|
|
1728
1770
|
A: [
|
|
1729
1771
|
"this._identityManager.identity",
|
|
@@ -1739,25 +1781,55 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1739
1781
|
});
|
|
1740
1782
|
}
|
|
1741
1783
|
async _fixIdentityWithoutDefaultSpace(identity) {
|
|
1742
|
-
let
|
|
1784
|
+
let recodedDefaultSpace = false;
|
|
1785
|
+
let foundDefaultSpace = false;
|
|
1743
1786
|
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
1744
|
-
|
|
1787
|
+
const recordedDefaultSpaceTrigger = new import_async8.Trigger();
|
|
1788
|
+
const allProcessed = (0, import_util4.safeAwaitAll)(dataSpaceManager.spaces.values(), async (space) => {
|
|
1745
1789
|
if (space.state === import_services4.SpaceState.CLOSED) {
|
|
1746
1790
|
await space.open();
|
|
1747
|
-
|
|
1791
|
+
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services4.SpaceState.REQUIRES_MIGRATION);
|
|
1792
|
+
await Promise.race([
|
|
1793
|
+
space.initializeDataPipeline(),
|
|
1794
|
+
requiresMigration
|
|
1795
|
+
]);
|
|
1748
1796
|
}
|
|
1749
1797
|
if (await dataSpaceManager.isDefaultSpace(space)) {
|
|
1798
|
+
if (foundDefaultSpace) {
|
|
1799
|
+
import_log5.log.warn("Multiple default spaces found. Using the first one.", {
|
|
1800
|
+
duplicate: space.id
|
|
1801
|
+
}, {
|
|
1802
|
+
F: __dxlog_file7,
|
|
1803
|
+
L: 129,
|
|
1804
|
+
S: this,
|
|
1805
|
+
C: (f, a) => f(...a)
|
|
1806
|
+
});
|
|
1807
|
+
return;
|
|
1808
|
+
}
|
|
1809
|
+
foundDefaultSpace = true;
|
|
1750
1810
|
await identity.updateDefaultSpace(space.id);
|
|
1751
|
-
|
|
1752
|
-
|
|
1811
|
+
recodedDefaultSpace = true;
|
|
1812
|
+
recordedDefaultSpaceTrigger.wake();
|
|
1753
1813
|
}
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1814
|
+
}, (err) => {
|
|
1815
|
+
import_log5.log.catch(err, void 0, {
|
|
1816
|
+
F: __dxlog_file7,
|
|
1817
|
+
L: 140,
|
|
1818
|
+
S: this,
|
|
1819
|
+
C: (f, a) => f(...a)
|
|
1820
|
+
});
|
|
1821
|
+
});
|
|
1822
|
+
await Promise.race([
|
|
1823
|
+
allProcessed,
|
|
1824
|
+
recordedDefaultSpaceTrigger.wait(),
|
|
1825
|
+
(0, import_async8.sleep)(DEFAULT_SPACE_SEARCH_TIMEOUT)
|
|
1826
|
+
]);
|
|
1827
|
+
if (!recodedDefaultSpace) {
|
|
1756
1828
|
await this._createDefaultSpace(dataSpaceManager);
|
|
1757
1829
|
}
|
|
1758
1830
|
}
|
|
1759
1831
|
};
|
|
1760
|
-
var
|
|
1832
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1761
1833
|
var DeviceInvitationProtocol = class {
|
|
1762
1834
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1763
1835
|
this._keyring = _keyring;
|
|
@@ -1783,7 +1855,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1783
1855
|
}
|
|
1784
1856
|
async admit(_, request) {
|
|
1785
1857
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1786
|
-
F:
|
|
1858
|
+
F: __dxlog_file8,
|
|
1787
1859
|
L: 50,
|
|
1788
1860
|
S: this,
|
|
1789
1861
|
A: [
|
|
@@ -1829,7 +1901,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1829
1901
|
}
|
|
1830
1902
|
async accept(response, request) {
|
|
1831
1903
|
(0, import_invariant5.invariant)(response.device, void 0, {
|
|
1832
|
-
F:
|
|
1904
|
+
F: __dxlog_file8,
|
|
1833
1905
|
L: 95,
|
|
1834
1906
|
S: this,
|
|
1835
1907
|
A: [
|
|
@@ -1839,7 +1911,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1839
1911
|
});
|
|
1840
1912
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1841
1913
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1842
|
-
F:
|
|
1914
|
+
F: __dxlog_file8,
|
|
1843
1915
|
L: 98,
|
|
1844
1916
|
S: this,
|
|
1845
1917
|
A: [
|
|
@@ -1878,7 +1950,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1878
1950
|
return guard;
|
|
1879
1951
|
})());
|
|
1880
1952
|
};
|
|
1881
|
-
var
|
|
1953
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1882
1954
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1883
1955
|
var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
1884
1956
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1892,8 +1964,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1892
1964
|
});
|
|
1893
1965
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1894
1966
|
this._callbacks = _callbacks;
|
|
1895
|
-
this._ctx = new import_context6.Context(
|
|
1896
|
-
|
|
1967
|
+
this._ctx = new import_context6.Context(void 0, {
|
|
1968
|
+
F: __dxlog_file9,
|
|
1969
|
+
L: 33
|
|
1970
|
+
});
|
|
1971
|
+
this._remoteOptionsTrigger = new import_async10.Trigger();
|
|
1897
1972
|
this._invitationFlowLock = null;
|
|
1898
1973
|
}
|
|
1899
1974
|
hasFlowLock() {
|
|
@@ -1904,7 +1979,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1904
1979
|
InvitationHostService: {
|
|
1905
1980
|
options: async (options) => {
|
|
1906
1981
|
(0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1907
|
-
F:
|
|
1982
|
+
F: __dxlog_file9,
|
|
1908
1983
|
L: 63,
|
|
1909
1984
|
S: this,
|
|
1910
1985
|
A: [
|
|
@@ -1930,15 +2005,15 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1930
2005
|
async onOpen(context) {
|
|
1931
2006
|
await super.onOpen(context);
|
|
1932
2007
|
try {
|
|
1933
|
-
(0,
|
|
1934
|
-
F:
|
|
2008
|
+
(0, import_log7.log)("guest acquire lock", void 0, {
|
|
2009
|
+
F: __dxlog_file9,
|
|
1935
2010
|
L: 84,
|
|
1936
2011
|
S: this,
|
|
1937
2012
|
C: (f, a) => f(...a)
|
|
1938
2013
|
});
|
|
1939
2014
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1940
|
-
(0,
|
|
1941
|
-
F:
|
|
2015
|
+
(0, import_log7.log)("guest lock acquired", void 0, {
|
|
2016
|
+
F: __dxlog_file9,
|
|
1942
2017
|
L: 86,
|
|
1943
2018
|
S: this,
|
|
1944
2019
|
C: (f, a) => f(...a)
|
|
@@ -1946,8 +2021,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1946
2021
|
await (0, import_context6.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
|
|
1947
2022
|
role: import_invitations3.Options.Role.GUEST
|
|
1948
2023
|
}));
|
|
1949
|
-
(0,
|
|
1950
|
-
F:
|
|
2024
|
+
(0, import_log7.log)("options sent", void 0, {
|
|
2025
|
+
F: __dxlog_file9,
|
|
1951
2026
|
L: 88,
|
|
1952
2027
|
S: this,
|
|
1953
2028
|
C: (f, a) => f(...a)
|
|
@@ -1955,8 +2030,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1955
2030
|
await (0, import_context6.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
1956
2031
|
timeout: OPTIONS_TIMEOUT
|
|
1957
2032
|
}));
|
|
1958
|
-
(0,
|
|
1959
|
-
F:
|
|
2033
|
+
(0, import_log7.log)("options received", void 0, {
|
|
2034
|
+
F: __dxlog_file9,
|
|
1960
2035
|
L: 90,
|
|
1961
2036
|
S: this,
|
|
1962
2037
|
C: (f, a) => f(...a)
|
|
@@ -1989,8 +2064,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1989
2064
|
if (this._invitationFlowLock != null) {
|
|
1990
2065
|
this._invitationFlowLock.release();
|
|
1991
2066
|
this._invitationFlowLock = null;
|
|
1992
|
-
(0,
|
|
1993
|
-
F:
|
|
2067
|
+
(0, import_log7.log)("invitation flow lock released", void 0, {
|
|
2068
|
+
F: __dxlog_file9,
|
|
1994
2069
|
L: 123,
|
|
1995
2070
|
S: this,
|
|
1996
2071
|
C: (f, a) => f(...a)
|
|
@@ -1998,7 +2073,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1998
2073
|
}
|
|
1999
2074
|
}
|
|
2000
2075
|
};
|
|
2001
|
-
var
|
|
2076
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
2002
2077
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
2003
2078
|
var MAX_OTP_ATTEMPTS = 3;
|
|
2004
2079
|
var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
@@ -2013,13 +2088,16 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2013
2088
|
});
|
|
2014
2089
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
2015
2090
|
this._callbacks = _callbacks;
|
|
2016
|
-
this._ctx = new import_context8.Context(
|
|
2017
|
-
|
|
2091
|
+
this._ctx = new import_context8.Context(void 0, {
|
|
2092
|
+
F: __dxlog_file10,
|
|
2093
|
+
L: 52
|
|
2094
|
+
});
|
|
2095
|
+
this._remoteOptionsTrigger = new import_async11.Trigger();
|
|
2018
2096
|
this._challenge = void 0;
|
|
2019
2097
|
this.guestProfile = void 0;
|
|
2020
2098
|
this.authenticationPassed = false;
|
|
2021
2099
|
this.authenticationRetry = 0;
|
|
2022
|
-
this.completedTrigger = new
|
|
2100
|
+
this.completedTrigger = new import_async11.Trigger();
|
|
2023
2101
|
this._invitationFlowLock = null;
|
|
2024
2102
|
}
|
|
2025
2103
|
hasFlowLock() {
|
|
@@ -2032,7 +2110,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2032
2110
|
InvitationHostService: {
|
|
2033
2111
|
options: async (options) => {
|
|
2034
2112
|
(0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
2035
|
-
F:
|
|
2113
|
+
F: __dxlog_file10,
|
|
2036
2114
|
L: 101,
|
|
2037
2115
|
S: this,
|
|
2038
2116
|
A: [
|
|
@@ -2046,10 +2124,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2046
2124
|
introduce: async (request) => {
|
|
2047
2125
|
const { profile, invitationId } = request;
|
|
2048
2126
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2049
|
-
|
|
2127
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
|
|
2050
2128
|
id: traceId
|
|
2051
2129
|
}), {
|
|
2052
|
-
F:
|
|
2130
|
+
F: __dxlog_file10,
|
|
2053
2131
|
L: 110,
|
|
2054
2132
|
S: this,
|
|
2055
2133
|
C: (f, a) => f(...a)
|
|
@@ -2057,25 +2135,25 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2057
2135
|
const invitation = this._requireActiveInvitation();
|
|
2058
2136
|
this._assertInvitationState(import_services8.Invitation.State.CONNECTED);
|
|
2059
2137
|
if (invitationId !== invitation?.invitationId) {
|
|
2060
|
-
|
|
2138
|
+
import_log8.log.warn("incorrect invitationId", {
|
|
2061
2139
|
expected: invitation.invitationId,
|
|
2062
2140
|
actual: invitationId
|
|
2063
2141
|
}, {
|
|
2064
|
-
F:
|
|
2142
|
+
F: __dxlog_file10,
|
|
2065
2143
|
L: 116,
|
|
2066
2144
|
S: this,
|
|
2067
2145
|
C: (f, a) => f(...a)
|
|
2068
2146
|
});
|
|
2069
2147
|
this._callbacks.onError(new Error("Incorrect invitationId."));
|
|
2070
|
-
(0,
|
|
2148
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2071
2149
|
return {
|
|
2072
2150
|
authMethod: import_services8.Invitation.AuthMethod.NONE
|
|
2073
2151
|
};
|
|
2074
2152
|
}
|
|
2075
|
-
(0,
|
|
2153
|
+
(0, import_log8.log)("guest introduced themselves", {
|
|
2076
2154
|
guestProfile: profile
|
|
2077
2155
|
}, {
|
|
2078
|
-
F:
|
|
2156
|
+
F: __dxlog_file10,
|
|
2079
2157
|
L: 125,
|
|
2080
2158
|
S: this,
|
|
2081
2159
|
C: (f, a) => f(...a)
|
|
@@ -2083,10 +2161,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2083
2161
|
this.guestProfile = profile;
|
|
2084
2162
|
this._callbacks.onStateUpdate(import_services8.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2085
2163
|
this._challenge = invitation.authMethod === import_services8.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
|
|
2086
|
-
|
|
2164
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
|
|
2087
2165
|
id: traceId
|
|
2088
2166
|
}), {
|
|
2089
|
-
F:
|
|
2167
|
+
F: __dxlog_file10,
|
|
2090
2168
|
L: 132,
|
|
2091
2169
|
S: this,
|
|
2092
2170
|
C: (f, a) => f(...a)
|
|
@@ -2098,19 +2176,19 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2098
2176
|
},
|
|
2099
2177
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
2100
2178
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2101
|
-
|
|
2179
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
|
|
2102
2180
|
id: traceId
|
|
2103
2181
|
}), {
|
|
2104
|
-
F:
|
|
2182
|
+
F: __dxlog_file10,
|
|
2105
2183
|
L: 141,
|
|
2106
2184
|
S: this,
|
|
2107
2185
|
C: (f, a) => f(...a)
|
|
2108
2186
|
});
|
|
2109
2187
|
const invitation = this._requireActiveInvitation();
|
|
2110
|
-
(0,
|
|
2188
|
+
(0, import_log8.log)("received authentication request", {
|
|
2111
2189
|
authCode: code
|
|
2112
2190
|
}, {
|
|
2113
|
-
F:
|
|
2191
|
+
F: __dxlog_file10,
|
|
2114
2192
|
L: 144,
|
|
2115
2193
|
S: this,
|
|
2116
2194
|
C: (f, a) => f(...a)
|
|
@@ -2123,8 +2201,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2123
2201
|
this._callbacks.onStateUpdate(import_services8.Invitation.State.AUTHENTICATING);
|
|
2124
2202
|
switch (invitation.authMethod) {
|
|
2125
2203
|
case import_services8.Invitation.AuthMethod.NONE: {
|
|
2126
|
-
(0,
|
|
2127
|
-
F:
|
|
2204
|
+
(0, import_log8.log)("authentication not required", void 0, {
|
|
2205
|
+
F: __dxlog_file10,
|
|
2128
2206
|
L: 152,
|
|
2129
2207
|
S: this,
|
|
2130
2208
|
C: (f, a) => f(...a)
|
|
@@ -2159,10 +2237,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2159
2237
|
break;
|
|
2160
2238
|
}
|
|
2161
2239
|
default: {
|
|
2162
|
-
|
|
2240
|
+
import_log8.log.error("invalid authentication method", {
|
|
2163
2241
|
authMethod: invitation.authMethod
|
|
2164
2242
|
}, {
|
|
2165
|
-
F:
|
|
2243
|
+
F: __dxlog_file10,
|
|
2166
2244
|
L: 190,
|
|
2167
2245
|
S: this,
|
|
2168
2246
|
C: (f, a) => f(...a)
|
|
@@ -2176,18 +2254,18 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2176
2254
|
import_invitations4.AuthenticationResponse.Status.INVALID_OTP
|
|
2177
2255
|
].includes(status)) {
|
|
2178
2256
|
this._callbacks.onError(new Error(`Authentication failed, with status=${status}`));
|
|
2179
|
-
(0,
|
|
2257
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2180
2258
|
return {
|
|
2181
2259
|
status
|
|
2182
2260
|
};
|
|
2183
2261
|
}
|
|
2184
|
-
|
|
2262
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.end({
|
|
2185
2263
|
id: traceId,
|
|
2186
2264
|
data: {
|
|
2187
2265
|
status
|
|
2188
2266
|
}
|
|
2189
2267
|
}), {
|
|
2190
|
-
F:
|
|
2268
|
+
F: __dxlog_file10,
|
|
2191
2269
|
L: 202,
|
|
2192
2270
|
S: this,
|
|
2193
2271
|
C: (f, a) => f(...a)
|
|
@@ -2198,10 +2276,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2198
2276
|
},
|
|
2199
2277
|
admit: async (request) => {
|
|
2200
2278
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2201
|
-
|
|
2279
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
|
|
2202
2280
|
id: traceId
|
|
2203
2281
|
}), {
|
|
2204
|
-
F:
|
|
2282
|
+
F: __dxlog_file10,
|
|
2205
2283
|
L: 208,
|
|
2206
2284
|
S: this,
|
|
2207
2285
|
C: (f, a) => f(...a)
|
|
@@ -2215,10 +2293,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2215
2293
|
}
|
|
2216
2294
|
}
|
|
2217
2295
|
const response = await this._callbacks.admit(request);
|
|
2218
|
-
|
|
2296
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
|
|
2219
2297
|
id: traceId
|
|
2220
2298
|
}), {
|
|
2221
|
-
F:
|
|
2299
|
+
F: __dxlog_file10,
|
|
2222
2300
|
L: 222,
|
|
2223
2301
|
S: this,
|
|
2224
2302
|
C: (f, a) => f(...a)
|
|
@@ -2235,15 +2313,15 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2235
2313
|
async onOpen(context) {
|
|
2236
2314
|
await super.onOpen(context);
|
|
2237
2315
|
try {
|
|
2238
|
-
(0,
|
|
2239
|
-
F:
|
|
2316
|
+
(0, import_log8.log)("host acquire lock", void 0, {
|
|
2317
|
+
F: __dxlog_file10,
|
|
2240
2318
|
L: 237,
|
|
2241
2319
|
S: this,
|
|
2242
2320
|
C: (f, a) => f(...a)
|
|
2243
2321
|
});
|
|
2244
2322
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2245
|
-
(0,
|
|
2246
|
-
F:
|
|
2323
|
+
(0, import_log8.log)("host lock acquired", void 0, {
|
|
2324
|
+
F: __dxlog_file10,
|
|
2247
2325
|
L: 239,
|
|
2248
2326
|
S: this,
|
|
2249
2327
|
C: (f, a) => f(...a)
|
|
@@ -2253,8 +2331,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2253
2331
|
await this.rpc.InvitationHostService.options({
|
|
2254
2332
|
role: import_invitations4.Options.Role.HOST
|
|
2255
2333
|
});
|
|
2256
|
-
(0,
|
|
2257
|
-
F:
|
|
2334
|
+
(0, import_log8.log)("options sent", void 0, {
|
|
2335
|
+
F: __dxlog_file10,
|
|
2258
2336
|
L: 243,
|
|
2259
2337
|
S: this,
|
|
2260
2338
|
C: (f, a) => f(...a)
|
|
@@ -2262,8 +2340,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2262
2340
|
await (0, import_context8.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
2263
2341
|
timeout: OPTIONS_TIMEOUT2
|
|
2264
2342
|
}));
|
|
2265
|
-
(0,
|
|
2266
|
-
F:
|
|
2343
|
+
(0, import_log8.log)("options received", void 0, {
|
|
2344
|
+
F: __dxlog_file10,
|
|
2267
2345
|
L: 245,
|
|
2268
2346
|
S: this,
|
|
2269
2347
|
C: (f, a) => f(...a)
|
|
@@ -2290,7 +2368,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2290
2368
|
_requireActiveInvitation() {
|
|
2291
2369
|
const invitation = this._callbacks.activeInvitation;
|
|
2292
2370
|
if (invitation == null) {
|
|
2293
|
-
(0,
|
|
2371
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2294
2372
|
throw new Error("Active invitation not found");
|
|
2295
2373
|
}
|
|
2296
2374
|
return invitation;
|
|
@@ -2301,7 +2379,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2301
2379
|
stateOrMany
|
|
2302
2380
|
];
|
|
2303
2381
|
if (!validStates.includes(invitation.state)) {
|
|
2304
|
-
(0,
|
|
2382
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2305
2383
|
throw new import_invariant8.InvariantViolation(`Expected ${stateToString(invitation.state)} to be one of [${validStates.map(stateToString).join(", ")}]`);
|
|
2306
2384
|
}
|
|
2307
2385
|
}
|
|
@@ -2316,8 +2394,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2316
2394
|
if (this._invitationFlowLock != null) {
|
|
2317
2395
|
this._invitationFlowLock?.release();
|
|
2318
2396
|
this._invitationFlowLock = null;
|
|
2319
|
-
(0,
|
|
2320
|
-
F:
|
|
2397
|
+
(0, import_log8.log)("invitation flow lock released", void 0, {
|
|
2398
|
+
F: __dxlog_file10,
|
|
2321
2399
|
L: 300,
|
|
2322
2400
|
S: this,
|
|
2323
2401
|
C: (f, a) => f(...a)
|
|
@@ -2326,15 +2404,15 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2326
2404
|
}
|
|
2327
2405
|
};
|
|
2328
2406
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services8.Invitation.AuthMethod.NONE;
|
|
2329
|
-
var
|
|
2407
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2330
2408
|
var InvitationTopology = class {
|
|
2331
2409
|
constructor(_role) {
|
|
2332
2410
|
this._role = _role;
|
|
2333
|
-
this._seenPeers = new
|
|
2411
|
+
this._seenPeers = new import_util6.ComplexSet(import_keys8.PublicKey.hash);
|
|
2334
2412
|
}
|
|
2335
2413
|
init(controller) {
|
|
2336
2414
|
(0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
|
|
2337
|
-
F:
|
|
2415
|
+
F: __dxlog_file11,
|
|
2338
2416
|
L: 42,
|
|
2339
2417
|
S: this,
|
|
2340
2418
|
A: [
|
|
@@ -2346,7 +2424,7 @@ var InvitationTopology = class {
|
|
|
2346
2424
|
}
|
|
2347
2425
|
update() {
|
|
2348
2426
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2349
|
-
F:
|
|
2427
|
+
F: __dxlog_file11,
|
|
2350
2428
|
L: 47,
|
|
2351
2429
|
S: this,
|
|
2352
2430
|
A: [
|
|
@@ -2363,13 +2441,13 @@ var InvitationTopology = class {
|
|
|
2363
2441
|
return;
|
|
2364
2442
|
}
|
|
2365
2443
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
2366
|
-
this._seenPeers = new
|
|
2444
|
+
this._seenPeers = new import_util6.ComplexSet(import_keys8.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
2367
2445
|
if (firstUnknownPeer != null) {
|
|
2368
|
-
(0,
|
|
2446
|
+
(0, import_log9.log)("invitation connect", {
|
|
2369
2447
|
ownPeerId,
|
|
2370
2448
|
remotePeerId: firstUnknownPeer
|
|
2371
2449
|
}, {
|
|
2372
|
-
F:
|
|
2450
|
+
F: __dxlog_file11,
|
|
2373
2451
|
L: 69,
|
|
2374
2452
|
S: this,
|
|
2375
2453
|
C: (f, a) => f(...a)
|
|
@@ -2380,7 +2458,7 @@ var InvitationTopology = class {
|
|
|
2380
2458
|
}
|
|
2381
2459
|
async onOffer(peer) {
|
|
2382
2460
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2383
|
-
F:
|
|
2461
|
+
F: __dxlog_file11,
|
|
2384
2462
|
L: 76,
|
|
2385
2463
|
S: this,
|
|
2386
2464
|
A: [
|
|
@@ -2397,7 +2475,7 @@ var InvitationTopology = class {
|
|
|
2397
2475
|
return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
|
|
2398
2476
|
}
|
|
2399
2477
|
};
|
|
2400
|
-
var
|
|
2478
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2401
2479
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2402
2480
|
var InvitationsHandler = class {
|
|
2403
2481
|
/**
|
|
@@ -2422,7 +2500,7 @@ var InvitationsHandler = class {
|
|
|
2422
2500
|
try {
|
|
2423
2501
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2424
2502
|
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
2425
|
-
F:
|
|
2503
|
+
F: __dxlog_file12,
|
|
2426
2504
|
L: 90,
|
|
2427
2505
|
S: this,
|
|
2428
2506
|
A: [
|
|
@@ -2445,21 +2523,21 @@ var InvitationsHandler = class {
|
|
|
2445
2523
|
guardedState.error(extension, new import_context5.ContextDisposedError());
|
|
2446
2524
|
}
|
|
2447
2525
|
});
|
|
2448
|
-
(0,
|
|
2526
|
+
(0, import_async9.scheduleTask)(connectionCtx, async () => {
|
|
2449
2527
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2450
2528
|
try {
|
|
2451
|
-
|
|
2529
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
2452
2530
|
id: traceId
|
|
2453
2531
|
}), {
|
|
2454
|
-
F:
|
|
2532
|
+
F: __dxlog_file12,
|
|
2455
2533
|
L: 115,
|
|
2456
2534
|
S: this,
|
|
2457
2535
|
C: (f, a) => f(...a)
|
|
2458
2536
|
});
|
|
2459
|
-
(0,
|
|
2537
|
+
(0, import_log6.log)("connected", {
|
|
2460
2538
|
...protocol.toJSON()
|
|
2461
2539
|
}, {
|
|
2462
|
-
F:
|
|
2540
|
+
F: __dxlog_file12,
|
|
2463
2541
|
L: 116,
|
|
2464
2542
|
S: this,
|
|
2465
2543
|
C: (f, a) => f(...a)
|
|
@@ -2467,20 +2545,20 @@ var InvitationsHandler = class {
|
|
|
2467
2545
|
const deviceKey = await extension.completedTrigger.wait({
|
|
2468
2546
|
timeout: invitation.timeout
|
|
2469
2547
|
});
|
|
2470
|
-
(0,
|
|
2548
|
+
(0, import_log6.log)("admitted guest", {
|
|
2471
2549
|
guest: deviceKey,
|
|
2472
2550
|
...protocol.toJSON()
|
|
2473
2551
|
}, {
|
|
2474
|
-
F:
|
|
2552
|
+
F: __dxlog_file12,
|
|
2475
2553
|
L: 118,
|
|
2476
2554
|
S: this,
|
|
2477
2555
|
C: (f, a) => f(...a)
|
|
2478
2556
|
});
|
|
2479
2557
|
guardedState.set(extension, import_services6.Invitation.State.SUCCESS);
|
|
2480
|
-
|
|
2558
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
|
|
2481
2559
|
id: traceId
|
|
2482
2560
|
}), {
|
|
2483
|
-
F:
|
|
2561
|
+
F: __dxlog_file12,
|
|
2484
2562
|
L: 120,
|
|
2485
2563
|
S: this,
|
|
2486
2564
|
C: (f, a) => f(...a)
|
|
@@ -2490,12 +2568,12 @@ var InvitationsHandler = class {
|
|
|
2490
2568
|
await ctx.dispose();
|
|
2491
2569
|
}
|
|
2492
2570
|
} catch (err) {
|
|
2493
|
-
if (err instanceof
|
|
2571
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2494
2572
|
if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
|
|
2495
|
-
(0,
|
|
2573
|
+
(0, import_log6.log)("timeout", {
|
|
2496
2574
|
...protocol.toJSON()
|
|
2497
2575
|
}, {
|
|
2498
|
-
F:
|
|
2576
|
+
F: __dxlog_file12,
|
|
2499
2577
|
L: 129,
|
|
2500
2578
|
S: this,
|
|
2501
2579
|
C: (f, a) => f(...a)
|
|
@@ -2503,19 +2581,19 @@ var InvitationsHandler = class {
|
|
|
2503
2581
|
}
|
|
2504
2582
|
} else {
|
|
2505
2583
|
if (guardedState.error(extension, err)) {
|
|
2506
|
-
|
|
2507
|
-
F:
|
|
2584
|
+
import_log6.log.error("failed", err, {
|
|
2585
|
+
F: __dxlog_file12,
|
|
2508
2586
|
L: 133,
|
|
2509
2587
|
S: this,
|
|
2510
2588
|
C: (f, a) => f(...a)
|
|
2511
2589
|
});
|
|
2512
2590
|
}
|
|
2513
2591
|
}
|
|
2514
|
-
|
|
2592
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.error({
|
|
2515
2593
|
id: traceId,
|
|
2516
2594
|
error: err
|
|
2517
2595
|
}), {
|
|
2518
|
-
F:
|
|
2596
|
+
F: __dxlog_file12,
|
|
2519
2597
|
L: 136,
|
|
2520
2598
|
S: this,
|
|
2521
2599
|
C: (f, a) => f(...a)
|
|
@@ -2526,22 +2604,22 @@ var InvitationsHandler = class {
|
|
|
2526
2604
|
},
|
|
2527
2605
|
onError: (err) => {
|
|
2528
2606
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
2529
|
-
(0,
|
|
2607
|
+
(0, import_log6.log)("invalid role", {
|
|
2530
2608
|
...err.context
|
|
2531
2609
|
}, {
|
|
2532
|
-
F:
|
|
2610
|
+
F: __dxlog_file12,
|
|
2533
2611
|
L: 144,
|
|
2534
2612
|
S: this,
|
|
2535
2613
|
C: (f, a) => f(...a)
|
|
2536
2614
|
});
|
|
2537
2615
|
return;
|
|
2538
2616
|
}
|
|
2539
|
-
if (err instanceof
|
|
2617
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2540
2618
|
if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
|
|
2541
|
-
(0,
|
|
2619
|
+
(0, import_log6.log)("timeout", {
|
|
2542
2620
|
err
|
|
2543
2621
|
}, {
|
|
2544
|
-
F:
|
|
2622
|
+
F: __dxlog_file12,
|
|
2545
2623
|
L: 149,
|
|
2546
2624
|
S: this,
|
|
2547
2625
|
C: (f, a) => f(...a)
|
|
@@ -2549,8 +2627,8 @@ var InvitationsHandler = class {
|
|
|
2549
2627
|
}
|
|
2550
2628
|
} else {
|
|
2551
2629
|
if (guardedState.error(extension, err)) {
|
|
2552
|
-
|
|
2553
|
-
F:
|
|
2630
|
+
import_log6.log.error("failed", err, {
|
|
2631
|
+
F: __dxlog_file12,
|
|
2554
2632
|
L: 153,
|
|
2555
2633
|
S: this,
|
|
2556
2634
|
C: (f, a) => f(...a)
|
|
@@ -2563,14 +2641,14 @@ var InvitationsHandler = class {
|
|
|
2563
2641
|
};
|
|
2564
2642
|
if (invitation.lifetime && invitation.created) {
|
|
2565
2643
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2566
|
-
|
|
2567
|
-
F:
|
|
2644
|
+
import_log6.log.warn("invitation has already expired", void 0, {
|
|
2645
|
+
F: __dxlog_file12,
|
|
2568
2646
|
L: 164,
|
|
2569
2647
|
S: this,
|
|
2570
2648
|
C: (f, a) => f(...a)
|
|
2571
2649
|
});
|
|
2572
2650
|
} else {
|
|
2573
|
-
(0,
|
|
2651
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2574
2652
|
await swarmConnection.close();
|
|
2575
2653
|
guardedState.set(null, import_services6.Invitation.State.EXPIRED);
|
|
2576
2654
|
await ctx.dispose();
|
|
@@ -2578,7 +2656,7 @@ var InvitationsHandler = class {
|
|
|
2578
2656
|
}
|
|
2579
2657
|
}
|
|
2580
2658
|
let swarmConnection;
|
|
2581
|
-
(0,
|
|
2659
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2582
2660
|
swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.Options.Role.HOST, createExtension);
|
|
2583
2661
|
guardedState.set(null, import_services6.Invitation.State.CONNECTING);
|
|
2584
2662
|
});
|
|
@@ -2587,7 +2665,7 @@ var InvitationsHandler = class {
|
|
|
2587
2665
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2588
2666
|
if (deviceProfile) {
|
|
2589
2667
|
(0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2590
|
-
F:
|
|
2668
|
+
F: __dxlog_file12,
|
|
2591
2669
|
L: 197,
|
|
2592
2670
|
S: this,
|
|
2593
2671
|
A: [
|
|
@@ -2596,16 +2674,16 @@ var InvitationsHandler = class {
|
|
|
2596
2674
|
]
|
|
2597
2675
|
});
|
|
2598
2676
|
}
|
|
2599
|
-
const triedPeersIds = new
|
|
2677
|
+
const triedPeersIds = new import_util5.ComplexSet(import_keys6.PublicKey.hash);
|
|
2600
2678
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
2601
2679
|
const shouldCancelInvitationFlow = (extension) => {
|
|
2602
2680
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
2603
|
-
(0,
|
|
2681
|
+
(0, import_log6.log)("should cancel invitation flow", {
|
|
2604
2682
|
isLockedByAnotherConnection,
|
|
2605
2683
|
invitationType: import_services6.Invitation.Type.DELEGATED,
|
|
2606
2684
|
triedPeers: triedPeersIds.size
|
|
2607
2685
|
}, {
|
|
2608
|
-
F:
|
|
2686
|
+
F: __dxlog_file12,
|
|
2609
2687
|
L: 205,
|
|
2610
2688
|
S: this,
|
|
2611
2689
|
C: (f, a) => f(...a)
|
|
@@ -2628,11 +2706,11 @@ var InvitationsHandler = class {
|
|
|
2628
2706
|
return;
|
|
2629
2707
|
}
|
|
2630
2708
|
connectionCtx.onDispose(async () => {
|
|
2631
|
-
(0,
|
|
2709
|
+
(0, import_log6.log)("extension disposed", {
|
|
2632
2710
|
admitted,
|
|
2633
2711
|
currentState: guardedState.current.state
|
|
2634
2712
|
}, {
|
|
2635
|
-
F:
|
|
2713
|
+
F: __dxlog_file12,
|
|
2636
2714
|
L: 233,
|
|
2637
2715
|
S: this,
|
|
2638
2716
|
C: (f, a) => f(...a)
|
|
@@ -2644,34 +2722,34 @@ var InvitationsHandler = class {
|
|
|
2644
2722
|
}
|
|
2645
2723
|
}
|
|
2646
2724
|
});
|
|
2647
|
-
(0,
|
|
2725
|
+
(0, import_async9.scheduleTask)(connectionCtx, async () => {
|
|
2648
2726
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2649
2727
|
try {
|
|
2650
|
-
|
|
2728
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
2651
2729
|
id: traceId
|
|
2652
2730
|
}), {
|
|
2653
|
-
F:
|
|
2731
|
+
F: __dxlog_file12,
|
|
2654
2732
|
L: 245,
|
|
2655
2733
|
S: this,
|
|
2656
2734
|
C: (f, a) => f(...a)
|
|
2657
2735
|
});
|
|
2658
|
-
(0,
|
|
2736
|
+
(0, import_async9.scheduleTask)(connectionCtx, () => {
|
|
2659
2737
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2660
2738
|
extensionCtx.close();
|
|
2661
2739
|
}, timeout);
|
|
2662
|
-
(0,
|
|
2740
|
+
(0, import_log6.log)("connected", {
|
|
2663
2741
|
...protocol.toJSON()
|
|
2664
2742
|
}, {
|
|
2665
|
-
F:
|
|
2743
|
+
F: __dxlog_file12,
|
|
2666
2744
|
L: 256,
|
|
2667
2745
|
S: this,
|
|
2668
2746
|
C: (f, a) => f(...a)
|
|
2669
2747
|
});
|
|
2670
2748
|
guardedState.set(extension, import_services6.Invitation.State.CONNECTED);
|
|
2671
|
-
(0,
|
|
2749
|
+
(0, import_log6.log)("introduce", {
|
|
2672
2750
|
...protocol.toJSON()
|
|
2673
2751
|
}, {
|
|
2674
|
-
F:
|
|
2752
|
+
F: __dxlog_file12,
|
|
2675
2753
|
L: 260,
|
|
2676
2754
|
S: this,
|
|
2677
2755
|
C: (f, a) => f(...a)
|
|
@@ -2680,11 +2758,11 @@ var InvitationsHandler = class {
|
|
|
2680
2758
|
invitationId: invitation.invitationId,
|
|
2681
2759
|
...protocol.createIntroduction()
|
|
2682
2760
|
});
|
|
2683
|
-
(0,
|
|
2761
|
+
(0, import_log6.log)("introduce response", {
|
|
2684
2762
|
...protocol.toJSON(),
|
|
2685
2763
|
response: introductionResponse
|
|
2686
2764
|
}, {
|
|
2687
|
-
F:
|
|
2765
|
+
F: __dxlog_file12,
|
|
2688
2766
|
L: 265,
|
|
2689
2767
|
S: this,
|
|
2690
2768
|
C: (f, a) => f(...a)
|
|
@@ -2702,10 +2780,10 @@ var InvitationsHandler = class {
|
|
|
2702
2780
|
break;
|
|
2703
2781
|
}
|
|
2704
2782
|
}
|
|
2705
|
-
(0,
|
|
2783
|
+
(0, import_log6.log)("request admission", {
|
|
2706
2784
|
...protocol.toJSON()
|
|
2707
2785
|
}, {
|
|
2708
|
-
F:
|
|
2786
|
+
F: __dxlog_file12,
|
|
2709
2787
|
L: 291,
|
|
2710
2788
|
S: this,
|
|
2711
2789
|
C: (f, a) => f(...a)
|
|
@@ -2714,10 +2792,10 @@ var InvitationsHandler = class {
|
|
|
2714
2792
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
2715
2793
|
admitted = true;
|
|
2716
2794
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
2717
|
-
(0,
|
|
2795
|
+
(0, import_log6.log)("admitted by host", {
|
|
2718
2796
|
...protocol.toJSON()
|
|
2719
2797
|
}, {
|
|
2720
|
-
F:
|
|
2798
|
+
F: __dxlog_file12,
|
|
2721
2799
|
L: 302,
|
|
2722
2800
|
S: this,
|
|
2723
2801
|
C: (f, a) => f(...a)
|
|
@@ -2727,28 +2805,28 @@ var InvitationsHandler = class {
|
|
|
2727
2805
|
...result,
|
|
2728
2806
|
state: import_services6.Invitation.State.SUCCESS
|
|
2729
2807
|
});
|
|
2730
|
-
|
|
2808
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
|
|
2731
2809
|
id: traceId
|
|
2732
2810
|
}), {
|
|
2733
|
-
F:
|
|
2811
|
+
F: __dxlog_file12,
|
|
2734
2812
|
L: 308,
|
|
2735
2813
|
S: this,
|
|
2736
2814
|
C: (f, a) => f(...a)
|
|
2737
2815
|
});
|
|
2738
2816
|
} catch (err) {
|
|
2739
|
-
if (err instanceof
|
|
2740
|
-
(0,
|
|
2817
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2818
|
+
(0, import_log6.log)("timeout", {
|
|
2741
2819
|
...protocol.toJSON()
|
|
2742
2820
|
}, {
|
|
2743
|
-
F:
|
|
2821
|
+
F: __dxlog_file12,
|
|
2744
2822
|
L: 311,
|
|
2745
2823
|
S: this,
|
|
2746
2824
|
C: (f, a) => f(...a)
|
|
2747
2825
|
});
|
|
2748
2826
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2749
2827
|
} else {
|
|
2750
|
-
(0,
|
|
2751
|
-
F:
|
|
2828
|
+
(0, import_log6.log)("auth failed", err, {
|
|
2829
|
+
F: __dxlog_file12,
|
|
2752
2830
|
L: 314,
|
|
2753
2831
|
S: this,
|
|
2754
2832
|
C: (f, a) => f(...a)
|
|
@@ -2756,11 +2834,11 @@ var InvitationsHandler = class {
|
|
|
2756
2834
|
guardedState.error(extension, err);
|
|
2757
2835
|
}
|
|
2758
2836
|
extensionCtx.close(err);
|
|
2759
|
-
|
|
2837
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.error({
|
|
2760
2838
|
id: traceId,
|
|
2761
2839
|
error: err
|
|
2762
2840
|
}), {
|
|
2763
|
-
F:
|
|
2841
|
+
F: __dxlog_file12,
|
|
2764
2842
|
L: 318,
|
|
2765
2843
|
S: this,
|
|
2766
2844
|
C: (f, a) => f(...a)
|
|
@@ -2772,19 +2850,19 @@ var InvitationsHandler = class {
|
|
|
2772
2850
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
2773
2851
|
return;
|
|
2774
2852
|
}
|
|
2775
|
-
if (err instanceof
|
|
2776
|
-
(0,
|
|
2853
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2854
|
+
(0, import_log6.log)("timeout", {
|
|
2777
2855
|
...protocol.toJSON()
|
|
2778
2856
|
}, {
|
|
2779
|
-
F:
|
|
2857
|
+
F: __dxlog_file12,
|
|
2780
2858
|
L: 327,
|
|
2781
2859
|
S: this,
|
|
2782
2860
|
C: (f, a) => f(...a)
|
|
2783
2861
|
});
|
|
2784
2862
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2785
2863
|
} else {
|
|
2786
|
-
(0,
|
|
2787
|
-
F:
|
|
2864
|
+
(0, import_log6.log)("auth failed", err, {
|
|
2865
|
+
F: __dxlog_file12,
|
|
2788
2866
|
L: 330,
|
|
2789
2867
|
S: this,
|
|
2790
2868
|
C: (f, a) => f(...a)
|
|
@@ -2795,14 +2873,14 @@ var InvitationsHandler = class {
|
|
|
2795
2873
|
});
|
|
2796
2874
|
return extension;
|
|
2797
2875
|
};
|
|
2798
|
-
(0,
|
|
2876
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2799
2877
|
const error = protocol.checkInvitation(invitation);
|
|
2800
2878
|
if (error) {
|
|
2801
2879
|
stream.error(error);
|
|
2802
2880
|
await ctx.dispose();
|
|
2803
2881
|
} else {
|
|
2804
2882
|
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2805
|
-
F:
|
|
2883
|
+
F: __dxlog_file12,
|
|
2806
2884
|
L: 345,
|
|
2807
2885
|
S: this,
|
|
2808
2886
|
A: [
|
|
@@ -2841,7 +2919,7 @@ var InvitationsHandler = class {
|
|
|
2841
2919
|
* invitation flow connections.
|
|
2842
2920
|
*/
|
|
2843
2921
|
_createGuardedState(ctx, invitation, stream) {
|
|
2844
|
-
const mutex = new
|
|
2922
|
+
const mutex = new import_async9.Mutex();
|
|
2845
2923
|
let lastActiveExtension = null;
|
|
2846
2924
|
let currentInvitation = {
|
|
2847
2925
|
...invitation
|
|
@@ -2896,20 +2974,33 @@ var InvitationsHandler = class {
|
|
|
2896
2974
|
};
|
|
2897
2975
|
}
|
|
2898
2976
|
_logStateUpdate(invitation, actor, newState) {
|
|
2899
|
-
(
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2977
|
+
if (this._isNotTerminal(newState)) {
|
|
2978
|
+
(0, import_log6.log)("invitation state update", {
|
|
2979
|
+
actor: actor?.constructor.name,
|
|
2980
|
+
newState: stateToString(newState),
|
|
2981
|
+
oldState: stateToString(invitation.state)
|
|
2982
|
+
}, {
|
|
2983
|
+
F: __dxlog_file12,
|
|
2984
|
+
L: 439,
|
|
2985
|
+
S: this,
|
|
2986
|
+
C: (f, a) => f(...a)
|
|
2987
|
+
});
|
|
2988
|
+
} else {
|
|
2989
|
+
import_log6.log.info("invitation state update", {
|
|
2990
|
+
actor: actor?.constructor.name,
|
|
2991
|
+
newState: stateToString(newState),
|
|
2992
|
+
oldState: stateToString(invitation.state)
|
|
2993
|
+
}, {
|
|
2994
|
+
F: __dxlog_file12,
|
|
2995
|
+
L: 445,
|
|
2996
|
+
S: this,
|
|
2997
|
+
C: (f, a) => f(...a)
|
|
2998
|
+
});
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
_isNotTerminal(currentState) {
|
|
3002
|
+
return ![
|
|
3003
|
+
import_services6.Invitation.State.SUCCESS,
|
|
2913
3004
|
import_services6.Invitation.State.ERROR,
|
|
2914
3005
|
import_services6.Invitation.State.CANCELLED,
|
|
2915
3006
|
import_services6.Invitation.State.TIMEOUT,
|
|
@@ -2918,17 +3009,17 @@ var InvitationsHandler = class {
|
|
|
2918
3009
|
}
|
|
2919
3010
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2920
3011
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2921
|
-
(0,
|
|
2922
|
-
F:
|
|
2923
|
-
L:
|
|
3012
|
+
(0, import_log6.log)("guest waiting for authentication code...", void 0, {
|
|
3013
|
+
F: __dxlog_file12,
|
|
3014
|
+
L: 470,
|
|
2924
3015
|
S: this,
|
|
2925
3016
|
C: (f, a) => f(...a)
|
|
2926
3017
|
});
|
|
2927
3018
|
setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2928
3019
|
const authCode = await authenticated.wait(options);
|
|
2929
|
-
(0,
|
|
2930
|
-
F:
|
|
2931
|
-
L:
|
|
3020
|
+
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3021
|
+
F: __dxlog_file12,
|
|
3022
|
+
L: 474,
|
|
2932
3023
|
S: this,
|
|
2933
3024
|
C: (f, a) => f(...a)
|
|
2934
3025
|
});
|
|
@@ -2943,11 +3034,11 @@ var InvitationsHandler = class {
|
|
|
2943
3034
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2944
3035
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2945
3036
|
} else {
|
|
2946
|
-
(0,
|
|
3037
|
+
(0, import_log6.log)("retrying invalid code", {
|
|
2947
3038
|
attempt
|
|
2948
3039
|
}, {
|
|
2949
|
-
F:
|
|
2950
|
-
L:
|
|
3040
|
+
F: __dxlog_file12,
|
|
3041
|
+
L: 485,
|
|
2951
3042
|
S: this,
|
|
2952
3043
|
C: (f, a) => f(...a)
|
|
2953
3044
|
});
|
|
@@ -2963,9 +3054,9 @@ var InvitationsHandler = class {
|
|
|
2963
3054
|
if (introductionResponse.challenge == null) {
|
|
2964
3055
|
throw new Error("challenge missing in the introduction");
|
|
2965
3056
|
}
|
|
2966
|
-
(0,
|
|
2967
|
-
F:
|
|
2968
|
-
L:
|
|
3057
|
+
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3058
|
+
F: __dxlog_file12,
|
|
3059
|
+
L: 504,
|
|
2969
3060
|
S: this,
|
|
2970
3061
|
C: (f, a) => f(...a)
|
|
2971
3062
|
});
|
|
@@ -3079,7 +3170,7 @@ var InvitationsServiceImpl = class {
|
|
|
3079
3170
|
});
|
|
3080
3171
|
}
|
|
3081
3172
|
};
|
|
3082
|
-
var
|
|
3173
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3083
3174
|
var SpaceInvitationProtocol = class {
|
|
3084
3175
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3085
3176
|
this._spaceManager = _spaceManager;
|
|
@@ -3113,79 +3204,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3113
3204
|
};
|
|
3114
3205
|
}
|
|
3115
3206
|
async admit(invitation, request, guestProfile) {
|
|
3116
|
-
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3117
|
-
F:
|
|
3118
|
-
L:
|
|
3119
|
-
S: this,
|
|
3120
|
-
A: [
|
|
3121
|
-
"this._spaceKey",
|
|
3122
|
-
""
|
|
3123
|
-
]
|
|
3124
|
-
});
|
|
3125
|
-
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3126
|
-
(0, import_invariant10.invariant)(space, void 0, {
|
|
3127
|
-
F: __dxlog_file12,
|
|
3128
|
-
L: 78,
|
|
3129
|
-
S: this,
|
|
3130
|
-
A: [
|
|
3131
|
-
"space",
|
|
3132
|
-
""
|
|
3133
|
-
]
|
|
3134
|
-
});
|
|
3135
|
-
(0, import_invariant10.invariant)(request.space, void 0, {
|
|
3136
|
-
F: __dxlog_file12,
|
|
3137
|
-
L: 80,
|
|
3207
|
+
(0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
|
|
3208
|
+
F: __dxlog_file13,
|
|
3209
|
+
L: 74,
|
|
3138
3210
|
S: this,
|
|
3139
3211
|
A: [
|
|
3140
|
-
"request.space",
|
|
3212
|
+
"this._spaceKey && request.space",
|
|
3141
3213
|
""
|
|
3142
3214
|
]
|
|
3143
3215
|
});
|
|
3144
|
-
|
|
3145
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
|
|
3146
|
-
throw new import_protocols8.AlreadyJoinedError();
|
|
3147
|
-
}
|
|
3148
|
-
(0, import_log9.log)("writing guest credentials", {
|
|
3216
|
+
(0, import_log10.log)("writing guest credentials", {
|
|
3149
3217
|
host: this._signingContext.deviceKey,
|
|
3150
|
-
guest: deviceKey
|
|
3218
|
+
guest: request.space.deviceKey
|
|
3151
3219
|
}, {
|
|
3152
|
-
F:
|
|
3153
|
-
L:
|
|
3220
|
+
F: __dxlog_file13,
|
|
3221
|
+
L: 75,
|
|
3154
3222
|
S: this,
|
|
3155
3223
|
C: (f, a) => f(...a)
|
|
3156
3224
|
});
|
|
3157
|
-
const
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
"credentials[0].credential",
|
|
3164
|
-
""
|
|
3165
|
-
]
|
|
3166
|
-
});
|
|
3167
|
-
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3168
|
-
(0, import_invariant10.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3169
|
-
F: __dxlog_file12,
|
|
3170
|
-
L: 103,
|
|
3171
|
-
S: this,
|
|
3172
|
-
A: [
|
|
3173
|
-
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3174
|
-
""
|
|
3175
|
-
]
|
|
3225
|
+
const spaceMemberCredential = await this._spaceManager.admitMember({
|
|
3226
|
+
spaceKey: this._spaceKey,
|
|
3227
|
+
identityKey: request.space.identityKey,
|
|
3228
|
+
role: invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN,
|
|
3229
|
+
profile: guestProfile,
|
|
3230
|
+
delegationCredentialId: invitation.delegationCredentialId
|
|
3176
3231
|
});
|
|
3177
|
-
|
|
3232
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3178
3233
|
return {
|
|
3179
3234
|
space: {
|
|
3180
3235
|
credential: spaceMemberCredential,
|
|
3181
|
-
controlTimeframe: space
|
|
3236
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3182
3237
|
}
|
|
3183
3238
|
};
|
|
3184
3239
|
}
|
|
3185
3240
|
async delegate(invitation) {
|
|
3186
3241
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3187
|
-
F:
|
|
3188
|
-
L:
|
|
3242
|
+
F: __dxlog_file13,
|
|
3243
|
+
L: 95,
|
|
3189
3244
|
S: this,
|
|
3190
3245
|
A: [
|
|
3191
3246
|
"this._spaceKey",
|
|
@@ -3194,8 +3249,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3194
3249
|
});
|
|
3195
3250
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3196
3251
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3197
|
-
F:
|
|
3198
|
-
L:
|
|
3252
|
+
F: __dxlog_file13,
|
|
3253
|
+
L: 97,
|
|
3199
3254
|
S: this,
|
|
3200
3255
|
A: [
|
|
3201
3256
|
"space",
|
|
@@ -3204,8 +3259,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3204
3259
|
});
|
|
3205
3260
|
if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3206
3261
|
(0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
3207
|
-
F:
|
|
3208
|
-
L:
|
|
3262
|
+
F: __dxlog_file13,
|
|
3263
|
+
L: 99,
|
|
3209
3264
|
S: this,
|
|
3210
3265
|
A: [
|
|
3211
3266
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3213,12 +3268,12 @@ var SpaceInvitationProtocol = class {
|
|
|
3213
3268
|
]
|
|
3214
3269
|
});
|
|
3215
3270
|
}
|
|
3216
|
-
(0,
|
|
3271
|
+
(0, import_log10.log)("writing delegate space invitation", {
|
|
3217
3272
|
host: this._signingContext.deviceKey,
|
|
3218
3273
|
id: invitation.invitationId
|
|
3219
3274
|
}, {
|
|
3220
|
-
F:
|
|
3221
|
-
L:
|
|
3275
|
+
F: __dxlog_file13,
|
|
3276
|
+
L: 102,
|
|
3222
3277
|
S: this,
|
|
3223
3278
|
C: (f, a) => f(...a)
|
|
3224
3279
|
});
|
|
@@ -3232,8 +3287,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3232
3287
|
guestKey: invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3233
3288
|
});
|
|
3234
3289
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3235
|
-
F:
|
|
3236
|
-
L:
|
|
3290
|
+
F: __dxlog_file13,
|
|
3291
|
+
L: 122,
|
|
3237
3292
|
S: this,
|
|
3238
3293
|
A: [
|
|
3239
3294
|
"credential.credential",
|
|
@@ -3247,8 +3302,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3247
3302
|
}
|
|
3248
3303
|
async cancelDelegation(invitation) {
|
|
3249
3304
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3250
|
-
F:
|
|
3251
|
-
L:
|
|
3305
|
+
F: __dxlog_file13,
|
|
3306
|
+
L: 128,
|
|
3252
3307
|
S: this,
|
|
3253
3308
|
A: [
|
|
3254
3309
|
"this._spaceKey",
|
|
@@ -3256,8 +3311,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3256
3311
|
]
|
|
3257
3312
|
});
|
|
3258
3313
|
(0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3259
|
-
F:
|
|
3260
|
-
L:
|
|
3314
|
+
F: __dxlog_file13,
|
|
3315
|
+
L: 129,
|
|
3261
3316
|
S: this,
|
|
3262
3317
|
A: [
|
|
3263
3318
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3266,27 +3321,27 @@ var SpaceInvitationProtocol = class {
|
|
|
3266
3321
|
});
|
|
3267
3322
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3268
3323
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3269
|
-
F:
|
|
3270
|
-
L:
|
|
3324
|
+
F: __dxlog_file13,
|
|
3325
|
+
L: 131,
|
|
3271
3326
|
S: this,
|
|
3272
3327
|
A: [
|
|
3273
3328
|
"space",
|
|
3274
3329
|
""
|
|
3275
3330
|
]
|
|
3276
3331
|
});
|
|
3277
|
-
(0,
|
|
3332
|
+
(0, import_log10.log)("cancelling delegated space invitation", {
|
|
3278
3333
|
host: this._signingContext.deviceKey,
|
|
3279
3334
|
id: invitation.invitationId
|
|
3280
3335
|
}, {
|
|
3281
|
-
F:
|
|
3282
|
-
L:
|
|
3336
|
+
F: __dxlog_file13,
|
|
3337
|
+
L: 133,
|
|
3283
3338
|
S: this,
|
|
3284
3339
|
C: (f, a) => f(...a)
|
|
3285
3340
|
});
|
|
3286
3341
|
const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3287
3342
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3288
|
-
F:
|
|
3289
|
-
L:
|
|
3343
|
+
F: __dxlog_file13,
|
|
3344
|
+
L: 140,
|
|
3290
3345
|
S: this,
|
|
3291
3346
|
A: [
|
|
3292
3347
|
"credential.credential",
|
|
@@ -3324,8 +3379,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3324
3379
|
}
|
|
3325
3380
|
async accept(response) {
|
|
3326
3381
|
(0, import_invariant10.invariant)(response.space, void 0, {
|
|
3327
|
-
F:
|
|
3328
|
-
L:
|
|
3382
|
+
F: __dxlog_file13,
|
|
3383
|
+
L: 175,
|
|
3329
3384
|
S: this,
|
|
3330
3385
|
A: [
|
|
3331
3386
|
"response.space",
|
|
@@ -3335,8 +3390,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3335
3390
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3336
3391
|
const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
|
|
3337
3392
|
(0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3338
|
-
F:
|
|
3339
|
-
L:
|
|
3393
|
+
F: __dxlog_file13,
|
|
3394
|
+
L: 178,
|
|
3340
3395
|
S: this,
|
|
3341
3396
|
A: [
|
|
3342
3397
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3344,8 +3399,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3344
3399
|
]
|
|
3345
3400
|
});
|
|
3346
3401
|
(0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3347
|
-
F:
|
|
3348
|
-
L:
|
|
3402
|
+
F: __dxlog_file13,
|
|
3403
|
+
L: 179,
|
|
3349
3404
|
S: this,
|
|
3350
3405
|
A: [
|
|
3351
3406
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3367,7 +3422,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3367
3422
|
};
|
|
3368
3423
|
}
|
|
3369
3424
|
};
|
|
3370
|
-
var
|
|
3425
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3371
3426
|
var InvitationsManager = class {
|
|
3372
3427
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3373
3428
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3375,12 +3430,12 @@ var InvitationsManager = class {
|
|
|
3375
3430
|
this._metadataStore = _metadataStore;
|
|
3376
3431
|
this._createInvitations = /* @__PURE__ */ new Map();
|
|
3377
3432
|
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
3378
|
-
this.invitationCreated = new
|
|
3379
|
-
this.invitationAccepted = new
|
|
3380
|
-
this.removedCreated = new
|
|
3381
|
-
this.removedAccepted = new
|
|
3382
|
-
this.saved = new
|
|
3383
|
-
this._persistentInvitationsLoadedEvent = new
|
|
3433
|
+
this.invitationCreated = new import_async12.Event();
|
|
3434
|
+
this.invitationAccepted = new import_async12.Event();
|
|
3435
|
+
this.removedCreated = new import_async12.Event();
|
|
3436
|
+
this.removedAccepted = new import_async12.Event();
|
|
3437
|
+
this.saved = new import_async12.Event();
|
|
3438
|
+
this._persistentInvitationsLoadedEvent = new import_async12.Event();
|
|
3384
3439
|
this._persistentInvitationsLoaded = false;
|
|
3385
3440
|
}
|
|
3386
3441
|
async createInvitation(options) {
|
|
@@ -3409,8 +3464,8 @@ var InvitationsManager = class {
|
|
|
3409
3464
|
try {
|
|
3410
3465
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3411
3466
|
} catch (err) {
|
|
3412
|
-
|
|
3413
|
-
F:
|
|
3467
|
+
import_log11.log.catch(err, void 0, {
|
|
3468
|
+
F: __dxlog_file14,
|
|
3414
3469
|
L: 82,
|
|
3415
3470
|
S: this,
|
|
3416
3471
|
C: (f, a) => f(...a)
|
|
@@ -3433,7 +3488,7 @@ var InvitationsManager = class {
|
|
|
3433
3488
|
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
3434
3489
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3435
3490
|
(0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3436
|
-
F:
|
|
3491
|
+
F: __dxlog_file14,
|
|
3437
3492
|
L: 103,
|
|
3438
3493
|
S: this,
|
|
3439
3494
|
A: [
|
|
@@ -3451,8 +3506,8 @@ var InvitationsManager = class {
|
|
|
3451
3506
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
3452
3507
|
};
|
|
3453
3508
|
} catch (err) {
|
|
3454
|
-
|
|
3455
|
-
F:
|
|
3509
|
+
import_log11.log.catch(err, void 0, {
|
|
3510
|
+
F: __dxlog_file14,
|
|
3456
3511
|
L: 110,
|
|
3457
3512
|
S: this,
|
|
3458
3513
|
C: (f, a) => f(...a)
|
|
@@ -3483,14 +3538,14 @@ var InvitationsManager = class {
|
|
|
3483
3538
|
return invitation;
|
|
3484
3539
|
}
|
|
3485
3540
|
async authenticate({ invitationId, authCode }) {
|
|
3486
|
-
(0,
|
|
3487
|
-
F:
|
|
3541
|
+
(0, import_log11.log)("authenticating...", void 0, {
|
|
3542
|
+
F: __dxlog_file14,
|
|
3488
3543
|
L: 140,
|
|
3489
3544
|
S: this,
|
|
3490
3545
|
C: (f, a) => f(...a)
|
|
3491
3546
|
});
|
|
3492
3547
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3493
|
-
F:
|
|
3548
|
+
F: __dxlog_file14,
|
|
3494
3549
|
L: 141,
|
|
3495
3550
|
S: this,
|
|
3496
3551
|
A: [
|
|
@@ -3500,10 +3555,10 @@ var InvitationsManager = class {
|
|
|
3500
3555
|
});
|
|
3501
3556
|
const observable = this._acceptInvitations.get(invitationId);
|
|
3502
3557
|
if (!observable) {
|
|
3503
|
-
|
|
3558
|
+
import_log11.log.warn("invalid invitation", {
|
|
3504
3559
|
invitationId
|
|
3505
3560
|
}, {
|
|
3506
|
-
F:
|
|
3561
|
+
F: __dxlog_file14,
|
|
3507
3562
|
L: 144,
|
|
3508
3563
|
S: this,
|
|
3509
3564
|
C: (f, a) => f(...a)
|
|
@@ -3513,16 +3568,16 @@ var InvitationsManager = class {
|
|
|
3513
3568
|
}
|
|
3514
3569
|
}
|
|
3515
3570
|
async cancelInvitation({ invitationId }) {
|
|
3516
|
-
(0,
|
|
3571
|
+
(0, import_log11.log)("cancelInvitation...", {
|
|
3517
3572
|
invitationId
|
|
3518
3573
|
}, {
|
|
3519
|
-
F:
|
|
3574
|
+
F: __dxlog_file14,
|
|
3520
3575
|
L: 151,
|
|
3521
3576
|
S: this,
|
|
3522
3577
|
C: (f, a) => f(...a)
|
|
3523
3578
|
});
|
|
3524
3579
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3525
|
-
F:
|
|
3580
|
+
F: __dxlog_file14,
|
|
3526
3581
|
L: 152,
|
|
3527
3582
|
S: this,
|
|
3528
3583
|
A: [
|
|
@@ -3590,18 +3645,21 @@ var InvitationsManager = class {
|
|
|
3590
3645
|
};
|
|
3591
3646
|
}
|
|
3592
3647
|
_createObservableInvitation(handler, invitation) {
|
|
3593
|
-
const stream = new
|
|
3648
|
+
const stream = new import_async12.PushStream();
|
|
3594
3649
|
const ctx = new import_context9.Context({
|
|
3595
3650
|
onError: (err) => {
|
|
3596
3651
|
stream.error(err);
|
|
3597
3652
|
void ctx.dispose();
|
|
3598
3653
|
}
|
|
3654
|
+
}, {
|
|
3655
|
+
F: __dxlog_file14,
|
|
3656
|
+
L: 234
|
|
3599
3657
|
});
|
|
3600
3658
|
ctx.onDispose(() => {
|
|
3601
|
-
(0,
|
|
3659
|
+
(0, import_log11.log)("complete", {
|
|
3602
3660
|
...handler.toJSON()
|
|
3603
3661
|
}, {
|
|
3604
|
-
F:
|
|
3662
|
+
F: __dxlog_file14,
|
|
3605
3663
|
L: 241,
|
|
3606
3664
|
S: this,
|
|
3607
3665
|
C: (f, a) => f(...a)
|
|
@@ -3626,15 +3684,15 @@ var InvitationsManager = class {
|
|
|
3626
3684
|
};
|
|
3627
3685
|
}
|
|
3628
3686
|
_createObservableAcceptingInvitation(handler, initialState) {
|
|
3629
|
-
const otpEnteredTrigger = new
|
|
3630
|
-
const stream = new
|
|
3687
|
+
const otpEnteredTrigger = new import_async12.Trigger();
|
|
3688
|
+
const stream = new import_async12.PushStream();
|
|
3631
3689
|
const ctx = new import_context9.Context({
|
|
3632
3690
|
onError: (err) => {
|
|
3633
|
-
if (err instanceof
|
|
3634
|
-
(0,
|
|
3691
|
+
if (err instanceof import_async12.TimeoutError) {
|
|
3692
|
+
(0, import_log11.log)("timeout", {
|
|
3635
3693
|
...handler.toJSON()
|
|
3636
3694
|
}, {
|
|
3637
|
-
F:
|
|
3695
|
+
F: __dxlog_file14,
|
|
3638
3696
|
L: 261,
|
|
3639
3697
|
S: this,
|
|
3640
3698
|
C: (f, a) => f(...a)
|
|
@@ -3644,8 +3702,8 @@ var InvitationsManager = class {
|
|
|
3644
3702
|
state: import_services11.Invitation.State.TIMEOUT
|
|
3645
3703
|
});
|
|
3646
3704
|
} else {
|
|
3647
|
-
|
|
3648
|
-
F:
|
|
3705
|
+
import_log11.log.warn("auth failed", err, {
|
|
3706
|
+
F: __dxlog_file14,
|
|
3649
3707
|
L: 264,
|
|
3650
3708
|
S: this,
|
|
3651
3709
|
C: (f, a) => f(...a)
|
|
@@ -3657,12 +3715,15 @@ var InvitationsManager = class {
|
|
|
3657
3715
|
}
|
|
3658
3716
|
void ctx.dispose();
|
|
3659
3717
|
}
|
|
3718
|
+
}, {
|
|
3719
|
+
F: __dxlog_file14,
|
|
3720
|
+
L: 258
|
|
3660
3721
|
});
|
|
3661
3722
|
ctx.onDispose(() => {
|
|
3662
|
-
(0,
|
|
3723
|
+
(0, import_log11.log)("complete", {
|
|
3663
3724
|
...handler.toJSON()
|
|
3664
3725
|
}, {
|
|
3665
|
-
F:
|
|
3726
|
+
F: __dxlog_file14,
|
|
3666
3727
|
L: 271,
|
|
3667
3728
|
S: this,
|
|
3668
3729
|
C: (f, a) => f(...a)
|
|
@@ -3706,8 +3767,8 @@ var InvitationsManager = class {
|
|
|
3706
3767
|
try {
|
|
3707
3768
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3708
3769
|
} catch (err) {
|
|
3709
|
-
|
|
3710
|
-
F:
|
|
3770
|
+
import_log11.log.catch(err, void 0, {
|
|
3771
|
+
F: __dxlog_file14,
|
|
3711
3772
|
L: 307,
|
|
3712
3773
|
S: this,
|
|
3713
3774
|
C: (f, a) => f(...a)
|
|
@@ -3720,12 +3781,18 @@ var InvitationsManager = class {
|
|
|
3720
3781
|
}, callback);
|
|
3721
3782
|
}
|
|
3722
3783
|
};
|
|
3723
|
-
var AutomergeSpaceState = class {
|
|
3784
|
+
var AutomergeSpaceState = class extends import_context11.Resource {
|
|
3724
3785
|
constructor(_onNewRoot) {
|
|
3786
|
+
super();
|
|
3725
3787
|
this._onNewRoot = _onNewRoot;
|
|
3726
3788
|
this.rootUrl = void 0;
|
|
3727
3789
|
this.lastEpoch = void 0;
|
|
3728
|
-
this.onNewEpoch = new
|
|
3790
|
+
this.onNewEpoch = new import_async14.Event();
|
|
3791
|
+
this._isProcessingRootDocs = false;
|
|
3792
|
+
}
|
|
3793
|
+
async _open(ctx) {
|
|
3794
|
+
}
|
|
3795
|
+
async _close(ctx) {
|
|
3729
3796
|
this._isProcessingRootDocs = false;
|
|
3730
3797
|
}
|
|
3731
3798
|
async processCredential(credential) {
|
|
@@ -3754,18 +3821,186 @@ var AutomergeSpaceState = class {
|
|
|
3754
3821
|
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3755
3822
|
}
|
|
3756
3823
|
};
|
|
3757
|
-
var
|
|
3824
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
3825
|
+
var LOAD_DOC_TIMEOUT = 1e4;
|
|
3826
|
+
var runEpochMigration = async (ctx, context) => {
|
|
3827
|
+
switch (context.migration) {
|
|
3828
|
+
case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3829
|
+
const document = context.echoHost.createDoc();
|
|
3830
|
+
await context.echoHost.flush();
|
|
3831
|
+
return {
|
|
3832
|
+
newRoot: document.url
|
|
3833
|
+
};
|
|
3834
|
+
}
|
|
3835
|
+
case import_services13.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY: {
|
|
3836
|
+
if (!context.currentRoot) {
|
|
3837
|
+
throw new Error("Space does not have an automerge root");
|
|
3838
|
+
}
|
|
3839
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
|
|
3840
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3841
|
+
});
|
|
3842
|
+
const newRoot = context.echoHost.createDoc(rootHandle.docSync());
|
|
3843
|
+
await context.echoHost.flush();
|
|
3844
|
+
return {
|
|
3845
|
+
newRoot: newRoot.url
|
|
3846
|
+
};
|
|
3847
|
+
}
|
|
3848
|
+
case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3849
|
+
import_log13.log.info("Fragmenting", void 0, {
|
|
3850
|
+
F: __dxlog_file15,
|
|
3851
|
+
L: 64,
|
|
3852
|
+
S: void 0,
|
|
3853
|
+
C: (f, a) => f(...a)
|
|
3854
|
+
});
|
|
3855
|
+
const currentRootUrl = context.currentRoot;
|
|
3856
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3857
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3858
|
+
});
|
|
3859
|
+
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3860
|
+
const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
|
|
3861
|
+
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3862
|
+
(0, import_invariant13.invariant)(properties, "Properties not found", {
|
|
3863
|
+
F: __dxlog_file15,
|
|
3864
|
+
L: 75,
|
|
3865
|
+
S: void 0,
|
|
3866
|
+
A: [
|
|
3867
|
+
"properties",
|
|
3868
|
+
"'Properties not found'"
|
|
3869
|
+
]
|
|
3870
|
+
});
|
|
3871
|
+
const newRoot = context.echoHost.createDoc({
|
|
3872
|
+
...rootHandle.docSync(),
|
|
3873
|
+
objects: Object.fromEntries([
|
|
3874
|
+
properties
|
|
3875
|
+
])
|
|
3876
|
+
});
|
|
3877
|
+
(0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3878
|
+
F: __dxlog_file15,
|
|
3879
|
+
L: 82,
|
|
3880
|
+
S: void 0,
|
|
3881
|
+
A: [
|
|
3882
|
+
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3883
|
+
""
|
|
3884
|
+
]
|
|
3885
|
+
});
|
|
3886
|
+
const newLinks = [];
|
|
3887
|
+
for (const [id, objData] of otherObjects) {
|
|
3888
|
+
const handle = context.echoHost.createDoc({
|
|
3889
|
+
version: import_echo_protocol2.SpaceDocVersion.CURRENT,
|
|
3890
|
+
access: {
|
|
3891
|
+
spaceKey: context.spaceKey.toHex()
|
|
3892
|
+
},
|
|
3893
|
+
objects: {
|
|
3894
|
+
[id]: objData
|
|
3895
|
+
}
|
|
3896
|
+
});
|
|
3897
|
+
newLinks.push([
|
|
3898
|
+
id,
|
|
3899
|
+
handle.url
|
|
3900
|
+
]);
|
|
3901
|
+
}
|
|
3902
|
+
newRoot.change((doc) => {
|
|
3903
|
+
doc.links ??= {};
|
|
3904
|
+
for (const [id, url] of newLinks) {
|
|
3905
|
+
doc.links[id] = url;
|
|
3906
|
+
}
|
|
3907
|
+
});
|
|
3908
|
+
await context.echoHost.flush();
|
|
3909
|
+
return {
|
|
3910
|
+
newRoot: newRoot.url
|
|
3911
|
+
};
|
|
3912
|
+
}
|
|
3913
|
+
case import_services13.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
3914
|
+
const currentRootUrl = context.currentRoot;
|
|
3915
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3916
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3917
|
+
});
|
|
3918
|
+
(0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
|
|
3919
|
+
F: __dxlog_file15,
|
|
3920
|
+
L: 115,
|
|
3921
|
+
S: void 0,
|
|
3922
|
+
A: [
|
|
3923
|
+
"rootHandle.docSync()",
|
|
3924
|
+
"'Root doc not found'"
|
|
3925
|
+
]
|
|
3926
|
+
});
|
|
3927
|
+
const newRootContent = await (0, import_echo_db.convertLegacySpaceRootDoc)(structuredClone(rootHandle.docSync()));
|
|
3928
|
+
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
3929
|
+
try {
|
|
3930
|
+
const handle = await context.echoHost.loadDoc(ctx, url, {
|
|
3931
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3932
|
+
});
|
|
3933
|
+
(0, import_invariant13.invariant)(handle.docSync(), void 0, {
|
|
3934
|
+
F: __dxlog_file15,
|
|
3935
|
+
L: 122,
|
|
3936
|
+
S: void 0,
|
|
3937
|
+
A: [
|
|
3938
|
+
"handle.docSync()",
|
|
3939
|
+
""
|
|
3940
|
+
]
|
|
3941
|
+
});
|
|
3942
|
+
const newDoc = await (0, import_echo_db.convertLegacyReferences)(structuredClone(handle.docSync()));
|
|
3943
|
+
const migratedDoc = (0, import_echo_db.migrateDocument)(handle.docSync(), newDoc);
|
|
3944
|
+
const newHandle = context.echoHost.createDoc(migratedDoc, {
|
|
3945
|
+
preserveHistory: true
|
|
3946
|
+
});
|
|
3947
|
+
newRootContent.links[id] = newHandle.url;
|
|
3948
|
+
} catch (err) {
|
|
3949
|
+
import_log13.log.warn("Failed to migrate reference", {
|
|
3950
|
+
id,
|
|
3951
|
+
url,
|
|
3952
|
+
error: err
|
|
3953
|
+
}, {
|
|
3954
|
+
F: __dxlog_file15,
|
|
3955
|
+
L: 128,
|
|
3956
|
+
S: void 0,
|
|
3957
|
+
C: (f, a) => f(...a)
|
|
3958
|
+
});
|
|
3959
|
+
delete newRootContent.links[id];
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
const migratedRoot = (0, import_echo_db.migrateDocument)(rootHandle.docSync(), newRootContent);
|
|
3963
|
+
const newRoot = context.echoHost.createDoc(migratedRoot, {
|
|
3964
|
+
preserveHistory: true
|
|
3965
|
+
});
|
|
3966
|
+
await context.echoHost.flush();
|
|
3967
|
+
return {
|
|
3968
|
+
newRoot: newRoot.url
|
|
3969
|
+
};
|
|
3970
|
+
}
|
|
3971
|
+
case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3972
|
+
(0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
|
|
3973
|
+
F: __dxlog_file15,
|
|
3974
|
+
L: 143,
|
|
3975
|
+
S: void 0,
|
|
3976
|
+
A: [
|
|
3977
|
+
"context.newAutomergeRoot",
|
|
3978
|
+
""
|
|
3979
|
+
]
|
|
3980
|
+
});
|
|
3981
|
+
await context.echoHost.flush();
|
|
3982
|
+
return {
|
|
3983
|
+
newRoot: context.newAutomergeRoot
|
|
3984
|
+
};
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
return {};
|
|
3988
|
+
};
|
|
3989
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3758
3990
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3759
3991
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3760
3992
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3761
3993
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3762
3994
|
var NotarizationPlugin = class {
|
|
3763
3995
|
constructor() {
|
|
3764
|
-
this._ctx = new
|
|
3765
|
-
|
|
3996
|
+
this._ctx = new import_context12.Context(void 0, {
|
|
3997
|
+
F: __dxlog_file16,
|
|
3998
|
+
L: 62
|
|
3999
|
+
});
|
|
4000
|
+
this._extensionOpened = new import_async15.Event();
|
|
3766
4001
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3767
|
-
this._processedCredentials = new
|
|
3768
|
-
this._processCredentialsTriggers = new
|
|
4002
|
+
this._processedCredentials = new import_util8.ComplexSet(import_keys11.PublicKey.hash);
|
|
4003
|
+
this._processCredentialsTriggers = new import_util8.ComplexMap(import_keys11.PublicKey.hash);
|
|
3769
4004
|
}
|
|
3770
4005
|
get hasWriter() {
|
|
3771
4006
|
return !!this._writer;
|
|
@@ -3779,16 +4014,16 @@ var NotarizationPlugin = class {
|
|
|
3779
4014
|
* Request credentials to be notarized.
|
|
3780
4015
|
*/
|
|
3781
4016
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
3782
|
-
(0,
|
|
4017
|
+
(0, import_log14.log)("notarize", {
|
|
3783
4018
|
credentials
|
|
3784
4019
|
}, {
|
|
3785
|
-
F:
|
|
4020
|
+
F: __dxlog_file16,
|
|
3786
4021
|
L: 90,
|
|
3787
4022
|
S: this,
|
|
3788
4023
|
C: (f, a) => f(...a)
|
|
3789
4024
|
});
|
|
3790
|
-
(0,
|
|
3791
|
-
F:
|
|
4025
|
+
(0, import_invariant14.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
4026
|
+
F: __dxlog_file16,
|
|
3792
4027
|
L: 91,
|
|
3793
4028
|
S: this,
|
|
3794
4029
|
A: [
|
|
@@ -3796,13 +4031,13 @@ var NotarizationPlugin = class {
|
|
|
3796
4031
|
"'Credentials must have an id'"
|
|
3797
4032
|
]
|
|
3798
4033
|
});
|
|
3799
|
-
const errors = new
|
|
4034
|
+
const errors = new import_async15.Trigger();
|
|
3800
4035
|
const ctx = this._ctx.derive({
|
|
3801
4036
|
onError: (err) => {
|
|
3802
|
-
|
|
4037
|
+
import_log14.log.warn("Notarization error", {
|
|
3803
4038
|
err
|
|
3804
4039
|
}, {
|
|
3805
|
-
F:
|
|
4040
|
+
F: __dxlog_file16,
|
|
3806
4041
|
L: 99,
|
|
3807
4042
|
S: this,
|
|
3808
4043
|
C: (f, a) => f(...a)
|
|
@@ -3813,23 +4048,23 @@ var NotarizationPlugin = class {
|
|
|
3813
4048
|
});
|
|
3814
4049
|
opCtx?.onDispose(() => ctx.dispose());
|
|
3815
4050
|
if (timeout !== 0) {
|
|
3816
|
-
(0,
|
|
3817
|
-
|
|
4051
|
+
(0, import_async15.scheduleTask)(ctx, () => {
|
|
4052
|
+
import_log14.log.warn("Notarization timeout", {
|
|
3818
4053
|
timeout,
|
|
3819
4054
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3820
4055
|
}, {
|
|
3821
|
-
F:
|
|
4056
|
+
F: __dxlog_file16,
|
|
3822
4057
|
L: 111,
|
|
3823
4058
|
S: this,
|
|
3824
4059
|
C: (f, a) => f(...a)
|
|
3825
4060
|
});
|
|
3826
4061
|
void ctx.dispose();
|
|
3827
|
-
errors.throw(new
|
|
4062
|
+
errors.throw(new import_async15.TimeoutError(timeout, "Notarization timed out"));
|
|
3828
4063
|
}, timeout);
|
|
3829
4064
|
}
|
|
3830
4065
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
3831
4066
|
const peersTried = /* @__PURE__ */ new Set();
|
|
3832
|
-
const notarizeTask = new
|
|
4067
|
+
const notarizeTask = new import_async15.DeferredTask(ctx, async () => {
|
|
3833
4068
|
try {
|
|
3834
4069
|
if (this._extensions.size === 0) {
|
|
3835
4070
|
return;
|
|
@@ -3838,24 +4073,24 @@ var NotarizationPlugin = class {
|
|
|
3838
4073
|
...this._extensions
|
|
3839
4074
|
].find((peer2) => !peersTried.has(peer2));
|
|
3840
4075
|
if (!peer) {
|
|
3841
|
-
|
|
4076
|
+
import_log14.log.info("Exhausted all peers to notarize with", {
|
|
3842
4077
|
retryIn: retryTimeout
|
|
3843
4078
|
}, {
|
|
3844
|
-
F:
|
|
4079
|
+
F: __dxlog_file16,
|
|
3845
4080
|
L: 136,
|
|
3846
4081
|
S: this,
|
|
3847
4082
|
C: (f, a) => f(...a)
|
|
3848
4083
|
});
|
|
3849
4084
|
peersTried.clear();
|
|
3850
|
-
(0,
|
|
4085
|
+
(0, import_async15.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
3851
4086
|
return;
|
|
3852
4087
|
}
|
|
3853
4088
|
peersTried.add(peer);
|
|
3854
|
-
(0,
|
|
4089
|
+
(0, import_log14.log)("try notarizing", {
|
|
3855
4090
|
peer: peer.localPeerId,
|
|
3856
4091
|
credentialId: credentials.map((credential) => credential.id)
|
|
3857
4092
|
}, {
|
|
3858
|
-
F:
|
|
4093
|
+
F: __dxlog_file16,
|
|
3859
4094
|
L: 143,
|
|
3860
4095
|
S: this,
|
|
3861
4096
|
C: (f, a) => f(...a)
|
|
@@ -3863,17 +4098,17 @@ var NotarizationPlugin = class {
|
|
|
3863
4098
|
await peer.rpc.NotarizationService.notarize({
|
|
3864
4099
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
3865
4100
|
});
|
|
3866
|
-
(0,
|
|
3867
|
-
F:
|
|
4101
|
+
(0, import_log14.log)("success", void 0, {
|
|
4102
|
+
F: __dxlog_file16,
|
|
3868
4103
|
L: 147,
|
|
3869
4104
|
S: this,
|
|
3870
4105
|
C: (f, a) => f(...a)
|
|
3871
4106
|
});
|
|
3872
|
-
await (0,
|
|
4107
|
+
await (0, import_async15.sleep)(successDelay);
|
|
3873
4108
|
} catch (err) {
|
|
3874
4109
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
3875
|
-
|
|
3876
|
-
F:
|
|
4110
|
+
import_log14.log.info("error notarizing (recoverable)", err, {
|
|
4111
|
+
F: __dxlog_file16,
|
|
3877
4112
|
L: 151,
|
|
3878
4113
|
S: this,
|
|
3879
4114
|
C: (f, a) => f(...a)
|
|
@@ -3886,12 +4121,12 @@ var NotarizationPlugin = class {
|
|
|
3886
4121
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
3887
4122
|
try {
|
|
3888
4123
|
await Promise.race([
|
|
3889
|
-
(0,
|
|
4124
|
+
(0, import_context12.rejectOnDispose)(ctx),
|
|
3890
4125
|
allNotarized,
|
|
3891
4126
|
errors.wait()
|
|
3892
4127
|
]);
|
|
3893
|
-
(0,
|
|
3894
|
-
F:
|
|
4128
|
+
(0, import_log14.log)("done", void 0, {
|
|
4129
|
+
F: __dxlog_file16,
|
|
3895
4130
|
L: 162,
|
|
3896
4131
|
S: this,
|
|
3897
4132
|
C: (f, a) => f(...a)
|
|
@@ -3912,8 +4147,8 @@ var NotarizationPlugin = class {
|
|
|
3912
4147
|
this._processCredentialsTriggers.delete(credential.id);
|
|
3913
4148
|
}
|
|
3914
4149
|
setWriter(writer) {
|
|
3915
|
-
(0,
|
|
3916
|
-
F:
|
|
4150
|
+
(0, import_invariant14.invariant)(!this._writer, "Writer already set.", {
|
|
4151
|
+
F: __dxlog_file16,
|
|
3917
4152
|
L: 181,
|
|
3918
4153
|
S: this,
|
|
3919
4154
|
A: [
|
|
@@ -3927,7 +4162,7 @@ var NotarizationPlugin = class {
|
|
|
3927
4162
|
if (this._processedCredentials.has(id)) {
|
|
3928
4163
|
return;
|
|
3929
4164
|
}
|
|
3930
|
-
await (0,
|
|
4165
|
+
await (0, import_util8.entry)(this._processCredentialsTriggers, id).orInsert(new import_async15.Trigger()).value.wait();
|
|
3931
4166
|
}
|
|
3932
4167
|
/**
|
|
3933
4168
|
* Requests from other peers to notarize credentials.
|
|
@@ -3937,8 +4172,8 @@ var NotarizationPlugin = class {
|
|
|
3937
4172
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
3938
4173
|
}
|
|
3939
4174
|
for (const credential of request.credentials ?? []) {
|
|
3940
|
-
(0,
|
|
3941
|
-
F:
|
|
4175
|
+
(0, import_invariant14.invariant)(credential.id, "Credential must have an id", {
|
|
4176
|
+
F: __dxlog_file16,
|
|
3942
4177
|
L: 200,
|
|
3943
4178
|
S: this,
|
|
3944
4179
|
A: [
|
|
@@ -3955,10 +4190,10 @@ var NotarizationPlugin = class {
|
|
|
3955
4190
|
createExtension() {
|
|
3956
4191
|
const extension = new NotarizationTeleportExtension({
|
|
3957
4192
|
onOpen: async () => {
|
|
3958
|
-
(0,
|
|
4193
|
+
(0, import_log14.log)("extension opened", {
|
|
3959
4194
|
peer: extension.localPeerId
|
|
3960
4195
|
}, {
|
|
3961
|
-
F:
|
|
4196
|
+
F: __dxlog_file16,
|
|
3962
4197
|
L: 211,
|
|
3963
4198
|
S: this,
|
|
3964
4199
|
C: (f, a) => f(...a)
|
|
@@ -3967,10 +4202,10 @@ var NotarizationPlugin = class {
|
|
|
3967
4202
|
this._extensionOpened.emit();
|
|
3968
4203
|
},
|
|
3969
4204
|
onClose: async () => {
|
|
3970
|
-
(0,
|
|
4205
|
+
(0, import_log14.log)("extension closed", {
|
|
3971
4206
|
peer: extension.localPeerId
|
|
3972
4207
|
}, {
|
|
3973
|
-
F:
|
|
4208
|
+
F: __dxlog_file16,
|
|
3974
4209
|
L: 216,
|
|
3975
4210
|
S: this,
|
|
3976
4211
|
C: (f, a) => f(...a)
|
|
@@ -4022,16 +4257,84 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
4022
4257
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4023
4258
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4024
4259
|
}
|
|
4025
|
-
|
|
4260
|
+
function _using_ctx() {
|
|
4261
|
+
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
4262
|
+
var err = new Error();
|
|
4263
|
+
err.name = "SuppressedError";
|
|
4264
|
+
err.suppressed = suppressed;
|
|
4265
|
+
err.error = error;
|
|
4266
|
+
return err;
|
|
4267
|
+
}, empty = {}, stack = [];
|
|
4268
|
+
function using(isAwait, value) {
|
|
4269
|
+
if (value != null) {
|
|
4270
|
+
if (Object(value) !== value) {
|
|
4271
|
+
throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
4272
|
+
}
|
|
4273
|
+
if (isAwait) {
|
|
4274
|
+
var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")];
|
|
4275
|
+
}
|
|
4276
|
+
if (dispose == null) {
|
|
4277
|
+
dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")];
|
|
4278
|
+
}
|
|
4279
|
+
if (typeof dispose !== "function") {
|
|
4280
|
+
throw new TypeError(`Property [Symbol.dispose] is not a function.`);
|
|
4281
|
+
}
|
|
4282
|
+
stack.push({
|
|
4283
|
+
v: value,
|
|
4284
|
+
d: dispose,
|
|
4285
|
+
a: isAwait
|
|
4286
|
+
});
|
|
4287
|
+
} else if (isAwait) {
|
|
4288
|
+
stack.push({
|
|
4289
|
+
d: value,
|
|
4290
|
+
a: isAwait
|
|
4291
|
+
});
|
|
4292
|
+
}
|
|
4293
|
+
return value;
|
|
4294
|
+
}
|
|
4295
|
+
return {
|
|
4296
|
+
e: empty,
|
|
4297
|
+
u: using.bind(null, false),
|
|
4298
|
+
a: using.bind(null, true),
|
|
4299
|
+
d: function() {
|
|
4300
|
+
var error = this.e;
|
|
4301
|
+
function next() {
|
|
4302
|
+
while (resource = stack.pop()) {
|
|
4303
|
+
try {
|
|
4304
|
+
var resource, disposalResult = resource.d && resource.d.call(resource.v);
|
|
4305
|
+
if (resource.a) {
|
|
4306
|
+
return Promise.resolve(disposalResult).then(next, err);
|
|
4307
|
+
}
|
|
4308
|
+
} catch (e) {
|
|
4309
|
+
return err(e);
|
|
4310
|
+
}
|
|
4311
|
+
}
|
|
4312
|
+
if (error !== empty)
|
|
4313
|
+
throw error;
|
|
4314
|
+
}
|
|
4315
|
+
function err(e) {
|
|
4316
|
+
error = error !== empty ? new _disposeSuppressedError(error, e) : e;
|
|
4317
|
+
return next();
|
|
4318
|
+
}
|
|
4319
|
+
return next();
|
|
4320
|
+
}
|
|
4321
|
+
};
|
|
4322
|
+
}
|
|
4323
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4026
4324
|
var DataSpace = class {
|
|
4027
4325
|
constructor(params) {
|
|
4028
|
-
this._ctx = new import_context10.Context(
|
|
4326
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4327
|
+
F: __dxlog_file17,
|
|
4328
|
+
L: 84
|
|
4329
|
+
});
|
|
4029
4330
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4030
4331
|
this._cache = void 0;
|
|
4031
4332
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
4333
|
+
this._epochProcessingMutex = new import_async13.Mutex();
|
|
4032
4334
|
this._state = import_services12.SpaceState.CLOSED;
|
|
4335
|
+
this._databaseRoot = null;
|
|
4033
4336
|
this.error = void 0;
|
|
4034
|
-
this.stateUpdate = new
|
|
4337
|
+
this.stateUpdate = new import_async13.Event();
|
|
4035
4338
|
this.metrics = {};
|
|
4036
4339
|
this._inner = params.inner;
|
|
4037
4340
|
this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
|
|
@@ -4044,17 +4347,17 @@ var DataSpace = class {
|
|
|
4044
4347
|
this._callbacks = params.callbacks ?? {};
|
|
4045
4348
|
this._echoHost = params.echoHost;
|
|
4046
4349
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
4047
|
-
trustedKeysProvider: () => new
|
|
4350
|
+
trustedKeysProvider: () => new import_util7.ComplexSet(import_keys10.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== import_credentials13.SpaceMember.Role.REMOVED).map((member) => member.key)),
|
|
4048
4351
|
update: this._inner.stateUpdate,
|
|
4049
4352
|
authTimeout: import_client_protocol4.AUTH_TIMEOUT
|
|
4050
4353
|
});
|
|
4051
4354
|
this._cache = params.cache;
|
|
4052
4355
|
this._state = params.initialState;
|
|
4053
|
-
(0,
|
|
4356
|
+
(0, import_log12.log)("new state", {
|
|
4054
4357
|
state: import_services12.SpaceState[this._state]
|
|
4055
4358
|
}, {
|
|
4056
|
-
F:
|
|
4057
|
-
L:
|
|
4359
|
+
F: __dxlog_file17,
|
|
4360
|
+
L: 146,
|
|
4058
4361
|
S: this,
|
|
4059
4362
|
C: (f, a) => f(...a)
|
|
4060
4363
|
});
|
|
@@ -4087,6 +4390,9 @@ var DataSpace = class {
|
|
|
4087
4390
|
get automergeSpaceState() {
|
|
4088
4391
|
return this._automergeSpaceState;
|
|
4089
4392
|
}
|
|
4393
|
+
get databaseRoot() {
|
|
4394
|
+
return this._databaseRoot;
|
|
4395
|
+
}
|
|
4090
4396
|
get _automergeInfo() {
|
|
4091
4397
|
return {
|
|
4092
4398
|
rootUrl: this._automergeSpaceState.rootUrl,
|
|
@@ -4103,14 +4409,18 @@ var DataSpace = class {
|
|
|
4103
4409
|
await this._gossip.open();
|
|
4104
4410
|
await this._notarizationPlugin.open();
|
|
4105
4411
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4412
|
+
await this._automergeSpaceState.open();
|
|
4106
4413
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4107
|
-
await this._inner.open(new import_context10.Context(
|
|
4414
|
+
await this._inner.open(new import_context10.Context(void 0, {
|
|
4415
|
+
F: __dxlog_file17,
|
|
4416
|
+
L: 215
|
|
4417
|
+
}));
|
|
4108
4418
|
this._state = import_services12.SpaceState.CONTROL_ONLY;
|
|
4109
|
-
(0,
|
|
4419
|
+
(0, import_log12.log)("new state", {
|
|
4110
4420
|
state: import_services12.SpaceState[this._state]
|
|
4111
4421
|
}, {
|
|
4112
|
-
F:
|
|
4113
|
-
L:
|
|
4422
|
+
F: __dxlog_file17,
|
|
4423
|
+
L: 217,
|
|
4114
4424
|
S: this,
|
|
4115
4425
|
C: (f, a) => f(...a)
|
|
4116
4426
|
});
|
|
@@ -4124,19 +4434,23 @@ var DataSpace = class {
|
|
|
4124
4434
|
async _close() {
|
|
4125
4435
|
await this._callbacks.beforeClose?.();
|
|
4126
4436
|
this._state = import_services12.SpaceState.CLOSED;
|
|
4127
|
-
(0,
|
|
4437
|
+
(0, import_log12.log)("new state", {
|
|
4128
4438
|
state: import_services12.SpaceState[this._state]
|
|
4129
4439
|
}, {
|
|
4130
|
-
F:
|
|
4131
|
-
L:
|
|
4440
|
+
F: __dxlog_file17,
|
|
4441
|
+
L: 231,
|
|
4132
4442
|
S: this,
|
|
4133
4443
|
C: (f, a) => f(...a)
|
|
4134
4444
|
});
|
|
4135
4445
|
await this._ctx.dispose();
|
|
4136
|
-
this._ctx = new import_context10.Context(
|
|
4446
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4447
|
+
F: __dxlog_file17,
|
|
4448
|
+
L: 233
|
|
4449
|
+
});
|
|
4137
4450
|
await this.authVerifier.close();
|
|
4138
4451
|
await this._inner.close();
|
|
4139
4452
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
4453
|
+
await this._automergeSpaceState.close();
|
|
4140
4454
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
4141
4455
|
await this._notarizationPlugin.close();
|
|
4142
4456
|
await this._presence.close();
|
|
@@ -4152,32 +4466,32 @@ var DataSpace = class {
|
|
|
4152
4466
|
* Initialize the data pipeline in a separate task.
|
|
4153
4467
|
*/
|
|
4154
4468
|
initializeDataPipelineAsync() {
|
|
4155
|
-
(0,
|
|
4469
|
+
(0, import_async13.scheduleTask)(this._ctx, async () => {
|
|
4156
4470
|
try {
|
|
4157
4471
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
4158
4472
|
await this.initializeDataPipeline();
|
|
4159
4473
|
} catch (err) {
|
|
4160
4474
|
if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
|
|
4161
|
-
(0,
|
|
4162
|
-
F:
|
|
4163
|
-
L:
|
|
4475
|
+
(0, import_log12.log)("data pipeline initialization cancelled", err, {
|
|
4476
|
+
F: __dxlog_file17,
|
|
4477
|
+
L: 265,
|
|
4164
4478
|
S: this,
|
|
4165
4479
|
C: (f, a) => f(...a)
|
|
4166
4480
|
});
|
|
4167
4481
|
return;
|
|
4168
4482
|
}
|
|
4169
|
-
|
|
4170
|
-
F:
|
|
4171
|
-
L:
|
|
4483
|
+
import_log12.log.error("Error initializing data pipeline", err, {
|
|
4484
|
+
F: __dxlog_file17,
|
|
4485
|
+
L: 269,
|
|
4172
4486
|
S: this,
|
|
4173
4487
|
C: (f, a) => f(...a)
|
|
4174
4488
|
});
|
|
4175
4489
|
this._state = import_services12.SpaceState.ERROR;
|
|
4176
|
-
(0,
|
|
4490
|
+
(0, import_log12.log)("new state", {
|
|
4177
4491
|
state: import_services12.SpaceState[this._state]
|
|
4178
4492
|
}, {
|
|
4179
|
-
F:
|
|
4180
|
-
L:
|
|
4493
|
+
F: __dxlog_file17,
|
|
4494
|
+
L: 271,
|
|
4181
4495
|
S: this,
|
|
4182
4496
|
C: (f, a) => f(...a)
|
|
4183
4497
|
});
|
|
@@ -4193,31 +4507,28 @@ var DataSpace = class {
|
|
|
4193
4507
|
throw new import_protocols9.SystemError("Invalid operation");
|
|
4194
4508
|
}
|
|
4195
4509
|
this._state = import_services12.SpaceState.INITIALIZING;
|
|
4196
|
-
(0,
|
|
4510
|
+
(0, import_log12.log)("new state", {
|
|
4197
4511
|
state: import_services12.SpaceState[this._state]
|
|
4198
4512
|
}, {
|
|
4199
|
-
F:
|
|
4200
|
-
L:
|
|
4513
|
+
F: __dxlog_file17,
|
|
4514
|
+
L: 287,
|
|
4201
4515
|
S: this,
|
|
4202
4516
|
C: (f, a) => f(...a)
|
|
4203
4517
|
});
|
|
4204
4518
|
await this._initializeAndReadControlPipeline();
|
|
4205
|
-
await (0,
|
|
4519
|
+
await (0, import_async13.sleep)(1);
|
|
4520
|
+
const ready = this.stateUpdate.waitForCondition(() => this._state === import_services12.SpaceState.READY);
|
|
4206
4521
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4207
|
-
await
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
L: 290,
|
|
4211
|
-
S: this,
|
|
4212
|
-
C: (f, a) => f(...a)
|
|
4213
|
-
});
|
|
4522
|
+
await ready;
|
|
4523
|
+
}
|
|
4524
|
+
async _enterReadyState() {
|
|
4214
4525
|
await this._callbacks.beforeReady?.();
|
|
4215
4526
|
this._state = import_services12.SpaceState.READY;
|
|
4216
|
-
(0,
|
|
4527
|
+
(0, import_log12.log)("new state", {
|
|
4217
4528
|
state: import_services12.SpaceState[this._state]
|
|
4218
4529
|
}, {
|
|
4219
|
-
F:
|
|
4220
|
-
L:
|
|
4530
|
+
F: __dxlog_file17,
|
|
4531
|
+
L: 306,
|
|
4221
4532
|
S: this,
|
|
4222
4533
|
C: (f, a) => f(...a)
|
|
4223
4534
|
});
|
|
@@ -4231,9 +4542,9 @@ var DataSpace = class {
|
|
|
4231
4542
|
});
|
|
4232
4543
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4233
4544
|
await this._createWritableFeeds();
|
|
4234
|
-
(0,
|
|
4235
|
-
F:
|
|
4236
|
-
L:
|
|
4545
|
+
(0, import_log12.log)("writable feeds created", void 0, {
|
|
4546
|
+
F: __dxlog_file17,
|
|
4547
|
+
L: 322,
|
|
4237
4548
|
S: this,
|
|
4238
4549
|
C: (f, a) => f(...a)
|
|
4239
4550
|
});
|
|
@@ -4291,57 +4602,66 @@ var DataSpace = class {
|
|
|
4291
4602
|
}
|
|
4292
4603
|
}
|
|
4293
4604
|
_onNewAutomergeRoot(rootUrl) {
|
|
4294
|
-
(0,
|
|
4605
|
+
(0, import_log12.log)("loading automerge root doc for space", {
|
|
4295
4606
|
space: this.key,
|
|
4296
4607
|
rootUrl
|
|
4297
4608
|
}, {
|
|
4298
|
-
F:
|
|
4299
|
-
L:
|
|
4609
|
+
F: __dxlog_file17,
|
|
4610
|
+
L: 388,
|
|
4300
4611
|
S: this,
|
|
4301
4612
|
C: (f, a) => f(...a)
|
|
4302
4613
|
});
|
|
4303
|
-
this._echoHost.replicateDocument(rootUrl);
|
|
4304
4614
|
const handle = this._echoHost.automergeRepo.find(rootUrl);
|
|
4305
4615
|
queueMicrotask(async () => {
|
|
4306
4616
|
try {
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
return;
|
|
4312
|
-
}
|
|
4313
|
-
const doc = handle.docSync() ?? (0, import_invariant12.failedInvariant)();
|
|
4314
|
-
if (!doc.access?.spaceKey) {
|
|
4315
|
-
handle.change((doc2) => {
|
|
4316
|
-
doc2.access = {
|
|
4317
|
-
spaceKey: this.key.toHex()
|
|
4318
|
-
};
|
|
4319
|
-
});
|
|
4320
|
-
}
|
|
4321
|
-
if (!this._echoHost.roots.has(handle.documentId)) {
|
|
4322
|
-
await this._echoHost.openSpaceRoot(handle.url);
|
|
4323
|
-
} else {
|
|
4324
|
-
import_log11.log.warn("echo database root already exists", {
|
|
4325
|
-
space: this.key,
|
|
4326
|
-
rootUrl
|
|
4327
|
-
}, {
|
|
4328
|
-
F: __dxlog_file15,
|
|
4329
|
-
L: 403,
|
|
4330
|
-
S: this,
|
|
4331
|
-
C: (f, a) => f(...a)
|
|
4617
|
+
try {
|
|
4618
|
+
var _usingCtx = _using_ctx();
|
|
4619
|
+
await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
4620
|
+
await (0, import_context10.cancelWithContext)(this._ctx, handle.whenReady());
|
|
4332
4621
|
});
|
|
4622
|
+
if (this._ctx.disposed) {
|
|
4623
|
+
return;
|
|
4624
|
+
}
|
|
4625
|
+
const _guard = (
|
|
4626
|
+
// Ensure only one root is processed at a time.
|
|
4627
|
+
_usingCtx.u(await this._epochProcessingMutex.acquire())
|
|
4628
|
+
);
|
|
4629
|
+
const doc = handle.docSync() ?? (0, import_invariant12.failedInvariant)();
|
|
4630
|
+
if (!doc.access?.spaceKey) {
|
|
4631
|
+
handle.change((doc2) => {
|
|
4632
|
+
doc2.access = {
|
|
4633
|
+
spaceKey: this.key.toHex()
|
|
4634
|
+
};
|
|
4635
|
+
});
|
|
4636
|
+
}
|
|
4637
|
+
const root = await this._echoHost.openSpaceRoot(handle.url);
|
|
4638
|
+
this._databaseRoot = root;
|
|
4639
|
+
if (root.getVersion() !== import_echo_protocol.SpaceDocVersion.CURRENT) {
|
|
4640
|
+
if (this._state !== import_services12.SpaceState.REQUIRES_MIGRATION) {
|
|
4641
|
+
this._state = import_services12.SpaceState.REQUIRES_MIGRATION;
|
|
4642
|
+
this.stateUpdate.emit();
|
|
4643
|
+
}
|
|
4644
|
+
} else {
|
|
4645
|
+
if (this._state !== import_services12.SpaceState.READY) {
|
|
4646
|
+
await this._enterReadyState();
|
|
4647
|
+
}
|
|
4648
|
+
}
|
|
4649
|
+
} catch (_) {
|
|
4650
|
+
_usingCtx.e = _;
|
|
4651
|
+
} finally {
|
|
4652
|
+
_usingCtx.d();
|
|
4333
4653
|
}
|
|
4334
4654
|
} catch (err) {
|
|
4335
4655
|
if (err instanceof import_context10.ContextDisposedError) {
|
|
4336
4656
|
return;
|
|
4337
4657
|
}
|
|
4338
|
-
|
|
4658
|
+
import_log12.log.warn("error loading automerge root doc", {
|
|
4339
4659
|
space: this.key,
|
|
4340
4660
|
rootUrl,
|
|
4341
4661
|
err
|
|
4342
4662
|
}, {
|
|
4343
|
-
F:
|
|
4344
|
-
L:
|
|
4663
|
+
F: __dxlog_file17,
|
|
4664
|
+
L: 433,
|
|
4345
4665
|
S: this,
|
|
4346
4666
|
C: (f, a) => f(...a)
|
|
4347
4667
|
});
|
|
@@ -4364,148 +4684,34 @@ var DataSpace = class {
|
|
|
4364
4684
|
});
|
|
4365
4685
|
}
|
|
4366
4686
|
async createEpoch(options) {
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
case import_services12.CreateEpochRequest.Migration.NONE:
|
|
4371
|
-
{
|
|
4372
|
-
epoch = {
|
|
4373
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4374
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4375
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4376
|
-
automergeRoot: this._automergeSpaceState.lastEpoch?.subject.assertion?.automergeRoot
|
|
4377
|
-
};
|
|
4378
|
-
}
|
|
4379
|
-
break;
|
|
4380
|
-
case import_services12.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
4381
|
-
{
|
|
4382
|
-
const document = this._echoHost.automergeRepo.create();
|
|
4383
|
-
epoch = {
|
|
4384
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4385
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4386
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4387
|
-
automergeRoot: document.url
|
|
4388
|
-
};
|
|
4389
|
-
}
|
|
4390
|
-
break;
|
|
4391
|
-
case import_services12.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
|
|
4392
|
-
{
|
|
4393
|
-
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
4394
|
-
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
4395
|
-
await (0, import_context10.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
4396
|
-
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
4397
|
-
await this._echoHost.automergeRepo.flush([
|
|
4398
|
-
newRoot.documentId
|
|
4399
|
-
]);
|
|
4400
|
-
(0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4401
|
-
F: __dxlog_file15,
|
|
4402
|
-
L: 460,
|
|
4403
|
-
S: this,
|
|
4404
|
-
A: [
|
|
4405
|
-
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
4406
|
-
""
|
|
4407
|
-
]
|
|
4408
|
-
});
|
|
4409
|
-
epoch = {
|
|
4410
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4411
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4412
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4413
|
-
automergeRoot: newRoot.url
|
|
4414
|
-
};
|
|
4415
|
-
}
|
|
4416
|
-
break;
|
|
4417
|
-
case import_services12.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
|
|
4418
|
-
{
|
|
4419
|
-
import_log11.log.info("Fragmenting", void 0, {
|
|
4420
|
-
F: __dxlog_file15,
|
|
4421
|
-
L: 472,
|
|
4422
|
-
S: this,
|
|
4423
|
-
C: (f, a) => f(...a)
|
|
4424
|
-
});
|
|
4425
|
-
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
4426
|
-
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
4427
|
-
await (0, import_context10.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
4428
|
-
const objects = Object.entries(rootHandle.docSync().objects);
|
|
4429
|
-
const properties = findPropertiesObject(rootHandle.docSync());
|
|
4430
|
-
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4431
|
-
(0, import_invariant12.invariant)(properties, "Properties not found", {
|
|
4432
|
-
F: __dxlog_file15,
|
|
4433
|
-
L: 482,
|
|
4434
|
-
S: this,
|
|
4435
|
-
A: [
|
|
4436
|
-
"properties",
|
|
4437
|
-
"'Properties not found'"
|
|
4438
|
-
]
|
|
4439
|
-
});
|
|
4440
|
-
const newSpaceDoc = {
|
|
4441
|
-
...rootHandle.docSync(),
|
|
4442
|
-
objects: Object.fromEntries([
|
|
4443
|
-
properties
|
|
4444
|
-
])
|
|
4445
|
-
};
|
|
4446
|
-
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
4447
|
-
(0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4448
|
-
F: __dxlog_file15,
|
|
4449
|
-
L: 487,
|
|
4450
|
-
S: this,
|
|
4451
|
-
A: [
|
|
4452
|
-
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
4453
|
-
""
|
|
4454
|
-
]
|
|
4455
|
-
});
|
|
4456
|
-
const docLoader = new import_echo_pipeline2.AutomergeDocumentLoaderImpl(await (0, import_echo_pipeline2.createIdFromSpaceKey)(this.key), this._echoHost.automergeRepo, this.key);
|
|
4457
|
-
await docLoader.loadSpaceRootDocHandle(this._ctx, {
|
|
4458
|
-
rootUrl: newRoot.url
|
|
4459
|
-
});
|
|
4460
|
-
otherObjects.forEach(([key, value]) => {
|
|
4461
|
-
const handle = docLoader.createDocumentForObject(key);
|
|
4462
|
-
handle.change((doc) => {
|
|
4463
|
-
(0, import_util6.assignDeep)(doc, [
|
|
4464
|
-
"objects",
|
|
4465
|
-
key
|
|
4466
|
-
], value);
|
|
4467
|
-
});
|
|
4468
|
-
});
|
|
4469
|
-
epoch = {
|
|
4470
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4471
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4472
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4473
|
-
automergeRoot: newRoot.url
|
|
4474
|
-
};
|
|
4475
|
-
}
|
|
4476
|
-
break;
|
|
4477
|
-
case import_services12.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT:
|
|
4478
|
-
{
|
|
4479
|
-
(0, import_invariant12.invariant)(options.newAutomergeRoot, void 0, {
|
|
4480
|
-
F: __dxlog_file15,
|
|
4481
|
-
L: 517,
|
|
4482
|
-
S: this,
|
|
4483
|
-
A: [
|
|
4484
|
-
"options.newAutomergeRoot",
|
|
4485
|
-
""
|
|
4486
|
-
]
|
|
4487
|
-
});
|
|
4488
|
-
epoch = {
|
|
4489
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4490
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4491
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4492
|
-
automergeRoot: options.newAutomergeRoot
|
|
4493
|
-
};
|
|
4494
|
-
}
|
|
4495
|
-
break;
|
|
4496
|
-
}
|
|
4497
|
-
if (!epoch) {
|
|
4498
|
-
return;
|
|
4687
|
+
const ctx = this._ctx.derive();
|
|
4688
|
+
if (!options?.migration) {
|
|
4689
|
+
return null;
|
|
4499
4690
|
}
|
|
4691
|
+
const { newRoot } = await runEpochMigration(ctx, {
|
|
4692
|
+
echoHost: this._echoHost,
|
|
4693
|
+
spaceId: this.id,
|
|
4694
|
+
spaceKey: this.key,
|
|
4695
|
+
migration: options.migration,
|
|
4696
|
+
currentRoot: this._automergeSpaceState.rootUrl ?? null,
|
|
4697
|
+
newAutomergeRoot: options.newAutomergeRoot
|
|
4698
|
+
});
|
|
4699
|
+
const epoch = {
|
|
4700
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4701
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4702
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4703
|
+
automergeRoot: newRoot ?? this._automergeSpaceState.rootUrl
|
|
4704
|
+
};
|
|
4705
|
+
const credential = await this._signingContext.credentialSigner.createCredential({
|
|
4706
|
+
subject: this.key,
|
|
4707
|
+
assertion: {
|
|
4708
|
+
"@type": "dxos.halo.credentials.Epoch",
|
|
4709
|
+
...epoch
|
|
4710
|
+
}
|
|
4711
|
+
});
|
|
4500
4712
|
const receipt = await this.inner.controlPipeline.writer.write({
|
|
4501
4713
|
credential: {
|
|
4502
|
-
credential
|
|
4503
|
-
subject: this.key,
|
|
4504
|
-
assertion: {
|
|
4505
|
-
"@type": "dxos.halo.credentials.Epoch",
|
|
4506
|
-
...epoch
|
|
4507
|
-
}
|
|
4508
|
-
})
|
|
4714
|
+
credential
|
|
4509
4715
|
}
|
|
4510
4716
|
});
|
|
4511
4717
|
await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe3.Timeframe([
|
|
@@ -4515,6 +4721,7 @@ var DataSpace = class {
|
|
|
4515
4721
|
]
|
|
4516
4722
|
]));
|
|
4517
4723
|
await this._echoHost.updateIndexes();
|
|
4724
|
+
return credential;
|
|
4518
4725
|
}
|
|
4519
4726
|
async activate() {
|
|
4520
4727
|
if (![
|
|
@@ -4536,11 +4743,11 @@ var DataSpace = class {
|
|
|
4536
4743
|
await this._close();
|
|
4537
4744
|
}
|
|
4538
4745
|
this._state = import_services12.SpaceState.INACTIVE;
|
|
4539
|
-
(0,
|
|
4746
|
+
(0, import_log12.log)("new state", {
|
|
4540
4747
|
state: import_services12.SpaceState[this._state]
|
|
4541
4748
|
}, {
|
|
4542
|
-
F:
|
|
4543
|
-
L:
|
|
4749
|
+
F: __dxlog_file17,
|
|
4750
|
+
L: 514,
|
|
4544
4751
|
S: this,
|
|
4545
4752
|
C: (f, a) => f(...a)
|
|
4546
4753
|
});
|
|
@@ -4567,10 +4774,10 @@ _ts_decorate4([
|
|
|
4567
4774
|
})
|
|
4568
4775
|
], DataSpace.prototype, "_automergeInfo", null);
|
|
4569
4776
|
_ts_decorate4([
|
|
4570
|
-
|
|
4777
|
+
import_async13.synchronized
|
|
4571
4778
|
], DataSpace.prototype, "open", null);
|
|
4572
4779
|
_ts_decorate4([
|
|
4573
|
-
|
|
4780
|
+
import_async13.synchronized
|
|
4574
4781
|
], DataSpace.prototype, "close", null);
|
|
4575
4782
|
_ts_decorate4([
|
|
4576
4783
|
import_tracing5.trace.span({
|
|
@@ -4586,27 +4793,15 @@ _ts_decorate4([
|
|
|
4586
4793
|
(0, import_debug3.timed)(1e4)
|
|
4587
4794
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
4588
4795
|
_ts_decorate4([
|
|
4589
|
-
|
|
4796
|
+
import_async13.synchronized
|
|
4590
4797
|
], DataSpace.prototype, "activate", null);
|
|
4591
4798
|
_ts_decorate4([
|
|
4592
|
-
|
|
4799
|
+
import_async13.synchronized
|
|
4593
4800
|
], DataSpace.prototype, "deactivate", null);
|
|
4594
4801
|
DataSpace = _ts_decorate4([
|
|
4595
|
-
(0,
|
|
4802
|
+
(0, import_async13.trackLeaks)("open", "close"),
|
|
4596
4803
|
import_tracing5.trace.resource()
|
|
4597
4804
|
], DataSpace);
|
|
4598
|
-
var findPropertiesObject = (spaceDoc) => {
|
|
4599
|
-
for (const id in spaceDoc.objects ?? {}) {
|
|
4600
|
-
const obj = spaceDoc.objects[id];
|
|
4601
|
-
if (obj.system.type?.itemId === import_echo_schema.TYPE_PROPERTIES) {
|
|
4602
|
-
return [
|
|
4603
|
-
id,
|
|
4604
|
-
obj
|
|
4605
|
-
];
|
|
4606
|
-
}
|
|
4607
|
-
}
|
|
4608
|
-
return void 0;
|
|
4609
|
-
};
|
|
4610
4805
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
4611
4806
|
const credentials = [
|
|
4612
4807
|
await (0, import_credentials17.createCredential)({
|
|
@@ -4681,7 +4876,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4681
4876
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4682
4877
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4683
4878
|
}
|
|
4684
|
-
var
|
|
4879
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4685
4880
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4686
4881
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4687
4882
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4695,9 +4890,12 @@ var DataSpaceManager = class {
|
|
|
4695
4890
|
this._echoHost = _echoHost;
|
|
4696
4891
|
this._invitationsManager = _invitationsManager;
|
|
4697
4892
|
this._params = _params;
|
|
4698
|
-
this._ctx = new
|
|
4699
|
-
|
|
4700
|
-
|
|
4893
|
+
this._ctx = new import_context13.Context(void 0, {
|
|
4894
|
+
F: __dxlog_file18,
|
|
4895
|
+
L: 104
|
|
4896
|
+
});
|
|
4897
|
+
this.updated = new import_async16.Event();
|
|
4898
|
+
this._spaces = new import_util9.ComplexMap(import_keys12.PublicKey.hash);
|
|
4701
4899
|
this._isOpen = false;
|
|
4702
4900
|
this._instanceId = import_keys12.PublicKey.random().toHex();
|
|
4703
4901
|
import_tracing6.trace.diagnostic({
|
|
@@ -4708,10 +4906,10 @@ var DataSpaceManager = class {
|
|
|
4708
4906
|
const rootUrl = space.automergeSpaceState.rootUrl;
|
|
4709
4907
|
const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
|
|
4710
4908
|
const rootDoc = rootHandle?.docSync();
|
|
4711
|
-
const properties = rootDoc &&
|
|
4909
|
+
const properties = rootDoc && (0, import_echo_db2.findInlineObjectOfType)(rootDoc, import_echo_schema2.TYPE_PROPERTIES);
|
|
4712
4910
|
return {
|
|
4713
4911
|
key: space.key.toHex(),
|
|
4714
|
-
state:
|
|
4912
|
+
state: import_services14.SpaceState[space.state],
|
|
4715
4913
|
name: properties?.[1].data.name ?? null,
|
|
4716
4914
|
inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
|
|
4717
4915
|
linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
|
|
@@ -4728,46 +4926,46 @@ var DataSpaceManager = class {
|
|
|
4728
4926
|
return this._spaces;
|
|
4729
4927
|
}
|
|
4730
4928
|
async open() {
|
|
4731
|
-
(0,
|
|
4732
|
-
F:
|
|
4733
|
-
L:
|
|
4929
|
+
(0, import_log15.log)("open", void 0, {
|
|
4930
|
+
F: __dxlog_file18,
|
|
4931
|
+
L: 156,
|
|
4734
4932
|
S: this,
|
|
4735
4933
|
C: (f, a) => f(...a)
|
|
4736
4934
|
});
|
|
4737
|
-
|
|
4935
|
+
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
|
|
4738
4936
|
id: this._instanceId
|
|
4739
4937
|
}), {
|
|
4740
|
-
F:
|
|
4741
|
-
L:
|
|
4938
|
+
F: __dxlog_file18,
|
|
4939
|
+
L: 157,
|
|
4742
4940
|
S: this,
|
|
4743
4941
|
C: (f, a) => f(...a)
|
|
4744
4942
|
});
|
|
4745
|
-
(0,
|
|
4943
|
+
(0, import_log15.log)("metadata loaded", {
|
|
4746
4944
|
spaces: this._metadataStore.spaces.length
|
|
4747
4945
|
}, {
|
|
4748
|
-
F:
|
|
4749
|
-
L:
|
|
4946
|
+
F: __dxlog_file18,
|
|
4947
|
+
L: 158,
|
|
4750
4948
|
S: this,
|
|
4751
4949
|
C: (f, a) => f(...a)
|
|
4752
4950
|
});
|
|
4753
|
-
await (0,
|
|
4951
|
+
await (0, import_util9.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
4754
4952
|
try {
|
|
4755
|
-
(0,
|
|
4953
|
+
(0, import_log15.log)("load space", {
|
|
4756
4954
|
spaceMetadata
|
|
4757
4955
|
}, {
|
|
4758
|
-
F:
|
|
4759
|
-
L:
|
|
4956
|
+
F: __dxlog_file18,
|
|
4957
|
+
L: 162,
|
|
4760
4958
|
S: this,
|
|
4761
4959
|
C: (f, a) => f(...a)
|
|
4762
4960
|
});
|
|
4763
4961
|
await this._constructSpace(spaceMetadata);
|
|
4764
4962
|
} catch (err) {
|
|
4765
|
-
|
|
4963
|
+
import_log15.log.error("Error loading space", {
|
|
4766
4964
|
spaceMetadata,
|
|
4767
4965
|
err
|
|
4768
4966
|
}, {
|
|
4769
|
-
F:
|
|
4770
|
-
L:
|
|
4967
|
+
F: __dxlog_file18,
|
|
4968
|
+
L: 165,
|
|
4771
4969
|
S: this,
|
|
4772
4970
|
C: (f, a) => f(...a)
|
|
4773
4971
|
});
|
|
@@ -4775,19 +4973,19 @@ var DataSpaceManager = class {
|
|
|
4775
4973
|
});
|
|
4776
4974
|
this._isOpen = true;
|
|
4777
4975
|
this.updated.emit();
|
|
4778
|
-
|
|
4976
|
+
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
|
|
4779
4977
|
id: this._instanceId
|
|
4780
4978
|
}), {
|
|
4781
|
-
F:
|
|
4782
|
-
L:
|
|
4979
|
+
F: __dxlog_file18,
|
|
4980
|
+
L: 172,
|
|
4783
4981
|
S: this,
|
|
4784
4982
|
C: (f, a) => f(...a)
|
|
4785
4983
|
});
|
|
4786
4984
|
}
|
|
4787
4985
|
async close() {
|
|
4788
|
-
(0,
|
|
4789
|
-
F:
|
|
4790
|
-
L:
|
|
4986
|
+
(0, import_log15.log)("close", void 0, {
|
|
4987
|
+
F: __dxlog_file18,
|
|
4988
|
+
L: 177,
|
|
4791
4989
|
S: this,
|
|
4792
4990
|
C: (f, a) => f(...a)
|
|
4793
4991
|
});
|
|
@@ -4802,9 +5000,9 @@ var DataSpaceManager = class {
|
|
|
4802
5000
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
4803
5001
|
*/
|
|
4804
5002
|
async createSpace() {
|
|
4805
|
-
(0,
|
|
4806
|
-
F:
|
|
4807
|
-
L:
|
|
5003
|
+
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
5004
|
+
F: __dxlog_file18,
|
|
5005
|
+
L: 191,
|
|
4808
5006
|
S: this,
|
|
4809
5007
|
A: [
|
|
4810
5008
|
"this._isOpen",
|
|
@@ -4819,13 +5017,13 @@ var DataSpaceManager = class {
|
|
|
4819
5017
|
genesisFeedKey: controlFeedKey,
|
|
4820
5018
|
controlFeedKey,
|
|
4821
5019
|
dataFeedKey,
|
|
4822
|
-
state:
|
|
5020
|
+
state: import_services14.SpaceState.ACTIVE
|
|
4823
5021
|
};
|
|
4824
|
-
(0,
|
|
5022
|
+
(0, import_log15.log)("creating space...", {
|
|
4825
5023
|
spaceKey
|
|
4826
5024
|
}, {
|
|
4827
|
-
F:
|
|
4828
|
-
L:
|
|
5025
|
+
F: __dxlog_file18,
|
|
5026
|
+
L: 203,
|
|
4829
5027
|
S: this,
|
|
4830
5028
|
C: (f, a) => f(...a)
|
|
4831
5029
|
});
|
|
@@ -4835,9 +5033,9 @@ var DataSpaceManager = class {
|
|
|
4835
5033
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
|
|
4836
5034
|
await this._metadataStore.addSpace(metadata);
|
|
4837
5035
|
const memberCredential = credentials[1];
|
|
4838
|
-
(0,
|
|
4839
|
-
F:
|
|
4840
|
-
L:
|
|
5036
|
+
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5037
|
+
F: __dxlog_file18,
|
|
5038
|
+
L: 213,
|
|
4841
5039
|
S: this,
|
|
4842
5040
|
A: [
|
|
4843
5041
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -4850,16 +5048,38 @@ var DataSpaceManager = class {
|
|
|
4850
5048
|
return space;
|
|
4851
5049
|
}
|
|
4852
5050
|
async isDefaultSpace(space) {
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
5051
|
+
if (!space.databaseRoot) {
|
|
5052
|
+
return false;
|
|
5053
|
+
}
|
|
5054
|
+
switch (space.databaseRoot.getVersion()) {
|
|
5055
|
+
case import_echo_protocol3.SpaceDocVersion.CURRENT: {
|
|
5056
|
+
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_echo_schema2.TYPE_PROPERTIES) ?? [];
|
|
5057
|
+
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5058
|
+
}
|
|
5059
|
+
case import_echo_protocol3.SpaceDocVersion.LEGACY: {
|
|
5060
|
+
const convertedDoc = await (0, import_echo_db2.convertLegacyReferences)(space.databaseRoot.docSync());
|
|
5061
|
+
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc, import_echo_protocol3.LEGACY_TYPE_PROPERTIES) ?? [];
|
|
5062
|
+
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5063
|
+
}
|
|
5064
|
+
default:
|
|
5065
|
+
import_log15.log.warn("unknown space version", {
|
|
5066
|
+
version: space.databaseRoot.getVersion(),
|
|
5067
|
+
spaceId: space.id
|
|
5068
|
+
}, {
|
|
5069
|
+
F: __dxlog_file18,
|
|
5070
|
+
L: 238,
|
|
5071
|
+
S: this,
|
|
5072
|
+
C: (f, a) => f(...a)
|
|
5073
|
+
});
|
|
5074
|
+
return false;
|
|
5075
|
+
}
|
|
4856
5076
|
}
|
|
4857
5077
|
async createDefaultSpace() {
|
|
4858
5078
|
const space = await this.createSpace();
|
|
4859
5079
|
const document = await this._getSpaceRootDocument(space);
|
|
4860
5080
|
const properties = {
|
|
4861
5081
|
system: {
|
|
4862
|
-
type: (0,
|
|
5082
|
+
type: (0, import_echo_protocol3.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
|
|
4863
5083
|
},
|
|
4864
5084
|
data: {
|
|
4865
5085
|
[DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
|
|
@@ -4868,9 +5088,9 @@ var DataSpaceManager = class {
|
|
|
4868
5088
|
keys: []
|
|
4869
5089
|
}
|
|
4870
5090
|
};
|
|
4871
|
-
const propertiesId =
|
|
5091
|
+
const propertiesId = (0, import_echo_schema2.generateEchoId)();
|
|
4872
5092
|
document.change((doc) => {
|
|
4873
|
-
(0,
|
|
5093
|
+
(0, import_util9.assignDeep)(doc, [
|
|
4874
5094
|
"objects",
|
|
4875
5095
|
propertiesId
|
|
4876
5096
|
], properties);
|
|
@@ -4880,9 +5100,9 @@ var DataSpaceManager = class {
|
|
|
4880
5100
|
}
|
|
4881
5101
|
async _getSpaceRootDocument(space) {
|
|
4882
5102
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
4883
|
-
(0,
|
|
4884
|
-
F:
|
|
4885
|
-
L:
|
|
5103
|
+
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5104
|
+
F: __dxlog_file18,
|
|
5105
|
+
L: 271,
|
|
4886
5106
|
S: this,
|
|
4887
5107
|
A: [
|
|
4888
5108
|
"automergeIndex",
|
|
@@ -4895,26 +5115,26 @@ var DataSpaceManager = class {
|
|
|
4895
5115
|
}
|
|
4896
5116
|
// TODO(burdon): Rename join space.
|
|
4897
5117
|
async acceptSpace(opts) {
|
|
4898
|
-
(0,
|
|
5118
|
+
(0, import_log15.log)("accept space", {
|
|
4899
5119
|
opts
|
|
4900
5120
|
}, {
|
|
4901
|
-
F:
|
|
4902
|
-
L:
|
|
5121
|
+
F: __dxlog_file18,
|
|
5122
|
+
L: 280,
|
|
4903
5123
|
S: this,
|
|
4904
5124
|
C: (f, a) => f(...a)
|
|
4905
5125
|
});
|
|
4906
|
-
(0,
|
|
4907
|
-
F:
|
|
4908
|
-
L:
|
|
5126
|
+
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
5127
|
+
F: __dxlog_file18,
|
|
5128
|
+
L: 281,
|
|
4909
5129
|
S: this,
|
|
4910
5130
|
A: [
|
|
4911
5131
|
"this._isOpen",
|
|
4912
5132
|
"'Not open.'"
|
|
4913
5133
|
]
|
|
4914
5134
|
});
|
|
4915
|
-
(0,
|
|
4916
|
-
F:
|
|
4917
|
-
L:
|
|
5135
|
+
(0, import_invariant15.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5136
|
+
F: __dxlog_file18,
|
|
5137
|
+
L: 282,
|
|
4918
5138
|
S: this,
|
|
4919
5139
|
A: [
|
|
4920
5140
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -4934,23 +5154,72 @@ var DataSpaceManager = class {
|
|
|
4934
5154
|
this.updated.emit();
|
|
4935
5155
|
return space;
|
|
4936
5156
|
}
|
|
5157
|
+
async admitMember(options) {
|
|
5158
|
+
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5159
|
+
(0, import_invariant15.invariant)(space, void 0, {
|
|
5160
|
+
F: __dxlog_file18,
|
|
5161
|
+
L: 302,
|
|
5162
|
+
S: this,
|
|
5163
|
+
A: [
|
|
5164
|
+
"space",
|
|
5165
|
+
""
|
|
5166
|
+
]
|
|
5167
|
+
});
|
|
5168
|
+
if (space.spaceState.getMemberRole(options.identityKey) !== import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5169
|
+
throw new import_protocols11.AlreadyJoinedError();
|
|
5170
|
+
}
|
|
5171
|
+
const credentials = await (0, import_credentials15.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5172
|
+
(0, import_invariant15.invariant)(credentials[0].credential, void 0, {
|
|
5173
|
+
F: __dxlog_file18,
|
|
5174
|
+
L: 321,
|
|
5175
|
+
S: this,
|
|
5176
|
+
A: [
|
|
5177
|
+
"credentials[0].credential",
|
|
5178
|
+
""
|
|
5179
|
+
]
|
|
5180
|
+
});
|
|
5181
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5182
|
+
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5183
|
+
F: __dxlog_file18,
|
|
5184
|
+
L: 323,
|
|
5185
|
+
S: this,
|
|
5186
|
+
A: [
|
|
5187
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5188
|
+
""
|
|
5189
|
+
]
|
|
5190
|
+
});
|
|
5191
|
+
await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5192
|
+
return spaceMemberCredential;
|
|
5193
|
+
}
|
|
4937
5194
|
/**
|
|
4938
5195
|
* Wait until the space data pipeline is fully initialized.
|
|
4939
5196
|
* Used by invitation handler.
|
|
4940
5197
|
* TODO(dmaretskyi): Consider removing.
|
|
4941
5198
|
*/
|
|
4942
5199
|
async waitUntilSpaceReady(spaceKey) {
|
|
4943
|
-
await (0,
|
|
5200
|
+
await (0, import_context13.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
4944
5201
|
const space = this._spaces.get(spaceKey);
|
|
4945
|
-
return !!space && space.state ===
|
|
5202
|
+
return !!space && space.state === import_services14.SpaceState.READY;
|
|
4946
5203
|
}));
|
|
4947
5204
|
}
|
|
5205
|
+
async requestSpaceAdmissionCredential(spaceKey) {
|
|
5206
|
+
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
5207
|
+
spaceKey,
|
|
5208
|
+
identityKey: this._signingContext.identityKey,
|
|
5209
|
+
timeout: 15e3,
|
|
5210
|
+
swarmIdentity: {
|
|
5211
|
+
peerKey: this._signingContext.deviceKey,
|
|
5212
|
+
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5213
|
+
credentialAuthenticator: async () => true
|
|
5214
|
+
}
|
|
5215
|
+
});
|
|
5216
|
+
}
|
|
4948
5217
|
async _constructSpace(metadata) {
|
|
4949
|
-
(0,
|
|
5218
|
+
(0, import_log15.log)("construct space", {
|
|
4950
5219
|
metadata
|
|
4951
5220
|
}, {
|
|
4952
|
-
F:
|
|
4953
|
-
L:
|
|
5221
|
+
F: __dxlog_file18,
|
|
5222
|
+
L: 358,
|
|
4954
5223
|
S: this,
|
|
4955
5224
|
C: (f, a) => f(...a)
|
|
4956
5225
|
});
|
|
@@ -4975,9 +5244,10 @@ var DataSpaceManager = class {
|
|
|
4975
5244
|
swarmIdentity: {
|
|
4976
5245
|
peerKey: this._signingContext.deviceKey,
|
|
4977
5246
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
4978
|
-
credentialAuthenticator: (0,
|
|
5247
|
+
credentialAuthenticator: (0, import_util9.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
4979
5248
|
},
|
|
4980
5249
|
onAuthorizedConnection: (session) => {
|
|
5250
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline4.CredentialServerExtension(space));
|
|
4981
5251
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
4982
5252
|
remotePeerId: session.remotePeerId
|
|
4983
5253
|
}));
|
|
@@ -4986,15 +5256,15 @@ var DataSpaceManager = class {
|
|
|
4986
5256
|
session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
|
|
4987
5257
|
},
|
|
4988
5258
|
onAuthFailure: () => {
|
|
4989
|
-
|
|
4990
|
-
F:
|
|
4991
|
-
L:
|
|
5259
|
+
import_log15.log.warn("auth failure", void 0, {
|
|
5260
|
+
F: __dxlog_file18,
|
|
5261
|
+
L: 396,
|
|
4992
5262
|
S: this,
|
|
4993
5263
|
C: (f, a) => f(...a)
|
|
4994
5264
|
});
|
|
4995
5265
|
},
|
|
4996
5266
|
onMemberRolesChanged: async (members) => {
|
|
4997
|
-
if (dataSpace?.state ===
|
|
5267
|
+
if (dataSpace?.state === import_services14.SpaceState.READY) {
|
|
4998
5268
|
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
4999
5269
|
}
|
|
5000
5270
|
},
|
|
@@ -5007,7 +5277,7 @@ var DataSpaceManager = class {
|
|
|
5007
5277
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
5008
5278
|
const dataSpace = new DataSpace({
|
|
5009
5279
|
inner: space,
|
|
5010
|
-
initialState: metadata.state ===
|
|
5280
|
+
initialState: metadata.state === import_services14.SpaceState.INACTIVE ? import_services14.SpaceState.INACTIVE : import_services14.SpaceState.CLOSED,
|
|
5011
5281
|
metadataStore: this._metadataStore,
|
|
5012
5282
|
gossip,
|
|
5013
5283
|
presence,
|
|
@@ -5017,22 +5287,22 @@ var DataSpaceManager = class {
|
|
|
5017
5287
|
signingContext: this._signingContext,
|
|
5018
5288
|
callbacks: {
|
|
5019
5289
|
beforeReady: async () => {
|
|
5020
|
-
(0,
|
|
5290
|
+
(0, import_log15.log)("before space ready", {
|
|
5021
5291
|
space: space.key
|
|
5022
5292
|
}, {
|
|
5023
|
-
F:
|
|
5024
|
-
L:
|
|
5293
|
+
F: __dxlog_file18,
|
|
5294
|
+
L: 423,
|
|
5025
5295
|
S: this,
|
|
5026
5296
|
C: (f, a) => f(...a)
|
|
5027
5297
|
});
|
|
5028
5298
|
},
|
|
5029
5299
|
afterReady: async () => {
|
|
5030
|
-
(0,
|
|
5300
|
+
(0, import_log15.log)("after space ready", {
|
|
5031
5301
|
space: space.key,
|
|
5032
5302
|
open: this._isOpen
|
|
5033
5303
|
}, {
|
|
5034
|
-
F:
|
|
5035
|
-
L:
|
|
5304
|
+
F: __dxlog_file18,
|
|
5305
|
+
L: 426,
|
|
5036
5306
|
S: this,
|
|
5037
5307
|
C: (f, a) => f(...a)
|
|
5038
5308
|
});
|
|
@@ -5047,11 +5317,11 @@ var DataSpaceManager = class {
|
|
|
5047
5317
|
}
|
|
5048
5318
|
},
|
|
5049
5319
|
beforeClose: async () => {
|
|
5050
|
-
(0,
|
|
5320
|
+
(0, import_log15.log)("before space close", {
|
|
5051
5321
|
space: space.key
|
|
5052
5322
|
}, {
|
|
5053
|
-
F:
|
|
5054
|
-
L:
|
|
5323
|
+
F: __dxlog_file18,
|
|
5324
|
+
L: 434,
|
|
5055
5325
|
S: this,
|
|
5056
5326
|
C: (f, a) => f(...a)
|
|
5057
5327
|
});
|
|
@@ -5060,7 +5330,7 @@ var DataSpaceManager = class {
|
|
|
5060
5330
|
cache: metadata.cache
|
|
5061
5331
|
});
|
|
5062
5332
|
presence.newPeer.on((peerState) => {
|
|
5063
|
-
if (dataSpace.state ===
|
|
5333
|
+
if (dataSpace.state === import_services14.SpaceState.READY) {
|
|
5064
5334
|
this._handleNewPeerConnected(space, peerState);
|
|
5065
5335
|
}
|
|
5066
5336
|
});
|
|
@@ -5082,17 +5352,17 @@ var DataSpaceManager = class {
|
|
|
5082
5352
|
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
|
|
5083
5353
|
});
|
|
5084
5354
|
sessionsToClose.forEach((session) => {
|
|
5085
|
-
void session.close().catch(
|
|
5355
|
+
void session.close().catch(import_log15.log.error);
|
|
5086
5356
|
});
|
|
5087
5357
|
closedSessions += sessionsToClose.length;
|
|
5088
5358
|
}
|
|
5089
|
-
(0,
|
|
5359
|
+
(0, import_log15.log)("processed member role changes", {
|
|
5090
5360
|
roleChangeCount: memberInfo.length,
|
|
5091
5361
|
peersOnline: presence.getPeersOnline().length,
|
|
5092
5362
|
closedSessions
|
|
5093
5363
|
}, {
|
|
5094
|
-
F:
|
|
5095
|
-
L:
|
|
5364
|
+
F: __dxlog_file18,
|
|
5365
|
+
L: 470,
|
|
5096
5366
|
S: this,
|
|
5097
5367
|
C: (f, a) => f(...a)
|
|
5098
5368
|
});
|
|
@@ -5103,20 +5373,20 @@ var DataSpaceManager = class {
|
|
|
5103
5373
|
if (role === import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5104
5374
|
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
5105
5375
|
if (session != null) {
|
|
5106
|
-
(0,
|
|
5376
|
+
(0, import_log15.log)("closing a session with a removed peer", {
|
|
5107
5377
|
peerId: peerState.peerId
|
|
5108
5378
|
}, {
|
|
5109
|
-
F:
|
|
5110
|
-
L:
|
|
5379
|
+
F: __dxlog_file18,
|
|
5380
|
+
L: 484,
|
|
5111
5381
|
S: this,
|
|
5112
5382
|
C: (f, a) => f(...a)
|
|
5113
5383
|
});
|
|
5114
|
-
void session.close().catch(
|
|
5384
|
+
void session.close().catch(import_log15.log.error);
|
|
5115
5385
|
}
|
|
5116
5386
|
}
|
|
5117
5387
|
}
|
|
5118
5388
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
5119
|
-
if (dataSpace?.state !==
|
|
5389
|
+
if (dataSpace?.state !== import_services14.SpaceState.READY) {
|
|
5120
5390
|
return;
|
|
5121
5391
|
}
|
|
5122
5392
|
if (isActive) {
|
|
@@ -5133,8 +5403,8 @@ var DataSpaceManager = class {
|
|
|
5133
5403
|
async _createDelegatedInvitations(space, invitations) {
|
|
5134
5404
|
const tasks = invitations.map(([credentialId, invitation]) => {
|
|
5135
5405
|
return this._invitationsManager.createInvitation({
|
|
5136
|
-
type:
|
|
5137
|
-
kind:
|
|
5406
|
+
type: import_services14.Invitation.Type.DELEGATED,
|
|
5407
|
+
kind: import_services14.Invitation.Kind.SPACE,
|
|
5138
5408
|
spaceKey: space.key,
|
|
5139
5409
|
authMethod: invitation.authMethod,
|
|
5140
5410
|
invitationId: invitation.invitationId,
|
|
@@ -5152,21 +5422,21 @@ var DataSpaceManager = class {
|
|
|
5152
5422
|
}
|
|
5153
5423
|
};
|
|
5154
5424
|
_ts_decorate5([
|
|
5155
|
-
|
|
5425
|
+
import_async16.synchronized
|
|
5156
5426
|
], DataSpaceManager.prototype, "open", null);
|
|
5157
5427
|
_ts_decorate5([
|
|
5158
|
-
|
|
5428
|
+
import_async16.synchronized
|
|
5159
5429
|
], DataSpaceManager.prototype, "close", null);
|
|
5160
5430
|
_ts_decorate5([
|
|
5161
|
-
|
|
5431
|
+
import_async16.synchronized
|
|
5162
5432
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
5163
5433
|
_ts_decorate5([
|
|
5164
|
-
|
|
5434
|
+
import_async16.synchronized
|
|
5165
5435
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
5166
5436
|
DataSpaceManager = _ts_decorate5([
|
|
5167
|
-
(0,
|
|
5437
|
+
(0, import_async16.trackLeaks)("open", "close")
|
|
5168
5438
|
], DataSpaceManager);
|
|
5169
|
-
var
|
|
5439
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5170
5440
|
var SpacesServiceImpl = class {
|
|
5171
5441
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5172
5442
|
this._identityManager = _identityManager;
|
|
@@ -5185,10 +5455,10 @@ var SpacesServiceImpl = class {
|
|
|
5185
5455
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5186
5456
|
if (state) {
|
|
5187
5457
|
switch (state) {
|
|
5188
|
-
case
|
|
5458
|
+
case import_services15.SpaceState.ACTIVE:
|
|
5189
5459
|
await space.activate();
|
|
5190
5460
|
break;
|
|
5191
|
-
case
|
|
5461
|
+
case import_services15.SpaceState.INACTIVE:
|
|
5192
5462
|
await space.deactivate();
|
|
5193
5463
|
break;
|
|
5194
5464
|
default:
|
|
@@ -5209,9 +5479,9 @@ var SpacesServiceImpl = class {
|
|
|
5209
5479
|
});
|
|
5210
5480
|
}
|
|
5211
5481
|
const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5212
|
-
(0,
|
|
5213
|
-
F:
|
|
5214
|
-
L:
|
|
5482
|
+
(0, import_invariant16.invariant)(credentials[0].credential, void 0, {
|
|
5483
|
+
F: __dxlog_file19,
|
|
5484
|
+
L: 102,
|
|
5215
5485
|
S: this,
|
|
5216
5486
|
A: [
|
|
5217
5487
|
"credentials[0].credential",
|
|
@@ -5219,27 +5489,27 @@ var SpacesServiceImpl = class {
|
|
|
5219
5489
|
]
|
|
5220
5490
|
});
|
|
5221
5491
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5222
|
-
(0,
|
|
5223
|
-
F:
|
|
5224
|
-
L:
|
|
5492
|
+
(0, import_invariant16.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5493
|
+
F: __dxlog_file19,
|
|
5494
|
+
L: 104,
|
|
5225
5495
|
S: this,
|
|
5226
5496
|
A: [
|
|
5227
5497
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5228
5498
|
""
|
|
5229
5499
|
]
|
|
5230
5500
|
});
|
|
5231
|
-
await (0,
|
|
5501
|
+
await (0, import_feed_store5.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5232
5502
|
}
|
|
5233
5503
|
querySpaces() {
|
|
5234
5504
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
5235
|
-
const scheduler = new
|
|
5505
|
+
const scheduler = new import_async17.UpdateScheduler(ctx, async () => {
|
|
5236
5506
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5237
5507
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
5238
|
-
(0,
|
|
5508
|
+
(0, import_log16.log)("update", {
|
|
5239
5509
|
spaces
|
|
5240
5510
|
}, {
|
|
5241
|
-
F:
|
|
5242
|
-
L:
|
|
5511
|
+
F: __dxlog_file19,
|
|
5512
|
+
L: 115,
|
|
5243
5513
|
S: this,
|
|
5244
5514
|
C: (f, a) => f(...a)
|
|
5245
5515
|
});
|
|
@@ -5250,14 +5520,22 @@ var SpacesServiceImpl = class {
|
|
|
5250
5520
|
}, {
|
|
5251
5521
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
5252
5522
|
});
|
|
5253
|
-
(0,
|
|
5523
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5254
5524
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5255
|
-
const subscriptions = new
|
|
5525
|
+
const subscriptions = new import_async17.EventSubscriptions();
|
|
5256
5526
|
ctx.onDispose(() => subscriptions.clear());
|
|
5257
5527
|
const subscribeSpaces = () => {
|
|
5258
5528
|
subscriptions.clear();
|
|
5259
5529
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
5260
|
-
|
|
5530
|
+
let lastState;
|
|
5531
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => {
|
|
5532
|
+
if (space.state !== lastState) {
|
|
5533
|
+
scheduler.forceTrigger();
|
|
5534
|
+
} else {
|
|
5535
|
+
scheduler.trigger();
|
|
5536
|
+
}
|
|
5537
|
+
lastState = space.state;
|
|
5538
|
+
}));
|
|
5261
5539
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
5262
5540
|
subscriptions.add(space.automergeSpaceState.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
5263
5541
|
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
@@ -5284,7 +5562,7 @@ var SpacesServiceImpl = class {
|
|
|
5284
5562
|
}
|
|
5285
5563
|
subscribeMessages({ spaceKey, channel }) {
|
|
5286
5564
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
5287
|
-
(0,
|
|
5565
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5288
5566
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5289
5567
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5290
5568
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -5303,7 +5581,7 @@ var SpacesServiceImpl = class {
|
|
|
5303
5581
|
}
|
|
5304
5582
|
};
|
|
5305
5583
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
5306
|
-
(0,
|
|
5584
|
+
(0, import_async17.scheduleTask)(ctx, async () => {
|
|
5307
5585
|
await space.spaceState.addCredentialProcessor(processor);
|
|
5308
5586
|
if (noTail) {
|
|
5309
5587
|
close();
|
|
@@ -5321,18 +5599,18 @@ var SpacesServiceImpl = class {
|
|
|
5321
5599
|
}
|
|
5322
5600
|
});
|
|
5323
5601
|
} else {
|
|
5324
|
-
(0,
|
|
5325
|
-
F:
|
|
5326
|
-
L:
|
|
5602
|
+
(0, import_invariant16.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5603
|
+
F: __dxlog_file19,
|
|
5604
|
+
L: 213,
|
|
5327
5605
|
S: this,
|
|
5328
5606
|
A: [
|
|
5329
5607
|
"!credential.id",
|
|
5330
5608
|
"'Id on unsigned credentials is not allowed'"
|
|
5331
5609
|
]
|
|
5332
5610
|
});
|
|
5333
|
-
(0,
|
|
5334
|
-
F:
|
|
5335
|
-
L:
|
|
5611
|
+
(0, import_invariant16.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
5612
|
+
F: __dxlog_file19,
|
|
5613
|
+
L: 214,
|
|
5336
5614
|
S: this,
|
|
5337
5615
|
A: [
|
|
5338
5616
|
"this._identityManager.identity",
|
|
@@ -5340,9 +5618,9 @@ var SpacesServiceImpl = class {
|
|
|
5340
5618
|
]
|
|
5341
5619
|
});
|
|
5342
5620
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5343
|
-
(0,
|
|
5344
|
-
F:
|
|
5345
|
-
L:
|
|
5621
|
+
(0, import_invariant16.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5622
|
+
F: __dxlog_file19,
|
|
5623
|
+
L: 216,
|
|
5346
5624
|
S: this,
|
|
5347
5625
|
A: [
|
|
5348
5626
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5364,10 +5642,66 @@ var SpacesServiceImpl = class {
|
|
|
5364
5642
|
async createEpoch({ spaceKey, migration, automergeRootUrl }) {
|
|
5365
5643
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5366
5644
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5367
|
-
await space.createEpoch({
|
|
5645
|
+
const credential = await space.createEpoch({
|
|
5368
5646
|
migration,
|
|
5369
5647
|
newAutomergeRoot: automergeRootUrl
|
|
5370
5648
|
});
|
|
5649
|
+
return {
|
|
5650
|
+
epochCredential: credential ?? void 0
|
|
5651
|
+
};
|
|
5652
|
+
}
|
|
5653
|
+
async admitContact(request) {
|
|
5654
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5655
|
+
await dataSpaceManager.admitMember({
|
|
5656
|
+
spaceKey: request.spaceKey,
|
|
5657
|
+
identityKey: request.contact.identityKey,
|
|
5658
|
+
role: request.role
|
|
5659
|
+
});
|
|
5660
|
+
}
|
|
5661
|
+
async joinBySpaceKey({ spaceKey }) {
|
|
5662
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5663
|
+
const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
|
|
5664
|
+
return this._joinByAdmission({
|
|
5665
|
+
credential
|
|
5666
|
+
});
|
|
5667
|
+
}
|
|
5668
|
+
async _joinByAdmission({ credential }) {
|
|
5669
|
+
const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
|
|
5670
|
+
(0, import_invariant16.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
5671
|
+
F: __dxlog_file19,
|
|
5672
|
+
L: 250,
|
|
5673
|
+
S: this,
|
|
5674
|
+
A: [
|
|
5675
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5676
|
+
"'Invalid credential'"
|
|
5677
|
+
]
|
|
5678
|
+
});
|
|
5679
|
+
const myIdentity = this._identityManager.identity;
|
|
5680
|
+
(0, import_invariant16.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
5681
|
+
F: __dxlog_file19,
|
|
5682
|
+
L: 252,
|
|
5683
|
+
S: this,
|
|
5684
|
+
A: [
|
|
5685
|
+
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
5686
|
+
""
|
|
5687
|
+
]
|
|
5688
|
+
});
|
|
5689
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5690
|
+
let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
|
|
5691
|
+
if (!dataSpace) {
|
|
5692
|
+
dataSpace = await dataSpaceManager.acceptSpace({
|
|
5693
|
+
spaceKey: assertion.spaceKey,
|
|
5694
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
5695
|
+
});
|
|
5696
|
+
await myIdentity.controlPipeline.writer.write({
|
|
5697
|
+
credential: {
|
|
5698
|
+
credential
|
|
5699
|
+
}
|
|
5700
|
+
});
|
|
5701
|
+
}
|
|
5702
|
+
return {
|
|
5703
|
+
space: this._serializeSpace(dataSpace)
|
|
5704
|
+
};
|
|
5371
5705
|
}
|
|
5372
5706
|
_serializeSpace(space) {
|
|
5373
5707
|
return {
|
|
@@ -5386,7 +5720,8 @@ var SpacesServiceImpl = class {
|
|
|
5386
5720
|
startDataTimeframe: void 0,
|
|
5387
5721
|
currentDataTimeframe: void 0,
|
|
5388
5722
|
targetDataTimeframe: void 0,
|
|
5389
|
-
totalDataTimeframe: void 0
|
|
5723
|
+
totalDataTimeframe: void 0,
|
|
5724
|
+
spaceRootUrl: space.databaseRoot?.url
|
|
5390
5725
|
},
|
|
5391
5726
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
5392
5727
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
@@ -5400,7 +5735,7 @@ var SpacesServiceImpl = class {
|
|
|
5400
5735
|
profile: member.profile ?? {}
|
|
5401
5736
|
},
|
|
5402
5737
|
role: member.role,
|
|
5403
|
-
presence: peers.length > 0 ?
|
|
5738
|
+
presence: peers.length > 0 ? import_services15.SpaceMember.PresenceState.ONLINE : import_services15.SpaceMember.PresenceState.OFFLINE,
|
|
5404
5739
|
peerStates: peers
|
|
5405
5740
|
};
|
|
5406
5741
|
}),
|
|
@@ -5438,8 +5773,8 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5438
5773
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5439
5774
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5440
5775
|
}
|
|
5441
|
-
var
|
|
5442
|
-
var ServiceContext = class extends
|
|
5776
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5777
|
+
var ServiceContext = class extends import_context14.Resource {
|
|
5443
5778
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5444
5779
|
super();
|
|
5445
5780
|
this.storage = storage;
|
|
@@ -5447,24 +5782,24 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5447
5782
|
this.networkManager = networkManager;
|
|
5448
5783
|
this.signalManager = signalManager;
|
|
5449
5784
|
this._runtimeParams = _runtimeParams;
|
|
5450
|
-
this.initialized = new
|
|
5785
|
+
this.initialized = new import_async18.Trigger();
|
|
5451
5786
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5452
5787
|
this._instanceId = import_keys13.PublicKey.random().toHex();
|
|
5453
|
-
this.metadataStore = new
|
|
5454
|
-
this.snapshotStore = new
|
|
5788
|
+
this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
|
|
5789
|
+
this.snapshotStore = new import_echo_pipeline5.SnapshotStore(storage.createDirectory("snapshots"));
|
|
5455
5790
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
5456
5791
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
5457
|
-
this.feedStore = new
|
|
5458
|
-
factory: new
|
|
5792
|
+
this.feedStore = new import_feed_store6.FeedStore({
|
|
5793
|
+
factory: new import_feed_store6.FeedFactory({
|
|
5459
5794
|
root: storage.createDirectory("feeds"),
|
|
5460
5795
|
signer: this.keyring,
|
|
5461
5796
|
hypercore: {
|
|
5462
|
-
valueEncoding:
|
|
5797
|
+
valueEncoding: import_echo_pipeline5.valueEncoding,
|
|
5463
5798
|
stats: true
|
|
5464
5799
|
}
|
|
5465
5800
|
})
|
|
5466
5801
|
});
|
|
5467
|
-
this.spaceManager = new
|
|
5802
|
+
this.spaceManager = new import_echo_pipeline5.SpaceManager({
|
|
5468
5803
|
feedStore: this.feedStore,
|
|
5469
5804
|
networkManager: this.networkManager,
|
|
5470
5805
|
blobStore: this.blobStore,
|
|
@@ -5472,25 +5807,25 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5472
5807
|
snapshotStore: this.snapshotStore
|
|
5473
5808
|
});
|
|
5474
5809
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
5475
|
-
this.echoHost = new
|
|
5810
|
+
this.echoHost = new import_echo_db3.EchoHost({
|
|
5476
5811
|
kv: this.level
|
|
5477
5812
|
});
|
|
5478
5813
|
this.invitations = new InvitationsHandler(this.networkManager, _runtimeParams?.invitationConnectionDefaultParams);
|
|
5479
5814
|
this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
|
|
5480
|
-
this._handlerFactories.set(
|
|
5815
|
+
this._handlerFactories.set(import_services16.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
5481
5816
|
}
|
|
5482
5817
|
async _open(ctx) {
|
|
5483
5818
|
await this._checkStorageVersion();
|
|
5484
|
-
(0,
|
|
5485
|
-
F:
|
|
5819
|
+
(0, import_log17.log)("opening...", void 0, {
|
|
5820
|
+
F: __dxlog_file20,
|
|
5486
5821
|
L: 149,
|
|
5487
5822
|
S: this,
|
|
5488
5823
|
C: (f, a) => f(...a)
|
|
5489
5824
|
});
|
|
5490
|
-
|
|
5825
|
+
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
|
|
5491
5826
|
id: this._instanceId
|
|
5492
5827
|
}), {
|
|
5493
|
-
F:
|
|
5828
|
+
F: __dxlog_file20,
|
|
5494
5829
|
L: 150,
|
|
5495
5830
|
S: this,
|
|
5496
5831
|
C: (f, a) => f(...a)
|
|
@@ -5505,32 +5840,32 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5505
5840
|
await this._initialize(ctx);
|
|
5506
5841
|
}
|
|
5507
5842
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
5508
|
-
(0,
|
|
5843
|
+
(0, import_log17.log)("loaded persistent invitations", {
|
|
5509
5844
|
count: loadedInvitations.invitations?.length
|
|
5510
5845
|
}, {
|
|
5511
|
-
F:
|
|
5846
|
+
F: __dxlog_file20,
|
|
5512
5847
|
L: 163,
|
|
5513
5848
|
S: this,
|
|
5514
5849
|
C: (f, a) => f(...a)
|
|
5515
5850
|
});
|
|
5516
|
-
|
|
5851
|
+
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
|
|
5517
5852
|
id: this._instanceId
|
|
5518
5853
|
}), {
|
|
5519
|
-
F:
|
|
5854
|
+
F: __dxlog_file20,
|
|
5520
5855
|
L: 165,
|
|
5521
5856
|
S: this,
|
|
5522
5857
|
C: (f, a) => f(...a)
|
|
5523
5858
|
});
|
|
5524
|
-
(0,
|
|
5525
|
-
F:
|
|
5859
|
+
(0, import_log17.log)("opened", void 0, {
|
|
5860
|
+
F: __dxlog_file20,
|
|
5526
5861
|
L: 166,
|
|
5527
5862
|
S: this,
|
|
5528
5863
|
C: (f, a) => f(...a)
|
|
5529
5864
|
});
|
|
5530
5865
|
}
|
|
5531
5866
|
async _close(ctx) {
|
|
5532
|
-
(0,
|
|
5533
|
-
F:
|
|
5867
|
+
(0, import_log17.log)("closing...", void 0, {
|
|
5868
|
+
F: __dxlog_file20,
|
|
5534
5869
|
L: 170,
|
|
5535
5870
|
S: this,
|
|
5536
5871
|
C: (f, a) => f(...a)
|
|
@@ -5546,8 +5881,8 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5546
5881
|
await this.echoHost.close(ctx);
|
|
5547
5882
|
await this.networkManager.close();
|
|
5548
5883
|
await this.signalManager.close();
|
|
5549
|
-
(0,
|
|
5550
|
-
F:
|
|
5884
|
+
(0, import_log17.log)("closed", void 0, {
|
|
5885
|
+
F: __dxlog_file20,
|
|
5551
5886
|
L: 182,
|
|
5552
5887
|
S: this,
|
|
5553
5888
|
C: (f, a) => f(...a)
|
|
@@ -5555,13 +5890,16 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5555
5890
|
}
|
|
5556
5891
|
async createIdentity(params = {}) {
|
|
5557
5892
|
const identity = await this.identityManager.createIdentity(params);
|
|
5558
|
-
await this._initialize(new
|
|
5893
|
+
await this._initialize(new import_context14.Context(void 0, {
|
|
5894
|
+
F: __dxlog_file20,
|
|
5895
|
+
L: 187
|
|
5896
|
+
}));
|
|
5559
5897
|
return identity;
|
|
5560
5898
|
}
|
|
5561
5899
|
getInvitationHandler(invitation) {
|
|
5562
5900
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5563
|
-
(0,
|
|
5564
|
-
F:
|
|
5901
|
+
(0, import_invariant17.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5902
|
+
F: __dxlog_file20,
|
|
5565
5903
|
L: 193,
|
|
5566
5904
|
S: this,
|
|
5567
5905
|
A: [
|
|
@@ -5581,7 +5919,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5581
5919
|
}
|
|
5582
5920
|
async _acceptIdentity(params) {
|
|
5583
5921
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5584
|
-
await this._initialize(new
|
|
5922
|
+
await this._initialize(new import_context14.Context(void 0, {
|
|
5923
|
+
F: __dxlog_file20,
|
|
5924
|
+
L: 209
|
|
5925
|
+
}));
|
|
5585
5926
|
return identity;
|
|
5586
5927
|
}
|
|
5587
5928
|
async _checkStorageVersion() {
|
|
@@ -5592,8 +5933,8 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5592
5933
|
}
|
|
5593
5934
|
// Called when identity is created.
|
|
5594
5935
|
async _initialize(ctx) {
|
|
5595
|
-
(0,
|
|
5596
|
-
F:
|
|
5936
|
+
(0, import_log17.log)("initializing spaces...", void 0, {
|
|
5937
|
+
F: __dxlog_file20,
|
|
5597
5938
|
L: 224,
|
|
5598
5939
|
S: this,
|
|
5599
5940
|
C: (f, a) => f(...a)
|
|
@@ -5614,9 +5955,9 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5614
5955
|
};
|
|
5615
5956
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.echoHost, this.invitationsManager, this._runtimeParams);
|
|
5616
5957
|
await this.dataSpaceManager.open();
|
|
5617
|
-
this._handlerFactories.set(
|
|
5618
|
-
(0,
|
|
5619
|
-
F:
|
|
5958
|
+
this._handlerFactories.set(import_services16.Invitation.Kind.SPACE, (invitation) => {
|
|
5959
|
+
(0, import_invariant17.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5960
|
+
F: __dxlog_file20,
|
|
5620
5961
|
L: 249,
|
|
5621
5962
|
S: this,
|
|
5622
5963
|
A: [
|
|
@@ -5637,10 +5978,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5637
5978
|
return;
|
|
5638
5979
|
}
|
|
5639
5980
|
if (!this.dataSpaceManager) {
|
|
5640
|
-
(0,
|
|
5981
|
+
(0, import_log17.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5641
5982
|
details: assertion
|
|
5642
5983
|
}, {
|
|
5643
|
-
F:
|
|
5984
|
+
F: __dxlog_file20,
|
|
5644
5985
|
L: 265,
|
|
5645
5986
|
S: this,
|
|
5646
5987
|
C: (f, a) => f(...a)
|
|
@@ -5648,10 +5989,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5648
5989
|
return;
|
|
5649
5990
|
}
|
|
5650
5991
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
5651
|
-
(0,
|
|
5992
|
+
(0, import_log17.log)("space already exists, ignoring space admission", {
|
|
5652
5993
|
details: assertion
|
|
5653
5994
|
}, {
|
|
5654
|
-
F:
|
|
5995
|
+
F: __dxlog_file20,
|
|
5655
5996
|
L: 269,
|
|
5656
5997
|
S: this,
|
|
5657
5998
|
C: (f, a) => f(...a)
|
|
@@ -5659,10 +6000,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5659
6000
|
return;
|
|
5660
6001
|
}
|
|
5661
6002
|
try {
|
|
5662
|
-
(0,
|
|
6003
|
+
(0, import_log17.log)("accepting space recorded in halo", {
|
|
5663
6004
|
details: assertion
|
|
5664
6005
|
}, {
|
|
5665
|
-
F:
|
|
6006
|
+
F: __dxlog_file20,
|
|
5666
6007
|
L: 274,
|
|
5667
6008
|
S: this,
|
|
5668
6009
|
C: (f, a) => f(...a)
|
|
@@ -5672,8 +6013,8 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5672
6013
|
genesisFeedKey: assertion.genesisFeedKey
|
|
5673
6014
|
});
|
|
5674
6015
|
} catch (err) {
|
|
5675
|
-
|
|
5676
|
-
F:
|
|
6016
|
+
import_log17.log.catch(err, void 0, {
|
|
6017
|
+
F: __dxlog_file20,
|
|
5677
6018
|
L: 280,
|
|
5678
6019
|
S: this,
|
|
5679
6020
|
C: (f, a) => f(...a)
|
|
@@ -5691,7 +6032,7 @@ _ts_decorate6([
|
|
|
5691
6032
|
import_tracing8.trace.span()
|
|
5692
6033
|
], ServiceContext.prototype, "_initialize", null);
|
|
5693
6034
|
ServiceContext = _ts_decorate6([
|
|
5694
|
-
(0,
|
|
6035
|
+
(0, import_util10.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
5695
6036
|
import_tracing8.trace.resource()
|
|
5696
6037
|
], ServiceContext);
|
|
5697
6038
|
var ServiceRegistry = class {
|
|
@@ -5726,7 +6067,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5726
6067
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5727
6068
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5728
6069
|
}
|
|
5729
|
-
var
|
|
6070
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
5730
6071
|
var Lock = class {
|
|
5731
6072
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
5732
6073
|
this._lockPath = lockPath;
|
|
@@ -5737,16 +6078,16 @@ var Lock = class {
|
|
|
5737
6078
|
return this._lockPath;
|
|
5738
6079
|
}
|
|
5739
6080
|
async acquire() {
|
|
5740
|
-
(0,
|
|
5741
|
-
F:
|
|
6081
|
+
(0, import_log18.log)("acquiring lock...", void 0, {
|
|
6082
|
+
F: __dxlog_file21,
|
|
5742
6083
|
L: 32,
|
|
5743
6084
|
S: this,
|
|
5744
6085
|
C: (f, a) => f(...a)
|
|
5745
6086
|
});
|
|
5746
6087
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
5747
6088
|
await this._onAcquire?.();
|
|
5748
|
-
(0,
|
|
5749
|
-
F:
|
|
6089
|
+
(0, import_log18.log)("acquired lock", void 0, {
|
|
6090
|
+
F: __dxlog_file21,
|
|
5750
6091
|
L: 37,
|
|
5751
6092
|
S: this,
|
|
5752
6093
|
C: (f, a) => f(...a)
|
|
@@ -5754,8 +6095,8 @@ var Lock = class {
|
|
|
5754
6095
|
}
|
|
5755
6096
|
async release() {
|
|
5756
6097
|
await this._onRelease?.();
|
|
5757
|
-
(0,
|
|
5758
|
-
F:
|
|
6098
|
+
(0, import_invariant18.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
6099
|
+
F: __dxlog_file21,
|
|
5759
6100
|
L: 42,
|
|
5760
6101
|
S: this,
|
|
5761
6102
|
A: [
|
|
@@ -5767,11 +6108,11 @@ var Lock = class {
|
|
|
5767
6108
|
}
|
|
5768
6109
|
};
|
|
5769
6110
|
_ts_decorate7([
|
|
5770
|
-
|
|
6111
|
+
import_log18.logInfo
|
|
5771
6112
|
], Lock.prototype, "lockKey", null);
|
|
5772
6113
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
5773
6114
|
var getRootPath = (config) => {
|
|
5774
|
-
const { dataRoot = (0,
|
|
6115
|
+
const { dataRoot = (0, import_util11.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5775
6116
|
return `${dataRoot}/`;
|
|
5776
6117
|
};
|
|
5777
6118
|
var isPersistent = (config) => {
|
|
@@ -5827,7 +6168,159 @@ var createLevel = async (config) => {
|
|
|
5827
6168
|
await level.open();
|
|
5828
6169
|
return level;
|
|
5829
6170
|
};
|
|
5830
|
-
var
|
|
6171
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6172
|
+
var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
|
|
6173
|
+
var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
|
|
6174
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
6175
|
+
const archive = {
|
|
6176
|
+
storage: [],
|
|
6177
|
+
meta: {
|
|
6178
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6179
|
+
}
|
|
6180
|
+
};
|
|
6181
|
+
{
|
|
6182
|
+
const directory = await storage.createDirectory();
|
|
6183
|
+
const files = await directory.list();
|
|
6184
|
+
import_log19.log.info("begin exporting files", {
|
|
6185
|
+
count: files.length
|
|
6186
|
+
}, {
|
|
6187
|
+
F: __dxlog_file22,
|
|
6188
|
+
L: 30,
|
|
6189
|
+
S: void 0,
|
|
6190
|
+
C: (f, a) => f(...a)
|
|
6191
|
+
});
|
|
6192
|
+
for (const filename of files) {
|
|
6193
|
+
const file = await directory.getOrCreateFile(filename);
|
|
6194
|
+
const { size } = await file.stat();
|
|
6195
|
+
const data = await file.read(0, size);
|
|
6196
|
+
archive.storage.push({
|
|
6197
|
+
type: import_protocols15.ProfileArchiveEntryType.FILE,
|
|
6198
|
+
key: filename,
|
|
6199
|
+
value: data
|
|
6200
|
+
});
|
|
6201
|
+
}
|
|
6202
|
+
import_log19.log.info("done exporting files", {
|
|
6203
|
+
count: files.length
|
|
6204
|
+
}, {
|
|
6205
|
+
F: __dxlog_file22,
|
|
6206
|
+
L: 41,
|
|
6207
|
+
S: void 0,
|
|
6208
|
+
C: (f, a) => f(...a)
|
|
6209
|
+
});
|
|
6210
|
+
}
|
|
6211
|
+
{
|
|
6212
|
+
import_log19.log.info("begin exporting kv pairs", void 0, {
|
|
6213
|
+
F: __dxlog_file22,
|
|
6214
|
+
L: 45,
|
|
6215
|
+
S: void 0,
|
|
6216
|
+
C: (f, a) => f(...a)
|
|
6217
|
+
});
|
|
6218
|
+
const iter = await level.iterator({
|
|
6219
|
+
keyEncoding: "binary",
|
|
6220
|
+
valueEncoding: "binary"
|
|
6221
|
+
});
|
|
6222
|
+
let count = 0;
|
|
6223
|
+
for await (const [key, value] of iter) {
|
|
6224
|
+
archive.storage.push({
|
|
6225
|
+
type: import_protocols15.ProfileArchiveEntryType.KEY_VALUE,
|
|
6226
|
+
key,
|
|
6227
|
+
value
|
|
6228
|
+
});
|
|
6229
|
+
count++;
|
|
6230
|
+
}
|
|
6231
|
+
import_log19.log.info("done exporting kv pairs", {
|
|
6232
|
+
count
|
|
6233
|
+
}, {
|
|
6234
|
+
F: __dxlog_file22,
|
|
6235
|
+
L: 56,
|
|
6236
|
+
S: void 0,
|
|
6237
|
+
C: (f, a) => f(...a)
|
|
6238
|
+
});
|
|
6239
|
+
}
|
|
6240
|
+
return archive;
|
|
6241
|
+
};
|
|
6242
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
6243
|
+
let batch = level.batch();
|
|
6244
|
+
let count = 0;
|
|
6245
|
+
for (const entry2 of archive.storage) {
|
|
6246
|
+
switch (entry2.type) {
|
|
6247
|
+
case import_protocols15.ProfileArchiveEntryType.FILE: {
|
|
6248
|
+
const directory = await storage.createDirectory();
|
|
6249
|
+
(0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
6250
|
+
F: __dxlog_file22,
|
|
6251
|
+
L: 79,
|
|
6252
|
+
S: void 0,
|
|
6253
|
+
A: [
|
|
6254
|
+
"typeof entry.key === 'string'",
|
|
6255
|
+
"'Invalid key type'"
|
|
6256
|
+
]
|
|
6257
|
+
});
|
|
6258
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
6259
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6260
|
+
F: __dxlog_file22,
|
|
6261
|
+
L: 81,
|
|
6262
|
+
S: void 0,
|
|
6263
|
+
A: [
|
|
6264
|
+
"entry.value instanceof Uint8Array",
|
|
6265
|
+
"'Invalid value type'"
|
|
6266
|
+
]
|
|
6267
|
+
});
|
|
6268
|
+
await file.write(0, (0, import_util12.arrayToBuffer)(entry2.value));
|
|
6269
|
+
await file.close();
|
|
6270
|
+
break;
|
|
6271
|
+
}
|
|
6272
|
+
case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
|
|
6273
|
+
(0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6274
|
+
F: __dxlog_file22,
|
|
6275
|
+
L: 87,
|
|
6276
|
+
S: void 0,
|
|
6277
|
+
A: [
|
|
6278
|
+
"entry.key instanceof Uint8Array",
|
|
6279
|
+
"'Invalid key type'"
|
|
6280
|
+
]
|
|
6281
|
+
});
|
|
6282
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6283
|
+
F: __dxlog_file22,
|
|
6284
|
+
L: 88,
|
|
6285
|
+
S: void 0,
|
|
6286
|
+
A: [
|
|
6287
|
+
"entry.value instanceof Uint8Array",
|
|
6288
|
+
"'Invalid value type'"
|
|
6289
|
+
]
|
|
6290
|
+
});
|
|
6291
|
+
batch.put(entry2.key, entry2.value, {
|
|
6292
|
+
keyEncoding: "binary",
|
|
6293
|
+
valueEncoding: "binary"
|
|
6294
|
+
});
|
|
6295
|
+
break;
|
|
6296
|
+
}
|
|
6297
|
+
default:
|
|
6298
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6299
|
+
}
|
|
6300
|
+
if (++count % 1e3 === 0) {
|
|
6301
|
+
await batch.write();
|
|
6302
|
+
batch = level.batch();
|
|
6303
|
+
import_log19.log.info("importing", {
|
|
6304
|
+
count,
|
|
6305
|
+
total: archive.storage.length,
|
|
6306
|
+
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
6307
|
+
}, {
|
|
6308
|
+
F: __dxlog_file22,
|
|
6309
|
+
L: 101,
|
|
6310
|
+
S: void 0,
|
|
6311
|
+
C: (f, a) => f(...a)
|
|
6312
|
+
});
|
|
6313
|
+
}
|
|
6314
|
+
}
|
|
6315
|
+
import_log19.log.info("committing changes..", void 0, {
|
|
6316
|
+
F: __dxlog_file22,
|
|
6317
|
+
L: 109,
|
|
6318
|
+
S: void 0,
|
|
6319
|
+
C: (f, a) => f(...a)
|
|
6320
|
+
});
|
|
6321
|
+
await batch.write();
|
|
6322
|
+
};
|
|
6323
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
5831
6324
|
var DevicesServiceImpl = class {
|
|
5832
6325
|
constructor(_identityManager) {
|
|
5833
6326
|
this._identityManager = _identityManager;
|
|
@@ -5844,8 +6337,8 @@ var DevicesServiceImpl = class {
|
|
|
5844
6337
|
devices: []
|
|
5845
6338
|
});
|
|
5846
6339
|
} else {
|
|
5847
|
-
(0,
|
|
5848
|
-
F:
|
|
6340
|
+
(0, import_invariant21.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
6341
|
+
F: __dxlog_file23,
|
|
5849
6342
|
L: 32,
|
|
5850
6343
|
S: this,
|
|
5851
6344
|
A: [
|
|
@@ -5860,9 +6353,9 @@ var DevicesServiceImpl = class {
|
|
|
5860
6353
|
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
5861
6354
|
return {
|
|
5862
6355
|
deviceKey: key,
|
|
5863
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
6356
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services18.DeviceKind.CURRENT : import_services18.DeviceKind.TRUSTED,
|
|
5864
6357
|
profile,
|
|
5865
|
-
presence: isMe ?
|
|
6358
|
+
presence: isMe ? import_services18.Device.PresenceState.ONLINE : peerState ? import_services18.Device.PresenceState.ONLINE : import_services18.Device.PresenceState.OFFLINE
|
|
5866
6359
|
};
|
|
5867
6360
|
})
|
|
5868
6361
|
});
|
|
@@ -5886,7 +6379,7 @@ var DevicesServiceImpl = class {
|
|
|
5886
6379
|
presenceSubscribed = true;
|
|
5887
6380
|
}
|
|
5888
6381
|
};
|
|
5889
|
-
const subscriptions = new
|
|
6382
|
+
const subscriptions = new import_async20.EventSubscriptions();
|
|
5890
6383
|
if (this._identityManager.identity) {
|
|
5891
6384
|
subscribeIdentity();
|
|
5892
6385
|
subscribePresence();
|
|
@@ -5911,7 +6404,7 @@ var DiagnosticsCollector = class {
|
|
|
5911
6404
|
}
|
|
5912
6405
|
static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
|
|
5913
6406
|
const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
|
|
5914
|
-
keys: options.humanize ?
|
|
6407
|
+
keys: options.humanize ? import_services19.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services19.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
|
|
5915
6408
|
}, {
|
|
5916
6409
|
timeout: GET_DIAGNOSTICS_RPC_TIMEOUT
|
|
5917
6410
|
});
|
|
@@ -5926,7 +6419,7 @@ var DiagnosticsCollector = class {
|
|
|
5926
6419
|
client: clientDiagnostics,
|
|
5927
6420
|
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
5928
6421
|
};
|
|
5929
|
-
return JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6422
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util13.jsonKeyReplacer)(options)));
|
|
5930
6423
|
}
|
|
5931
6424
|
};
|
|
5932
6425
|
var findSystemServiceProvider = () => {
|
|
@@ -5936,35 +6429,112 @@ var findSystemServiceProvider = () => {
|
|
|
5936
6429
|
};
|
|
5937
6430
|
var findConfigs = () => {
|
|
5938
6431
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
5939
|
-
return configs.map((r) => r.instance.deref()).filter(
|
|
6432
|
+
return configs.map((r) => r.instance.deref()).filter(import_util13.nonNullable);
|
|
6433
|
+
};
|
|
6434
|
+
var ContactsServiceImpl = class {
|
|
6435
|
+
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
6436
|
+
this._identityManager = _identityManager;
|
|
6437
|
+
this._spaceManager = _spaceManager;
|
|
6438
|
+
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
6439
|
+
}
|
|
6440
|
+
async getContacts() {
|
|
6441
|
+
const identity = this._identityManager.identity;
|
|
6442
|
+
if (identity == null) {
|
|
6443
|
+
return {
|
|
6444
|
+
contacts: []
|
|
6445
|
+
};
|
|
6446
|
+
}
|
|
6447
|
+
const contacts = [
|
|
6448
|
+
...this._spaceManager.spaces.values()
|
|
6449
|
+
].flatMap((s) => [
|
|
6450
|
+
...s.spaceState.members.values()
|
|
6451
|
+
].map((m) => [
|
|
6452
|
+
s.key,
|
|
6453
|
+
m
|
|
6454
|
+
])).reduce((acc, v) => {
|
|
6455
|
+
const [spaceKey, memberInfo] = v;
|
|
6456
|
+
if (memberInfo.key.equals(identity.identityKey)) {
|
|
6457
|
+
return acc;
|
|
6458
|
+
}
|
|
6459
|
+
const existing = acc.get(memberInfo.key);
|
|
6460
|
+
if (existing != null) {
|
|
6461
|
+
existing.profile ??= memberInfo.profile;
|
|
6462
|
+
existing.commonSpaces?.push(spaceKey);
|
|
6463
|
+
} else {
|
|
6464
|
+
acc.set(memberInfo.key, {
|
|
6465
|
+
identityKey: memberInfo.key,
|
|
6466
|
+
profile: memberInfo.profile,
|
|
6467
|
+
commonSpaces: [
|
|
6468
|
+
spaceKey
|
|
6469
|
+
]
|
|
6470
|
+
});
|
|
6471
|
+
}
|
|
6472
|
+
return acc;
|
|
6473
|
+
}, new import_util15.ComplexMap(import_keys17.PublicKey.hash));
|
|
6474
|
+
return {
|
|
6475
|
+
contacts: [
|
|
6476
|
+
...contacts.values()
|
|
6477
|
+
]
|
|
6478
|
+
};
|
|
6479
|
+
}
|
|
6480
|
+
queryContacts() {
|
|
6481
|
+
const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys17.PublicKey.hash);
|
|
6482
|
+
return new import_codec_protobuf13.Stream(({ next, ctx }) => {
|
|
6483
|
+
const pushUpdateTask = new import_async21.UpdateScheduler(ctx, async () => {
|
|
6484
|
+
const contacts = await this.getContacts();
|
|
6485
|
+
next(contacts);
|
|
6486
|
+
}, {
|
|
6487
|
+
maxFrequency: 2
|
|
6488
|
+
});
|
|
6489
|
+
(0, import_async21.scheduleTask)(ctx, async () => {
|
|
6490
|
+
const subscriptions = new import_async21.EventSubscriptions();
|
|
6491
|
+
ctx.onDispose(() => subscriptions.clear());
|
|
6492
|
+
const subscribeToSpaceAndUpdate = () => {
|
|
6493
|
+
const oldSetSize = subscribedSpaceKeySet.size;
|
|
6494
|
+
for (const space of this._spaceManager.spaces.values()) {
|
|
6495
|
+
if (!subscribedSpaceKeySet.has(space.key)) {
|
|
6496
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
|
|
6497
|
+
subscribedSpaceKeySet.add(space.key);
|
|
6498
|
+
}
|
|
6499
|
+
}
|
|
6500
|
+
if (oldSetSize !== subscribedSpaceKeySet.size) {
|
|
6501
|
+
pushUpdateTask.trigger();
|
|
6502
|
+
}
|
|
6503
|
+
};
|
|
6504
|
+
const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
|
|
6505
|
+
ctx.onDispose(unsubscribe);
|
|
6506
|
+
subscribeToSpaceAndUpdate();
|
|
6507
|
+
});
|
|
6508
|
+
});
|
|
6509
|
+
}
|
|
5940
6510
|
};
|
|
5941
6511
|
var LoggingServiceImpl = class {
|
|
5942
6512
|
constructor() {
|
|
5943
|
-
this._logs = new
|
|
6513
|
+
this._logs = new import_async22.Event();
|
|
5944
6514
|
this._started = Date.now();
|
|
5945
|
-
this._sessionId =
|
|
6515
|
+
this._sessionId = import_keys18.PublicKey.random().toHex();
|
|
5946
6516
|
this._logProcessor = (_config, entry2) => {
|
|
5947
6517
|
this._logs.emit(entry2);
|
|
5948
6518
|
};
|
|
5949
6519
|
}
|
|
5950
6520
|
async open() {
|
|
5951
|
-
|
|
6521
|
+
import_log21.log.runtimeConfig.processors.push(this._logProcessor);
|
|
5952
6522
|
}
|
|
5953
6523
|
async close() {
|
|
5954
|
-
const index =
|
|
5955
|
-
|
|
6524
|
+
const index = import_log21.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6525
|
+
import_log21.log.runtimeConfig.processors.splice(index, 1);
|
|
5956
6526
|
}
|
|
5957
6527
|
async controlMetrics({ reset, record }) {
|
|
5958
6528
|
if (reset) {
|
|
5959
|
-
|
|
6529
|
+
import_util16.tracer.clear();
|
|
5960
6530
|
}
|
|
5961
6531
|
if (record === true) {
|
|
5962
|
-
|
|
6532
|
+
import_util16.tracer.start();
|
|
5963
6533
|
} else if (record === false) {
|
|
5964
|
-
|
|
6534
|
+
import_util16.tracer.stop();
|
|
5965
6535
|
}
|
|
5966
6536
|
return {
|
|
5967
|
-
recording:
|
|
6537
|
+
recording: import_util16.tracer.recording
|
|
5968
6538
|
};
|
|
5969
6539
|
}
|
|
5970
6540
|
/**
|
|
@@ -5972,13 +6542,13 @@ var LoggingServiceImpl = class {
|
|
|
5972
6542
|
*/
|
|
5973
6543
|
queryMetrics({ interval = 5e3 }) {
|
|
5974
6544
|
const getNumericalValues = (key) => {
|
|
5975
|
-
const events =
|
|
6545
|
+
const events = import_util16.tracer.get(key) ?? [];
|
|
5976
6546
|
return {
|
|
5977
6547
|
key,
|
|
5978
|
-
stats: (0,
|
|
6548
|
+
stats: (0, import_util16.numericalValues)(events, "duration")
|
|
5979
6549
|
};
|
|
5980
6550
|
};
|
|
5981
|
-
return new
|
|
6551
|
+
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
5982
6552
|
const update = () => {
|
|
5983
6553
|
const metrics = {
|
|
5984
6554
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6000,7 +6570,7 @@ var LoggingServiceImpl = class {
|
|
|
6000
6570
|
});
|
|
6001
6571
|
}
|
|
6002
6572
|
queryLogs(request) {
|
|
6003
|
-
return new
|
|
6573
|
+
return new import_codec_protobuf14.Stream(({ ctx, next }) => {
|
|
6004
6574
|
const handler = (entry2) => {
|
|
6005
6575
|
if (LOG_PROCESSING > 0) {
|
|
6006
6576
|
return;
|
|
@@ -6013,7 +6583,7 @@ var LoggingServiceImpl = class {
|
|
|
6013
6583
|
}
|
|
6014
6584
|
const record = {
|
|
6015
6585
|
...entry2,
|
|
6016
|
-
context: (0,
|
|
6586
|
+
context: (0, import_util16.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
|
|
6017
6587
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6018
6588
|
meta: {
|
|
6019
6589
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -6022,7 +6592,7 @@ var LoggingServiceImpl = class {
|
|
|
6022
6592
|
scope: {
|
|
6023
6593
|
hostSessionId: this._sessionId,
|
|
6024
6594
|
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
6025
|
-
name: (0,
|
|
6595
|
+
name: (0, import_util16.getDebugName)(entry2.meta?.S)
|
|
6026
6596
|
}
|
|
6027
6597
|
}
|
|
6028
6598
|
};
|
|
@@ -6039,16 +6609,16 @@ var LoggingServiceImpl = class {
|
|
|
6039
6609
|
};
|
|
6040
6610
|
var matchFilter = (filter, level, path2, options) => {
|
|
6041
6611
|
switch (options) {
|
|
6042
|
-
case
|
|
6612
|
+
case import_services20.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
6043
6613
|
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
6044
|
-
case
|
|
6614
|
+
case import_services20.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
6045
6615
|
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
6046
6616
|
}
|
|
6047
6617
|
};
|
|
6048
6618
|
var shouldLog = (entry2, request) => {
|
|
6049
|
-
const options = request.options ??
|
|
6619
|
+
const options = request.options ?? import_services20.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
6050
6620
|
if (request.filters === void 0) {
|
|
6051
|
-
return options ===
|
|
6621
|
+
return options === import_services20.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
6052
6622
|
} else {
|
|
6053
6623
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
6054
6624
|
}
|
|
@@ -6060,7 +6630,7 @@ var NetworkServiceImpl = class {
|
|
|
6060
6630
|
this.signalManager = signalManager;
|
|
6061
6631
|
}
|
|
6062
6632
|
queryStatus() {
|
|
6063
|
-
return new
|
|
6633
|
+
return new import_codec_protobuf15.Stream(({ next }) => {
|
|
6064
6634
|
const update = () => {
|
|
6065
6635
|
next({
|
|
6066
6636
|
swarm: this.networkManager.connectionState,
|
|
@@ -6103,9 +6673,9 @@ var SystemServiceImpl = class {
|
|
|
6103
6673
|
const diagnostics = await this._getDiagnostics();
|
|
6104
6674
|
return {
|
|
6105
6675
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6106
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6107
|
-
truncate: keys ===
|
|
6108
|
-
humanize: keys ===
|
|
6676
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
|
|
6677
|
+
truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
6678
|
+
humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
6109
6679
|
})))
|
|
6110
6680
|
};
|
|
6111
6681
|
}
|
|
@@ -6117,7 +6687,7 @@ var SystemServiceImpl = class {
|
|
|
6117
6687
|
}
|
|
6118
6688
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6119
6689
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6120
|
-
return new
|
|
6690
|
+
return new import_codec_protobuf16.Stream(({ next }) => {
|
|
6121
6691
|
const update = () => {
|
|
6122
6692
|
next({
|
|
6123
6693
|
status: this._getCurrentStatus()
|
|
@@ -6146,7 +6716,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6146
6716
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6147
6717
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6148
6718
|
}
|
|
6149
|
-
var
|
|
6719
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6150
6720
|
var ClientServicesHost = class {
|
|
6151
6721
|
constructor({
|
|
6152
6722
|
config,
|
|
@@ -6160,7 +6730,7 @@ var ClientServicesHost = class {
|
|
|
6160
6730
|
runtimeParams
|
|
6161
6731
|
} = {}) {
|
|
6162
6732
|
this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
|
|
6163
|
-
this._statusUpdate = new
|
|
6733
|
+
this._statusUpdate = new import_async19.Event();
|
|
6164
6734
|
this._opening = false;
|
|
6165
6735
|
this._open = false;
|
|
6166
6736
|
this._storage = storage;
|
|
@@ -6179,7 +6749,10 @@ var ClientServicesHost = class {
|
|
|
6179
6749
|
lockKey,
|
|
6180
6750
|
onAcquire: () => {
|
|
6181
6751
|
if (!this._opening) {
|
|
6182
|
-
void this.open(new
|
|
6752
|
+
void this.open(new import_context15.Context(void 0, {
|
|
6753
|
+
F: __dxlog_file24,
|
|
6754
|
+
L: 121
|
|
6755
|
+
}));
|
|
6183
6756
|
}
|
|
6184
6757
|
},
|
|
6185
6758
|
onRelease: () => this.close()
|
|
@@ -6188,14 +6761,14 @@ var ClientServicesHost = class {
|
|
|
6188
6761
|
this._systemService = new SystemServiceImpl({
|
|
6189
6762
|
config: () => this._config,
|
|
6190
6763
|
statusUpdate: this._statusUpdate,
|
|
6191
|
-
getCurrentStatus: () => this.isOpen ?
|
|
6764
|
+
getCurrentStatus: () => this.isOpen ? import_services17.SystemStatus.ACTIVE : import_services17.SystemStatus.INACTIVE,
|
|
6192
6765
|
getDiagnostics: () => {
|
|
6193
6766
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
6194
6767
|
},
|
|
6195
6768
|
onUpdateStatus: async (status) => {
|
|
6196
|
-
if (!this.isOpen && status ===
|
|
6769
|
+
if (!this.isOpen && status === import_services17.SystemStatus.ACTIVE) {
|
|
6197
6770
|
await this._resourceLock?.acquire();
|
|
6198
|
-
} else if (this.isOpen && status ===
|
|
6771
|
+
} else if (this.isOpen && status === import_services17.SystemStatus.INACTIVE) {
|
|
6199
6772
|
await this._resourceLock?.release();
|
|
6200
6773
|
}
|
|
6201
6774
|
},
|
|
@@ -6234,25 +6807,25 @@ var ClientServicesHost = class {
|
|
|
6234
6807
|
* Can only be called once.
|
|
6235
6808
|
*/
|
|
6236
6809
|
initialize({ config, ...options }) {
|
|
6237
|
-
(0,
|
|
6238
|
-
F:
|
|
6239
|
-
L:
|
|
6810
|
+
(0, import_invariant20.invariant)(!this._open, "service host is open", {
|
|
6811
|
+
F: __dxlog_file24,
|
|
6812
|
+
L: 187,
|
|
6240
6813
|
S: this,
|
|
6241
6814
|
A: [
|
|
6242
6815
|
"!this._open",
|
|
6243
6816
|
"'service host is open'"
|
|
6244
6817
|
]
|
|
6245
6818
|
});
|
|
6246
|
-
(0,
|
|
6247
|
-
F:
|
|
6248
|
-
L:
|
|
6819
|
+
(0, import_log20.log)("initializing...", void 0, {
|
|
6820
|
+
F: __dxlog_file24,
|
|
6821
|
+
L: 188,
|
|
6249
6822
|
S: this,
|
|
6250
6823
|
C: (f, a) => f(...a)
|
|
6251
6824
|
});
|
|
6252
6825
|
if (config) {
|
|
6253
|
-
(0,
|
|
6254
|
-
F:
|
|
6255
|
-
L:
|
|
6826
|
+
(0, import_invariant20.invariant)(!this._config, "config already set", {
|
|
6827
|
+
F: __dxlog_file24,
|
|
6828
|
+
L: 191,
|
|
6256
6829
|
S: this,
|
|
6257
6830
|
A: [
|
|
6258
6831
|
"!this._config",
|
|
@@ -6265,9 +6838,9 @@ var ClientServicesHost = class {
|
|
|
6265
6838
|
}
|
|
6266
6839
|
}
|
|
6267
6840
|
if (!options.signalManager) {
|
|
6268
|
-
|
|
6269
|
-
F:
|
|
6270
|
-
L:
|
|
6841
|
+
import_log20.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
6842
|
+
F: __dxlog_file24,
|
|
6843
|
+
L: 199,
|
|
6271
6844
|
S: this,
|
|
6272
6845
|
C: (f, a) => f(...a)
|
|
6273
6846
|
});
|
|
@@ -6276,9 +6849,9 @@ var ClientServicesHost = class {
|
|
|
6276
6849
|
iceServers: this._config?.get("runtime.services.ice")
|
|
6277
6850
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6278
6851
|
this._signalManager = signalManager;
|
|
6279
|
-
(0,
|
|
6280
|
-
F:
|
|
6281
|
-
L:
|
|
6852
|
+
(0, import_invariant20.invariant)(!this._networkManager, "network manager already set", {
|
|
6853
|
+
F: __dxlog_file24,
|
|
6854
|
+
L: 210,
|
|
6282
6855
|
S: this,
|
|
6283
6856
|
A: [
|
|
6284
6857
|
"!this._networkManager",
|
|
@@ -6290,9 +6863,9 @@ var ClientServicesHost = class {
|
|
|
6290
6863
|
transportFactory,
|
|
6291
6864
|
signalManager
|
|
6292
6865
|
});
|
|
6293
|
-
(0,
|
|
6294
|
-
F:
|
|
6295
|
-
L:
|
|
6866
|
+
(0, import_log20.log)("initialized", void 0, {
|
|
6867
|
+
F: __dxlog_file24,
|
|
6868
|
+
L: 217,
|
|
6296
6869
|
S: this,
|
|
6297
6870
|
C: (f, a) => f(...a)
|
|
6298
6871
|
});
|
|
@@ -6302,44 +6875,44 @@ var ClientServicesHost = class {
|
|
|
6302
6875
|
return;
|
|
6303
6876
|
}
|
|
6304
6877
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6305
|
-
|
|
6878
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.begin({
|
|
6306
6879
|
id: traceId
|
|
6307
6880
|
}), {
|
|
6308
|
-
F:
|
|
6309
|
-
L:
|
|
6881
|
+
F: __dxlog_file24,
|
|
6882
|
+
L: 228,
|
|
6310
6883
|
S: this,
|
|
6311
6884
|
C: (f, a) => f(...a)
|
|
6312
6885
|
});
|
|
6313
|
-
(0,
|
|
6314
|
-
F:
|
|
6315
|
-
L:
|
|
6886
|
+
(0, import_invariant20.invariant)(this._config, "config not set", {
|
|
6887
|
+
F: __dxlog_file24,
|
|
6888
|
+
L: 230,
|
|
6316
6889
|
S: this,
|
|
6317
6890
|
A: [
|
|
6318
6891
|
"this._config",
|
|
6319
6892
|
"'config not set'"
|
|
6320
6893
|
]
|
|
6321
6894
|
});
|
|
6322
|
-
(0,
|
|
6323
|
-
F:
|
|
6324
|
-
L:
|
|
6895
|
+
(0, import_invariant20.invariant)(this._storage, "storage not set", {
|
|
6896
|
+
F: __dxlog_file24,
|
|
6897
|
+
L: 231,
|
|
6325
6898
|
S: this,
|
|
6326
6899
|
A: [
|
|
6327
6900
|
"this._storage",
|
|
6328
6901
|
"'storage not set'"
|
|
6329
6902
|
]
|
|
6330
6903
|
});
|
|
6331
|
-
(0,
|
|
6332
|
-
F:
|
|
6333
|
-
L:
|
|
6904
|
+
(0, import_invariant20.invariant)(this._signalManager, "signal manager not set", {
|
|
6905
|
+
F: __dxlog_file24,
|
|
6906
|
+
L: 232,
|
|
6334
6907
|
S: this,
|
|
6335
6908
|
A: [
|
|
6336
6909
|
"this._signalManager",
|
|
6337
6910
|
"'signal manager not set'"
|
|
6338
6911
|
]
|
|
6339
6912
|
});
|
|
6340
|
-
(0,
|
|
6341
|
-
F:
|
|
6342
|
-
L:
|
|
6913
|
+
(0, import_invariant20.invariant)(this._networkManager, "network manager not set", {
|
|
6914
|
+
F: __dxlog_file24,
|
|
6915
|
+
L: 233,
|
|
6343
6916
|
S: this,
|
|
6344
6917
|
A: [
|
|
6345
6918
|
"this._networkManager",
|
|
@@ -6347,11 +6920,11 @@ var ClientServicesHost = class {
|
|
|
6347
6920
|
]
|
|
6348
6921
|
});
|
|
6349
6922
|
this._opening = true;
|
|
6350
|
-
(0,
|
|
6923
|
+
(0, import_log20.log)("opening...", {
|
|
6351
6924
|
lockKey: this._resourceLock?.lockKey
|
|
6352
6925
|
}, {
|
|
6353
|
-
F:
|
|
6354
|
-
L:
|
|
6926
|
+
F: __dxlog_file24,
|
|
6927
|
+
L: 236,
|
|
6355
6928
|
S: this,
|
|
6356
6929
|
C: (f, a) => f(...a)
|
|
6357
6930
|
});
|
|
@@ -6362,16 +6935,18 @@ var ClientServicesHost = class {
|
|
|
6362
6935
|
await this._level.open();
|
|
6363
6936
|
await this._loggingService.open();
|
|
6364
6937
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
6938
|
+
const dataSpaceManagerProvider = async () => {
|
|
6939
|
+
await this._serviceContext.initialized.wait();
|
|
6940
|
+
return this._serviceContext.dataSpaceManager;
|
|
6941
|
+
};
|
|
6365
6942
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6366
6943
|
this._serviceRegistry.setServices({
|
|
6367
6944
|
SystemService: this._systemService,
|
|
6368
6945
|
IdentityService: identityService,
|
|
6946
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6369
6947
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6370
6948
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6371
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6372
|
-
await this._serviceContext.initialized.wait();
|
|
6373
|
-
return this._serviceContext.dataSpaceManager;
|
|
6374
|
-
}),
|
|
6949
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6375
6950
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6376
6951
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6377
6952
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6401,19 +6976,19 @@ var ClientServicesHost = class {
|
|
|
6401
6976
|
this._open = true;
|
|
6402
6977
|
this._statusUpdate.emit();
|
|
6403
6978
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6404
|
-
(0,
|
|
6979
|
+
(0, import_log20.log)("opened", {
|
|
6405
6980
|
deviceKey
|
|
6406
6981
|
}, {
|
|
6407
|
-
F:
|
|
6408
|
-
L:
|
|
6982
|
+
F: __dxlog_file24,
|
|
6983
|
+
L: 322,
|
|
6409
6984
|
S: this,
|
|
6410
6985
|
C: (f, a) => f(...a)
|
|
6411
6986
|
});
|
|
6412
|
-
|
|
6987
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.end({
|
|
6413
6988
|
id: traceId
|
|
6414
6989
|
}), {
|
|
6415
|
-
F:
|
|
6416
|
-
L:
|
|
6990
|
+
F: __dxlog_file24,
|
|
6991
|
+
L: 323,
|
|
6417
6992
|
S: this,
|
|
6418
6993
|
C: (f, a) => f(...a)
|
|
6419
6994
|
});
|
|
@@ -6423,11 +6998,11 @@ var ClientServicesHost = class {
|
|
|
6423
6998
|
return;
|
|
6424
6999
|
}
|
|
6425
7000
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6426
|
-
(0,
|
|
7001
|
+
(0, import_log20.log)("closing...", {
|
|
6427
7002
|
deviceKey
|
|
6428
7003
|
}, {
|
|
6429
|
-
F:
|
|
6430
|
-
L:
|
|
7004
|
+
F: __dxlog_file24,
|
|
7005
|
+
L: 334,
|
|
6431
7006
|
S: this,
|
|
6432
7007
|
C: (f, a) => f(...a)
|
|
6433
7008
|
});
|
|
@@ -6441,44 +7016,44 @@ var ClientServicesHost = class {
|
|
|
6441
7016
|
await this._level?.close();
|
|
6442
7017
|
this._open = false;
|
|
6443
7018
|
this._statusUpdate.emit();
|
|
6444
|
-
(0,
|
|
7019
|
+
(0, import_log20.log)("closed", {
|
|
6445
7020
|
deviceKey
|
|
6446
7021
|
}, {
|
|
6447
|
-
F:
|
|
6448
|
-
L:
|
|
7022
|
+
F: __dxlog_file24,
|
|
7023
|
+
L: 343,
|
|
6449
7024
|
S: this,
|
|
6450
7025
|
C: (f, a) => f(...a)
|
|
6451
7026
|
});
|
|
6452
7027
|
}
|
|
6453
7028
|
async reset() {
|
|
6454
7029
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6455
|
-
|
|
7030
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.begin({
|
|
6456
7031
|
id: traceId
|
|
6457
7032
|
}), {
|
|
6458
|
-
F:
|
|
6459
|
-
L:
|
|
7033
|
+
F: __dxlog_file24,
|
|
7034
|
+
L: 348,
|
|
6460
7035
|
S: this,
|
|
6461
7036
|
C: (f, a) => f(...a)
|
|
6462
7037
|
});
|
|
6463
|
-
|
|
6464
|
-
F:
|
|
6465
|
-
L:
|
|
7038
|
+
import_log20.log.info("resetting...", void 0, {
|
|
7039
|
+
F: __dxlog_file24,
|
|
7040
|
+
L: 350,
|
|
6466
7041
|
S: this,
|
|
6467
7042
|
C: (f, a) => f(...a)
|
|
6468
7043
|
});
|
|
6469
7044
|
await this._serviceContext?.close();
|
|
6470
7045
|
await this._storage.reset();
|
|
6471
|
-
|
|
6472
|
-
F:
|
|
6473
|
-
L:
|
|
7046
|
+
import_log20.log.info("reset", void 0, {
|
|
7047
|
+
F: __dxlog_file24,
|
|
7048
|
+
L: 353,
|
|
6474
7049
|
S: this,
|
|
6475
7050
|
C: (f, a) => f(...a)
|
|
6476
7051
|
});
|
|
6477
|
-
|
|
7052
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.end({
|
|
6478
7053
|
id: traceId
|
|
6479
7054
|
}), {
|
|
6480
|
-
F:
|
|
6481
|
-
L:
|
|
7055
|
+
F: __dxlog_file24,
|
|
7056
|
+
L: 354,
|
|
6482
7057
|
S: this,
|
|
6483
7058
|
C: (f, a) => f(...a)
|
|
6484
7059
|
});
|
|
@@ -6497,11 +7072,11 @@ _ts_decorate8([
|
|
|
6497
7072
|
import_tracing9.trace.info()
|
|
6498
7073
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
6499
7074
|
_ts_decorate8([
|
|
6500
|
-
|
|
7075
|
+
import_async19.synchronized,
|
|
6501
7076
|
import_tracing9.trace.span()
|
|
6502
7077
|
], ClientServicesHost.prototype, "open", null);
|
|
6503
7078
|
_ts_decorate8([
|
|
6504
|
-
|
|
7079
|
+
import_async19.synchronized,
|
|
6505
7080
|
import_tracing9.trace.span()
|
|
6506
7081
|
], ClientServicesHost.prototype, "close", null);
|
|
6507
7082
|
ClientServicesHost = _ts_decorate8([
|
|
@@ -6537,8 +7112,11 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6537
7112
|
createDiagnostics,
|
|
6538
7113
|
createLevel,
|
|
6539
7114
|
createStorageObjects,
|
|
6540
|
-
|
|
7115
|
+
decodeProfileArchive,
|
|
7116
|
+
encodeProfileArchive,
|
|
7117
|
+
exportProfileData,
|
|
6541
7118
|
getNetworkPeers,
|
|
7119
|
+
importProfileData,
|
|
6542
7120
|
isLocked,
|
|
6543
7121
|
subscribeToFeedBlocks,
|
|
6544
7122
|
subscribeToFeeds,
|
|
@@ -6548,4 +7126,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6548
7126
|
subscribeToSpaces,
|
|
6549
7127
|
subscribeToSwarmInfo
|
|
6550
7128
|
});
|
|
6551
|
-
//# sourceMappingURL=chunk-
|
|
7129
|
+
//# sourceMappingURL=chunk-5PALJZPW.cjs.map
|