@forge/feature-flags-node 3.0.0-next.1 → 3.0.0-next.1-experimental-fd4d1a2
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/CHANGELOG.md +12 -0
- package/out/evaluator.d.ts.map +1 -1
- package/out/evaluator.js +6 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @forge/feature-flags-node
|
|
2
2
|
|
|
3
|
+
## 3.0.0-next.1-experimental-fd4d1a2
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 4c1adf3: Rule evaluator implementation change
|
|
8
|
+
- fd4d1a2: testing evaluator
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [63d29ca]
|
|
13
|
+
- @forge/api@7.0.1-next.1-experimental-fd4d1a2
|
|
14
|
+
|
|
3
15
|
## 3.0.0-next.1
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
package/out/evaluator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAkB,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAc3F,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;gBAC9B,OAAO,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;IAM1C,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,GAAG,gBAAgB;
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAkB,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAc3F,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;gBAC9B,OAAO,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;IAM1C,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,GAAG,gBAAgB;IA4ChE,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,YAAY;IAwBpB,OAAO,CAAC,sBAAsB;IAqC9B,OAAO,CAAC,SAAS;CAGlB"}
|
package/out/evaluator.js
CHANGED
|
@@ -26,9 +26,10 @@ class Evaluator {
|
|
|
26
26
|
.filter((rule) => rule.env.includes(this.environment))
|
|
27
27
|
.sort((a, b) => a.order - b.order);
|
|
28
28
|
for (const rule of rulesForEnv) {
|
|
29
|
-
|
|
29
|
+
const ruleResult = this.evaluateRule(user, rule, flag);
|
|
30
|
+
if (ruleResult !== null) {
|
|
30
31
|
return {
|
|
31
|
-
value:
|
|
32
|
+
value: ruleResult,
|
|
32
33
|
ruleId: rule.name,
|
|
33
34
|
reason: 'rule_match'
|
|
34
35
|
};
|
|
@@ -63,9 +64,10 @@ class Evaluator {
|
|
|
63
64
|
const conditionResults = rule.conditions.map((condition) => (0, conditions_1.evaluateCondition)(user, condition));
|
|
64
65
|
const conditionsPassed = conditionResults.every((result) => result === true);
|
|
65
66
|
if (!conditionsPassed) {
|
|
66
|
-
return
|
|
67
|
+
return null;
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
const passesPercentageCheck = this.evaluatePassPercentage(user, rule, flag);
|
|
70
|
+
return passesPercentageCheck ? rule.returnValue.value : false;
|
|
69
71
|
}
|
|
70
72
|
evaluatePassPercentage(user, rule, flag) {
|
|
71
73
|
if (rule.passPercentage === undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/feature-flags-node",
|
|
3
|
-
"version": "3.0.0-next.1",
|
|
3
|
+
"version": "3.0.0-next.1-experimental-fd4d1a2",
|
|
4
4
|
"description": "Feature Flags Node SDK for Atlassian Forge apps running on Node Runtime",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@types/node": "20.19.1"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@forge/api": "^7.0.1-next.
|
|
18
|
+
"@forge/api": "^7.0.1-next.1-experimental-fd4d1a2"
|
|
19
19
|
},
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"registry": "https://packages.atlassian.com/api/npm/npm-public/"
|