@gct-paas/core 6.0.0-dev.5 → 6.0.0-dev.50
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/dist/index.esm.min.js +2 -2
- package/dist/{redirect-index-qf1j4GVJ.js → redirect-index-DeDexHf7.js} +1 -1
- package/es/constants/expression-type/FunctionKeys.mjs +7 -0
- package/es/constants/expression-type/function.mjs +64 -1
- package/es/constants/expression-type/index.mjs +5 -0
- package/es/constants/expression-type/modeCfg.mjs +8 -2
- package/es/enums/designEnum.mjs +2 -1
- package/es/enums/page-designer/layout.d.ts +6 -0
- package/es/enums/page-designer/layout.mjs +8 -1
- package/es/global/gct/gct.d.ts +4 -1
- package/es/index.mjs +6 -3
- package/es/interface/i-kit-plugin-module/i-kit-plugin-module.d.ts +2 -1
- package/es/modules/mqtt/mqtt-manager.d.ts +1 -1
- package/es/modules/mqtt/mqtt-manager.mjs +3 -2
- package/es/modules/mqtt/utils/mqtt-broker-url.util.d.ts +6 -0
- package/es/modules/mqtt/utils/mqtt-broker-url.util.mjs +11 -0
- package/es/modules/platform-config/enums/platform.enum.d.ts +4 -0
- package/es/modules/platform-config/enums/platform.enum.mjs +6 -1
- package/es/modules/platform-config/index.d.ts +3 -0
- package/es/modules/platform-config/index.mjs +3 -0
- package/es/modules/platform-config/store.d.ts +4 -1
- package/es/modules/platform-config/useSecuritySetting.d.ts +1 -0
- package/es/modules/platform-config/useSecuritySetting.mjs +11 -0
- package/es/modules/system-mqtt/system-mqtt.service.d.ts +1 -1
- package/es/modules/user-stores/store/user.store.d.ts +4 -0
- package/es/setup-app.mjs +6 -0
- package/es/types/index.d.ts +4 -17
- package/es/utils/axios/interceptors.mjs +33 -3
- package/es/utils/kit-pkg-util/kit-pkg-util.mjs +1 -1
- package/es/utils/openUtil/overlay-popover-container/overlay-popover-container.mjs +2 -1
- package/es/utils/tools/tools.d.ts +2 -0
- package/es/utils/tools/tools.mjs +8 -4
- package/package.json +3 -3
|
@@ -6,6 +6,33 @@ import { globalRefStorage } from "../../store/storage-store.mjs";
|
|
|
6
6
|
import "../../store/index.mjs";
|
|
7
7
|
import { AxiosHeaders } from "axios";
|
|
8
8
|
//#region src/utils/axios/interceptors.ts
|
|
9
|
+
function logApiError(error) {
|
|
10
|
+
const { config, response, code, message, stack } = error || {};
|
|
11
|
+
console.error("[API 请求失败]", {
|
|
12
|
+
url: config?.url,
|
|
13
|
+
method: config?.method,
|
|
14
|
+
status: response?.status,
|
|
15
|
+
statusText: response?.statusText,
|
|
16
|
+
code,
|
|
17
|
+
message,
|
|
18
|
+
responseData: response?.data,
|
|
19
|
+
stack
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function logBusinessError(response) {
|
|
23
|
+
const { config, data, status, statusText } = response;
|
|
24
|
+
const message = data?.subMessage || data?.message || "接口业务处理失败";
|
|
25
|
+
console.error("[API 业务错误]", {
|
|
26
|
+
url: config?.url,
|
|
27
|
+
method: config?.method,
|
|
28
|
+
status,
|
|
29
|
+
statusText,
|
|
30
|
+
code: data?.code,
|
|
31
|
+
subCode: data?.subCode,
|
|
32
|
+
message,
|
|
33
|
+
responseData: data
|
|
34
|
+
}, new Error(message));
|
|
35
|
+
}
|
|
9
36
|
/**
|
|
10
37
|
* 安装拦截器
|
|
11
38
|
*
|
|
@@ -17,7 +44,7 @@ function interceptors(axios) {
|
|
|
17
44
|
if (!config.headers) config.headers = new AxiosHeaders();
|
|
18
45
|
Object.assign(config.headers, {
|
|
19
46
|
Token: getToken(),
|
|
20
|
-
Lang:
|
|
47
|
+
Lang: globalRefStorage.value.lang,
|
|
21
48
|
"Tenant-Id": getTenant(),
|
|
22
49
|
Timezone: globalRefStorage.value.timezone
|
|
23
50
|
});
|
|
@@ -26,19 +53,22 @@ function interceptors(axios) {
|
|
|
26
53
|
axios.interceptors.response.use((response) => {
|
|
27
54
|
if (response.data.code === 200) return response;
|
|
28
55
|
else {
|
|
56
|
+
logBusinessError(response);
|
|
29
57
|
const { errorMessageMode } = response.config || {};
|
|
30
|
-
const { subMessage, message, subCode } = response.data;
|
|
58
|
+
const { code, subMessage, message, subCode } = response.data;
|
|
31
59
|
if (subCode === "sys.global.tenantId.required") {
|
|
32
60
|
console.error("租户信息缺失", response.data);
|
|
33
61
|
AuthUtil.getInstance().goTenantSelect();
|
|
34
62
|
} else if (subCode === "sys.plat.api.pass.failure.over.max_times") console.error("账号锁定", response.data);
|
|
35
63
|
else if (errorMessageMode === "none") console.error(response.data);
|
|
36
64
|
else if (subMessage || message) _gct.message.error(subMessage || message);
|
|
65
|
+
if (code && code >= 400) checkStatus(code, message, errorMessageMode);
|
|
37
66
|
}
|
|
38
67
|
return response;
|
|
39
68
|
}, (error) => {
|
|
69
|
+
logApiError(error);
|
|
40
70
|
const { response, code, message, status } = error || {};
|
|
41
|
-
const errorMessageMode = response
|
|
71
|
+
const errorMessageMode = response?.config?.errorMessageMode || "none";
|
|
42
72
|
let errMessage = "";
|
|
43
73
|
if (code === "ECONNABORTED" && message?.indexOf("timeout") !== -1) errMessage = t("sys.apiTimeoutMessage");
|
|
44
74
|
if (message?.includes("Network Error")) errMessage = t("sys.networkExceptionMsg");
|
|
@@ -37,7 +37,7 @@ var KitPkgUtil = class {
|
|
|
37
37
|
loaderUrl
|
|
38
38
|
);
|
|
39
39
|
if (module) return module;
|
|
40
|
-
else console.
|
|
40
|
+
else console.error(`Kit ${kit} does not export a default function`);
|
|
41
41
|
} catch (error) {
|
|
42
42
|
console.error(`Error loading kit ${kit} from ${loaderUrl}:`, error);
|
|
43
43
|
}
|
|
@@ -11,7 +11,8 @@ import { OverlayContainer } from "../overlay-container/overlay-container.mjs";
|
|
|
11
11
|
* @implements {IOverlayPopoverContainer}
|
|
12
12
|
*/
|
|
13
13
|
var OverlayPopoverContainer = class extends OverlayContainer {
|
|
14
|
-
present(target) {
|
|
14
|
+
async present(target) {
|
|
15
|
+
await this._initPromise;
|
|
15
16
|
return this.modal.present(target);
|
|
16
17
|
}
|
|
17
18
|
};
|
package/es/utils/tools/tools.mjs
CHANGED
|
@@ -7,6 +7,8 @@ import { customRef, readonly } from "vue";
|
|
|
7
7
|
//#region src/utils/tools/tools.ts
|
|
8
8
|
/**
|
|
9
9
|
* 租户 cookie 双向绑定响应式引用:get 直接读 cookie,set 直接写 cookie
|
|
10
|
+
*
|
|
11
|
+
* cookie 不设置 domain 属性,绑定当前完整 hostname(host-only),按域名隔离
|
|
10
12
|
*/
|
|
11
13
|
var _tenantRef = customRef((track, trigger) => ({
|
|
12
14
|
get() {
|
|
@@ -14,8 +16,8 @@ var _tenantRef = customRef((track, trigger) => ({
|
|
|
14
16
|
return getCookie(CoreConst.TENANT) || "";
|
|
15
17
|
},
|
|
16
18
|
set(value) {
|
|
17
|
-
if (value) setCookie(CoreConst.TENANT, value, 7,
|
|
18
|
-
else clearCookie(CoreConst.TENANT,
|
|
19
|
+
if (value) setCookie(CoreConst.TENANT, value, 7, false);
|
|
20
|
+
else clearCookie(CoreConst.TENANT, false);
|
|
19
21
|
trigger();
|
|
20
22
|
}
|
|
21
23
|
}));
|
|
@@ -32,12 +34,14 @@ function getToken() {
|
|
|
32
34
|
/**
|
|
33
35
|
* 设置认证令牌(目前只有 session 级别生效)
|
|
34
36
|
*
|
|
37
|
+
* cookie 不设置 domain 属性,绑定当前完整 hostname(host-only),按域名隔离
|
|
38
|
+
*
|
|
35
39
|
* @export
|
|
36
40
|
* @param {string} token
|
|
37
41
|
*/
|
|
38
42
|
function setToken(token) {
|
|
39
|
-
if (token) setCookie(CoreConst.TOKEN, token, 7,
|
|
40
|
-
else clearCookie(CoreConst.TOKEN,
|
|
43
|
+
if (token) setCookie(CoreConst.TOKEN, token, 7, false);
|
|
44
|
+
else clearCookie(CoreConst.TOKEN, false);
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* 从 cookie 获取租户标识
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/core",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.50",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"loader": "dist/index.esm.min.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fingerprintjs/fingerprintjs": "^5.1.0",
|
|
35
35
|
"@floating-ui/dom": "^1.7.6",
|
|
36
|
-
"@gct-paas/api": "^6.0.0-dev.
|
|
36
|
+
"@gct-paas/api": "^6.0.0-dev.17",
|
|
37
37
|
"@module-federation/runtime": "^2.2.3",
|
|
38
38
|
"@vueuse/core": "^14.1.0",
|
|
39
39
|
"async-validator": "^4.2.5",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"playwright": "^1.58.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@gct-paas/api": "^6.0.0-dev.
|
|
63
|
+
"@gct-paas/api": "^6.0.0-dev.17",
|
|
64
64
|
"vue": ">=3",
|
|
65
65
|
"vue-i18n": ">=11",
|
|
66
66
|
"vue-router": ">=4"
|