@dxos/client-services 0.4.10-main.93fda5f → 0.4.10-main.a14f081

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_4TLGRMKO_exports = {};
30
- __export(chunk_4TLGRMKO_exports, {
29
+ var chunk_OUU5LAAY_exports = {};
30
+ __export(chunk_OUU5LAAY_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -60,7 +60,7 @@ __export(chunk_4TLGRMKO_exports, {
60
60
  subscribeToSpaces: () => subscribeToSpaces,
61
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
62
  });
63
- module.exports = __toCommonJS(chunk_4TLGRMKO_exports);
63
+ module.exports = __toCommonJS(chunk_OUU5LAAY_exports);
64
64
  var import_async = require("@dxos/async");
65
65
  var import_codec_protobuf = require("@dxos/codec-protobuf");
66
66
  var import_feed_store = require("@dxos/feed-store");
@@ -158,7 +158,9 @@ var import_async10 = require("@dxos/async");
158
158
  var import_client_protocol3 = require("@dxos/client-protocol");
159
159
  var import_context7 = require("@dxos/context");
160
160
  var import_debug3 = require("@dxos/debug");
161
+ var import_echo_db = require("@dxos/echo-db");
161
162
  var import_echo_pipeline = require("@dxos/echo-pipeline");
163
+ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
162
164
  var import_invariant10 = require("@dxos/invariant");
163
165
  var import_keys7 = require("@dxos/keys");
164
166
  var import_log8 = require("@dxos/log");
@@ -203,7 +205,7 @@ var import_async15 = require("@dxos/async");
203
205
  var import_context10 = require("@dxos/context");
204
206
  var import_credentials15 = require("@dxos/credentials");
205
207
  var import_debug6 = require("@dxos/debug");
206
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
208
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
207
209
  var import_feed_store4 = require("@dxos/feed-store");
208
210
  var import_indexing = require("@dxos/indexing");
209
211
  var import_invariant14 = require("@dxos/invariant");
@@ -229,7 +231,7 @@ var import_util8 = require("@dxos/util");
229
231
  var import_async16 = require("@dxos/async");
230
232
  var import_client_protocol5 = require("@dxos/client-protocol");
231
233
  var import_context11 = require("@dxos/context");
232
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
234
+ var import_echo_pipeline4 = require("@dxos/echo-pipeline");
233
235
  var import_echo_schema = require("@dxos/echo-schema");
234
236
  var import_indexing2 = require("@dxos/indexing");
235
237
  var import_invariant16 = require("@dxos/invariant");
@@ -2884,7 +2886,7 @@ var getPlatform = () => {
2884
2886
  };
2885
2887
  }
2886
2888
  };
2887
- var DXOS_VERSION = "0.4.10-main.93fda5f";
2889
+ var DXOS_VERSION = "0.4.10-main.a14f081";
2888
2890
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2889
2891
  var DEFAULT_TIMEOUT = 1e3;
2890
2892
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -3326,7 +3328,7 @@ var DataSpace = class {
3326
3328
  state: import_services9.SpaceState[this._state]
3327
3329
  }, {
3328
3330
  F: __dxlog_file12,
3329
- L: 132,
3331
+ L: 140,
3330
3332
  S: this,
3331
3333
  C: (f, a) => f(...a)
3332
3334
  });
@@ -3376,7 +3378,7 @@ var DataSpace = class {
3376
3378
  state: import_services9.SpaceState[this._state]
3377
3379
  }, {
3378
3380
  F: __dxlog_file12,
3379
- L: 190,
3381
+ L: 198,
3380
3382
  S: this,
3381
3383
  C: (f, a) => f(...a)
3382
3384
  });
@@ -3394,7 +3396,7 @@ var DataSpace = class {
3394
3396
  state: import_services9.SpaceState[this._state]
3395
3397
  }, {
3396
3398
  F: __dxlog_file12,
3397
- L: 204,
3399
+ L: 212,
3398
3400
  S: this,
3399
3401
  C: (f, a) => f(...a)
3400
3402
  });
