@etsoo/smarterp-core 1.0.0

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.
Files changed (226) hide show
  1. package/.github/workflows/main.yml +60 -0
  2. package/LICENSE +21 -0
  3. package/README.md +17 -0
  4. package/__tests__/OrgApi.ts +132 -0
  5. package/__tests__/PublicApi.ts +130 -0
  6. package/__tests__/UserApi.ts +29 -0
  7. package/__tests__/app/TestApp.ts +138 -0
  8. package/__tests__/tsconfig.json +18 -0
  9. package/babel.config.json +11 -0
  10. package/lib/cjs/AppApi.d.ts +48 -0
  11. package/lib/cjs/AppApi.js +54 -0
  12. package/lib/cjs/CoreApp.d.ts +58 -0
  13. package/lib/cjs/CoreApp.js +68 -0
  14. package/lib/cjs/MemberApi.d.ts +38 -0
  15. package/lib/cjs/MemberApi.js +45 -0
  16. package/lib/cjs/OrgApi.d.ts +95 -0
  17. package/lib/cjs/OrgApi.js +110 -0
  18. package/lib/cjs/PublicApi.d.ts +105 -0
  19. package/lib/cjs/PublicApi.js +143 -0
  20. package/lib/cjs/UserApi.d.ts +53 -0
  21. package/lib/cjs/UserApi.js +68 -0
  22. package/lib/cjs/dto/IdentityType.d.ts +21 -0
  23. package/lib/cjs/dto/IdentityType.js +25 -0
  24. package/lib/cjs/dto/app/AppData.d.ts +31 -0
  25. package/lib/cjs/dto/app/AppData.js +2 -0
  26. package/lib/cjs/dto/app/AppListDto.d.ts +6 -0
  27. package/lib/cjs/dto/app/AppListDto.js +2 -0
  28. package/lib/cjs/dto/app/AppPurchasedQueryData.d.ts +28 -0
  29. package/lib/cjs/dto/app/AppPurchasedQueryData.js +2 -0
  30. package/lib/cjs/dto/app/AppQueryData.d.ts +42 -0
  31. package/lib/cjs/dto/app/AppQueryData.js +2 -0
  32. package/lib/cjs/dto/member/MemberListDto.d.ts +6 -0
  33. package/lib/cjs/dto/member/MemberListDto.js +2 -0
  34. package/lib/cjs/dto/member/MemberQueryDto.d.ts +35 -0
  35. package/lib/cjs/dto/member/MemberQueryDto.js +2 -0
  36. package/lib/cjs/dto/org/OrgGetMyData.d.ts +21 -0
  37. package/lib/cjs/dto/org/OrgGetMyData.js +2 -0
  38. package/lib/cjs/dto/org/OrgListDto.d.ts +6 -0
  39. package/lib/cjs/dto/org/OrgListDto.js +2 -0
  40. package/lib/cjs/dto/org/OrgQueryDto.d.ts +39 -0
  41. package/lib/cjs/dto/org/OrgQueryDto.js +2 -0
  42. package/lib/cjs/dto/org/OrgReadDto.d.ts +47 -0
  43. package/lib/cjs/dto/org/OrgReadDto.js +2 -0
  44. package/lib/cjs/dto/org/OrgUpdateReadDto.d.ts +39 -0
  45. package/lib/cjs/dto/org/OrgUpdateReadDto.js +2 -0
  46. package/lib/cjs/dto/public/CurrencyItem.d.ts +31 -0
  47. package/lib/cjs/dto/public/CurrencyItem.js +2 -0
  48. package/lib/cjs/dto/public/PlaceCommon.d.ts +43 -0
  49. package/lib/cjs/dto/public/PlaceCommon.js +2 -0
  50. package/lib/cjs/dto/public/PlaceLocation.d.ts +14 -0
  51. package/lib/cjs/dto/public/PlaceLocation.js +2 -0
  52. package/lib/cjs/dto/public/RegionData.d.ts +36 -0
  53. package/lib/cjs/dto/public/RegionData.js +2 -0
  54. package/lib/cjs/dto/user/AuditHistoryDto.d.ts +26 -0
  55. package/lib/cjs/dto/user/AuditHistoryDto.js +2 -0
  56. package/lib/cjs/dto/user/DeviceListDto.d.ts +8 -0
  57. package/lib/cjs/dto/user/DeviceListDto.js +2 -0
  58. package/lib/cjs/i18n/CoreCulture.d.ts +44 -0
  59. package/lib/cjs/i18n/CoreCulture.js +52 -0
  60. package/lib/cjs/i18n/en.json +40 -0
  61. package/lib/cjs/i18n/zh-Hans.json +40 -0
  62. package/lib/cjs/i18n/zh-Hant.json +40 -0
  63. package/lib/cjs/index.d.ts +39 -0
  64. package/lib/cjs/index.js +59 -0
  65. package/lib/cjs/rq/app/AppGetMyRQ.d.ts +19 -0
  66. package/lib/cjs/rq/app/AppGetMyRQ.js +2 -0
  67. package/lib/cjs/rq/app/AppListRQ.d.ts +18 -0
  68. package/lib/cjs/rq/app/AppListRQ.js +2 -0
  69. package/lib/cjs/rq/app/AppPurchasedQueryRQ.d.ts +17 -0
  70. package/lib/cjs/rq/app/AppPurchasedQueryRQ.js +2 -0
  71. package/lib/cjs/rq/app/AppQueryRQ.d.ts +6 -0
  72. package/lib/cjs/rq/app/AppQueryRQ.js +2 -0
  73. package/lib/cjs/rq/member/MemberListRQ.d.ts +18 -0
  74. package/lib/cjs/rq/member/MemberListRQ.js +2 -0
  75. package/lib/cjs/rq/member/MemberQueryRQ.d.ts +10 -0
  76. package/lib/cjs/rq/member/MemberQueryRQ.js +2 -0
  77. package/lib/cjs/rq/org/OrgCreateRQ.d.ts +37 -0
  78. package/lib/cjs/rq/org/OrgCreateRQ.js +2 -0
  79. package/lib/cjs/rq/org/OrgGetMyRQ.d.ts +11 -0
  80. package/lib/cjs/rq/org/OrgGetMyRQ.js +2 -0
  81. package/lib/cjs/rq/org/OrgListRQ.d.ts +12 -0
  82. package/lib/cjs/rq/org/OrgListRQ.js +2 -0
  83. package/lib/cjs/rq/org/OrgQueryRQ.d.ts +11 -0
  84. package/lib/cjs/rq/org/OrgQueryRQ.js +2 -0
  85. package/lib/cjs/rq/org/OrgUpdateRQ.d.ts +37 -0
  86. package/lib/cjs/rq/org/OrgUpdateRQ.js +2 -0
  87. package/lib/cjs/rq/public/CreateBarcodeRQ.d.ts +56 -0
  88. package/lib/cjs/rq/public/CreateBarcodeRQ.js +2 -0
  89. package/lib/cjs/rq/public/PinyinRQ.d.ts +38 -0
  90. package/lib/cjs/rq/public/PinyinRQ.js +21 -0
  91. package/lib/cjs/rq/public/PlaceQueryRQ.d.ts +58 -0
  92. package/lib/cjs/rq/public/PlaceQueryRQ.js +21 -0
  93. package/lib/cjs/rq/user/AuditHistoryRQ.d.ts +19 -0
  94. package/lib/cjs/rq/user/AuditHistoryRQ.js +2 -0
  95. package/lib/mjs/AppApi.d.ts +48 -0
  96. package/lib/mjs/AppApi.js +50 -0
  97. package/lib/mjs/CoreApp.d.ts +58 -0
  98. package/lib/mjs/CoreApp.js +64 -0
  99. package/lib/mjs/MemberApi.d.ts +38 -0
  100. package/lib/mjs/MemberApi.js +41 -0
  101. package/lib/mjs/OrgApi.d.ts +95 -0
  102. package/lib/mjs/OrgApi.js +106 -0
  103. package/lib/mjs/PublicApi.d.ts +105 -0
  104. package/lib/mjs/PublicApi.js +139 -0
  105. package/lib/mjs/UserApi.d.ts +53 -0
  106. package/lib/mjs/UserApi.js +64 -0
  107. package/lib/mjs/dto/IdentityType.d.ts +21 -0
  108. package/lib/mjs/dto/IdentityType.js +22 -0
  109. package/lib/mjs/dto/app/AppData.d.ts +31 -0
  110. package/lib/mjs/dto/app/AppData.js +1 -0
  111. package/lib/mjs/dto/app/AppListDto.d.ts +6 -0
  112. package/lib/mjs/dto/app/AppListDto.js +1 -0
  113. package/lib/mjs/dto/app/AppPurchasedQueryData.d.ts +28 -0
  114. package/lib/mjs/dto/app/AppPurchasedQueryData.js +1 -0
  115. package/lib/mjs/dto/app/AppQueryData.d.ts +42 -0
  116. package/lib/mjs/dto/app/AppQueryData.js +1 -0
  117. package/lib/mjs/dto/member/MemberListDto.d.ts +6 -0
  118. package/lib/mjs/dto/member/MemberListDto.js +1 -0
  119. package/lib/mjs/dto/member/MemberQueryDto.d.ts +35 -0
  120. package/lib/mjs/dto/member/MemberQueryDto.js +1 -0
  121. package/lib/mjs/dto/org/OrgGetMyData.d.ts +21 -0
  122. package/lib/mjs/dto/org/OrgGetMyData.js +1 -0
  123. package/lib/mjs/dto/org/OrgListDto.d.ts +6 -0
  124. package/lib/mjs/dto/org/OrgListDto.js +1 -0
  125. package/lib/mjs/dto/org/OrgQueryDto.d.ts +39 -0
  126. package/lib/mjs/dto/org/OrgQueryDto.js +1 -0
  127. package/lib/mjs/dto/org/OrgReadDto.d.ts +47 -0
  128. package/lib/mjs/dto/org/OrgReadDto.js +1 -0
  129. package/lib/mjs/dto/org/OrgUpdateReadDto.d.ts +39 -0
  130. package/lib/mjs/dto/org/OrgUpdateReadDto.js +1 -0
  131. package/lib/mjs/dto/public/CurrencyItem.d.ts +31 -0
  132. package/lib/mjs/dto/public/CurrencyItem.js +1 -0
  133. package/lib/mjs/dto/public/PlaceCommon.d.ts +43 -0
  134. package/lib/mjs/dto/public/PlaceCommon.js +1 -0
  135. package/lib/mjs/dto/public/PlaceLocation.d.ts +14 -0
  136. package/lib/mjs/dto/public/PlaceLocation.js +1 -0
  137. package/lib/mjs/dto/public/RegionData.d.ts +36 -0
  138. package/lib/mjs/dto/public/RegionData.js +1 -0
  139. package/lib/mjs/dto/user/AuditHistoryDto.d.ts +26 -0
  140. package/lib/mjs/dto/user/AuditHistoryDto.js +1 -0
  141. package/lib/mjs/dto/user/DeviceListDto.d.ts +8 -0
  142. package/lib/mjs/dto/user/DeviceListDto.js +1 -0
  143. package/lib/mjs/i18n/CoreCulture.d.ts +44 -0
  144. package/lib/mjs/i18n/CoreCulture.js +49 -0
  145. package/lib/mjs/i18n/en.json +40 -0
  146. package/lib/mjs/i18n/zh-Hans.json +40 -0
  147. package/lib/mjs/i18n/zh-Hant.json +40 -0
  148. package/lib/mjs/index.d.ts +39 -0
  149. package/lib/mjs/index.js +43 -0
  150. package/lib/mjs/rq/app/AppGetMyRQ.d.ts +19 -0
  151. package/lib/mjs/rq/app/AppGetMyRQ.js +1 -0
  152. package/lib/mjs/rq/app/AppListRQ.d.ts +18 -0
  153. package/lib/mjs/rq/app/AppListRQ.js +1 -0
  154. package/lib/mjs/rq/app/AppPurchasedQueryRQ.d.ts +17 -0
  155. package/lib/mjs/rq/app/AppPurchasedQueryRQ.js +1 -0
  156. package/lib/mjs/rq/app/AppQueryRQ.d.ts +6 -0
  157. package/lib/mjs/rq/app/AppQueryRQ.js +1 -0
  158. package/lib/mjs/rq/member/MemberListRQ.d.ts +18 -0
  159. package/lib/mjs/rq/member/MemberListRQ.js +1 -0
  160. package/lib/mjs/rq/member/MemberQueryRQ.d.ts +10 -0
  161. package/lib/mjs/rq/member/MemberQueryRQ.js +1 -0
  162. package/lib/mjs/rq/org/OrgCreateRQ.d.ts +37 -0
  163. package/lib/mjs/rq/org/OrgCreateRQ.js +1 -0
  164. package/lib/mjs/rq/org/OrgGetMyRQ.d.ts +11 -0
  165. package/lib/mjs/rq/org/OrgGetMyRQ.js +1 -0
  166. package/lib/mjs/rq/org/OrgListRQ.d.ts +12 -0
  167. package/lib/mjs/rq/org/OrgListRQ.js +1 -0
  168. package/lib/mjs/rq/org/OrgQueryRQ.d.ts +11 -0
  169. package/lib/mjs/rq/org/OrgQueryRQ.js +1 -0
  170. package/lib/mjs/rq/org/OrgUpdateRQ.d.ts +37 -0
  171. package/lib/mjs/rq/org/OrgUpdateRQ.js +1 -0
  172. package/lib/mjs/rq/public/CreateBarcodeRQ.d.ts +56 -0
  173. package/lib/mjs/rq/public/CreateBarcodeRQ.js +1 -0
  174. package/lib/mjs/rq/public/PinyinRQ.d.ts +38 -0
  175. package/lib/mjs/rq/public/PinyinRQ.js +18 -0
  176. package/lib/mjs/rq/public/PlaceQueryRQ.d.ts +58 -0
  177. package/lib/mjs/rq/public/PlaceQueryRQ.js +18 -0
  178. package/lib/mjs/rq/user/AuditHistoryRQ.d.ts +19 -0
  179. package/lib/mjs/rq/user/AuditHistoryRQ.js +1 -0
  180. package/package.json +75 -0
  181. package/src/AppApi.ts +66 -0
  182. package/src/CoreApp.ts +75 -0
  183. package/src/MemberApi.ts +51 -0
  184. package/src/OrgApi.ts +134 -0
  185. package/src/PublicApi.ts +183 -0
  186. package/src/UserApi.ts +77 -0
  187. package/src/dto/IdentityType.ts +23 -0
  188. package/src/dto/app/AppData.ts +35 -0
  189. package/src/dto/app/AppListDto.ts +7 -0
  190. package/src/dto/app/AppPurchasedQueryData.ts +32 -0
  191. package/src/dto/app/AppQueryData.ts +49 -0
  192. package/src/dto/member/MemberListDto.ts +7 -0
  193. package/src/dto/member/MemberQueryDto.ts +43 -0
  194. package/src/dto/org/OrgGetMyData.ts +23 -0
  195. package/src/dto/org/OrgListDto.ts +7 -0
  196. package/src/dto/org/OrgQueryDto.ts +47 -0
  197. package/src/dto/org/OrgReadDto.ts +57 -0
  198. package/src/dto/org/OrgUpdateReadDto.ts +47 -0
  199. package/src/dto/public/CurrencyItem.ts +35 -0
  200. package/src/dto/public/PlaceCommon.ts +52 -0
  201. package/src/dto/public/PlaceLocation.ts +15 -0
  202. package/src/dto/public/RegionData.ts +41 -0
  203. package/src/dto/user/AuditHistoryDto.ts +30 -0
  204. package/src/dto/user/DeviceListDto.ts +8 -0
  205. package/src/i18n/CoreCulture.ts +84 -0
  206. package/src/i18n/en.json +40 -0
  207. package/src/i18n/zh-Hans.json +40 -0
  208. package/src/i18n/zh-Hant.json +40 -0
  209. package/src/index.ts +54 -0
  210. package/src/rq/app/AppGetMyRQ.ts +21 -0
  211. package/src/rq/app/AppListRQ.ts +20 -0
  212. package/src/rq/app/AppPurchasedQueryRQ.ts +19 -0
  213. package/src/rq/app/AppQueryRQ.ts +7 -0
  214. package/src/rq/member/MemberListRQ.ts +21 -0
  215. package/src/rq/member/MemberQueryRQ.ts +11 -0
  216. package/src/rq/org/OrgCreateRQ.ts +43 -0
  217. package/src/rq/org/OrgGetMyRQ.ts +11 -0
  218. package/src/rq/org/OrgListRQ.ts +13 -0
  219. package/src/rq/org/OrgQueryRQ.ts +12 -0
  220. package/src/rq/org/OrgUpdateRQ.ts +43 -0
  221. package/src/rq/public/CreateBarcodeRQ.ts +65 -0
  222. package/src/rq/public/PinyinRQ.ts +43 -0
  223. package/src/rq/public/PlaceQueryRQ.ts +67 -0
  224. package/src/rq/user/AuditHistoryRQ.ts +22 -0
  225. package/tsconfig.cjs.json +19 -0
  226. package/tsconfig.json +19 -0
