@dxos/client-services 0.4.10-main.b39148d → 0.4.10-main.b3cf40d

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_UW65NO7Q_exports = {};
30
- __export(chunk_UW65NO7Q_exports, {
29
+ var chunk_OYV4Y6T4_exports = {};
30
+ __export(chunk_OYV4Y6T4_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -60,7 +60,7 @@ __export(chunk_UW65NO7Q_exports, {
60
60
  subscribeToSpaces: () => subscribeToSpaces,
61
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
62
  });
63
- module.exports = __toCommonJS(chunk_UW65NO7Q_exports);
63
+ module.exports = __toCommonJS(chunk_OYV4Y6T4_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");
@@ -232,6 +232,7 @@ var import_async16 = require("@dxos/async");
232
232
  var import_client_protocol5 = require("@dxos/client-protocol");
233
233
  var import_context11 = require("@dxos/context");
234
234
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
235
+ var E = __toESM(require("@dxos/echo-schema"));
235
236
  var import_echo_schema = require("@dxos/echo-schema");
236
237
  var import_indexing2 = require("@dxos/indexing");
237
238
  var import_invariant16 = require("@dxos/invariant");
@@ -2886,7 +2887,7 @@ var getPlatform = () => {
2886
2887
  };
2887
2888
  }
2888
2889
  };
2889
- var DXOS_VERSION = "0.4.10-main.b39148d";
2890
+ var DXOS_VERSION = "0.4.10-main.b3cf40d";
2890
2891
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2891
2892
  var DEFAULT_TIMEOUT = 1e3;
2892
2893
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -4431,7 +4432,7 @@ var SpacesServiceImpl = class {
4431
4432
  }
4432
4433
  };
4433
4434
  var getChannelId = (channel) => `user-channel/${channel}`;
4434
- var createLoadDocuments = (automergeHost) => (
4435
+ var createSelectedDocumentsIterator = (automergeHost) => (
4435
4436
  /**
4436
4437
  * Get object data blobs from Automerge Repo by ids.
4437
4438
  * @param ids
@@ -4444,17 +4445,17 @@ var createLoadDocuments = (automergeHost) => (
4444
4445
  await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
4445
4446
  const doc = handle.docSync();
4446
4447
  const hash = (0, import_automerge.getHeads)(doc).join("");
4447
- yield [
4448
+ yield doc.objects?.[objectId] ? [
4448
4449
  {
4449
4450
  id,
4450
4451
  object: doc.objects[objectId],
4451
4452
  currentHash: hash
4452
4453
  }
4453
- ];
4454
+ ] : [];
4454
4455
  }
4455
4456
  }
4456
4457
  );
4457
- var createGetAllDocuments = (automergeHost) => (
4458
+ var createDocumentsIterator = (automergeHost) => (
4458
4459
  /**
4459
4460
  * Recursively get all object data blobs from Automerge Repo.
4460
4461
  * @param ids
@@ -4477,7 +4478,7 @@ var createGetAllDocuments = (automergeHost) => (
4477
4478
  objectId
4478
4479
  }),
4479
4480
  object,
4480
- currentHash: heads.at(-1)
4481
+ currentHash: heads.join("")
4481
4482
  };
4482
4483
  });
4483
4484
  }
@@ -4559,8 +4560,8 @@ var ServiceContext = class {
4559
4560
  directory: storage.createDirectory("index-store")
4560
4561
  }),
4561
4562
  metadataStore: this.indexMetadata,
4562
- loadDocuments: createLoadDocuments(this.automergeHost),
4563
- getAllDocuments: createGetAllDocuments(this.automergeHost)
4563
+ loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
4564
+ getAllDocuments: createDocumentsIterator(this.automergeHost)
4564
4565
  });
4565
4566
  this.invitations = new InvitationsHandler(this.networkManager);
4566
4567
  this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
@@ -5260,7 +5261,7 @@ var ClientServicesHost = class {
5260
5261
  initialize({ config, ...options }) {
5261
5262
  (0, import_invariant16.invariant)(!this._open, "service host is open", {
5262
5263
  F: __dxlog_file18,
5263
- L: 179,
5264
+ L: 180,
5264
5265
  S: this,
5265
5266
  A: [
5266
5267
  "!this._open",
@@ -5269,14 +5270,14 @@ var ClientServicesHost = class {
5269
5270
  });
5270
5271
  (0, import_log14.log)("initializing...", void 0, {
5271
5272
  F: __dxlog_file18,
5272
- L: 180,
5273
+ L: 181,
5273
5274
  S: this,
5274
5275
  C: (f, a) => f(...a)
5275
5276
  });
5276
5277
  if (config) {
5277
5278
  (0, import_invariant16.invariant)(!this._config, "config already set", {
5278
5279
  F: __dxlog_file18,
5279
- L: 183,
5280
+ L: 184,
5280
5281
  S: this,
5281
5282
  A: [
5282
5283
  "!this._config",
@@ -5291,7 +5292,7 @@ var ClientServicesHost = class {
5291
5292
  if (!options.signalManager) {
5292
5293
  import_log14.log.warn("running signaling without telemetry metadata.", void 0, {
5293
5294
  F: __dxlog_file18,
5294
- L: 191,
5295
+ L: 192,
5295
5296
  S: this,
5296
5297
  C: (f, a) => f(...a)
5297
5298
  });
@@ -5302,7 +5303,7 @@ var ClientServicesHost = class {
5302
5303
  this._signalManager = signalManager;
5303
5304
  (0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
5304
5305
  F: __dxlog_file18,
5305
- L: 202,
5306
+ L: 203,
5306
5307
  S: this,
5307
5308
  A: [
5308
5309
  "!this._networkManager",
@@ -5316,7 +5317,7 @@ var ClientServicesHost = class {
5316
5317
  });
5317
5318
  (0, import_log14.log)("initialized", void 0, {
5318
5319
  F: __dxlog_file18,
5319
- L: 209,
5320
+ L: 210,
5320
5321
  S: this,
5321
5322
  C: (f, a) => f(...a)
5322
5323
  });
@@ -5330,13 +5331,13 @@ var ClientServicesHost = class {
5330
5331
  id: traceId
5331
5332
  }), {
5332
5333
  F: __dxlog_file18,
5333
- L: 220,
5334
+ L: 221,
5334
5335
  S: this,
5335
5336
  C: (f, a) => f(...a)
5336
5337
  });
5337
5338
  (0, import_invariant16.invariant)(this._config, "config not set", {
5338
5339
  F: __dxlog_file18,
5339
- L: 222,
5340
+ L: 223,
5340
5341
  S: this,
5341
5342
  A: [
5342
5343
  "this._config",
@@ -5345,7 +5346,7 @@ var ClientServicesHost = class {
5345
5346
  });
5346
5347
  (0, import_invariant16.invariant)(this._storage, "storage not set", {
5347
5348
  F: __dxlog_file18,
5348
- L: 223,
5349
+ L: 224,
5349
5350
  S: this,
5350
5351
  A: [
5351
5352
  "this._storage",
@@ -5354,7 +5355,7 @@ var ClientServicesHost = class {
5354
5355
  });
5355
5356
  (0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
5356
5357
  F: __dxlog_file18,
5357
- L: 224,
5358
+ L: 225,
5358
5359
  S: this,
5359
5360
  A: [
5360
5361
  "this._signalManager",
@@ -5363,7 +5364,7 @@ var ClientServicesHost = class {
5363
5364
  });
5364
5365
  (0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
5365
5366
  F: __dxlog_file18,
5366
- L: 225,
5367
+ L: 226,
5367
5368
  S: this,
5368
5369
  A: [
5369
5370
  "this._networkManager",
@@ -5375,7 +5376,7 @@ var ClientServicesHost = class {
5375
5376
  lockKey: this._resourceLock?.lockKey
5376
5377
  }, {
5377
5378
  F: __dxlog_file18,
5378
- L: 228,
5379
+ L: 229,
5379
5380
  S: this,
5380
5381
  C: (f, a) => f(...a)
5381
5382
  });
@@ -5409,7 +5410,7 @@ var ClientServicesHost = class {
5409
5410
  await this._serviceContext.open(ctx);
5410
5411
  (0, import_invariant16.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
5411
5412
  F: __dxlog_file18,
5412
- L: 289,
5413
+ L: 290,
5413
5414
  S: this,
5414
5415
  A: [
5415
5416
  "this.serviceRegistry.services.InvitationsService",
@@ -5421,7 +5422,7 @@ var ClientServicesHost = class {
5421
5422
  count: loadedInvitations.invitations?.length
5422
5423
  }, {
5423
5424
  F: __dxlog_file18,
5424
- L: 292,
5425
+ L: 293,
5425
5426
  S: this,
5426
5427
  C: (f, a) => f(...a)
5427
5428
  });
@@ -5443,7 +5444,7 @@ var ClientServicesHost = class {
5443
5444
  deviceKey
5444
5445
  }, {
5445
5446
  F: __dxlog_file18,
5446
- L: 309,
5447
+ L: 310,
5447
5448
  S: this,
5448
5449
  C: (f, a) => f(...a)
5449
5450
  });
@@ -5451,7 +5452,7 @@ var ClientServicesHost = class {
5451
5452
  id: traceId
5452
5453
  }), {
5453
5454
  F: __dxlog_file18,
5454
- L: 310,
5455
+ L: 311,
5455
5456
  S: this,
5456
5457
  C: (f, a) => f(...a)
5457
5458
  });
@@ -5465,7 +5466,7 @@ var ClientServicesHost = class {
5465
5466
  deviceKey
5466
5467
  }, {
5467
5468
  F: __dxlog_file18,
5468
- L: 321,
5469
+ L: 322,
5469
5470
  S: this,
5470
5471
  C: (f, a) => f(...a)
5471
5472
  });
@@ -5481,7 +5482,7 @@ var ClientServicesHost = class {
5481
5482
  deviceKey
5482
5483
  }, {
5483
5484
  F: __dxlog_file18,
5484
- L: 328,
5485
+ L: 329,
5485
5486
  S: this,
5486
5487
  C: (f, a) => f(...a)
5487
5488
  });
@@ -5492,13 +5493,13 @@ var ClientServicesHost = class {
5492
5493
  id: traceId
5493
5494
  }), {
5494
5495
  F: __dxlog_file18,
5495
- L: 333,
5496
+ L: 334,
5496
5497
  S: this,
5497
5498
  C: (f, a) => f(...a)
5498
5499
  });
5499
5500
  (0, import_log14.log)("resetting...", void 0, {
5500
5501
  F: __dxlog_file18,
5501
- L: 335,
5502
+ L: 336,
5502
5503
  S: this,
5503
5504
  C: (f, a) => f(...a)
5504
5505
  });
@@ -5506,7 +5507,7 @@ var ClientServicesHost = class {
5506
5507
  await this._storage.reset();
5507
5508
  (0, import_log14.log)("reset", void 0, {
5508
5509
  F: __dxlog_file18,
5509
- L: 338,
5510
+ L: 339,
5510
5511
  S: this,
5511
5512
  C: (f, a) => f(...a)
5512
5513
  });
@@ -5514,7 +5515,7 @@ var ClientServicesHost = class {
5514
5515
  id: traceId
5515
5516
  }), {
5516
5517
  F: __dxlog_file18,
5517
- L: 339,
5518
+ L: 340,
5518
5519
  S: this,
5519
5520
  C: (f, a) => f(...a)
5520
5521
  });
@@ -5524,12 +5525,10 @@ var ClientServicesHost = class {
5524
5525
  const identity = await this._serviceContext.createIdentity(params);
5525
5526
  await this._serviceContext.initialized.wait();
5526
5527
  const space = await this._serviceContext.dataSpaceManager.createSpace();
5527
- const obj = new import_client_protocol5.Properties(void 0);
5528
- obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
5529
5528
  const automergeIndex = space.automergeSpaceState.rootUrl;
5530
5529
  (0, import_invariant16.invariant)(automergeIndex, void 0, {
5531
5530
  F: __dxlog_file18,
5532
- L: 354,
5531
+ L: 352,
5533
5532
  S: this,
5534
5533
  A: [
5535
5534
  "automergeIndex",
@@ -5538,12 +5537,18 @@ var ClientServicesHost = class {
5538
5537
  });
5539
5538
  const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5540
5539
  await document.whenReady();
5540
+ const objectDocument = (0, import_echo_schema.createRawObjectDoc)({
5541
+ [import_client_protocol5.defaultKey]: identity.identityKey.toHex()
5542
+ }, {
5543
+ type: E.getTypeReference(import_client_protocol5.PropertiesSchema)
5544
+ });
5541
5545
  document.change((doc) => {
5542
5546
  (0, import_util9.assignDeep)(doc, [
5543
5547
  "objects",
5544
- (0, import_echo_schema.getAutomergeObjectCore)(obj).id
5545
- ], (0, import_echo_schema.getRawDoc)(obj).handle.docSync());
5548
+ objectDocument.id
5549
+ ], objectDocument.handle.docSync());
5546
5550
  });
5551
+ await (0, import_async16.sleep)(200);
5547
5552
  return identity;
5548
5553
  }
5549
5554
  };
@@ -5598,4 +5603,4 @@ ClientServicesHost = _ts_decorate8([
5598
5603
  subscribeToSpaces,
5599
5604
  subscribeToSwarmInfo
5600
5605
  });
5601
- //# sourceMappingURL=chunk-UW65NO7Q.cjs.map
5606
+ //# sourceMappingURL=chunk-OYV4Y6T4.cjs.map