@dxos/client-services 0.3.11-main.8d54a30 → 0.3.11-main.8feb6a5

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_FFVCPJTG_exports = {};
30
- __export(chunk_FFVCPJTG_exports, {
29
+ var chunk_72F5Z47S_exports = {};
30
+ __export(chunk_72F5Z47S_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -60,7 +60,7 @@ __export(chunk_FFVCPJTG_exports, {
60
60
  subscribeToSpaces: () => subscribeToSpaces,
61
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
62
  });
63
- module.exports = __toCommonJS(chunk_FFVCPJTG_exports);
63
+ module.exports = __toCommonJS(chunk_72F5Z47S_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");
@@ -1197,6 +1197,7 @@ IdentityManager = _ts_decorate2([
1197
1197
  import_tracing2.trace.resource()
1198
1198
  ], IdentityManager);
1199
1199
  var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1200
+ var CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT = true;
1200
1201
  var IdentityServiceImpl = class {
1201
1202
  constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
1202
1203
  this._createIdentity = _createIdentity;
@@ -1205,7 +1206,7 @@ var IdentityServiceImpl = class {
1205
1206
  this._onProfileUpdate = _onProfileUpdate;
1206
1207
  }
1207
1208
  async createIdentity(request) {
1208
- await this._createIdentity(request);
1209
+ await this._createIdentity(request.profile ?? {}, request.useAutomerge ?? CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT);
1209
1210
  return this._getIdentity();
1210
1211
  }
1211
1212
  async recoverIdentity(request) {
@@ -1233,7 +1234,7 @@ var IdentityServiceImpl = class {
1233
1234
  async updateProfile(profile) {
1234
1235
  (0, import_invariant3.invariant)(this._identityManager.identity, "Identity not initialized.", {
1235
1236
  F: __dxlog_file4,
1236
- L: 60,
1237
+ L: 63,
1237
1238
  S: this,
1238
1239
  A: [
1239
1240
  "this._identityManager.identity",
@@ -1247,7 +1248,7 @@ var IdentityServiceImpl = class {
1247
1248
  async signPresentation({ presentation, nonce }) {
1248
1249
  (0, import_invariant3.invariant)(this._identityManager.identity, "Identity not initialized.", {
1249
1250
  F: __dxlog_file4,
1250
- L: 67,
1251
+ L: 70,
1251
1252
  S: this,
1252
1253
  A: [
1253
1254
  "this._identityManager.identity",
@@ -2110,6 +2111,7 @@ var InvitationsHandler = class {
2110
2111
  });
2111
2112
  setState({
2112
2113
  ...result,
2114
+ target: invitation.target,
2113
2115
  state: import_services2.Invitation.State.SUCCESS
2114
2116
  });
2115
2117
  import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.end({
@@ -2649,7 +2651,7 @@ var getPlatform = () => {
2649
2651
  };
2650
2652
  }
2651
2653
  };
2652
- var DXOS_VERSION = "0.3.11-main.8d54a30";
2654
+ var DXOS_VERSION = "0.3.11-main.8feb6a5";
2653
2655
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2654
2656
  var DEFAULT_TIMEOUT = 1e3;
2655
2657
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -4884,7 +4886,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4884
4886
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4885
4887
  this._serviceRegistry.setServices({
4886
4888
  SystemService: this._systemService,
4887
- IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
4889
+ IdentityService: new IdentityServiceImpl((params, useAutomerge) => this._createIdentity(params, useAutomerge), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
4888
4890
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4889
4891
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4890
4892
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
@@ -4998,25 +5000,44 @@ var ClientServicesHost = class ClientServicesHost2 {
4998
5000
  });
4999
5001
  await this._callbacks?.onReset?.();
5000
5002
  }
5001
- async _createIdentity(params) {
5003
+ async _createIdentity(params, useAutomerge) {
5002
5004
  const identity = await this._serviceContext.createIdentity(params);
5003
5005
  await this._serviceContext.initialized.wait();
5004
5006
  const space = await this._serviceContext.dataSpaceManager.createSpace();
5005
5007
  const obj = new import_client_protocol5.Properties(void 0, {
5006
- automerge: false
5008
+ automerge: useAutomerge
5007
5009
  });
5008
5010
  obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
5009
- await this._serviceRegistry.services.DataService.write({
5010
- spaceKey: space.key,
5011
- batch: {
5012
- objects: [
5013
- createGenesisMutationFromTypedObject(obj)
5011
+ if (!useAutomerge) {
5012
+ await this._serviceRegistry.services.DataService.write({
5013
+ spaceKey: space.key,
5014
+ batch: {
5015
+ objects: [
5016
+ createGenesisMutationFromTypedObject(obj)
5017
+ ]
5018
+ }
5019
+ });
5020
+ await this._serviceRegistry.services.DataService.flush({
5021
+ spaceKey: space.key
5022
+ });
5023
+ } else {
5024
+ const automergeIndex = space.automergeSpaceState.rootUrl;
5025
+ (0, import_invariant15.invariant)(automergeIndex, void 0, {
5026
+ F: __dxlog_file17,
5027
+ L: 375,
5028
+ S: this,
5029
+ A: [
5030
+ "automergeIndex",
5031
+ ""
5014
5032
  ]
5015
- }
5016
- });
5017
- await this._serviceRegistry.services.DataService.flush({
5018
- spaceKey: space.key
5019
- });
5033
+ });
5034
+ const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5035
+ await document.whenReady();
5036
+ document.change((doc) => {
5037
+ doc.objects ??= {};
5038
+ doc.objects[obj[import_echo_schema.base]._id] = (0, import_echo_schema.getRawDoc)(obj).handle.docSync();
5039
+ });
5040
+ }
5020
5041
  return identity;
5021
5042
  }
5022
5043
  };
@@ -5071,4 +5092,4 @@ ClientServicesHost = _ts_decorate8([
5071
5092
  subscribeToSpaces,
5072
5093
  subscribeToSwarmInfo
5073
5094
  });
5074
- //# sourceMappingURL=chunk-FFVCPJTG.cjs.map
5095
+ //# sourceMappingURL=chunk-72F5Z47S.cjs.map