@dxos/client-services 0.8.0 → 0.8.1-main.013e445
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/{node-esm/chunk-ORQYMDJN.mjs → browser/chunk-TIE6MASS.mjs} +1306 -853
- package/dist/lib/browser/chunk-TIE6MASS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-FELZPQQE.cjs → chunk-AENAROAE.cjs} +1015 -711
- package/dist/lib/node/chunk-AENAROAE.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/{browser/chunk-25OL3JVO.mjs → node-esm/chunk-M4EV7TIV.mjs} +721 -554
- package/dist/lib/node-esm/chunk-M4EV7TIV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +2 -1
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/index.d.ts +3 -0
- package/dist/types/src/packlets/space-export/index.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +9 -0
- package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts +23 -0
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/tar.test.d.ts +2 -0
- package/dist/types/src/packlets/space-export/tar.test.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +8 -2
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +3 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +39 -38
- package/src/packlets/network/network-service.ts +10 -1
- package/src/packlets/space-export/index.ts +6 -0
- package/src/packlets/space-export/space-archive-reader.ts +33 -0
- package/src/packlets/space-export/space-archive-writer.ts +83 -0
- package/src/packlets/space-export/tar.test.ts +25 -0
- package/src/packlets/spaces/data-space-manager.ts +70 -9
- package/src/packlets/spaces/data-space.ts +14 -1
- package/src/packlets/spaces/spaces-service.ts +39 -1
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-25OL3JVO.mjs.map +0 -7
- package/dist/lib/node/chunk-FELZPQQE.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-ORQYMDJN.mjs.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_AENAROAE_exports = {};
|
|
30
|
+
__export(chunk_AENAROAE_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -72,7 +72,7 @@ __export(chunk_FELZPQQE_exports, {
|
|
|
72
72
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
73
73
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
74
74
|
});
|
|
75
|
-
module.exports = __toCommonJS(
|
|
75
|
+
module.exports = __toCommonJS(chunk_AENAROAE_exports);
|
|
76
76
|
var import_async = require("@dxos/async");
|
|
77
77
|
var import_stream = require("@dxos/codec-protobuf/stream");
|
|
78
78
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -118,6 +118,7 @@ var import_buf = require("@dxos/protocols/buf");
|
|
|
118
118
|
var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
|
|
119
119
|
var import_util3 = require("@dxos/util");
|
|
120
120
|
var import_async7 = require("@dxos/async");
|
|
121
|
+
var import_automerge = require("@dxos/automerge/automerge");
|
|
121
122
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
122
123
|
var import_context4 = require("@dxos/context");
|
|
123
124
|
var import_debug = require("@dxos/debug");
|
|
@@ -162,6 +163,7 @@ var import_credentials8 = require("@dxos/credentials");
|
|
|
162
163
|
var import_keys7 = require("@dxos/keys");
|
|
163
164
|
var import_log7 = require("@dxos/log");
|
|
164
165
|
var import_async11 = require("@dxos/async");
|
|
166
|
+
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
165
167
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
166
168
|
var import_context7 = require("@dxos/context");
|
|
167
169
|
var import_credentials9 = require("@dxos/credentials");
|
|
@@ -189,18 +191,25 @@ var import_credentials13 = require("@dxos/credentials");
|
|
|
189
191
|
var import_debug3 = require("@dxos/debug");
|
|
190
192
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
191
193
|
var import_invariant8 = require("@dxos/invariant");
|
|
194
|
+
var import_keys9 = require("@dxos/keys");
|
|
192
195
|
var import_log9 = require("@dxos/log");
|
|
193
196
|
var import_protocols6 = require("@dxos/protocols");
|
|
194
197
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
195
198
|
var import_tracing6 = require("@dxos/tracing");
|
|
196
|
-
var import_platform = __toESM(require("platform"));
|
|
197
|
-
var import_async13 = require("@dxos/async");
|
|
198
199
|
var import_context8 = require("@dxos/context");
|
|
199
|
-
var import_credentials14 = require("@dxos/credentials");
|
|
200
200
|
var import_invariant9 = require("@dxos/invariant");
|
|
201
|
-
var import_keys9 = require("@dxos/keys");
|
|
202
|
-
var import_log10 = require("@dxos/log");
|
|
203
201
|
var import_protocols7 = require("@dxos/protocols");
|
|
202
|
+
var import_invariant10 = require("@dxos/invariant");
|
|
203
|
+
var import_log10 = require("@dxos/log");
|
|
204
|
+
var import_protocols8 = require("@dxos/protocols");
|
|
205
|
+
var import_platform = __toESM(require("platform"));
|
|
206
|
+
var import_async13 = require("@dxos/async");
|
|
207
|
+
var import_context9 = require("@dxos/context");
|
|
208
|
+
var import_credentials14 = require("@dxos/credentials");
|
|
209
|
+
var import_invariant11 = require("@dxos/invariant");
|
|
210
|
+
var import_keys10 = require("@dxos/keys");
|
|
211
|
+
var import_log11 = require("@dxos/log");
|
|
212
|
+
var import_protocols9 = require("@dxos/protocols");
|
|
204
213
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
205
214
|
var import_credentials15 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
206
215
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
@@ -209,25 +218,25 @@ var import_tracing7 = require("@dxos/tracing");
|
|
|
209
218
|
var import_util8 = require("@dxos/util");
|
|
210
219
|
var import_async14 = require("@dxos/async");
|
|
211
220
|
var import_stream8 = require("@dxos/codec-protobuf/stream");
|
|
212
|
-
var
|
|
221
|
+
var import_context10 = require("@dxos/context");
|
|
213
222
|
var import_credentials16 = require("@dxos/credentials");
|
|
214
|
-
var
|
|
215
|
-
var
|
|
223
|
+
var import_invariant12 = require("@dxos/invariant");
|
|
224
|
+
var import_log12 = require("@dxos/log");
|
|
216
225
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
217
226
|
var import_util9 = require("@dxos/util");
|
|
218
227
|
var import_credentials17 = require("@dxos/credentials");
|
|
219
|
-
var
|
|
220
|
-
var
|
|
228
|
+
var import_invariant13 = require("@dxos/invariant");
|
|
229
|
+
var import_protocols10 = require("@dxos/protocols");
|
|
221
230
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
222
231
|
var import_async15 = require("@dxos/async");
|
|
223
232
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
224
|
-
var
|
|
233
|
+
var import_context11 = require("@dxos/context");
|
|
225
234
|
var import_crypto = require("@dxos/crypto");
|
|
226
|
-
var
|
|
227
|
-
var
|
|
228
|
-
var
|
|
235
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
236
|
+
var import_keys11 = require("@dxos/keys");
|
|
237
|
+
var import_log13 = require("@dxos/log");
|
|
229
238
|
var import_network_manager = require("@dxos/network-manager");
|
|
230
|
-
var
|
|
239
|
+
var import_protocols11 = require("@dxos/protocols");
|
|
231
240
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
232
241
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
233
242
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
@@ -235,39 +244,39 @@ var import_tracing8 = require("@dxos/tracing");
|
|
|
235
244
|
var import_util10 = require("@dxos/util");
|
|
236
245
|
var import_async16 = require("@dxos/async");
|
|
237
246
|
var import_crypto2 = require("@dxos/crypto");
|
|
238
|
-
var
|
|
239
|
-
var
|
|
240
|
-
var
|
|
241
|
-
var
|
|
247
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
248
|
+
var import_keys12 = require("@dxos/keys");
|
|
249
|
+
var import_log14 = require("@dxos/log");
|
|
250
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
242
251
|
var import_proto3 = require("@dxos/protocols/proto");
|
|
243
252
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
244
|
-
var
|
|
253
|
+
var import_context12 = require("@dxos/context");
|
|
245
254
|
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
246
255
|
var import_async17 = require("@dxos/async");
|
|
247
|
-
var
|
|
248
|
-
var
|
|
249
|
-
var
|
|
250
|
-
var
|
|
256
|
+
var import_context13 = require("@dxos/context");
|
|
257
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
258
|
+
var import_log15 = require("@dxos/log");
|
|
259
|
+
var import_protocols13 = require("@dxos/protocols");
|
|
251
260
|
var import_proto4 = require("@dxos/protocols/proto");
|
|
252
261
|
var import_invitations3 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
253
262
|
var import_teleport2 = require("@dxos/teleport");
|
|
254
263
|
var import_async18 = require("@dxos/async");
|
|
255
|
-
var
|
|
264
|
+
var import_context14 = require("@dxos/context");
|
|
256
265
|
var import_crypto3 = require("@dxos/crypto");
|
|
257
|
-
var
|
|
258
|
-
var
|
|
259
|
-
var
|
|
260
|
-
var
|
|
266
|
+
var import_invariant17 = require("@dxos/invariant");
|
|
267
|
+
var import_keys13 = require("@dxos/keys");
|
|
268
|
+
var import_log16 = require("@dxos/log");
|
|
269
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
261
270
|
var import_proto5 = require("@dxos/protocols/proto");
|
|
262
271
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
263
272
|
var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
264
273
|
var import_teleport3 = require("@dxos/teleport");
|
|
265
274
|
var import_async19 = require("@dxos/async");
|
|
266
|
-
var import_log16 = require("@dxos/log");
|
|
267
|
-
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
268
|
-
var import_invariant16 = require("@dxos/invariant");
|
|
269
|
-
var import_keys13 = require("@dxos/keys");
|
|
270
275
|
var import_log17 = require("@dxos/log");
|
|
276
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
277
|
+
var import_invariant18 = require("@dxos/invariant");
|
|
278
|
+
var import_keys14 = require("@dxos/keys");
|
|
279
|
+
var import_log18 = require("@dxos/log");
|
|
271
280
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
272
281
|
var import_util11 = require("@dxos/util");
|
|
273
282
|
var import_stream9 = require("@dxos/codec-protobuf/stream");
|
|
@@ -275,102 +284,102 @@ var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
275
284
|
var import_tracing9 = require("@dxos/tracing");
|
|
276
285
|
var import_credentials18 = require("@dxos/credentials");
|
|
277
286
|
var import_feed_store5 = require("@dxos/feed-store");
|
|
278
|
-
var
|
|
279
|
-
var
|
|
280
|
-
var
|
|
287
|
+
var import_invariant19 = require("@dxos/invariant");
|
|
288
|
+
var import_log19 = require("@dxos/log");
|
|
289
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
281
290
|
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
282
291
|
var import_credentials19 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
283
292
|
var import_async20 = require("@dxos/async");
|
|
284
293
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
285
|
-
var
|
|
294
|
+
var import_context15 = require("@dxos/context");
|
|
286
295
|
var import_credentials20 = require("@dxos/credentials");
|
|
287
296
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
288
|
-
var
|
|
289
|
-
var
|
|
290
|
-
var
|
|
297
|
+
var import_invariant20 = require("@dxos/invariant");
|
|
298
|
+
var import_keys15 = require("@dxos/keys");
|
|
299
|
+
var import_log20 = require("@dxos/log");
|
|
291
300
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
292
301
|
var import_credentials21 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
293
|
-
var
|
|
302
|
+
var import_invariant21 = require("@dxos/invariant");
|
|
294
303
|
var import_lock_file = require("@dxos/lock-file");
|
|
295
|
-
var
|
|
304
|
+
var import_log21 = require("@dxos/log");
|
|
296
305
|
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
297
306
|
var import_debug4 = require("@dxos/debug");
|
|
298
307
|
var import_rpc = require("@dxos/rpc");
|
|
299
308
|
var import_tracing10 = require("@dxos/tracing");
|
|
300
309
|
var import_async21 = require("@dxos/async");
|
|
301
|
-
var
|
|
302
|
-
var
|
|
303
|
-
var
|
|
304
|
-
var
|
|
305
|
-
var
|
|
310
|
+
var import_context16 = require("@dxos/context");
|
|
311
|
+
var import_invariant22 = require("@dxos/invariant");
|
|
312
|
+
var import_keys16 = require("@dxos/keys");
|
|
313
|
+
var import_log22 = require("@dxos/log");
|
|
314
|
+
var import_protocols16 = require("@dxos/protocols");
|
|
306
315
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
307
316
|
var import_metadata2 = require("@dxos/protocols/proto/dxos/echo/metadata");
|
|
308
317
|
var import_stream10 = require("@dxos/codec-protobuf/stream");
|
|
309
|
-
var
|
|
318
|
+
var import_protocols17 = require("@dxos/protocols");
|
|
310
319
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
311
320
|
var import_async22 = require("@dxos/async");
|
|
312
|
-
var
|
|
321
|
+
var import_context17 = require("@dxos/context");
|
|
313
322
|
var import_credentials22 = require("@dxos/credentials");
|
|
314
323
|
var import_debug5 = require("@dxos/debug");
|
|
315
324
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
316
325
|
var import_edge_client2 = require("@dxos/edge-client");
|
|
317
326
|
var import_feed_store6 = require("@dxos/feed-store");
|
|
318
|
-
var
|
|
327
|
+
var import_invariant23 = require("@dxos/invariant");
|
|
319
328
|
var import_keyring = require("@dxos/keyring");
|
|
320
|
-
var
|
|
321
|
-
var
|
|
322
|
-
var
|
|
329
|
+
var import_keys17 = require("@dxos/keys");
|
|
330
|
+
var import_log23 = require("@dxos/log");
|
|
331
|
+
var import_protocols18 = require("@dxos/protocols");
|
|
323
332
|
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
324
333
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
325
334
|
var import_tracing11 = require("@dxos/tracing");
|
|
326
335
|
var import_util12 = require("@dxos/util");
|
|
327
336
|
var import_credentials23 = require("@dxos/credentials");
|
|
328
337
|
var import_crypto4 = require("@dxos/crypto");
|
|
329
|
-
var
|
|
330
|
-
var
|
|
331
|
-
var
|
|
332
|
-
var
|
|
338
|
+
var import_invariant24 = require("@dxos/invariant");
|
|
339
|
+
var import_keys18 = require("@dxos/keys");
|
|
340
|
+
var import_log24 = require("@dxos/log");
|
|
341
|
+
var import_protocols19 = require("@dxos/protocols");
|
|
333
342
|
var import_proto6 = require("@dxos/protocols/proto");
|
|
334
343
|
var import_timeframe5 = require("@dxos/timeframe");
|
|
335
|
-
var
|
|
344
|
+
var import_protocols20 = require("@dxos/protocols");
|
|
336
345
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
337
346
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
338
347
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
339
348
|
var import_config3 = require("@dxos/protocols/proto/dxos/config");
|
|
340
349
|
var import_util13 = require("@dxos/util");
|
|
341
350
|
var import_node_path = __toESM(require("node:path"));
|
|
342
|
-
var
|
|
351
|
+
var import_keys19 = require("@dxos/keys");
|
|
343
352
|
var import_kv_store = require("@dxos/kv-store");
|
|
344
|
-
var
|
|
345
|
-
var
|
|
346
|
-
var
|
|
347
|
-
var
|
|
353
|
+
var import_automerge_repo2 = require("@dxos/automerge/automerge-repo");
|
|
354
|
+
var import_invariant25 = require("@dxos/invariant");
|
|
355
|
+
var import_log25 = require("@dxos/log");
|
|
356
|
+
var import_protocols21 = require("@dxos/protocols");
|
|
348
357
|
var import_util14 = require("@dxos/util");
|
|
349
358
|
var import_async23 = require("@dxos/async");
|
|
350
359
|
var import_client_protocol8 = require("@dxos/client-protocol");
|
|
351
|
-
var
|
|
360
|
+
var import_context18 = require("@dxos/context");
|
|
352
361
|
var import_edge_client3 = require("@dxos/edge-client");
|
|
353
|
-
var
|
|
354
|
-
var
|
|
355
|
-
var
|
|
362
|
+
var import_invariant26 = require("@dxos/invariant");
|
|
363
|
+
var import_keys20 = require("@dxos/keys");
|
|
364
|
+
var import_log26 = require("@dxos/log");
|
|
356
365
|
var import_messaging = require("@dxos/messaging");
|
|
357
366
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
358
|
-
var
|
|
367
|
+
var import_protocols22 = require("@dxos/protocols");
|
|
359
368
|
var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
|
|
360
369
|
var import_tracing12 = require("@dxos/tracing");
|
|
361
370
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
362
371
|
var import_async24 = require("@dxos/async");
|
|
363
372
|
var import_stream11 = require("@dxos/codec-protobuf/stream");
|
|
364
|
-
var
|
|
373
|
+
var import_invariant27 = require("@dxos/invariant");
|
|
365
374
|
var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
|
|
366
375
|
var import_async25 = require("@dxos/async");
|
|
367
376
|
var import_stream12 = require("@dxos/codec-protobuf/stream");
|
|
368
|
-
var
|
|
377
|
+
var import_keys21 = require("@dxos/keys");
|
|
369
378
|
var import_util15 = require("@dxos/util");
|
|
370
379
|
var import_async26 = require("@dxos/async");
|
|
371
380
|
var import_stream13 = require("@dxos/codec-protobuf/stream");
|
|
372
|
-
var
|
|
373
|
-
var
|
|
381
|
+
var import_keys22 = require("@dxos/keys");
|
|
382
|
+
var import_log27 = require("@dxos/log");
|
|
374
383
|
var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
|
|
375
384
|
var import_util16 = require("@dxos/util");
|
|
376
385
|
var import_stream14 = require("@dxos/codec-protobuf/stream");
|
|
@@ -735,7 +744,7 @@ var DevtoolsServiceImpl = class {
|
|
|
735
744
|
});
|
|
736
745
|
}
|
|
737
746
|
};
|
|
738
|
-
var DXOS_VERSION = "0.8.
|
|
747
|
+
var DXOS_VERSION = "0.8.1-main.013e445";
|
|
739
748
|
var getPlatform = () => {
|
|
740
749
|
if (process.browser) {
|
|
741
750
|
if (typeof window !== "undefined") {
|
|
@@ -2221,10 +2230,15 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2221
2230
|
get spaces() {
|
|
2222
2231
|
return this._spaces;
|
|
2223
2232
|
}
|
|
2233
|
+
getSpaceById(spaceId) {
|
|
2234
|
+
return [
|
|
2235
|
+
...this._spaces.values()
|
|
2236
|
+
].find((space) => space.id === spaceId);
|
|
2237
|
+
}
|
|
2224
2238
|
async _open() {
|
|
2225
2239
|
(0, import_log8.log)("open", void 0, {
|
|
2226
2240
|
F: __dxlog_file9,
|
|
2227
|
-
L:
|
|
2241
|
+
L: 213,
|
|
2228
2242
|
S: this,
|
|
2229
2243
|
C: (f, a) => f(...a)
|
|
2230
2244
|
});
|
|
@@ -2232,7 +2246,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2232
2246
|
id: this._instanceId
|
|
2233
2247
|
}), {
|
|
2234
2248
|
F: __dxlog_file9,
|
|
2235
|
-
L:
|
|
2249
|
+
L: 214,
|
|
2236
2250
|
S: this,
|
|
2237
2251
|
C: (f, a) => f(...a)
|
|
2238
2252
|
});
|
|
@@ -2240,7 +2254,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2240
2254
|
spaces: this._metadataStore.spaces.length
|
|
2241
2255
|
}, {
|
|
2242
2256
|
F: __dxlog_file9,
|
|
2243
|
-
L:
|
|
2257
|
+
L: 215,
|
|
2244
2258
|
S: this,
|
|
2245
2259
|
C: (f, a) => f(...a)
|
|
2246
2260
|
});
|
|
@@ -2250,7 +2264,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2250
2264
|
spaceMetadata
|
|
2251
2265
|
}, {
|
|
2252
2266
|
F: __dxlog_file9,
|
|
2253
|
-
L:
|
|
2267
|
+
L: 219,
|
|
2254
2268
|
S: this,
|
|
2255
2269
|
C: (f, a) => f(...a)
|
|
2256
2270
|
});
|
|
@@ -2261,7 +2275,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2261
2275
|
err
|
|
2262
2276
|
}, {
|
|
2263
2277
|
F: __dxlog_file9,
|
|
2264
|
-
L:
|
|
2278
|
+
L: 222,
|
|
2265
2279
|
S: this,
|
|
2266
2280
|
C: (f, a) => f(...a)
|
|
2267
2281
|
});
|
|
@@ -2272,7 +2286,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2272
2286
|
id: this._instanceId
|
|
2273
2287
|
}), {
|
|
2274
2288
|
F: __dxlog_file9,
|
|
2275
|
-
L:
|
|
2289
|
+
L: 228,
|
|
2276
2290
|
S: this,
|
|
2277
2291
|
C: (f, a) => f(...a)
|
|
2278
2292
|
});
|
|
@@ -2280,7 +2294,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2280
2294
|
async _close() {
|
|
2281
2295
|
(0, import_log8.log)("close", void 0, {
|
|
2282
2296
|
F: __dxlog_file9,
|
|
2283
|
-
L:
|
|
2297
|
+
L: 233,
|
|
2284
2298
|
S: this,
|
|
2285
2299
|
C: (f, a) => f(...a)
|
|
2286
2300
|
});
|
|
@@ -2292,19 +2306,13 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2292
2306
|
/**
|
|
2293
2307
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
2294
2308
|
*/
|
|
2295
|
-
async createSpace() {
|
|
2296
|
-
(0, import_invariant7.
|
|
2297
|
-
|
|
2298
|
-
L: 224,
|
|
2299
|
-
S: this,
|
|
2300
|
-
A: [
|
|
2301
|
-
"this._lifecycleState === LifecycleState.OPEN",
|
|
2302
|
-
"'Not open.'"
|
|
2303
|
-
]
|
|
2304
|
-
});
|
|
2309
|
+
async createSpace(options = {}) {
|
|
2310
|
+
(0, import_invariant7.assertArgument)(!!options.rootUrl === !!options.documents, "root url must be required when providing documents");
|
|
2311
|
+
(0, import_invariant7.assertState)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.");
|
|
2305
2312
|
const spaceKey = await this._keyring.createKey();
|
|
2306
2313
|
const controlFeedKey = await this._keyring.createKey();
|
|
2307
2314
|
const dataFeedKey = await this._keyring.createKey();
|
|
2315
|
+
const spaceId = await (0, import_echo_protocol2.createIdFromSpaceKey)(spaceKey);
|
|
2308
2316
|
const metadata = {
|
|
2309
2317
|
key: spaceKey,
|
|
2310
2318
|
genesisFeedKey: controlFeedKey,
|
|
@@ -2313,22 +2321,84 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2313
2321
|
state: import_services6.SpaceState.SPACE_ACTIVE
|
|
2314
2322
|
};
|
|
2315
2323
|
(0, import_log8.log)("creating space...", {
|
|
2324
|
+
spaceId,
|
|
2325
|
+
spaceKey
|
|
2326
|
+
}, {
|
|
2327
|
+
F: __dxlog_file9,
|
|
2328
|
+
L: 262,
|
|
2329
|
+
S: this,
|
|
2330
|
+
C: (f, a) => f(...a)
|
|
2331
|
+
});
|
|
2332
|
+
const documentIdMapping = {};
|
|
2333
|
+
if (options.documents) {
|
|
2334
|
+
(0, import_invariant7.invariant)(Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId)), "Invalid document IDs", {
|
|
2335
|
+
F: __dxlog_file9,
|
|
2336
|
+
L: 267,
|
|
2337
|
+
S: this,
|
|
2338
|
+
A: [
|
|
2339
|
+
"Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId))",
|
|
2340
|
+
"'Invalid document IDs'"
|
|
2341
|
+
]
|
|
2342
|
+
});
|
|
2343
|
+
await Promise.all(Object.entries(options.documents).map(async ([documentId, data]) => {
|
|
2344
|
+
(0, import_log8.log)("creating document...", {
|
|
2345
|
+
documentId
|
|
2346
|
+
}, {
|
|
2347
|
+
F: __dxlog_file9,
|
|
2348
|
+
L: 274,
|
|
2349
|
+
S: this,
|
|
2350
|
+
C: (f, a) => f(...a)
|
|
2351
|
+
});
|
|
2352
|
+
const newDoc = await this._echoHost.createDoc(data, {
|
|
2353
|
+
preserveHistory: true
|
|
2354
|
+
});
|
|
2355
|
+
documentIdMapping[documentId] = newDoc.documentId;
|
|
2356
|
+
}));
|
|
2357
|
+
}
|
|
2358
|
+
(0, import_log8.log)("opening space...", {
|
|
2316
2359
|
spaceKey
|
|
2317
2360
|
}, {
|
|
2318
2361
|
F: __dxlog_file9,
|
|
2319
|
-
L:
|
|
2362
|
+
L: 281,
|
|
2363
|
+
S: this,
|
|
2364
|
+
C: (f, a) => f(...a)
|
|
2365
|
+
});
|
|
2366
|
+
let root;
|
|
2367
|
+
if (options.rootUrl) {
|
|
2368
|
+
const newRootDocId = documentIdMapping[(0, import_automerge_repo.interpretAsDocumentId)(options.rootUrl)] ?? (0, import_invariant7.failedInvariant)();
|
|
2369
|
+
const rootDocHandle = await this._echoHost.loadDoc(import_context7.Context.default(void 0, {
|
|
2370
|
+
F: __dxlog_file9,
|
|
2371
|
+
L: 286
|
|
2372
|
+
}), newRootDocId);
|
|
2373
|
+
import_echo_pipeline2.DatabaseRoot.mapLinks(rootDocHandle, documentIdMapping);
|
|
2374
|
+
root = await this._echoHost.openSpaceRoot(spaceId, `automerge:${newRootDocId}`);
|
|
2375
|
+
} else {
|
|
2376
|
+
root = await this._echoHost.createSpaceRoot(spaceKey);
|
|
2377
|
+
}
|
|
2378
|
+
(0, import_log8.log)("constructing space...", {
|
|
2379
|
+
spaceKey
|
|
2380
|
+
}, {
|
|
2381
|
+
F: __dxlog_file9,
|
|
2382
|
+
L: 294,
|
|
2320
2383
|
S: this,
|
|
2321
2384
|
C: (f, a) => f(...a)
|
|
2322
2385
|
});
|
|
2323
|
-
const root = await this._echoHost.createSpaceRoot(spaceKey);
|
|
2324
2386
|
const space = await this._constructSpace(metadata);
|
|
2325
2387
|
await space.open();
|
|
2388
|
+
(0, import_log8.log)("adding space...", {
|
|
2389
|
+
spaceKey
|
|
2390
|
+
}, {
|
|
2391
|
+
F: __dxlog_file9,
|
|
2392
|
+
L: 299,
|
|
2393
|
+
S: this,
|
|
2394
|
+
C: (f, a) => f(...a)
|
|
2395
|
+
});
|
|
2326
2396
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
|
|
2327
2397
|
await this._metadataStore.addSpace(metadata);
|
|
2328
2398
|
const memberCredential = credentials[1];
|
|
2329
2399
|
(0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2330
2400
|
F: __dxlog_file9,
|
|
2331
|
-
L:
|
|
2401
|
+
L: 305,
|
|
2332
2402
|
S: this,
|
|
2333
2403
|
A: [
|
|
2334
2404
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2337,6 +2407,15 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2337
2407
|
});
|
|
2338
2408
|
await this._signingContext.recordCredential(memberCredential);
|
|
2339
2409
|
await space.initializeDataPipeline();
|
|
2410
|
+
(0, import_log8.log)("space ready.", {
|
|
2411
|
+
spaceId,
|
|
2412
|
+
spaceKey
|
|
2413
|
+
}, {
|
|
2414
|
+
F: __dxlog_file9,
|
|
2415
|
+
L: 310,
|
|
2416
|
+
S: this,
|
|
2417
|
+
C: (f, a) => f(...a)
|
|
2418
|
+
});
|
|
2340
2419
|
this.updated.emit();
|
|
2341
2420
|
return space;
|
|
2342
2421
|
}
|
|
@@ -2358,7 +2437,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2358
2437
|
spaceId: space.id
|
|
2359
2438
|
}, {
|
|
2360
2439
|
F: __dxlog_file9,
|
|
2361
|
-
L:
|
|
2440
|
+
L: 330,
|
|
2362
2441
|
S: this,
|
|
2363
2442
|
C: (f, a) => f(...a)
|
|
2364
2443
|
});
|
|
@@ -2393,7 +2472,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2393
2472
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
2394
2473
|
(0, import_invariant7.invariant)(automergeIndex, void 0, {
|
|
2395
2474
|
F: __dxlog_file9,
|
|
2396
|
-
L:
|
|
2475
|
+
L: 363,
|
|
2397
2476
|
S: this,
|
|
2398
2477
|
A: [
|
|
2399
2478
|
"automergeIndex",
|
|
@@ -2410,13 +2489,13 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2410
2489
|
opts
|
|
2411
2490
|
}, {
|
|
2412
2491
|
F: __dxlog_file9,
|
|
2413
|
-
L:
|
|
2492
|
+
L: 372,
|
|
2414
2493
|
S: this,
|
|
2415
2494
|
C: (f, a) => f(...a)
|
|
2416
2495
|
});
|
|
2417
2496
|
(0, import_invariant7.invariant)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.", {
|
|
2418
2497
|
F: __dxlog_file9,
|
|
2419
|
-
L:
|
|
2498
|
+
L: 373,
|
|
2420
2499
|
S: this,
|
|
2421
2500
|
A: [
|
|
2422
2501
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -2425,7 +2504,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2425
2504
|
});
|
|
2426
2505
|
(0, import_invariant7.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
2427
2506
|
F: __dxlog_file9,
|
|
2428
|
-
L:
|
|
2507
|
+
L: 374,
|
|
2429
2508
|
S: this,
|
|
2430
2509
|
A: [
|
|
2431
2510
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -2449,7 +2528,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2449
2528
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
2450
2529
|
(0, import_invariant7.invariant)(space, void 0, {
|
|
2451
2530
|
F: __dxlog_file9,
|
|
2452
|
-
L:
|
|
2531
|
+
L: 394,
|
|
2453
2532
|
S: this,
|
|
2454
2533
|
A: [
|
|
2455
2534
|
"space",
|
|
@@ -2462,7 +2541,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2462
2541
|
const credentials = await (0, import_credentials9.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
2463
2542
|
(0, import_invariant7.invariant)(credentials[0].credential, void 0, {
|
|
2464
2543
|
F: __dxlog_file9,
|
|
2465
|
-
L:
|
|
2544
|
+
L: 413,
|
|
2466
2545
|
S: this,
|
|
2467
2546
|
A: [
|
|
2468
2547
|
"credentials[0].credential",
|
|
@@ -2472,7 +2551,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2472
2551
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2473
2552
|
(0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2474
2553
|
F: __dxlog_file9,
|
|
2475
|
-
L:
|
|
2554
|
+
L: 415,
|
|
2476
2555
|
S: this,
|
|
2477
2556
|
A: [
|
|
2478
2557
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2510,7 +2589,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2510
2589
|
const space = this._spaces.get(spaceKey);
|
|
2511
2590
|
(0, import_invariant7.invariant)(space, "Space not found.", {
|
|
2512
2591
|
F: __dxlog_file9,
|
|
2513
|
-
L:
|
|
2592
|
+
L: 452,
|
|
2514
2593
|
S: this,
|
|
2515
2594
|
A: [
|
|
2516
2595
|
"space",
|
|
@@ -2535,7 +2614,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2535
2614
|
metadata
|
|
2536
2615
|
}, {
|
|
2537
2616
|
F: __dxlog_file9,
|
|
2538
|
-
L:
|
|
2617
|
+
L: 471,
|
|
2539
2618
|
S: this,
|
|
2540
2619
|
C: (f, a) => f(...a)
|
|
2541
2620
|
});
|
|
@@ -2579,7 +2658,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2579
2658
|
err
|
|
2580
2659
|
}, {
|
|
2581
2660
|
F: __dxlog_file9,
|
|
2582
|
-
L:
|
|
2661
|
+
L: 513,
|
|
2583
2662
|
S: this,
|
|
2584
2663
|
C: (f, a) => f(...a)
|
|
2585
2664
|
});
|
|
@@ -2589,7 +2668,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2589
2668
|
onAuthFailure: () => {
|
|
2590
2669
|
import_log8.log.warn("auth failure", void 0, {
|
|
2591
2670
|
F: __dxlog_file9,
|
|
2592
|
-
L:
|
|
2671
|
+
L: 518,
|
|
2593
2672
|
S: this,
|
|
2594
2673
|
C: (f, a) => f(...a)
|
|
2595
2674
|
});
|
|
@@ -2622,7 +2701,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2622
2701
|
space: space.key
|
|
2623
2702
|
}, {
|
|
2624
2703
|
F: __dxlog_file9,
|
|
2625
|
-
L:
|
|
2704
|
+
L: 545,
|
|
2626
2705
|
S: this,
|
|
2627
2706
|
C: (f, a) => f(...a)
|
|
2628
2707
|
});
|
|
@@ -2633,7 +2712,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2633
2712
|
open: this._lifecycleState === import_context7.LifecycleState.OPEN
|
|
2634
2713
|
}, {
|
|
2635
2714
|
F: __dxlog_file9,
|
|
2636
|
-
L:
|
|
2715
|
+
L: 548,
|
|
2637
2716
|
S: this,
|
|
2638
2717
|
C: (f, a) => f(...a)
|
|
2639
2718
|
});
|
|
@@ -2652,7 +2731,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2652
2731
|
space: space.key
|
|
2653
2732
|
}, {
|
|
2654
2733
|
F: __dxlog_file9,
|
|
2655
|
-
L:
|
|
2734
|
+
L: 556,
|
|
2656
2735
|
S: this,
|
|
2657
2736
|
C: (f, a) => f(...a)
|
|
2658
2737
|
});
|
|
@@ -2673,7 +2752,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2673
2752
|
spaceId: dataSpace.id
|
|
2674
2753
|
}, {
|
|
2675
2754
|
F: __dxlog_file9,
|
|
2676
|
-
L:
|
|
2755
|
+
L: 570,
|
|
2677
2756
|
S: this,
|
|
2678
2757
|
C: (f, a) => f(...a)
|
|
2679
2758
|
});
|
|
@@ -2703,7 +2782,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2703
2782
|
space: space.key
|
|
2704
2783
|
}, {
|
|
2705
2784
|
F: __dxlog_file9,
|
|
2706
|
-
L:
|
|
2785
|
+
L: 597,
|
|
2707
2786
|
S: this,
|
|
2708
2787
|
C: (f, a) => f(...a)
|
|
2709
2788
|
});
|
|
@@ -2736,7 +2815,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2736
2815
|
closedSessions
|
|
2737
2816
|
}, {
|
|
2738
2817
|
F: __dxlog_file9,
|
|
2739
|
-
L:
|
|
2818
|
+
L: 623,
|
|
2740
2819
|
S: this,
|
|
2741
2820
|
C: (f, a) => f(...a)
|
|
2742
2821
|
});
|
|
@@ -2751,7 +2830,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2751
2830
|
peerId: peerState.peerId
|
|
2752
2831
|
}, {
|
|
2753
2832
|
F: __dxlog_file9,
|
|
2754
|
-
L:
|
|
2833
|
+
L: 637,
|
|
2755
2834
|
S: this,
|
|
2756
2835
|
C: (f, a) => f(...a)
|
|
2757
2836
|
});
|
|
@@ -2810,7 +2889,155 @@ _ts_decorate3([
|
|
|
2810
2889
|
DataSpaceManager = _ts_decorate3([
|
|
2811
2890
|
(0, import_async11.trackLeaks)("open", "close")
|
|
2812
2891
|
], DataSpaceManager);
|
|
2813
|
-
var
|
|
2892
|
+
var CURRENT_VERSION = import_protocols7.SpaceArchiveVersion.V1;
|
|
2893
|
+
var SpaceArchiveWriter = class extends import_context8.Resource {
|
|
2894
|
+
constructor() {
|
|
2895
|
+
super(...arguments);
|
|
2896
|
+
this._meta = void 0;
|
|
2897
|
+
this._currentRootUrl = void 0;
|
|
2898
|
+
}
|
|
2899
|
+
async _open(ctx) {
|
|
2900
|
+
this._tar = await import("@obsidize/tar-browserify");
|
|
2901
|
+
}
|
|
2902
|
+
async _close() {
|
|
2903
|
+
return Promise.resolve();
|
|
2904
|
+
}
|
|
2905
|
+
async begin(meta) {
|
|
2906
|
+
(0, import_invariant9.assertState)(this._tar, "Not open");
|
|
2907
|
+
(0, import_invariant9.assertState)(!this._meta, "Already started");
|
|
2908
|
+
this._meta = meta;
|
|
2909
|
+
this._archive = new this._tar.Archive();
|
|
2910
|
+
}
|
|
2911
|
+
async setCurrentRootUrl(url) {
|
|
2912
|
+
(0, import_invariant9.assertArgument)(url.startsWith("automerge:"), "Invalid root URL");
|
|
2913
|
+
(0, import_invariant9.assertState)(this._tar, "Not open");
|
|
2914
|
+
(0, import_invariant9.assertState)(this._meta, "Not started");
|
|
2915
|
+
this._currentRootUrl = url;
|
|
2916
|
+
}
|
|
2917
|
+
async writeDocument(documentId, data) {
|
|
2918
|
+
(0, import_invariant9.assertArgument)(!documentId.startsWith("automerge:"), "Invalid document ID");
|
|
2919
|
+
(0, import_invariant9.assertState)(this._archive, "Not open");
|
|
2920
|
+
this._archive.addBinaryFile(`${import_protocols7.SpaceArchiveFileStructure.documents}/${documentId}.bin`, data);
|
|
2921
|
+
}
|
|
2922
|
+
async finish() {
|
|
2923
|
+
(0, import_invariant9.assertState)(this._archive, "Not open");
|
|
2924
|
+
(0, import_invariant9.assertState)(this._meta, "Not started");
|
|
2925
|
+
(0, import_invariant9.assertState)(this._currentRootUrl, "No root URL set");
|
|
2926
|
+
const metadata = {
|
|
2927
|
+
version: CURRENT_VERSION,
|
|
2928
|
+
createdAt: Date.now(),
|
|
2929
|
+
exportedBy: this._meta.exportedBy,
|
|
2930
|
+
originalSpaceId: this._meta.spaceId,
|
|
2931
|
+
echo: {
|
|
2932
|
+
currentRootUrl: this._currentRootUrl
|
|
2933
|
+
}
|
|
2934
|
+
};
|
|
2935
|
+
this._archive.addTextFile(import_protocols7.SpaceArchiveFileStructure.metadata, JSON.stringify(metadata));
|
|
2936
|
+
const binary = this._archive.toUint8Array();
|
|
2937
|
+
return {
|
|
2938
|
+
filename: `${this._meta.spaceId}.tar`,
|
|
2939
|
+
contents: binary
|
|
2940
|
+
};
|
|
2941
|
+
}
|
|
2942
|
+
};
|
|
2943
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/space-export/space-archive-reader.ts";
|
|
2944
|
+
var extractSpaceArchive = async (archive) => {
|
|
2945
|
+
const { Archive } = await import("@obsidize/tar-browserify");
|
|
2946
|
+
const { entries } = await Archive.extract(archive.contents);
|
|
2947
|
+
const metadataEntry = entries.find((entry2) => entry2.fileName === import_protocols8.SpaceArchiveFileStructure.metadata);
|
|
2948
|
+
(0, import_invariant10.assertArgument)(metadataEntry, "Metadata entry not found");
|
|
2949
|
+
const metadata = JSON.parse(metadataEntry.getContentAsText());
|
|
2950
|
+
const documents = {};
|
|
2951
|
+
for (const entry2 of entries.filter((entry3) => entry3.fileName.startsWith(`${import_protocols8.SpaceArchiveFileStructure.documents}/`))) {
|
|
2952
|
+
const documentId = entry2.fileName.replace(`${import_protocols8.SpaceArchiveFileStructure.documents}/`, "").replace(/\.bin$/, "");
|
|
2953
|
+
(0, import_invariant10.invariant)(!documentId.includes("/"), void 0, {
|
|
2954
|
+
F: __dxlog_file10,
|
|
2955
|
+
L: 27,
|
|
2956
|
+
S: void 0,
|
|
2957
|
+
A: [
|
|
2958
|
+
"!documentId.includes('/')",
|
|
2959
|
+
""
|
|
2960
|
+
]
|
|
2961
|
+
});
|
|
2962
|
+
documents[documentId] = entry2.content ?? (0, import_invariant10.failedInvariant)();
|
|
2963
|
+
}
|
|
2964
|
+
import_log10.log.info("extracted space archive", {
|
|
2965
|
+
metadata,
|
|
2966
|
+
documents
|
|
2967
|
+
}, {
|
|
2968
|
+
F: __dxlog_file10,
|
|
2969
|
+
L: 31,
|
|
2970
|
+
S: void 0,
|
|
2971
|
+
C: (f, a) => f(...a)
|
|
2972
|
+
});
|
|
2973
|
+
return {
|
|
2974
|
+
metadata,
|
|
2975
|
+
documents
|
|
2976
|
+
};
|
|
2977
|
+
};
|
|
2978
|
+
function _using_ctx2() {
|
|
2979
|
+
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
2980
|
+
var err = new Error();
|
|
2981
|
+
err.name = "SuppressedError";
|
|
2982
|
+
err.suppressed = suppressed;
|
|
2983
|
+
err.error = error;
|
|
2984
|
+
return err;
|
|
2985
|
+
}, empty = {}, stack = [];
|
|
2986
|
+
function using(isAwait, value) {
|
|
2987
|
+
if (value != null) {
|
|
2988
|
+
if (Object(value) !== value) {
|
|
2989
|
+
throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
2990
|
+
}
|
|
2991
|
+
if (isAwait) {
|
|
2992
|
+
var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")];
|
|
2993
|
+
}
|
|
2994
|
+
if (dispose == null) {
|
|
2995
|
+
dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")];
|
|
2996
|
+
}
|
|
2997
|
+
if (typeof dispose !== "function") {
|
|
2998
|
+
throw new TypeError(`Property [Symbol.dispose] is not a function.`);
|
|
2999
|
+
}
|
|
3000
|
+
stack.push({
|
|
3001
|
+
v: value,
|
|
3002
|
+
d: dispose,
|
|
3003
|
+
a: isAwait
|
|
3004
|
+
});
|
|
3005
|
+
} else if (isAwait) {
|
|
3006
|
+
stack.push({
|
|
3007
|
+
d: value,
|
|
3008
|
+
a: isAwait
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
return value;
|
|
3012
|
+
}
|
|
3013
|
+
return {
|
|
3014
|
+
e: empty,
|
|
3015
|
+
u: using.bind(null, false),
|
|
3016
|
+
a: using.bind(null, true),
|
|
3017
|
+
d: function() {
|
|
3018
|
+
var error = this.e;
|
|
3019
|
+
function next() {
|
|
3020
|
+
while (resource = stack.pop()) {
|
|
3021
|
+
try {
|
|
3022
|
+
var resource, disposalResult = resource.d && resource.d.call(resource.v);
|
|
3023
|
+
if (resource.a) {
|
|
3024
|
+
return Promise.resolve(disposalResult).then(next, err);
|
|
3025
|
+
}
|
|
3026
|
+
} catch (e) {
|
|
3027
|
+
return err(e);
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
if (error !== empty) throw error;
|
|
3031
|
+
}
|
|
3032
|
+
function err(e) {
|
|
3033
|
+
error = error !== empty ? new _disposeSuppressedError(error, e) : e;
|
|
3034
|
+
return next();
|
|
3035
|
+
}
|
|
3036
|
+
return next();
|
|
3037
|
+
}
|
|
3038
|
+
};
|
|
3039
|
+
}
|
|
3040
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
2814
3041
|
var SpacesServiceImpl = class {
|
|
2815
3042
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
2816
3043
|
this._identityManager = _identityManager;
|
|
@@ -2857,8 +3084,8 @@ var SpacesServiceImpl = class {
|
|
|
2857
3084
|
}
|
|
2858
3085
|
const credentials = await (0, import_credentials13.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
2859
3086
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2860
|
-
F:
|
|
2861
|
-
L:
|
|
3087
|
+
F: __dxlog_file11,
|
|
3088
|
+
L: 118,
|
|
2862
3089
|
S: this,
|
|
2863
3090
|
A: [
|
|
2864
3091
|
"credentials[0].credential",
|
|
@@ -2867,8 +3094,8 @@ var SpacesServiceImpl = class {
|
|
|
2867
3094
|
});
|
|
2868
3095
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2869
3096
|
(0, import_invariant8.invariant)((0, import_credentials13.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2870
|
-
F:
|
|
2871
|
-
L:
|
|
3097
|
+
F: __dxlog_file11,
|
|
3098
|
+
L: 120,
|
|
2872
3099
|
S: this,
|
|
2873
3100
|
A: [
|
|
2874
3101
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2885,8 +3112,8 @@ var SpacesServiceImpl = class {
|
|
|
2885
3112
|
(0, import_log9.log)("update", () => ({
|
|
2886
3113
|
ids: spaces.map((space) => space.id)
|
|
2887
3114
|
}), {
|
|
2888
|
-
F:
|
|
2889
|
-
L:
|
|
3115
|
+
F: __dxlog_file11,
|
|
3116
|
+
L: 133,
|
|
2890
3117
|
S: this,
|
|
2891
3118
|
C: (f, a) => f(...a)
|
|
2892
3119
|
});
|
|
@@ -2977,8 +3204,8 @@ var SpacesServiceImpl = class {
|
|
|
2977
3204
|
});
|
|
2978
3205
|
} else {
|
|
2979
3206
|
(0, import_invariant8.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
2980
|
-
F:
|
|
2981
|
-
L:
|
|
3207
|
+
F: __dxlog_file11,
|
|
3208
|
+
L: 231,
|
|
2982
3209
|
S: this,
|
|
2983
3210
|
A: [
|
|
2984
3211
|
"!credential.id",
|
|
@@ -2986,8 +3213,8 @@ var SpacesServiceImpl = class {
|
|
|
2986
3213
|
]
|
|
2987
3214
|
});
|
|
2988
3215
|
(0, import_invariant8.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
2989
|
-
F:
|
|
2990
|
-
L:
|
|
3216
|
+
F: __dxlog_file11,
|
|
3217
|
+
L: 232,
|
|
2991
3218
|
S: this,
|
|
2992
3219
|
A: [
|
|
2993
3220
|
"this._identityManager.identity",
|
|
@@ -2996,8 +3223,8 @@ var SpacesServiceImpl = class {
|
|
|
2996
3223
|
});
|
|
2997
3224
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
2998
3225
|
(0, import_invariant8.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
2999
|
-
F:
|
|
3000
|
-
L:
|
|
3226
|
+
F: __dxlog_file11,
|
|
3227
|
+
L: 234,
|
|
3001
3228
|
S: this,
|
|
3002
3229
|
A: [
|
|
3003
3230
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -3043,11 +3270,58 @@ var SpacesServiceImpl = class {
|
|
|
3043
3270
|
credential
|
|
3044
3271
|
});
|
|
3045
3272
|
}
|
|
3273
|
+
async exportSpace(request) {
|
|
3274
|
+
try {
|
|
3275
|
+
var _usingCtx = _using_ctx2();
|
|
3276
|
+
const writer = _usingCtx.a(await new SpaceArchiveWriter().open());
|
|
3277
|
+
(0, import_invariant8.assertArgument)(import_keys9.SpaceId.isValid(request.spaceId), "Invalid space ID");
|
|
3278
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3279
|
+
const space = dataSpaceManager.getSpaceById(request.spaceId) ?? (0, import_debug3.raise)(new Error("Space not found"));
|
|
3280
|
+
await writer.begin({
|
|
3281
|
+
spaceId: space.id
|
|
3282
|
+
});
|
|
3283
|
+
const rootUrl = space.automergeSpaceState.lastEpoch?.subject.assertion.automergeRoot;
|
|
3284
|
+
(0, import_invariant8.assertState)(rootUrl, "Space does not have a root URL");
|
|
3285
|
+
await writer.setCurrentRootUrl(rootUrl);
|
|
3286
|
+
for await (const [documentId, data] of space.getAllDocuments()) {
|
|
3287
|
+
await writer.writeDocument(documentId, data);
|
|
3288
|
+
}
|
|
3289
|
+
const archive = await writer.finish();
|
|
3290
|
+
return {
|
|
3291
|
+
archive
|
|
3292
|
+
};
|
|
3293
|
+
} catch (_) {
|
|
3294
|
+
_usingCtx.e = _;
|
|
3295
|
+
} finally {
|
|
3296
|
+
await _usingCtx.d();
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
async importSpace(request) {
|
|
3300
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3301
|
+
const extracted = await extractSpaceArchive(request.archive);
|
|
3302
|
+
(0, import_invariant8.invariant)(extracted.metadata.echo?.currentRootUrl, "Space archive does not contain a root URL", {
|
|
3303
|
+
F: __dxlog_file11,
|
|
3304
|
+
L: 288,
|
|
3305
|
+
S: this,
|
|
3306
|
+
A: [
|
|
3307
|
+
"extracted.metadata.echo?.currentRootUrl",
|
|
3308
|
+
"'Space archive does not contain a root URL'"
|
|
3309
|
+
]
|
|
3310
|
+
});
|
|
3311
|
+
const space = await dataSpaceManager.createSpace({
|
|
3312
|
+
documents: extracted.documents,
|
|
3313
|
+
rootUrl: extracted.metadata.echo?.currentRootUrl
|
|
3314
|
+
});
|
|
3315
|
+
await this._updateMetrics();
|
|
3316
|
+
return {
|
|
3317
|
+
newSpaceId: space.id
|
|
3318
|
+
};
|
|
3319
|
+
}
|
|
3046
3320
|
async _joinByAdmission({ credential }) {
|
|
3047
3321
|
const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
|
|
3048
3322
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3049
|
-
F:
|
|
3050
|
-
L:
|
|
3323
|
+
F: __dxlog_file11,
|
|
3324
|
+
L: 299,
|
|
3051
3325
|
S: this,
|
|
3052
3326
|
A: [
|
|
3053
3327
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3056,8 +3330,8 @@ var SpacesServiceImpl = class {
|
|
|
3056
3330
|
});
|
|
3057
3331
|
const myIdentity = this._identityManager.identity;
|
|
3058
3332
|
(0, import_invariant8.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
3059
|
-
F:
|
|
3060
|
-
L:
|
|
3333
|
+
F: __dxlog_file11,
|
|
3334
|
+
L: 301,
|
|
3061
3335
|
S: this,
|
|
3062
3336
|
A: [
|
|
3063
3337
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -3149,7 +3423,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
3149
3423
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3150
3424
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3151
3425
|
}
|
|
3152
|
-
var
|
|
3426
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
3153
3427
|
var Identity = class {
|
|
3154
3428
|
constructor(params) {
|
|
3155
3429
|
this._edgeFeedReplicator = void 0;
|
|
@@ -3166,7 +3440,7 @@ var Identity = class {
|
|
|
3166
3440
|
import_log6.log.trace("dxos.halo.device", {
|
|
3167
3441
|
deviceKey: params.deviceKey
|
|
3168
3442
|
}, {
|
|
3169
|
-
F:
|
|
3443
|
+
F: __dxlog_file12,
|
|
3170
3444
|
L: 82,
|
|
3171
3445
|
S: this,
|
|
3172
3446
|
C: (f, a) => f(...a)
|
|
@@ -3268,7 +3542,7 @@ var Identity = class {
|
|
|
3268
3542
|
*/
|
|
3269
3543
|
getIdentityCredentialSigner() {
|
|
3270
3544
|
(0, import_invariant6.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
3271
|
-
F:
|
|
3545
|
+
F: __dxlog_file12,
|
|
3272
3546
|
L: 198,
|
|
3273
3547
|
S: this,
|
|
3274
3548
|
A: [
|
|
@@ -3312,7 +3586,7 @@ var Identity = class {
|
|
|
3312
3586
|
controlFeedKey,
|
|
3313
3587
|
dataFeedKey
|
|
3314
3588
|
}, {
|
|
3315
|
-
F:
|
|
3589
|
+
F: __dxlog_file12,
|
|
3316
3590
|
L: 223,
|
|
3317
3591
|
S: this,
|
|
3318
3592
|
C: (f, a) => f(...a)
|
|
@@ -3371,7 +3645,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3371
3645
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3372
3646
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3373
3647
|
}
|
|
3374
|
-
var
|
|
3648
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
3375
3649
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3376
3650
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3377
3651
|
var IdentityManager = class {
|
|
@@ -3391,20 +3665,20 @@ var IdentityManager = class {
|
|
|
3391
3665
|
return this._identity;
|
|
3392
3666
|
}
|
|
3393
3667
|
async open(ctx) {
|
|
3394
|
-
const traceId =
|
|
3395
|
-
|
|
3668
|
+
const traceId = import_keys10.PublicKey.random().toHex();
|
|
3669
|
+
import_log11.log.trace("dxos.halo.identity-manager.open", import_protocols9.trace.begin({
|
|
3396
3670
|
id: traceId
|
|
3397
3671
|
}), {
|
|
3398
|
-
F:
|
|
3672
|
+
F: __dxlog_file13,
|
|
3399
3673
|
L: 116,
|
|
3400
3674
|
S: this,
|
|
3401
3675
|
C: (f, a) => f(...a)
|
|
3402
3676
|
});
|
|
3403
3677
|
const identityRecord = this._metadataStore.getIdentityRecord();
|
|
3404
|
-
(0,
|
|
3678
|
+
(0, import_log11.log)("identity record", {
|
|
3405
3679
|
identityRecord
|
|
3406
3680
|
}, {
|
|
3407
|
-
F:
|
|
3681
|
+
F: __dxlog_file13,
|
|
3408
3682
|
L: 119,
|
|
3409
3683
|
S: this,
|
|
3410
3684
|
C: (f, a) => f(...a)
|
|
@@ -3413,35 +3687,35 @@ var IdentityManager = class {
|
|
|
3413
3687
|
this._identity = await this._constructIdentity(identityRecord);
|
|
3414
3688
|
await this._identity.open(ctx);
|
|
3415
3689
|
await this._identity.ready();
|
|
3416
|
-
|
|
3690
|
+
import_log11.log.trace("dxos.halo.identity", {
|
|
3417
3691
|
identityKey: identityRecord.identityKey,
|
|
3418
3692
|
displayName: this._identity.profileDocument?.displayName
|
|
3419
3693
|
}, {
|
|
3420
|
-
F:
|
|
3694
|
+
F: __dxlog_file13,
|
|
3421
3695
|
L: 124,
|
|
3422
3696
|
S: this,
|
|
3423
3697
|
C: (f, a) => f(...a)
|
|
3424
3698
|
});
|
|
3425
3699
|
this.stateUpdate.emit();
|
|
3426
3700
|
}
|
|
3427
|
-
|
|
3701
|
+
import_log11.log.trace("dxos.halo.identity-manager.open", import_protocols9.trace.end({
|
|
3428
3702
|
id: traceId
|
|
3429
3703
|
}), {
|
|
3430
|
-
F:
|
|
3704
|
+
F: __dxlog_file13,
|
|
3431
3705
|
L: 131,
|
|
3432
3706
|
S: this,
|
|
3433
3707
|
C: (f, a) => f(...a)
|
|
3434
3708
|
});
|
|
3435
3709
|
}
|
|
3436
3710
|
async close() {
|
|
3437
|
-
await this._identity?.close(new
|
|
3438
|
-
F:
|
|
3711
|
+
await this._identity?.close(new import_context9.Context(void 0, {
|
|
3712
|
+
F: __dxlog_file13,
|
|
3439
3713
|
L: 135
|
|
3440
3714
|
}));
|
|
3441
3715
|
}
|
|
3442
3716
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
3443
|
-
(0,
|
|
3444
|
-
F:
|
|
3717
|
+
(0, import_invariant11.invariant)(!this._identity, "Identity already exists.", {
|
|
3718
|
+
F: __dxlog_file13,
|
|
3445
3719
|
L: 140,
|
|
3446
3720
|
S: this,
|
|
3447
3721
|
A: [
|
|
@@ -3449,8 +3723,8 @@ var IdentityManager = class {
|
|
|
3449
3723
|
"'Identity already exists.'"
|
|
3450
3724
|
]
|
|
3451
3725
|
});
|
|
3452
|
-
(0,
|
|
3453
|
-
F:
|
|
3726
|
+
(0, import_log11.log)("creating identity...", void 0, {
|
|
3727
|
+
F: __dxlog_file13,
|
|
3454
3728
|
L: 141,
|
|
3455
3729
|
S: this,
|
|
3456
3730
|
C: (f, a) => f(...a)
|
|
@@ -3467,14 +3741,14 @@ var IdentityManager = class {
|
|
|
3467
3741
|
}
|
|
3468
3742
|
};
|
|
3469
3743
|
const identity = await this._constructIdentity(identityRecord);
|
|
3470
|
-
await identity.open(new
|
|
3471
|
-
F:
|
|
3744
|
+
await identity.open(new import_context9.Context(void 0, {
|
|
3745
|
+
F: __dxlog_file13,
|
|
3472
3746
|
L: 156
|
|
3473
3747
|
}));
|
|
3474
3748
|
{
|
|
3475
3749
|
const generator = new import_credentials14.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
3476
|
-
(0,
|
|
3477
|
-
F:
|
|
3750
|
+
(0, import_invariant11.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
3751
|
+
F: __dxlog_file13,
|
|
3478
3752
|
L: 160,
|
|
3479
3753
|
S: this,
|
|
3480
3754
|
A: [
|
|
@@ -3482,8 +3756,8 @@ var IdentityManager = class {
|
|
|
3482
3756
|
"'Genesis feed key is required.'"
|
|
3483
3757
|
]
|
|
3484
3758
|
});
|
|
3485
|
-
(0,
|
|
3486
|
-
F:
|
|
3759
|
+
(0, import_invariant11.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
3760
|
+
F: __dxlog_file13,
|
|
3487
3761
|
L: 161,
|
|
3488
3762
|
S: this,
|
|
3489
3763
|
A: [
|
|
@@ -3518,22 +3792,22 @@ var IdentityManager = class {
|
|
|
3518
3792
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
3519
3793
|
this._identity = identity;
|
|
3520
3794
|
await this._identity.ready();
|
|
3521
|
-
|
|
3795
|
+
import_log11.log.trace("dxos.halo.identity", {
|
|
3522
3796
|
identityKey: identityRecord.identityKey,
|
|
3523
3797
|
displayName: this._identity.profileDocument?.displayName
|
|
3524
3798
|
}, {
|
|
3525
|
-
F:
|
|
3799
|
+
F: __dxlog_file13,
|
|
3526
3800
|
L: 199,
|
|
3527
3801
|
S: this,
|
|
3528
3802
|
C: (f, a) => f(...a)
|
|
3529
3803
|
});
|
|
3530
3804
|
this.stateUpdate.emit();
|
|
3531
|
-
(0,
|
|
3805
|
+
(0, import_log11.log)("created identity", {
|
|
3532
3806
|
identityKey: identity.identityKey,
|
|
3533
3807
|
deviceKey: identity.deviceKey,
|
|
3534
3808
|
profile: identity.profileDocument
|
|
3535
3809
|
}, {
|
|
3536
|
-
F:
|
|
3810
|
+
F: __dxlog_file13,
|
|
3537
3811
|
L: 205,
|
|
3538
3812
|
S: this,
|
|
3539
3813
|
C: (f, a) => f(...a)
|
|
@@ -3567,16 +3841,16 @@ var IdentityManager = class {
|
|
|
3567
3841
|
* Prepare an identity object as the first step of acceptIdentity flow.
|
|
3568
3842
|
*/
|
|
3569
3843
|
async prepareIdentity(params) {
|
|
3570
|
-
(0,
|
|
3844
|
+
(0, import_log11.log)("accepting identity", {
|
|
3571
3845
|
params
|
|
3572
3846
|
}, {
|
|
3573
|
-
F:
|
|
3847
|
+
F: __dxlog_file13,
|
|
3574
3848
|
L: 244,
|
|
3575
3849
|
S: this,
|
|
3576
3850
|
C: (f, a) => f(...a)
|
|
3577
3851
|
});
|
|
3578
|
-
(0,
|
|
3579
|
-
F:
|
|
3852
|
+
(0, import_invariant11.invariant)(!this._identity, "Identity already exists.", {
|
|
3853
|
+
F: __dxlog_file13,
|
|
3580
3854
|
L: 245,
|
|
3581
3855
|
S: this,
|
|
3582
3856
|
A: [
|
|
@@ -3596,8 +3870,8 @@ var IdentityManager = class {
|
|
|
3596
3870
|
}
|
|
3597
3871
|
};
|
|
3598
3872
|
const identity = await this._constructIdentity(identityRecord);
|
|
3599
|
-
await identity.open(new
|
|
3600
|
-
F:
|
|
3873
|
+
await identity.open(new import_context9.Context(void 0, {
|
|
3874
|
+
F: __dxlog_file13,
|
|
3601
3875
|
L: 259
|
|
3602
3876
|
}));
|
|
3603
3877
|
return {
|
|
@@ -3612,11 +3886,11 @@ var IdentityManager = class {
|
|
|
3612
3886
|
this._identity = identity;
|
|
3613
3887
|
await this._identity.ready();
|
|
3614
3888
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
3615
|
-
|
|
3889
|
+
import_log11.log.trace("dxos.halo.identity", {
|
|
3616
3890
|
identityKey: this._identity.identityKey,
|
|
3617
3891
|
displayName: this._identity.profileDocument?.displayName
|
|
3618
3892
|
}, {
|
|
3619
|
-
F:
|
|
3893
|
+
F: __dxlog_file13,
|
|
3620
3894
|
L: 273,
|
|
3621
3895
|
S: this,
|
|
3622
3896
|
C: (f, a) => f(...a)
|
|
@@ -3626,11 +3900,11 @@ var IdentityManager = class {
|
|
|
3626
3900
|
...profile
|
|
3627
3901
|
});
|
|
3628
3902
|
this.stateUpdate.emit();
|
|
3629
|
-
(0,
|
|
3903
|
+
(0, import_log11.log)("accepted identity", {
|
|
3630
3904
|
identityKey: identity.identityKey,
|
|
3631
3905
|
deviceKey: identity.deviceKey
|
|
3632
3906
|
}, {
|
|
3633
|
-
F:
|
|
3907
|
+
F: __dxlog_file13,
|
|
3634
3908
|
L: 284,
|
|
3635
3909
|
S: this,
|
|
3636
3910
|
C: (f, a) => f(...a)
|
|
@@ -3640,8 +3914,8 @@ var IdentityManager = class {
|
|
|
3640
3914
|
* Update the profile document of an existing identity.
|
|
3641
3915
|
*/
|
|
3642
3916
|
async updateProfile(profile) {
|
|
3643
|
-
(0,
|
|
3644
|
-
F:
|
|
3917
|
+
(0, import_invariant11.invariant)(this._identity, "Identity not initialized.", {
|
|
3918
|
+
F: __dxlog_file13,
|
|
3645
3919
|
L: 291,
|
|
3646
3920
|
S: this,
|
|
3647
3921
|
A: [
|
|
@@ -3671,8 +3945,8 @@ var IdentityManager = class {
|
|
|
3671
3945
|
return profile;
|
|
3672
3946
|
}
|
|
3673
3947
|
async updateDeviceProfile(profile) {
|
|
3674
|
-
(0,
|
|
3675
|
-
F:
|
|
3948
|
+
(0, import_invariant11.invariant)(this._identity, "Identity not initialized.", {
|
|
3949
|
+
F: __dxlog_file13,
|
|
3676
3950
|
L: 308,
|
|
3677
3951
|
S: this,
|
|
3678
3952
|
A: [
|
|
@@ -3707,8 +3981,8 @@ var IdentityManager = class {
|
|
|
3707
3981
|
};
|
|
3708
3982
|
}
|
|
3709
3983
|
async _constructIdentity(identityRecord) {
|
|
3710
|
-
(0,
|
|
3711
|
-
F:
|
|
3984
|
+
(0, import_invariant11.invariant)(!this._identity, void 0, {
|
|
3985
|
+
F: __dxlog_file13,
|
|
3712
3986
|
L: 334,
|
|
3713
3987
|
S: this,
|
|
3714
3988
|
A: [
|
|
@@ -3716,10 +3990,10 @@ var IdentityManager = class {
|
|
|
3716
3990
|
""
|
|
3717
3991
|
]
|
|
3718
3992
|
});
|
|
3719
|
-
(0,
|
|
3993
|
+
(0, import_log11.log)("constructing identity", {
|
|
3720
3994
|
identityRecord
|
|
3721
3995
|
}, {
|
|
3722
|
-
F:
|
|
3996
|
+
F: __dxlog_file13,
|
|
3723
3997
|
L: 335,
|
|
3724
3998
|
S: this,
|
|
3725
3999
|
C: (f, a) => f(...a)
|
|
@@ -3733,8 +4007,8 @@ var IdentityManager = class {
|
|
|
3733
4007
|
identityKey: identityRecord.deviceKey,
|
|
3734
4008
|
gossip
|
|
3735
4009
|
});
|
|
3736
|
-
(0,
|
|
3737
|
-
F:
|
|
4010
|
+
(0, import_invariant11.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
4011
|
+
F: __dxlog_file13,
|
|
3738
4012
|
L: 348,
|
|
3739
4013
|
S: this,
|
|
3740
4014
|
A: [
|
|
@@ -3745,8 +4019,8 @@ var IdentityManager = class {
|
|
|
3745
4019
|
const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
|
|
3746
4020
|
writable: true
|
|
3747
4021
|
});
|
|
3748
|
-
(0,
|
|
3749
|
-
F:
|
|
4022
|
+
(0, import_invariant11.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
4023
|
+
F: __dxlog_file13,
|
|
3750
4024
|
L: 352,
|
|
3751
4025
|
S: this,
|
|
3752
4026
|
A: [
|
|
@@ -3782,10 +4056,10 @@ var IdentityManager = class {
|
|
|
3782
4056
|
edgeConnection: this._edgeConnection,
|
|
3783
4057
|
edgeFeatures: this._edgeFeatures
|
|
3784
4058
|
});
|
|
3785
|
-
(0,
|
|
4059
|
+
(0, import_log11.log)("done", {
|
|
3786
4060
|
identityKey: identityRecord.identityKey
|
|
3787
4061
|
}, {
|
|
3788
|
-
F:
|
|
4062
|
+
F: __dxlog_file13,
|
|
3789
4063
|
L: 383,
|
|
3790
4064
|
S: this,
|
|
3791
4065
|
C: (f, a) => f(...a)
|
|
@@ -3809,8 +4083,8 @@ var IdentityManager = class {
|
|
|
3809
4083
|
}));
|
|
3810
4084
|
},
|
|
3811
4085
|
onAuthFailure: () => {
|
|
3812
|
-
|
|
3813
|
-
F:
|
|
4086
|
+
import_log11.log.warn("auth failure", void 0, {
|
|
4087
|
+
F: __dxlog_file13,
|
|
3814
4088
|
L: 408,
|
|
3815
4089
|
S: this,
|
|
3816
4090
|
C: (f, a) => f(...a)
|
|
@@ -3832,9 +4106,9 @@ _ts_decorate5([
|
|
|
3832
4106
|
IdentityManager = _ts_decorate5([
|
|
3833
4107
|
import_tracing7.trace.resource()
|
|
3834
4108
|
], IdentityManager);
|
|
3835
|
-
var
|
|
4109
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
3836
4110
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
3837
|
-
var IdentityServiceImpl = class extends
|
|
4111
|
+
var IdentityServiceImpl = class extends import_context10.Resource {
|
|
3838
4112
|
constructor(_identityManager, _recoveryManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
3839
4113
|
super();
|
|
3840
4114
|
this._identityManager = _identityManager;
|
|
@@ -3862,8 +4136,8 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3862
4136
|
async _createDefaultSpace(dataSpaceManager) {
|
|
3863
4137
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
3864
4138
|
const identity = this._identityManager.identity;
|
|
3865
|
-
(0,
|
|
3866
|
-
F:
|
|
4139
|
+
(0, import_invariant12.invariant)(identity, void 0, {
|
|
4140
|
+
F: __dxlog_file14,
|
|
3867
4141
|
L: 61,
|
|
3868
4142
|
S: this,
|
|
3869
4143
|
A: [
|
|
@@ -3894,8 +4168,8 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3894
4168
|
};
|
|
3895
4169
|
}
|
|
3896
4170
|
async updateProfile(profile) {
|
|
3897
|
-
(0,
|
|
3898
|
-
F:
|
|
4171
|
+
(0, import_invariant12.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
4172
|
+
F: __dxlog_file14,
|
|
3899
4173
|
L: 88,
|
|
3900
4174
|
S: this,
|
|
3901
4175
|
A: [
|
|
@@ -3927,8 +4201,8 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3927
4201
|
}
|
|
3928
4202
|
// TODO(burdon): Rename createPresentation?
|
|
3929
4203
|
async signPresentation({ presentation, nonce }) {
|
|
3930
|
-
(0,
|
|
3931
|
-
F:
|
|
4204
|
+
(0, import_invariant12.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
4205
|
+
F: __dxlog_file14,
|
|
3932
4206
|
L: 116,
|
|
3933
4207
|
S: this,
|
|
3934
4208
|
A: [
|
|
@@ -3946,8 +4220,8 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3946
4220
|
}
|
|
3947
4221
|
async createAuthCredential() {
|
|
3948
4222
|
const identity = this._identityManager.identity;
|
|
3949
|
-
(0,
|
|
3950
|
-
F:
|
|
4223
|
+
(0, import_invariant12.invariant)(identity, "Identity not initialized.", {
|
|
4224
|
+
F: __dxlog_file14,
|
|
3951
4225
|
L: 130,
|
|
3952
4226
|
S: this,
|
|
3953
4227
|
A: [
|
|
@@ -3982,10 +4256,10 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3982
4256
|
}
|
|
3983
4257
|
if (await dataSpaceManager.isDefaultSpace(space)) {
|
|
3984
4258
|
if (foundDefaultSpace) {
|
|
3985
|
-
|
|
4259
|
+
import_log12.log.warn("Multiple default spaces found. Using the first one.", {
|
|
3986
4260
|
duplicate: space.id
|
|
3987
4261
|
}, {
|
|
3988
|
-
F:
|
|
4262
|
+
F: __dxlog_file14,
|
|
3989
4263
|
L: 164,
|
|
3990
4264
|
S: this,
|
|
3991
4265
|
C: (f, a) => f(...a)
|
|
@@ -3998,8 +4272,8 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3998
4272
|
recordedDefaultSpaceTrigger.wake();
|
|
3999
4273
|
}
|
|
4000
4274
|
}, (err) => {
|
|
4001
|
-
|
|
4002
|
-
F:
|
|
4275
|
+
import_log12.log.catch(err, void 0, {
|
|
4276
|
+
F: __dxlog_file14,
|
|
4003
4277
|
L: 175,
|
|
4004
4278
|
S: this,
|
|
4005
4279
|
C: (f, a) => f(...a)
|
|
@@ -4021,7 +4295,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4021
4295
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4022
4296
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4023
4297
|
}
|
|
4024
|
-
function
|
|
4298
|
+
function _using_ctx3() {
|
|
4025
4299
|
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
4026
4300
|
var err = new Error();
|
|
4027
4301
|
err.name = "SuppressedError";
|
|
@@ -4083,12 +4357,12 @@ function _using_ctx2() {
|
|
|
4083
4357
|
}
|
|
4084
4358
|
};
|
|
4085
4359
|
}
|
|
4086
|
-
var
|
|
4360
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4087
4361
|
var DataSpace = class {
|
|
4088
4362
|
constructor(params) {
|
|
4089
4363
|
this._ctx = new import_context4.Context(void 0, {
|
|
4090
|
-
F:
|
|
4091
|
-
L:
|
|
4364
|
+
F: __dxlog_file15,
|
|
4365
|
+
L: 97
|
|
4092
4366
|
});
|
|
4093
4367
|
this._cache = void 0;
|
|
4094
4368
|
this._edgeFeedReplicator = void 0;
|
|
@@ -4136,8 +4410,8 @@ var DataSpace = class {
|
|
|
4136
4410
|
(0, import_log4.log)("new state", {
|
|
4137
4411
|
state: import_services4.SpaceState[this._state]
|
|
4138
4412
|
}, {
|
|
4139
|
-
F:
|
|
4140
|
-
L:
|
|
4413
|
+
F: __dxlog_file15,
|
|
4414
|
+
L: 173,
|
|
4141
4415
|
S: this,
|
|
4142
4416
|
C: (f, a) => f(...a)
|
|
4143
4417
|
});
|
|
@@ -4195,8 +4469,8 @@ var DataSpace = class {
|
|
|
4195
4469
|
this.inner.protocol.feedAdded.append(this._onFeedAdded);
|
|
4196
4470
|
}
|
|
4197
4471
|
await this._inner.open(new import_context4.Context(void 0, {
|
|
4198
|
-
F:
|
|
4199
|
-
L:
|
|
4472
|
+
F: __dxlog_file15,
|
|
4473
|
+
L: 247
|
|
4200
4474
|
}));
|
|
4201
4475
|
await this._inner.startProtocol();
|
|
4202
4476
|
await this._edgeFeedReplicator?.open();
|
|
@@ -4204,8 +4478,8 @@ var DataSpace = class {
|
|
|
4204
4478
|
(0, import_log4.log)("new state", {
|
|
4205
4479
|
state: import_services4.SpaceState[this._state]
|
|
4206
4480
|
}, {
|
|
4207
|
-
F:
|
|
4208
|
-
L:
|
|
4481
|
+
F: __dxlog_file15,
|
|
4482
|
+
L: 253,
|
|
4209
4483
|
S: this,
|
|
4210
4484
|
C: (f, a) => f(...a)
|
|
4211
4485
|
});
|
|
@@ -4224,15 +4498,15 @@ var DataSpace = class {
|
|
|
4224
4498
|
(0, import_log4.log)("new state", {
|
|
4225
4499
|
state: import_services4.SpaceState[this._state]
|
|
4226
4500
|
}, {
|
|
4227
|
-
F:
|
|
4228
|
-
L:
|
|
4501
|
+
F: __dxlog_file15,
|
|
4502
|
+
L: 272,
|
|
4229
4503
|
S: this,
|
|
4230
4504
|
C: (f, a) => f(...a)
|
|
4231
4505
|
});
|
|
4232
4506
|
await this._ctx.dispose();
|
|
4233
4507
|
this._ctx = new import_context4.Context(void 0, {
|
|
4234
|
-
F:
|
|
4235
|
-
L:
|
|
4508
|
+
F: __dxlog_file15,
|
|
4509
|
+
L: 274
|
|
4236
4510
|
});
|
|
4237
4511
|
if (this._edgeFeedReplicator) {
|
|
4238
4512
|
this.inner.protocol.feedAdded.remove(this._onFeedAdded);
|
|
@@ -4264,16 +4538,16 @@ var DataSpace = class {
|
|
|
4264
4538
|
} catch (err) {
|
|
4265
4539
|
if (err instanceof import_protocols3.CancelledError || err instanceof import_context4.ContextDisposedError) {
|
|
4266
4540
|
(0, import_log4.log)("data pipeline initialization cancelled", err, {
|
|
4267
|
-
F:
|
|
4268
|
-
L:
|
|
4541
|
+
F: __dxlog_file15,
|
|
4542
|
+
L: 312,
|
|
4269
4543
|
S: this,
|
|
4270
4544
|
C: (f, a) => f(...a)
|
|
4271
4545
|
});
|
|
4272
4546
|
return;
|
|
4273
4547
|
}
|
|
4274
4548
|
import_log4.log.error("Error initializing data pipeline", err, {
|
|
4275
|
-
F:
|
|
4276
|
-
L:
|
|
4549
|
+
F: __dxlog_file15,
|
|
4550
|
+
L: 316,
|
|
4277
4551
|
S: this,
|
|
4278
4552
|
C: (f, a) => f(...a)
|
|
4279
4553
|
});
|
|
@@ -4281,8 +4555,8 @@ var DataSpace = class {
|
|
|
4281
4555
|
(0, import_log4.log)("new state", {
|
|
4282
4556
|
state: import_services4.SpaceState[this._state]
|
|
4283
4557
|
}, {
|
|
4284
|
-
F:
|
|
4285
|
-
L:
|
|
4558
|
+
F: __dxlog_file15,
|
|
4559
|
+
L: 318,
|
|
4286
4560
|
S: this,
|
|
4287
4561
|
C: (f, a) => f(...a)
|
|
4288
4562
|
});
|
|
@@ -4301,14 +4575,14 @@ var DataSpace = class {
|
|
|
4301
4575
|
(0, import_log4.log)("new state", {
|
|
4302
4576
|
state: import_services4.SpaceState[this._state]
|
|
4303
4577
|
}, {
|
|
4304
|
-
F:
|
|
4305
|
-
L:
|
|
4578
|
+
F: __dxlog_file15,
|
|
4579
|
+
L: 334,
|
|
4306
4580
|
S: this,
|
|
4307
4581
|
C: (f, a) => f(...a)
|
|
4308
4582
|
});
|
|
4309
4583
|
(0, import_log4.log)("initializing control pipeline", void 0, {
|
|
4310
|
-
F:
|
|
4311
|
-
L:
|
|
4584
|
+
F: __dxlog_file15,
|
|
4585
|
+
L: 336,
|
|
4312
4586
|
S: this,
|
|
4313
4587
|
C: (f, a) => f(...a)
|
|
4314
4588
|
});
|
|
@@ -4316,34 +4590,61 @@ var DataSpace = class {
|
|
|
4316
4590
|
await (0, import_async7.sleep)(1);
|
|
4317
4591
|
const ready = this.stateUpdate.waitForCondition(() => this._state === import_services4.SpaceState.SPACE_READY);
|
|
4318
4592
|
(0, import_log4.log)("initializing automerge root", void 0, {
|
|
4319
|
-
F:
|
|
4320
|
-
L:
|
|
4593
|
+
F: __dxlog_file15,
|
|
4594
|
+
L: 344,
|
|
4321
4595
|
S: this,
|
|
4322
4596
|
C: (f, a) => f(...a)
|
|
4323
4597
|
});
|
|
4324
4598
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4325
4599
|
(0, import_log4.log)("waiting for space to be ready", void 0, {
|
|
4326
|
-
F:
|
|
4327
|
-
L:
|
|
4600
|
+
F: __dxlog_file15,
|
|
4601
|
+
L: 348,
|
|
4328
4602
|
S: this,
|
|
4329
4603
|
C: (f, a) => f(...a)
|
|
4330
4604
|
});
|
|
4331
4605
|
await ready;
|
|
4332
4606
|
(0, import_log4.log)("space is ready", void 0, {
|
|
4333
|
-
F:
|
|
4334
|
-
L:
|
|
4607
|
+
F: __dxlog_file15,
|
|
4608
|
+
L: 350,
|
|
4335
4609
|
S: this,
|
|
4336
4610
|
C: (f, a) => f(...a)
|
|
4337
4611
|
});
|
|
4338
4612
|
}
|
|
4613
|
+
async *getAllDocuments() {
|
|
4614
|
+
(0, import_invariant3.invariant)(this._databaseRoot, "Space is not ready", {
|
|
4615
|
+
F: __dxlog_file15,
|
|
4616
|
+
L: 354,
|
|
4617
|
+
S: this,
|
|
4618
|
+
A: [
|
|
4619
|
+
"this._databaseRoot",
|
|
4620
|
+
"'Space is not ready'"
|
|
4621
|
+
]
|
|
4622
|
+
});
|
|
4623
|
+
const doc = this._databaseRoot.docSync() ?? (0, import_invariant3.failedInvariant)();
|
|
4624
|
+
const root = (0, import_automerge.save)(doc);
|
|
4625
|
+
yield [
|
|
4626
|
+
this._databaseRoot.documentId,
|
|
4627
|
+
root
|
|
4628
|
+
];
|
|
4629
|
+
for (const documentUrl of this._databaseRoot.getAllLinkedDocuments()) {
|
|
4630
|
+
const data = await this._echoHost.exportDoc(import_context4.Context.default(void 0, {
|
|
4631
|
+
F: __dxlog_file15,
|
|
4632
|
+
L: 360
|
|
4633
|
+
}), documentUrl);
|
|
4634
|
+
yield [
|
|
4635
|
+
documentUrl.replace(/^automerge:/, ""),
|
|
4636
|
+
data
|
|
4637
|
+
];
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4339
4640
|
async _enterReadyState() {
|
|
4340
4641
|
await this._callbacks.beforeReady?.();
|
|
4341
4642
|
this._state = import_services4.SpaceState.SPACE_READY;
|
|
4342
4643
|
(0, import_log4.log)("new state", {
|
|
4343
4644
|
state: import_services4.SpaceState[this._state]
|
|
4344
4645
|
}, {
|
|
4345
|
-
F:
|
|
4346
|
-
L:
|
|
4646
|
+
F: __dxlog_file15,
|
|
4647
|
+
L: 369,
|
|
4347
4648
|
S: this,
|
|
4348
4649
|
C: (f, a) => f(...a)
|
|
4349
4650
|
});
|
|
@@ -4359,8 +4660,8 @@ var DataSpace = class {
|
|
|
4359
4660
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4360
4661
|
await this._createWritableFeeds();
|
|
4361
4662
|
(0, import_log4.log)("writable feeds created", void 0, {
|
|
4362
|
-
F:
|
|
4363
|
-
L:
|
|
4663
|
+
F: __dxlog_file15,
|
|
4664
|
+
L: 386,
|
|
4364
4665
|
S: this,
|
|
4365
4666
|
C: (f, a) => f(...a)
|
|
4366
4667
|
});
|
|
@@ -4413,8 +4714,8 @@ var DataSpace = class {
|
|
|
4413
4714
|
(0, import_log4.log)("will notarize credentials for feed admission", {
|
|
4414
4715
|
count: credentials.length
|
|
4415
4716
|
}, {
|
|
4416
|
-
F:
|
|
4417
|
-
L:
|
|
4717
|
+
F: __dxlog_file15,
|
|
4718
|
+
L: 444,
|
|
4418
4719
|
S: this,
|
|
4419
4720
|
C: (f, a) => f(...a)
|
|
4420
4721
|
});
|
|
@@ -4424,15 +4725,15 @@ var DataSpace = class {
|
|
|
4424
4725
|
timeout: 0
|
|
4425
4726
|
});
|
|
4426
4727
|
(0, import_log4.log)("credentials notarized", void 0, {
|
|
4427
|
-
F:
|
|
4428
|
-
L:
|
|
4728
|
+
F: __dxlog_file15,
|
|
4729
|
+
L: 448,
|
|
4429
4730
|
S: this,
|
|
4430
4731
|
C: (f, a) => f(...a)
|
|
4431
4732
|
});
|
|
4432
4733
|
} catch (err) {
|
|
4433
4734
|
import_log4.log.error("error notarizing credentials for feed admission", err, {
|
|
4434
|
-
F:
|
|
4435
|
-
L:
|
|
4735
|
+
F: __dxlog_file15,
|
|
4736
|
+
L: 450,
|
|
4436
4737
|
S: this,
|
|
4437
4738
|
C: (f, a) => f(...a)
|
|
4438
4739
|
});
|
|
@@ -4446,8 +4747,8 @@ var DataSpace = class {
|
|
|
4446
4747
|
space: this.key,
|
|
4447
4748
|
rootUrl
|
|
4448
4749
|
}, {
|
|
4449
|
-
F:
|
|
4450
|
-
L:
|
|
4750
|
+
F: __dxlog_file15,
|
|
4751
|
+
L: 460,
|
|
4451
4752
|
S: this,
|
|
4452
4753
|
C: (f, a) => f(...a)
|
|
4453
4754
|
});
|
|
@@ -4455,7 +4756,7 @@ var DataSpace = class {
|
|
|
4455
4756
|
queueMicrotask(async () => {
|
|
4456
4757
|
try {
|
|
4457
4758
|
try {
|
|
4458
|
-
var _usingCtx =
|
|
4759
|
+
var _usingCtx = _using_ctx3();
|
|
4459
4760
|
await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
4460
4761
|
await (0, import_context4.cancelWithContext)(this._ctx, handle.whenReady());
|
|
4461
4762
|
});
|
|
@@ -4498,8 +4799,8 @@ var DataSpace = class {
|
|
|
4498
4799
|
rootUrl,
|
|
4499
4800
|
err
|
|
4500
4801
|
}, {
|
|
4501
|
-
F:
|
|
4502
|
-
L:
|
|
4802
|
+
F: __dxlog_file15,
|
|
4803
|
+
L: 503,
|
|
4503
4804
|
S: this,
|
|
4504
4805
|
C: (f, a) => f(...a)
|
|
4505
4806
|
});
|
|
@@ -4588,8 +4889,8 @@ var DataSpace = class {
|
|
|
4588
4889
|
(0, import_log4.log)("new state", {
|
|
4589
4890
|
state: import_services4.SpaceState[this._state]
|
|
4590
4891
|
}, {
|
|
4591
|
-
F:
|
|
4592
|
-
L:
|
|
4892
|
+
F: __dxlog_file15,
|
|
4893
|
+
L: 585,
|
|
4593
4894
|
S: this,
|
|
4594
4895
|
C: (f, a) => f(...a)
|
|
4595
4896
|
});
|
|
@@ -4647,7 +4948,7 @@ DataSpace = _ts_decorate6([
|
|
|
4647
4948
|
(0, import_async7.trackLeaks)("open", "close"),
|
|
4648
4949
|
import_tracing3.trace.resource()
|
|
4649
4950
|
], DataSpace);
|
|
4650
|
-
var
|
|
4951
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
4651
4952
|
var DeviceInvitationProtocol = class {
|
|
4652
4953
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
4653
4954
|
this._keyring = _keyring;
|
|
@@ -4674,8 +4975,8 @@ var DeviceInvitationProtocol = class {
|
|
|
4674
4975
|
throw new Error("delegation not supported");
|
|
4675
4976
|
}
|
|
4676
4977
|
async admit(_, request) {
|
|
4677
|
-
(0,
|
|
4678
|
-
F:
|
|
4978
|
+
(0, import_invariant13.invariant)(request.device, void 0, {
|
|
4979
|
+
F: __dxlog_file16,
|
|
4679
4980
|
L: 53,
|
|
4680
4981
|
S: this,
|
|
4681
4982
|
A: [
|
|
@@ -4685,8 +4986,8 @@ var DeviceInvitationProtocol = class {
|
|
|
4685
4986
|
});
|
|
4686
4987
|
const identity = this._getIdentity();
|
|
4687
4988
|
const credential = await identity.admitDevice(request.device);
|
|
4688
|
-
(0,
|
|
4689
|
-
F:
|
|
4989
|
+
(0, import_invariant13.invariant)((0, import_credentials17.getCredentialAssertion)(credential)["@type"] === "dxos.halo.credentials.AuthorizedDevice", void 0, {
|
|
4990
|
+
F: __dxlog_file16,
|
|
4690
4991
|
L: 56,
|
|
4691
4992
|
S: this,
|
|
4692
4993
|
A: [
|
|
@@ -4708,7 +5009,7 @@ var DeviceInvitationProtocol = class {
|
|
|
4708
5009
|
try {
|
|
4709
5010
|
const identity = this._getIdentity();
|
|
4710
5011
|
if (identity) {
|
|
4711
|
-
return new
|
|
5012
|
+
return new import_protocols10.AlreadyJoinedError("Currently only one identity per client is supported.");
|
|
4712
5013
|
}
|
|
4713
5014
|
} catch {
|
|
4714
5015
|
}
|
|
@@ -4730,8 +5031,8 @@ var DeviceInvitationProtocol = class {
|
|
|
4730
5031
|
};
|
|
4731
5032
|
}
|
|
4732
5033
|
async accept(response, request) {
|
|
4733
|
-
(0,
|
|
4734
|
-
F:
|
|
5034
|
+
(0, import_invariant13.invariant)(response.device, void 0, {
|
|
5035
|
+
F: __dxlog_file16,
|
|
4735
5036
|
L: 100,
|
|
4736
5037
|
S: this,
|
|
4737
5038
|
A: [
|
|
@@ -4740,8 +5041,8 @@ var DeviceInvitationProtocol = class {
|
|
|
4740
5041
|
]
|
|
4741
5042
|
});
|
|
4742
5043
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
4743
|
-
(0,
|
|
4744
|
-
F:
|
|
5044
|
+
(0, import_invariant13.invariant)(request.device, void 0, {
|
|
5045
|
+
F: __dxlog_file16,
|
|
4745
5046
|
L: 103,
|
|
4746
5047
|
S: this,
|
|
4747
5048
|
A: [
|
|
@@ -4777,17 +5078,17 @@ var computeExpirationTime = (invitation) => {
|
|
|
4777
5078
|
};
|
|
4778
5079
|
var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
4779
5080
|
let guard;
|
|
4780
|
-
return (0,
|
|
5081
|
+
return (0, import_context12.cancelWithContext)(ctx, (async () => {
|
|
4781
5082
|
guard = await mutex.acquire();
|
|
4782
5083
|
if (ctx.disposed) {
|
|
4783
5084
|
guard.release();
|
|
4784
5085
|
guard = void 0;
|
|
4785
|
-
throw new
|
|
5086
|
+
throw new import_context12.ContextDisposedError();
|
|
4786
5087
|
}
|
|
4787
5088
|
return guard;
|
|
4788
5089
|
})());
|
|
4789
5090
|
};
|
|
4790
|
-
var
|
|
5091
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/edge-invitation-handler.ts";
|
|
4791
5092
|
var MAX_RETRIES_PER_INVITATION = 5;
|
|
4792
5093
|
var DEFAULT_REQUEST_RETRY_INTERVAL_MS = 3e3;
|
|
4793
5094
|
var DEFAULT_REQUEST_RETRY_JITTER_MS = 500;
|
|
@@ -4800,8 +5101,8 @@ var EdgeInvitationHandler = class {
|
|
|
4800
5101
|
}
|
|
4801
5102
|
handle(ctx, guardedState, protocol, deviceProfile) {
|
|
4802
5103
|
if (!this._client) {
|
|
4803
|
-
(0,
|
|
4804
|
-
F:
|
|
5104
|
+
(0, import_log14.log)("edge disabled", void 0, {
|
|
5105
|
+
F: __dxlog_file17,
|
|
4805
5106
|
L: 66,
|
|
4806
5107
|
S: this,
|
|
4807
5108
|
C: (f, a) => f(...a)
|
|
@@ -4810,12 +5111,12 @@ var EdgeInvitationHandler = class {
|
|
|
4810
5111
|
}
|
|
4811
5112
|
const invitation = guardedState.current;
|
|
4812
5113
|
const spaceId = invitation.spaceId;
|
|
4813
|
-
const canBeHandledByEdge = invitation.authMethod !== import_services12.Invitation.AuthMethod.SHARED_SECRET && invitation.type === import_services12.Invitation.Type.DELEGATED && invitation.kind === import_services12.Invitation.Kind.SPACE && spaceId != null &&
|
|
5114
|
+
const canBeHandledByEdge = invitation.authMethod !== import_services12.Invitation.AuthMethod.SHARED_SECRET && invitation.type === import_services12.Invitation.Type.DELEGATED && invitation.kind === import_services12.Invitation.Kind.SPACE && spaceId != null && import_keys12.SpaceId.isValid(spaceId);
|
|
4814
5115
|
if (!canBeHandledByEdge) {
|
|
4815
|
-
(0,
|
|
5116
|
+
(0, import_log14.log)("invitation could not be handled by edge", {
|
|
4816
5117
|
invitation
|
|
4817
5118
|
}, {
|
|
4818
|
-
F:
|
|
5119
|
+
F: __dxlog_file17,
|
|
4819
5120
|
L: 80,
|
|
4820
5121
|
S: this,
|
|
4821
5122
|
C: (f, a) => f(...a)
|
|
@@ -4834,13 +5135,13 @@ var EdgeInvitationHandler = class {
|
|
|
4834
5135
|
try {
|
|
4835
5136
|
await this._handleSpaceInvitationFlow(ctx, guardedState, admissionRequest.space, spaceId);
|
|
4836
5137
|
} catch (error) {
|
|
4837
|
-
if (error instanceof
|
|
4838
|
-
|
|
5138
|
+
if (error instanceof import_protocols12.EdgeCallFailedError) {
|
|
5139
|
+
import_log14.log.info("join space with edge unsuccessful", {
|
|
4839
5140
|
reason: error.message,
|
|
4840
5141
|
retryable: error.isRetryable,
|
|
4841
5142
|
after: error.retryAfterMs ?? this._calculateNextRetryMs()
|
|
4842
5143
|
}, {
|
|
4843
|
-
F:
|
|
5144
|
+
F: __dxlog_file17,
|
|
4844
5145
|
L: 98,
|
|
4845
5146
|
S: this,
|
|
4846
5147
|
C: (f, a) => f(...a)
|
|
@@ -4849,10 +5150,10 @@ var EdgeInvitationHandler = class {
|
|
|
4849
5150
|
(0, import_async16.scheduleTask)(ctx, tryHandleInvitation, error.retryAfterMs ?? this._calculateNextRetryMs());
|
|
4850
5151
|
}
|
|
4851
5152
|
} else if (requestCount < MAX_RETRIES_PER_INVITATION) {
|
|
4852
|
-
|
|
5153
|
+
import_log14.log.info("failed to handle invitation with edge", {
|
|
4853
5154
|
error
|
|
4854
5155
|
}, {
|
|
4855
|
-
F:
|
|
5156
|
+
F: __dxlog_file17,
|
|
4856
5157
|
L: 107,
|
|
4857
5158
|
S: this,
|
|
4858
5159
|
C: (f, a) => f(...a)
|
|
@@ -4866,15 +5167,15 @@ var EdgeInvitationHandler = class {
|
|
|
4866
5167
|
}
|
|
4867
5168
|
async _handleSpaceInvitationFlow(ctx, guardedState, admissionRequest, spaceId) {
|
|
4868
5169
|
try {
|
|
4869
|
-
(0,
|
|
4870
|
-
F:
|
|
5170
|
+
(0, import_log14.log)("edge invitation flow", void 0, {
|
|
5171
|
+
F: __dxlog_file17,
|
|
4871
5172
|
L: 123,
|
|
4872
5173
|
S: this,
|
|
4873
5174
|
C: (f, a) => f(...a)
|
|
4874
5175
|
});
|
|
4875
5176
|
this._flowLock = await tryAcquireBeforeContextDisposed(ctx, guardedState.mutex);
|
|
4876
|
-
|
|
4877
|
-
F:
|
|
5177
|
+
import_log14.log.verbose("edge invitation flow acquired the lock", void 0, {
|
|
5178
|
+
F: __dxlog_file17,
|
|
4878
5179
|
L: 125,
|
|
4879
5180
|
S: this,
|
|
4880
5181
|
C: (f, a) => f(...a)
|
|
@@ -4906,8 +5207,8 @@ var EdgeInvitationHandler = class {
|
|
|
4906
5207
|
};
|
|
4907
5208
|
}
|
|
4908
5209
|
async _joinSpaceByInvitation(guardedState, spaceId, request) {
|
|
4909
|
-
(0,
|
|
4910
|
-
F:
|
|
5210
|
+
(0, import_invariant15.invariant)(this._client, void 0, {
|
|
5211
|
+
F: __dxlog_file17,
|
|
4911
5212
|
L: 160,
|
|
4912
5213
|
S: this,
|
|
4913
5214
|
A: [
|
|
@@ -4918,7 +5219,7 @@ var EdgeInvitationHandler = class {
|
|
|
4918
5219
|
try {
|
|
4919
5220
|
return await this._client.joinSpaceByInvitation(spaceId, request);
|
|
4920
5221
|
} catch (error) {
|
|
4921
|
-
if (error instanceof
|
|
5222
|
+
if (error instanceof import_protocols12.EdgeAuthChallengeError) {
|
|
4922
5223
|
const publicKey = guardedState.current.guestKeypair?.publicKey;
|
|
4923
5224
|
const privateKey = guardedState.current.guestKeypair?.privateKey;
|
|
4924
5225
|
if (!privateKey || !publicKey) {
|
|
@@ -4941,7 +5242,7 @@ var EdgeInvitationHandler = class {
|
|
|
4941
5242
|
return this._retryInterval + Math.random() * this._retryJitter;
|
|
4942
5243
|
}
|
|
4943
5244
|
};
|
|
4944
|
-
var
|
|
5245
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
4945
5246
|
var OPTIONS_TIMEOUT = 1e4;
|
|
4946
5247
|
var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
|
|
4947
5248
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -4955,8 +5256,8 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
|
|
|
4955
5256
|
});
|
|
4956
5257
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
4957
5258
|
this._callbacks = _callbacks;
|
|
4958
|
-
this._ctx = new
|
|
4959
|
-
F:
|
|
5259
|
+
this._ctx = new import_context13.Context(void 0, {
|
|
5260
|
+
F: __dxlog_file18,
|
|
4960
5261
|
L: 38
|
|
4961
5262
|
});
|
|
4962
5263
|
this._remoteOptionsTrigger = new import_async17.Trigger();
|
|
@@ -4969,8 +5270,8 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
|
|
|
4969
5270
|
return {
|
|
4970
5271
|
InvitationHostService: {
|
|
4971
5272
|
options: async (options) => {
|
|
4972
|
-
(0,
|
|
4973
|
-
F:
|
|
5273
|
+
(0, import_invariant16.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
5274
|
+
F: __dxlog_file18,
|
|
4974
5275
|
L: 68,
|
|
4975
5276
|
S: this,
|
|
4976
5277
|
A: [
|
|
@@ -4996,39 +5297,39 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
|
|
|
4996
5297
|
async onOpen(context) {
|
|
4997
5298
|
await super.onOpen(context);
|
|
4998
5299
|
try {
|
|
4999
|
-
|
|
5000
|
-
F:
|
|
5300
|
+
import_log15.log.verbose("guest acquire lock", void 0, {
|
|
5301
|
+
F: __dxlog_file18,
|
|
5001
5302
|
L: 89,
|
|
5002
5303
|
S: this,
|
|
5003
5304
|
C: (f, a) => f(...a)
|
|
5004
5305
|
});
|
|
5005
5306
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
5006
|
-
|
|
5007
|
-
F:
|
|
5307
|
+
import_log15.log.verbose("guest lock acquired", void 0, {
|
|
5308
|
+
F: __dxlog_file18,
|
|
5008
5309
|
L: 91,
|
|
5009
5310
|
S: this,
|
|
5010
5311
|
C: (f, a) => f(...a)
|
|
5011
5312
|
});
|
|
5012
|
-
await (0,
|
|
5313
|
+
await (0, import_context13.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
|
|
5013
5314
|
role: import_invitations3.InvitationOptions.Role.GUEST
|
|
5014
5315
|
}));
|
|
5015
|
-
|
|
5016
|
-
F:
|
|
5316
|
+
import_log15.log.verbose("options sent", void 0, {
|
|
5317
|
+
F: __dxlog_file18,
|
|
5017
5318
|
L: 96,
|
|
5018
5319
|
S: this,
|
|
5019
5320
|
C: (f, a) => f(...a)
|
|
5020
5321
|
});
|
|
5021
|
-
await (0,
|
|
5322
|
+
await (0, import_context13.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
5022
5323
|
timeout: OPTIONS_TIMEOUT
|
|
5023
5324
|
}));
|
|
5024
|
-
|
|
5025
|
-
F:
|
|
5325
|
+
import_log15.log.verbose("options received", void 0, {
|
|
5326
|
+
F: __dxlog_file18,
|
|
5026
5327
|
L: 98,
|
|
5027
5328
|
S: this,
|
|
5028
5329
|
C: (f, a) => f(...a)
|
|
5029
5330
|
});
|
|
5030
5331
|
if (this._remoteOptions?.role !== import_invitations3.InvitationOptions.Role.HOST) {
|
|
5031
|
-
throw new
|
|
5332
|
+
throw new import_protocols13.InvalidInvitationExtensionRoleError(void 0, {
|
|
5032
5333
|
expected: import_invitations3.InvitationOptions.Role.HOST,
|
|
5033
5334
|
remoteOptions: this._remoteOptions,
|
|
5034
5335
|
remotePeerId: context.remotePeerId
|
|
@@ -5055,8 +5356,8 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
|
|
|
5055
5356
|
if (this._invitationFlowLock != null) {
|
|
5056
5357
|
this._invitationFlowLock.release();
|
|
5057
5358
|
this._invitationFlowLock = null;
|
|
5058
|
-
|
|
5059
|
-
F:
|
|
5359
|
+
import_log15.log.verbose("invitation flow lock released", void 0, {
|
|
5360
|
+
F: __dxlog_file18,
|
|
5060
5361
|
L: 131,
|
|
5061
5362
|
S: this,
|
|
5062
5363
|
C: (f, a) => f(...a)
|
|
@@ -5064,7 +5365,7 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
|
|
|
5064
5365
|
}
|
|
5065
5366
|
}
|
|
5066
5367
|
};
|
|
5067
|
-
var
|
|
5368
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
5068
5369
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
5069
5370
|
var MAX_OTP_ATTEMPTS = 3;
|
|
5070
5371
|
var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
@@ -5079,8 +5380,8 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5079
5380
|
});
|
|
5080
5381
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
5081
5382
|
this._callbacks = _callbacks;
|
|
5082
|
-
this._ctx = new
|
|
5083
|
-
F:
|
|
5383
|
+
this._ctx = new import_context14.Context(void 0, {
|
|
5384
|
+
F: __dxlog_file19,
|
|
5084
5385
|
L: 57
|
|
5085
5386
|
});
|
|
5086
5387
|
this._remoteOptionsTrigger = new import_async18.Trigger();
|
|
@@ -5100,8 +5401,8 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5100
5401
|
// Perhaps in the future we will have more complex logic here.
|
|
5101
5402
|
InvitationHostService: {
|
|
5102
5403
|
options: async (options) => {
|
|
5103
|
-
(0,
|
|
5104
|
-
F:
|
|
5404
|
+
(0, import_invariant17.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
5405
|
+
F: __dxlog_file19,
|
|
5105
5406
|
L: 106,
|
|
5106
5407
|
S: this,
|
|
5107
5408
|
A: [
|
|
@@ -5114,11 +5415,11 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5114
5415
|
},
|
|
5115
5416
|
introduce: async (request) => {
|
|
5116
5417
|
const { profile, invitationId } = request;
|
|
5117
|
-
const traceId =
|
|
5118
|
-
|
|
5418
|
+
const traceId = import_keys13.PublicKey.random().toHex();
|
|
5419
|
+
import_log16.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols14.trace.begin({
|
|
5119
5420
|
id: traceId
|
|
5120
5421
|
}), {
|
|
5121
|
-
F:
|
|
5422
|
+
F: __dxlog_file19,
|
|
5122
5423
|
L: 114,
|
|
5123
5424
|
S: this,
|
|
5124
5425
|
C: (f, a) => f(...a)
|
|
@@ -5126,11 +5427,11 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5126
5427
|
const invitation = this._requireActiveInvitation();
|
|
5127
5428
|
this._assertInvitationState(import_services14.Invitation.State.CONNECTED);
|
|
5128
5429
|
if (invitationId !== invitation?.invitationId) {
|
|
5129
|
-
|
|
5430
|
+
import_log16.log.warn("incorrect invitationId", {
|
|
5130
5431
|
expected: invitation.invitationId,
|
|
5131
5432
|
actual: invitationId
|
|
5132
5433
|
}, {
|
|
5133
|
-
F:
|
|
5434
|
+
F: __dxlog_file19,
|
|
5134
5435
|
L: 119,
|
|
5135
5436
|
S: this,
|
|
5136
5437
|
C: (f, a) => f(...a)
|
|
@@ -5141,10 +5442,10 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5141
5442
|
authMethod: import_services14.Invitation.AuthMethod.NONE
|
|
5142
5443
|
};
|
|
5143
5444
|
}
|
|
5144
|
-
|
|
5445
|
+
import_log16.log.verbose("guest introduced themselves", {
|
|
5145
5446
|
guestProfile: profile
|
|
5146
5447
|
}, {
|
|
5147
|
-
F:
|
|
5448
|
+
F: __dxlog_file19,
|
|
5148
5449
|
L: 128,
|
|
5149
5450
|
S: this,
|
|
5150
5451
|
C: (f, a) => f(...a)
|
|
@@ -5152,10 +5453,10 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5152
5453
|
this.guestProfile = profile;
|
|
5153
5454
|
this._callbacks.onStateUpdate(import_services14.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
5154
5455
|
this._challenge = invitation.authMethod === import_services14.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto3.randomBytes)(32) : void 0;
|
|
5155
|
-
|
|
5456
|
+
import_log16.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols14.trace.end({
|
|
5156
5457
|
id: traceId
|
|
5157
5458
|
}), {
|
|
5158
|
-
F:
|
|
5459
|
+
F: __dxlog_file19,
|
|
5159
5460
|
L: 134,
|
|
5160
5461
|
S: this,
|
|
5161
5462
|
C: (f, a) => f(...a)
|
|
@@ -5166,20 +5467,20 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5166
5467
|
};
|
|
5167
5468
|
},
|
|
5168
5469
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
5169
|
-
const traceId =
|
|
5170
|
-
|
|
5470
|
+
const traceId = import_keys13.PublicKey.random().toHex();
|
|
5471
|
+
import_log16.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols14.trace.begin({
|
|
5171
5472
|
id: traceId
|
|
5172
5473
|
}), {
|
|
5173
|
-
F:
|
|
5474
|
+
F: __dxlog_file19,
|
|
5174
5475
|
L: 143,
|
|
5175
5476
|
S: this,
|
|
5176
5477
|
C: (f, a) => f(...a)
|
|
5177
5478
|
});
|
|
5178
5479
|
const invitation = this._requireActiveInvitation();
|
|
5179
|
-
|
|
5480
|
+
import_log16.log.verbose("received authentication request", {
|
|
5180
5481
|
authCode: code
|
|
5181
5482
|
}, {
|
|
5182
|
-
F:
|
|
5483
|
+
F: __dxlog_file19,
|
|
5183
5484
|
L: 146,
|
|
5184
5485
|
S: this,
|
|
5185
5486
|
C: (f, a) => f(...a)
|
|
@@ -5192,8 +5493,8 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5192
5493
|
this._callbacks.onStateUpdate(import_services14.Invitation.State.AUTHENTICATING);
|
|
5193
5494
|
switch (invitation.authMethod) {
|
|
5194
5495
|
case import_services14.Invitation.AuthMethod.NONE: {
|
|
5195
|
-
(0,
|
|
5196
|
-
F:
|
|
5496
|
+
(0, import_log16.log)("authentication not required", void 0, {
|
|
5497
|
+
F: __dxlog_file19,
|
|
5197
5498
|
L: 154,
|
|
5198
5499
|
S: this,
|
|
5199
5500
|
C: (f, a) => f(...a)
|
|
@@ -5228,10 +5529,10 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5228
5529
|
break;
|
|
5229
5530
|
}
|
|
5230
5531
|
default: {
|
|
5231
|
-
|
|
5532
|
+
import_log16.log.error("invalid authentication method", {
|
|
5232
5533
|
authMethod: invitation.authMethod
|
|
5233
5534
|
}, {
|
|
5234
|
-
F:
|
|
5535
|
+
F: __dxlog_file19,
|
|
5235
5536
|
L: 192,
|
|
5236
5537
|
S: this,
|
|
5237
5538
|
C: (f, a) => f(...a)
|
|
@@ -5250,13 +5551,13 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5250
5551
|
status
|
|
5251
5552
|
};
|
|
5252
5553
|
}
|
|
5253
|
-
|
|
5554
|
+
import_log16.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols14.trace.end({
|
|
5254
5555
|
id: traceId,
|
|
5255
5556
|
data: {
|
|
5256
5557
|
status
|
|
5257
5558
|
}
|
|
5258
5559
|
}), {
|
|
5259
|
-
F:
|
|
5560
|
+
F: __dxlog_file19,
|
|
5260
5561
|
L: 204,
|
|
5261
5562
|
S: this,
|
|
5262
5563
|
C: (f, a) => f(...a)
|
|
@@ -5266,11 +5567,11 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5266
5567
|
};
|
|
5267
5568
|
},
|
|
5268
5569
|
admit: async (request) => {
|
|
5269
|
-
const traceId =
|
|
5270
|
-
|
|
5570
|
+
const traceId = import_keys13.PublicKey.random().toHex();
|
|
5571
|
+
import_log16.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols14.trace.begin({
|
|
5271
5572
|
id: traceId
|
|
5272
5573
|
}), {
|
|
5273
|
-
F:
|
|
5574
|
+
F: __dxlog_file19,
|
|
5274
5575
|
L: 210,
|
|
5275
5576
|
S: this,
|
|
5276
5577
|
C: (f, a) => f(...a)
|
|
@@ -5284,10 +5585,10 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5284
5585
|
}
|
|
5285
5586
|
}
|
|
5286
5587
|
const response = await this._callbacks.admit(request);
|
|
5287
|
-
|
|
5588
|
+
import_log16.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols14.trace.end({
|
|
5288
5589
|
id: traceId
|
|
5289
5590
|
}), {
|
|
5290
|
-
F:
|
|
5591
|
+
F: __dxlog_file19,
|
|
5291
5592
|
L: 224,
|
|
5292
5593
|
S: this,
|
|
5293
5594
|
C: (f, a) => f(...a)
|
|
@@ -5304,15 +5605,15 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5304
5605
|
async onOpen(context) {
|
|
5305
5606
|
await super.onOpen(context);
|
|
5306
5607
|
try {
|
|
5307
|
-
|
|
5308
|
-
F:
|
|
5608
|
+
import_log16.log.verbose("host acquire lock", void 0, {
|
|
5609
|
+
F: __dxlog_file19,
|
|
5309
5610
|
L: 239,
|
|
5310
5611
|
S: this,
|
|
5311
5612
|
C: (f, a) => f(...a)
|
|
5312
5613
|
});
|
|
5313
5614
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
5314
|
-
|
|
5315
|
-
F:
|
|
5615
|
+
import_log16.log.verbose("host lock acquired", void 0, {
|
|
5616
|
+
F: __dxlog_file19,
|
|
5316
5617
|
L: 241,
|
|
5317
5618
|
S: this,
|
|
5318
5619
|
C: (f, a) => f(...a)
|
|
@@ -5321,23 +5622,23 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5321
5622
|
await this.rpc.InvitationHostService.options({
|
|
5322
5623
|
role: import_invitations4.InvitationOptions.Role.HOST
|
|
5323
5624
|
});
|
|
5324
|
-
|
|
5325
|
-
F:
|
|
5625
|
+
import_log16.log.verbose("options sent", void 0, {
|
|
5626
|
+
F: __dxlog_file19,
|
|
5326
5627
|
L: 244,
|
|
5327
5628
|
S: this,
|
|
5328
5629
|
C: (f, a) => f(...a)
|
|
5329
5630
|
});
|
|
5330
|
-
await (0,
|
|
5631
|
+
await (0, import_context14.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
5331
5632
|
timeout: OPTIONS_TIMEOUT2
|
|
5332
5633
|
}));
|
|
5333
|
-
|
|
5334
|
-
F:
|
|
5634
|
+
import_log16.log.verbose("options received", void 0, {
|
|
5635
|
+
F: __dxlog_file19,
|
|
5335
5636
|
L: 246,
|
|
5336
5637
|
S: this,
|
|
5337
5638
|
C: (f, a) => f(...a)
|
|
5338
5639
|
});
|
|
5339
5640
|
if (this._remoteOptions?.role !== import_invitations4.InvitationOptions.Role.GUEST) {
|
|
5340
|
-
throw new
|
|
5641
|
+
throw new import_protocols14.InvalidInvitationExtensionRoleError(void 0, {
|
|
5341
5642
|
expected: import_invitations4.InvitationOptions.Role.GUEST,
|
|
5342
5643
|
remoteOptions: this._remoteOptions,
|
|
5343
5644
|
remotePeerId: context.remotePeerId
|
|
@@ -5369,7 +5670,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5369
5670
|
];
|
|
5370
5671
|
if (!validStates.includes(invitation.state)) {
|
|
5371
5672
|
(0, import_async18.scheduleTask)(this._ctx, () => this.close());
|
|
5372
|
-
throw new
|
|
5673
|
+
throw new import_invariant17.InvariantViolation(`Expected ${stateToString(invitation.state)} to be one of [${validStates.map(stateToString).join(", ")}]`);
|
|
5373
5674
|
}
|
|
5374
5675
|
}
|
|
5375
5676
|
async onClose() {
|
|
@@ -5383,8 +5684,8 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5383
5684
|
if (this._invitationFlowLock != null) {
|
|
5384
5685
|
this._invitationFlowLock?.release();
|
|
5385
5686
|
this._invitationFlowLock = null;
|
|
5386
|
-
|
|
5387
|
-
F:
|
|
5687
|
+
import_log16.log.verbose("invitation flow lock released", void 0, {
|
|
5688
|
+
F: __dxlog_file19,
|
|
5388
5689
|
L: 299,
|
|
5389
5690
|
S: this,
|
|
5390
5691
|
C: (f, a) => f(...a)
|
|
@@ -5393,7 +5694,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
|
|
|
5393
5694
|
}
|
|
5394
5695
|
};
|
|
5395
5696
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services14.Invitation.AuthMethod.NONE;
|
|
5396
|
-
var
|
|
5697
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-state.ts";
|
|
5397
5698
|
var createGuardedInvitationState = (ctx, invitation, stream) => {
|
|
5398
5699
|
const mutex = new import_async19.Mutex();
|
|
5399
5700
|
let lastActiveLockHolder = null;
|
|
@@ -5460,15 +5761,15 @@ var logStateUpdate = (invitation, actor, newState, error) => {
|
|
|
5460
5761
|
errorStack: error?.stack
|
|
5461
5762
|
};
|
|
5462
5763
|
if (isNonTerminalState(newState)) {
|
|
5463
|
-
|
|
5464
|
-
F:
|
|
5764
|
+
import_log17.log.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
|
|
5765
|
+
F: __dxlog_file20,
|
|
5465
5766
|
L: 98,
|
|
5466
5767
|
S: void 0,
|
|
5467
5768
|
C: (f, a) => f(...a)
|
|
5468
5769
|
});
|
|
5469
5770
|
} else {
|
|
5470
|
-
|
|
5471
|
-
F:
|
|
5771
|
+
import_log17.log.info("dxos.sdk.invitations-handler.state.update", logContext, {
|
|
5772
|
+
F: __dxlog_file20,
|
|
5472
5773
|
L: 100,
|
|
5473
5774
|
S: void 0,
|
|
5474
5775
|
C: (f, a) => f(...a)
|
|
@@ -5484,15 +5785,15 @@ var isNonTerminalState = (currentState) => {
|
|
|
5484
5785
|
import_services15.Invitation.State.EXPIRED
|
|
5485
5786
|
].includes(currentState);
|
|
5486
5787
|
};
|
|
5487
|
-
var
|
|
5788
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
5488
5789
|
var InvitationTopology = class {
|
|
5489
5790
|
constructor(_role) {
|
|
5490
5791
|
this._role = _role;
|
|
5491
|
-
this._seenPeers = new import_util11.ComplexSet(
|
|
5792
|
+
this._seenPeers = new import_util11.ComplexSet(import_keys14.PublicKey.hash);
|
|
5492
5793
|
}
|
|
5493
5794
|
init(controller) {
|
|
5494
|
-
(0,
|
|
5495
|
-
F:
|
|
5795
|
+
(0, import_invariant18.invariant)(!this._controller, "Already initialized.", {
|
|
5796
|
+
F: __dxlog_file21,
|
|
5496
5797
|
L: 42,
|
|
5497
5798
|
S: this,
|
|
5498
5799
|
A: [
|
|
@@ -5503,8 +5804,8 @@ var InvitationTopology = class {
|
|
|
5503
5804
|
this._controller = controller;
|
|
5504
5805
|
}
|
|
5505
5806
|
update() {
|
|
5506
|
-
(0,
|
|
5507
|
-
F:
|
|
5807
|
+
(0, import_invariant18.invariant)(this._controller, "Not initialized.", {
|
|
5808
|
+
F: __dxlog_file21,
|
|
5508
5809
|
L: 47,
|
|
5509
5810
|
S: this,
|
|
5510
5811
|
A: [
|
|
@@ -5521,13 +5822,13 @@ var InvitationTopology = class {
|
|
|
5521
5822
|
return;
|
|
5522
5823
|
}
|
|
5523
5824
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
5524
|
-
this._seenPeers = new import_util11.ComplexSet(
|
|
5825
|
+
this._seenPeers = new import_util11.ComplexSet(import_keys14.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
5525
5826
|
if (firstUnknownPeer != null) {
|
|
5526
|
-
(0,
|
|
5827
|
+
(0, import_log18.log)("invitation connect", {
|
|
5527
5828
|
ownPeerId,
|
|
5528
5829
|
remotePeerId: firstUnknownPeer
|
|
5529
5830
|
}, {
|
|
5530
|
-
F:
|
|
5831
|
+
F: __dxlog_file21,
|
|
5531
5832
|
L: 69,
|
|
5532
5833
|
S: this,
|
|
5533
5834
|
C: (f, a) => f(...a)
|
|
@@ -5537,8 +5838,8 @@ var InvitationTopology = class {
|
|
|
5537
5838
|
}
|
|
5538
5839
|
}
|
|
5539
5840
|
async onOffer(peer) {
|
|
5540
|
-
(0,
|
|
5541
|
-
F:
|
|
5841
|
+
(0, import_invariant18.invariant)(this._controller, "Not initialized.", {
|
|
5842
|
+
F: __dxlog_file21,
|
|
5542
5843
|
L: 76,
|
|
5543
5844
|
S: this,
|
|
5544
5845
|
A: [
|
|
@@ -5555,7 +5856,7 @@ var InvitationTopology = class {
|
|
|
5555
5856
|
return `InvitationTopology(${this._role === import_invitations5.InvitationOptions.Role.GUEST ? "guest" : "host"})`;
|
|
5556
5857
|
}
|
|
5557
5858
|
};
|
|
5558
|
-
var
|
|
5859
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
5559
5860
|
var metrics = import_tracing8.trace.metrics;
|
|
5560
5861
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
5561
5862
|
var InvitationsHandler = class {
|
|
@@ -5568,13 +5869,13 @@ var InvitationsHandler = class {
|
|
|
5568
5869
|
this._connectionParams = _connectionParams;
|
|
5569
5870
|
}
|
|
5570
5871
|
handleInvitationFlow(ctx, stream, protocol, invitation) {
|
|
5571
|
-
|
|
5872
|
+
import_log13.log.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
|
|
5572
5873
|
state: invitation.state,
|
|
5573
5874
|
invitationId: invitation.invitationId,
|
|
5574
5875
|
kind: invitation.kind,
|
|
5575
5876
|
type: invitation.type
|
|
5576
5877
|
}, {
|
|
5577
|
-
F:
|
|
5878
|
+
F: __dxlog_file22,
|
|
5578
5879
|
L: 83,
|
|
5579
5880
|
S: this,
|
|
5580
5881
|
C: (f, a) => f(...a)
|
|
@@ -5594,18 +5895,18 @@ var InvitationsHandler = class {
|
|
|
5594
5895
|
},
|
|
5595
5896
|
admit: async (admissionRequest) => {
|
|
5596
5897
|
try {
|
|
5597
|
-
|
|
5898
|
+
import_log13.log.verbose("dxos.sdk.invitations-handler.host.admit", {
|
|
5598
5899
|
invitationId: invitation.invitationId,
|
|
5599
5900
|
...protocol.toJSON()
|
|
5600
5901
|
}, {
|
|
5601
|
-
F:
|
|
5902
|
+
F: __dxlog_file22,
|
|
5602
5903
|
L: 107,
|
|
5603
5904
|
S: this,
|
|
5604
5905
|
C: (f, a) => f(...a)
|
|
5605
5906
|
});
|
|
5606
5907
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
5607
|
-
(0,
|
|
5608
|
-
F:
|
|
5908
|
+
(0, import_invariant14.invariant)(deviceKey, void 0, {
|
|
5909
|
+
F: __dxlog_file22,
|
|
5609
5910
|
L: 112,
|
|
5610
5911
|
S: this,
|
|
5611
5912
|
A: [
|
|
@@ -5629,20 +5930,20 @@ var InvitationsHandler = class {
|
|
|
5629
5930
|
}
|
|
5630
5931
|
});
|
|
5631
5932
|
(0, import_async15.scheduleTask)(connectionCtx, async () => {
|
|
5632
|
-
const traceId =
|
|
5933
|
+
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5633
5934
|
try {
|
|
5634
|
-
|
|
5935
|
+
import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols11.trace.begin({
|
|
5635
5936
|
id: traceId
|
|
5636
5937
|
}), {
|
|
5637
|
-
F:
|
|
5938
|
+
F: __dxlog_file22,
|
|
5638
5939
|
L: 137,
|
|
5639
5940
|
S: this,
|
|
5640
5941
|
C: (f, a) => f(...a)
|
|
5641
5942
|
});
|
|
5642
|
-
|
|
5943
|
+
import_log13.log.verbose("connected", {
|
|
5643
5944
|
...protocol.toJSON()
|
|
5644
5945
|
}, {
|
|
5645
|
-
F:
|
|
5946
|
+
F: __dxlog_file22,
|
|
5646
5947
|
L: 138,
|
|
5647
5948
|
S: this,
|
|
5648
5949
|
C: (f, a) => f(...a)
|
|
@@ -5650,21 +5951,21 @@ var InvitationsHandler = class {
|
|
|
5650
5951
|
const deviceKey = await extension.completedTrigger.wait({
|
|
5651
5952
|
timeout: invitation.timeout
|
|
5652
5953
|
});
|
|
5653
|
-
|
|
5954
|
+
import_log13.log.verbose("admitted guest", {
|
|
5654
5955
|
guest: deviceKey,
|
|
5655
5956
|
...protocol.toJSON()
|
|
5656
5957
|
}, {
|
|
5657
|
-
F:
|
|
5958
|
+
F: __dxlog_file22,
|
|
5658
5959
|
L: 140,
|
|
5659
5960
|
S: this,
|
|
5660
5961
|
C: (f, a) => f(...a)
|
|
5661
5962
|
});
|
|
5662
5963
|
guardedState.set(extension, import_services11.Invitation.State.SUCCESS);
|
|
5663
5964
|
metrics.increment("dxos.invitation.success");
|
|
5664
|
-
|
|
5965
|
+
import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols11.trace.end({
|
|
5665
5966
|
id: traceId
|
|
5666
5967
|
}), {
|
|
5667
|
-
F:
|
|
5968
|
+
F: __dxlog_file22,
|
|
5668
5969
|
L: 143,
|
|
5669
5970
|
S: this,
|
|
5670
5971
|
C: (f, a) => f(...a)
|
|
@@ -5678,10 +5979,10 @@ var InvitationsHandler = class {
|
|
|
5678
5979
|
if (err instanceof import_async15.TimeoutError) {
|
|
5679
5980
|
if (stateChanged) {
|
|
5680
5981
|
metrics.increment("dxos.invitation.timeout");
|
|
5681
|
-
|
|
5982
|
+
import_log13.log.verbose("timeout", {
|
|
5682
5983
|
...protocol.toJSON()
|
|
5683
5984
|
}, {
|
|
5684
|
-
F:
|
|
5985
|
+
F: __dxlog_file22,
|
|
5685
5986
|
L: 154,
|
|
5686
5987
|
S: this,
|
|
5687
5988
|
C: (f, a) => f(...a)
|
|
@@ -5690,19 +5991,19 @@ var InvitationsHandler = class {
|
|
|
5690
5991
|
} else {
|
|
5691
5992
|
if (stateChanged) {
|
|
5692
5993
|
metrics.increment("dxos.invitation.failed");
|
|
5693
|
-
|
|
5694
|
-
F:
|
|
5994
|
+
import_log13.log.error("failed", err, {
|
|
5995
|
+
F: __dxlog_file22,
|
|
5695
5996
|
L: 159,
|
|
5696
5997
|
S: this,
|
|
5697
5998
|
C: (f, a) => f(...a)
|
|
5698
5999
|
});
|
|
5699
6000
|
}
|
|
5700
6001
|
}
|
|
5701
|
-
|
|
6002
|
+
import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols11.trace.error({
|
|
5702
6003
|
id: traceId,
|
|
5703
6004
|
error: err
|
|
5704
6005
|
}), {
|
|
5705
|
-
F:
|
|
6006
|
+
F: __dxlog_file22,
|
|
5706
6007
|
L: 162,
|
|
5707
6008
|
S: this,
|
|
5708
6009
|
C: (f, a) => f(...a)
|
|
@@ -5713,11 +6014,11 @@ var InvitationsHandler = class {
|
|
|
5713
6014
|
},
|
|
5714
6015
|
onError: (err) => {
|
|
5715
6016
|
const stateChanged = guardedState.set(extension, import_services11.Invitation.State.CONNECTING);
|
|
5716
|
-
if (err instanceof
|
|
5717
|
-
(0,
|
|
6017
|
+
if (err instanceof import_protocols11.InvalidInvitationExtensionRoleError) {
|
|
6018
|
+
(0, import_log13.log)("invalid role", {
|
|
5718
6019
|
...err.context
|
|
5719
6020
|
}, {
|
|
5720
|
-
F:
|
|
6021
|
+
F: __dxlog_file22,
|
|
5721
6022
|
L: 171,
|
|
5722
6023
|
S: this,
|
|
5723
6024
|
C: (f, a) => f(...a)
|
|
@@ -5727,10 +6028,10 @@ var InvitationsHandler = class {
|
|
|
5727
6028
|
if (err instanceof import_async15.TimeoutError) {
|
|
5728
6029
|
if (stateChanged) {
|
|
5729
6030
|
metrics.increment("dxos.invitation.timeout");
|
|
5730
|
-
|
|
6031
|
+
import_log13.log.verbose("timeout", {
|
|
5731
6032
|
err
|
|
5732
6033
|
}, {
|
|
5733
|
-
F:
|
|
6034
|
+
F: __dxlog_file22,
|
|
5734
6035
|
L: 177,
|
|
5735
6036
|
S: this,
|
|
5736
6037
|
C: (f, a) => f(...a)
|
|
@@ -5739,8 +6040,8 @@ var InvitationsHandler = class {
|
|
|
5739
6040
|
} else {
|
|
5740
6041
|
if (stateChanged) {
|
|
5741
6042
|
metrics.increment("dxos.invitation.failed");
|
|
5742
|
-
|
|
5743
|
-
F:
|
|
6043
|
+
import_log13.log.error("failed", err, {
|
|
6044
|
+
F: __dxlog_file22,
|
|
5744
6045
|
L: 182,
|
|
5745
6046
|
S: this,
|
|
5746
6047
|
C: (f, a) => f(...a)
|
|
@@ -5754,15 +6055,15 @@ var InvitationsHandler = class {
|
|
|
5754
6055
|
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
5755
6056
|
if (expiresOn) {
|
|
5756
6057
|
if (expiresOn.getTime() < Date.now()) {
|
|
5757
|
-
|
|
5758
|
-
F:
|
|
6058
|
+
import_log13.log.warn("invitation has already expired", void 0, {
|
|
6059
|
+
F: __dxlog_file22,
|
|
5759
6060
|
L: 194,
|
|
5760
6061
|
S: this,
|
|
5761
6062
|
C: (f, a) => f(...a)
|
|
5762
6063
|
});
|
|
5763
6064
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5764
|
-
void ctx.dispose().catch((err) =>
|
|
5765
|
-
F:
|
|
6065
|
+
void ctx.dispose().catch((err) => import_log13.log.catch(err, void 0, {
|
|
6066
|
+
F: __dxlog_file22,
|
|
5766
6067
|
L: 196,
|
|
5767
6068
|
S: this,
|
|
5768
6069
|
C: (f, a) => f(...a)
|
|
@@ -5783,21 +6084,21 @@ var InvitationsHandler = class {
|
|
|
5783
6084
|
});
|
|
5784
6085
|
}
|
|
5785
6086
|
acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
|
|
5786
|
-
|
|
6087
|
+
import_log13.log.verbose("dxos.sdk.invitations-handler.acceptInvitation", {
|
|
5787
6088
|
state: invitation.state,
|
|
5788
6089
|
invitationId: invitation.invitationId,
|
|
5789
6090
|
kind: invitation.kind,
|
|
5790
6091
|
type: invitation.type
|
|
5791
6092
|
}, {
|
|
5792
|
-
F:
|
|
6093
|
+
F: __dxlog_file22,
|
|
5793
6094
|
L: 227,
|
|
5794
6095
|
S: this,
|
|
5795
6096
|
C: (f, a) => f(...a)
|
|
5796
6097
|
});
|
|
5797
6098
|
const { timeout = import_client_protocol5.INVITATION_TIMEOUT } = invitation;
|
|
5798
6099
|
if (deviceProfile) {
|
|
5799
|
-
(0,
|
|
5800
|
-
F:
|
|
6100
|
+
(0, import_invariant14.invariant)(invitation.kind === import_services11.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
6101
|
+
F: __dxlog_file22,
|
|
5801
6102
|
L: 236,
|
|
5802
6103
|
S: this,
|
|
5803
6104
|
A: [
|
|
@@ -5806,16 +6107,16 @@ var InvitationsHandler = class {
|
|
|
5806
6107
|
]
|
|
5807
6108
|
});
|
|
5808
6109
|
}
|
|
5809
|
-
const triedPeersIds = new import_util10.ComplexSet(
|
|
6110
|
+
const triedPeersIds = new import_util10.ComplexSet(import_keys11.PublicKey.hash);
|
|
5810
6111
|
const guardedState = createGuardedInvitationState(ctx, invitation, stream);
|
|
5811
6112
|
const shouldCancelInvitationFlow = (extension) => {
|
|
5812
6113
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
5813
|
-
(0,
|
|
6114
|
+
(0, import_log13.log)("should cancel invitation flow", {
|
|
5814
6115
|
isLockedByAnotherConnection,
|
|
5815
6116
|
invitationType: import_services11.Invitation.Type.DELEGATED,
|
|
5816
6117
|
triedPeers: triedPeersIds.size
|
|
5817
6118
|
}, {
|
|
5818
|
-
F:
|
|
6119
|
+
F: __dxlog_file22,
|
|
5819
6120
|
L: 244,
|
|
5820
6121
|
S: this,
|
|
5821
6122
|
C: (f, a) => f(...a)
|
|
@@ -5838,29 +6139,29 @@ var InvitationsHandler = class {
|
|
|
5838
6139
|
return;
|
|
5839
6140
|
}
|
|
5840
6141
|
connectionCtx.onDispose(async () => {
|
|
5841
|
-
|
|
6142
|
+
import_log13.log.verbose("extension disposed", {
|
|
5842
6143
|
admitted,
|
|
5843
6144
|
currentState: guardedState.current.state
|
|
5844
6145
|
}, {
|
|
5845
|
-
F:
|
|
6146
|
+
F: __dxlog_file22,
|
|
5846
6147
|
L: 272,
|
|
5847
6148
|
S: this,
|
|
5848
6149
|
C: (f, a) => f(...a)
|
|
5849
6150
|
});
|
|
5850
6151
|
if (!admitted) {
|
|
5851
|
-
guardedState.error(extension, new
|
|
6152
|
+
guardedState.error(extension, new import_context11.ContextDisposedError());
|
|
5852
6153
|
if (shouldCancelInvitationFlow(extension)) {
|
|
5853
6154
|
await ctx.dispose();
|
|
5854
6155
|
}
|
|
5855
6156
|
}
|
|
5856
6157
|
});
|
|
5857
6158
|
(0, import_async15.scheduleTask)(connectionCtx, async () => {
|
|
5858
|
-
const traceId =
|
|
6159
|
+
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5859
6160
|
try {
|
|
5860
|
-
|
|
6161
|
+
import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols11.trace.begin({
|
|
5861
6162
|
id: traceId
|
|
5862
6163
|
}), {
|
|
5863
|
-
F:
|
|
6164
|
+
F: __dxlog_file22,
|
|
5864
6165
|
L: 284,
|
|
5865
6166
|
S: this,
|
|
5866
6167
|
C: (f, a) => f(...a)
|
|
@@ -5869,20 +6170,20 @@ var InvitationsHandler = class {
|
|
|
5869
6170
|
guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
|
|
5870
6171
|
extensionCtx.close();
|
|
5871
6172
|
}, timeout);
|
|
5872
|
-
|
|
6173
|
+
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.connected", {
|
|
5873
6174
|
...protocol.toJSON()
|
|
5874
6175
|
}, {
|
|
5875
|
-
F:
|
|
6176
|
+
F: __dxlog_file22,
|
|
5876
6177
|
L: 295,
|
|
5877
6178
|
S: this,
|
|
5878
6179
|
C: (f, a) => f(...a)
|
|
5879
6180
|
});
|
|
5880
6181
|
guardedState.set(extension, import_services11.Invitation.State.CONNECTED);
|
|
5881
|
-
|
|
6182
|
+
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.introduce", {
|
|
5882
6183
|
invitationId: invitation.invitationId,
|
|
5883
6184
|
...protocol.toJSON()
|
|
5884
6185
|
}, {
|
|
5885
|
-
F:
|
|
6186
|
+
F: __dxlog_file22,
|
|
5886
6187
|
L: 299,
|
|
5887
6188
|
S: this,
|
|
5888
6189
|
C: (f, a) => f(...a)
|
|
@@ -5891,12 +6192,12 @@ var InvitationsHandler = class {
|
|
|
5891
6192
|
invitationId: invitation.invitationId,
|
|
5892
6193
|
...protocol.createIntroduction()
|
|
5893
6194
|
});
|
|
5894
|
-
|
|
6195
|
+
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.introduce-response", {
|
|
5895
6196
|
invitationId: invitation.invitationId,
|
|
5896
6197
|
...protocol.toJSON(),
|
|
5897
6198
|
authMethod: introductionResponse.authMethod
|
|
5898
6199
|
}, {
|
|
5899
|
-
F:
|
|
6200
|
+
F: __dxlog_file22,
|
|
5900
6201
|
L: 307,
|
|
5901
6202
|
S: this,
|
|
5902
6203
|
C: (f, a) => f(...a)
|
|
@@ -5914,11 +6215,11 @@ var InvitationsHandler = class {
|
|
|
5914
6215
|
break;
|
|
5915
6216
|
}
|
|
5916
6217
|
}
|
|
5917
|
-
|
|
6218
|
+
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.request-admission", {
|
|
5918
6219
|
invitationId: invitation.invitationId,
|
|
5919
6220
|
...protocol.toJSON()
|
|
5920
6221
|
}, {
|
|
5921
|
-
F:
|
|
6222
|
+
F: __dxlog_file22,
|
|
5922
6223
|
L: 337,
|
|
5923
6224
|
S: this,
|
|
5924
6225
|
C: (f, a) => f(...a)
|
|
@@ -5927,11 +6228,11 @@ var InvitationsHandler = class {
|
|
|
5927
6228
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
5928
6229
|
admitted = true;
|
|
5929
6230
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
5930
|
-
|
|
6231
|
+
import_log13.log.verbose("dxos.sdk.invitations-handler.guest.admitted-by-host", {
|
|
5931
6232
|
invitationId: invitation.invitationId,
|
|
5932
6233
|
...protocol.toJSON()
|
|
5933
6234
|
}, {
|
|
5934
|
-
F:
|
|
6235
|
+
F: __dxlog_file22,
|
|
5935
6236
|
L: 351,
|
|
5936
6237
|
S: this,
|
|
5937
6238
|
C: (f, a) => f(...a)
|
|
@@ -5941,28 +6242,28 @@ var InvitationsHandler = class {
|
|
|
5941
6242
|
...result,
|
|
5942
6243
|
state: import_services11.Invitation.State.SUCCESS
|
|
5943
6244
|
});
|
|
5944
|
-
|
|
6245
|
+
import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols11.trace.end({
|
|
5945
6246
|
id: traceId
|
|
5946
6247
|
}), {
|
|
5947
|
-
F:
|
|
6248
|
+
F: __dxlog_file22,
|
|
5948
6249
|
L: 360,
|
|
5949
6250
|
S: this,
|
|
5950
6251
|
C: (f, a) => f(...a)
|
|
5951
6252
|
});
|
|
5952
6253
|
} catch (err) {
|
|
5953
6254
|
if (err instanceof import_async15.TimeoutError) {
|
|
5954
|
-
|
|
6255
|
+
import_log13.log.verbose("timeout", {
|
|
5955
6256
|
...protocol.toJSON()
|
|
5956
6257
|
}, {
|
|
5957
|
-
F:
|
|
6258
|
+
F: __dxlog_file22,
|
|
5958
6259
|
L: 363,
|
|
5959
6260
|
S: this,
|
|
5960
6261
|
C: (f, a) => f(...a)
|
|
5961
6262
|
});
|
|
5962
6263
|
guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
|
|
5963
6264
|
} else {
|
|
5964
|
-
|
|
5965
|
-
F:
|
|
6265
|
+
import_log13.log.verbose("auth failed", err, {
|
|
6266
|
+
F: __dxlog_file22,
|
|
5966
6267
|
L: 366,
|
|
5967
6268
|
S: this,
|
|
5968
6269
|
C: (f, a) => f(...a)
|
|
@@ -5970,11 +6271,11 @@ var InvitationsHandler = class {
|
|
|
5970
6271
|
guardedState.error(extension, err);
|
|
5971
6272
|
}
|
|
5972
6273
|
extensionCtx.close(err);
|
|
5973
|
-
|
|
6274
|
+
import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols11.trace.error({
|
|
5974
6275
|
id: traceId,
|
|
5975
6276
|
error: err
|
|
5976
6277
|
}), {
|
|
5977
|
-
F:
|
|
6278
|
+
F: __dxlog_file22,
|
|
5978
6279
|
L: 370,
|
|
5979
6280
|
S: this,
|
|
5980
6281
|
C: (f, a) => f(...a)
|
|
@@ -5983,22 +6284,22 @@ var InvitationsHandler = class {
|
|
|
5983
6284
|
});
|
|
5984
6285
|
},
|
|
5985
6286
|
onError: (err) => {
|
|
5986
|
-
if (err instanceof
|
|
6287
|
+
if (err instanceof import_protocols11.InvalidInvitationExtensionRoleError) {
|
|
5987
6288
|
return;
|
|
5988
6289
|
}
|
|
5989
6290
|
if (err instanceof import_async15.TimeoutError) {
|
|
5990
|
-
|
|
6291
|
+
import_log13.log.verbose("timeout", {
|
|
5991
6292
|
...protocol.toJSON()
|
|
5992
6293
|
}, {
|
|
5993
|
-
F:
|
|
6294
|
+
F: __dxlog_file22,
|
|
5994
6295
|
L: 379,
|
|
5995
6296
|
S: this,
|
|
5996
6297
|
C: (f, a) => f(...a)
|
|
5997
6298
|
});
|
|
5998
6299
|
guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
|
|
5999
6300
|
} else {
|
|
6000
|
-
|
|
6001
|
-
F:
|
|
6301
|
+
import_log13.log.verbose("auth failed", err, {
|
|
6302
|
+
F: __dxlog_file22,
|
|
6002
6303
|
L: 382,
|
|
6003
6304
|
S: this,
|
|
6004
6305
|
C: (f, a) => f(...a)
|
|
@@ -6012,10 +6313,10 @@ var InvitationsHandler = class {
|
|
|
6012
6313
|
const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionParams?.edgeInvitations, this._edgeClient, {
|
|
6013
6314
|
onInvitationSuccess: async (admissionResponse, admissionRequest) => {
|
|
6014
6315
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
6015
|
-
|
|
6316
|
+
import_log13.log.info("admitted by edge", {
|
|
6016
6317
|
...protocol.toJSON()
|
|
6017
6318
|
}, {
|
|
6018
|
-
F:
|
|
6319
|
+
F: __dxlog_file22,
|
|
6019
6320
|
L: 394,
|
|
6020
6321
|
S: this,
|
|
6021
6322
|
C: (f, a) => f(...a)
|
|
@@ -6034,8 +6335,8 @@ var InvitationsHandler = class {
|
|
|
6034
6335
|
stream.error(error);
|
|
6035
6336
|
await ctx.dispose();
|
|
6036
6337
|
} else {
|
|
6037
|
-
(0,
|
|
6038
|
-
F:
|
|
6338
|
+
(0, import_invariant14.invariant)(invitation.swarmKey, void 0, {
|
|
6339
|
+
F: __dxlog_file22,
|
|
6039
6340
|
L: 406,
|
|
6040
6341
|
S: this,
|
|
6041
6342
|
A: [
|
|
@@ -6078,16 +6379,16 @@ var InvitationsHandler = class {
|
|
|
6078
6379
|
}
|
|
6079
6380
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
6080
6381
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6081
|
-
(0,
|
|
6082
|
-
F:
|
|
6382
|
+
(0, import_log13.log)("guest waiting for authentication code...", void 0, {
|
|
6383
|
+
F: __dxlog_file22,
|
|
6083
6384
|
L: 458,
|
|
6084
6385
|
S: this,
|
|
6085
6386
|
C: (f, a) => f(...a)
|
|
6086
6387
|
});
|
|
6087
6388
|
setState(import_services11.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
6088
6389
|
const authCode = await authenticated.wait(options);
|
|
6089
|
-
(0,
|
|
6090
|
-
F:
|
|
6390
|
+
(0, import_log13.log)("sending authentication request", void 0, {
|
|
6391
|
+
F: __dxlog_file22,
|
|
6091
6392
|
L: 462,
|
|
6092
6393
|
S: this,
|
|
6093
6394
|
C: (f, a) => f(...a)
|
|
@@ -6103,10 +6404,10 @@ var InvitationsHandler = class {
|
|
|
6103
6404
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
6104
6405
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
6105
6406
|
} else {
|
|
6106
|
-
(0,
|
|
6407
|
+
(0, import_log13.log)("retrying invalid code", {
|
|
6107
6408
|
attempt
|
|
6108
6409
|
}, {
|
|
6109
|
-
F:
|
|
6410
|
+
F: __dxlog_file22,
|
|
6110
6411
|
L: 473,
|
|
6111
6412
|
S: this,
|
|
6112
6413
|
C: (f, a) => f(...a)
|
|
@@ -6123,8 +6424,8 @@ var InvitationsHandler = class {
|
|
|
6123
6424
|
if (introductionResponse.challenge == null) {
|
|
6124
6425
|
throw new Error("challenge missing in the introduction");
|
|
6125
6426
|
}
|
|
6126
|
-
(0,
|
|
6127
|
-
F:
|
|
6427
|
+
(0, import_log13.log)("sending authentication request", void 0, {
|
|
6428
|
+
F: __dxlog_file22,
|
|
6128
6429
|
L: 492,
|
|
6129
6430
|
S: this,
|
|
6130
6431
|
C: (f, a) => f(...a)
|
|
@@ -6141,14 +6442,14 @@ var InvitationsHandler = class {
|
|
|
6141
6442
|
var checkInvitation = (protocol, invitation) => {
|
|
6142
6443
|
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
6143
6444
|
if (expiresOn && expiresOn.getTime() < Date.now()) {
|
|
6144
|
-
return new
|
|
6445
|
+
return new import_protocols11.InvalidInvitationError("Invitation already expired.");
|
|
6145
6446
|
}
|
|
6146
6447
|
return protocol.checkInvitation(invitation);
|
|
6147
6448
|
};
|
|
6148
6449
|
var createAdmissionKeypair = () => {
|
|
6149
6450
|
const keypair = (0, import_crypto.createKeyPair)();
|
|
6150
6451
|
return {
|
|
6151
|
-
publicKey:
|
|
6452
|
+
publicKey: import_keys11.PublicKey.from(keypair.publicKey),
|
|
6152
6453
|
privateKey: keypair.secretKey
|
|
6153
6454
|
};
|
|
6154
6455
|
};
|
|
@@ -6248,7 +6549,7 @@ var InvitationsServiceImpl = class {
|
|
|
6248
6549
|
});
|
|
6249
6550
|
}
|
|
6250
6551
|
};
|
|
6251
|
-
var
|
|
6552
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
6252
6553
|
var SpaceInvitationProtocol = class {
|
|
6253
6554
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
6254
6555
|
this._spaceManager = _spaceManager;
|
|
@@ -6265,20 +6566,20 @@ var SpaceInvitationProtocol = class {
|
|
|
6265
6566
|
}
|
|
6266
6567
|
checkCanInviteNewMembers() {
|
|
6267
6568
|
if (this._spaceKey == null) {
|
|
6268
|
-
return new
|
|
6569
|
+
return new import_protocols15.InvalidInvitationError("No spaceKey was provided for a space invitation.");
|
|
6269
6570
|
}
|
|
6270
6571
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6271
6572
|
if (space == null) {
|
|
6272
|
-
return new
|
|
6573
|
+
return new import_protocols15.SpaceNotFoundError(this._spaceKey);
|
|
6273
6574
|
}
|
|
6274
6575
|
if (!space?.inner.spaceState.hasMembershipManagementPermission(this._signingContext.identityKey)) {
|
|
6275
|
-
return new
|
|
6576
|
+
return new import_protocols15.AuthorizationError("No member management permission.");
|
|
6276
6577
|
}
|
|
6277
6578
|
return void 0;
|
|
6278
6579
|
}
|
|
6279
6580
|
getInvitationContext() {
|
|
6280
|
-
(0,
|
|
6281
|
-
F:
|
|
6581
|
+
(0, import_invariant19.invariant)(this._spaceKey, void 0, {
|
|
6582
|
+
F: __dxlog_file23,
|
|
6282
6583
|
L: 65,
|
|
6283
6584
|
S: this,
|
|
6284
6585
|
A: [
|
|
@@ -6287,8 +6588,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6287
6588
|
]
|
|
6288
6589
|
});
|
|
6289
6590
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6290
|
-
(0,
|
|
6291
|
-
F:
|
|
6591
|
+
(0, import_invariant19.invariant)(space, void 0, {
|
|
6592
|
+
F: __dxlog_file23,
|
|
6292
6593
|
L: 67,
|
|
6293
6594
|
S: this,
|
|
6294
6595
|
A: [
|
|
@@ -6303,8 +6604,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6303
6604
|
};
|
|
6304
6605
|
}
|
|
6305
6606
|
async admit(invitation, request, guestProfile) {
|
|
6306
|
-
(0,
|
|
6307
|
-
F:
|
|
6607
|
+
(0, import_invariant19.invariant)(this._spaceKey && request.space, void 0, {
|
|
6608
|
+
F: __dxlog_file23,
|
|
6308
6609
|
L: 80,
|
|
6309
6610
|
S: this,
|
|
6310
6611
|
A: [
|
|
@@ -6312,11 +6613,11 @@ var SpaceInvitationProtocol = class {
|
|
|
6312
6613
|
""
|
|
6313
6614
|
]
|
|
6314
6615
|
});
|
|
6315
|
-
(0,
|
|
6616
|
+
(0, import_log19.log)("writing guest credentials", {
|
|
6316
6617
|
host: this._signingContext.deviceKey,
|
|
6317
6618
|
guest: request.space.deviceKey
|
|
6318
6619
|
}, {
|
|
6319
|
-
F:
|
|
6620
|
+
F: __dxlog_file23,
|
|
6320
6621
|
L: 81,
|
|
6321
6622
|
S: this,
|
|
6322
6623
|
C: (f, a) => f(...a)
|
|
@@ -6337,8 +6638,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6337
6638
|
};
|
|
6338
6639
|
}
|
|
6339
6640
|
async delegate(invitation) {
|
|
6340
|
-
(0,
|
|
6341
|
-
F:
|
|
6641
|
+
(0, import_invariant19.invariant)(this._spaceKey, void 0, {
|
|
6642
|
+
F: __dxlog_file23,
|
|
6342
6643
|
L: 101,
|
|
6343
6644
|
S: this,
|
|
6344
6645
|
A: [
|
|
@@ -6347,8 +6648,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6347
6648
|
]
|
|
6348
6649
|
});
|
|
6349
6650
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6350
|
-
(0,
|
|
6351
|
-
F:
|
|
6651
|
+
(0, import_invariant19.invariant)(space, void 0, {
|
|
6652
|
+
F: __dxlog_file23,
|
|
6352
6653
|
L: 103,
|
|
6353
6654
|
S: this,
|
|
6354
6655
|
A: [
|
|
@@ -6357,8 +6658,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6357
6658
|
]
|
|
6358
6659
|
});
|
|
6359
6660
|
if (invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6360
|
-
(0,
|
|
6361
|
-
F:
|
|
6661
|
+
(0, import_invariant19.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
6662
|
+
F: __dxlog_file23,
|
|
6362
6663
|
L: 105,
|
|
6363
6664
|
S: this,
|
|
6364
6665
|
A: [
|
|
@@ -6367,11 +6668,11 @@ var SpaceInvitationProtocol = class {
|
|
|
6367
6668
|
]
|
|
6368
6669
|
});
|
|
6369
6670
|
}
|
|
6370
|
-
(0,
|
|
6671
|
+
(0, import_log19.log)("writing delegate space invitation", {
|
|
6371
6672
|
host: this._signingContext.deviceKey,
|
|
6372
6673
|
id: invitation.invitationId
|
|
6373
6674
|
}, {
|
|
6374
|
-
F:
|
|
6675
|
+
F: __dxlog_file23,
|
|
6375
6676
|
L: 108,
|
|
6376
6677
|
S: this,
|
|
6377
6678
|
C: (f, a) => f(...a)
|
|
@@ -6385,8 +6686,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6385
6686
|
multiUse: invitation.multiUse ?? false,
|
|
6386
6687
|
guestKey: invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6387
6688
|
});
|
|
6388
|
-
(0,
|
|
6389
|
-
F:
|
|
6689
|
+
(0, import_invariant19.invariant)(credential.credential, void 0, {
|
|
6690
|
+
F: __dxlog_file23,
|
|
6390
6691
|
L: 126,
|
|
6391
6692
|
S: this,
|
|
6392
6693
|
A: [
|
|
@@ -6400,8 +6701,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6400
6701
|
return credential.credential.credential.id;
|
|
6401
6702
|
}
|
|
6402
6703
|
async cancelDelegation(invitation) {
|
|
6403
|
-
(0,
|
|
6404
|
-
F:
|
|
6704
|
+
(0, import_invariant19.invariant)(this._spaceKey, void 0, {
|
|
6705
|
+
F: __dxlog_file23,
|
|
6405
6706
|
L: 132,
|
|
6406
6707
|
S: this,
|
|
6407
6708
|
A: [
|
|
@@ -6409,8 +6710,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6409
6710
|
""
|
|
6410
6711
|
]
|
|
6411
6712
|
});
|
|
6412
|
-
(0,
|
|
6413
|
-
F:
|
|
6713
|
+
(0, import_invariant19.invariant)(invitation.type === import_services17.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6714
|
+
F: __dxlog_file23,
|
|
6414
6715
|
L: 133,
|
|
6415
6716
|
S: this,
|
|
6416
6717
|
A: [
|
|
@@ -6419,8 +6720,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6419
6720
|
]
|
|
6420
6721
|
});
|
|
6421
6722
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6422
|
-
(0,
|
|
6423
|
-
F:
|
|
6723
|
+
(0, import_invariant19.invariant)(space, void 0, {
|
|
6724
|
+
F: __dxlog_file23,
|
|
6424
6725
|
L: 135,
|
|
6425
6726
|
S: this,
|
|
6426
6727
|
A: [
|
|
@@ -6428,18 +6729,18 @@ var SpaceInvitationProtocol = class {
|
|
|
6428
6729
|
""
|
|
6429
6730
|
]
|
|
6430
6731
|
});
|
|
6431
|
-
(0,
|
|
6732
|
+
(0, import_log19.log)("cancelling delegated space invitation", {
|
|
6432
6733
|
host: this._signingContext.deviceKey,
|
|
6433
6734
|
id: invitation.invitationId
|
|
6434
6735
|
}, {
|
|
6435
|
-
F:
|
|
6736
|
+
F: __dxlog_file23,
|
|
6436
6737
|
L: 137,
|
|
6437
6738
|
S: this,
|
|
6438
6739
|
C: (f, a) => f(...a)
|
|
6439
6740
|
});
|
|
6440
6741
|
const credential = await (0, import_credentials18.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6441
|
-
(0,
|
|
6442
|
-
F:
|
|
6742
|
+
(0, import_invariant19.invariant)(credential.credential, void 0, {
|
|
6743
|
+
F: __dxlog_file23,
|
|
6443
6744
|
L: 144,
|
|
6444
6745
|
S: this,
|
|
6445
6746
|
A: [
|
|
@@ -6453,10 +6754,10 @@ var SpaceInvitationProtocol = class {
|
|
|
6453
6754
|
}
|
|
6454
6755
|
checkInvitation(invitation) {
|
|
6455
6756
|
if (invitation.spaceKey == null) {
|
|
6456
|
-
return new
|
|
6757
|
+
return new import_protocols15.InvalidInvitationError("No spaceKey was provided for a space invitation.");
|
|
6457
6758
|
}
|
|
6458
6759
|
if (this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
6459
|
-
return new
|
|
6760
|
+
return new import_protocols15.AlreadyJoinedError("Already joined space.");
|
|
6460
6761
|
}
|
|
6461
6762
|
}
|
|
6462
6763
|
createIntroduction() {
|
|
@@ -6477,8 +6778,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6477
6778
|
};
|
|
6478
6779
|
}
|
|
6479
6780
|
async accept(response) {
|
|
6480
|
-
(0,
|
|
6481
|
-
F:
|
|
6781
|
+
(0, import_invariant19.invariant)(response.space, void 0, {
|
|
6782
|
+
F: __dxlog_file23,
|
|
6482
6783
|
L: 179,
|
|
6483
6784
|
S: this,
|
|
6484
6785
|
A: [
|
|
@@ -6488,8 +6789,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6488
6789
|
});
|
|
6489
6790
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
6490
6791
|
const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
|
|
6491
|
-
(0,
|
|
6492
|
-
F:
|
|
6792
|
+
(0, import_invariant19.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6793
|
+
F: __dxlog_file23,
|
|
6493
6794
|
L: 182,
|
|
6494
6795
|
S: this,
|
|
6495
6796
|
A: [
|
|
@@ -6497,8 +6798,8 @@ var SpaceInvitationProtocol = class {
|
|
|
6497
6798
|
"'Invalid credential'"
|
|
6498
6799
|
]
|
|
6499
6800
|
});
|
|
6500
|
-
(0,
|
|
6501
|
-
F:
|
|
6801
|
+
(0, import_invariant19.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6802
|
+
F: __dxlog_file23,
|
|
6502
6803
|
L: 183,
|
|
6503
6804
|
S: this,
|
|
6504
6805
|
A: [
|
|
@@ -6507,7 +6808,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6507
6808
|
]
|
|
6508
6809
|
});
|
|
6509
6810
|
if (this._spaceManager.spaces.has(assertion.spaceKey)) {
|
|
6510
|
-
throw new
|
|
6811
|
+
throw new import_protocols15.AlreadyJoinedError("Already joined space.");
|
|
6511
6812
|
}
|
|
6512
6813
|
await this._spaceManager.acceptSpace({
|
|
6513
6814
|
spaceKey: assertion.spaceKey,
|
|
@@ -6521,7 +6822,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6521
6822
|
};
|
|
6522
6823
|
}
|
|
6523
6824
|
};
|
|
6524
|
-
var
|
|
6825
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
6525
6826
|
var InvitationsManager = class {
|
|
6526
6827
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
6527
6828
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -6563,8 +6864,8 @@ var InvitationsManager = class {
|
|
|
6563
6864
|
try {
|
|
6564
6865
|
await this._persistIfRequired(handler, stream, invitation);
|
|
6565
6866
|
} catch (err) {
|
|
6566
|
-
|
|
6567
|
-
F:
|
|
6867
|
+
import_log20.log.catch(err, void 0, {
|
|
6868
|
+
F: __dxlog_file24,
|
|
6568
6869
|
L: 82,
|
|
6569
6870
|
S: this,
|
|
6570
6871
|
C: (f, a) => f(...a)
|
|
@@ -6586,8 +6887,8 @@ var InvitationsManager = class {
|
|
|
6586
6887
|
const persistentInvitations = this._metadataStore.getInvitations();
|
|
6587
6888
|
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline3.hasInvitationExpired)(invitation));
|
|
6588
6889
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
6589
|
-
(0,
|
|
6590
|
-
F:
|
|
6890
|
+
(0, import_invariant20.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
6891
|
+
F: __dxlog_file24,
|
|
6591
6892
|
L: 103,
|
|
6592
6893
|
S: this,
|
|
6593
6894
|
A: [
|
|
@@ -6605,8 +6906,8 @@ var InvitationsManager = class {
|
|
|
6605
6906
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
6606
6907
|
};
|
|
6607
6908
|
} catch (err) {
|
|
6608
|
-
|
|
6609
|
-
F:
|
|
6909
|
+
import_log20.log.catch(err, void 0, {
|
|
6910
|
+
F: __dxlog_file24,
|
|
6610
6911
|
L: 110,
|
|
6611
6912
|
S: this,
|
|
6612
6913
|
C: (f, a) => f(...a)
|
|
@@ -6637,14 +6938,14 @@ var InvitationsManager = class {
|
|
|
6637
6938
|
return invitation;
|
|
6638
6939
|
}
|
|
6639
6940
|
async authenticate({ invitationId, authCode }) {
|
|
6640
|
-
(0,
|
|
6641
|
-
F:
|
|
6941
|
+
(0, import_log20.log)("authenticating...", void 0, {
|
|
6942
|
+
F: __dxlog_file24,
|
|
6642
6943
|
L: 140,
|
|
6643
6944
|
S: this,
|
|
6644
6945
|
C: (f, a) => f(...a)
|
|
6645
6946
|
});
|
|
6646
|
-
(0,
|
|
6647
|
-
F:
|
|
6947
|
+
(0, import_invariant20.invariant)(invitationId, void 0, {
|
|
6948
|
+
F: __dxlog_file24,
|
|
6648
6949
|
L: 141,
|
|
6649
6950
|
S: this,
|
|
6650
6951
|
A: [
|
|
@@ -6654,10 +6955,10 @@ var InvitationsManager = class {
|
|
|
6654
6955
|
});
|
|
6655
6956
|
const observable = this._acceptInvitations.get(invitationId);
|
|
6656
6957
|
if (!observable) {
|
|
6657
|
-
|
|
6958
|
+
import_log20.log.warn("invalid invitation", {
|
|
6658
6959
|
invitationId
|
|
6659
6960
|
}, {
|
|
6660
|
-
F:
|
|
6961
|
+
F: __dxlog_file24,
|
|
6661
6962
|
L: 144,
|
|
6662
6963
|
S: this,
|
|
6663
6964
|
C: (f, a) => f(...a)
|
|
@@ -6667,16 +6968,16 @@ var InvitationsManager = class {
|
|
|
6667
6968
|
}
|
|
6668
6969
|
}
|
|
6669
6970
|
async cancelInvitation({ invitationId }) {
|
|
6670
|
-
(0,
|
|
6971
|
+
(0, import_log20.log)("cancelInvitation...", {
|
|
6671
6972
|
invitationId
|
|
6672
6973
|
}, {
|
|
6673
|
-
F:
|
|
6974
|
+
F: __dxlog_file24,
|
|
6674
6975
|
L: 151,
|
|
6675
6976
|
S: this,
|
|
6676
6977
|
C: (f, a) => f(...a)
|
|
6677
6978
|
});
|
|
6678
|
-
(0,
|
|
6679
|
-
F:
|
|
6979
|
+
(0, import_invariant20.invariant)(invitationId, void 0, {
|
|
6980
|
+
F: __dxlog_file24,
|
|
6680
6981
|
L: 152,
|
|
6681
6982
|
S: this,
|
|
6682
6983
|
A: [
|
|
@@ -6723,7 +7024,7 @@ var InvitationsManager = class {
|
|
|
6723
7024
|
}
|
|
6724
7025
|
}
|
|
6725
7026
|
_createInvitation(protocol, _options) {
|
|
6726
|
-
const { invitationId =
|
|
7027
|
+
const { invitationId = import_keys15.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys15.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400 * 7, multiUse = false, ...options } = _options ?? {};
|
|
6727
7028
|
const authCode = options?.authCode ?? (authMethod === import_services18.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
6728
7029
|
return {
|
|
6729
7030
|
invitationId,
|
|
@@ -6746,20 +7047,20 @@ var InvitationsManager = class {
|
|
|
6746
7047
|
}
|
|
6747
7048
|
_createObservableInvitation(handler, invitation) {
|
|
6748
7049
|
const stream = new import_async20.PushStream();
|
|
6749
|
-
const ctx = new
|
|
7050
|
+
const ctx = new import_context15.Context({
|
|
6750
7051
|
onError: (err) => {
|
|
6751
7052
|
stream.error(err);
|
|
6752
7053
|
void ctx.dispose();
|
|
6753
7054
|
}
|
|
6754
7055
|
}, {
|
|
6755
|
-
F:
|
|
7056
|
+
F: __dxlog_file24,
|
|
6756
7057
|
L: 236
|
|
6757
7058
|
});
|
|
6758
7059
|
ctx.onDispose(() => {
|
|
6759
|
-
(0,
|
|
7060
|
+
(0, import_log20.log)("complete", {
|
|
6760
7061
|
...handler.toJSON()
|
|
6761
7062
|
}, {
|
|
6762
|
-
F:
|
|
7063
|
+
F: __dxlog_file24,
|
|
6763
7064
|
L: 243,
|
|
6764
7065
|
S: this,
|
|
6765
7066
|
C: (f, a) => f(...a)
|
|
@@ -6786,13 +7087,13 @@ var InvitationsManager = class {
|
|
|
6786
7087
|
_createObservableAcceptingInvitation(handler, initialState) {
|
|
6787
7088
|
const otpEnteredTrigger = new import_async20.Trigger();
|
|
6788
7089
|
const stream = new import_async20.PushStream();
|
|
6789
|
-
const ctx = new
|
|
7090
|
+
const ctx = new import_context15.Context({
|
|
6790
7091
|
onError: (err) => {
|
|
6791
7092
|
if (err instanceof import_async20.TimeoutError) {
|
|
6792
|
-
(0,
|
|
7093
|
+
(0, import_log20.log)("timeout", {
|
|
6793
7094
|
...handler.toJSON()
|
|
6794
7095
|
}, {
|
|
6795
|
-
F:
|
|
7096
|
+
F: __dxlog_file24,
|
|
6796
7097
|
L: 263,
|
|
6797
7098
|
S: this,
|
|
6798
7099
|
C: (f, a) => f(...a)
|
|
@@ -6802,8 +7103,8 @@ var InvitationsManager = class {
|
|
|
6802
7103
|
state: import_services18.Invitation.State.TIMEOUT
|
|
6803
7104
|
});
|
|
6804
7105
|
} else {
|
|
6805
|
-
|
|
6806
|
-
F:
|
|
7106
|
+
import_log20.log.warn("auth failed", err, {
|
|
7107
|
+
F: __dxlog_file24,
|
|
6807
7108
|
L: 266,
|
|
6808
7109
|
S: this,
|
|
6809
7110
|
C: (f, a) => f(...a)
|
|
@@ -6816,14 +7117,14 @@ var InvitationsManager = class {
|
|
|
6816
7117
|
void ctx.dispose();
|
|
6817
7118
|
}
|
|
6818
7119
|
}, {
|
|
6819
|
-
F:
|
|
7120
|
+
F: __dxlog_file24,
|
|
6820
7121
|
L: 260
|
|
6821
7122
|
});
|
|
6822
7123
|
ctx.onDispose(() => {
|
|
6823
|
-
(0,
|
|
7124
|
+
(0, import_log20.log)("complete", {
|
|
6824
7125
|
...handler.toJSON()
|
|
6825
7126
|
}, {
|
|
6826
|
-
F:
|
|
7127
|
+
F: __dxlog_file24,
|
|
6827
7128
|
L: 273,
|
|
6828
7129
|
S: this,
|
|
6829
7130
|
C: (f, a) => f(...a)
|
|
@@ -6867,8 +7168,8 @@ var InvitationsManager = class {
|
|
|
6867
7168
|
try {
|
|
6868
7169
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
6869
7170
|
} catch (err) {
|
|
6870
|
-
|
|
6871
|
-
F:
|
|
7171
|
+
import_log20.log.catch(err, void 0, {
|
|
7172
|
+
F: __dxlog_file24,
|
|
6872
7173
|
L: 309,
|
|
6873
7174
|
S: this,
|
|
6874
7175
|
C: (f, a) => f(...a)
|
|
@@ -6887,7 +7188,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
6887
7188
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6888
7189
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6889
7190
|
}
|
|
6890
|
-
var
|
|
7191
|
+
var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
6891
7192
|
var Lock = class {
|
|
6892
7193
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
6893
7194
|
this._lockPath = lockPath;
|
|
@@ -6898,16 +7199,16 @@ var Lock = class {
|
|
|
6898
7199
|
return this._lockPath;
|
|
6899
7200
|
}
|
|
6900
7201
|
async acquire() {
|
|
6901
|
-
(0,
|
|
6902
|
-
F:
|
|
7202
|
+
(0, import_log21.log)("acquiring lock...", void 0, {
|
|
7203
|
+
F: __dxlog_file25,
|
|
6903
7204
|
L: 32,
|
|
6904
7205
|
S: this,
|
|
6905
7206
|
C: (f, a) => f(...a)
|
|
6906
7207
|
});
|
|
6907
7208
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
6908
7209
|
await this._onAcquire?.();
|
|
6909
|
-
(0,
|
|
6910
|
-
F:
|
|
7210
|
+
(0, import_log21.log)("acquired lock", void 0, {
|
|
7211
|
+
F: __dxlog_file25,
|
|
6911
7212
|
L: 37,
|
|
6912
7213
|
S: this,
|
|
6913
7214
|
C: (f, a) => f(...a)
|
|
@@ -6915,8 +7216,8 @@ var Lock = class {
|
|
|
6915
7216
|
}
|
|
6916
7217
|
async release() {
|
|
6917
7218
|
await this._onRelease?.();
|
|
6918
|
-
(0,
|
|
6919
|
-
F:
|
|
7219
|
+
(0, import_invariant21.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
7220
|
+
F: __dxlog_file25,
|
|
6920
7221
|
L: 42,
|
|
6921
7222
|
S: this,
|
|
6922
7223
|
A: [
|
|
@@ -6928,7 +7229,7 @@ var Lock = class {
|
|
|
6928
7229
|
}
|
|
6929
7230
|
};
|
|
6930
7231
|
_ts_decorate7([
|
|
6931
|
-
|
|
7232
|
+
import_log21.logInfo
|
|
6932
7233
|
], Lock.prototype, "lockKey", null);
|
|
6933
7234
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
6934
7235
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
@@ -7008,11 +7309,11 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
7008
7309
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7009
7310
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7010
7311
|
}
|
|
7011
|
-
var
|
|
7312
|
+
var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts";
|
|
7012
7313
|
var AGENT_STATUS_QUERY_RETRY_INTERVAL = 5e3;
|
|
7013
7314
|
var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
|
|
7014
7315
|
var AGENT_FEED_ADDED_CHECK_INTERVAL_MS = 3e3;
|
|
7015
|
-
var EdgeAgentManager = class extends
|
|
7316
|
+
var EdgeAgentManager = class extends import_context16.Resource {
|
|
7016
7317
|
constructor(_edgeFeatures, _edgeHttpClient, _dataSpaceManager, _identity) {
|
|
7017
7318
|
super();
|
|
7018
7319
|
this._edgeFeatures = _edgeFeatures;
|
|
@@ -7026,11 +7327,11 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7026
7327
|
return this._agentStatus;
|
|
7027
7328
|
}
|
|
7028
7329
|
get agentExists() {
|
|
7029
|
-
return this._agentStatus && this._agentStatus !==
|
|
7330
|
+
return this._agentStatus && this._agentStatus !== import_protocols16.EdgeAgentStatus.NOT_FOUND;
|
|
7030
7331
|
}
|
|
7031
7332
|
async createAgent() {
|
|
7032
|
-
(0,
|
|
7033
|
-
F:
|
|
7333
|
+
(0, import_invariant22.invariant)(this.isOpen, void 0, {
|
|
7334
|
+
F: __dxlog_file26,
|
|
7034
7335
|
L: 54,
|
|
7035
7336
|
S: this,
|
|
7036
7337
|
A: [
|
|
@@ -7038,8 +7339,8 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7038
7339
|
""
|
|
7039
7340
|
]
|
|
7040
7341
|
});
|
|
7041
|
-
(0,
|
|
7042
|
-
F:
|
|
7342
|
+
(0, import_invariant22.invariant)(this._edgeHttpClient, void 0, {
|
|
7343
|
+
F: __dxlog_file26,
|
|
7043
7344
|
L: 55,
|
|
7044
7345
|
S: this,
|
|
7045
7346
|
A: [
|
|
@@ -7047,8 +7348,8 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7047
7348
|
""
|
|
7048
7349
|
]
|
|
7049
7350
|
});
|
|
7050
|
-
(0,
|
|
7051
|
-
F:
|
|
7351
|
+
(0, import_invariant22.invariant)(this._edgeFeatures?.agents, void 0, {
|
|
7352
|
+
F: __dxlog_file26,
|
|
7052
7353
|
L: 56,
|
|
7053
7354
|
S: this,
|
|
7054
7355
|
A: [
|
|
@@ -7061,39 +7362,39 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7061
7362
|
haloSpaceId: this._identity.haloSpaceId,
|
|
7062
7363
|
haloSpaceKey: this._identity.haloSpaceKey.toHex()
|
|
7063
7364
|
});
|
|
7064
|
-
const deviceKey =
|
|
7365
|
+
const deviceKey = import_keys16.PublicKey.fromHex(response.deviceKey);
|
|
7065
7366
|
if (await this._identity.authorizedDeviceKeys.has(deviceKey)) {
|
|
7066
|
-
|
|
7367
|
+
import_log22.log.info("agent was already added to HALO, ignoring response", {
|
|
7067
7368
|
response
|
|
7068
7369
|
}, {
|
|
7069
|
-
F:
|
|
7370
|
+
F: __dxlog_file26,
|
|
7070
7371
|
L: 67,
|
|
7071
7372
|
S: this,
|
|
7072
7373
|
C: (f, a) => f(...a)
|
|
7073
7374
|
});
|
|
7074
|
-
this._updateStatus(
|
|
7375
|
+
this._updateStatus(import_protocols16.EdgeAgentStatus.ACTIVE, deviceKey);
|
|
7075
7376
|
return;
|
|
7076
7377
|
}
|
|
7077
7378
|
await this._identity.admitDevice({
|
|
7078
7379
|
deviceKey,
|
|
7079
|
-
controlFeedKey:
|
|
7380
|
+
controlFeedKey: import_keys16.PublicKey.fromHex(response.feedKey),
|
|
7080
7381
|
// TODO: agents don't have data feed, should be removed
|
|
7081
|
-
dataFeedKey:
|
|
7382
|
+
dataFeedKey: import_keys16.PublicKey.random()
|
|
7082
7383
|
});
|
|
7083
|
-
(0,
|
|
7084
|
-
F:
|
|
7384
|
+
(0, import_log22.log)("agent created", response, {
|
|
7385
|
+
F: __dxlog_file26,
|
|
7085
7386
|
L: 79,
|
|
7086
7387
|
S: this,
|
|
7087
7388
|
C: (f, a) => f(...a)
|
|
7088
7389
|
});
|
|
7089
|
-
this._updateStatus(
|
|
7390
|
+
this._updateStatus(import_protocols16.EdgeAgentStatus.ACTIVE, deviceKey);
|
|
7090
7391
|
}
|
|
7091
7392
|
async _open() {
|
|
7092
7393
|
const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
|
|
7093
|
-
(0,
|
|
7394
|
+
(0, import_log22.log)("edge agent manager open", {
|
|
7094
7395
|
isEnabled
|
|
7095
7396
|
}, {
|
|
7096
|
-
F:
|
|
7397
|
+
F: __dxlog_file26,
|
|
7097
7398
|
L: 87,
|
|
7098
7399
|
S: this,
|
|
7099
7400
|
C: (f, a) => f(...a)
|
|
@@ -7125,8 +7426,8 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7125
7426
|
this._lastKnownDeviceCount = 0;
|
|
7126
7427
|
}
|
|
7127
7428
|
async _fetchAgentStatus() {
|
|
7128
|
-
(0,
|
|
7129
|
-
F:
|
|
7429
|
+
(0, import_invariant22.invariant)(this._edgeHttpClient, void 0, {
|
|
7430
|
+
F: __dxlog_file26,
|
|
7130
7431
|
L: 121,
|
|
7131
7432
|
S: this,
|
|
7132
7433
|
A: [
|
|
@@ -7135,8 +7436,8 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7135
7436
|
]
|
|
7136
7437
|
});
|
|
7137
7438
|
try {
|
|
7138
|
-
(0,
|
|
7139
|
-
F:
|
|
7439
|
+
(0, import_log22.log)("fetching agent status", void 0, {
|
|
7440
|
+
F: __dxlog_file26,
|
|
7140
7441
|
L: 123,
|
|
7141
7442
|
S: this,
|
|
7142
7443
|
C: (f, a) => f(...a)
|
|
@@ -7144,18 +7445,18 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7144
7445
|
const { agent } = await this._edgeHttpClient.getAgentStatus({
|
|
7145
7446
|
ownerIdentityKey: this._identity.identityKey
|
|
7146
7447
|
});
|
|
7147
|
-
const wasAgentCreatedDuringQuery = this._agentStatus ===
|
|
7448
|
+
const wasAgentCreatedDuringQuery = this._agentStatus === import_protocols16.EdgeAgentStatus.ACTIVE;
|
|
7148
7449
|
if (!wasAgentCreatedDuringQuery) {
|
|
7149
|
-
const deviceKey = agent.deviceKey ?
|
|
7450
|
+
const deviceKey = agent.deviceKey ? import_keys16.PublicKey.fromHex(agent.deviceKey) : void 0;
|
|
7150
7451
|
this._updateStatus(agent.status, deviceKey);
|
|
7151
7452
|
}
|
|
7152
7453
|
} catch (err) {
|
|
7153
|
-
if (err instanceof
|
|
7454
|
+
if (err instanceof import_protocols16.EdgeCallFailedError) {
|
|
7154
7455
|
if (!err.isRetryable) {
|
|
7155
|
-
|
|
7456
|
+
import_log22.log.warn("non retryable error on agent status fetch attempt", {
|
|
7156
7457
|
err
|
|
7157
7458
|
}, {
|
|
7158
|
-
F:
|
|
7459
|
+
F: __dxlog_file26,
|
|
7159
7460
|
L: 133,
|
|
7160
7461
|
S: this,
|
|
7161
7462
|
C: (f, a) => f(...a)
|
|
@@ -7164,11 +7465,11 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7164
7465
|
}
|
|
7165
7466
|
}
|
|
7166
7467
|
const retryAfterMs = AGENT_STATUS_QUERY_RETRY_INTERVAL + Math.random() * AGENT_STATUS_QUERY_RETRY_JITTER;
|
|
7167
|
-
|
|
7468
|
+
import_log22.log.info("agent status fetching failed", {
|
|
7168
7469
|
err,
|
|
7169
7470
|
retryAfterMs
|
|
7170
7471
|
}, {
|
|
7171
|
-
F:
|
|
7472
|
+
F: __dxlog_file26,
|
|
7172
7473
|
L: 138,
|
|
7173
7474
|
S: this,
|
|
7174
7475
|
C: (f, a) => f(...a)
|
|
@@ -7200,11 +7501,11 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7200
7501
|
].some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
|
|
7201
7502
|
space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
|
|
7202
7503
|
activePollingEnabled = activePollingEnabled || agentFeedNeedsNotarization;
|
|
7203
|
-
|
|
7504
|
+
import_log22.log.info("set active edge polling", {
|
|
7204
7505
|
enabled: agentFeedNeedsNotarization,
|
|
7205
7506
|
spaceId: space.id
|
|
7206
7507
|
}, {
|
|
7207
|
-
F:
|
|
7508
|
+
F: __dxlog_file26,
|
|
7208
7509
|
L: 165,
|
|
7209
7510
|
S: this,
|
|
7210
7511
|
C: (f, a) => f(...a)
|
|
@@ -7221,10 +7522,10 @@ var EdgeAgentManager = class extends import_context15.Resource {
|
|
|
7221
7522
|
if (deviceKey) {
|
|
7222
7523
|
this._ensureAgentIsInSpaces(deviceKey);
|
|
7223
7524
|
}
|
|
7224
|
-
|
|
7525
|
+
import_log22.log.info("agent status update", {
|
|
7225
7526
|
status
|
|
7226
7527
|
}, {
|
|
7227
|
-
F:
|
|
7528
|
+
F: __dxlog_file26,
|
|
7228
7529
|
L: 181,
|
|
7229
7530
|
S: this,
|
|
7230
7531
|
C: (f, a) => f(...a)
|
|
@@ -7280,17 +7581,17 @@ var EdgeAgentServiceImpl = class {
|
|
|
7280
7581
|
};
|
|
7281
7582
|
var mapStatus = (agentStatus) => {
|
|
7282
7583
|
switch (agentStatus) {
|
|
7283
|
-
case
|
|
7584
|
+
case import_protocols17.EdgeAgentStatus.ACTIVE:
|
|
7284
7585
|
return import_services20.QueryAgentStatusResponse.AgentStatus.ACTIVE;
|
|
7285
|
-
case
|
|
7586
|
+
case import_protocols17.EdgeAgentStatus.INACTIVE:
|
|
7286
7587
|
return import_services20.QueryAgentStatusResponse.AgentStatus.INACTIVE;
|
|
7287
|
-
case
|
|
7588
|
+
case import_protocols17.EdgeAgentStatus.NOT_FOUND:
|
|
7288
7589
|
return import_services20.QueryAgentStatusResponse.AgentStatus.NOT_FOUND;
|
|
7289
7590
|
case void 0:
|
|
7290
7591
|
return import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN;
|
|
7291
7592
|
}
|
|
7292
7593
|
};
|
|
7293
|
-
var
|
|
7594
|
+
var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-recovery-manager.ts";
|
|
7294
7595
|
var EdgeIdentityRecoveryManager = class {
|
|
7295
7596
|
constructor(_keyring, _edgeClient, _identityProvider, _acceptRecoveredIdentity) {
|
|
7296
7597
|
this._keyring = _keyring;
|
|
@@ -7300,8 +7601,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7300
7601
|
}
|
|
7301
7602
|
async createRecoveryCredential({ data }) {
|
|
7302
7603
|
const identity = this._identityProvider();
|
|
7303
|
-
(0,
|
|
7304
|
-
F:
|
|
7604
|
+
(0, import_invariant24.invariant)(identity, void 0, {
|
|
7605
|
+
F: __dxlog_file27,
|
|
7305
7606
|
L: 37,
|
|
7306
7607
|
S: this,
|
|
7307
7608
|
A: [
|
|
@@ -7320,8 +7621,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7320
7621
|
} else {
|
|
7321
7622
|
recoveryCode = (0, import_credentials23.generateSeedPhrase)();
|
|
7322
7623
|
const keypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7323
|
-
recoveryKey =
|
|
7324
|
-
lookupKey =
|
|
7624
|
+
recoveryKey = import_keys18.PublicKey.from(keypair.publicKey);
|
|
7625
|
+
lookupKey = import_keys18.PublicKey.from(keypair.publicKey);
|
|
7325
7626
|
algorithm = "ED25519";
|
|
7326
7627
|
}
|
|
7327
7628
|
const identityKey = identity.identityKey;
|
|
@@ -7351,8 +7652,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7351
7652
|
};
|
|
7352
7653
|
}
|
|
7353
7654
|
async requestRecoveryChallenge() {
|
|
7354
|
-
(0,
|
|
7355
|
-
F:
|
|
7655
|
+
(0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7656
|
+
F: __dxlog_file27,
|
|
7356
7657
|
L: 74,
|
|
7357
7658
|
S: this,
|
|
7358
7659
|
A: [
|
|
@@ -7370,7 +7671,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7370
7671
|
await this._edgeClient.recoverIdentity(request);
|
|
7371
7672
|
throw new Error("No challenge received.");
|
|
7372
7673
|
} catch (error) {
|
|
7373
|
-
if (!(error instanceof
|
|
7674
|
+
if (!(error instanceof import_protocols19.EdgeAuthChallengeError)) {
|
|
7374
7675
|
throw error;
|
|
7375
7676
|
}
|
|
7376
7677
|
return {
|
|
@@ -7381,8 +7682,8 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7381
7682
|
}
|
|
7382
7683
|
}
|
|
7383
7684
|
async recoverIdentityWithExternalSignature({ lookupKey, deviceKey, controlFeedKey, signature, clientDataJson, authenticatorData }) {
|
|
7384
|
-
(0,
|
|
7385
|
-
F:
|
|
7685
|
+
(0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7686
|
+
F: __dxlog_file27,
|
|
7386
7687
|
L: 106,
|
|
7387
7688
|
S: this,
|
|
7388
7689
|
A: [
|
|
@@ -7403,17 +7704,17 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7403
7704
|
const response = await this._edgeClient.recoverIdentity(request);
|
|
7404
7705
|
await this._acceptRecoveredIdentity({
|
|
7405
7706
|
authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
|
|
7406
|
-
haloGenesisFeedKey:
|
|
7407
|
-
haloSpaceKey:
|
|
7408
|
-
identityKey:
|
|
7707
|
+
haloGenesisFeedKey: import_keys18.PublicKey.fromHex(response.genesisFeedKey),
|
|
7708
|
+
haloSpaceKey: import_keys18.PublicKey.fromHex(response.haloSpaceKey),
|
|
7709
|
+
identityKey: import_keys18.PublicKey.fromHex(response.identityKey),
|
|
7409
7710
|
deviceKey,
|
|
7410
7711
|
controlFeedKey,
|
|
7411
7712
|
dataFeedKey: await this._keyring.createKey()
|
|
7412
7713
|
});
|
|
7413
7714
|
}
|
|
7414
7715
|
async recoverIdentity({ recoveryCode }) {
|
|
7415
|
-
(0,
|
|
7416
|
-
F:
|
|
7716
|
+
(0, import_invariant24.invariant)(this._edgeClient, "Not connected to EDGE.", {
|
|
7717
|
+
F: __dxlog_file27,
|
|
7417
7718
|
L: 136,
|
|
7418
7719
|
S: this,
|
|
7419
7720
|
A: [
|
|
@@ -7422,7 +7723,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7422
7723
|
]
|
|
7423
7724
|
});
|
|
7424
7725
|
const recoveryKeypair = (0, import_credentials23.keyPairFromSeedPhrase)(recoveryCode);
|
|
7425
|
-
const recoveryKey =
|
|
7726
|
+
const recoveryKey = import_keys18.PublicKey.from(recoveryKeypair.publicKey);
|
|
7426
7727
|
const deviceKey = await this._keyring.createKey();
|
|
7427
7728
|
const controlFeedKey = await this._keyring.createKey();
|
|
7428
7729
|
const request = {
|
|
@@ -7434,7 +7735,7 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7434
7735
|
try {
|
|
7435
7736
|
response = await this._edgeClient.recoverIdentity(request);
|
|
7436
7737
|
} catch (error) {
|
|
7437
|
-
if (!(error instanceof
|
|
7738
|
+
if (!(error instanceof import_protocols19.EdgeAuthChallengeError)) {
|
|
7438
7739
|
throw error;
|
|
7439
7740
|
}
|
|
7440
7741
|
const signature = (0, import_crypto4.sign)(Buffer.from(error.challenge, "base64"), recoveryKeypair.secretKey);
|
|
@@ -7443,17 +7744,17 @@ var EdgeIdentityRecoveryManager = class {
|
|
|
7443
7744
|
signature: Buffer.from(signature).toString("base64")
|
|
7444
7745
|
});
|
|
7445
7746
|
}
|
|
7446
|
-
|
|
7447
|
-
F:
|
|
7747
|
+
import_log24.log.info("recovering identity", response, {
|
|
7748
|
+
F: __dxlog_file27,
|
|
7448
7749
|
L: 162,
|
|
7449
7750
|
S: this,
|
|
7450
7751
|
C: (f, a) => f(...a)
|
|
7451
7752
|
});
|
|
7452
7753
|
await this._acceptRecoveredIdentity({
|
|
7453
7754
|
authorizedDeviceCredential: decodeCredential(response.deviceAuthCredential),
|
|
7454
|
-
haloGenesisFeedKey:
|
|
7455
|
-
haloSpaceKey:
|
|
7456
|
-
identityKey:
|
|
7755
|
+
haloGenesisFeedKey: import_keys18.PublicKey.fromHex(response.genesisFeedKey),
|
|
7756
|
+
haloSpaceKey: import_keys18.PublicKey.fromHex(response.haloSpaceKey),
|
|
7757
|
+
identityKey: import_keys18.PublicKey.fromHex(response.identityKey),
|
|
7457
7758
|
deviceKey,
|
|
7458
7759
|
controlFeedKey,
|
|
7459
7760
|
dataFeedKey: await this._keyring.createKey()
|
|
@@ -7471,7 +7772,7 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
7471
7772
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7472
7773
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7473
7774
|
}
|
|
7474
|
-
function
|
|
7775
|
+
function _using_ctx4() {
|
|
7475
7776
|
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
7476
7777
|
var err = new Error();
|
|
7477
7778
|
err.name = "SuppressedError";
|
|
@@ -7533,8 +7834,8 @@ function _using_ctx3() {
|
|
|
7533
7834
|
}
|
|
7534
7835
|
};
|
|
7535
7836
|
}
|
|
7536
|
-
var
|
|
7537
|
-
var ServiceContext = class extends
|
|
7837
|
+
var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
7838
|
+
var ServiceContext = class extends import_context17.Resource {
|
|
7538
7839
|
constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient, _runtimeParams, _edgeFeatures) {
|
|
7539
7840
|
super();
|
|
7540
7841
|
this.storage = storage;
|
|
@@ -7550,7 +7851,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7550
7851
|
this._meshReplicator = void 0;
|
|
7551
7852
|
this._echoEdgeReplicator = void 0;
|
|
7552
7853
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
7553
|
-
this._instanceId =
|
|
7854
|
+
this._instanceId = import_keys17.PublicKey.random().toHex();
|
|
7554
7855
|
this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
|
|
7555
7856
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
7556
7857
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
@@ -7602,16 +7903,16 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7602
7903
|
}
|
|
7603
7904
|
async _open(ctx) {
|
|
7604
7905
|
await this._checkStorageVersion();
|
|
7605
|
-
(0,
|
|
7606
|
-
F:
|
|
7906
|
+
(0, import_log23.log)("opening...", void 0, {
|
|
7907
|
+
F: __dxlog_file28,
|
|
7607
7908
|
L: 199,
|
|
7608
7909
|
S: this,
|
|
7609
7910
|
C: (f, a) => f(...a)
|
|
7610
7911
|
});
|
|
7611
|
-
|
|
7912
|
+
import_log23.log.trace("dxos.sdk.service-context.open", import_protocols18.trace.begin({
|
|
7612
7913
|
id: this._instanceId
|
|
7613
7914
|
}), {
|
|
7614
|
-
F:
|
|
7915
|
+
F: __dxlog_file28,
|
|
7615
7916
|
L: 200,
|
|
7616
7917
|
S: this,
|
|
7617
7918
|
C: (f, a) => f(...a)
|
|
@@ -7635,32 +7936,32 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7635
7936
|
await this._initialize(ctx);
|
|
7636
7937
|
}
|
|
7637
7938
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
7638
|
-
(0,
|
|
7939
|
+
(0, import_log23.log)("loaded persistent invitations", {
|
|
7639
7940
|
count: loadedInvitations.invitations?.length
|
|
7640
7941
|
}, {
|
|
7641
|
-
F:
|
|
7942
|
+
F: __dxlog_file28,
|
|
7642
7943
|
L: 228,
|
|
7643
7944
|
S: this,
|
|
7644
7945
|
C: (f, a) => f(...a)
|
|
7645
7946
|
});
|
|
7646
|
-
|
|
7947
|
+
import_log23.log.trace("dxos.sdk.service-context.open", import_protocols18.trace.end({
|
|
7647
7948
|
id: this._instanceId
|
|
7648
7949
|
}), {
|
|
7649
|
-
F:
|
|
7950
|
+
F: __dxlog_file28,
|
|
7650
7951
|
L: 230,
|
|
7651
7952
|
S: this,
|
|
7652
7953
|
C: (f, a) => f(...a)
|
|
7653
7954
|
});
|
|
7654
|
-
(0,
|
|
7655
|
-
F:
|
|
7955
|
+
(0, import_log23.log)("opened", void 0, {
|
|
7956
|
+
F: __dxlog_file28,
|
|
7656
7957
|
L: 231,
|
|
7657
7958
|
S: this,
|
|
7658
7959
|
C: (f, a) => f(...a)
|
|
7659
7960
|
});
|
|
7660
7961
|
}
|
|
7661
7962
|
async _close(ctx) {
|
|
7662
|
-
(0,
|
|
7663
|
-
F:
|
|
7963
|
+
(0, import_log23.log)("closing...", void 0, {
|
|
7964
|
+
F: __dxlog_file28,
|
|
7664
7965
|
L: 235,
|
|
7665
7966
|
S: this,
|
|
7666
7967
|
C: (f, a) => f(...a)
|
|
@@ -7678,8 +7979,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7678
7979
|
await this.networkManager.close();
|
|
7679
7980
|
await this.signalManager.close();
|
|
7680
7981
|
await this._edgeConnection?.close();
|
|
7681
|
-
(0,
|
|
7682
|
-
F:
|
|
7982
|
+
(0, import_log23.log)("closed", void 0, {
|
|
7983
|
+
F: __dxlog_file28,
|
|
7683
7984
|
L: 251,
|
|
7684
7985
|
S: this,
|
|
7685
7986
|
C: (f, a) => f(...a)
|
|
@@ -7689,8 +7990,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7689
7990
|
const identity = await this.identityManager.createIdentity(params);
|
|
7690
7991
|
await this._setNetworkIdentity();
|
|
7691
7992
|
await identity.joinNetwork();
|
|
7692
|
-
await this._initialize(new
|
|
7693
|
-
F:
|
|
7993
|
+
await this._initialize(new import_context17.Context(void 0, {
|
|
7994
|
+
F: __dxlog_file28,
|
|
7694
7995
|
L: 258
|
|
7695
7996
|
}));
|
|
7696
7997
|
return identity;
|
|
@@ -7700,8 +8001,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7700
8001
|
throw new Error("Identity must be created before joining a space.");
|
|
7701
8002
|
}
|
|
7702
8003
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
7703
|
-
(0,
|
|
7704
|
-
F:
|
|
8004
|
+
(0, import_invariant23.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
8005
|
+
F: __dxlog_file28,
|
|
7705
8006
|
L: 267,
|
|
7706
8007
|
S: this,
|
|
7707
8008
|
A: [
|
|
@@ -7726,22 +8027,22 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7726
8027
|
});
|
|
7727
8028
|
await identity.joinNetwork();
|
|
7728
8029
|
await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
|
|
7729
|
-
await this._initialize(new
|
|
7730
|
-
F:
|
|
8030
|
+
await this._initialize(new import_context17.Context(void 0, {
|
|
8031
|
+
F: __dxlog_file28,
|
|
7731
8032
|
L: 286
|
|
7732
8033
|
}));
|
|
7733
8034
|
return identity;
|
|
7734
8035
|
}
|
|
7735
8036
|
async _checkStorageVersion() {
|
|
7736
8037
|
await this.metadataStore.load();
|
|
7737
|
-
if (this.metadataStore.version !==
|
|
7738
|
-
throw new
|
|
8038
|
+
if (this.metadataStore.version !== import_protocols18.STORAGE_VERSION) {
|
|
8039
|
+
throw new import_protocols18.InvalidStorageVersionError(import_protocols18.STORAGE_VERSION, this.metadataStore.version);
|
|
7739
8040
|
}
|
|
7740
8041
|
}
|
|
7741
8042
|
// Called when identity is created.
|
|
7742
8043
|
async _initialize(ctx) {
|
|
7743
|
-
(0,
|
|
7744
|
-
F:
|
|
8044
|
+
(0, import_log23.log)("initializing spaces...", void 0, {
|
|
8045
|
+
F: __dxlog_file28,
|
|
7745
8046
|
L: 301,
|
|
7746
8047
|
S: this,
|
|
7747
8048
|
C: (f, a) => f(...a)
|
|
@@ -7779,8 +8080,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7779
8080
|
this.edgeAgentManager = new EdgeAgentManager(this._edgeFeatures, this._edgeHttpClient, this.dataSpaceManager, identity);
|
|
7780
8081
|
await this.edgeAgentManager.open();
|
|
7781
8082
|
this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
|
|
7782
|
-
(0,
|
|
7783
|
-
F:
|
|
8083
|
+
(0, import_invariant23.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
8084
|
+
F: __dxlog_file28,
|
|
7784
8085
|
L: 339,
|
|
7785
8086
|
S: this,
|
|
7786
8087
|
A: [
|
|
@@ -7801,10 +8102,10 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7801
8102
|
return;
|
|
7802
8103
|
}
|
|
7803
8104
|
if (!this.dataSpaceManager) {
|
|
7804
|
-
(0,
|
|
8105
|
+
(0, import_log23.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
7805
8106
|
details: assertion
|
|
7806
8107
|
}, {
|
|
7807
|
-
F:
|
|
8108
|
+
F: __dxlog_file28,
|
|
7808
8109
|
L: 355,
|
|
7809
8110
|
S: this,
|
|
7810
8111
|
C: (f, a) => f(...a)
|
|
@@ -7812,10 +8113,10 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7812
8113
|
return;
|
|
7813
8114
|
}
|
|
7814
8115
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
7815
|
-
(0,
|
|
8116
|
+
(0, import_log23.log)("space already exists, ignoring space admission", {
|
|
7816
8117
|
details: assertion
|
|
7817
8118
|
}, {
|
|
7818
|
-
F:
|
|
8119
|
+
F: __dxlog_file28,
|
|
7819
8120
|
L: 359,
|
|
7820
8121
|
S: this,
|
|
7821
8122
|
C: (f, a) => f(...a)
|
|
@@ -7823,10 +8124,10 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7823
8124
|
return;
|
|
7824
8125
|
}
|
|
7825
8126
|
try {
|
|
7826
|
-
(0,
|
|
8127
|
+
(0, import_log23.log)("accepting space recorded in halo", {
|
|
7827
8128
|
details: assertion
|
|
7828
8129
|
}, {
|
|
7829
|
-
F:
|
|
8130
|
+
F: __dxlog_file28,
|
|
7830
8131
|
L: 364,
|
|
7831
8132
|
S: this,
|
|
7832
8133
|
C: (f, a) => f(...a)
|
|
@@ -7836,8 +8137,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7836
8137
|
genesisFeedKey: assertion.genesisFeedKey
|
|
7837
8138
|
});
|
|
7838
8139
|
} catch (err) {
|
|
7839
|
-
|
|
7840
|
-
F:
|
|
8140
|
+
import_log23.log.catch(err, void 0, {
|
|
8141
|
+
F: __dxlog_file28,
|
|
7841
8142
|
L: 370,
|
|
7842
8143
|
S: this,
|
|
7843
8144
|
C: (f, a) => f(...a)
|
|
@@ -7849,16 +8150,16 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7849
8150
|
}
|
|
7850
8151
|
async _setNetworkIdentity(params) {
|
|
7851
8152
|
try {
|
|
7852
|
-
var _usingCtx =
|
|
8153
|
+
var _usingCtx = _using_ctx4();
|
|
7853
8154
|
const _ = _usingCtx.u(await this._edgeIdentityUpdateMutex.acquire());
|
|
7854
8155
|
let edgeIdentity;
|
|
7855
8156
|
const identity = this.identityManager.identity;
|
|
7856
8157
|
if (identity) {
|
|
7857
|
-
(0,
|
|
8158
|
+
(0, import_log23.log)("setting identity on edge connection", {
|
|
7858
8159
|
identity: identity.identityKey.toHex(),
|
|
7859
8160
|
swarms: this.networkManager.topics
|
|
7860
8161
|
}, {
|
|
7861
|
-
F:
|
|
8162
|
+
F: __dxlog_file28,
|
|
7862
8163
|
L: 384,
|
|
7863
8164
|
S: this,
|
|
7864
8165
|
C: (f, a) => f(...a)
|
|
@@ -7871,8 +8172,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7871
8172
|
await (0, import_debug5.warnAfterTimeout)(1e4, "Waiting for identity to be ready for edge connection", async () => {
|
|
7872
8173
|
await identity.ready();
|
|
7873
8174
|
});
|
|
7874
|
-
(0,
|
|
7875
|
-
F:
|
|
8175
|
+
(0, import_invariant23.invariant)(identity.deviceCredentialChain, void 0, {
|
|
8176
|
+
F: __dxlog_file28,
|
|
7876
8177
|
L: 403,
|
|
7877
8178
|
S: this,
|
|
7878
8179
|
A: [
|
|
@@ -7942,16 +8243,16 @@ var StorageDriver = import_config2.Runtime.Client.Storage.StorageDriver;
|
|
|
7942
8243
|
var createStorageObjects = (config) => {
|
|
7943
8244
|
const { persistent = false, keyStore, dataStore } = config ?? {};
|
|
7944
8245
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
7945
|
-
throw new
|
|
8246
|
+
throw new import_protocols20.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
7946
8247
|
}
|
|
7947
8248
|
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
7948
|
-
throw new
|
|
8249
|
+
throw new import_protocols20.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
7949
8250
|
}
|
|
7950
8251
|
if (persistent && keyStore === StorageDriver.RAM) {
|
|
7951
|
-
throw new
|
|
8252
|
+
throw new import_protocols20.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
7952
8253
|
}
|
|
7953
8254
|
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
7954
|
-
throw new
|
|
8255
|
+
throw new import_protocols20.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
7955
8256
|
}
|
|
7956
8257
|
return {
|
|
7957
8258
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -7982,14 +8283,14 @@ var toStorageType = (type) => {
|
|
|
7982
8283
|
};
|
|
7983
8284
|
var createLevel = async (config) => {
|
|
7984
8285
|
const persistent = isPersistent(config);
|
|
7985
|
-
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${
|
|
8286
|
+
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys19.PublicKey.random().toHex()}`;
|
|
7986
8287
|
const level = (0, import_kv_store.createLevel)(storagePath);
|
|
7987
8288
|
await level.open();
|
|
7988
8289
|
return level;
|
|
7989
8290
|
};
|
|
7990
|
-
var
|
|
7991
|
-
var encodeProfileArchive = (profile) =>
|
|
7992
|
-
var decodeProfileArchive = (data) =>
|
|
8291
|
+
var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
8292
|
+
var encodeProfileArchive = (profile) => import_automerge_repo2.cbor.encode(profile);
|
|
8293
|
+
var decodeProfileArchive = (data) => import_automerge_repo2.cbor.decode(data);
|
|
7993
8294
|
var exportProfileData = async ({ storage, level }) => {
|
|
7994
8295
|
const archive = {
|
|
7995
8296
|
storage: [],
|
|
@@ -8000,10 +8301,10 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8000
8301
|
{
|
|
8001
8302
|
const directory = await storage.createDirectory();
|
|
8002
8303
|
const files = await directory.list();
|
|
8003
|
-
|
|
8304
|
+
import_log25.log.info("begin exporting files", {
|
|
8004
8305
|
count: files.length
|
|
8005
8306
|
}, {
|
|
8006
|
-
F:
|
|
8307
|
+
F: __dxlog_file29,
|
|
8007
8308
|
L: 30,
|
|
8008
8309
|
S: void 0,
|
|
8009
8310
|
C: (f, a) => f(...a)
|
|
@@ -8013,23 +8314,23 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8013
8314
|
const { size } = await file.stat();
|
|
8014
8315
|
const data = await file.read(0, size);
|
|
8015
8316
|
archive.storage.push({
|
|
8016
|
-
type:
|
|
8317
|
+
type: import_protocols21.ProfileArchiveEntryType.FILE,
|
|
8017
8318
|
key: filename,
|
|
8018
8319
|
value: data
|
|
8019
8320
|
});
|
|
8020
8321
|
}
|
|
8021
|
-
|
|
8322
|
+
import_log25.log.info("done exporting files", {
|
|
8022
8323
|
count: files.length
|
|
8023
8324
|
}, {
|
|
8024
|
-
F:
|
|
8325
|
+
F: __dxlog_file29,
|
|
8025
8326
|
L: 41,
|
|
8026
8327
|
S: void 0,
|
|
8027
8328
|
C: (f, a) => f(...a)
|
|
8028
8329
|
});
|
|
8029
8330
|
}
|
|
8030
8331
|
{
|
|
8031
|
-
|
|
8032
|
-
F:
|
|
8332
|
+
import_log25.log.info("begin exporting kv pairs", void 0, {
|
|
8333
|
+
F: __dxlog_file29,
|
|
8033
8334
|
L: 45,
|
|
8034
8335
|
S: void 0,
|
|
8035
8336
|
C: (f, a) => f(...a)
|
|
@@ -8041,16 +8342,16 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
8041
8342
|
let count = 0;
|
|
8042
8343
|
for await (const [key, value] of iter) {
|
|
8043
8344
|
archive.storage.push({
|
|
8044
|
-
type:
|
|
8345
|
+
type: import_protocols21.ProfileArchiveEntryType.KEY_VALUE,
|
|
8045
8346
|
key,
|
|
8046
8347
|
value
|
|
8047
8348
|
});
|
|
8048
8349
|
count++;
|
|
8049
8350
|
}
|
|
8050
|
-
|
|
8351
|
+
import_log25.log.info("done exporting kv pairs", {
|
|
8051
8352
|
count
|
|
8052
8353
|
}, {
|
|
8053
|
-
F:
|
|
8354
|
+
F: __dxlog_file29,
|
|
8054
8355
|
L: 56,
|
|
8055
8356
|
S: void 0,
|
|
8056
8357
|
C: (f, a) => f(...a)
|
|
@@ -8063,10 +8364,10 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8063
8364
|
let count = 0;
|
|
8064
8365
|
for (const entry2 of archive.storage) {
|
|
8065
8366
|
switch (entry2.type) {
|
|
8066
|
-
case
|
|
8367
|
+
case import_protocols21.ProfileArchiveEntryType.FILE: {
|
|
8067
8368
|
const directory = await storage.createDirectory();
|
|
8068
|
-
(0,
|
|
8069
|
-
F:
|
|
8369
|
+
(0, import_invariant25.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
8370
|
+
F: __dxlog_file29,
|
|
8070
8371
|
L: 79,
|
|
8071
8372
|
S: void 0,
|
|
8072
8373
|
A: [
|
|
@@ -8075,8 +8376,8 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8075
8376
|
]
|
|
8076
8377
|
});
|
|
8077
8378
|
const file = await directory.getOrCreateFile(entry2.key);
|
|
8078
|
-
(0,
|
|
8079
|
-
F:
|
|
8379
|
+
(0, import_invariant25.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
8380
|
+
F: __dxlog_file29,
|
|
8080
8381
|
L: 81,
|
|
8081
8382
|
S: void 0,
|
|
8082
8383
|
A: [
|
|
@@ -8088,9 +8389,9 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8088
8389
|
await file.close();
|
|
8089
8390
|
break;
|
|
8090
8391
|
}
|
|
8091
|
-
case
|
|
8092
|
-
(0,
|
|
8093
|
-
F:
|
|
8392
|
+
case import_protocols21.ProfileArchiveEntryType.KEY_VALUE: {
|
|
8393
|
+
(0, import_invariant25.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
8394
|
+
F: __dxlog_file29,
|
|
8094
8395
|
L: 87,
|
|
8095
8396
|
S: void 0,
|
|
8096
8397
|
A: [
|
|
@@ -8098,8 +8399,8 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8098
8399
|
"'Invalid key type'"
|
|
8099
8400
|
]
|
|
8100
8401
|
});
|
|
8101
|
-
(0,
|
|
8102
|
-
F:
|
|
8402
|
+
(0, import_invariant25.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
8403
|
+
F: __dxlog_file29,
|
|
8103
8404
|
L: 88,
|
|
8104
8405
|
S: void 0,
|
|
8105
8406
|
A: [
|
|
@@ -8119,27 +8420,27 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
8119
8420
|
if (++count % 1e3 === 0) {
|
|
8120
8421
|
await batch.write();
|
|
8121
8422
|
batch = level.batch();
|
|
8122
|
-
|
|
8423
|
+
import_log25.log.info("importing", {
|
|
8123
8424
|
count,
|
|
8124
8425
|
total: archive.storage.length,
|
|
8125
8426
|
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
8126
8427
|
}, {
|
|
8127
|
-
F:
|
|
8428
|
+
F: __dxlog_file29,
|
|
8128
8429
|
L: 101,
|
|
8129
8430
|
S: void 0,
|
|
8130
8431
|
C: (f, a) => f(...a)
|
|
8131
8432
|
});
|
|
8132
8433
|
}
|
|
8133
8434
|
}
|
|
8134
|
-
|
|
8135
|
-
F:
|
|
8435
|
+
import_log25.log.info("committing changes..", void 0, {
|
|
8436
|
+
F: __dxlog_file29,
|
|
8136
8437
|
L: 109,
|
|
8137
8438
|
S: void 0,
|
|
8138
8439
|
C: (f, a) => f(...a)
|
|
8139
8440
|
});
|
|
8140
8441
|
await batch.write();
|
|
8141
8442
|
};
|
|
8142
|
-
var
|
|
8443
|
+
var __dxlog_file30 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
8143
8444
|
var DevicesServiceImpl = class {
|
|
8144
8445
|
constructor(_identityManager, _edgeConnection) {
|
|
8145
8446
|
this._identityManager = _identityManager;
|
|
@@ -8157,8 +8458,8 @@ var DevicesServiceImpl = class {
|
|
|
8157
8458
|
devices: []
|
|
8158
8459
|
});
|
|
8159
8460
|
} else {
|
|
8160
|
-
(0,
|
|
8161
|
-
F:
|
|
8461
|
+
(0, import_invariant27.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
8462
|
+
F: __dxlog_file30,
|
|
8162
8463
|
L: 36,
|
|
8163
8464
|
S: this,
|
|
8164
8465
|
A: [
|
|
@@ -8262,7 +8563,7 @@ var ContactsServiceImpl = class {
|
|
|
8262
8563
|
});
|
|
8263
8564
|
}
|
|
8264
8565
|
return acc;
|
|
8265
|
-
}, new import_util15.ComplexMap(
|
|
8566
|
+
}, new import_util15.ComplexMap(import_keys21.PublicKey.hash));
|
|
8266
8567
|
return {
|
|
8267
8568
|
contacts: [
|
|
8268
8569
|
...contacts.values()
|
|
@@ -8270,7 +8571,7 @@ var ContactsServiceImpl = class {
|
|
|
8270
8571
|
};
|
|
8271
8572
|
}
|
|
8272
8573
|
queryContacts() {
|
|
8273
|
-
const subscribedSpaceKeySet = new import_util15.ComplexSet(
|
|
8574
|
+
const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys21.PublicKey.hash);
|
|
8274
8575
|
return new import_stream12.Stream(({ next, ctx }) => {
|
|
8275
8576
|
const pushUpdateTask = new import_async25.UpdateScheduler(ctx, async () => {
|
|
8276
8577
|
const contacts = await this.getContacts();
|
|
@@ -8304,17 +8605,17 @@ var LoggingServiceImpl = class {
|
|
|
8304
8605
|
constructor() {
|
|
8305
8606
|
this._logs = new import_async26.Event();
|
|
8306
8607
|
this._started = Date.now();
|
|
8307
|
-
this._sessionId =
|
|
8608
|
+
this._sessionId = import_keys22.PublicKey.random().toHex();
|
|
8308
8609
|
this._logProcessor = (_config, entry2) => {
|
|
8309
8610
|
this._logs.emit(entry2);
|
|
8310
8611
|
};
|
|
8311
8612
|
}
|
|
8312
8613
|
async open() {
|
|
8313
|
-
|
|
8614
|
+
import_log27.log.runtimeConfig.processors.push(this._logProcessor);
|
|
8314
8615
|
}
|
|
8315
8616
|
async close() {
|
|
8316
|
-
const index =
|
|
8317
|
-
|
|
8617
|
+
const index = import_log27.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
8618
|
+
import_log27.log.runtimeConfig.processors.splice(index, 1);
|
|
8318
8619
|
}
|
|
8319
8620
|
async controlMetrics({ reset, record }) {
|
|
8320
8621
|
if (reset) {
|
|
@@ -8375,7 +8676,7 @@ var LoggingServiceImpl = class {
|
|
|
8375
8676
|
}
|
|
8376
8677
|
const record = {
|
|
8377
8678
|
...entry2,
|
|
8378
|
-
context: (0, import_util16.jsonify)((0,
|
|
8679
|
+
context: (0, import_util16.jsonify)((0, import_log27.getContextFromEntry)(entry2)),
|
|
8379
8680
|
timestamp: /* @__PURE__ */ new Date(),
|
|
8380
8681
|
meta: {
|
|
8381
8682
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -8451,6 +8752,9 @@ var NetworkServiceImpl = class {
|
|
|
8451
8752
|
async leaveSwarm(request) {
|
|
8452
8753
|
return this.signalManager.leave(request);
|
|
8453
8754
|
}
|
|
8755
|
+
async querySwarm(request) {
|
|
8756
|
+
return this.signalManager.query(request);
|
|
8757
|
+
}
|
|
8454
8758
|
subscribeSwarmState(request) {
|
|
8455
8759
|
return new import_stream14.Stream(({ next }) => {
|
|
8456
8760
|
const unsubscribe = this.signalManager.swarmState?.on((state) => {
|
|
@@ -8533,7 +8837,7 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
8533
8837
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8534
8838
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8535
8839
|
}
|
|
8536
|
-
var
|
|
8840
|
+
var __dxlog_file31 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
8537
8841
|
var ClientServicesHost = class {
|
|
8538
8842
|
constructor({
|
|
8539
8843
|
config,
|
|
@@ -8572,8 +8876,8 @@ var ClientServicesHost = class {
|
|
|
8572
8876
|
lockKey,
|
|
8573
8877
|
onAcquire: () => {
|
|
8574
8878
|
if (!this._opening) {
|
|
8575
|
-
void this.open(new
|
|
8576
|
-
F:
|
|
8879
|
+
void this.open(new import_context18.Context(void 0, {
|
|
8880
|
+
F: __dxlog_file31,
|
|
8577
8881
|
L: 137
|
|
8578
8882
|
}));
|
|
8579
8883
|
}
|
|
@@ -8630,8 +8934,8 @@ var ClientServicesHost = class {
|
|
|
8630
8934
|
* Can only be called once.
|
|
8631
8935
|
*/
|
|
8632
8936
|
initialize({ config, ...options }) {
|
|
8633
|
-
(0,
|
|
8634
|
-
F:
|
|
8937
|
+
(0, import_invariant26.invariant)(!this._open, "service host is open", {
|
|
8938
|
+
F: __dxlog_file31,
|
|
8635
8939
|
L: 203,
|
|
8636
8940
|
S: this,
|
|
8637
8941
|
A: [
|
|
@@ -8639,15 +8943,15 @@ var ClientServicesHost = class {
|
|
|
8639
8943
|
"'service host is open'"
|
|
8640
8944
|
]
|
|
8641
8945
|
});
|
|
8642
|
-
(0,
|
|
8643
|
-
F:
|
|
8946
|
+
(0, import_log26.log)("initializing...", void 0, {
|
|
8947
|
+
F: __dxlog_file31,
|
|
8644
8948
|
L: 204,
|
|
8645
8949
|
S: this,
|
|
8646
8950
|
C: (f, a) => f(...a)
|
|
8647
8951
|
});
|
|
8648
8952
|
if (config) {
|
|
8649
|
-
(0,
|
|
8650
|
-
F:
|
|
8953
|
+
(0, import_invariant26.invariant)(!this._config, "config already set", {
|
|
8954
|
+
F: __dxlog_file31,
|
|
8651
8955
|
L: 207,
|
|
8652
8956
|
S: this,
|
|
8653
8957
|
A: [
|
|
@@ -8661,8 +8965,8 @@ var ClientServicesHost = class {
|
|
|
8661
8965
|
}
|
|
8662
8966
|
}
|
|
8663
8967
|
if (!options.signalManager) {
|
|
8664
|
-
|
|
8665
|
-
F:
|
|
8968
|
+
import_log26.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
8969
|
+
F: __dxlog_file31,
|
|
8666
8970
|
L: 215,
|
|
8667
8971
|
S: this,
|
|
8668
8972
|
C: (f, a) => f(...a)
|
|
@@ -8681,8 +8985,8 @@ var ClientServicesHost = class {
|
|
|
8681
8985
|
edgeConnection: this._edgeConnection
|
|
8682
8986
|
}) : new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
8683
8987
|
this._signalManager = signalManager;
|
|
8684
|
-
(0,
|
|
8685
|
-
F:
|
|
8988
|
+
(0, import_invariant26.invariant)(!this._networkManager, "network manager already set", {
|
|
8989
|
+
F: __dxlog_file31,
|
|
8686
8990
|
L: 237,
|
|
8687
8991
|
S: this,
|
|
8688
8992
|
A: [
|
|
@@ -8699,8 +9003,8 @@ var ClientServicesHost = class {
|
|
|
8699
9003
|
peerKey: this._edgeConnection.peerKey
|
|
8700
9004
|
} : void 0
|
|
8701
9005
|
});
|
|
8702
|
-
(0,
|
|
8703
|
-
F:
|
|
9006
|
+
(0, import_log26.log)("initialized", void 0, {
|
|
9007
|
+
F: __dxlog_file31,
|
|
8704
9008
|
L: 250,
|
|
8705
9009
|
S: this,
|
|
8706
9010
|
C: (f, a) => f(...a)
|
|
@@ -8710,17 +9014,17 @@ var ClientServicesHost = class {
|
|
|
8710
9014
|
if (this._open) {
|
|
8711
9015
|
return;
|
|
8712
9016
|
}
|
|
8713
|
-
const traceId =
|
|
8714
|
-
|
|
9017
|
+
const traceId = import_keys20.PublicKey.random().toHex();
|
|
9018
|
+
import_log26.log.trace("dxos.client-services.host.open", import_protocols22.trace.begin({
|
|
8715
9019
|
id: traceId
|
|
8716
9020
|
}), {
|
|
8717
|
-
F:
|
|
9021
|
+
F: __dxlog_file31,
|
|
8718
9022
|
L: 261,
|
|
8719
9023
|
S: this,
|
|
8720
9024
|
C: (f, a) => f(...a)
|
|
8721
9025
|
});
|
|
8722
|
-
(0,
|
|
8723
|
-
F:
|
|
9026
|
+
(0, import_invariant26.invariant)(this._config, "config not set", {
|
|
9027
|
+
F: __dxlog_file31,
|
|
8724
9028
|
L: 263,
|
|
8725
9029
|
S: this,
|
|
8726
9030
|
A: [
|
|
@@ -8728,8 +9032,8 @@ var ClientServicesHost = class {
|
|
|
8728
9032
|
"'config not set'"
|
|
8729
9033
|
]
|
|
8730
9034
|
});
|
|
8731
|
-
(0,
|
|
8732
|
-
F:
|
|
9035
|
+
(0, import_invariant26.invariant)(this._storage, "storage not set", {
|
|
9036
|
+
F: __dxlog_file31,
|
|
8733
9037
|
L: 264,
|
|
8734
9038
|
S: this,
|
|
8735
9039
|
A: [
|
|
@@ -8737,8 +9041,8 @@ var ClientServicesHost = class {
|
|
|
8737
9041
|
"'storage not set'"
|
|
8738
9042
|
]
|
|
8739
9043
|
});
|
|
8740
|
-
(0,
|
|
8741
|
-
F:
|
|
9044
|
+
(0, import_invariant26.invariant)(this._signalManager, "signal manager not set", {
|
|
9045
|
+
F: __dxlog_file31,
|
|
8742
9046
|
L: 265,
|
|
8743
9047
|
S: this,
|
|
8744
9048
|
A: [
|
|
@@ -8746,8 +9050,8 @@ var ClientServicesHost = class {
|
|
|
8746
9050
|
"'signal manager not set'"
|
|
8747
9051
|
]
|
|
8748
9052
|
});
|
|
8749
|
-
(0,
|
|
8750
|
-
F:
|
|
9053
|
+
(0, import_invariant26.invariant)(this._networkManager, "network manager not set", {
|
|
9054
|
+
F: __dxlog_file31,
|
|
8751
9055
|
L: 266,
|
|
8752
9056
|
S: this,
|
|
8753
9057
|
A: [
|
|
@@ -8756,10 +9060,10 @@ var ClientServicesHost = class {
|
|
|
8756
9060
|
]
|
|
8757
9061
|
});
|
|
8758
9062
|
this._opening = true;
|
|
8759
|
-
(0,
|
|
9063
|
+
(0, import_log26.log)("opening...", {
|
|
8760
9064
|
lockKey: this._resourceLock?.lockKey
|
|
8761
9065
|
}, {
|
|
8762
|
-
F:
|
|
9066
|
+
F: __dxlog_file31,
|
|
8763
9067
|
L: 269,
|
|
8764
9068
|
S: this,
|
|
8765
9069
|
C: (f, a) => f(...a)
|
|
@@ -8817,18 +9121,18 @@ var ClientServicesHost = class {
|
|
|
8817
9121
|
this._open = true;
|
|
8818
9122
|
this._statusUpdate.emit();
|
|
8819
9123
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
8820
|
-
(0,
|
|
9124
|
+
(0, import_log26.log)("opened", {
|
|
8821
9125
|
deviceKey
|
|
8822
9126
|
}, {
|
|
8823
|
-
F:
|
|
9127
|
+
F: __dxlog_file31,
|
|
8824
9128
|
L: 366,
|
|
8825
9129
|
S: this,
|
|
8826
9130
|
C: (f, a) => f(...a)
|
|
8827
9131
|
});
|
|
8828
|
-
|
|
9132
|
+
import_log26.log.trace("dxos.client-services.host.open", import_protocols22.trace.end({
|
|
8829
9133
|
id: traceId
|
|
8830
9134
|
}), {
|
|
8831
|
-
F:
|
|
9135
|
+
F: __dxlog_file31,
|
|
8832
9136
|
L: 367,
|
|
8833
9137
|
S: this,
|
|
8834
9138
|
C: (f, a) => f(...a)
|
|
@@ -8839,10 +9143,10 @@ var ClientServicesHost = class {
|
|
|
8839
9143
|
return;
|
|
8840
9144
|
}
|
|
8841
9145
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
8842
|
-
(0,
|
|
9146
|
+
(0, import_log26.log)("closing...", {
|
|
8843
9147
|
deviceKey
|
|
8844
9148
|
}, {
|
|
8845
|
-
F:
|
|
9149
|
+
F: __dxlog_file31,
|
|
8846
9150
|
L: 378,
|
|
8847
9151
|
S: this,
|
|
8848
9152
|
C: (f, a) => f(...a)
|
|
@@ -8857,27 +9161,27 @@ var ClientServicesHost = class {
|
|
|
8857
9161
|
await this._level?.close();
|
|
8858
9162
|
this._open = false;
|
|
8859
9163
|
this._statusUpdate.emit();
|
|
8860
|
-
(0,
|
|
9164
|
+
(0, import_log26.log)("closed", {
|
|
8861
9165
|
deviceKey
|
|
8862
9166
|
}, {
|
|
8863
|
-
F:
|
|
9167
|
+
F: __dxlog_file31,
|
|
8864
9168
|
L: 387,
|
|
8865
9169
|
S: this,
|
|
8866
9170
|
C: (f, a) => f(...a)
|
|
8867
9171
|
});
|
|
8868
9172
|
}
|
|
8869
9173
|
async reset() {
|
|
8870
|
-
const traceId =
|
|
8871
|
-
|
|
9174
|
+
const traceId = import_keys20.PublicKey.random().toHex();
|
|
9175
|
+
import_log26.log.trace("dxos.sdk.client-services-host.reset", import_protocols22.trace.begin({
|
|
8872
9176
|
id: traceId
|
|
8873
9177
|
}), {
|
|
8874
|
-
F:
|
|
9178
|
+
F: __dxlog_file31,
|
|
8875
9179
|
L: 392,
|
|
8876
9180
|
S: this,
|
|
8877
9181
|
C: (f, a) => f(...a)
|
|
8878
9182
|
});
|
|
8879
|
-
|
|
8880
|
-
F:
|
|
9183
|
+
import_log26.log.info("resetting...", void 0, {
|
|
9184
|
+
F: __dxlog_file31,
|
|
8881
9185
|
L: 394,
|
|
8882
9186
|
S: this,
|
|
8883
9187
|
C: (f, a) => f(...a)
|
|
@@ -8886,16 +9190,16 @@ var ClientServicesHost = class {
|
|
|
8886
9190
|
this._statusUpdate.emit();
|
|
8887
9191
|
await this._serviceContext?.close();
|
|
8888
9192
|
await this._storage.reset();
|
|
8889
|
-
|
|
8890
|
-
F:
|
|
9193
|
+
import_log26.log.info("reset", void 0, {
|
|
9194
|
+
F: __dxlog_file31,
|
|
8891
9195
|
L: 401,
|
|
8892
9196
|
S: this,
|
|
8893
9197
|
C: (f, a) => f(...a)
|
|
8894
9198
|
});
|
|
8895
|
-
|
|
9199
|
+
import_log26.log.trace("dxos.sdk.client-services-host.reset", import_protocols22.trace.end({
|
|
8896
9200
|
id: traceId
|
|
8897
9201
|
}), {
|
|
8898
|
-
F:
|
|
9202
|
+
F: __dxlog_file31,
|
|
8899
9203
|
L: 402,
|
|
8900
9204
|
S: this,
|
|
8901
9205
|
C: (f, a) => f(...a)
|
|
@@ -8974,4 +9278,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
8974
9278
|
subscribeToSpaces,
|
|
8975
9279
|
subscribeToSwarmInfo
|
|
8976
9280
|
});
|
|
8977
|
-
//# sourceMappingURL=chunk-
|
|
9281
|
+
//# sourceMappingURL=chunk-AENAROAE.cjs.map
|