@dxos/client-services 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446

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.
Files changed (73) hide show
  1. package/dist/lib/browser/{chunk-I3QLQXQD.mjs → chunk-2TKMQ2UP.mjs} +167 -170
  2. package/dist/lib/browser/chunk-2TKMQ2UP.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +1 -1
  6. package/dist/lib/node/{chunk-Y747YVDI.cjs → chunk-HUMVSL5Y.cjs} +336 -339
  7. package/dist/lib/node/chunk-HUMVSL5Y.cjs.map +7 -0
  8. package/dist/lib/node/index.cjs +47 -47
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +8 -8
  11. package/dist/lib/node-esm/{chunk-XNCWQTDB.mjs → chunk-DQCPFIVI.mjs} +167 -170
  12. package/dist/lib/node-esm/chunk-DQCPFIVI.mjs.map +7 -0
  13. package/dist/lib/node-esm/index.mjs +1 -1
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/testing/index.mjs +1 -1
  16. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +1 -1
  17. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  18. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  19. package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
  20. package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
  21. package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
  22. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  23. package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
  24. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
  25. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
  26. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
  27. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  28. package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
  29. package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
  30. package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
  31. package/dist/types/src/packlets/locks/browser.d.ts.map +1 -1
  32. package/dist/types/src/packlets/locks/node.d.ts.map +1 -1
  33. package/dist/types/src/packlets/network/network-service.d.ts +1 -3
  34. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  35. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  36. package/dist/types/src/packlets/services/util.d.ts.map +1 -1
  37. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +1 -1
  38. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
  39. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -1
  40. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  41. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  42. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  43. package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
  44. package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
  45. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  46. package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
  47. package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
  48. package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
  49. package/dist/types/src/packlets/storage/util.d.ts.map +1 -1
  50. package/dist/types/src/packlets/testing/credential-utils.d.ts.map +1 -1
  51. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  52. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  53. package/dist/types/src/version.d.ts +1 -1
  54. package/dist/types/src/version.d.ts.map +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +38 -39
  57. package/src/packlets/agents/edge-agent-service.ts +11 -8
  58. package/src/packlets/devices/devices-service.ts +3 -5
  59. package/src/packlets/identity/identity.test.ts +6 -9
  60. package/src/packlets/network/network-service.ts +15 -9
  61. package/src/packlets/services/service-host.ts +1 -5
  62. package/src/packlets/space-export/space-archive-reader.ts +1 -2
  63. package/src/packlets/spaces/data-space-manager.ts +29 -35
  64. package/src/packlets/spaces/data-space.ts +4 -11
  65. package/src/packlets/spaces/edge-feed-replicator.test.ts +1 -2
  66. package/src/packlets/spaces/edge-feed-replicator.ts +1 -2
  67. package/src/packlets/spaces/epoch-migrations.ts +2 -3
  68. package/src/packlets/spaces/spaces-service.ts +1 -2
  69. package/src/packlets/storage/profile-archive.ts +1 -2
  70. package/src/version.ts +1 -1
  71. package/dist/lib/browser/chunk-I3QLQXQD.mjs.map +0 -7
  72. package/dist/lib/node/chunk-Y747YVDI.cjs.map +0 -7
  73. package/dist/lib/node-esm/chunk-XNCWQTDB.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 chunk_Y747YVDI_exports = {};
30
- __export(chunk_Y747YVDI_exports, {
29
+ var chunk_HUMVSL5Y_exports = {};
30
+ __export(chunk_HUMVSL5Y_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -72,7 +72,7 @@ __export(chunk_Y747YVDI_exports, {
72
72
  subscribeToSpaces: () => subscribeToSpaces,
73
73
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
74
74
  });
75
- module.exports = __toCommonJS(chunk_Y747YVDI_exports);
75
+ module.exports = __toCommonJS(chunk_HUMVSL5Y_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");
@@ -116,10 +116,9 @@ var import_log3 = require("@dxos/log");
116
116
  var import_protocols2 = require("@dxos/protocols");
117
117
  var import_buf = require("@dxos/protocols/buf");
118
118
  var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
119
- var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
120
119
  var import_util3 = require("@dxos/util");
121
- var import_automerge = require("@automerge/automerge");
122
120
  var import_async7 = require("@dxos/async");
121
+ var import_automerge = require("@dxos/automerge/automerge");
123
122
  var import_client_protocol2 = require("@dxos/client-protocol");
124
123
  var import_context4 = require("@dxos/context");
125
124
  var import_debug = require("@dxos/debug");
@@ -129,7 +128,7 @@ var import_invariant3 = require("@dxos/invariant");
129
128
  var import_keys4 = require("@dxos/keys");
130
129
  var import_log4 = require("@dxos/log");
131
130
  var import_protocols3 = require("@dxos/protocols");
132
- var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
131
+ var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
133
132
  var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
134
133
  var import_timeframe = require("@dxos/timeframe");
135
134
  var import_tracing3 = require("@dxos/tracing");
@@ -138,7 +137,7 @@ var import_async8 = require("@dxos/async");
138
137
  var import_context5 = require("@dxos/context");
139
138
  var import_credentials4 = require("@dxos/credentials");
140
139
  var import_invariant4 = require("@dxos/invariant");
141
- var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
140
+ var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
142
141
  var import_async9 = require("@dxos/async");
143
142
  var import_context6 = require("@dxos/context");
144
143
  var import_credentials5 = require("@dxos/credentials");
@@ -163,8 +162,8 @@ var import_util6 = require("@dxos/util");
163
162
  var import_credentials8 = require("@dxos/credentials");
164
163
  var import_keys7 = require("@dxos/keys");
165
164
  var import_log7 = require("@dxos/log");
166
- var import_automerge_repo = require("@automerge/automerge-repo");
167
165
  var import_async11 = require("@dxos/async");
166
+ var import_automerge_repo = require("@dxos/automerge/automerge-repo");
168
167
  var import_client_protocol4 = require("@dxos/client-protocol");
169
168
  var import_context7 = require("@dxos/context");
170
169
  var import_credentials9 = require("@dxos/credentials");
@@ -176,7 +175,7 @@ var import_invariant7 = require("@dxos/invariant");
176
175
  var import_keys8 = require("@dxos/keys");
177
176
  var import_log8 = require("@dxos/log");
178
177
  var import_protocols5 = require("@dxos/protocols");
179
- var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
178
+ var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
180
179
  var import_metadata = require("@dxos/protocols/proto/dxos/echo/metadata");
181
180
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
182
181
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
@@ -195,7 +194,7 @@ var import_invariant8 = require("@dxos/invariant");
195
194
  var import_keys9 = require("@dxos/keys");
196
195
  var import_log9 = require("@dxos/log");
197
196
  var import_protocols6 = require("@dxos/protocols");
198
- var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
197
+ var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
199
198
  var import_tracing6 = require("@dxos/tracing");
200
199
  var import_context8 = require("@dxos/context");
201
200
  var import_invariant9 = require("@dxos/invariant");
@@ -211,7 +210,7 @@ var import_invariant11 = require("@dxos/invariant");
211
210
  var import_keys10 = require("@dxos/keys");
212
211
  var import_log11 = require("@dxos/log");
213
212
  var import_protocols9 = require("@dxos/protocols");
214
- var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
213
+ var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
215
214
  var import_credentials15 = require("@dxos/protocols/proto/dxos/halo/credentials");
216
215
  var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
217
216
  var import_timeframe4 = require("@dxos/timeframe");
@@ -223,12 +222,12 @@ var import_context10 = require("@dxos/context");
223
222
  var import_credentials16 = require("@dxos/credentials");
224
223
  var import_invariant12 = require("@dxos/invariant");
225
224
  var import_log12 = require("@dxos/log");
226
- var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
225
+ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
227
226
  var import_util9 = require("@dxos/util");
228
227
  var import_credentials17 = require("@dxos/credentials");
229
228
  var import_invariant13 = require("@dxos/invariant");
230
229
  var import_protocols10 = require("@dxos/protocols");
231
- var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
230
+ var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
232
231
  var import_async15 = require("@dxos/async");
233
232
  var import_client_protocol5 = require("@dxos/client-protocol");
234
233
  var import_context11 = require("@dxos/context");
@@ -238,7 +237,7 @@ var import_keys11 = require("@dxos/keys");
238
237
  var import_log13 = require("@dxos/log");
239
238
  var import_network_manager = require("@dxos/network-manager");
240
239
  var import_protocols11 = require("@dxos/protocols");
241
- var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
240
+ var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
242
241
  var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
243
242
  var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
244
243
  var import_tracing8 = require("@dxos/tracing");
@@ -250,9 +249,9 @@ var import_keys12 = require("@dxos/keys");
250
249
  var import_log14 = require("@dxos/log");
251
250
  var import_protocols12 = require("@dxos/protocols");
252
251
  var import_proto3 = require("@dxos/protocols/proto");
253
- var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
252
+ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
254
253
  var import_context12 = require("@dxos/context");
255
- var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
254
+ var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
256
255
  var import_async17 = require("@dxos/async");
257
256
  var import_context13 = require("@dxos/context");
258
257
  var import_invariant16 = require("@dxos/invariant");
@@ -269,26 +268,26 @@ var import_keys13 = require("@dxos/keys");
269
268
  var import_log16 = require("@dxos/log");
270
269
  var import_protocols14 = require("@dxos/protocols");
271
270
  var import_proto5 = require("@dxos/protocols/proto");
272
- var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
271
+ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
273
272
  var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
274
273
  var import_teleport3 = require("@dxos/teleport");
275
274
  var import_async19 = require("@dxos/async");
276
275
  var import_log17 = require("@dxos/log");
277
- var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
276
+ var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
278
277
  var import_invariant18 = require("@dxos/invariant");
279
278
  var import_keys14 = require("@dxos/keys");
280
279
  var import_log18 = require("@dxos/log");
281
280
  var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
282
281
  var import_util11 = require("@dxos/util");
283
282
  var import_stream9 = require("@dxos/codec-protobuf/stream");
284
- var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
283
+ var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
285
284
  var import_tracing9 = require("@dxos/tracing");
286
285
  var import_credentials18 = require("@dxos/credentials");
287
286
  var import_feed_store5 = require("@dxos/feed-store");
288
287
  var import_invariant19 = require("@dxos/invariant");
289
288
  var import_log19 = require("@dxos/log");
290
289
  var import_protocols15 = require("@dxos/protocols");
291
- var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
290
+ var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
292
291
  var import_credentials19 = require("@dxos/protocols/proto/dxos/halo/credentials");
293
292
  var import_async20 = require("@dxos/async");
294
293
  var import_client_protocol6 = require("@dxos/client-protocol");
@@ -298,7 +297,7 @@ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
298
297
  var import_invariant20 = require("@dxos/invariant");
299
298
  var import_keys15 = require("@dxos/keys");
300
299
  var import_log20 = require("@dxos/log");
301
- var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
300
+ var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
302
301
  var import_credentials21 = require("@dxos/protocols/proto/dxos/halo/credentials");
303
302
  var import_invariant21 = require("@dxos/invariant");
304
303
  var import_lock_file = require("@dxos/lock-file");
@@ -313,11 +312,11 @@ var import_invariant22 = require("@dxos/invariant");
313
312
  var import_keys16 = require("@dxos/keys");
314
313
  var import_log22 = require("@dxos/log");
315
314
  var import_protocols16 = require("@dxos/protocols");
316
- var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
315
+ var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
317
316
  var import_metadata2 = require("@dxos/protocols/proto/dxos/echo/metadata");
318
317
  var import_stream10 = require("@dxos/codec-protobuf/stream");
319
318
  var import_protocols17 = require("@dxos/protocols");
320
- var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
319
+ var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
321
320
  var import_async22 = require("@dxos/async");
322
321
  var import_context17 = require("@dxos/context");
323
322
  var import_credentials22 = require("@dxos/credentials");
@@ -330,7 +329,7 @@ var import_keyring = require("@dxos/keyring");
330
329
  var import_keys17 = require("@dxos/keys");
331
330
  var import_log23 = require("@dxos/log");
332
331
  var import_protocols18 = require("@dxos/protocols");
333
- var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
332
+ var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
334
333
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
335
334
  var import_tracing11 = require("@dxos/tracing");
336
335
  var import_util12 = require("@dxos/util");
@@ -351,7 +350,7 @@ var import_util13 = require("@dxos/util");
351
350
  var import_node_path = __toESM(require("node:path"));
352
351
  var import_keys19 = require("@dxos/keys");
353
352
  var import_kv_store = require("@dxos/kv-store");
354
- var import_automerge_repo2 = require("@automerge/automerge-repo");
353
+ var import_automerge_repo2 = require("@dxos/automerge/automerge-repo");
355
354
  var import_invariant25 = require("@dxos/invariant");
356
355
  var import_log25 = require("@dxos/log");
357
356
  var import_protocols21 = require("@dxos/protocols");
@@ -366,13 +365,13 @@ var import_log26 = require("@dxos/log");
366
365
  var import_messaging = require("@dxos/messaging");
367
366
  var import_network_manager2 = require("@dxos/network-manager");
368
367
  var import_protocols22 = require("@dxos/protocols");
369
- var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
368
+ var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
370
369
  var import_tracing12 = require("@dxos/tracing");
371
370
  var import_websocket_rpc = require("@dxos/websocket-rpc");
372
371
  var import_async24 = require("@dxos/async");
373
372
  var import_stream11 = require("@dxos/codec-protobuf/stream");
374
373
  var import_invariant27 = require("@dxos/invariant");
375
- var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
374
+ var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
376
375
  var import_async25 = require("@dxos/async");
377
376
  var import_stream12 = require("@dxos/codec-protobuf/stream");
378
377
  var import_keys21 = require("@dxos/keys");
@@ -381,11 +380,11 @@ var import_async26 = require("@dxos/async");
381
380
  var import_stream13 = require("@dxos/codec-protobuf/stream");
382
381
  var import_keys22 = require("@dxos/keys");
383
382
  var import_log27 = require("@dxos/log");
384
- var import_services25 = require("@dxos/protocols/proto/dxos/client/services");
383
+ var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
385
384
  var import_util16 = require("@dxos/util");
386
385
  var import_stream14 = require("@dxos/codec-protobuf/stream");
387
386
  var import_stream15 = require("@dxos/codec-protobuf/stream");
388
- var import_services26 = require("@dxos/protocols/proto/dxos/client/services");
387
+ var import_services25 = require("@dxos/protocols/proto/dxos/client/services");
389
388
  var import_util17 = require("@dxos/util");
390
389
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
391
390
  var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
@@ -745,7 +744,7 @@ var DevtoolsServiceImpl = class {
745
744
  });
746
745
  }
747
746
  };
748
- var DXOS_VERSION = "0.8.2-main.fbd8ed0";
747
+ var DXOS_VERSION = "0.8.2-staging.7ac8446";
749
748
  var getPlatform = () => {
750
749
  if (process.browser) {
751
750
  if (typeof window !== "undefined") {
@@ -1137,7 +1136,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1137
1136
  async _open() {
1138
1137
  (0, import_log3.log)("open", void 0, {
1139
1138
  F: __dxlog_file5,
1140
- L: 57,
1139
+ L: 56,
1141
1140
  S: this,
1142
1141
  C: (f, a) => f(...a)
1143
1142
  });
@@ -1156,7 +1155,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1156
1155
  _spaceId: this._spaceId
1157
1156
  }, {
1158
1157
  F: __dxlog_file5,
1159
- L: 71,
1158
+ L: 70,
1160
1159
  S: this,
1161
1160
  C: (f, a) => f(...a)
1162
1161
  });
@@ -1169,7 +1168,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1169
1168
  type: payload.type
1170
1169
  }, {
1171
1170
  F: __dxlog_file5,
1172
- L: 76,
1171
+ L: 75,
1173
1172
  S: this,
1174
1173
  C: (f, a) => f(...a)
1175
1174
  });
@@ -1181,14 +1180,14 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1181
1180
  }
