@das-fed/upf-utils 6.4.0-dev.238 → 6.4.0-dev.240

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 (190) hide show
  1. package/api-services/es5.d.ts +2 -0
  2. package/api-services/es5.js +1360 -1345
  3. package/api-services/i18n/es5.d.ts +63 -0
  4. package/api-services/index.js +1076 -1060
  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 +25 -19
  8. package/api-services/modules/app-manage/index.js +17 -15
  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 +1100 -1082
  12. package/api-services/modules/authentication/index.js +911 -891
  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 +96 -90
  16. package/api-services/modules/bems/index.js +75 -73
  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 +25 -19
  20. package/api-services/modules/contract/index.js +17 -15
  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 +23 -17
  24. package/api-services/modules/duty-manage/index.js +16 -14
  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 +829 -826
  28. package/api-services/modules/enterpriseright/index.js +651 -653
  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 +1353 -1356
  32. package/api-services/modules/file/es5.d.ts +37 -0
  33. package/api-services/modules/file/es5.js +1226 -1232
  34. package/api-services/modules/file/index.js +993 -1009
  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 +1343 -1325
  38. package/api-services/modules/gateway-edge/index.js +1140 -1120
  39. package/api-services/modules/gateway-edge/index.js.gz +0 -0
  40. package/api-services/modules/index.js +1062 -1074
  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 +33 -27
  44. package/api-services/modules/iot/index.js +23 -21
  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 +1345 -1351
  48. package/api-services/modules/justauth/index.js +1127 -1143
  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 +1343 -1325
  52. package/api-services/modules/knowledge/index.js +1140 -1120
  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 +25 -19
  56. package/api-services/modules/link/index.js +17 -15
  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 +1100 -1106
  60. package/api-services/modules/permission/index.js +897 -913
  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 +1350 -1356
  64. package/api-services/modules/platformManage/index.js +1131 -1147
  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 +1343 -1349
  68. package/api-services/modules/portal/index.js +1126 -1142
  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 +1343 -1349
  72. package/api-services/modules/space-manage/index.js +1126 -1142
  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 +1104 -1110
  76. package/api-services/modules/super-admin/index.js +899 -915
  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 +1104 -1110
  80. package/api-services/modules/supplier/index.js +899 -915
  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 +1343 -1325
  84. package/api-services/modules/supplychain-manage/index.js +1140 -1120
  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 +25 -19
  88. package/api-services/modules/systemConfiguration/index.js +17 -15
  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 +845 -836
  92. package/api-services/modules/tool/index.js +660 -654
  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 +99 -93
  96. package/api-services/src/create-service/index.js +78 -76
  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 +915 -965
  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 +1371 -1355
  105. package/common-info/getPermissionMethod/index.d.ts +27 -9
  106. package/common-info/getPermissionMethod/index.js +1141 -1125
  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 +725 -757
  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/type.d.ts +2 -2
  113. package/common-tools/arr-tools/es5.d.ts +15 -0
  114. package/common-tools/calc-text-width/es5.d.ts +1 -0
  115. package/common-tools/date-format/es5.d.ts +7 -0
  116. package/common-tools/es5.d.ts +15 -0
  117. package/common-tools/es5.js +9 -0
  118. package/common-tools/extract-file-name/es5.d.ts +1 -0
  119. package/common-tools/get-file-extension/es5.d.ts +6 -0
  120. package/common-tools/get-url-params/es5.d.ts +46 -0
  121. package/common-tools/handle-data/es5.d.ts +34 -0
  122. package/common-tools/handle-data/es5.js +44 -6
  123. package/common-tools/handle-data/index.d.ts +16 -1
  124. package/common-tools/handle-data/index.js +1 -1
  125. package/common-tools/handle-data/index.js.gz +0 -0
  126. package/common-tools/index.d.ts +1 -0
  127. package/common-tools/index.js +1 -0
  128. package/common-tools/nest-tree-format/es5.d.ts +30 -0
  129. package/common-tools/obj-tools/es5.d.ts +7 -0
  130. package/common-tools/platform-tools/es5.d.ts +19 -0
  131. package/common-tools/queue-promise/es5.d.ts +6 -0
  132. package/common-tools/setHtmlMinWH/es5.d.ts +5 -0
  133. package/common-tools/timezone-format/es5.d.ts +28 -0
  134. package/common-tools/timezone-format/es5.js +140 -0
  135. package/common-tools/timezone-format/index.d.ts +28 -0
  136. package/common-tools/timezone-format/index.js +81 -0
  137. package/common-tools/timezone-format/index.js.gz +0 -0
  138. package/common-tools/update-browser-title/es5.d.ts +1 -0
  139. package/common-tools/update-fav-icon/es5.d.ts +11 -0
  140. package/config/es5.d.ts +2 -0
  141. package/create-api-service/access-token-auto-refresh/es5.d.ts +20 -0
  142. package/create-api-service/access-token-auto-refresh/es5.js +27 -26
  143. package/create-api-service/access-token-auto-refresh/index.js +27 -26
  144. package/create-api-service/access-token-auto-refresh/index.js.gz +0 -0
  145. package/create-api-service/check-token/es5.d.ts +12 -0
  146. package/create-api-service/es5.d.ts +8 -0
  147. package/create-api-service/es5.js +24 -18
  148. package/create-api-service/i18n/es5.d.ts +39 -0
  149. package/create-api-service/index.js +17 -15
  150. package/create-api-service/index.js.gz +0 -0
  151. package/create-api-service/proxy-sso/es5.d.ts +3 -0
  152. package/create-api-service/sso/es5.d.ts +21 -0
  153. package/create-api-service/token-refresh-shared/es5.d.ts +30 -0
  154. package/curring-http/es5.d.ts +12 -0
  155. package/dimple-canvas/es5.d.ts +3 -0
  156. package/directive/auth/es5.d.ts +8 -0
  157. package/directive/clickOutside/es5.d.ts +6 -0
  158. package/directive/es5.d.ts +3 -0
  159. package/directive/hoverInside/es5.d.ts +6 -0
  160. package/directive/utils/es5.d.ts +7 -0
  161. package/dom-check-in/es5.d.ts +6 -0
  162. package/dom-watcher/es5.d.ts +25 -0
  163. package/esm-map.json +32 -7
  164. package/hooks/popup-manager/use-zindex/es5.d.ts +3 -0
  165. package/i18n-bridge/es5.d.ts +10 -0
  166. package/index.d.ts +1 -0
  167. package/index.js +1 -0
  168. package/load-js/es5.d.ts +3 -0
  169. package/nextTiken/es5.d.ts +12 -0
  170. package/oss/es5.d.ts +2 -0
  171. package/package.json +4 -3
  172. package/pinyin-first-character/es5.d.ts +2 -0
  173. package/process-engine-info/es5.d.ts +13 -0
  174. package/pure-image-src/es5.d.ts +2 -0
  175. package/size-watcher/es5.d.ts +6 -0
  176. package/style/es5.d.ts +2 -0
  177. package/theme/es5.d.ts +92 -0
  178. package/theme/es5.js +1365 -0
  179. package/theme/index.d.ts +92 -0
  180. package/theme/index.js +871 -0
  181. package/theme/index.js.gz +0 -0
  182. package/token-tools/es5.d.ts +21 -0
  183. package/use-low-code/es5.d.ts +1 -0
  184. package/vue/es5.d.ts +1 -0
  185. package/vue/hooks/use-model-value/es5.d.ts +9 -0
  186. package/webSocket-service/es5.d.ts +41 -0
  187. package/with-install/es5.d.ts +11 -0
  188. package/hooks/use-get-auth/es5.js +0 -67
  189. package/hooks/use-get-auth/index.d.ts +0 -4
  190. package/hooks/use-get-auth/index.js +0 -19