@@ -3426,7 +3428,7 @@ var DataSpace = class {
3426
3428
  if (err instanceof import_protocols8.CancelledError || err instanceof import_context7.ContextDisposedError) {
3427
3429
  (0, import_log8.log)("data pipeline initialization cancelled", err, {
3428
3430
  F: __dxlog_file12,
3429
- L: 237,
3431
+ L: 245,
3430
3432
  S: this,
3431
3433
  C: (f, a) => f(...a)
3432
3434
  });
@@ -3434,7 +3436,7 @@ var DataSpace = class {
3434
3436
  }
3435
3437
  import_log8.log.error("Error initializing data pipeline", err, {
3436
3438
  F: __dxlog_file12,
3437
- L: 241,
3439
+ L: 249,
3438
3440
  S: this,
3439
3441
  C: (f, a) => f(...a)
3440
3442
  });
@@ -3443,7 +3445,7 @@ var DataSpace = class {
3443
3445
  state: import_services9.SpaceState[this._state]
3444
3446
  }, {
3445
3447
  F: __dxlog_file12,
3446
- L: 243,
3448
+ L: 251,
3447
3449
  S: this,
3448
3450
  C: (f, a) => f(...a)
3449
3451
  });
@@ -3463,7 +3465,7 @@ var DataSpace = class {
3463
3465
  state: import_services9.SpaceState[this._state]
3464
3466
  }, {
3465
3467
  F: __dxlog_file12,
3466
- L: 259,
3468
+ L: 267,
3467
3469
  S: this,
3468
3470
  C: (f, a) => f(...a)
3469
3471
  });
@@ -3473,7 +3475,7 @@ var DataSpace = class {
3473
3475
  await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3474
3476
  (0, import_log8.log)("data pipeline ready", void 0, {
3475
3477
  F: __dxlog_file12,
3476
- L: 271,
3478
+ L: 279,
3477
3479
  S: this,
3478
3480
  C: (f, a) => f(...a)
3479
3481
  });
@@ -3483,7 +3485,7 @@ var DataSpace = class {
3483
3485
  state: import_services9.SpaceState[this._state]
3484
3486
  }, {
3485
3487
  F: __dxlog_file12,
3486
- L: 275,
3488
+ L: 283,
3487
3489
  S: this,
3488
3490
  C: (f, a) => f(...a)
3489
3491
  });
@@ -3499,7 +3501,7 @@ var DataSpace = class {
3499
3501
  await this._createWritableFeeds();
3500
3502
  (0, import_log8.log)("writable feeds created", void 0, {
3501
3503
  F: __dxlog_file12,
3502
- L: 291,
3504
+ L: 299,
3503
3505
  S: this,
3504
3506
  C: (f, a) => f(...a)
3505
3507
  });
@@ -3562,7 +3564,7 @@ var DataSpace = class {
3562
3564
  rootUrl
3563
3565
  }, {
3564
3566
  F: __dxlog_file12,
3565
- L: 357,
3567
+ L: 365,
3566
3568
  S: this,
3567
3569
  C: (f, a) => f(...a)
3568
3570
  });
@@ -3594,7 +3596,7 @@ var DataSpace = class {
3594
3596
  err
3595
3597
  }, {
3596
3598
  F: __dxlog_file12,
3597
- L: 380,
3599
+ L: 388,
3598
3600
  S: this,
3599
3601
  C: (f, a) => f(...a)
3600
3602
  });
@@ -3649,13 +3651,73 @@ var DataSpace = class {
3649
3651
  const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
3650
3652
  (0, import_invariant10.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3651
3653
  F: __dxlog_file12,
3652
- L: 430,
3654
+ L: 438,
3655
+ S: this,
3656
+ A: [
3657
+ "typeof newRoot.url === 'string' && newRoot.url.length > 0",
3658
+ ""
3659
+ ]
3660
+ });
3661
+ epoch = {
3662
+ previousId: this._automergeSpaceState.lastEpoch?.id,
3663
+ number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
3664
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
3665
+ automergeRoot: newRoot.url
3666
+ };
3667
+ }
3668
+ break;
3669
+ case import_services9.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
3670
+ {
3671
+ import_log8.log.info("Fragmenting", void 0, {
3672
+ F: __dxlog_file12,
3673
+ L: 450,
3674
+ S: this,
3675
+ C: (f, a) => f(...a)
3676
+ });
3677
+ const currentRootUrl = this._automergeSpaceState.rootUrl;
3678
+ const rootHandle = this._automergeHost.repo.find(currentRootUrl);
3679
+ await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
3680
+ const objects = Object.entries(rootHandle.docSync().objects);
3681
+ const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_db.TYPE_PROPERTIES);
3682
+ const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
3683
+ (0, import_invariant10.invariant)(properties, "Properties not found", {
3684
+ F: __dxlog_file12,
3685
+ L: 460,
3686
+ S: this,
3687
+ A: [
3688
+ "properties",
3689
+ "'Properties not found'"
3690
+ ]
3691
+ });
3692
+ const newSpaceDoc = {
3693
+ ...rootHandle.docSync(),
3694
+ objects: Object.fromEntries([
3695
+ properties
3696
+ ])
3697
+ };
3698
+ const newRoot = this._automergeHost.repo.create(newSpaceDoc);
3699
+ (0, import_invariant10.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3700
+ F: __dxlog_file12,
3701
+ L: 465,
3653
3702
  S: this,
3654
3703
  A: [
3655
3704
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
3656
3705
  ""
3657
3706
  ]
3658
3707
  });
