@gct-paas/core 6.0.0-dev.6 → 6.0.0-dev.60

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 (37) hide show
  1. package/dist/index.esm.min.js +2 -2
  2. package/dist/{redirect-index-iltTH0Oz.js → redirect-index-B7tCkf_R.js} +1 -1
  3. package/es/constants/expression-type/FunctionKeys.mjs +7 -0
  4. package/es/constants/expression-type/function.mjs +64 -1
  5. package/es/constants/expression-type/index.mjs +5 -0
  6. package/es/constants/expression-type/modeCfg.mjs +8 -2
  7. package/es/enums/designEnum.mjs +2 -1
  8. package/es/enums/page-designer/layout.d.ts +6 -0
  9. package/es/enums/page-designer/layout.mjs +8 -1
  10. package/es/enums/page-designer/panel.d.ts +4 -2
  11. package/es/enums/page-designer/panel.mjs +3 -1
  12. package/es/global/gct/gct.d.ts +4 -1
  13. package/es/index.mjs +6 -3
  14. package/es/interface/i-kit-plugin-module/i-kit-plugin-module.d.ts +2 -1
  15. package/es/locale/index.mjs +5 -1
  16. package/es/modules/mqtt/mqtt-manager.d.ts +1 -1
  17. package/es/modules/mqtt/mqtt-manager.mjs +3 -2
  18. package/es/modules/mqtt/utils/mqtt-broker-url.util.d.ts +6 -0
  19. package/es/modules/mqtt/utils/mqtt-broker-url.util.mjs +11 -0
  20. package/es/modules/platform-config/enums/platform.enum.d.ts +4 -0
  21. package/es/modules/platform-config/enums/platform.enum.mjs +6 -1
  22. package/es/modules/platform-config/index.d.ts +3 -0
  23. package/es/modules/platform-config/index.mjs +3 -0
  24. package/es/modules/platform-config/store.d.ts +4 -1
  25. package/es/modules/platform-config/useSecuritySetting.d.ts +1 -0
  26. package/es/modules/platform-config/useSecuritySetting.mjs +11 -0
  27. package/es/modules/user-stores/store/user.store.d.ts +4 -0
  28. package/es/setup-app.mjs +6 -0
  29. package/es/types/index.d.ts +4 -17
  30. package/es/utils/axios/interceptors.mjs +33 -3
  31. package/es/utils/kit-pkg-util/kit-pkg-util.d.ts +4 -0
  32. package/es/utils/kit-pkg-util/kit-pkg-util.mjs +13 -2
  33. package/es/utils/openUtil/overlay-container/overlay-container.mjs +5 -0
  34. package/es/utils/openUtil/overlay-popover-container/overlay-popover-container.mjs +2 -1
  35. package/es/utils/tools/tools.d.ts +2 -0
  36. package/es/utils/tools/tools.mjs +8 -4
  37. 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: _gct.store.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.config?.errorMessageMode || "none";
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.warn(`Kit ${kit} does not export a default function`);
40
+ else console.error(`Kit ${kit} does not export a default function`);
41
41
  } catch (error) {
42
- console.warn(`Error loading kit ${kit} from ${loaderUrl}:`, error);
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
  });
@@ -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
  };
@@ -10,6 +10,8 @@ export declare function getToken(): string | null;
10
10
  /**
11
11
  * 设置认证令牌(目前只有 session 级别生效)
12
12
  *
13
+ * cookie 不设置 domain 属性,绑定当前完整 hostname(host-only),按域名隔离
14
+ *
13
15
  * @export
14
16
  * @param {string} token
15
17
  */
@@ -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, true);
18
- else clearCookie(CoreConst.TENANT, true);
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, true);
40
- else clearCookie(CoreConst.TOKEN, true);
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.6",
3
+ "version": "6.0.0-dev.60",
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.6",
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.6",
63
+ "@gct-paas/api": "^6.0.0-dev.17",
64
64
  "vue": ">=3",
65
65
  "vue-i18n": ">=11",
66
66
  "vue-router": ">=4"