@dxos/client-services 0.1.53-main.b6f5d87 → 0.1.53-main.d095ee3

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.
@@ -2564,7 +2564,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2564
2564
  metadata
2565
2565
  }, {
2566
2566
  file: "data-space-manager.ts",
2567
- line: 181,
2567
+ line: 180,
2568
2568
  scope: this,
2569
2569
  callSite: (f, a) => f(...a)
2570
2570
  });
@@ -2600,7 +2600,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2600
2600
  onAuthFailure: () => {
2601
2601
  import_log10.log.warn("auth failure", {}, {
2602
2602
  file: "data-space-manager.ts",
2603
- line: 212,
2603
+ line: 211,
2604
2604
  scope: this,
2605
2605
  callSite: (f, a) => f(...a)
2606
2606
  });
@@ -2623,7 +2623,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2623
2623
  space: space.key
2624
2624
  }, {
2625
2625
  file: "data-space-manager.ts",
2626
- line: 229,
2626
+ line: 228,
2627
2627
  scope: this,
2628
2628
  callSite: (f, a) => f(...a)
2629
2629
  });
@@ -2635,7 +2635,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2635
2635
  open: this._isOpen
2636
2636
  }, {
2637
2637
  file: "data-space-manager.ts",
2638
- line: 236,
2638
+ line: 235,
2639
2639
  scope: this,
2640
2640
  callSite: (f, a) => f(...a)
2641
2641
  });
@@ -2682,7 +2682,6 @@ var import_log11 = require("@dxos/log");
2682
2682
  var import_protocols7 = require("@dxos/protocols");
2683
2683
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2684
2684
  var import_util5 = require("@dxos/util");
2685
- var TIMEFRAME_UPDATE_DEBOUNCE_TIME = 500;
2686
2685
  var SpacesServiceImpl = class {
2687
2686
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
2688
2687
  this._identityManager = _identityManager;
@@ -2696,16 +2695,16 @@ var SpacesServiceImpl = class {
2696
2695
  }
2697
2696
  const dataSpaceManager = await this._getDataSpaceManager();
2698
2697
  const space = await dataSpaceManager.createSpace();
2699
- return this._transformSpace(space);
2698
+ return this._serializeSpace(space);
2700
2699
  }
2701
2700
  async updateSpace(request) {
2702
2701
  (0, import_debug5.todo)();
2703
2702
  }
2704
2703
  querySpaces() {
2705
2704
  return new import_codec_protobuf3.Stream(({ next, ctx }) => {
2706
- const onUpdate = async () => {
2705
+ const scheduler = new import_async10.UpdateScheduler(ctx, async () => {
2707
2706
  const dataSpaceManager = await this._getDataSpaceManager();
2708
- const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._transformSpace(space));
2707
+ const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
2709
2708
  (0, import_log11.log)("update", {
2710
2709
  spaces
2711
2710
  }, {
@@ -2717,7 +2716,9 @@ var SpacesServiceImpl = class {
2717
2716
  next({
2718
2717
  spaces
2719
2718
  });
2720
- };
2719
+ }, {
2720
+ maxFrequency: 2
2721
+ });
2721
2722
  (0, import_async10.scheduleTask)(ctx, async () => {
2722
2723
  const dataSpaceManager = await this._getDataSpaceManager();
2723
2724
  const subscriptions = new import_async10.EventSubscriptions();
@@ -2725,21 +2726,21 @@ var SpacesServiceImpl = class {
2725
2726
  const subscribeSpaces = () => {
2726
2727
  subscriptions.clear();
2727
2728
  for (const space of dataSpaceManager.spaces.values()) {
2728
- subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
2729
- subscriptions.add(space.presence.updated.on(ctx, onUpdate));
2730
- subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
2731
- space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
2729
+ subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.trigger()));
2730
+ subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
2731
+ subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
2732
+ space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
2732
2733
  if (space.dataPipeline.pipelineState) {
2733
- subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
2734
+ subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
2734
2735
  }
2735
2736
  }
2736
2737
  };
2737
2738
  dataSpaceManager.updated.on(ctx, () => {
2738
2739
  subscribeSpaces();
2739
- void onUpdate();
2740
+ scheduler.trigger();
2740
2741
  });
2741
2742
  subscribeSpaces();
2742
- void onUpdate();
2743
+ scheduler.trigger();
2743
2744
  });
2744
2745
  if (!this._identityManager.identity) {
2745
2746
  next({
@@ -2797,7 +2798,7 @@ var SpacesServiceImpl = class {
2797
2798
  const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug5.raise)(new import_echo_pipeline2.SpaceNotFoundError(spaceKey));
2798
2799
  await space.createEpoch();
2799
2800
  }
2800
- _transformSpace(space) {
2801
+ _serializeSpace(space) {
2801
2802
  var _a, _b, _c, _d, _e, _f, _g;
2802
2803
  return {
2803
2804
  spaceKey: space.key,