ais_auth_lib 1.0.0 → 1.0.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/dist/filter.js CHANGED
@@ -5,6 +5,7 @@ const conditions_1 = require("./conditions");
5
5
  function filterObjects(objects, rules) {
6
6
  return objects.filter((obj) => {
7
7
  let overallResult = false;
8
+ const actions = new Set();
8
9
  for (const rule of rules) {
9
10
  let ruleResult = (0, conditions_1.evaluateConditionGroup)(obj, rule.conditionGroups[0]);
10
11
  for (let i = 1; i < rule.conditionGroups.length; i++) {
@@ -17,8 +18,14 @@ function filterObjects(objects, rules) {
17
18
  ruleResult = ruleResult && currentResult;
18
19
  }
19
20
  }
21
+ if (ruleResult) {
22
+ actions.add(rule.action);
23
+ }
20
24
  overallResult = overallResult || ruleResult;
21
25
  }
26
+ if (overallResult) {
27
+ obj.actions = Array.from(actions);
28
+ }
22
29
  return overallResult;
23
30
  });
24
31
  }
@@ -5,5 +5,5 @@ export interface ConditionGroup {
5
5
  logicalCondition: string | null;
6
6
  orderIndex: number;
7
7
  conditions: Condition[];
8
- rule: Rule;
8
+ rule?: Rule;
9
9
  }
@@ -6,5 +6,5 @@ export interface Condition {
6
6
  operator: string;
7
7
  orderIndex: number;
8
8
  logicalCondition: string;
9
- conditionGroup: ConditionGroup;
9
+ conditionGroup?: ConditionGroup;
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ais_auth_lib",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "auth lib for microservices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",