@dxos/client-services 0.4.9-main.8437471 → 0.4.9-main.95b3f2d

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 (31) hide show
  1. package/dist/lib/browser/{chunk-4C7NKJXO.mjs → chunk-6C5245ZM.mjs} +55 -44
  2. package/dist/lib/browser/{chunk-4C7NKJXO.mjs.map → chunk-6C5245ZM.mjs.map} +3 -3
  3. package/dist/lib/browser/index.mjs +3 -1
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +6 -3
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-5U6I6YG3.cjs → chunk-MXUR4NMK.cjs} +56 -44
  9. package/dist/lib/node/{chunk-5U6I6YG3.cjs.map → chunk-MXUR4NMK.cjs.map} +3 -3
  10. package/dist/lib/node/index.cjs +39 -37
  11. package/dist/lib/node/index.cjs.map +1 -1
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +8 -6
  14. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  15. package/dist/types/src/packlets/services/diagnostics.d.ts +1 -1
  16. package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
  17. package/dist/types/src/packlets/services/service-context.d.ts +3 -1
  18. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  19. package/dist/types/src/packlets/services/service-host.d.ts +5 -1
  20. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  21. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  22. package/dist/types/src/version.d.ts +1 -1
  23. package/package.json +37 -34
  24. package/src/packlets/identity/identity-manager.test.ts +2 -0
  25. package/src/packlets/identity/identity.test.ts +4 -0
  26. package/src/packlets/indexing/util.ts +2 -2
  27. package/src/packlets/services/diagnostics.ts +3 -3
  28. package/src/packlets/services/service-context.ts +3 -0
  29. package/src/packlets/services/service-host.ts +18 -5
  30. package/src/packlets/testing/test-builder.ts +4 -2
  31. package/src/version.ts +1 -1
@@ -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.9-main.8437471";
2772
+ var DXOS_VERSION = "0.4.9-main.95b3f2d";
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";
@@ -4356,12 +4356,12 @@ var createLoadDocuments = (automergeHost) => (
4356
4356
  const handle = automergeHost.repo.find(documentId);
4357
4357
  await warnAfterTimeout2(5e3, "to long to load doc", () => handle.whenReady());
4358
4358
  const doc = handle.docSync();
4359
- const hash = getHeads(doc).join("");
4359
+ const heads = getHeads(doc);
4360
4360
  yield [
4361
4361
  {
4362
4362
  id,
4363
4363
  object: doc.objects[objectId],
4364
- currentHash: hash
4364
+ currentHash: heads.at(-1)
4365
4365
  }
4366
4366
  ];
4367
4367
  }
@@ -4432,10 +4432,11 @@ function _ts_decorate6(decorators, target, key, desc) {
4432
4432
  }
4433
4433
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4434
4434
  var ServiceContext = class {
4435
- constructor(storage, networkManager, signalManager, _runtimeParams) {
4435
+ constructor(storage, networkManager, signalManager, modelFactory, _runtimeParams) {
4436
4436
  this.storage = storage;
4437
4437
  this.networkManager = networkManager;
4438
4438
  this.signalManager = signalManager;
4439
+ this.modelFactory = modelFactory;
4439
4440
  this._runtimeParams = _runtimeParams;
4440
4441
  this.initialized = new Trigger5();
4441
4442
  this._handlerFactories = /* @__PURE__ */ new Map();
@@ -4459,6 +4460,7 @@ var ServiceContext = class {
4459
4460
  networkManager: this.networkManager,
4460
4461
  blobStore: this.blobStore,
4461
4462
  metadataStore: this.metadataStore,
4463
+ modelFactory: this.modelFactory,
4462
4464
  snapshotStore: this.snapshotStore
4463
4465
  });
4464
4466
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
@@ -4484,7 +4486,7 @@ var ServiceContext = class {
4484
4486
  await this._checkStorageVersion();
4485
4487
  log12("opening...", void 0, {
4486
4488
  F: __dxlog_file15,
4487
- L: 151,
4489
+ L: 154,
4488
4490
  S: this,
4489
4491
  C: (f, a) => f(...a)
4490
4492
  });
@@ -4492,7 +4494,7 @@ var ServiceContext = class {
4492
4494
  id: this._instanceId
4493
4495
  }), {
4494
4496
  F: __dxlog_file15,
4495
- L: 152,
4497
+ L: 155,
4496
4498
  S: this,
4497
4499
  C: (f, a) => f(...a)
4498
4500
  });
@@ -4508,13 +4510,13 @@ var ServiceContext = class {
4508
4510
  id: this._instanceId
4509
4511
  }), {
4510
4512
  F: __dxlog_file15,
4511
- L: 162,
4513
+ L: 165,
4512
4514
  S: this,
4513
4515
  C: (f, a) => f(...a)
4514
4516
  });
