asv-hlps 1.4.2 → 1.4.4

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.
@@ -6,18 +6,18 @@ const arraySome = (arr1, arr2) => {
6
6
  return arr1.some((x) => arr2.includes(x));
7
7
  };
8
8
  const getAuth = (authUser, authSte, param) => {
9
- var _a, _b, _c, _d, _e, _f;
10
- if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags.length)) {
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
10
+ if ((param === null || param === void 0 ? void 0 : param.tag) && ((_a = authUser === null || authUser === void 0 ? void 0 : authUser.tags) === null || _a === void 0 ? void 0 : _a.length)) {
11
11
  const tags = [];
12
12
  for (const tag of authUser.tags) {
13
- tags.push(tag.code.toLowerCase());
13
+ tags.push((_b = tag === null || tag === void 0 ? void 0 : tag.code) === null || _b === void 0 ? void 0 : _b.toLowerCase());
14
14
  }
15
- const authIn = tags.includes(param.tag.toLowerCase());
15
+ const authIn = tags === null || tags === void 0 ? void 0 : tags.includes((_c = param === null || param === void 0 ? void 0 : param.tag) === null || _c === void 0 ? void 0 : _c.toLowerCase());
16
16
  if (authIn) {
17
17
  return true;
18
18
  }
19
19
  }
20
- if (((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
20
+ if (((_d = param === null || param === void 0 ? void 0 : param.roles) === null || _d === void 0 ? void 0 : _d.length) > 0) {
21
21
  /* if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
22
22
  return true;
23
23
  } */
@@ -27,7 +27,7 @@ const getAuth = (authUser, authSte, param) => {
27
27
  }
28
28
  // ------ staff ------
29
29
  if (param === null || param === void 0 ? void 0 : param.staff) {
30
- if (((_b = param === null || param === void 0 ? void 0 : param.staff.roles) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
30
+ if (((_e = param === null || param === void 0 ? void 0 : param.staff.roles) === null || _e === void 0 ? void 0 : _e.length) > 0 &&
31
31
  (0, user_1.isStaffSte)(authSte, authUser.ste.name) &&
32
32
  ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
33
33
  return true;
@@ -48,7 +48,7 @@ const getAuth = (authUser, authSte, param) => {
48
48
  param.client.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
49
49
  return true;
50
50
  }
51
- if (((_c = param === null || param === void 0 ? void 0 : param.client.roles) === null || _c === void 0 ? void 0 : _c.length) &&
51
+ if (((_f = param === null || param === void 0 ? void 0 : param.client.roles) === null || _f === void 0 ? void 0 : _f.length) &&
52
52
  (param === null || param === void 0 ? void 0 : param.client.steGrps.length) &&
53
53
  ["ceo", ...param === null || param === void 0 ? void 0 : param.client.roles].includes(authUser.role.code.toLowerCase()) &&
54
54
  (param === null || param === void 0 ? void 0 : param.client.steGrps).includes(authUser.ste.grp.code.toLowerCase())) {
@@ -57,13 +57,13 @@ const getAuth = (authUser, authSte, param) => {
57
57
  }
58
58
  }
59
59
  // ------ ste grps ------
60
- if (((_d = param === null || param === void 0 ? void 0 : param.steGrps) === null || _d === void 0 ? void 0 : _d.length) > 0 && param.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
60
+ if (((_g = param === null || param === void 0 ? void 0 : param.steGrps) === null || _g === void 0 ? void 0 : _g.length) > 0 && param.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
61
61
  return true;
62
62
  }
63
- if (((_e = param === null || param === void 0 ? void 0 : param.grps) === null || _e === void 0 ? void 0 : _e.length) && param.grps.includes(authUser.grp.code.toLowerCase())) {
63
+ if (((_h = param === null || param === void 0 ? void 0 : param.grps) === null || _h === void 0 ? void 0 : _h.length) && param.grps.includes(authUser.grp.code.toLowerCase())) {
64
64
  return true;
65
65
  }
66
- if (((_f = param === null || param === void 0 ? void 0 : param.steNames) === null || _f === void 0 ? void 0 : _f.length) > 0 && param.steNames.includes(authUser.ste.name.toLowerCase())) {
66
+ if (((_j = param === null || param === void 0 ? void 0 : param.steNames) === null || _j === void 0 ? void 0 : _j.length) > 0 && param.steNames.includes(authUser.ste.name.toLowerCase())) {
67
67
  return true;
68
68
  }
69
69
  return false;
@@ -1,6 +1,6 @@
1
- import NaCoAc from "@/shared/models/NaCoAc";
1
+ import NaCoAc from "../../shared/models/NaCoAc";
2
2
  import AuthTagCat from "./AuthTagCat";
3
- import AuthTagSub from "@/auth/models/AuthTagSub";
3
+ import AuthTagSub from "./AuthTagSub";
4
4
  export default interface AuthTag extends NaCoAc {
5
5
  cat?: AuthTagCat;
6
6
  subs?: AuthTagSub[];
@@ -3,18 +3,18 @@ const arraySome = (arr1, arr2) => {
3
3
  return arr1.some((x) => arr2.includes(x));
4
4
  };
5
5
  const getAuth = (authUser, authSte, param) => {
6
- var _a, _b, _c, _d, _e, _f;
7
- if ((param === null || param === void 0 ? void 0 : param.tag) && (authUser === null || authUser === void 0 ? void 0 : authUser.tags.length)) {
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
7
+ if ((param === null || param === void 0 ? void 0 : param.tag) && ((_a = authUser === null || authUser === void 0 ? void 0 : authUser.tags) === null || _a === void 0 ? void 0 : _a.length)) {
8
8
  const tags = [];
9
9
  for (const tag of authUser.tags) {
10
- tags.push(tag.code.toLowerCase());
10
+ tags.push((_b = tag === null || tag === void 0 ? void 0 : tag.code) === null || _b === void 0 ? void 0 : _b.toLowerCase());
11
11
  }
12
- const authIn = tags.includes(param.tag.toLowerCase());
12
+ const authIn = tags === null || tags === void 0 ? void 0 : tags.includes((_c = param === null || param === void 0 ? void 0 : param.tag) === null || _c === void 0 ? void 0 : _c.toLowerCase());
13
13
  if (authIn) {
14
14
  return true;
15
15
  }
16
16
  }
17
- if (((_a = param === null || param === void 0 ? void 0 : param.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
17
+ if (((_d = param === null || param === void 0 ? void 0 : param.roles) === null || _d === void 0 ? void 0 : _d.length) > 0) {
18
18
  /* if (isStaffSte(authSte, authUser.ste.name) && ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
19
19
  return true;
20
20
  } */
@@ -24,7 +24,7 @@ const getAuth = (authUser, authSte, param) => {
24
24
  }
25
25
  // ------ staff ------
26
26
  if (param === null || param === void 0 ? void 0 : param.staff) {
27
- if (((_b = param === null || param === void 0 ? void 0 : param.staff.roles) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
27
+ if (((_e = param === null || param === void 0 ? void 0 : param.staff.roles) === null || _e === void 0 ? void 0 : _e.length) > 0 &&
28
28
  isStaffSte(authSte, authUser.ste.name) &&
29
29
  ["sadm", ...param.roles].includes(authUser.role.code.toLowerCase())) {
30
30
  return true;
@@ -45,7 +45,7 @@ const getAuth = (authUser, authSte, param) => {
45
45
  param.client.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
46
46
  return true;
47
47
  }
48
- if (((_c = param === null || param === void 0 ? void 0 : param.client.roles) === null || _c === void 0 ? void 0 : _c.length) &&
48
+ if (((_f = param === null || param === void 0 ? void 0 : param.client.roles) === null || _f === void 0 ? void 0 : _f.length) &&
49
49
  (param === null || param === void 0 ? void 0 : param.client.steGrps.length) &&
50
50
  ["ceo", ...param === null || param === void 0 ? void 0 : param.client.roles].includes(authUser.role.code.toLowerCase()) &&
51
51
  (param === null || param === void 0 ? void 0 : param.client.steGrps).includes(authUser.ste.grp.code.toLowerCase())) {
@@ -54,13 +54,13 @@ const getAuth = (authUser, authSte, param) => {
54
54
  }
55
55
  }
56
56
  // ------ ste grps ------
57
- if (((_d = param === null || param === void 0 ? void 0 : param.steGrps) === null || _d === void 0 ? void 0 : _d.length) > 0 && param.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
57
+ if (((_g = param === null || param === void 0 ? void 0 : param.steGrps) === null || _g === void 0 ? void 0 : _g.length) > 0 && param.steGrps.includes(authUser.ste.grp.code.toLowerCase())) {
58
58
  return true;
59
59
  }
60
- if (((_e = param === null || param === void 0 ? void 0 : param.grps) === null || _e === void 0 ? void 0 : _e.length) && param.grps.includes(authUser.grp.code.toLowerCase())) {
60
+ if (((_h = param === null || param === void 0 ? void 0 : param.grps) === null || _h === void 0 ? void 0 : _h.length) && param.grps.includes(authUser.grp.code.toLowerCase())) {
61
61
  return true;
62
62
  }
63
- if (((_f = param === null || param === void 0 ? void 0 : param.steNames) === null || _f === void 0 ? void 0 : _f.length) > 0 && param.steNames.includes(authUser.ste.name.toLowerCase())) {
63
+ if (((_j = param === null || param === void 0 ? void 0 : param.steNames) === null || _j === void 0 ? void 0 : _j.length) > 0 && param.steNames.includes(authUser.ste.name.toLowerCase())) {
64
64
  return true;
65
65
  }
66
66
  return false;
@@ -1,6 +1,6 @@
1
- import NaCoAc from "@/shared/models/NaCoAc";
1
+ import NaCoAc from "../../shared/models/NaCoAc";
2
2
  import AuthTagCat from "./AuthTagCat";
3
- import AuthTagSub from "@/auth/models/AuthTagSub";
3
+ import AuthTagSub from "./AuthTagSub";
4
4
  export default interface AuthTag extends NaCoAc {
5
5
  cat?: AuthTagCat;
6
6
  subs?: AuthTagSub[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",