@das-fed/upf-utils 6.4.0-dev.227 → 6.4.0-dev.229

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 (93) hide show
  1. package/api-services/es5.js +1082 -1077
  2. package/api-services/index.js +846 -842
  3. package/api-services/index.js.gz +0 -0
  4. package/api-services/modules/app-manage/es5.js +1418 -1403
  5. package/api-services/modules/app-manage/index.js +1198 -1180
  6. package/api-services/modules/app-manage/index.js.gz +0 -0
  7. package/api-services/modules/authentication/es5.js +161 -158
  8. package/api-services/modules/authentication/index.js +138 -138
  9. package/api-services/modules/authentication/index.js.gz +0 -0
  10. package/api-services/modules/bems/es5.js +1180 -1165
  11. package/api-services/modules/bems/index.js +976 -958
  12. package/api-services/modules/bems/index.js.gz +0 -0
  13. package/api-services/modules/contract/es5.js +702 -699
  14. package/api-services/modules/contract/index.js +619 -619
  15. package/api-services/modules/contract/index.js.gz +0 -0
  16. package/api-services/modules/duty-manage/es5.js +1389 -1374
  17. package/api-services/modules/duty-manage/index.js +1180 -1162
  18. package/api-services/modules/duty-manage/index.js.gz +0 -0
  19. package/api-services/modules/enterpriseright/es5.js +1174 -1159
  20. package/api-services/modules/enterpriseright/index.js +971 -953
  21. package/api-services/modules/enterpriseright/index.js.gz +0 -0
  22. package/api-services/modules/es5.js +1337 -1346
  23. package/api-services/modules/file/es5.js +1222 -1231
  24. package/api-services/modules/file/index.js +987 -1005
  25. package/api-services/modules/file/index.js.gz +0 -0
  26. package/api-services/modules/gateway-edge/es5.js +1384 -1391
  27. package/api-services/modules/gateway-edge/index.js +1165 -1179
  28. package/api-services/modules/gateway-edge/index.js.gz +0 -0
  29. package/api-services/modules/index.js +1046 -1064
  30. package/api-services/modules/index.js.gz +0 -0
  31. package/api-services/modules/iot/es5.js +1206 -1191
  32. package/api-services/modules/iot/index.js +1006 -988
  33. package/api-services/modules/iot/index.js.gz +0 -0
  34. package/api-services/modules/justauth/es5.js +1148 -1133
  35. package/api-services/modules/justauth/index.js +954 -936
  36. package/api-services/modules/justauth/index.js.gz +0 -0
  37. package/api-services/modules/knowledge/es5.js +1157 -1163
  38. package/api-services/modules/knowledge/index.js +955 -969
  39. package/api-services/modules/knowledge/index.js.gz +0 -0
  40. package/api-services/modules/link/es5.js +1384 -1393
  41. package/api-services/modules/link/index.js +1165 -1183
  42. package/api-services/modules/link/index.js.gz +0 -0
  43. package/api-services/modules/permission/es5.js +1157 -1163
  44. package/api-services/modules/permission/index.js +955 -969
  45. package/api-services/modules/permission/index.js.gz +0 -0
  46. package/api-services/modules/platformManage/es5.js +171 -168
  47. package/api-services/modules/platformManage/index.js +150 -150
  48. package/api-services/modules/platformManage/index.js.gz +0 -0
  49. package/api-services/modules/portal/es5.js +235 -232
  50. package/api-services/modules/portal/index.js +209 -209
  51. package/api-services/modules/portal/index.js.gz +0 -0
  52. package/api-services/modules/space-manage/es5.js +919 -913
  53. package/api-services/modules/space-manage/index.js +728 -724
  54. package/api-services/modules/space-manage/index.js.gz +0 -0
  55. package/api-services/modules/super-admin/es5.js +1117 -1126
  56. package/api-services/modules/super-admin/index.js +916 -934
  57. package/api-services/modules/super-admin/index.js.gz +0 -0
  58. package/api-services/modules/supplier/es5.js +165 -162
  59. package/api-services/modules/supplier/index.js +141 -141
  60. package/api-services/modules/supplier/index.js.gz +0 -0
  61. package/api-services/modules/supplychain-manage/es5.js +1134 -1143
  62. package/api-services/modules/supplychain-manage/index.js +932 -950
  63. package/api-services/modules/supplychain-manage/index.js.gz +0 -0
  64. package/api-services/modules/systemConfiguration/es5.js +1145 -1133
  65. package/api-services/modules/systemConfiguration/index.js +948 -934
  66. package/api-services/modules/systemConfiguration/index.js.gz +0 -0
  67. package/api-services/modules/tool/es5.js +1174 -1159
  68. package/api-services/modules/tool/index.js +971 -953
  69. package/api-services/modules/tool/index.js.gz +0 -0
  70. package/api-services/src/create-service/es5.js +1390 -1397
  71. package/api-services/src/create-service/index.js +1164 -1178
  72. package/api-services/src/create-service/index.js.gz +0 -0
  73. package/common-info/es5.js +1635 -1596
  74. package/common-info/getPermissionMethod/es5.js +1160 -1148
  75. package/common-info/getPermissionMethod/index.js +956 -942
  76. package/common-info/getPermissionMethod/index.js.gz +0 -0
  77. package/common-info/index.d.ts +9 -2
  78. package/common-info/index.js +1417 -1397
  79. package/common-info/index.js.gz +0 -0
  80. package/create-api-service/es5.js +165 -161
  81. package/create-api-service/index.d.ts +6 -6
  82. package/create-api-service/index.js +151 -150
  83. package/create-api-service/index.js.gz +0 -0
  84. package/directive/auth/es5.js +49 -56
  85. package/directive/auth/index.js +33 -41
  86. package/directive/auth/index.js.gz +0 -0
  87. package/esm-map.json +4 -1
  88. package/hooks/use-get-auth/es5.js +57 -191
  89. package/hooks/use-get-auth/index.d.ts +2 -7
  90. package/hooks/use-get-auth/index.js +16 -50
  91. package/package.json +3 -3
  92. package/hooks/use-get-auth/apis.d.ts +0 -4
  93. package/hooks/use-get-auth/index.js.gz +0 -0
