@dxos/client-services 0.5.9-main.2d0a5e6 → 0.5.9-main.2dbe289

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_KYH2GPWL_exports = {};
30
- __export(chunk_KYH2GPWL_exports, {
29
+ var chunk_NPYJIVOX_exports = {};
30
+ __export(chunk_NPYJIVOX_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -67,7 +67,7 @@ __export(chunk_KYH2GPWL_exports, {
67
67
  subscribeToSpaces: () => subscribeToSpaces,
68
68
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
69
69
  });
70
- module.exports = __toCommonJS(chunk_KYH2GPWL_exports);
70
+ module.exports = __toCommonJS(chunk_NPYJIVOX_exports);
71
71
  var import_async = require("@dxos/async");
72
72
  var import_codec_protobuf = require("@dxos/codec-protobuf");
73
73
  var import_feed_store = require("@dxos/feed-store");
@@ -611,7 +611,7 @@ var DevtoolsServiceImpl = class {
611
611
  });
612
612
  }
613
613
  };
614
- var DXOS_VERSION = "0.5.9-main.2d0a5e6";
614
+ var DXOS_VERSION = "0.5.9-main.2dbe289";
615
615
  var getPlatform = () => {
616
616
  if (process.browser) {
617
617
  if (typeof window !== "undefined") {
@@ -3935,7 +3935,7 @@ var DataSpace = class {
3935
3935
  state: import_services11.SpaceState[this._state]
3936
3936
  }, {
3937
3937
  F: __dxlog_file14,
3938
- L: 142,
3938
+ L: 143,
3939
3939
  S: this,
3940
3940
  C: (f, a) => f(...a)
3941
3941
  });
@@ -3988,7 +3988,7 @@ var DataSpace = class {
3988
3988
  state: import_services11.SpaceState[this._state]
3989
3989
  }, {
3990
3990
  F: __dxlog_file14,
3991
- L: 205,
3991
+ L: 206,
3992
3992
  S: this,
3993
3993
  C: (f, a) => f(...a)
3994
3994
  });
@@ -4006,7 +4006,7 @@ var DataSpace = class {
4006
4006
  state: import_services11.SpaceState[this._state]
4007
4007
  }, {
4008
4008
  F: __dxlog_file14,
4009
- L: 219,
4009
+ L: 220,
4010
4010
  S: this,
4011
4011
  C: (f, a) => f(...a)
4012
4012
  });
@@ -4038,7 +4038,7 @@ var DataSpace = class {
4038
4038
  if (err instanceof import_protocols9.CancelledError || err instanceof import_context9.ContextDisposedError) {
4039
4039
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
4040
4040
  F: __dxlog_file14,
4041
- L: 252,
4041
+ L: 253,
4042
4042
  S: this,
4043
4043
  C: (f, a) => f(...a)
4044
4044
  });
@@ -4046,7 +4046,7 @@ var DataSpace = class {
4046
4046
  }
4047
4047
  import_log10.log.error("Error initializing data pipeline", err, {
4048
4048
  F: __dxlog_file14,
4049
- L: 256,
4049
+ L: 257,
4050
4050
  S: this,
4051
4051
  C: (f, a) => f(...a)
4052
4052
  });
@@ -4055,7 +4055,7 @@ var DataSpace = class {
4055
4055
  state: import_services11.SpaceState[this._state]
4056
4056
  }, {
4057
4057
  F: __dxlog_file14,
4058
- L: 258,
4058
+ L: 259,
4059
4059
  S: this,
4060
4060
  C: (f, a) => f(...a)
4061
4061
  });
@@ -4075,7 +4075,7 @@ var DataSpace = class {
4075
4075
  state: import_services11.SpaceState[this._state]
4076
4076
  }, {
4077
4077
  F: __dxlog_file14,
4078
- L: 274,
4078
+ L: 275,
4079
4079
  S: this,
4080
4080
  C: (f, a) => f(...a)
4081
4081
  });
@@ -4085,7 +4085,7 @@ var DataSpace = class {
4085
4085
  await (0, import_context9.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
4086
4086
  (0, import_log10.log)("data pipeline ready", void 0, {
4087
4087
  F: __dxlog_file14,
4088
- L: 286,
4088
+ L: 287,
4089
4089
  S: this,
4090
4090
  C: (f, a) => f(...a)
4091
4091
  });
@@ -4095,7 +4095,7 @@ var DataSpace = class {
4095
4095
  state: import_services11.SpaceState[this._state]
4096
4096
  }, {
4097
4097
  F: __dxlog_file14,
4098
- L: 290,
4098
+ L: 291,
4099
4099
  S: this,
4100
4100
  C: (f, a) => f(...a)
4101
4101
  });
@@ -4111,7 +4111,7 @@ var DataSpace = class {
4111
4111
  await this._createWritableFeeds();
4112
4112
  (0, import_log10.log)("writable feeds created", void 0, {
4113
4113
  F: __dxlog_file14,
4114
- L: 306,
4114
+ L: 307,
4115
4115
  S: this,
4116
4116
  C: (f, a) => f(...a)
4117
4117
  });
@@ -4174,7 +4174,7 @@ var DataSpace = class {
4174
4174
  rootUrl
4175
4175
  }, {
4176
4176
  F: __dxlog_file14,
4177
- L: 372,
4177
+ L: 373,
4178
4178
  S: this,
4179
4179
  C: (f, a) => f(...a)
4180
4180
  });
@@ -4204,7 +4204,7 @@ var DataSpace = class {
4204
4204
  rootUrl
4205
4205
  }, {
4206
4206
  F: __dxlog_file14,
4207
- L: 399,
4207
+ L: 400,
4208
4208
  S: this,
4209
4209
  C: (f, a) => f(...a)
4210
4210
  });
