@dxos/client-services 0.8.2-main.f11618f → 0.8.2-main.fbd8ed0

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 (58) hide show
  1. package/dist/lib/browser/{chunk-R24OWGT7.mjs → chunk-I3QLQXQD.mjs} +111 -98
  2. package/dist/lib/browser/chunk-I3QLQXQD.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-ZIKA2DAN.cjs → chunk-Y747YVDI.cjs} +112 -99
  7. package/dist/lib/node/chunk-Y747YVDI.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-QLUXYSIC.mjs → chunk-XNCWQTDB.mjs} +111 -98
  12. package/dist/lib/node-esm/chunk-XNCWQTDB.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/devtools/feeds.d.ts.map +1 -1
  17. package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
  18. package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
  19. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  20. package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
  21. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
  22. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
  23. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
  24. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  25. package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
  26. package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
  27. package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
  28. package/dist/types/src/packlets/locks/browser.d.ts.map +1 -1
  29. package/dist/types/src/packlets/locks/node.d.ts.map +1 -1
  30. package/dist/types/src/packlets/services/util.d.ts.map +1 -1
  31. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +1 -1
  32. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
  33. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -1
  34. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  35. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  36. package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
  37. package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
  38. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  39. package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
  40. package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
  41. package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
  42. package/dist/types/src/packlets/storage/util.d.ts.map +1 -1
  43. package/dist/types/src/packlets/testing/credential-utils.d.ts.map +1 -1
  44. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  45. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  46. package/dist/types/src/version.d.ts +1 -1
  47. package/dist/types/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +39 -38
  49. package/src/packlets/space-export/space-archive-reader.ts +2 -1
  50. package/src/packlets/spaces/data-space-manager.ts +33 -27
  51. package/src/packlets/spaces/data-space.ts +11 -4
  52. package/src/packlets/spaces/epoch-migrations.ts +3 -2
  53. package/src/packlets/spaces/spaces-service.ts +2 -1
  54. package/src/packlets/storage/profile-archive.ts +2 -1
  55. package/src/version.ts +1 -1
  56. package/dist/lib/browser/chunk-R24OWGT7.mjs.map +0 -7
  57. package/dist/lib/node/chunk-ZIKA2DAN.cjs.map +0 -7
  58. package/dist/lib/node-esm/chunk-QLUXYSIC.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_ZIKA2DAN_exports = {};
30
- __export(chunk_ZIKA2DAN_exports, {
29
+ var chunk_Y747YVDI_exports = {};
30
+ __export(chunk_Y747YVDI_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -72,7 +72,7 @@ __export(chunk_ZIKA2DAN_exports, {
72
72
  subscribeToSpaces: () => subscribeToSpaces,
73
73
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
74
74
  });
75
- module.exports = __toCommonJS(chunk_ZIKA2DAN_exports);
75
+ module.exports = __toCommonJS(chunk_Y747YVDI_exports);
76
76
  var import_async = require("@dxos/async");
77
77
  var import_stream = require("@dxos/codec-protobuf/stream");
78
78
  var import_feed_store = require("@dxos/feed-store");
@@ -118,8 +118,8 @@ var import_buf = require("@dxos/protocols/buf");
118
118
  var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
119
119
  var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
120
120
  var import_util3 = require("@dxos/util");
121
+ var import_automerge = require("@automerge/automerge");
121
122
  var import_async7 = require("@dxos/async");
122
- var import_automerge = require("@dxos/automerge/automerge");
123
123
  var import_client_protocol2 = require("@dxos/client-protocol");
124
124
  var import_context4 = require("@dxos/context");
125
125
  var import_debug = require("@dxos/debug");
@@ -163,8 +163,8 @@ var import_util6 = require("@dxos/util");
163
163
  var import_credentials8 = require("@dxos/credentials");
164
164
  var import_keys7 = require("@dxos/keys");
165
165
  var import_log7 = require("@dxos/log");
166
+ var import_automerge_repo = require("@automerge/automerge-repo");
166
167
  var import_async11 = require("@dxos/async");
167
- var import_automerge_repo = require("@dxos/automerge/automerge-repo");
168
168
  var import_client_protocol4 = require("@dxos/client-protocol");
169
169
  var import_context7 = require("@dxos/context");
170
170
  var import_credentials9 = require("@dxos/credentials");
@@ -351,7 +351,7 @@ var import_util13 = require("@dxos/util");
351
351
  var import_node_path = __toESM(require("node:path"));
352
352
  var import_keys19 = require("@dxos/keys");
353
353
  var import_kv_store = require("@dxos/kv-store");
354
- var import_automerge_repo2 = require("@dxos/automerge/automerge-repo");
354
+ var import_automerge_repo2 = require("@automerge/automerge-repo");
355
355
  var import_invariant25 = require("@dxos/invariant");
356
356
  var import_log25 = require("@dxos/log");
357
357
  var import_protocols21 = require("@dxos/protocols");
@@ -745,7 +745,7 @@ var DevtoolsServiceImpl = class {
745
745
  });
746
746
  }
747
747
  };
