@dxos/client-services 0.3.11-main.8be6c8a → 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.
@@ -1025,6 +1025,7 @@ import { signPresentation } from "@dxos/credentials";
1025
1025
  import { todo } from "@dxos/debug";
1026
1026
  import { invariant as invariant3 } from "@dxos/invariant";
1027
1027
  var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1028
+ var CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT = true;
1028
1029
  var IdentityServiceImpl = class {
1029
1030
  constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
1030
1031
  this._createIdentity = _createIdentity;
@@ -1033,7 +1034,7 @@ var IdentityServiceImpl = class {
1033
1034
  this._onProfileUpdate = _onProfileUpdate;
1034
1035
  }
1035
1036
  async createIdentity(request) {
1036
- await this._createIdentity(request);
1037
+ await this._createIdentity(request.profile ?? {}, request.useAutomerge ?? CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT);
1037
1038
  return this._getIdentity();
1038
1039
  }
1039
1040
  async recoverIdentity(request) {
@@ -1061,7 +1062,7 @@ var IdentityServiceImpl = class {
1061
1062
  async updateProfile(profile) {
1062
1063
  invariant3(this._identityManager.identity, "Identity not initialized.", {
1063
1064
  F: __dxlog_file4,
1064
- L: 60,
1065
+ L: 63,
1065
1066
  S: this,
1066
1067
  A: [
1067
1068
  "this._identityManager.identity",
@@ -1075,7 +1076,7 @@ var IdentityServiceImpl = class {
1075
1076
  async signPresentation({ presentation, nonce }) {
1076
1077
  invariant3(this._identityManager.identity, "Identity not initialized.", {
1077
1078
  F: __dxlog_file4,
1078
- L: 67,
1079
+ L: 70,
1079
1080
  S: this,
1080
1081
  A: [
1081
1082
  "this._identityManager.identity",
@@ -1968,6 +1969,7 @@ var InvitationsHandler = class {
1968
1969
  });
1969
1970
  setState({
1970
1971
  ...result,
1972
+ target: invitation.target,
1971
1973
  state: Invitation3.State.SUCCESS
1972
1974
  });
1973
1975
  log5.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.end({
@@ -2541,7 +2543,7 @@ var getPlatform = () => {
2541
2543
  };
2542
2544
 
2543
2545
  // packages/sdk/client-services/src/version.ts
2544
- var DXOS_VERSION = "0.3.11-main.8be6c8a";
2546
+ var DXOS_VERSION = "0.3.11-main.8feb6a5";
2545
2547
 
2546
2548
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2547
2549
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -4489,7 +4491,7 @@ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protoc
4489
4491
  import { Context as Context10 } from "@dxos/context";
4490
4492
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4491
4493
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4492
- import { base } from "@dxos/echo-schema";
4494
+ import { base, getRawDoc } from "@dxos/echo-schema";
4493
4495
  import { invariant as invariant14 } from "@dxos/invariant";
4494
4496
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4495
4497
  import { log as log16 } from "@dxos/log";
@@ -4978,7 +4980,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4978
4980
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
4979
4981
  this._serviceRegistry.setServices({
4980
4982
  SystemService: this._systemService,
4981
- IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
4983
+ IdentityService: new IdentityServiceImpl((params, useAutomerge) => this._createIdentity(params, useAutomerge), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
4982
4984
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
4983
4985
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
4984
4986
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
@@ -5092,25 +5094,44 @@ var ClientServicesHost = class ClientServicesHost2 {
5092
5094
  });
5093
5095
  await this._callbacks?.onReset?.();
5094
5096
  }
5095
- async _createIdentity(params) {
5097
+ async _createIdentity(params, useAutomerge) {
5096
5098
  const identity = await this._serviceContext.createIdentity(params);
5097
5099
  await this._serviceContext.initialized.wait();
5098
5100
  const space = await this._serviceContext.dataSpaceManager.createSpace();
5099
5101
  const obj = new Properties(void 0, {
5100
- automerge: false
5102
+ automerge: useAutomerge
5101
5103
  });
5102
5104
  obj[defaultKey] = identity.identityKey.toHex();
5103
- await this._serviceRegistry.services.DataService.write({
5104
- spaceKey: space.key,
5105
- batch: {
5106
- objects: [
5107
- createGenesisMutationFromTypedObject(obj)
5105
+ if (!useAutomerge) {
5106
+ await this._serviceRegistry.services.DataService.write({
5107
+ spaceKey: space.key,
5108
+ batch: {
5109
+ objects: [
5110
+ createGenesisMutationFromTypedObject(obj)
5111
+ ]
5112
+ }
5113
+ });
5114
+ await this._serviceRegistry.services.DataService.flush({
5115
+ spaceKey: space.key
5116
+ });
5117
+ } else {
5118
+ const automergeIndex = space.automergeSpaceState.rootUrl;
5119
+ invariant14(automergeIndex, void 0, {
5120
+ F: __dxlog_file17,
5121
+ L: 375,
5122
+ S: this,
5123
+ A: [
5124
+ "automergeIndex",
5125
+ ""
5108
5126
  ]
5109
- }
5110
- });
5111
- await this._serviceRegistry.services.DataService.flush({
5112
- spaceKey: space.key
5113
- });
5127
+ });
5128
+ const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5129
+ await document.whenReady();
5130
+ document.change((doc) => {
5131
+ doc.objects ??= {};
5132
+ doc.objects[obj[base]._id] = getRawDoc(obj).handle.docSync();
5133
+ });
5134
+ }
5114
5135
  return identity;
5115
5136
  }
5116
5137
  };
@@ -5166,4 +5187,4 @@ export {
5166
5187
  createDefaultModelFactory,
5167
5188
  ClientServicesHost
5168
5189
  };
5169
- //# sourceMappingURL=chunk-APOYKFE7.mjs.map
5190
+ //# sourceMappingURL=chunk-NL2YAECI.mjs.map