@gct-paas/core 0.1.4-dev.6 → 0.1.4-dev.7
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.mjs +20168 -0
- package/dist/index.min.cjs +2 -15
- package/dist/index.system.min.js +2 -15
- package/es/create-app-vue.mjs +1 -2
- package/es/enums/index.mjs +0 -4
- package/es/global/gct/gct.d.ts +3 -1
- package/es/global/gct/gct.mjs +2 -0
- package/es/hooks/useCopyToClipboard.d.ts +3 -3
- package/es/index.mjs +49 -49
- package/es/modules/error-handler/error-strategy.mjs +4 -1
- package/es/modules/platform-config/useLoginSetting.d.ts +12 -4
- package/es/modules/platform-config/useOrgSetting.d.ts +14 -0
- package/es/modules/platform-config/useThemeSetting.d.ts +1 -1
- package/es/store/global-store.mjs +7 -2
- package/es/types/index.d.ts +0 -2
- package/package.json +28 -26
- package/es/interface/controller/edit-form/edit-form.controller.mjs +0 -1
- package/es/interface/controller/editor/i-color-editor.controller.mjs +0 -1
- package/es/interface/controller/editor/i-length-unit-editor.controller.mjs +0 -1
- package/es/interface/controller/editor-item/editor-item.controller.mjs +0 -1
- package/es/interface/controller/form/form.controller.mjs +0 -3
- package/es/interface/controller/form-collapse/form-collapse.controller.mjs +0 -1
- package/es/interface/controller/form-collapse-pane/form-collapse-pane.controller.mjs +0 -1
- package/es/interface/controller/form-edit-item/form-edit-item.controller.mjs +0 -1
- package/es/interface/controller/form-group/form-group.controller.mjs +0 -1
- package/es/interface/controller/form-hidden-item/form-hidden-item.controller.mjs +0 -1
- package/es/interface/controller/form-item/form-item.controller.mjs +0 -1
- package/es/interface/controller/form-item-basic/form-item-basic.controller.mjs +0 -1
- package/es/interface/controller/form-tab/form-tab.controller.mjs +0 -1
- package/es/interface/controller/form-tab-pane/form-tab-pane.controller.mjs +0 -1
- package/es/interface/controller/i-designer-controller.mjs +0 -1
- package/es/interface/controller/index.mjs +0 -1
- package/es/interface/events/form/i-form.event.mjs +0 -1
- package/es/interface/events/index.mjs +0 -1
- package/es/interface/form/i-editor/i-check-switch.mjs +0 -3
- package/es/interface/form/i-editor/i-checkbox-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-color-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-editor-basic.mjs +0 -1
- package/es/interface/form/i-editor/i-icon-select-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-info-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-length-unit-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-number-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-picker-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-radio-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-select-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-span-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-switch-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-text-editor.mjs +0 -3
- package/es/interface/form/i-editor/i-textarea-editor.mjs +0 -3
- package/es/interface/form/i-form/i-edit-form.mjs +0 -1
- package/es/interface/form/i-form/i-form-collapse-pane.mjs +0 -1
- package/es/interface/form/i-form/i-form-collapse.mjs +0 -1
- package/es/interface/form/i-form/i-form-container.mjs +0 -1
- package/es/interface/form/i-form/i-form-edit-item.mjs +0 -1
- package/es/interface/form/i-form/i-form-group-container.mjs +0 -1
- package/es/interface/form/i-form/i-form-group.mjs +0 -1
- package/es/interface/form/i-form/i-form-hidden-item.mjs +0 -1
- package/es/interface/form/i-form/i-form-item-basic.mjs +0 -1
- package/es/interface/form/i-form/i-form-item.mjs +0 -1
- package/es/interface/form/i-form/i-form-tab-pane.mjs +0 -1
- package/es/interface/form/i-form/i-form-tab.mjs +0 -1
- package/es/interface/form/i-form/i-form.mjs +0 -1
- package/es/interface/form/index.mjs +0 -1
- package/es/interface/hooks/i-designer-hooks.mjs +0 -3
- package/es/interface/hooks/index.mjs +0 -1
- package/es/interface/i-dictionary/i-dictionary-item.mjs +0 -1
- package/es/interface/i-dictionary/i-dictionary.mjs +0 -1
- package/es/interface/i-import-style-map/i-import-style-map.mjs +0 -1
- package/es/interface/i-message-util/i-message-util.mjs +0 -1
- package/es/interface/i-modal/i-modal.mjs +0 -3
- package/es/interface/i-modal-data/i-modal-data.mjs +0 -1
- package/es/interface/i-pinia-action/i-global-actions.mjs +0 -1
- package/es/interface/i-pinia-getter/i-global-getters.mjs +0 -1
- package/es/interface/i-pinia-state/i-global-state.mjs +0 -1
- package/es/interface/layout/i-flex-layout/i-flex-container.mjs +0 -1
- package/es/interface/layout/i-flex-layout/i-flex-item.mjs +0 -1
- package/es/interface/layout/i-grid-layout/i-grid-container.mjs +0 -1
- package/es/interface/layout/i-grid-layout/i-grid-item-span.mjs +0 -1
- package/es/interface/layout/i-grid-layout/i-grid-item.mjs +0 -1
- package/es/interface/layout/i-layout-basis/i-layout-container-basis.mjs +0 -1
- package/es/interface/layout/index.mjs +0 -1
- package/es/interface/low-code-types/index.mjs +0 -5
- package/es/interface/low-code-types/modal-types.mjs +0 -3
- package/es/interface/low-code-types/model/index.mjs +0 -1
- package/es/interface/low-code-types/schema/index.mjs +0 -1
- package/es/interface/low-code-types/widget-basic-types.mjs +0 -3
- package/es/interface/provider/i-editor-provider/i-editor-provider.mjs +0 -1
- package/es/interface/provider/i-form-item-provider/i-form-item-provider.mjs +0 -1
- package/es/interface/provider/i-provider-basic/i-provider-basic.mjs +0 -1
- package/es/interface/provider/index.mjs +0 -1
- package/es/interface/state/form/form.state.mjs +0 -1
- package/es/interface/state/form-collapse/form-collapse.state.mjs +0 -1
- package/es/interface/state/form-collapse-pane/form-collapse-pane.state.mjs +0 -1
- package/es/interface/state/form-edit-item/form-edit-item.state.mjs +0 -1
- package/es/interface/state/form-group/form-group.state.mjs +0 -1
- package/es/interface/state/form-hidden-item/form-hidden-item.state.mjs +0 -1
- package/es/interface/state/form-item/form-item.state.mjs +0 -1
- package/es/interface/state/form-item-basic/form-item-basic.state.mjs +0 -1
- package/es/interface/state/form-tab/form-tab.state.mjs +0 -1
- package/es/interface/state/form-tab-pane/form-tab-pane.state.mjs +0 -1
- package/es/interface/state/i-designer-state.mjs +0 -1
- package/es/interface/state/index.mjs +0 -1
- package/es/interface/style/i-border.mjs +0 -1
- package/es/interface/style/i-font.mjs +0 -1
- package/es/interface/style/i-margin.mjs +0 -1
- package/es/interface/style/i-padding.mjs +0 -1
- package/es/interface/style/i-position.mjs +0 -1
- package/es/interface/style/i-spacing.mjs +0 -1
- package/es/interface/style/index.mjs +0 -1
- package/es/modules/api-service/api-manage.d.ts +0 -26
- package/es/modules/api-service/api-manage.mjs +0 -33
- package/es/modules/api-service/api-service.d.ts +0 -96
- package/es/modules/api-service/api-service.interface.d.ts +0 -159
- package/es/modules/api-service/api-service.interface.mjs +0 -4
- package/es/modules/api-service/api-service.mjs +0 -173
- package/es/modules/api-service/http.enum.d.ts +0 -76
- package/es/modules/api-service/http.enum.mjs +0 -63
- package/es/modules/api-service/http.util.d.ts +0 -113
- package/es/modules/api-service/http.util.mjs +0 -160
- package/es/modules/api-service/index.d.ts +0 -8
- package/es/modules/api-service/index.mjs +0 -13
- package/es/modules/error-handler/error-handler.interface.mjs +0 -1
- package/es/modules/platform-config/constants.mjs +0 -63
- package/es/modules/platform-config/types.mjs +0 -27
- package/es/modules/platform-config/useBasicSetting.mjs +0 -50
- package/es/modules/platform-config/useDeploySetting.mjs +0 -32
- package/es/modules/platform-config/useLoginSetting.mjs +0 -183
- package/es/modules/platform-config/useOrgSetting.mjs +0 -121
- package/es/modules/platform-config/useSecuritySetting.mjs +0 -71
- package/es/modules/platform-config/useThemeSetting.mjs +0 -73
- package/es/modules/platform-config/useWatermarkSetting.mjs +0 -48
- package/es/provider/i-designer-provider/i-designer-provider.mjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ApiService } from './api-service';
|
|
2
|
-
import { ApiConfigItem } from './api-service.interface';
|
|
3
|
-
/**
|
|
4
|
-
* API 管理类
|
|
5
|
-
* 使用 Proxy 模式根据配置动态创建和管理 API 服务实例
|
|
6
|
-
*
|
|
7
|
-
* @author chitanda
|
|
8
|
-
* @date 2025-08-21 17:08:42
|
|
9
|
-
* @export
|
|
10
|
-
* @class ApiManage
|
|
11
|
-
*/
|
|
12
|
-
export declare class ApiManage {
|
|
13
|
-
/**
|
|
14
|
-
* 动态 API 服务实例索引签名
|
|
15
|
-
*/
|
|
16
|
-
[key: string]: ApiService;
|
|
17
|
-
/**
|
|
18
|
-
* 根据 api 配置挂载请求对象以及方法
|
|
19
|
-
*
|
|
20
|
-
* @author chitanda
|
|
21
|
-
* @date 2025-08-21 18:08:04
|
|
22
|
-
* @param {string} url 服务基础 URL
|
|
23
|
-
* @param {ApiConfigItem[]} configs API 配置项数组
|
|
24
|
-
*/
|
|
25
|
-
constructor(url: string, configs: ApiConfigItem[]);
|
|
26
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import path from 'path-browserify';
|
|
2
|
-
import { ApiService } from './api-service.mjs';
|
|
3
|
-
|
|
4
|
-
"use strict";
|
|
5
|
-
class ApiManage {
|
|
6
|
-
/**
|
|
7
|
-
* 根据 api 配置挂载请求对象以及方法
|
|
8
|
-
*
|
|
9
|
-
* @author chitanda
|
|
10
|
-
* @date 2025-08-21 18:08:04
|
|
11
|
-
* @param {string} url 服务基础 URL
|
|
12
|
-
* @param {ApiConfigItem[]} configs API 配置项数组
|
|
13
|
-
*/
|
|
14
|
-
constructor(url, configs) {
|
|
15
|
-
return new Proxy(this, {
|
|
16
|
-
get(manage, property) {
|
|
17
|
-
const config = configs.find((item) => item.name === property);
|
|
18
|
-
if (!config) {
|
|
19
|
-
return void 0;
|
|
20
|
-
}
|
|
21
|
-
if (!(property in manage)) {
|
|
22
|
-
manage[property] = new ApiService(
|
|
23
|
-
path.join(url, config.entityName),
|
|
24
|
-
config
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
return manage[property];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { ApiManage };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { ApiConfigItem, IHttpResponse } from './api-service.interface';
|
|
2
|
-
/**
|
|
3
|
-
* 服务基类
|
|
4
|
-
* 提供基础的 HTTP 请求方法封装
|
|
5
|
-
*
|
|
6
|
-
* @export
|
|
7
|
-
* @class ApiService
|
|
8
|
-
*/
|
|
9
|
-
export declare class ApiService {
|
|
10
|
-
private url;
|
|
11
|
-
/**
|
|
12
|
-
* Creates an instance of ApiService.
|
|
13
|
-
* @author chitanda
|
|
14
|
-
* @date 2025-08-21 18:08:19
|
|
15
|
-
* @param {string} url 服务基础 URL
|
|
16
|
-
* @param {ApiConfigItem} config 当前实例的 api 配置
|
|
17
|
-
*/
|
|
18
|
-
constructor(url: string, config: ApiConfigItem);
|
|
19
|
-
/**
|
|
20
|
-
* PUT 请求方法
|
|
21
|
-
*
|
|
22
|
-
* @protected
|
|
23
|
-
* @param {string} method 请求方法路径
|
|
24
|
-
* @param {(IObject | null)} data 请求数据
|
|
25
|
-
* @param {(IParams | null)} query 查询参数
|
|
26
|
-
* @param {IParams} config 请求配置
|
|
27
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
28
|
-
*/
|
|
29
|
-
protected _put(method: string, data: IObject | null, query: IParams | null, config: IParams): Promise<IHttpResponse>;
|
|
30
|
-
/**
|
|
31
|
-
* GET 请求方法
|
|
32
|
-
*
|
|
33
|
-
* @protected
|
|
34
|
-
* @param {string} method 请求方法路径
|
|
35
|
-
* @param {(IObject | null)} data 请求数据
|
|
36
|
-
* @param {(IParams | null)} query 查询参数
|
|
37
|
-
* @param {IParams} config 请求配置
|
|
38
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
39
|
-
*/
|
|
40
|
-
protected _get(method: string, data: IObject | null, query: IParams | null, config: IParams): Promise<IHttpResponse>;
|
|
41
|
-
/**
|
|
42
|
-
* DELETE 请求方法
|
|
43
|
-
*
|
|
44
|
-
* @protected
|
|
45
|
-
* @param {string} method 请求方法路径
|
|
46
|
-
* @param {(IObject | null)} data 请求数据
|
|
47
|
-
* @param {(IParams | null)} query 查询参数
|
|
48
|
-
* @param {IParams} config 请求配置
|
|
49
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
50
|
-
*/
|
|
51
|
-
protected _delete(method: string, data: IObject | null, query: IParams | null, config: IParams): Promise<IHttpResponse>;
|
|
52
|
-
/**
|
|
53
|
-
* POST 请求方法
|
|
54
|
-
*
|
|
55
|
-
* @protected
|
|
56
|
-
* @param {string} method 请求方法路径
|
|
57
|
-
* @param {(IObject | null)} data 请求数据
|
|
58
|
-
* @param {(IParams | null)} query 查询参数
|
|
59
|
-
* @param {IParams} config 请求配置
|
|
60
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
61
|
-
*/
|
|
62
|
-
protected _post(method: string, data: IObject | null, query: IParams | null, config: IParams): Promise<IHttpResponse>;
|
|
63
|
-
/**
|
|
64
|
-
* OPTIONS 请求方法
|
|
65
|
-
*
|
|
66
|
-
* @protected
|
|
67
|
-
* @param {string} method 请求方法路径
|
|
68
|
-
* @param {(IObject | null)} data 请求数据
|
|
69
|
-
* @param {(IParams | null)} query 查询参数
|
|
70
|
-
* @param {IParams} config 请求配置
|
|
71
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
72
|
-
*/
|
|
73
|
-
protected _options(method: string, data: IObject | null, query: IParams | null, config: IParams): Promise<IHttpResponse>;
|
|
74
|
-
/**
|
|
75
|
-
* PATCH 请求方法
|
|
76
|
-
*
|
|
77
|
-
* @protected
|
|
78
|
-
* @param {string} method 请求方法路径
|
|
79
|
-
* @param {(IObject | null)} data 请求数据
|
|
80
|
-
* @param {(IParams | null)} query 查询参数
|
|
81
|
-
* @param {IParams} config 请求配置
|
|
82
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
83
|
-
*/
|
|
84
|
-
protected _patch(method: string, data: IObject | null, query: IParams | null, config: IParams): Promise<IHttpResponse>;
|
|
85
|
-
/**
|
|
86
|
-
* HEAD 请求方法
|
|
87
|
-
*
|
|
88
|
-
* @protected
|
|
89
|
-
* @param {string} method 请求方法路径
|
|
90
|
-
* @param {(IObject | null)} data 请求数据
|
|
91
|
-
* @param {(IParams | null)} query 查询参数
|
|
92
|
-
* @param {IParams} config 请求配置
|
|
93
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
94
|
-
*/
|
|
95
|
-
protected _head(method: string, data: IObject | null, query: IParams | null, config: IParams): Promise<IHttpResponse>;
|
|
96
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { ApiManage as APaasApiManage } from '@gct-paas/api/apaas';
|
|
2
|
-
import { ApiManage as PlatformApiManage } from '@gct-paas/api/platform';
|
|
3
|
-
/**
|
|
4
|
-
* HTTP 响应接口
|
|
5
|
-
*
|
|
6
|
-
* @export
|
|
7
|
-
* @interface IHttpResponse
|
|
8
|
-
* @template T - 响应数据类型
|
|
9
|
-
*/
|
|
10
|
-
export interface IHttpResponse<T = any> {
|
|
11
|
-
/**
|
|
12
|
-
* 请求状态码
|
|
13
|
-
*
|
|
14
|
-
* @type {number}
|
|
15
|
-
*/
|
|
16
|
-
code: number;
|
|
17
|
-
/**
|
|
18
|
-
* 响应数据
|
|
19
|
-
*
|
|
20
|
-
* @type {T}
|
|
21
|
-
*/
|
|
22
|
-
data: T;
|
|
23
|
-
/**
|
|
24
|
-
* 是否请求成功
|
|
25
|
-
*
|
|
26
|
-
* @type {boolean}
|
|
27
|
-
*/
|
|
28
|
-
ok: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* 响应消息
|
|
31
|
-
*
|
|
32
|
-
* @type {string}
|
|
33
|
-
*/
|
|
34
|
-
message: string;
|
|
35
|
-
/**
|
|
36
|
-
* 子状态码
|
|
37
|
-
*
|
|
38
|
-
* @type {number}
|
|
39
|
-
* @memberof IHttpResponse
|
|
40
|
-
*/
|
|
41
|
-
subCode?: number;
|
|
42
|
-
/**
|
|
43
|
-
* 子状态消息
|
|
44
|
-
*
|
|
45
|
-
* @type {string}
|
|
46
|
-
* @memberof IHttpResponse
|
|
47
|
-
*/
|
|
48
|
-
subMessage?: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* API 接口项
|
|
52
|
-
*
|
|
53
|
-
* @author chitanda
|
|
54
|
-
* @date 2025-08-21 17:08:36
|
|
55
|
-
* @export
|
|
56
|
-
* @interface ApiItem
|
|
57
|
-
*/
|
|
58
|
-
export interface ApiItem {
|
|
59
|
-
/**
|
|
60
|
-
* 请求方式
|
|
61
|
-
*
|
|
62
|
-
* @author chitanda
|
|
63
|
-
* @date 2025-08-21 17:08:40
|
|
64
|
-
* @type {string}
|
|
65
|
-
*/
|
|
66
|
-
mode: string;
|
|
67
|
-
/**
|
|
68
|
-
* 方法名称
|
|
69
|
-
*
|
|
70
|
-
* @author chitanda
|
|
71
|
-
* @date 2025-08-21 17:08:50
|
|
72
|
-
* @type {string}
|
|
73
|
-
*/
|
|
74
|
-
method: string;
|
|
75
|
-
/**
|
|
76
|
-
* 请求路径
|
|
77
|
-
*
|
|
78
|
-
* @author chitanda
|
|
79
|
-
* @date 2025-08-21 17:08:57
|
|
80
|
-
* @type {string}
|
|
81
|
-
*/
|
|
82
|
-
path: string;
|
|
83
|
-
/**
|
|
84
|
-
* 是否有查询参数
|
|
85
|
-
*
|
|
86
|
-
* @author chitanda
|
|
87
|
-
* @date 2025-08-21 19:08:35
|
|
88
|
-
* @type {boolean}
|
|
89
|
-
*/
|
|
90
|
-
hasQuery: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* 是否有请求体
|
|
93
|
-
*
|
|
94
|
-
* @author chitanda
|
|
95
|
-
* @date 2025-08-21 19:08:41
|
|
96
|
-
* @type {boolean}
|
|
97
|
-
*/
|
|
98
|
-
hasData: boolean;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* 接口配置项
|
|
102
|
-
*
|
|
103
|
-
* @author chitanda
|
|
104
|
-
* @date 2025-08-21 17:08:09
|
|
105
|
-
* @export
|
|
106
|
-
* @interface ApiConfigItem
|
|
107
|
-
*/
|
|
108
|
-
export interface ApiConfigItem {
|
|
109
|
-
/**
|
|
110
|
-
* 实体名称 camelCase 模式
|
|
111
|
-
*
|
|
112
|
-
* @author chitanda
|
|
113
|
-
* @date 2025-08-21 17:08:24
|
|
114
|
-
* @type {string}
|
|
115
|
-
*/
|
|
116
|
-
name: string;
|
|
117
|
-
/**
|
|
118
|
-
* 实体名称
|
|
119
|
-
*
|
|
120
|
-
* @author chitanda
|
|
121
|
-
* @date 2025-08-21 19:08:57
|
|
122
|
-
* @type {string}
|
|
123
|
-
*/
|
|
124
|
-
entityName: string;
|
|
125
|
-
/**
|
|
126
|
-
* 实体所有 api
|
|
127
|
-
*
|
|
128
|
-
* @author chitanda
|
|
129
|
-
* @date 2025-08-21 17:08:07
|
|
130
|
-
* @type {ApiItem[]}
|
|
131
|
-
*/
|
|
132
|
-
apis: ApiItem[];
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* API 映射
|
|
136
|
-
*
|
|
137
|
-
* @author chitanda
|
|
138
|
-
* @date 2025-08-21 17:08:39
|
|
139
|
-
* @export
|
|
140
|
-
* @interface ApiMap
|
|
141
|
-
*/
|
|
142
|
-
export interface ApiMap {
|
|
143
|
-
/**
|
|
144
|
-
* APaas 平台 API 管理
|
|
145
|
-
*
|
|
146
|
-
* @author chitanda
|
|
147
|
-
* @date 2025-08-21 17:08:53
|
|
148
|
-
* @type {APaasApiManage}
|
|
149
|
-
*/
|
|
150
|
-
apaas: APaasApiManage;
|
|
151
|
-
/**
|
|
152
|
-
* 平台 API 管理
|
|
153
|
-
*
|
|
154
|
-
* @author chitanda
|
|
155
|
-
* @date 2025-08-21 17:08:50
|
|
156
|
-
* @type {PlatformApiManage}
|
|
157
|
-
*/
|
|
158
|
-
platform: PlatformApiManage;
|
|
159
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import path from 'path-browserify';
|
|
2
|
-
import { HttpUtil } from './http.util.mjs';
|
|
3
|
-
|
|
4
|
-
"use strict";
|
|
5
|
-
class ApiService {
|
|
6
|
-
/**
|
|
7
|
-
* Creates an instance of ApiService.
|
|
8
|
-
* @author chitanda
|
|
9
|
-
* @date 2025-08-21 18:08:19
|
|
10
|
-
* @param {string} url 服务基础 URL
|
|
11
|
-
* @param {ApiConfigItem} config 当前实例的 api 配置
|
|
12
|
-
*/
|
|
13
|
-
constructor(url, config) {
|
|
14
|
-
this.url = url;
|
|
15
|
-
return new Proxy(this, {
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
get(api, property) {
|
|
18
|
-
if (!(property in api)) {
|
|
19
|
-
const cfg = config.apis.find((item) => item.method === property);
|
|
20
|
-
if (cfg) {
|
|
21
|
-
const modeFn = `_${cfg.mode}`;
|
|
22
|
-
if (cfg.hasData && cfg.hasQuery) {
|
|
23
|
-
api[property] = (data, query, config2) => {
|
|
24
|
-
return api[modeFn](cfg.path, query, data, config2);
|
|
25
|
-
};
|
|
26
|
-
} else if (cfg.hasData) {
|
|
27
|
-
api[property] = function(data, config2) {
|
|
28
|
-
return api[modeFn](cfg.path, data, void 0, config2);
|
|
29
|
-
};
|
|
30
|
-
} else if (cfg.hasQuery) {
|
|
31
|
-
api[property] = function(query, config2) {
|
|
32
|
-
return api[modeFn](cfg.path, void 0, query, config2);
|
|
33
|
-
};
|
|
34
|
-
} else {
|
|
35
|
-
api[property] = function(config2) {
|
|
36
|
-
return api[modeFn](cfg.path, void 0, void 0, config2);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return api[property];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* PUT 请求方法
|
|
47
|
-
*
|
|
48
|
-
* @protected
|
|
49
|
-
* @param {string} method 请求方法路径
|
|
50
|
-
* @param {(IObject | null)} data 请求数据
|
|
51
|
-
* @param {(IParams | null)} query 查询参数
|
|
52
|
-
* @param {IParams} config 请求配置
|
|
53
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
54
|
-
*/
|
|
55
|
-
_put(method, data, query, config) {
|
|
56
|
-
return HttpUtil.put(
|
|
57
|
-
query?.id ? path.join(this.url, method, query.id) : path.join(this.url, method),
|
|
58
|
-
data || {},
|
|
59
|
-
query || {},
|
|
60
|
-
config
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* GET 请求方法
|
|
65
|
-
*
|
|
66
|
-
* @protected
|
|
67
|
-
* @param {string} method 请求方法路径
|
|
68
|
-
* @param {(IObject | null)} data 请求数据
|
|
69
|
-
* @param {(IParams | null)} query 查询参数
|
|
70
|
-
* @param {IParams} config 请求配置
|
|
71
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
72
|
-
*/
|
|
73
|
-
_get(method, data, query, config) {
|
|
74
|
-
return HttpUtil.get(
|
|
75
|
-
path.join(this.url, method),
|
|
76
|
-
data || {},
|
|
77
|
-
query || {},
|
|
78
|
-
config
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* DELETE 请求方法
|
|
83
|
-
*
|
|
84
|
-
* @protected
|
|
85
|
-
* @param {string} method 请求方法路径
|
|
86
|
-
* @param {(IObject | null)} data 请求数据
|
|
87
|
-
* @param {(IParams | null)} query 查询参数
|
|
88
|
-
* @param {IParams} config 请求配置
|
|
89
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
90
|
-
*/
|
|
91
|
-
_delete(method, data, query, config) {
|
|
92
|
-
return HttpUtil.delete(
|
|
93
|
-
path.join(this.url, method),
|
|
94
|
-
data || {},
|
|
95
|
-
query || {},
|
|
96
|
-
config
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* POST 请求方法
|
|
101
|
-
*
|
|
102
|
-
* @protected
|
|
103
|
-
* @param {string} method 请求方法路径
|
|
104
|
-
* @param {(IObject | null)} data 请求数据
|
|
105
|
-
* @param {(IParams | null)} query 查询参数
|
|
106
|
-
* @param {IParams} config 请求配置
|
|
107
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
108
|
-
*/
|
|
109
|
-
_post(method, data, query, config) {
|
|
110
|
-
return HttpUtil.post(
|
|
111
|
-
path.join(this.url, method),
|
|
112
|
-
data || {},
|
|
113
|
-
query || {},
|
|
114
|
-
config
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* OPTIONS 请求方法
|
|
119
|
-
*
|
|
120
|
-
* @protected
|
|
121
|
-
* @param {string} method 请求方法路径
|
|
122
|
-
* @param {(IObject | null)} data 请求数据
|
|
123
|
-
* @param {(IParams | null)} query 查询参数
|
|
124
|
-
* @param {IParams} config 请求配置
|
|
125
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
126
|
-
*/
|
|
127
|
-
_options(method, data, query, config) {
|
|
128
|
-
return HttpUtil.options(
|
|
129
|
-
path.join(this.url, method),
|
|
130
|
-
data || {},
|
|
131
|
-
query || {},
|
|
132
|
-
config
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* PATCH 请求方法
|
|
137
|
-
*
|
|
138
|
-
* @protected
|
|
139
|
-
* @param {string} method 请求方法路径
|
|
140
|
-
* @param {(IObject | null)} data 请求数据
|
|
141
|
-
* @param {(IParams | null)} query 查询参数
|
|
142
|
-
* @param {IParams} config 请求配置
|
|
143
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
144
|
-
*/
|
|
145
|
-
_patch(method, data, query, config) {
|
|
146
|
-
return HttpUtil.patch(
|
|
147
|
-
path.join(this.url, method),
|
|
148
|
-
data || {},
|
|
149
|
-
query || {},
|
|
150
|
-
config
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* HEAD 请求方法
|
|
155
|
-
*
|
|
156
|
-
* @protected
|
|
157
|
-
* @param {string} method 请求方法路径
|
|
158
|
-
* @param {(IObject | null)} data 请求数据
|
|
159
|
-
* @param {(IParams | null)} query 查询参数
|
|
160
|
-
* @param {IParams} config 请求配置
|
|
161
|
-
* @returns {Promise<IHttpResponse>} 请求结果
|
|
162
|
-
*/
|
|
163
|
-
_head(method, data, query, config) {
|
|
164
|
-
return HttpUtil.head(
|
|
165
|
-
path.join(this.url, method),
|
|
166
|
-
data || {},
|
|
167
|
-
query || {},
|
|
168
|
-
config
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export { ApiService };
|