748
- var DXOS_VERSION = "0.8.2-main.f11618f";
748
+ var DXOS_VERSION = "0.8.2-main.fbd8ed0";
749
749
  var getPlatform = () => {
750
750
  if (process.browser) {
751
751
  if (typeof window !== "undefined") {
@@ -1592,7 +1592,7 @@ var runEpochMigration = async (ctx, context) => {
1592
1592
  const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
1593
1593
  timeout: LOAD_DOC_TIMEOUT
1594
1594
  });
1595
- const newRoot = context.echoHost.createDoc(rootHandle.docSync());
1595
+ const newRoot = context.echoHost.createDoc(rootHandle.doc());
1596
1596
  await context.echoHost.flush();
1597
1597
  return {
1598
1598
  newRoot: newRoot.url
@@ -1608,7 +1608,7 @@ var runEpochMigration = async (ctx, context) => {
1608
1608
  case import_services6.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
1609
1609
  (0, import_invariant4.invariant)(context.newAutomergeRoot, void 0, {
1610
1610
  F: __dxlog_file6,
1611
- L: 62,
1611
+ L: 63,
1612
1612
  S: void 0,
1613
1613
  A: [
1614
1614
  "context.newAutomergeRoot",
@@ -2208,10 +2208,11 @@ var DataSpaceManager = class extends import_context7.Resource {
2208
2208
  id: "spaces",
2209
2209
  name: "Spaces",
2210
2210
  fetch: async () => {
2211
- return Array.from(this._spaces.values()).map((space) => {
2211
+ return Promise.all(Array.from(this._spaces.values()).map(async (space) => {
2212
2212
  const rootUrl = space.automergeSpaceState.rootUrl;
2213
- const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
2214
- const rootDoc = rootHandle?.docSync();
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();
2215
2216
  const properties = rootDoc && (0, import_echo_pipeline2.findInlineObjectOfType)(rootDoc, import_client_protocol4.TYPE_PROPERTIES);
2216
2217
  return {
2217
2218
  key: space.key.toHex(),
@@ -2223,7 +2224,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2223
2224
  members: space.inner.spaceState.members.size,
2224
2225
  rootUrl
2225
2226
  };
2226
- });
2227
+ }));
2227
2228
  }
2228
2229
  });
2229
2230
  }
@@ -2239,7 +2240,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2239
2240
  async _open() {
2240
2241
  (0, import_log8.log)("open", void 0, {
2241
2242
  F: __dxlog_file9,
2242
- L: 213,
2243
+ L: 215,
2243
2244
  S: this,
2244
2245
  C: (f, a) => f(...a)
2245
2246
  });
@@ -2247,7 +2248,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2247
2248
  id: this._instanceId
2248
2249
  }), {
2249
2250
  F: __dxlog_file9,
2250
- L: 214,
2251
+ L: 216,
2251
2252
  S: this,
2252
2253
  C: (f, a) => f(...a)
2253
2254
  });
@@ -2255,7 +2256,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2255
2256
  spaces: this._metadataStore.spaces.length
2256
2257
  }, {
2257
2258
  F: __dxlog_file9,
2258
- L: 215,
2259
+ L: 217,
2259
2260
  S: this,
2260
2261
  C: (f, a) => f(...a)
2261
2262
  });
@@ -2265,7 +2266,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2265
2266
  spaceMetadata
2266
2267
  }, {
2267
2268
  F: __dxlog_file9,
2268
- L: 219,
2269
+ L: 221,
2269
2270
  S: this,
2270
2271
  C: (f, a) => f(...a)
2271
2272
  });
@@ -2276,7 +2277,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2276
2277
  err
2277
2278
  }, {
2278
2279
  F: __dxlog_file9,
2279
- L: 222,
2280
+ L: 224,
2280
2281
  S: this,
2281
2282
  C: (f, a) => f(...a)
2282
2283
  });
@@ -2287,7 +2288,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2287
2288
  id: this._instanceId
2288
2289
  }), {
2289
2290
  F: __dxlog_file9,
2290
- L: 228,
2291
+ L: 230,
2291
2292
  S: this,
2292
2293
  C: (f, a) => f(...a)
2293
2294
  });
@@ -2295,7 +2296,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2295
2296
  async _close() {
2296
2297
  (0, import_log8.log)("close", void 0, {
2297
2298
  F: __dxlog_file9,
2298
- L: 233,
2299
+ L: 235,
2299
2300
  S: this,
2300
2301
  C: (f, a) => f(...a)
2301
2302
  });
@@ -2326,7 +2327,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2326
2327
  spaceKey
2327
2328
  }, {
2328
2329
  F: __dxlog_file9,
2329
- L: 262,
2330
+ L: 264,
2330
2331
  S: this,
2331
2332
  C: (f, a) => f(...a)
2332
2333
  });
