@dxos/client-services 0.5.9-main.55e2125 → 0.5.9-main.5ad2d33

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.
@@ -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_QN3UVJ5U_exports = {};
30
- __export(chunk_QN3UVJ5U_exports, {
29
+ var chunk_E6HB26ZB_exports = {};
30
+ __export(chunk_E6HB26ZB_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -70,7 +70,7 @@ __export(chunk_QN3UVJ5U_exports, {
70
70
  subscribeToSpaces: () => subscribeToSpaces,
71
71
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
72
72
  });
73
- module.exports = __toCommonJS(chunk_QN3UVJ5U_exports);
73
+ module.exports = __toCommonJS(chunk_E6HB26ZB_exports);
74
74
  var import_async = require("@dxos/async");
75
75
  var import_codec_protobuf = require("@dxos/codec-protobuf");
76
76
  var import_feed_store = require("@dxos/feed-store");
@@ -216,32 +216,28 @@ var import_util7 = require("@dxos/util");
216
216
  var import_async14 = require("@dxos/async");
217
217
  var import_context11 = require("@dxos/context");
218
218
  var import_credentials14 = require("@dxos/credentials");
219
- var import_async15 = require("@dxos/async");
220
- var import_automerge = require("@dxos/automerge/automerge");
221
- var import_context12 = require("@dxos/context");
222
219
  var import_echo_db = require("@dxos/echo-db");
223
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
220
+ var import_echo_protocol2 = require("@dxos/echo-protocol");
224
221
  var import_echo_schema = require("@dxos/echo-schema");
225
222
  var import_invariant13 = require("@dxos/invariant");
226
223
  var import_log13 = require("@dxos/log");
227
224
  var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
228
- var import_util8 = require("@dxos/util");
229
- var import_async16 = require("@dxos/async");
230
- var import_context13 = require("@dxos/context");
225
+ var import_async15 = require("@dxos/async");
226
+ var import_context12 = require("@dxos/context");
231
227
  var import_invariant14 = require("@dxos/invariant");
232
228
  var import_keys11 = require("@dxos/keys");
233
229
  var import_log14 = require("@dxos/log");
234
230
  var import_protocols10 = require("@dxos/protocols");
235
231
  var import_teleport3 = require("@dxos/teleport");
236
- var import_util9 = require("@dxos/util");
237
- var import_async17 = require("@dxos/async");
232
+ var import_util8 = require("@dxos/util");
233
+ var import_async16 = require("@dxos/async");
238
234
  var import_client_protocol5 = require("@dxos/client-protocol");
239
- var import_context14 = require("@dxos/context");
235
+ var import_context13 = require("@dxos/context");
240
236
  var import_credentials15 = require("@dxos/credentials");
241
237
  var import_echo_db2 = require("@dxos/echo-db");
238
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
242
239
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
243
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
244
- var import_echo_protocol2 = require("@dxos/echo-protocol");
240
+ var import_echo_protocol3 = require("@dxos/echo-protocol");
245
241
  var import_echo_schema2 = require("@dxos/echo-schema");
246
242
  var import_feed_store4 = require("@dxos/feed-store");
247
243
  var import_invariant15 = require("@dxos/invariant");
@@ -252,12 +248,12 @@ var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
252
248
  var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
253
249
  var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
254
250
  var import_tracing6 = require("@dxos/tracing");
255
- var import_util10 = require("@dxos/util");
251
+ var import_util9 = require("@dxos/util");
256
252
  var import_credentials17 = require("@dxos/credentials");
257
253
  var import_debug4 = require("@dxos/debug");
258
254
  var import_credentials18 = require("@dxos/protocols/proto/dxos/halo/credentials");
259
255
  var import_timeframe4 = require("@dxos/timeframe");
260
- var import_async18 = require("@dxos/async");
256
+ var import_async17 = require("@dxos/async");
261
257
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
262
258
  var import_credentials19 = require("@dxos/credentials");
263
259
  var import_debug5 = require("@dxos/debug");
@@ -267,12 +263,12 @@ var import_log16 = require("@dxos/log");
267
263
  var import_protocols12 = require("@dxos/protocols");
268
264
  var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
269
265
  var import_tracing7 = require("@dxos/tracing");
270
- var import_async19 = require("@dxos/async");
271
- var import_context15 = require("@dxos/context");
266
+ var import_async18 = require("@dxos/async");
267
+ var import_context14 = require("@dxos/context");
272
268
  var import_credentials20 = require("@dxos/credentials");
273
269
  var import_debug6 = require("@dxos/debug");
274
270
  var import_echo_db3 = require("@dxos/echo-db");
275
- var import_echo_pipeline6 = require("@dxos/echo-pipeline");
271
+ var import_echo_pipeline5 = require("@dxos/echo-pipeline");
276
272
  var import_feed_store6 = require("@dxos/feed-store");
277
273
  var import_invariant17 = require("@dxos/invariant");
278
274
  var import_keyring = require("@dxos/keyring");
@@ -282,7 +278,7 @@ var import_protocols13 = require("@dxos/protocols");
282
278
  var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
283
279
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
284
280
  var import_tracing8 = require("@dxos/tracing");
285
- var import_util11 = require("@dxos/util");
281
+ var import_util10 = require("@dxos/util");
286
282
  var import_invariant18 = require("@dxos/invariant");
287
283
  var import_lock_file = require("@dxos/lock-file");
288
284
  var import_log18 = require("@dxos/log");
@@ -291,7 +287,7 @@ var import_config = require("@dxos/protocols/proto/dxos/config");
291
287
  var import_random_access_storage = require("@dxos/random-access-storage");
292
288
  var import_client_protocol6 = require("@dxos/client-protocol");
293
289
  var import_config2 = require("@dxos/protocols/proto/dxos/config");
294
- var import_util12 = require("@dxos/util");
290
+ var import_util11 = require("@dxos/util");
295
291
  var import_node_path = __toESM(require("node:path"));
296
292
  var import_keys14 = require("@dxos/keys");
297
293
  var import_kv_store = require("@dxos/kv-store");
@@ -299,10 +295,10 @@ var import_automerge_repo = require("@dxos/automerge/automerge-repo");
299
295
  var import_invariant19 = require("@dxos/invariant");
300
296
  var import_log19 = require("@dxos/log");
301
297
  var import_protocols15 = require("@dxos/protocols");
302
- var import_util13 = require("@dxos/util");
303
- var import_async20 = require("@dxos/async");
298
+ var import_util12 = require("@dxos/util");
299
+ var import_async19 = require("@dxos/async");
304
300
  var import_client_protocol7 = require("@dxos/client-protocol");
305
- var import_context16 = require("@dxos/context");
301
+ var import_context15 = require("@dxos/context");
306
302
  var import_invariant20 = require("@dxos/invariant");
307
303
  var import_keys15 = require("@dxos/keys");
308
304
  var import_log20 = require("@dxos/log");
@@ -312,30 +308,30 @@ var import_protocols16 = require("@dxos/protocols");
312
308
  var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
313
309
  var import_tracing9 = require("@dxos/tracing");
314
310
  var import_websocket_rpc = require("@dxos/websocket-rpc");
315
- var import_async21 = require("@dxos/async");
311
+ var import_async20 = require("@dxos/async");
316
312
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
317
313
  var import_invariant21 = require("@dxos/invariant");
318
314
  var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
319
315
  var import_config3 = require("@dxos/config");
320
316
  var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
321
317
  var import_tracing10 = require("@dxos/tracing");
322
- var import_util14 = require("@dxos/util");
318
+ var import_util13 = require("@dxos/util");
323
319
  var import_keys16 = require("@dxos/keys");
324
- var import_util15 = require("@dxos/util");
325
- var import_async22 = require("@dxos/async");
320
+ var import_util14 = require("@dxos/util");
321
+ var import_async21 = require("@dxos/async");
326
322
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
327
323
  var import_keys17 = require("@dxos/keys");
328
- var import_util16 = require("@dxos/util");
329
- var import_async23 = require("@dxos/async");
324
+ var import_util15 = require("@dxos/util");
325
+ var import_async22 = require("@dxos/async");
330
326
  var import_codec_protobuf14 = require("@dxos/codec-protobuf");
331
327
  var import_keys18 = require("@dxos/keys");
332
328
  var import_log21 = require("@dxos/log");
333
329
  var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
334
- var import_util17 = require("@dxos/util");
330
+ var import_util16 = require("@dxos/util");
335
331
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
336
332
  var import_codec_protobuf16 = require("@dxos/codec-protobuf");
337
333
  var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
338
- var import_util18 = require("@dxos/util");
334
+ var import_util17 = require("@dxos/util");
339
335
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
340
336
  return new import_codec_protobuf.Stream(({ next }) => {
341
337
  const subscriptions = new import_async.EventSubscriptions();
@@ -650,7 +646,7 @@ var DevtoolsServiceImpl = class {
650
646
  });
651
647
  }
652
648
  };
653
- var DXOS_VERSION = "0.5.9-main.55e2125";
649
+ var DXOS_VERSION = "0.5.9-main.5ad2d33";
654
650
  var getPlatform = () => {
655
651
  if (process.browser) {
656
652
  if (typeof window !== "undefined") {
@@ -1804,7 +1800,7 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1804
1800
  duplicate: space.id
1805
1801
  }, {
1806
1802
  F: __dxlog_file7,
1807
- L: 127,
1803
+ L: 129,
1808
1804
  S: this,
1809
1805
  C: (f, a) => f(...a)
1810
1806
  });
@@ -1815,6 +1811,13 @@ var IdentityServiceImpl = class extends import_context4.Resource {
1815
1811
  recodedDefaultSpace = true;
1816
1812
  recordedDefaultSpaceTrigger.wake();
1817
1813
  }
1814
+ }, (err) => {
1815
+ import_log5.log.catch(err, void 0, {
1816
+ F: __dxlog_file7,
1817
+ L: 140,
1818
+ S: this,
1819
+ C: (f, a) => f(...a)
1820
+ });
1818
1821
  });
1819
1822
  await Promise.race([
1820
1823
  allProcessed,
@@ -3819,11 +3822,12 @@ var AutomergeSpaceState = class extends import_context11.Resource {
3819
3822
  }
3820
3823
  };
3821
3824
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
3825
+ var LOAD_DOC_TIMEOUT = 1e4;
3822
3826
  var runEpochMigration = async (ctx, context) => {
3823
3827
  switch (context.migration) {
3824
3828
  case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
3825
- const document = context.repo.create();
3826
- await context.repo.flush();
3829
+ const document = context.echoHost.createDoc();
3830
+ await context.echoHost.flush();
3827
3831
  return {
3828
3832
  newRoot: document.url
3829
3833
  };
@@ -3832,10 +3836,11 @@ var runEpochMigration = async (ctx, context) => {
3832
3836
  if (!context.currentRoot) {
3833
3837
  throw new Error("Space does not have an automerge root");
3834
3838
  }
3835
- const rootHandle = context.repo.find(context.currentRoot);
3836
- await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
3837
- const newRoot = context.repo.create(rootHandle.docSync());
3838
- await context.repo.flush();
3839
+ const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
3840
+ timeout: LOAD_DOC_TIMEOUT
3841
+ });
3842
+ const newRoot = context.echoHost.createDoc(rootHandle.docSync());
3843
+ await context.echoHost.flush();
3839
3844
  return {
3840
3845
  newRoot: newRoot.url
3841
3846
  };
@@ -3843,66 +3848,76 @@ var runEpochMigration = async (ctx, context) => {
3843
3848
  case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
3844
3849
  import_log13.log.info("Fragmenting", void 0, {
3845
3850
  F: __dxlog_file15,
3846
- L: 63,
3851
+ L: 64,
3847
3852
  S: void 0,
3848
3853
  C: (f, a) => f(...a)
3849
3854
  });
3850
3855
  const currentRootUrl = context.currentRoot;
3851
- const rootHandle = context.repo.find(currentRootUrl);
3852
- await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
3856
+ const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
3857
+ timeout: LOAD_DOC_TIMEOUT
3858
+ });
3853
3859
  const objects = Object.entries(rootHandle.docSync().objects);
3854
3860
  const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
3855
3861
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
3856
3862
  (0, import_invariant13.invariant)(properties, "Properties not found", {
3857
3863
  F: __dxlog_file15,
3858
- L: 73,
3864
+ L: 75,
3859
3865
  S: void 0,
3860
3866
  A: [
3861
3867
  "properties",
3862
3868
  "'Properties not found'"
3863
3869
  ]
3864
3870
  });
3865
- const newSpaceDoc = {
3871
+ const newRoot = context.echoHost.createDoc({
3866
3872
  ...rootHandle.docSync(),
3867
3873
  objects: Object.fromEntries([
3868
3874
  properties
3869
3875
  ])
3870
- };
3871
- const newRoot = context.repo.create(newSpaceDoc);
3876
+ });
3872
3877
  (0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3873
3878
  F: __dxlog_file15,
3874
- L: 78,
3879
+ L: 82,
3875
3880
  S: void 0,
3876
3881
  A: [
3877
3882
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
3878
3883
  ""
3879
3884
  ]
3880
3885
  });
3881
- const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(context.spaceId, context.repo, context.spaceKey);
3882
- await docLoader.loadSpaceRootDocHandle(ctx, {
3883
- rootUrl: newRoot.url
3884
- });
3885
- otherObjects.forEach(([key, value]) => {
3886
- const handle = docLoader.createDocumentForObject(key);
3887
- handle.change((doc) => {
3888
- (0, import_util8.assignDeep)(doc, [
3889
- "objects",
3890
- key
3891
- ], value);
3886
+ const newLinks = [];
3887
+ for (const [id, objData] of otherObjects) {
3888
+ const handle = context.echoHost.createDoc({
3889
+ version: import_echo_protocol2.SpaceDocVersion.CURRENT,
3890
+ access: {
3891
+ spaceKey: context.spaceKey.toHex()
3892
+ },
3893
+ objects: {
3894
+ [id]: objData
3895
+ }
3892
3896
  });
3897
+ newLinks.push([
3898
+ id,
3899
+ handle.url
3900
+ ]);
3901
+ }
3902
+ newRoot.change((doc) => {
3903
+ doc.links ??= {};
3904
+ for (const [id, url] of newLinks) {
3905
+ doc.links[id] = url;
3906
+ }
3893
3907
  });
3894
- await context.repo.flush();
3908
+ await context.echoHost.flush();
3895
3909
  return {
3896
3910
  newRoot: newRoot.url
3897
3911
  };
3898
3912
  }
3899
3913
  case import_services13.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
3900
3914
  const currentRootUrl = context.currentRoot;
3901
- const rootHandle = context.repo.find(currentRootUrl);
3902
- await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
3915
+ const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
3916
+ timeout: LOAD_DOC_TIMEOUT
3917
+ });
3903
3918
  (0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
3904
3919
  F: __dxlog_file15,
3905
- L: 100,
3920
+ L: 115,
3906
3921
  S: void 0,
3907
3922
  A: [
3908
3923
  "rootHandle.docSync()",
@@ -3912,20 +3927,23 @@ var runEpochMigration = async (ctx, context) => {
3912
3927
  const newRootContent = await (0, import_echo_db.convertLegacySpaceRootDoc)(structuredClone(rootHandle.docSync()));
3913
3928
  for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
3914
3929
  try {
3915
- const handle = context.repo.find(url);
3916
- await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(handle.whenReady(), 1e4));
3917
- (0, import_invariant13.invariant)(handle.docSync(), "Doc not found", {
3930
+ const handle = await context.echoHost.loadDoc(ctx, url, {
3931
+ timeout: LOAD_DOC_TIMEOUT
3932
+ });
3933
+ (0, import_invariant13.invariant)(handle.docSync(), void 0, {
3918
3934
  F: __dxlog_file15,
3919
- L: 108,
3935
+ L: 122,
3920
3936
  S: void 0,
3921
3937
  A: [
3922
3938
  "handle.docSync()",
3923
- "'Doc not found'"
3939
+ ""
3924
3940
  ]
3925
3941
  });
3926
3942
  const newDoc = await (0, import_echo_db.convertLegacyReferences)(structuredClone(handle.docSync()));
3927
3943
  const migratedDoc = (0, import_echo_db.migrateDocument)(handle.docSync(), newDoc);
3928
- const newHandle = context.repo.import(import_automerge.next.save(migratedDoc));
3944
+ const newHandle = context.echoHost.createDoc(migratedDoc, {
3945
+ preserveHistory: true
3946
+ });
3929
3947
  newRootContent.links[id] = newHandle.url;
3930
3948
  } catch (err) {
3931
3949
  import_log13.log.warn("Failed to migrate reference", {
@@ -3934,7 +3952,7 @@ var runEpochMigration = async (ctx, context) => {
3934
3952
  error: err
3935
3953
  }, {
3936
3954
  F: __dxlog_file15,
3937
- L: 114,
3955
+ L: 128,
3938
3956
  S: void 0,
3939
3957
  C: (f, a) => f(...a)
3940
3958
  });
@@ -3942,8 +3960,10 @@ var runEpochMigration = async (ctx, context) => {
3942
3960
  }
3943
3961
  }
3944
3962
  const migratedRoot = (0, import_echo_db.migrateDocument)(rootHandle.docSync(), newRootContent);
3945
- const newRoot = context.repo.import(import_automerge.next.save(migratedRoot));
3946
- await context.repo.flush();
3963
+ const newRoot = context.echoHost.createDoc(migratedRoot, {
3964
+ preserveHistory: true
3965
+ });
3966
+ await context.echoHost.flush();
3947
3967
  return {
3948
3968
  newRoot: newRoot.url
3949
3969
  };
@@ -3951,14 +3971,14 @@ var runEpochMigration = async (ctx, context) => {
3951
3971
  case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
3952
3972
  (0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
3953
3973
  F: __dxlog_file15,
3954
- L: 129,
3974
+ L: 143,
3955
3975
  S: void 0,
3956
3976
  A: [
3957
3977
  "context.newAutomergeRoot",
3958
3978
  ""
3959
3979
  ]
3960
3980
  });
3961
- await context.repo.flush();
3981
+ await context.echoHost.flush();
3962
3982
  return {
3963
3983
  newRoot: context.newAutomergeRoot
3964
3984
  };
@@ -3973,14 +3993,14 @@ var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
3973
3993
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
3974
3994
  var NotarizationPlugin = class {
3975
3995
  constructor() {
3976
- this._ctx = new import_context13.Context(void 0, {
3996
+ this._ctx = new import_context12.Context(void 0, {
3977
3997
  F: __dxlog_file16,
3978
3998
  L: 62
3979
3999
  });
3980
- this._extensionOpened = new import_async16.Event();
4000
+ this._extensionOpened = new import_async15.Event();
3981
4001
  this._extensions = /* @__PURE__ */ new Set();
3982
- this._processedCredentials = new import_util9.ComplexSet(import_keys11.PublicKey.hash);
3983
- this._processCredentialsTriggers = new import_util9.ComplexMap(import_keys11.PublicKey.hash);
4002
+ this._processedCredentials = new import_util8.ComplexSet(import_keys11.PublicKey.hash);
4003
+ this._processCredentialsTriggers = new import_util8.ComplexMap(import_keys11.PublicKey.hash);
3984
4004
  }
3985
4005
  get hasWriter() {
3986
4006
  return !!this._writer;
@@ -4011,7 +4031,7 @@ var NotarizationPlugin = class {
4011
4031
  "'Credentials must have an id'"
4012
4032
  ]
4013
4033
  });
4014
- const errors = new import_async16.Trigger();
4034
+ const errors = new import_async15.Trigger();
4015
4035
  const ctx = this._ctx.derive({
4016
4036
  onError: (err) => {
4017
4037
  import_log14.log.warn("Notarization error", {
@@ -4028,7 +4048,7 @@ var NotarizationPlugin = class {
4028
4048
  });
4029
4049
  opCtx?.onDispose(() => ctx.dispose());
4030
4050
  if (timeout !== 0) {
4031
- (0, import_async16.scheduleTask)(ctx, () => {
4051
+ (0, import_async15.scheduleTask)(ctx, () => {
4032
4052
  import_log14.log.warn("Notarization timeout", {
4033
4053
  timeout,
4034
4054
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
@@ -4039,12 +4059,12 @@ var NotarizationPlugin = class {
4039
4059
  C: (f, a) => f(...a)
4040
4060
  });
4041
4061
  void ctx.dispose();
4042
- errors.throw(new import_async16.TimeoutError(timeout, "Notarization timed out"));
4062
+ errors.throw(new import_async15.TimeoutError(timeout, "Notarization timed out"));
4043
4063
  }, timeout);
4044
4064
  }
4045
4065
  const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
4046
4066
  const peersTried = /* @__PURE__ */ new Set();
4047
- const notarizeTask = new import_async16.DeferredTask(ctx, async () => {
4067
+ const notarizeTask = new import_async15.DeferredTask(ctx, async () => {
4048
4068
  try {
4049
4069
  if (this._extensions.size === 0) {
4050
4070
  return;
@@ -4062,7 +4082,7 @@ var NotarizationPlugin = class {
4062
4082
  C: (f, a) => f(...a)
4063
4083
  });
4064
4084
  peersTried.clear();
4065
- (0, import_async16.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
4085
+ (0, import_async15.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
4066
4086
  return;
4067
4087
  }
4068
4088
  peersTried.add(peer);
@@ -4084,7 +4104,7 @@ var NotarizationPlugin = class {
4084
4104
  S: this,
4085
4105
  C: (f, a) => f(...a)
4086
4106
  });
4087
- await (0, import_async16.sleep)(successDelay);
4107
+ await (0, import_async15.sleep)(successDelay);
4088
4108
  } catch (err) {
4089
4109
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
4090
4110
  import_log14.log.info("error notarizing (recoverable)", err, {
@@ -4101,7 +4121,7 @@ var NotarizationPlugin = class {
4101
4121
  this._extensionOpened.on(ctx, () => notarizeTask.schedule());
4102
4122
  try {
4103
4123
  await Promise.race([
4104
- (0, import_context13.rejectOnDispose)(ctx),
4124
+ (0, import_context12.rejectOnDispose)(ctx),
4105
4125
  allNotarized,
4106
4126
  errors.wait()
4107
4127
  ]);
@@ -4142,7 +4162,7 @@ var NotarizationPlugin = class {
4142
4162
  if (this._processedCredentials.has(id)) {
4143
4163
  return;
4144
4164
  }
4145
- await (0, import_util9.entry)(this._processCredentialsTriggers, id).orInsert(new import_async16.Trigger()).value.wait();
4165
+ await (0, import_util8.entry)(this._processCredentialsTriggers, id).orInsert(new import_async15.Trigger()).value.wait();
4146
4166
  }
4147
4167
  /**
4148
4168
  * Requests from other peers to notarize credentials.
@@ -4641,7 +4661,7 @@ var DataSpace = class {
4641
4661
  err
4642
4662
  }, {
4643
4663
  F: __dxlog_file17,
4644
- L: 431,
4664
+ L: 433,
4645
4665
  S: this,
4646
4666
  C: (f, a) => f(...a)
4647
4667
  });
@@ -4669,7 +4689,7 @@ var DataSpace = class {
4669
4689
  return null;
4670
4690
  }
4671
4691
  const { newRoot } = await runEpochMigration(ctx, {
4672
- repo: this._echoHost.automergeRepo,
4692
+ echoHost: this._echoHost,
4673
4693
  spaceId: this.id,
4674
4694
  spaceKey: this.key,
4675
4695
  migration: options.migration,
@@ -4727,7 +4747,7 @@ var DataSpace = class {
4727
4747
  state: import_services12.SpaceState[this._state]
4728
4748
  }, {
4729
4749
  F: __dxlog_file17,
4730
- L: 512,
4750
+ L: 514,
4731
4751
  S: this,
4732
4752
  C: (f, a) => f(...a)
4733
4753
  });
@@ -4870,12 +4890,12 @@ var DataSpaceManager = class {
4870
4890
  this._echoHost = _echoHost;
4871
4891
  this._invitationsManager = _invitationsManager;
4872
4892
  this._params = _params;
4873
- this._ctx = new import_context14.Context(void 0, {
4893
+ this._ctx = new import_context13.Context(void 0, {
4874
4894
  F: __dxlog_file18,
4875
4895
  L: 104
4876
4896
  });
4877
- this.updated = new import_async17.Event();
4878
- this._spaces = new import_util10.ComplexMap(import_keys12.PublicKey.hash);
4897
+ this.updated = new import_async16.Event();
4898
+ this._spaces = new import_util9.ComplexMap(import_keys12.PublicKey.hash);
4879
4899
  this._isOpen = false;
4880
4900
  this._instanceId = import_keys12.PublicKey.random().toHex();
4881
4901
  import_tracing6.trace.diagnostic({
@@ -4928,7 +4948,7 @@ var DataSpaceManager = class {
4928
4948
  S: this,
4929
4949
  C: (f, a) => f(...a)
4930
4950
  });
4931
- await (0, import_util10.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
4951
+ await (0, import_util9.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
4932
4952
  try {
4933
4953
  (0, import_log15.log)("load space", {
4934
4954
  spaceMetadata
@@ -5032,13 +5052,13 @@ var DataSpaceManager = class {
5032
5052
  return false;
5033
5053
  }
5034
5054
  switch (space.databaseRoot.getVersion()) {
5035
- case import_echo_protocol2.SpaceDocVersion.CURRENT: {
5055
+ case import_echo_protocol3.SpaceDocVersion.CURRENT: {
5036
5056
  const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_echo_schema2.TYPE_PROPERTIES) ?? [];
5037
5057
  return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
5038
5058
  }
5039
- case import_echo_protocol2.SpaceDocVersion.LEGACY: {
5059
+ case import_echo_protocol3.SpaceDocVersion.LEGACY: {
5040
5060
  const convertedDoc = await (0, import_echo_db2.convertLegacyReferences)(space.databaseRoot.docSync());
5041
- const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc, import_echo_protocol2.LEGACY_TYPE_PROPERTIES) ?? [];
5061
+ const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc, import_echo_protocol3.LEGACY_TYPE_PROPERTIES) ?? [];
5042
5062
  return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
5043
5063
  }
5044
5064
  default:
@@ -5059,7 +5079,7 @@ var DataSpaceManager = class {
5059
5079
  const document = await this._getSpaceRootDocument(space);
5060
5080
  const properties = {
5061
5081
  system: {
5062
- type: (0, import_echo_protocol2.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
5082
+ type: (0, import_echo_protocol3.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
5063
5083
  },
5064
5084
  data: {
5065
5085
  [DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
@@ -5070,7 +5090,7 @@ var DataSpaceManager = class {
5070
5090
  };
5071
5091
  const propertiesId = (0, import_echo_schema2.generateEchoId)();
5072
5092
  document.change((doc) => {
5073
- (0, import_util10.assignDeep)(doc, [
5093
+ (0, import_util9.assignDeep)(doc, [
5074
5094
  "objects",
5075
5095
  propertiesId
5076
5096
  ], properties);
@@ -5177,7 +5197,7 @@ var DataSpaceManager = class {
5177
5197
  * TODO(dmaretskyi): Consider removing.
5178
5198
  */
5179
5199
  async waitUntilSpaceReady(spaceKey) {
5180
- await (0, import_context14.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
5200
+ await (0, import_context13.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
5181
5201
  const space = this._spaces.get(spaceKey);
5182
5202
  return !!space && space.state === import_services14.SpaceState.READY;
5183
5203
  }));
@@ -5224,10 +5244,10 @@ var DataSpaceManager = class {
5224
5244
  swarmIdentity: {
5225
5245
  peerKey: this._signingContext.deviceKey,
5226
5246
  credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
5227
- credentialAuthenticator: (0, import_util10.deferFunction)(() => dataSpace.authVerifier.verifier)
5247
+ credentialAuthenticator: (0, import_util9.deferFunction)(() => dataSpace.authVerifier.verifier)
5228
5248
  },
5229
5249
  onAuthorizedConnection: (session) => {
5230
- session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline5.CredentialServerExtension(space));
5250
+ session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline4.CredentialServerExtension(space));
5231
5251
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
5232
5252
  remotePeerId: session.remotePeerId
5233
5253
  }));
@@ -5329,7 +5349,7 @@ var DataSpaceManager = class {
5329
5349
  const peers = presence.getPeersByIdentityKey(member.key);
5330
5350
  const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
5331
5351
  const sessionsToClose = sessions.filter((s) => {
5332
- return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline4.AuthStatus.FAILURE)) ?? false;
5352
+ return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
5333
5353
  });
5334
5354
  sessionsToClose.forEach((session) => {
5335
5355
  void session.close().catch(import_log15.log.error);
@@ -5402,19 +5422,19 @@ var DataSpaceManager = class {
5402
5422
  }
5403
5423
  };
5404
5424
  _ts_decorate5([
5405
- import_async17.synchronized
5425
+ import_async16.synchronized
5406
5426
  ], DataSpaceManager.prototype, "open", null);
5407
5427
  _ts_decorate5([
5408
- import_async17.synchronized
5428
+ import_async16.synchronized
5409
5429
  ], DataSpaceManager.prototype, "close", null);
5410
5430
  _ts_decorate5([
5411
- import_async17.synchronized
5431
+ import_async16.synchronized
5412
5432
  ], DataSpaceManager.prototype, "createSpace", null);
5413
5433
  _ts_decorate5([
5414
- import_async17.synchronized
5434
+ import_async16.synchronized
5415
5435
  ], DataSpaceManager.prototype, "acceptSpace", null);
5416
5436
  DataSpaceManager = _ts_decorate5([
5417
- (0, import_async17.trackLeaks)("open", "close")
5437
+ (0, import_async16.trackLeaks)("open", "close")
5418
5438
  ], DataSpaceManager);
5419
5439
  var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5420
5440
  var SpacesServiceImpl = class {
@@ -5482,7 +5502,7 @@ var SpacesServiceImpl = class {
5482
5502
  }
5483
5503
  querySpaces() {
5484
5504
  return new import_codec_protobuf11.Stream(({ next, ctx }) => {
5485
- const scheduler = new import_async18.UpdateScheduler(ctx, async () => {
5505
+ const scheduler = new import_async17.UpdateScheduler(ctx, async () => {
5486
5506
  const dataSpaceManager = await this._getDataSpaceManager();
5487
5507
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
5488
5508
  (0, import_log16.log)("update", {
@@ -5500,9 +5520,9 @@ var SpacesServiceImpl = class {
5500
5520
  }, {
5501
5521
  maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
5502
5522
  });
5503
- (0, import_async18.scheduleTask)(ctx, async () => {
5523
+ (0, import_async17.scheduleTask)(ctx, async () => {
5504
5524
  const dataSpaceManager = await this._getDataSpaceManager();
5505
- const subscriptions = new import_async18.EventSubscriptions();
5525
+ const subscriptions = new import_async17.EventSubscriptions();
5506
5526
  ctx.onDispose(() => subscriptions.clear());
5507
5527
  const subscribeSpaces = () => {
5508
5528
  subscriptions.clear();
@@ -5542,7 +5562,7 @@ var SpacesServiceImpl = class {
5542
5562
  }
5543
5563
  subscribeMessages({ spaceKey, channel }) {
5544
5564
  return new import_codec_protobuf11.Stream(({ ctx, next }) => {
5545
- (0, import_async18.scheduleTask)(ctx, async () => {
5565
+ (0, import_async17.scheduleTask)(ctx, async () => {
5546
5566
  const dataSpaceManager = await this._getDataSpaceManager();
5547
5567
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
5548
5568
  const handle = space.listen(getChannelId(channel), (message) => {
@@ -5561,7 +5581,7 @@ var SpacesServiceImpl = class {
5561
5581
  }
5562
5582
  };
5563
5583
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
5564
- (0, import_async18.scheduleTask)(ctx, async () => {
5584
+ (0, import_async17.scheduleTask)(ctx, async () => {
5565
5585
  await space.spaceState.addCredentialProcessor(processor);
5566
5586
  if (noTail) {
5567
5587
  close();
@@ -5700,7 +5720,8 @@ var SpacesServiceImpl = class {
5700
5720
  startDataTimeframe: void 0,
5701
5721
  currentDataTimeframe: void 0,
5702
5722
  targetDataTimeframe: void 0,
5703
- totalDataTimeframe: void 0
5723
+ totalDataTimeframe: void 0,
5724
+ spaceRootUrl: space.databaseRoot?.url
5704
5725
  },
5705
5726
  members: Array.from(space.inner.spaceState.members.values()).map((member) => {
5706
5727
  const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
@@ -5753,7 +5774,7 @@ function _ts_decorate6(decorators, target, key, desc) {
5753
5774
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5754
5775
  }
5755
5776
  var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5756
- var ServiceContext = class extends import_context15.Resource {
5777
+ var ServiceContext = class extends import_context14.Resource {
5757
5778
  constructor(storage, level, networkManager, signalManager, _runtimeParams) {
5758
5779
  super();
5759
5780
  this.storage = storage;
@@ -5761,11 +5782,11 @@ var ServiceContext = class extends import_context15.Resource {
5761
5782
  this.networkManager = networkManager;
5762
5783
  this.signalManager = signalManager;
5763
5784
  this._runtimeParams = _runtimeParams;
5764
- this.initialized = new import_async19.Trigger();
5785
+ this.initialized = new import_async18.Trigger();
5765
5786
  this._handlerFactories = /* @__PURE__ */ new Map();
5766
5787
  this._instanceId = import_keys13.PublicKey.random().toHex();
5767
- this.metadataStore = new import_echo_pipeline6.MetadataStore(storage.createDirectory("metadata"));
5768
- this.snapshotStore = new import_echo_pipeline6.SnapshotStore(storage.createDirectory("snapshots"));
5788
+ this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
5789
+ this.snapshotStore = new import_echo_pipeline5.SnapshotStore(storage.createDirectory("snapshots"));
5769
5790
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
5770
5791
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
5771
5792
  this.feedStore = new import_feed_store6.FeedStore({
@@ -5773,12 +5794,12 @@ var ServiceContext = class extends import_context15.Resource {
5773
5794
  root: storage.createDirectory("feeds"),
5774
5795
  signer: this.keyring,
5775
5796
  hypercore: {
5776
- valueEncoding: import_echo_pipeline6.valueEncoding,
5797
+ valueEncoding: import_echo_pipeline5.valueEncoding,
5777
5798
  stats: true
5778
5799
  }
5779
5800
  })
5780
5801
  });
5781
- this.spaceManager = new import_echo_pipeline6.SpaceManager({
5802
+ this.spaceManager = new import_echo_pipeline5.SpaceManager({
5782
5803
  feedStore: this.feedStore,
5783
5804
  networkManager: this.networkManager,
5784
5805
  blobStore: this.blobStore,
@@ -5869,7 +5890,7 @@ var ServiceContext = class extends import_context15.Resource {
5869
5890
  }
5870
5891
  async createIdentity(params = {}) {
5871
5892
  const identity = await this.identityManager.createIdentity(params);
5872
- await this._initialize(new import_context15.Context(void 0, {
5893
+ await this._initialize(new import_context14.Context(void 0, {
5873
5894
  F: __dxlog_file20,
5874
5895
  L: 187
5875
5896
  }));
@@ -5898,7 +5919,7 @@ var ServiceContext = class extends import_context15.Resource {
5898
5919
  }
5899
5920
  async _acceptIdentity(params) {
5900
5921
  const identity = await this.identityManager.acceptIdentity(params);
5901
- await this._initialize(new import_context15.Context(void 0, {
5922
+ await this._initialize(new import_context14.Context(void 0, {
5902
5923
  F: __dxlog_file20,
5903
5924
  L: 209
5904
5925
  }));
@@ -6011,7 +6032,7 @@ _ts_decorate6([
6011
6032
  import_tracing8.trace.span()
6012
6033
  ], ServiceContext.prototype, "_initialize", null);
6013
6034
  ServiceContext = _ts_decorate6([
6014
- (0, import_util11.safeInstanceof)("dxos.client-services.ServiceContext"),
6035
+ (0, import_util10.safeInstanceof)("dxos.client-services.ServiceContext"),
6015
6036
  import_tracing8.trace.resource()
6016
6037
  ], ServiceContext);
6017
6038
  var ServiceRegistry = class {
@@ -6091,7 +6112,7 @@ _ts_decorate7([
6091
6112
  ], Lock.prototype, "lockKey", null);
6092
6113
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
6093
6114
  var getRootPath = (config) => {
6094
- const { dataRoot = (0, import_util12.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
6115
+ const { dataRoot = (0, import_util11.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
6095
6116
  return `${dataRoot}/`;
6096
6117
  };
6097
6118
  var isPersistent = (config) => {
@@ -6219,14 +6240,15 @@ var exportProfileData = async ({ storage, level }) => {
6219
6240
  return archive;
6220
6241
  };
6221
6242
  var importProfileData = async ({ storage, level }, archive) => {
6222
- const batch = level.batch();
6243
+ let batch = level.batch();
6244
+ let count = 0;
6223
6245
  for (const entry2 of archive.storage) {
6224
6246
  switch (entry2.type) {
6225
6247
  case import_protocols15.ProfileArchiveEntryType.FILE: {
6226
6248
  const directory = await storage.createDirectory();
6227
6249
  (0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
6228
6250
  F: __dxlog_file22,
6229
- L: 78,
6251
+ L: 79,
6230
6252
  S: void 0,
6231
6253
  A: [
6232
6254
  "typeof entry.key === 'string'",
@@ -6236,21 +6258,21 @@ var importProfileData = async ({ storage, level }, archive) => {
6236
6258
  const file = await directory.getOrCreateFile(entry2.key);
6237
6259
  (0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
6238
6260
  F: __dxlog_file22,
6239
- L: 80,
6261
+ L: 81,
6240
6262
  S: void 0,
6241
6263
  A: [
6242
6264
  "entry.value instanceof Uint8Array",
6243
6265
  "'Invalid value type'"
6244
6266
  ]
6245
6267
  });
6246
- await file.write(0, (0, import_util13.arrayToBuffer)(entry2.value));
6268
+ await file.write(0, (0, import_util12.arrayToBuffer)(entry2.value));
6247
6269
  await file.close();
6248
6270
  break;
6249
6271
  }
6250
6272
  case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
6251
6273
  (0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
6252
6274
  F: __dxlog_file22,
6253
- L: 86,
6275
+ L: 87,
6254
6276
  S: void 0,
6255
6277
  A: [
6256
6278
  "entry.key instanceof Uint8Array",
@@ -6259,7 +6281,7 @@ var importProfileData = async ({ storage, level }, archive) => {
6259
6281
  });
6260
6282
  (0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
6261
6283
  F: __dxlog_file22,
6262
- L: 87,
6284
+ L: 88,
6263
6285
  S: void 0,
6264
6286
  A: [
6265
6287
  "entry.value instanceof Uint8Array",
@@ -6275,7 +6297,27 @@ var importProfileData = async ({ storage, level }, archive) => {
6275
6297
  default:
6276
6298
  throw new Error(`Invalid entry type: ${entry2.type}`);
6277
6299
  }
6300
+ if (++count % 1e3 === 0) {
6301
+ await batch.write();
6302
+ batch = level.batch();
6303
+ import_log19.log.info("importing", {
6304
+ count,
6305
+ total: archive.storage.length,
6306
+ progress: `${(count / archive.storage.length * 100).toFixed()}%`
6307
+ }, {
6308
+ F: __dxlog_file22,
6309
+ L: 101,
6310
+ S: void 0,
6311
+ C: (f, a) => f(...a)
6312
+ });
6313
+ }
6278
6314
  }
6315
+ import_log19.log.info("committing changes..", void 0, {
6316
+ F: __dxlog_file22,
6317
+ L: 109,
6318
+ S: void 0,
6319
+ C: (f, a) => f(...a)
6320
+ });
6279
6321
  await batch.write();
6280
6322
  };
6281
6323
  var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
@@ -6337,7 +6379,7 @@ var DevicesServiceImpl = class {
6337
6379
  presenceSubscribed = true;
6338
6380
  }
6339
6381
  };
6340
- const subscriptions = new import_async21.EventSubscriptions();
6382
+ const subscriptions = new import_async20.EventSubscriptions();
6341
6383
  if (this._identityManager.identity) {
6342
6384
  subscribeIdentity();
6343
6385
  subscribePresence();
@@ -6377,7 +6419,7 @@ var DiagnosticsCollector = class {
6377
6419
  client: clientDiagnostics,
6378
6420
  broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
6379
6421
  };
6380
- return JSON.parse(JSON.stringify(diagnostics, (0, import_util14.jsonKeyReplacer)(options)));
6422
+ return JSON.parse(JSON.stringify(diagnostics, (0, import_util13.jsonKeyReplacer)(options)));
6381
6423
  }
6382
6424
  };
6383
6425
  var findSystemServiceProvider = () => {
@@ -6387,7 +6429,7 @@ var findSystemServiceProvider = () => {
6387
6429
  };
6388
6430
  var findConfigs = () => {
6389
6431
  const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
6390
- return configs.map((r) => r.instance.deref()).filter(import_util14.nonNullable);
6432
+ return configs.map((r) => r.instance.deref()).filter(import_util13.nonNullable);
6391
6433
  };
6392
6434
  var ContactsServiceImpl = class {
6393
6435
  constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
@@ -6428,7 +6470,7 @@ var ContactsServiceImpl = class {
6428
6470
  });
6429
6471
  }
6430
6472
  return acc;
6431
- }, new import_util16.ComplexMap(import_keys17.PublicKey.hash));
6473
+ }, new import_util15.ComplexMap(import_keys17.PublicKey.hash));
6432
6474
  return {
6433
6475
  contacts: [
6434
6476
  ...contacts.values()
@@ -6436,16 +6478,16 @@ var ContactsServiceImpl = class {
6436
6478
  };
6437
6479
  }
6438
6480
  queryContacts() {
6439
- const subscribedSpaceKeySet = new import_util16.ComplexSet(import_keys17.PublicKey.hash);
6481
+ const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys17.PublicKey.hash);
6440
6482
  return new import_codec_protobuf13.Stream(({ next, ctx }) => {
6441
- const pushUpdateTask = new import_async22.UpdateScheduler(ctx, async () => {
6483
+ const pushUpdateTask = new import_async21.UpdateScheduler(ctx, async () => {
6442
6484
  const contacts = await this.getContacts();
6443
6485
  next(contacts);
6444
6486
  }, {
6445
6487
  maxFrequency: 2
6446
6488
  });
6447
- (0, import_async22.scheduleTask)(ctx, async () => {
6448
- const subscriptions = new import_async22.EventSubscriptions();
6489
+ (0, import_async21.scheduleTask)(ctx, async () => {
6490
+ const subscriptions = new import_async21.EventSubscriptions();
6449
6491
  ctx.onDispose(() => subscriptions.clear());
6450
6492
  const subscribeToSpaceAndUpdate = () => {
6451
6493
  const oldSetSize = subscribedSpaceKeySet.size;
@@ -6468,7 +6510,7 @@ var ContactsServiceImpl = class {
6468
6510
  };
6469
6511
  var LoggingServiceImpl = class {
6470
6512
  constructor() {
6471
- this._logs = new import_async23.Event();
6513
+ this._logs = new import_async22.Event();
6472
6514
  this._started = Date.now();
6473
6515
  this._sessionId = import_keys18.PublicKey.random().toHex();
6474
6516
  this._logProcessor = (_config, entry2) => {
@@ -6484,15 +6526,15 @@ var LoggingServiceImpl = class {
6484
6526
  }
6485
6527
  async controlMetrics({ reset, record }) {
6486
6528
  if (reset) {
6487
- import_util17.tracer.clear();
6529
+ import_util16.tracer.clear();
6488
6530
  }
6489
6531
  if (record === true) {
6490
- import_util17.tracer.start();
6532
+ import_util16.tracer.start();
6491
6533
  } else if (record === false) {
6492
- import_util17.tracer.stop();
6534
+ import_util16.tracer.stop();
6493
6535
  }
6494
6536
  return {
6495
- recording: import_util17.tracer.recording
6537
+ recording: import_util16.tracer.recording
6496
6538
  };
6497
6539
  }
6498
6540
  /**
@@ -6500,10 +6542,10 @@ var LoggingServiceImpl = class {
6500
6542
  */
6501
6543
  queryMetrics({ interval = 5e3 }) {
6502
6544
  const getNumericalValues = (key) => {
6503
- const events = import_util17.tracer.get(key) ?? [];
6545
+ const events = import_util16.tracer.get(key) ?? [];
6504
6546
  return {
6505
6547
  key,
6506
- stats: (0, import_util17.numericalValues)(events, "duration")
6548
+ stats: (0, import_util16.numericalValues)(events, "duration")
6507
6549
  };
6508
6550
  };
6509
6551
  return new import_codec_protobuf14.Stream(({ next }) => {
@@ -6541,7 +6583,7 @@ var LoggingServiceImpl = class {
6541
6583
  }
6542
6584
  const record = {
6543
6585
  ...entry2,
6544
- context: (0, import_util17.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
6586
+ context: (0, import_util16.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
6545
6587
  timestamp: /* @__PURE__ */ new Date(),
6546
6588
  meta: {
6547
6589
  // TODO(dmaretskyi): Fix proto.
@@ -6550,7 +6592,7 @@ var LoggingServiceImpl = class {
6550
6592
  scope: {
6551
6593
  hostSessionId: this._sessionId,
6552
6594
  uptimeSeconds: (Date.now() - this._started) / 1e3,
6553
- name: (0, import_util17.getDebugName)(entry2.meta?.S)
6595
+ name: (0, import_util16.getDebugName)(entry2.meta?.S)
6554
6596
  }
6555
6597
  }
6556
6598
  };
@@ -6631,7 +6673,7 @@ var SystemServiceImpl = class {
6631
6673
  const diagnostics = await this._getDiagnostics();
6632
6674
  return {
6633
6675
  timestamp: /* @__PURE__ */ new Date(),
6634
- diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util18.jsonKeyReplacer)({
6676
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
6635
6677
  truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
6636
6678
  humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
6637
6679
  })))
@@ -6688,7 +6730,7 @@ var ClientServicesHost = class {
6688
6730
  runtimeParams
6689
6731
  } = {}) {
6690
6732
  this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
6691
- this._statusUpdate = new import_async20.Event();
6733
+ this._statusUpdate = new import_async19.Event();
6692
6734
  this._opening = false;
6693
6735
  this._open = false;
6694
6736
  this._storage = storage;
@@ -6707,7 +6749,7 @@ var ClientServicesHost = class {
6707
6749
  lockKey,
6708
6750
  onAcquire: () => {
6709
6751
  if (!this._opening) {
6710
- void this.open(new import_context16.Context(void 0, {
6752
+ void this.open(new import_context15.Context(void 0, {
6711
6753
  F: __dxlog_file24,
6712
6754
  L: 121
6713
6755
  }));
@@ -7030,11 +7072,11 @@ _ts_decorate8([
7030
7072
  import_tracing9.trace.info()
7031
7073
  ], ClientServicesHost.prototype, "_open", void 0);
7032
7074
  _ts_decorate8([
7033
- import_async20.synchronized,
7075
+ import_async19.synchronized,
7034
7076
  import_tracing9.trace.span()
7035
7077
  ], ClientServicesHost.prototype, "open", null);
7036
7078
  _ts_decorate8([
7037
- import_async20.synchronized,
7079
+ import_async19.synchronized,
7038
7080
  import_tracing9.trace.span()
7039
7081
  ], ClientServicesHost.prototype, "close", null);
7040
7082
  ClientServicesHost = _ts_decorate8([
@@ -7084,4 +7126,4 @@ ClientServicesHost = _ts_decorate8([
7084
7126
  subscribeToSpaces,
7085
7127
  subscribeToSwarmInfo
7086
7128
  });
7087
- //# sourceMappingURL=chunk-QN3UVJ5U.cjs.map
7129
+ //# sourceMappingURL=chunk-E6HB26ZB.cjs.map