4515
4517
  log12("opened", void 0, {
4516
4518
  F: __dxlog_file15,
4517
- L: 163,
4519
+ L: 166,
4518
4520
  S: this,
4519
4521
  C: (f, a) => f(...a)
4520
4522
  });
@@ -4522,7 +4524,7 @@ var ServiceContext = class {
4522
4524
  async close() {
4523
4525
  log12("closing...", void 0, {
4524
4526
  F: __dxlog_file15,
4525
- L: 167,
4527
+ L: 170,
4526
4528
  S: this,
4527
4529
  C: (f, a) => f(...a)
4528
4530
  });
@@ -4540,7 +4542,7 @@ var ServiceContext = class {
4540
4542
  await this.indexer.destroy();
4541
4543
  log12("closed", void 0, {
4542
4544
  F: __dxlog_file15,
4543
- L: 180,
4545
+ L: 183,
4544
4546
  S: this,
4545
4547
  C: (f, a) => f(...a)
4546
4548
  });
@@ -4554,7 +4556,7 @@ var ServiceContext = class {
4554
4556
  const factory = this._handlerFactories.get(invitation.kind);
4555
4557
  invariant14(factory, `Unknown invitation kind: ${invitation.kind}`, {
4556
4558
  F: __dxlog_file15,
4557
- L: 191,
4559
+ L: 194,
4558
4560
  S: this,
4559
4561
  A: [
4560
4562
  "factory",
@@ -4586,7 +4588,7 @@ var ServiceContext = class {
4586
4588
  async _initialize(ctx) {
4587
4589
  log12("initializing spaces...", void 0, {
4588
4590
  F: __dxlog_file15,
4589
- L: 222,
4591
+ L: 225,
4590
4592
  S: this,
4591
4593
  C: (f, a) => f(...a)
4592
4594
  });
@@ -4609,7 +4611,7 @@ var ServiceContext = class {
4609
4611
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4610
4612
  invariant14(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4611
4613
  F: __dxlog_file15,
4612
- L: 246,
4614
+ L: 249,
4613
4615
  S: this,
4614
4616
  A: [
4615
4617
  "this.dataSpaceManager",
@@ -4633,7 +4635,7 @@ var ServiceContext = class {
4633
4635
  details: assertion
4634
4636
  }, {
4635
4637
  F: __dxlog_file15,
4636
- L: 262,
4638
+ L: 265,
4637
4639
  S: this,
4638
4640
  C: (f, a) => f(...a)
4639
4641
  });
@@ -4644,7 +4646,7 @@ var ServiceContext = class {
4644
4646
  details: assertion
4645
4647
  }, {
4646
4648
  F: __dxlog_file15,
4647
- L: 266,
4649
+ L: 269,
4648
4650
  S: this,
4649
4651
  C: (f, a) => f(...a)
4650
4652
  });
@@ -4655,7 +4657,7 @@ var ServiceContext = class {
4655
4657
  details: assertion
4656
4658
  }, {
4657
4659
  F: __dxlog_file15,
4658
- L: 271,
4660
+ L: 274,
4659
4661
  S: this,
4660
4662
  C: (f, a) => f(...a)
4661
4663
  });
@@ -4666,7 +4668,7 @@ var ServiceContext = class {
4666
4668
  } catch (err) {
4667
4669
  log12.catch(err, void 0, {
4668
4670
  F: __dxlog_file15,
4669
- L: 277,
4671
+ L: 280,
4670
4672
  S: this,
4671
4673
  C: (f, a) => f(...a)
4672
4674
  });
@@ -4886,18 +4888,21 @@ var toStorageType = (type) => {
4886
4888
 
4887
4889
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4888
4890
  import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
4889
- import { Properties, clientServiceBundle, defaultKey } from "@dxos/client-protocol";
4891
+ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protocol";
4890
4892
  import { Context as Context11 } from "@dxos/context";
4893
+ import { DocumentModel } from "@dxos/document-model";
4891
4894
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4892
- import { getAutomergeObjectCore, getRawDoc } from "@dxos/echo-schema";
4895
+ import { getRawDoc, getAutomergeObjectCore } from "@dxos/echo-schema";
4893
4896
  import { IndexServiceImpl } from "@dxos/indexing";
4894
4897
  import { invariant as invariant16 } from "@dxos/invariant";
4895
4898
  import { PublicKey as PublicKey12 } from "@dxos/keys";
4896
4899
  import { log as log15 } from "@dxos/log";
4897
4900
  import { WebsocketSignalManager } from "@dxos/messaging";
4898
- import { NetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
4901
+ import { ModelFactory } from "@dxos/model-factory";
4902
+ import { createSimplePeerTransportFactory, NetworkManager } from "@dxos/network-manager";
4899
4903
  import { trace as trace9 } from "@dxos/protocols";
4900
4904
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
4905
+ import { TextModel } from "@dxos/text-model";
4901
4906
  import { TRACE_PROCESSOR as TRACE_PROCESSOR2, trace as Trace3 } from "@dxos/tracing";
4902
4907
  import { assignDeep } from "@dxos/util";
4903
4908
  import { WebsocketRpcClient } from "@dxos/websocket-rpc";
@@ -5210,9 +5215,13 @@ function _ts_decorate8(decorators, target, key, desc) {
5210
5215
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5211
5216
  }
5212
5217
  var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
5218
+ var createDefaultModelFactory = () => {
5219
+ return new ModelFactory().registerModel(DocumentModel).registerModel(TextModel);
5220
+ };
5213
5221
  var ClientServicesHost = class {
5214
5222
  constructor({
5215
5223
  config,
5224
+ modelFactory = createDefaultModelFactory(),
5216
5225
  transportFactory,
5217
5226
  signalManager,
5218
5227
  storage,
@@ -5226,6 +5235,7 @@ var ClientServicesHost = class {
5226
5235
  this._opening = false;
5227
5236
  this._open = false;
5228
5237
  this._storage = storage;
5238
+ this._modelFactory = modelFactory;
5229
5239
  this._callbacks = callbacks;
5230
5240
  this._runtimeParams = runtimeParams;
5231
5241
  if (config) {
@@ -5296,7 +5306,7 @@ var ClientServicesHost = class {
5296
5306
  initialize({ config, ...options }) {
5297
5307
  invariant16(!this._open, "service host is open", {
5298
5308
  F: __dxlog_file18,
5299
- L: 179,
5309
+ L: 191,
5300
5310
  S: this,
5301
5311
  A: [
5302
5312
  "!this._open",
@@ -5305,14 +5315,14 @@ var ClientServicesHost = class {
5305
5315
  });
5306
5316
  log15("initializing...", void 0, {
5307
5317
  F: __dxlog_file18,
5308
- L: 180,
5318
+ L: 192,
5309
5319
  S: this,
5310
5320
  C: (f, a) => f(...a)
5311
5321
  });
5312
5322
  if (config) {
5313
5323
  invariant16(!this._config, "config already set", {
5314
5324
  F: __dxlog_file18,
5315
- L: 183,
5325
+ L: 195,
5316
5326
  S: this,
5317
5327
  A: [
5318
5328
  "!this._config",
@@ -5330,7 +5340,7 @@ var ClientServicesHost = class {
5330
5340
  this._signalManager = signalManager;
5331
5341
  invariant16(!this._networkManager, "network manager already set", {
5332
5342
  F: __dxlog_file18,
5333
- L: 199,
5343
+ L: 211,
5334
5344
  S: this,
5335
5345
  A: [
5336
5346
  "!this._networkManager",
@@ -5344,7 +5354,7 @@ var ClientServicesHost = class {
5344
5354
  });
5345
5355
  log15("initialized", void 0, {
5346
5356
  F: __dxlog_file18,
5347
- L: 206,
5357
+ L: 218,
5348
5358
  S: this,
5349
5359
  C: (f, a) => f(...a)
5350
5360
  });
@@ -5358,13 +5368,13 @@ var ClientServicesHost = class {
5358
5368
  id: traceId
5359
5369
  }), {
5360
5370
  F: __dxlog_file18,
5361
- L: 217,
5371
+ L: 229,
5362
5372
  S: this,
5363
5373
  C: (f, a) => f(...a)
5364
5374
  });
5365
5375
  invariant16(this._config, "config not set", {
5366
5376
  F: __dxlog_file18,
5367
- L: 219,
5377
+ L: 231,
5368
5378
  S: this,
5369
5379
  A: [
5370
5380
  "this._config",
@@ -5373,7 +5383,7 @@ var ClientServicesHost = class {
5373
5383
  });
5374
5384
  invariant16(this._storage, "storage not set", {
5375
5385
  F: __dxlog_file18,
5376
- L: 220,
5386
+ L: 232,
5377
5387
  S: this,
5378
5388
  A: [
5379
5389
  "this._storage",
@@ -5382,7 +5392,7 @@ var ClientServicesHost = class {
5382
5392
  });
5383
5393
  invariant16(this._signalManager, "signal manager not set", {
5384
5394
  F: __dxlog_file18,
5385
- L: 221,
5395
+ L: 233,
5386
5396
  S: this,
5387
5397
  A: [
5388
5398
  "this._signalManager",
@@ -5391,7 +5401,7 @@ var ClientServicesHost = class {
5391
5401
  });
5392
5402
  invariant16(this._networkManager, "network manager not set", {
5393
5403
  F: __dxlog_file18,
5394
- L: 222,
5404
+ L: 234,
5395
5405
  S: this,
5396
5406
  A: [
5397
5407
  "this._networkManager",
@@ -5403,13 +5413,13 @@ var ClientServicesHost = class {
5403
5413
  lockKey: this._resourceLock?.lockKey
5404
5414
  }, {
5405
5415
  F: __dxlog_file18,
5406
- L: 225,
5416
+ L: 237,
5407
5417
  S: this,
5408
5418
  C: (f, a) => f(...a)
5409
5419
  });
5410
5420
  await this._resourceLock?.acquire();
5411
5421
  await this._loggingService.open();
5412
- this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._runtimeParams);
5422
+ this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory, this._runtimeParams);
5413
5423
  this._serviceRegistry.setServices({
5414
5424
  SystemService: this._systemService,
5415
5425
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
@@ -5437,7 +5447,7 @@ var ClientServicesHost = class {
5437
5447
  await this._serviceContext.open(ctx);
5438
5448
  invariant16(this.serviceRegistry.services.InvitationsService, void 0, {
5439
5449
  F: __dxlog_file18,
5440
- L: 286,
5450
+ L: 299,
5441
5451
  S: this,
5442
5452
  A: [
5443
5453
  "this.serviceRegistry.services.InvitationsService",
@@ -5449,7 +5459,7 @@ var ClientServicesHost = class {
5449
5459
  count: loadedInvitations.invitations?.length
5450
5460
  }, {
5451
5461
  F: __dxlog_file18,
5452
- L: 289,
5462
+ L: 302,
5453
5463
  S: this,
5454
5464
  C: (f, a) => f(...a)
5455
5465
  });
@@ -5471,7 +5481,7 @@ var ClientServicesHost = class {
5471
5481
  deviceKey
5472
5482
  }, {
5473
5483
  F: __dxlog_file18,
5474
- L: 306,
5484
+ L: 319,
5475
5485
  S: this,
5476
5486
  C: (f, a) => f(...a)
5477
5487
  });
@@ -5479,7 +5489,7 @@ var ClientServicesHost = class {
5479
5489
  id: traceId
5480
5490
  }), {
5481
5491
  F: __dxlog_file18,
5482
- L: 307,
5492
+ L: 320,
5483
5493
  S: this,
5484
5494
  C: (f, a) => f(...a)
5485
5495
  });
@@ -5493,7 +5503,7 @@ var ClientServicesHost = class {
5493
5503
  deviceKey
5494
5504
  }, {
5495
5505
  F: __dxlog_file18,
5496
- L: 318,
5506
+ L: 331,
5497
5507
  S: this,
5498
5508
  C: (f, a) => f(...a)
5499
5509
  });
@@ -5509,7 +5519,7 @@ var ClientServicesHost = class {
5509
5519
  deviceKey
5510
5520
  }, {
5511
5521
  F: __dxlog_file18,
5512
- L: 325,
5522
+ L: 338,
5513
5523
  S: this,
5514
5524
  C: (f, a) => f(...a)
5515
5525
  });
@@ -5520,13 +5530,13 @@ var ClientServicesHost = class {
5520
5530
  id: traceId
5521
5531
  }), {
5522
5532
  F: __dxlog_file18,
5523
- L: 330,
5533
+ L: 343,
5524
5534
  S: this,
5525
5535
  C: (f, a) => f(...a)
5526
5536
  });
5527
5537
  log15("resetting...", void 0, {
5528
5538
  F: __dxlog_file18,
5529
- L: 332,
5539
+ L: 345,
5530
5540
  S: this,
5531
5541
  C: (f, a) => f(...a)
5532
5542
  });
@@ -5534,7 +5544,7 @@ var ClientServicesHost = class {
5534
5544
  await this._storage.reset();
5535
5545
  log15("reset", void 0, {
5536
5546
  F: __dxlog_file18,
5537
- L: 335,
5547
+ L: 348,
5538
5548
  S: this,
5539
5549
  C: (f, a) => f(...a)
5540
5550
  });
@@ -5542,7 +5552,7 @@ var ClientServicesHost = class {
5542
5552
  id: traceId
5543
5553
  }), {
5544
5554
  F: __dxlog_file18,
5545
- L: 336,
5555
+ L: 349,
5546
5556
  S: this,
5547
5557
  C: (f, a) => f(...a)
5548
5558
  });
@@ -5557,7 +5567,7 @@ var ClientServicesHost = class {
5557
5567
  const automergeIndex = space.automergeSpaceState.rootUrl;
5558
5568
  invariant16(automergeIndex, void 0, {
5559
5569
  F: __dxlog_file18,
5560
- L: 351,
5570
+ L: 364,
5561
5571
  S: this,
5562
5572
  A: [
5563
5573
  "automergeIndex",
@@ -5625,6 +5635,7 @@ export {
5625
5635
  Lock,
5626
5636
  isLocked,
5627
5637
  createStorageObjects,
5638
+ createDefaultModelFactory,
5628
5639
  ClientServicesHost
5629
5640
  };
5630
- //# sourceMappingURL=chunk-4C7NKJXO.mjs.map
5641
+ //# sourceMappingURL=chunk-6C5245ZM.mjs.map