3708
+ const docLoader = new import_echo_pipeline2.AutomergeDocumentLoaderImpl(this.key, this._automergeHost.repo);
3709
+ await docLoader.loadSpaceRootDocHandle(this._ctx, {
3710
+ rootUrl: newRoot.url
3711
+ });
3712
+ otherObjects.forEach(([key, value]) => {
3713
+ const handle = docLoader.createDocumentForObject(key);
3714
+ handle.change((doc) => {
3715
+ (0, import_util4.assignDeep)(doc, [
3716
+ "objects",
3717
+ key
3718
+ ], value);
3719
+ });
3720
+ });
3659
3721
  epoch = {
3660
3722
  previousId: this._automergeSpaceState.lastEpoch?.id,
3661
3723
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
@@ -3705,7 +3767,7 @@ var DataSpace = class {
3705
3767
  state: import_services9.SpaceState[this._state]
3706
3768
  }, {
3707
3769
  F: __dxlog_file12,
3708
- L: 482,
3770
+ L: 531,
3709
3771
  S: this,
3710
3772
  C: (f, a) => f(...a)
3711
3773
  });
@@ -4463,8 +4525,8 @@ var ServiceContext = class {
4463
4525
  this.initialized = new import_async15.Trigger();
4464
4526
  this._handlerFactories = /* @__PURE__ */ new Map();
4465
4527
  this._instanceId = import_keys10.PublicKey.random().toHex();
4466
- this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
4467
- this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
4528
+ this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
4529
+ this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
4468
4530
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
4469
4531
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
4470
4532
  this.feedStore = new import_feed_store4.FeedStore({
@@ -4472,12 +4534,12 @@ var ServiceContext = class {
4472
4534
  root: storage.createDirectory("feeds"),
4473
4535
  signer: this.keyring,
4474
4536
  hypercore: {
4475
- valueEncoding: import_echo_pipeline2.valueEncoding,
4537
+ valueEncoding: import_echo_pipeline3.valueEncoding,
4476
4538
  stats: true
4477
4539
  }
4478
4540
  })
4479
4541
  });
4480
- this.spaceManager = new import_echo_pipeline2.SpaceManager({
4542
+ this.spaceManager = new import_echo_pipeline3.SpaceManager({
4481
4543
  feedStore: this.feedStore,
4482
4544
  networkManager: this.networkManager,
4483
4545
  blobStore: this.blobStore,
@@ -4488,7 +4550,7 @@ var ServiceContext = class {
4488
4550
  this.indexMetadata = new import_indexing.IndexMetadataStore({
4489
4551
  directory: storage.createDirectory("index-metadata")
4490
4552
  });
4491
- this.automergeHost = new import_echo_pipeline2.AutomergeHost({
4553
+ this.automergeHost = new import_echo_pipeline3.AutomergeHost({
4492
4554
  directory: storage.createDirectory("automerge"),
4493
4555
  metadata: this.indexMetadata
4494
4556
  });
@@ -5329,7 +5391,7 @@ var ClientServicesHost = class {
5329
5391
  await this._serviceContext.initialized.wait();
5330
5392
  return this._serviceContext.dataSpaceManager;
5331
5393
  }),
5332
- DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.automergeHost),
5394
+ DataService: new import_echo_pipeline4.DataServiceImpl(this._serviceContext.automergeHost),
5333
5395
  IndexService: new import_indexing2.IndexServiceImpl({
5334
5396
  indexer: this._serviceContext.indexer,
5335
5397
  automergeHost: this._serviceContext.automergeHost
@@ -5536,4 +5598,4 @@ ClientServicesHost = _ts_decorate8([
5536
5598
  subscribeToSpaces,
5537
5599
  subscribeToSwarmInfo
5538
5600
  });
5539
- //# sourceMappingURL=chunk-4TLGRMKO.cjs.map
5601
+ //# sourceMappingURL=chunk-OUU5LAAY.cjs.map