@etsoo/appscript 1.5.62 → 1.5.64

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 (274) hide show
  1. package/README.md +97 -71
  2. package/__tests__/app/CoreApp.ts +9 -276
  3. package/__tests__/app/TestApp.ts +136 -0
  4. package/babel.config.json +8 -8
  5. package/lib/{mjs/erp → cjs/api}/AuthApi.d.ts +12 -5
  6. package/lib/cjs/{erp → api}/AuthApi.js +8 -0
  7. package/lib/{mjs/erp → cjs/api}/EntityApi.d.ts +1 -10
  8. package/lib/cjs/{erp → api}/EntityApi.js +0 -9
  9. package/lib/cjs/api/dto/AntiforgeryRequestToken.d.ts +21 -0
  10. package/lib/{mjs/erp → cjs/api}/dto/AuditLineDto.d.ts +1 -1
  11. package/lib/cjs/{erp → api}/dto/PinDto.d.ts +1 -1
  12. package/{src/erp/dto/ResultPayload.ts → lib/cjs/api/dto/ResultPayload.d.ts} +9 -4
  13. package/lib/{mjs/erp → cjs/api}/rq/QueryPagingData.d.ts +7 -7
  14. package/lib/{mjs/erp/rq/TiplistRQ.d.ts → cjs/api/rq/QueryRQ.d.ts} +8 -4
  15. package/lib/cjs/api/rq/StatusQueryRQ.d.ts +17 -0
  16. package/lib/cjs/api/rq/UpdateModel.d.ts +18 -0
  17. package/lib/cjs/app/CoreApp.d.ts +10 -3
  18. package/lib/cjs/app/CoreApp.js +13 -5
  19. package/lib/cjs/app/IApp.d.ts +2 -2
  20. package/lib/cjs/business/EntityStatus.d.ts +1 -1
  21. package/lib/cjs/business/EntityStatus.js +1 -1
  22. package/lib/cjs/i18n/en.json +2 -0
  23. package/lib/cjs/i18n/zh-Hans.json +2 -0
  24. package/lib/cjs/i18n/zh-Hant.json +2 -0
  25. package/lib/cjs/index.d.ts +69 -87
  26. package/lib/cjs/index.js +28 -48
  27. package/lib/{cjs/erp → mjs/api}/AuthApi.d.ts +12 -5
  28. package/lib/mjs/{erp → api}/AuthApi.js +8 -0
  29. package/lib/{cjs/erp → mjs/api}/EntityApi.d.ts +1 -10
  30. package/lib/mjs/{erp → api}/EntityApi.js +0 -9
  31. package/lib/mjs/api/dto/AntiforgeryRequestToken.d.ts +21 -0
  32. package/lib/{cjs/erp → mjs/api}/dto/AuditLineDto.d.ts +1 -1
  33. package/lib/mjs/{erp → api}/dto/PinDto.d.ts +1 -1
  34. package/lib/{cjs/erp → mjs/api}/dto/ResultPayload.d.ts +9 -1
  35. package/lib/{cjs/erp → mjs/api}/rq/QueryPagingData.d.ts +7 -7
  36. package/lib/{cjs/erp/rq/TiplistRQ.d.ts → mjs/api/rq/QueryRQ.d.ts} +8 -4
  37. package/lib/mjs/api/rq/StatusQueryRQ.d.ts +17 -0
  38. package/lib/mjs/api/rq/UpdateModel.d.ts +18 -0
  39. package/lib/mjs/app/CoreApp.d.ts +10 -3
  40. package/lib/mjs/app/CoreApp.js +13 -5
  41. package/lib/mjs/app/IApp.d.ts +2 -2
  42. package/lib/mjs/business/EntityStatus.d.ts +1 -1
  43. package/lib/mjs/business/EntityStatus.js +1 -1
  44. package/lib/mjs/i18n/en.json +2 -0
  45. package/lib/mjs/i18n/zh-Hans.json +2 -0
  46. package/lib/mjs/i18n/zh-Hant.json +2 -0
  47. package/lib/mjs/index.d.ts +69 -87
  48. package/lib/mjs/index.js +69 -89
  49. package/package.json +72 -69
  50. package/src/{erp → api}/AuthApi.ts +16 -6
  51. package/src/{erp → api}/EntityApi.ts +1 -17
  52. package/src/api/dto/AntiforgeryRequestToken.ts +23 -0
  53. package/src/api/dto/AuditLineDto.ts +27 -0
  54. package/src/api/dto/PinDto.ts +71 -0
  55. package/{lib/mjs/erp/dto/ResultPayload.d.ts → src/api/dto/ResultPayload.ts} +19 -1
  56. package/src/{erp → api}/rq/QueryPagingData.ts +7 -7
  57. package/src/{erp/rq/TiplistRQ.ts → api/rq/QueryRQ.ts} +9 -4
  58. package/src/api/rq/StatusQueryRQ.ts +19 -0
  59. package/src/api/rq/UpdateModel.ts +20 -0
  60. package/src/app/CoreApp.ts +17 -8
  61. package/src/app/IApp.ts +2 -2
  62. package/src/business/EntityStatus.ts +1 -1
  63. package/src/i18n/en.json +2 -0
  64. package/src/i18n/zh-Hans.json +2 -0
  65. package/src/i18n/zh-Hant.json +2 -0
  66. package/src/index.ts +79 -99
  67. package/tsconfig.cjs.json +17 -17
  68. package/tsconfig.json +17 -17
  69. package/.eslintignore +0 -3
  70. package/.eslintrc.json +0 -29
  71. package/.prettierignore +0 -5
  72. package/.prettierrc +0 -6
  73. package/lib/cjs/erp/AddressApi.d.ts +0 -127
  74. package/lib/cjs/erp/AddressApi.js +0 -230
  75. package/lib/cjs/erp/MemberApi.d.ts +0 -22
  76. package/lib/cjs/erp/MemberApi.js +0 -26
  77. package/lib/cjs/erp/OrgApi.d.ts +0 -74
  78. package/lib/cjs/erp/OrgApi.js +0 -94
  79. package/lib/cjs/erp/PublicApi.d.ts +0 -127
  80. package/lib/cjs/erp/PublicApi.js +0 -212
  81. package/lib/cjs/erp/dto/CurrencyDto.d.ts +0 -6
  82. package/lib/cjs/erp/dto/ExchangeRateDto.d.ts +0 -13
  83. package/lib/cjs/erp/dto/ExchangeRateHistoryDto.d.ts +0 -8
  84. package/lib/cjs/erp/dto/OrgDto.d.ts +0 -33
  85. package/lib/cjs/erp/dto/OrgDto.js +0 -2
  86. package/lib/cjs/erp/dto/OrgQueryDto.d.ts +0 -21
  87. package/lib/cjs/erp/dto/OrgQueryDto.js +0 -2
  88. package/lib/cjs/erp/dto/OrgViewDto.d.ts +0 -63
  89. package/lib/cjs/erp/dto/OrgViewDto.js +0 -2
  90. package/lib/cjs/erp/dto/PlaceParsedDto.d.ts +0 -50
  91. package/lib/cjs/erp/dto/PlaceParsedDto.js +0 -2
  92. package/lib/cjs/erp/dto/ResponseActionMessageDto.d.ts +0 -14
  93. package/lib/cjs/erp/dto/ResponseActionMessageDto.js +0 -2
  94. package/lib/cjs/erp/rq/MemberListRQ.d.ts +0 -5
  95. package/lib/cjs/erp/rq/MemberListRQ.js +0 -2
  96. package/lib/cjs/erp/rq/OrgListRQ.d.ts +0 -10
  97. package/lib/cjs/erp/rq/OrgListRQ.js +0 -2
  98. package/lib/cjs/erp/rq/OrgQueryRQ.d.ts +0 -14
  99. package/lib/cjs/erp/rq/OrgQueryRQ.js +0 -2
  100. package/lib/cjs/erp/rq/ParsePinRQ.d.ts +0 -14
  101. package/lib/cjs/erp/rq/ParsePinRQ.js +0 -2
  102. package/lib/cjs/erp/rq/PlaceParseRQ.d.ts +0 -25
  103. package/lib/cjs/erp/rq/PlaceParseRQ.js +0 -2
  104. package/lib/cjs/erp/rq/PlaceQueryRQ.d.ts +0 -58
  105. package/lib/cjs/erp/rq/PlaceQueryRQ.js +0 -21
  106. package/lib/cjs/erp/rq/QueryRQ.d.ts +0 -16
  107. package/lib/cjs/erp/rq/RegionsRQ.d.ts +0 -22
  108. package/lib/cjs/erp/rq/RegionsRQ.js +0 -2
  109. package/lib/cjs/erp/rq/SendActionMessageRQ.d.ts +0 -26
  110. package/lib/cjs/erp/rq/SendActionMessageRQ.js +0 -2
  111. package/lib/cjs/erp/rq/TiplistRQ.js +0 -2
  112. package/lib/mjs/erp/AddressApi.d.ts +0 -127
  113. package/lib/mjs/erp/AddressApi.js +0 -226
  114. package/lib/mjs/erp/MemberApi.d.ts +0 -22
  115. package/lib/mjs/erp/MemberApi.js +0 -22
  116. package/lib/mjs/erp/OrgApi.d.ts +0 -74
  117. package/lib/mjs/erp/OrgApi.js +0 -90
  118. package/lib/mjs/erp/PublicApi.d.ts +0 -127
  119. package/lib/mjs/erp/PublicApi.js +0 -208
  120. package/lib/mjs/erp/dto/CurrencyDto.d.ts +0 -6
  121. package/lib/mjs/erp/dto/ExchangeRateDto.d.ts +0 -13
  122. package/lib/mjs/erp/dto/ExchangeRateHistoryDto.d.ts +0 -8
  123. package/lib/mjs/erp/dto/OrgDto.d.ts +0 -33
  124. package/lib/mjs/erp/dto/OrgDto.js +0 -1
  125. package/lib/mjs/erp/dto/OrgQueryDto.d.ts +0 -21
  126. package/lib/mjs/erp/dto/OrgQueryDto.js +0 -1
  127. package/lib/mjs/erp/dto/OrgViewDto.d.ts +0 -63
  128. package/lib/mjs/erp/dto/OrgViewDto.js +0 -1
  129. package/lib/mjs/erp/dto/PlaceParsedDto.d.ts +0 -50
  130. package/lib/mjs/erp/dto/PlaceParsedDto.js +0 -1
  131. package/lib/mjs/erp/dto/ResponseActionMessageDto.d.ts +0 -14
  132. package/lib/mjs/erp/dto/ResponseActionMessageDto.js +0 -1
  133. package/lib/mjs/erp/rq/MemberListRQ.d.ts +0 -5
  134. package/lib/mjs/erp/rq/MemberListRQ.js +0 -1
  135. package/lib/mjs/erp/rq/OrgListRQ.d.ts +0 -10
  136. package/lib/mjs/erp/rq/OrgListRQ.js +0 -1
  137. package/lib/mjs/erp/rq/OrgQueryRQ.d.ts +0 -14
  138. package/lib/mjs/erp/rq/OrgQueryRQ.js +0 -1
  139. package/lib/mjs/erp/rq/ParsePinRQ.d.ts +0 -14
  140. package/lib/mjs/erp/rq/ParsePinRQ.js +0 -1
  141. package/lib/mjs/erp/rq/PlaceParseRQ.d.ts +0 -25
  142. package/lib/mjs/erp/rq/PlaceParseRQ.js +0 -1
  143. package/lib/mjs/erp/rq/PlaceQueryRQ.d.ts +0 -58
  144. package/lib/mjs/erp/rq/PlaceQueryRQ.js +0 -18
  145. package/lib/mjs/erp/rq/QueryRQ.d.ts +0 -16
  146. package/lib/mjs/erp/rq/RegionsRQ.d.ts +0 -22
  147. package/lib/mjs/erp/rq/RegionsRQ.js +0 -1
  148. package/lib/mjs/erp/rq/SendActionMessageRQ.d.ts +0 -26
  149. package/lib/mjs/erp/rq/SendActionMessageRQ.js +0 -1
  150. package/lib/mjs/erp/rq/TiplistRQ.js +0 -1
  151. package/src/erp/AddressApi.ts +0 -310
  152. package/src/erp/MemberApi.ts +0 -28
  153. package/src/erp/OrgApi.ts +0 -136
  154. package/src/erp/PublicApi.ts +0 -282
  155. package/src/erp/dto/AuditLineDto.ts +0 -27
  156. package/src/erp/dto/CurrencyDto.ts +0 -7
  157. package/src/erp/dto/ExchangeRateDto.ts +0 -14
  158. package/src/erp/dto/ExchangeRateHistoryDto.ts +0 -9
  159. package/src/erp/dto/OrgDto.ts +0 -39
  160. package/src/erp/dto/OrgQueryDto.ts +0 -24
  161. package/src/erp/dto/OrgViewDto.ts +0 -78
  162. package/src/erp/dto/PinDto.ts +0 -71
  163. package/src/erp/dto/PlaceParsedDto.ts +0 -58
  164. package/src/erp/dto/ResponseActionMessageDto.ts +0 -16
  165. package/src/erp/rq/MemberListRQ.ts +0 -6
  166. package/src/erp/rq/OrgListRQ.ts +0 -11
  167. package/src/erp/rq/OrgQueryRQ.ts +0 -16
  168. package/src/erp/rq/ParsePinRQ.ts +0 -15
  169. package/src/erp/rq/PlaceParseRQ.ts +0 -28
  170. package/src/erp/rq/PlaceQueryRQ.ts +0 -67
  171. package/src/erp/rq/QueryRQ.ts +0 -18
  172. package/src/erp/rq/RegionsRQ.ts +0 -26
  173. package/src/erp/rq/SendActionMessageRQ.ts +0 -29
  174. package/lib/cjs/{erp → api}/BaseApi.d.ts +0 -0
  175. package/lib/cjs/{erp → api}/BaseApi.js +0 -0
  176. package/lib/cjs/{erp/dto/ApiRefreshTokenDto.js → api/dto/AntiforgeryRequestToken.js} +0 -0
  177. package/lib/cjs/{erp → api}/dto/ApiRefreshTokenDto.d.ts +0 -0
  178. package/lib/cjs/{erp/dto/AuditLineDto.js → api/dto/ApiRefreshTokenDto.js} +0 -0
  179. package/lib/cjs/{erp/dto/CurrencyDto.js → api/dto/AuditLineDto.js} +0 -0
  180. package/lib/cjs/{erp → api}/dto/IdLabelDto.d.ts +0 -0
  181. package/lib/cjs/{erp → api}/dto/IdLabelDto.js +0 -0
  182. package/lib/cjs/{erp → api}/dto/IdLabelPrimaryDto.d.ts +0 -0
  183. package/lib/cjs/{erp → api}/dto/IdLabelPrimaryDto.js +0 -0
  184. package/lib/cjs/{erp → api}/dto/InitCallDto.d.ts +0 -0
  185. package/lib/cjs/{erp → api}/dto/InitCallDto.js +0 -0
  186. package/lib/cjs/{erp → api}/dto/PinDto.js +0 -0
  187. package/lib/cjs/{erp → api}/dto/ResultPayload.js +0 -0
  188. package/lib/cjs/{erp → api}/rq/ApiRefreshTokenRQ.d.ts +0 -0
  189. package/lib/cjs/{erp → api}/rq/ApiRefreshTokenRQ.js +0 -0
  190. package/lib/cjs/{erp → api}/rq/AuthRequest.d.ts +0 -0
  191. package/lib/cjs/{erp → api}/rq/AuthRequest.js +0 -0
  192. package/lib/cjs/{erp → api}/rq/GetLogInUrlRQ.d.ts +0 -0
  193. package/lib/cjs/{erp → api}/rq/GetLogInUrlRQ.js +0 -0
  194. package/lib/cjs/{erp → api}/rq/LoginIdRQ.d.ts +0 -0
  195. package/lib/cjs/{erp → api}/rq/LoginIdRQ.js +0 -0
  196. package/lib/cjs/{erp → api}/rq/LoginRQ.d.ts +1 -1
  197. package/lib/cjs/{erp → api}/rq/LoginRQ.js +0 -0
  198. package/lib/cjs/{erp → api}/rq/MergeRQ.d.ts +0 -0
  199. package/lib/cjs/{erp → api}/rq/MergeRQ.js +0 -0
  200. package/lib/cjs/{erp → api}/rq/QueryPagingData.js +0 -0
  201. package/lib/cjs/{erp → api}/rq/QueryRQ.js +0 -0
  202. package/lib/cjs/{erp → api}/rq/RefreshTokenRQ.d.ts +0 -0
  203. package/lib/cjs/{erp → api}/rq/RefreshTokenRQ.js +0 -0
  204. package/lib/cjs/{erp → api}/rq/ResetPasswordRQ.d.ts +0 -0
  205. package/lib/cjs/{erp → api}/rq/ResetPasswordRQ.js +0 -0
  206. package/lib/cjs/{erp → api}/rq/SignoutRQ.d.ts +0 -0
  207. package/lib/cjs/{erp → api}/rq/SignoutRQ.js +0 -0
  208. package/lib/cjs/{erp/dto/ExchangeRateDto.js → api/rq/StatusQueryRQ.js} +0 -0
  209. package/lib/cjs/{erp → api}/rq/SwitchOrgRQ.d.ts +0 -0
  210. package/lib/cjs/{erp → api}/rq/SwitchOrgRQ.js +0 -0
  211. package/lib/cjs/{erp → api}/rq/TokenRQ.d.ts +0 -0
  212. package/lib/cjs/{erp → api}/rq/TokenRQ.js +0 -0
  213. package/lib/cjs/{erp/dto/ExchangeRateHistoryDto.js → api/rq/UpdateModel.js} +0 -0
  214. package/lib/cjs/{erp → api}/rq/UpdateStatusRQ.d.ts +0 -0
  215. package/lib/cjs/{erp → api}/rq/UpdateStatusRQ.js +0 -0
  216. package/lib/mjs/{erp → api}/BaseApi.d.ts +0 -0
  217. package/lib/mjs/{erp → api}/BaseApi.js +0 -0
  218. package/lib/mjs/{erp/dto/ApiRefreshTokenDto.js → api/dto/AntiforgeryRequestToken.js} +0 -0
  219. package/lib/mjs/{erp → api}/dto/ApiRefreshTokenDto.d.ts +0 -0
  220. package/lib/mjs/{erp/dto/AuditLineDto.js → api/dto/ApiRefreshTokenDto.js} +0 -0
  221. package/lib/mjs/{erp/dto/CurrencyDto.js → api/dto/AuditLineDto.js} +0 -0
  222. package/lib/mjs/{erp → api}/dto/IdLabelDto.d.ts +0 -0
  223. package/lib/mjs/{erp → api}/dto/IdLabelDto.js +0 -0
  224. package/lib/mjs/{erp → api}/dto/IdLabelPrimaryDto.d.ts +0 -0
  225. package/lib/mjs/{erp → api}/dto/IdLabelPrimaryDto.js +0 -0
  226. package/lib/mjs/{erp → api}/dto/InitCallDto.d.ts +0 -0
  227. package/lib/mjs/{erp → api}/dto/InitCallDto.js +0 -0
  228. package/lib/mjs/{erp → api}/dto/PinDto.js +0 -0
  229. package/lib/mjs/{erp → api}/dto/ResultPayload.js +0 -0
  230. package/lib/mjs/{erp → api}/rq/ApiRefreshTokenRQ.d.ts +0 -0
  231. package/lib/mjs/{erp → api}/rq/ApiRefreshTokenRQ.js +0 -0
  232. package/lib/mjs/{erp → api}/rq/AuthRequest.d.ts +0 -0
  233. package/lib/mjs/{erp → api}/rq/AuthRequest.js +0 -0
  234. package/lib/mjs/{erp → api}/rq/GetLogInUrlRQ.d.ts +0 -0
  235. package/lib/mjs/{erp → api}/rq/GetLogInUrlRQ.js +0 -0
  236. package/lib/mjs/{erp → api}/rq/LoginIdRQ.d.ts +0 -0
  237. package/lib/mjs/{erp → api}/rq/LoginIdRQ.js +0 -0
  238. package/lib/mjs/{erp → api}/rq/LoginRQ.d.ts +1 -1
  239. package/lib/mjs/{erp → api}/rq/LoginRQ.js +0 -0
  240. package/lib/mjs/{erp → api}/rq/MergeRQ.d.ts +0 -0
  241. package/lib/mjs/{erp → api}/rq/MergeRQ.js +0 -0
  242. package/lib/mjs/{erp → api}/rq/QueryPagingData.js +0 -0
  243. package/lib/mjs/{erp → api}/rq/QueryRQ.js +0 -0
  244. package/lib/mjs/{erp → api}/rq/RefreshTokenRQ.d.ts +0 -0
  245. package/lib/mjs/{erp → api}/rq/RefreshTokenRQ.js +0 -0
  246. package/lib/mjs/{erp → api}/rq/ResetPasswordRQ.d.ts +0 -0
  247. package/lib/mjs/{erp → api}/rq/ResetPasswordRQ.js +0 -0
  248. package/lib/mjs/{erp → api}/rq/SignoutRQ.d.ts +0 -0
  249. package/lib/mjs/{erp → api}/rq/SignoutRQ.js +0 -0
  250. package/lib/mjs/{erp/dto/ExchangeRateDto.js → api/rq/StatusQueryRQ.js} +0 -0
  251. package/lib/mjs/{erp → api}/rq/SwitchOrgRQ.d.ts +0 -0
  252. package/lib/mjs/{erp → api}/rq/SwitchOrgRQ.js +0 -0
  253. package/lib/mjs/{erp → api}/rq/TokenRQ.d.ts +0 -0
  254. package/lib/mjs/{erp → api}/rq/TokenRQ.js +0 -0
  255. package/lib/mjs/{erp/dto/ExchangeRateHistoryDto.js → api/rq/UpdateModel.js} +0 -0
  256. package/lib/mjs/{erp → api}/rq/UpdateStatusRQ.d.ts +0 -0
  257. package/lib/mjs/{erp → api}/rq/UpdateStatusRQ.js +0 -0
  258. package/src/{erp → api}/BaseApi.ts +0 -0
  259. package/src/{erp → api}/dto/ApiRefreshTokenDto.ts +0 -0
  260. package/src/{erp → api}/dto/IdLabelDto.ts +0 -0
  261. package/src/{erp → api}/dto/IdLabelPrimaryDto.ts +0 -0
  262. package/src/{erp → api}/dto/InitCallDto.ts +0 -0
  263. package/src/{erp → api}/rq/ApiRefreshTokenRQ.ts +0 -0
  264. package/src/{erp → api}/rq/AuthRequest.ts +0 -0
  265. package/src/{erp → api}/rq/GetLogInUrlRQ.ts +0 -0
  266. package/src/{erp → api}/rq/LoginIdRQ.ts +0 -0
  267. package/src/{erp → api}/rq/LoginRQ.ts +1 -1
  268. /package/src/{erp → api}/rq/MergeRQ.ts +0 -0
  269. /package/src/{erp → api}/rq/RefreshTokenRQ.ts +0 -0
  270. /package/src/{erp → api}/rq/ResetPasswordRQ.ts +0 -0
  271. /package/src/{erp → api}/rq/SignoutRQ.ts +0 -0
  272. /package/src/{erp → api}/rq/SwitchOrgRQ.ts +0 -0
  273. /package/src/{erp → api}/rq/TokenRQ.ts +0 -0
  274. /package/src/{erp → api}/rq/UpdateStatusRQ.ts +0 -0
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # AppScript
2
+
2
3
  **TypeScript application scripts shared by different frameworks.**
