@etsoo/appscript 1.5.61 → 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 (271) 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/state/User.d.ts +20 -0
  24. package/lib/{cjs/erp → mjs/api}/AuthApi.d.ts +12 -5
  25. package/lib/mjs/{erp → api}/AuthApi.js +8 -0
  26. package/lib/{cjs/erp → mjs/api}/EntityApi.d.ts +1 -10
  27. package/lib/mjs/{erp → api}/EntityApi.js +0 -9
  28. package/lib/mjs/api/dto/AntiforgeryRequestToken.d.ts +21 -0
  29. package/lib/{cjs/erp → mjs/api}/dto/ResultPayload.d.ts +9 -1
  30. package/lib/{cjs/erp → mjs/api}/rq/QueryPagingData.d.ts +7 -7
  31. package/lib/{cjs/erp/rq/TiplistRQ.d.ts → mjs/api/rq/QueryRQ.d.ts} +8 -4
  32. package/lib/mjs/api/rq/StatusQueryRQ.d.ts +17 -0
  33. package/lib/mjs/api/rq/UpdateModel.d.ts +18 -0
  34. package/lib/mjs/app/CoreApp.d.ts +10 -3
  35. package/lib/mjs/app/CoreApp.js +13 -5
  36. package/lib/mjs/app/IApp.d.ts +2 -2
  37. package/lib/mjs/business/EntityStatus.d.ts +1 -1
  38. package/lib/mjs/business/EntityStatus.js +1 -1
  39. package/lib/mjs/i18n/en.json +2 -0
  40. package/lib/mjs/i18n/zh-Hans.json +2 -0
  41. package/lib/mjs/i18n/zh-Hant.json +2 -0
  42. package/lib/mjs/index.d.ts +67 -87
  43. package/lib/mjs/index.js +67 -89
  44. package/lib/mjs/state/User.d.ts +20 -0
  45. package/package.json +72 -69
  46. package/src/{erp → api}/AuthApi.ts +16 -6
  47. package/src/{erp → api}/EntityApi.ts +1 -17
  48. package/src/api/dto/AntiforgeryRequestToken.ts +23 -0
  49. package/{lib/mjs/erp/dto/ResultPayload.d.ts → src/api/dto/ResultPayload.ts} +19 -1
  50. package/src/{erp → api}/rq/QueryPagingData.ts +7 -7
  51. package/src/{erp/rq/TiplistRQ.ts → api/rq/QueryRQ.ts} +9 -4
  52. package/src/api/rq/StatusQueryRQ.ts +19 -0
  53. package/src/api/rq/UpdateModel.ts +20 -0
  54. package/src/app/CoreApp.ts +17 -8
  55. package/src/app/IApp.ts +2 -2
  56. package/src/business/EntityStatus.ts +1 -1
  57. package/src/i18n/en.json +2 -0
  58. package/src/i18n/zh-Hans.json +2 -0
  59. package/src/i18n/zh-Hant.json +2 -0
  60. package/src/index.ts +77 -99
  61. package/src/state/User.ts +24 -0
  62. package/.eslintignore +0 -3
  63. package/.eslintrc.json +0 -29
  64. package/.prettierignore +0 -5
  65. package/.prettierrc +0 -6
  66. package/lib/cjs/erp/AddressApi.d.ts +0 -127
  67. package/lib/cjs/erp/AddressApi.js +0 -230
  68. package/lib/cjs/erp/MemberApi.d.ts +0 -22
  69. package/lib/cjs/erp/MemberApi.js +0 -26
  70. package/lib/cjs/erp/OrgApi.d.ts +0 -74
  71. package/lib/cjs/erp/OrgApi.js +0 -94
  72. package/lib/cjs/erp/PublicApi.d.ts +0 -127
  73. package/lib/cjs/erp/PublicApi.js +0 -212
  74. package/lib/cjs/erp/dto/AuditLineDto.d.ts +0 -24
  75. package/lib/cjs/erp/dto/CurrencyDto.d.ts +0 -6
  76. package/lib/cjs/erp/dto/ExchangeRateDto.d.ts +0 -13
  77. package/lib/cjs/erp/dto/ExchangeRateHistoryDto.d.ts +0 -8
  78. package/lib/cjs/erp/dto/ExchangeRateHistoryDto.js +0 -2
  79. package/lib/cjs/erp/dto/OrgDto.d.ts +0 -33
  80. package/lib/cjs/erp/dto/OrgDto.js +0 -2
  81. package/lib/cjs/erp/dto/OrgQueryDto.d.ts +0 -21
  82. package/lib/cjs/erp/dto/OrgQueryDto.js +0 -2
  83. package/lib/cjs/erp/dto/OrgViewDto.d.ts +0 -63
  84. package/lib/cjs/erp/dto/OrgViewDto.js +0 -2
  85. package/lib/cjs/erp/dto/PinDto.d.ts +0 -61
  86. package/lib/cjs/erp/dto/PinDto.js +0 -2
  87. package/lib/cjs/erp/dto/PlaceParsedDto.d.ts +0 -50
  88. package/lib/cjs/erp/dto/PlaceParsedDto.js +0 -2
  89. package/lib/cjs/erp/dto/ResponseActionMessageDto.d.ts +0 -14
  90. package/lib/cjs/erp/dto/ResponseActionMessageDto.js +0 -2
  91. package/lib/cjs/erp/rq/MemberListRQ.d.ts +0 -5
  92. package/lib/cjs/erp/rq/MemberListRQ.js +0 -2
  93. package/lib/cjs/erp/rq/OrgListRQ.d.ts +0 -10
  94. package/lib/cjs/erp/rq/OrgListRQ.js +0 -2
  95. package/lib/cjs/erp/rq/OrgQueryRQ.d.ts +0 -14
  96. package/lib/cjs/erp/rq/OrgQueryRQ.js +0 -2
  97. package/lib/cjs/erp/rq/ParsePinRQ.d.ts +0 -14
  98. package/lib/cjs/erp/rq/ParsePinRQ.js +0 -2
  99. package/lib/cjs/erp/rq/PlaceParseRQ.d.ts +0 -25
  100. package/lib/cjs/erp/rq/PlaceParseRQ.js +0 -2
  101. package/lib/cjs/erp/rq/PlaceQueryRQ.d.ts +0 -58
  102. package/lib/cjs/erp/rq/PlaceQueryRQ.js +0 -21
  103. package/lib/cjs/erp/rq/QueryRQ.d.ts +0 -16
  104. package/lib/cjs/erp/rq/RegionsRQ.d.ts +0 -22
  105. package/lib/cjs/erp/rq/RegionsRQ.js +0 -2
  106. package/lib/cjs/erp/rq/SendActionMessageRQ.d.ts +0 -26
  107. package/lib/cjs/erp/rq/SendActionMessageRQ.js +0 -2
  108. package/lib/cjs/erp/rq/TiplistRQ.js +0 -2
  109. package/lib/mjs/erp/AddressApi.d.ts +0 -127
  110. package/lib/mjs/erp/AddressApi.js +0 -226
  111. package/lib/mjs/erp/MemberApi.d.ts +0 -22
  112. package/lib/mjs/erp/MemberApi.js +0 -22
  113. package/lib/mjs/erp/OrgApi.d.ts +0 -74
  114. package/lib/mjs/erp/OrgApi.js +0 -90
  115. package/lib/mjs/erp/PublicApi.d.ts +0 -127
  116. package/lib/mjs/erp/PublicApi.js +0 -208
  117. package/lib/mjs/erp/dto/AuditLineDto.d.ts +0 -24
  118. package/lib/mjs/erp/dto/CurrencyDto.d.ts +0 -6
  119. package/lib/mjs/erp/dto/ExchangeRateDto.d.ts +0 -13
  120. package/lib/mjs/erp/dto/ExchangeRateHistoryDto.d.ts +0 -8
  121. package/lib/mjs/erp/dto/ExchangeRateHistoryDto.js +0 -1
  122. package/lib/mjs/erp/dto/OrgDto.d.ts +0 -33
  123. package/lib/mjs/erp/dto/OrgDto.js +0 -1
  124. package/lib/mjs/erp/dto/OrgQueryDto.d.ts +0 -21
  125. package/lib/mjs/erp/dto/OrgQueryDto.js +0 -1
  126. package/lib/mjs/erp/dto/OrgViewDto.d.ts +0 -63
  127. package/lib/mjs/erp/dto/OrgViewDto.js +0 -1
  128. package/lib/mjs/erp/dto/PinDto.d.ts +0 -61
  129. package/lib/mjs/erp/dto/PinDto.js +0 -1
  130. package/lib/mjs/erp/dto/PlaceParsedDto.d.ts +0 -50
  131. package/lib/mjs/erp/dto/PlaceParsedDto.js +0 -1
  132. package/lib/mjs/erp/dto/ResponseActionMessageDto.d.ts +0 -14
  133. package/lib/mjs/erp/dto/ResponseActionMessageDto.js +0 -1
  134. package/lib/mjs/erp/rq/MemberListRQ.d.ts +0 -5
  135. package/lib/mjs/erp/rq/MemberListRQ.js +0 -1
  136. package/lib/mjs/erp/rq/OrgListRQ.d.ts +0 -10
  137. package/lib/mjs/erp/rq/OrgListRQ.js +0 -1
  138. package/lib/mjs/erp/rq/OrgQueryRQ.d.ts +0 -14
  139. package/lib/mjs/erp/rq/OrgQueryRQ.js +0 -1
  140. package/lib/mjs/erp/rq/ParsePinRQ.d.ts +0 -14
  141. package/lib/mjs/erp/rq/ParsePinRQ.js +0 -1
  142. package/lib/mjs/erp/rq/PlaceParseRQ.d.ts +0 -25
  143. package/lib/mjs/erp/rq/PlaceParseRQ.js +0 -1
  144. package/lib/mjs/erp/rq/PlaceQueryRQ.d.ts +0 -58
  145. package/lib/mjs/erp/rq/PlaceQueryRQ.js +0 -18
  146. package/lib/mjs/erp/rq/QueryRQ.d.ts +0 -16
  147. package/lib/mjs/erp/rq/RegionsRQ.d.ts +0 -22
  148. package/lib/mjs/erp/rq/RegionsRQ.js +0 -1
  149. package/lib/mjs/erp/rq/SendActionMessageRQ.d.ts +0 -26
  150. package/lib/mjs/erp/rq/SendActionMessageRQ.js +0 -1
  151. package/lib/mjs/erp/rq/TiplistRQ.js +0 -1
  152. package/src/erp/AddressApi.ts +0 -310
  153. package/src/erp/MemberApi.ts +0 -28
  154. package/src/erp/OrgApi.ts +0 -136
  155. package/src/erp/PublicApi.ts +0 -282
  156. package/src/erp/dto/AuditLineDto.ts +0 -27
  157. package/src/erp/dto/CurrencyDto.ts +0 -7
  158. package/src/erp/dto/ExchangeRateDto.ts +0 -14
  159. package/src/erp/dto/ExchangeRateHistoryDto.ts +0 -9
  160. package/src/erp/dto/OrgDto.ts +0 -39
  161. package/src/erp/dto/OrgQueryDto.ts +0 -24
  162. package/src/erp/dto/OrgViewDto.ts +0 -78
  163. package/src/erp/dto/PinDto.ts +0 -71
  164. package/src/erp/dto/PlaceParsedDto.ts +0 -58
  165. package/src/erp/dto/ResponseActionMessageDto.ts +0 -16
  166. package/src/erp/rq/MemberListRQ.ts +0 -6
  167. package/src/erp/rq/OrgListRQ.ts +0 -11
  168. package/src/erp/rq/OrgQueryRQ.ts +0 -16
  169. package/src/erp/rq/ParsePinRQ.ts +0 -15
  170. package/src/erp/rq/PlaceParseRQ.ts +0 -28
  171. package/src/erp/rq/PlaceQueryRQ.ts +0 -67
  172. package/src/erp/rq/QueryRQ.ts +0 -18
  173. package/src/erp/rq/RegionsRQ.ts +0 -26
  174. package/src/erp/rq/SendActionMessageRQ.ts +0 -29
  175. package/lib/cjs/{erp → api}/BaseApi.d.ts +0 -0
  176. package/lib/cjs/{erp → api}/BaseApi.js +0 -0
  177. package/lib/cjs/{erp/dto/ApiRefreshTokenDto.js → api/dto/AntiforgeryRequestToken.js} +0 -0
  178. package/lib/cjs/{erp → api}/dto/ApiRefreshTokenDto.d.ts +0 -0
  179. package/lib/cjs/{erp/dto/AuditLineDto.js → api/dto/ApiRefreshTokenDto.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/ResultPayload.js +0 -0
  187. package/lib/cjs/{erp → api}/rq/ApiRefreshTokenRQ.d.ts +0 -0
  188. package/lib/cjs/{erp → api}/rq/ApiRefreshTokenRQ.js +0 -0
  189. package/lib/cjs/{erp → api}/rq/AuthRequest.d.ts +0 -0
  190. package/lib/cjs/{erp → api}/rq/AuthRequest.js +0 -0
  191. package/lib/cjs/{erp → api}/rq/GetLogInUrlRQ.d.ts +0 -0
  192. package/lib/cjs/{erp → api}/rq/GetLogInUrlRQ.js +0 -0
  193. package/lib/cjs/{erp → api}/rq/LoginIdRQ.d.ts +0 -0
  194. package/lib/cjs/{erp → api}/rq/LoginIdRQ.js +0 -0
  195. package/lib/cjs/{erp → api}/rq/LoginRQ.d.ts +1 -1
  196. package/lib/cjs/{erp → api}/rq/LoginRQ.js +0 -0
  197. package/lib/cjs/{erp → api}/rq/MergeRQ.d.ts +0 -0
  198. package/lib/cjs/{erp → api}/rq/MergeRQ.js +0 -0
  199. package/lib/cjs/{erp → api}/rq/QueryPagingData.js +0 -0
  200. package/lib/cjs/{erp → api}/rq/QueryRQ.js +0 -0
  201. package/lib/cjs/{erp → api}/rq/RefreshTokenRQ.d.ts +0 -0
  202. package/lib/cjs/{erp → api}/rq/RefreshTokenRQ.js +0 -0
  203. package/lib/cjs/{erp → api}/rq/ResetPasswordRQ.d.ts +0 -0
  204. package/lib/cjs/{erp → api}/rq/ResetPasswordRQ.js +0 -0
  205. package/lib/cjs/{erp → api}/rq/SignoutRQ.d.ts +0 -0
  206. package/lib/cjs/{erp → api}/rq/SignoutRQ.js +0 -0
  207. package/lib/cjs/{erp/dto/CurrencyDto.js → api/rq/StatusQueryRQ.js} +0 -0
  208. package/lib/cjs/{erp → api}/rq/SwitchOrgRQ.d.ts +0 -0
  209. package/lib/cjs/{erp → api}/rq/SwitchOrgRQ.js +0 -0
  210. package/lib/cjs/{erp → api}/rq/TokenRQ.d.ts +0 -0
  211. package/lib/cjs/{erp → api}/rq/TokenRQ.js +0 -0
  212. package/lib/cjs/{erp/dto/ExchangeRateDto.js → api/rq/UpdateModel.js} +0 -0
  213. package/lib/cjs/{erp → api}/rq/UpdateStatusRQ.d.ts +0 -0
  214. package/lib/cjs/{erp → api}/rq/UpdateStatusRQ.js +0 -0
  215. package/lib/mjs/{erp → api}/BaseApi.d.ts +0 -0
  216. package/lib/mjs/{erp → api}/BaseApi.js +0 -0
  217. package/lib/mjs/{erp/dto/ApiRefreshTokenDto.js → api/dto/AntiforgeryRequestToken.js} +0 -0
  218. package/lib/mjs/{erp → api}/dto/ApiRefreshTokenDto.d.ts +0 -0
  219. package/lib/mjs/{erp/dto/AuditLineDto.js → api/dto/ApiRefreshTokenDto.js} +0 -0
  220. package/lib/mjs/{erp → api}/dto/IdLabelDto.d.ts +0 -0
  221. package/lib/mjs/{erp → api}/dto/IdLabelDto.js +0 -0
  222. package/lib/mjs/{erp → api}/dto/IdLabelPrimaryDto.d.ts +0 -0
  223. package/lib/mjs/{erp → api}/dto/IdLabelPrimaryDto.js +0 -0
  224. package/lib/mjs/{erp → api}/dto/InitCallDto.d.ts +0 -0
  225. package/lib/mjs/{erp → api}/dto/InitCallDto.js +0 -0
  226. package/lib/mjs/{erp → api}/dto/ResultPayload.js +0 -0
  227. package/lib/mjs/{erp → api}/rq/ApiRefreshTokenRQ.d.ts +0 -0
  228. package/lib/mjs/{erp → api}/rq/ApiRefreshTokenRQ.js +0 -0
  229. package/lib/mjs/{erp → api}/rq/AuthRequest.d.ts +0 -0
  230. package/lib/mjs/{erp → api}/rq/AuthRequest.js +0 -0
  231. package/lib/mjs/{erp → api}/rq/GetLogInUrlRQ.d.ts +0 -0
  232. package/lib/mjs/{erp → api}/rq/GetLogInUrlRQ.js +0 -0
  233. package/lib/mjs/{erp → api}/rq/LoginIdRQ.d.ts +0 -0
  234. package/lib/mjs/{erp → api}/rq/LoginIdRQ.js +0 -0
  235. package/lib/mjs/{erp → api}/rq/LoginRQ.d.ts +1 -1
  236. package/lib/mjs/{erp → api}/rq/LoginRQ.js +0 -0
  237. package/lib/mjs/{erp → api}/rq/MergeRQ.d.ts +0 -0
  238. package/lib/mjs/{erp → api}/rq/MergeRQ.js +0 -0
  239. package/lib/mjs/{erp → api}/rq/QueryPagingData.js +0 -0
  240. package/lib/mjs/{erp → api}/rq/QueryRQ.js +0 -0
  241. package/lib/mjs/{erp → api}/rq/RefreshTokenRQ.d.ts +0 -0
  242. package/lib/mjs/{erp → api}/rq/RefreshTokenRQ.js +0 -0
  243. package/lib/mjs/{erp → api}/rq/ResetPasswordRQ.d.ts +0 -0
  244. package/lib/mjs/{erp → api}/rq/ResetPasswordRQ.js +0 -0
  245. package/lib/mjs/{erp → api}/rq/SignoutRQ.d.ts +0 -0
  246. package/lib/mjs/{erp → api}/rq/SignoutRQ.js +0 -0
  247. package/lib/mjs/{erp/dto/CurrencyDto.js → api/rq/StatusQueryRQ.js} +0 -0
  248. package/lib/mjs/{erp → api}/rq/SwitchOrgRQ.d.ts +0 -0
  249. package/lib/mjs/{erp → api}/rq/SwitchOrgRQ.js +0 -0
  250. package/lib/mjs/{erp → api}/rq/TokenRQ.d.ts +0 -0
  251. package/lib/mjs/{erp → api}/rq/TokenRQ.js +0 -0
  252. package/lib/mjs/{erp/dto/ExchangeRateDto.js → api/rq/UpdateModel.js} +0 -0
  253. package/lib/mjs/{erp → api}/rq/UpdateStatusRQ.d.ts +0 -0
  254. package/lib/mjs/{erp → api}/rq/UpdateStatusRQ.js +0 -0
  255. package/src/{erp → api}/BaseApi.ts +0 -0
  256. package/src/{erp → api}/dto/ApiRefreshTokenDto.ts +0 -0
  257. package/src/{erp → api}/dto/IdLabelDto.ts +0 -0
  258. package/src/{erp → api}/dto/IdLabelPrimaryDto.ts +0 -0
  259. package/src/{erp → api}/dto/InitCallDto.ts +0 -0
  260. package/src/{erp → api}/rq/ApiRefreshTokenRQ.ts +0 -0
  261. package/src/{erp → api}/rq/AuthRequest.ts +0 -0
  262. package/src/{erp → api}/rq/GetLogInUrlRQ.ts +0 -0
  263. package/src/{erp → api}/rq/LoginIdRQ.ts +0 -0
  264. package/src/{erp → api}/rq/LoginRQ.ts +1 -1
  265. /package/src/{erp → api}/rq/MergeRQ.ts +0 -0
  266. /package/src/{erp → api}/rq/RefreshTokenRQ.ts +0 -0
  267. /package/src/{erp → api}/rq/ResetPasswordRQ.ts +0 -0
  268. /package/src/{erp → api}/rq/SignoutRQ.ts +0 -0
  269. /package/src/{erp → api}/rq/SwitchOrgRQ.ts +0 -0
  270. /package/src/{erp → api}/rq/TokenRQ.ts +0 -0
  271. /package/src/{erp → api}/rq/UpdateStatusRQ.ts +0 -0
@@ -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
+ }
@@ -2,15 +2,16 @@ import { IApiPayload } from '@etsoo/restclient';
2
2
  import { IUser } from '../state/User';
