@etsoo/appscript 1.5.64 → 1.5.65

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 (182) hide show
  1. package/.github/workflows/main.yml +6 -5
  2. package/__tests__/app/CoreApp.ts +141 -143
  3. package/__tests__/app/Culture.ts +23 -23
  4. package/__tests__/app/TestApp.ts +107 -105
  5. package/__tests__/business/BusinessUtils.ts +37 -37
  6. package/__tests__/result/ActionResult.ts +14 -14
  7. package/__tests__/tsconfig.json +16 -16
  8. package/lib/cjs/address/AddressAutocomplete.d.ts +1 -1
  9. package/lib/cjs/address/AddressPlace.d.ts +3 -3
  10. package/lib/cjs/address/AddressPlaceBase.d.ts +1 -1
  11. package/lib/cjs/address/AddressRegion.d.ts +2 -2
  12. package/lib/cjs/address/AddressRegion.js +12 -12
  13. package/lib/cjs/address/AddressUtils.d.ts +1 -1
  14. package/lib/cjs/api/AuthApi.d.ts +14 -14
  15. package/lib/cjs/api/AuthApi.js +17 -17
  16. package/lib/cjs/api/BaseApi.d.ts +1 -1
  17. package/lib/cjs/api/EntityApi.d.ts +8 -8
  18. package/lib/cjs/api/EntityApi.js +4 -4
  19. package/lib/cjs/api/dto/IdLabelDto.d.ts +1 -1
  20. package/lib/cjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
  21. package/lib/cjs/api/dto/ResultPayload.d.ts +2 -2
  22. package/lib/cjs/api/rq/AuthRequest.d.ts +1 -1
  23. package/lib/cjs/api/rq/LoginRQ.d.ts +2 -2
  24. package/lib/cjs/api/rq/MergeRQ.d.ts +1 -1
  25. package/lib/cjs/api/rq/QueryRQ.d.ts +2 -2
  26. package/lib/cjs/api/rq/StatusQueryRQ.d.ts +3 -3
  27. package/lib/cjs/api/rq/UpdateModel.d.ts +2 -2
  28. package/lib/cjs/api/rq/UpdateStatusRQ.d.ts +2 -2
  29. package/lib/cjs/app/AppSettings.d.ts +3 -3
  30. package/lib/cjs/bridges/FlutterHost.d.ts +2 -2
  31. package/lib/cjs/bridges/FlutterHost.js +11 -11
  32. package/lib/cjs/business/BusinessTax.js +6 -6
  33. package/lib/cjs/business/BusinessUtils.d.ts +2 -2
  34. package/lib/cjs/business/BusinessUtils.js +5 -5
  35. package/lib/cjs/business/Currency.d.ts +1 -1
  36. package/lib/cjs/business/Currency.js +10 -10
  37. package/lib/cjs/business/ProductUnit.d.ts +1 -1
  38. package/lib/cjs/business/ShoppingCart.d.ts +9 -9
  39. package/lib/cjs/business/ShoppingCart.js +11 -11
  40. package/lib/cjs/custom/CustomField.d.ts +1 -1
  41. package/lib/cjs/custom/CustomFieldData.d.ts +2 -2
  42. package/lib/cjs/i18n/Culture.d.ts +31 -0
  43. package/lib/cjs/i18n/Culture.js +51 -0
  44. package/lib/cjs/index.d.ts +1 -4
  45. package/lib/cjs/index.js +1 -4
  46. package/lib/cjs/result/ActionResult.d.ts +1 -1
  47. package/lib/cjs/result/ActionResultError.d.ts +1 -1
  48. package/lib/cjs/result/ActionResultError.js +3 -3
  49. package/lib/cjs/result/InitCallResult.d.ts +1 -1
  50. package/lib/cjs/state/Culture.d.ts +2 -2
  51. package/lib/cjs/state/User.d.ts +1 -1
  52. package/lib/mjs/address/AddressAutocomplete.d.ts +1 -1
  53. package/lib/mjs/address/AddressPlace.d.ts +3 -3
  54. package/lib/mjs/address/AddressPlaceBase.d.ts +1 -1
  55. package/lib/mjs/address/AddressRegion.d.ts +2 -2
  56. package/lib/mjs/address/AddressRegion.js +13 -13
  57. package/lib/mjs/address/AddressUtils.d.ts +1 -1
  58. package/lib/mjs/address/AddressUtils.js +1 -1
  59. package/lib/mjs/api/AuthApi.d.ts +14 -14
  60. package/lib/mjs/api/AuthApi.js +19 -19
  61. package/lib/mjs/api/BaseApi.d.ts +1 -1
  62. package/lib/mjs/api/EntityApi.d.ts +8 -8
  63. package/lib/mjs/api/EntityApi.js +5 -5
  64. package/lib/mjs/api/dto/IdLabelDto.d.ts +1 -1
  65. package/lib/mjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
  66. package/lib/mjs/api/dto/ResultPayload.d.ts +2 -2
  67. package/lib/mjs/api/rq/AuthRequest.d.ts +1 -1
  68. package/lib/mjs/api/rq/LoginRQ.d.ts +2 -2
  69. package/lib/mjs/api/rq/MergeRQ.d.ts +1 -1
  70. package/lib/mjs/api/rq/QueryRQ.d.ts +2 -2
  71. package/lib/mjs/api/rq/StatusQueryRQ.d.ts +3 -3
  72. package/lib/mjs/api/rq/UpdateModel.d.ts +2 -2
  73. package/lib/mjs/api/rq/UpdateStatusRQ.d.ts +2 -2
  74. package/lib/mjs/app/AppSettings.d.ts +3 -3
  75. package/lib/mjs/bridges/FlutterHost.d.ts +2 -2
  76. package/lib/mjs/bridges/FlutterHost.js +13 -13
  77. package/lib/mjs/business/BusinessTax.js +6 -6
  78. package/lib/mjs/business/BusinessUtils.d.ts +2 -2
  79. package/lib/mjs/business/BusinessUtils.js +5 -5
  80. package/lib/mjs/business/Currency.d.ts +1 -1
  81. package/lib/mjs/business/Currency.js +10 -10
  82. package/lib/mjs/business/ProductUnit.d.ts +1 -1
  83. package/lib/mjs/business/ProductUnit.js +1 -1
  84. package/lib/mjs/business/ShoppingCart.d.ts +9 -9
  85. package/lib/mjs/business/ShoppingCart.js +12 -12
  86. package/lib/mjs/custom/CustomField.d.ts +1 -1
  87. package/lib/mjs/custom/CustomFieldData.d.ts +2 -2
  88. package/lib/mjs/i18n/Culture.d.ts +31 -0
  89. package/lib/mjs/i18n/Culture.js +48 -0
  90. package/lib/mjs/index.d.ts +1 -4
  91. package/lib/mjs/index.js +1 -4
  92. package/lib/mjs/result/ActionResult.d.ts +1 -1
  93. package/lib/mjs/result/ActionResult.js +1 -1
  94. package/lib/mjs/result/ActionResultError.d.ts +1 -1
  95. package/lib/mjs/result/ActionResultError.js +3 -3
  96. package/lib/mjs/result/InitCallResult.d.ts +1 -1
  97. package/lib/mjs/state/Culture.d.ts +2 -2
  98. package/lib/mjs/state/User.d.ts +1 -1
  99. package/package.json +1 -1
  100. package/src/address/AddressAutocomplete.ts +16 -16
  101. package/src/address/AddressCity.ts +12 -12
  102. package/src/address/AddressContinent.ts +35 -35
  103. package/src/address/AddressDistrict.ts +12 -12
  104. package/src/address/AddressLocation.ts +8 -8
  105. package/src/address/AddressPlace.ts +23 -23
  106. package/src/address/AddressPlaceBase.ts +31 -31
  107. package/src/address/AddressRegion.ts +286 -286
  108. package/src/address/AddressState.ts +12 -12
  109. package/src/address/AddressUtils.ts +27 -27
  110. package/src/api/AuthApi.ts +194 -194
  111. package/src/api/BaseApi.ts +13 -13
  112. package/src/api/EntityApi.ts +181 -194
  113. package/src/api/dto/AntiforgeryRequestToken.ts +15 -15
  114. package/src/api/dto/ApiRefreshTokenDto.ts +16 -16
  115. package/src/api/dto/IdLabelDto.ts +3 -3
  116. package/src/api/dto/IdLabelPrimaryDto.ts +7 -7
  117. package/src/api/dto/InitCallDto.ts +12 -12
  118. package/src/api/dto/ResultPayload.ts +6 -6
  119. package/src/api/rq/ApiRefreshTokenRQ.ts +8 -8
  120. package/src/api/rq/AuthRequest.ts +40 -40
  121. package/src/api/rq/GetLogInUrlRQ.ts +8 -8
  122. package/src/api/rq/LoginIdRQ.ts +12 -12
  123. package/src/api/rq/LoginRQ.ts +18 -18
  124. package/src/api/rq/MergeRQ.ts +13 -13
  125. package/src/api/rq/QueryPagingData.ts +16 -16
  126. package/src/api/rq/QueryRQ.ts +22 -22
  127. package/src/api/rq/RefreshTokenRQ.ts +4 -4
  128. package/src/api/rq/ResetPasswordRQ.ts +20 -20
  129. package/src/api/rq/SignoutRQ.ts +8 -8
  130. package/src/api/rq/StatusQueryRQ.ts +11 -11
  131. package/src/api/rq/SwitchOrgRQ.ts +8 -8
  132. package/src/api/rq/TokenRQ.ts +4 -4
  133. package/src/api/rq/UpdateModel.ts +12 -12
  134. package/src/api/rq/UpdateStatusRQ.ts +10 -10
  135. package/src/app/AppSettings.ts +27 -27
  136. package/src/app/UserRole.ts +44 -44
  137. package/src/bridges/FlutterHost.ts +92 -97
  138. package/src/bridges/IBridgeHost.ts +49 -51
  139. package/src/business/ApiService.ts +25 -25
  140. package/src/business/BusinessTax.ts +63 -63
  141. package/src/business/BusinessUtils.ts +75 -75
  142. package/src/business/CultureItem.ts +43 -43
  143. package/src/business/Currency.ts +11 -11
  144. package/src/business/DataPrivacy.ts +35 -35
  145. package/src/business/EntityStatus.ts +44 -44
  146. package/src/business/ProductUnit.ts +58 -58
  147. package/src/business/RepeatOption.ts +50 -50
  148. package/src/business/ShoppingCart.ts +696 -706
  149. package/src/custom/CustomField.ts +20 -20
  150. package/src/custom/CustomFieldData.ts +43 -43
  151. package/src/def/ListItem.ts +12 -12
  152. package/src/i18n/Culture.ts +60 -0
  153. package/src/i18n/en.json +244 -244
  154. package/src/i18n/zh-Hans.json +244 -244
  155. package/src/i18n/zh-Hant.json +244 -244
  156. package/src/index.ts +1 -4
  157. package/src/result/ActionResult.ts +19 -19
  158. package/src/result/ActionResultError.ts +30 -30
  159. package/src/result/InitCallResult.ts +21 -21
  160. package/src/state/Culture.ts +3 -3
  161. package/src/state/State.ts +5 -5
  162. package/src/state/User.ts +92 -92
  163. package/lib/cjs/i18n/CultureUtils.d.ts +0 -13
  164. package/lib/cjs/i18n/CultureUtils.js +0 -32
  165. package/lib/cjs/i18n/en.d.ts +0 -6
  166. package/lib/cjs/i18n/en.js +0 -12
  167. package/lib/cjs/i18n/zhHans.d.ts +0 -6
  168. package/lib/cjs/i18n/zhHans.js +0 -12
  169. package/lib/cjs/i18n/zhHant.d.ts +0 -6
  170. package/lib/cjs/i18n/zhHant.js +0 -12
  171. package/lib/mjs/i18n/CultureUtils.d.ts +0 -13
  172. package/lib/mjs/i18n/CultureUtils.js +0 -29
  173. package/lib/mjs/i18n/en.d.ts +0 -6
  174. package/lib/mjs/i18n/en.js +0 -8
  175. package/lib/mjs/i18n/zhHans.d.ts +0 -6
  176. package/lib/mjs/i18n/zhHans.js +0 -8
  177. package/lib/mjs/i18n/zhHant.d.ts +0 -6
  178. package/lib/mjs/i18n/zhHant.js +0 -8
  179. package/src/i18n/CultureUtils.ts +0 -36
  180. package/src/i18n/en.ts +0 -10
  181. package/src/i18n/zhHans.ts +0 -10
  182. package/src/i18n/zhHant.ts +0 -10