1182
1181
  async _handleReconnect() {
1183
1182
  await this._resetConnection();
1184
- if (this._messenger.status === import_services4.EdgeStatus.CONNECTED) {
1183
+ if (this._messenger.isConnected) {
1185
1184
  this._startReplication();
1186
1185
  }
1187
1186
  }
1188
1187
  async _close() {
1189
1188
  (0, import_log3.log)("close", void 0, {
1190
1189
  F: __dxlog_file5,
1191
- L: 96,
1190
+ L: 95,
1192
1191
  S: this,
1193
1192
  C: (f, a) => f(...a)
1194
1193
  });
@@ -1200,7 +1199,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1200
1199
  this._connectionCtx = connectionCtx;
1201
1200
  (0, import_log3.log)("connection context created", void 0, {
1202
1201
  F: __dxlog_file5,
1203
- L: 104,
1202
+ L: 103,
1204
1203
  S: this,
1205
1204
  C: (f, a) => f(...a)
1206
1205
  });
@@ -1213,7 +1212,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1213
1212
  async _resetConnection() {
1214
1213
  (0, import_log3.log)("resetConnection", void 0, {
1215
1214
  F: __dxlog_file5,
1216
- L: 113,
1215
+ L: 112,
1217
1216
  S: this,
1218
1217
  C: (f, a) => f(...a)
1219
1218
  });
@@ -1229,7 +1228,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1229
1228
  hasConnectionCtx: !!this._connectionCtx
1230
1229
  }, {
1231
1230
  F: __dxlog_file5,
1232
- L: 121,
1231
+ L: 120,
1233
1232
  S: this,
1234
1233
  C: (f, a) => f(...a)
1235
1234
  });
@@ -1246,7 +1245,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1246
1245
  key: feed.key
1247
1246
  }, {
1248
1247
  F: __dxlog_file5,
1249
- L: 134,
1248
+ L: 133,
1250
1249
  S: this,
1251
1250
  C: (f, a) => f(...a)
1252
1251
  });
@@ -1262,7 +1261,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1262
1261
  if (!this._connectionCtx) {
1263
1262
  (0, import_log3.log)("message dropped because connection was disposed", void 0, {
1264
1263
  F: __dxlog_file5,
1265
- L: 147,
1264
+ L: 146,
1266
1265
  S: this,
1267
1266
  C: (f, a) => f(...a)
1268
1267
  });
@@ -1274,14 +1273,14 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1274
1273
  blocks: message.blocks.map((b) => b.index)
1275
1274
  }, {
1276
1275
  F: __dxlog_file5,
1277
- L: 152,
1276
+ L: 151,
1278
1277
  S: this,
1279
1278
  C: (f, a) => f(...a)
1280
1279
  });
1281
1280
  }
1282
1281
  (0, import_invariant2.invariant)(message.feedKey, void 0, {
1283
1282
  F: __dxlog_file5,
1284
- L: 158,
1283
+ L: 157,
1285
1284
  S: this,
1286
1285
  A: [
1287
1286
  "message.feedKey",
@@ -1293,7 +1292,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1293
1292
  type: message.type
1294
1293
  }, {
1295
1294
  F: __dxlog_file5,
1296
- L: 161,
1295
+ L: 160,
1297
1296
  S: this,
1298
1297
  C: (f, a) => f(...a)
1299
1298
  });
@@ -1312,7 +1311,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1312
1311
  if (!this._connectionCtx) {
1313
1312
  import_log3.log.warn("received message after connection context was disposed", void 0, {
1314
1313
  F: __dxlog_file5,
1315
- L: 176,
1314
+ L: 175,
1316
1315
  S: this,
1317
1316
  C: (f, a) => f(...a)
1318
1317
  });
@@ -1330,7 +1329,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1330
1329
  feedKey
1331
1330
  }, {
1332
1331
  F: __dxlog_file5,
1333
- L: 185,
1332
+ L: 184,
1334
1333
  S: this,
1335
1334
  C: (f, a) => f(...a)
1336
1335
  });
@@ -1346,7 +1345,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1346
1345
  if (message.length > feed.length) {
1347
1346
  (0, import_log3.log)("requesting missing blocks", logMeta, {
1348
1347
  F: __dxlog_file5,
1349
- L: 195,
1348
+ L: 194,
1350
1349
  S: this,
1351
1350
  C: (f, a) => f(...a)
1352
1351
  });
@@ -1361,7 +1360,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1361
1360
  } else if (message.length < feed.length) {
1362
1361
  (0, import_log3.log)("pushing blocks to remote", logMeta, {
1363
1362
  F: __dxlog_file5,
1364
- L: 203,
1363
+ L: 202,
1365
1364
  S: this,
1366
1365
  C: (f, a) => f(...a)
1367
1366
  });
@@ -1380,7 +1379,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1380
1379
  blocks: message.blocks.map((b) => b.index)
1381
1380
  }, {
1382
1381
  F: __dxlog_file5,
1383
- L: 212,
1382
+ L: 211,
1384
1383
  S: this,
1385
1384
  C: (f, a) => f(...a)
1386
1385
  });
@@ -1391,7 +1390,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1391
1390
  feedKey
1392
1391
  }, {
1393
1392
  F: __dxlog_file5,
1394
- L: 217,
1393
+ L: 216,
1395
1394
  S: this,
1396
1395
  C: (f, a) => f(...a)
1397
1396
  });
@@ -1405,7 +1404,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1405
1404
  ...message
1406
1405
  }, {
1407
1406
  F: __dxlog_file5,
1408
- L: 226,
1407
+ L: 225,
1409
1408
  S: this,
1410
1409
  C: (f, a) => f(...a)
1411
1410
  });
@@ -1420,7 +1419,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1420
1419
  to
1421
1420
  }, {
1422
1421
  F: __dxlog_file5,
1423
- L: 233,
1422
+ L: 232,
1424
1423
  S: this,
1425
1424
  C: (f, a) => f(...a)
1426
1425
  });
@@ -1430,7 +1429,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1430
1429
  });
1431
1430
  (0, import_invariant2.invariant)(data instanceof Uint8Array, void 0, {
1432
1431
  F: __dxlog_file5,
1433
- L: 238,
1432
+ L: 237,
1434
1433
  S: this,
1435
1434
  A: [
1436
1435
  "data instanceof Uint8Array",
@@ -1458,7 +1457,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1458
1457
  blocks: blocks.length
1459
1458
  }, {
1460
1459
  F: __dxlog_file5,
1461
- L: 259,
1460
+ L: 258,
1462
1461
  S: this,
1463
1462
  C: (f, a) => f(...a)
1464
1463
  });
@@ -1480,7 +1479,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1480
1479
  if (!this._remoteLength.has(feed.key)) {
1481
1480
  (0, import_log3.log)("blocks not pushed because remote length is unknown", void 0, {
1482
1481
  F: __dxlog_file5,
1483
- L: 280,
1482
+ L: 279,
1484
1483
  S: this,
1485
1484
  C: (f, a) => f(...a)
1486
1485
  });
@@ -1505,7 +1504,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1505
1504
  if (err instanceof import_edge_client.EdgeIdentityChangedError || err instanceof import_edge_client.EdgeConnectionClosedError) {
1506
1505
  (0, import_log3.log)("resetting on reconnect", void 0, {
1507
1506
  F: __dxlog_file5,
1508
- L: 297,
1507
+ L: 296,
1509
1508
  S: this,
1510
1509
  C: (f, a) => f(...a)
1511
1510
  });
@@ -1516,7 +1515,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1516
1515
  }
1517
1516
  }, {
1518
1517
  F: __dxlog_file5,
1519
- L: 291
1518
+ L: 290
1520
1519
  });
1521
1520
  return connectionCtx;
1522
1521
  }
@@ -1578,37 +1577,37 @@ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
1578
1577
  var LOAD_DOC_TIMEOUT = 1e4;
1579
1578
  var runEpochMigration = async (ctx, context) => {
1580
1579
  switch (context.migration) {
1581
- case import_services6.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
1580
+ case import_services5.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
1582
1581
  const document = context.echoHost.createDoc();
1583
1582
  await context.echoHost.flush();
1584
1583
  return {
1585
1584
  newRoot: document.url
1586
1585
  };
1587
1586
  }
1588
- case import_services6.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY: {
1587
+ case import_services5.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY: {
1589
1588
  if (!context.currentRoot) {
1590
1589
  throw new Error("Space does not have an automerge root");
1591
1590
  }
1592
1591
  const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
1593
1592
  timeout: LOAD_DOC_TIMEOUT
1594
1593
  });
1595
- const newRoot = context.echoHost.createDoc(rootHandle.doc());
1594
+ const newRoot = context.echoHost.createDoc(rootHandle.docSync());
1596
1595
  await context.echoHost.flush();
1597
1596
  return {
1598
1597
  newRoot: newRoot.url
1599
1598
  };
1600
1599
  }
1601
- case import_services6.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
1600
+ case import_services5.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
1602
1601
  throw new Error("Migration not available");
1603
1602
  }
1604
- case import_services6.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
1603
+ case import_services5.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
1605
1604
  throw new Error("Migration not available");
1606
1605
  }
1607
1606
  // TODO(dmaretskyi): This path doesn't seem to fit here. This is not a migration.
1608
- case import_services6.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
1607
+ case import_services5.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
1609
1608
  (0, import_invariant4.invariant)(context.newAutomergeRoot, void 0, {
1610
1609
  F: __dxlog_file6,
1611
- L: 63,
1610
+ L: 62,
1612
1611
  S: void 0,
1613
1612
  A: [
1614
1613
  "context.newAutomergeRoot",
@@ -2208,15 +2207,14 @@ var DataSpaceManager = class extends import_context7.Resource {
2208
2207
  id: "spaces",
2209
2208
  name: "Spaces",
2210
2209
  fetch: async () => {
2211
- return Promise.all(Array.from(this._spaces.values()).map(async (space) => {
2210
+ return Array.from(this._spaces.values()).map((space) => {
2212
2211
  const rootUrl = space.automergeSpaceState.rootUrl;
2213
- const rootHandle = rootUrl ? await this._echoHost.automergeRepo.find(rootUrl, import_echo_pipeline2.FIND_PARAMS) : void 0;
2214
- await rootHandle?.whenReady();
2215
- const rootDoc = rootHandle?.doc();
2212
+ const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
2213
+ const rootDoc = rootHandle?.docSync();
2216
2214
  const properties = rootDoc && (0, import_echo_pipeline2.findInlineObjectOfType)(rootDoc, import_client_protocol4.TYPE_PROPERTIES);
2217
2215
  return {
2218
2216
  key: space.key.toHex(),
2219
- state: import_services7.SpaceState[space.state],
2217
+ state: import_services6.SpaceState[space.state],
2220
2218
  name: properties?.[1].data.name ?? null,
2221
2219
  inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
2222
2220
  linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
@@ -2224,7 +2222,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2224
2222
  members: space.inner.spaceState.members.size,
2225
2223
  rootUrl
2226
2224
  };
2227
- }));
2225
+ });
2228
2226
  }
2229
2227
  });
2230
2228
  }
@@ -2240,7 +2238,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2240
2238
  async _open() {
2241
2239
  (0, import_log8.log)("open", void 0, {
2242
2240
  F: __dxlog_file9,
2243
- L: 215,
2241
+ L: 213,
2244
2242
  S: this,
2245
2243
  C: (f, a) => f(...a)
2246
2244
  });
@@ -2248,7 +2246,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2248
2246
  id: this._instanceId
2249
2247
  }), {
2250
2248
  F: __dxlog_file9,
2251
- L: 216,
2249
+ L: 214,
2252
2250
  S: this,
2253
2251
  C: (f, a) => f(...a)
2254
2252
  });
@@ -2256,7 +2254,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2256
2254
  spaces: this._metadataStore.spaces.length
2257
2255
  }, {
2258
2256
  F: __dxlog_file9,
2259
- L: 217,
2257
+ L: 215,
2260
2258
  S: this,
2261
2259
  C: (f, a) => f(...a)
2262
2260
  });
@@ -2266,7 +2264,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2266
2264
  spaceMetadata
2267
2265
  }, {
2268
2266
  F: __dxlog_file9,
2269
- L: 221,
2267
+ L: 219,
2270
2268
  S: this,
2271
2269
  C: (f, a) => f(...a)
2272
2270
  });
@@ -2277,7 +2275,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2277
2275
  err
2278
2276
  }, {
2279
2277
  F: __dxlog_file9,
2280
- L: 224,
2278
+ L: 222,
2281
2279
  S: this,
2282
2280
  C: (f, a) => f(...a)
2283
2281
  });
@@ -2288,7 +2286,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2288
2286
  id: this._instanceId
2289
2287
  }), {
2290
2288
  F: __dxlog_file9,
2291
- L: 230,
2289
+ L: 228,
2292
2290
  S: this,
2293
2291
  C: (f, a) => f(...a)
2294
2292
  });
@@ -2296,7 +2294,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2296
2294
  async _close() {
2297
2295
  (0, import_log8.log)("close", void 0, {
2298
2296
  F: __dxlog_file9,
2299
- L: 235,
2297
+ L: 233,
2300
2298
  S: this,
2301
2299
  C: (f, a) => f(...a)
2302
2300
  });
@@ -2320,14 +2318,14 @@ var DataSpaceManager = class extends import_context7.Resource {
2320
2318
  genesisFeedKey: controlFeedKey,
2321
2319
  controlFeedKey,
2322
2320
  dataFeedKey,
2323
- state: import_services7.SpaceState.SPACE_ACTIVE
2321
+ state: import_services6.SpaceState.SPACE_ACTIVE
2324
2322
  };
2325
2323
  (0, import_log8.log)("creating space...", {
2326
2324
  spaceId,
2327
2325
  spaceKey
2328
2326
  }, {
2329
2327
  F: __dxlog_file9,
2330
- L: 264,
2328
+ L: 262,
2331
2329
  S: this,
2332
2330
  C: (f, a) => f(...a)
2333
2331
  });
@@ -2335,7 +2333,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2335
2333
  if (options.documents) {
2336
2334
  (0, import_invariant7.invariant)(Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId)), "Invalid document IDs", {
2337
2335
  F: __dxlog_file9,
2338
- L: 269,
2336
+ L: 267,
2339
2337
  S: this,
2340
2338
  A: [
2341
2339
  "Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId))",
@@ -2347,7 +2345,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2347
2345
  documentId
2348
2346
  }, {
2349
2347
  F: __dxlog_file9,
2350
- L: 276,
2348
+ L: 274,
2351
2349
  S: this,
2352
2350
  C: (f, a) => f(...a)
2353
2351
  });
@@ -2361,7 +2359,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2361
2359
  spaceKey
2362
2360
  }, {
2363
2361
  F: __dxlog_file9,
2364
- L: 283,
2362
+ L: 281,
2365
2363
  S: this,
2366
2364
  C: (f, a) => f(...a)
2367
2365
  });
