@dxos/client-services 0.4.10-main.b112538 → 0.4.10-main.b1e8dec

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.b112538";
2772
+ var DXOS_VERSION = "0.4.10-main.b1e8dec";
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";
@@ -4406,7 +4406,7 @@ import { safeInstanceof } from "@dxos/util";
4406
4406
  import { getHeads } from "@dxos/automerge/automerge";
4407
4407
  import { warnAfterTimeout as warnAfterTimeout2 } from "@dxos/debug";
4408
4408
  import { idCodec } from "@dxos/protocols";
4409
- var createLoadDocuments = (automergeHost) => (
4409
+ var createSelectedDocumentsIterator = (automergeHost) => (
4410
4410
  /**
4411
4411
  * Get object data blobs from Automerge Repo by ids.
4412
4412
  * @param ids
@@ -4419,17 +4419,17 @@ var createLoadDocuments = (automergeHost) => (
4419
4419
  await warnAfterTimeout2(5e3, "to long to load doc", () => handle.whenReady());
4420
4420
  const doc = handle.docSync();
4421
4421
  const hash = getHeads(doc).join("");
4422
- yield [
4422
+ yield doc.objects?.[objectId] ? [
4423
4423
  {
4424
4424
  id,
4425
4425
  object: doc.objects[objectId],
4426
4426
  currentHash: hash
4427
4427
  }
4428
- ];
4428
+ ] : [];
4429
4429
  }
4430
4430
  }
4431
4431
  );
4432
- var createGetAllDocuments = (automergeHost) => (
4432
+ var createDocumentsIterator = (automergeHost) => (
4433
4433
  /**
4434
4434
  * Recursively get all object data blobs from Automerge Repo.
4435
4435
  * @param ids
@@ -4452,7 +4452,7 @@ var createGetAllDocuments = (automergeHost) => (
4452
4452
  objectId
4453
4453
  }),
4454
4454
  object,
4455
- currentHash: heads.at(-1)
4455
+ currentHash: heads.join("")
4456
4456
  };
4457
4457
  });
4458
4458
  }
@@ -4536,8 +4536,8 @@ var ServiceContext = class {
4536
4536
  directory: storage.createDirectory("index-store")
4537
4537
  }),
4538
4538
  metadataStore: this.indexMetadata,
4539
- loadDocuments: createLoadDocuments(this.automergeHost),
4540
- getAllDocuments: createGetAllDocuments(this.automergeHost)
4539
+ loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
4540
+ getAllDocuments: createDocumentsIterator(this.automergeHost)
4541
4541
  });
4542
4542
  this.invitations = new InvitationsHandler(this.networkManager);
4543
4543
  this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
@@ -4947,11 +4947,12 @@ var toStorageType = (type) => {
4947
4947
  };
4948
4948
 
4949
4949
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4950
- import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
4951
- import { Properties, clientServiceBundle, defaultKey } from "@dxos/client-protocol";
4950
+ import { Event as Event9, sleep as sleep3, synchronized as synchronized3 } from "@dxos/async";
4951
+ import { clientServiceBundle, defaultKey, PropertiesSchema } from "@dxos/client-protocol";
4952
4952
  import { Context as Context11 } from "@dxos/context";
4953
4953
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4954
- import { getAutomergeObjectCore, getRawDoc } from "@dxos/echo-schema";
4954
+ import * as E from "@dxos/echo-schema";
4955
+ import { createRawObjectDoc } from "@dxos/echo-schema";
4955
4956
  import { IndexServiceImpl } from "@dxos/indexing";
4956
4957
  import { invariant as invariant16 } from "@dxos/invariant";
4957
4958
  import { PublicKey as PublicKey12 } from "@dxos/keys";
@@ -5358,7 +5359,7 @@ var ClientServicesHost = class {
5358
5359
  initialize({ config, ...options }) {
5359
5360
  invariant16(!this._open, "service host is open", {
5360
5361
  F: __dxlog_file18,
5361
- L: 179,
5362
+ L: 180,
5362
5363
  S: this,
5363
5364
  A: [
5364
5365
  "!this._open",
@@ -5367,14 +5368,14 @@ var ClientServicesHost = class {
5367
5368
  });
5368
5369
  log15("initializing...", void 0, {
5369
5370
  F: __dxlog_file18,
5370
- L: 180,
5371
+ L: 181,
5371
5372
  S: this,
5372
5373
  C: (f, a) => f(...a)
5373
5374
  });
5374
5375
  if (config) {
5375
5376
  invariant16(!this._config, "config already set", {
5376
5377
  F: __dxlog_file18,
5377
- L: 183,
5378
+ L: 184,
5378
5379
  S: this,
5379
5380
  A: [
5380
5381
  "!this._config",
@@ -5389,7 +5390,7 @@ var ClientServicesHost = class {
5389
5390
  if (!options.signalManager) {
5390
5391
  log15.warn("running signaling without telemetry metadata.", void 0, {
5391
5392
  F: __dxlog_file18,
5392
- L: 191,
5393
+ L: 192,
5393
5394
  S: this,
5394
5395
  C: (f, a) => f(...a)
5395
5396
  });
@@ -5400,7 +5401,7 @@ var ClientServicesHost = class {
5400
5401
  this._signalManager = signalManager;
5401
5402
  invariant16(!this._networkManager, "network manager already set", {
5402
5403
  F: __dxlog_file18,
5403
- L: 202,
5404
+ L: 203,
5404
5405
  S: this,
5405
5406
  A: [
5406
5407
  "!this._networkManager",
@@ -5414,7 +5415,7 @@ var ClientServicesHost = class {
5414
5415
  });
5415
5416
  log15("initialized", void 0, {
5416
5417
  F: __dxlog_file18,
5417
- L: 209,
5418
+ L: 210,
5418
5419
  S: this,
5419
5420
  C: (f, a) => f(...a)
5420
5421
  });
@@ -5428,13 +5429,13 @@ var ClientServicesHost = class {
5428
5429
  id: traceId
5429
5430
  }), {
5430
5431
  F: __dxlog_file18,
5431
- L: 220,
5432
+ L: 221,
5432
5433
  S: this,
5433
5434
  C: (f, a) => f(...a)
5434
5435
  });
5435
5436
  invariant16(this._config, "config not set", {
5436
5437
  F: __dxlog_file18,
5437
- L: 222,
5438
+ L: 223,
5438
5439
  S: this,
5439
5440
  A: [
5440
5441
  "this._config",
@@ -5443,7 +5444,7 @@ var ClientServicesHost = class {
5443
5444
  });
5444
5445
  invariant16(this._storage, "storage not set", {
5445
5446
  F: __dxlog_file18,
5446
- L: 223,
5447
+ L: 224,
5447
5448
  S: this,
5448
5449
  A: [
5449
5450
  "this._storage",
@@ -5452,7 +5453,7 @@ var ClientServicesHost = class {
5452
5453
  });
5453
5454
  invariant16(this._signalManager, "signal manager not set", {
5454
5455
  F: __dxlog_file18,
5455
- L: 224,
5456
+ L: 225,
5456
5457
  S: this,
5457
5458
  A: [
5458
5459
  "this._signalManager",
@@ -5461,7 +5462,7 @@ var ClientServicesHost = class {
5461
5462
  });
5462
5463
  invariant16(this._networkManager, "network manager not set", {
5463
5464
  F: __dxlog_file18,
5464
- L: 225,
5465
+ L: 226,
5465
5466
  S: this,
5466
5467
  A: [
5467
5468
  "this._networkManager",
@@ -5473,7 +5474,7 @@ var ClientServicesHost = class {
5473
5474
  lockKey: this._resourceLock?.lockKey
5474
5475
  }, {
5475
5476
  F: __dxlog_file18,
5476
- L: 228,
5477
+ L: 229,
5477
5478
  S: this,
5478
5479
  C: (f, a) => f(...a)
5479
5480
  });
@@ -5507,7 +5508,7 @@ var ClientServicesHost = class {
5507
5508
  await this._serviceContext.open(ctx);
5508
5509
  invariant16(this.serviceRegistry.services.InvitationsService, void 0, {
5509
5510
  F: __dxlog_file18,
5510
- L: 289,
5511
+ L: 290,
5511
5512
  S: this,
5512
5513
  A: [
5513
5514
  "this.serviceRegistry.services.InvitationsService",
@@ -5519,7 +5520,7 @@ var ClientServicesHost = class {
5519
5520
  count: loadedInvitations.invitations?.length
5520
5521
  }, {
5521
5522
  F: __dxlog_file18,
5522
- L: 292,
5523
+ L: 293,
5523
5524
  S: this,
5524
5525
  C: (f, a) => f(...a)
5525
5526
  });
@@ -5541,7 +5542,7 @@ var ClientServicesHost = class {
5541
5542
  deviceKey
5542
5543
  }, {
5543
5544
  F: __dxlog_file18,
5544
- L: 309,
5545
+ L: 310,
5545
5546
  S: this,
5546
5547
  C: (f, a) => f(...a)
5547
5548
  });
@@ -5549,7 +5550,7 @@ var ClientServicesHost = class {
5549
5550
  id: traceId
5550
5551
  }), {
5551
5552
  F: __dxlog_file18,
5552
- L: 310,
5553
+ L: 311,
5553
5554
  S: this,
5554
5555
  C: (f, a) => f(...a)
5555
5556
  });
@@ -5563,7 +5564,7 @@ var ClientServicesHost = class {
5563
5564
  deviceKey
5564
5565
  }, {
5565
5566
  F: __dxlog_file18,
5566
- L: 321,
5567
+ L: 322,
5567
5568
  S: this,
5568
5569
  C: (f, a) => f(...a)
5569
5570
  });
@@ -5579,7 +5580,7 @@ var ClientServicesHost = class {
5579
5580
  deviceKey
5580
5581
  }, {
5581
5582
  F: __dxlog_file18,
5582
- L: 328,
5583
+ L: 329,
5583
5584
  S: this,
5584
5585
  C: (f, a) => f(...a)
5585
5586
  });
@@ -5590,13 +5591,13 @@ var ClientServicesHost = class {
5590
5591
  id: traceId
5591
5592
  }), {
5592
5593
  F: __dxlog_file18,
5593
- L: 333,
5594
+ L: 334,
5594
5595
  S: this,
5595
5596
  C: (f, a) => f(...a)
5596
5597
  });
5597
5598
  log15("resetting...", void 0, {
5598
5599
  F: __dxlog_file18,
5599
- L: 335,
5600
+ L: 336,
5600
5601
  S: this,
5601
5602
  C: (f, a) => f(...a)
5602
5603
  });
@@ -5604,7 +5605,7 @@ var ClientServicesHost = class {
5604
5605
  await this._storage.reset();
5605
5606
  log15("reset", void 0, {
5606
5607
  F: __dxlog_file18,
5607
- L: 338,
5608
+ L: 339,
5608
5609
  S: this,
5609
5610
  C: (f, a) => f(...a)
5610
5611
  });
@@ -5612,7 +5613,7 @@ var ClientServicesHost = class {
5612
5613
  id: traceId
5613
5614
  }), {
5614
5615
  F: __dxlog_file18,
5615
- L: 339,
5616
+ L: 340,
5616
5617
  S: this,
5617
5618
  C: (f, a) => f(...a)
5618
5619
  });
@@ -5622,12 +5623,10 @@ var ClientServicesHost = class {
5622
5623
  const identity = await this._serviceContext.createIdentity(params);
5623
5624
  await this._serviceContext.initialized.wait();
5624
5625
  const space = await this._serviceContext.dataSpaceManager.createSpace();
5625
- const obj = new Properties(void 0);
5626
- obj[defaultKey] = identity.identityKey.toHex();
5627
5626
  const automergeIndex = space.automergeSpaceState.rootUrl;
5628
5627
  invariant16(automergeIndex, void 0, {
5629
5628
  F: __dxlog_file18,
5630
- L: 354,
5629
+ L: 352,
5631
5630
  S: this,
5632
5631
  A: [
5633
5632
  "automergeIndex",
@@ -5636,12 +5635,18 @@ var ClientServicesHost = class {
5636
5635
  });
5637
5636
  const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5638
5637
  await document.whenReady();
5638
+ const objectDocument = createRawObjectDoc({
5639
+ [defaultKey]: identity.identityKey.toHex()
5640
+ }, {
5641
+ type: E.getTypeReference(PropertiesSchema)
5642
+ });
5639
5643
  document.change((doc) => {
5640
5644
  assignDeep2(doc, [
5641
5645
  "objects",
5642
- getAutomergeObjectCore(obj).id
5643
- ], getRawDoc(obj).handle.docSync());
5646
+ objectDocument.id
5647
+ ], objectDocument.handle.docSync());
5644
5648
  });
5649
+ await sleep3(200);
5645
5650
  return identity;
5646
5651
  }
5647
5652
  };
@@ -5697,4 +5702,4 @@ export {
5697
5702
  createStorageObjects,
5698
5703
  ClientServicesHost
5699
5704
  };
5700
- //# sourceMappingURL=chunk-VUUAQRJM.mjs.map
5705
+ //# sourceMappingURL=chunk-BJNDCR72.mjs.map