3
3
  import { BaseApi } from './BaseApi';
4
4
  import { ResultPayload } from './dto/ResultPayload';
5
- import { LoginRQ } from './rq/LoginRQ';
6
- import { ResetPasswordRQ } from './rq/ResetPasswordRQ';
7
5
  import { IActionResult } from '@etsoo/shared';
8
- import { SignoutRQ } from './rq/SignoutRQ';
9
- import { GetLogInUrlRQ } from './rq/GetLogInUrlRQ';
6
+ import { RefreshTokenProps, RefreshTokenResult } from '../app/IApp';
10
7
  import { TokenRQ } from './rq/TokenRQ';
11
8
  import { ApiRefreshTokenDto } from './dto/ApiRefreshTokenDto';
12
- import { RefreshTokenProps, RefreshTokenResult } from '../app/IApp';
9
+ import { GetLogInUrlRQ } from './rq/GetLogInUrlRQ';
10
+ import { LoginRQ } from './rq/LoginRQ';
11
+ import { ResetPasswordRQ } from './rq/ResetPasswordRQ';
12
+ import { SignoutRQ } from './rq/SignoutRQ';
13
13
  import { SwitchOrgRQ } from './rq/SwitchOrgRQ';
14
+ import { AuthRequest } from './rq/AuthRequest';
14
15
  /**
15
16
  * Authentication API
16
17
  */
