@etsoo/appscript 1.5.62 → 1.5.63

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 (268) hide show
  1. package/__tests__/app/CoreApp.ts +9 -276
  2. package/__tests__/app/TestApp.ts +136 -0
  3. package/lib/{mjs/erp → cjs/api}/AuthApi.d.ts +12 -5
  4. package/lib/cjs/{erp → api}/AuthApi.js +8 -0
  5. package/lib/{mjs/erp → cjs/api}/EntityApi.d.ts +1 -10
  6. package/lib/cjs/{erp → api}/EntityApi.js +0 -9
  7. package/lib/cjs/api/dto/AntiforgeryRequestToken.d.ts +21 -0
  8. package/{src/erp/dto/ResultPayload.ts → lib/cjs/api/dto/ResultPayload.d.ts} +9 -4
  9. package/lib/{mjs/erp → cjs/api}/rq/QueryPagingData.d.ts +7 -7
  10. package/lib/{mjs/erp/rq/TiplistRQ.d.ts → cjs/api/rq/QueryRQ.d.ts} +8 -4
  11. package/lib/cjs/api/rq/StatusQueryRQ.d.ts +17 -0
  12. package/lib/cjs/api/rq/UpdateModel.d.ts +18 -0
  13. package/lib/cjs/app/CoreApp.d.ts +10 -3
  14. package/lib/cjs/app/CoreApp.js +13 -5
  15. package/lib/cjs/app/IApp.d.ts +2 -2
  16. package/lib/cjs/business/EntityStatus.d.ts +1 -1
  17. package/lib/cjs/business/EntityStatus.js +1 -1
  18. package/lib/cjs/i18n/en.json +2 -0
  19. package/lib/cjs/i18n/zh-Hans.json +2 -0
  20. package/lib/cjs/i18n/zh-Hant.json +2 -0
  21. package/lib/cjs/index.d.ts +67 -87
  22. package/lib/cjs/index.js +26 -48
  23. package/lib/{cjs/erp → mjs/api}/AuthApi.d.ts +12 -5
  24. package/lib/mjs/{erp → api}/AuthApi.js +8 -0
  25. package/lib/{cjs/erp → mjs/api}/EntityApi.d.ts +1 -10
  26. package/lib/mjs/{erp → api}/EntityApi.js +0 -9
  27. package/lib/mjs/api/dto/AntiforgeryRequestToken.d.ts +21 -0
  28. package/lib/{cjs/erp → mjs/api}/dto/ResultPayload.d.ts +9 -1
  29. package/lib/{cjs/erp → mjs/api}/rq/QueryPagingData.d.ts +7 -7
  30. package/lib/{cjs/erp/rq/TiplistRQ.d.ts → mjs/api/rq/QueryRQ.d.ts} +8 -4
  31. package/lib/mjs/api/rq/StatusQueryRQ.d.ts +17 -0
  32. package/lib/mjs/api/rq/UpdateModel.d.ts +18 -0
  33. package/lib/mjs/app/CoreApp.d.ts +10 -3
  34. package/lib/mjs/app/CoreApp.js +13 -5
  35. package/lib/mjs/app/IApp.d.ts +2 -2
  36. package/lib/mjs/business/EntityStatus.d.ts +1 -1
  37. package/lib/mjs/business/EntityStatus.js +1 -1
  38. package/lib/mjs/i18n/en.json +2 -0
  39. package/lib/mjs/i18n/zh-Hans.json +2 -0
  40. package/lib/mjs/i18n/zh-Hant.json +2 -0
  41. package/lib/mjs/index.d.ts +67 -87
  42. package/lib/mjs/index.js +67 -89
  43. package/package.json +72 -69
  44. package/src/{erp → api}/AuthApi.ts +16 -6
  45. package/src/{erp → api}/EntityApi.ts +1 -17
  46. package/src/api/dto/AntiforgeryRequestToken.ts +23 -0
  47. package/{lib/mjs/erp/dto/ResultPayload.d.ts → src/api/dto/ResultPayload.ts} +19 -1
  48. package/src/{erp → api}/rq/QueryPagingData.ts +7 -7
  49. package/src/{erp/rq/TiplistRQ.ts → api/rq/QueryRQ.ts} +9 -4
  50. package/src/api/rq/StatusQueryRQ.ts +19 -0
  51. package/src/api/rq/UpdateModel.ts +20 -0
  52. package/src/app/CoreApp.ts +17 -8
  53. package/src/app/IApp.ts +2 -2
  54. package/src/business/EntityStatus.ts +1 -1
  55. package/src/i18n/en.json +2 -0
  56. package/src/i18n/zh-Hans.json +2 -0
  57. package/src/i18n/zh-Hant.json +2 -0
  58. package/src/index.ts +77 -99
  59. package/.eslintignore +0 -3
  60. package/.eslintrc.json +0 -29
  61. package/.prettierignore +0 -5
  62. package/.prettierrc +0 -6
  63. package/lib/cjs/erp/AddressApi.d.ts +0 -127
  64. package/lib/cjs/erp/AddressApi.js +0 -230
  65. package/lib/cjs/erp/MemberApi.d.ts +0 -22
  66. package/lib/cjs/erp/MemberApi.js +0 -26
  67. package/lib/cjs/erp/OrgApi.d.ts +0 -74
  68. package/lib/cjs/erp/OrgApi.js +0 -94
  69. package/lib/cjs/erp/PublicApi.d.ts +0 -127
  70. package/lib/cjs/erp/PublicApi.js +0 -212
  71. package/lib/cjs/erp/dto/AuditLineDto.d.ts +0 -24
  72. package/lib/cjs/erp/dto/CurrencyDto.d.ts +0 -6
  73. package/lib/cjs/erp/dto/ExchangeRateDto.d.ts +0 -13
  74. package/lib/cjs/erp/dto/ExchangeRateHistoryDto.d.ts +0 -8
  75. package/lib/cjs/erp/dto/ExchangeRateHistoryDto.js +0 -2
  76. package/lib/cjs/erp/dto/OrgDto.d.ts +0 -33
  77. package/lib/cjs/erp/dto/OrgDto.js +0 -2
  78. package/lib/cjs/erp/dto/OrgQueryDto.d.ts +0 -21
  79. package/lib/cjs/erp/dto/OrgQueryDto.js +0 -2
  80. package/lib/cjs/erp/dto/OrgViewDto.d.ts +0 -63
  81. package/lib/cjs/erp/dto/OrgViewDto.js +0 -2
  82. package/lib/cjs/erp/dto/PinDto.d.ts +0 -61
  83. package/lib/cjs/erp/dto/PinDto.js +0 -2
  84. package/lib/cjs/erp/dto/PlaceParsedDto.d.ts +0 -50
  85. package/lib/cjs/erp/dto/PlaceParsedDto.js +0 -2
  86. package/lib/cjs/erp/dto/ResponseActionMessageDto.d.ts +0 -14
  87. package/lib/cjs/erp/dto/ResponseActionMessageDto.js +0 -2
  88. package/lib/cjs/erp/rq/MemberListRQ.d.ts +0 -5
  89. package/lib/cjs/erp/rq/MemberListRQ.js +0 -2
  90. package/lib/cjs/erp/rq/OrgListRQ.d.ts +0 -10
  91. package/lib/cjs/erp/rq/OrgListRQ.js +0 -2
  92. package/lib/cjs/erp/rq/OrgQueryRQ.d.ts +0 -14
  93. package/lib/cjs/erp/rq/OrgQueryRQ.js +0 -2
  94. package/lib/cjs/erp/rq/ParsePinRQ.d.ts +0 -14
  95. package/lib/cjs/erp/rq/ParsePinRQ.js +0 -2
  96. package/lib/cjs/erp/rq/PlaceParseRQ.d.ts +0 -25
  97. package/lib/cjs/erp/rq/PlaceParseRQ.js +0 -2
  98. package/lib/cjs/erp/rq/PlaceQueryRQ.d.ts +0 -58
  99. package/lib/cjs/erp/rq/PlaceQueryRQ.js +0 -21
  100. package/lib/cjs/erp/rq/QueryRQ.d.ts +0 -16
  101. package/lib/cjs/erp/rq/RegionsRQ.d.ts +0 -22
  102. package/lib/cjs/erp/rq/RegionsRQ.js +0 -2
  103. package/lib/cjs/erp/rq/SendActionMessageRQ.d.ts +0 -26
  104. package/lib/cjs/erp/rq/SendActionMessageRQ.js +0 -2
  105. package/lib/cjs/erp/rq/TiplistRQ.js +0 -2
  106. package/lib/mjs/erp/AddressApi.d.ts +0 -127
  107. package/lib/mjs/erp/AddressApi.js +0 -226
  108. package/lib/mjs/erp/MemberApi.d.ts +0 -22
  109. package/lib/mjs/erp/MemberApi.js +0 -22
  110. package/lib/mjs/erp/OrgApi.d.ts +0 -74
  111. package/lib/mjs/erp/OrgApi.js +0 -90
  112. package/lib/mjs/erp/PublicApi.d.ts +0 -127
  113. package/lib/mjs/erp/PublicApi.js +0 -208
  114. package/lib/mjs/erp/dto/AuditLineDto.d.ts +0 -24
  115. package/lib/mjs/erp/dto/CurrencyDto.d.ts +0 -6
  116. package/lib/mjs/erp/dto/ExchangeRateDto.d.ts +0 -13
  117. package/lib/mjs/erp/dto/ExchangeRateHistoryDto.d.ts +0 -8
  118. package/lib/mjs/erp/dto/ExchangeRateHistoryDto.js +0 -1
  119. package/lib/mjs/erp/dto/OrgDto.d.ts +0 -33
  120. package/lib/mjs/erp/dto/OrgDto.js +0 -1
  121. package/lib/mjs/erp/dto/OrgQueryDto.d.ts +0 -21
  122. package/lib/mjs/erp/dto/OrgQueryDto.js +0 -1
  123. package/lib/mjs/erp/dto/OrgViewDto.d.ts +0 -63
  124. package/lib/mjs/erp/dto/OrgViewDto.js +0 -1
  125. package/lib/mjs/erp/dto/PinDto.d.ts +0 -61
  126. package/lib/mjs/erp/dto/PinDto.js +0 -1
  127. package/lib/mjs/erp/dto/PlaceParsedDto.d.ts +0 -50
  128. package/lib/mjs/erp/dto/PlaceParsedDto.js +0 -1
  129. package/lib/mjs/erp/dto/ResponseActionMessageDto.d.ts +0 -14
  130. package/lib/mjs/erp/dto/ResponseActionMessageDto.js +0 -1
  131. package/lib/mjs/erp/rq/MemberListRQ.d.ts +0 -5
  132. package/lib/mjs/erp/rq/MemberListRQ.js +0 -1
  133. package/lib/mjs/erp/rq/OrgListRQ.d.ts +0 -10
  134. package/lib/mjs/erp/rq/OrgListRQ.js +0 -1
  135. package/lib/mjs/erp/rq/OrgQueryRQ.d.ts +0 -14
  136. package/lib/mjs/erp/rq/OrgQueryRQ.js +0 -1
  137. package/lib/mjs/erp/rq/ParsePinRQ.d.ts +0 -14
  138. package/lib/mjs/erp/rq/ParsePinRQ.js +0 -1
  139. package/lib/mjs/erp/rq/PlaceParseRQ.d.ts +0 -25
  140. package/lib/mjs/erp/rq/PlaceParseRQ.js +0 -1
  141. package/lib/mjs/erp/rq/PlaceQueryRQ.d.ts +0 -58
  142. package/lib/mjs/erp/rq/PlaceQueryRQ.js +0 -18
  143. package/lib/mjs/erp/rq/QueryRQ.d.ts +0 -16
  144. package/lib/mjs/erp/rq/RegionsRQ.d.ts +0 -22
  145. package/lib/mjs/erp/rq/RegionsRQ.js +0 -1
  146. package/lib/mjs/erp/rq/SendActionMessageRQ.d.ts +0 -26
  147. package/lib/mjs/erp/rq/SendActionMessageRQ.js +0 -1
  148. package/lib/mjs/erp/rq/TiplistRQ.js +0 -1
  149. package/src/erp/AddressApi.ts +0 -310
  150. package/src/erp/MemberApi.ts +0 -28
  151. package/src/erp/OrgApi.ts +0 -136
  152. package/src/erp/PublicApi.ts +0 -282
  153. package/src/erp/dto/AuditLineDto.ts +0 -27
  154. package/src/erp/dto/CurrencyDto.ts +0 -7
  155. package/src/erp/dto/ExchangeRateDto.ts +0 -14
  156. package/src/erp/dto/ExchangeRateHistoryDto.ts +0 -9
  157. package/src/erp/dto/OrgDto.ts +0 -39
  158. package/src/erp/dto/OrgQueryDto.ts +0 -24
  159. package/src/erp/dto/OrgViewDto.ts +0 -78
  160. package/src/erp/dto/PinDto.ts +0 -71
  161. package/src/erp/dto/PlaceParsedDto.ts +0 -58
  162. package/src/erp/dto/ResponseActionMessageDto.ts +0 -16
  163. package/src/erp/rq/MemberListRQ.ts +0 -6
  164. package/src/erp/rq/OrgListRQ.ts +0 -11
  165. package/src/erp/rq/OrgQueryRQ.ts +0 -16
  166. package/src/erp/rq/ParsePinRQ.ts +0 -15
  167. package/src/erp/rq/PlaceParseRQ.ts +0 -28
  168. package/src/erp/rq/PlaceQueryRQ.ts +0 -67
  169. package/src/erp/rq/QueryRQ.ts +0 -18
  170. package/src/erp/rq/RegionsRQ.ts +0 -26
  171. package/src/erp/rq/SendActionMessageRQ.ts +0 -29
  172. package/lib/cjs/{erp → api}/BaseApi.d.ts +0 -0
  173. package/lib/cjs/{erp → api}/BaseApi.js +0 -0
  174. package/lib/cjs/{erp/dto/ApiRefreshTokenDto.js → api/dto/AntiforgeryRequestToken.js} +0 -0
  175. package/lib/cjs/{erp → api}/dto/ApiRefreshTokenDto.d.ts +0 -0
  176. package/lib/cjs/{erp/dto/AuditLineDto.js → api/dto/ApiRefreshTokenDto.js} +0 -0
  177. package/lib/cjs/{erp → api}/dto/IdLabelDto.d.ts +0 -0
  178. package/lib/cjs/{erp → api}/dto/IdLabelDto.js +0 -0
  179. package/lib/cjs/{erp → api}/dto/IdLabelPrimaryDto.d.ts +0 -0
  180. package/lib/cjs/{erp → api}/dto/IdLabelPrimaryDto.js +0 -0
  181. package/lib/cjs/{erp → api}/dto/InitCallDto.d.ts +0 -0
  182. package/lib/cjs/{erp → api}/dto/InitCallDto.js +0 -0
  183. package/lib/cjs/{erp → api}/dto/ResultPayload.js +0 -0
  184. package/lib/cjs/{erp → api}/rq/ApiRefreshTokenRQ.d.ts +0 -0
  185. package/lib/cjs/{erp → api}/rq/ApiRefreshTokenRQ.js +0 -0
  186. package/lib/cjs/{erp → api}/rq/AuthRequest.d.ts +0 -0
  187. package/lib/cjs/{erp → api}/rq/AuthRequest.js +0 -0
  188. package/lib/cjs/{erp → api}/rq/GetLogInUrlRQ.d.ts +0 -0
  189. package/lib/cjs/{erp → api}/rq/GetLogInUrlRQ.js +0 -0
  190. package/lib/cjs/{erp → api}/rq/LoginIdRQ.d.ts +0 -0
  191. package/lib/cjs/{erp → api}/rq/LoginIdRQ.js +0 -0
  192. package/lib/cjs/{erp → api}/rq/LoginRQ.d.ts +1 -1
  193. package/lib/cjs/{erp → api}/rq/LoginRQ.js +0 -0
  194. package/lib/cjs/{erp → api}/rq/MergeRQ.d.ts +0 -0
  195. package/lib/cjs/{erp → api}/rq/MergeRQ.js +0 -0
  196. package/lib/cjs/{erp → api}/rq/QueryPagingData.js +0 -0
  197. package/lib/cjs/{erp → api}/rq/QueryRQ.js +0 -0
  198. package/lib/cjs/{erp → api}/rq/RefreshTokenRQ.d.ts +0 -0
  199. package/lib/cjs/{erp → api}/rq/RefreshTokenRQ.js +0 -0
  200. package/lib/cjs/{erp → api}/rq/ResetPasswordRQ.d.ts +0 -0
  201. package/lib/cjs/{erp → api}/rq/ResetPasswordRQ.js +0 -0
  202. package/lib/cjs/{erp → api}/rq/SignoutRQ.d.ts +0 -0
  203. package/lib/cjs/{erp → api}/rq/SignoutRQ.js +0 -0
  204. package/lib/cjs/{erp/dto/CurrencyDto.js → api/rq/StatusQueryRQ.js} +0 -0
  205. package/lib/cjs/{erp → api}/rq/SwitchOrgRQ.d.ts +0 -0
  206. package/lib/cjs/{erp → api}/rq/SwitchOrgRQ.js +0 -0
  207. package/lib/cjs/{erp → api}/rq/TokenRQ.d.ts +0 -0
  208. package/lib/cjs/{erp → api}/rq/TokenRQ.js +0 -0
  209. package/lib/cjs/{erp/dto/ExchangeRateDto.js → api/rq/UpdateModel.js} +0 -0
  210. package/lib/cjs/{erp → api}/rq/UpdateStatusRQ.d.ts +0 -0
  211. package/lib/cjs/{erp → api}/rq/UpdateStatusRQ.js +0 -0
  212. package/lib/mjs/{erp → api}/BaseApi.d.ts +0 -0
  213. package/lib/mjs/{erp → api}/BaseApi.js +0 -0
  214. package/lib/mjs/{erp/dto/ApiRefreshTokenDto.js → api/dto/AntiforgeryRequestToken.js} +0 -0
  215. package/lib/mjs/{erp → api}/dto/ApiRefreshTokenDto.d.ts +0 -0
  216. package/lib/mjs/{erp/dto/AuditLineDto.js → api/dto/ApiRefreshTokenDto.js} +0 -0
  217. package/lib/mjs/{erp → api}/dto/IdLabelDto.d.ts +0 -0
  218. package/lib/mjs/{erp → api}/dto/IdLabelDto.js +0 -0
  219. package/lib/mjs/{erp → api}/dto/IdLabelPrimaryDto.d.ts +0 -0
  220. package/lib/mjs/{erp → api}/dto/IdLabelPrimaryDto.js +0 -0
  221. package/lib/mjs/{erp → api}/dto/InitCallDto.d.ts +0 -0
  222. package/lib/mjs/{erp → api}/dto/InitCallDto.js +0 -0
  223. package/lib/mjs/{erp → api}/dto/ResultPayload.js +0 -0
  224. package/lib/mjs/{erp → api}/rq/ApiRefreshTokenRQ.d.ts +0 -0
  225. package/lib/mjs/{erp → api}/rq/ApiRefreshTokenRQ.js +0 -0
  226. package/lib/mjs/{erp → api}/rq/AuthRequest.d.ts +0 -0
  227. package/lib/mjs/{erp → api}/rq/AuthRequest.js +0 -0
  228. package/lib/mjs/{erp → api}/rq/GetLogInUrlRQ.d.ts +0 -0
  229. package/lib/mjs/{erp → api}/rq/GetLogInUrlRQ.js +0 -0
  230. package/lib/mjs/{erp → api}/rq/LoginIdRQ.d.ts +0 -0
  231. package/lib/mjs/{erp → api}/rq/LoginIdRQ.js +0 -0
  232. package/lib/mjs/{erp → api}/rq/LoginRQ.d.ts +1 -1
  233. package/lib/mjs/{erp → api}/rq/LoginRQ.js +0 -0
  234. package/lib/mjs/{erp → api}/rq/MergeRQ.d.ts +0 -0
  235. package/lib/mjs/{erp → api}/rq/MergeRQ.js +0 -0
  236. package/lib/mjs/{erp → api}/rq/QueryPagingData.js +0 -0
  237. package/lib/mjs/{erp → api}/rq/QueryRQ.js +0 -0
  238. package/lib/mjs/{erp → api}/rq/RefreshTokenRQ.d.ts +0 -0
  239. package/lib/mjs/{erp → api}/rq/RefreshTokenRQ.js +0 -0
  240. package/lib/mjs/{erp → api}/rq/ResetPasswordRQ.d.ts +0 -0
  241. package/lib/mjs/{erp → api}/rq/ResetPasswordRQ.js +0 -0
  242. package/lib/mjs/{erp → api}/rq/SignoutRQ.d.ts +0 -0
  243. package/lib/mjs/{erp → api}/rq/SignoutRQ.js +0 -0
  244. package/lib/mjs/{erp/dto/CurrencyDto.js → api/rq/StatusQueryRQ.js} +0 -0
  245. package/lib/mjs/{erp → api}/rq/SwitchOrgRQ.d.ts +0 -0
  246. package/lib/mjs/{erp → api}/rq/SwitchOrgRQ.js +0 -0
  247. package/lib/mjs/{erp → api}/rq/TokenRQ.d.ts +0 -0
  248. package/lib/mjs/{erp → api}/rq/TokenRQ.js +0 -0
  249. package/lib/mjs/{erp/dto/ExchangeRateDto.js → api/rq/UpdateModel.js} +0 -0
  250. package/lib/mjs/{erp → api}/rq/UpdateStatusRQ.d.ts +0 -0
  251. package/lib/mjs/{erp → api}/rq/UpdateStatusRQ.js +0 -0
  252. package/src/{erp → api}/BaseApi.ts +0 -0
  253. package/src/{erp → api}/dto/ApiRefreshTokenDto.ts +0 -0
  254. package/src/{erp → api}/dto/IdLabelDto.ts +0 -0
  255. package/src/{erp → api}/dto/IdLabelPrimaryDto.ts +0 -0
  256. package/src/{erp → api}/dto/InitCallDto.ts +0 -0
  257. package/src/{erp → api}/rq/ApiRefreshTokenRQ.ts +0 -0
  258. package/src/{erp → api}/rq/AuthRequest.ts +0 -0
  259. package/src/{erp → api}/rq/GetLogInUrlRQ.ts +0 -0
  260. package/src/{erp → api}/rq/LoginIdRQ.ts +0 -0
  261. package/src/{erp → api}/rq/LoginRQ.ts +1 -1
  262. /package/src/{erp → api}/rq/MergeRQ.ts +0 -0
  263. /package/src/{erp → api}/rq/RefreshTokenRQ.ts +0 -0
  264. /package/src/{erp → api}/rq/ResetPasswordRQ.ts +0 -0
  265. /package/src/{erp → api}/rq/SignoutRQ.ts +0 -0
  266. /package/src/{erp → api}/rq/SwitchOrgRQ.ts +0 -0
  267. /package/src/{erp → api}/rq/TokenRQ.ts +0 -0
  268. /package/src/{erp → api}/rq/UpdateStatusRQ.ts +0 -0
