@dxos/client-services 0.1.52 → 0.1.53-main.032dce6

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.
@@ -248,8 +248,10 @@ var DevtoolsServiceImpl = class {
248
248
  });
249
249
  });
250
250
  }
251
- getConfig(request) {
252
- throw new Error();
251
+ async getConfig(request) {
252
+ return {
253
+ config: JSON.stringify(this.params.config.values)
254
+ };
253
255
  }
254
256
  async getStorageInfo() {
255
257
  var _a, _b, _c, _d, _e;
@@ -2939,7 +2941,7 @@ DataSpaceManager = __decorate2([
2939
2941
  ], DataSpaceManager);
2940
2942
 
2941
2943
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
2942
- import { EventSubscriptions as EventSubscriptions2, scheduleTask as scheduleTask5 } from "@dxos/async";
2944
+ import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask5 } from "@dxos/async";
2943
2945
  import { Stream as Stream9 } from "@dxos/codec-protobuf";
2944
2946
  import { raise, todo as todo2 } from "@dxos/debug";
2945
2947
  import { SpaceNotFoundError } from "@dxos/echo-pipeline";
@@ -2947,7 +2949,6 @@ import { log as log11 } from "@dxos/log";
2947
2949
  import { encodeError } from "@dxos/protocols";
2948
2950
  import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/client/services";
2949
2951
  import { humanize } from "@dxos/util";
2950
- var TIMEFRAME_UPDATE_DEBOUNCE_TIME = 500;
2951
2952
  var SpacesServiceImpl = class {
2952
2953
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
2953
2954
  this._identityManager = _identityManager;
@@ -2961,16 +2962,16 @@ var SpacesServiceImpl = class {
2961
2962
  }
2962
2963
  const dataSpaceManager = await this._getDataSpaceManager();
2963
2964
  const space = await dataSpaceManager.createSpace();
2964
- return this._transformSpace(space);
2965
+ return this._serializeSpace(space);
2965
2966
  }
2966
2967
  async updateSpace(request) {
2967
2968
  todo2();
2968
2969
  }
2969
2970
  querySpaces() {
2970
2971
  return new Stream9(({ next, ctx }) => {
2971
- const onUpdate = async () => {
2972
+ const scheduler = new UpdateScheduler(ctx, async () => {
2972
2973
  const dataSpaceManager = await this._getDataSpaceManager();
2973
- const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._transformSpace(space));
2974
+ const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
2974
2975
  log11("update", {
2975
2976
  spaces
2976
2977
  }, {
@@ -2982,7 +2983,9 @@ var SpacesServiceImpl = class {
2982
2983
  next({
2983
2984
  spaces
2984
2985
  });
2985
- };
2986
+ }, {
2987
+ maxFrequency: 2
2988
+ });
2986
2989
  scheduleTask5(ctx, async () => {
2987
2990
  const dataSpaceManager = await this._getDataSpaceManager();
2988
2991
  const subscriptions = new EventSubscriptions2();
@@ -2990,21 +2993,21 @@ var SpacesServiceImpl = class {
2990
2993
  const subscribeSpaces = () => {
2991
2994
  subscriptions.clear();
2992
2995
  for (const space of dataSpaceManager.spaces.values()) {
2993
- subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
2994
- subscriptions.add(space.presence.updated.on(ctx, onUpdate));
2995
- subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
2996
- space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
2996
+ subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.trigger()));
2997
+ subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
2998
+ subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
2999
+ space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
2997
3000
  if (space.dataPipeline.pipelineState) {
2998
- subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
3001
+ subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
2999
3002
  }
3000
3003
  }
3001
3004
  };
3002
3005
  dataSpaceManager.updated.on(ctx, () => {
3003
3006
  subscribeSpaces();
3004
- void onUpdate();
3007
+ scheduler.trigger();
3005
3008
  });
3006
3009
  subscribeSpaces();
3007
- void onUpdate();
3010
+ scheduler.trigger();
3008
3011
  });
3009
3012
  if (!this._identityManager.identity) {
3010
3013
  next({
@@ -3062,7 +3065,7 @@ var SpacesServiceImpl = class {
3062
3065
  const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : raise(new SpaceNotFoundError(spaceKey));
3063
3066
  await space.createEpoch();
3064
3067
  }
3065
- _transformSpace(space) {
3068
+ _serializeSpace(space) {
3066
3069
  var _a, _b, _c, _d, _e, _f, _g;
3067
3070
  return {
3068
3071
  spaceKey: space.key,
@@ -3523,7 +3526,7 @@ var ServiceRegistry = class {
3523
3526
 
3524
3527
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3525
3528
  import assert12 from "@dxos/node-std/assert";
3526
- import { Event as Event8 } from "@dxos/async";
3529
+ import { Event as Event8, synchronized as synchronized2 } from "@dxos/async";
3527
3530
  import { clientServiceBundle, createDefaultModelFactory } from "@dxos/client-protocol";
3528
3531
  import { DataServiceImpl } from "@dxos/echo-pipeline";
3529
3532
  import { PublicKey as PublicKey10 } from "@dxos/keys";
@@ -3727,6 +3730,16 @@ var SystemServiceImpl = class {
3727
3730
  };
3728
3731
 
3729
3732
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3733
+ var __decorate4 = function(decorators, target, key, desc) {
3734
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3735
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3736
+ r = Reflect.decorate(decorators, target, key, desc);
3737
+ else
3738
+ for (var i = decorators.length - 1; i >= 0; i--)
3739
+ if (d = decorators[i])
3740
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3741
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3742
+ };
3730
3743
  var ClientServicesHost = class {
3731
3744
  constructor({
3732
3745
  config,
@@ -3831,7 +3844,7 @@ var ClientServicesHost = class {
3831
3844
  id: traceId
3832
3845
  }), {
3833
3846
  file: "service-host.ts",
3834
- line: 187,
3847
+ line: 188,
3835
3848
  scope: this,
3836
3849
  callSite: (f, a) => f(...a)
3837
3850
  });
@@ -3844,7 +3857,7 @@ var ClientServicesHost = class {
3844
3857
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
3845
3858
  }, {
3846
3859
  file: "service-host.ts",
3847
- line: 195,
3860
+ line: 196,
3848
3861
  scope: this,
3849
3862
  callSite: (f, a) => f(...a)
3850
3863
  });
@@ -3879,7 +3892,7 @@ var ClientServicesHost = class {
3879
3892
  deviceKey
3880
3893
  }, {
3881
3894
  file: "service-host.ts",
3882
- line: 250,
3895
+ line: 251,
3883
3896
  scope: this,
3884
3897
  callSite: (f, a) => f(...a)
3885
3898
  });
@@ -3887,7 +3900,7 @@ var ClientServicesHost = class {
3887
3900
  id: traceId
3888
3901
  }), {
3889
3902
  file: "service-host.ts",
3890
- line: 251,
3903
+ line: 252,
3891
3904
  scope: this,
3892
3905
  callSite: (f, a) => f(...a)
3893
3906
  });
@@ -3902,7 +3915,7 @@ var ClientServicesHost = class {
3902
3915
  deviceKey
3903
3916
  }, {
3904
3917
  file: "service-host.ts",
3905
- line: 260,
3918
+ line: 262,
3906
3919
  scope: this,
3907
3920
  callSite: (f, a) => f(...a)
3908
3921
  });
@@ -3917,7 +3930,7 @@ var ClientServicesHost = class {
3917
3930
  deviceKey
3918
3931
  }, {
3919
3932
  file: "service-host.ts",
3920
- line: 266,
3933
+ line: 268,
3921
3934
  scope: this,
3922
3935
  callSite: (f, a) => f(...a)
3923
3936
  });
@@ -3929,13 +3942,13 @@ var ClientServicesHost = class {
3929
3942
  id: traceId
3930
3943
  }), {
3931
3944
  file: "service-host.ts",
3932
- line: 271,
3945
+ line: 273,
3933
3946
  scope: this,
3934
3947
  callSite: (f, a) => f(...a)
3935
3948
  });
3936
3949
  log15("resetting...", {}, {
3937
3950
  file: "service-host.ts",
3938
- line: 273,
3951
+ line: 275,
3939
3952
  scope: this,
3940
3953
  callSite: (f, a) => f(...a)
3941
3954
  });
@@ -3943,7 +3956,7 @@ var ClientServicesHost = class {
3943
3956
  await this._storage.reset();
3944
3957
  log15("reset", {}, {
3945
3958
  file: "service-host.ts",
3946
- line: 276,
3959
+ line: 278,
3947
3960
  scope: this,
3948
3961
  callSite: (f, a) => f(...a)
3949
3962
  });
@@ -3951,12 +3964,18 @@ var ClientServicesHost = class {
3951
3964
  id: traceId
3952
3965
  }), {
3953
3966
  file: "service-host.ts",
3954
- line: 277,
3967
+ line: 279,
3955
3968
  scope: this,
3956
3969
  callSite: (f, a) => f(...a)
3957
3970
  });
3958
3971
  }
3959
3972
  };
3973
+ __decorate4([
3974
+ synchronized2
3975
+ ], ClientServicesHost.prototype, "open", null);
3976
+ __decorate4([
3977
+ synchronized2
3978
+ ], ClientServicesHost.prototype, "close", null);
3960
3979
 
3961
3980
  export {
3962
3981
  subscribeToFeeds,
@@ -3988,4 +4007,4 @@ export {
3988
4007
  ServiceRegistry,
3989
4008
  ClientServicesHost
3990
4009
  };
3991
- //# sourceMappingURL=chunk-C3SPTMW3.mjs.map
4010
+ //# sourceMappingURL=chunk-6ITWCQIT.mjs.map