@statsig/js-on-device-eval-adapter 3.12.0 → 3.12.1

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.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@statsig/js-on-device-eval-adapter",
3
- "version": "3.12.0",
3
+ "version": "3.12.1",
4
4
  "dependencies": {
5
- "@statsig/client-core": "3.12.0",
6
- "@statsig/on-device-eval-core": "3.12.0"
5
+ "@statsig/client-core": "3.12.1",
6
+ "@statsig/on-device-eval-core": "3.12.1"
7
7
  },
8
8
  "type": "commonjs",
9
9
  "main": "./src/index.js",
@@ -1,4 +1,4 @@
1
- import { DynamicConfig, DynamicConfigEvaluationOptions, Experiment, ExperimentEvaluationOptions, FeatureGate, FeatureGateEvaluationOptions, Layer, LayerEvaluationOptions, OverrideAdapter, StatsigUserInternal } from '@statsig/client-core';
1
+ import { DynamicConfig, DynamicConfigEvaluationOptions, EvaluationDetails, Experiment, ExperimentEvaluationOptions, FeatureGate, FeatureGateEvaluationOptions, Layer, LayerEvaluationOptions, OverrideAdapter, ParamStoreConfig, ParameterStore, ParameterStoreEvaluationOptions, StatsigUserInternal } from '@statsig/client-core';
2
2
  export declare class OnDeviceEvalAdapter implements OverrideAdapter {
3
3
  private _store;
4
4
  private _evaluator;
@@ -8,6 +8,10 @@ export declare class OnDeviceEvalAdapter implements OverrideAdapter {
8
8
  getDynamicConfigOverride(current: DynamicConfig, user: StatsigUserInternal, _options?: DynamicConfigEvaluationOptions): DynamicConfig | null;
9
9
  getExperimentOverride(current: Experiment, user: StatsigUserInternal, _options?: ExperimentEvaluationOptions): Experiment | null;
10
10
  getLayerOverride(current: Layer, user: StatsigUserInternal, _options?: LayerEvaluationOptions): Layer | null;
11
+ getParamStoreOverride(current: ParameterStore, _options?: ParameterStoreEvaluationOptions): {
12
+ config: ParamStoreConfig;
13
+ details: EvaluationDetails;
14
+ } | null;
11
15
  private _evaluate;
12
16
  private _shouldTryOnDeviceEval;
13
17
  }
@@ -27,6 +27,14 @@ class OnDeviceEvalAdapter {
27
27
  getLayerOverride(current, user, _options) {
28
28
  return this._evaluate(current, user, this._evaluator.evaluateLayer.bind(this._evaluator), client_core_1._makeLayer);
29
29
  }
30
+ getParamStoreOverride(current, _options) {
31
+ if (!this._shouldTryOnDeviceEval(current.details)) {
32
+ return null;
33
+ }
34
+ const { config, details: newDetails } = this._evaluator.getParamStoreConfig(current.name);
35
+ newDetails.reason = '[OnDevice]' + newDetails.reason;
36
+ return { config: config !== null && config !== void 0 ? config : {}, details: newDetails };
37
+ }
30
38
  _evaluate(current, user, evaluateFn, makeFn) {
31
39
  if (!this._shouldTryOnDeviceEval(current.details)) {
32
40
  return null;