@gct-paas/api 0.1.6-dev.6 → 0.1.6-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.js +1 -0
- package/es/apaas/service/api-config.mjs +452 -5
- package/es/apaas/service/apis/app-global-settings.service.d.ts +0 -4
- package/es/apaas/service/apis/app-org.service.d.ts +0 -4
- package/es/apaas/service/apis/approve.service.d.ts +54 -0
- package/es/apaas/service/apis/audit-log.service.d.ts +7 -0
- package/es/apaas/service/apis/category.service.d.ts +8 -0
- package/es/apaas/service/apis/data-source.service.d.ts +4 -0
- package/es/apaas/service/apis/detail-page.service.d.ts +96 -0
- package/es/apaas/service/apis/dhr.service.d.ts +2 -2
- package/es/apaas/service/apis/doc-control-started.service.d.ts +76 -1
- package/es/apaas/service/apis/doc-control-task-todo.service.d.ts +12 -0
- package/es/apaas/service/apis/edhr-instance.service.d.ts +16 -0
- package/es/apaas/service/apis/edhr-tmpl.service.d.ts +18 -5
- package/es/apaas/service/apis/enum-model-field.service.d.ts +8 -0
- package/es/apaas/service/apis/excel.service.d.ts +6 -2
- package/es/apaas/service/apis/field-meta.service.d.ts +21 -0
- package/es/apaas/service/apis/file.service.d.ts +4 -0
- package/es/apaas/service/apis/inspection-category.service.d.ts +84 -0
- package/es/apaas/service/apis/label.service.d.ts +11 -3
- package/es/apaas/service/apis/med-pro.service.d.ts +108 -0
- package/es/apaas/service/apis/medPro.service.d.ts +49 -21
- package/es/apaas/service/apis/model-meta.service.d.ts +15 -1
- package/es/apaas/service/apis/model-method.service.d.ts +19 -1
- package/es/apaas/service/apis/online-form-instance.service.d.ts +78 -0
- package/es/apaas/service/apis/online-form-tmpl-export.service.d.ts +29 -0
- package/es/apaas/service/apis/online-form-tmpl.service.d.ts +77 -0
- package/es/apaas/service/apis/online-form.service.d.ts +8 -1
- package/es/apaas/service/apis/process-task-done.service.d.ts +28 -1
- package/es/apaas/service/apis/process-task-todo.service.d.ts +44 -1
- package/es/apaas/service/apis/product-release-category.service.d.ts +84 -0
- package/es/apaas/service/apis/ss.service.d.ts +8 -0
- package/es/apaas/service/apis/transaction.service.d.ts +157 -0
- package/es/apaas/service/apis/user.service.d.ts +31 -0
- package/es/apaas/service/entities.d.ts +3159 -76
- package/es/apaas/service/index.d.ts +14 -0
- package/es/ipaas/service/api-config.mjs +29 -5
- package/es/ipaas/service/apis/camel.service.d.ts +18 -5
- package/es/ipaas/service/apis/flow.service.d.ts +77 -1
- package/es/ipaas/service/apis/runtime.service.d.ts +13 -0
- package/es/ipaas/service/entities.d.ts +168 -0
- package/es/platform/service/api-config.mjs +48 -2
- package/es/platform/service/apis/api.service.d.ts +52 -1
- package/es/platform/service/apis/bi-app.service.d.ts +4 -3
- package/es/platform/service/apis/file-task.service.d.ts +13 -0
- package/es/platform/service/apis/invoke-log.service.d.ts +17 -1
- package/es/platform/service/apis/license.service.d.ts +18 -0
- package/es/platform/service/apis/login-log.service.d.ts +13 -0
- package/es/platform/service/apis/plat.service.d.ts +7 -0
- package/es/platform/service/entities.d.ts +529 -4
- package/es/service/api-manage.mjs +2 -2
- package/es/service/api-service.d.ts +13 -0
- package/es/service/api-service.interface.d.ts +6 -9
- package/es/service/api-service.mjs +42 -17
- package/es/service/http.util.d.ts +8 -1
- package/es/service/http.util.mjs +22 -4
- package/es/service/index.mjs +1 -3
- package/es/types/index.d.ts +27 -0
- package/es/utils/index.d.ts +7 -0
- package/es/utils/index.mjs +6 -0
- package/package.json +1 -1
- package/dist/gct-api.esm.min.js +0 -1
- package/dist/gct-api.system.min.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { joinPath } from "../utils/index.mjs";
|
|
2
2
|
import { ApiService } from "./api-service.mjs";
|
|
3
3
|
export class ApiManage {
|
|
4
4
|
/**
|
|
@@ -18,7 +18,7 @@ export class ApiManage {
|
|
|
18
18
|
}
|
|
19
19
|
if (!(property in manage)) {
|
|
20
20
|
manage[property] = new ApiService(
|
|
21
|
-
|
|
21
|
+
joinPath(url, config.entityName),
|
|
22
22
|
config
|
|
23
23
|
);
|
|
24
24
|
}
|
|
@@ -101,4 +101,17 @@ export declare class ApiService {
|
|
|
101
101
|
* @returns {Promise<T>} 请求结果
|
|
102
102
|
*/
|
|
103
103
|
protected _head<T = unknown>(method: string, pathParams?: IParams, query?: IParams, data?: IObject, config?: Partial<AxiosRequestConfig>): Promise<T>;
|
|
104
|
+
/**
|
|
105
|
+
* 文件上传方法
|
|
106
|
+
*
|
|
107
|
+
* @protected
|
|
108
|
+
* @template T
|
|
109
|
+
* @param {string} method 请求方法路径
|
|
110
|
+
* @param {IObject} [pathParams] 路径参数
|
|
111
|
+
* @param {IParams} [query] 查询参数
|
|
112
|
+
* @param {Partial<UploadFileData>} [data] 上传数据
|
|
113
|
+
* @param {Partial<AxiosRequestConfig>} [config] 请求配置
|
|
114
|
+
* @return {*} {Promise<T>} 请求结果
|
|
115
|
+
*/
|
|
116
|
+
protected _upload<T = unknown>(method: string, pathParams?: IObject, query?: IParams, data?: Partial<UploadFileData>, config?: Partial<AxiosRequestConfig>): Promise<T>;
|
|
104
117
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ApiManage as APaasApiManage } from '../apaas';
|
|
2
2
|
import { type ApiManage as PlatformApiManage } from '../platform';
|
|
3
|
-
import { type ApiManage as IPaasApiManage } from '../ipaas';
|
|
4
3
|
/**
|
|
5
4
|
* HTTP 响应接口
|
|
6
5
|
*
|
|
@@ -99,6 +98,12 @@ export interface ApiItem {
|
|
|
99
98
|
* @type {boolean}
|
|
100
99
|
*/
|
|
101
100
|
hasData?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* 是否为文件上传
|
|
103
|
+
*
|
|
104
|
+
* @type {boolean}
|
|
105
|
+
*/
|
|
106
|
+
hasUpload?: boolean;
|
|
102
107
|
}
|
|
103
108
|
/**
|
|
104
109
|
* 接口配置项
|
|
@@ -159,12 +164,4 @@ export interface ApiMap {
|
|
|
159
164
|
* @type {PlatformApiManage}
|
|
160
165
|
*/
|
|
161
166
|
platform: PlatformApiManage;
|
|
162
|
-
/**
|
|
163
|
-
* IPaas 平台 API 管理
|
|
164
|
-
*
|
|
165
|
-
* @author wangcheng
|
|
166
|
-
* @date 2026--03-19 17:08:50
|
|
167
|
-
* @type {IPaasApiManage}
|
|
168
|
-
*/
|
|
169
|
-
ipaas: IPaasApiManage;
|
|
170
167
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { joinPath } from "../utils/index.mjs";
|
|
2
2
|
import { HttpUtil } from "./http.util.mjs";
|
|
3
3
|
export class ApiService {
|
|
4
4
|
/**
|
|
@@ -16,24 +16,24 @@ export class ApiService {
|
|
|
16
16
|
if (!(property in api)) {
|
|
17
17
|
const cfg = config.apis.find((item) => item.method === property);
|
|
18
18
|
if (cfg) {
|
|
19
|
-
const modeFn = `_${cfg.mode}`;
|
|
19
|
+
const modeFn = cfg.hasUpload ? "_upload" : `_${cfg.mode}`;
|
|
20
20
|
if (cfg.hasPathParams && cfg.hasData && cfg.hasQuery) {
|
|
21
|
-
api[property] = (
|
|
22
|
-
return api[modeFn](cfg.path,
|
|
21
|
+
api[property] = (path, query, data, config2) => {
|
|
22
|
+
return api[modeFn](cfg.path, path, query, data, config2);
|
|
23
23
|
};
|
|
24
24
|
} else if (cfg.hasPathParams && cfg.hasData) {
|
|
25
|
-
api[property] = function(
|
|
26
|
-
return api[modeFn](cfg.path,
|
|
25
|
+
api[property] = function(path, data, config2) {
|
|
26
|
+
return api[modeFn](cfg.path, path, void 0, data, config2);
|
|
27
27
|
};
|
|
28
28
|
} else if (cfg.hasPathParams && cfg.hasQuery) {
|
|
29
|
-
api[property] = function(
|
|
30
|
-
return api[modeFn](cfg.path,
|
|
29
|
+
api[property] = function(path, query, config2) {
|
|
30
|
+
return api[modeFn](cfg.path, path, query, void 0, config2);
|
|
31
31
|
};
|
|
32
32
|
} else if (cfg.hasPathParams) {
|
|
33
|
-
api[property] = function(
|
|
33
|
+
api[property] = function(path, config2) {
|
|
34
34
|
return api[modeFn](
|
|
35
35
|
cfg.path,
|
|
36
|
-
|
|
36
|
+
path,
|
|
37
37
|
void 0,
|
|
38
38
|
void 0,
|
|
39
39
|
config2
|
|
@@ -74,6 +74,10 @@ export class ApiService {
|
|
|
74
74
|
);
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
+
} else {
|
|
78
|
+
console.warn(
|
|
79
|
+
`API method ${property} is not defined in the configuration.`
|
|
80
|
+
);
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
return api[property];
|
|
@@ -93,7 +97,7 @@ export class ApiService {
|
|
|
93
97
|
*/
|
|
94
98
|
_put(method, pathParams, query, data, config) {
|
|
95
99
|
return HttpUtil.put(
|
|
96
|
-
|
|
100
|
+
joinPath(this.url, method),
|
|
97
101
|
pathParams,
|
|
98
102
|
data,
|
|
99
103
|
query,
|
|
@@ -113,7 +117,7 @@ export class ApiService {
|
|
|
113
117
|
*/
|
|
114
118
|
_get(method, pathParams, query, data, config) {
|
|
115
119
|
return HttpUtil.get(
|
|
116
|
-
|
|
120
|
+
joinPath(this.url, method),
|
|
117
121
|
pathParams,
|
|
118
122
|
data,
|
|
119
123
|
query,
|
|
@@ -133,7 +137,7 @@ export class ApiService {
|
|
|
133
137
|
*/
|
|
134
138
|
_delete(method, pathParams, query, data, config) {
|
|
135
139
|
return HttpUtil.delete(
|
|
136
|
-
|
|
140
|
+
joinPath(this.url, method),
|
|
137
141
|
pathParams,
|
|
138
142
|
data,
|
|
139
143
|
query,
|
|
@@ -153,7 +157,7 @@ export class ApiService {
|
|
|
153
157
|
*/
|
|
154
158
|
_post(method, pathParams, query, data, config) {
|
|
155
159
|
return HttpUtil.post(
|
|
156
|
-
|
|
160
|
+
joinPath(this.url, method),
|
|
157
161
|
pathParams,
|
|
158
162
|
data,
|
|
159
163
|
query,
|
|
@@ -173,7 +177,7 @@ export class ApiService {
|
|
|
173
177
|
*/
|
|
174
178
|
_options(method, pathParams, query, data, config) {
|
|
175
179
|
return HttpUtil.options(
|
|
176
|
-
|
|
180
|
+
joinPath(this.url, method),
|
|
177
181
|
pathParams,
|
|
178
182
|
data,
|
|
179
183
|
query,
|
|
@@ -193,7 +197,7 @@ export class ApiService {
|
|
|
193
197
|
*/
|
|
194
198
|
_patch(method, pathParams, query, data, config) {
|
|
195
199
|
return HttpUtil.patch(
|
|
196
|
-
|
|
200
|
+
joinPath(this.url, method),
|
|
197
201
|
pathParams,
|
|
198
202
|
data,
|
|
199
203
|
query,
|
|
@@ -213,7 +217,28 @@ export class ApiService {
|
|
|
213
217
|
*/
|
|
214
218
|
_head(method, pathParams, query, data, config) {
|
|
215
219
|
return HttpUtil.head(
|
|
216
|
-
|
|
220
|
+
joinPath(this.url, method),
|
|
221
|
+
pathParams,
|
|
222
|
+
data,
|
|
223
|
+
query,
|
|
224
|
+
config
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* 文件上传方法
|
|
229
|
+
*
|
|
230
|
+
* @protected
|
|
231
|
+
* @template T
|
|
232
|
+
* @param {string} method 请求方法路径
|
|
233
|
+
* @param {IObject} [pathParams] 路径参数
|
|
234
|
+
* @param {IParams} [query] 查询参数
|
|
235
|
+
* @param {Partial<UploadFileData>} [data] 上传数据
|
|
236
|
+
* @param {Partial<AxiosRequestConfig>} [config] 请求配置
|
|
237
|
+
* @return {*} {Promise<T>} 请求结果
|
|
238
|
+
*/
|
|
239
|
+
_upload(method, pathParams, query, data, config) {
|
|
240
|
+
return HttpUtil.upload(
|
|
241
|
+
joinPath(this.url, method),
|
|
217
242
|
pathParams,
|
|
218
243
|
data,
|
|
219
244
|
query,
|
|
@@ -6,6 +6,13 @@ import type { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
|
6
6
|
* @class HttpUtil
|
|
7
7
|
*/
|
|
8
8
|
export declare class HttpUtil {
|
|
9
|
+
/**
|
|
10
|
+
* Axios 实例,供外部使用和挂载中间件
|
|
11
|
+
*
|
|
12
|
+
* @static
|
|
13
|
+
* @type {AxiosInstance}
|
|
14
|
+
*/
|
|
15
|
+
static _instance: AxiosInstance;
|
|
9
16
|
/**
|
|
10
17
|
* 挂载中间件
|
|
11
18
|
*
|
|
@@ -111,7 +118,7 @@ export declare class HttpUtil {
|
|
|
111
118
|
* @template T
|
|
112
119
|
* @param {string} url 请求地址
|
|
113
120
|
* @param {IObject} [path={}] 路径参数
|
|
114
|
-
* @param {UploadFileData} [data={}] 额外的请求数据
|
|
121
|
+
* @param {Partial<UploadFileData>} [data={}] 额外的请求数据
|
|
115
122
|
* @param {IParams} [query={}] 查询参数
|
|
116
123
|
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
117
124
|
* @returns {Promise<T>} 请求结果
|
package/es/service/http.util.mjs
CHANGED
|
@@ -3,6 +3,13 @@ import { ContentTypeEnum } from "./http.enum.mjs";
|
|
|
3
3
|
import { BackendError } from "./http.error.mjs";
|
|
4
4
|
const instance = axios.create();
|
|
5
5
|
export class HttpUtil {
|
|
6
|
+
/**
|
|
7
|
+
* Axios 实例,供外部使用和挂载中间件
|
|
8
|
+
*
|
|
9
|
+
* @static
|
|
10
|
+
* @type {AxiosInstance}
|
|
11
|
+
*/
|
|
12
|
+
static _instance = instance;
|
|
6
13
|
/**
|
|
7
14
|
* 挂载中间件
|
|
8
15
|
*
|
|
@@ -10,7 +17,7 @@ export class HttpUtil {
|
|
|
10
17
|
* @param {(_axios: AxiosInstance) => void} fn 中间件函数
|
|
11
18
|
*/
|
|
12
19
|
static use(fn) {
|
|
13
|
-
fn(
|
|
20
|
+
fn(this._instance);
|
|
14
21
|
}
|
|
15
22
|
/**
|
|
16
23
|
* GET 请求方法
|
|
@@ -130,7 +137,7 @@ export class HttpUtil {
|
|
|
130
137
|
* @template T
|
|
131
138
|
* @param {string} url 请求地址
|
|
132
139
|
* @param {IObject} [path={}] 路径参数
|
|
133
|
-
* @param {UploadFileData} [data={}] 额外的请求数据
|
|
140
|
+
* @param {Partial<UploadFileData>} [data={}] 额外的请求数据
|
|
134
141
|
* @param {IParams} [query={}] 查询参数
|
|
135
142
|
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
136
143
|
* @returns {Promise<T>} 请求结果
|
|
@@ -164,7 +171,8 @@ export class HttpUtil {
|
|
|
164
171
|
headers: {
|
|
165
172
|
"Content-Type": ContentTypeEnum.FORM_DATA,
|
|
166
173
|
...config.headers
|
|
167
|
-
}
|
|
174
|
+
},
|
|
175
|
+
nativeData: true
|
|
168
176
|
});
|
|
169
177
|
}
|
|
170
178
|
/**
|
|
@@ -198,6 +206,10 @@ export class HttpUtil {
|
|
|
198
206
|
* @returns {Promise<T>} 请求结果
|
|
199
207
|
*/
|
|
200
208
|
static async request(url, path, data, query, config = {}) {
|
|
209
|
+
const headers = config.headers || {};
|
|
210
|
+
if (config.headers) {
|
|
211
|
+
delete config.headers;
|
|
212
|
+
}
|
|
201
213
|
const res = await instance.request({
|
|
202
214
|
url: this.transformUrl(url, path || {}),
|
|
203
215
|
data: data instanceof FormData ? data : JSON.stringify(data ? data : {}),
|
|
@@ -205,10 +217,16 @@ export class HttpUtil {
|
|
|
205
217
|
timeout: 2 * 60 * 1e3,
|
|
206
218
|
headers: {
|
|
207
219
|
"Content-Type": ContentTypeEnum.JSON,
|
|
208
|
-
...
|
|
220
|
+
...headers
|
|
209
221
|
},
|
|
210
222
|
...config
|
|
211
223
|
});
|
|
224
|
+
if (config.nativeResponse) {
|
|
225
|
+
return res;
|
|
226
|
+
}
|
|
227
|
+
if (config.nativeData) {
|
|
228
|
+
return res.data;
|
|
229
|
+
}
|
|
212
230
|
if (res.status >= 200 && res.status < 300) {
|
|
213
231
|
const data2 = res.data;
|
|
214
232
|
if (data2.ok === true) {
|
package/es/service/index.mjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { apiConfig as aPaasConfig } from "../apaas/index.mjs";
|
|
2
2
|
import { apiConfig as platformConfig } from "../platform/index.mjs";
|
|
3
|
-
import { apiConfig as iPaasConfig } from "../ipaas/index.mjs";
|
|
4
3
|
import { ApiManage } from "./api-manage.mjs";
|
|
5
4
|
export const api = {
|
|
6
5
|
apaas: new ApiManage("/gct-apaas/api", aPaasConfig),
|
|
7
|
-
platform: new ApiManage("/gct-platform/api", platformConfig)
|
|
8
|
-
ipaas: new ApiManage("/gct-ipaas/api", iPaasConfig)
|
|
6
|
+
platform: new ApiManage("/gct-platform/api", platformConfig)
|
|
9
7
|
};
|
|
10
8
|
export {
|
|
11
9
|
ResultEnum,
|
package/es/types/index.d.ts
CHANGED
|
@@ -28,6 +28,14 @@ declare global {
|
|
|
28
28
|
* @interface IObject
|
|
29
29
|
*/
|
|
30
30
|
type IObject = Record<string | symbol, any>;
|
|
31
|
+
interface Window {
|
|
32
|
+
/**
|
|
33
|
+
* 安卓混合开发模式标识,由原生层注入,值为 true 时表示在安卓混合开发模式下运行
|
|
34
|
+
*
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
*/
|
|
37
|
+
__GCT_ANDROID__?: boolean;
|
|
38
|
+
}
|
|
31
39
|
|
|
32
40
|
/**
|
|
33
41
|
* 查询分页对象
|
|
@@ -169,3 +177,22 @@ declare global {
|
|
|
169
177
|
subMessage?: string;
|
|
170
178
|
}
|
|
171
179
|
}
|
|
180
|
+
|
|
181
|
+
declare module 'axios' {
|
|
182
|
+
export interface AxiosRequestConfig {
|
|
183
|
+
/**
|
|
184
|
+
* 是否返回原生响应对象
|
|
185
|
+
*
|
|
186
|
+
* @default false
|
|
187
|
+
* @type {boolean}
|
|
188
|
+
*/
|
|
189
|
+
nativeResponse?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* 是否返回原生数据对象,包含后台返回的所有状态码和消息等信息
|
|
192
|
+
*
|
|
193
|
+
* @default false
|
|
194
|
+
* @type {boolean}
|
|
195
|
+
*/
|
|
196
|
+
nativeData?: boolean;
|
|
197
|
+
}
|
|
198
|
+
}
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.mjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { cloneDeep, isEqual, mergeWith, unionWith } from "lodash-es";
|
|
2
|
+
export function joinPath(...segments) {
|
|
3
|
+
return segments.map((seg, i) => {
|
|
4
|
+
if (i === 0) return seg.replace(/\/+$/, "");
|
|
5
|
+
return seg.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
6
|
+
}).filter(Boolean).join("/");
|
|
7
|
+
}
|
|
2
8
|
export function deepMerge(target, source) {
|
|
3
9
|
return mergeWith(cloneDeep(target), source, (objValue, srcValue) => {
|
|
4
10
|
if (typeof objValue === "object" && typeof srcValue === "object") {
|