@dxos/client-services 0.4.10-main.3aa8c1b → 0.4.10-main.3c620fb

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 (27) hide show
  1. package/dist/lib/browser/{chunk-SETGCXWR.mjs → chunk-H2TNTLUE.mjs} +44 -39
  2. package/dist/lib/browser/{chunk-SETGCXWR.mjs.map → chunk-H2TNTLUE.mjs.map} +3 -3
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +8 -4
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/{chunk-CFWIMM3Q.cjs → chunk-OSCHFTM3.cjs} +47 -42
  8. package/dist/lib/node/{chunk-CFWIMM3Q.cjs.map → chunk-OSCHFTM3.cjs.map} +3 -3
  9. package/dist/lib/node/index.cjs +42 -42
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +13 -9
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  14. package/dist/types/src/packlets/services/service-host.d.ts +3 -1
  15. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  16. package/dist/types/src/packlets/testing/test-builder.d.ts +4 -1
  17. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  18. package/dist/types/src/version.d.ts +1 -1
  19. package/package.json +34 -34
  20. package/src/packlets/services/automerge-host.test.ts +9 -3
  21. package/src/packlets/services/service-context.test.ts +4 -1
  22. package/src/packlets/services/service-context.ts +2 -0
  23. package/src/packlets/services/service-host.ts +12 -1
  24. package/src/packlets/spaces/data-space-manager.test.ts +4 -4
  25. package/src/packlets/storage/level.ts +1 -1
  26. package/src/packlets/testing/test-builder.ts +20 -4
  27. package/src/version.ts +1 -1
@@ -4381,6 +4381,7 @@ var ServiceContext = class extends Resource {
4381
4381
  });
4382
4382
  this.automergeHost = new AutomergeHost({
4383
4383
  directory: storage.createDirectory("automerge"),
4384
+ db: level.sublevel("automerge"),
4384
4385
  metadata: this.indexMetadata
4385
4386
  });
4386
4387
  this.indexer = new Indexer({
@@ -4398,7 +4399,7 @@ var ServiceContext = class extends Resource {
4398
4399
  await this._checkStorageVersion();
4399
4400
  log12("opening...", void 0, {
4400
4401
  F: __dxlog_file14,
4401
- L: 156,
4402
+ L: 157,
4402
4403
  S: this,
4403
4404
  C: (f, a) => f(...a)
4404
4405
  });
@@ -4406,12 +4407,13 @@ var ServiceContext = class extends Resource {
4406
4407
  id: this._instanceId
4407
4408
  }), {
4408
4409
  F: __dxlog_file14,
4409
- L: 157,
4410
+ L: 158,
4410
4411
  S: this,
4411
4412
  C: (f, a) => f(...a)
4412
4413
  });
4413
4414
  await this.signalManager.open();
4414
4415
  await this.networkManager.open();
4416
+ await this.automergeHost.open();
4415
4417
  await this.metadataStore.load();
4416
4418
  await this.spaceManager.open();
4417
4419
  await this.identityManager.open(ctx);
@@ -4422,13 +4424,13 @@ var ServiceContext = class extends Resource {
4422
4424
  id: this._instanceId
4423
4425
  }), {
4424
4426
  F: __dxlog_file14,
4425
- L: 167,
4427
+ L: 169,
4426
4428
  S: this,
4427
4429
  C: (f, a) => f(...a)
4428
4430
  });
4429
4431
  log12("opened", void 0, {
4430
4432
  F: __dxlog_file14,
4431
- L: 168,
4433
+ L: 170,
4432
4434
  S: this,
4433
4435
  C: (f, a) => f(...a)
4434
4436
  });