@@ -0,0 +1,81 @@
1
+ import l from "dayjs";
2
+ import T from "dayjs/plugin/utc";
3
+ import w from "dayjs/plugin/timezone";
4
+ l.extend(T);
5
+ l.extend(w);
6
+ const f = "zh-CN", y = "YYYY.MM.DD HH:mm:ss", D = "UTC", m = {
7
+ zh: "夏令时",
8
+ default: "DST"
9
+ }, u = () => l.tz.guess() || D, v = () => {
10
+ var t;
11
+ return typeof window < "u" && ((t = window.navigator) != null && t.language) ? window.navigator.language : f;
12
+ }, S = (t, e = []) => {
13
+ const n = t || v() || f, r = n.toLowerCase();
14
+ if (!e.length)
15
+ return r === "en" ? "en-US" : r === "zh" || r === "zh-cn" ? f : n;
16
+ const a = e.find((i) => i.toLowerCase() === r);
17
+ if (a) return a;
18
+ const c = r.split("-")[0], s = e.find((i) => i.toLowerCase().split("-")[0] === c);
19
+ return s || (c === "en" ? e.find((i) => i.toLowerCase().startsWith("en-")) || n : c === "zh" ? e.find((i) => i.toLowerCase().startsWith("zh-")) || f : n);
20
+ }, g = (t) => {
21
+ if (l.isDayjs(t)) return t;
22
+ if (t == null || t === "") return l();
23
+ const e = l(t);
24
+ return e.isValid() ? e : l();
25
+ }, h = (t) => {
26
+ if (!t) return u();
27
+ try {
28
+ return new Intl.DateTimeFormat(void 0, { timeZone: t }), t;
29
+ } catch {
30
+ return u();
31
+ }
32
+ }, L = (t) => `UTC${t}`, z = (t, e) => {
33
+ const o = t.match(/([+-]\d{1,2})(?::?(\d{2}))?/) || [];
34
+ if (!o[1]) return e;
35
+ const n = o[1].startsWith("-") ? "-" : "+", r = o[1].replace(/[+-]/, "").padStart(2, "0"), a = o[2] || "00";
36
+ return `UTC${n}${r}:${a}`;
37
+ }, C = (t, e, o) => {
38
+ var r, a;
39
+ const n = L(o.format("Z"));
40
+ try {
41
+ const c = Intl.DateTimeFormat.supportedLocalesOf([e])[0] || e, s = (a = (r = new Intl.DateTimeFormat(c, { timeZone: t, timeZoneName: "long" }).formatToParts(o.toDate()).find((i) => i.type === "timeZoneName")) == null ? void 0 : r.value) == null ? void 0 : a.trim();
42
+ return s ? /^(gmt|utc)/i.test(s) ? z(s, n) : s : n;
43
+ } catch {
44
+ return n;
45
+ }
46
+ }, Z = (t, e) => {
47
+ const o = e.year();
48
+ return Array.from(
49
+ new Set(
50
+ Array.from({ length: 12 }, (n, r) => {
51
+ const a = `${r + 1}`.padStart(2, "0");
52
+ return l.tz(`${o}-${a}-15 12:00:00`, t).utcOffset();
53
+ })
54
+ )
55
+ );
56
+ }, b = (t, e) => {
57
+ const o = h(t), n = g(e).tz(o), r = Z(o, n);
58
+ return r.length <= 1 ? !1 : n.utcOffset() > Math.min(...r);
59
+ }, A = (t) => {
60
+ const e = t.toLowerCase().split("-")[0];
61
+ return m[e] || m.default;
62
+ }, O = (t) => typeof t.showDaylightSavingLabel == "boolean" ? t.showDaylightSavingLabel : t.showDaylightSavingMarker ?? !0, U = (t = {}) => {
63
+ const e = S(t.locale, t.supportedLocales), o = h(t.timeZone), n = g(t.value).tz(o), r = C(o, e, n), a = L(n.format("Z")), c = b(o, n), s = c ? A(e) : "", i = O(t), d = c && i ? `${r} - ${s}` : r;
64
+ return {
65
+ formattedValue: n.format(t.format || y),
66
+ locale: e,
67
+ timeZone: o,
68
+ timeZoneName: r,
69
+ timeZoneLabel: d,
70
+ offsetLabel: a,
71
+ offsetMinutes: n.utcOffset(),
72
+ isDaylightSavingTime: c,
73
+ daylightSavingLabel: s
74
+ };
75
+ };
76
+ export {
77
+ u as getClientTimeZone,
78
+ U as getTimeZoneDisplayInfo,
79
+ b as isDaylightSavingTime,
80
+ S as normalizeLocaleCode
81
+ };
@@ -0,0 +1 @@
1
+ export declare const setBrowseTitle: (defaultTitle?: string) => any;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 设置平台的favIcon
3
+ * @param favIcon 图标
4
+ * @param defaultIcon 默认图标
5
+ */
6
+ export declare const updateFavIcon: (favIcon: string, defaultIcon?: string) => void;
7
+ /**
8
+ * 设置平台的favIcon,如果localStorage中没有则调用接口获取
9
+ * @param defaultIcon 默认图标
10
+ */
11
+ export declare const setDasHtmlIcon: (defaultIcon?: string) => any;
@@ -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 };
@@ -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 };
@@ -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;
@@ -3797,13 +3797,17 @@ var jr = Bt(Bl, {
3797
3797
  });
