@etsoo/smarterp-core 1.0.38 → 1.0.40

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.
@@ -10,6 +10,7 @@ import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, MsgResultPay
10
10
  import { OrgListRQ } from "./rq/org/OrgListRQ";
11
11
  import { OrgGetMyRQ } from "./rq/org/OrgGetMyRQ";
12
12
  import { OrgGetMyData } from "./dto/org/OrgGetMyData";
13
+ import { OrgDownloadKind } from "./dto/org/OrgDownloadKind";
13
14
  /**
14
15
  * Organization API
15
16
  * 机构接口
@@ -35,6 +36,14 @@ export declare class OrgApi extends EntityApi {
35
36
  * @returns Result
36
37
  */
37
38
  delete(id: number, payload?: IdResultPayload): Promise<import("@etsoo/shared").IdActionResult | undefined>;
39
+ /**
40
+ * Download file
41
+ * @kind Download kind
42
+ * @param id id
43
+ * @param payload Payload
44
+ * @returns Result
45
+ */
46
+ downloadFile(kind: OrgDownloadKind, id: number): Promise<void>;
38
47
  /**
39
48
  * Get user's latest accessed organizations
40
49
  * @param rq Request data
package/lib/cjs/OrgApi.js CHANGED
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OrgApi = void 0;
4
+ const restclient_1 = require("@etsoo/restclient");
4
5
  const appscript_1 = require("@etsoo/appscript");
6
+ const OrgDownloadKind_1 = require("./dto/org/OrgDownloadKind");
7
+ const shared_1 = require("@etsoo/shared");
5
8
  /**
6
9
  * Organization API
7
10
  * 机构接口
@@ -33,6 +36,25 @@ class OrgApi extends appscript_1.EntityApi {
33
36
  delete(id, payload) {
34
37
  return this.deleteBase(id, payload);
35
38
  }
39
+ /**
40
+ * Download file
41
+ * @kind Download kind
42
+ * @param id id
43
+ * @param payload Payload
44
+ * @returns Result
45
+ */
46
+ async downloadFile(kind, id) {
47
+ const payload = {
48
+ responseType: restclient_1.ApiResponseType.Stream
49
+ };
50
+ const key = shared_1.DataTypes.getEnumKey(OrgDownloadKind_1.OrgDownloadKind, kind);
51
+ const result = await this.api.get(`${this.flag}/Download${key}File/${id}`, undefined, payload);
52
+ if (result == null || payload.response == null)
53
+ return;
54
+ const filename = this.api.getContentDisposition(payload.response)?.filename ??
55
+ "DownloadFile";
56
+ await this.app.download(result, filename);
57
+ }
36
58
  /**
37
59
  * Get user's latest accessed organizations
38
60
  * @param rq Request data
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Organization download kind
3
+ * 机构下载类型
4
+ */
5
+ export declare enum OrgDownloadKind {
6
+ /**
7
+ * Profile
8
+ * 档案
9
+ */
10
+ Profile = 1
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrgDownloadKind = void 0;
4
+ /**
5
+ * Organization download kind
6
+ * 机构下载类型
7
+ */
8
+ var OrgDownloadKind;
9
+ (function (OrgDownloadKind) {
10
+ /**
11
+ * Profile
12
+ * 档案
13
+ */
14
+ OrgDownloadKind[OrgDownloadKind["Profile"] = 1] = "Profile";
15
+ })(OrgDownloadKind || (exports.OrgDownloadKind = OrgDownloadKind = {}));
@@ -25,6 +25,7 @@
25
25
  "editLogo": "Edit logo",
26
26
  "expandMenu": "Expand menu",
27
27
  "expandNavMenuAriaLabel": "Expand navigation menu",
28
+ "fileName": "File name",
28
29
  "fullName": "Full name",
29
30
  "idCustomer": "Customer",
30
31
  "idSupplier": "Supplier",
@@ -25,6 +25,7 @@
25
25
  "editLogo": "修改图标",
26
26
  "expandMenu": "展开菜单",
27
27
  "expandNavMenuAriaLabel": "展开导航菜单",
28
+ "fileName": "文件名",
28
29
  "fullName": "全称",
29
30
  "idCustomer": "客户",
30
31
  "idSupplier": "供应商",
@@ -25,6 +25,7 @@
25
25
  "editLogo": "修改圖標",
26
26
  "expandMenu": "展開菜單",
27
27
  "expandNavMenuAriaLabel": "展開導航菜單",
28
+ "fileName": "文件名",
28
29
  "fullName": "全稱",
29
30
  "latinFamilyName": "姓氏(拼音)",
30
31
  "latinGivenName": "名(拼音)",
@@ -10,6 +10,7 @@ export * from "./dto/member/MemberListDto";
10
10
  export * from "./dto/member/MemberQueryDto";
11
11
  export * from "./dto/member/MemberReadDto";
12
12
  export * from "./dto/member/MemberUpdateReadDto";
13
+ export * from "./dto/org/OrgDownloadKind";
13
14
  export * from "./dto/org/OrgGetMyData";
14
15
  export * from "./dto/org/OrgListDto";
15
16
  export * from "./dto/org/OrgQueryDto";
package/lib/cjs/index.js CHANGED
@@ -27,6 +27,7 @@ __exportStar(require("./dto/member/MemberListDto"), exports);
27
27
  __exportStar(require("./dto/member/MemberQueryDto"), exports);
28
28
  __exportStar(require("./dto/member/MemberReadDto"), exports);
29
29
  __exportStar(require("./dto/member/MemberUpdateReadDto"), exports);
30
+ __exportStar(require("./dto/org/OrgDownloadKind"), exports);
30
31
  __exportStar(require("./dto/org/OrgGetMyData"), exports);
31
32
  __exportStar(require("./dto/org/OrgListDto"), exports);
32
33
  __exportStar(require("./dto/org/OrgQueryDto"), exports);
@@ -10,6 +10,7 @@ import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, MsgResultPay
10
10
  import { OrgListRQ } from "./rq/org/OrgListRQ";
11
11
  import { OrgGetMyRQ } from "./rq/org/OrgGetMyRQ";
12
12
  import { OrgGetMyData } from "./dto/org/OrgGetMyData";
13
+ import { OrgDownloadKind } from "./dto/org/OrgDownloadKind";
13
14
  /**
14
15
  * Organization API
15
16
  * 机构接口
@@ -35,6 +36,14 @@ export declare class OrgApi extends EntityApi {
35
36
  * @returns Result
36
37
  */
37
38
  delete(id: number, payload?: IdResultPayload): Promise<import("@etsoo/shared").IdActionResult | undefined>;
39
+ /**
40
+ * Download file
41
+ * @kind Download kind
42
+ * @param id id
43
+ * @param payload Payload
44
+ * @returns Result
45
+ */
46
+ downloadFile(kind: OrgDownloadKind, id: number): Promise<void>;
38
47
  /**
39
48
  * Get user's latest accessed organizations
40
49
  * @param rq Request data
package/lib/mjs/OrgApi.js CHANGED
@@ -1,4 +1,7 @@
1
+ import { ApiResponseType } from "@etsoo/restclient";
1
2
  import { EntityApi } from "@etsoo/appscript";
3
+ import { OrgDownloadKind } from "./dto/org/OrgDownloadKind";
4
+ import { DataTypes } from "@etsoo/shared";
2
5
  /**
3
6
  * Organization API
4
7
  * 机构接口
@@ -30,6 +33,25 @@ export class OrgApi extends EntityApi {
30
33
  delete(id, payload) {
31
34
  return this.deleteBase(id, payload);
32
35
  }
36
+ /**
37
+ * Download file
38
+ * @kind Download kind
39
+ * @param id id
40
+ * @param payload Payload
41
+ * @returns Result
42
+ */
43
+ async downloadFile(kind, id) {
44
+ const payload = {
45
+ responseType: ApiResponseType.Stream
46
+ };
47
+ const key = DataTypes.getEnumKey(OrgDownloadKind, kind);
48
+ const result = await this.api.get(`${this.flag}/Download${key}File/${id}`, undefined, payload);
49
+ if (result == null || payload.response == null)
50
+ return;
51
+ const filename = this.api.getContentDisposition(payload.response)?.filename ??
52
+ "DownloadFile";
53
+ await this.app.download(result, filename);
54
+ }
33
55
  /**
34
56
  * Get user's latest accessed organizations
35
57
  * @param rq Request data
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Organization download kind
3
+ * 机构下载类型
4
+ */
5
+ export declare enum OrgDownloadKind {
6
+ /**
7
+ * Profile
8
+ * 档案
9
+ */
10
+ Profile = 1
11
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Organization download kind
3
+ * 机构下载类型
4
+ */
5
+ export var OrgDownloadKind;
6
+ (function (OrgDownloadKind) {
7
+ /**
8
+ * Profile
9
+ * 档案
10
+ */
11
+ OrgDownloadKind[OrgDownloadKind["Profile"] = 1] = "Profile";
12
+ })(OrgDownloadKind || (OrgDownloadKind = {}));
@@ -25,6 +25,7 @@
25
25
  "editLogo": "Edit logo",
26
26
  "expandMenu": "Expand menu",
27
27
  "expandNavMenuAriaLabel": "Expand navigation menu",
28
+ "fileName": "File name",
28
29
  "fullName": "Full name",
29
30
  "idCustomer": "Customer",
30
31
  "idSupplier": "Supplier",
@@ -25,6 +25,7 @@
25
25
  "editLogo": "修改图标",
26
26
  "expandMenu": "展开菜单",
27
27
  "expandNavMenuAriaLabel": "展开导航菜单",
28
+ "fileName": "文件名",
28
29
  "fullName": "全称",
29
30
  "idCustomer": "客户",
30
31
  "idSupplier": "供应商",
@@ -25,6 +25,7 @@
25
25
  "editLogo": "修改圖標",
26
26
  "expandMenu": "展開菜單",
27
27
  "expandNavMenuAriaLabel": "展開導航菜單",
28
+ "fileName": "文件名",
28
29
  "fullName": "全稱",
29
30
  "latinFamilyName": "姓氏(拼音)",
30
31
  "latinGivenName": "名(拼音)",
@@ -10,6 +10,7 @@ export * from "./dto/member/MemberListDto";
10
10
  export * from "./dto/member/MemberQueryDto";
11
11
  export * from "./dto/member/MemberReadDto";
12
12
  export * from "./dto/member/MemberUpdateReadDto";
13
+ export * from "./dto/org/OrgDownloadKind";
13
14
  export * from "./dto/org/OrgGetMyData";
14
15
  export * from "./dto/org/OrgListDto";
15
16
  export * from "./dto/org/OrgQueryDto";
package/lib/mjs/index.js CHANGED
@@ -11,6 +11,7 @@ export * from "./dto/member/MemberListDto";
11
11
  export * from "./dto/member/MemberQueryDto";
12
12
  export * from "./dto/member/MemberReadDto";
13
13
  export * from "./dto/member/MemberUpdateReadDto";
14
+ export * from "./dto/org/OrgDownloadKind";
14
15
  export * from "./dto/org/OrgGetMyData";
15
16
  export * from "./dto/org/OrgListDto";
16
17
  export * from "./dto/org/OrgQueryDto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/smarterp-core",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -58,7 +58,7 @@
58
58
  "@etsoo/react": "^1.8.38",
59
59
  "@etsoo/shared": "^1.2.66",
60
60
  "@etsoo/toolpad": "^1.0.26",
61
- "@mui/material": "^7.0.1",
61
+ "@mui/material": "^7.0.2",
62
62
  "react": "^18.3.1",
63
63
  "react-dom": "^18.3.1"
64
64
  }
package/src/OrgApi.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IApi, IApiPayload } from "@etsoo/restclient";
1
+ import { ApiResponseType, IApi, IApiPayload } from "@etsoo/restclient";
2
2
  import { OrgCreateRQ } from "./rq/org/OrgCreateRQ";