@@ -0,0 +1,58 @@
1
+ import { IApi } from "@etsoo/restclient";
2
+ import { MemberApi } from "./MemberApi";
3
+ import { OrgApi } from "./OrgApi";
4
+ import { AppApi } from "./AppApi";
5
+ import { PublicApi } from "./PublicApi";
6
+ import { UserApi } from "./UserApi";
7
+ import { AuthApi, IApp } from "@etsoo/appscript";
8
+ /**
9
+ * Core application
10
+ * 核心应用程序
11
+ */
12
+ export declare class CoreApp {
13
+ protected app: IApp;
14
+ protected api: IApi;
15
+ _appApi?: AppApi;
16
+ /**
17
+ * Application API
18
+ * 应用程序接口
19
+ */
20
+ get appApi(): AppApi;
21
+ _authApi?: AuthApi;
22
+ /**
23
+ * Authentication API
24
+ * 认证接口
25
+ */
26
+ get authApi(): AuthApi;
27
+ _memberApi?: MemberApi;
28
+ /**
29
+ * Member API
30
+ * 会员接口
31
+ */
32
+ get memberApi(): MemberApi;
33
+ _orgApi?: OrgApi;
34
+ /**
35
+ * Organization API
36
+ * 机构接口
37
+ */
38
+ get orgApi(): OrgApi;
39
+ _publicApi?: PublicApi;
40
+ /**
41
+ * Public API
42
+ * 公共接口
43
+ */
44
+ get publicApi(): PublicApi;
45
+ _userApi?: UserApi;
46
+ /**
47
+ * User API
48
+ * 用户接口
49
+ */
50
+ get userApi(): UserApi;
51
+ /**
52
+ * Constructor
53
+ * 构造函数
54
+ * @param app Base application
55
+ * @param api API
56
+ */
57
+ constructor(app: IApp, api: IApi);
58
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CoreApp = void 0;
4
+ const MemberApi_1 = require("./MemberApi");
5
+ const OrgApi_1 = require("./OrgApi");
6
+ const AppApi_1 = require("./AppApi");
7
+ const PublicApi_1 = require("./PublicApi");
8
+ const UserApi_1 = require("./UserApi");
9
+ const appscript_1 = require("@etsoo/appscript");
10
+ /**
11
+ * Core application
12
+ * 核心应用程序
13
+ */
14
+ class CoreApp {
15
+ /**
16
+ * Application API
17
+ * 应用程序接口
18
+ */
19
+ get appApi() {
20
+ return (this._appApi ?? (this._appApi = new AppApi_1.AppApi(this.app, this.api)));
21
+ }
22
+ /**
23
+ * Authentication API
24
+ * 认证接口
25
+ */
26
+ get authApi() {
27
+ return (this._authApi ?? (this._authApi = new appscript_1.AuthApi(this.app, this.api)));
28
+ }
29
+ /**
30
+ * Member API
31
+ * 会员接口
32
+ */
33
+ get memberApi() {
34
+ return (this._memberApi ?? (this._memberApi = new MemberApi_1.MemberApi(this.app, this.api)));
35
+ }
36
+ /**
37
+ * Organization API
38
+ * 机构接口
39
+ */
40
+ get orgApi() {
41
+ return (this._orgApi ?? (this._orgApi = new OrgApi_1.OrgApi(this.app, this.api)));
42
+ }
43
+ /**
44
+ * Public API
45
+ * 公共接口
46
+ */
47
+ get publicApi() {
48
+ return (this._publicApi ?? (this._publicApi = new PublicApi_1.PublicApi(this.app, this.api)));
49
+ }
50
+ /**
51
+ * User API
52
+ * 用户接口
53
+ */
54
+ get userApi() {
55
+ return (this._userApi ?? (this._userApi = new UserApi_1.UserApi(this.app, this.api)));
56
+ }
57
+ /**
58
+ * Constructor
59
+ * 构造函数
60
+ * @param app Base application
61
+ * @param api API
62
+ */
63
+ constructor(app, api) {
64
+ this.app = app;
65
+ this.api = api;
66
+ }
67
+ }
68
+ exports.CoreApp = CoreApp;
@@ -0,0 +1,38 @@
1
+ import { IApi, IApiPayload } from "@etsoo/restclient";
2
+ import { MemberListRQ } from "./rq/member/MemberListRQ";
3
+ import { MemberQueryRQ } from "./rq/member/MemberQueryRQ";
4
+ import { MemberQueryDto } from "./dto/member/MemberQueryDto";
5
+ import { EntityApi, IApp, IdResultPayload } from "@etsoo/appscript";
6
+ import { MemberListDto } from "./dto/member/MemberListDto";
7
+ /**
8
+ * Member API
9
+ */
10
+ export declare class MemberApi extends EntityApi {
11
+ /**
12
+ * Constructor
13
+ * @param app Application
14
+ * @param api API
15
+ */
16
+ constructor(app: IApp, api?: IApi);
17
+ /**
18
+ * Delete
19
+ * @param id Id
20
+ * @param payload Payload
21
+ * @returns Result
22
+ */
23
+ delete(id: number, payload?: IdResultPayload): Promise<import("@etsoo/shared").IdActionResult | undefined>;
24
+ /**
25
+ * List
26
+ * @param rq Request data
27
+ * @param payload Payload
28
+ * @returns Result
29
+ */
30
+ list(rq: MemberListRQ, payload: IApiPayload<MemberListDto[]>): Promise<MemberListDto[] | undefined>;
31
+ /**
32
+ * Query
33
+ * @param rq Request data
34
+ * @param payload Payload
35
+ * @returns Result
36
+ */
37
+ query(rq: MemberQueryRQ, payload?: IApiPayload<MemberQueryDto[]>): Promise<MemberQueryDto[] | undefined>;
38
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MemberApi = void 0;
4
+ const appscript_1 = require("@etsoo/appscript");
5
+ /**
6
+ * Member API
7
+ */
8
+ class MemberApi extends appscript_1.EntityApi {
9
+ /**
10
+ * Constructor
11
+ * @param app Application
12
+ * @param api API
13
+ */
14
+ constructor(app, api = app.api) {
15
+ super("Member", app, api);
16
+ }
17
+ /**
18
+ * Delete
19
+ * @param id Id
20
+ * @param payload Payload
21
+ * @returns Result
22
+ */
23
+ delete(id, payload) {
24
+ return this.deleteBase(id, payload);
25
+ }
26
+ /**
27
+ * List
28
+ * @param rq Request data
29
+ * @param payload Payload
30
+ * @returns Result
31
+ */
32
+ list(rq, payload) {
33
+ return this.listBase(rq, payload);
34
+ }
35
+ /**
36
+ * Query
37
+ * @param rq Request data
38
+ * @param payload Payload
39
+ * @returns Result
40
+ */
41
+ query(rq, payload) {
42
+ return this.queryBase(rq, payload);
43
+ }
44
+ }
45
+ exports.MemberApi = MemberApi;
@@ -0,0 +1,95 @@
1
+ import { IApi, IApiPayload } from "@etsoo/restclient";
2
+ import { OrgCreateRQ } from "./rq/org/OrgCreateRQ";
3
+ import { OrgUpdateRQ } from "./rq/org/OrgUpdateRQ";
4
+ import { OrgQueryRQ } from "./rq/org/OrgQueryRQ";
5
+ import { OrgQueryDto } from "./dto/org/OrgQueryDto";
6
+ import { OrgReadDto } from "./dto/org/OrgReadDto";
7
+ import { OrgUpdateReadDto } from "./dto/org/OrgUpdateReadDto";
8
+ import { OrgListDto } from "./dto/org/OrgListDto";
9
+ import { AntiforgeryRequestToken, EntityApi, IApp, IdResultPayload, MsgResultPayload } from "@etsoo/appscript";
10
+ import { OrgListRQ } from "./rq/org/OrgListRQ";
11
+ import { OrgGetMyRQ } from "./rq/org/OrgGetMyRQ";
12
+ import { OrgGetMyData } from "./dto/org/OrgGetMyData";
13
+ /**
14
+ * Organization API
15
+ * 机构接口
16
+ */
17
+ export declare class OrgApi extends EntityApi {
18
+ /**
19
+ * Constructor
20
+ * @param app Application
21
+ * @param api API
22
+ */
23
+ constructor(app: IApp, api?: IApi);
24
+ /**
25
+ * Create
26
+ * @param rq Request data
27
+ * @param payload Payload
28
+ * @returns Result
29
+ */
30
+ create(rq: OrgCreateRQ, payload?: IdResultPayload): Promise<import("@etsoo/shared").IdActionResult | undefined>;
31
+ /**
32
+ * Delete
33
+ * @param id Id
34
+ * @param payload Payload
35
+ * @returns Result
36
+ */
37
+ delete(id: number, payload?: IdResultPayload): Promise<import("@etsoo/shared").IdActionResult | undefined>;
38
+ /**
39
+ * Get user's latest accessed organizations
40
+ * @param rq Request data
41
+ * @param payload Payload
42
+ * @returns Result
43
+ */
44
+ getMy(rq: OrgGetMyRQ, payload?: IApiPayload<OrgGetMyData[]>): Promise<OrgGetMyData[] | undefined>;
45
+ /**
46
+ * List
47
+ * @param rq Request data
48
+ * @param payload Payload
49
+ * @returns Result
50
+ */
51
+ list(rq: OrgListRQ, payload?: IApiPayload<OrgListDto[]>): Promise<OrgListDto[] | undefined>;
52
+ /**
53
+ * Query
54
+ * @param rq Request data
55
+ * @param payload Payload
56
+ * @returns Result
57
+ */
58
+ query(rq: OrgQueryRQ, payload?: IApiPayload<OrgQueryDto[]>): Promise<OrgQueryDto[] | undefined>;
59
+ /**
60
+ * Read
61
+ * @param id Id
62
+ * @param payload Payload
63
+ * @returns Result
64
+ */
65
+ read(id: number, payload?: IApiPayload<OrgReadDto>): Promise<OrgReadDto | undefined>;
66
+ /**
67
+ * Get Antiforgery request token
68
+ * 获取反伪造请求令牌
69
+ * @param payload Payload
70
+ * @returns Result
71
+ */
72
+ requestToken(payload?: IApiPayload<AntiforgeryRequestToken>): Promise<AntiforgeryRequestToken | undefined>;
73
+ /**
74
+ * Update
75
+ * @param rq Request data
76
+ * @param payload Payload
77
+ * @returns Result
78
+ */
79
+ update(rq: OrgUpdateRQ, payload?: IdResultPayload): Promise<import("@etsoo/shared").IdActionResult | undefined>;
80
+ /**
81
+ * Upload avatar
82
+ * @param id Organization id
83
+ * @param data Avatar form data
84
+ * @param payload Payload
85
+ * @returns Result
86
+ */
87
+ uploadAvatar(id: number, data: FormData, payload?: MsgResultPayload): Promise<import("@etsoo/shared").MsgActionResult | undefined>;
88
+ /**
89
+ * Update read
90
+ * @param id Id
91
+ * @param payload Payload
92
+ * @returns Result
93
+ */
94
+ updateRead(id: number, payload?: IApiPayload<OrgUpdateReadDto>): Promise<OrgUpdateReadDto | undefined>;
95
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OrgApi = void 0;
4
+ const appscript_1 = require("@etsoo/appscript");
5
+ /**
6
+ * Organization API
7
+ * 机构接口
8
+ */
9
+ class OrgApi extends appscript_1.EntityApi {
10
+ /**
11
+ * Constructor
12
+ * @param app Application
13
+ * @param api API
14
+ */
15
+ constructor(app, api = app.api) {
16
+ super("Org", app, api);
17
+ }
18
+ /**
19
+ * Create
20
+ * @param rq Request data
21
+ * @param payload Payload
22
+ * @returns Result
23
+ */
24
+ create(rq, payload) {
25
+ return this.createBase(rq, payload);
26
+ }
27
+ /**
28
+ * Delete
29
+ * @param id Id
30
+ * @param payload Payload
31
+ * @returns Result
32
+ */
33
+ delete(id, payload) {
34
+ return this.deleteBase(id, payload);
35
+ }
36
+ /**
37
+ * Get user's latest accessed organizations
38
+ * @param rq Request data
39
+ * @param payload Payload
40
+ * @returns Result
41
+ */
42
+ getMy(rq, payload) {
43
+ return this.api.post(`${this.flag}/GetMy`, rq, payload);
44
+ }
45
+ /**
46
+ * List
47
+ * @param rq Request data
48
+ * @param payload Payload
49
+ * @returns Result
50
+ */
51
+ list(rq, payload) {
52
+ return this.listBase(rq, payload);
53
+ }
54
+ /**
55
+ * Query
56
+ * @param rq Request data
57
+ * @param payload Payload
58
+ * @returns Result
59
+ */
60
+ query(rq, payload) {
61
+ return this.queryBase(rq, payload);
62
+ }
63
+ /**
64
+ * Read
65
+ * @param id Id
66
+ * @param payload Payload
67
+ * @returns Result
68
+ */
69
+ read(id, payload) {
70
+ return this.readBase(id, payload);
71
+ }
72
+ /**
73
+ * Get Antiforgery request token
74
+ * 获取反伪造请求令牌
75
+ * @param payload Payload
76
+ * @returns Result
77
+ */
78
+ requestToken(payload) {
79
+ return this.api.get(`${this.flag}/RequestToken`, undefined, payload);
80
+ }
81
+ /**
82
+ * Update
83
+ * @param rq Request data
84
+ * @param payload Payload
85
+ * @returns Result
86
+ */
87
+ update(rq, payload) {
88
+ return this.updateBase(rq, payload);
89
+ }
90
+ /**
91
+ * Upload avatar
92
+ * @param id Organization id
93
+ * @param data Avatar form data
94
+ * @param payload Payload
95
+ * @returns Result
96
+ */
97
+ uploadAvatar(id, data, payload) {
98
+ return this.api.put(`${this.flag}/UploadAvatar/${id}`, data, payload);
99
+ }
100
+ /**
101
+ * Update read
102
+ * @param id Id
103
+ * @param payload Payload
104
+ * @returns Result
105
+ */
106
+ updateRead(id, payload) {
107
+ return this.updateReadBase(id, payload);
108
+ }
109
+ }
110
+ exports.OrgApi = OrgApi;
@@ -0,0 +1,105 @@
1
+ import { IApi, IApiPayload } from "@etsoo/restclient";
2
+ import { ListType, ListType1 } from "@etsoo/shared";
3
+ import { PinyinRQ } from "./rq/public/PinyinRQ";
4
+ import { CreateBarcodeRQ } from "./rq/public/CreateBarcodeRQ";
5
+ import { CurrencyItem } from "./dto/public/CurrencyItem";
6
+ import { RegionData } from "./dto/public/RegionData";
7
+ import { PlaceQueryRQ } from "./rq/public/PlaceQueryRQ";
8
+ import { PlaceCommon } from "./dto/public/PlaceCommon";
9
+ import { BaseApi, Currency, IApp, ProductUnit } from "@etsoo/appscript";
10
+ /**
11
+ * Public API
12
+ * 公共接口
13
+ */
14
+ export declare class PublicApi extends BaseApi {
15
+ /**
16
+ * Constructor
17
+ * @param app Application
18
+ * @param api API
19
+ */
20
+ constructor(app: IApp, api?: IApi);
21
+ /**
22
+ * Create barcode
23
+ * @param rq Request data
24
+ * @param payload Payload
25
+ * @returns Result
26
+ */
27
+ createBarcode(rq: CreateBarcodeRQ, payload?: IApiPayload<string>): Promise<string | undefined>;
28
+ /**
29
+ * Get currency label
30
+ * @param currency Currency
31
+ * @returns Label
32
+ */
33
+ getCurrencyLabel(currency: Currency | string): string;
34
+ /**
35
+ * Get currencies
36
+ * @param ids Currency ids to include and order by
37
+ * @param payload Payload
38
+ * @returns Result
39
+ */
40
+ getCurrencies(ids?: string[], payload?: IApiPayload<CurrencyItem[]>): Promise<CurrencyItem[] | undefined>;
41
+ /**
42
+ * Get Pinyin
43
+ * @param rq Request data
44
+ * @param payload Payload
45
+ * @returns Result
46
+ */
47
+ getPinyin(rq: PinyinRQ, payload?: IApiPayload<string>): Promise<string | undefined>;
48
+ /**
49
+ * Get regions
50
+ * @param ids Region ids to include and order by
51
+ * @param payload Payload
52
+ * @returns Result
53
+ */
54
+ getRegions(ids?: string[], payload?: IApiPayload<RegionData[]>): Promise<RegionData[] | undefined>;
55
+ /**
56
+ * Get product unit's label
57
+ * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
58
+ * @param unit Unit
59
+ * @param isJoined Add the join label like 'per Kg' for Kg
60
+ * @returns Label
61
+ */
62
+ getUnitLabel(unit: ProductUnit | number, isJoined?: boolean | string): string;
63
+ private getUnitJoin;
64
+ /**
65
+ * Get mobile base64 QRCode
66
+ * @param id User id
67
+ * @param host Host URL
68
+ * @param payload Payload
69
+ */
70
+ mobileQRCode(id?: string, host?: string, payload?: IApiPayload<string>): Promise<string | undefined>;
71
+ /**
72
+ * Query place
73
+ * @param rq Request data
74
+ * @param payload Payload
75
+ * @returns Result
76
+ */
77
+ queryPlace(rq: PlaceQueryRQ, payload?: IApiPayload<PlaceCommon[]>): Promise<PlaceCommon[] | undefined>;
78
+ /**
79
+ *
80
+ * Get all repeat options
81
+ * @param options Define the order and limit the items
82
+ * @param isJoined Add the join label
83
+ * @returns Result
84
+ */
85
+ repeatOptions(options?: string[], isJoined?: boolean): ListType[];
86
+ /**
87
+ * Get all supported cultures
88
+ * @param payload Payload
89
+ * @returns Result
90
+ */
91
+ supportedCultures(payload?: IApiPayload<ListType1[]>): Promise<ListType1[] | undefined>;
92
+ /**
93
+ * Get all product units
94
+ * @returns Units
95
+ */
96
+ units(): ListType[];
97
+ /**
98
+ *
99
+ * Get all product units
100
+ * @param options Define the order and limit the items
101
+ * @param isJoined Add the join label like 'per Kg' for Kg
102
+ * @returns Units
103
+ */
104
+ units(options?: string[], isJoined?: boolean): ListType[];
105
+ }
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PublicApi = void 0;
4
+ const shared_1 = require("@etsoo/shared");
5
+ const appscript_1 = require("@etsoo/appscript");
6
+ const unitPrefix = "unit";
7
+ /**
8
+ * Public API
9
+ * 公共接口
10
+ */
11
+ class PublicApi extends appscript_1.BaseApi {
12
+ /**
13
+ * Constructor
14
+ * @param app Application
15
+ * @param api API
16
+ */
17
+ constructor(app, api = app.api) {
18
+ super(app, api);
19
+ }
20
+ /**
21
+ * Create barcode
22
+ * @param rq Request data
23
+ * @param payload Payload
24
+ * @returns Result
25
+ */
26
+ createBarcode(rq, payload) {
27
+ return this.api.post("Public/CreateBarcode", rq, payload);
28
+ }
29
+ /**
30
+ * Get currency label
31
+ * @param currency Currency
32
+ * @returns Label
33
+ */
34
+ getCurrencyLabel(currency) {
35
+ const c = `currency${currency}`;
36
+ return this.app.get(c) ?? c;
37
+ }
38
+ /**
39
+ * Get currencies
40
+ * @param ids Currency ids to include and order by
41
+ * @param payload Payload
42
+ * @returns Result
43
+ */
44
+ getCurrencies(ids, payload) {
45
+ return this.api.post("Public/GetCurrencies", ids, payload);
46
+ }
47
+ /**
48
+ * Get Pinyin
49
+ * @param rq Request data
50
+ * @param payload Payload
51
+ * @returns Result
52
+ */
53
+ getPinyin(rq, payload) {
54
+ return this.api.post("Public/GetPinyin", rq, payload);
55
+ }
56
+ /**
57
+ * Get regions
58
+ * @param ids Region ids to include and order by
59
+ * @param payload Payload
60
+ * @returns Result
61
+ */
62
+ getRegions(ids, payload) {
63
+ return this.api.post("Public/GetRegions", ids, payload);
64
+ }
65
+ /**
66
+ * Get product unit's label
67
+ * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
68
+ * @param unit Unit
69
+ * @param isJoined Add the join label like 'per Kg' for Kg
70
+ * @returns Label
71
+ */
72
+ getUnitLabel(unit, isJoined) {
73
+ const key = appscript_1.ProductUnit[unit];
74
+ const label = this.app.get(unitPrefix + key) ?? key;
75
+ const join = this.getUnitJoin(isJoined);
76
+ if (join) {
77
+ return join.format(label);
78
+ }
79
+ return label;
80
+ }
81
+ getUnitJoin(isJoined) {
82
+ return typeof isJoined === "string"
83
+ ? this.app.get(isJoined) ?? isJoined
84
+ : isJoined
85
+ ? this.app.get("unitJoin")
86
+ : undefined;
87
+ }
88
+ /**
89
+ * Get mobile base64 QRCode
90
+ * @param id User id
91
+ * @param host Host URL
92
+ * @param payload Payload
93
+ */
94
+ mobileQRCode(id, host, payload) {
95
+ return this.api.post("Public/MobileQRCode", { id, host }, payload);
96
+ }
97
+ /**
98
+ * Query place
99
+ * @param rq Request data
100
+ * @param payload Payload
101
+ * @returns Result
102
+ */
103
+ queryPlace(rq, payload) {
104
+ return this.api.post("Public/QueryPlace", rq, payload);
105
+ }
106
+ /**
107
+ *
108
+ * Get all repeat options
109
+ * @param options Define the order and limit the items
110
+ * @param isJoined Add the join label
111
+ * @returns Result
112
+ */
113
+ repeatOptions(options, isJoined = true) {
114
+ options ?? (options = shared_1.DataTypes.getEnumKeys(appscript_1.RepeatOption));
115
+ return this.units(options, isJoined);
116
+ }
117
+ /**
118
+ * Get all supported cultures
119
+ * @param payload Payload
120
+ * @returns Result
121
+ */
122
+ supportedCultures(payload) {
123
+ return this.api.get("Public/SupportedCultures", undefined, payload);
124
+ }
125
+ /**
126
+ *
127
+ * Get all product units
128
+ * @param options Define the order and limit the items
129
+ * @param isJoined Add the join label like 'per Kg' for Kg
130
+ * @returns Units
131
+ */
132
+ units(options, isJoined) {
133
+ options ?? (options = shared_1.DataTypes.getEnumKeys(appscript_1.ProductUnit));
134
+ return options.map((key) => {
135
+ const id = shared_1.DataTypes.getEnumByKey(appscript_1.ProductUnit, key);
136
+ return {
137
+ id,
138
+ label: this.getUnitLabel(id, this.getUnitJoin(isJoined)).formatInitial(true)
139
+ };
140
+ });
141
+ }
142
+ }
143
+ exports.PublicApi = PublicApi;