@@ -4436,7 +4438,7 @@ var ServiceContext = class extends Resource {
4436
4438
  async _close() {
4437
4439
  log12("closing...", void 0, {
4438
4440
  F: __dxlog_file14,
4439
- L: 172,
4441
+ L: 174,
4440
4442
  S: this,
4441
4443
  C: (f, a) => f(...a)
4442
4444
  });
@@ -4454,7 +4456,7 @@ var ServiceContext = class extends Resource {
4454
4456
  await this.indexer.destroy();
4455
4457
  log12("closed", void 0, {
4456
4458
  F: __dxlog_file14,
4457
- L: 185,
4459
+ L: 187,
4458
4460
  S: this,
4459
4461
  C: (f, a) => f(...a)
4460
4462
  });
@@ -4468,7 +4470,7 @@ var ServiceContext = class extends Resource {
4468
4470
  const factory = this._handlerFactories.get(invitation.kind);
4469
4471
  invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
4470
4472
  F: __dxlog_file14,
4471
- L: 196,
4473
+ L: 198,
4472
4474
  S: this,
4473
4475
  A: [
4474
4476
  "factory",
@@ -4500,7 +4502,7 @@ var ServiceContext = class extends Resource {
4500
4502
  async _initialize(ctx) {
4501
4503
  log12("initializing spaces...", void 0, {
4502
4504
  F: __dxlog_file14,
4503
- L: 227,
4505
+ L: 229,
4504
4506
  S: this,
4505
4507
  C: (f, a) => f(...a)
4506
4508
  });
@@ -4523,7 +4525,7 @@ var ServiceContext = class extends Resource {
4523
4525
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4524
4526
  invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4525
4527
  F: __dxlog_file14,
4526
- L: 251,
4528
+ L: 253,
4527
4529
  S: this,
4528
4530
  A: [
4529
4531
  "this.dataSpaceManager",
@@ -4547,7 +4549,7 @@ var ServiceContext = class extends Resource {
4547
4549
  details: assertion
4548
4550
  }, {
4549
4551
  F: __dxlog_file14,
4550
- L: 267,
4552
+ L: 269,
4551
4553
  S: this,
4552
4554
  C: (f, a) => f(...a)
4553
4555
  });
@@ -4558,7 +4560,7 @@ var ServiceContext = class extends Resource {
4558
4560
  details: assertion
4559
4561
  }, {
4560
4562
  F: __dxlog_file14,
4561
- L: 271,
4563
+ L: 273,
4562
4564
  S: this,
4563
4565
  C: (f, a) => f(...a)
4564
4566
  });
@@ -4569,7 +4571,7 @@ var ServiceContext = class extends Resource {
4569
4571
  details: assertion
4570
4572
  }, {
4571
4573
  F: __dxlog_file14,
4572
- L: 276,
4574
+ L: 278,
4573
4575
  S: this,
4574
4576
  C: (f, a) => f(...a)
4575
4577
  });
@@ -4580,7 +4582,7 @@ var ServiceContext = class extends Resource {
4580
4582
  } catch (err) {
4581
4583
  log12.catch(err, void 0, {
4582
4584
  F: __dxlog_file14,
4583
- L: 282,
4585
+ L: 284,
4584
4586
  S: this,
4585
4587
  C: (f, a) => f(...a)
4586
4588
  });
@@ -4634,7 +4636,7 @@ import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/client/s
4634
4636
  import { TRACE_PROCESSOR } from "@dxos/tracing";
4635
4637
 
4636
4638
  // packages/sdk/client-services/src/version.ts
4637
- var DXOS_VERSION = "0.4.10-main.3aa8c1b";
4639
+ var DXOS_VERSION = "0.4.10-main.3c620fb";
4638
4640
 
4639
4641
  // packages/sdk/client-services/src/packlets/services/platform.ts
4640
4642
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -5323,7 +5325,7 @@ import path from "@dxos/node-std/path";
5323
5325
  import { PublicKey as PublicKey12 } from "@dxos/keys";
5324
5326
  var createLevel = async (config) => {
5325
5327
  const persistent = isPersistent(config);
5326
- const storagePath = persistent ? getRootPath(config) : path.join("tmp", "level", PublicKey12.random().toHex());
5328
+ const storagePath = persistent ? path.join(getRootPath(config), "level") : `/tmp/dxos-${PublicKey12.random().toHex()}`;
5327
5329
  const level = new Level(storagePath);
5328
5330
  await level.open();
5329
5331
  return level;
@@ -5404,6 +5406,7 @@ var ClientServicesHost = class {
5404
5406
  transportFactory,
5405
5407
  signalManager,
5406
5408
  storage,
5409
+ level,
5407
5410
  // TODO(wittjosiah): Turn this on by default.
5408
5411
  lockKey,
5409
5412
  callbacks,
@@ -5414,6 +5417,7 @@ var ClientServicesHost = class {
5414
5417
  this._opening = false;
5415
5418
  this._open = false;
5416
5419
  this._storage = storage;
5420
+ this._level = level;
5417
5421
  this._callbacks = callbacks;
5418
5422
  this._runtimeParams = runtimeParams;
5419
5423
  if (config) {
@@ -5485,7 +5489,7 @@ var ClientServicesHost = class {
5485
5489
  initialize({ config, ...options }) {
5486
5490
  invariant16(!this._open, "service host is open", {
5487
5491
  F: __dxlog_file19,
5488
- L: 188,
5492
+ L: 197,
5489
5493
  S: this,
5490
5494
  A: [
5491
5495
  "!this._open",
@@ -5494,14 +5498,14 @@ var ClientServicesHost = class {
5494
5498
  });
5495
5499
  log16("initializing...", void 0, {
5496
5500
  F: __dxlog_file19,
5497
- L: 189,
5501
+ L: 198,
5498
5502
  S: this,
5499
5503
  C: (f, a) => f(...a)
5500
5504
  });
5501
5505
  if (config) {
5502
5506
  invariant16(!this._config, "config already set", {
5503
5507
  F: __dxlog_file19,
5504
- L: 192,
5508
+ L: 201,
5505
5509
  S: this,
5506
5510
  A: [
5507
5511
  "!this._config",
@@ -5516,7 +5520,7 @@ var ClientServicesHost = class {
5516
5520
  if (!options.signalManager) {
5517
5521
  log16.warn("running signaling without telemetry metadata.", void 0, {
5518
5522
  F: __dxlog_file19,
5519
- L: 200,
5523
+ L: 209,
5520
5524
  S: this,
5521
5525
  C: (f, a) => f(...a)
5522
5526
  });
@@ -5527,7 +5531,7 @@ var ClientServicesHost = class {
5527
5531
  this._signalManager = signalManager;
5528
5532
  invariant16(!this._networkManager, "network manager already set", {
5529
5533
  F: __dxlog_file19,
5530
- L: 211,
5534
+ L: 220,
5531
5535
  S: this,
5532
5536
  A: [
5533
5537
  "!this._networkManager",
@@ -5541,7 +5545,7 @@ var ClientServicesHost = class {
5541
5545
  });
5542
5546
  log16("initialized", void 0, {
5543
5547
  F: __dxlog_file19,
5544
- L: 218,
5548
+ L: 227,
5545
5549
  S: this,
5546
5550
  C: (f, a) => f(...a)
5547
5551
  });
@@ -5555,13 +5559,13 @@ var ClientServicesHost = class {
5555
5559
  id: traceId
5556
5560
  }), {
5557
5561
  F: __dxlog_file19,
5558
- L: 229,
5562
+ L: 238,
5559
5563
  S: this,
5560
5564
  C: (f, a) => f(...a)
5561
5565
  });
5562
5566
  invariant16(this._config, "config not set", {
5563
5567
  F: __dxlog_file19,
5564
- L: 231,
5568
+ L: 240,
5565
5569
  S: this,
5566
5570
  A: [
5567
5571
  "this._config",
@@ -5570,7 +5574,7 @@ var ClientServicesHost = class {
5570
5574
  });
5571
5575
  invariant16(this._storage, "storage not set", {
5572
5576
  F: __dxlog_file19,
5573
- L: 232,
5577
+ L: 241,
5574
5578
  S: this,
5575
5579
  A: [
5576
5580
  "this._storage",
@@ -5579,7 +5583,7 @@ var ClientServicesHost = class {
5579
5583
  });
5580
5584
  invariant16(this._signalManager, "signal manager not set", {
5581
5585
  F: __dxlog_file19,
5582
- L: 233,
5586
+ L: 242,
5583
5587
  S: this,
5584
5588
  A: [
5585
5589
  "this._signalManager",
@@ -5588,7 +5592,7 @@ var ClientServicesHost = class {
5588
5592
  });
5589
5593
  invariant16(this._networkManager, "network manager not set", {
5590
5594
  F: __dxlog_file19,
5591
- L: 234,
5595
+ L: 243,
5592
5596
  S: this,
5593
5597
  A: [
5594
5598
  "this._networkManager",
@@ -5600,13 +5604,14 @@ var ClientServicesHost = class {
5600
5604
  lockKey: this._resourceLock?.lockKey
5601
5605
  }, {
5602
5606
  F: __dxlog_file19,
5603
- L: 237,
5607
+ L: 246,
5604
5608
  S: this,
5605
5609
  C: (f, a) => f(...a)
5606
5610
  });
5607
5611
  if (!this._level) {
5608
5612
  this._level = await createLevel(this._config.get("runtime.client.storage", {}));
5609
5613
  }
5614
+ await this._level.open();
5610
5615
  await this._resourceLock?.acquire();
5611
5616
  await this._loggingService.open();
5612
5617
  this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
@@ -5637,7 +5642,7 @@ var ClientServicesHost = class {
5637
5642
  await this._serviceContext.open(ctx);
5638
5643
  invariant16(this.serviceRegistry.services.InvitationsService, void 0, {
5639
5644
  F: __dxlog_file19,
5640
- L: 303,
5645
+ L: 314,
5641
5646
  S: this,
5642
5647
  A: [
5643
5648
  "this.serviceRegistry.services.InvitationsService",
@@ -5649,7 +5654,7 @@ var ClientServicesHost = class {
5649
5654
  count: loadedInvitations.invitations?.length
5650
5655
  }, {
5651
5656
  F: __dxlog_file19,
5652
- L: 306,
5657
+ L: 317,
5653
5658
  S: this,
5654
5659
  C: (f, a) => f(...a)
5655
5660
  });
@@ -5672,7 +5677,7 @@ var ClientServicesHost = class {
5672
5677
  deviceKey
5673
5678
  }, {
5674
5679
  F: __dxlog_file19,
5675
- L: 324,
5680
+ L: 335,
5676
5681
  S: this,
5677
5682
  C: (f, a) => f(...a)
5678
5683
  });
@@ -5680,7 +5685,7 @@ var ClientServicesHost = class {
5680
5685
  id: traceId
5681
5686
  }), {
5682
5687
  F: __dxlog_file19,
5683
- L: 325,
5688
+ L: 336,
5684
5689
  S: this,
5685
5690
  C: (f, a) => f(...a)
5686
5691
  });
@@ -5694,7 +5699,7 @@ var ClientServicesHost = class {
5694
5699
  deviceKey
5695
5700
  }, {
5696
5701
  F: __dxlog_file19,
5697
- L: 336,
5702
+ L: 347,
5698
5703
  S: this,
5699
5704
  C: (f, a) => f(...a)
5700
5705
  });
@@ -5712,7 +5717,7 @@ var ClientServicesHost = class {
5712
5717
  deviceKey
5713
5718
  }, {
5714
5719
  F: __dxlog_file19,
5715
- L: 345,
5720
+ L: 356,
5716
5721
  S: this,
5717
5722
  C: (f, a) => f(...a)
5718
5723
  });
@@ -5723,13 +5728,13 @@ var ClientServicesHost = class {
5723
5728
  id: traceId
5724
5729
  }), {
5725
5730
  F: __dxlog_file19,
5726
- L: 350,
5731
+ L: 361,
5727
5732
  S: this,
5728
5733
  C: (f, a) => f(...a)
5729
5734
  });
5730
5735
  log16("resetting...", void 0, {
5731
5736
  F: __dxlog_file19,
5732
- L: 352,
5737
+ L: 363,
5733
5738
  S: this,
5734
5739
  C: (f, a) => f(...a)
5735
5740
  });
@@ -5737,7 +5742,7 @@ var ClientServicesHost = class {
5737
5742
  await this._storage.reset();
5738
5743
  log16("reset", void 0, {
5739
5744
  F: __dxlog_file19,
5740
- L: 355,
5745
+ L: 366,
5741
5746
  S: this,
5742
5747
  C: (f, a) => f(...a)
5743
5748
  });
@@ -5745,7 +5750,7 @@ var ClientServicesHost = class {
5745
5750
  id: traceId
5746
5751
  }), {
5747
5752
  F: __dxlog_file19,
5748
- L: 356,
5753
+ L: 367,
5749
5754
  S: this,
5750
5755
  C: (f, a) => f(...a)
5751
5756
  });
@@ -5758,7 +5763,7 @@ var ClientServicesHost = class {
5758
5763
  const automergeIndex = space.automergeSpaceState.rootUrl;
5759
5764
  invariant16(automergeIndex, void 0, {
5760
5765
  F: __dxlog_file19,
5761
- L: 368,
5766
+ L: 379,
5762
5767
  S: this,
5763
5768
  A: [
5764
5769
  "automergeIndex",
@@ -5884,4 +5889,4 @@ export {
5884
5889
  ClientServicesHost,
5885
5890
  ClientServicesProviderResource
5886
5891
  };
5887
- //# sourceMappingURL=chunk-SETGCXWR.mjs.map
5892
+ //# sourceMappingURL=chunk-H2TNTLUE.mjs.map