ais_auth_lib 1.0.8 → 1.0.9

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.
Files changed (2) hide show
  1. package/dist/filter.js +6 -2
  2. package/package.json +1 -1
package/dist/filter.js CHANGED
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkResourceMatchWithRules = exports.filterObjects = void 0;
4
4
  const conditions_1 = require("./conditions");
5
5
  function filterObjects(objects, rules) {
6
+ const rulesWithoutCreateAction = rules.map((rule) => ({
7
+ ...rule,
8
+ actions: rule.actions.filter((action) => action !== "create"),
9
+ })).filter(rule => rule.actions.length > 0);
6
10
  return objects.filter((obj) => {
7
- return checkResourceMatchWithRules(obj, rules);
11
+ return checkResourceMatchWithRules(obj, rulesWithoutCreateAction);
8
12
  });
9
13
  }
10
14
  exports.filterObjects = filterObjects;
@@ -24,7 +28,7 @@ function checkResourceMatchWithRules(obj, rules) {
24
28
  }
25
29
  }
26
30
  if (ruleResult) {
27
- rule.actions.forEach(action => actions.add(action));
31
+ rule.actions.forEach((action) => actions.add(action));
28
32
  }
29
33
  overallResult = overallResult || ruleResult;
30
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ais_auth_lib",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "auth lib for microservices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",