@das-fed/upf-utils 6.4.0-dev.237 → 6.4.0-dev.239

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 (217) hide show
  1. package/api-services/es5.d.ts +2 -0
  2. package/api-services/es5.js +2176 -2106
  3. package/api-services/i18n/es5.d.ts +63 -0
  4. package/api-services/index.js +1654 -1602
  5. package/api-services/index.js.gz +0 -0
  6. package/api-services/modules/app-manage/es5.d.ts +2 -0
  7. package/api-services/modules/app-manage/es5.js +2305 -2223
  8. package/api-services/modules/app-manage/index.js +1900 -1830
  9. package/api-services/modules/app-manage/index.js.gz +0 -0
  10. package/api-services/modules/authentication/es5.d.ts +2 -0
  11. package/api-services/modules/authentication/es5.js +2373 -2279
  12. package/api-services/modules/authentication/index.js +1979 -1891
  13. package/api-services/modules/authentication/index.js.gz +0 -0
  14. package/api-services/modules/bems/es5.d.ts +6 -0
  15. package/api-services/modules/bems/es5.js +2190 -2120
  16. package/api-services/modules/bems/index.js +1812 -1760
  17. package/api-services/modules/bems/index.js.gz +0 -0
  18. package/api-services/modules/contract/es5.d.ts +2 -0
  19. package/api-services/modules/contract/es5.js +2305 -2223
  20. package/api-services/modules/contract/index.js +1900 -1830
  21. package/api-services/modules/contract/index.js.gz +0 -0
  22. package/api-services/modules/duty-manage/es5.d.ts +7 -0
  23. package/api-services/modules/duty-manage/es5.js +2190 -2120
  24. package/api-services/modules/duty-manage/index.js +1813 -1761
  25. package/api-services/modules/duty-manage/index.js.gz +0 -0
  26. package/api-services/modules/enterpriseright/es5.d.ts +2 -0
  27. package/api-services/modules/enterpriseright/es5.js +2305 -2223
  28. package/api-services/modules/enterpriseright/index.js +1900 -1830
  29. package/api-services/modules/enterpriseright/index.js.gz +0 -0
  30. package/api-services/modules/es5.d.ts +21 -0
  31. package/api-services/modules/es5.js +1846 -1764
  32. package/api-services/modules/file/es5.d.ts +37 -0
  33. package/api-services/modules/file/es5.js +1900 -1818
  34. package/api-services/modules/file/index.js +1469 -1399
  35. package/api-services/modules/file/index.js.gz +0 -0
  36. package/api-services/modules/gateway-edge/es5.d.ts +2 -0
  37. package/api-services/modules/gateway-edge/es5.js +2365 -2274
  38. package/api-services/modules/gateway-edge/index.js +1973 -1889
  39. package/api-services/modules/gateway-edge/index.js.gz +0 -0
  40. package/api-services/modules/index.js +1374 -1304
  41. package/api-services/modules/index.js.gz +0 -0
  42. package/api-services/modules/iot/es5.d.ts +16 -0
  43. package/api-services/modules/iot/es5.js +2160 -2078
  44. package/api-services/modules/iot/index.js +1765 -1695
  45. package/api-services/modules/iot/index.js.gz +0 -0
  46. package/api-services/modules/justauth/es5.d.ts +3 -0
  47. package/api-services/modules/justauth/es5.js +2370 -2279
  48. package/api-services/modules/justauth/index.js +1975 -1891
  49. package/api-services/modules/justauth/index.js.gz +0 -0
  50. package/api-services/modules/knowledge/es5.d.ts +2 -0
  51. package/api-services/modules/knowledge/es5.js +2303 -2223
  52. package/api-services/modules/knowledge/index.js +1898 -1832
  53. package/api-services/modules/knowledge/index.js.gz +0 -0
  54. package/api-services/modules/link/es5.d.ts +2 -0
  55. package/api-services/modules/link/es5.js +2373 -2279
  56. package/api-services/modules/link/index.js +1979 -1891
  57. package/api-services/modules/link/index.js.gz +0 -0
  58. package/api-services/modules/permission/es5.d.ts +2 -0
  59. package/api-services/modules/permission/es5.js +2386 -2316
  60. package/api-services/modules/permission/index.js +1979 -1927
  61. package/api-services/modules/permission/index.js.gz +0 -0
  62. package/api-services/modules/platformManage/es5.d.ts +14 -0
  63. package/api-services/modules/platformManage/es5.js +2323 -2241
  64. package/api-services/modules/platformManage/index.js +1911 -1841
  65. package/api-services/modules/platformManage/index.js.gz +0 -0
  66. package/api-services/modules/portal/es5.d.ts +2 -0
  67. package/api-services/modules/portal/es5.js +2189 -2119
  68. package/api-services/modules/portal/index.js +1812 -1760
  69. package/api-services/modules/portal/index.js.gz +0 -0
  70. package/api-services/modules/space-manage/es5.d.ts +2 -0
  71. package/api-services/modules/space-manage/es5.js +2189 -2119
  72. package/api-services/modules/space-manage/index.js +1812 -1760
  73. package/api-services/modules/space-manage/index.js.gz +0 -0
  74. package/api-services/modules/super-admin/es5.d.ts +8 -0
  75. package/api-services/modules/super-admin/es5.js +2276 -2191
  76. package/api-services/modules/super-admin/index.js +1875 -1801
  77. package/api-services/modules/super-admin/index.js.gz +0 -0
  78. package/api-services/modules/supplier/es5.d.ts +6 -0
  79. package/api-services/modules/supplier/es5.js +2407 -2334
  80. package/api-services/modules/supplier/index.js +1997 -1941
  81. package/api-services/modules/supplier/index.js.gz +0 -0
  82. package/api-services/modules/supplychain-manage/es5.d.ts +2 -0
  83. package/api-services/modules/supplychain-manage/es5.js +2305 -2223
  84. package/api-services/modules/supplychain-manage/index.js +1900 -1830
  85. package/api-services/modules/supplychain-manage/index.js.gz +0 -0
  86. package/api-services/modules/systemConfiguration/es5.d.ts +2 -0
  87. package/api-services/modules/systemConfiguration/es5.js +2398 -2326
  88. package/api-services/modules/systemConfiguration/index.js +1990 -1934
  89. package/api-services/modules/systemConfiguration/index.js.gz +0 -0
  90. package/api-services/modules/tool/es5.d.ts +2 -0
  91. package/api-services/modules/tool/es5.js +2403 -2330
  92. package/api-services/modules/tool/index.js +1994 -1938
  93. package/api-services/modules/tool/index.js.gz +0 -0
  94. package/api-services/src/create-service/es5.d.ts +1 -0
  95. package/api-services/src/create-service/es5.js +2101 -2019
  96. package/api-services/src/create-service/index.js +1718 -1648
  97. package/api-services/src/create-service/index.js.gz +0 -0
  98. package/atob/es5.d.ts +2 -0
  99. package/common-info/es5.d.ts +48 -0
  100. package/common-info/es5.js +2246 -2229
  101. package/common-info/getIframeUrl/es5.d.ts +9 -0
  102. package/common-info/getInfoFromUrl/es5.d.ts +8 -0
  103. package/common-info/getPermissionMethod/es5.d.ts +77 -0
  104. package/common-info/getPermissionMethod/es5.js +2187 -2107
  105. package/common-info/getPermissionMethod/index.d.ts +27 -9
  106. package/common-info/getPermissionMethod/index.js +1774 -1708
  107. package/common-info/getPermissionMethod/index.js.gz +0 -0
  108. package/common-info/index.d.ts +1 -29
  109. package/common-info/index.js +1811 -1792
  110. package/common-info/index.js.gz +0 -0
  111. package/common-info/set-personal-info/es5.d.ts +5 -0
  112. package/common-info/set-personal-info/es5.js +1073 -997
  113. package/common-info/set-personal-info/index.js +895 -827
  114. package/common-info/set-personal-info/index.js.gz +0 -0
  115. package/common-info/type.d.ts +2 -2
  116. package/common-tools/arr-tools/es5.d.ts +15 -0
  117. package/common-tools/calc-text-width/es5.d.ts +1 -0
  118. package/common-tools/date-format/es5.d.ts +7 -0
  119. package/common-tools/es5.d.ts +15 -0
  120. package/common-tools/es5.js +9 -0
  121. package/common-tools/extract-file-name/es5.d.ts +1 -0
  122. package/common-tools/extract-file-name/es5.js +1074 -998
  123. package/common-tools/extract-file-name/index.js +889 -821
  124. package/common-tools/extract-file-name/index.js.gz +0 -0
  125. package/common-tools/get-file-extension/es5.d.ts +6 -0
  126. package/common-tools/get-url-params/es5.d.ts +46 -0
  127. package/common-tools/handle-data/es5.d.ts +34 -0
  128. package/common-tools/handle-data/es5.js +45 -7
  129. package/common-tools/handle-data/index.d.ts +16 -1
  130. package/common-tools/handle-data/index.js +1 -1
  131. package/common-tools/handle-data/index.js.gz +0 -0
  132. package/common-tools/index.d.ts +1 -0
  133. package/common-tools/index.js +1 -0
  134. package/common-tools/nest-tree-format/es5.d.ts +30 -0
  135. package/common-tools/obj-tools/es5.d.ts +7 -0
  136. package/common-tools/platform-tools/es5.d.ts +19 -0
  137. package/common-tools/queue-promise/es5.d.ts +6 -0
  138. package/common-tools/setHtmlMinWH/es5.d.ts +5 -0
  139. package/common-tools/timezone-format/es5.d.ts +28 -0
  140. package/common-tools/timezone-format/es5.js +140 -0
  141. package/common-tools/timezone-format/index.d.ts +28 -0
  142. package/common-tools/timezone-format/index.js +81 -0
  143. package/common-tools/timezone-format/index.js.gz +0 -0
  144. package/common-tools/update-browser-title/es5.d.ts +1 -0
  145. package/common-tools/update-browser-title/es5.js +1 -1
  146. package/common-tools/update-fav-icon/es5.d.ts +11 -0
  147. package/common-tools/update-fav-icon/es5.js +1 -1
  148. package/config/es5.d.ts +2 -0
  149. package/create-api-service/access-token-auto-refresh/es5.d.ts +20 -0
  150. package/create-api-service/access-token-auto-refresh/es5.js +28 -27
  151. package/create-api-service/access-token-auto-refresh/index.js +27 -26
  152. package/create-api-service/access-token-auto-refresh/index.js.gz +0 -0
  153. package/create-api-service/check-token/es5.d.ts +12 -0
  154. package/create-api-service/check-token/es5.js +1 -1
  155. package/create-api-service/es5.d.ts +8 -0
  156. package/create-api-service/es5.js +2102 -2020
  157. package/create-api-service/i18n/es5.d.ts +39 -0
  158. package/create-api-service/index.js +1719 -1649
  159. package/create-api-service/index.js.gz +0 -0
  160. package/create-api-service/proxy-sso/es5.d.ts +3 -0
  161. package/create-api-service/sso/es5.d.ts +21 -0
  162. package/create-api-service/sso/es5.js +1242 -1166
  163. package/create-api-service/sso/index.js +1006 -938
  164. package/create-api-service/sso/index.js.gz +0 -0
  165. package/create-api-service/token-refresh-shared/es5.d.ts +30 -0
  166. package/create-api-service/token-refresh-shared/es5.js +1125 -1049
  167. package/create-api-service/token-refresh-shared/index.js +927 -859
  168. package/create-api-service/token-refresh-shared/index.js.gz +0 -0
  169. package/curring-http/es5.d.ts +12 -0
  170. package/curring-http/es5.js +1442 -1366
  171. package/curring-http/index.js +1132 -1064
  172. package/curring-http/index.js.gz +0 -0
  173. package/dimple-canvas/es5.d.ts +3 -0
  174. package/directive/auth/es5.d.ts +8 -0
  175. package/directive/clickOutside/es5.d.ts +6 -0
  176. package/directive/clickOutside/es5.js +1 -1
  177. package/directive/es5.d.ts +3 -0
  178. package/directive/hoverInside/es5.d.ts +6 -0
  179. package/directive/hoverInside/es5.js +1 -1
  180. package/directive/utils/es5.d.ts +7 -0
  181. package/directive/utils/es5.js +1 -1
  182. package/dom-check-in/es5.d.ts +6 -0
  183. package/dom-watcher/es5.d.ts +25 -0
  184. package/esm-map.json +32 -7
  185. package/hooks/popup-manager/use-zindex/es5.d.ts +3 -0
  186. package/i18n-bridge/es5.d.ts +10 -0
  187. package/index.d.ts +1 -0
  188. package/index.js +1 -0
  189. package/load-js/es5.d.ts +3 -0
  190. package/nextTiken/es5.d.ts +12 -0
  191. package/oss/es5.d.ts +2 -0
  192. package/package.json +4 -3
  193. package/pinyin-first-character/es5.d.ts +2 -0
  194. package/pinyin-first-character/es5.js +47 -45
  195. package/pinyin-first-character/index.js +37 -35
  196. package/pinyin-first-character/index.js.gz +0 -0
  197. package/process-engine-info/es5.d.ts +13 -0
  198. package/pure-image-src/es5.d.ts +2 -0
  199. package/size-watcher/es5.d.ts +6 -0
  200. package/style/es5.d.ts +2 -0
  201. package/style/es5.js +11 -11
  202. package/style/index.js +10 -10
  203. package/style/index.js.gz +0 -0
  204. package/theme/es5.d.ts +92 -0
  205. package/theme/es5.js +1365 -0
  206. package/theme/index.d.ts +92 -0
  207. package/theme/index.js +871 -0
  208. package/theme/index.js.gz +0 -0
  209. package/token-tools/es5.d.ts +21 -0
  210. package/use-low-code/es5.d.ts +1 -0
  211. package/vue/es5.d.ts +1 -0
  212. package/vue/hooks/use-model-value/es5.d.ts +9 -0
  213. package/webSocket-service/es5.d.ts +41 -0
  214. package/with-install/es5.d.ts +11 -0
  215. package/hooks/use-get-auth/es5.js +0 -67
  216. package/hooks/use-get-auth/index.d.ts +0 -4
  217. package/hooks/use-get-auth/index.js +0 -19