@@ -1,90 +0,0 @@
1
- import { EntityApi } from './EntityApi';
2
- const cachedOrgs = {};
3
- /**
4
- * Organization API
5
- */
6
- export class OrgApi extends EntityApi {
7
- /**
8
- * Constructor
9
- * @param app Application
10
- */
11
- constructor(app) {
12
- super('Organization', app);
13
- }
14
- /**
15
- * Check API service's availability
16
- * @param api API service id
17
- * @param payload Payload
18
- * @returns Result
19
- */
20
- checkApiService(api, payload) {
21
- payload ?? (payload = { showLoading: false });
22
- return this.api.get(`${this.flag}/CheckApiService`, { api }, payload);
23
- }
24
- list(items, serviceId) {
25
- if (typeof items === 'object') {
26
- if (typeof serviceId === 'number')
27
- return undefined;
28
- return this.listBase(items, serviceId);
29
- }
30
- else {
31
- if (typeof serviceId === 'object')
32
- return undefined;
33
- return this.listBase({ queryPaging: items, serviceId }, { defaultValue: [], showLoading: false });
34
- }
35
- }
36
- /**
37
- * Query
38
- * @param rq Request data
39
- * @param payload Payload
40
- * @returns Result
41
- */
42
- query(rq, payload) {
43
- return this.queryBase(rq, payload);
44
- }
45
- /**
46
- * Read
47
- * @param id Id
48
- * @param payload Payload
49
- * @param reload Reload data
50
- * @returns Result
51
- */
52
- async read(id, payload, reload = false) {
53
- let data = cachedOrgs[id];
54
- if (data == null || reload) {
55
- data = await this.readBase(id, payload);
56
- if (data != null)
57
- cachedOrgs[id] = data;
58
- }
59
- return data;
60
- }
61
- /**
62
- * Send action message
63
- * @param rq Request data
64
- * @param payload Payload
65
- * @returns Result
66
- */
67
- sendActionMessage(rq, payload) {
68
- const appId = 'serviceId' in this.app.settings ? this.app.settings.serviceId : 0;
69
- payload ?? (payload = { showLoading: false });
70
- return this.api.post('System/SendActionMessage', { ...rq, appId }, payload);
71
- }
72
- /**
73
- * Update
74
- * @param data Modal data
75
- * @param payload Payload
76
- * @returns Result
77
- */
78
- update(data, payload) {
79
- return super.updateBase(data, payload);
80
- }
81
- /**
82
- * Read for update
83
- * @param id Id
84
- * @param payload Payload
85
- * @returns Result
86
- */
87
- updateRead(id, payload) {
88
- return super.updateReadBase(id, payload);
89
- }
90
- }
@@ -1,127 +0,0 @@
1
- import { IApiPayload } from '@etsoo/restclient';
2
- import { ListType, ListType1 } from '@etsoo/shared';
3
- import { Currency } from '../business/Currency';
4
- import { ProductUnit } from '../business/ProductUnit';
5
- import { BaseApi } from './BaseApi';
6
- import { CurrencyDto } from './dto/CurrencyDto';
7
- import { ExchangeRateDto } from './dto/ExchangeRateDto';
8
- import { ExchangeRateHistoryDto } from './dto/ExchangeRateHistoryDto';
9
- import { PinDto } from './dto/PinDto';
10
- import { ParsePinRQ } from './rq/ParsePinRQ';
11
- /**
12
- * Public API
13
- */
14
- export declare class PublicApi extends BaseApi {
15
- /**
16
- * Default currency
17
- */
18
- defaultCurrency: string | Currency;
19
- /**
20
- * Asset units
21
- * @returns Result
22
- */
23
- assetUnits(): ListType[];
24
- /**
25
- * Asset string id units
26
- * @returns Result
27
- */
28
- assetStrUnits(): ListType1[];
29
- /**
30
- * Base units
31
- * @returns Result
32
- */
33
- baseUnits(): ListType1[];
34
- /**
35
- * Get currencies
36
- * @param names Limited currency names for local data, undefined will try to retrive remotely
37
- * @returns Result
38
- */
39
- currencies(): Promise<CurrencyDto[] | undefined>;
40
- currencies(names: string[] | Currency[] | boolean): ListType1[];
41
- /**
42
- * Get exchange amount
43
- * @param amount Amount
44
- * @param sourceCurrency Source currency
45
- * @param targetCurrency Target currency
46
- * @returns Result
47
- */
48
- exchangeAmount(amount: number, sourceCurrency: Currency | string, targetCurrency?: Currency | string): Promise<number | undefined>;
49
- /**
50
- * Get exchange rate
51
- * @param currency Currency
52
- * @param payload Payload
53
- * @param reload Reload data
54
- * @returns Result
55
- */
56
- exchangeRate(currency: Currency | string, payload?: IApiPayload<ExchangeRateDto>, reload?: boolean): Promise<ExchangeRateDto | undefined>;
57
- /**
58
- * Get exchange rate history
59
- * @param currencies Currencies
60
- * @param months Max months
61
- * @param payload Payload
62
- * @returns Result
63
- */
64
- exchangeRateHistory(currencies: (Currency | string)[], months?: number, payload?: IApiPayload<ExchangeRateHistoryDto[]>): Promise<ExchangeRateHistoryDto[] | undefined>;
65
- /**
66
- * Get organization's avatar URL
67
- * @param id Organization id
68
- * @returns Result
69
- */
70
- getOrgAvatar(id: number): string;
71
- /**
72
- * Get currency label
73
- * @param currency Currency
74
- * @returns Label
75
- */
76
- getCurrencyLabel(currency: Currency | string): string;
77
- /**
78
- * Get product unit's label
79
- * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
80
- * @param unit Unit
81
- * @param isJoined Add the join label like 'per Kg' for Kg
82
- * @returns Label
83
- */
84
- getUnitLabel(unit: ProductUnit | number, isJoined?: boolean | string): string;
85
- private getUnitJoin;
86
- /**
87
- * Get mobile base64 QRCode
88
- * @param id User id
89
- * @param host Host URL
90
- * @param payload Payload
91
- */
92
- mobileQRCode(id?: string, host?: string, payload?: IApiPayload<string>): Promise<string | undefined>;
93
- /**
94
- * Parse Pin data
95
- * @param input Request data
96
- * @param payload Payload
97
- * @returns Result
98
- */
99
- parsePin(input: ParsePinRQ | string, payload?: IApiPayload<PinDto>): Promise<PinDto | undefined>;
100
- /**
101
- *
102
- * Get all repeat options
103
- * @param options Define the order and limit the items
104
- * @param isJoined Add the join label like 'per Kg' for Kg
105
- * @returns Units
106
- */
107
- repeatOptions(options?: string[], isJoined?: boolean): ListType[];
108
- /**
109
- * Get all supported cultures
110
- * @param payload Payload
111
- * @returns Result
112
- */
113
- supportedCultures(payload?: IApiPayload<ListType1[]>): Promise<ListType1[] | undefined>;
114
- /**
115
- * Get all product units
116
- * @returns Units
117
- */
118
- units(): ListType[];
119
- /**
120
- *
121
- * Get all product units
122
- * @param options Define the order and limit the items
123
- * @param isJoined Add the join label like 'per Kg' for Kg
124
- * @returns Units
125
- */
126
- units(options?: string[], isJoined?: boolean): ListType[];
127
- }
@@ -1,208 +0,0 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import { Currencies } from '../business/Currency';
3
- import { AssetUnits, ProductUnit } from '../business/ProductUnit';
4
- import { RepeatOption } from '../business/RepeatOption';
5
- import { BaseApi } from './BaseApi';
6
- const cachedCurrencyRates = {};
7
- const unitPrefix = 'unit';
8
- /**
9
- * Public API
10
- */
11
- export class PublicApi extends BaseApi {
12
- constructor() {
13
- super(...arguments);
14
- /**
15
- * Default currency
16
- */
17
- this.defaultCurrency = this.app.defaultRegion.currency;
18
- }
19
- /**
20
- * Asset units
21
- * @returns Result
22
- */
23
- assetUnits() {
24
- return this.app.getEnumList(AssetUnits, unitPrefix);
25
- }
26
- /**
27
- * Asset string id units
28
- * @returns Result
29
- */
30
- assetStrUnits() {
31
- return this.app.getEnumStrList(AssetUnits, unitPrefix);
32
- }
33
- /**
34
- * Base units
35
- * @returns Result
36
- */
37
- baseUnits() {
38
- return this.app.getEnumStrList(ProductUnit, unitPrefix);
39
- }
40
- currencies(names) {
41
- if (typeof names === 'boolean' && names) {
42
- return Currencies.map((name) => ({
43
- id: name,
44
- label: this.app.get(`currency${name}`) ?? name
45
- }));
46
- }
47
- if (Array.isArray(names)) {
48
- return names.map((name) => ({
49
- id: name,
50
- label: this.app.get(`currency${name}`) ?? name
51
- }));
52
- }
53
- return this.api.get('Public/GetCurrencies', undefined, {
54
- defaultValue: [],
55
- showLoading: false
56
- });
57
- }
58
- /**
59
- * Get exchange amount
60
- * @param amount Amount
61
- * @param sourceCurrency Source currency
62
- * @param targetCurrency Target currency
63
- * @returns Result
64
- */
65
- async exchangeAmount(amount, sourceCurrency, targetCurrency) {
66
- targetCurrency ?? (targetCurrency = this.app.defaultRegion.currency);
67
- const [sourceRate, targetRate] = await Promise.all([
68
- this.exchangeRate(sourceCurrency, {
69
- showLoading: false
70
- }),
71
- this.exchangeRate(targetCurrency, {
72
- showLoading: false
73
- })
74
- ]);
75
- if (sourceRate == null || targetRate == null)
76
- return undefined;
77
- const result = Math.round((1000 * amount * sourceRate.exchangeRate) /
78
- targetRate.exchangeRate) / 1000;
79
- return result;
80
- }
81
- /**
82
- * Get exchange rate
83
- * @param currency Currency
84
- * @param payload Payload
85
- * @param reload Reload data
86
- * @returns Result
87
- */
88
- async exchangeRate(currency, payload, reload = false) {
89
- let rate = cachedCurrencyRates[currency];
90
- if (rate == null || reload) {
91
- rate =
92
- currency === this.defaultCurrency
93
- ? { exchangeRate: 100, updateTime: new Date() }
94
- : await this.api.get(`Public/ExchangeRate/${currency}`, undefined, payload);
95
- if (rate == null)
96
- return undefined;
97
- cachedCurrencyRates[currency] = rate;
98
- }
99
- return rate;
100
- }
101
- /**
102
- * Get exchange rate history
103
- * @param currencies Currencies
104
- * @param months Max months
105
- * @param payload Payload
106
- * @returns Result
107
- */
108
- exchangeRateHistory(currencies, months, payload) {
109
- payload ?? (payload = { defaultValue: [] });
110
- return this.api.post('Public/ExchangeRateHistory', { currencies, months }, payload);
111
- }
112
- /**
113
- * Get organization's avatar URL
114
- * @param id Organization id
115
- * @returns Result
116
- */
117
- getOrgAvatar(id) {
118
- return `${this.api.baseUrl}Storage/OrgAvatar/${id}`;
119
- }
120
- /**
121
- * Get currency label
122
- * @param currency Currency
123
- * @returns Label
124
- */
125
- getCurrencyLabel(currency) {
126
- const c = `currency${currency}`;
127
- return this.app.get(c) ?? c;
128
- }
129
- /**
130
- * Get product unit's label
131
- * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
132
- * @param unit Unit
133
- * @param isJoined Add the join label like 'per Kg' for Kg
134
- * @returns Label
135
- */
136
- getUnitLabel(unit, isJoined) {
137
- const key = ProductUnit[unit];
138
- const label = this.app.get(unitPrefix + key) ?? key;
139
- const join = this.getUnitJoin(isJoined);
140
- if (join) {
141
- return join.format(label);
142
- }
143
- return label;
144
- }
145
- getUnitJoin(isJoined) {
146
- return typeof isJoined === 'string'
147
- ? this.app.get(isJoined) ?? isJoined
148
- : isJoined
149
- ? this.app.get('unitJoin')
150
- : undefined;
151
- }
152
- /**
153
- * Get mobile base64 QRCode
154
- * @param id User id
155
- * @param host Host URL
156
- * @param payload Payload
157
- */
158
- mobileQRCode(id, host, payload) {
159
- return this.api.post('Public/MobileQRCode', { id, host }, payload);
160
- }
161
- /**
162
- * Parse Pin data
163
- * @param input Request data
164
- * @param payload Payload
165
- * @returns Result
166
- */
167
- parsePin(input, payload) {
168
- const rq = typeof input === 'string' ? { pin: input } : input;
169
- rq.language ?? (rq.language = this.app.culture);
170
- return this.api.post('Public/ParsePin', rq, payload);
171
- }
172
- /**
173
- *
174
- * Get all repeat options
175
- * @param options Define the order and limit the items
176
- * @param isJoined Add the join label like 'per Kg' for Kg
177
- * @returns Units
178
- */
179
- repeatOptions(options, isJoined = true) {
180
- options ?? (options = DataTypes.getEnumKeys(RepeatOption));
181
- return this.units(options, isJoined);
182
- }
183
- /**
184
- * Get all supported cultures
185
- * @param payload Payload
186
- * @returns Result
187
- */
188
- supportedCultures(payload) {
189
- return this.api.get('Public/SupportedCultures', undefined, payload);
190
- }
191
- /**
192
- *
193
- * Get all product units
194
- * @param options Define the order and limit the items
195
- * @param isJoined Add the join label like 'per Kg' for Kg
196
- * @returns Units
197
- */
198
- units(options, isJoined) {
199
- options ?? (options = DataTypes.getEnumKeys(ProductUnit));
200
- return options.map((key) => {
201
- const id = DataTypes.getEnumByKey(ProductUnit, key);
202
- return {
203
- id,
204
- label: this.getUnitLabel(id, this.getUnitJoin(isJoined)).formatInitial(true)
205
- };
206
- });
207
- }
208
- }
@@ -1,24 +0,0 @@
1
- import { IApiPayload } from '@etsoo/restclient';
2
- /**
3
- * Audit line data
4
- */
5
- export type AuditLineDto = {
6
- id: number;
7
- creation: Date;
8
- user: string;
9
- action: string;
10
- changes?: AuditLineChangesDto;
11
- oldData?: Record<string, unknown>;
12
- newData?: Record<string, unknown>;
13
- };
14
- /**
15
- * Audit line changes data
16
- */
17
- export type AuditLineChangesDto = {
18
- oldData: Record<string, unknown>;
19
- newData: Record<string, unknown>;
20
- };
21
- /**
22
- * Audit line API payload
23
- */
24
- export type AuditLinePayload = IApiPayload<AuditLineDto[]>;
@@ -1,6 +0,0 @@
1
- import { ListType1 } from '@etsoo/shared';
2
- import { ExchangeRateDto } from './ExchangeRateDto';
3
- /**
4
- * Currency data
5
- */
6
- export type CurrencyDto = ListType1 & ExchangeRateDto;
@@ -1,13 +0,0 @@
1
- /**
2
- * Exchange rate data
3
- */
4
- export type ExchangeRateDto = {
5
- /**
6
- * Exchange rate
7
- */
8
- exchangeRate: number;
9
- /**
10
- * Update time
11
- */
12
- updateTime: string | Date;
13
- };
@@ -1,8 +0,0 @@
1
- import { Currency } from '../../business/Currency';
2
- import { ExchangeRateDto } from './ExchangeRateDto';
3
- /**
4
- * Exchange rate history data
5
- */
6
- export type ExchangeRateHistoryDto = ExchangeRateDto & {
7
- id: Currency;
8
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- /**
2
- * Organization data
3
- */
4
- export type OrgDto = {
5
- /**
6
- * Id
7
- */
8
- id: number;
9
- /**
10
- * Region id
11
- */
12
- regionId: string;
13
- /**
14
- * Name
15
- */
16
- name: string;
17
- /**
18
- * Identifier
19
- */
20
- identifier: string;
21
- /**
22
- * Brand
23
- */
24
- brand?: string;
25
- /**
26
- * Trade as
27
- */
28
- tradeAs?: string;
29
- /**
30
- * Parent organization
31
- */
32
- parentId?: number;
33
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,21 +0,0 @@
1
- /**
2
- * Organization query data
3
- */
4
- export type OrgQueryDto = {
5
- /**
6
- * Id
7
- */
8
- id: number;
9
- /**
10
- * Brand, like ETSOO
11
- */
12
- brand?: string;
13
- /**
14
- * Name, like ETSOO NZ LIMITED
15
- */
16
- name: string;
17
- /**
18
- * Creation
19
- */
20
- creation: string | Date;
21
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,63 +0,0 @@
1
- import { EntityStatus } from '../../business/EntityStatus';
2
- export type OrgViewDto = {
3
- /**
4
- * Id
5
- */
6
- id: number;
7
- /**
8
- * Entity id
9
- */
10
- entityId: number;
11
- /**
12
- * Trade as
13
- */
14
- tradeAs?: string;
15
- /**
16
- * Brand, like ETSOO
17
- */
18
- brand?: string;
19
- /**
20
- * Name, like ETSOO NZ LIMITED
21
- */
22
- name: string;
23
- /**
24
- * Country or region id, like CN = China
25
- */
26
- regionId?: string;
27
- /**
28
- * State id
29
- */
30
- stateId?: string;
31
- /**
32
- * City id
33
- */
34
- cityId?: string;
35
- /**
36
- * Identifier id
37
- */
38
- identifier?: string;
39
- /**
40
- * Avatar or logo
41
- */
42
- avatar?: string;
43
- /**
44
- * Corporate or personal
45
- */
46
- corporate?: boolean;
47
- /**
48
- * Expiry time
49
- */
50
- expiry?: string | Date;
51
- /**
52
- * Entity status
53
- */
54
- entityStatus: EntityStatus;
55
- /**
56
- * Parent organization id
57
- */
58
- parentId?: number;
59
- /**
60
- * Creation
61
- */
62
- creation: string | Date;
63
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,61 +0,0 @@
1
- /**
2
- * Pin data
3
- * 身份证信息
4
- */
5
- export type PinDto = {
6
- /**
7
- * Region id
8
- * 地区编号
9
- */
10
- regionId?: string;
11
- /**
12
- * State or province
13
- * 州 / 省
14
- */
15
- state?: string;
16
- /**
17
- * State or province id
18
- * 州 / 省编号
19
- */
20
- stateId?: string;
21
- /**
22
- * City
23
- * 城市
24
- */
25
- city?: string;
26
- /**
27
- * City id
28
- * 城市编号
29
- */
30
- cityId?: number;
31
- /**
32
- * District
33
- * 区县
34
- */
35
- district?: string;
36
- /**
37
- * District id
38
- * 区县编号
39
- */
40
- districtId?: number;
41
- /**
42
- * Merged previous district
43
- * 合并的原区县
44
- */
45
- mergedDistrict?: string;
46
- /**
47
- * Gender
48
- * 性别
49
- */
50
- gender?: 'F' | 'M';
51
- /**
52
- * Birthday
53
- * 生日
54
- */
55
- birthday?: string | Date;
56
- /**
57
- * Whether the form is legal
58
- * 是否形式合法
59
- */
60
- valid: boolean;
61
- };
@@ -1 +0,0 @@
1
- export {};