@@ -1,9 +1,9 @@
1
- import { IdType, ListType2 } from '@etsoo/shared';
1
+ import { IdType, ListType2 } from "@etsoo/shared";
2
2
  /**
3
3
  * Custom field space (12 columns)
4
4
  * 自定义字段空间(12列)
5
5
  */
6
- export type CustomFieldSpace = 'quater' | 'half' | 'half1' | 'full' | 'five' | 'seven';
6
+ export type CustomFieldSpace = "quater" | "half" | "half1" | "full" | "five" | "seven";
7
7
  /**
8
8
  * Custom field data
9
9
  * 自定义字段数据
@@ -0,0 +1,31 @@
1
+ import { DataTypes, DomUtils } from "@etsoo/shared";
2
+ /**
3
+ * Culture namespace
4
+ */
5
+ export declare namespace Culture {
6
+ /**
7
+ * Make culture
8
+ * @param cultureMaker Culture maker
9
+ * @param resources Resources
10
+ * @returns Culture
11
+ */
12
+ function make(cultureMaker: typeof DomUtils.zhHans, ...resources: (object | (() => Promise<object>))[]): DataTypes.CultureDefinition<DataTypes.StringRecord>;
13
+ /**
14
+ * Get en neutral culture
15
+ * @param localResources Local resources
16
+ * @returns Full culture
17
+ */
18
+ const en: (...resources: (object | (() => Promise<object>))[]) => DataTypes.CultureDefinition<DataTypes.StringRecord>;
19
+ /**
20
+ * Get zh-Hans neutral cultrue
21
+ * @param localResources Local resources
22
+ * @returns Full culture
23
+ */
24
+ const zhHans: (...resources: (object | (() => Promise<object>))[]) => DataTypes.CultureDefinition<DataTypes.StringRecord>;
25
+ /**
26
+ * Get zh-Hant neutral cultrue
27
+ * @param localResources Local resources
28
+ * @returns Full culture
29
+ */
30
+ const zhHant: (...resources: (object | (() => Promise<object>))[]) => DataTypes.CultureDefinition<DataTypes.StringRecord>;
31
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Culture = void 0;
4
+ const shared_1 = require("@etsoo/shared");
5
+ /**
6
+ * Culture namespace
7
+ */
8
+ var Culture;
9
+ (function (Culture) {
10
+ /**
11
+ * Make culture
12
+ * @param cultureMaker Culture maker
13
+ * @param resources Resources
14
+ * @returns Culture
15
+ */
16
+ function make(cultureMaker, ...resources) {
17
+ return cultureMaker(async () => {
18
+ const rs = await Promise.all(resources.map((resource) => new Promise((resolve) => {
19
+ if (typeof resource === "object") {
20
+ resolve(resource);
21
+ }
22
+ else {
23
+ resource().then((result) => resolve(result));
24
+ }
25
+ })));
26
+ return rs.reduce((prev, curr) => ({
27
+ ...prev,
28
+ ...curr
29
+ }));
30
+ });
31
+ }
32
+ Culture.make = make;
33
+ /**
34
+ * Get en neutral culture
35
+ * @param localResources Local resources
36
+ * @returns Full culture
37
+ */
38
+ Culture.en = (...resources) => make(shared_1.DomUtils.en, import("./en.json"), ...resources);
39
+ /**
40
+ * Get zh-Hans neutral cultrue
41
+ * @param localResources Local resources
42
+ * @returns Full culture
43
+ */
44
+ Culture.zhHans = (...resources) => make(shared_1.DomUtils.zhHans, import("./zh-Hans.json"), ...resources);
45
+ /**
46
+ * Get zh-Hant neutral cultrue
47
+ * @param localResources Local resources
48
+ * @returns Full culture
49
+ */
50
+ Culture.zhHant = (...resources) => make(shared_1.DomUtils.zhHant, import("./zh-Hant.json"), ...resources);
51
+ })(Culture || (exports.Culture = Culture = {}));
@@ -55,10 +55,7 @@ export * from "./business/ShoppingCart";
55
55
  export * from "./custom/CustomField";
56
56
  export * from "./custom/CustomFieldData";
57
57
  export * from "./def/ListItem";
58
- export * from "./i18n/CultureUtils";
59
- export * from "./i18n/en";
60
- export * from "./i18n/zhHans";
61
- export * from "./i18n/zhHant";
58
+ export * from "./i18n/Culture";
62
59
  export { ApiAuthorizationScheme, ApiDataError, ApiMethod, ApiResponseType, createClient, createClientAsync } from "@etsoo/restclient";
63
60
  export type { IApi, IApiPayload } from "@etsoo/restclient";
64
61
  export * from "./result/ActionResult";
package/lib/cjs/index.js CHANGED
@@ -80,10 +80,7 @@ __exportStar(require("./custom/CustomFieldData"), exports);
80
80
  // def
81
81
  __exportStar(require("./def/ListItem"), exports);
82
82
  // i18n
83
- __exportStar(require("./i18n/CultureUtils"), exports);
84
- __exportStar(require("./i18n/en"), exports);
85
- __exportStar(require("./i18n/zhHans"), exports);
86
- __exportStar(require("./i18n/zhHant"), exports);
83
+ __exportStar(require("./i18n/Culture"), exports);
87
84
  // @etsoo/restclient
88
85
  var restclient_1 = require("@etsoo/restclient");
89
86
  Object.defineProperty(exports, "ApiAuthorizationScheme", { enumerable: true, get: function () { return restclient_1.ApiAuthorizationScheme; } });
@@ -1,4 +1,4 @@
1
- import { IActionResult } from '@etsoo/shared';
1
+ import { IActionResult } from "@etsoo/shared";
2
2
  /**
3
3
  * Action result
4
4
  */
@@ -1,4 +1,4 @@
1
- import { IActionResult } from '@etsoo/shared';
1
+ import { IActionResult } from "@etsoo/shared";
2
2
  /**
3
3
  * Action result error
4
4
  */
@@ -18,8 +18,8 @@ class ActionResultError extends Error {
18
18
  addtions.push(result.type);
19
19
  if (result.field)
20
20
  addtions.push(result.field);
21
- const add = addtions.length > 0 ? ` (${addtions.join(', ')})` : '';
22
- return `${result.title || 'Error'}${add}`;
21
+ const add = addtions.length > 0 ? ` (${addtions.join(", ")})` : "";
22
+ return `${result.title || "Error"}${add}`;
23
23
  }
24
24
  /**
25
25
  * Constructor
@@ -29,7 +29,7 @@ class ActionResultError extends Error {
29
29
  // Super
30
30
  super(ActionResultError.format(result));
31
31
  // Name
32
- this.name = 'ActionResultError';
32
+ this.name = "ActionResultError";
33
33
  // Hold the result
34
34
  this.result = result;
35
35
  }
@@ -1,4 +1,4 @@
1
- import { IActionResult } from '@etsoo/shared';
1
+ import { IActionResult } from "@etsoo/shared";
2
2
  /**
3
3
  * Init call result data
4
4
  */
@@ -1,5 +1,5 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import { IState } from './State';
1
+ import { DataTypes } from "@etsoo/shared";
2
+ import { IState } from "./State";
3
3
  /**
4
4
  * Culture resources state, simple i18n solution
5
5
  * For premium solution: https://www.i18next.com/
@@ -1,4 +1,4 @@
1
- import { IState } from './State';
1
+ import { IState } from "./State";
2
2
  /**
3
3
  * User data interface
4
4
  */
@@ -1,4 +1,4 @@
1
- import { AddressPlaceBase } from './AddressPlaceBase';
1
+ import { AddressPlaceBase } from "./AddressPlaceBase";
2
2
  /**
3
3
  * Address autocomplete
4
4
  * 地点自动填充
@@ -1,10 +1,10 @@
1
- import { AddressLocation } from './AddressLocation';
2
- import { AddressPlaceBase } from './AddressPlaceBase';
1
+ import { AddressLocation } from "./AddressLocation";
2
+ import { AddressPlaceBase } from "./AddressPlaceBase";
3
3
  /**
4
4
  * Address place
5
5
  * 地点
6
6
  */
7
- export type AddressPlace = Omit<AddressPlaceBase, 'location'> & {
7
+ export type AddressPlace = Omit<AddressPlaceBase, "location"> & {
8
8
  /**
9
9
  * Place id
10
10
  * 地点编号
@@ -1,4 +1,4 @@
1
- import { AddressLocation } from './AddressLocation';
1
+ import { AddressLocation } from "./AddressLocation";
2
2
  /**
3
3
  * Address place base
4
4
  * 基础地点
@@ -1,5 +1,5 @@
1
- import { Currency } from '../business/Currency';
2
- import { AddressContinent, AddressContinentId } from './AddressContinent';
1
+ import { Currency } from "../business/Currency";
2
+ import { AddressContinent, AddressContinentId } from "./AddressContinent";
3
3
  /**
4
4
  * Address region in database
5
5
  */
@@ -1,4 +1,4 @@
1
- import { AddressContinent } from './AddressContinent';
1
+ import { AddressContinent } from "./AddressContinent";
2
2
  /**
3
3
  * Address or region
4
4
  */
@@ -28,62 +28,62 @@ export class AddressRegion {
28
28
  /**
29
29
  * CN - China
30
30
  */
31
- AddressRegion.CN = new AddressRegion('CN', 'CHN', '156', AddressContinent.AS, '00', '+86', '0', 'CNY', ['zh-Hans-CN', 'zh-CN']);
31
+ AddressRegion.CN = new AddressRegion("CN", "CHN", "156", AddressContinent.AS, "00", "+86", "0", "CNY", ["zh-Hans-CN", "zh-CN"]);
32
32
  /**
33
33
  * HK - HK, China
34
34
  * 中国香港
35
35
  */
36
- AddressRegion.HK = new AddressRegion('HK', 'HKG', '344', AddressContinent.AS, '001', '+852', undefined, 'HKD', ['zh-Hant-HK', 'zh-HK', 'en-HK']);
36
+ AddressRegion.HK = new AddressRegion("HK", "HKG", "344", AddressContinent.AS, "001", "+852", undefined, "HKD", ["zh-Hant-HK", "zh-HK", "en-HK"]);
37
37
  /**
38
38
  * SG - Singapore
39
39
  * 新加坡
40
40
  */
41
- AddressRegion.SG = new AddressRegion('SG', 'SGP', '702', AddressContinent.AS, '000', '+65', undefined, 'SGD', ['zh-Hans-SG', 'zh-SG', 'en-SG']);
41
+ AddressRegion.SG = new AddressRegion("SG", "SGP", "702", AddressContinent.AS, "000", "+65", undefined, "SGD", ["zh-Hans-SG", "zh-SG", "en-SG"]);
42
42
  /**
43
43
  * JP - Japan
44
44
  * 日本
45
45
  */
46
- AddressRegion.JP = new AddressRegion('JP', 'JPN', '392', AddressContinent.AS, '010', '+81', '0', 'JPY', ['ja-JP']);
46
+ AddressRegion.JP = new AddressRegion("JP", "JPN", "392", AddressContinent.AS, "010", "+81", "0", "JPY", ["ja-JP"]);
47
47
  /**
48
48
  * US - United States
49
49
  * 美国
50
50
  */
51
- AddressRegion.US = new AddressRegion('US', 'USA', '840', AddressContinent.NA, '011', '+1', '1', 'USD', ['en-US']);
51
+ AddressRegion.US = new AddressRegion("US", "USA", "840", AddressContinent.NA, "011", "+1", "1", "USD", ["en-US"]);
52
52
  /**
53
53
  * CA - Canada
54
54
  * 加拿大
55
55
  */
56
- AddressRegion.CA = new AddressRegion('CA', 'CAN', '124', AddressContinent.NA, '011', '+1', '1', 'CAD', ['en-CA', 'fr-CA']);
56
+ AddressRegion.CA = new AddressRegion("CA", "CAN", "124", AddressContinent.NA, "011", "+1", "1", "CAD", ["en-CA", "fr-CA"]);
57
57
  /**
58
58
  * AU - Australia
59
59
  * 澳大利亚
60
60
  */
61
- AddressRegion.AU = new AddressRegion('AU', 'AUS', '036', AddressContinent.OC, '0011', '+61', '0', 'AUD', ['en-AU']);
61
+ AddressRegion.AU = new AddressRegion("AU", "AUS", "036", AddressContinent.OC, "0011", "+61", "0", "AUD", ["en-AU"]);
62
62
  /**
63
63
  * NZ - New Zealand
64
64
  * 新西兰
65
65
  */
66
- AddressRegion.NZ = new AddressRegion('NZ', 'NZL', '554', AddressContinent.OC, '00', '+64', '0', 'NZD', ['en-NZ', 'mi-NZ']);
66
+ AddressRegion.NZ = new AddressRegion("NZ", "NZL", "554", AddressContinent.OC, "00", "+64", "0", "NZD", ["en-NZ", "mi-NZ"]);
67
67
  /**
68
68
  * GB - Great Britain
69
69
  * 英国
70
70
  */
71
- AddressRegion.GB = new AddressRegion('GB', 'GBR', '826', AddressContinent.EU, '00', '+44', '0', 'GBP', ['en-GB']);
71
+ AddressRegion.GB = new AddressRegion("GB", "GBR", "826", AddressContinent.EU, "00", "+44", "0", "GBP", ["en-GB"]);
72
72
  /**
73
73
  * IE - Ireland
74
74
  * 爱尔兰
75
75
  */
76
- AddressRegion.IE = new AddressRegion('IE', 'IRL', '372', AddressContinent.EU, '00', '+353', '0', 'EUR', ['en-IE']);
76
+ AddressRegion.IE = new AddressRegion("IE", "IRL", "372", AddressContinent.EU, "00", "+353", "0", "EUR", ["en-IE"]);
77
77
  /**
78
78
  * DE - Germany
79
79
  * 德国
80
80
  */
81
- AddressRegion.DE = new AddressRegion('DE', 'DEU', '276', AddressContinent.EU, '00', '+49', '0', 'EUR', ['de-DE']);
81
+ AddressRegion.DE = new AddressRegion("DE", "DEU", "276", AddressContinent.EU, "00", "+49", "0", "EUR", ["de-DE"]);
82
82
  /**
83
83
  * FR - France
84
84
  * 法国
85
85
  */
86
- AddressRegion.FR = new AddressRegion('FR', 'FRA', '250', AddressContinent.EU, '00', '+33', '0', 'EUR', ['fr-FR']);
86
+ AddressRegion.FR = new AddressRegion("FR", "FRA", "250", AddressContinent.EU, "00", "+33", "0", "EUR", ["fr-FR"]);
87
87
  /**
88
88
  * All countries and regions
89
89
  */
@@ -1,4 +1,4 @@
1
- import { AddressRegion } from './AddressRegion';
1
+ import { AddressRegion } from "./AddressRegion";
2
2
  /**
3
3
  * Address utils
4
4
  */
@@ -1,4 +1,4 @@
1
- import { AddressRegion } from './AddressRegion';
1
+ import { AddressRegion } from "./AddressRegion";
2
2
  /**
3
3
  * Address utils
4
4
  */
@@ -1,17 +1,17 @@
1
- import { IApiPayload } from '@etsoo/restclient';
2
- import { IUser } from '../state/User';
3
- import { BaseApi } from './BaseApi';
4
- import { ResultPayload } from './dto/ResultPayload';
5
- import { IActionResult } from '@etsoo/shared';
6
- import { RefreshTokenProps, RefreshTokenResult } from '../app/IApp';
7
- import { TokenRQ } from './rq/TokenRQ';
8
- import { ApiRefreshTokenDto } from './dto/ApiRefreshTokenDto';
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
- import { SwitchOrgRQ } from './rq/SwitchOrgRQ';
14
- import { AuthRequest } from './rq/AuthRequest';
1
+ import { IApiPayload } from "@etsoo/restclient";
2
+ import { IUser } from "../state/User";
3
+ import { BaseApi } from "./BaseApi";
4
+ import { ResultPayload } from "./dto/ResultPayload";
5
+ import { IActionResult } from "@etsoo/shared";
6
+ import { RefreshTokenProps, RefreshTokenResult } from "../app/IApp";
7
+ import { TokenRQ } from "./rq/TokenRQ";
8
+ import { ApiRefreshTokenDto } from "./dto/ApiRefreshTokenDto";
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
+ import { SwitchOrgRQ } from "./rq/SwitchOrgRQ";
14
+ import { AuthRequest } from "./rq/AuthRequest";
15
15
  /**
16
16
  * Authentication API
17
17
  */
@@ -1,5 +1,5 @@
1
- import { BaseApi } from './BaseApi';
2
- import { ActionResult } from '@etsoo/shared';
1
+ import { BaseApi } from "./BaseApi";
2
+ import { ActionResult } from "@etsoo/shared";
3
3
  /**
4
4
  * Authentication API
5
5
  */
@@ -11,7 +11,7 @@ export class AuthApi extends BaseApi {
11
11
  * @returns Result
12
12
  */
13
13
  apiRefreshToken(rq, payload) {
14
- return this.api.put('Auth/ApiRefreshToken', rq, payload);
14
+ return this.api.put("Auth/ApiRefreshToken", rq, payload);
15
15
  }
16
16
  /**
17
17
  * Authorization request
@@ -19,7 +19,7 @@ export class AuthApi extends BaseApi {
19
19
  * @param payload Payload
20
20
  */
21
21
  authRequest(auth, payload) {
22
- return this.api.post('Auth/AuthRequest', auth, payload);
22
+ return this.api.post("Auth/AuthRequest", auth, payload);
23
23
  }
24
24
  /**
25
25
  * Exchange token
@@ -28,7 +28,7 @@ export class AuthApi extends BaseApi {
28
28
  * @returns Result
29
29
  */
30
30
  exchangeToken(rq, payload) {
31
- return this.api.put('Auth/ExchangeToken', rq, payload);
31
+ return this.api.put("Auth/ExchangeToken", rq, payload);
32
32
  }
33
33
  /**
34
34
  * Get log in url
@@ -37,7 +37,7 @@ export class AuthApi extends BaseApi {
37
37
  * @returns Result
38
38
  */
39
39
  getLogInUrl(rq, payload) {
40
- return this.api.get('Auth/GetLogInUrl', rq, payload);
40
+ return this.api.get("Auth/GetLogInUrl", rq, payload);
41
41
  }
42
42
  /**
43
43
  * Login
@@ -51,7 +51,7 @@ export class AuthApi extends BaseApi {
51
51
  payload ?? (payload = {});
52
52
  tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
53
53
  // Call the API
54
- const result = await this.api.post('Auth/Login', rq, payload);
54
+ const result = await this.api.post("Auth/Login", rq, payload);
55
55
  // Get the refresh token
56
56
  const refreshToken = result?.ok
57
57
  ? this.app.getResponseToken(payload.response, tokenKey)
@@ -73,7 +73,7 @@ export class AuthApi extends BaseApi {
73
73
  deviceId,
74
74
  region
75
75
  };
76
- return this.api.post('Auth/LoginId', rq, payload);
76
+ return this.api.post("Auth/LoginId", rq, payload);
77
77
  }
78
78
  /**
79
79
  * Refresh token
@@ -82,14 +82,14 @@ export class AuthApi extends BaseApi {
82
82
  */
83
83
  async refreshToken(props) {
84
84
  // Destruct
85
- const { api = 'Auth/RefreshToken', showLoading = false, token, tokenField = AuthApi.HeaderTokenField } = props ?? {};
85
+ const { api = "Auth/RefreshToken", showLoading = false, token, tokenField = AuthApi.HeaderTokenField } = props ?? {};
86
86
  // Check the token
87
87
  if (!token) {
88
88
  return {
89
89
  ok: false,
90
- type: 'noData',
91
- field: 'token',
92
- title: this.app.get('noData')
90
+ type: "noData",
91
+ field: "token",
92
+ title: this.app.get("noData")
93
93
  };
94
94
  }
95
95
  // Reqest data
@@ -113,9 +113,9 @@ export class AuthApi extends BaseApi {
113
113
  ? ActionResult.create(this.api.lastError)
114
114
  : {
115
115
  ok: false,
116
- type: 'unknownError',
117
- field: 'result',
118
- title: this.app.get('unknownError')
116
+ type: "unknownError",
117
+ field: "result",
118
+ title: this.app.get("unknownError")
119
119
  };
120
120
  }
121
121
  // Token
@@ -130,7 +130,7 @@ export class AuthApi extends BaseApi {
130
130
  * @returns Result
131
131
  */
132
132
  resetPassword(rq, payload) {
133
- return this.api.put('Auth/ResetPassword', rq, payload);
133
+ return this.api.put("Auth/ResetPassword", rq, payload);
134
134
  }
135
135
  /**
136
136
  * Signout
@@ -139,7 +139,7 @@ export class AuthApi extends BaseApi {
139
139
  * @returns Result
140
140
  */
141
141
  signout(rq, payload) {
142
- return this.api.put('Auth/Signout', rq, payload);
142
+ return this.api.put("Auth/Signout", rq, payload);
143
143
  }
144
144
  /**
145
145
  * Switch organization
@@ -147,10 +147,10 @@ export class AuthApi extends BaseApi {
147
147
  * @param payload Payload
148
148
  */
149
149
  switchOrg(rq, payload) {
150
- return this.app.api.put('Auth/SwitchOrg', rq, payload);
150
+ return this.app.api.put("Auth/SwitchOrg", rq, payload);
151
151
  }
152
152
  }
153
153
  /**
154
154
  * Header token field name
155
155
  */
156
- AuthApi.HeaderTokenField = 'Etsoo-Refresh-Token';
156
+ AuthApi.HeaderTokenField = "Etsoo-Refresh-Token";
@@ -1,4 +1,4 @@
1
- import { IApp } from '../app/IApp';
1
+ import { IApp } from "../app/IApp";
2
2
  /**
3
3
  * SmartERP base API
4
4
  */
@@ -1,11 +1,11 @@
1
- import { IApi, IApiPayload } from '@etsoo/restclient';
2
- import { IActionResult, IdType } from '@etsoo/shared';
3
- import { IApp } from '../app/IApp';
4
- import { BaseApi } from './BaseApi';
5
- import { ResultPayload } from './dto/ResultPayload';
6
- import { MergeRQ } from './rq/MergeRQ';
7
- import { QueryRQ } from './rq/QueryRQ';
8
- import { UpdateStatusRQ } from './rq/UpdateStatusRQ';
1
+ import { IApi, IApiPayload } from "@etsoo/restclient";
2
+ import { IActionResult, IdType } from "@etsoo/shared";
3
+ import { IApp } from "../app/IApp";
4
+ import { BaseApi } from "./BaseApi";
5
+ import { ResultPayload } from "./dto/ResultPayload";
6
+ import { MergeRQ } from "./rq/MergeRQ";
7
+ import { QueryRQ } from "./rq/QueryRQ";
8
+ import { UpdateStatusRQ } from "./rq/UpdateStatusRQ";
9
9
  /**
10
10
  * Entity API
11
11
  * Follow com.etsoo.CoreFramework.Services.EntityServiceBase
@@ -1,4 +1,4 @@
1
- import { BaseApi } from './BaseApi';
1
+ import { BaseApi } from "./BaseApi";
2
2
  /**
3
3
  * Entity API
4
4
  * Follow com.etsoo.CoreFramework.Services.EntityServiceBase
@@ -24,7 +24,7 @@ export class EntityApi extends BaseApi {
24
24
  }
25
25
  deleteBase(id, payload) {
26
26
  const query = Array.isArray(id)
27
- ? '?' + id.map((item) => `ids=${item}`).join('&')
27
+ ? "?" + id.map((item) => `ids=${item}`).join("&")
28
28
  : id;
29
29
  return this.api.delete(`${this.flag}/Delete/${query}`, undefined, payload);
30
30
  }
@@ -36,7 +36,7 @@ export class EntityApi extends BaseApi {
36
36
  */
37
37
  listBase(rq, payload) {
38
38
  let { queryPaging, ...rest } = rq;
39
- if (typeof queryPaging === 'number') {
39
+ if (typeof queryPaging === "number") {
40
40
  queryPaging = { currentPage: 0, batchSize: queryPaging };
41
41
  }
42
42
  return this.api.post(`${this.flag}/List`, { queryPaging, ...rest }, payload);
@@ -57,7 +57,7 @@ export class EntityApi extends BaseApi {
57
57
  * @param queryKey Additional query key
58
58
  * @returns Result
59
59
  */
60
- queryBase(rq, payload, queryKey = '') {
60
+ queryBase(rq, payload, queryKey = "") {
61
61
  return this.api.post(`${this.flag}/Query${queryKey}`, rq, payload);
62
62
  }
63
63
  /**
@@ -101,7 +101,7 @@ export class EntityApi extends BaseApi {
101
101
  * @param payload Payload
102
102
  * @returns Result
103
103
  */
104
- sortWith(category, items, method = 'Sort', payload) {
104
+ sortWith(category, items, method = "Sort", payload) {
105
105
  const data = {};
106
106
  items.forEach((item, index) => (data[item.id] = index));
107
107
  return this.api.put(`${this.flag}/${method}`, { category, data }, payload);
@@ -1,4 +1,4 @@
1
- import { ListType, ListType1 } from '@etsoo/shared';
1
+ import { ListType, ListType1 } from "@etsoo/shared";
2
2
  /**
3
3
  * Conditional IdLabel type
4
4
  */
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdType } from '@etsoo/shared';
1
+ import { DataTypes, IdType } from "@etsoo/shared";
2
2
  /**
3
3
  * Dto with id, label and primary field
4
4
  */
@@ -1,5 +1,5 @@
1
- import { IApiPayload } from '@etsoo/restclient';
2
- import { IActionResult, IdActionResult, IdMsgActionResult, MsgActionResult } from '@etsoo/shared';
1
+ import { IApiPayload } from "@etsoo/restclient";
2
+ import { IActionResult, IdActionResult, IdMsgActionResult, MsgActionResult } from "@etsoo/shared";
3
3
  /**
4
4
  * Action result payload
5
5
  */
@@ -27,7 +27,7 @@ export type AuthRequest = {
27
27
  * Response type, code or token
28
28
  * 响应类型,代码或令牌
29
29
  */
30
- responseType: 'code' | 'token';
30
+ responseType: "code" | "token";
31
31
  /**
32
32
  * Scope
33
33
  * 作用域
@@ -1,5 +1,5 @@
1
- import { AuthRequest } from './AuthRequest';
2
- import { LoginIdRQ } from './LoginIdRQ';
1
+ import { AuthRequest } from "./AuthRequest";
2
+ import { LoginIdRQ } from "./LoginIdRQ";
3
3
  /**
4
4
  * Login request data
5
5
  */
@@ -1,4 +1,4 @@
1
- import { IdType } from '@etsoo/shared';
1
+ import { IdType } from "@etsoo/shared";
2
2
  /**
3
3
  * Merge request data
4
4
  */
@@ -1,5 +1,5 @@
1
- import { IdType } from '@etsoo/shared';
2
- import { QueryPagingData } from './QueryPagingData';
1
+ import { IdType } from "@etsoo/shared";
2
+ import { QueryPagingData } from "./QueryPagingData";
3
3
  /**
4
4
  * Query request data
5
5
  * com.etsoo.CoreFramework.Models.QueryRQ
@@ -1,6 +1,6 @@
1
- import { IdType } from '@etsoo/shared';
2
- import { QueryRQ } from './QueryRQ';
3
- import { EntityStatus } from '../../business/EntityStatus';
1
+ import { IdType } from "@etsoo/shared";
2
+ import { QueryRQ } from "./QueryRQ";
3
+ import { EntityStatus } from "../../business/EntityStatus";
4
4
  /**
5
5
  * Query with status request data
6
6
  * com.etsoo.CoreFramework.Models.QueryRQ
@@ -1,4 +1,4 @@
1
- import { IdType } from '@etsoo/shared';
1
+ import { IdType } from "@etsoo/shared";
2
2
  /**
3
3
  * Update model
4
4
  * 更新模型
@@ -14,5 +14,5 @@ export interface UpdateModel<T extends IdType = number> {
14
14
  * 'Exclude' items from a union type while 'omit' items from an object type.
15
15
  * 更改的字段,注意 'Exclude' 用于联合类型,'omit' 用于对象类型。
16
16
  */
17
- changedFields?: Exclude<keyof this, 'changedFields'>[];
17
+ changedFields?: Exclude<keyof this, "changedFields">[];
18
18
  }