@dxos/client-services 0.6.2 → 0.6.3-main.40d1cec

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.
@@ -7,7 +7,7 @@ import {
7
7
  InvitationsManager,
8
8
  ServiceContext,
9
9
  SpaceInvitationProtocol
10
- } from "../../chunk-CFKVGKP3.mjs";
10
+ } from "../../chunk-EY3CQTKB.mjs";
11
11
 
12
12
  // packages/sdk/client-services/src/packlets/testing/credential-utils.ts
13
13
  import { createCredential } from "@dxos/credentials";
@@ -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_7XBIZ7NK_exports = {};
30
- __export(chunk_7XBIZ7NK_exports, {
29
+ var chunk_DJZLGSSR_exports = {};
30
+ __export(chunk_DJZLGSSR_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -70,7 +70,7 @@ __export(chunk_7XBIZ7NK_exports, {
70
70
  subscribeToSpaces: () => subscribeToSpaces,
71
71
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
72
72
  });
73
- module.exports = __toCommonJS(chunk_7XBIZ7NK_exports);
73
+ module.exports = __toCommonJS(chunk_DJZLGSSR_exports);
74
74
  var import_async = require("@dxos/async");
75
75
  var import_codec_protobuf = require("@dxos/codec-protobuf");
76
76
  var import_feed_store = require("@dxos/feed-store");
@@ -647,7 +647,7 @@ var DevtoolsServiceImpl = class {
647
647
  });
648
648
  }
649
649
  };
650
- var DXOS_VERSION = "0.6.2";
650
+ var DXOS_VERSION = "0.6.3-main.40d1cec";
651
651
  var getPlatform = () => {
652
652
  if (process.browser) {
653
653
  if (typeof window !== "undefined") {
@@ -4643,17 +4643,15 @@ var DataSpace = class {
4643
4643
  };
4644
4644
  });
4645
4645
  }
4646
- const root = await this._echoHost.openSpaceRoot(handle.url);
4646
+ const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
4647
4647
  this._databaseRoot = root;
4648
4648
  if (root.getVersion() !== import_echo_protocol.SpaceDocVersion.CURRENT) {
4649
- if (this._state !== import_services12.SpaceState.REQUIRES_MIGRATION) {
4650
- this._state = import_services12.SpaceState.REQUIRES_MIGRATION;
4651
- this.stateUpdate.emit();
4652
- }
4649
+ this._state = import_services12.SpaceState.REQUIRES_MIGRATION;
4650
+ this.stateUpdate.emit();
4651
+ } else if (this._state !== import_services12.SpaceState.READY) {
4652
+ await this._enterReadyState();
4653
4653
  } else {
4654
- if (this._state !== import_services12.SpaceState.READY) {
4655
- await this._enterReadyState();
4656
- }
4654
+ this.stateUpdate.emit();
4657
4655
  }
4658
4656
  } catch (_) {
4659
4657
  _usingCtx.e = _;
@@ -4670,7 +4668,7 @@ var DataSpace = class {
4670
4668
  err
4671
4669
  }, {
4672
4670
  F: __dxlog_file17,
4673
- L: 433,
4671
+ L: 431,
4674
4672
  S: this,
4675
4673
  C: (f, a) => f(...a)
4676
4674
  });
@@ -4723,14 +4721,18 @@ var DataSpace = class {
4723
4721
  credential
4724
4722
  }
4725
4723
  });
4726
- await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe3.Timeframe([
4724
+ const timeframe = new import_timeframe3.Timeframe([
4727
4725
  [
4728
4726
  receipt.feedKey,
4729
4727
  receipt.seq
4730
4728
  ]
4731
- ]));
4729
+ ]);
4730
+ await this.inner.controlPipeline.state.waitUntilTimeframe(timeframe);
4732
4731
  await this._echoHost.updateIndexes();
4733
- return credential;
4732
+ return {
4733
+ credential,
4734
+ timeframe
4735
+ };
4734
4736
  }