3798
3798
  Mt.extend(eo);
3799
3799
  Mt.extend(to);
3800
- var Xt = config.getConfig(),
3800
+ var Ml = "UTC",
3801
+ kl = function kl() {
3802
+ return Mt.tz.guess() || Ml;
3803
+ },
3804
+ Xt = config.getConfig(),
3801
3805
  zn = (_Xt$sso = Xt.sso) !== null && _Xt$sso !== void 0 ? _Xt$sso : true,
3802
3806
  Hr = (_Xt$i18n = Xt.i18n) !== null && _Xt$i18n !== void 0 ? _Xt$i18n : true,
3803
3807
  Wn = (_Xt$noRedireLogin = Xt.noRedireLogin) !== null && _Xt$noRedireLogin !== void 0 ? _Xt$noRedireLogin : false;
3804
3808
  var zr = "",
3805
3809
  Wr = 0;
3806
- var Ml = 1e3,
3810
+ var ql = 1e3,
3807
3811
  Gr = /*#__PURE__*/function () {
3808
3812
  var _ref22 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(t, e) {
3809
3813
  var r,
@@ -3846,24 +3850,26 @@ var Ml = 1e3,
3846
3850
  };
3847
3851
  }();
3848
3852
  var Tt = false;
3849
- var kl = 5e3,
3853
+ var jl = 5e3,
3850
3854
  Gn = function Gn() {
3851
3855
  return Tt ? false : (Tt = true, setTimeout(function () {
3852
3856
  Tt = false;
3853
- }, kl), true);
3857
+ }, jl), true);
3854
3858
  },