@@ -2334,7 +2335,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2334
2335
  if (options.documents) {
2335
2336
  (0, import_invariant7.invariant)(Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId)), "Invalid document IDs", {
2336
2337
  F: __dxlog_file9,
2337
- L: 267,
2338
+ L: 269,
2338
2339
  S: this,
2339
2340
  A: [
2340
2341
  "Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId))",
@@ -2346,7 +2347,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2346
2347
  documentId
2347
2348
  }, {
2348
2349
  F: __dxlog_file9,
2349
- L: 274,
2350
+ L: 276,
2350
2351
  S: this,
2351
2352
  C: (f, a) => f(...a)
2352
2353
  });
@@ -2360,7 +2361,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2360
2361
  spaceKey
2361
2362
  }, {
2362
2363
  F: __dxlog_file9,
2363
- L: 281,
2364
+ L: 283,
2364
2365
  S: this,
2365
2366
  C: (f, a) => f(...a)
2366
2367
  });
@@ -2369,7 +2370,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2369
2370
  const newRootDocId = documentIdMapping[(0, import_automerge_repo.interpretAsDocumentId)(options.rootUrl)] ?? (0, import_invariant7.failedInvariant)();
2370
2371
  const rootDocHandle = await this._echoHost.loadDoc(import_context7.Context.default(void 0, {
2371
2372
  F: __dxlog_file9,
2372
- L: 286
2373
+ L: 288
2373
2374
  }), newRootDocId);
2374
2375
  import_echo_pipeline2.DatabaseRoot.mapLinks(rootDocHandle, documentIdMapping);
2375
2376
  root = await this._echoHost.openSpaceRoot(spaceId, `automerge:${newRootDocId}`);
@@ -2380,7 +2381,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2380
2381
  spaceKey
2381
2382
  }, {
2382
2383
  F: __dxlog_file9,
2383
- L: 294,
2384
+ L: 296,
2384
2385
  S: this,
2385
2386
  C: (f, a) => f(...a)
2386
2387
  });
@@ -2390,7 +2391,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2390
2391
  spaceKey
2391
2392
  }, {
2392
2393
  F: __dxlog_file9,
2393
- L: 299,
2394
+ L: 301,
2394
2395
  S: this,
2395
2396
  C: (f, a) => f(...a)
2396
2397
  });
@@ -2399,7 +2400,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2399
2400
  const memberCredential = credentials[1];
2400
2401
  (0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2401
2402
  F: __dxlog_file9,
2402
- L: 305,
2403
+ L: 307,
2403
2404
  S: this,
2404
2405
  A: [
2405
2406
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2413,7 +2414,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2413
2414
  spaceKey
2414
2415
  }, {
2415
2416
  F: __dxlog_file9,
2416
- L: 310,
2417
+ L: 312,
2417
2418
  S: this,
2418
2419
  C: (f, a) => f(...a)
2419
2420
  });
@@ -2426,7 +2427,18 @@ var DataSpaceManager = class extends import_context7.Resource {
2426
2427
  }
2427
2428
  switch (space.databaseRoot.getVersion()) {
2428
2429
  case import_echo_protocol2.SpaceDocVersion.CURRENT: {
2429
- const [_, properties] = (0, import_echo_pipeline2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_client_protocol4.TYPE_PROPERTIES) ?? [];
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) ?? [];
2430
2442
  return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
2431
2443
  }
2432
2444
  case import_echo_protocol2.SpaceDocVersion.LEGACY: {
@@ -2438,7 +2450,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2438
2450
  spaceId: space.id
2439
2451
  }, {
2440
2452
  F: __dxlog_file9,
2441
- L: 330,
2453
+ L: 336,
2442
2454
  S: this,
2443
2455
  C: (f, a) => f(...a)
2444
2456
  });
@@ -2473,14 +2485,14 @@ var DataSpaceManager = class extends import_context7.Resource {
2473
2485
  const automergeIndex = space.automergeSpaceState.rootUrl;
2474
2486
  (0, import_invariant7.invariant)(automergeIndex, void 0, {
2475
2487
  F: __dxlog_file9,
2476
- L: 363,
2488
+ L: 369,
2477
2489
  S: this,
2478
2490
  A: [
2479
2491
  "automergeIndex",
2480
2492
  ""
2481
2493
  ]
2482
2494
  });
2483
- const document = this._echoHost.automergeRepo.find(automergeIndex);
2495
+ const document = await this._echoHost.automergeRepo.find(automergeIndex, import_echo_pipeline2.FIND_PARAMS);
2484
2496
  await document.whenReady();
2485
2497
  return document;
2486
2498
  }
@@ -2490,13 +2502,13 @@ var DataSpaceManager = class extends import_context7.Resource {
2490
2502
  opts
2491
2503
  }, {
2492
2504
  F: __dxlog_file9,
2493
- L: 372,
2505
+ L: 378,
2494
2506
  S: this,
2495
2507
  C: (f, a) => f(...a)
2496
2508
  });