@@ -2370,7 +2368,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2370
2368
  const newRootDocId = documentIdMapping[(0, import_automerge_repo.interpretAsDocumentId)(options.rootUrl)] ?? (0, import_invariant7.failedInvariant)();
2371
2369
  const rootDocHandle = await this._echoHost.loadDoc(import_context7.Context.default(void 0, {
2372
2370
  F: __dxlog_file9,
2373
- L: 288
2371
+ L: 286
2374
2372
  }), newRootDocId);
2375
2373
  import_echo_pipeline2.DatabaseRoot.mapLinks(rootDocHandle, documentIdMapping);
2376
2374
  root = await this._echoHost.openSpaceRoot(spaceId, `automerge:${newRootDocId}`);
@@ -2381,7 +2379,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2381
2379
  spaceKey
2382
2380
  }, {
2383
2381
  F: __dxlog_file9,
2384
- L: 296,
2382
+ L: 294,
2385
2383
  S: this,
2386
2384
  C: (f, a) => f(...a)
2387
2385
  });
@@ -2391,7 +2389,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2391
2389
  spaceKey
2392
2390
  }, {
2393
2391
  F: __dxlog_file9,
2394
- L: 301,
2392
+ L: 299,
2395
2393
  S: this,
2396
2394
  C: (f, a) => f(...a)
2397
2395
  });
@@ -2400,7 +2398,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2400
2398
  const memberCredential = credentials[1];
2401
2399
  (0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2402
2400
  F: __dxlog_file9,
2403
- L: 307,
2401
+ L: 305,
2404
2402
  S: this,
2405
2403
  A: [
2406
2404
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2414,7 +2412,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2414
2412
  spaceKey
2415
2413
  }, {
2416
2414
  F: __dxlog_file9,
2417
- L: 312,
2415
+ L: 310,
2418
2416
  S: this,
2419
2417
  C: (f, a) => f(...a)
2420
2418
  });
@@ -2427,18 +2425,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2427
2425
  }
2428
2426
  switch (space.databaseRoot.getVersion()) {
2429
2427
  case import_echo_protocol2.SpaceDocVersion.CURRENT: {
2430
- if (!space.databaseRoot.handle.isReady()) {
2431
- import_log8.log.warn("waiting for space root to be ready", {
2432
- spaceId: space.id
2433
- }, {
2434
- F: __dxlog_file9,
2435
- L: 325,
2436
- S: this,
2437
- C: (f, a) => f(...a)
2438
- });
2439
- await space.databaseRoot.handle.whenReady();
2440
- }
2441
- const [_, properties] = (0, import_echo_pipeline2.findInlineObjectOfType)(space.databaseRoot.doc(), import_client_protocol4.TYPE_PROPERTIES) ?? [];
2428
+ const [_, properties] = (0, import_echo_pipeline2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_client_protocol4.TYPE_PROPERTIES) ?? [];
2442
2429
  return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
2443
2430
  }
2444
2431
  case import_echo_protocol2.SpaceDocVersion.LEGACY: {
@@ -2450,7 +2437,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2450
2437
  spaceId: space.id
2451
2438
  }, {
2452
2439
  F: __dxlog_file9,
2453
- L: 336,
2440
+ L: 330,
2454
2441
  S: this,
2455
2442
  C: (f, a) => f(...a)
2456
2443
  });
@@ -2471,7 +2458,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2471
2458
  keys: []
2472
2459
  }
2473
2460
  };
2474
- const propertiesId = import_echo_schema.ObjectId.random();
2461
+ const propertiesId = (0, import_echo_schema.createObjectId)();
2475
2462
  document.change((doc) => {
2476
2463
  (0, import_util7.setDeep)(doc, [
2477
2464
  "objects",
@@ -2485,14 +2472,14 @@ var DataSpaceManager = class extends import_context7.Resource {
2485
2472
  const automergeIndex = space.automergeSpaceState.rootUrl;
2486
2473
  (0, import_invariant7.invariant)(automergeIndex, void 0, {
2487
2474
  F: __dxlog_file9,
2488
- L: 369,
2475
+ L: 363,
2489
2476
  S: this,
2490
2477
  A: [
2491
2478
  "automergeIndex",
2492
2479
  ""
2493
2480
  ]
2494
2481
  });
2495
- const document = await this._echoHost.automergeRepo.find(automergeIndex, import_echo_pipeline2.FIND_PARAMS);
2482
+ const document = this._echoHost.automergeRepo.find(automergeIndex);
2496
2483
  await document.whenReady();
2497
2484
  return document;
2498
2485
  }
@@ -2502,13 +2489,13 @@ var DataSpaceManager = class extends import_context7.Resource {
2502
2489
  opts
2503
2490
  }, {
2504
2491
  F: __dxlog_file9,
2505
- L: 378,
2492
+ L: 372,
2506
2493
  S: this,
2507
2494
  C: (f, a) => f(...a)
2508
2495
  });
2509
2496
  (0, import_invariant7.invariant)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.", {
2510
2497
  F: __dxlog_file9,
2511
- L: 379,
2498
+ L: 373,
2512
2499
  S: this,
2513
2500
  A: [
2514
2501
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2517,7 +2504,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2517
2504
  });
2518
2505
  (0, import_invariant7.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
2519
2506
  F: __dxlog_file9,
2520
- L: 380,
2507
+ L: 374,
2521
2508
  S: this,
2522
2509
  A: [
2523
2510
  "!this._spaces.has(opts.spaceKey)",
@@ -2541,7 +2528,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2541
2528
  const space = this._spaceManager.spaces.get(options.spaceKey);
2542
2529
  (0, import_invariant7.invariant)(space, void 0, {
2543
2530
  F: __dxlog_file9,
2544
- L: 400,
2531
+ L: 394,
2545
2532
  S: this,
2546
2533
  A: [
2547
2534
  "space",
@@ -2554,7 +2541,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2554
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);
2555
2542
  (0, import_invariant7.invariant)(credentials[0].credential, void 0, {
2556
2543
  F: __dxlog_file9,
2557
- L: 419,
2544
+ L: 413,
2558
2545
  S: this,
2559
2546
  A: [
2560
2547
  "credentials[0].credential",
@@ -2564,7 +2551,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2564
2551
  const spaceMemberCredential = credentials[0].credential.credential;
2565
2552
  (0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2566
2553
  F: __dxlog_file9,
2567
- L: 421,
2554
+ L: 415,
2568
2555
  S: this,
2569
2556
  A: [
2570
2557
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2582,7 +2569,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2582
2569
  async waitUntilSpaceReady(spaceKey) {
2583
2570
  await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
2584
2571
  const space = this._spaces.get(spaceKey);
2585
- return !!space && space.state === import_services7.SpaceState.SPACE_READY;
2572
+ return !!space && space.state === import_services6.SpaceState.SPACE_READY;
2586
2573
  }));
2587
2574
  }
2588
2575
  async requestSpaceAdmissionCredential(spaceKey) {
@@ -2602,7 +2589,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2602
2589
  const space = this._spaces.get(spaceKey);
2603
2590
  (0, import_invariant7.invariant)(space, "Space not found.", {
2604
2591
  F: __dxlog_file9,
2605
- L: 458,
2592
+ L: 452,
2606
2593
  S: this,
2607
2594
  A: [
2608
2595
  "space",
@@ -2627,7 +2614,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2627
2614
  metadata
2628
2615
  }, {
2629
2616
  F: __dxlog_file9,
2630
- L: 477,
2617
+ L: 471,
2631
2618
  S: this,
2632
2619
  C: (f, a) => f(...a)
2633
2620
  });
@@ -2671,7 +2658,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2671
2658
  err
2672
2659
  }, {
2673
2660
  F: __dxlog_file9,
2674
- L: 519,
2661
+ L: 513,
2675
2662
  S: this,
2676
2663
  C: (f, a) => f(...a)
2677
2664
  });
@@ -2681,13 +2668,13 @@ var DataSpaceManager = class extends import_context7.Resource {
2681
2668
  onAuthFailure: () => {
2682
2669
  import_log8.log.warn("auth failure", void 0, {
2683
2670
  F: __dxlog_file9,
2684
- L: 524,
2671
+ L: 518,
2685
2672
  S: this,
2686
2673
  C: (f, a) => f(...a)
2687
2674
  });
2688
2675
  },
2689
2676
  onMemberRolesChanged: async (members) => {
2690
- if (dataSpace?.state === import_services7.SpaceState.SPACE_READY) {
2677
+ if (dataSpace?.state === import_services6.SpaceState.SPACE_READY) {
2691
2678
  this._handleMemberRoleChanges(presence, space.protocol, members);
2692
2679
  }
2693
2680
  },
@@ -2700,7 +2687,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2700
2687
  dataFeed && await space.setDataFeed(dataFeed);
2701
2688
  const dataSpace = new DataSpace({
2702
2689
  inner: space,
2703
- initialState: metadata.state === import_services7.SpaceState.SPACE_INACTIVE ? import_services7.SpaceState.SPACE_INACTIVE : import_services7.SpaceState.SPACE_CLOSED,
2690
+ initialState: metadata.state === import_services6.SpaceState.SPACE_INACTIVE ? import_services6.SpaceState.SPACE_INACTIVE : import_services6.SpaceState.SPACE_CLOSED,
2704
2691
  metadataStore: this._metadataStore,
2705
2692
  gossip,
2706
2693
  presence,
@@ -2714,7 +2701,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2714
2701
  space: space.key
2715
2702
  }, {
2716
2703
  F: __dxlog_file9,
2717
- L: 551,
2704
+ L: 545,
2718
2705
  S: this,
2719
2706
  C: (f, a) => f(...a)
2720
2707
  });
@@ -2725,7 +2712,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2725
2712
  open: this._lifecycleState === import_context7.LifecycleState.OPEN
2726
2713
  }, {
2727
2714
  F: __dxlog_file9,
2728
- L: 554,
2715
+ L: 548,
2729
2716
  S: this,
2730
2717
  C: (f, a) => f(...a)
2731
2718
  });
@@ -2744,7 +2731,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2744
2731
  space: space.key
2745
2732
  }, {
2746
2733
  F: __dxlog_file9,
2747
- L: 562,
2734
+ L: 556,
2748
2735
  S: this,
2749
2736
  C: (f, a) => f(...a)
2750
2737
  });
@@ -2765,7 +2752,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2765
2752
  spaceId: dataSpace.id
2766
2753
  }, {
2767
2754
  F: __dxlog_file9,
2768
- L: 576,
2755
+ L: 570,
2769
2756
  S: this,
2770
2757
  C: (f, a) => f(...a)
2771
2758
  });
@@ -2778,7 +2765,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2778
2765
  }
2779
2766
  });
2780
2767
  presence.newPeer.on((peerState) => {
2781
- if (dataSpace.state === import_services7.SpaceState.SPACE_READY) {
2768
+ if (dataSpace.state === import_services6.SpaceState.SPACE_READY) {
2782
2769
  this._handleNewPeerConnected(space, peerState);
2783
2770
  }
2784
2771
  });
@@ -2795,7 +2782,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2795
2782
  space: space.key
2796
2783
  }, {
2797
2784
  F: __dxlog_file9,
2798
- L: 603,
2785
+ L: 597,
2799
2786
  S: this,
2800
2787
  C: (f, a) => f(...a)
2801
2788
  });
@@ -2828,7 +2815,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2828
2815
  closedSessions
2829
2816
  }, {
2830
2817
  F: __dxlog_file9,
2831
- L: 629,
2818
+ L: 623,
2832
2819
  S: this,
2833
2820
  C: (f, a) => f(...a)
2834
2821
  });
@@ -2843,7 +2830,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2843
2830
  peerId: peerState.peerId
2844
2831
  }, {
2845
2832
  F: __dxlog_file9,
2846
- L: 643,
2833
+ L: 637,
2847
2834
  S: this,
2848
2835
  C: (f, a) => f(...a)
2849
2836
  });
@@ -2852,7 +2839,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2852
2839
  }
2853
2840
  }
2854
2841
  async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