3
3
  import { OrgUpdateRQ } from "./rq/org/OrgUpdateRQ";
4
4
  import { OrgQueryRQ } from "./rq/org/OrgQueryRQ";
@@ -17,6 +17,8 @@ import {
17
17
  import { OrgListRQ } from "./rq/org/OrgListRQ";
18
18
  import { OrgGetMyRQ } from "./rq/org/OrgGetMyRQ";
19
19
  import { OrgGetMyData } from "./dto/org/OrgGetMyData";
20
+ import { OrgDownloadKind } from "./dto/org/OrgDownloadKind";
21
+ import { DataTypes } from "@etsoo/shared";
20
22
 
21
23
  /**
22
24
  * Organization API
@@ -52,6 +54,35 @@ export class OrgApi extends EntityApi {
52
54
  return this.deleteBase(id, payload);
53
55
  }
54
56
 
57
+ /**
58
+ * Download file
59
+ * @kind Download kind
60
+ * @param id id
61
+ * @param payload Payload
62
+ * @returns Result
63
+ */
64
+ async downloadFile(kind: OrgDownloadKind, id: number): Promise<void> {
65
+ const payload: IApiPayload<ReadableStream> = {
66
+ responseType: ApiResponseType.Stream
67
+ };
68
+
69
+ const key = DataTypes.getEnumKey(OrgDownloadKind, kind);
70
+
71
+ const result = await this.api.get(
72
+ `${this.flag}/Download${key}File/${id}`,
73
+ undefined,
74
+ payload
75
+ );
76
+
77
+ if (result == null || payload.response == null) return;
78
+
79
+ const filename =
80
+ this.api.getContentDisposition(payload.response)?.filename ??
81
+ "DownloadFile";
82
+
83
+ await this.app.download(result, filename);
84
+ }
85
+
55
86
  /**
56
87
  * Get user's latest accessed organizations
57
88
  * @param rq Request data
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Organization download kind
3
+ * 机构下载类型
4
+ */
5
+ export enum OrgDownloadKind {
6
+ /**
7
+ * Profile
8
+ * 档案
9
+ */
10
+ Profile = 1
11
+ }
package/src/i18n/en.json CHANGED
@@ -25,6 +25,7 @@
25
25
  "editLogo": "Edit logo",
26
26
  "expandMenu": "Expand menu",
27
27
  "expandNavMenuAriaLabel": "Expand navigation menu",
28
+ "fileName": "File name",
28
29
  "fullName": "Full name",
29
30
  "idCustomer": "Customer",
30
31
  "idSupplier": "Supplier",
@@ -25,6 +25,7 @@
25
25
  "editLogo": "修改图标",
26
26
  "expandMenu": "展开菜单",
27
27
  "expandNavMenuAriaLabel": "展开导航菜单",
28
+ "fileName": "文件名",
28
29
  "fullName": "全称",
29
30
  "idCustomer": "客户",
30
31
  "idSupplier": "供应商",
@@ -25,6 +25,7 @@
25
25
  "editLogo": "修改圖標",
26
26
  "expandMenu": "展開菜單",
27
27
  "expandNavMenuAriaLabel": "展開導航菜單",
28
+ "fileName": "文件名",
28
29
  "fullName": "全稱",
29
30
  "latinFamilyName": "姓氏(拼音)",
30
31
  "latinGivenName": "名(拼音)",
package/src/index.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./dto/member/MemberQueryDto";
14
14
  export * from "./dto/member/MemberReadDto";
15
15
  export * from "./dto/member/MemberUpdateReadDto";
16
16
 
17
+ export * from "./dto/org/OrgDownloadKind";
17
18
  export * from "./dto/org/OrgGetMyData";
18
19
  export * from "./dto/org/OrgListDto";
19
20
  export * from "./dto/org/OrgQueryDto";