@dxos/client-services 0.4.4 → 0.4.5-main.b5b1909

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,7 +1025,6 @@ 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;
1029
1028
  var IdentityServiceImpl = class {
1030
1029
  constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
1031
1030
  this._createIdentity = _createIdentity;
@@ -1034,7 +1033,7 @@ var IdentityServiceImpl = class {
1034
1033
  this._onProfileUpdate = _onProfileUpdate;
1035
1034
  }
1036
1035
  async createIdentity(request) {
1037
- await this._createIdentity(request.profile ?? {}, request.useAutomerge ?? CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT);
1036
+ await this._createIdentity(request.profile ?? {});
1038
1037
  return this._getIdentity();
1039
1038
  }
1040
1039
  async recoverIdentity(request) {
@@ -1062,7 +1061,7 @@ var IdentityServiceImpl = class {
1062
1061
  async updateProfile(profile) {
1063
1062
  invariant3(this._identityManager.identity, "Identity not initialized.", {
1064
1063
  F: __dxlog_file4,
1065
- L: 63,
1064
+ L: 61,
1066
1065
  S: this,
1067
1066
  A: [
1068
1067
  "this._identityManager.identity",
@@ -1076,7 +1075,7 @@ var IdentityServiceImpl = class {
1076
1075
  async signPresentation({ presentation, nonce }) {
1077
1076
  invariant3(this._identityManager.identity, "Identity not initialized.", {
1078
1077
  F: __dxlog_file4,
1079
- L: 70,
1078
+ L: 68,
1080
1079
  S: this,
1081
1080
  A: [
1082
1081
  "this._identityManager.identity",
@@ -2566,7 +2565,7 @@ var getPlatform = () => {
2566
2565
  };
2567
2566
 
2568
2567
  // packages/sdk/client-services/src/version.ts
2569
- var DXOS_VERSION = "0.4.4";
2568
+ var DXOS_VERSION = "0.4.5-main.b5b1909";
2570
2569
 
2571
2570
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2572
2571
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -3325,9 +3324,11 @@ var DataSpace = class {
3325
3324
  return;
3326
3325
  }
3327
3326
  const doc = handle.docSync() ?? failedInvariant();
3328
- if (!doc.experimental_spaceKey) {
3327
+ if (!doc.access?.spaceKey) {
3329
3328
  handle.change((doc2) => {
3330
- doc2.experimental_spaceKey = this.key.toHex();
3329
+ doc2.access = {
3330
+ spaceKey: this.key.toHex()
3331
+ };
3331
3332
  });
3332
3333
  }
3333
3334
  } catch (err) {
@@ -3706,7 +3707,9 @@ var DataSpaceManager = class {
3706
3707
  });
3707
3708
  const automergeRoot = this._automergeHost.repo.create();
3708
3709
  automergeRoot.change((doc) => {
3709
- doc.experimental_spaceKey = spaceKey.toHex();
3710
+ doc.access = {
3711
+ spaceKey: spaceKey.toHex()
3712
+ };
3710
3713
  });
3711
3714
  const space = await this._constructSpace(metadata);
3712
3715
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
@@ -4614,6 +4617,7 @@ import { trace as trace9 } from "@dxos/protocols";
4614
4617
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
4615
4618
  import { TextModel } from "@dxos/text-model";
4616
4619
  import { TRACE_PROCESSOR as TRACE_PROCESSOR2, trace as Trace3 } from "@dxos/tracing";
4620
+ import { assignDeep } from "@dxos/util";
4617
4621
  import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4618
4622
 
4619
4623
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
@@ -4882,18 +4886,6 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4882
4886
  var createDefaultModelFactory = () => {
4883
4887
  return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
4884
4888
  };
4885
- var createGenesisMutationFromTypedObject = (obj) => {
4886
- const snapshot = obj[base]._createSnapshot();
4887
- return {
4888
- objectId: obj[base]._id,
4889
- genesis: {
4890
- modelType: obj[base]._modelConstructor.meta.type
4891
- },
4892
- snapshot: {
4893
- model: snapshot
4894
- }
4895
- };
4896
- };
4897
4889
  var ClientServicesHost = class {
4898
4890
  constructor({
4899
4891
  config,
@@ -4980,7 +4972,7 @@ var ClientServicesHost = class {
4980
4972
  initialize({ config, ...options }) {
4981
4973
  invariant14(!this._open, "service host is open", {
4982
4974
  F: __dxlog_file17,
4983
- L: 201,
4975
+ L: 186,
4984
4976
  S: this,
4985
4977
  A: [
4986
4978
  "!this._open",
@@ -4989,14 +4981,14 @@ var ClientServicesHost = class {
4989
4981
  });
4990
4982
  log16("initializing...", void 0, {
4991
4983
  F: __dxlog_file17,
4992
- L: 202,
4984
+ L: 187,
4993
4985
  S: this,
4994
4986
  C: (f, a) => f(...a)
4995
4987
  });
4996
4988
  if (config) {
4997
4989
  invariant14(!this._config, "config already set", {
4998
4990
  F: __dxlog_file17,
4999
- L: 205,
4991
+ L: 190,
5000
4992
  S: this,
5001
4993
  A: [
5002
4994
  "!this._config",
@@ -5014,7 +5006,7 @@ var ClientServicesHost = class {
5014
5006
  this._signalManager = signalManager;
5015
5007
  invariant14(!this._networkManager, "network manager already set", {
5016
5008
  F: __dxlog_file17,
5017
- L: 221,
5009
+ L: 206,
5018
5010
  S: this,
5019
5011
  A: [
5020
5012
  "!this._networkManager",
@@ -5028,7 +5020,7 @@ var ClientServicesHost = class {
5028
5020
  });
5029
5021
  log16("initialized", void 0, {
5030
5022
  F: __dxlog_file17,
5031
- L: 228,
5023
+ L: 213,
5032
5024
  S: this,
5033
5025
  C: (f, a) => f(...a)
5034
5026
  });
@@ -5042,13 +5034,13 @@ var ClientServicesHost = class {
5042
5034
  id: traceId
5043
5035
  }), {
5044
5036
  F: __dxlog_file17,
5045
- L: 239,
5037
+ L: 224,
5046
5038
  S: this,
5047
5039
  C: (f, a) => f(...a)
5048
5040
  });
5049
5041
  invariant14(this._config, "config not set", {
5050
5042
  F: __dxlog_file17,
5051
- L: 241,
5043
+ L: 226,
5052
5044
  S: this,
5053
5045
  A: [
5054
5046
  "this._config",
@@ -5057,7 +5049,7 @@ var ClientServicesHost = class {
5057
5049
  });
5058
5050
  invariant14(this._storage, "storage not set", {
5059
5051
  F: __dxlog_file17,
5060
- L: 242,
5052
+ L: 227,
5061
5053
  S: this,
5062
5054
  A: [
5063
5055
  "this._storage",
@@ -5066,7 +5058,7 @@ var ClientServicesHost = class {
5066
5058
  });
5067
5059
  invariant14(this._signalManager, "signal manager not set", {
5068
5060
  F: __dxlog_file17,
5069
- L: 243,
5061
+ L: 228,
5070
5062
  S: this,
5071
5063
  A: [
5072
5064
  "this._signalManager",
@@ -5075,7 +5067,7 @@ var ClientServicesHost = class {
5075
5067
  });
5076
5068
  invariant14(this._networkManager, "network manager not set", {
5077
5069
  F: __dxlog_file17,
5078
- L: 244,
5070
+ L: 229,
5079
5071
  S: this,
5080
5072
  A: [
5081
5073
  "this._networkManager",
@@ -5087,7 +5079,7 @@ var ClientServicesHost = class {
5087
5079
  lockKey: this._resourceLock?.lockKey
5088
5080
  }, {
5089
5081
  F: __dxlog_file17,
5090
- L: 247,
5082
+ L: 232,
5091
5083
  S: this,
5092
5084
  C: (f, a) => f(...a)
5093
5085
  });
@@ -5096,7 +5088,7 @@ var ClientServicesHost = class {
5096
5088
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
5097
5089
  this._serviceRegistry.setServices({
5098
5090
  SystemService: this._systemService,
5099
- IdentityService: new IdentityServiceImpl((params, useAutomerge) => this._createIdentity(params, useAutomerge), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
5091
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
5100
5092
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
5101
5093
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
5102
5094
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
@@ -5133,7 +5125,7 @@ var ClientServicesHost = class {
5133
5125
  deviceKey
5134
5126
  }, {
5135
5127
  F: __dxlog_file17,
5136
- L: 320,
5128
+ L: 305,
5137
5129
  S: this,
5138
5130
  C: (f, a) => f(...a)
5139
5131
  });
@@ -5141,7 +5133,7 @@ var ClientServicesHost = class {
5141
5133
  id: traceId
5142
5134
  }), {
5143
5135
  F: __dxlog_file17,
5144
- L: 321,
5136
+ L: 306,
5145
5137
  S: this,
5146
5138
  C: (f, a) => f(...a)
5147
5139
  });
@@ -5155,7 +5147,7 @@ var ClientServicesHost = class {
5155
5147
  deviceKey
5156
5148
  }, {
5157
5149
  F: __dxlog_file17,
5158
- L: 332,
5150
+ L: 317,
5159
5151
  S: this,
5160
5152
  C: (f, a) => f(...a)
5161
5153
  });
@@ -5171,7 +5163,7 @@ var ClientServicesHost = class {
5171
5163
  deviceKey
5172
5164
  }, {
5173
5165
  F: __dxlog_file17,
5174
- L: 339,
5166
+ L: 324,
5175
5167
  S: this,
5176
5168
  C: (f, a) => f(...a)
5177
5169
  });
@@ -5182,13 +5174,13 @@ var ClientServicesHost = class {
5182
5174
  id: traceId
5183
5175
  }), {
5184
5176
  F: __dxlog_file17,
5185
- L: 344,
5177
+ L: 329,
5186
5178
  S: this,
5187
5179
  C: (f, a) => f(...a)
5188
5180
  });
5189
5181
  log16("resetting...", void 0, {
5190
5182
  F: __dxlog_file17,
5191
- L: 346,
5183
+ L: 331,
5192
5184
  S: this,
5193
5185
  C: (f, a) => f(...a)
5194
5186
  });
@@ -5196,7 +5188,7 @@ var ClientServicesHost = class {
5196
5188
  await this._storage.reset();
5197
5189
  log16("reset", void 0, {
5198
5190
  F: __dxlog_file17,
5199
- L: 349,
5191
+ L: 334,
5200
5192
  S: this,
5201
5193
  C: (f, a) => f(...a)
5202
5194
  });
@@ -5204,50 +5196,36 @@ var ClientServicesHost = class {
5204
5196
  id: traceId
5205
5197
  }), {
5206
5198
  F: __dxlog_file17,
5207
- L: 350,
5199
+ L: 335,
5208
5200
  S: this,
5209
5201
  C: (f, a) => f(...a)
5210
5202
  });
5211
5203
  await this._callbacks?.onReset?.();
5212
5204
  }
5213
- async _createIdentity(params, useAutomerge) {
5205
+ async _createIdentity(params) {
5214
5206
  const identity = await this._serviceContext.createIdentity(params);
5215
5207
  await this._serviceContext.initialized.wait();
5216
5208
  const space = await this._serviceContext.dataSpaceManager.createSpace();
5217
- const obj = new Properties(void 0, {
5218
- automerge: useAutomerge
5219
- });
5209
+ const obj = new Properties(void 0);
5220
5210
  obj[defaultKey] = identity.identityKey.toHex();
5221
- if (!useAutomerge) {
5222
- await this._serviceRegistry.services.DataService.write({
5223
- spaceKey: space.key,
5224
- batch: {
5225
- objects: [
5226
- createGenesisMutationFromTypedObject(obj)
5227
- ]
5228
- }
5229
- });
5230
- await this._serviceRegistry.services.DataService.flush({
5231
- spaceKey: space.key
5232
- });
5233
- } else {
5234
- const automergeIndex = space.automergeSpaceState.rootUrl;
5235
- invariant14(automergeIndex, void 0, {
5236
- F: __dxlog_file17,
5237
- L: 375,
5238
- S: this,
5239
- A: [
5240
- "automergeIndex",
5241
- ""
5242
- ]
5243
- });
5244
- const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5245
- await document.whenReady();
5246
- document.change((doc) => {
5247
- doc.objects ??= {};
5248
- doc.objects[obj[base]._id] = getRawDoc(obj).handle.docSync();
5249
- });
5250
- }
5211
+ const automergeIndex = space.automergeSpaceState.rootUrl;
5212
+ invariant14(automergeIndex, void 0, {
5213
+ F: __dxlog_file17,
5214
+ L: 350,
5215
+ S: this,
5216
+ A: [
5217
+ "automergeIndex",
5218
+ ""
5219
+ ]
5220
+ });
5221
+ const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5222
+ await document.whenReady();
5223
+ document.change((doc) => {
5224
+ assignDeep(doc, [
5225
+ "objects",
5226
+ obj[base]._id
5227
+ ], getRawDoc(obj).handle.docSync());
5228
+ });
5251
5229
  return identity;
5252
5230
  }
5253
5231
  };
@@ -5303,4 +5281,4 @@ export {
5303
5281
  createDefaultModelFactory,
5304
5282
  ClientServicesHost
5305
5283
  };
5306
- //# sourceMappingURL=chunk-NFGK66US.mjs.map
5284
+ //# sourceMappingURL=chunk-O5YSWDFG.mjs.map