3855
3859
  Jn = function Jn() {
3856
- var e, r;
3857
3860
  if (Wn) return;
3858
3861
  var t = "/login";
3859
- location.pathname !== t && (window.sessionStorage.clear(), window.localStorage.clear(), window.__isAutoCloseApp = false, (e = window.top) != null && e.vueRouter ? (r = window.top) == null || r.vueRouter.replace(t) : window.location.replace("/#".concat(t)));
3862
+ if (location.pathname === t) return;
3863
+ window.sessionStorage.clear(), window.localStorage.clear(), window.__isAutoCloseApp = false;
3864
+ var e = window.top;
3865
+ e != null && e.vueRouter ? e.vueRouter.replace(t) : window.location.replace("/#".concat(t));
3860
3866
  },
3861
- ql = function ql() {
3867
+ Hl = function Hl() {
3862
3868
  return sso.getQuery("code") || "" || Wn ? false : Gn() ? (zn ? sso.login(_objectSpread(_objectSpread({}, sso.getTokenParams), {}, {
3863
3869
  redirect_uri: sso.real_uri
3864
3870
  })) : Jn(), true) : false;
3865
3871
  },
3866
- jl = /*#__PURE__*/function () {
3872
+ zl = /*#__PURE__*/function () {
3867
3873
  var _ref23 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(t) {
3868
3874
  var _t$data;
3869
3875
  var r;
@@ -3874,11 +3880,11 @@ var kl = 5e3,
3874
3880
  }
3875
3881
  }, _callee0);
3876
3882
  }));
3877
- return function jl(_x11) {
3883
+ return function zl(_x11) {
3878
3884
  return _ref23.apply(this, arguments);
3879
3885
  };
3880
3886
  }(),
