@das-fed/utils 7.0.7-hot.52 → 7.0.7-hot.53
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 +396 -395
- package/api-services/index.js.gz +0 -0
- package/api-services/modules/app-manage/index.js +783 -800
- package/api-services/modules/app-manage/index.js.gz +0 -0
- package/api-services/modules/authentication/index.js +799 -780
- package/api-services/modules/authentication/index.js.gz +0 -0
- package/api-services/modules/bems/index.js +786 -803
- package/api-services/modules/bems/index.js.gz +0 -0
- package/api-services/modules/contract/index.js +353 -352
- package/api-services/modules/contract/index.js.gz +0 -0
- package/api-services/modules/duty-manage/index.js +353 -352
- package/api-services/modules/duty-manage/index.js.gz +0 -0
- package/api-services/modules/enterpriseright/index.js +353 -352
- package/api-services/modules/enterpriseright/index.js.gz +0 -0
- package/api-services/modules/file/index.js +406 -405
- package/api-services/modules/file/index.js.gz +0 -0
- package/api-services/modules/gateway-edge/index.js +353 -352
- package/api-services/modules/gateway-edge/index.js.gz +0 -0
- package/api-services/modules/index.js +448 -447
- package/api-services/modules/index.js.gz +0 -0
- package/api-services/modules/iot/index.js +360 -359
- package/api-services/modules/iot/index.js.gz +0 -0
- package/api-services/modules/justauth/index.js +785 -802
- package/api-services/modules/justauth/index.js.gz +0 -0
- package/api-services/modules/knowledge/index.js +353 -352
- package/api-services/modules/knowledge/index.js.gz +0 -0
- package/api-services/modules/link/index.js +783 -800
- package/api-services/modules/link/index.js.gz +0 -0
- package/api-services/modules/permission/index.js +353 -352
- package/api-services/modules/permission/index.js.gz +0 -0
- package/api-services/modules/platformManage/index.js +777 -794
- package/api-services/modules/platformManage/index.js.gz +0 -0
- package/api-services/modules/portal/index.js +353 -352
- package/api-services/modules/portal/index.js.gz +0 -0
- package/api-services/modules/space-manage/index.js +353 -352
- package/api-services/modules/space-manage/index.js.gz +0 -0
- package/api-services/modules/super-admin/index.js +356 -355
- package/api-services/modules/super-admin/index.js.gz +0 -0
- package/api-services/modules/supplier/index.js +802 -783
- package/api-services/modules/supplier/index.js.gz +0 -0
- package/api-services/modules/supplychain-manage/index.js +353 -352
- package/api-services/modules/supplychain-manage/index.js.gz +0 -0
- package/api-services/modules/systemConfiguration/index.js +353 -352
- package/api-services/modules/systemConfiguration/index.js.gz +0 -0
- package/api-services/modules/tool/index.js +799 -780
- package/api-services/modules/tool/index.js.gz +0 -0
- package/api-services/src/create-service/index.js +782 -799
- package/api-services/src/create-service/index.js.gz +0 -0
- package/create-api-service/index.js +353 -352
- package/create-api-service/index.js.gz +0 -0
- package/create-api-service/sso/index.js +400 -398
- package/create-api-service/sso/index.js.gz +0 -0
- package/create-api-service/thirdLogout/index.d.ts +1 -1
- package/create-api-service/thirdLogout/index.js +56 -55
- package/create-api-service/thirdLogout/index.js.gz +0 -0
- package/create-api-service/unauthorized-recovery/index.d.ts +6 -0
- package/create-api-service/unauthorized-recovery/index.js +5 -4
- package/curring-http/type.d.ts +93 -93
- package/esm-map.json +2 -1
- package/package.json +4 -4
|
Binary file
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getConfig as nt } from "@das-fed/utils/config";
|
|
2
|
-
function
|
|
2
|
+
function _e(e, t) {
|
|
3
3
|
return function() {
|
|
4
4
|
return e.apply(t, arguments);
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
-
const { toString: rt } = Object.prototype, { getPrototypeOf: de } = Object, { iterator: G, toStringTag:
|
|
7
|
+
const { toString: rt } = Object.prototype, { getPrototypeOf: de } = Object, { iterator: G, toStringTag: Ue } = Symbol, Q = /* @__PURE__ */ ((e) => (t) => {
|
|
8
8
|
const n = rt.call(t);
|
|
9
9
|
return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
|
|
10
10
|
})(/* @__PURE__ */ Object.create(null)), x = (e) => (e = e.toLowerCase(), (t) => Q(t) === e), Z = (e) => (t) => typeof t === e, { isArray: B } = Array, I = Z("undefined");
|
|
@@ -20,7 +20,7 @@ const ot = Z("string"), A = Z("function"), Fe = Z("number"), M = (e) => e !== nu
|
|
|
20
20
|
if (Q(e) !== "object")
|
|
21
21
|
return !1;
|
|
22
22
|
const t = de(e);
|
|
23
|
-
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(
|
|
23
|
+
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Ue in e) && !(G in e);
|
|
24
24
|
}, at = (e) => {
|
|
25
25
|
if (!M(e) || q(e))
|
|
26
26
|
return !1;
|
|
@@ -72,7 +72,7 @@ function oe() {
|
|
|
72
72
|
return t;
|
|
73
73
|
}
|
|
74
74
|
const Et = (e, t, n, { allOwnKeys: r } = {}) => (H(t, (s, i) => {
|
|
75
|
-
n && A(s) ? e[i] =
|
|
75
|
+
n && A(s) ? e[i] = _e(s, n) : e[i] = s;
|
|
76
76
|
}, { allOwnKeys: r }), e), Rt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), St = (e, t, n, r) => {
|
|
77
77
|
e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
|
|
78
78
|
value: t.prototype
|
|
@@ -113,12 +113,12 @@ const Et = (e, t, n, { allOwnKeys: r } = {}) => (H(t, (s, i) => {
|
|
|
113
113
|
for (; (n = e.exec(t)) !== null; )
|
|
114
114
|
r.push(n);
|
|
115
115
|
return r;
|
|
116
|
-
}, Pt = x("HTMLFormElement"),
|
|
116
|
+
}, Pt = x("HTMLFormElement"), _t = (e) => e.toLowerCase().replace(
|
|
117
117
|
/[-_\s]([a-z\d])(\w*)/g,
|
|
118
118
|
function(n, r, s) {
|
|
119
119
|
return r.toUpperCase() + s;
|
|
120
120
|
}
|
|
121
|
-
), ye = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype),
|
|
121
|
+
), ye = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Ut = x("RegExp"), De = (e, t) => {
|
|
122
122
|
const n = Object.getOwnPropertyDescriptors(e), r = {};
|
|
123
123
|
H(n, (s, i) => {
|
|
124
124
|
let o;
|
|
@@ -149,7 +149,7 @@ const Et = (e, t, n, { allOwnKeys: r } = {}) => (H(t, (s, i) => {
|
|
|
149
149
|
}, kt = () => {
|
|
150
150
|
}, Bt = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
|
|
151
151
|
function Dt(e) {
|
|
152
|
-
return !!(e && A(e.append) && e[
|
|
152
|
+
return !!(e && A(e.append) && e[Ue] === "FormData" && e[G]);
|
|
153
153
|
}
|
|
154
154
|
const jt = (e) => {
|
|
155
155
|
const t = new Array(10), n = (r, s) => {
|
|
@@ -197,7 +197,7 @@ const jt = (e) => {
|
|
|
197
197
|
isDate: ct,
|
|
198
198
|
isFile: ut,
|
|
199
199
|
isBlob: lt,
|
|
200
|
-
isRegExp:
|
|
200
|
+
isRegExp: Ut,
|
|
201
201
|
isFunction: A,
|
|
202
202
|
isStream: dt,
|
|
203
203
|
isURLSearchParams: ht,
|
|
@@ -223,7 +223,7 @@ const jt = (e) => {
|
|
|
223
223
|
reduceDescriptors: De,
|
|
224
224
|
freezeMethods: Lt,
|
|
225
225
|
toObjectSet: Ft,
|
|
226
|
-
toCamelCase:
|
|
226
|
+
toCamelCase: _t,
|
|
227
227
|
noop: kt,
|
|
228
228
|
toFiniteNumber: Bt,
|
|
229
229
|
findKey: ke,
|
|
@@ -1042,10 +1042,10 @@ const Ke = (e) => {
|
|
|
1042
1042
|
config: e,
|
|
1043
1043
|
request: h
|
|
1044
1044
|
};
|
|
1045
|
-
Ve(function(
|
|
1046
|
-
n(
|
|
1047
|
-
}, function(
|
|
1048
|
-
r(
|
|
1045
|
+
Ve(function(U) {
|
|
1046
|
+
n(U), y();
|
|
1047
|
+
}, function(U) {
|
|
1048
|
+
r(U), y();
|
|
1049
1049
|
}, T), h = null;
|
|
1050
1050
|
}
|
|
1051
1051
|
"onloadend" in h ? h.onloadend = g : h.onreadystatechange = function() {
|
|
@@ -1225,13 +1225,13 @@ const Cn = async (e) => {
|
|
|
1225
1225
|
method: "POST",
|
|
1226
1226
|
body: r,
|
|
1227
1227
|
duplex: "half"
|
|
1228
|
-
}),
|
|
1229
|
-
if (a.isFormData(r) && (
|
|
1230
|
-
const [
|
|
1228
|
+
}), _;
|
|
1229
|
+
if (a.isFormData(r) && (_ = T.headers.get("content-type")) && u.setContentType(_), T.body) {
|
|
1230
|
+
const [U, $] = Re(
|
|
1231
1231
|
h,
|
|
1232
1232
|
K(Se(f))
|
|
1233
1233
|
);
|
|
1234
|
-
r = Te(T.body, Ae,
|
|
1234
|
+
r = Te(T.body, Ae, U, $);
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
1237
|
a.isString(d) || (d = d ? "include" : "omit");
|
|
@@ -1252,12 +1252,12 @@ const Cn = async (e) => {
|
|
|
1252
1252
|
["status", "statusText", "headers"].forEach((me) => {
|
|
1253
1253
|
T[me] = R[me];
|
|
1254
1254
|
});
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1255
|
+
const _ = a.toFiniteNumber(R.headers.get("content-length")), [U, $] = c && Re(
|
|
1256
|
+
_,
|
|
1257
1257
|
K(Se(c), !0)
|
|
1258
1258
|
) || [];
|
|
1259
1259
|
R = new Response(
|
|
1260
|
-
Te(R.body, Ae,
|
|
1260
|
+
Te(R.body, Ae, U, () => {
|
|
1261
1261
|
$ && $(), y && y();
|
|
1262
1262
|
}),
|
|
1263
1263
|
T
|
|
@@ -1265,8 +1265,8 @@ const Cn = async (e) => {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
l = l || "text";
|
|
1267
1267
|
let P = await X[a.findKey(X, l) || "text"](R, e);
|
|
1268
|
-
return !S && y && y(), await new Promise((T,
|
|
1269
|
-
Ve(T,
|
|
1268
|
+
return !S && y && y(), await new Promise((T, _) => {
|
|
1269
|
+
Ve(T, _, {
|
|
1270
1270
|
data: P,
|
|
1271
1271
|
headers: C.from(R.headers),
|
|
1272
1272
|
status: R.status,
|
|
@@ -1373,7 +1373,7 @@ te.transitional = function(t, n, r) {
|
|
|
1373
1373
|
te.spelling = function(t) {
|
|
1374
1374
|
return (n, r) => !0;
|
|
1375
1375
|
};
|
|
1376
|
-
function
|
|
1376
|
+
function _n(e, t, n) {
|
|
1377
1377
|
if (typeof e != "object")
|
|
1378
1378
|
throw new m("options must be an object", m.ERR_BAD_OPTION_VALUE);
|
|
1379
1379
|
const r = Object.keys(e);
|
|
@@ -1391,7 +1391,7 @@ function Un(e, t, n) {
|
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
1393
|
const W = {
|
|
1394
|
-
assertOptions:
|
|
1394
|
+
assertOptions: _n,
|
|
1395
1395
|
validators: te
|
|
1396
1396
|
}, N = W.validators;
|
|
1397
1397
|
let F = class {
|
|
@@ -1518,7 +1518,7 @@ a.forEach(["post", "put", "patch"], function(t) {
|
|
|
1518
1518
|
}
|
|
1519
1519
|
F.prototype[t] = n(), F.prototype[t + "Form"] = n(!0);
|
|
1520
1520
|
});
|
|
1521
|
-
let
|
|
1521
|
+
let Un = class Ye {
|
|
1522
1522
|
constructor(t) {
|
|
1523
1523
|
if (typeof t != "function")
|
|
1524
1524
|
throw new TypeError("executor must be a function.");
|
|
@@ -1668,7 +1668,7 @@ Object.entries(le).forEach(([e, t]) => {
|
|
|
1668
1668
|
le[t] = e;
|
|
1669
1669
|
});
|
|
1670
1670
|
function et(e) {
|
|
1671
|
-
const t = new F(e), n =
|
|
1671
|
+
const t = new F(e), n = _e(F.prototype.request, t);
|
|
1672
1672
|
return a.extend(n, F.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
|
|
1673
1673
|
return et(k(e, s));
|
|
1674
1674
|
}, n;
|
|
@@ -1676,7 +1676,7 @@ function et(e) {
|
|
|
1676
1676
|
const b = et(z);
|
|
1677
1677
|
b.Axios = F;
|
|
1678
1678
|
b.CanceledError = D;
|
|
1679
|
-
b.CancelToken =
|
|
1679
|
+
b.CancelToken = Un;
|
|
1680
1680
|
b.isCancel = Je;
|
|
1681
1681
|
b.VERSION = Ze;
|
|
1682
1682
|
b.toFormData = Y;
|
|
@@ -1694,22 +1694,22 @@ b.getAdapter = Qe.getAdapter;
|
|
|
1694
1694
|
b.HttpStatusCode = le;
|
|
1695
1695
|
b.default = b;
|
|
1696
1696
|
const {
|
|
1697
|
-
Axios:
|
|
1698
|
-
AxiosError:
|
|
1699
|
-
CanceledError:
|
|
1700
|
-
isCancel:
|
|
1701
|
-
CancelToken:
|
|
1702
|
-
VERSION:
|
|
1703
|
-
all:
|
|
1704
|
-
Cancel:
|
|
1705
|
-
isAxiosError:
|
|
1706
|
-
spread:
|
|
1707
|
-
toFormData:
|
|
1708
|
-
AxiosHeaders:
|
|
1709
|
-
HttpStatusCode:
|
|
1710
|
-
formToJSON:
|
|
1711
|
-
getAdapter:
|
|
1712
|
-
mergeConfig:
|
|
1697
|
+
Axios: $n,
|
|
1698
|
+
AxiosError: vn,
|
|
1699
|
+
CanceledError: Jn,
|
|
1700
|
+
isCancel: Vn,
|
|
1701
|
+
CancelToken: Wn,
|
|
1702
|
+
VERSION: Kn,
|
|
1703
|
+
all: Xn,
|
|
1704
|
+
Cancel: Gn,
|
|
1705
|
+
isAxiosError: Qn,
|
|
1706
|
+
spread: Zn,
|
|
1707
|
+
toFormData: Yn,
|
|
1708
|
+
AxiosHeaders: er,
|
|
1709
|
+
HttpStatusCode: tr,
|
|
1710
|
+
formToJSON: nr,
|
|
1711
|
+
getAdapter: rr,
|
|
1712
|
+
mergeConfig: sr
|
|
1713
1713
|
} = b;
|
|
1714
1714
|
/*! js-cookie v3.0.5 | MIT */
|
|
1715
1715
|
function v(e) {
|
|
@@ -1784,15 +1784,15 @@ function fe(e, t) {
|
|
|
1784
1784
|
var Pe = fe(kn, { path: "/" });
|
|
1785
1785
|
const Bn = "/api/justauth/client/v1/visitor/sso-param", Dn = {
|
|
1786
1786
|
uat: "https://sso-uat.jmc.com.cn"
|
|
1787
|
-
},
|
|
1788
|
-
const e = localStorage.getItem("thirdLogouSource");
|
|
1789
|
-
return e === "zhongshen" || e === "jmc";
|
|
1787
|
+
}, jn = () => {
|
|
1788
|
+
const e = localStorage.getItem("thirdLogouSource"), t = localStorage.getItem("loginType");
|
|
1789
|
+
return e === "jmc" && t === "das" ? !1 : e === "zhongshen" || e === "jmc";
|
|
1790
1790
|
}, tt = (e) => {
|
|
1791
|
-
localStorage.removeItem("thirdLogouSource"), location.href = e;
|
|
1792
|
-
},
|
|
1791
|
+
localStorage.removeItem("thirdLogouSource"), window.__isAutoCloseApp = !1, location.href = e;
|
|
1792
|
+
}, In = (e) => {
|
|
1793
1793
|
const n = `https://iam.shenyejituan.com:443/idp/profile/OAUTH2/Redirect/GLO?redirctToUrl=${encodeURIComponent(e)}&entityId=AIoT&redirectToLogin=true`;
|
|
1794
1794
|
tt(n);
|
|
1795
|
-
},
|
|
1795
|
+
}, qn = async () => {
|
|
1796
1796
|
let e = "";
|
|
1797
1797
|
try {
|
|
1798
1798
|
const { baseURL: s } = nt();
|
|
@@ -1818,17 +1818,18 @@ const Bn = "/api/justauth/client/v1/visitor/sso-param", Dn = {
|
|
|
1818
1818
|
} catch {
|
|
1819
1819
|
}
|
|
1820
1820
|
tt(e);
|
|
1821
|
-
}, or = async (e) => {
|
|
1821
|
+
}, or = async (e = "") => {
|
|
1822
|
+
if (!jn()) return;
|
|
1822
1823
|
const t = localStorage.getItem("thirdLogouSource");
|
|
1823
1824
|
if (t === "zhongshen") {
|
|
1824
|
-
|
|
1825
|
+
In(e);
|
|
1825
1826
|
return;
|
|
1826
1827
|
}
|
|
1827
|
-
t === "jmc" && await
|
|
1828
|
+
t === "jmc" && await qn();
|
|
1828
1829
|
};
|
|
1829
1830
|
export {
|
|
1830
|
-
|
|
1831
|
-
|
|
1831
|
+
jn as isThirdLogin,
|
|
1832
|
+
qn as jmcLogout,
|
|
1832
1833
|
or as thirdLogout,
|
|
1833
|
-
|
|
1834
|
+
In as zhongshenLogout
|
|
1834
1835
|
};
|
|
Binary file
|
|
@@ -14,6 +14,12 @@ export interface UnauthorizedRecoveryContext {
|
|
|
14
14
|
}
|
|
15
15
|
/** 项目可注册的 401 恢复处理器。 */
|
|
16
16
|
export type UnauthorizedRecoveryHandler = (context: UnauthorizedRecoveryContext) => Promise<UnauthorizedRecoveryResult | null>;
|
|
17
|
+
/**
|
|
18
|
+
* 判断当前是否已经注册项目级 401 恢复处理器。
|
|
19
|
+
* 预请求阶段需要据此跳过框架默认续签,避免自定义续签尚未接管时就触发登出。
|
|
20
|
+
* @returns 是否存在项目级恢复处理器
|
|
21
|
+
*/
|
|
22
|
+
export declare const hasUnauthorizedRecovery: () => boolean;
|
|
17
23
|
/**
|
|
18
24
|
* 注册项目自定义的 401 恢复处理器。
|
|
19
25
|
* 后注册的处理器会覆盖之前的处理器,避免不同项目逻辑同时接管认证流程。
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
let e = null, l = null;
|
|
2
|
-
const n = (r) => (e = r, () => {
|
|
2
|
+
const n = () => e !== null, o = (r) => (e = r, () => {
|
|
3
3
|
e === r && (e = null);
|
|
4
|
-
}),
|
|
4
|
+
}), t = async (r) => e ? (l || (l = Promise.resolve(e(r)).finally(() => {
|
|
5
5
|
l = null;
|
|
6
6
|
})), l) : null;
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
n as hasUnauthorizedRecovery,
|
|
9
|
+
t as recoverUnauthorized,
|
|
10
|
+
o as registerUnauthorizedRecovery
|
|
10
11
|
};
|
package/curring-http/type.d.ts
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, AxiosError } from 'axios';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** 请求工具配置项 */
|
|
6
|
-
export type CurringConfig = AxiosRequestConfig & {
|
|
7
|
-
/** 请求实例 */
|
|
8
|
-
axiosInstance?: AxiosInstance
|
|
9
|
-
|
|
10
|
-
/** 请求方法 */
|
|
11
|
-
method?: Method
|
|
12
|
-
|
|
13
|
-
/** 请求的body数据 */
|
|
14
|
-
data?: any
|
|
15
|
-
|
|
16
|
-
/** 请求的query数据 */
|
|
17
|
-
params?: any
|
|
18
|
-
|
|
19
|
-
/** 接口地址前缀 */
|
|
20
|
-
urlPrefix?: string
|
|
21
|
-
|
|
22
|
-
/** 标记为公共接口,不需要鉴权,默认为false */
|
|
23
|
-
public?: boolean
|
|
24
|
-
|
|
25
|
-
/** 请求成功执行的回调 */
|
|
26
|
-
onSuccess?: (res: any, config: CurringConfig) => Promise<any>
|
|
27
|
-
|
|
28
|
-
/** 请求失败执行的回调 */
|
|
29
|
-
onError?: (error: any, config: CurringConfig) => Promise<any>
|
|
30
|
-
|
|
31
|
-
/** 自定义处理请求失败执行的回调 */
|
|
32
|
-
onCustomError?: (error: any, config: CurringConfig) => Promise<any>
|
|
33
|
-
|
|
34
|
-
/** 不管请求成功或失败都会执行的回调 */
|
|
35
|
-
finally?: (config: CurringConfig) => any
|
|
36
|
-
|
|
37
|
-
/** 每次请求之前都会执行的函数 */
|
|
38
|
-
beforeRun?: (config: CurringConfig) => Promise<CurringConfig>
|
|
39
|
-
|
|
40
|
-
/** 自定义错误信息 */
|
|
41
|
-
customErrorMessage?: (
|
|
42
|
-
/** 原始错误信息 */
|
|
43
|
-
message: string,
|
|
44
|
-
|
|
45
|
-
/** 原始错误对象 */
|
|
46
|
-
error: any,
|
|
47
|
-
) => string | null | undefined
|
|
48
|
-
|
|
49
|
-
/** 忽略错误提示 */
|
|
50
|
-
ignoreErrorMessage?: boolean
|
|
51
|
-
|
|
52
|
-
/** 接口401是否重定向到登录页 */
|
|
53
|
-
noRedireLogin?: boolean
|
|
54
|
-
|
|
55
|
-
/** 是否跳过项目注册的401恢复逻辑 */
|
|
56
|
-
skipUnauthorizedRecovery?: boolean
|
|
57
|
-
|
|
58
|
-
/** 标记当前请求已完成一次401恢复重试,防止重复续签 */
|
|
59
|
-
_unauthorizedRecoveryRetried?: boolean
|
|
60
|
-
|
|
61
|
-
/** 开启CSRF安全选项 */
|
|
62
|
-
csrf?: boolean
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export type Method = 'get' | 'post' | 'put' | 'delete' | 'patch'
|
|
66
|
-
|
|
67
|
-
export type CurringConfigFun = (config: CurringConfig) => CurringConfig | Promise<CurringConfig>
|
|
68
|
-
|
|
69
|
-
export type CurringRes = {
|
|
70
|
-
/** 请求时返回的接口数据 */
|
|
71
|
-
data: Ref<any>
|
|
72
|
-
|
|
73
|
-
/** 请求时的错误信息 */
|
|
74
|
-
error: Ref<any>
|
|
75
|
-
|
|
76
|
-
/** 请求时的loading */
|
|
77
|
-
loading: Ref<boolean>
|
|
78
|
-
|
|
79
|
-
/** 发起请求 返回格式 [ error, data ] */
|
|
80
|
-
run: (payload?: any, config?: CurringConfig) => CurringRunRes
|
|
81
|
-
|
|
82
|
-
/** 取消请求控制器 */
|
|
83
|
-
abortController: Ref<AbortController | null>
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** 返回为数组 [error, data], 请求成功error为null,请求失败data为null */
|
|
87
|
-
export type CurringRunRes = Promise<
|
|
88
|
-
[
|
|
89
|
-
/** 请求返回的错误信息,请求成功时为null,请求失败时为错误信息 */
|
|
90
|
-
error: { code: string | number; msg: string; error: AxiosError } | null,
|
|
91
|
-
|
|
92
|
-
/** 请求返回的接口数据,请求成功时为后端数据,请求失败时为null */
|
|
93
|
-
data: any | null,
|
|
94
|
-
]
|
|
95
|
-
>
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/** 请求工具配置项 */
|
|
6
|
+
export type CurringConfig = AxiosRequestConfig & {
|
|
7
|
+
/** 请求实例 */
|
|
8
|
+
axiosInstance?: AxiosInstance
|
|
9
|
+
|
|
10
|
+
/** 请求方法 */
|
|
11
|
+
method?: Method
|
|
12
|
+
|
|
13
|
+
/** 请求的body数据 */
|
|
14
|
+
data?: any
|
|
15
|
+
|
|
16
|
+
/** 请求的query数据 */
|
|
17
|
+
params?: any
|
|
18
|
+
|
|
19
|
+
/** 接口地址前缀 */
|
|
20
|
+
urlPrefix?: string
|
|
21
|
+
|
|
22
|
+
/** 标记为公共接口,不需要鉴权,默认为false */
|
|
23
|
+
public?: boolean
|
|
24
|
+
|
|
25
|
+
/** 请求成功执行的回调 */
|
|
26
|
+
onSuccess?: (res: any, config: CurringConfig) => Promise<any>
|
|
27
|
+
|
|
28
|
+
/** 请求失败执行的回调 */
|
|
29
|
+
onError?: (error: any, config: CurringConfig) => Promise<any>
|
|
30
|
+
|
|
31
|
+
/** 自定义处理请求失败执行的回调 */
|
|
32
|
+
onCustomError?: (error: any, config: CurringConfig) => Promise<any>
|
|
33
|
+
|
|
34
|
+
/** 不管请求成功或失败都会执行的回调 */
|
|
35
|
+
finally?: (config: CurringConfig) => any
|
|
36
|
+
|
|
37
|
+
/** 每次请求之前都会执行的函数 */
|
|
38
|
+
beforeRun?: (config: CurringConfig) => Promise<CurringConfig>
|
|
39
|
+
|
|
40
|
+
/** 自定义错误信息 */
|
|
41
|
+
customErrorMessage?: (
|
|
42
|
+
/** 原始错误信息 */
|
|
43
|
+
message: string,
|
|
44
|
+
|
|
45
|
+
/** 原始错误对象 */
|
|
46
|
+
error: any,
|
|
47
|
+
) => string | null | undefined
|
|
48
|
+
|
|
49
|
+
/** 忽略错误提示 */
|
|
50
|
+
ignoreErrorMessage?: boolean
|
|
51
|
+
|
|
52
|
+
/** 接口401是否重定向到登录页 */
|
|
53
|
+
noRedireLogin?: boolean
|
|
54
|
+
|
|
55
|
+
/** 是否跳过项目注册的401恢复逻辑 */
|
|
56
|
+
skipUnauthorizedRecovery?: boolean
|
|
57
|
+
|
|
58
|
+
/** 标记当前请求已完成一次401恢复重试,防止重复续签 */
|
|
59
|
+
_unauthorizedRecoveryRetried?: boolean
|
|
60
|
+
|
|
61
|
+
/** 开启CSRF安全选项 */
|
|
62
|
+
csrf?: boolean
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type Method = 'get' | 'post' | 'put' | 'delete' | 'patch'
|
|
66
|
+
|
|
67
|
+
export type CurringConfigFun = (config: CurringConfig) => CurringConfig | Promise<CurringConfig>
|
|
68
|
+
|
|
69
|
+
export type CurringRes = {
|
|
70
|
+
/** 请求时返回的接口数据 */
|
|
71
|
+
data: Ref<any>
|
|
72
|
+
|
|
73
|
+
/** 请求时的错误信息 */
|
|
74
|
+
error: Ref<any>
|
|
75
|
+
|
|
76
|
+
/** 请求时的loading */
|
|
77
|
+
loading: Ref<boolean>
|
|
78
|
+
|
|
79
|
+
/** 发起请求 返回格式 [ error, data ] */
|
|
80
|
+
run: (payload?: any, config?: CurringConfig) => CurringRunRes
|
|
81
|
+
|
|
82
|
+
/** 取消请求控制器 */
|
|
83
|
+
abortController: Ref<AbortController | null>
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** 返回为数组 [error, data], 请求成功error为null,请求失败data为null */
|
|
87
|
+
export type CurringRunRes = Promise<
|
|
88
|
+
[
|
|
89
|
+
/** 请求返回的错误信息,请求成功时为null,请求失败时为错误信息 */
|
|
90
|
+
error: { code: string | number; msg: string; error: AxiosError } | null,
|
|
91
|
+
|
|
92
|
+
/** 请求返回的接口数据,请求成功时为后端数据,请求失败时为null */
|
|
93
|
+
data: any | null,
|
|
94
|
+
]
|
|
95
|
+
>
|
package/esm-map.json
CHANGED
|
@@ -151,5 +151,6 @@
|
|
|
151
151
|
"zhongshenLogout": "/create-api-service/thirdLogout/index",
|
|
152
152
|
"jmcLogout": "/create-api-service/thirdLogout/index",
|
|
153
153
|
"registerUnauthorizedRecovery": "/create-api-service/unauthorized-recovery/index",
|
|
154
|
-
"recoverUnauthorized": "/create-api-service/unauthorized-recovery/index"
|
|
154
|
+
"recoverUnauthorized": "/create-api-service/unauthorized-recovery/index",
|
|
155
|
+
"hasUnauthorizedRecovery": "/create-api-service/unauthorized-recovery/index"
|
|
155
156
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@das-fed/utils",
|
|
3
|
-
"version": "7.0.7-hot.
|
|
3
|
+
"version": "7.0.7-hot.53",
|
|
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.7-hot.
|
|
12
|
+
"@das-fed/utils": "7.0.7-hot.53",
|
|
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.7-hot.
|
|
25
|
-
"@das-fed/web": "7.0.7-hot.
|
|
24
|
+
"@das-fed/cli": "7.0.7-hot.53",
|
|
25
|
+
"@das-fed/web": "7.0.7-hot.53",
|
|
26
26
|
"@types/js-cookie": "^3.0.6",
|
|
27
27
|
"@types/lodash-es": "^4.17.12",
|
|
28
28
|
"@types/qs": "^6.9.15",
|