@@ -0,0 +1,2 @@
1
+ declare const getConfig: () => any;
2
+ export { getConfig };
@@ -0,0 +1,20 @@
1
+ import { RefreshDataType } from '@das-fed/upf-utils/create-api-service/token-refresh-shared';
2
+
3
+ export interface AccessTokenAutoRefreshOptions {
4
+ refreshScope?: string;
5
+ maxStartRetry?: number;
6
+ onTokenApplied?: (data: RefreshDataType) => void;
7
+ redirectToLogin?: () => void;
8
+ }
9
+ export declare const applyRefreshedToken: (data: RefreshDataType) => void;
10
+ export declare const configureAccessTokenAutoRefresh: (options?: AccessTokenAutoRefreshOptions) => void;
11
+ export declare const startAccessTokenAutoRefresh: () => boolean;
12
+ export declare const stopAccessTokenAutoRefresh: () => void;
13
+ export declare const getAccessTokenAutoRefreshState: () => {
14
+ started: boolean;
15
+ tokenReady: any;
16
+ accessTokenExpiredAt: any;
17
+ refreshTokenExpiredAt: any;
18
+ refreshScope: any;
19
+ };
20
+ export type { RefreshDataType };
@@ -2,7 +2,7 @@
2
2
 
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
4
  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 }; })(); }