@@ -26,6 +27,12 @@ export declare class AuthApi extends BaseApi {
26
27
  * @returns Result
27
28
  */
28
29
  apiRefreshToken(rq: TokenRQ, payload?: IApiPayload<ApiRefreshTokenDto>): Promise<ApiRefreshTokenDto | undefined>;
30
+ /**
31
+ * Authorization request
32
+ * @param auth Authorization request data
33
+ * @param payload Payload
34
+ */
35
+ authRequest(auth: AuthRequest, payload?: IApiPayload<string>): Promise<string | undefined>;
29
36
  /**
30
37
  * Exchange token
31
38
  * @param rq Request data
@@ -16,6 +16,14 @@ class AuthApi extends BaseApi_1.BaseApi {
16
16
  apiRefreshToken(rq, payload) {
17
17
  return this.api.put('Auth/ApiRefreshToken', rq, payload);
18
18
  }
19
+ /**
20
+ * Authorization request
21
+ * @param auth Authorization request data
22
+ * @param payload Payload
23
+ */
24
+ authRequest(auth, payload) {
25
+ return this.api.post('Auth/AuthRequest', auth, payload);
26
+ }
19
27
  /**
20
28
  * Exchange token
21
29
  * @param rq Request data
@@ -2,11 +2,9 @@ import { IApi, IApiPayload } from '@etsoo/restclient';
2
2
  import { IActionResult, IdType } from '@etsoo/shared';
3
3
  import { IApp } from '../app/IApp';
4
4
  import { BaseApi } from './BaseApi';
5
- import { AuditLinePayload } from './dto/AuditLineDto';
6
5
  import { ResultPayload } from './dto/ResultPayload';
7
6
  import { MergeRQ } from './rq/MergeRQ';
8
7
  import { QueryRQ } from './rq/QueryRQ';
9
- import { TiplistRQ } from './rq/TiplistRQ';
10
8
  import { UpdateStatusRQ } from './rq/UpdateStatusRQ';
11
9
  /**
12
10
  * Entity API
@@ -40,7 +38,7 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
40
38
  * @param payload Payload
41
39
  * @returns Result
42
40
  */
43
- protected listBase<T extends IdType, RQ extends TiplistRQ<T>, R extends object>(rq: RQ, payload?: IApiPayload<R[]>): Promise<R[] | undefined>;
41
+ protected listBase<T extends IdType, RQ extends QueryRQ<T>, R extends object>(rq: RQ, payload?: IApiPayload<R[]>): Promise<R[] | undefined>;
44
42
  /**
45
43
  * Merge
46
44
  * @param rq Request data
@@ -56,13 +54,6 @@ export declare class EntityApi<T extends IApp = IApp> extends BaseApi<T> {
56
54
  * @returns Result
57
55
  */
58
56
  protected queryBase<T extends IdType, RQ extends QueryRQ<T>, R extends object>(rq: RQ, payload?: IApiPayload<R[]>, queryKey?: string): Promise<R[] | undefined>;
59
- /**
60
- * Query audit history
61
- * @param rq Request data
62
- * @param payload Payload
63
- * @returns Result
64
- */
65
- protected queryAuditBase<T extends IdType, R extends QueryRQ<T>>(rq: R, payload?: AuditLinePayload): Promise<import("./dto/AuditLineDto").AuditLineDto[] | undefined>;
66
57
  /**
67
58
  * Query favored country ids
68
59
  * @returns Result
@@ -63,15 +63,6 @@ class EntityApi extends BaseApi_1.BaseApi {
63
63
  queryBase(rq, payload, queryKey = '') {
64
64
  return this.api.post(`${this.flag}/Query${queryKey}`, rq, payload);
65
65
  }
66
- /**
67
- * Query audit history
68
- * @param rq Request data
69
- * @param payload Payload
70
- * @returns Result
71
- */
72
- queryAuditBase(rq, payload) {
73
- return this.api.post(`${this.flag}/QueryAudit`, rq, payload);
74
- }
75
66
  /**
76
67
  * Query favored country ids
77
68
  * @returns Result
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Antiforgery token
3
+ * 反伪造令牌
4
+ */
5
+ export type AntiforgeryRequestToken = {
6
+ /**
7
+ * Name of the form field used for the request token
8
+ * 用于请求令牌的表单字段名称
9
+ */
10
+ name: string;
11
+ /**
12
+ * Name of the header used for the request token
13
+ * 用于请求令牌的标头名称
14
+ */
15
+ headerName?: string;
16
+ /**
17
+ * Request token value
18
+ * 请求令牌值
19
+ */
20
+ value?: string;
21
+ };
@@ -1,17 +1,22 @@
1
1
  import { IApiPayload } from '@etsoo/restclient';
2
- import { IActionResult, IdActionResult } from '@etsoo/shared';
3
-
2
+ import { IActionResult, IdActionResult, IdMsgActionResult, MsgActionResult } from '@etsoo/shared';
4
3
  /**
5
4
  * Action result payload
6
5
  */
7
6
  export type ResultPayload = IApiPayload<IActionResult>;
8
-
9
7
  /**
10
8
  * Number id action result payload
11
9
  */
12
10
  export type IdResultPayload = IApiPayload<IdActionResult>;
13
-
14
11
  /**
15
12
  * String id action result payload
16
13
  */
17
14
  export type StringIdResultPayload = IApiPayload<IdActionResult<string>>;
15
+ /**
16
+ * Id and message action result payload
17
+ */
18
+ export type IdMsgResultPayload = IApiPayload<IdMsgActionResult>;
19
+ /**
20
+ * Message action result payload
21
+ */
22
+ export type MsgResultPayload = IApiPayload<MsgActionResult>;
@@ -6,17 +6,17 @@ export type QueryPagingData = {
6
6
  /**
7
7
  * Current page
8
8
  */
9
- currentPage: number;
9
+ currentPage?: number;
10
10
  /**
11
- * Batch size
11
+ * Keyset array, same order as the order by fields
12
12
  */
13
- batchSize: number;
13
+ keysets?: unknown[];
14
14
  /**
15
- * Order by field name
15
+ * Batch size
16
16
  */
17
- orderBy?: string;
17
+ batchSize: number;
18
18
  /**
19
- * Order by ascending
19
+ * Order by fields
20
20
  */
21
- orderByAsc?: boolean;
21
+ orderBy?: Record<string, boolean>;
22
22
  };
@@ -1,14 +1,18 @@
1
1
  import { IdType } from '@etsoo/shared';
2
2
  import { QueryPagingData } from './QueryPagingData';
3
3
  /**
4
- * Tiplist request data
5
- * com.etsoo.CoreFramework.Models.TiplistRQ
4
+ * Query request data
5
+ * com.etsoo.CoreFramework.Models.QueryRQ
6
6
  */
7
- export type TiplistRQ<T extends IdType = number> = {
7
+ export type QueryRQ<T extends IdType = number> = {
8
8
  /**
9
- * number id
9
+ * Number id
10
10
  */
11
11
  id?: T;
12
+ /**
13
+ * Included ids
14
+ */
15
+ ids?: T[];
12
16
  /**
13
17
  * Excluded ids
14
18
  */
@@ -0,0 +1,17 @@
1
+ import { IdType } from '@etsoo/shared';
2
+ import { QueryRQ } from './QueryRQ';
3
+ import { EntityStatus } from '../../business/EntityStatus';
4
+ /**
5
+ * Query with status request data
6
+ * com.etsoo.CoreFramework.Models.QueryRQ
7
+ */
8
+ export type StatusQueryRQ<T extends IdType = number> = QueryRQ<T> & {
9
+ /**
10
+ * Disabled or not, null for all, true for disabled (> EntityStatus.Approved), false for enabled (<= 100)
11
+ */
12
+ disabled?: boolean;
13
+ /**
14
+ * Status
15
+ */
16
+ status?: EntityStatus;
17
+ };
@@ -0,0 +1,18 @@
1
+ import { IdType } from '@etsoo/shared';
2
+ /**
3
+ * Update model
4
+ * 更新模型
5
+ */
6
+ export interface UpdateModel<T extends IdType = number> {
7
+ /**
8
+ * Id
9
+ * 编号
10
+ */
11
+ id: T;
12
+ /**
13
+ * Changed (modified) fields
14
+ * 'Exclude' items from a union type while 'omit' items from an object type.
15
+ * 更改的字段,注意 'Exclude' 用于联合类型,'omit' 用于对象类型。
16
+ */
17
+ changedFields?: Exclude<keyof this, 'changedFields'>[];
18
+ }