Binary file
@@ -2,80 +2,73 @@
2
2
 
3
3
  var commonInfo = require('@das-fed/upf-utils/common-info/es5');
4
4
  var utils = require('@das-fed/upf-utils/directive/utils/es5');
5
- var y = function y(s) {
6
- var e = /* @__PURE__ */new Set();
7
- return s.forEach(function (t) {
8
- var n = String(t !== null && t !== void 0 ? t : "").trim();
9
- if (!n) return;
10
- var r = n.lastIndexOf("."),
11
- o = n.lastIndexOf("_"),
12
- c = Math.max(r, o),
13
- d = c >= 0 ? n.slice(c + 1) : n;
14
- d && e.add(d);
15
- }), e;
16
- },
17
- S = function S(s) {
5
+ var A = function A(e) {
18
6
  var _ref;
19
- var e = (_ref = s == null ? undefined : s.code) !== null && _ref !== void 0 ? _ref : "";
7
+ var i = (_ref = e == null ? undefined : e.code) !== null && _ref !== void 0 ? _ref : "";
20
8
  var t = false;
21
- if (!e) return t;
22
- var n = Array.isArray(e) ? e : [e],
9
+ if (!i) return t;
10
+ var o = Array.isArray(i) ? i : [i],
23
11
  r = commonInfo.getCurrentModulePermissionData("all"),
24
- o = Array.isArray(r == null ? undefined : r.idList) ? r.idList : commonInfo.getCurrentModulePermissionData("id"),
12
+ a = Array.isArray(r == null ? undefined : r.idList) ? r.idList : commonInfo.getCurrentModulePermissionData("id"),
25
13
  c = Array.isArray(r == null ? undefined : r.codeList) ? r.codeList : commonInfo.getCurrentModulePermissionData("code"),
26
- d = new Set((Array.isArray(o) ? o : []).map(function (a) {
27
- return String(a);
14
+ d = new Set((Array.isArray(a) ? a : []).map(function (n) {
15
+ return String(n);
28
16
  })),
29
- f = new Set((Array.isArray(c) ? c : []).map(function (a) {
30
- return String(a);
17
+ u = new Set((Array.isArray(c) ? c : []).map(function (n) {
18
+ return String(n);
31
19
  })),
32
- l = n.some(function (a) {
33
- var i = String(a !== null && a !== void 0 ? a : "").trim();
34
- return i && !/^[0-9]{3,}$/.test(i) && !i.includes(".") && !i.includes("_");
35
- }) ? y(f) : /* @__PURE__ */new Set(),
36
- x = function x(a) {
37
- if (!a) return false;
38
- var i = String(a || "").trim();
39
- if (!i) return false;
40
- if (i.includes(".") || i.includes("_")) return f.has(i);
41
- var m = {
42
- search: "q",
43
- add: "a",
44
- "delete": "d",
45
- edit: "m",
46
- view: "v"
47
- }[i] || "";
48
- return l.has(i) || (m ? l.has(m) : false);
20
+ y = o.some(function (n) {
21
+ var s = String(n !== null && n !== void 0 ? n : "").trim();
22
+ return s && !/^[0-9]{3,}$/.test(s) && !s.includes(".") && !s.includes("_");
23
+ }),
24
+ L = commonInfo.getCurrentRouteCode(),
25
+ l = y ? commonInfo.buildActionSuffixSet(u, {
26
+ routeCode: L
27
+ }) : /* @__PURE__ */new Set(),
28
+ v = {
29
+ search: "q",
30
+ add: "a",
31
+ "delete": "d",
32
+ edit: "m",
33
+ view: "v"
34
+ },
35
+ w = function w(n) {
36
+ if (!n) return false;
37
+ var s = String(n || "").trim();
38
+ if (!s) return false;
39
+ if (s.includes(".") || s.includes("_")) return u.has(s);
40
+ var m = v[s] || "";
41
+ return l.has(s) || (m ? l.has(m) : false);
49
42
  };
50
- return (d.size > 0 || f.size > 0) && (t = n.some(function (a) {
51
- var i = String(a !== null && a !== void 0 ? a : "").trim();
52
- return i ? /^[0-9]{3,}$/.test(i) ? d.has(i) : x(i) : false;
43
+ return (d.size > 0 || u.size > 0) && (t = o.some(function (n) {
44
+ var s = String(n !== null && n !== void 0 ? n : "").trim();
45
+ return s ? /^[0-9]{3,}$/.test(s) ? d.has(s) : w(s) : false;
53
46
  }), t) ? true : t;
54
47
  },
55
- A = function A(s, e) {
56
- e === "hide" ? s.classList.add("is-hide") : (s.setAttribute("disabled", ""), s.classList.add("is-disabled"));
48
+ S = function S(e, i) {
49
+ i === "hide" ? e.classList.add("is-hide") : (e.setAttribute("disabled", ""), e.classList.add("is-disabled"));
57
50
  },
58
- w = function w(s, e) {
59
- e === "hide" ? s.classList.remove("is-hide") : (s.removeAttribute("disabled"), s.classList.remove("is-disabled"));
51
+ C = function C(e, i) {
52
+ i === "hide" ? e.classList.remove("is-hide") : (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
60
53
  },
61
- p = function p(s, e) {
54
+ E = function E(e, i) {
62
55
  var _ref2;
63
- var t = (s ? e.value : e) || {};
56
+ var t = (e ? i.value : i) || {};
64
57
  typeof t == "string" && (t = {
65
58
  code: t
66
59
  });
67
- var n = (_ref2 = t == null ? undefined : t.type) !== null && _ref2 !== void 0 ? _ref2 : "hide",
68
- r = S(t);
69
- if (s) if (!e.oldValue) r || utils.getEl(s, t).then(function (o) {
70
- A(o, n);
60
+ var o = (_ref2 = t == null ? undefined : t.type) !== null && _ref2 !== void 0 ? _ref2 : "hide",
61
+ r = A(t);
62
+ if (e) if (!i.oldValue) r || utils.getEl(e, t).then(function (a) {
63
+ S(a, o);
71
64
  });else {
72
- var o = S(e.oldValue),
65
+ var a = A(i.oldValue),
73
66
  c = r;
74
- if (o === c) return;
75
- utils.getEl(s, t).then(function (d) {
76
- c ? w(d, n) : A(d, n);
67
+ if (a === c) return;
68
+ utils.getEl(e, t).then(function (d) {
69
+ c ? C(d, o) : S(d, o);
77
70
  });
78
71
  }
79
72
  return r;
80
73
  };
81
- exports.vAuth = p;
74
+ exports.vAuth = E;
@@ -1,55 +1,47 @@
1
- import { getCurrentModulePermissionData as u } from "@das-fed/upf-utils/common-info";
1
+ import { getCurrentModulePermissionData as f, getCurrentRouteCode as g, buildActionSuffixSet as P } from "@das-fed/upf-utils/common-info";
2
2
  import { getEl as h } from "@das-fed/upf-utils/directive/utils";
3
- const y = (s) => {
4
- const e = /* @__PURE__ */ new Set();
5
- return s.forEach((t) => {
6
- const n = String(t ?? "").trim();
7
- if (!n) return;
8
- const r = n.lastIndexOf("."), o = n.lastIndexOf("_"), c = Math.max(r, o), d = c >= 0 ? n.slice(c + 1) : n;
9
- d && e.add(d);
10
- }), e;
11
- }, S = (s) => {
12
- const e = (s == null ? void 0 : s.code) ?? "";
3
+ const A = (e) => {
4
+ const i = (e == null ? void 0 : e.code) ?? "";
13
5
  let t = !1;
14
- if (!e)
6
+ if (!i)
15
7
  return t;
16
- const n = Array.isArray(e) ? e : [e], r = u("all"), o = Array.isArray(r == null ? void 0 : r.idList) ? r.idList : u("id"), c = Array.isArray(r == null ? void 0 : r.codeList) ? r.codeList : u("code"), d = new Set((Array.isArray(o) ? o : []).map((a) => String(a))), f = new Set((Array.isArray(c) ? c : []).map((a) => String(a))), l = n.some((a) => {
17
- const i = String(a ?? "").trim();
18
- return i && !/^[0-9]{3,}$/.test(i) && !i.includes(".") && !i.includes("_");
19
- }) ? y(f) : /* @__PURE__ */ new Set(), x = (a) => {
20
- if (!a) return !1;
21
- const i = String(a || "").trim();
22
- if (!i) return !1;
23
- if (i.includes(".") || i.includes("_")) return f.has(i);
24
- const m = { search: "q", add: "a", delete: "d", edit: "m", view: "v" }[i] || "";
25
- return l.has(i) || (m ? l.has(m) : !1);
8
+ const o = Array.isArray(i) ? i : [i], r = f("all"), a = Array.isArray(r == null ? void 0 : r.idList) ? r.idList : f("id"), c = Array.isArray(r == null ? void 0 : r.codeList) ? r.codeList : f("code"), d = new Set((Array.isArray(a) ? a : []).map((n) => String(n))), u = new Set((Array.isArray(c) ? c : []).map((n) => String(n))), y = o.some((n) => {
9
+ const s = String(n ?? "").trim();
10
+ return s && !/^[0-9]{3,}$/.test(s) && !s.includes(".") && !s.includes("_");
11
+ }), L = g(), l = y ? P(u, { routeCode: L }) : /* @__PURE__ */ new Set(), v = { search: "q", add: "a", delete: "d", edit: "m", view: "v" }, w = (n) => {
12
+ if (!n) return !1;
13
+ const s = String(n || "").trim();
14
+ if (!s) return !1;
15
+ if (s.includes(".") || s.includes("_")) return u.has(s);
16
+ const m = v[s] || "";
17
+ return l.has(s) || (m ? l.has(m) : !1);
26
18
  };
27
- return (d.size > 0 || f.size > 0) && (t = n.some((a) => {
28
- const i = String(a ?? "").trim();
29
- return i ? /^[0-9]{3,}$/.test(i) ? d.has(i) : x(i) : !1;
19
+ return (d.size > 0 || u.size > 0) && (t = o.some((n) => {
20
+ const s = String(n ?? "").trim();
21
+ return s ? /^[0-9]{3,}$/.test(s) ? d.has(s) : w(s) : !1;
30
22
  }), t) ? !0 : t;
31
- }, A = (s, e) => {
32
- e === "hide" ? s.classList.add("is-hide") : (s.setAttribute("disabled", ""), s.classList.add("is-disabled"));
33
- }, w = (s, e) => {
34
- e === "hide" ? s.classList.remove("is-hide") : (s.removeAttribute("disabled"), s.classList.remove("is-disabled"));
35
- }, p = (s, e) => {
36
- let t = (s ? e.value : e) || {};
23
+ }, S = (e, i) => {
24
+ i === "hide" ? e.classList.add("is-hide") : (e.setAttribute("disabled", ""), e.classList.add("is-disabled"));
25
+ }, C = (e, i) => {
26
+ i === "hide" ? e.classList.remove("is-hide") : (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
27
+ }, E = (e, i) => {
28
+ let t = (e ? i.value : i) || {};
37
29
  typeof t == "string" && (t = { code: t });
38
- const n = (t == null ? void 0 : t.type) ?? "hide", r = S(t);
39
- if (s)
40
- if (!e.oldValue)
41
- r || h(s, t).then((o) => {
42
- A(o, n);
30
+ const o = (t == null ? void 0 : t.type) ?? "hide", r = A(t);
31
+ if (e)
32
+ if (!i.oldValue)
33
+ r || h(e, t).then((a) => {
34
+ S(a, o);
43
35
  });
44
36
  else {
45
- const o = S(e.oldValue), c = r;
46
- if (o === c) return;
47
- h(s, t).then((d) => {
48
- c ? w(d, n) : A(d, n);
37
+ const a = A(i.oldValue), c = r;
38
+ if (a === c) return;
39
+ h(e, t).then((d) => {
40
+ c ? C(d, o) : S(d, o);
49
41
  });
50
42
  }
51
43
  return r;
52
44
  };
53
45
  export {
54
- p as vAuth
46
+ E as vAuth
55
47
  };
Binary file
package/esm-map.json CHANGED
@@ -155,5 +155,8 @@
155
155
  "getGroupedCurrentUserPermissionList": "/common-info/index",
156
156
  "getCurrentModulePermissionData": "/common-info/getPermissionMethod/index",
157
157
  "getCurrentUserPermissionsList": "/common-info/getPermissionMethod/index",
158
- "getCurrentUserMenuPermissionsList": "/common-info/getPermissionMethod/index"
158
+ "getCurrentUserMenuPermissionsList": "/common-info/getPermissionMethod/index",
159
+ "handleUnauthorized": "/create-api-service/index",
160
+ "getCurrentRouteCode": "/common-info/index",
161
+ "buildActionSuffixSet": "/common-info/index"
159
162
  }
@@ -1,201 +1,67 @@
1
1
  'use strict';
2
2
 
3
- function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
4
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
- function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
6
- function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
7
3
  function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
8
4
  function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
9
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
15
5
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
16
6
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
17
7
  var commonTools = require('@das-fed/upf-utils/common-tools/es5');
18
8
  var nextTiken = require('@das-fed/upf-utils/nextTiken/es5');
19
- var auth = require('@das-fed/upf-utils/directive/auth/es5');
20
- var modules = require('@das-fed/upf-utils/api-services/modules/es5');
21
- var B = modules.portal.get("/appcategory"),
22
- C = modules.superadminPortal.get("/appcategory"),
23
- L = modules.enterpriseright.get("/permissionset/user-portal-menu"),
24
- P = modules.superadminPortal.get("/user-menu"),
25
- v = function v() {
26
- var d = /*#__PURE__*/function () {
27
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(r) {
28
- var i,
29
- t,
30
- s,
31
- _yield$t,
32
- _yield$t2,
33
- u,
34
- l,
35
- f,
36
- _args = arguments;
37
- return _regenerator().w(function (_context) {
38
- while (1) switch (_context.n) {
39
- case 0:
40
- i = _args.length > 1 && _args[1] !== undefined ? _args[1] : "enterpriseadmin";
41
- t = null, s = {};
42
- _context.n = 1;
43
- return nextTiken.projectNextTick();
44
- case 1:
45
- i === "superadmin" ? t = C().run : (s = {
46
- userType: 1
47
- }, t = B().run);
48
- _context.n = 2;
49
- return t(s);
50
- case 2:
51
- _yield$t = _context.v;
52
- _yield$t2 = _slicedToArray(_yield$t, 2);
53
- u = _yield$t2[0];
54
- l = _yield$t2[1];
55
- if (!(u || !l || !l.length)) {
56
- _context.n = 3;
57
- break;
58
- }
59
- return _context.a(2, null);
60
- case 3:
61
- f = l.map(function (p) {
62
- return p.apps;
63
- }).flat();
64
- return _context.a(2, r ? f.find(function (p) {
65
- return p.code === r;
66
- }) : f);
67
- }
68
- }, _callee);
69
- }));
70
- return function d(_x) {
71
- return _ref.apply(this, arguments);
72
- };
73
- }(),
74
- g = /*#__PURE__*/function () {
75
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(r, i, t) {
76
- var s,
77
- c,
78
- u,
79
- l,
80
- _yield$u,
81
- _yield$u2,
82
- f,
83
- e,
84
- p,
85
- m,
86
- o,
87
- a,
88
- _ref3,
89
- n,
90
- _args2 = arguments;
91
- return _regenerator().w(function (_context2) {
92
- while (1) switch (_context2.n) {
93
- case 0:
94
- s = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : "enterpriseadmin";
95
- _context2.n = 1;
96
- return nextTiken.projectNextTick();
97
- case 1:
98
- u = null, l = {
99
- code: r,
100
- showBtn: true
101
- };
102
- s === "superadmin" ? u = P().run : (l.userType = 1, u = L().run);
9
+ var l = function l() {
10
+ return {
11
+ getApplication: function () {
12
+ var _getApplication = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(t) {
13
+ var i;
14
+ return _regenerator().w(function (_context) {
15
+ while (1) switch (_context.n) {
16
+ case 0:
17
+ _context.n = 1;
18
+ return nextTiken.projectNextTick();
19
+ case 1:
20
+ i = JSON.parse(sessionStorage.getItem("menuList") || "[]").filter(function (e) {
21
+ return e.type === "application";
22
+ });
23
+ return _context.a(2, t ? i.find(function (e) {
24
+ return e.appId === t;
25
+ }) : i);
26
+ }
27
+ }, _callee);
28
+ }));
29
+ function getApplication(_x) {
30
+ return _getApplication.apply(this, arguments);
31
+ }
32
+ return getApplication;
33
+ }(),
34
+ getMenu: function () {
35
+ var _getMenu = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(t, n) {
36
+ var i, e, a;
37
+ return _regenerator().w(function (_context2) {
38
+ while (1) switch (_context2.n) {
39
+ case 0:
40
+ _context2.n = 1;
41
+ return nextTiken.projectNextTick();
42
+ case 1:
43
+ i = JSON.parse(sessionStorage.getItem("menuList") || "[]"), e = commonTools.flatTree(i).filter(function (r) {
44
+ return r.type === "menu";
45
+ });
46
+ if (!(!t && !n)) {
103
47
  _context2.n = 2;
104
- return u(l);
105
- case 2:
106
- _yield$u = _context2.v;
107
- _yield$u2 = _slicedToArray(_yield$u, 2);
108
- f = _yield$u2[0];
109
- e = _yield$u2[1];
110
- if (!(f || !e || !e.length)) {
111
- _context2.n = 3;
112
- break;
113
- }
114
- return _context2.a(2, i || t ? undefined : []);
115
- case 3:
116
- if (!(!i && !t)) {
117
- _context2.n = 4;
118
- break;
119
- }
120
- return _context2.a(2, e);
121
- case 4:
122
- p = e != null && e.length ? e.filter(function (n) {
123
- return n.routeUrl;
124
- }) : [], m = e != null && e.length ? e.filter(function (n) {
125
- return !n.routeUrl && n.children;
126
- }).map(function (n) {
127
- return n.children;
128
- }).flat() : [], o = [].concat(_toConsumableArray(p), _toConsumableArray(m));
129
- if (i) a = o.find(function (n) {
130
- return n.code === i || n.originalCode === i;
131
- });else if (t) {
132
- n = t.replace((_ref3 = (c = o[0]) == null ? undefined : c.applicationPath) !== null && _ref3 !== void 0 ? _ref3 : "", "").replace(/\/\//g, "/");
133
- a = o.find(function (h) {
134
- return h.routeUrl && h.routeUrl === n;
135
- });
136
- }
137
- return _context2.a(2, a);
138
- }
139
- }, _callee2);
140
- }));
141
- return function g(_x2, _x3, _x4) {
142
- return _ref2.apply(this, arguments);
143
- };
144
- }();
145
- return {
146
- getApplication: d,
147
- getMenu: g,
148
- getAuth: function () {
149
- var _getAuth = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(r) {
150
- var _ref4, _ref5, _ref6;
151
- var i,
152
- o,
153
- t,
154
- s,
155
- u,
156
- e,
157
- _args3 = arguments;
158
- return _regenerator().w(function (_context3) {
159
- while (1) switch (_context3.n) {
160
- case 0:
161
- i = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : "enterpriseadmin";
162
- t = (_ref4 = r == null ? undefined : r.applicationCode) !== null && _ref4 !== void 0 ? _ref4 : "", s = (_ref5 = r == null ? undefined : r.menuCode) !== null && _ref5 !== void 0 ? _ref5 : "", u = (_ref6 = r == null ? undefined : r.code) !== null && _ref6 !== void 0 ? _ref6 : "";
163
- if (!JSON.parse(sessionStorage.getItem("permission-btn") || "{}")[s]) {
164
- _context3.n = 1;
165
- break;
166
- }
167
- return _context3.a(2, auth.vAuth(null, {
168
- applicationCode: t,
169
- menuCode: s,
170
- code: u
171
- }));
172
- case 1:
173
- _context3.n = 2;
174
- return d(t, i);
175
- case 2:
176
- if (_context3.v) {
177
- _context3.n = 3;
178
- break;
179
- }
180
- return _context3.a(2, false);
181
- case 3:
182
- _context3.n = 4;
183
- return g(t, s, i);
184
- case 4:
185
- e = _context3.v;
186
- return _context3.a(2, !e || !(e != null && e.children) || !((o = e.children) != null && o.length) ? false : !!commonTools.flatTree(e.children).find(function (a) {
187
- var _ref7;
188
- var c = (_ref7 = a == null ? undefined : a.originalCode) !== null && _ref7 !== void 0 ? _ref7 : a.code;
189
- return c.includes(s + ".") && (c = c.replace(s + ".", "").replaceAll(".", "-")), c === u;
190
- }));
191
- }
192
- }, _callee3);
193
- }));
194
- function getAuth(_x5) {
195
- return _getAuth.apply(this, arguments);
196
- }
197
- return getAuth;
198
- }()
199
- };
48
+ break;
49
+ }
50
+ return _context2.a(2, e);
51
+ case 2:
52
+ return _context2.a(2, (t ? a = e.find(function (r) {
53
+ return r.routeCode === t || r.originalCode === t;
54
+ }) : n && (a = e.find(function (r) {
55
+ return r.routeUrl === n;
56
+ })), a));
57
+ }
58
+ }, _callee2);
59
+ }));
60
+ function getMenu(_x2, _x3) {
61
+ return _getMenu.apply(this, arguments);
62
+ }
63
+ return getMenu;
64
+ }()
200
65
  };
201
- exports.useGetAuth = v;
66
+ };
67
+ exports.useGetAuth = l;
@@ -1,9 +1,4 @@
1
1
  export declare const useGetAuth: () => {
2
- getApplication: (code?: string, appName?: "superadmin" | "enterpriseadmin") => unknown;
3
- getMenu: (code: string, menuCode?: string, path?: string, appName?: "superadmin" | "enterpriseadmin") => unknown;
4
- getAuth: (options: {
5
- applicationCode: string;
6
- menuCode: string;
7
- code: string;
8
- }, appName?: "superadmin" | "enterpriseadmin") => unknown;
2
+ getApplication: (code?: string) => unknown;
3
+ getMenu: (menuCode?: string, path?: string) => unknown;
9
4
  };
@@ -1,53 +1,19 @@
1
- import { flatTree as w } from "@das-fed/upf-utils/common-tools";
2
- import { projectNextTick as A } from "@das-fed/upf-utils/nextTiken";
3
- import { vAuth as M } from "@das-fed/upf-utils/directive/auth";
4
- import { portal as T, superadminPortal as y, enterpriseright as U } from "@das-fed/upf-utils/api-services/modules";
5
- const B = T.get("/appcategory"), C = y.get("/appcategory"), L = U.get("/permissionset/user-portal-menu"), P = y.get("/user-menu"), v = () => {
6
- const d = async (r, i = "enterpriseadmin") => {
7
- let t = null, s = {};
8
- await A(), i === "superadmin" ? t = C().run : (s = { userType: 1 }, t = B().run);
9
- const [u, l] = await t(s);
10
- if (u || !l || !l.length) return null;
11
- const f = l.map((p) => p.apps).flat();
12
- return r ? f.find((p) => p.code === r) : f;
13
- }, g = async (r, i, t, s = "enterpriseadmin") => {
14
- var c;
15
- await A();
16
- let u = null, l = {
17
- code: r,
18
- showBtn: !0
19
- };
20
- s === "superadmin" ? u = P().run : (l.userType = 1, u = L().run);
21
- const [f, e] = await u(l);
22
- if (f || !e || !e.length)
23
- return i || t ? void 0 : [];
24
- if (!i && !t) return e;
25
- const p = e != null && e.length ? e.filter((n) => n.routeUrl) : [], m = e != null && e.length ? e.filter((n) => !n.routeUrl && n.children).map((n) => n.children).flat() : [], o = [...p, ...m];
1
+ import { flatTree as o } from "@das-fed/upf-utils/common-tools";
2
+ import { projectNextTick as s } from "@das-fed/upf-utils/nextTiken";
3
+ const l = () => ({
4
+ getApplication: async (t) => {
5
+ await s();
6
+ const i = JSON.parse(sessionStorage.getItem("menuList") || "[]").filter((e) => e.type === "application");
7
+ return t ? i.find((e) => e.appId === t) : i;
8
+ },
9
+ getMenu: async (t, n) => {
10
+ await s();
11
+ const i = JSON.parse(sessionStorage.getItem("menuList") || "[]"), e = o(i).filter((r) => r.type === "menu");
12
+ if (!t && !n) return e;
26
13
  let a;
27
- if (i)
28
- a = o.find((n) => n.code === i || n.originalCode === i);
29
- else if (t) {
30
- const n = t.replace(((c = o[0]) == null ? void 0 : c.applicationPath) ?? "", "").replace(/\/\//g, "/");
31
- a = o.find((h) => h.routeUrl && h.routeUrl === n);
32
- }
33
- return a;
34
- };
35
- return {
36
- getApplication: d,
37
- getMenu: g,
38
- getAuth: async (r, i = "enterpriseadmin") => {
39
- var o;
40
- const t = (r == null ? void 0 : r.applicationCode) ?? "", s = (r == null ? void 0 : r.menuCode) ?? "", u = (r == null ? void 0 : r.code) ?? "";
41
- if (JSON.parse(sessionStorage.getItem("permission-btn") || "{}")[s]) return M(null, { applicationCode: t, menuCode: s, code: u });
42
- if (!await d(t, i)) return !1;
43
- const e = await g(t, s, i);
44
- return !e || !(e != null && e.children) || !((o = e.children) != null && o.length) ? !1 : !!w(e.children).find((a) => {
45
- let c = (a == null ? void 0 : a.originalCode) ?? a.code;
46
- return c.includes(s + ".") && (c = c.replace(s + ".", "").replaceAll(".", "-")), c === u;
47
- });
48
- }
49
- };
50
- };
14
+ return t ? a = e.find((r) => r.routeCode === t || r.originalCode === t) : n && (a = e.find((r) => r.routeUrl === n)), a;
15
+ }
16
+ });
51
17
  export {
52
- v as useGetAuth
18
+ l as useGetAuth
53
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@das-fed/upf-utils",
3
- "version": "6.4.0-dev.227",
3
+ "version": "6.4.0-dev.229",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@babel/preset-env": "7.26.0",
24
- "@das-fed/upf-cli": "6.4.0-dev.227",
25
- "@das-fed/upf-web": "6.4.0-dev.227",
24
+ "@das-fed/upf-cli": "6.4.0-dev.229",
25
+ "@das-fed/upf-web": "6.4.0-dev.229",
26
26
  "@rollup/plugin-babel": "6.0.4",
27
27
  "@types/js-cookie": "^3.0.6",
28
28
  "@types/lodash-es": "^4.17.12",
@@ -1,4 +0,0 @@
1
- export declare const appcategory: any;
2
- export declare const superadminAppcategory: any;
3
- export declare const enterpriserightQueryportalmenu: any;
4
- export declare const superadminQuerymenu: any;
Binary file