5
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var _o = function _o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; _o("next", 0), _o("throw", 1), _o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
5
+ 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); }
6
6
  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); }
7
7
  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); }); }; }
8
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -33,20 +33,20 @@ var X = function X(e) {
33
33
  o = function o() {
34
34
  return c.refreshScope || tokenRefreshShared.DEFAULT_REFRESH_SCOPE;
35
35
  },
36
- S = function S() {
36
+ w = function w() {
37
37
  return X(tokenTools.getAccessTokenInfo("tokenInfo")) || {};
38
38
  },
39
39
  T = function T() {
40
40
  var e = tokenTools.getAccessTokenInfo("accessTokenExpiredAt"),
41
- r = S();
41
+ r = w();
42
42
  return tokenRefreshShared.toTimestamp((r == null ? undefined : r.accessExp) || (r == null ? undefined : r.accessTokenExpiredAt) || e);
43
43
  },
44
44
  m = function m() {
45
- var e = S();
45
+ var e = w();
46
46
  return String((e == null ? undefined : e.refreshToken) || tokenTools.getAccessTokenInfo("refreshToken") || "").trim();
47
47
  },
48
48
  C = function C() {
49
- var e = S();
49
+ var e = w();
50
50
  return tokenRefreshShared.toTimestamp(e == null ? undefined : e.refreshExp);
51
51
  },
52
52
  E = function E() {
@@ -68,21 +68,22 @@ var X = function X(e) {
68
68
  p && (clearTimeout(p), p = null), l && (clearTimeout(l), l = null), R && (clearTimeout(R), R = null);
69
69
  },
70
70
  j = function j() {
71
- var e;
72
71
  try {
73
- var r = "/login";
74
- if (location.pathname === r) return;
75
- if (window.sessionStorage.clear(), window.localStorage.clear(), window.__isAutoCloseApp = !1, (e = window.top) != null && e.vueRouter) {
76
- window.top.vueRouter.replace(r);
72
+ var e = "/login";
73
+ if (location.pathname === e) return;
74
+ window.sessionStorage.clear(), window.localStorage.clear(), window.__isAutoCloseApp = !1;
75
+ var r = window.top;
76
+ if (r != null && r.vueRouter) {
77
+ r.vueRouter.replace(e);
77
78
  return;
78
79
  }
79
- window.location.replace("/#".concat(r));
80
+ window.location.replace("/#".concat(e));
80
81
  } catch (_unused2) {
81
82
  window.location.replace("/#/login");
82
83
  }
83
84
  },
84
85
  a = function a() {
85
- w(), (c.redirectToLogin || j)();
86
+ S(), (c.redirectToLogin || j)();
86
87
  },
87
88
  G = function G() {
88
89
  var e = T();
@@ -106,7 +107,7 @@ var X = function X(e) {
106
107
  var k = r - t;
107
108
  return k > 0 ? k : 0;
108
109
  },
109
- W = function W(e) {
110
+ $ = function $(e) {
110
111
  var f;
111
112
  var r = String((e == null ? undefined : e.accessToken) || "").trim(),
112
113
  s = String((e == null ? undefined : e.refreshToken) || "").trim() || m(),
@@ -117,7 +118,7 @@ var X = function X(e) {
117
118
  refreshToken: s
118
119
  });
119
120
  try {
120
- var t = S(),
121
+ var t = w(),
121
122
  k = _objectSpread(_objectSpread(_objectSpread({}, t), e), {}, {
122
123
  accessToken: r,
123
124
  refreshToken: s || (t == null ? void 0 : t.refreshToken) || "",
@@ -149,7 +150,7 @@ var X = function X(e) {
149
150
  _context.n = 2;
150
151
  break;
151
152
  }
152
- w();
153
+ S();
153
154
  return _context.a(2);
154
155
  case 2:
155
156
  e = m();
@@ -193,7 +194,7 @@ var X = function X(e) {
193
194
  refreshExp: (s == null ? void 0 : s.refreshExp) || C(),
194
195
  accessTokenExpiredAt: tokenRefreshShared.toTimestamp((s == null ? void 0 : s.accessTokenExpiredAt) || (s == null ? void 0 : s.accessExp))
195
196
  });
196
- n != null && n.accessToken && n != null && n.accessExp && W(n), tokenRefreshShared.resolveRefreshResult(n, o()), y();
197
+ n != null && n.accessToken && n != null && n.accessExp && $(n), tokenRefreshShared.resolveRefreshResult(n, o()), y();
197
198
  _context.n = 11;
198
199
  break;
199
200
  case 9:
@@ -206,7 +207,7 @@ var X = function X(e) {
206
207
  a();
207
208
  return _context.a(2);
208
209
  case 10:
209
- w();
210
+ S();
210
211
  case 11:
211
212
  return _context.a(2);
212
213
  }
@@ -226,7 +227,7 @@ var X = function X(e) {
226
227
  _context2.n = 1;
227
228
  break;
228
229
  }
229
- w();
230
+ S();
230
231
  return _context2.a(2);
231
232
  case 1:
232
233
  e = tokenRefreshShared.getRefreshPrecheckResult(E());
@@ -279,7 +280,7 @@ var X = function X(e) {
279
280
  p = null, F();
280
281
  }, e)), _O();
281
282
  },
282
- z = function z() {
283
+ Q = function Q() {
283
284
  var _ref4, _e$maxStartRetry;
284
285
  var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
285
286
  c = _objectSpread(_objectSpread(_objectSpread({}, c), e), {}, {
@@ -287,7 +288,7 @@ var X = function X(e) {
287
288
  maxStartRetry: (_ref4 = (_e$maxStartRetry = e.maxStartRetry) !== null && _e$maxStartRetry !== void 0 ? _e$maxStartRetry : c.maxStartRetry) !== null && _ref4 !== void 0 ? _ref4 : I
288
289
  });
289
290
  },
290
- Q = function Q() {
291
+ V = function V() {
291
292
  if (i) return true;
292
293
  var e = function e() {
293
294
  return h() ? (i = true, u = 0, H(), y(), true) : false;
@@ -306,10 +307,10 @@ var X = function X(e) {
306
307
  };
307
308
  return _r(), false;
308
309
  },
309
- w = function w() {
310
+ S = function S() {
310
311
  i = false, N(), tokenRefreshShared.clearRefreshState(o()), u = 0;
311
312
  },
312
- V = function V() {
313
+ W = function W() {
313
314
  return {
314
315
  started: i,
315
316
  tokenReady: h(),
@@ -318,8 +319,8 @@ var X = function X(e) {
318
319
  refreshScope: o()
319
320
  };
320
321
  };
321
- exports.applyRefreshedToken = W;
322
- exports.configureAccessTokenAutoRefresh = z;
323
- exports.getAccessTokenAutoRefreshState = V;
324
- exports.startAccessTokenAutoRefresh = Q;
325
- exports.stopAccessTokenAutoRefresh = w;
322
+ exports.applyRefreshedToken = $;
323
+ exports.configureAccessTokenAutoRefresh = Q;
324
+ exports.getAccessTokenAutoRefreshState = W;
325
+ exports.startAccessTokenAutoRefresh = V;
326
+ exports.stopAccessTokenAutoRefresh = S;
@@ -12,14 +12,14 @@ const X = (e) => {
12
12
  } catch {
13
13
  return null;
14
14
  }
15
- }, o = () => c.refreshScope || d, S = () => X(_("tokenInfo")) || {}, T = () => {
16
- const e = _("accessTokenExpiredAt"), r = S();
15
+ }, o = () => c.refreshScope || d, w = () => X(_("tokenInfo")) || {}, T = () => {
16
+ const e = _("accessTokenExpiredAt"), r = w();
17
17
  return x((r == null ? void 0 : r.accessExp) || (r == null ? void 0 : r.accessTokenExpiredAt) || e);
18
18
  }, m = () => {
19
- const e = S();
19
+ const e = w();
20
20
  return String((e == null ? void 0 : e.refreshToken) || _("refreshToken") || "").trim();
21
21
  }, C = () => {
22
- const e = S();
22
+ const e = w();
23
23
  return x(e == null ? void 0 : e.refreshExp);
24
24
  }, E = () => ({
25
25
  accessToken: M(),
@@ -33,20 +33,21 @@ const X = (e) => {
33
33
  }, N = () => {
34
34
  p && (clearTimeout(p), p = null), l && (clearTimeout(l), l = null), R && (clearTimeout(R), R = null);
35
35
  }, j = () => {
36
- var e;
37
36
  try {
38
- const r = "/login";
39
- if (location.pathname === r) return;
40
- if (window.sessionStorage.clear(), window.localStorage.clear(), window.__isAutoCloseApp = !1, (e = window.top) != null && e.vueRouter) {
41
- window.top.vueRouter.replace(r);
37
+ const e = "/login";
38
+ if (location.pathname === e) return;
39
+ window.sessionStorage.clear(), window.localStorage.clear(), window.__isAutoCloseApp = !1;
40
+ const r = window.top;
41
+ if (r != null && r.vueRouter) {
42
+ r.vueRouter.replace(e);
42
43
  return;
43
44
  }
44
- window.location.replace(`/#${r}`);
45
+ window.location.replace(`/#${e}`);
45
46
  } catch {
46
47
  window.location.replace("/#/login");
47
48
  }
48
49
  }, a = () => {
49
- w(), (c.redirectToLogin || j)();
50
+ S(), (c.redirectToLogin || j)();
50
51
  }, G = () => {
51
52
  const e = T();
52
53
  if (!e) return 60 * 1e3;
@@ -62,13 +63,13 @@ const X = (e) => {
62
63
  r <= s ? t = 30 * 1e3 : r <= n ? t = 60 * 1e3 : r <= f ? t = 5 * 60 * 1e3 : t = 10 * 60 * 1e3;
63
64
  const k = r - t;
64
65
  return k > 0 ? k : 0;
65
- }, W = (e) => {
66
+ }, $ = (e) => {
66
67
  var f;
67
68
  const r = String((e == null ? void 0 : e.accessToken) || "").trim(), s = String((e == null ? void 0 : e.refreshToken) || "").trim() || m(), n = x((e == null ? void 0 : e.accessExp) || (e == null ? void 0 : e.accessTokenExpiredAt));
68
69
  if (!(!r || !n)) {
69
70
  P(r, { accessTokenExpiredAt: n, refreshToken: s });
70
71
  try {
71
- const t = S(), k = {
72
+ const t = w(), k = {
72
73
  ...t,
73
74
  ...e,
74
75
  accessToken: r,
@@ -86,7 +87,7 @@ const X = (e) => {
86
87
  }, F = async () => {
87
88
  if (!i) return;
88
89
  if (!h()) {
89
- w();
90
+ S();
90
91
  return;
91
92
  }
92
93
  const e = m();
@@ -111,17 +112,17 @@ const X = (e) => {
111
112
  refreshExp: (s == null ? void 0 : s.refreshExp) || C(),
112
113
  accessTokenExpiredAt: x((s == null ? void 0 : s.accessTokenExpiredAt) || (s == null ? void 0 : s.accessExp))
113
114
  };
114
- n != null && n.accessToken && (n != null && n.accessExp) && W(n), B(n, o()), y();
115
+ n != null && n.accessToken && (n != null && n.accessExp) && $(n), B(n, o()), y();
115
116
  } catch (s) {
116
117
  if (g(s, o()), A(E()) === "refresh_expired") {
117
118
  a();
118
119
  return;
119
120
  }
120
- w();
121
+ S();
121
122
  }
122
123
  }, H = async () => {
123
124
  if (!h()) {
124
- w();
125
+ S();
125
126
  return;
126
127
  }
127
128
  const e = A(E());
@@ -142,14 +143,14 @@ const X = (e) => {
142
143
  e > 0 && r === "access_valid" && (p = window.setTimeout(() => {
143
144
  p = null, F();
144
145
  }, e)), O();
145
- }, z = (e = {}) => {
146
+ }, Q = (e = {}) => {
146
147
  c = {
147
148
  ...c,
148
149
  ...e,
149
150
  refreshScope: e.refreshScope || c.refreshScope || d,
150
151
  maxStartRetry: e.maxStartRetry ?? c.maxStartRetry ?? I
151
152
  };
152
- }, Q = () => {
153
+ }, V = () => {
153
154
  if (i) return !0;
154
155
  const e = () => h() ? (i = !0, u = 0, H(), y(), !0) : !1;
155
156
  if (e()) return !0;
@@ -164,9 +165,9 @@ const X = (e) => {
164
165
  }, 500));
165
166
  };
166
167
  return r(), !1;
167
- }, w = () => {
168
+ }, S = () => {
168
169
  i = !1, N(), J(o()), u = 0;
169
- }, V = () => ({
170
+ }, W = () => ({
170
171
  started: i,
171
172
  tokenReady: h(),
172
173
  accessTokenExpiredAt: T(),
@@ -174,9 +175,9 @@ const X = (e) => {
174
175
  refreshScope: o()
175
176
  });
176
177
  export {
177
- W as applyRefreshedToken,
178
- z as configureAccessTokenAutoRefresh,
179
- V as getAccessTokenAutoRefreshState,
180
- Q as startAccessTokenAutoRefresh,
181
- w as stopAccessTokenAutoRefresh
178
+ $ as applyRefreshedToken,
179
+ Q as configureAccessTokenAutoRefresh,
180
+ W as getAccessTokenAutoRefreshState,
181
+ V as startAccessTokenAutoRefresh,
182
+ S as stopAccessTokenAutoRefresh
182
183
  };
@@ -0,0 +1,12 @@
1
+ import { RefreshDataType } from '@das-fed/upf-utils/create-api-service/token-refresh-shared';
2
+
3
+ /**
4
+ * 检查并获取有效的 Access Token(带缓冲、防并发和重试机制)
5
+ * @param tokenData 当前 token 数据
6
+ * @param updateTokenCallback 更新 token 的回调函数
7
+ * @param retryCount 内部重试计数器(外部调用无需传递)
8
+ * @returns 有效的 access_token
9
+ */
10
+ declare const getValidAccessToken: (tokenData: RefreshDataType, updateTokenCallback: (newToken: RefreshDataType) => void, retryCount?: number) => Promise<string>;
11
+ export { getValidAccessToken };
12
+ export type { RefreshDataType };
@@ -2,7 +2,7 @@
2
2
 
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
4
  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 }; })(); }
5
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
5
+ 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); }
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -0,0 +1,8 @@
1
+ import { CurringConfigFun } from '../curring-http/type';
2
+
3
+ /**
4
+ * 处理401未授权情况
5
+ * @returns 是否执行了登录操作
6
+ */
7
+ export declare const handleUnauthorized: () => boolean;
8
+ export declare function createService(urlPrefix: string, customConfig?: CurringConfigFun): any;