@@ -4219,7 +4219,7 @@ var DataSpace = class {
4219
4219
  err
4220
4220
  }, {
4221
4221
  F: __dxlog_file14,
4222
- L: 405,
4222
+ L: 406,
4223
4223
  S: this,
4224
4224
  C: (f, a) => f(...a)
4225
4225
  });
@@ -4272,9 +4272,12 @@ var DataSpace = class {
4272
4272
  const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
4273
4273
  await (0, import_context9.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
4274
4274
  const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
4275
+ await this._echoHost.automergeRepo.flush([
4276
+ newRoot.documentId
4277
+ ]);
4275
4278
  (0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4276
4279
  F: __dxlog_file14,
4277
- L: 455,
4280
+ L: 457,
4278
4281
  S: this,
4279
4282
  A: [
4280
4283
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4293,7 +4296,7 @@ var DataSpace = class {
4293
4296
  {
4294
4297
  import_log10.log.info("Fragmenting", void 0, {
4295
4298
  F: __dxlog_file14,
4296
- L: 467,
4299
+ L: 469,
4297
4300
  S: this,
4298
4301
  C: (f, a) => f(...a)
4299
4302
  });
@@ -4305,7 +4308,7 @@ var DataSpace = class {
4305
4308
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
4306
4309
  (0, import_invariant12.invariant)(properties, "Properties not found", {
4307
4310
  F: __dxlog_file14,
4308
- L: 477,
4311
+ L: 479,
4309
4312
  S: this,
4310
4313
  A: [
4311
4314
  "properties",
@@ -4321,7 +4324,7 @@ var DataSpace = class {
4321
4324
  const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
4322
4325
  (0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4323
4326
  F: __dxlog_file14,
4324
- L: 482,
4327
+ L: 484,
4325
4328
  S: this,
4326
4329
  A: [
4327
4330
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4349,6 +4352,25 @@ var DataSpace = class {
4349
4352
  };
4350
4353
  }
4351
4354
  break;
4355
+ case import_services11.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT:
4356
+ {
4357
+ (0, import_invariant12.invariant)(options.newAutomergeRoot, void 0, {
4358
+ F: __dxlog_file14,
4359
+ L: 514,
4360
+ S: this,
4361
+ A: [
4362
+ "options.newAutomergeRoot",
4363
+ ""
4364
+ ]
4365
+ });
4366
+ epoch = {
4367
+ previousId: this._automergeSpaceState.lastEpoch?.id,
4368
+ number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4369
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
4370
+ automergeRoot: options.newAutomergeRoot
4371
+ };
4372
+ }
4373
+ break;
4352
4374
  }
4353
4375
  if (!epoch) {
4354
4376
  return;
@@ -4370,6 +4392,7 @@ var DataSpace = class {
4370
4392
  receipt.seq
4371
4393
  ]
4372
4394
  ]));
4395
+ await this._echoHost.updateIndexes();
4373
4396
  }
4374
4397
  async activate() {
4375
4398
  if (this._state !== import_services11.SpaceState.INACTIVE) {
@@ -4390,7 +4413,7 @@ var DataSpace = class {
4390
4413
  state: import_services11.SpaceState[this._state]
4391
4414
  }, {
4392
4415
  F: __dxlog_file14,
4393
- L: 552,
4416
+ L: 567,
4394
4417
  S: this,
4395
4418
  C: (f, a) => f(...a)
4396
4419
  });
@@ -5173,11 +5196,12 @@ var SpacesServiceImpl = class {
5173
5196
  }
5174
5197
  }
5175
5198
  }
5176
- async createEpoch({ spaceKey, migration }) {
5199
+ async createEpoch({ spaceKey, migration, automergeRootUrl }) {
5177
5200
  const dataSpaceManager = await this._getDataSpaceManager();
5178
5201
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
5179
5202
  await space.createEpoch({
5180
- migration
5203
+ migration,
5204
+ newAutomergeRoot: automergeRootUrl
5181
5205
  });
5182
5206
  }
5183
5207
  _serializeSpace(space) {
@@ -6390,4 +6414,4 @@ ClientServicesHost = _ts_decorate8([
6390
6414
  subscribeToSpaces,
6391
6415
  subscribeToSwarmInfo
6392
6416
  });
6393
- //# sourceMappingURL=chunk-KYH2GPWL.cjs.map
6417
+ //# sourceMappingURL=chunk-NPYJIVOX.cjs.map