@gct-paas/api 0.1.0-dev.2 → 0.1.0-dev.3
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/gct-api.esm.min.js +25 -0
- package/dist/gct-api.system.min.js +25 -0
- package/es/apaas/service/api-config.mjs +676 -20
- package/es/apaas/service/apis/api.service.d.ts +10 -0
- package/es/apaas/service/apis/app-granted-user.service.d.ts +1 -0
- package/es/apaas/service/apis/audit-log.service.d.ts +2 -5
- package/es/apaas/service/apis/category.service.d.ts +0 -2
- package/es/apaas/service/apis/control-config.service.d.ts +4 -0
- package/es/apaas/service/apis/designer-common.service.d.ts +4 -0
- package/es/apaas/service/apis/dhr.service.d.ts +46 -0
- package/es/apaas/service/apis/doc-outline.service.d.ts +1 -1
- package/es/apaas/service/apis/document.service.d.ts +4 -0
- package/es/apaas/service/apis/edhr-category.service.d.ts +57 -0
- package/es/apaas/service/apis/edhr-circulationFormRelateModel.service.d.ts +60 -0
- package/es/apaas/service/apis/edhr-instance.service.d.ts +7 -0
- package/es/apaas/service/apis/edhr-tmpl.service.d.ts +5 -2
- package/es/apaas/service/apis/file-resource.service.d.ts +1 -0
- package/es/apaas/service/apis/file.service.d.ts +10 -0
- package/es/apaas/service/apis/form.service.d.ts +41 -0
- package/es/apaas/service/apis/label.service.d.ts +41 -1
- package/es/apaas/service/apis/message-record.service.d.ts +2 -0
- package/es/apaas/service/apis/model-meta.service.d.ts +25 -0
- package/es/apaas/service/apis/model-permission-relation.service.d.ts +50 -0
- package/es/apaas/service/apis/online-form-category.service.d.ts +57 -0
- package/es/apaas/service/apis/online-form-instance.service.d.ts +75 -6
- package/es/apaas/service/apis/online-form-tmpl.service.d.ts +6 -1
- package/es/apaas/service/apis/online-form.service.d.ts +0 -5
- package/es/apaas/service/apis/online-user-summary.service.d.ts +50 -0
- package/es/apaas/service/apis/online.service.d.ts +15 -1
- package/es/apaas/service/apis/pad-page.service.d.ts +70 -0
- package/es/apaas/service/apis/page-designer-log.service.d.ts +1 -1
- package/es/apaas/service/apis/pm-process-definition.service.d.ts +1 -0
- package/es/apaas/service/apis/print.service.d.ts +5 -0
- package/es/apaas/service/apis/process-definition-version.service.d.ts +8 -0
- package/es/apaas/service/apis/process-path.service.d.ts +8 -0
- package/es/apaas/service/apis/process-task-done.service.d.ts +10 -0
- package/es/apaas/service/apis/process-task-todo.service.d.ts +20 -0
- package/es/apaas/service/apis/product-release.service.d.ts +9 -0
- package/es/apaas/service/apis/report-data-set.service.d.ts +10 -0
- package/es/apaas/service/apis/sandbox-config.service.d.ts +74 -0
- package/es/apaas/service/apis/ss.service.d.ts +12 -0
- package/es/apaas/service/apis/trace-log.service.d.ts +1 -0
- package/es/apaas/service/entities.d.ts +9796 -6316
- package/es/apaas/service/index.d.ts +18 -0
- package/es/index.d.ts +1 -0
- package/es/index.mjs +1 -0
- package/es/ipaas/service/api-config.mjs +21 -0
- package/es/ipaas/service/apis/camel.service.d.ts +8 -0
- package/es/ipaas/service/apis/flow.service.d.ts +10 -1
- package/es/ipaas/service/entities.d.ts +27 -1
- package/es/platform/service/api-config.mjs +320 -16
- package/es/platform/service/apis/api.service.d.ts +63 -30
- package/es/platform/service/apis/app-member.service.d.ts +0 -4
- package/es/platform/service/apis/bi-app.service.d.ts +6 -0
- package/es/platform/service/apis/database.service.d.ts +24 -0
- package/es/platform/service/apis/dataset.service.d.ts +19 -0
- package/es/platform/service/apis/device-interconnection-param.service.d.ts +58 -0
- package/es/platform/service/apis/device-interconnection.service.d.ts +63 -0
- package/es/platform/service/apis/device-param-ref.service.d.ts +25 -0
- package/es/platform/service/apis/file-task.service.d.ts +1 -0
- package/es/platform/service/apis/file.service.d.ts +4 -0
- package/es/platform/service/apis/license.service.d.ts +8 -0
- package/es/platform/service/apis/login.service.d.ts +1 -0
- package/es/platform/service/apis/org.service.d.ts +1 -0
- package/es/platform/service/apis/plat.service.d.ts +17 -0
- package/es/platform/service/apis/seal-management.service.d.ts +1 -1
- package/es/platform/service/apis/tenant.service.d.ts +1 -0
- package/es/platform/service/entities.d.ts +768 -72
- package/es/platform/service/index.d.ts +8 -0
- package/es/service/api-manage.d.ts +26 -0
- package/es/service/api-manage.mjs +29 -0
- package/es/service/api-service.d.ts +96 -0
- package/es/service/api-service.interface.d.ts +159 -0
- package/es/service/api-service.interface.mjs +0 -0
- package/es/service/api-service.mjs +169 -0
- package/es/service/http.enum.d.ts +76 -0
- package/es/service/http.enum.mjs +60 -0
- package/es/service/http.util.d.ts +113 -0
- package/es/service/http.util.mjs +155 -0
- package/es/service/index.d.ts +8 -0
- package/es/service/index.mjs +14 -0
- package/es/types/index.d.ts +2 -0
- package/es/utils/index.d.ts +10 -0
- package/es/utils/index.mjs +14 -0
- package/lib/apaas/service/api-config.cjs +566 -14
- package/lib/apaas/service/apis/api.service.d.ts +10 -0
- package/lib/apaas/service/apis/app-granted-user.service.d.ts +1 -0
- package/lib/apaas/service/apis/audit-log.service.d.ts +2 -5
- package/lib/apaas/service/apis/category.service.d.ts +0 -2
- package/lib/apaas/service/apis/control-config.service.d.ts +4 -0
- package/lib/apaas/service/apis/designer-common.service.d.ts +4 -0
- package/lib/apaas/service/apis/dhr.service.d.ts +46 -0
- package/lib/apaas/service/apis/doc-outline.service.d.ts +1 -1
- package/lib/apaas/service/apis/document.service.d.ts +4 -0
- package/lib/apaas/service/apis/edhr-category.service.d.ts +57 -0
- package/lib/apaas/service/apis/edhr-circulationFormRelateModel.service.d.ts +60 -0
- package/lib/apaas/service/apis/edhr-instance.service.d.ts +7 -0
- package/lib/apaas/service/apis/edhr-tmpl.service.d.ts +5 -2
- package/lib/apaas/service/apis/file-resource.service.d.ts +1 -0
- package/lib/apaas/service/apis/file.service.d.ts +10 -0
- package/lib/apaas/service/apis/form.service.d.ts +41 -0
- package/lib/apaas/service/apis/label.service.d.ts +41 -1
- package/lib/apaas/service/apis/message-record.service.d.ts +2 -0
- package/lib/apaas/service/apis/model-meta.service.d.ts +25 -0
- package/lib/apaas/service/apis/model-permission-relation.service.d.ts +50 -0
- package/lib/apaas/service/apis/online-form-category.service.d.ts +57 -0
- package/lib/apaas/service/apis/online-form-instance.service.d.ts +75 -6
- package/lib/apaas/service/apis/online-form-tmpl.service.d.ts +6 -1
- package/lib/apaas/service/apis/online-form.service.d.ts +0 -5
- package/lib/apaas/service/apis/online-user-summary.service.d.ts +50 -0
- package/lib/apaas/service/apis/online.service.d.ts +15 -1
- package/lib/apaas/service/apis/pad-page.service.d.ts +70 -0
- package/lib/apaas/service/apis/page-designer-log.service.d.ts +1 -1
- package/lib/apaas/service/apis/pm-process-definition.service.d.ts +1 -0
- package/lib/apaas/service/apis/print.service.d.ts +5 -0
- package/lib/apaas/service/apis/process-definition-version.service.d.ts +8 -0
- package/lib/apaas/service/apis/process-path.service.d.ts +8 -0
- package/lib/apaas/service/apis/process-task-done.service.d.ts +10 -0
- package/lib/apaas/service/apis/process-task-todo.service.d.ts +20 -0
- package/lib/apaas/service/apis/product-release.service.d.ts +9 -0
- package/lib/apaas/service/apis/report-data-set.service.d.ts +10 -0
- package/lib/apaas/service/apis/sandbox-config.service.d.ts +74 -0
- package/lib/apaas/service/apis/ss.service.d.ts +12 -0
- package/lib/apaas/service/apis/trace-log.service.d.ts +1 -0
- package/lib/apaas/service/entities.d.ts +9796 -6316
- package/lib/apaas/service/index.d.ts +18 -0
- package/lib/index.cjs +16 -0
- package/lib/ipaas/service/api-config.cjs +18 -0
- package/lib/ipaas/service/apis/camel.service.d.ts +8 -0
- package/lib/ipaas/service/apis/flow.service.d.ts +10 -1
- package/lib/ipaas/service/entities.d.ts +27 -1
- package/lib/platform/service/api-config.cjs +271 -15
- package/lib/platform/service/apis/api.service.d.ts +63 -30
- package/lib/platform/service/apis/app-member.service.d.ts +0 -4
- package/lib/platform/service/apis/bi-app.service.d.ts +6 -0
- package/lib/platform/service/apis/database.service.d.ts +24 -0
- package/lib/platform/service/apis/dataset.service.d.ts +19 -0
- package/lib/platform/service/apis/device-interconnection-param.service.d.ts +58 -0
- package/lib/platform/service/apis/device-interconnection.service.d.ts +63 -0
- package/lib/platform/service/apis/device-param-ref.service.d.ts +25 -0
- package/lib/platform/service/apis/file-task.service.d.ts +1 -0
- package/lib/platform/service/apis/file.service.d.ts +4 -0
- package/lib/platform/service/apis/license.service.d.ts +8 -0
- package/lib/platform/service/apis/login.service.d.ts +1 -0
- package/lib/platform/service/apis/org.service.d.ts +1 -0
- package/lib/platform/service/apis/plat.service.d.ts +17 -0
- package/lib/platform/service/apis/seal-management.service.d.ts +1 -1
- package/lib/platform/service/apis/tenant.service.d.ts +1 -0
- package/lib/platform/service/entities.d.ts +768 -72
- package/lib/platform/service/index.d.ts +8 -0
- package/lib/service/api-manage.cjs +34 -0
- package/lib/service/api-service.cjs +142 -0
- package/lib/service/api-service.interface.cjs +1 -0
- package/lib/service/http.enum.cjs +66 -0
- package/lib/service/http.util.cjs +181 -0
- package/lib/service/index.cjs +45 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/utils/index.cjs +16 -0
- package/package.json +38 -38
- package/dist/api-apaas.esm.js +0 -1
- package/dist/api-apaas.system.js +0 -1
- package/dist/api-ipaas.esm.js +0 -1
- package/dist/api-ipaas.system.js +0 -1
- package/dist/api-platform.esm.js +0 -1
- package/dist/api-platform.system.js +0 -1
|
@@ -5,6 +5,7 @@ import type { AppMemberService } from './apis/app-member.service';
|
|
|
5
5
|
import type { AppSettingService } from './apis/app-setting.service';
|
|
6
6
|
import type { AssetsService } from './apis/assets.service';
|
|
7
7
|
import type { AuditLogService } from './apis/audit-log.service';
|
|
8
|
+
import type { BiAppService } from './apis/bi-app.service';
|
|
8
9
|
import type { BiDataSetService } from './apis/bi-data-set.service';
|
|
9
10
|
import type { BiFileDatasetConfigService } from './apis/bi-file-dataset-config.service';
|
|
10
11
|
import type { BiFileService } from './apis/bi-file.service';
|
|
@@ -20,6 +21,9 @@ import type { DatasourceDevopsService } from './apis/datasource-devops.service';
|
|
|
20
21
|
import type { DatasourceMoveService } from './apis/datasource-move.service';
|
|
21
22
|
import type { DatasourceMoveDataService } from './apis/datasource-move-data.service';
|
|
22
23
|
import type { DatasourceMoveDetailService } from './apis/datasource-move-detail.service';
|
|
24
|
+
import type { DeviceInterconnectionService } from './apis/device-interconnection.service';
|
|
25
|
+
import type { DeviceInterconnectionParamService } from './apis/device-interconnection-param.service';
|
|
26
|
+
import type { DeviceParamRefService } from './apis/device-param-ref.service';
|
|
23
27
|
import type { ExternalMessageService } from './apis/external-message.service';
|
|
24
28
|
import type { FileTaskService } from './apis/file-task.service';
|
|
25
29
|
import type { FileService } from './apis/file.service';
|
|
@@ -186,6 +190,7 @@ export interface ApiManage {
|
|
|
186
190
|
readonly appSetting: AppSettingService;
|
|
187
191
|
readonly assets: AssetsService;
|
|
188
192
|
readonly auditLog: AuditLogService;
|
|
193
|
+
readonly biApp: BiAppService;
|
|
189
194
|
readonly biDataSet: BiDataSetService;
|
|
190
195
|
readonly biFileDatasetConfig: BiFileDatasetConfigService;
|
|
191
196
|
readonly biFile: BiFileService;
|
|
@@ -201,6 +206,9 @@ export interface ApiManage {
|
|
|
201
206
|
readonly datasourceMove: DatasourceMoveService;
|
|
202
207
|
readonly datasourceMoveData: DatasourceMoveDataService;
|
|
203
208
|
readonly datasourceMoveDetail: DatasourceMoveDetailService;
|
|
209
|
+
readonly deviceInterconnection: DeviceInterconnectionService;
|
|
210
|
+
readonly deviceInterconnectionParam: DeviceInterconnectionParamService;
|
|
211
|
+
readonly deviceParamRef: DeviceParamRefService;
|
|
204
212
|
readonly externalMessage: ExternalMessageService;
|
|
205
213
|
readonly fileTask: FileTaskService;
|
|
206
214
|
readonly file: FileService;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ApiService } from './api-service';
|
|
2
|
+
import type { 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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import path from "path-browserify";
|
|
2
|
+
import { ApiService } from "./api-service.mjs";
|
|
3
|
+
export class ApiManage {
|
|
4
|
+
/**
|
|
5
|
+
* 根据 api 配置挂载请求对象以及方法
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2025-08-21 18:08:04
|
|
9
|
+
* @param {string} url 服务基础 URL
|
|
10
|
+
* @param {ApiConfigItem[]} configs API 配置项数组
|
|
11
|
+
*/
|
|
12
|
+
constructor(url, configs) {
|
|
13
|
+
return new Proxy(this, {
|
|
14
|
+
get(manage, property) {
|
|
15
|
+
const config = configs.find((item) => item.name === property);
|
|
16
|
+
if (!config) {
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
if (!(property in manage)) {
|
|
20
|
+
manage[property] = new ApiService(
|
|
21
|
+
path.join(url, config.entityName),
|
|
22
|
+
config
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return manage[property];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { 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
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { type ApiManage as APaasApiManage } from '../apaas';
|
|
2
|
+
import { type ApiManage as PlatformApiManage } from '../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
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import path from "path-browserify";
|
|
2
|
+
import { HttpUtil } from "./http.util.mjs";
|
|
3
|
+
export class ApiService {
|
|
4
|
+
/**
|
|
5
|
+
* Creates an instance of ApiService.
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2025-08-21 18:08:19
|
|
8
|
+
* @param {string} url 服务基础 URL
|
|
9
|
+
* @param {ApiConfigItem} config 当前实例的 api 配置
|
|
10
|
+
*/
|
|
11
|
+
constructor(url, config) {
|
|
12
|
+
this.url = url;
|
|
13
|
+
return new Proxy(this, {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
get(api, property) {
|
|
16
|
+
if (!(property in api)) {
|
|
17
|
+
const cfg = config.apis.find((item) => item.method === property);
|
|
18
|
+
if (cfg) {
|
|
19
|
+
const modeFn = `_${cfg.mode}`;
|
|
20
|
+
if (cfg.hasData && cfg.hasQuery) {
|
|
21
|
+
api[property] = (data, query, config2) => {
|
|
22
|
+
return api[modeFn](cfg.path, query, data, config2);
|
|
23
|
+
};
|
|
24
|
+
} else if (cfg.hasData) {
|
|
25
|
+
api[property] = function(data, config2) {
|
|
26
|
+
return api[modeFn](cfg.path, data, void 0, config2);
|
|
27
|
+
};
|
|
28
|
+
} else if (cfg.hasQuery) {
|
|
29
|
+
api[property] = function(query, config2) {
|
|
30
|
+
return api[modeFn](cfg.path, void 0, query, config2);
|
|
31
|
+
};
|
|
32
|
+
} else {
|
|
33
|
+
api[property] = function(config2) {
|
|
34
|
+
return api[modeFn](cfg.path, void 0, void 0, config2);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return api[property];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* PUT 请求方法
|
|
45
|
+
*
|
|
46
|
+
* @protected
|
|
47
|
+
* @param {string} method 请求方法路径
|
|
48
|
+
* @param {(IObject | null)} data 请求数据
|
|
49
|
+
* @param {(IParams | null)} query 查询参数
|
|
50
|
+
* @param {IParams} config 请求配置
|
|
51
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
52
|
+
*/
|
|
53
|
+
_put(method, data, query, config) {
|
|
54
|
+
return HttpUtil.put(
|
|
55
|
+
query?.id ? path.join(this.url, method, query.id) : path.join(this.url, method),
|
|
56
|
+
data || {},
|
|
57
|
+
query || {},
|
|
58
|
+
config
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* GET 请求方法
|
|
63
|
+
*
|
|
64
|
+
* @protected
|
|
65
|
+
* @param {string} method 请求方法路径
|
|
66
|
+
* @param {(IObject | null)} data 请求数据
|
|
67
|
+
* @param {(IParams | null)} query 查询参数
|
|
68
|
+
* @param {IParams} config 请求配置
|
|
69
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
70
|
+
*/
|
|
71
|
+
_get(method, data, query, config) {
|
|
72
|
+
return HttpUtil.get(
|
|
73
|
+
path.join(this.url, method),
|
|
74
|
+
data || {},
|
|
75
|
+
query || {},
|
|
76
|
+
config
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* DELETE 请求方法
|
|
81
|
+
*
|
|
82
|
+
* @protected
|
|
83
|
+
* @param {string} method 请求方法路径
|
|
84
|
+
* @param {(IObject | null)} data 请求数据
|
|
85
|
+
* @param {(IParams | null)} query 查询参数
|
|
86
|
+
* @param {IParams} config 请求配置
|
|
87
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
88
|
+
*/
|
|
89
|
+
_delete(method, data, query, config) {
|
|
90
|
+
return HttpUtil.delete(
|
|
91
|
+
path.join(this.url, method),
|
|
92
|
+
data || {},
|
|
93
|
+
query || {},
|
|
94
|
+
config
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* POST 请求方法
|
|
99
|
+
*
|
|
100
|
+
* @protected
|
|
101
|
+
* @param {string} method 请求方法路径
|
|
102
|
+
* @param {(IObject | null)} data 请求数据
|
|
103
|
+
* @param {(IParams | null)} query 查询参数
|
|
104
|
+
* @param {IParams} config 请求配置
|
|
105
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
106
|
+
*/
|
|
107
|
+
_post(method, data, query, config) {
|
|
108
|
+
return HttpUtil.post(
|
|
109
|
+
path.join(this.url, method),
|
|
110
|
+
data || {},
|
|
111
|
+
query || {},
|
|
112
|
+
config
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* OPTIONS 请求方法
|
|
117
|
+
*
|
|
118
|
+
* @protected
|
|
119
|
+
* @param {string} method 请求方法路径
|
|
120
|
+
* @param {(IObject | null)} data 请求数据
|
|
121
|
+
* @param {(IParams | null)} query 查询参数
|
|
122
|
+
* @param {IParams} config 请求配置
|
|
123
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
124
|
+
*/
|
|
125
|
+
_options(method, data, query, config) {
|
|
126
|
+
return HttpUtil.options(
|
|
127
|
+
path.join(this.url, method),
|
|
128
|
+
data || {},
|
|
129
|
+
query || {},
|
|
130
|
+
config
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* PATCH 请求方法
|
|
135
|
+
*
|
|
136
|
+
* @protected
|
|
137
|
+
* @param {string} method 请求方法路径
|
|
138
|
+
* @param {(IObject | null)} data 请求数据
|
|
139
|
+
* @param {(IParams | null)} query 查询参数
|
|
140
|
+
* @param {IParams} config 请求配置
|
|
141
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
142
|
+
*/
|
|
143
|
+
_patch(method, data, query, config) {
|
|
144
|
+
return HttpUtil.patch(
|
|
145
|
+
path.join(this.url, method),
|
|
146
|
+
data || {},
|
|
147
|
+
query || {},
|
|
148
|
+
config
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* HEAD 请求方法
|
|
153
|
+
*
|
|
154
|
+
* @protected
|
|
155
|
+
* @param {string} method 请求方法路径
|
|
156
|
+
* @param {(IObject | null)} data 请求数据
|
|
157
|
+
* @param {(IParams | null)} query 查询参数
|
|
158
|
+
* @param {IParams} config 请求配置
|
|
159
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
160
|
+
*/
|
|
161
|
+
_head(method, data, query, config) {
|
|
162
|
+
return HttpUtil.head(
|
|
163
|
+
path.join(this.url, method),
|
|
164
|
+
data || {},
|
|
165
|
+
query || {},
|
|
166
|
+
config
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 请求结果枚举
|
|
3
|
+
*
|
|
4
|
+
* @description: Request result set
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ResultEnum {
|
|
7
|
+
SUCCESS = 200,
|
|
8
|
+
ERROR = -1,
|
|
9
|
+
TIMEOUT = 401,
|
|
10
|
+
TYPE = "success"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 请求方法枚举
|
|
14
|
+
*
|
|
15
|
+
* @description: request method
|
|
16
|
+
*/
|
|
17
|
+
export declare enum RequestEnum {
|
|
18
|
+
GET = "GET",
|
|
19
|
+
POST = "POST",
|
|
20
|
+
PUT = "PUT",
|
|
21
|
+
DELETE = "DELETE"
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 内容类型枚举
|
|
25
|
+
*
|
|
26
|
+
* @description: contentType
|
|
27
|
+
*/
|
|
28
|
+
export declare enum ContentTypeEnum {
|
|
29
|
+
JSON = "application/json;charset=UTF-8",
|
|
30
|
+
FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
|
|
31
|
+
FORM_DATA = "multipart/form-data;charset=UTF-8"
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 业务服务枚举
|
|
35
|
+
*
|
|
36
|
+
* @description: Business service enum
|
|
37
|
+
*/
|
|
38
|
+
export declare enum BizServiceEnum {
|
|
39
|
+
submit = "post",
|
|
40
|
+
listByIds = "get",
|
|
41
|
+
getone = "post",
|
|
42
|
+
listAll = "post",
|
|
43
|
+
listByPage = "post",
|
|
44
|
+
listTree = "post",
|
|
45
|
+
save = "post",
|
|
46
|
+
saveOrUpdate = "post",
|
|
47
|
+
saveBatch = "post",
|
|
48
|
+
importData = "post",
|
|
49
|
+
exportData = "post",
|
|
50
|
+
remove = "post",
|
|
51
|
+
removeById = "delete",
|
|
52
|
+
removeByIds = "delete",
|
|
53
|
+
update = "put",
|
|
54
|
+
updateById = "put",
|
|
55
|
+
updateByIds = "put",
|
|
56
|
+
rdoSave = "post",
|
|
57
|
+
rdoListAll = "post",
|
|
58
|
+
rdoListByPage = "post",
|
|
59
|
+
rdoListVersionById = "get",
|
|
60
|
+
rdoSaveVersion = "post",
|
|
61
|
+
rdoSaveBatch = "post",
|
|
62
|
+
rdoUpdateVersionById = "put",
|
|
63
|
+
rdoRemoveVersionById = "delete",
|
|
64
|
+
rdoRemoveById = "delete",
|
|
65
|
+
rdoGetVersionById = "get",
|
|
66
|
+
getOne = "post",
|
|
67
|
+
rdoGetVersionByRefId = "post",
|
|
68
|
+
getById = "get",
|
|
69
|
+
rdoListAllVersion = "post",
|
|
70
|
+
rdoRefListByPage = "post",
|
|
71
|
+
export = "post",
|
|
72
|
+
import = "post",
|
|
73
|
+
rdoExport = "post",
|
|
74
|
+
rdoImport = "post",
|
|
75
|
+
biz_search = "post"
|
|
76
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export var ResultEnum = /* @__PURE__ */ ((ResultEnum2) => {
|
|
2
|
+
ResultEnum2[ResultEnum2["SUCCESS"] = 200] = "SUCCESS";
|
|
3
|
+
ResultEnum2[ResultEnum2["ERROR"] = -1] = "ERROR";
|
|
4
|
+
ResultEnum2[ResultEnum2["TIMEOUT"] = 401] = "TIMEOUT";
|
|
5
|
+
ResultEnum2["TYPE"] = "success";
|
|
6
|
+
return ResultEnum2;
|
|
7
|
+
})(ResultEnum || {});
|
|
8
|
+
export var RequestEnum = /* @__PURE__ */ ((RequestEnum2) => {
|
|
9
|
+
RequestEnum2["GET"] = "GET";
|
|
10
|
+
RequestEnum2["POST"] = "POST";
|
|
11
|
+
RequestEnum2["PUT"] = "PUT";
|
|
12
|
+
RequestEnum2["DELETE"] = "DELETE";
|
|
13
|
+
return RequestEnum2;
|
|
14
|
+
})(RequestEnum || {});
|
|
15
|
+
export var ContentTypeEnum = /* @__PURE__ */ ((ContentTypeEnum2) => {
|
|
16
|
+
ContentTypeEnum2["JSON"] = "application/json;charset=UTF-8";
|
|
17
|
+
ContentTypeEnum2["FORM_URLENCODED"] = "application/x-www-form-urlencoded;charset=UTF-8";
|
|
18
|
+
ContentTypeEnum2["FORM_DATA"] = "multipart/form-data;charset=UTF-8";
|
|
19
|
+
return ContentTypeEnum2;
|
|
20
|
+
})(ContentTypeEnum || {});
|
|
21
|
+
export var BizServiceEnum = /* @__PURE__ */ ((BizServiceEnum2) => {
|
|
22
|
+
BizServiceEnum2["submit"] = "post";
|
|
23
|
+
BizServiceEnum2["listByIds"] = "get";
|
|
24
|
+
BizServiceEnum2["getone"] = "post";
|
|
25
|
+
BizServiceEnum2["listAll"] = "post";
|
|
26
|
+
BizServiceEnum2["listByPage"] = "post";
|
|
27
|
+
BizServiceEnum2["listTree"] = "post";
|
|
28
|
+
BizServiceEnum2["save"] = "post";
|
|
29
|
+
BizServiceEnum2["saveOrUpdate"] = "post";
|
|
30
|
+
BizServiceEnum2["saveBatch"] = "post";
|
|
31
|
+
BizServiceEnum2["importData"] = "post";
|
|
32
|
+
BizServiceEnum2["exportData"] = "post";
|
|
33
|
+
BizServiceEnum2["remove"] = "post";
|
|
34
|
+
BizServiceEnum2["removeById"] = "delete";
|
|
35
|
+
BizServiceEnum2["removeByIds"] = "delete";
|
|
36
|
+
BizServiceEnum2["update"] = "put";
|
|
37
|
+
BizServiceEnum2["updateById"] = "put";
|
|
38
|
+
BizServiceEnum2["updateByIds"] = "put";
|
|
39
|
+
BizServiceEnum2["rdoSave"] = "post";
|
|
40
|
+
BizServiceEnum2["rdoListAll"] = "post";
|
|
41
|
+
BizServiceEnum2["rdoListByPage"] = "post";
|
|
42
|
+
BizServiceEnum2["rdoListVersionById"] = "get";
|
|
43
|
+
BizServiceEnum2["rdoSaveVersion"] = "post";
|
|
44
|
+
BizServiceEnum2["rdoSaveBatch"] = "post";
|
|
45
|
+
BizServiceEnum2["rdoUpdateVersionById"] = "put";
|
|
46
|
+
BizServiceEnum2["rdoRemoveVersionById"] = "delete";
|
|
47
|
+
BizServiceEnum2["rdoRemoveById"] = "delete";
|
|
48
|
+
BizServiceEnum2["rdoGetVersionById"] = "get";
|
|
49
|
+
BizServiceEnum2["getOne"] = "post";
|
|
50
|
+
BizServiceEnum2["rdoGetVersionByRefId"] = "post";
|
|
51
|
+
BizServiceEnum2["getById"] = "get";
|
|
52
|
+
BizServiceEnum2["rdoListAllVersion"] = "post";
|
|
53
|
+
BizServiceEnum2["rdoRefListByPage"] = "post";
|
|
54
|
+
BizServiceEnum2["export"] = "post";
|
|
55
|
+
BizServiceEnum2["import"] = "post";
|
|
56
|
+
BizServiceEnum2["rdoExport"] = "post";
|
|
57
|
+
BizServiceEnum2["rdoImport"] = "post";
|
|
58
|
+
BizServiceEnum2["biz_search"] = "post";
|
|
59
|
+
return BizServiceEnum2;
|
|
60
|
+
})(BizServiceEnum || {});
|