@gct-paas/api 0.1.4-dev.1 → 0.1.4-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.
@@ -1,7 +1,7 @@
1
1
  export const apiConfig = [
2
2
  {
3
3
  name: "medPro",
4
- entityName: "med-pro",
4
+ entityName: "medPro",
5
5
  apis: [
6
6
  {
7
7
  mode: "post",
@@ -1443,6 +1443,7 @@ export const apiConfig = [
1443
1443
  mode: "post",
1444
1444
  method: "postUploadFile",
1445
1445
  path: "upload/file",
1446
+ hasUpload: true,
1446
1447
  hasQuery: true,
1447
1448
  hasData: true
1448
1449
  },
@@ -1450,6 +1451,7 @@ export const apiConfig = [
1450
1451
  mode: "post",
1451
1452
  method: "postUploadLabelImage",
1452
1453
  path: "upload/label/image",
1454
+ hasUpload: true,
1453
1455
  hasData: true
1454
1456
  },
1455
1457
  {
@@ -2678,6 +2680,7 @@ export const apiConfig = [
2678
2680
  mode: "post",
2679
2681
  method: "postUpload",
2680
2682
  path: "upload",
2683
+ hasUpload: true,
2681
2684
  hasQuery: true,
2682
2685
  hasData: true
2683
2686
  }
@@ -2726,6 +2729,7 @@ export const apiConfig = [
2726
2729
  mode: "post",
2727
2730
  method: "postUploadImage",
2728
2731
  path: "upload/image",
2732
+ hasUpload: true,
2729
2733
  hasQuery: true,
2730
2734
  hasData: true
2731
2735
  }
@@ -2937,6 +2941,7 @@ export const apiConfig = [
2937
2941
  mode: "post",
2938
2942
  method: "postLangUpload",
2939
2943
  path: "lang/upload",
2944
+ hasUpload: true,
2940
2945
  hasQuery: true,
2941
2946
  hasData: true
2942
2947
  },
@@ -3281,6 +3286,7 @@ export const apiConfig = [
3281
3286
  mode: "post",
3282
3287
  method: "postImport",
3283
3288
  path: "import",
3289
+ hasUpload: true,
3284
3290
  hasData: true
3285
3291
  },
3286
3292
  {
@@ -4261,6 +4267,7 @@ export const apiConfig = [
4261
4267
  mode: "post",
4262
4268
  method: "postDocxJson",
4263
4269
  path: "docx-json",
4270
+ hasUpload: true,
4264
4271
  hasData: true
4265
4272
  }
4266
4273
  ]
@@ -4628,6 +4635,7 @@ export const apiConfig = [
4628
4635
  mode: "post",
4629
4636
  method: "postImportJsonl",
4630
4637
  path: "importJsonl",
4638
+ hasUpload: true,
4631
4639
  hasQuery: true,
4632
4640
  hasData: true
4633
4641
  }
@@ -7219,6 +7227,7 @@ export const apiConfig = [
7219
7227
  mode: "post",
7220
7228
  method: "postUploadExcel",
7221
7229
  path: "upload/excel",
7230
+ hasUpload: true,
7222
7231
  hasQuery: true,
7223
7232
  hasData: true
7224
7233
  }
@@ -6,43 +6,71 @@ import type {
6
6
  } from '../entities';
7
7
 
8
8
  export interface getModelMetaGetSysConfigQuery {
9
- key: string; // key
9
+ /**
10
+ * key
11
+ */
12
+ key: string;
10
13
  }
11
14
  export interface getModelMetaHasDataAssociationQuery {
12
- id: string; // id
13
- modelKey: string; // modelKey
15
+ /**
16
+ * id
17
+ */
18
+ id: string;
19
+ /**
20
+ * modelKey
21
+ */
22
+ modelKey: string;
14
23
  }
15
24
  export interface getModelMetaModelDataAssociationQuery {
16
- id: string; // id
17
- modelKey: string; // modelKey
25
+ /**
26
+ * id
27
+ */
28
+ id: string;
29
+ /**
30
+ * modelKey
31
+ */
32
+ modelKey: string;
18
33
  }
19
34
  export interface getEdhrAttachmentGetEdhrAttachmentQuery {
20
- materialNo: string; // materialNo
35
+ /**
36
+ * materialNo
37
+ */
38
+ materialNo: string;
21
39
  }
22
- export interface MedproService {
23
- // 关联模型数据查询
40
+ export interface MedProService {
41
+ /**
42
+ * 关联模型数据查询
43
+ */
24
44
  postModelMetaDataAssociation(
25
45
  data: modelDataAssociationRequest,
26
46
  config?: Partial<AxiosRequestConfig>,
27
- ): Promise<IHttpResponse<object>>;
28
- // 获取系统配置
47
+ ): Promise<object>;
48
+ /**
49
+ * 获取系统配置
50
+ */
29
51
  getModelMetaGetSysConfig(
30
52
  query: getModelMetaGetSysConfigQuery,
31
53
  config?: Partial<AxiosRequestConfig>,
32
- ): Promise<IHttpResponse<boolean>>;
33
- // 存在关联数据
54
+ ): Promise<boolean>;
55
+ /**
56
+ * 存在关联数据
57
+ */
34
58
  getModelMetaHasDataAssociation(
35
59
  query: getModelMetaHasDataAssociationQuery,
36
60
  config?: Partial<AxiosRequestConfig>,
37
- ): Promise<IHttpResponse<boolean>>;
38
- // 关联数据信息列表
61
+ ): Promise<boolean>;
62
+ /**
63
+ * 关联数据信息列表
64
+ */
39
65
  getModelMetaModelDataAssociation(
40
66
  query: getModelMetaModelDataAssociationQuery,
41
67
  config?: Partial<AxiosRequestConfig>,
42
- ): Promise<IHttpResponse<ModelAssociationResponse[]>>;
43
- // 获取Edhr附录接口
68
+ ): Promise<ModelAssociationResponse[]>;
69
+ /**
70
+ * 获取Edhr附录接口
71
+ */
44
72
  getEdhrAttachmentGetEdhrAttachment(
45
73
  query: getEdhrAttachmentGetEdhrAttachmentQuery,
46
74
  config?: Partial<AxiosRequestConfig>,
47
- ): Promise<IHttpResponse<OnlineFormInstance[]>>;
75
+ ): Promise<OnlineFormInstance[]>;
48
76
  }
@@ -1,4 +1,4 @@
1
- import type { MedProService } from './apis/med-pro.service';
1
+ import type { MedProService } from './apis/medPro.service';
2
2
  import type { AppBranchService } from './apis/app-branch.service';
3
3
  import type { AppGlobalSettingsService } from './apis/app-global-settings.service';
4
4
  import type { AppGrantedUserService } from './apis/app-granted-user.service';
@@ -118,6 +118,7 @@ export const apiConfig = [
118
118
  mode: "post",
119
119
  method: "postImport",
120
120
  path: "import",
121
+ hasUpload: true,
121
122
  hasQuery: true,
122
123
  hasData: true
123
124
  },
@@ -345,6 +346,7 @@ export const apiConfig = [
345
346
  mode: "post",
346
347
  method: "postImport",
347
348
  path: "import",
349
+ hasUpload: true,
348
350
  hasQuery: true,
349
351
  hasData: true
350
352
  },
@@ -82,6 +82,7 @@ export const apiConfig = [
82
82
  mode: "post",
83
83
  method: "postUploadApk",
84
84
  path: "upload/apk",
85
+ hasUpload: true,
85
86
  hasData: true
86
87
  },
87
88
  {
@@ -322,6 +323,7 @@ export const apiConfig = [
322
323
  mode: "post",
323
324
  method: "postUploadAppPkg",
324
325
  path: "upload/appPkg",
326
+ hasUpload: true,
325
327
  hasData: true
326
328
  },
327
329
  {
@@ -471,6 +473,7 @@ export const apiConfig = [
471
473
  mode: "post",
472
474
  method: "postUploadCategoryId",
473
475
  path: "upload/{categoryId}",
476
+ hasUpload: true,
474
477
  hasPathParams: true,
475
478
  hasData: true
476
479
  }
@@ -631,6 +634,7 @@ export const apiConfig = [
631
634
  mode: "post",
632
635
  method: "postUpload",
633
636
  path: "upload",
637
+ hasUpload: true,
634
638
  hasQuery: true,
635
639
  hasData: true
636
640
  }
@@ -1400,6 +1404,7 @@ export const apiConfig = [
1400
1404
  mode: "post",
1401
1405
  method: "postImport",
1402
1406
  path: "import",
1407
+ hasUpload: true,
1403
1408
  hasData: true
1404
1409
  },
1405
1410
  {
@@ -1453,6 +1458,7 @@ export const apiConfig = [
1453
1458
  mode: "post",
1454
1459
  method: "postImport",
1455
1460
  path: "import",
1461
+ hasUpload: true,
1456
1462
  hasData: true
1457
1463
  },
1458
1464
  {
@@ -1615,6 +1621,7 @@ export const apiConfig = [
1615
1621
  mode: "post",
1616
1622
  method: "postUploadCommon",
1617
1623
  path: "upload-common",
1624
+ hasUpload: true,
1618
1625
  hasQuery: true,
1619
1626
  hasData: true
1620
1627
  },
@@ -1622,12 +1629,14 @@ export const apiConfig = [
1622
1629
  mode: "post",
1623
1630
  method: "postUploadDataset",
1624
1631
  path: "upload-dataset",
1632
+ hasUpload: true,
1625
1633
  hasData: true
1626
1634
  },
1627
1635
  {
1628
1636
  mode: "post",
1629
1637
  method: "postUploadImage",
1630
1638
  path: "upload/image",
1639
+ hasUpload: true,
1631
1640
  hasQuery: true,
1632
1641
  hasData: true
1633
1642
  }
@@ -1700,6 +1709,7 @@ export const apiConfig = [
1700
1709
  mode: "post",
1701
1710
  method: "postLangUpload",
1702
1711
  path: "lang/upload",
1712
+ hasUpload: true,
1703
1713
  hasQuery: true,
1704
1714
  hasData: true
1705
1715
  },
@@ -1922,6 +1932,7 @@ export const apiConfig = [
1922
1932
  mode: "post",
1923
1933
  method: "postUploadCertificate",
1924
1934
  path: "upload/certificate",
1935
+ hasUpload: true,
1925
1936
  hasData: true
1926
1937
  }
1927
1938
  ]
@@ -2004,8 +2015,7 @@ export const apiConfig = [
2004
2015
  {
2005
2016
  mode: "get",
2006
2017
  method: "getModuleAuth",
2007
- path: "moduleAuth",
2008
- hasQuery: true
2018
+ path: "moduleAuth"
2009
2019
  },
2010
2020
  {
2011
2021
  mode: "get",
@@ -2773,6 +2783,7 @@ export const apiConfig = [
2773
2783
  mode: "post",
2774
2784
  method: "postUploadCertFile",
2775
2785
  path: "uploadCertFile",
2786
+ hasUpload: true,
2776
2787
  hasData: true
2777
2788
  },
2778
2789
  {
@@ -3237,6 +3248,7 @@ export const apiConfig = [
3237
3248
  mode: "post",
3238
3249
  method: "postImport",
3239
3250
  path: "import",
3251
+ hasUpload: true,
3240
3252
  hasQuery: true,
3241
3253
  hasData: true
3242
3254
  },
@@ -4291,6 +4303,7 @@ export const apiConfig = [
4291
4303
  mode: "post",
4292
4304
  method: "postOrgPlatImport",
4293
4305
  path: "org/plat/import",
4306
+ hasUpload: true,
4294
4307
  hasQuery: true,
4295
4308
  hasData: true
4296
4309
  },
@@ -4304,6 +4317,7 @@ export const apiConfig = [
4304
4317
  mode: "post",
4305
4318
  method: "postOrgTenantImport",
4306
4319
  path: "org/tenant/import",
4320
+ hasUpload: true,
4307
4321
  hasQuery: true,
4308
4322
  hasData: true
4309
4323
  },
@@ -4311,6 +4325,7 @@ export const apiConfig = [
4311
4325
  mode: "post",
4312
4326
  method: "postOrgTenantImport4App",
4313
4327
  path: "org/tenant/import4App",
4328
+ hasUpload: true,
4314
4329
  hasQuery: true,
4315
4330
  hasData: true
4316
4331
  },
@@ -4336,6 +4351,7 @@ export const apiConfig = [
4336
4351
  mode: "post",
4337
4352
  method: "postPlatImport",
4338
4353
  path: "plat/import",
4354
+ hasUpload: true,
4339
4355
  hasData: true
4340
4356
  },
4341
4357
  {
@@ -4378,12 +4394,14 @@ export const apiConfig = [
4378
4394
  mode: "post",
4379
4395
  method: "postTenantImport",
4380
4396
  path: "tenant/import",
4397
+ hasUpload: true,
4381
4398
  hasData: true
4382
4399
  },
4383
4400
  {
4384
4401
  mode: "post",
4385
4402
  method: "postTenantImport4App",
4386
4403
  path: "tenant/import4App",
4404
+ hasUpload: true,
4387
4405
  hasData: true
4388
4406
  },
4389
4407
  {
@@ -5566,8 +5584,7 @@ export const apiConfig = [
5566
5584
  {
5567
5585
  mode: "get",
5568
5586
  method: "getLicenseModuleAuth",
5569
- path: "license/moduleAuth",
5570
- hasQuery: true
5587
+ path: "license/moduleAuth"
5571
5588
  },
5572
5589
  {
5573
5590
  mode: "post",
@@ -509,12 +509,6 @@ export interface getLicenseGetAppEffectiveLicenseQuery {
509
509
  */
510
510
  env: string;
511
511
  }
512
- export interface getLicenseModuleAuthQuery {
513
- /**
514
- * 授权模块
515
- */
516
- module?: string;
517
- }
518
512
  export interface getLoginSsoOauth2AuthorizeQuery {
519
513
  /**
520
514
  * 授权码
@@ -1254,10 +1248,7 @@ export interface ApiService {
1254
1248
  /**
1255
1249
  * 判断对应模块是否已进行授权
1256
1250
  */
1257
- getLicenseModuleAuth(
1258
- query: getLicenseModuleAuthQuery,
1259
- config?: Partial<AxiosRequestConfig>,
1260
- ): Promise<boolean>;
1251
+ getLicenseModuleAuth(config?: Partial<AxiosRequestConfig>): Promise<boolean>;
1261
1252
  /**
1262
1253
  * 用户登录日志分页查询
1263
1254
  */
@@ -98,12 +98,6 @@ export interface getInfoQuery {
98
98
  */
99
99
  licenseId: string;
100
100
  }
101
- export interface getModuleAuthQuery {
102
- /**
103
- * 授权模块
104
- */
105
- module?: string;
106
- }
107
101
  export interface getPageListQuery {
108
102
  /**
109
103
  * 应用id
@@ -223,10 +217,7 @@ export interface LicenseService {
223
217
  /**
224
218
  * 判断对应模块是否已进行授权
225
219
  */
226
- getModuleAuth(
227
- query: getModuleAuthQuery,
228
- config?: Partial<AxiosRequestConfig>,
229
- ): Promise<boolean>;
220
+ getModuleAuth(config?: Partial<AxiosRequestConfig>): Promise<boolean>;
230
221
  /**
231
222
  * 平台/应用,授权列表
232
223
  */
@@ -81,10 +81,6 @@ export interface getUserPageListQuery {
81
81
  * 排序方式:ASC/DESC, 不传默认 ASC
82
82
  */
83
83
  sortType?: string;
84
- /**
85
- * 参数来源,0企业后台管理、1租户后台管理
86
- */
87
- source?: number;
88
84
  /**
89
85
  * 创建开始时间
90
86
  */
@@ -131,10 +131,6 @@ export interface getManagementOrgUserPageListQuery {
131
131
  * 排序方式:ASC/DESC, 不传默认 ASC
132
132
  */
133
133
  sortType?: string;
134
- /**
135
- * 参数来源,0企业后台管理、1租户后台管理
136
- */
137
- source?: number;
138
134
  /**
139
135
  * 创建开始时间
140
136
  */
@@ -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
  }
@@ -98,6 +98,12 @@ export interface ApiItem {
98
98
  * @type {boolean}
99
99
  */
100
100
  hasData?: boolean;
101
+ /**
102
+ * 是否为文件上传
103
+ *
104
+ * @type {boolean}
105
+ */
106
+ hasUpload?: boolean;
101
107
  }
102
108
  /**
103
109
  * 接口配置项
@@ -16,7 +16,7 @@ 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
21
  api[property] = (path, query, data, config2) => {
22
22
  return api[modeFn](cfg.path, path, query, data, 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];
@@ -220,4 +224,25 @@ export class ApiService {
220
224
  config
221
225
  );
222
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),
242
+ pathParams,
243
+ data,
244
+ query,
245
+ config
246
+ );
247
+ }
223
248
  }
@@ -164,7 +164,8 @@ export class HttpUtil {
164
164
  headers: {
165
165
  "Content-Type": ContentTypeEnum.FORM_DATA,
166
166
  ...config.headers
167
- }
167
+ },
168
+ nativeData: true
168
169
  });
169
170
  }
170
171
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/api",
3
- "version": "0.1.4-dev.1",
3
+ "version": "0.1.4-dev.3",
4
4
  "description": "paas 平台底包",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -80,7 +80,7 @@
80
80
  "@babel/preset-env": "^7.28.6",
81
81
  "@commitlint/cli": "^20.3.1",
82
82
  "@gct-paas/build": "^0.1.7",
83
- "@gct-paas/cli": "^0.1.11",
83
+ "@gct-paas/cli": "^0.1.13",
84
84
  "@rollup/plugin-commonjs": "^29.0.0",
85
85
  "@rollup/plugin-json": "^6.1.0",
86
86
  "@rollup/plugin-node-resolve": "^16.0.3",