ais_auth_lib 1.0.10 → 1.0.11

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/conditions.js +12 -7
  2. package/package.json +1 -1
@@ -2,22 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPropertiesByPath = exports.evaluateConditionGroup = exports.evaluateCondition = exports.resolveDynamicValue = void 0;
4
4
  function resolveDynamicValue(condition, context) {
5
- if (!context)
5
+ if (!(context === null || context === void 0 ? void 0 : context.user))
6
6
  return undefined;
7
7
  switch (condition.attribute) {
8
8
  case "userUid":
9
- if (condition.value == "me") {
9
+ if (condition.value === "me") {
10
10
  return context.user.uid;
11
11
  }
12
12
  break;
13
13
  case "resources.*.companies.*.division.uid":
14
- if (condition.value == "my_division") {
15
- return context.user.companies.map((company) => company.division.uid);
14
+ if (!Array.isArray(context.user.companies)) {
15
+ return undefined;
16
16
  }
17
- if (condition.value == "parent_division") {
17
+ if (condition.value === "my_division") {
18
18
  return context.user.companies
19
- .map((company) => company.division.parentUid)
20
- .filter((d) => d);
19
+ .map((company) => { var _a; return (_a = company === null || company === void 0 ? void 0 : company.division) === null || _a === void 0 ? void 0 : _a.uid; })
20
+ .filter(Boolean);
21
+ }
22
+ if (condition.value === "parent_division") {
23
+ return context.user.companies
24
+ .map((company) => { var _a; return (_a = company === null || company === void 0 ? void 0 : company.division) === null || _a === void 0 ? void 0 : _a.parentUid; })
25
+ .filter(Boolean);
21
26
  }
22
27
  }
23
28
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ais_auth_lib",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "auth lib for microservices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",