3881
- Hl = /*#__PURE__*/function () {
3887
+ Wl = /*#__PURE__*/function () {
3882
3888
  var _ref24 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(t, e) {
3883
3889
  var d, m, h, S, _i18nBridge$getI18nBr, r, n, o, a, i, s, c, u, _ref25, O, g, E, _ref26, _ref27, _O, _g, _E, p, y, v, _t11, _t12, _t13;
3884
3890
  return _regenerator().w(function (_context10) {
@@ -3897,7 +3903,7 @@ var kl = 5e3,
3897
3903
  _context10.n = 6;
3898
3904
  break;
3899
3905
  }
3900
- ql(), n = c || u, a = s;
3906
+ Hl(), n = c || u, a = s;
3901
3907
  O = (_ref25 = e == null ? undefined : e.i18n) !== null && _ref25 !== void 0 ? _ref25 : true;
3902
3908
  if (!(Hr && O && s != null && s.status)) {
3903
3909
  _context10.n = 4;
@@ -3994,7 +4000,7 @@ var kl = 5e3,
3994
4000
  t.request ? (n = 500, t.code === "ERR_CANCELED" ? o = t.abortReason || "" : o = r("网络异常,请检查您的网络情况")) : (n = 500, t.code === "ERR_CANCELED" ? o = t.abortReason || "" : o = r("请求配置异常"));
3995
4001
  case 17:
3996
4002
  e != null && e.customErrorMessage && (o = e == null ? undefined : e.customErrorMessage(o, t));
3997
- p = Date.now(), y = o === zr, v = p - Wr < Ml;
4003
+ p = Date.now(), y = o === zr, v = p - Wr < ql;
3998
4004
  return _context10.a(2, (!(e != null && e.ignoreErrorMessage) && o && (!y || !v) && ((S = (h = window.DasMessage) == null ? undefined : h.error) == null || S.call(h, {
3999
4005
  message: o,
4000
4006
  showClose: true
@@ -4006,11 +4012,11 @@ var kl = 5e3,
4006
4012
  }
4007
4013
  }, _callee1);
4008
4014
  }));
4009
- return function Hl(_x12, _x13) {
4015
+ return function Wl(_x12, _x13) {
4010
4016
  return _ref24.apply(this, arguments);
4011
4017
  };
4012
4018
  }();
4013
- function tc(t, e) {
4019
+ function nc(t, e) {
4014
4020
  var r = R.create();
4015
4021
  return curringHttp.curringHttp(r, /*#__PURE__*/function () {
4016
4022
  var _ref28 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(n) {
@@ -4071,7 +4077,7 @@ function tc(t, e) {
4071
4077
  indices: false
4072
4078
  });
4073
4079
  }
4074
- }), n.onSuccess || (n.onSuccess = jl), n.onError || (n.onError = Hl), ((_n$csrf = n.csrf) !== null && _n$csrf !== void 0 ? _n$csrf : false) && (n.headers["csrf-token"] = jr.get("csrf-token"));
4080
+ }), n.onSuccess || (n.onSuccess = zl), n.onError || (n.onError = Wl), ((_n$csrf = n.csrf) !== null && _n$csrf !== void 0 ? _n$csrf : false) && (n.headers["csrf-token"] = jr.get("csrf-token"));
4075
4081
  c = n.params || {};
4076
4082
  if (c.project === undefined) {
4077
4083
  _p = 0;
@@ -4082,7 +4088,7 @@ function tc(t, e) {
4082
4088
  _commonInfo$getInstan = commonInfo.getInstanceInfo(), _p2 = _commonInfo$getInstan.instanceInfo;
4083
4089
  _p2 != null && _p2.instanceId && (c.instance = _p2.instanceId);
4084
4090
  }
4085
- n.params = c, n.headers.Timezone = Mt.tz.guess(), n.headers["X-Origin"] = location.origin;
4091
+ n.params = c, n.headers.Timezone = kl(), n.headers["X-Origin"] = location.origin;
4086
4092
  l = (_ref29 = o == null ? undefined : o.value) !== null && _ref29 !== void 0 ? _ref29 : "";
4087
4093
  return _context11.a(2, (l && (n.headers["Accept-Language"] = l), l && jr.set("locale", l), (e == null ? undefined : e(n)) || n));
4088
4094
  }
@@ -4093,5 +4099,5 @@ function tc(t, e) {
4093
4099
  };
4094
4100
  }());
4095
4101
  }
4096
- exports.createService = tc;
4097
- exports.handleUnauthorized = ql;
4102
+ exports.createService = nc;
4103
+ exports.handleUnauthorized = Hl;
@@ -0,0 +1,39 @@
1
+ declare const _default: {
2
+ 参数校验错误: {
3
+ 'zh-CN': string;
4
+ en: string;
5
+ _appCode: string;
6
+ 'zh-MO': string;
7
+ };
8
+ 接口地址未找到: {
9
+ 'zh-CN': string;
10
+ en: string;
11
+ _appCode: string;
12
+ 'zh-MO': string;
13
+ };
14
+ 服务器内部错误: {
15
+ 'zh-CN': string;
16
+ en: string;
17
+ _appCode: string;
18
+ 'zh-MO': string;
19
+ };
20
+ 解析错误: {
21
+ 'zh-CN': string;
22
+ en: string;
23
+ _appCode: string;
24
+ 'zh-MO': string;
25
+ };
26
+ 请求配置异常: {
27
+ 'zh-CN': string;
28
+ en: string;
29
+ _appCode: string;
30
+ 'zh-MO': string;
31
+ };
32
+ '\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u68C0\u67E5\u60A8\u7684\u7F51\u7EDC\u60C5\u51B5': {
33
+ 'zh-CN': string;
34
+ en: string;
35
+ _appCode: string;
36
+ 'zh-MO': string;
37
+ };
38
+ };
39
+ export default _default;