@etsoo/smarterp-core 1.0.37 → 1.0.39

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.
@@ -6,10 +6,11 @@ import { OrgQueryDto } from "./dto/org/OrgQueryDto";
6
6
  import { OrgReadDto } from "./dto/org/OrgReadDto";
7
7
  import { OrgUpdateReadDto } from "./dto/org/OrgUpdateReadDto";
8
8
  import { OrgListDto } from "./dto/org/OrgListDto";
9
- import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, MsgResultPayload } from "@etsoo/appscript";
9
+ import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, MsgResultPayload, ResultPayload } from "@etsoo/appscript";
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
@@ -99,4 +108,12 @@ export declare class OrgApi extends EntityApi {
99
108
  * @returns Result
100
109
  */
101
110
  updateRead(id: number, payload?: IApiPayload<OrgUpdateReadDto>): Promise<OrgUpdateReadDto | undefined>;
111
+ /**
112
+ * Upload profle attachments
113
+ * @param id Profile id
114
+ * @param files Files
115
+ * @param payload Payload
116
+ * @returns Result
117
+ */
118
+ uploadProfileFiles(id: number, files: FileList, payload?: ResultPayload): Promise<import("@etsoo/shared").IActionResult<{}> | undefined>;
102
119
  }
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
@@ -115,5 +137,15 @@ class OrgApi extends appscript_1.EntityApi {
115
137
  updateRead(id, payload) {
116
138
  return this.updateReadBase(id, payload);
117
139
  }
140
+ /**
141
+ * Upload profle attachments
142
+ * @param id Profile id
143
+ * @param files Files
144
+ * @param payload Payload
145
+ * @returns Result
146
+ */
147
+ uploadProfileFiles(id, files, payload) {
148
+ return this.api.post(`${this.flag}/UploadProfileFiles/${id}`, files, payload);
149
+ }
118
150
  }
119
151
  exports.OrgApi = OrgApi;
@@ -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 = {}));
@@ -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);
@@ -6,10 +6,11 @@ import { OrgQueryDto } from "./dto/org/OrgQueryDto";
6
6
  import { OrgReadDto } from "./dto/org/OrgReadDto";
7
7
  import { OrgUpdateReadDto } from "./dto/org/OrgUpdateReadDto";
8
8
  import { OrgListDto } from "./dto/org/OrgListDto";
9
- import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, MsgResultPayload } from "@etsoo/appscript";
9
+ import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, MsgResultPayload, ResultPayload } from "@etsoo/appscript";
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
@@ -99,4 +108,12 @@ export declare class OrgApi extends EntityApi {
99
108
  * @returns Result
100
109
  */
101
110
  updateRead(id: number, payload?: IApiPayload<OrgUpdateReadDto>): Promise<OrgUpdateReadDto | undefined>;
111
+ /**
112
+ * Upload profle attachments
113
+ * @param id Profile id
114
+ * @param files Files
115
+ * @param payload Payload
116
+ * @returns Result
117
+ */
118
+ uploadProfileFiles(id: number, files: FileList, payload?: ResultPayload): Promise<import("@etsoo/shared").IActionResult<{}> | undefined>;
102
119
  }
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
@@ -112,4 +134,14 @@ export class OrgApi extends EntityApi {
112
134
  updateRead(id, payload) {
113
135
  return this.updateReadBase(id, payload);
114
136
  }
137
+ /**
138
+ * Upload profle attachments
139
+ * @param id Profile id
140
+ * @param files Files
141
+ * @param payload Payload
142
+ * @returns Result
143
+ */
144
+ uploadProfileFiles(id, files, payload) {
145
+ return this.api.post(`${this.flag}/UploadProfileFiles/${id}`, files, payload);
146
+ }
115
147
  }
@@ -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 = {}));
@@ -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.37",
3
+ "version": "1.0.39",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -46,18 +46,18 @@
46
46
  "@babel/preset-env": "^7.26.9",
47
47
  "@babel/runtime-corejs3": "^7.27.0",
48
48
  "@types/react": "^18.3.20",
49
- "@types/react-dom": "^18.3.1",
49
+ "@types/react-dom": "^18.3.6",
50
50
  "@vitejs/plugin-react": "^4.3.4",
51
51
  "jsdom": "^26.0.0",
52
- "typescript": "^5.8.2",
52
+ "typescript": "^5.8.3",
53
53
  "vitest": "^3.1.1"
54
54
  },
55
55
  "dependencies": {
56
- "@etsoo/appscript": "^1.6.21",
57
- "@etsoo/materialui": "^1.5.10",
58
- "@etsoo/react": "^1.8.35",
56
+ "@etsoo/appscript": "^1.6.22",
57
+ "@etsoo/materialui": "^1.5.20",
58
+ "@etsoo/react": "^1.8.38",
59
59
  "@etsoo/shared": "^1.2.66",
60
- "@etsoo/toolpad": "^1.0.24",
60
+ "@etsoo/toolpad": "^1.0.26",
61
61
  "@mui/material": "^7.0.1",
62
62
  "react": "^18.3.1",
63
63
  "react-dom": "^18.3.1"
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";
@@ -11,11 +11,14 @@ import {
11
11
  EntityApi,
12
12
  IApp,
13
13
  IdResultPayload,
14
- MsgResultPayload
14
+ MsgResultPayload,
15
+ ResultPayload
15
16
  } from "@etsoo/appscript";
16
17
  import { OrgListRQ } from "./rq/org/OrgListRQ";
17
18
  import { OrgGetMyRQ } from "./rq/org/OrgGetMyRQ";
18
19
  import { OrgGetMyData } from "./dto/org/OrgGetMyData";
20
+ import { OrgDownloadKind } from "./dto/org/OrgDownloadKind";
21
+ import { DataTypes } from "@etsoo/shared";
19
22
 
20
23
  /**
21
24
  * Organization API
@@ -51,6 +54,35 @@ export class OrgApi extends EntityApi {
51
54
  return this.deleteBase(id, payload);
52
55
  }
53
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
+
54
86
  /**
55
87
  * Get user's latest accessed organizations
56
88
  * @param rq Request data
@@ -141,4 +173,19 @@ export class OrgApi extends EntityApi {
141
173
  updateRead(id: number, payload?: IApiPayload<OrgUpdateReadDto>) {
142
174
  return this.updateReadBase(id, payload);
143
175
  }
176
+
177
+ /**
178
+ * Upload profle attachments
179
+ * @param id Profile id
180
+ * @param files Files
181
+ * @param payload Payload
182
+ * @returns Result
183
+ */
184
+ uploadProfileFiles(id: number, files: FileList, payload?: ResultPayload) {
185
+ return this.api.post(
186
+ `${this.flag}/UploadProfileFiles/${id}`,
187
+ files,
188
+ payload
189
+ );
190
+ }
144
191
  }
@@ -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/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";