@dxos/client-services 0.4.4-main.8a6f0d0 → 0.4.4-main.8f561b4

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-main.8a6f0d0";
2568
+ var DXOS_VERSION = "0.4.4-main.8f561b4";
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";
@@ -2836,7 +2835,7 @@ var NotarizationPlugin = class {
2836
2835
  ...this._extensions
2837
2836
  ].find((peer2) => !peersTried.has(peer2));
2838
2837
  if (!peer) {
2839
- log9.warn("Exhausted all peers to notarize with", {
2838
+ log9.info("Exhausted all peers to notarize with", {
2840
2839
  retryIn: retryTimeout
2841
2840
  }, {
2842
2841
  F: __dxlog_file11,
@@ -2870,7 +2869,7 @@ var NotarizationPlugin = class {
2870
2869
  await sleep(successDelay);
2871
2870
  } catch (err) {
2872
2871
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
2873
- log9.warn("error notarizing (recoverable)", err, {
2872
+ log9.info("error notarizing (recoverable)", err, {
2874
2873
  F: __dxlog_file11,
2875
2874
  L: 151,
2876
2875
  S: this,
@@ -3221,7 +3220,7 @@ var DataSpace = class {
3221
3220
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3222
3221
  log10("data pipeline ready", void 0, {
3223
3222
  F: __dxlog_file12,
3224
- L: 295,
3223
+ L: 294,
3225
3224
  S: this,
3226
3225
  C: (f, a) => f(...a)
3227
3226
  });
@@ -3231,7 +3230,7 @@ var DataSpace = class {
3231
3230
  state: SpaceState[this._state]
3232
3231
  }, {
3233
3232
  F: __dxlog_file12,
3234
- L: 299,
3233
+ L: 298,
3235
3234
  S: this,
3236
3235
  C: (f, a) => f(...a)
3237
3236
  });
@@ -3247,7 +3246,7 @@ var DataSpace = class {
3247
3246
  await this._createWritableFeeds();
3248
3247
  log10("writable feeds created", void 0, {
3249
3248
  F: __dxlog_file12,
3250
- L: 315,
3249
+ L: 314,
3251
3250
  S: this,
3252
3251
  C: (f, a) => f(...a)
3253
3252
  });
@@ -3310,10 +3309,11 @@ var DataSpace = class {
3310
3309
  rootUrl
3311
3310
  }, {
3312
3311
  F: __dxlog_file12,
3313
- L: 381,
3312
+ L: 380,
3314
3313
  S: this,
3315
3314
  C: (f, a) => f(...a)
3316
3315
  });
3316
+ this._automergeHost._requestedDocs.add(rootUrl);
3317
3317
  const handle = this._automergeHost.repo.find(rootUrl);
3318
3318
  queueMicrotask(async () => {
3319
3319
  try {
@@ -3703,17 +3703,17 @@ var DataSpaceManager = class {
3703
3703
  S: this,
3704
3704
  C: (f, a) => f(...a)
3705
3705
  });
3706
- const space = await this._constructSpace(metadata);
3707
3706
  const automergeRoot = this._automergeHost.repo.create();
3708
3707
  automergeRoot.change((doc) => {
3709
3708
  doc.experimental_spaceKey = spaceKey.toHex();
3710
3709
  });
3710
+ const space = await this._constructSpace(metadata);
3711
3711
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
3712
3712
  await this._metadataStore.addSpace(metadata);
3713
3713
  const memberCredential = credentials[1];
3714
3714
  invariant11(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3715
3715
  F: __dxlog_file13,
3716
- L: 154,
3716
+ L: 155,
3717
3717
  S: this,
3718
3718
  A: [
3719
3719
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3731,13 +3731,13 @@ var DataSpaceManager = class {
3731
3731
  opts
3732
3732
  }, {
3733
3733
  F: __dxlog_file13,
3734
- L: 166,
3734
+ L: 167,
3735
3735
  S: this,
3736
3736
  C: (f, a) => f(...a)
3737
3737
  });
3738
3738
  invariant11(this._isOpen, "Not open.", {
3739
3739
  F: __dxlog_file13,
3740
- L: 167,
3740
+ L: 168,
3741
3741
  S: this,
3742
3742
  A: [
3743
3743
  "this._isOpen",
@@ -3746,7 +3746,7 @@ var DataSpaceManager = class {
3746
3746
  });
3747
3747
  invariant11(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3748
3748
  F: __dxlog_file13,
3749
- L: 168,
3749
+ L: 169,
3750
3750
  S: this,
3751
3751
  A: [
3752
3752
  "!this._spaces.has(opts.spaceKey)",
@@ -3781,7 +3781,7 @@ var DataSpaceManager = class {
3781
3781
  metadata
3782
3782
  }, {
3783
3783
  F: __dxlog_file13,
3784
- L: 201,
3784
+ L: 202,
3785
3785
  S: this,
3786
3786
  C: (f, a) => f(...a)
3787
3787
  });
@@ -3819,7 +3819,7 @@ var DataSpaceManager = class {
3819
3819
  onAuthFailure: () => {
3820
3820
  log11.warn("auth failure", void 0, {
3821
3821
  F: __dxlog_file13,
3822
- L: 238,
3822
+ L: 239,
3823
3823
  S: this,
3824
3824
  C: (f, a) => f(...a)
3825
3825
  });
@@ -3843,7 +3843,7 @@ var DataSpaceManager = class {
3843
3843
  space: space.key
3844
3844
  }, {
3845
3845
  F: __dxlog_file13,
3846
- L: 256,
3846
+ L: 257,
3847
3847
  S: this,
3848
3848
  C: (f, a) => f(...a)
3849
3849
  });
@@ -3855,7 +3855,7 @@ var DataSpaceManager = class {
3855
3855
  open: this._isOpen
3856
3856
  }, {
3857
3857
  F: __dxlog_file13,
3858
- L: 263,
3858
+ L: 264,
3859
3859
  S: this,
3860
3860
  C: (f, a) => f(...a)
3861
3861
  });
@@ -3868,7 +3868,7 @@ var DataSpaceManager = class {
3868
3868
  space: space.key
3869
3869
  }, {
3870
3870
  F: __dxlog_file13,
3871
- L: 269,
3871
+ L: 270,
3872
3872
  S: this,
3873
3873
  C: (f, a) => f(...a)
3874
3874
  });
@@ -4613,6 +4613,7 @@ import { trace as trace9 } from "@dxos/protocols";
4613
4613
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
4614
4614
  import { TextModel } from "@dxos/text-model";
4615
4615
  import { TRACE_PROCESSOR as TRACE_PROCESSOR2, trace as Trace3 } from "@dxos/tracing";
4616
+ import { assignDeep } from "@dxos/util";
4616
4617
  import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4617
4618
 
4618
4619
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
@@ -4881,18 +4882,6 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
4881
4882
  var createDefaultModelFactory = () => {
4882
4883
  return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
4883
4884
  };
4884
- var createGenesisMutationFromTypedObject = (obj) => {
4885
- const snapshot = obj[base]._createSnapshot();
4886
- return {
4887
- objectId: obj[base]._id,
4888
- genesis: {
4889
- modelType: obj[base]._modelConstructor.meta.type
4890
- },
4891
- snapshot: {
4892
- model: snapshot
4893
- }
4894
- };
4895
- };
4896
4885
  var ClientServicesHost = class {
4897
4886
  constructor({
4898
4887
  config,
@@ -4979,7 +4968,7 @@ var ClientServicesHost = class {
4979
4968
  initialize({ config, ...options }) {
4980
4969
  invariant14(!this._open, "service host is open", {
4981
4970
  F: __dxlog_file17,
4982
- L: 201,
4971
+ L: 186,
4983
4972
  S: this,
4984
4973
  A: [
4985
4974
  "!this._open",
@@ -4988,14 +4977,14 @@ var ClientServicesHost = class {
4988
4977
  });
4989
4978
  log16("initializing...", void 0, {
4990
4979
  F: __dxlog_file17,
4991
- L: 202,
4980
+ L: 187,
4992
4981
  S: this,
4993
4982
  C: (f, a) => f(...a)
4994
4983
  });
4995
4984
  if (config) {
4996
4985
  invariant14(!this._config, "config already set", {
4997
4986
  F: __dxlog_file17,
4998
- L: 205,
4987
+ L: 190,
4999
4988
  S: this,
5000
4989
  A: [
5001
4990
  "!this._config",
@@ -5013,7 +5002,7 @@ var ClientServicesHost = class {
5013
5002
  this._signalManager = signalManager;
5014
5003
  invariant14(!this._networkManager, "network manager already set", {
5015
5004
  F: __dxlog_file17,
5016
- L: 221,
5005
+ L: 206,
5017
5006
  S: this,
5018
5007
  A: [
5019
5008
  "!this._networkManager",
@@ -5027,7 +5016,7 @@ var ClientServicesHost = class {
5027
5016
  });
5028
5017
  log16("initialized", void 0, {
5029
5018
  F: __dxlog_file17,
5030
- L: 228,
5019
+ L: 213,
5031
5020
  S: this,
5032
5021
  C: (f, a) => f(...a)
5033
5022
  });
@@ -5041,13 +5030,13 @@ var ClientServicesHost = class {
5041
5030
  id: traceId
5042
5031
  }), {
5043
5032
  F: __dxlog_file17,
5044
- L: 239,
5033
+ L: 224,
5045
5034
  S: this,
5046
5035
  C: (f, a) => f(...a)
5047
5036
  });
5048
5037
  invariant14(this._config, "config not set", {
5049
5038
  F: __dxlog_file17,
5050
- L: 241,
5039
+ L: 226,
5051
5040
  S: this,
5052
5041
  A: [
5053
5042
  "this._config",
@@ -5056,7 +5045,7 @@ var ClientServicesHost = class {
5056
5045
  });
5057
5046
  invariant14(this._storage, "storage not set", {
5058
5047
  F: __dxlog_file17,
5059
- L: 242,
5048
+ L: 227,
5060
5049
  S: this,
5061
5050
  A: [
5062
5051
  "this._storage",
@@ -5065,7 +5054,7 @@ var ClientServicesHost = class {
5065
5054
  });
5066
5055
  invariant14(this._signalManager, "signal manager not set", {
5067
5056
  F: __dxlog_file17,
5068
- L: 243,
5057
+ L: 228,
5069
5058
  S: this,
5070
5059
  A: [
5071
5060
  "this._signalManager",
@@ -5074,7 +5063,7 @@ var ClientServicesHost = class {
5074
5063
  });
5075
5064
  invariant14(this._networkManager, "network manager not set", {
5076
5065
  F: __dxlog_file17,
5077
- L: 244,
5066
+ L: 229,
5078
5067
  S: this,
5079
5068
  A: [
5080
5069
  "this._networkManager",
@@ -5086,7 +5075,7 @@ var ClientServicesHost = class {
5086
5075
  lockKey: this._resourceLock?.lockKey
5087
5076
  }, {
5088
5077
  F: __dxlog_file17,
5089
- L: 247,
5078
+ L: 232,
5090
5079
  S: this,
5091
5080
  C: (f, a) => f(...a)
5092
5081
  });
@@ -5095,7 +5084,7 @@ var ClientServicesHost = class {
5095
5084
  this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
5096
5085
  this._serviceRegistry.setServices({
5097
5086
  SystemService: this._systemService,
5098
- IdentityService: new IdentityServiceImpl((params, useAutomerge) => this._createIdentity(params, useAutomerge), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
5087
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
5099
5088
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
5100
5089
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
5101
5090
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
@@ -5132,7 +5121,7 @@ var ClientServicesHost = class {
5132
5121
  deviceKey
5133
5122
  }, {
5134
5123
  F: __dxlog_file17,
5135
- L: 320,
5124
+ L: 305,
5136
5125
  S: this,
5137
5126
  C: (f, a) => f(...a)
5138
5127
  });
@@ -5140,7 +5129,7 @@ var ClientServicesHost = class {
5140
5129
  id: traceId
5141
5130
  }), {
5142
5131
  F: __dxlog_file17,
5143
- L: 321,
5132
+ L: 306,
5144
5133
  S: this,
5145
5134
  C: (f, a) => f(...a)
5146
5135
  });
@@ -5154,7 +5143,7 @@ var ClientServicesHost = class {
5154
5143
  deviceKey
5155
5144
  }, {
5156
5145
  F: __dxlog_file17,
5157
- L: 332,
5146
+ L: 317,
5158
5147
  S: this,
5159
5148
  C: (f, a) => f(...a)
5160
5149
  });
@@ -5170,7 +5159,7 @@ var ClientServicesHost = class {
5170
5159
  deviceKey
5171
5160
  }, {
5172
5161
  F: __dxlog_file17,
5173
- L: 339,
5162
+ L: 324,
5174
5163
  S: this,
5175
5164
  C: (f, a) => f(...a)
5176
5165
  });
@@ -5181,13 +5170,13 @@ var ClientServicesHost = class {
5181
5170
  id: traceId
5182
5171
  }), {
5183
5172
  F: __dxlog_file17,
5184
- L: 344,
5173
+ L: 329,
5185
5174
  S: this,
5186
5175
  C: (f, a) => f(...a)
5187
5176
  });
5188
5177
  log16("resetting...", void 0, {
5189
5178
  F: __dxlog_file17,
5190
- L: 346,
5179
+ L: 331,
5191
5180
  S: this,
5192
5181
  C: (f, a) => f(...a)
5193
5182
  });
@@ -5195,7 +5184,7 @@ var ClientServicesHost = class {
5195
5184
  await this._storage.reset();
5196
5185
  log16("reset", void 0, {
5197
5186
  F: __dxlog_file17,
5198
- L: 349,
5187
+ L: 334,
5199
5188
  S: this,
5200
5189
  C: (f, a) => f(...a)
5201
5190
  });
@@ -5203,50 +5192,36 @@ var ClientServicesHost = class {
5203
5192
  id: traceId
5204
5193
  }), {
5205
5194
  F: __dxlog_file17,
5206
- L: 350,
5195
+ L: 335,
5207
5196
  S: this,
5208
5197
  C: (f, a) => f(...a)
5209
5198
  });
5210
5199
  await this._callbacks?.onReset?.();
5211
5200
  }
5212
- async _createIdentity(params, useAutomerge) {
5201
+ async _createIdentity(params) {
5213
5202
  const identity = await this._serviceContext.createIdentity(params);
5214
5203
  await this._serviceContext.initialized.wait();
5215
5204
  const space = await this._serviceContext.dataSpaceManager.createSpace();
5216
- const obj = new Properties(void 0, {
5217
- automerge: useAutomerge
5218
- });
5205
+ const obj = new Properties(void 0);
5219
5206
  obj[defaultKey] = identity.identityKey.toHex();
5220
- if (!useAutomerge) {
5221
- await this._serviceRegistry.services.DataService.write({
5222
- spaceKey: space.key,
5223
- batch: {
5224
- objects: [
5225
- createGenesisMutationFromTypedObject(obj)
5226
- ]
5227
- }
5228
- });
5229
- await this._serviceRegistry.services.DataService.flush({
5230
- spaceKey: space.key
5231
- });
5232
- } else {
5233
- const automergeIndex = space.automergeSpaceState.rootUrl;
5234
- invariant14(automergeIndex, void 0, {
5235
- F: __dxlog_file17,
5236
- L: 375,
5237
- S: this,
5238
- A: [
5239
- "automergeIndex",
5240
- ""
5241
- ]
5242
- });
5243
- const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5244
- await document.whenReady();
5245
- document.change((doc) => {
5246
- doc.objects ??= {};
5247
- doc.objects[obj[base]._id] = getRawDoc(obj).handle.docSync();
5248
- });
5249
- }
5207
+ const automergeIndex = space.automergeSpaceState.rootUrl;
5208
+ invariant14(automergeIndex, void 0, {
5209
+ F: __dxlog_file17,
5210
+ L: 350,
5211
+ S: this,
5212
+ A: [
5213
+ "automergeIndex",
5214
+ ""
5215
+ ]
5216
+ });
5217
+ const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5218
+ await document.whenReady();
5219
+ document.change((doc) => {
5220
+ assignDeep(doc, [
5221
+ "objects",
5222
+ obj[base]._id
5223
+ ], getRawDoc(obj).handle.docSync());
5224
+ });
5250
5225
  return identity;
5251
5226
  }
5252
5227
  };
@@ -5302,4 +5277,4 @@ export {
5302
5277
  createDefaultModelFactory,
5303
5278
  ClientServicesHost
5304
5279
  };
5305
- //# sourceMappingURL=chunk-QGZQVG3C.mjs.map
5280
+ //# sourceMappingURL=chunk-QNMD46PN.mjs.map