2497
2509
  (0, import_invariant7.invariant)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.", {
2498
2510
  F: __dxlog_file9,
2499
- L: 373,
2511
+ L: 379,
2500
2512
  S: this,
2501
2513
  A: [
2502
2514
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2505,7 +2517,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2505
2517
  });
2506
2518
  (0, import_invariant7.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
2507
2519
  F: __dxlog_file9,
2508
- L: 374,
2520
+ L: 380,
2509
2521
  S: this,
2510
2522
  A: [
2511
2523
  "!this._spaces.has(opts.spaceKey)",
@@ -2529,7 +2541,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2529
2541
  const space = this._spaceManager.spaces.get(options.spaceKey);
2530
2542
  (0, import_invariant7.invariant)(space, void 0, {
2531
2543
  F: __dxlog_file9,
2532
- L: 394,
2544
+ L: 400,
2533
2545
  S: this,
2534
2546
  A: [
2535
2547
  "space",
@@ -2542,7 +2554,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2542
2554
  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);
2543
2555
  (0, import_invariant7.invariant)(credentials[0].credential, void 0, {
2544
2556
  F: __dxlog_file9,
2545
- L: 413,
2557
+ L: 419,
2546
2558
  S: this,
2547
2559
  A: [
2548
2560
  "credentials[0].credential",
@@ -2552,7 +2564,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2552
2564
  const spaceMemberCredential = credentials[0].credential.credential;
2553
2565
  (0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2554
2566
  F: __dxlog_file9,
2555
- L: 415,
2567
+ L: 421,
2556
2568
  S: this,
2557
2569
  A: [
2558
2570
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2590,7 +2602,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2590
2602
  const space = this._spaces.get(spaceKey);
2591
2603
  (0, import_invariant7.invariant)(space, "Space not found.", {
2592
2604
  F: __dxlog_file9,
2593
- L: 452,
2605
+ L: 458,
2594
2606
  S: this,
2595
2607
  A: [
2596
2608
  "space",
@@ -2615,7 +2627,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2615
2627
  metadata
2616
2628
  }, {
2617
2629
  F: __dxlog_file9,
2618
- L: 471,
2630
+ L: 477,
2619
2631
  S: this,
2620
2632
  C: (f, a) => f(...a)
2621
2633
  });
@@ -2659,7 +2671,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2659
2671
  err
2660
2672
  }, {
2661
2673
  F: __dxlog_file9,
2662
- L: 513,
2674
+ L: 519,
2663
2675
  S: this,
2664
2676
  C: (f, a) => f(...a)
2665
2677
  });
@@ -2669,7 +2681,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2669
2681
  onAuthFailure: () => {
2670
2682
  import_log8.log.warn("auth failure", void 0, {
2671
2683
  F: __dxlog_file9,
2672
- L: 518,
2684
+ L: 524,
2673
2685
  S: this,
2674
2686
  C: (f, a) => f(...a)
2675
2687
  });
@@ -2702,7 +2714,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2702
2714
  space: space.key
2703
2715
  }, {
2704
2716
  F: __dxlog_file9,
2705
- L: 545,
2717
+ L: 551,
2706
2718
  S: this,
2707
2719
  C: (f, a) => f(...a)
2708
2720
  });
@@ -2713,7 +2725,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2713
2725
  open: this._lifecycleState === import_context7.LifecycleState.OPEN
2714
2726
  }, {
2715
2727
  F: __dxlog_file9,
2716
- L: 548,
2728
+ L: 554,
2717
2729
  S: this,
2718
2730
  C: (f, a) => f(...a)
2719
2731
  });
@@ -2732,7 +2744,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2732
2744
  space: space.key
2733
2745
  }, {
2734
2746
  F: __dxlog_file9,
2735
- L: 556,
2747
+ L: 562,
2736
2748
  S: this,
2737
2749
  C: (f, a) => f(...a)
2738
2750
  });
@@ -2753,7 +2765,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2753
2765
  spaceId: dataSpace.id
2754
2766
  }, {
2755
2767
  F: __dxlog_file9,
2756
- L: 570,
2768
+ L: 576,
2757
2769
  S: this,
2758
2770
  C: (f, a) => f(...a)
2759
2771
  });
@@ -2783,7 +2795,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2783
2795
  space: space.key
2784
2796
  }, {
2785
2797
  F: __dxlog_file9,
2786
- L: 597,
2798
+ L: 603,
2787
2799
  S: this,
2788
2800
  C: (f, a) => f(...a)
2789
2801
  });
@@ -2816,7 +2828,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2816
2828
  closedSessions
2817
2829
  }, {
2818
2830
  F: __dxlog_file9,
2819
- L: 623,
2831
+ L: 629,
2820
2832
  S: this,
2821
2833
  C: (f, a) => f(...a)
2822
2834
  });
