@dxos/client-services 0.4.10-main.6132afb → 0.4.10-main.697c7a4

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_OP35CLAW_exports = {};
30
- __export(chunk_OP35CLAW_exports, {
29
+ var chunk_NL45CUJT_exports = {};
30
+ __export(chunk_NL45CUJT_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -60,7 +60,7 @@ __export(chunk_OP35CLAW_exports, {
60
60
  subscribeToSpaces: () => subscribeToSpaces,
61
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
62
  });
63
- module.exports = __toCommonJS(chunk_OP35CLAW_exports);
63
+ module.exports = __toCommonJS(chunk_NL45CUJT_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,7 +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 import_echo_schema = require("@dxos/echo-schema");
235
+ var E = __toESM(require("@dxos/echo-schema"));
236
236
  var import_indexing2 = require("@dxos/indexing");
237
237
  var import_invariant16 = require("@dxos/invariant");
238
238
  var import_keys11 = require("@dxos/keys");
@@ -2886,7 +2886,7 @@ var getPlatform = () => {
2886
2886
  };
2887
2887
  }
2888
2888
  };
2889
- var DXOS_VERSION = "0.4.10-main.6132afb";
2889
+ var DXOS_VERSION = "0.4.10-main.697c7a4";
2890
2890
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2891
2891
  var DEFAULT_TIMEOUT = 1e3;
2892
2892
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -4431,7 +4431,7 @@ var SpacesServiceImpl = class {
4431
4431
  }
4432
4432
  };
4433
4433
  var getChannelId = (channel) => `user-channel/${channel}`;
4434
- var createLoadDocuments = (automergeHost) => (
4434
+ var createSelectedDocumentsIterator = (automergeHost) => (
4435
4435
  /**
4436
4436
  * Get object data blobs from Automerge Repo by ids.
4437
4437
  * @param ids
@@ -4444,17 +4444,17 @@ var createLoadDocuments = (automergeHost) => (
4444
4444
  await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
4445
4445
  const doc = handle.docSync();
4446
4446
  const hash = (0, import_automerge.getHeads)(doc).join("");
4447
- yield [
4447
+ yield doc.objects?.[objectId] ? [
4448
4448
  {
4449
4449
  id,
4450
4450
  object: doc.objects[objectId],
4451
4451
  currentHash: hash
4452
4452
  }
4453
- ];
4453
+ ] : [];
4454
4454
  }
4455
4455
  }
4456
4456
  );
4457
- var createGetAllDocuments = (automergeHost) => (
4457
+ var createDocumentsIterator = (automergeHost) => (
4458
4458
  /**
4459
4459
  * Recursively get all object data blobs from Automerge Repo.
4460
4460
  * @param ids
@@ -4477,7 +4477,7 @@ var createGetAllDocuments = (automergeHost) => (
4477
4477
  objectId
4478
4478
  }),
4479
4479
  object,
4480
- currentHash: heads.at(-1)
4480
+ currentHash: heads.join("")
4481
4481
  };
4482
4482
  });
4483
4483
  }
@@ -4559,8 +4559,8 @@ var ServiceContext = class {
4559
4559
  directory: storage.createDirectory("index-store")
4560
4560
  }),
4561
4561
  metadataStore: this.indexMetadata,
4562
- loadDocuments: createLoadDocuments(this.automergeHost),
4563
- getAllDocuments: createGetAllDocuments(this.automergeHost)
4562
+ loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
4563
+ getAllDocuments: createDocumentsIterator(this.automergeHost)
4564
4564
  });
4565
4565
  this.invitations = new InvitationsHandler(this.networkManager);
4566
4566
  this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
@@ -5524,12 +5524,10 @@ var ClientServicesHost = class {
5524
5524
  const identity = await this._serviceContext.createIdentity(params);
5525
5525
  await this._serviceContext.initialized.wait();
5526
5526
  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
5527
  const automergeIndex = space.automergeSpaceState.rootUrl;
5530
5528
  (0, import_invariant16.invariant)(automergeIndex, void 0, {
5531
5529
  F: __dxlog_file18,
5532
- L: 354,
5530
+ L: 351,
5533
5531
  S: this,
5534
5532
  A: [
5535
5533
  "automergeIndex",
@@ -5538,12 +5536,25 @@ var ClientServicesHost = class {
5538
5536
  });
5539
5537
  const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5540
5538
  await document.whenReady();
5539
+ const properties = {
5540
+ system: {
5541
+ type: (0, import_echo_pipeline4.encodeReference)(E.getTypeReference(import_client_protocol5.Properties))
5542
+ },
5543
+ data: {
5544
+ [import_client_protocol5.defaultKey]: identity.identityKey.toHex()
5545
+ },
5546
+ meta: {
5547
+ keys: []
5548
+ }
5549
+ };
5550
+ const propertiesId = import_keys11.PublicKey.random().toHex();
5541
5551
  document.change((doc) => {
5542
5552
  (0, import_util9.assignDeep)(doc, [
5543
5553
  "objects",
5544
- (0, import_echo_schema.getAutomergeObjectCore)(obj).id
5545
- ], (0, import_echo_schema.getRawDoc)(obj).handle.docSync());
5554
+ propertiesId
5555
+ ], properties);
5546
5556
  });
5557
+ await this._serviceContext.automergeHost.repo.flush();
5547
5558
  return identity;
5548
5559
  }
5549
5560
  };
@@ -5598,4 +5609,4 @@ ClientServicesHost = _ts_decorate8([
5598
5609
  subscribeToSpaces,
5599
5610
  subscribeToSwarmInfo
5600
5611
  });
5601
- //# sourceMappingURL=chunk-OP35CLAW.cjs.map
5612
+ //# sourceMappingURL=chunk-NL45CUJT.cjs.map