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

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.
@@ -2769,7 +2769,7 @@ var getPlatform = () => {
2769
2769
  };
2770
2770
 
2771
2771
  // packages/sdk/client-services/src/version.ts
2772
- var DXOS_VERSION = "0.4.10-main.93fda5f";
2772
+ var DXOS_VERSION = "0.4.10-main.b112538";
2773
2773
 
2774
2774
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2775
2775
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -2885,7 +2885,9 @@ import { Event as Event6, asyncTimeout, scheduleTask as scheduleTask5, sleep as
2885
2885
  import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
2886
2886
  import { cancelWithContext as cancelWithContext2, Context as Context8, ContextDisposedError } from "@dxos/context";
2887
2887
  import { timed, warnAfterTimeout } from "@dxos/debug";
2888
+ import { TYPE_PROPERTIES } from "@dxos/echo-db";
2888
2889
  import { createMappedFeedWriter } from "@dxos/echo-pipeline";
2890
+ import { AutomergeDocumentLoaderImpl } from "@dxos/echo-pipeline";
2889
2891
  import { failedInvariant, invariant as invariant11 } from "@dxos/invariant";
2890
2892
  import { PublicKey as PublicKey8 } from "@dxos/keys";
2891
2893
  import { log as log9 } from "@dxos/log";
@@ -2894,7 +2896,7 @@ import { SpaceState, CreateEpochRequest } from "@dxos/protocols/proto/dxos/clien
2894
2896
  import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
2895
2897
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
2896
2898
  import { trace as trace6 } from "@dxos/tracing";
2897
- import { ComplexSet as ComplexSet3 } from "@dxos/util";
2899
+ import { ComplexSet as ComplexSet3, assignDeep } from "@dxos/util";
2898
2900
 
2899
2901
  // packages/sdk/client-services/src/packlets/spaces/automerge-space-state.ts
2900
2902
  import { Event as Event4 } from "@dxos/async";
@@ -3249,7 +3251,7 @@ var DataSpace = class {
3249
3251
  state: SpaceState[this._state]
3250
3252
  }, {
3251
3253
  F: __dxlog_file12,
3252
- L: 132,
3254
+ L: 140,
3253
3255
  S: this,
3254
3256
  C: (f, a) => f(...a)
3255
3257
  });
@@ -3299,7 +3301,7 @@ var DataSpace = class {
3299
3301
  state: SpaceState[this._state]
3300
3302
  }, {
3301
3303
  F: __dxlog_file12,
3302
- L: 190,
3304
+ L: 198,
3303
3305
  S: this,
3304
3306
  C: (f, a) => f(...a)
3305
3307
  });
@@ -3317,7 +3319,7 @@ var DataSpace = class {
3317
3319
  state: SpaceState[this._state]
3318
3320
  }, {
3319
3321
  F: __dxlog_file12,
3320
- L: 204,
3322
+ L: 212,
3321
3323
  S: this,
3322
3324
  C: (f, a) => f(...a)
3323
3325
  });
@@ -3349,7 +3351,7 @@ var DataSpace = class {
3349
3351
  if (err instanceof CancelledError || err instanceof ContextDisposedError) {
3350
3352
  log9("data pipeline initialization cancelled", err, {
3351
3353
  F: __dxlog_file12,
3352
- L: 237,
3354
+ L: 245,
3353
3355
  S: this,
3354
3356
  C: (f, a) => f(...a)
3355
3357
  });
@@ -3357,7 +3359,7 @@ var DataSpace = class {
3357
3359
  }
3358
3360
  log9.error("Error initializing data pipeline", err, {
3359
3361
  F: __dxlog_file12,
3360
- L: 241,
3362
+ L: 249,
3361
3363
  S: this,
3362
3364
  C: (f, a) => f(...a)
3363
3365
  });
@@ -3366,7 +3368,7 @@ var DataSpace = class {
3366
3368
  state: SpaceState[this._state]
3367
3369
  }, {
3368
3370
  F: __dxlog_file12,
3369
- L: 243,
3371
+ L: 251,
3370
3372
  S: this,
3371
3373
  C: (f, a) => f(...a)
3372
3374
  });
@@ -3386,7 +3388,7 @@ var DataSpace = class {
3386
3388
  state: SpaceState[this._state]
3387
3389
  }, {
3388
3390
  F: __dxlog_file12,
3389
- L: 259,
3391
+ L: 267,
3390
3392
  S: this,
3391
3393
  C: (f, a) => f(...a)
3392
3394
  });
@@ -3396,7 +3398,7 @@ var DataSpace = class {
3396
3398
  await cancelWithContext2(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3397
3399
  log9("data pipeline ready", void 0, {
3398
3400
  F: __dxlog_file12,
3399
- L: 271,
3401
+ L: 279,
3400
3402
  S: this,
3401
3403
  C: (f, a) => f(...a)
3402
3404
  });
@@ -3406,7 +3408,7 @@ var DataSpace = class {
3406
3408
  state: SpaceState[this._state]
3407
3409
  }, {
3408
3410
  F: __dxlog_file12,
3409
- L: 275,
3411
+ L: 283,
3410
3412
  S: this,
3411
3413
  C: (f, a) => f(...a)
3412
3414
  });
@@ -3422,7 +3424,7 @@ var DataSpace = class {
3422
3424
  await this._createWritableFeeds();
3423
3425
  log9("writable feeds created", void 0, {
3424
3426
  F: __dxlog_file12,
3425
- L: 291,
3427
+ L: 299,
3426
3428
  S: this,
3427
3429
  C: (f, a) => f(...a)
3428
3430
  });
@@ -3485,7 +3487,7 @@ var DataSpace = class {
3485
3487
  rootUrl
3486
3488
  }, {
3487
3489
  F: __dxlog_file12,
3488
- L: 357,
3490
+ L: 365,
3489
3491
  S: this,
3490
3492
  C: (f, a) => f(...a)
3491
3493
  });
@@ -3517,7 +3519,7 @@ var DataSpace = class {
3517
3519
  err
3518
3520
  }, {
3519
3521
  F: __dxlog_file12,
3520
- L: 380,
3522
+ L: 388,
3521
3523
  S: this,
3522
3524
  C: (f, a) => f(...a)
3523
3525
  });