3
4
 
4
5
  ## Installing
@@ -16,120 +17,145 @@ $ yarn add @etsoo/appscript
16
17
  ```
17
18
 
18
19
  ## Client data security framework
19
- - CoreApp, constructor, reads deviceId from session storage
20
- - restore, when deviceId is empty, try to restore from persisted storage, get the passphrase (encryption / decription) or remove all data keys
21
- - initCall (everytime the application running), if passphrase is there, just return, otherwise read from serverside
22
- - device updated will cause validataion failure. Please call initCall(undefined, true);
20
+
21
+ - CoreApp, constructor, reads deviceId from session storage
22
+ - restore, when deviceId is empty, try to restore from persisted storage, get the passphrase (encryption / decription) or remove all data keys
23
+ - initCall (everytime the application running), if passphrase is there, just return, otherwise read from serverside
24
+ - device updated will cause validataion failure. Please call initCall(undefined, true);
23
25
 
24
26
  ## Structure
25
27
 
26
28
  ### address - Address (region) related
27
29
 
28
- #### AddressContinent.ts ####
29
- - AddressContinent - Continent Enum
30
+ #### AddressContinent.ts
31
+
32
+ - AddressContinent - Continent Enum
33
+
34
+ #### AddressRegion.ts
30
35
 
31
- #### AddressRegion.ts ####
32
- - IAddressRegion - Country or region interface
33
- - AddressRegion - Address or region
36
+ - IAddressRegion - Country or region interface
37
+ - AddressRegion - Address or region
34
38
 
35
- #### AddressUtils.ts ####
36
- - getRegion - Get region from regions and detected region and language
39
+ #### AddressUtils.ts
40
+
41
+ - getRegion - Get region from regions and detected region and language
37
42
 
38
43
  ### app - Application related
39
44
 
40
- #### AppSettings.ts ####
41
- - IAppSettings - App settings interface
45
+ #### AppSettings.ts
46
+
47
+ - IAppSettings - App settings interface
48
+
49
+ #### CoreApp.ts
42
50
 
43
- #### CoreApp.ts ####
44
- - IDetectIPCallback - Detect IP callback interface
45
- - ICoreApp - Core application interface
46
- - CoreApp - Core application
51
+ - IDetectIPCallback - Detect IP callback interface
52
+ - ICoreApp - Core application interface
53
+ - CoreApp - Core application
47
54
 
48
- #### ExternalSettings.ts ####
49
- - IExternalSettings - External settings items
50
- - IExternalSettingsHost - External settings host passed by external script
55
+ #### ExternalSettings.ts
51
56
 
52
- #### UserRole.ts ####
53
- - Standard user roles
57
+ - IExternalSettings - External settings items
58
+ - IExternalSettingsHost - External settings host passed by external script
59
+
60
+ #### UserRole.ts
61
+
62
+ - Standard user roles
54
63
 
55
64
  ### bridges - Works with Electron
56
65
 
57
- #### BridgeUtils.ts ####
58
- - BridgeUtils - Bridge utils
66
+ #### BridgeUtils.ts
67
+
68
+ - BridgeUtils - Bridge utils
59
69
 
60
- #### FlutterHost.ts ####
61
- - FlutterHost - Flutter JavaScript Host
70
+ #### FlutterHost.ts
62
71
 
63
- #### IBridgeHost.ts ####
64
- - IBridgeHost - Bridge host interface
72
+ - FlutterHost - Flutter JavaScript Host
73
+
74
+ #### IBridgeHost.ts
75
+
76
+ - IBridgeHost - Bridge host interface
65
77
 
66
78
  ### business - Business logics
67
79
 
68
- #### BusinessTax.ts ####
69
- - IBusinessTax - Business tax interface
70
- - BusinessTax - Business tax
80
+ #### BusinessTax.ts
81
+
82
+ - IBusinessTax - Business tax interface
83
+ - BusinessTax - Business tax
71
84
 
72
- #### BusinessUtils.ts ####
73
- - getCurrencies - Get currency collection
74
- - getEntityStatusLabel - Get entity status's label
75
- - getEntityStatus - Get entity status collection
76
- - getUnitLabel - Get product unit's label
77
- - getUnits - Get all product units
78
- - getRepeatOptions - Get all repeat options
85
+ #### BusinessUtils.ts
79
86
 
80
- #### EntityStatus.ts ####
81
- - EntityStatus - Standard entity status enum
87
+ - getCurrencies - Get currency collection
88
+ - getEntityStatusLabel - Get entity status's label
89
+ - getEntityStatus - Get entity status collection
90
+ - getUnitLabel - Get product unit's label
91
+ - getUnits - Get all product units
92
+ - getRepeatOptions - Get all repeat options
82
93
 
83
- #### ProductUnit.ts ####
84
- - ProductUnit - Product units enum
94
+ #### EntityStatus.ts
85
95
 
86
- #### RepeatOption.ts ####
87
- - RepeatOption - Repeat options
96
+ - EntityStatus - Standard entity status enum
97
+
98
+ #### ProductUnit.ts
99
+
100
+ - ProductUnit - Product units enum
101
+
102
+ #### RepeatOption.ts
103
+
104
+ - RepeatOption - Repeat options
88
105
 
89
106
  ### custom - Custom dynamic component rendering
90
107
 
91
- #### CustomFieldData.ts ####
92
- - CustomFieldSpace - Custom field space (12 columns)
93
- - CustomFieldData - Custom field data
108
+ #### CustomFieldData.ts
109
+
110
+ - CustomFieldSpace - Custom field space (12 columns)
111
+ - CustomFieldData - Custom field data
94
112
 
95
113
  ### def - Type definition
96
114
 
97
- #### ListItem.ts ####
98
- - ListItem - List item definition
115
+ #### ListItem.ts
116
+
117
+ - ListItem - List item definition
99
118
 
100
119
  ### i18n - Multiple cultures
101
120
 
102
121
  ### result - API action result
103
122
 
104
- #### ActionResult.ts ####
105
- - ActionResult - API call action result extends IActionResult
123
+ #### ActionResult.ts
124
+
125
+ - ActionResult - API call action result extends IActionResult
106
126
 
107
- #### ActionResultError.ts ####
108
- - ActionResultError - Action result to error type
127
+ #### ActionResultError.ts
109
128
 
110
- #### IActionResult.ts ####
111
- - IResultData - Result data interface
112
- - IdResultData - extends IResultData for 'id' included return data
113
- - IResultErrors - Result errors interface
114
- - IActionResult - Action result interface
115
- - ActionResultId - Action result with id data
129
+ - ActionResultError - Action result to error type
116
130
 
117
- #### InitCallResultData.ts ####
118
- - InitCallResultData - Init call result data
119
- - InitCallResult - Init call result
131
+ #### IActionResult.ts
132
+
133
+ - IResultData - Result data interface
134
+ - IdResultData - extends IResultData for 'id' included return data
135
+ - IResultErrors - Result errors interface
136
+ - IActionResult - Action result interface
137
+ - ActionResultId - Action result with id data
138
+
139
+ #### InitCallResultData.ts
140
+
141
+ - InitCallResultData - Init call result data
142
+ - InitCallResult - Init call result
120
143
 
121
144
  ### erp - SmartERP APIs
122
145
 
123
146
  ### state - State management
124
147
 
125
- #### Culture.ts ####
126
- - ICulture - Culture resources state, simple i18n solution
127
- - ICultureGet - Culture get delegate
148
+ #### Culture.ts
149
+
150
+ - ICulture - Culture resources state, simple i18n solution
151
+ - ICultureGet - Culture get delegate
152
+
153
+ #### State.ts
154
+
155
+ - IState - state interface.
156
+ - IAction - state action interface
128
157
 
129
- #### State.ts ####
130
- - IState - state interface.
131
- - IAction - state action interface
158
+ #### User.ts
132
159
 
133
- #### User.ts ####
134
- - IUserData - User basic data.
135
- - IUser - extends IState for user state
160
+ - IUserData - User basic data.
161
+ - IUser - extends IState for user state
@@ -1,174 +1,25 @@
1
- import {
2
- INotificaseBase,
3
- INotification,
4
- Notification,
5
- NotificationCallProps,
6
- NotificationContainer,
7
- NotificationRenderProps
8
- } from '@etsoo/notificationbase';
9
- import {
10
- ApiAuthorizationScheme,
11
- ApiDataError,
12
- ApiMethod,
13
- createClient
14
- } from '@etsoo/restclient';
15
- import {
16
- DataTypes,
17
- DomUtils,
18
- IActionResult,
19
- Utils,
20
- WindowStorage
21
- } from '@etsoo/shared';
22
- import {
23
- AddressApi,
24
- en,
25
- EntityStatus,
26
- ExternalSettings,
27
- IUser,
28
- OrgApi,
29
- PublicApi,
30
- UserRole,
31
- zhHans
32
- } from '../../src';
33
- import { AddressUtils } from '../../src/address/AddressUtils';
34
- import { IAppSettings } from '../../src/app/AppSettings';
35
- import { CoreApp } from '../../src/app/CoreApp';
36
- import { InitCallResultData } from '../../src/result/InitCallResult';
37
-
38
- // Detected country or region
39
- const { detectedCountry } = DomUtils;
40
-
41
- // Detected culture
42
- const { detectedCulture } = DomUtils;
43
-
44
- // Supported cultures
45
- const supportedCultures: DataTypes.CultureDefinition[] = [zhHans({}), en({})];
46
-
47
- // Supported regions
48
- const supportedRegions = ['CN'];
49
-
50
- // Class implementation for tests
51
- class NotificationTest extends Notification<any, NotificationCallProps> {
52
- render(props: NotificationRenderProps, className?: string, options?: any) {
53
- throw new Error('Method not implemented.');
54
- }
55
- }
56
-
57
- class NotificationContainerTest extends NotificationContainer<
58
- any,
59
- NotificationCallProps
60
- > {
61
- protected addRaw(
62
- data: INotificaseBase<any, NotificationCallProps>
63
- ): INotification<any, NotificationCallProps> {
64
- return new NotificationTest(data.type, data.content);
65
- }
66
- }
67
-
68
- // Container
69
- var container = new NotificationContainerTest((update) => {});
1
+ import { ApiDataError, ApiMethod } from '@etsoo/restclient';
2
+ import { DataTypes, IActionResult } from '@etsoo/shared';
3
+ import { EntityStatus, UserRole } from '../../src';
4
+ import { TestApp } from './TestApp';
70
5
 
71
6
  // Arrange
72
- class CoreAppTest extends CoreApp<
73
- IUser,
74
- IAppSettings,
75
- {},
76
- NotificationCallProps
77
- > {
78
- /**
79
- * Constructor
80
- * @param settings Settings
81
- * @param name Application name
82
- */
83
- constructor() {
84
- super(
85
- ExternalSettings.format({
86
- /**
87
- * Endpoint of the API service
88
- */
89
- endpoint: 'http://{hostname}/com.etsoo.SmartERPApi/api/',
90
-
91
- endpoints: {
92
- core: {
93
- endpoint: 'http://{hostname}:9001/api/',
94
- webUrl: ''
95
- }
96
- },
97
-
98
- /**
99
- * App root url
100
- */
101
- homepage: '/cms',
102
-
103
- /**
104
- * Web url of the cloud
105
- */
106
- webUrl: 'http://localhost',
107
-
108
- // Detected culture
109
- detectedCulture,
110
-
111
- // Supported cultures
112
- cultures: supportedCultures,
113
-
114
- // Supported regions
115
- regions: supportedRegions,
116
-
117
- // Browser's time zone
118
- timeZone: Utils.getTimeZone(),
119
-
120
- // Current country or region
121
- currentRegion: AddressUtils.getRegion(
122
- supportedRegions,
123
- detectedCountry,
124
- detectedCulture
125
- ),
126
-
127
- // Current culture
128
- currentCulture: DomUtils.getCulture(
129
- supportedCultures,
130
- detectedCulture
131
- )![0]
132
- }),
133
- createClient(),
134
- container,
135
- new WindowStorage(),
136
- 'SmartERP'
137
- );
138
- }
139
-
140
- freshCountdownUI(callback?: () => PromiseLike<unknown>): void {
141
- throw new Error('Method not implemented.');
142
- }
143
-
144
- initCallUpdateLocal(data: InitCallResultData, timestamp: number) {
145
- this.initCallUpdate(data, timestamp);
146
- return this.passphrase;
147
- }
148
- }
149
-
150
7
  // Mixins example
151
- function EnhanceApp<TBase extends DataTypes.MConstructor<CoreAppTest>>(
8
+ function EnhanceApp<TBase extends DataTypes.MConstructor<TestApp>>(
152
9
  Base: TBase
153
10
  ) {
154
- return class extends Base {
155
- readonly addressApi = new AddressApi(this);
156
- readonly publicApi = new PublicApi(this);
157
- readonly orgApi = new OrgApi(this);
158
- };
11
+ return class extends Base {};
159
12
  }
160
13
 
161
- const appClass = EnhanceApp(CoreAppTest);
14
+ const appClass = EnhanceApp(TestApp);
162
15
  const app = new appClass();
163
16
  app.changeCulture(app.settings.cultures[0]);
164
17
 
165
18
  test('Test for domain replacement', () => {
166
- expect(app.settings.endpoint).toBe(
167
- 'http://localhost/com.etsoo.SmartERPApi/api/'
168
- );
19
+ expect(app.settings.endpoint).toBe('http://localhost:9000/api/');
169
20
 
170
21
  expect(app.settings.endpoints?.core.endpoint).toBe(
171
- 'http://localhost:9001/api/'
22
+ 'https://localhost:9001/api/'
172
23
  );
173
24
  });
174
25
 
@@ -335,121 +186,3 @@ test('Tests for isValidPassword', () => {
335
186
  expect(app.isValidPassword('abcd3')).toBeFalsy();
336
187
  expect(app.isValidPassword('1234abcd')).toBeTruthy();
337
188
  });
338
-
339
- test('Tests for addressApi', async () => {
340
- const regions = app.addressApi.regions();
341
- const cn = regions.find((r) => r.id === 'CN');
342
- expect(cn?.label).toBe('中国大陆');
343
-
344
- const favoredRegions = app.addressApi.regions(['US', 'CA']);
345
- expect(favoredRegions.length).toBe(2);
346
- expect(favoredRegions.find((region) => region.id === 'US')?.label).toBe(
347
- '美国'
348
- );
349
-
350
- const region = app.addressApi.region('US');
351
- expect(region?.label).toBe('美国');
352
- const regionFailed = app.addressApi.region('ABC');
353
- expect(regionFailed).toBeUndefined();
354
-
355
- /*
356
- const results1 = await app.addressApi.autocomplete({
357
- query: '青岛市玫瑰庭院',
358
- region: 'CN',
359
- language: 'zh-CN'
360
- });
361
-
362
- const results2 = await app.addressApi.autocomplete({
363
- query: '青岛市玫瑰庭院',
364
- language: 'zh-CN'
365
- });
366
-
367
- const results1 = await app.addressApi.searchPlace({
368
- query: '青岛市玫瑰庭院',
369
- region: 'CN',
370
- language: 'zh-CN'
371
- });
372
-
373
- const result = await app.addressApi.parsePlace({
374
- city: '青岛',
375
- district: '市南'
376
- });
377
-
378
- const result = await app.addressApi.GetPlaceDetails(
379
- 'ChIJczySyo1qljUR1Jnq4Uqak2I',
380
- 'zh-CN'
381
- );
382
-
383
- const results2 = await app.addressApi.searchPlace({
384
- query: '青岛市玫瑰庭院',
385
- language: 'zh-CN'
386
- });
387
-
388
- const cities = await app.addressApi.cities('CNHN');
389
- console.log(cities);
390
-
391
- const districts = await app.addressApi.districts(1181);
392
- console.log(districts);
393
- */
394
- });
395
-
396
- /*
397
- test('Tests for addressApi Async', async () => {
398
- const regions = await app.addressApi.getRegions({
399
- items: 3,
400
- favoredIds: ['US', 'AU', 'CA', 'NZ']
401
- });
402
- expect(regions?.length).toBe(3);
403
- expect(regions![2].id).toBe('CA');
404
- });
405
- */
406
-
407
- test('Tests for addressApi.continents', () => {
408
- const continents1 = app.addressApi.continents();
409
- const continents2 = app.addressApi.continents(true, true);
410
- expect(continents1.length).toBe(6);
411
- expect(continents1.some((item) => item.id === 'AN')).toBeFalsy();
412
- expect(continents2.length).toBe(7);
413
- expect(continents2[0].id).toBe(1);
414
- });
415
-
416
- test('Tests for publicApi', async () => {
417
- expect(app.publicApi.getUnitLabel(12, true)).toBe('每年');
418
-
419
- const options = app.publicApi.repeatOptions(['MONTH', 'QUATER', 'YEAR']);
420
- expect(options[2]).toStrictEqual({ id: 12, label: '每年' });
421
-
422
- const currencies = app.publicApi.currencies(['NZD', 'AUD', 'USD']);
423
- expect(currencies.length).toBe(3);
424
- expect(currencies[1].id).toBe('AUD');
425
-
426
- const currencies1 = app.publicApi.currencies(true);
427
- expect(currencies1.length >= 10).toBeTruthy();
428
-
429
- expect(app.publicApi.getCurrencyLabel('USD')).toBe('美元');
430
-
431
- const defaultExchangeRate = await app.publicApi.exchangeRate('CNY', {
432
- showLoading: false
433
- });
434
- expect(defaultExchangeRate?.exchangeRate).toBe(100);
435
-
436
- const url = app.publicApi.getOrgAvatar(1);
437
- expect(url).toBe(
438
- 'http://localhost/com.etsoo.SmartERPApi/api/Storage/OrgAvatar/1'
439
- );
440
-
441
- /*
442
- const amount1 = await app.publicApi.exchangeAmount(1000, 'NZD', 'CNY');
443
- const amount2 = await app.publicApi.exchangeAmount(100, 'NZD', 'USD');
444
- console.log(amount1, amount2);
445
-
446
- const orgs = await app.orgApi.list();
447
- console.log(orgs);
448
-
449
- const orgsQuery = await app.orgApi.query({ currentPage: 1, batchSize: 2 });
450
- console.log(orgsQuery);
451
-
452
- const cultures = await app.publicApi.supportedCultures();
453
- expect(cultures?.some((culture) => culture.id === 'zh-Hans')).toBeTruthy();
454
- */
455
- });
@@ -0,0 +1,136 @@
1
+ import {
2
+ INotificaseBase,
3
+ INotification,
4
+ Notification,
5
+ NotificationCallProps,
6
+ NotificationContainer,
7
+ NotificationRenderProps
8
+ } from '@etsoo/notificationbase';
9
+ import {
10
+ AddressUtils,
11
+ CoreApp,
12
+ createClient,
13
+ en,
14
+ ExternalSettings,
15
+ IAppSettings,
16
+ InitCallResultData,
17
+ IUser,
18
+ zhHans
19
+ } from '../../src';
20
+ import { DataTypes, DomUtils, Utils, WindowStorage } from '@etsoo/shared';
21
+
22
+ // Detected country or region
23
+ const { detectedCountry } = DomUtils;
24
+
25
+ // Detected culture
26
+ const { detectedCulture } = DomUtils;
27
+
28
+ // Supported cultures
29
+ const supportedCultures: DataTypes.CultureDefinition[] = [zhHans({}), en({})];
30
+
31
+ // Supported regions
32
+ const supportedRegions = ['CN'];
33
+
34
+ // Class implementation for tests
35
+ class NotificationTest extends Notification<any, NotificationCallProps> {
36
+ render(props: NotificationRenderProps, className?: string, options?: any) {
37
+ throw new Error('Method not implemented.');
38
+ }
39
+ }
40
+
41
+ class NotificationContainerTest extends NotificationContainer<
42
+ any,
43
+ NotificationCallProps
44
+ > {
45
+ protected addRaw(
46
+ data: INotificaseBase<any, NotificationCallProps>
47
+ ): INotification<any, NotificationCallProps> {
48
+ return new NotificationTest(data.type, data.content);
49
+ }
50
+ }
51
+
52
+ // Container
53
+ var container = new NotificationContainerTest((update) => {});
54
+
55
+ // Is local test (integration test)
56
+ // Make sure your local environment is ready
57
+ export const isLocalTest = process.env.NODE_ENV === 'local';
58
+
59
+ // Test application class
60
+ export class TestApp extends CoreApp<
61
+ IUser,
62
+ IAppSettings,
63
+ {},
64
+ NotificationCallProps
65
+ > {
66
+ /**
67
+ * Constructor
68
+ * @param settings Settings
69
+ * @param name Application name
70
+ */
71
+ constructor() {
72
+ super(
73
+ ExternalSettings.format({
74
+ /**
75
+ * Endpoint of the API service
76
+ */
77
+ endpoint: 'http://{hostname}:9000/api/',
78
+
79
+ endpoints: {
80
+ core: {
81
+ endpoint: 'https://{hostname}:9001/api/',
82
+ webUrl: ''
83
+ }
84
+ },
85
+
86
+ /**
87
+ * App root url
88
+ */
89
+ homepage: '/cms',
90
+
91
+ /**
92
+ * Web url of the cloud
93
+ */
94
+ webUrl: 'https://localhost',
95
+
96
+ // Detected culture
97
+ detectedCulture,
98
+
99
+ // Supported cultures
100
+ cultures: supportedCultures,
101
+
102
+ // Supported regions
103
+ regions: supportedRegions,
104
+
105
+ // Browser's time zone
106
+ timeZone: Utils.getTimeZone(),
107
+
108
+ // Current country or region
109
+ currentRegion: AddressUtils.getRegion(
110
+ supportedRegions,
111
+ detectedCountry,
112
+ detectedCulture
113
+ ),
114
+
115
+ // Current culture
116
+ currentCulture: DomUtils.getCulture(
117
+ supportedCultures,
118
+ detectedCulture
119
+ )![0]
120
+ }),
121
+ createClient(),
122
+ container,
123
+ new WindowStorage(),
124
+ 'SmartERP'
125
+ );
126
+ }
127
+
128
+ freshCountdownUI(callback?: () => PromiseLike<unknown>): void {
129
+ throw new Error('Method not implemented.');
130
+ }
131
+
132
+ initCallUpdateLocal(data: InitCallResultData, timestamp: number) {
133
+ this.initCallUpdate(data, timestamp);
134
+ return this.passphrase;
135
+ }
136
+ }
package/babel.config.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "presets": [["@babel/env"]],
3
- "plugins": [
4
- [
5
- "@babel/plugin-transform-runtime",
6
- {
7
- "corejs": 3
8
- }
9
- ]
2
+ "presets": [["@babel/env"]],
3
+ "plugins": [
4
+ [
5
+ "@babel/plugin-transform-runtime",
6
+ {
7
+ "corejs": 3
8
+ }
10
9
  ]
10
+ ]
11
11
  }