4735
4737
  async activate() {
4736
4738
  if (![
@@ -4756,7 +4758,7 @@ var DataSpace = class {
4756
4758
  state: import_services12.SpaceState[this._state]
4757
4759
  }, {
4758
4760
  F: __dxlog_file17,
4759
- L: 514,
4761
+ L: 513,
4760
4762
  S: this,
4761
4763
  C: (f, a) => f(...a)
4762
4764
  });
@@ -5255,19 +5257,37 @@ var DataSpaceManager = class {
5255
5257
  credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
5256
5258
  credentialAuthenticator: (0, import_util9.deferFunction)(() => dataSpace.authVerifier.verifier)
5257
5259
  },
5258
- onAuthorizedConnection: (session) => {
5259
- session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline4.CredentialServerExtension(space));
5260
- session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
5261
- remotePeerId: session.remotePeerId
5262
- }));
5263
- session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
5264
- this._echoHost.authorizeDevice(space.key, session.remotePeerId);
5265
- session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
5266
- },
5260
+ onAuthorizedConnection: (session) => queueMicrotask(async () => {
5261
+ try {
5262
+ if (!session.isOpen) {
5263
+ return;
5264
+ }
5265
+ session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline4.CredentialServerExtension(space));
5266
+ session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
5267
+ remotePeerId: session.remotePeerId
5268
+ }));
5269
+ session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
5270
+ await this._echoHost.authorizeDevice(space.key, session.remotePeerId);
5271
+ if (!session.isOpen) {
5272
+ return;
5273
+ }
5274
+ session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
5275
+ } catch (err) {
5276
+ import_log15.log.warn("error on authorized connection", {
5277
+ err
5278
+ }, {
5279
+ F: __dxlog_file18,
5280
+ L: 403,
5281
+ S: this,
5282
+ C: (f, a) => f(...a)
5283
+ });
5284
+ await session.close(err);
5285
+ }
5286
+ }),
5267
5287
  onAuthFailure: () => {
5268
5288
  import_log15.log.warn("auth failure", void 0, {
5269
5289
  F: __dxlog_file18,
5270
- L: 396,
5290
+ L: 408,
5271
5291
  S: this,
5272
5292
  C: (f, a) => f(...a)
5273
5293
  });
@@ -5300,7 +5320,7 @@ var DataSpaceManager = class {
5300
5320
  space: space.key
5301
5321
  }, {
5302
5322
  F: __dxlog_file18,
5303
- L: 423,
5323
+ L: 435,
5304
5324
  S: this,
5305
5325
  C: (f, a) => f(...a)
5306
5326
  });
@@ -5311,7 +5331,7 @@ var DataSpaceManager = class {
5311
5331
  open: this._isOpen
5312
5332
  }, {
5313
5333
  F: __dxlog_file18,
5314
- L: 426,
5334
+ L: 438,
5315
5335
  S: this,
5316
5336
  C: (f, a) => f(...a)
5317
5337
  });
@@ -5330,7 +5350,7 @@ var DataSpaceManager = class {
5330
5350
  space: space.key
5331
5351
  }, {
5332
5352
  F: __dxlog_file18,
5333
- L: 434,
5353
+ L: 446,
5334
5354
  S: this,
5335
5355
  C: (f, a) => f(...a)
5336
5356
  });
@@ -5371,7 +5391,7 @@ var DataSpaceManager = class {
5371
5391
  closedSessions
5372
5392
  }, {
5373
5393
  F: __dxlog_file18,
5374
- L: 470,
5394
+ L: 482,
5375
5395
  S: this,
5376
5396
  C: (f, a) => f(...a)
5377
5397
  });
@@ -5386,7 +5406,7 @@ var DataSpaceManager = class {
5386
5406
  peerId: peerState.peerId
5387
5407
  }, {
5388
5408
  F: __dxlog_file18,
5389
- L: 484,
5409
+ L: 496,
5390
5410
  S: this,
5391
5411
  C: (f, a) => f(...a)
5392
5412
  });
@@ -5514,9 +5534,9 @@ var SpacesServiceImpl = class {
5514
5534
  const scheduler = new import_async17.UpdateScheduler(ctx, async () => {
5515
5535
  const dataSpaceManager = await this._getDataSpaceManager();
5516
5536
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
5517
- (0, import_log16.log)("update", {
5518
- spaces
5519
- }, {
5537
+ (0, import_log16.log)("update", () => ({
5538
+ ids: spaces.map((space) => space.id)
5539
+ }), {
5520
5540
  F: __dxlog_file19,
5521
5541
  L: 115,
5522
5542
  S: this,
@@ -5651,12 +5671,13 @@ var SpacesServiceImpl = class {
5651
5671
  async createEpoch({ spaceKey, migration, automergeRootUrl }) {
5652
5672
  const dataSpaceManager = await this._getDataSpaceManager();
5653
5673
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
5654
- const credential = await space.createEpoch({
5674
+ const result = await space.createEpoch({
5655
5675
  migration,
5656
5676
  newAutomergeRoot: automergeRootUrl
5657
5677
  });
5658
5678
  return {
5659
- epochCredential: credential ?? void 0
5679
+ epochCredential: result?.credential,
5680
+ controlTimeframe: result?.timeframe
5660
5681
  };
5661
5682
  }
5662
5683
  async admitContact(request) {
@@ -7135,4 +7156,4 @@ ClientServicesHost = _ts_decorate8([
7135
7156
  subscribeToSpaces,
7136
7157
  subscribeToSwarmInfo
7137
7158
  });
7138
- //# sourceMappingURL=chunk-7XBIZ7NK.cjs.map
7159
+ //# sourceMappingURL=chunk-DJZLGSSR.cjs.map