@@ -3572,13 +3574,73 @@ var DataSpace = class {
3572
3574
  const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
3573
3575
  invariant11(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3574
3576
  F: __dxlog_file12,
3575
- L: 430,
3577
+ L: 438,
3578
+ S: this,
3579
+ A: [
3580
+ "typeof newRoot.url === 'string' && newRoot.url.length > 0",
3581
+ ""
3582
+ ]
3583
+ });
3584
+ epoch = {
3585
+ previousId: this._automergeSpaceState.lastEpoch?.id,
3586
+ number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
3587
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
3588
+ automergeRoot: newRoot.url
3589
+ };
3590
+ }
3591
+ break;
3592
+ case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
3593
+ {
3594
+ log9.info("Fragmenting", void 0, {
3595
+ F: __dxlog_file12,
3596
+ L: 450,
3597
+ S: this,
3598
+ C: (f, a) => f(...a)
3599
+ });
3600
+ const currentRootUrl = this._automergeSpaceState.rootUrl;
3601
+ const rootHandle = this._automergeHost.repo.find(currentRootUrl);
3602
+ await cancelWithContext2(this._ctx, asyncTimeout(rootHandle.whenReady(), 1e4));
3603
+ const objects = Object.entries(rootHandle.docSync().objects);
3604
+ const properties = objects.find(([_, value]) => value.system.type?.itemId === TYPE_PROPERTIES);
3605
+ const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
3606
+ invariant11(properties, "Properties not found", {
3607
+ F: __dxlog_file12,
3608
+ L: 460,
3609
+ S: this,
3610
+ A: [
3611
+ "properties",
3612
+ "'Properties not found'"
3613
+ ]
3614
+ });
3615
+ const newSpaceDoc = {
3616
+ ...rootHandle.docSync(),
3617
+ objects: Object.fromEntries([
3618
+ properties
3619
+ ])
3620
+ };
3621
+ const newRoot = this._automergeHost.repo.create(newSpaceDoc);
3622
+ invariant11(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3623
+ F: __dxlog_file12,
3624
+ L: 465,
3576
3625
  S: this,
3577
3626
  A: [
3578
3627
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
3579
3628
  ""
3580
3629
  ]
3581
3630
  });
3631
+ const docLoader = new AutomergeDocumentLoaderImpl(this.key, this._automergeHost.repo);
3632
+ await docLoader.loadSpaceRootDocHandle(this._ctx, {
3633
+ rootUrl: newRoot.url
3634
+ });
3635
+ otherObjects.forEach(([key, value]) => {
3636
+ const handle = docLoader.createDocumentForObject(key);
3637
+ handle.change((doc) => {
3638
+ assignDeep(doc, [
3639
+ "objects",
3640
+ key
3641
+ ], value);
3642
+ });
3643
+ });
3582
3644
  epoch = {
3583
3645
  previousId: this._automergeSpaceState.lastEpoch?.id,
3584
3646
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
@@ -3628,7 +3690,7 @@ var DataSpace = class {
3628
3690
  state: SpaceState[this._state]
3629
3691
  }, {
3630
3692
  F: __dxlog_file12,
3631
- L: 482,
3693
+ L: 531,
3632
3694
  S: this,
3633
3695
  C: (f, a) => f(...a)
3634
3696
  });
@@ -4899,7 +4961,7 @@ import { NetworkManager, createSimplePeerTransportFactory } from "@dxos/network-
4899
4961
  import { trace as trace9 } from "@dxos/protocols";
4900
4962
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
4901
4963
  import { TRACE_PROCESSOR as TRACE_PROCESSOR2, trace as Trace3 } from "@dxos/tracing";
4902
- import { assignDeep } from "@dxos/util";
4964
+ import { assignDeep as assignDeep2 } from "@dxos/util";
4903
4965
  import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4904
4966
 
4905
4967
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
@@ -5575,7 +5637,7 @@ var ClientServicesHost = class {
5575
5637
  const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5576
5638
  await document.whenReady();
5577
5639
  document.change((doc) => {
5578
- assignDeep(doc, [
5640
+ assignDeep2(doc, [
5579
5641
  "objects",
5580
5642
  getAutomergeObjectCore(obj).id
5581
5643
  ], getRawDoc(obj).handle.docSync());
@@ -5635,4 +5697,4 @@ export {
5635
5697
  createStorageObjects,
5636
5698
  ClientServicesHost
5637
5699
  };
5638
- //# sourceMappingURL=chunk-ULO2U4N6.mjs.map
5700
+ //# sourceMappingURL=chunk-VUUAQRJM.mjs.map