@statsig/on-device-eval-core 3.18.1 → 3.18.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/on-device-eval-core",
3
- "version": "3.18.1",
3
+ "version": "3.18.2",
4
4
  "license": "ISC",
5
5
  "homepage": "https://github.com/statsig-io/js-client-monorepo",
6
6
  "repository": {
@@ -9,8 +9,8 @@
9
9
  "directory": "packages/on-device-eval-core"
10
10
  },
11
11
  "dependencies": {
12
- "@statsig/client-core": "3.18.1",
13
- "@statsig/sha256": "3.18.1"
12
+ "@statsig/client-core": "3.18.2",
13
+ "@statsig/sha256": "3.18.2"
14
14
  },
15
15
  "type": "commonjs",
16
16
  "main": "./src/index.js",
@@ -10,6 +10,7 @@ export declare class Evaluator {
10
10
  evaluateGate(name: string, user: StatsigUserInternal): DetailedEvaluation<GateEvaluation>;
11
11
  evaluateConfig(name: string, user: StatsigUserInternal): DetailedEvaluation<DynamicConfigEvaluation>;
12
12
  evaluateLayer(name: string, user: StatsigUserInternal): DetailedEvaluation<LayerEvaluation>;
13
+ private _handleUnsupportedEvaluation;
13
14
  getParamStoreConfig(name: string): {
14
15
  config: ParamStoreConfig | null;
15
16
  details: EvaluationDetails;
package/src/Evaluator.js CHANGED
@@ -15,7 +15,9 @@ class Evaluator {
15
15
  if (!spec) {
16
16
  return { evaluation: null, details };
17
17
  }
18
- const evaluation = (0, EvaluationResult_1.resultToGateEval)(spec, this._evaluateSpec(spec, user));
18
+ const result = this._evaluateSpec(spec, user);
19
+ const evaluation = (0, EvaluationResult_1.resultToGateEval)(spec, result);
20
+ this._handleUnsupportedEvaluation(result, details);
19
21
  return { evaluation, details };
20
22
  }
21
23
  evaluateConfig(name, user) {
@@ -23,7 +25,9 @@ class Evaluator {
23
25
  if (!spec) {
24
26
  return { evaluation: null, details };
25
27
  }
26
- const evaluation = (0, EvaluationResult_1.resultToConfigEval)(spec, this._evaluateSpec(spec, user));
28
+ const result = this._evaluateSpec(spec, user);
29
+ const evaluation = (0, EvaluationResult_1.resultToConfigEval)(spec, result);
30
+ this._handleUnsupportedEvaluation(result, details);
27
31
  return { evaluation, details };
28
32
  }
29
33
  evaluateLayer(name, user) {
@@ -36,8 +40,14 @@ class Evaluator {
36
40
  const experimentName = (_a = result === null || result === void 0 ? void 0 : result.allocated_experiment_name) !== null && _a !== void 0 ? _a : '';
37
41
  const experimentSpec = this._store.getSpecAndSourceInfo('config', experimentName).spec;
38
42
  const evaluation = (0, EvaluationResult_1.resultToLayerEval)(spec, experimentSpec, result);
43
+ this._handleUnsupportedEvaluation(result, details);
39
44
  return { evaluation, details };
40
45
  }
46
+ _handleUnsupportedEvaluation(evaluation, details) {
47
+ if (evaluation.unsupported) {
48
+ details.reason = 'Unsupported';
49
+ }
50
+ }
41
51
  getParamStoreConfig(name) {
42
52
  var _a;
43
53
  const paramStoreAndSourceInfo = this._store.getParamStoreAndSourceInfo(name);