@dxos/client-services 0.6.3-main.d007b87 → 0.6.3-main.daaea86

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.
@@ -359,7 +359,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
359
359
  import { TRACE_PROCESSOR } from "@dxos/tracing";
360
360
 
361
361
  // packages/sdk/client-services/src/version.ts
362
- var DXOS_VERSION = "0.6.3-main.d007b87";
362
+ var DXOS_VERSION = "0.6.3-main.daaea86";
363
363
 
364
364
  // packages/sdk/client-services/src/packlets/services/platform.ts
365
365
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -2402,7 +2402,7 @@ var InvitationsHandler = class {
2402
2402
  this._defaultTeleportParams = _defaultTeleportParams;
2403
2403
  }
2404
2404
  handleInvitationFlow(ctx, stream, protocol, invitation) {
2405
- metrics.increment("invitation.created");
2405
+ metrics.increment("dxos.invitation.created");
2406
2406
  const guardedState = this._createGuardedState(ctx, invitation, stream);
2407
2407
  const createExtension = () => {
2408
2408
  const extension = new InvitationHostExtension(guardedState.mutex, {
@@ -2472,7 +2472,7 @@ var InvitationsHandler = class {
2472
2472
  C: (f, a) => f(...a)
2473
2473
  });
2474
2474
  guardedState.set(extension, Invitation4.State.SUCCESS);
2475
- metrics.increment("invitation.success");
2475
+ metrics.increment("dxos.invitation.success");
2476
2476
  log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.end({
2477
2477
  id: traceId
2478
2478
  }), {
@@ -2488,7 +2488,7 @@ var InvitationsHandler = class {
2488
2488
  } catch (err) {
2489
2489
  if (err instanceof TimeoutError) {
2490
2490
  if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
2491
- metrics.increment("invitation.timeout");
2491
+ metrics.increment("dxos.invitation.timeout");
2492
2492
  log10("timeout", {
2493
2493
  ...protocol.toJSON()
2494
2494
  }, {
@@ -2500,7 +2500,7 @@ var InvitationsHandler = class {
2500
2500
  }
2501
2501
  } else {
2502
2502
  if (guardedState.error(extension, err)) {
2503
- metrics.increment("invitation.failed");
2503
+ metrics.increment("dxos.invitation.failed");
2504
2504
  log10.error("failed", err, {
2505
2505
  F: __dxlog_file13,
2506
2506
  L: 139,
@@ -2536,7 +2536,7 @@ var InvitationsHandler = class {
2536
2536
  }
2537
2537
  if (err instanceof TimeoutError) {
2538
2538
  if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
2539
- metrics.increment("invitation.timeout");
2539
+ metrics.increment("dxos.invitation.timeout");
2540
2540
  log10("timeout", {
2541
2541
  err
2542
2542
  }, {
@@ -2548,7 +2548,7 @@ var InvitationsHandler = class {
2548
2548
  }
2549
2549
  } else {
2550
2550
  if (guardedState.error(extension, err)) {
2551
- metrics.increment("invitation.failed");
2551
+ metrics.increment("dxos.invitation.failed");
2552
2552
  log10.error("failed", err, {
2553
2553
  F: __dxlog_file13,
2554
2554
  L: 161,
@@ -2573,7 +2573,7 @@ var InvitationsHandler = class {
2573
2573
  scheduleTask3(ctx, async () => {
2574
2574
  await swarmConnection.close();
2575
2575
  guardedState.set(null, Invitation4.State.EXPIRED);
2576
- metrics.increment("invitation.expired");
2576
+ metrics.increment("dxos.invitation.expired");
2577
2577
  await ctx.dispose();
2578
2578
  }, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
2579
2579
  }
@@ -4628,17 +4628,15 @@ var DataSpace = class {
4628
4628
  };
4629
4629
  });
4630
4630
  }
4631
- const root = await this._echoHost.openSpaceRoot(handle.url);
4631
+ const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
4632
4632
  this._databaseRoot = root;
4633
4633
  if (root.getVersion() !== SpaceDocVersion2.CURRENT) {
4634
- if (this._state !== SpaceState2.REQUIRES_MIGRATION) {
4635
- this._state = SpaceState2.REQUIRES_MIGRATION;
4636
- this.stateUpdate.emit();
4637
- }
4634
+ this._state = SpaceState2.REQUIRES_MIGRATION;
4635
+ this.stateUpdate.emit();
4636
+ } else if (this._state !== SpaceState2.READY) {
4637
+ await this._enterReadyState();
4638
4638
  } else {
4639
- if (this._state !== SpaceState2.READY) {
4640
- await this._enterReadyState();
4641
- }
4639
+ this.stateUpdate.emit();
4642
4640
  }
4643
4641
  } catch (_) {
4644
4642
  _usingCtx.e = _;
@@ -4655,7 +4653,7 @@ var DataSpace = class {
4655
4653
  err
4656
4654
  }, {
4657
4655
  F: __dxlog_file18,
4658
- L: 433,
4656
+ L: 431,
4659
4657
  S: this,
4660
4658
  C: (f, a) => f(...a)
4661
4659
  });
@@ -4708,14 +4706,18 @@ var DataSpace = class {
4708
4706
  credential
4709
4707
  }
4710
4708
  });
4711
- await this.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe3([
4709
+ const timeframe = new Timeframe3([
4712
4710
  [
4713
4711
  receipt.feedKey,
4714
4712
  receipt.seq
4715
4713
  ]
4716
- ]));
4714
+ ]);
4715
+ await this.inner.controlPipeline.state.waitUntilTimeframe(timeframe);
4717
4716
  await this._echoHost.updateIndexes();
4718
- return credential;
4717
+ return {
4718
+ credential,
4719
+ timeframe
4720
+ };
4719
4721
  }
4720
4722
  async activate() {
4721
4723
  if (![
@@ -4741,7 +4743,7 @@ var DataSpace = class {
4741
4743
  state: SpaceState2[this._state]
4742
4744
  }, {
4743
4745
  F: __dxlog_file18,
4744
- L: 514,
4746
+ L: 513,
4745
4747
  S: this,
4746
4748
  C: (f, a) => f(...a)
4747
4749
  });
@@ -5269,19 +5271,37 @@ var DataSpaceManager = class {
5269
5271
  credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
5270
5272
  credentialAuthenticator: deferFunction2(() => dataSpace.authVerifier.verifier)
5271
5273
  },
5272
- onAuthorizedConnection: (session) => {
5273
- session.addExtension("dxos.mesh.teleport.admission-discovery", new CredentialServerExtension(space));
5274
- session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
5275
- remotePeerId: session.remotePeerId
5276
- }));
5277
- session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
5278
- this._echoHost.authorizeDevice(space.key, session.remotePeerId);
5279
- session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
5280
- },
5274
+ onAuthorizedConnection: (session) => queueMicrotask(async () => {
5275
+ try {
5276
+ if (!session.isOpen) {
5277
+ return;
5278
+ }
5279
+ session.addExtension("dxos.mesh.teleport.admission-discovery", new CredentialServerExtension(space));
5280
+ session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
5281
+ remotePeerId: session.remotePeerId
5282
+ }));
5283
+ session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
5284
+ await this._echoHost.authorizeDevice(space.key, session.remotePeerId);
5285
+ if (!session.isOpen) {
5286
+ return;
5287
+ }
5288
+ session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
5289
+ } catch (err) {
5290
+ log16.warn("error on authorized connection", {
5291
+ err
5292
+ }, {
5293
+ F: __dxlog_file19,
5294
+ L: 403,
5295
+ S: this,
5296
+ C: (f, a) => f(...a)
5297
+ });
5298
+ await session.close(err);
5299
+ }
5300
+ }),
5281
5301
  onAuthFailure: () => {
5282
5302
  log16.warn("auth failure", void 0, {
5283
5303
  F: __dxlog_file19,
5284
- L: 396,
5304
+ L: 408,
5285
5305
  S: this,
5286
5306
  C: (f, a) => f(...a)
5287
5307
  });
@@ -5314,7 +5334,7 @@ var DataSpaceManager = class {
5314
5334
  space: space.key
5315
5335
  }, {
5316
5336
  F: __dxlog_file19,
5317
- L: 423,
5337
+ L: 435,
5318
5338
  S: this,
5319
5339
  C: (f, a) => f(...a)
5320
5340
  });
@@ -5325,7 +5345,7 @@ var DataSpaceManager = class {
5325
5345
  open: this._isOpen
5326
5346
  }, {
5327
5347
  F: __dxlog_file19,
5328
- L: 426,
5348
+ L: 438,
5329
5349
  S: this,
5330
5350
  C: (f, a) => f(...a)
5331
5351
  });
@@ -5344,7 +5364,7 @@ var DataSpaceManager = class {
5344
5364
  space: space.key
5345
5365
  }, {
5346
5366
  F: __dxlog_file19,
5347
- L: 434,
5367
+ L: 446,
5348
5368
  S: this,
5349
5369
  C: (f, a) => f(...a)
5350
5370
  });
@@ -5385,7 +5405,7 @@ var DataSpaceManager = class {
5385
5405
  closedSessions
5386
5406
  }, {
5387
5407
  F: __dxlog_file19,
5388
- L: 470,
5408
+ L: 482,
5389
5409
  S: this,
5390
5410
  C: (f, a) => f(...a)
5391
5411
  });
@@ -5400,7 +5420,7 @@ var DataSpaceManager = class {
5400
5420
  peerId: peerState.peerId
5401
5421
  }, {
5402
5422
  F: __dxlog_file19,
5403
- L: 484,
5423
+ L: 496,
5404
5424
  S: this,
5405
5425
  C: (f, a) => f(...a)
5406
5426
  });
@@ -5540,9 +5560,9 @@ var SpacesServiceImpl = class {
5540
5560
  const scheduler = new UpdateScheduler(ctx, async () => {
5541
5561
  const dataSpaceManager = await this._getDataSpaceManager();
5542
5562
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
5543
- log17("update", {
5544
- spaces
5545
- }, {
5563
+ log17("update", () => ({
5564
+ ids: spaces.map((space) => space.id)
5565
+ }), {
5546
5566
  F: __dxlog_file20,
5547
5567
  L: 115,
5548
5568
  S: this,
@@ -5677,12 +5697,13 @@ var SpacesServiceImpl = class {
5677
5697
  async createEpoch({ spaceKey, migration, automergeRootUrl }) {
5678
5698
  const dataSpaceManager = await this._getDataSpaceManager();
5679
5699
  const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
5680
- const credential = await space.createEpoch({
5700
+ const result = await space.createEpoch({
5681
5701
  migration,
5682
5702
  newAutomergeRoot: automergeRootUrl
5683
5703
  });
5684
5704
  return {
5685
- epochCredential: credential ?? void 0
5705
+ epochCredential: result?.credential,
5706
+ controlTimeframe: result?.timeframe
5686
5707
  };
5687
5708
  }
5688
5709
  async admitContact(request) {
@@ -5789,7 +5810,7 @@ var SpacesServiceImpl = class {
5789
5810
  const dataSpaceManager = await this._getDataSpaceManager();
5790
5811
  const identity = this._identityManager.identity?.identityKey.truncate();
5791
5812
  if (identity) {
5792
- trace8.metrics.gauge("echo.space.count", dataSpaceManager.spaces.size, {
5813
+ trace8.metrics.gauge("dxos.echo.space.count", dataSpaceManager.spaces.size, {
5793
5814
  tags: {
5794
5815
  identity
5795
5816
  }
@@ -7332,4 +7353,4 @@ export {
7332
7353
  ClientServicesProviderResource,
7333
7354
  DiagnosticsCollector
7334
7355
  };
7335
- //# sourceMappingURL=chunk-Y7UULU6J.mjs.map
7356
+ //# sourceMappingURL=chunk-UESTPAVS.mjs.map