@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,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ApiManage = void 0;
|
|
7
|
+
var _pathBrowserify = _interopRequireDefault(require("path-browserify"));
|
|
8
|
+
var _apiService = require("./api-service.cjs");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
class ApiManage {
|
|
11
|
+
/**
|
|
12
|
+
* 根据 api 配置挂载请求对象以及方法
|
|
13
|
+
*
|
|
14
|
+
* @author chitanda
|
|
15
|
+
* @date 2025-08-21 18:08:04
|
|
16
|
+
* @param {string} url 服务基础 URL
|
|
17
|
+
* @param {ApiConfigItem[]} configs API 配置项数组
|
|
18
|
+
*/
|
|
19
|
+
constructor(url, configs) {
|
|
20
|
+
return new Proxy(this, {
|
|
21
|
+
get(manage, property) {
|
|
22
|
+
const config = configs.find(item => item.name === property);
|
|
23
|
+
if (!config) {
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
if (!(property in manage)) {
|
|
27
|
+
manage[property] = new _apiService.ApiService(_pathBrowserify.default.join(url, config.entityName), config);
|
|
28
|
+
}
|
|
29
|
+
return manage[property];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ApiManage = ApiManage;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ApiService = void 0;
|
|
7
|
+
var _pathBrowserify = _interopRequireDefault(require("path-browserify"));
|
|
8
|
+
var _http = require("./http.util.cjs");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
class ApiService {
|
|
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, config) {
|
|
19
|
+
this.url = url;
|
|
20
|
+
return new Proxy(this, {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
get(api, property) {
|
|
23
|
+
if (!(property in api)) {
|
|
24
|
+
const cfg = config.apis.find(item => item.method === property);
|
|
25
|
+
if (cfg) {
|
|
26
|
+
const modeFn = `_${cfg.mode}`;
|
|
27
|
+
if (cfg.hasData && cfg.hasQuery) {
|
|
28
|
+
api[property] = (data, query, config2) => {
|
|
29
|
+
return api[modeFn](cfg.path, query, data, config2);
|
|
30
|
+
};
|
|
31
|
+
} else if (cfg.hasData) {
|
|
32
|
+
api[property] = function (data, config2) {
|
|
33
|
+
return api[modeFn](cfg.path, data, void 0, config2);
|
|
34
|
+
};
|
|
35
|
+
} else if (cfg.hasQuery) {
|
|
36
|
+
api[property] = function (query, config2) {
|
|
37
|
+
return api[modeFn](cfg.path, void 0, query, config2);
|
|
38
|
+
};
|
|
39
|
+
} else {
|
|
40
|
+
api[property] = function (config2) {
|
|
41
|
+
return api[modeFn](cfg.path, void 0, void 0, config2);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return api[property];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* PUT 请求方法
|
|
52
|
+
*
|
|
53
|
+
* @protected
|
|
54
|
+
* @param {string} method 请求方法路径
|
|
55
|
+
* @param {(IObject | null)} data 请求数据
|
|
56
|
+
* @param {(IParams | null)} query 查询参数
|
|
57
|
+
* @param {IParams} config 请求配置
|
|
58
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
59
|
+
*/
|
|
60
|
+
_put(method, data, query, config) {
|
|
61
|
+
return _http.HttpUtil.put(query?.id ? _pathBrowserify.default.join(this.url, method, query.id) : _pathBrowserify.default.join(this.url, method), data || {}, query || {}, config);
|
|
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 _http.HttpUtil.get(_pathBrowserify.default.join(this.url, method), data || {}, query || {}, config);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* DELETE 请求方法
|
|
78
|
+
*
|
|
79
|
+
* @protected
|
|
80
|
+
* @param {string} method 请求方法路径
|
|
81
|
+
* @param {(IObject | null)} data 请求数据
|
|
82
|
+
* @param {(IParams | null)} query 查询参数
|
|
83
|
+
* @param {IParams} config 请求配置
|
|
84
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
85
|
+
*/
|
|
86
|
+
_delete(method, data, query, config) {
|
|
87
|
+
return _http.HttpUtil.delete(_pathBrowserify.default.join(this.url, method), data || {}, query || {}, config);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* POST 请求方法
|
|
91
|
+
*
|
|
92
|
+
* @protected
|
|
93
|
+
* @param {string} method 请求方法路径
|
|
94
|
+
* @param {(IObject | null)} data 请求数据
|
|
95
|
+
* @param {(IParams | null)} query 查询参数
|
|
96
|
+
* @param {IParams} config 请求配置
|
|
97
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
98
|
+
*/
|
|
99
|
+
_post(method, data, query, config) {
|
|
100
|
+
return _http.HttpUtil.post(_pathBrowserify.default.join(this.url, method), data || {}, query || {}, config);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* OPTIONS 请求方法
|
|
104
|
+
*
|
|
105
|
+
* @protected
|
|
106
|
+
* @param {string} method 请求方法路径
|
|
107
|
+
* @param {(IObject | null)} data 请求数据
|
|
108
|
+
* @param {(IParams | null)} query 查询参数
|
|
109
|
+
* @param {IParams} config 请求配置
|
|
110
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
111
|
+
*/
|
|
112
|
+
_options(method, data, query, config) {
|
|
113
|
+
return _http.HttpUtil.options(_pathBrowserify.default.join(this.url, method), data || {}, query || {}, config);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* PATCH 请求方法
|
|
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
|
+
_patch(method, data, query, config) {
|
|
126
|
+
return _http.HttpUtil.patch(_pathBrowserify.default.join(this.url, method), data || {}, query || {}, config);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* HEAD 请求方法
|
|
130
|
+
*
|
|
131
|
+
* @protected
|
|
132
|
+
* @param {string} method 请求方法路径
|
|
133
|
+
* @param {(IObject | null)} data 请求数据
|
|
134
|
+
* @param {(IParams | null)} query 查询参数
|
|
135
|
+
* @param {IParams} config 请求配置
|
|
136
|
+
* @returns {Promise<IHttpResponse>} 请求结果
|
|
137
|
+
*/
|
|
138
|
+
_head(method, data, query, config) {
|
|
139
|
+
return _http.HttpUtil.head(_pathBrowserify.default.join(this.url, method), data || {}, query || {}, config);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.ApiService = ApiService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResultEnum = exports.RequestEnum = exports.ContentTypeEnum = exports.BizServiceEnum = void 0;
|
|
7
|
+
var ResultEnum = exports.ResultEnum = /* @__PURE__ */(ResultEnum2 => {
|
|
8
|
+
ResultEnum2[ResultEnum2["SUCCESS"] = 200] = "SUCCESS";
|
|
9
|
+
ResultEnum2[ResultEnum2["ERROR"] = -1] = "ERROR";
|
|
10
|
+
ResultEnum2[ResultEnum2["TIMEOUT"] = 401] = "TIMEOUT";
|
|
11
|
+
ResultEnum2["TYPE"] = "success";
|
|
12
|
+
return ResultEnum2;
|
|
13
|
+
})(ResultEnum || {});
|
|
14
|
+
var RequestEnum = exports.RequestEnum = /* @__PURE__ */(RequestEnum2 => {
|
|
15
|
+
RequestEnum2["GET"] = "GET";
|
|
16
|
+
RequestEnum2["POST"] = "POST";
|
|
17
|
+
RequestEnum2["PUT"] = "PUT";
|
|
18
|
+
RequestEnum2["DELETE"] = "DELETE";
|
|
19
|
+
return RequestEnum2;
|
|
20
|
+
})(RequestEnum || {});
|
|
21
|
+
var ContentTypeEnum = exports.ContentTypeEnum = /* @__PURE__ */(ContentTypeEnum2 => {
|
|
22
|
+
ContentTypeEnum2["JSON"] = "application/json;charset=UTF-8";
|
|
23
|
+
ContentTypeEnum2["FORM_URLENCODED"] = "application/x-www-form-urlencoded;charset=UTF-8";
|
|
24
|
+
ContentTypeEnum2["FORM_DATA"] = "multipart/form-data;charset=UTF-8";
|
|
25
|
+
return ContentTypeEnum2;
|
|
26
|
+
})(ContentTypeEnum || {});
|
|
27
|
+
var BizServiceEnum = exports.BizServiceEnum = /* @__PURE__ */(BizServiceEnum2 => {
|
|
28
|
+
BizServiceEnum2["submit"] = "post";
|
|
29
|
+
BizServiceEnum2["listByIds"] = "get";
|
|
30
|
+
BizServiceEnum2["getone"] = "post";
|
|
31
|
+
BizServiceEnum2["listAll"] = "post";
|
|
32
|
+
BizServiceEnum2["listByPage"] = "post";
|
|
33
|
+
BizServiceEnum2["listTree"] = "post";
|
|
34
|
+
BizServiceEnum2["save"] = "post";
|
|
35
|
+
BizServiceEnum2["saveOrUpdate"] = "post";
|
|
36
|
+
BizServiceEnum2["saveBatch"] = "post";
|
|
37
|
+
BizServiceEnum2["importData"] = "post";
|
|
38
|
+
BizServiceEnum2["exportData"] = "post";
|
|
39
|
+
BizServiceEnum2["remove"] = "post";
|
|
40
|
+
BizServiceEnum2["removeById"] = "delete";
|
|
41
|
+
BizServiceEnum2["removeByIds"] = "delete";
|
|
42
|
+
BizServiceEnum2["update"] = "put";
|
|
43
|
+
BizServiceEnum2["updateById"] = "put";
|
|
44
|
+
BizServiceEnum2["updateByIds"] = "put";
|
|
45
|
+
BizServiceEnum2["rdoSave"] = "post";
|
|
46
|
+
BizServiceEnum2["rdoListAll"] = "post";
|
|
47
|
+
BizServiceEnum2["rdoListByPage"] = "post";
|
|
48
|
+
BizServiceEnum2["rdoListVersionById"] = "get";
|
|
49
|
+
BizServiceEnum2["rdoSaveVersion"] = "post";
|
|
50
|
+
BizServiceEnum2["rdoSaveBatch"] = "post";
|
|
51
|
+
BizServiceEnum2["rdoUpdateVersionById"] = "put";
|
|
52
|
+
BizServiceEnum2["rdoRemoveVersionById"] = "delete";
|
|
53
|
+
BizServiceEnum2["rdoRemoveById"] = "delete";
|
|
54
|
+
BizServiceEnum2["rdoGetVersionById"] = "get";
|
|
55
|
+
BizServiceEnum2["getOne"] = "post";
|
|
56
|
+
BizServiceEnum2["rdoGetVersionByRefId"] = "post";
|
|
57
|
+
BizServiceEnum2["getById"] = "get";
|
|
58
|
+
BizServiceEnum2["rdoListAllVersion"] = "post";
|
|
59
|
+
BizServiceEnum2["rdoRefListByPage"] = "post";
|
|
60
|
+
BizServiceEnum2["export"] = "post";
|
|
61
|
+
BizServiceEnum2["import"] = "post";
|
|
62
|
+
BizServiceEnum2["rdoExport"] = "post";
|
|
63
|
+
BizServiceEnum2["rdoImport"] = "post";
|
|
64
|
+
BizServiceEnum2["biz_search"] = "post";
|
|
65
|
+
return BizServiceEnum2;
|
|
66
|
+
})(BizServiceEnum || {});
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HttpUtil = void 0;
|
|
7
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
8
|
+
var _qs = _interopRequireDefault(require("qs"));
|
|
9
|
+
var _http = require("./http.enum.cjs");
|
|
10
|
+
var _utils = require("../utils/index.cjs");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const instance = _axios.default.create();
|
|
13
|
+
class HttpUtil {
|
|
14
|
+
/**
|
|
15
|
+
* 挂载中间件
|
|
16
|
+
*
|
|
17
|
+
* @static
|
|
18
|
+
* @param {(_axios: AxiosInstance) => void} fn 中间件函数
|
|
19
|
+
*/
|
|
20
|
+
static use(fn) {
|
|
21
|
+
fn(instance);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* GET 请求方法
|
|
25
|
+
*
|
|
26
|
+
* @static
|
|
27
|
+
* @template T
|
|
28
|
+
* @param {string} url 请求地址
|
|
29
|
+
* @param {IObject} [data={}] 请求数据
|
|
30
|
+
* @param {IParams} [query={}] 查询参数
|
|
31
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
32
|
+
* @returns {Promise<IHttpResponse<T>>} 请求结果
|
|
33
|
+
*/
|
|
34
|
+
static get(url, data = {}, query = {}, config = {}) {
|
|
35
|
+
return this.request(url, data, query, {
|
|
36
|
+
...config,
|
|
37
|
+
method: "GET"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* POST 请求方法
|
|
42
|
+
*
|
|
43
|
+
* @static
|
|
44
|
+
* @template T
|
|
45
|
+
* @param {string} url 请求地址
|
|
46
|
+
* @param {IObject} [data={}] 请求数据
|
|
47
|
+
* @param {IParams} [query={}] 查询参数
|
|
48
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
49
|
+
* @returns {Promise<IHttpResponse<T>>} 请求结果
|
|
50
|
+
*/
|
|
51
|
+
static post(url, data = {}, query = {}, config = {}) {
|
|
52
|
+
return this.request(url, data, query, {
|
|
53
|
+
...config,
|
|
54
|
+
method: "POST"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* PUT 请求方法
|
|
59
|
+
*
|
|
60
|
+
* @static
|
|
61
|
+
* @template T
|
|
62
|
+
* @param {string} url 请求地址
|
|
63
|
+
* @param {IObject} [data={}] 请求数据
|
|
64
|
+
* @param {IParams} [query={}] 查询参数
|
|
65
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
66
|
+
* @returns {Promise<IHttpResponse<T>>} 请求结果
|
|
67
|
+
*/
|
|
68
|
+
static put(url, data = {}, query = {}, config = {}) {
|
|
69
|
+
return this.request(url, data, query, {
|
|
70
|
+
...config,
|
|
71
|
+
method: "PUT"
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* DELETE 请求方法
|
|
76
|
+
*
|
|
77
|
+
* @static
|
|
78
|
+
* @template T
|
|
79
|
+
* @param {string} url 请求地址
|
|
80
|
+
* @param {IObject} [data={}] 请求数据
|
|
81
|
+
* @param {IParams} [query={}] 查询参数
|
|
82
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
83
|
+
* @returns {Promise<IHttpResponse<T>>} 请求结果
|
|
84
|
+
*/
|
|
85
|
+
static delete(url, data = {}, query = {}, config = {}) {
|
|
86
|
+
return this.request(url, data, query, {
|
|
87
|
+
...config,
|
|
88
|
+
method: "DELETE"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* OPTIONS 请求方法
|
|
93
|
+
*
|
|
94
|
+
* @static
|
|
95
|
+
* @template T
|
|
96
|
+
* @param {string} url 请求地址
|
|
97
|
+
* @param {IObject} [data={}] 请求数据
|
|
98
|
+
* @param {IParams} [query={}] 查询参数
|
|
99
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
100
|
+
* @returns {Promise<IHttpResponse<T>>} 请求结果
|
|
101
|
+
*/
|
|
102
|
+
static options(url, data = {}, query = {}, config = {}) {
|
|
103
|
+
return this.request(url, data, query, {
|
|
104
|
+
...config,
|
|
105
|
+
method: "OPTIONS"
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* PATCH 请求方法
|
|
110
|
+
*
|
|
111
|
+
* @static
|
|
112
|
+
* @template T
|
|
113
|
+
* @param {string} url 请求地址
|
|
114
|
+
* @param {IObject} [data={}] 请求数据
|
|
115
|
+
* @param {IParams} [query={}] 查询参数
|
|
116
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
117
|
+
* @returns {Promise<IHttpResponse<T>>} 请求结果
|
|
118
|
+
*/
|
|
119
|
+
static patch(url, data = {}, query = {}, config = {}) {
|
|
120
|
+
return this.request(url, data, query, {
|
|
121
|
+
...config,
|
|
122
|
+
method: "PATCH"
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* HEAD 请求方法
|
|
127
|
+
*
|
|
128
|
+
* @static
|
|
129
|
+
* @template T
|
|
130
|
+
* @param {string} url 请求地址
|
|
131
|
+
* @param {IObject} [data={}] 请求数据
|
|
132
|
+
* @param {IParams} [query={}] 查询参数
|
|
133
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
134
|
+
* @returns {Promise<IHttpResponse<T>>} 请求结果
|
|
135
|
+
*/
|
|
136
|
+
static head(url, data = {}, query = {}, config = {}) {
|
|
137
|
+
return this.request(url, data, query, {
|
|
138
|
+
...config,
|
|
139
|
+
method: "HEAD"
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 通用请求方法
|
|
144
|
+
*
|
|
145
|
+
* @static
|
|
146
|
+
* @template T
|
|
147
|
+
* @param {string} url 请求地址
|
|
148
|
+
* @param {(IObject | null)} data 请求数据
|
|
149
|
+
* @param {(IParams | null)} query 查询参数
|
|
150
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
151
|
+
* @returns {Promise<IHttpResponse<T>>} 请求结果
|
|
152
|
+
*/
|
|
153
|
+
static async request(url, data, query, config = {}) {
|
|
154
|
+
if (query) {
|
|
155
|
+
const queryStr = _qs.default.stringify(query, {
|
|
156
|
+
arrayFormat: "brackets"
|
|
157
|
+
});
|
|
158
|
+
if (queryStr) {
|
|
159
|
+
if (url.includes("?")) {
|
|
160
|
+
url += `&${queryStr}`;
|
|
161
|
+
} else {
|
|
162
|
+
url += `?${queryStr}`;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const res = await instance.request((0, _utils.deepMerge)({
|
|
167
|
+
url,
|
|
168
|
+
data: JSON.stringify(data ? data : {}),
|
|
169
|
+
params: query,
|
|
170
|
+
timeout: 2 * 60 * 1e3,
|
|
171
|
+
headers: {
|
|
172
|
+
"Content-Type": _http.ContentTypeEnum.JSON
|
|
173
|
+
}
|
|
174
|
+
}, config));
|
|
175
|
+
if (res.status >= 200 && res.status < 300) {
|
|
176
|
+
return res.data;
|
|
177
|
+
}
|
|
178
|
+
throw res;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.HttpUtil = HttpUtil;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BizServiceEnum", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _http.BizServiceEnum;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ContentTypeEnum", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _http.ContentTypeEnum;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "HttpUtil", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _http2.HttpUtil;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "RequestEnum", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _http.RequestEnum;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "ResultEnum", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _http.ResultEnum;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
exports.api = void 0;
|
|
37
|
+
var _apaas = require("../apaas/index.cjs");
|
|
38
|
+
var _platform = require("../platform/index.cjs");
|
|
39
|
+
var _apiManage = require("./api-manage.cjs");
|
|
40
|
+
var _http = require("./http.enum.cjs");
|
|
41
|
+
var _http2 = require("./http.util.cjs");
|
|
42
|
+
const api = exports.api = {
|
|
43
|
+
apaas: new _apiManage.ApiManage("/gct-apaas/api", _apaas.apiConfig),
|
|
44
|
+
platform: new _apiManage.ApiManage("/gct-platform/api", _platform.apiConfig)
|
|
45
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deepMerge = deepMerge;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
function deepMerge(target, source) {
|
|
9
|
+
return (0, _lodashEs.mergeWith)((0, _lodashEs.cloneDeep)(target), source, (objValue, srcValue) => {
|
|
10
|
+
if (typeof objValue === "object" && typeof srcValue === "object") {
|
|
11
|
+
return (0, _lodashEs.mergeWith)((0, _lodashEs.cloneDeep)(objValue), srcValue, (prevValue, nextValue) => {
|
|
12
|
+
return Array.isArray(prevValue) ? (0, _lodashEs.unionWith)(prevValue, nextValue, _lodashEs.isEqual) : void 0;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/api",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.3",
|
|
4
4
|
"description": "paas 平台底包",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"paas",
|
|
7
8
|
"gct"
|
|
@@ -16,24 +17,15 @@
|
|
|
16
17
|
"node": ">=18.12.0",
|
|
17
18
|
"pnpm": ">=10.0.0"
|
|
18
19
|
},
|
|
20
|
+
"types": "./es/index.d.ts",
|
|
21
|
+
"main": "./lib/index.cjs",
|
|
22
|
+
"module": "./es/index.mjs",
|
|
19
23
|
"exports": {
|
|
20
|
-
"
|
|
21
|
-
"types": "./es/
|
|
22
|
-
"import": "./es/
|
|
23
|
-
"require": "./lib/
|
|
24
|
-
"system": "./dist/api
|
|
25
|
-
},
|
|
26
|
-
"./ipaas": {
|
|
27
|
-
"types": "./es/ipaas/index.d.ts",
|
|
28
|
-
"import": "./es/ipaas/index.mjs",
|
|
29
|
-
"require": "./lib/ipaas/index.cjs",
|
|
30
|
-
"system": "./dist/api-ipaas.system.js"
|
|
31
|
-
},
|
|
32
|
-
"./platform": {
|
|
33
|
-
"types": "./es/platform/index.d.ts",
|
|
34
|
-
"import": "./es/platform/index.mjs",
|
|
35
|
-
"require": "./lib/platform/index.cjs",
|
|
36
|
-
"system": "./dist/api-platform.system.js"
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./es/index.d.ts",
|
|
26
|
+
"import": "./es/index.mjs",
|
|
27
|
+
"require": "./lib/index.cjs",
|
|
28
|
+
"system": "./dist/gct-api.system.min.js"
|
|
37
29
|
}
|
|
38
30
|
},
|
|
39
31
|
"files": [
|
|
@@ -42,7 +34,7 @@
|
|
|
42
34
|
"lib"
|
|
43
35
|
],
|
|
44
36
|
"scripts": {
|
|
45
|
-
"build": "
|
|
37
|
+
"build": "rollup -c rollup.config.js && unbuild",
|
|
46
38
|
"lint": "eslint './src' --fix",
|
|
47
39
|
"prettier": "prettier './src' --write",
|
|
48
40
|
"prepare": "husky",
|
|
@@ -51,32 +43,40 @@
|
|
|
51
43
|
"publish:test": "npm publish --access public --tag=test --registry=https://registry.npmjs.org/",
|
|
52
44
|
"publish:beta": "npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
|
|
53
45
|
"publish:npm": "npm publish --access public --registry=https://registry.npmjs.org/",
|
|
54
|
-
"gen-api:dev": "./script/gen-api.
|
|
55
|
-
"gen-api:
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
"gen-api:dev": "./script/gen-api.sh http://paas.paasdev.gct-paas.com",
|
|
47
|
+
"gen-api:test": "./script/gen-api.sh"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"axios": "^1.13.2",
|
|
51
|
+
"lodash-es": "^4.17.23",
|
|
52
|
+
"path-browserify": "^1.0.1",
|
|
53
|
+
"qs": "^6.14.1"
|
|
58
54
|
},
|
|
59
55
|
"devDependencies": {
|
|
60
|
-
"@babel/preset-env": "^7.28.
|
|
61
|
-
"@commitlint/cli": "^
|
|
62
|
-
"@gct-paas/build": "0.1.4
|
|
63
|
-
"@gct-paas/cli": "^0.1.4
|
|
64
|
-
"@rollup/plugin-commonjs": "^
|
|
65
|
-
"@rollup/plugin-
|
|
66
|
-
"@rollup/plugin-
|
|
56
|
+
"@babel/preset-env": "^7.28.6",
|
|
57
|
+
"@commitlint/cli": "^20.3.1",
|
|
58
|
+
"@gct-paas/build": "0.1.4",
|
|
59
|
+
"@gct-paas/cli": "^0.1.4",
|
|
60
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
61
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
62
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
63
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
67
64
|
"@types/fs-extra": "^11.0.4",
|
|
68
65
|
"@types/lodash-es": "^4.17.12",
|
|
69
|
-
"@types/node": "^
|
|
70
|
-
"@types/
|
|
71
|
-
"
|
|
66
|
+
"@types/node": "^25.0.10",
|
|
67
|
+
"@types/path-browserify": "^1.0.3",
|
|
68
|
+
"@types/qs": "^6.14.0",
|
|
69
|
+
"@types/systemjs": "^6.15.4",
|
|
70
|
+
"@vue/tsconfig": "^0.8.1",
|
|
71
|
+
"eslint": "^9.39.2",
|
|
72
72
|
"husky": "^9.1.7",
|
|
73
|
-
"lint-staged": "^16.
|
|
74
|
-
"prettier": "^3.
|
|
75
|
-
"rimraf": "^6.
|
|
76
|
-
"rollup": "^4.
|
|
73
|
+
"lint-staged": "^16.2.7",
|
|
74
|
+
"prettier": "^3.8.1",
|
|
75
|
+
"rimraf": "^6.1.2",
|
|
76
|
+
"rollup": "^4.56.0",
|
|
77
77
|
"rollup-plugin-esbuild": "^6.2.1",
|
|
78
78
|
"ts-node": "^10.9.2",
|
|
79
|
-
"typescript": "^5.9.
|
|
79
|
+
"typescript": "^5.9.3",
|
|
80
80
|
"unbuild": "^3.6.1"
|
|
81
81
|
}
|
|
82
82
|
}
|