2855
- if (dataSpace?.state !== import_services7.SpaceState.SPACE_READY) {
2842
+ if (dataSpace?.state !== import_services6.SpaceState.SPACE_READY) {
2856
2843
  return;
2857
2844
  }
2858
2845
  if (isActive) {
@@ -2869,8 +2856,8 @@ var DataSpaceManager = class extends import_context7.Resource {
2869
2856
  async _createDelegatedInvitations(space, invitations) {
2870
2857
  const tasks = invitations.map(([credentialId, invitation]) => {
2871
2858
  return this._invitationsManager.createInvitation({
2872
- type: import_services7.Invitation.Type.DELEGATED,
2873
- kind: import_services7.Invitation.Kind.SPACE,
2859
+ type: import_services6.Invitation.Type.DELEGATED,
2860
+ kind: import_services6.Invitation.Kind.SPACE,
2874
2861
  spaceKey: space.key,
2875
2862
  authMethod: invitation.authMethod,
2876
2863
  invitationId: invitation.invitationId,
@@ -2965,7 +2952,7 @@ var extractSpaceArchive = async (archive) => {
2965
2952
  const documentId = entry2.fileName.replace(`${import_protocols8.SpaceArchiveFileStructure.documents}/`, "").replace(/\.bin$/, "");
2966
2953
  (0, import_invariant10.invariant)(!documentId.includes("/"), void 0, {
2967
2954
  F: __dxlog_file10,
2968
- L: 28,
2955
+ L: 27,
2969
2956
  S: void 0,
2970
2957
  A: [
2971
2958
  "!documentId.includes('/')",
@@ -2979,7 +2966,7 @@ var extractSpaceArchive = async (archive) => {
2979
2966
  documents
2980
2967
  }, {
2981
2968
  F: __dxlog_file10,
2982
- L: 32,
2969
+ L: 31,
2983
2970
  S: void 0,
2984
2971
  C: (f, a) => f(...a)
2985
2972
  });
@@ -3069,10 +3056,10 @@ var SpacesServiceImpl = class {
3069
3056
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
3070
3057
  if (state) {
3071
3058
  switch (state) {
3072
- case import_services8.SpaceState.SPACE_ACTIVE:
3059
+ case import_services7.SpaceState.SPACE_ACTIVE:
3073
3060
  await space.activate();
3074
3061
  break;
3075
- case import_services8.SpaceState.SPACE_INACTIVE:
3062
+ case import_services7.SpaceState.SPACE_INACTIVE:
3076
3063
  await space.deactivate();
3077
3064
  break;
3078
3065
  default:
@@ -3098,7 +3085,7 @@ var SpacesServiceImpl = class {
3098
3085
  const credentials = await (0, import_credentials13.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
3099
3086
  (0, import_invariant8.invariant)(credentials[0].credential, void 0, {
3100
3087
  F: __dxlog_file11,
3101
- L: 119,
3088
+ L: 118,
3102
3089
  S: this,
3103
3090
  A: [
3104
3091
  "credentials[0].credential",
@@ -3108,7 +3095,7 @@ var SpacesServiceImpl = class {
3108
3095
  const spaceMemberCredential = credentials[0].credential.credential;
3109
3096
  (0, import_invariant8.invariant)((0, import_credentials13.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3110
3097
  F: __dxlog_file11,
3111
- L: 121,
3098
+ L: 120,
3112
3099
  S: this,
3113
3100
  A: [
3114
3101
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3126,7 +3113,7 @@ var SpacesServiceImpl = class {
3126
3113
  ids: spaces.map((space) => space.id)
3127
3114
  }), {
3128
3115
  F: __dxlog_file11,
3129
- L: 134,
3116
+ L: 133,
3130
3117
  S: this,
3131
3118
  C: (f, a) => f(...a)
3132
3119
  });
@@ -3218,7 +3205,7 @@ var SpacesServiceImpl = class {
3218
3205
  } else {
3219
3206
  (0, import_invariant8.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
3220
3207
  F: __dxlog_file11,
3221
- L: 232,
3208
+ L: 231,
3222
3209
  S: this,
3223
3210
  A: [
3224
3211
  "!credential.id",
@@ -3227,7 +3214,7 @@ var SpacesServiceImpl = class {
3227
3214
  });
3228
3215
  (0, import_invariant8.invariant)(this._identityManager.identity, "Identity is not available", {
3229
3216
  F: __dxlog_file11,
3230
- L: 233,
3217
+ L: 232,
3231
3218
  S: this,
3232
3219
  A: [
3233
3220
  "this._identityManager.identity",
@@ -3237,7 +3224,7 @@ var SpacesServiceImpl = class {
3237
3224
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
3238
3225
  (0, import_invariant8.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
3239
3226
  F: __dxlog_file11,
3240
- L: 235,
3227
+ L: 234,
3241
3228
  S: this,
3242
3229
  A: [
3243
3230
  "credential.issuer.equals(signer.getIssuer())",
@@ -3314,7 +3301,7 @@ var SpacesServiceImpl = class {
3314
3301
  const extracted = await extractSpaceArchive(request.archive);
3315
3302
  (0, import_invariant8.invariant)(extracted.metadata.echo?.currentRootUrl, "Space archive does not contain a root URL", {
3316
3303
  F: __dxlog_file11,
3317
- L: 289,
3304
+ L: 288,
3318
3305
  S: this,
3319
3306
  A: [
3320
3307
  "extracted.metadata.echo?.currentRootUrl",
@@ -3334,7 +3321,7 @@ var SpacesServiceImpl = class {
3334
3321
  const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
3335
3322
  (0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
3336
3323
  F: __dxlog_file11,
3337
- L: 300,
3324
+ L: 299,
3338
3325
  S: this,
3339
3326
  A: [
3340
3327
  "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3344,7 +3331,7 @@ var SpacesServiceImpl = class {
3344
3331
  const myIdentity = this._identityManager.identity;
3345
3332
  (0, import_invariant8.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
3346
3333
  F: __dxlog_file11,
3347
- L: 302,
3334
+ L: 301,
3348
3335
  S: this,
3349
3336
  A: [
3350
3337
  "myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
@@ -3401,7 +3388,7 @@ var SpacesServiceImpl = class {
3401
3388
  profile: member.profile ?? {}
3402
3389
  },
3403
3390
  role: member.role,
3404
- presence: peers.length > 0 ? import_services8.SpaceMember.PresenceState.ONLINE : import_services8.SpaceMember.PresenceState.OFFLINE,
3391
+ presence: peers.length > 0 ? import_services7.SpaceMember.PresenceState.ONLINE : import_services7.SpaceMember.PresenceState.OFFLINE,
3405
3392
  peerStates: peers
3406
3393
  };
3407
3394
  })),
@@ -3988,8 +3975,8 @@ var IdentityManager = class {
3988
3975
  this.stateUpdate.emit();
3989
3976
  return {
3990
3977
  deviceKey: this._identity.deviceKey,
3991
- kind: import_services9.DeviceKind.CURRENT,
3992
- presence: import_services9.Device.PresenceState.ONLINE,
3978
+ kind: import_services8.DeviceKind.CURRENT,
3979
+ presence: import_services8.Device.PresenceState.ONLINE,
3993
3980
  profile
3994
3981
  };
3995
3982
  }
@@ -4263,9 +4250,9 @@ var IdentityServiceImpl = class extends import_context10.Resource {
4263
4250
  const dataSpaceManager = this._dataSpaceManagerProvider();
4264
4251
  const recordedDefaultSpaceTrigger = new import_async14.Trigger();
4265
4252
  const allProcessed = (0, import_util9.safeAwaitAll)(dataSpaceManager.spaces.values(), async (space) => {
4266
- if (space.state === import_services10.SpaceState.SPACE_CLOSED) {
4253
+ if (space.state === import_services9.SpaceState.SPACE_CLOSED) {
4267
4254
  await space.open();
4268
- const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services10.SpaceState.SPACE_REQUIRES_MIGRATION);
4255
+ const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services9.SpaceState.SPACE_REQUIRES_MIGRATION);
4269
4256
  await Promise.race([
4270
4257
  space.initializeDataPipeline(),
4271
4258
  requiresMigration
@@ -4379,13 +4366,13 @@ var DataSpace = class {
4379
4366
  constructor(params) {
4380
4367
  this._ctx = new import_context4.Context(void 0, {
4381
4368
  F: __dxlog_file15,
4382
- L: 100
4369
+ L: 97
4383
4370
  });
4384
4371
  this._cache = void 0;
4385
4372
  this._edgeFeedReplicator = void 0;
4386
4373
  this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
4387
4374
  this._epochProcessingMutex = new import_async7.Mutex();
4388
- this._state = import_services5.SpaceState.SPACE_CLOSED;
4375
+ this._state = import_services4.SpaceState.SPACE_CLOSED;
4389
4376
  this._databaseRoot = null;
4390
4377
  this.error = void 0;
4391
4378
  this.stateUpdate = new import_async7.Event();
@@ -4425,10 +4412,10 @@ var DataSpace = class {
4425
4412
  }
4426
4413
  this._state = params.initialState;
4427
4414
  (0, import_log4.log)("new state", {
4428
- state: import_services5.SpaceState[this._state]
4415
+ state: import_services4.SpaceState[this._state]
4429
4416
  }, {
4430
4417
  F: __dxlog_file15,
4431
- L: 176,
4418
+ L: 173,
4432
4419
  S: this,
4433
4420
  C: (f, a) => f(...a)
4434
4421
  });
@@ -4471,7 +4458,7 @@ var DataSpace = class {
4471
4458
  };
4472
4459
  }
4473
4460
  async open() {
4474
- if (this._state === import_services5.SpaceState.SPACE_CLOSED) {
4461
+ if (this._state === import_services4.SpaceState.SPACE_CLOSED) {
4475
4462
  await this._open();
4476
4463
  }
4477
4464
  }
@@ -4487,16 +4474,16 @@ var DataSpace = class {
4487
4474
  }
4488
4475
  await this._inner.open(new import_context4.Context(void 0, {
4489
4476
  F: __dxlog_file15,
4490
- L: 250
4477
+ L: 247
4491
4478
  }));
4492
4479
  await this._inner.startProtocol();
4493
4480
  await this._edgeFeedReplicator?.open();
4494
- this._state = import_services5.SpaceState.SPACE_CONTROL_ONLY;
4481
+ this._state = import_services4.SpaceState.SPACE_CONTROL_ONLY;
4495
4482
  (0, import_log4.log)("new state", {
4496
- state: import_services5.SpaceState[this._state]
4483
+ state: import_services4.SpaceState[this._state]
4497
4484
  }, {
4498
4485
  F: __dxlog_file15,
4499
- L: 256,
4486
+ L: 253,
4500
4487
  S: this,
4501
4488
  C: (f, a) => f(...a)
4502
4489
  });
@@ -4511,19 +4498,19 @@ var DataSpace = class {
4511
4498
  async _close() {
4512
4499
  await this._callbacks.beforeClose?.();
4513
4500
  await this.preClose.callSerial();
4514
- this._state = import_services5.SpaceState.SPACE_CLOSED;
4501
+ this._state = import_services4.SpaceState.SPACE_CLOSED;
4515
4502
  (0, import_log4.log)("new state", {
4516
- state: import_services5.SpaceState[this._state]
4503
+ state: import_services4.SpaceState[this._state]
4517
4504
  }, {
4518
4505
  F: __dxlog_file15,
4519
- L: 275,
4506
+ L: 272,
4520
4507
  S: this,
4521
4508
  C: (f, a) => f(...a)
4522
4509
  });
4523
4510
  await this._ctx.dispose();
4524
4511
  this._ctx = new import_context4.Context(void 0, {
4525
4512
  F: __dxlog_file15,
4526
- L: 277
4513
+ L: 274
4527
4514
  });
4528
4515
  if (this._edgeFeedReplicator) {
4529
4516
  this.inner.protocol.feedAdded.remove(this._onFeedAdded);
@@ -4556,7 +4543,7 @@ var DataSpace = class {
4556
4543
  if (err instanceof import_protocols3.CancelledError || err instanceof import_context4.ContextDisposedError) {
4557
4544
  (0, import_log4.log)("data pipeline initialization cancelled", err, {
4558
4545
  F: __dxlog_file15,
4559
- L: 315,
4546
+ L: 312,
4560
4547
  S: this,
4561
4548
  C: (f, a) => f(...a)
4562
4549
  });
@@ -4564,16 +4551,16 @@ var DataSpace = class {
4564
4551
  }
4565
4552
  import_log4.log.error("Error initializing data pipeline", err, {
4566
4553
  F: __dxlog_file15,
4567
- L: 319,
4554
+ L: 316,
4568
4555
  S: this,
4569
4556
  C: (f, a) => f(...a)
4570
4557
  });
4571
- this._state = import_services5.SpaceState.SPACE_ERROR;
4558
+ this._state = import_services4.SpaceState.SPACE_ERROR;
4572
4559
  (0, import_log4.log)("new state", {
4573
- state: import_services5.SpaceState[this._state]
4560
+ state: import_services4.SpaceState[this._state]
4574
4561
  }, {
4575
4562
  F: __dxlog_file15,
4576
- L: 321,
4563
+ L: 318,
4577
4564
  S: this,
4578
4565
  C: (f, a) => f(...a)
4579
4566
  });
@@ -4585,44 +4572,44 @@ var DataSpace = class {
4585
4572
  });
4586
4573
  }
4587
4574
  async initializeDataPipeline() {
4588
- if (this._state !== import_services5.SpaceState.SPACE_CONTROL_ONLY) {
4575
+ if (this._state !== import_services4.SpaceState.SPACE_CONTROL_ONLY) {
4589
4576
  throw new import_protocols3.SystemError("Invalid operation");
4590
4577
  }
4591
- this._state = import_services5.SpaceState.SPACE_INITIALIZING;
4578
+ this._state = import_services4.SpaceState.SPACE_INITIALIZING;
4592
4579
  (0, import_log4.log)("new state", {
4593
- state: import_services5.SpaceState[this._state]
4580
+ state: import_services4.SpaceState[this._state]
4594
4581
  }, {
4595
4582
  F: __dxlog_file15,
4596
- L: 337,
4583
+ L: 334,
4597
4584
  S: this,
4598
4585
  C: (f, a) => f(...a)
4599
4586
  });
4600
4587
  (0, import_log4.log)("initializing control pipeline", void 0, {
4601
4588
  F: __dxlog_file15,
4602
- L: 339,
4589
+ L: 336,
4603
4590
  S: this,
4604
4591
  C: (f, a) => f(...a)
4605
4592
  });
4606
4593
  await this._initializeAndReadControlPipeline();
4607
4594
  await (0, import_async7.sleep)(1);
4608
- const ready = this.stateUpdate.waitForCondition(() => this._state === import_services5.SpaceState.SPACE_READY);
4595
+ const ready = this.stateUpdate.waitForCondition(() => this._state === import_services4.SpaceState.SPACE_READY);
4609
4596
  (0, import_log4.log)("initializing automerge root", void 0, {
4610
4597
  F: __dxlog_file15,
4611
- L: 347,
4598
+ L: 344,
4612
4599
  S: this,
4613
4600
  C: (f, a) => f(...a)
4614
4601
  });
4615
4602
  this._automergeSpaceState.startProcessingRootDocs();
4616
4603
  (0, import_log4.log)("waiting for space to be ready", void 0, {
4617
4604
  F: __dxlog_file15,
4618
- L: 351,
4605
+ L: 348,
4619
4606
  S: this,
4620
4607
  C: (f, a) => f(...a)
4621
4608
  });
4622
4609
  await ready;
4623
4610
  (0, import_log4.log)("space is ready", void 0, {
4624
4611
  F: __dxlog_file15,
4625
- L: 353,
4612
+ L: 350,
4626
4613
  S: this,
4627
4614
  C: (f, a) => f(...a)
4628
4615
  });
@@ -4630,14 +4617,14 @@ var DataSpace = class {
4630
4617
  async *getAllDocuments() {
4631
4618
  (0, import_invariant3.invariant)(this._databaseRoot, "Space is not ready", {
4632
4619
  F: __dxlog_file15,
4633
- L: 357,
4620
+ L: 354,
4634
4621
  S: this,
4635
4622
  A: [
4636
4623
  "this._databaseRoot",
4637
4624
  "'Space is not ready'"
4638
4625
  ]
4639
4626
  });
4640
- const doc = this._databaseRoot.doc() ?? (0, import_invariant3.failedInvariant)();
4627
+ const doc = this._databaseRoot.docSync() ?? (0, import_invariant3.failedInvariant)();
4641
4628
  const root = (0, import_automerge.save)(doc);
4642
4629
  yield [
4643
4630
  this._databaseRoot.documentId,
@@ -4646,7 +4633,7 @@ var DataSpace = class {
4646
4633
  for (const documentUrl of this._databaseRoot.getAllLinkedDocuments()) {
4647
4634
  const data = await this._echoHost.exportDoc(import_context4.Context.default(void 0, {
4648
4635
  F: __dxlog_file15,
4649
- L: 363
4636
+ L: 360
4650
4637
  }), documentUrl);
4651
4638
  yield [
4652
4639
  documentUrl.replace(/^automerge:/, ""),
@@ -4656,12 +4643,12 @@ var DataSpace = class {
4656
4643
  }
4657
4644
  async _enterReadyState() {
4658
4645
  await this._callbacks.beforeReady?.();
4659
- this._state = import_services5.SpaceState.SPACE_READY;
4646
+ this._state = import_services4.SpaceState.SPACE_READY;
4660
4647
  (0, import_log4.log)("new state", {
4661
- state: import_services5.SpaceState[this._state]
4648
+ state: import_services4.SpaceState[this._state]
4662
4649
  }, {
4663
4650
  F: __dxlog_file15,
4664
- L: 372,
4651
+ L: 369,
4665
4652
  S: this,
4666
4653
  C: (f, a) => f(...a)
4667
4654
  });
@@ -4678,7 +4665,7 @@ var DataSpace = class {
4678
4665
  await this._createWritableFeeds();
4679
4666
  (0, import_log4.log)("writable feeds created", void 0, {
4680
4667
  F: __dxlog_file15,
4681
- L: 389,
4668
+ L: 386,
4682
4669
  S: this,
4683
4670
  C: (f, a) => f(...a)
4684
4671
  });
@@ -4732,7 +4719,7 @@ var DataSpace = class {
4732
4719
  count: credentials.length
4733
4720
  }, {
4734
4721
  F: __dxlog_file15,
4735
- L: 447,
4722
+ L: 444,
4736
4723
  S: this,
4737
4724
  C: (f, a) => f(...a)
4738
4725
  });
@@ -4743,14 +4730,14 @@ var DataSpace = class {
4743
4730
  });
4744
4731
  (0, import_log4.log)("credentials notarized", void 0, {
4745
4732
  F: __dxlog_file15,
4746
- L: 451,
4733
+ L: 448,
4747
4734
  S: this,
4748
4735
  C: (f, a) => f(...a)
4749
4736
  });
4750
4737
  } catch (err) {
4751
4738
  import_log4.log.error("error notarizing credentials for feed admission", err, {
4752
4739
  F: __dxlog_file15,
4753
- L: 453,
4740
+ L: 450,
4754
4741
  S: this,
4755
4742
  C: (f, a) => f(...a)
4756
4743
  });
@@ -4765,17 +4752,16 @@ var DataSpace = class {
4765
4752
  rootUrl
4766
4753
  }, {
4767
4754
  F: __dxlog_file15,
4768
- L: 463,
4755
+ L: 460,
4769
4756
  S: this,
4770
4757
  C: (f, a) => f(...a)
4771
4758
  });
4772
- let handle;
4759
+ const handle = this._echoHost.automergeRepo.find(rootUrl);
4773
4760
  queueMicrotask(async () => {
4774
4761
  try {
4775
4762
  try {
4776
4763
  var _usingCtx = _using_ctx3();
4777
4764
  await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
4778
- handle = await (0, import_context4.cancelWithContext)(this._ctx, this._echoHost.automergeRepo.find(rootUrl, import_echo_pipeline.FIND_PARAMS));
4779
4765
  await (0, import_context4.cancelWithContext)(this._ctx, handle.whenReady());
4780
4766
  });
4781
4767
  if (this._ctx.disposed) {
@@ -4785,7 +4771,7 @@ var DataSpace = class {
4785
4771
  // Ensure only one root is processed at a time.
4786
4772
  _usingCtx.u(await this._epochProcessingMutex.acquire())
4787
4773
  );
4788
- const doc = handle.doc() ?? (0, import_invariant3.failedInvariant)();
4774
+ const doc = handle.docSync() ?? (0, import_invariant3.failedInvariant)();
4789
4775
  if (!doc.access?.spaceKey) {
4790
4776
  handle.change((doc2) => {
4791
4777
  doc2.access = {
@@ -4796,9 +4782,9 @@ var DataSpace = class {
4796
4782
  const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
4797
4783
  this._databaseRoot = root;
4798
4784
  if (root.getVersion() !== import_echo_protocol.SpaceDocVersion.CURRENT) {
4799
- this._state = import_services5.SpaceState.SPACE_REQUIRES_MIGRATION;
4785
+ this._state = import_services4.SpaceState.SPACE_REQUIRES_MIGRATION;
4800
4786
  this.stateUpdate.emit();
4801
- } else if (this._state !== import_services5.SpaceState.SPACE_READY) {
4787
+ } else if (this._state !== import_services4.SpaceState.SPACE_READY) {
4802
4788
  await this._enterReadyState();
4803
4789
  } else {
4804
4790
  this.stateUpdate.emit();
@@ -4818,7 +4804,7 @@ var DataSpace = class {
4818
4804
  err
4819
4805
  }, {
4820
4806
  F: __dxlog_file15,
4821
- L: 510,
4807
+ L: 503,
4822
4808
  S: this,
4823
4809
  C: (f, a) => f(...a)
4824
4810
  });
@@ -4886,29 +4872,29 @@ var DataSpace = class {
4886
4872
  }
4887
4873
  async activate() {
4888
4874
  if (![
4889
- import_services5.SpaceState.SPACE_CLOSED,
4890
- import_services5.SpaceState.SPACE_INACTIVE
4875
+ import_services4.SpaceState.SPACE_CLOSED,
4876
+ import_services4.SpaceState.SPACE_INACTIVE
4891
4877
  ].includes(this._state)) {
4892
4878
  return;
4893
4879
  }
4894
- await this._metadataStore.setSpaceState(this.key, import_services5.SpaceState.SPACE_ACTIVE);
4880
+ await this._metadataStore.setSpaceState(this.key, import_services4.SpaceState.SPACE_ACTIVE);
4895
4881
  await this._open();
4896
4882
  this.initializeDataPipelineAsync();
4897
4883
  }
4898
4884
  async deactivate() {
4899
- if (this._state === import_services5.SpaceState.SPACE_INACTIVE) {
4885
+ if (this._state === import_services4.SpaceState.SPACE_INACTIVE) {
4900
4886
  return;
4901
4887
  }
4902
- await this._metadataStore.setSpaceState(this.key, import_services5.SpaceState.SPACE_INACTIVE);
4903
- if (this._state !== import_services5.SpaceState.SPACE_CLOSED) {
4888
+ await this._metadataStore.setSpaceState(this.key, import_services4.SpaceState.SPACE_INACTIVE);
4889
+ if (this._state !== import_services4.SpaceState.SPACE_CLOSED) {
4904
4890
  await this._close();
4905
4891
  }
4906
- this._state = import_services5.SpaceState.SPACE_INACTIVE;
4892
+ this._state = import_services4.SpaceState.SPACE_INACTIVE;
4907
4893
  (0, import_log4.log)("new state", {
4908
- state: import_services5.SpaceState[this._state]
4894
+ state: import_services4.SpaceState[this._state]
4909
4895
  }, {
4910
4896
  F: __dxlog_file15,
4911
- L: 592,
4897
+ L: 585,
4912
4898
  S: this,
4913
4899
  C: (f, a) => f(...a)
4914
4900
  });
@@ -4929,7 +4915,7 @@ _ts_decorate6([
4929
4915
  ], DataSpace.prototype, "key", null);
4930
4916
  _ts_decorate6([
4931
4917
  import_tracing3.trace.info({
4932
- enum: import_services5.SpaceState
4918
+ enum: import_services4.SpaceState
4933
4919
  })
4934
4920
  ], DataSpace.prototype, "state", null);
4935
4921
  _ts_decorate6([
@@ -4983,7 +4969,7 @@ var DeviceInvitationProtocol = class {
4983
4969
  }
4984
4970
  getInvitationContext() {
4985
4971
  return {
4986
- kind: import_services11.Invitation.Kind.DEVICE
4972
+ kind: import_services10.Invitation.Kind.DEVICE
4987
4973
  };
4988
4974
  }
4989
4975
  async delegate() {
@@ -5086,7 +5072,7 @@ var DeviceInvitationProtocol = class {
5086
5072
  }
5087
5073
  };
5088
5074
  var stateToString = (state) => {
5089
- return Object.entries(import_services14.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
5075
+ return Object.entries(import_services13.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
5090
5076
  };
5091
5077
  var computeExpirationTime = (invitation) => {
5092
5078
  if (!invitation.lifetime) {
@@ -5129,7 +5115,7 @@ var EdgeInvitationHandler = class {
5129
5115
  }
5130
5116
  const invitation = guardedState.current;
5131
5117
  const spaceId = invitation.spaceId;
5132
- const canBeHandledByEdge = invitation.authMethod !== import_services13.Invitation.AuthMethod.SHARED_SECRET && invitation.type === import_services13.Invitation.Type.DELEGATED && invitation.kind === import_services13.Invitation.Kind.SPACE && spaceId != null && import_keys12.SpaceId.isValid(spaceId);
5118
+ 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);
5133
5119
  if (!canBeHandledByEdge) {
5134
5120
  (0, import_log14.log)("invitation could not be handled by edge", {
5135
5121
  invitation
@@ -5198,7 +5184,7 @@ var EdgeInvitationHandler = class {
5198
5184
  S: this,
5199
5185
  C: (f, a) => f(...a)
5200
5186
  });
5201
- guardedState.set(this, import_services13.Invitation.State.CONNECTING);
5187
+ guardedState.set(this, import_services12.Invitation.State.CONNECTING);
5202
5188
  const response = await this._joinSpaceByInvitation(guardedState, spaceId, {
5203
5189
  identityKey: admissionRequest.identityKey.toHex(),
5204
5190
  invitationId: guardedState.current.invitationId
@@ -5208,7 +5194,7 @@ var EdgeInvitationHandler = class {
5208
5194
  space: admissionRequest
5209
5195
  });
5210
5196
  } catch (error) {
5211
- guardedState.set(this, import_services13.Invitation.State.ERROR);
5197
+ guardedState.set(this, import_services12.Invitation.State.ERROR);
5212
5198
  throw error;
5213
5199
  } finally {
5214
5200
  this._flowLock?.release();
@@ -5443,7 +5429,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5443
5429
  C: (f, a) => f(...a)
5444
5430
  });
5445
5431
  const invitation = this._requireActiveInvitation();
5446
- this._assertInvitationState(import_services15.Invitation.State.CONNECTED);
5432
+ this._assertInvitationState(import_services14.Invitation.State.CONNECTED);
5447
5433
  if (invitationId !== invitation?.invitationId) {
5448
5434
  import_log16.log.warn("incorrect invitationId", {
5449
5435
  expected: invitation.invitationId,
@@ -5457,7 +5443,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5457
5443
  this._callbacks.onError(new Error("Incorrect invitationId."));
5458
5444
  (0, import_async18.scheduleTask)(this._ctx, () => this.close());
5459
5445
  return {
5460
- authMethod: import_services15.Invitation.AuthMethod.NONE
5446
+ authMethod: import_services14.Invitation.AuthMethod.NONE
5461
5447
  };
5462
5448
  }
5463
5449
  import_log16.log.verbose("guest introduced themselves", {
@@ -5469,8 +5455,8 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5469
5455
  C: (f, a) => f(...a)
5470
5456
  });
5471
5457
  this.guestProfile = profile;
5472
- this._callbacks.onStateUpdate(import_services15.Invitation.State.READY_FOR_AUTHENTICATION);
5473
- this._challenge = invitation.authMethod === import_services15.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto3.randomBytes)(32) : void 0;
5458
+ this._callbacks.onStateUpdate(import_services14.Invitation.State.READY_FOR_AUTHENTICATION);
5459
+ this._challenge = invitation.authMethod === import_services14.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto3.randomBytes)(32) : void 0;
5474
5460
  import_log16.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols14.trace.end({
5475
5461
  id: traceId
5476
5462
  }), {
@@ -5505,12 +5491,12 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5505
5491
  });
5506
5492
  let status = import_invitations4.AuthenticationResponse.Status.OK;
5507
5493
  this._assertInvitationState([
5508
- import_services15.Invitation.State.AUTHENTICATING,
5509
- import_services15.Invitation.State.READY_FOR_AUTHENTICATION
5494
+ import_services14.Invitation.State.AUTHENTICATING,
5495
+ import_services14.Invitation.State.READY_FOR_AUTHENTICATION
5510
5496
  ]);
5511
- this._callbacks.onStateUpdate(import_services15.Invitation.State.AUTHENTICATING);
5497
+ this._callbacks.onStateUpdate(import_services14.Invitation.State.AUTHENTICATING);
5512
5498
  switch (invitation.authMethod) {
5513
- case import_services15.Invitation.AuthMethod.NONE: {
5499
+ case import_services14.Invitation.AuthMethod.NONE: {
5514
5500
  (0, import_log16.log)("authentication not required", void 0, {
5515
5501
  F: __dxlog_file19,
5516
5502
  L: 154,
@@ -5521,7 +5507,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5521
5507
  status: import_invitations4.AuthenticationResponse.Status.OK
5522
5508
  };
5523
5509
  }
5524
- case import_services15.Invitation.AuthMethod.SHARED_SECRET: {
5510
+ case import_services14.Invitation.AuthMethod.SHARED_SECRET: {
5525
5511
  if (invitation.authCode) {
5526
5512
  if (this.authenticationRetry++ > MAX_OTP_ATTEMPTS) {
5527
5513
  status = import_invitations4.AuthenticationResponse.Status.INVALID_OPT_ATTEMPTS;
@@ -5533,7 +5519,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5533
5519
  }
5534
5520
  break;
5535
5521
  }
5536
- case import_services15.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
5522
+ case import_services14.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
5537
5523
  if (!invitation.guestKeypair) {
5538
5524
  status = import_invitations4.AuthenticationResponse.Status.INTERNAL_ERROR;
5539
5525
  break;
@@ -5597,7 +5583,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5597
5583
  const invitation = this._requireActiveInvitation();
5598
5584
  try {
5599
5585
  if (isAuthenticationRequired(invitation)) {
5600
- this._assertInvitationState(import_services15.Invitation.State.AUTHENTICATING);
5586
+ this._assertInvitationState(import_services14.Invitation.State.AUTHENTICATING);
5601
5587
  if (!this.authenticationPassed) {
5602
5588
  throw new Error("Not authenticated");
5603
5589
  }
@@ -5636,7 +5622,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5636
5622
  S: this,
5637
5623
  C: (f, a) => f(...a)
5638
5624
  });
5639
- this._callbacks.onStateUpdate(import_services15.Invitation.State.CONNECTING);
5625
+ this._callbacks.onStateUpdate(import_services14.Invitation.State.CONNECTING);
5640
5626
  await this.rpc.InvitationHostService.options({
5641
5627
  role: import_invitations4.InvitationOptions.Role.HOST
5642
5628
  });
@@ -5662,7 +5648,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5662
5648
  remotePeerId: context.remotePeerId
5663
5649
  });
5664
5650
  }
5665
- this._callbacks.onStateUpdate(import_services15.Invitation.State.CONNECTED);
5651
+ this._callbacks.onStateUpdate(import_services14.Invitation.State.CONNECTED);
5666
5652
  this._callbacks.onOpen(this._ctx, context);
5667
5653
  } catch (err) {
5668
5654
  if (this._invitationFlowLock != null) {
@@ -5711,7 +5697,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5711
5697
  }
5712
5698
  }
5713
5699
  };
5714
- var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services15.Invitation.AuthMethod.NONE;
5700
+ var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services14.Invitation.AuthMethod.NONE;
5715
5701
  var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-state.ts";
5716
5702
  var createGuardedInvitationState = (ctx, invitation, stream) => {
5717
5703
  const mutex = new import_async19.Mutex();
@@ -5755,10 +5741,10 @@ var createGuardedInvitationState = (ctx, invitation, stream) => {
5755
5741
  },
5756
5742
  error: (lockHolder, error) => {
5757
5743
  if (isStateChangeAllowed(lockHolder)) {
5758
- logStateUpdate(currentInvitation, lockHolder, import_services16.Invitation.State.ERROR, error);
5744
+ logStateUpdate(currentInvitation, lockHolder, import_services15.Invitation.State.ERROR, error);
5759
5745
  currentInvitation = {
5760
5746
  ...currentInvitation,
5761
- state: import_services16.Invitation.State.ERROR
5747
+ state: import_services15.Invitation.State.ERROR
5762
5748
  };
5763
5749
  stream.next(currentInvitation);
5764
5750
  stream.error(error);
@@ -5796,11 +5782,11 @@ var logStateUpdate = (invitation, actor, newState, error) => {
5796
5782
  };
5797
5783
  var isNonTerminalState = (currentState) => {
5798
5784
  return ![
5799
- import_services16.Invitation.State.SUCCESS,
5800
- import_services16.Invitation.State.ERROR,
5801
- import_services16.Invitation.State.CANCELLED,
5802
- import_services16.Invitation.State.TIMEOUT,
5803
- import_services16.Invitation.State.EXPIRED
5785
+ import_services15.Invitation.State.SUCCESS,
5786
+ import_services15.Invitation.State.ERROR,
5787
+ import_services15.Invitation.State.CANCELLED,
5788
+ import_services15.Invitation.State.TIMEOUT,
5789
+ import_services15.Invitation.State.EXPIRED
5804
5790
  ].includes(currentState);
5805
5791
  };
5806
5792
  var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
@@ -5906,7 +5892,7 @@ var InvitationsHandler = class {
5906
5892
  return ctx.disposed ? null : guardedState.current;
5907
5893
  },
5908
5894
  onStateUpdate: (newState) => {
5909
- if (newState !== import_services12.Invitation.State.ERROR && newState !== import_services12.Invitation.State.TIMEOUT) {
5895
+ if (newState !== import_services11.Invitation.State.ERROR && newState !== import_services11.Invitation.State.TIMEOUT) {
5910
5896
  guardedState.set(extension, newState);
5911
5897
  }
5912
5898
  return guardedState.current;
@@ -5944,7 +5930,7 @@ var InvitationsHandler = class {
5944
5930
  let admitted = false;
5945
5931
  connectionCtx.onDispose(() => {
5946
5932
  if (!admitted) {
5947
- guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
5933
+ guardedState.set(extension, import_services11.Invitation.State.CONNECTING);
5948
5934
  }
5949
5935
  });
5950
5936
  (0, import_async15.scheduleTask)(connectionCtx, async () => {
@@ -5978,7 +5964,7 @@ var InvitationsHandler = class {
5978
5964
  S: this,
5979
5965
  C: (f, a) => f(...a)
5980
5966
  });
5981
- guardedState.set(extension, import_services12.Invitation.State.SUCCESS);
5967
+ guardedState.set(extension, import_services11.Invitation.State.SUCCESS);
5982
5968
  metrics.increment("dxos.invitation.success");
5983
5969
  import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols11.trace.end({
5984
5970
  id: traceId
@@ -5993,7 +5979,7 @@ var InvitationsHandler = class {
5993
5979
  await ctx.dispose();
5994
5980
  }
5995
5981
  } catch (err) {
5996
- const stateChanged = guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
5982
+ const stateChanged = guardedState.set(extension, import_services11.Invitation.State.CONNECTING);
5997
5983
  if (err instanceof import_async15.TimeoutError) {
5998
5984
  if (stateChanged) {
5999
5985
  metrics.increment("dxos.invitation.timeout");
@@ -6031,7 +6017,7 @@ var InvitationsHandler = class {
6031
6017
  });
6032
6018
  },
6033
6019
  onError: (err) => {
6034
- const stateChanged = guardedState.set(extension, import_services12.Invitation.State.CONNECTING);
6020
+ const stateChanged = guardedState.set(extension, import_services11.Invitation.State.CONNECTING);
6035
6021
  if (err instanceof import_protocols11.InvalidInvitationExtensionRoleError) {
6036
6022
  (0, import_log13.log)("invalid role", {
6037
6023
  ...err.context
@@ -6079,7 +6065,7 @@ var InvitationsHandler = class {
6079
6065
  S: this,
6080
6066
  C: (f, a) => f(...a)
6081
6067
  });
6082
- guardedState.set(null, import_services12.Invitation.State.EXPIRED);
6068
+ guardedState.set(null, import_services11.Invitation.State.EXPIRED);
6083
6069
  void ctx.dispose().catch((err) => import_log13.log.catch(err, void 0, {
6084
6070
  F: __dxlog_file22,
6085
6071
  L: 196,
@@ -6090,7 +6076,7 @@ var InvitationsHandler = class {
6090
6076
  }
6091
6077
  (0, import_async15.scheduleTask)(ctx, async () => {
6092
6078
  await swarmConnection.close();
6093
- guardedState.set(null, import_services12.Invitation.State.EXPIRED);
6079
+ guardedState.set(null, import_services11.Invitation.State.EXPIRED);
6094
6080
  metrics.increment("dxos.invitation.expired");
6095
6081
  await ctx.dispose();
6096
6082
  }, expiresOn.getTime() - Date.now());
@@ -6098,7 +6084,7 @@ var InvitationsHandler = class {
6098
6084
  let swarmConnection;
6099
6085
  (0, import_async15.scheduleTask)(ctx, async () => {
6100
6086
  swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.InvitationOptions.Role.HOST, createExtension);
6101
- guardedState.set(null, import_services12.Invitation.State.CONNECTING);
6087
+ guardedState.set(null, import_services11.Invitation.State.CONNECTING);
6102
6088
  });
6103
6089
  }
6104
6090
  acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
@@ -6115,7 +6101,7 @@ var InvitationsHandler = class {
6115
6101
  });
6116
6102
  const { timeout = import_client_protocol5.INVITATION_TIMEOUT } = invitation;
6117
6103
  if (deviceProfile) {
6118
- (0, import_invariant14.invariant)(invitation.kind === import_services12.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
6104
+ (0, import_invariant14.invariant)(invitation.kind === import_services11.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
6119
6105
  F: __dxlog_file22,
6120
6106
  L: 236,
6121
6107
  S: this,
@@ -6131,7 +6117,7 @@ var InvitationsHandler = class {
6131
6117
  const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
6132
6118
  (0, import_log13.log)("should cancel invitation flow", {
6133
6119
  isLockedByAnotherConnection,
6134
- invitationType: import_services12.Invitation.Type.DELEGATED,
6120
+ invitationType: import_services11.Invitation.Type.DELEGATED,
6135
6121
  triedPeers: triedPeersIds.size
6136
6122
  }, {
6137
6123
  F: __dxlog_file22,
@@ -6142,7 +6128,7 @@ var InvitationsHandler = class {
6142
6128
  if (isLockedByAnotherConnection) {
6143
6129
  return false;
6144
6130
  }
6145
- return invitation.type !== import_services12.Invitation.Type.DELEGATED || triedPeersIds.size >= MAX_DELEGATED_INVITATION_HOST_TRIES;
6131
+ return invitation.type !== import_services11.Invitation.Type.DELEGATED || triedPeersIds.size >= MAX_DELEGATED_INVITATION_HOST_TRIES;
6146
6132
  };
6147
6133
  let admitted = false;
6148
6134
  const createExtension = () => {
@@ -6185,7 +6171,7 @@ var InvitationsHandler = class {
6185
6171
  C: (f, a) => f(...a)
6186
6172
  });
6187
6173
  (0, import_async15.scheduleTask)(connectionCtx, () => {
6188
- guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
6174
+ guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
6189
6175
  extensionCtx.close();
6190
6176
  }, timeout);
6191
6177
  import_log13.log.verbose("dxos.sdk.invitations-handler.guest.connected", {
@@ -6196,7 +6182,7 @@ var InvitationsHandler = class {
6196
6182
  S: this,
6197
6183
  C: (f, a) => f(...a)
6198
6184
  });
6199
- guardedState.set(extension, import_services12.Invitation.State.CONNECTED);
6185
+ guardedState.set(extension, import_services11.Invitation.State.CONNECTED);
6200
6186
  import_log13.log.verbose("dxos.sdk.invitations-handler.guest.introduce", {
6201
6187
  invitationId: invitation.invitationId,
6202
6188
  ...protocol.toJSON()
@@ -6223,12 +6209,12 @@ var InvitationsHandler = class {
6223
6209
  invitation.authMethod = introductionResponse.authMethod;
6224
6210
  if (isAuthenticationRequired(invitation)) {
6225
6211
  switch (invitation.authMethod) {
6226
- case import_services12.Invitation.AuthMethod.SHARED_SECRET:
6212
+ case import_services11.Invitation.AuthMethod.SHARED_SECRET:
6227
6213
  await this._handleGuestOtpAuth(extension, (state) => guardedState.set(extension, state), otpEnteredTrigger, {
6228
6214
  timeout
6229
6215
  });
6230
6216
  break;
6231
- case import_services12.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
6217
+ case import_services11.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
6232
6218
  await this._handleGuestKpkAuth(extension, (state) => guardedState.set(extension, state), invitation, introductionResponse);
6233
6219
  break;
6234
6220
  }
@@ -6258,7 +6244,7 @@ var InvitationsHandler = class {
6258
6244
  guardedState.complete({
6259
6245
  ...guardedState.current,
6260
6246
  ...result,
6261
- state: import_services12.Invitation.State.SUCCESS
6247
+ state: import_services11.Invitation.State.SUCCESS
6262
6248
  });
6263
6249
  import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols11.trace.end({
6264
6250
  id: traceId
@@ -6278,7 +6264,7 @@ var InvitationsHandler = class {
6278
6264
  S: this,
6279
6265
  C: (f, a) => f(...a)
6280
6266
  });
6281
- guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
6267
+ guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
6282
6268
  } else {
6283
6269
  import_log13.log.verbose("auth failed", err, {
6284
6270
  F: __dxlog_file22,
@@ -6314,7 +6300,7 @@ var InvitationsHandler = class {
6314
6300
  S: this,
6315
6301
  C: (f, a) => f(...a)
6316
6302
  });
6317
- guardedState.set(extension, import_services12.Invitation.State.TIMEOUT);
6303
+ guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
6318
6304
  } else {
6319
6305
  import_log13.log.verbose("auth failed", err, {
6320
6306
  F: __dxlog_file22,
@@ -6342,7 +6328,7 @@ var InvitationsHandler = class {
6342
6328
  guardedState.complete({
6343
6329
  ...guardedState.current,
6344
6330
  ...result,
6345
- state: import_services12.Invitation.State.SUCCESS
6331
+ state: import_services11.Invitation.State.SUCCESS
6346
6332
  });
6347
6333
  }
6348
6334
  });
@@ -6366,12 +6352,12 @@ var InvitationsHandler = class {
6366
6352
  if (guardedState.mutex.isLocked()) {
6367
6353
  (0, import_async15.scheduleTask)(ctx, timeoutInactive, timeout);
6368
6354
  } else {
6369
- guardedState.set(null, import_services12.Invitation.State.TIMEOUT);
6355
+ guardedState.set(null, import_services11.Invitation.State.TIMEOUT);
6370
6356
  }
6371
6357
  };
6372
6358
  (0, import_async15.scheduleTask)(ctx, timeoutInactive, timeout);
6373
6359
  await this._joinSwarm(ctx, invitation, import_invitations2.InvitationOptions.Role.GUEST, createExtension);
6374
- guardedState.set(null, import_services12.Invitation.State.CONNECTING);
6360
+ guardedState.set(null, import_services11.Invitation.State.CONNECTING);
6375
6361
  }
6376
6362
  });
6377
6363
  }
@@ -6379,7 +6365,7 @@ var InvitationsHandler = class {
6379
6365
  let label;
6380
6366
  if (role === import_invitations2.InvitationOptions.Role.GUEST) {
6381
6367
  label = "invitation guest";
6382
- } else if (invitation.kind === import_services12.Invitation.Kind.DEVICE) {
6368
+ } else if (invitation.kind === import_services11.Invitation.Kind.DEVICE) {
6383
6369
  label = "invitation host for device";
6384
6370
  } else {
6385
6371
  label = `invitation host for space ${invitation.spaceKey?.truncate()}`;
@@ -6403,7 +6389,7 @@ var InvitationsHandler = class {
6403
6389
  S: this,
6404
6390
  C: (f, a) => f(...a)
6405
6391
  });
6406
- setState(import_services12.Invitation.State.READY_FOR_AUTHENTICATION);
6392
+ setState(import_services11.Invitation.State.READY_FOR_AUTHENTICATION);
6407
6393
  const authCode = await authenticated.wait(options);
6408
6394
  (0, import_log13.log)("sending authentication request", void 0, {
6409
6395
  F: __dxlog_file22,
@@ -6411,7 +6397,7 @@ var InvitationsHandler = class {
6411
6397
  S: this,
6412
6398
  C: (f, a) => f(...a)
6413
6399
  });
6414
- setState(import_services12.Invitation.State.AUTHENTICATING);
6400
+ setState(import_services11.Invitation.State.AUTHENTICATING);
6415
6401
  const response = await extension.rpc.InvitationHostService.authenticate({
6416
6402
  authCode
6417
6403
  });
@@ -6503,8 +6489,8 @@ var InvitationsServiceImpl = class {
6503
6489
  return new import_stream9.Stream(({ next, ctx }) => {
6504
6490
  this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
6505
6491
  next({
6506
- action: import_services17.QueryInvitationsResponse.Action.ADDED,
6507
- type: import_services17.QueryInvitationsResponse.Type.CREATED,
6492
+ action: import_services16.QueryInvitationsResponse.Action.ADDED,
6493
+ type: import_services16.QueryInvitationsResponse.Type.CREATED,
6508
6494
  invitations: [
6509
6495
  invitation
6510
6496
  ]
@@ -6512,8 +6498,8 @@ var InvitationsServiceImpl = class {
6512
6498
  });
6513
6499
  this._invitationsManager.invitationAccepted.on(ctx, (invitation) => {
6514
6500
  next({
6515
- action: import_services17.QueryInvitationsResponse.Action.ADDED,
6516
- type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
6501
+ action: import_services16.QueryInvitationsResponse.Action.ADDED,
6502
+ type: import_services16.QueryInvitationsResponse.Type.ACCEPTED,
6517
6503
  invitations: [
6518
6504
  invitation
6519
6505
  ]
@@ -6521,8 +6507,8 @@ var InvitationsServiceImpl = class {
6521
6507
  });
6522
6508
  this._invitationsManager.removedCreated.on(ctx, (invitation) => {
6523
6509
  next({
6524
- action: import_services17.QueryInvitationsResponse.Action.REMOVED,
6525
- type: import_services17.QueryInvitationsResponse.Type.CREATED,
6510
+ action: import_services16.QueryInvitationsResponse.Action.REMOVED,
6511
+ type: import_services16.QueryInvitationsResponse.Type.CREATED,
6526
6512
  invitations: [
6527
6513
  invitation
6528
6514
  ]
@@ -6530,8 +6516,8 @@ var InvitationsServiceImpl = class {
6530
6516
  });
6531
6517
  this._invitationsManager.removedAccepted.on(ctx, (invitation) => {
6532
6518
  next({
6533
- action: import_services17.QueryInvitationsResponse.Action.REMOVED,
6534
- type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
6519
+ action: import_services16.QueryInvitationsResponse.Action.REMOVED,
6520
+ type: import_services16.QueryInvitationsResponse.Type.ACCEPTED,
6535
6521
  invitations: [
6536
6522
  invitation
6537
6523
  ]
@@ -6539,29 +6525,29 @@ var InvitationsServiceImpl = class {
6539
6525
  });
6540
6526
  this._invitationsManager.saved.on(ctx, (invitation) => {
6541
6527
  next({
6542
- action: import_services17.QueryInvitationsResponse.Action.SAVED,
6543
- type: import_services17.QueryInvitationsResponse.Type.CREATED,
6528
+ action: import_services16.QueryInvitationsResponse.Action.SAVED,
6529
+ type: import_services16.QueryInvitationsResponse.Type.CREATED,
6544
6530
  invitations: [
6545
6531
  invitation
6546
6532
  ]
6547
6533
  });
6548
6534
  });
6549
6535
  next({
6550
- action: import_services17.QueryInvitationsResponse.Action.ADDED,
6551
- type: import_services17.QueryInvitationsResponse.Type.CREATED,
6536
+ action: import_services16.QueryInvitationsResponse.Action.ADDED,
6537
+ type: import_services16.QueryInvitationsResponse.Type.CREATED,
6552
6538
  invitations: this._invitationsManager.getCreatedInvitations(),
6553
6539
  existing: true
6554
6540
  });
6555
6541
  next({
6556
- action: import_services17.QueryInvitationsResponse.Action.ADDED,
6557
- type: import_services17.QueryInvitationsResponse.Type.ACCEPTED,
6542
+ action: import_services16.QueryInvitationsResponse.Action.ADDED,
6543
+ type: import_services16.QueryInvitationsResponse.Type.ACCEPTED,
6558
6544
  invitations: this._invitationsManager.getAcceptedInvitations(),
6559
6545
  existing: true
6560
6546
  });
6561
6547
  this._invitationsManager.onPersistentInvitationsLoaded(ctx, () => {
6562
6548
  next({
6563
- action: import_services17.QueryInvitationsResponse.Action.LOAD_COMPLETE,
6564
- type: import_services17.QueryInvitationsResponse.Type.CREATED
6549
+ action: import_services16.QueryInvitationsResponse.Action.LOAD_COMPLETE,
6550
+ type: import_services16.QueryInvitationsResponse.Type.CREATED
6565
6551
  });
6566
6552
  });
6567
6553
  });
@@ -6616,7 +6602,7 @@ var SpaceInvitationProtocol = class {
6616
6602
  ]
6617
6603
  });
6618
6604
  return {
6619
- kind: import_services18.Invitation.Kind.SPACE,
6605
+ kind: import_services17.Invitation.Kind.SPACE,
6620
6606
  spaceKey: this._spaceKey,
6621
6607
  spaceId: space.id
6622
6608
  };
@@ -6675,7 +6661,7 @@ var SpaceInvitationProtocol = class {
6675
6661
  ""
6676
6662
  ]
6677
6663
  });
6678
- if (invitation.authMethod === import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
6664
+ if (invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
6679
6665
  (0, import_invariant19.invariant)(invitation.guestKeypair?.publicKey, void 0, {
6680
6666
  F: __dxlog_file23,
6681
6667
  L: 105,
@@ -6702,7 +6688,7 @@ var SpaceInvitationProtocol = class {
6702
6688
  role: invitation.role ?? import_credentials19.SpaceMember.Role.ADMIN,
6703
6689
  expiresOn: computeExpirationTime(invitation),
6704
6690
  multiUse: invitation.multiUse ?? false,
6705
- guestKey: invitation.authMethod === import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
6691
+ guestKey: invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
6706
6692
  });
6707
6693
  (0, import_invariant19.invariant)(credential.credential, void 0, {
6708
6694
  F: __dxlog_file23,
@@ -6728,7 +6714,7 @@ var SpaceInvitationProtocol = class {
6728
6714
  ""
6729
6715
  ]
6730
6716
  });
6731
- (0, import_invariant19.invariant)(invitation.type === import_services18.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
6717
+ (0, import_invariant19.invariant)(invitation.type === import_services17.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
6732
6718
  F: __dxlog_file23,
6733
6719
  L: 133,
6734
6720
  S: this,
@@ -7008,7 +6994,7 @@ var InvitationsManager = class {
7008
6994
  if (created.get().persistent) {
7009
6995
  await this._metadataStore.removeInvitation(invitationId);
7010
6996
  }
7011
- if (created.get().type === import_services19.Invitation.Type.DELEGATED) {
6997
+ if (created.get().type === import_services18.Invitation.Type.DELEGATED) {
7012
6998
  const handler = this._getHandler(created.get());
7013
6999
  await handler.cancelDelegation(created.get());
7014
7000
  }
@@ -7042,8 +7028,8 @@ var InvitationsManager = class {
7042
7028
  }
7043
7029
  }
7044
7030
  _createInvitation(protocol, _options) {
7045
- const { invitationId = import_keys15.PublicKey.random().toHex(), type = import_services19.Invitation.Type.INTERACTIVE, authMethod = import_services19.Invitation.AuthMethod.SHARED_SECRET, state = import_services19.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys15.PublicKey.random(), persistent = _options?.authMethod !== import_services19.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 ?? {};
7046
- const authCode = options?.authCode ?? (authMethod === import_services19.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
7031
+ 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 ?? {};
7032
+ const authCode = options?.authCode ?? (authMethod === import_services18.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
7047
7033
  return {
7048
7034
  invitationId,
7049
7035
  type,
@@ -7052,8 +7038,8 @@ var InvitationsManager = class {
7052
7038
  swarmKey,
7053
7039
  authCode,
7054
7040
  timeout,
7055
- persistent: persistent && type !== import_services19.Invitation.Type.DELEGATED,
7056
- guestKeypair: guestKeypair ?? (authMethod === import_services19.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
7041
+ persistent: persistent && type !== import_services18.Invitation.Type.DELEGATED,
7042
+ guestKeypair: guestKeypair ?? (authMethod === import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
7057
7043
  created,
7058
7044
  lifetime,
7059
7045
  role,
@@ -7091,7 +7077,7 @@ var InvitationsManager = class {
7091
7077
  onCancel: async () => {
7092
7078
  stream.next({
7093
7079
  ...invitation,
7094
- state: import_services19.Invitation.State.CANCELLED
7080
+ state: import_services18.Invitation.State.CANCELLED
7095
7081
  });
7096
7082
  await ctx.dispose();
7097
7083
  }
@@ -7118,7 +7104,7 @@ var InvitationsManager = class {
7118
7104
  });
7119
7105
  stream.next({
7120
7106
  ...initialState,
7121
- state: import_services19.Invitation.State.TIMEOUT
7107
+ state: import_services18.Invitation.State.TIMEOUT
7122
7108
  });
7123
7109
  } else {
7124
7110
  import_log20.log.warn("auth failed", err, {
@@ -7129,7 +7115,7 @@ var InvitationsManager = class {
7129
7115
  });
7130
7116
  stream.next({
7131
7117
  ...initialState,
7132
- state: import_services19.Invitation.State.ERROR
7118
+ state: import_services18.Invitation.State.ERROR
7133
7119
  });
7134
7120
  }
7135
7121
  void ctx.dispose();
@@ -7155,7 +7141,7 @@ var InvitationsManager = class {
7155
7141
  onCancel: async () => {
7156
7142
  stream.next({
7157
7143
  ...initialState,
7158
- state: import_services19.Invitation.State.CANCELLED
7144
+ state: import_services18.Invitation.State.CANCELLED
7159
7145
  });
7160
7146
  await ctx.dispose();
7161
7147
  },
@@ -7171,7 +7157,7 @@ var InvitationsManager = class {
7171
7157
  };
7172
7158
  }
7173
7159
  async _persistIfRequired(handler, changeStream, invitation) {
7174
- if (invitation.type === import_services19.Invitation.Type.DELEGATED && invitation.delegationCredentialId == null) {
7160
+ if (invitation.type === import_services18.Invitation.Type.DELEGATED && invitation.delegationCredentialId == null) {
7175
7161
  const delegationCredentialId = await handler.delegate(invitation);
7176
7162
  changeStream.next({
7177
7163
  ...invitation,
@@ -7508,8 +7494,8 @@ var EdgeAgentManager = class extends import_context16.Resource {
7508
7494
  continue;
7509
7495
  }
7510
7496
  if ([
7511
- import_services20.SpaceState.SPACE_INACTIVE,
7512
- import_services20.SpaceState.SPACE_CLOSED
7497
+ import_services19.SpaceState.SPACE_INACTIVE,
7498
+ import_services19.SpaceState.SPACE_CLOSED
7513
7499
  ].includes(space.state)) {
7514
7500
  space.notarizationPlugin.setActiveEdgePollingEnabled(false);
7515
7501
  continue;
@@ -7558,16 +7544,22 @@ var EdgeAgentServiceImpl = class {
7558
7544
  this._agentManagerProvider = _agentManagerProvider;
7559
7545
  this._edgeConnection = _edgeConnection;
7560
7546
  }
7561
- // TODO(mykola): Reconcile with NetworkService.queryStatus.
7562
7547
  queryEdgeStatus() {
7563
7548
  return new import_stream10.Stream(({ ctx, next }) => {
7564
- const update = () => {
7565
- next({
7566
- status: this._edgeConnection?.status ?? import_services21.EdgeStatus.NOT_CONNECTED
7567
- });
7568
- };
7569
- this._edgeConnection?.statusChanged.on(ctx, update);
7570
- update();
7549
+ next({
7550
+ status: import_services20.QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
7551
+ });
7552
+ if (!this._edgeConnection) {
7553
+ return;
7554
+ }
7555
+ ctx.onDispose(
7556
+ // TODO(wittjosiah): EdgeConnection should include a disconnected event as well.
7557
+ this._edgeConnection.onReconnected(() => {
7558
+ next({
7559
+ status: import_services20.QueryEdgeStatusResponse.EdgeStatus.CONNECTED
7560
+ });
7561
+ })
7562
+ );
7571
7563
  });
7572
7564
  }
7573
7565
  async createAgent() {
@@ -7576,7 +7568,7 @@ var EdgeAgentServiceImpl = class {
7576
7568
  queryAgentStatus() {
7577
7569
  return new import_stream10.Stream(({ ctx, next }) => {
7578
7570
  next({
7579
- status: import_services21.QueryAgentStatusResponse.AgentStatus.UNKNOWN
7571
+ status: import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN
7580
7572
  });
7581
7573
  void this._agentManagerProvider().then((agentManager) => {
7582
7574
  next({
@@ -7594,13 +7586,13 @@ var EdgeAgentServiceImpl = class {
7594
7586
  var mapStatus = (agentStatus) => {
7595
7587
  switch (agentStatus) {
7596
7588
  case import_protocols17.EdgeAgentStatus.ACTIVE:
7597
- return import_services21.QueryAgentStatusResponse.AgentStatus.ACTIVE;
7589
+ return import_services20.QueryAgentStatusResponse.AgentStatus.ACTIVE;
7598
7590
  case import_protocols17.EdgeAgentStatus.INACTIVE:
7599
- return import_services21.QueryAgentStatusResponse.AgentStatus.INACTIVE;
7591
+ return import_services20.QueryAgentStatusResponse.AgentStatus.INACTIVE;
7600
7592
  case import_protocols17.EdgeAgentStatus.NOT_FOUND:
7601
- return import_services21.QueryAgentStatusResponse.AgentStatus.NOT_FOUND;
7593
+ return import_services20.QueryAgentStatusResponse.AgentStatus.NOT_FOUND;
7602
7594
  case void 0:
7603
- return import_services21.QueryAgentStatusResponse.AgentStatus.UNKNOWN;
7595
+ return import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN;
7604
7596
  }
7605
7597
  };
7606
7598
  var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-recovery-manager.ts";
@@ -7934,7 +7926,7 @@ var ServiceContext = class extends import_context17.Resource {
7934
7926
  this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
7935
7927
  this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
7936
7928
  this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
7937
- this._handlerFactories.set(import_services22.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug5.failUndefined)(), this._acceptIdentity.bind(this)));
7929
+ this._handlerFactories.set(import_services21.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug5.failUndefined)(), this._acceptIdentity.bind(this)));
7938
7930
  if (!this._runtimeParams?.disableP2pReplication) {
7939
7931
  this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
7940
7932
  }
@@ -8040,7 +8032,7 @@ var ServiceContext = class extends import_context17.Resource {
8040
8032
  return identity;
8041
8033
  }
8042
8034
  getInvitationHandler(invitation) {
8043
- if (this.identityManager.identity == null && invitation.kind === import_services22.Invitation.Kind.SPACE) {
8035
+ if (this.identityManager.identity == null && invitation.kind === import_services21.Invitation.Kind.SPACE) {
8044
8036
  throw new Error("Identity must be created before joining a space.");
8045
8037
  }
8046
8038
  const factory = this._handlerFactories.get(invitation.kind);
@@ -8122,7 +8114,7 @@ var ServiceContext = class extends import_context17.Resource {
8122
8114
  await this.dataSpaceManager.open();
8123
8115
  this.edgeAgentManager = new EdgeAgentManager(this._edgeFeatures, this._edgeHttpClient, this.dataSpaceManager, identity);
8124
8116
  await this.edgeAgentManager.open();
8125
- this._handlerFactories.set(import_services22.Invitation.Kind.SPACE, (invitation) => {
8117
+ this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
8126
8118
  (0, import_invariant23.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
8127
8119
  F: __dxlog_file28,
8128
8120
  L: 339,
@@ -8348,7 +8340,7 @@ var exportProfileData = async ({ storage, level }) => {
8348
8340
  count: files.length
8349
8341
  }, {
8350
8342
  F: __dxlog_file29,
8351
- L: 31,
8343
+ L: 30,
8352
8344
  S: void 0,
8353
8345
  C: (f, a) => f(...a)
8354
8346
  });
@@ -8366,7 +8358,7 @@ var exportProfileData = async ({ storage, level }) => {
8366
8358
  count: files.length
8367
8359
  }, {
8368
8360
  F: __dxlog_file29,
8369
- L: 42,
8361
+ L: 41,
8370
8362
  S: void 0,
8371
8363
  C: (f, a) => f(...a)
8372
8364
  });
@@ -8374,7 +8366,7 @@ var exportProfileData = async ({ storage, level }) => {
8374
8366
  {
8375
8367
  import_log25.log.info("begin exporting kv pairs", void 0, {
8376
8368
  F: __dxlog_file29,
8377
- L: 46,
8369
+ L: 45,
8378
8370
  S: void 0,
8379
8371
  C: (f, a) => f(...a)
8380
8372
  });
@@ -8395,7 +8387,7 @@ var exportProfileData = async ({ storage, level }) => {
8395
8387
  count
8396
8388
  }, {
8397
8389
  F: __dxlog_file29,
8398
- L: 57,
8390
+ L: 56,
8399
8391
  S: void 0,
8400
8392
  C: (f, a) => f(...a)
8401
8393
  });
@@ -8411,7 +8403,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8411
8403
  const directory = await storage.createDirectory();
8412
8404
  (0, import_invariant25.invariant)(typeof entry2.key === "string", "Invalid key type", {
8413
8405
  F: __dxlog_file29,
8414
- L: 80,
8406
+ L: 79,
8415
8407
  S: void 0,
8416
8408
  A: [
8417
8409
  "typeof entry.key === 'string'",
@@ -8421,7 +8413,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8421
8413
  const file = await directory.getOrCreateFile(entry2.key);
8422
8414
  (0, import_invariant25.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
8423
8415
  F: __dxlog_file29,
8424
- L: 82,
8416
+ L: 81,
8425
8417
  S: void 0,
8426
8418
  A: [
8427
8419
  "entry.value instanceof Uint8Array",
@@ -8435,7 +8427,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8435
8427
  case import_protocols21.ProfileArchiveEntryType.KEY_VALUE: {
8436
8428
  (0, import_invariant25.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
8437
8429
  F: __dxlog_file29,
8438
- L: 88,
8430
+ L: 87,
8439
8431
  S: void 0,
8440
8432
  A: [
8441
8433
  "entry.key instanceof Uint8Array",
@@ -8444,7 +8436,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8444
8436
  });
8445
8437
  (0, import_invariant25.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
8446
8438
  F: __dxlog_file29,
8447
- L: 89,
8439
+ L: 88,
8448
8440
  S: void 0,
8449
8441
  A: [
8450
8442
  "entry.value instanceof Uint8Array",
@@ -8469,7 +8461,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8469
8461
  progress: `${(count / archive.storage.length * 100).toFixed()}%`
8470
8462
  }, {
8471
8463
  F: __dxlog_file29,
8472
- L: 102,
8464
+ L: 101,
8473
8465
  S: void 0,
8474
8466
  C: (f, a) => f(...a)
8475
8467
  });
@@ -8477,7 +8469,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8477
8469
  }
8478
8470
  import_log25.log.info("committing changes..", void 0, {
8479
8471
  F: __dxlog_file29,
8480
- L: 110,
8472
+ L: 109,
8481
8473
  S: void 0,
8482
8474
  C: (f, a) => f(...a)
8483
8475
  });
@@ -8503,7 +8495,7 @@ var DevicesServiceImpl = class {
8503
8495
  } else {
8504
8496
  (0, import_invariant27.invariant)(this._identityManager.identity?.presence, "presence not present", {
8505
8497
  F: __dxlog_file30,
8506
- L: 37,
8498
+ L: 36,
8507
8499
  S: this,
8508
8500
  A: [
8509
8501
  "this._identityManager.identity?.presence",
@@ -8516,15 +8508,15 @@ var DevicesServiceImpl = class {
8516
8508
  const isMe = this._identityManager.identity?.deviceKey.equals(key);
8517
8509
  let presence;
8518
8510
  if (isMe) {
8519
- presence = import_services24.Device.PresenceState.ONLINE;
8511
+ presence = import_services23.Device.PresenceState.ONLINE;
8520
8512
  } else if (profile.os?.toUpperCase() === "EDGE") {
8521
- presence = this._edgeConnection?.status === import_services24.EdgeStatus.CONNECTED ? import_services24.Device.PresenceState.ONLINE : import_services24.Device.PresenceState.OFFLINE;
8513
+ presence = this._edgeConnection?.isConnected ? import_services23.Device.PresenceState.ONLINE : import_services23.Device.PresenceState.OFFLINE;
8522
8514
  } else {
8523
- presence = peers.some((peer) => peer.identityKey.equals(key)) ? import_services24.Device.PresenceState.ONLINE : import_services24.Device.PresenceState.OFFLINE;
8515
+ presence = peers.some((peer) => peer.identityKey.equals(key)) ? import_services23.Device.PresenceState.ONLINE : import_services23.Device.PresenceState.OFFLINE;
8524
8516
  }
8525
8517
  return {
8526
8518
  deviceKey: key,
8527
- kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services24.DeviceKind.CURRENT : import_services24.DeviceKind.TRUSTED,
8519
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services23.DeviceKind.CURRENT : import_services23.DeviceKind.TRUSTED,
8528
8520
  profile,
8529
8521
  presence
8530
8522
  };
@@ -8745,29 +8737,28 @@ var LoggingServiceImpl = class {
8745
8737
  };
8746
8738
  var matchFilter = (filter, level, path2, options) => {
8747
8739
  switch (options) {
8748
- case import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE:
8740
+ case import_services24.QueryLogsRequest.MatchingOptions.INCLUSIVE:
8749
8741
  return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
8750
- case import_services25.QueryLogsRequest.MatchingOptions.EXPLICIT:
8742
+ case import_services24.QueryLogsRequest.MatchingOptions.EXPLICIT:
8751
8743
  return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
8752
8744
  }
8753
8745
  };
8754
8746
  var shouldLog = (entry2, request) => {
8755
- const options = request.options ?? import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE;
8747
+ const options = request.options ?? import_services24.QueryLogsRequest.MatchingOptions.INCLUSIVE;
8756
8748
  if (request.filters === void 0) {
8757
- return options === import_services25.QueryLogsRequest.MatchingOptions.INCLUSIVE;
8749
+ return options === import_services24.QueryLogsRequest.MatchingOptions.INCLUSIVE;
8758
8750
  } else {
8759
8751
  return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
8760
8752
  }
8761
8753
  };
8762
8754
  var LOG_PROCESSING = 0;
8763
8755
  var NetworkServiceImpl = class {
8764
- constructor(networkManager, signalManager, edgeConnection) {
8756
+ constructor(networkManager, signalManager) {
8765
8757
  this.networkManager = networkManager;
8766
8758
  this.signalManager = signalManager;
8767
- this.edgeConnection = edgeConnection;
8768
8759
  }
8769
8760
  queryStatus() {
8770
- return new import_stream14.Stream(({ ctx, next }) => {
8761
+ return new import_stream14.Stream(({ next }) => {
8771
8762
  const update = () => {
8772
8763
  next({
8773
8764
  swarm: this.networkManager.connectionState,
@@ -8778,9 +8769,13 @@ var NetworkServiceImpl = class {
8778
8769
  }))
8779
8770
  });
8780
8771
  };
8781
- this.networkManager.connectionStateChanged.on(ctx, () => update());
8782
- this.signalManager.statusChanged?.on(ctx, () => update());
8772
+ const unsubscribeSwarm = this.networkManager.connectionStateChanged.on(() => update());
8773
+ const unsubscribeSignal = this.signalManager.statusChanged?.on(() => update());
8783
8774
  update();
8775
+ return () => {
8776
+ unsubscribeSwarm();
8777
+ unsubscribeSignal?.();
8778
+ };
8784
8779
  });
8785
8780
  }
8786
8781
  async updateConfig(request) {
@@ -8796,24 +8791,26 @@ var NetworkServiceImpl = class {
8796
8791
  return this.signalManager.query(request);
8797
8792
  }
8798
8793
  subscribeSwarmState(request) {
8799
- return new import_stream14.Stream(({ ctx, next }) => {
8800
- this.signalManager.swarmState?.on(ctx, (state) => {
8794
+ return new import_stream14.Stream(({ next }) => {
8795
+ const unsubscribe = this.signalManager.swarmState?.on((state) => {
8801
8796
  if (request.topic.equals(state.swarmKey)) {
8802
8797
  next(state);
8803
8798
  }
8804
8799
  });
8800
+ return unsubscribe;
8805
8801
  });
8806
8802
  }
8807
8803
  async sendMessage(message) {
8808
8804
  return this.signalManager.sendMessage(message);
8809
8805
  }
8810
8806
  subscribeMessages(peer) {
8811
- return new import_stream14.Stream(({ ctx, next }) => {
8812
- this.signalManager.onMessage.on(ctx, (message) => {
8807
+ return new import_stream14.Stream(({ next }) => {
8808
+ const unsubscribe = this.signalManager.onMessage.on((message) => {
8813
8809
  if (message.recipient.peerKey === peer.peerKey) {
8814
8810
  next(message);
8815
8811
  }
8816
8812
  });
8813
+ return unsubscribe;
8817
8814
  });
8818
8815
  }
8819
8816
  };
@@ -8837,8 +8834,8 @@ var SystemServiceImpl = class {
8837
8834
  return {
8838
8835
  timestamp: /* @__PURE__ */ new Date(),
8839
8836
  diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
8840
- truncate: keys === import_services26.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
8841
- humanize: keys === import_services26.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
8837
+ truncate: keys === import_services25.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
8838
+ humanize: keys === import_services25.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
8842
8839
  })))
8843
8840
  };
8844
8841
  }
@@ -8926,14 +8923,14 @@ var ClientServicesHost = class {
8926
8923
  this._systemService = new SystemServiceImpl({
8927
8924
  config: () => this._config,
8928
8925
  statusUpdate: this._statusUpdate,
8929
- getCurrentStatus: () => this.isOpen && !this._resetting ? import_services23.SystemStatus.ACTIVE : import_services23.SystemStatus.INACTIVE,
8926
+ getCurrentStatus: () => this.isOpen && !this._resetting ? import_services22.SystemStatus.ACTIVE : import_services22.SystemStatus.INACTIVE,
8930
8927
  getDiagnostics: () => {
8931
8928
  return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
8932
8929
  },
8933
8930
  onUpdateStatus: async (status) => {
8934
- if (!this.isOpen && status === import_services23.SystemStatus.ACTIVE) {
8931
+ if (!this.isOpen && status === import_services22.SystemStatus.ACTIVE) {
8935
8932
  await this._resourceLock?.acquire();
8936
- } else if (this.isOpen && status === import_services23.SystemStatus.INACTIVE) {
8933
+ } else if (this.isOpen && status === import_services22.SystemStatus.INACTIVE) {
8937
8934
  await this._resourceLock?.release();
8938
8935
  }
8939
8936
  },
@@ -9131,7 +9128,7 @@ var ClientServicesHost = class {
9131
9128
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
9132
9129
  DataService: this._serviceContext.echoHost.dataService,
9133
9130
  QueryService: this._serviceContext.echoHost.queryService,
9134
- NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager, this._edgeConnection),
9131
+ NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
9135
9132
  LoggingService: this._loggingService,
9136
9133
  TracingService: this._tracingService,
9137
9134
  // TODO(burdon): Move to new protobuf definitions.
@@ -9163,7 +9160,7 @@ var ClientServicesHost = class {
9163
9160
  deviceKey
9164
9161
  }, {
9165
9162
  F: __dxlog_file31,
9166
- L: 370,
9163
+ L: 366,
9167
9164
  S: this,
9168
9165
  C: (f, a) => f(...a)
9169
9166
  });
@@ -9171,7 +9168,7 @@ var ClientServicesHost = class {
9171
9168
  id: traceId
9172
9169
  }), {
9173
9170
  F: __dxlog_file31,
9174
- L: 371,
9171
+ L: 367,
9175
9172
  S: this,
9176
9173
  C: (f, a) => f(...a)
9177
9174
  });
@@ -9185,7 +9182,7 @@ var ClientServicesHost = class {
9185
9182
  deviceKey
9186
9183
  }, {
9187
9184
  F: __dxlog_file31,
9188
- L: 382,
9185
+ L: 378,
9189
9186
  S: this,
9190
9187
  C: (f, a) => f(...a)
9191
9188
  });
@@ -9203,7 +9200,7 @@ var ClientServicesHost = class {
9203
9200
  deviceKey
9204
9201
  }, {
9205
9202
  F: __dxlog_file31,
9206
- L: 391,
9203
+ L: 387,
9207
9204
  S: this,
9208
9205
  C: (f, a) => f(...a)
9209
9206
  });
@@ -9214,13 +9211,13 @@ var ClientServicesHost = class {
9214
9211
  id: traceId
9215
9212
  }), {
9216
9213
  F: __dxlog_file31,
9217
- L: 396,
9214
+ L: 392,
9218
9215
  S: this,
9219
9216
  C: (f, a) => f(...a)
9220
9217
  });
9221
9218
  import_log26.log.info("resetting...", void 0, {
9222
9219
  F: __dxlog_file31,
9223
- L: 398,
9220
+ L: 394,
9224
9221
  S: this,
9225
9222
  C: (f, a) => f(...a)
9226
9223
  });
@@ -9230,7 +9227,7 @@ var ClientServicesHost = class {
9230
9227
  await this._storage.reset();
9231
9228
  import_log26.log.info("reset", void 0, {
9232
9229
  F: __dxlog_file31,
9233
- L: 405,
9230
+ L: 401,
9234
9231
  S: this,
9235
9232
  C: (f, a) => f(...a)
9236
9233
  });
@@ -9238,7 +9235,7 @@ var ClientServicesHost = class {
9238
9235
  id: traceId
9239
9236
  }), {
9240
9237
  F: __dxlog_file31,
9241
- L: 406,
9238
+ L: 402,
9242
9239
  S: this,
9243
9240
  C: (f, a) => f(...a)
9244
9241
  });
@@ -9316,4 +9313,4 @@ ClientServicesHost = _ts_decorate11([
9316
9313
  subscribeToSpaces,
9317
9314
  subscribeToSwarmInfo
9318
9315
  });
9319
- //# sourceMappingURL=chunk-Y747YVDI.cjs.map
9316
+ //# sourceMappingURL=chunk-HUMVSL5Y.cjs.map