@gct-paas/core 6.0.0-dev.9 → 6.0.3-dev.1
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-60183YGE.js → redirect-index-DZUQbzHI.js} +1 -1
- package/es/constants/default-date-type/default-date-type.d.ts +4 -0
- package/es/constants/default-date-type/default-date-type.mjs +4 -0
- package/es/constants/expression-type/FunctionKeys.mjs +5 -0
- package/es/constants/expression-type/function.mjs +44 -1
- package/es/constants/expression-type/index.mjs +3 -0
- package/es/constants/expression-type/modeCfg.mjs +4 -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/enums/page-designer/panel.d.ts +4 -2
- package/es/enums/page-designer/panel.mjs +3 -1
- package/es/global/gct/gct.d.ts +4 -1
- package/es/global/gct/gct.mjs +1 -0
- package/es/index.mjs +3 -3
- package/es/interface/i-kit-plugin-module/i-kit-plugin-module.d.ts +2 -1
- package/es/locale/index.mjs +5 -1
- package/es/modules/env-manager/env-manager.d.ts +1 -0
- package/es/modules/env-manager/env-manager.interface.d.ts +6 -0
- package/es/modules/env-manager/env-manager.mjs +9 -0
- 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/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/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.d.ts +4 -0
- package/es/utils/kit-pkg-util/kit-pkg-util.mjs +13 -2
- package/es/utils/openUtil/overlay-container/overlay-container.mjs +5 -0
- package/es/utils/tools/tools.d.ts +2 -0
- package/es/utils/tools/tools.mjs +8 -4
- package/package.json +3 -3
package/es/types/index.d.ts
CHANGED
|
@@ -4,23 +4,10 @@ import 'systemjs';
|
|
|
4
4
|
import 'vite/types/importMeta.d.ts';
|
|
5
5
|
import type { Composer } from 'vue-i18n';
|
|
6
6
|
import type { GctGlobal } from '../global';
|
|
7
|
-
import type {
|
|
8
|
-
import type { ApiManage as PlatformApiManage } from '@gct-paas/api/platform';
|
|
7
|
+
import type { ApiMap } from '@gct-paas/api';
|
|
9
8
|
import type { bus } from 'wujie';
|
|
10
9
|
// import type { ModuleFederation } from '@module-federation/runtime';
|
|
11
10
|
|
|
12
|
-
/**
|
|
13
|
-
* 全局 api 对象
|
|
14
|
-
*
|
|
15
|
-
* @author chitanda
|
|
16
|
-
* @date 2025-08-21 11:08:40
|
|
17
|
-
* @interface GlobalApi
|
|
18
|
-
*/
|
|
19
|
-
interface GlobalApi {
|
|
20
|
-
apaas: APaasApiManage;
|
|
21
|
-
platform: PlatformApiManage;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
11
|
declare global {
|
|
25
12
|
/**
|
|
26
13
|
* paas 平台全局对象
|
|
@@ -29,7 +16,7 @@ declare global {
|
|
|
29
16
|
/**
|
|
30
17
|
* paas 平台 API 管理
|
|
31
18
|
*/
|
|
32
|
-
const _api:
|
|
19
|
+
const _api: ApiMap;
|
|
33
20
|
/**
|
|
34
21
|
* 模块联邦运行时对象
|
|
35
22
|
*/
|
|
@@ -47,9 +34,9 @@ declare global {
|
|
|
47
34
|
*
|
|
48
35
|
* @author chitanda
|
|
49
36
|
* @date 2025-08-21 11:08:30
|
|
50
|
-
* @type {
|
|
37
|
+
* @type {ApiMap}
|
|
51
38
|
*/
|
|
52
|
-
_api:
|
|
39
|
+
_api: ApiMap;
|
|
53
40
|
/**
|
|
54
41
|
* 多语言转换函数
|
|
55
42
|
*
|
|
@@ -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");
|
|
@@ -18,6 +18,10 @@ export declare class KitPkgUtil {
|
|
|
18
18
|
* @return {*} {(Promise<IPluginKitModule | null>)}
|
|
19
19
|
*/
|
|
20
20
|
static loadKit(kit: string, mode: PluginModeEnum): Promise<IPluginKitModule | null>;
|
|
21
|
+
/**
|
|
22
|
+
* 按给定顺序加载多个套件包。单个套件包加载失败不会中断后续加载。
|
|
23
|
+
*/
|
|
24
|
+
static loadKits(kits: string[], mode: PluginModeEnum): Promise<IPluginKitModule[]>;
|
|
21
25
|
/**
|
|
22
26
|
* 加载设计模式套件包
|
|
23
27
|
*
|
|
@@ -37,13 +37,24 @@ 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
|
-
console.
|
|
42
|
+
console.error(`Error loading kit ${kit} from ${loaderUrl}:`, error);
|
|
43
43
|
}
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
+
* 按给定顺序加载多个套件包。单个套件包加载失败不会中断后续加载。
|
|
48
|
+
*/
|
|
49
|
+
static async loadKits(kits, mode) {
|
|
50
|
+
const modules = [];
|
|
51
|
+
for (const kit of kits) {
|
|
52
|
+
const module = await this.loadKit(kit, mode);
|
|
53
|
+
if (module) modules.push(module);
|
|
54
|
+
}
|
|
55
|
+
return modules;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
47
58
|
* 加载设计模式套件包
|
|
48
59
|
*
|
|
49
60
|
* @static
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PluginModeEnum } from "../../../enums/plugin-enum.mjs";
|
|
2
|
+
import "../../../enums/index.mjs";
|
|
1
3
|
import { KitPkgUtil } from "../../kit-pkg-util/kit-pkg-util.mjs";
|
|
2
4
|
import "../../index.mjs";
|
|
3
5
|
import { QXEvent } from "qx-util";
|
|
@@ -108,6 +110,9 @@ var OverlayContainer = class OverlayContainer {
|
|
|
108
110
|
const module = await KitPkgUtil.loadWeb(_gct.store.appInfo.suiteKey);
|
|
109
111
|
if (module && module.createAppVue) module.createAppVue(vm);
|
|
110
112
|
}
|
|
113
|
+
const pluginKits = (_gct.store.appInfo.plugins ?? "").split(",").map((item) => item.trim()).filter(Boolean);
|
|
114
|
+
const pluginModules = await KitPkgUtil.loadKits(pluginKits, PluginModeEnum.WEB);
|
|
115
|
+
for (const module of pluginModules) module.createAppVue(vm);
|
|
111
116
|
vm.mount(container);
|
|
112
117
|
this.vm = vm;
|
|
113
118
|
});
|
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.
|
|
3
|
+
"version": "6.0.3-dev.1",
|
|
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"
|