@@ -2831,7 +2843,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2831
2843
  peerId: peerState.peerId
2832
2844
  }, {
2833
2845
  F: __dxlog_file9,
2834
- L: 637,
2846
+ L: 643,
2835
2847
  S: this,
2836
2848
  C: (f, a) => f(...a)
2837
2849
  });
@@ -2953,7 +2965,7 @@ var extractSpaceArchive = async (archive) => {
2953
2965
  const documentId = entry2.fileName.replace(`${import_protocols8.SpaceArchiveFileStructure.documents}/`, "").replace(/\.bin$/, "");
2954
2966
  (0, import_invariant10.invariant)(!documentId.includes("/"), void 0, {
2955
2967
  F: __dxlog_file10,
2956
- L: 27,
2968
+ L: 28,
2957
2969
  S: void 0,
2958
2970
  A: [
2959
2971
  "!documentId.includes('/')",
@@ -2967,7 +2979,7 @@ var extractSpaceArchive = async (archive) => {
2967
2979
  documents
2968
2980
  }, {
2969
2981
  F: __dxlog_file10,
2970
- L: 31,
2982
+ L: 32,
2971
2983
  S: void 0,
2972
2984
  C: (f, a) => f(...a)
2973
2985
  });
@@ -3086,7 +3098,7 @@ var SpacesServiceImpl = class {
3086
3098
  const credentials = await (0, import_credentials13.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
3087
3099
  (0, import_invariant8.invariant)(credentials[0].credential, void 0, {
3088
3100
  F: __dxlog_file11,
3089
- L: 118,
3101
+ L: 119,
3090
3102
  S: this,
3091
3103
  A: [
3092
3104
  "credentials[0].credential",
@@ -3096,7 +3108,7 @@ var SpacesServiceImpl = class {
3096
3108
  const spaceMemberCredential = credentials[0].credential.credential;
3097
3109
  (0, import_invariant8.invariant)((0, import_credentials13.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3098
3110
  F: __dxlog_file11,
3099
- L: 120,
3111
+ L: 121,
3100
3112
  S: this,
3101
3113
  A: [
3102
3114
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3114,7 +3126,7 @@ var SpacesServiceImpl = class {
3114
3126
  ids: spaces.map((space) => space.id)
3115
3127
  }), {
3116
3128
  F: __dxlog_file11,
3117
- L: 133,
3129
+ L: 134,
3118
3130
  S: this,
3119
3131
  C: (f, a) => f(...a)
3120
3132
  });
@@ -3206,7 +3218,7 @@ var SpacesServiceImpl = class {
3206
3218
  } else {
3207
3219
  (0, import_invariant8.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
3208
3220
  F: __dxlog_file11,
3209
- L: 231,
3221
+ L: 232,
3210
3222
  S: this,
3211
3223
  A: [
3212
3224
  "!credential.id",
@@ -3215,7 +3227,7 @@ var SpacesServiceImpl = class {
3215
3227
  });
3216
3228
  (0, import_invariant8.invariant)(this._identityManager.identity, "Identity is not available", {
3217
3229
  F: __dxlog_file11,
3218
- L: 232,
3230
+ L: 233,
3219
3231
  S: this,
3220
3232
  A: [
3221
3233
  "this._identityManager.identity",
@@ -3225,7 +3237,7 @@ var SpacesServiceImpl = class {
3225
3237
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
3226
3238
  (0, import_invariant8.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
3227
3239
  F: __dxlog_file11,
3228
- L: 234,
3240
+ L: 235,
3229
3241
  S: this,
3230
3242
  A: [
3231
3243
  "credential.issuer.equals(signer.getIssuer())",
@@ -3302,7 +3314,7 @@ var SpacesServiceImpl = class {
3302
3314
  const extracted = await extractSpaceArchive(request.archive);
3303
3315
  (0, import_invariant8.invariant)(extracted.metadata.echo?.currentRootUrl, "Space archive does not contain a root URL", {
3304
3316
  F: __dxlog_file11,
3305
- L: 288,
3317
+ L: 289,
3306
3318
  S: this,
3307
3319
  A: [
3308
3320
  "extracted.metadata.echo?.currentRootUrl",
@@ -3322,7 +3334,7 @@ var SpacesServiceImpl = class {
3322
3334
  const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
3323
3335
  (0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
3324
3336
  F: __dxlog_file11,
3325
- L: 299,
3337
+ L: 300,
3326
3338
  S: this,
3327
3339
  A: [
3328
3340
  "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3332,7 +3344,7 @@ var SpacesServiceImpl = class {
3332
3344
  const myIdentity = this._identityManager.identity;
3333
3345
  (0, import_invariant8.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
3334
3346
  F: __dxlog_file11,
3335
- L: 301,
3347
+ L: 302,
3336
3348
  S: this,
3337
3349
  A: [
3338
3350
  "myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
@@ -4367,7 +4379,7 @@ var DataSpace = class {
4367
4379
  constructor(params) {
4368
4380
  this._ctx = new import_context4.Context(void 0, {
4369
4381
  F: __dxlog_file15,
4370
- L: 97
4382
+ L: 100
4371
4383
  });
4372
4384
  this._cache = void 0;
4373
4385
  this._edgeFeedReplicator = void 0;
@@ -4416,7 +4428,7 @@ var DataSpace = class {
4416
4428
  state: import_services5.SpaceState[this._state]
4417
4429
  }, {
4418
4430
  F: __dxlog_file15,
4419
- L: 173,
4431
+ L: 176,
4420
4432
  S: this,
4421
4433
  C: (f, a) => f(...a)
4422
4434
  });
@@ -4475,7 +4487,7 @@ var DataSpace = class {
4475
4487
  }
4476
4488
  await this._inner.open(new import_context4.Context(void 0, {
4477
4489
  F: __dxlog_file15,
4478
- L: 247
4490
+ L: 250
4479
4491
  }));
4480
4492
  await this._inner.startProtocol();
4481
4493
  await this._edgeFeedReplicator?.open();
@@ -4484,7 +4496,7 @@ var DataSpace = class {
4484
4496
  state: import_services5.SpaceState[this._state]
4485
4497
  }, {
4486
4498
  F: __dxlog_file15,
4487
- L: 253,
4499
+ L: 256,
4488
4500
  S: this,
4489
4501
  C: (f, a) => f(...a)
4490
4502
  });
@@ -4504,14 +4516,14 @@ var DataSpace = class {
4504
4516
  state: import_services5.SpaceState[this._state]
4505
4517
  }, {
4506
4518
  F: __dxlog_file15,
4507
- L: 272,
4519
+ L: 275,
4508
4520
  S: this,
4509
4521
  C: (f, a) => f(...a)
4510
4522
  });
4511
4523
  await this._ctx.dispose();
4512
4524
  this._ctx = new import_context4.Context(void 0, {
4513
4525
  F: __dxlog_file15,
4514
- L: 274
4526
+ L: 277
4515
4527
  });
4516
4528
  if (this._edgeFeedReplicator) {
4517
4529
  this.inner.protocol.feedAdded.remove(this._onFeedAdded);
@@ -4544,7 +4556,7 @@ var DataSpace = class {
4544
4556
  if (err instanceof import_protocols3.CancelledError || err instanceof import_context4.ContextDisposedError) {
4545
4557
  (0, import_log4.log)("data pipeline initialization cancelled", err, {
4546
4558
  F: __dxlog_file15,
4547
- L: 312,
4559
+ L: 315,
4548
4560
  S: this,
4549
4561
  C: (f, a) => f(...a)
4550
4562
  });
@@ -4552,7 +4564,7 @@ var DataSpace = class {
4552
4564
  }
4553
4565
  import_log4.log.error("Error initializing data pipeline", err, {
4554
4566
  F: __dxlog_file15,
4555
- L: 316,
4567
+ L: 319,
4556
4568
  S: this,
4557
4569
  C: (f, a) => f(...a)
4558
4570
  });
@@ -4561,7 +4573,7 @@ var DataSpace = class {
4561
4573
  state: import_services5.SpaceState[this._state]
4562
4574
  }, {
4563
4575
  F: __dxlog_file15,
4564
- L: 318,
4576
+ L: 321,
4565
4577
  S: this,
4566
4578
  C: (f, a) => f(...a)
4567
4579
  });
@@ -4581,13 +4593,13 @@ var DataSpace = class {
4581
4593
  state: import_services5.SpaceState[this._state]
4582
4594
  }, {
4583
4595
  F: __dxlog_file15,
4584
- L: 334,
4596
+ L: 337,
4585
4597
  S: this,
4586
4598
  C: (f, a) => f(...a)
4587
4599
  });
4588
4600
  (0, import_log4.log)("initializing control pipeline", void 0, {
4589
4601
  F: __dxlog_file15,
4590
- L: 336,
4602
+ L: 339,
4591
4603
  S: this,
4592
4604
  C: (f, a) => f(...a)
4593
4605
  });
@@ -4596,21 +4608,21 @@ var DataSpace = class {
4596
4608
  const ready = this.stateUpdate.waitForCondition(() => this._state === import_services5.SpaceState.SPACE_READY);
4597
4609
  (0, import_log4.log)("initializing automerge root", void 0, {
4598
4610
  F: __dxlog_file15,
4599
- L: 344,
4611
+ L: 347,
4600
4612
  S: this,
4601
4613
  C: (f, a) => f(...a)
4602
4614
  });
4603
4615
  this._automergeSpaceState.startProcessingRootDocs();
4604
4616
  (0, import_log4.log)("waiting for space to be ready", void 0, {
4605
4617
  F: __dxlog_file15,
4606
- L: 348,
4618
+ L: 351,
4607
4619
  S: this,
4608
4620
  C: (f, a) => f(...a)
4609
4621
  });
4610
4622
  await ready;
4611
4623
  (0, import_log4.log)("space is ready", void 0, {
4612
4624
  F: __dxlog_file15,
4613
- L: 350,
4625
+ L: 353,
4614
4626
  S: this,
4615
4627
  C: (f, a) => f(...a)
4616
4628
  });
@@ -4618,14 +4630,14 @@ var DataSpace = class {
4618
4630
  async *getAllDocuments() {
4619
4631
  (0, import_invariant3.invariant)(this._databaseRoot, "Space is not ready", {
4620
4632
  F: __dxlog_file15,
4621
- L: 354,
4633
+ L: 357,
4622
4634
  S: this,
4623
4635
  A: [
4624
4636
  "this._databaseRoot",
4625
4637
  "'Space is not ready'"
4626
4638
  ]
4627
4639
  });
4628
- const doc = this._databaseRoot.docSync() ?? (0, import_invariant3.failedInvariant)();
4640
+ const doc = this._databaseRoot.doc() ?? (0, import_invariant3.failedInvariant)();
4629
4641
  const root = (0, import_automerge.save)(doc);
4630
4642
  yield [
4631
4643
  this._databaseRoot.documentId,
@@ -4634,7 +4646,7 @@ var DataSpace = class {
4634
4646
  for (const documentUrl of this._databaseRoot.getAllLinkedDocuments()) {
4635
4647
  const data = await this._echoHost.exportDoc(import_context4.Context.default(void 0, {
4636
4648
  F: __dxlog_file15,
4637
- L: 360
4649
+ L: 363
4638
4650
  }), documentUrl);
4639
4651
  yield [
4640
4652
  documentUrl.replace(/^automerge:/, ""),
@@ -4649,7 +4661,7 @@ var DataSpace = class {
4649
4661
  state: import_services5.SpaceState[this._state]
4650
4662
  }, {
4651
4663
  F: __dxlog_file15,
4652
- L: 369,
4664
+ L: 372,
4653
4665
  S: this,
4654
4666
  C: (f, a) => f(...a)
4655
4667
  });
@@ -4666,7 +4678,7 @@ var DataSpace = class {
4666
4678
  await this._createWritableFeeds();
4667
4679
  (0, import_log4.log)("writable feeds created", void 0, {
4668
4680
  F: __dxlog_file15,
4669
- L: 386,
4681
+ L: 389,
4670
4682
  S: this,
4671
4683
  C: (f, a) => f(...a)
4672
4684
  });
@@ -4720,7 +4732,7 @@ var DataSpace = class {
4720
4732
  count: credentials.length
4721
4733
  }, {
4722
4734
  F: __dxlog_file15,
4723
- L: 444,
4735
+ L: 447,
4724
4736
  S: this,
4725
4737
  C: (f, a) => f(...a)
4726
4738
  });
@@ -4731,14 +4743,14 @@ var DataSpace = class {
4731
4743
  });
4732
4744
  (0, import_log4.log)("credentials notarized", void 0, {
4733
4745
  F: __dxlog_file15,
4734
- L: 448,
4746
+ L: 451,
4735
4747
  S: this,
4736
4748
  C: (f, a) => f(...a)
4737
4749
  });
4738
4750
  } catch (err) {
4739
4751
  import_log4.log.error("error notarizing credentials for feed admission", err, {
4740
4752
  F: __dxlog_file15,
4741
- L: 450,
4753
+ L: 453,
4742
4754
  S: this,
4743
4755
  C: (f, a) => f(...a)
4744
4756
  });
@@ -4753,16 +4765,17 @@ var DataSpace = class {
4753
4765
  rootUrl
4754
4766
  }, {
4755
4767
  F: __dxlog_file15,
4756
- L: 460,
4768
+ L: 463,
4757
4769
  S: this,
4758
4770
  C: (f, a) => f(...a)
4759
4771
  });
4760
- const handle = this._echoHost.automergeRepo.find(rootUrl);
4772
+ let handle;
4761
4773
  queueMicrotask(async () => {
4762
4774
  try {
4763
4775
  try {
4764
4776
  var _usingCtx = _using_ctx3();
4765
4777
  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));
4766
4779
  await (0, import_context4.cancelWithContext)(this._ctx, handle.whenReady());
4767
4780
  });
4768
4781
  if (this._ctx.disposed) {
@@ -4772,7 +4785,7 @@ var DataSpace = class {
4772
4785
  // Ensure only one root is processed at a time.
4773
4786
  _usingCtx.u(await this._epochProcessingMutex.acquire())
4774
4787
  );
4775
- const doc = handle.docSync() ?? (0, import_invariant3.failedInvariant)();
4788
+ const doc = handle.doc() ?? (0, import_invariant3.failedInvariant)();
4776
4789
  if (!doc.access?.spaceKey) {
4777
4790
  handle.change((doc2) => {
4778
4791
  doc2.access = {
@@ -4805,7 +4818,7 @@ var DataSpace = class {
4805
4818
  err
4806
4819
  }, {
4807
4820
  F: __dxlog_file15,
4808
- L: 503,
4821
+ L: 510,
4809
4822
  S: this,
4810
4823
  C: (f, a) => f(...a)
4811
4824
  });
@@ -4895,7 +4908,7 @@ var DataSpace = class {
4895
4908
  state: import_services5.SpaceState[this._state]
4896
4909
  }, {
4897
4910
  F: __dxlog_file15,
4898
- L: 585,
4911
+ L: 592,
4899
4912
  S: this,
4900
4913
  C: (f, a) => f(...a)
4901
4914
  });
@@ -8335,7 +8348,7 @@ var exportProfileData = async ({ storage, level }) => {
8335
8348
  count: files.length
8336
8349
  }, {
8337
8350
  F: __dxlog_file29,
8338
- L: 30,
8351
+ L: 31,
8339
8352
  S: void 0,
8340
8353
  C: (f, a) => f(...a)
8341
8354
  });
@@ -8353,7 +8366,7 @@ var exportProfileData = async ({ storage, level }) => {
8353
8366
  count: files.length
8354
8367
  }, {
8355
8368
  F: __dxlog_file29,
8356
- L: 41,
8369
+ L: 42,
8357
8370
  S: void 0,
8358
8371
  C: (f, a) => f(...a)
8359
8372
  });
@@ -8361,7 +8374,7 @@ var exportProfileData = async ({ storage, level }) => {
8361
8374
  {
8362
8375
  import_log25.log.info("begin exporting kv pairs", void 0, {
8363
8376
  F: __dxlog_file29,
8364
- L: 45,
8377
+ L: 46,
8365
8378
  S: void 0,
8366
8379
  C: (f, a) => f(...a)
8367
8380
  });
@@ -8382,7 +8395,7 @@ var exportProfileData = async ({ storage, level }) => {
8382
8395
  count
8383
8396
  }, {
8384
8397
  F: __dxlog_file29,
8385
- L: 56,
8398
+ L: 57,
8386
8399
  S: void 0,
8387
8400
  C: (f, a) => f(...a)
8388
8401
  });
@@ -8398,7 +8411,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8398
8411
  const directory = await storage.createDirectory();
8399
8412
  (0, import_invariant25.invariant)(typeof entry2.key === "string", "Invalid key type", {
8400
8413
  F: __dxlog_file29,
8401
- L: 79,
8414
+ L: 80,
8402
8415
  S: void 0,
8403
8416
  A: [
8404
8417
  "typeof entry.key === 'string'",
@@ -8408,7 +8421,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8408
8421
  const file = await directory.getOrCreateFile(entry2.key);
8409
8422
  (0, import_invariant25.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
8410
8423
  F: __dxlog_file29,
8411
- L: 81,
8424
+ L: 82,
8412
8425
  S: void 0,
8413
8426
  A: [
8414
8427
  "entry.value instanceof Uint8Array",
@@ -8422,7 +8435,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8422
8435
  case import_protocols21.ProfileArchiveEntryType.KEY_VALUE: {
8423
8436
  (0, import_invariant25.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
8424
8437
  F: __dxlog_file29,
8425
- L: 87,
8438
+ L: 88,
8426
8439
  S: void 0,
8427
8440
  A: [
8428
8441
  "entry.key instanceof Uint8Array",
@@ -8431,7 +8444,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8431
8444
  });
8432
8445
  (0, import_invariant25.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
8433
8446
  F: __dxlog_file29,
8434
- L: 88,
8447
+ L: 89,
8435
8448
  S: void 0,
8436
8449
  A: [
8437
8450
  "entry.value instanceof Uint8Array",
@@ -8456,7 +8469,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8456
8469
  progress: `${(count / archive.storage.length * 100).toFixed()}%`
8457
8470
  }, {
8458
8471
  F: __dxlog_file29,
8459
- L: 101,
8472
+ L: 102,
8460
8473
  S: void 0,
8461
8474
  C: (f, a) => f(...a)
8462
8475
  });
@@ -8464,7 +8477,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8464
8477
  }
8465
8478
  import_log25.log.info("committing changes..", void 0, {
8466
8479
  F: __dxlog_file29,
8467
- L: 109,
8480
+ L: 110,
8468
8481
  S: void 0,
8469
8482
  C: (f, a) => f(...a)
8470
8483
  });
@@ -9303,4 +9316,4 @@ ClientServicesHost = _ts_decorate11([
9303
9316
  subscribeToSpaces,
9304
9317
  subscribeToSwarmInfo
9305
9318
  });
9306
- //# sourceMappingURL=chunk-ZIKA2DAN.cjs.map
9319
+ //# sourceMappingURL=chunk-Y747YVDI.cjs.map