@das-fed/utils 7.0.5-beta.8 → 7.0.5-beta.8.2
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.
- package/api-services/index.js +1000 -965
- package/api-services/index.js.gz +0 -0
- package/api-services/modules/app-manage/index.js +851 -853
- package/api-services/modules/app-manage/index.js.gz +0 -0
- package/api-services/modules/authentication/index.js +192 -176
- package/api-services/modules/authentication/index.js.gz +0 -0
- package/api-services/modules/bems/index.js +854 -856
- package/api-services/modules/bems/index.js.gz +0 -0
- package/api-services/modules/contract/index.js +851 -853
- package/api-services/modules/contract/index.js.gz +0 -0
- package/api-services/modules/duty-manage/index.js +758 -724
- package/api-services/modules/duty-manage/index.js.gz +0 -0
- package/api-services/modules/enterpriseright/index.js +780 -768
- package/api-services/modules/enterpriseright/index.js.gz +0 -0
- package/api-services/modules/file/index.js +178 -162
- package/api-services/modules/file/index.js.gz +0 -0
- package/api-services/modules/gateway-edge/index.js +851 -853
- package/api-services/modules/gateway-edge/index.js.gz +0 -0
- package/api-services/modules/index.js +643 -626
- package/api-services/modules/index.js.gz +0 -0
- package/api-services/modules/iot/index.js +1100 -1102
- package/api-services/modules/iot/index.js.gz +0 -0
- package/api-services/modules/justauth/index.d.ts +1 -1
- package/api-services/modules/justauth/index.js +852 -853
- package/api-services/modules/justauth/index.js.gz +0 -0
- package/api-services/modules/knowledge/index.js +192 -176
- package/api-services/modules/knowledge/index.js.gz +0 -0
- package/api-services/modules/link/index.js +192 -176
- package/api-services/modules/link/index.js.gz +0 -0
- package/api-services/modules/permission/index.js +192 -176
- package/api-services/modules/permission/index.js.gz +0 -0
- package/api-services/modules/platformManage/index.js +276 -260
- package/api-services/modules/platformManage/index.js.gz +0 -0
- package/api-services/modules/portal/index.js +192 -176
- package/api-services/modules/portal/index.js.gz +0 -0
- package/api-services/modules/space-manage/index.js +851 -853
- package/api-services/modules/space-manage/index.js.gz +0 -0
- package/api-services/modules/super-admin/index.js +207 -191
- package/api-services/modules/super-admin/index.js.gz +0 -0
- package/api-services/modules/supplier/index.js +853 -855
- package/api-services/modules/supplier/index.js.gz +0 -0
- package/api-services/modules/supplychain-manage/index.js +851 -853
- package/api-services/modules/supplychain-manage/index.js.gz +0 -0
- package/api-services/modules/systemConfiguration/index.js +851 -853
- package/api-services/modules/systemConfiguration/index.js.gz +0 -0
- package/api-services/modules/tool/index.js +192 -176
- package/api-services/modules/tool/index.js.gz +0 -0
- package/api-services/src/create-service/index.js +850 -852
- package/api-services/src/create-service/index.js.gz +0 -0
- package/common-info/index.d.ts +1 -1
- package/common-info/set-personal-info/index.d.ts +1 -1
- package/common-info/set-personal-info/index.js +10 -10
- package/common-info/set-personal-info/index.js.gz +0 -0
- package/common-tools/get-url-params/index.d.ts +7 -0
- package/common-tools/get-url-params/index.js +45 -38
- package/common-tools/get-url-params/index.js.gz +0 -0
- package/common-tools/obj-tools/index.js +1 -1
- package/common-tools/platform-tools/index.d.ts +7 -2
- package/common-tools/platform-tools/index.js +27 -15
- package/common-tools/platform-tools/index.js.gz +0 -0
- package/create-api-service/index.js +308 -292
- package/create-api-service/index.js.gz +0 -0
- package/create-api-service/sso/authorizer.d.ts +1 -0
- package/create-api-service/sso/index.d.ts +10 -8
- package/create-api-service/sso/index.js +874 -761
- package/create-api-service/sso/index.js.gz +0 -0
- package/create-api-service/sso/utils.d.ts +2 -0
- package/create-api-service/thirdLogout/index.d.ts +19 -0
- package/create-api-service/thirdLogout/index.js +1834 -0
- package/create-api-service/thirdLogout/index.js.gz +0 -0
- package/create-api-service/unauthorized-recovery/index.d.ts +30 -0
- package/create-api-service/unauthorized-recovery/index.js +10 -0
- package/curring-http/type.d.ts +6 -0
- package/esm-map.json +10 -1
- package/package.json +4 -4
- package/process-engine-info/index.js +8 -7
- package/token-tools/index.d.ts +2 -1
- package/token-tools/index.js +80 -8
- package/token-tools/index.js.gz +0 -0
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CurringConfig } from '../../curring-http/type';
|
|
2
|
+
|
|
3
|
+
/** 401 恢复成功后的结果。 */
|
|
4
|
+
export interface UnauthorizedRecoveryResult {
|
|
5
|
+
/** 恢复后用于重试原请求的平台访问令牌。 */
|
|
6
|
+
accessToken: string;
|
|
7
|
+
}
|
|
8
|
+
/** 401 恢复处理器接收的上下文。 */
|
|
9
|
+
export interface UnauthorizedRecoveryContext {
|
|
10
|
+
/** Axios 返回的原始错误。 */
|
|
11
|
+
error: any;
|
|
12
|
+
/** 发生 401 的原始请求配置。 */
|
|
13
|
+
config: CurringConfig;
|
|
14
|
+
}
|
|
15
|
+
/** 项目可注册的 401 恢复处理器。 */
|
|
16
|
+
export type UnauthorizedRecoveryHandler = (context: UnauthorizedRecoveryContext) => Promise<UnauthorizedRecoveryResult | null>;
|
|
17
|
+
/**
|
|
18
|
+
* 注册项目自定义的 401 恢复处理器。
|
|
19
|
+
* 后注册的处理器会覆盖之前的处理器,避免不同项目逻辑同时接管认证流程。
|
|
20
|
+
* @param handler 项目自定义恢复处理器
|
|
21
|
+
* @returns 注销当前处理器的方法
|
|
22
|
+
*/
|
|
23
|
+
export declare const registerUnauthorizedRecovery: (handler: UnauthorizedRecoveryHandler) => () => void;
|
|
24
|
+
/**
|
|
25
|
+
* 尝试恢复 401 请求。
|
|
26
|
+
* 并发 401 共用同一个恢复任务,避免短时间内重复续签 Token。
|
|
27
|
+
* @param context 401 请求上下文
|
|
28
|
+
* @returns 恢复成功后的新 Token;无法恢复时返回 null
|
|
29
|
+
*/
|
|
30
|
+
export declare const recoverUnauthorized: (context: UnauthorizedRecoveryContext) => unknown;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
let e = null, l = null;
|
|
2
|
+
const n = (r) => (e = r, () => {
|
|
3
|
+
e === r && (e = null);
|
|
4
|
+
}), o = async (r) => e ? (l || (l = Promise.resolve(e(r)).finally(() => {
|
|
5
|
+
l = null;
|
|
6
|
+
})), l) : null;
|
|
7
|
+
export {
|
|
8
|
+
o as recoverUnauthorized,
|
|
9
|
+
n as registerUnauthorizedRecovery
|
|
10
|
+
};
|
package/curring-http/type.d.ts
CHANGED
|
@@ -52,6 +52,12 @@ export type CurringConfig = AxiosRequestConfig & {
|
|
|
52
52
|
/** 接口401是否重定向到登录页 */
|
|
53
53
|
noRedireLogin?: boolean
|
|
54
54
|
|
|
55
|
+
/** 是否跳过项目注册的401恢复逻辑 */
|
|
56
|
+
skipUnauthorizedRecovery?: boolean
|
|
57
|
+
|
|
58
|
+
/** 标记当前请求已完成一次401恢复重试,防止重复续签 */
|
|
59
|
+
_unauthorizedRecoveryRetried?: boolean
|
|
60
|
+
|
|
55
61
|
/** 开启CSRF安全选项 */
|
|
56
62
|
csrf?: boolean
|
|
57
63
|
}
|
package/esm-map.json
CHANGED
|
@@ -142,5 +142,14 @@
|
|
|
142
142
|
"analyApi": "/api-services/modules/iot/index",
|
|
143
143
|
"calcTextWidth": "/common-tools/calc-text-width/index",
|
|
144
144
|
"getFileExtension": "/common-tools/get-file-extension/index",
|
|
145
|
-
"getLanguages": "/common-info/index"
|
|
145
|
+
"getLanguages": "/common-info/index",
|
|
146
|
+
"appendQueryParams": "/common-tools/get-url-params/index",
|
|
147
|
+
"refreshToken": "/create-api-service/sso/index",
|
|
148
|
+
"isThirdLogin": "/create-api-service/thirdLogout/index",
|
|
149
|
+
"thirdLogout": "/create-api-service/thirdLogout/index",
|
|
150
|
+
"oauthClient": "/api-services/modules/justauth/index",
|
|
151
|
+
"zhongshenLogout": "/create-api-service/thirdLogout/index",
|
|
152
|
+
"jmcLogout": "/create-api-service/thirdLogout/index",
|
|
153
|
+
"registerUnauthorizedRecovery": "/create-api-service/unauthorized-recovery/index",
|
|
154
|
+
"recoverUnauthorized": "/create-api-service/unauthorized-recovery/index"
|
|
146
155
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@das-fed/utils",
|
|
3
|
-
"version": "7.0.5-beta.8",
|
|
3
|
+
"version": "7.0.5-beta.8.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@antv/x6": "^2.18.1",
|
|
12
|
-
"@das-fed/utils": "7.0.5-beta.8",
|
|
12
|
+
"@das-fed/utils": "7.0.5-beta.8.2",
|
|
13
13
|
"@vue/shared": "^3.4.21",
|
|
14
14
|
"@vueuse/core": "^9.6.0",
|
|
15
15
|
"axios": "^1.6.7",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"vue": "^3.4.21"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@das-fed/cli": "7.0.5-beta.8",
|
|
25
|
-
"@das-fed/web": "7.0.5-beta.8",
|
|
24
|
+
"@das-fed/cli": "7.0.5-beta.8.2",
|
|
25
|
+
"@das-fed/web": "7.0.5-beta.8.2",
|
|
26
26
|
"@types/js-cookie": "^3.0.6",
|
|
27
27
|
"@types/lodash-es": "^4.17.12",
|
|
28
28
|
"@types/qs": "^6.9.15",
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const o = (e) => {
|
|
2
|
+
var s;
|
|
3
|
+
(s = window.webConfig) != null && s.disableSaveToken || (sessionStorage.setItem("hotentToken", e.accessToken || ""), sessionStorage.setItem("currentUser", JSON.stringify({ token: e.accessToken || "" })));
|
|
4
|
+
}, n = () => {
|
|
4
5
|
sessionStorage.removeItem("hotentToken"), sessionStorage.removeItem("currentUser");
|
|
5
6
|
}, t = (e) => {
|
|
6
7
|
sessionStorage.setItem("project", e);
|
|
7
|
-
},
|
|
8
|
+
}, r = () => {
|
|
8
9
|
sessionStorage.removeItem("project");
|
|
9
10
|
};
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
r as removeProcessEngineProject,
|
|
13
|
+
n as removeProcessEngineToken,
|
|
13
14
|
t as setProcessEngineProject,
|
|
14
|
-
|
|
15
|
+
o as setProcessEngineToken
|
|
15
16
|
};
|
package/token-tools/index.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export declare const getAccessToken: () => string;
|
|
|
10
10
|
/**
|
|
11
11
|
* 获取tokenInfo相关信息
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
type TokenInfoKey = typeof accessTokenExpiredAtKey | typeof refreshTokenKey | typeof redirectUriKey | typeof accessTokenInfoKey;
|
|
14
|
+
export declare const getAccessTokenInfo: (key: TokenInfoKey) => any;
|
|
14
15
|
/**
|
|
15
16
|
* 存入token、tokenInfo
|
|
16
17
|
* @param token
|
package/token-tools/index.js
CHANGED
|
@@ -1,11 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*! js-cookie v3.0.5 | MIT */
|
|
2
|
+
function l(e) {
|
|
3
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
4
|
+
var n = arguments[t];
|
|
5
|
+
for (var g in n)
|
|
6
|
+
e[g] = n[g];
|
|
7
|
+
}
|
|
8
|
+
return e;
|
|
9
|
+
}
|
|
10
|
+
var k = {
|
|
11
|
+
read: function(e) {
|
|
12
|
+
return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
13
|
+
},
|
|
14
|
+
write: function(e) {
|
|
15
|
+
return encodeURIComponent(e).replace(
|
|
16
|
+
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
17
|
+
decodeURIComponent
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function d(e, t) {
|
|
22
|
+
function n(r, i, o) {
|
|
23
|
+
if (!(typeof document > "u")) {
|
|
24
|
+
o = l({}, t, o), typeof o.expires == "number" && (o.expires = new Date(Date.now() + o.expires * 864e5)), o.expires && (o.expires = o.expires.toUTCString()), r = encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
25
|
+
var c = "";
|
|
26
|
+
for (var s in o)
|
|
27
|
+
o[s] && (c += "; " + s, o[s] !== !0 && (c += "=" + o[s].split(";")[0]));
|
|
28
|
+
return document.cookie = r + "=" + e.write(i, r) + c;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function g(r) {
|
|
32
|
+
if (!(typeof document > "u" || arguments.length && !r)) {
|
|
33
|
+
for (var i = document.cookie ? document.cookie.split("; ") : [], o = {}, c = 0; c < i.length; c++) {
|
|
34
|
+
var s = i[c].split("="), I = s.slice(1).join("=");
|
|
35
|
+
try {
|
|
36
|
+
var f = decodeURIComponent(s[0]);
|
|
37
|
+
if (o[f] = e.read(I, f), r === f)
|
|
38
|
+
break;
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return r ? o[r] : o;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return Object.create(
|
|
46
|
+
{
|
|
47
|
+
set: n,
|
|
48
|
+
get: g,
|
|
49
|
+
remove: function(r, i) {
|
|
50
|
+
n(
|
|
51
|
+
r,
|
|
52
|
+
"",
|
|
53
|
+
l({}, i, {
|
|
54
|
+
expires: -1
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
withAttributes: function(r) {
|
|
59
|
+
return d(this.converter, l({}, this.attributes, r));
|
|
60
|
+
},
|
|
61
|
+
withConverter: function(r) {
|
|
62
|
+
return d(l({}, this.converter, r), this.attributes);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
attributes: { value: Object.freeze(t) },
|
|
67
|
+
converter: { value: Object.freeze(e) }
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
var p = d(k, { path: "/" });
|
|
72
|
+
const a = "accessToken", m = "accessTokenExpiredAt", v = "refreshToken", u = "redirectUri", S = "csrf-token", h = () => localStorage.getItem(a) ?? p.get(a) ?? sessionStorage.getItem(a) ?? "", C = (e) => localStorage.getItem(e) ?? p.get(e) ?? sessionStorage.getItem(e) ?? "", x = (e, t = {}) => {
|
|
73
|
+
var n;
|
|
74
|
+
(n = window.webConfig) != null && n.disableSaveToken || (localStorage.setItem(a, e), localStorage.setItem(m, t.accessTokenExpiredAt ?? 0), localStorage.setItem(v, t.refreshToken ?? 0), t.redirectUri && localStorage.setItem(u, t.redirectUri));
|
|
75
|
+
}, U = () => {
|
|
76
|
+
localStorage.removeItem(a), localStorage.removeItem(m), localStorage.removeItem(v), localStorage.removeItem(u), localStorage.removeItem(S);
|
|
5
77
|
};
|
|
6
78
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
79
|
+
h as getAccessToken,
|
|
80
|
+
C as getAccessTokenInfo,
|
|
81
|
+
U as removeAccessToken,
|
|
82
|
+
x as setAccessToken
|
|
11
83
|
};
|
|
Binary file
|