@etsoo/appscript 1.5.63 → 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 (196) hide show
  1. package/.github/workflows/main.yml +6 -5
  2. package/README.md +97 -71
  3. package/__tests__/app/CoreApp.ts +141 -143
  4. package/__tests__/app/Culture.ts +23 -23
  5. package/__tests__/app/TestApp.ts +107 -105
  6. package/__tests__/business/BusinessUtils.ts +37 -37
  7. package/__tests__/result/ActionResult.ts +14 -14
  8. package/__tests__/tsconfig.json +16 -16
  9. package/babel.config.json +8 -8
  10. package/lib/cjs/address/AddressAutocomplete.d.ts +1 -1
  11. package/lib/cjs/address/AddressPlace.d.ts +3 -3
  12. package/lib/cjs/address/AddressPlaceBase.d.ts +1 -1
  13. package/lib/cjs/address/AddressRegion.d.ts +2 -2
  14. package/lib/cjs/address/AddressRegion.js +12 -12
  15. package/lib/cjs/address/AddressUtils.d.ts +1 -1
  16. package/lib/cjs/api/AuthApi.d.ts +14 -14
  17. package/lib/cjs/api/AuthApi.js +17 -17
  18. package/lib/cjs/api/BaseApi.d.ts +1 -1
  19. package/lib/cjs/api/EntityApi.d.ts +8 -8
  20. package/lib/cjs/api/EntityApi.js +4 -4
  21. package/lib/cjs/api/dto/AuditLineDto.d.ts +24 -0
  22. package/lib/cjs/api/dto/AuditLineDto.js +2 -0
  23. package/lib/cjs/api/dto/IdLabelDto.d.ts +1 -1
  24. package/lib/cjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
  25. package/lib/cjs/api/dto/PinDto.d.ts +61 -0
  26. package/lib/cjs/api/dto/PinDto.js +2 -0
  27. package/lib/cjs/api/dto/ResultPayload.d.ts +2 -2
  28. package/lib/cjs/api/rq/AuthRequest.d.ts +1 -1
  29. package/lib/cjs/api/rq/LoginRQ.d.ts +2 -2
  30. package/lib/cjs/api/rq/MergeRQ.d.ts +1 -1
  31. package/lib/cjs/api/rq/QueryRQ.d.ts +2 -2
  32. package/lib/cjs/api/rq/StatusQueryRQ.d.ts +3 -3
  33. package/lib/cjs/api/rq/UpdateModel.d.ts +2 -2
  34. package/lib/cjs/api/rq/UpdateStatusRQ.d.ts +2 -2
  35. package/lib/cjs/app/AppSettings.d.ts +3 -3
  36. package/lib/cjs/bridges/FlutterHost.d.ts +2 -2
  37. package/lib/cjs/bridges/FlutterHost.js +11 -11
  38. package/lib/cjs/business/BusinessTax.js +6 -6
  39. package/lib/cjs/business/BusinessUtils.d.ts +2 -2
  40. package/lib/cjs/business/BusinessUtils.js +5 -5
  41. package/lib/cjs/business/Currency.d.ts +1 -1
  42. package/lib/cjs/business/Currency.js +10 -10
  43. package/lib/cjs/business/ProductUnit.d.ts +1 -1
  44. package/lib/cjs/business/ShoppingCart.d.ts +9 -9
  45. package/lib/cjs/business/ShoppingCart.js +11 -11
  46. package/lib/cjs/custom/CustomField.d.ts +1 -1
  47. package/lib/cjs/custom/CustomFieldData.d.ts +2 -2
  48. package/lib/cjs/i18n/Culture.d.ts +31 -0
  49. package/lib/cjs/i18n/Culture.js +51 -0
  50. package/lib/cjs/index.d.ts +3 -4
  51. package/lib/cjs/index.js +3 -4
  52. package/lib/cjs/result/ActionResult.d.ts +1 -1
  53. package/lib/cjs/result/ActionResultError.d.ts +1 -1
  54. package/lib/cjs/result/ActionResultError.js +3 -3
  55. package/lib/cjs/result/InitCallResult.d.ts +1 -1
  56. package/lib/cjs/state/Culture.d.ts +2 -2
  57. package/lib/cjs/state/User.d.ts +1 -1
  58. package/lib/mjs/address/AddressAutocomplete.d.ts +1 -1
  59. package/lib/mjs/address/AddressPlace.d.ts +3 -3
  60. package/lib/mjs/address/AddressPlaceBase.d.ts +1 -1
  61. package/lib/mjs/address/AddressRegion.d.ts +2 -2
  62. package/lib/mjs/address/AddressRegion.js +13 -13
  63. package/lib/mjs/address/AddressUtils.d.ts +1 -1
  64. package/lib/mjs/address/AddressUtils.js +1 -1
  65. package/lib/mjs/api/AuthApi.d.ts +14 -14
  66. package/lib/mjs/api/AuthApi.js +19 -19
  67. package/lib/mjs/api/BaseApi.d.ts +1 -1
  68. package/lib/mjs/api/EntityApi.d.ts +8 -8
  69. package/lib/mjs/api/EntityApi.js +5 -5
  70. package/lib/mjs/api/dto/AuditLineDto.d.ts +24 -0
  71. package/lib/mjs/api/dto/AuditLineDto.js +1 -0
  72. package/lib/mjs/api/dto/IdLabelDto.d.ts +1 -1
  73. package/lib/mjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
  74. package/lib/mjs/api/dto/PinDto.d.ts +61 -0
  75. package/lib/mjs/api/dto/PinDto.js +1 -0
  76. package/lib/mjs/api/dto/ResultPayload.d.ts +2 -2
  77. package/lib/mjs/api/rq/AuthRequest.d.ts +1 -1
  78. package/lib/mjs/api/rq/LoginRQ.d.ts +2 -2
  79. package/lib/mjs/api/rq/MergeRQ.d.ts +1 -1
  80. package/lib/mjs/api/rq/QueryRQ.d.ts +2 -2
  81. package/lib/mjs/api/rq/StatusQueryRQ.d.ts +3 -3
  82. package/lib/mjs/api/rq/UpdateModel.d.ts +2 -2
  83. package/lib/mjs/api/rq/UpdateStatusRQ.d.ts +2 -2
  84. package/lib/mjs/app/AppSettings.d.ts +3 -3
  85. package/lib/mjs/bridges/FlutterHost.d.ts +2 -2
  86. package/lib/mjs/bridges/FlutterHost.js +13 -13
  87. package/lib/mjs/business/BusinessTax.js +6 -6
  88. package/lib/mjs/business/BusinessUtils.d.ts +2 -2
  89. package/lib/mjs/business/BusinessUtils.js +5 -5
  90. package/lib/mjs/business/Currency.d.ts +1 -1
  91. package/lib/mjs/business/Currency.js +10 -10
  92. package/lib/mjs/business/ProductUnit.d.ts +1 -1
  93. package/lib/mjs/business/ProductUnit.js +1 -1
  94. package/lib/mjs/business/ShoppingCart.d.ts +9 -9
  95. package/lib/mjs/business/ShoppingCart.js +12 -12
  96. package/lib/mjs/custom/CustomField.d.ts +1 -1
  97. package/lib/mjs/custom/CustomFieldData.d.ts +2 -2
  98. package/lib/mjs/i18n/Culture.d.ts +31 -0
  99. package/lib/mjs/i18n/Culture.js +48 -0
  100. package/lib/mjs/index.d.ts +3 -4
  101. package/lib/mjs/index.js +3 -4
  102. package/lib/mjs/result/ActionResult.d.ts +1 -1
  103. package/lib/mjs/result/ActionResult.js +1 -1
  104. package/lib/mjs/result/ActionResultError.d.ts +1 -1
  105. package/lib/mjs/result/ActionResultError.js +3 -3
  106. package/lib/mjs/result/InitCallResult.d.ts +1 -1
  107. package/lib/mjs/state/Culture.d.ts +2 -2
  108. package/lib/mjs/state/User.d.ts +1 -1
  109. package/package.json +1 -1
  110. package/src/address/AddressAutocomplete.ts +16 -16
  111. package/src/address/AddressCity.ts +12 -12
  112. package/src/address/AddressContinent.ts +35 -35
  113. package/src/address/AddressDistrict.ts +12 -12
  114. package/src/address/AddressLocation.ts +8 -8
  115. package/src/address/AddressPlace.ts +23 -23
  116. package/src/address/AddressPlaceBase.ts +31 -31
  117. package/src/address/AddressRegion.ts +286 -286
  118. package/src/address/AddressState.ts +12 -12
  119. package/src/address/AddressUtils.ts +27 -27
  120. package/src/api/AuthApi.ts +194 -194
  121. package/src/api/BaseApi.ts +13 -13
  122. package/src/api/EntityApi.ts +181 -194
  123. package/src/api/dto/AntiforgeryRequestToken.ts +15 -15
  124. package/src/api/dto/ApiRefreshTokenDto.ts +16 -16
  125. package/src/api/dto/AuditLineDto.ts +27 -0
  126. package/src/api/dto/IdLabelDto.ts +3 -3
  127. package/src/api/dto/IdLabelPrimaryDto.ts +7 -7
  128. package/src/api/dto/InitCallDto.ts +12 -12
  129. package/src/api/dto/PinDto.ts +71 -0
  130. package/src/api/dto/ResultPayload.ts +6 -6
  131. package/src/api/rq/ApiRefreshTokenRQ.ts +8 -8
  132. package/src/api/rq/AuthRequest.ts +40 -40
  133. package/src/api/rq/GetLogInUrlRQ.ts +8 -8
  134. package/src/api/rq/LoginIdRQ.ts +12 -12
  135. package/src/api/rq/LoginRQ.ts +18 -18
  136. package/src/api/rq/MergeRQ.ts +13 -13
  137. package/src/api/rq/QueryPagingData.ts +16 -16
  138. package/src/api/rq/QueryRQ.ts +22 -22
  139. package/src/api/rq/RefreshTokenRQ.ts +4 -4
  140. package/src/api/rq/ResetPasswordRQ.ts +20 -20
  141. package/src/api/rq/SignoutRQ.ts +8 -8
  142. package/src/api/rq/StatusQueryRQ.ts +11 -11
  143. package/src/api/rq/SwitchOrgRQ.ts +8 -8
  144. package/src/api/rq/TokenRQ.ts +4 -4
  145. package/src/api/rq/UpdateModel.ts +12 -12
  146. package/src/api/rq/UpdateStatusRQ.ts +10 -10
  147. package/src/app/AppSettings.ts +27 -27
  148. package/src/app/UserRole.ts +44 -44
  149. package/src/bridges/FlutterHost.ts +92 -97
  150. package/src/bridges/IBridgeHost.ts +49 -51
  151. package/src/business/ApiService.ts +25 -25
  152. package/src/business/BusinessTax.ts +63 -63
  153. package/src/business/BusinessUtils.ts +75 -75
  154. package/src/business/CultureItem.ts +43 -43
  155. package/src/business/Currency.ts +11 -11
  156. package/src/business/DataPrivacy.ts +35 -35
  157. package/src/business/EntityStatus.ts +44 -44
  158. package/src/business/ProductUnit.ts +58 -58
  159. package/src/business/RepeatOption.ts +50 -50
  160. package/src/business/ShoppingCart.ts +696 -706
  161. package/src/custom/CustomField.ts +20 -20
  162. package/src/custom/CustomFieldData.ts +43 -43
  163. package/src/def/ListItem.ts +12 -12
  164. package/src/i18n/Culture.ts +60 -0
  165. package/src/i18n/en.json +244 -244
  166. package/src/i18n/zh-Hans.json +244 -244
  167. package/src/i18n/zh-Hant.json +244 -244
  168. package/src/index.ts +3 -4
  169. package/src/result/ActionResult.ts +19 -19
  170. package/src/result/ActionResultError.ts +30 -30
  171. package/src/result/InitCallResult.ts +21 -21
  172. package/src/state/Culture.ts +3 -3
  173. package/src/state/State.ts +5 -5
  174. package/src/state/User.ts +92 -92
  175. package/tsconfig.cjs.json +17 -17
  176. package/tsconfig.json +17 -17
  177. package/lib/cjs/i18n/CultureUtils.d.ts +0 -13
  178. package/lib/cjs/i18n/CultureUtils.js +0 -32
  179. package/lib/cjs/i18n/en.d.ts +0 -6
  180. package/lib/cjs/i18n/en.js +0 -12
  181. package/lib/cjs/i18n/zhHans.d.ts +0 -6
  182. package/lib/cjs/i18n/zhHans.js +0 -12
  183. package/lib/cjs/i18n/zhHant.d.ts +0 -6
  184. package/lib/cjs/i18n/zhHant.js +0 -12
  185. package/lib/mjs/i18n/CultureUtils.d.ts +0 -13
  186. package/lib/mjs/i18n/CultureUtils.js +0 -29
  187. package/lib/mjs/i18n/en.d.ts +0 -6
  188. package/lib/mjs/i18n/en.js +0 -8
  189. package/lib/mjs/i18n/zhHans.d.ts +0 -6
  190. package/lib/mjs/i18n/zhHans.js +0 -8
  191. package/lib/mjs/i18n/zhHant.d.ts +0 -6
  192. package/lib/mjs/i18n/zhHant.js +0 -8
  193. package/src/i18n/CultureUtils.ts +0 -36
  194. package/src/i18n/en.ts +0 -10
  195. package/src/i18n/zhHans.ts +0 -10
  196. package/src/i18n/zhHant.ts +0 -10
@@ -1,33 +1,33 @@
1
- import { IActionResult } from '@etsoo/shared';
1
+ import { IActionResult } from "@etsoo/shared";
2
2
 
3
3
  /**
4
4
  * Init call result data
5
5
  */
6
6
  export interface InitCallResultData {
7
- /**
8
- * Device id
9
- */
10
- deviceId?: string;
7
+ /**
8
+ * Device id
9
+ */
10
+ deviceId?: string;
11
11
 
12
- /**
13
- * Secret passphrase
14
- */
15
- passphrase?: string;
12
+ /**
13
+ * Secret passphrase
14
+ */
15
+ passphrase?: string;
16
16
 
17
- /**
18
- * Previous secret passphrase
19
- */
20
- previousPassphrase?: string;
17
+ /**
18
+ * Previous secret passphrase
19
+ */
20
+ previousPassphrase?: string;
21
21
 
22
- /**
23
- * Actual seconds gap
24
- */
25
- seconds?: number;
22
+ /**
23
+ * Actual seconds gap
24
+ */
25
+ seconds?: number;
26
26
 
27
- /**
28
- * Valid seconds gap
29
- */
30
- validSeconds?: number;
27
+ /**
28
+ * Valid seconds gap
29
+ */
30
+ validSeconds?: number;
31
31
  }
32
32
 
33
33
  /**
@@ -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
  /**
5
5
  * Culture resources state, simple i18n solution
@@ -12,5 +12,5 @@ export interface ICulture extends DataTypes.CultureDefinition, IState {}
12
12
  * Culture get delegate
13
13
  */
14
14
  export interface ICultureGet {
15
- (key: string): string | undefined;
15
+ (key: string): string | undefined;
16
16
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * State data interface
3
3
  */
4
- export interface IState {}
4
+ export interface IState {}
5
5
 
6
- /**
7
- * State action interface
8
- */
9
- export interface IAction {}
6
+ /**
7
+ * State action interface
8
+ */
9
+ export interface IAction {}
package/src/state/User.ts CHANGED
@@ -1,91 +1,91 @@
1
- import { IState } from './State';
1
+ import { IState } from "./State";
2
2
 
3
3
  /**
4
4
  * User data interface
5
5
  */
6
6
  export interface IUserData {
7
- /**
8
- * Serverside device id encrypted, not the same device id of the app
9
- */
10
- readonly deviceId?: string;
11
-
12
- /**
13
- * User name
14
- * 用户姓名
15
- */
16
- readonly name: string;
17
-
18
- /**
19
- * Given name
20
- * 名
21
- */
22
- readonly givenName?: string;
23
-
24
- /**
25
- * Family name
26
- * 姓
27
- */
28
- readonly familyName?: string;
29
-
30
- /**
31
- * Latin given name
32
- * 拉丁名(拼音)
33
- */
34
- readonly latinGivenName?: string;
35
-
36
- /**
37
- * Latin family name
38
- * 拉丁姓(拼音)
39
- */
40
- readonly latinFamilyName?: string;
41
-
42
- /**
43
- * User avatar
44
- * 用户头像
45
- */
46
- readonly avatar?: string;
47
-
48
- /**
49
- * Organization id
50
- * 机构编号
51
- */
52
- readonly organization?: number;
53
-
54
- /**
55
- * Is from the channel organization
56
- * 是否来自渠道机构
57
- */
58
- readonly isChannel?: boolean;
59
-
60
- /**
61
- * Is from the parent organization
62
- * 是否来自父级机构
63
- */
64
- readonly isParent?: boolean;
65
-
66
- /**
67
- * User role value
68
- * 用户角色值
69
- */
70
- readonly role: number;
71
-
72
- /**
73
- * Refresh seconds
74
- * 刷新间隔秒数
75
- */
76
- readonly seconds: number;
77
-
78
- /**
79
- * Access token
80
- * 访问令牌
81
- */
82
- readonly token: string;
83
-
84
- /**
85
- * Access token scheme
86
- * 访问令牌方案
87
- */
88
- readonly tokenScheme?: string;
7
+ /**
8
+ * Serverside device id encrypted, not the same device id of the app
9
+ */
10
+ readonly deviceId?: string;
11
+
12
+ /**
13
+ * User name
14
+ * 用户姓名
15
+ */
16
+ readonly name: string;
17
+
18
+ /**
19
+ * Given name
20
+ * 名
21
+ */
22
+ readonly givenName?: string;
23
+
24
+ /**
25
+ * Family name
26
+ * 姓
27
+ */
28
+ readonly familyName?: string;
29
+
30
+ /**
31
+ * Latin given name
32
+ * 拉丁名(拼音)
33
+ */
34
+ readonly latinGivenName?: string;
35
+
36
+ /**
37
+ * Latin family name
38
+ * 拉丁姓(拼音)
39
+ */
40
+ readonly latinFamilyName?: string;
41
+
42
+ /**
43
+ * User avatar
44
+ * 用户头像
45
+ */
46
+ readonly avatar?: string;
47
+
48
+ /**
49
+ * Organization id
50
+ * 机构编号
51
+ */
52
+ readonly organization?: number;
53
+
54
+ /**
55
+ * Is from the channel organization
56
+ * 是否来自渠道机构
57
+ */
58
+ readonly isChannel?: boolean;
59
+
60
+ /**
61
+ * Is from the parent organization
62
+ * 是否来自父级机构
63
+ */
64
+ readonly isParent?: boolean;
65
+
66
+ /**
67
+ * User role value
68
+ * 用户角色值
69
+ */
70
+ readonly role: number;
71
+
72
+ /**
73
+ * Refresh seconds
74
+ * 刷新间隔秒数
75
+ */
76
+ readonly seconds: number;
77
+
78
+ /**
79
+ * Access token
80
+ * 访问令牌
81
+ */
82
+ readonly token: string;
83
+
84
+ /**
85
+ * Access token scheme
86
+ * 访问令牌方案
87
+ */
88
+ readonly tokenScheme?: string;
89
89
  }
90
90
 
91
91
  /**
@@ -97,13 +97,13 @@ export type UserKey = keyof IUserData;
97
97
  * User interface
98
98
  */
99
99
  export interface IUser extends IUserData, IState {
100
- /**
101
- * Authorized or not
102
- */
103
- authorized: boolean;
104
-
105
- /**
106
- * Last update changed fields
107
- */
108
- lastChangedFields?: UserKey[];
100
+ /**
101
+ * Authorized or not
102
+ */
103
+ authorized: boolean;
104
+
105
+ /**
106
+ * Last update changed fields
107
+ */
108
+ lastChangedFields?: UserKey[];
109
109
  }
package/tsconfig.cjs.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
- "target": "ES2020",
5
- "allowJs": false,
6
- "module": "NodeNext",
7
- "moduleResolution": "NodeNext",
8
- "resolveJsonModule": true,
9
- "isolatedModules": true,
10
- "outDir": "./lib/cjs",
11
- "noEmit": false,
12
- "declaration": true,
13
- "strict": true,
14
- "esModuleInterop": true,
15
- "skipLibCheck": true,
16
- "forceConsistentCasingInFileNames": true
17
- },
18
- "include": ["src"]
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+ "target": "ES2020",
5
+ "allowJs": false,
6
+ "module": "NodeNext",
7
+ "moduleResolution": "NodeNext",
8
+ "resolveJsonModule": true,
9
+ "isolatedModules": true,
10
+ "outDir": "./lib/cjs",
11
+ "noEmit": false,
12
+ "declaration": true,
13
+ "strict": true,
14
+ "esModuleInterop": true,
15
+ "skipLibCheck": true,
16
+ "forceConsistentCasingInFileNames": true
17
+ },
18
+ "include": ["src"]
19
19
  }
package/tsconfig.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
- "target": "ES2020",
5
- "allowJs": false,
6
- "module": "ESNext",
7
- "moduleResolution": "Node10",
8
- "resolveJsonModule": true,
9
- "isolatedModules": true,
10
- "outDir": "./lib/mjs",
11
- "noEmit": false,
12
- "declaration": true,
13
- "strict": true,
14
- "esModuleInterop": true,
15
- "skipLibCheck": true,
16
- "forceConsistentCasingInFileNames": true
17
- },
18
- "include": ["src"]
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+ "target": "ES2020",
5
+ "allowJs": false,
6
+ "module": "ESNext",
7
+ "moduleResolution": "Node10",
8
+ "resolveJsonModule": true,
9
+ "isolatedModules": true,
10
+ "outDir": "./lib/mjs",
11
+ "noEmit": false,
12
+ "declaration": true,
13
+ "strict": true,
14
+ "esModuleInterop": true,
15
+ "skipLibCheck": true,
16
+ "forceConsistentCasingInFileNames": true
17
+ },
18
+ "include": ["src"]
19
19
  }
@@ -1,13 +0,0 @@
1
- import { DataTypes, DomUtils } from '@etsoo/shared';
2
- /**
3
- * Culture utilities
4
- */
5
- export declare namespace CultureUtils {
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
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CultureUtils = void 0;
4
- /**
5
- * Culture utilities
6
- */
7
- var CultureUtils;
8
- (function (CultureUtils) {
9
- /**
10
- * Make culture
11
- * @param cultureMaker Culture maker
12
- * @param resources Resources
13
- * @returns Culture
14
- */
15
- function make(cultureMaker, ...resources) {
16
- return cultureMaker(async () => {
17
- const rs = await Promise.all(resources.map((resource) => new Promise((resolve) => {
18
- if (typeof resource === 'object') {
19
- resolve(resource);
20
- }
21
- else {
22
- resource().then((result) => resolve(result));
23
- }
24
- })));
25
- return rs.reduce((prev, curr) => ({
26
- ...prev,
27
- ...curr
28
- }));
29
- });
30
- }
31
- CultureUtils.make = make;
32
- })(CultureUtils || (exports.CultureUtils = CultureUtils = {}));
@@ -1,6 +0,0 @@
1
- /**
2
- * Get en neutral culture
3
- * @param localResources Local resources
4
- * @returns Full culture
5
- */
6
- export declare const en: (...resources: (object | (() => Promise<object>))[]) => import("@etsoo/shared").DataTypes.CultureDefinition<import("@etsoo/shared").DataTypes.StringRecord>;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.en = void 0;
4
- const shared_1 = require("@etsoo/shared");
5
- const CultureUtils_1 = require("./CultureUtils");
6
- /**
7
- * Get en neutral culture
8
- * @param localResources Local resources
9
- * @returns Full culture
10
- */
11
- const en = (...resources) => CultureUtils_1.CultureUtils.make(shared_1.DomUtils.en, import('./en.json'), ...resources);
12
- exports.en = en;
@@ -1,6 +0,0 @@
1
- /**
2
- * Get zh-Hans neutral cultrue
3
- * @param localResources Local resources
4
- * @returns Full culture
5
- */
6
- export declare const zhHans: (...resources: (object | (() => Promise<object>))[]) => import("@etsoo/shared").DataTypes.CultureDefinition<import("@etsoo/shared").DataTypes.StringRecord>;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zhHans = void 0;
4
- const shared_1 = require("@etsoo/shared");
5
- const CultureUtils_1 = require("./CultureUtils");
6
- /**
7
- * Get zh-Hans neutral cultrue
8
- * @param localResources Local resources
9
- * @returns Full culture
10
- */
11
- const zhHans = (...resources) => CultureUtils_1.CultureUtils.make(shared_1.DomUtils.zhHans, import('./zh-Hans.json'), ...resources);
12
- exports.zhHans = zhHans;
@@ -1,6 +0,0 @@
1
- /**
2
- * Get zh-Hant neutral cultrue
3
- * @param localResources Local resources
4
- * @returns Full culture
5
- */
6
- export declare const zhHant: (...resources: (object | (() => Promise<object>))[]) => import("@etsoo/shared").DataTypes.CultureDefinition<import("@etsoo/shared").DataTypes.StringRecord>;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zhHant = void 0;
4
- const shared_1 = require("@etsoo/shared");
5
- const CultureUtils_1 = require("./CultureUtils");
6
- /**
7
- * Get zh-Hant neutral cultrue
8
- * @param localResources Local resources
9
- * @returns Full culture
10
- */
11
- const zhHant = (...resources) => CultureUtils_1.CultureUtils.make(shared_1.DomUtils.zhHant, import('./zh-Hant.json'), ...resources);
12
- exports.zhHant = zhHant;
@@ -1,13 +0,0 @@
1
- import { DataTypes, DomUtils } from '@etsoo/shared';
2
- /**
3
- * Culture utilities
4
- */
5
- export declare namespace CultureUtils {
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
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Culture utilities
3
- */
4
- export var CultureUtils;
5
- (function (CultureUtils) {
6
- /**
7
- * Make culture
8
- * @param cultureMaker Culture maker
9
- * @param resources Resources
10
- * @returns Culture
11
- */
12
- function make(cultureMaker, ...resources) {
13
- return cultureMaker(async () => {
14
- const rs = await Promise.all(resources.map((resource) => new Promise((resolve) => {
15
- if (typeof resource === 'object') {
16
- resolve(resource);
17
- }
18
- else {
19
- resource().then((result) => resolve(result));
20
- }
21
- })));
22
- return rs.reduce((prev, curr) => ({
23
- ...prev,
24
- ...curr
25
- }));
26
- });
27
- }
28
- CultureUtils.make = make;
29
- })(CultureUtils || (CultureUtils = {}));
@@ -1,6 +0,0 @@
1
- /**
2
- * Get en neutral culture
3
- * @param localResources Local resources
4
- * @returns Full culture
5
- */
6
- export declare const en: (...resources: (object | (() => Promise<object>))[]) => import("@etsoo/shared").DataTypes.CultureDefinition<import("@etsoo/shared").DataTypes.StringRecord>;
@@ -1,8 +0,0 @@
1
- import { DomUtils } from '@etsoo/shared';
2
- import { CultureUtils } from './CultureUtils';
3
- /**
4
- * Get en neutral culture
5
- * @param localResources Local resources
6
- * @returns Full culture
7
- */
8
- export const en = (...resources) => CultureUtils.make(DomUtils.en, import('./en.json'), ...resources);
@@ -1,6 +0,0 @@
1
- /**
2
- * Get zh-Hans neutral cultrue
3
- * @param localResources Local resources
4
- * @returns Full culture
5
- */
6
- export declare const zhHans: (...resources: (object | (() => Promise<object>))[]) => import("@etsoo/shared").DataTypes.CultureDefinition<import("@etsoo/shared").DataTypes.StringRecord>;
@@ -1,8 +0,0 @@
1
- import { DomUtils } from '@etsoo/shared';
2
- import { CultureUtils } from './CultureUtils';
3
- /**
4
- * Get zh-Hans neutral cultrue
5
- * @param localResources Local resources
6
- * @returns Full culture
7
- */
8
- export const zhHans = (...resources) => CultureUtils.make(DomUtils.zhHans, import('./zh-Hans.json'), ...resources);
@@ -1,6 +0,0 @@
1
- /**
2
- * Get zh-Hant neutral cultrue
3
- * @param localResources Local resources
4
- * @returns Full culture
5
- */
6
- export declare const zhHant: (...resources: (object | (() => Promise<object>))[]) => import("@etsoo/shared").DataTypes.CultureDefinition<import("@etsoo/shared").DataTypes.StringRecord>;
@@ -1,8 +0,0 @@
1
- import { DomUtils } from '@etsoo/shared';
2
- import { CultureUtils } from './CultureUtils';
3
- /**
4
- * Get zh-Hant neutral cultrue
5
- * @param localResources Local resources
6
- * @returns Full culture
7
- */
8
- export const zhHant = (...resources) => CultureUtils.make(DomUtils.zhHant, import('./zh-Hant.json'), ...resources);
@@ -1,36 +0,0 @@
1
- import { DataTypes, DomUtils } from '@etsoo/shared';
2
-
3
- /**
4
- * Culture utilities
5
- */
6
- export namespace CultureUtils {
7
- /**
8
- * Make culture
9
- * @param cultureMaker Culture maker
10
- * @param resources Resources
11
- * @returns Culture
12
- */
13
- export function make(
14
- cultureMaker: typeof DomUtils.zhHans,
15
- ...resources: (object | (() => Promise<object>))[]
16
- ) {
17
- return cultureMaker(async () => {
18
- const rs = await Promise.all(
19
- resources.map(
20
- (resource) =>
21
- new Promise<object>((resolve) => {
22
- if (typeof resource === 'object') {
23
- resolve(resource);
24
- } else {
25
- resource().then((result) => resolve(result));
26
- }
27
- })
28
- )
29
- );
30
- return rs.reduce((prev, curr) => ({
31
- ...prev,
32
- ...curr
33
- })) as DataTypes.StringRecord;
34
- });
35
- }
36
- }
package/src/i18n/en.ts DELETED
@@ -1,10 +0,0 @@
1
- import { DomUtils } from '@etsoo/shared';
2
- import { CultureUtils } from './CultureUtils';
3
-
4
- /**
5
- * Get en neutral culture
6
- * @param localResources Local resources
7
- * @returns Full culture
8
- */
9
- export const en = (...resources: (object | (() => Promise<object>))[]) =>
10
- CultureUtils.make(DomUtils.en, import('./en.json'), ...resources);
@@ -1,10 +0,0 @@
1
- import { DomUtils } from '@etsoo/shared';
2
- import { CultureUtils } from './CultureUtils';
3
-
4
- /**
5
- * Get zh-Hans neutral cultrue
6
- * @param localResources Local resources
7
- * @returns Full culture
8
- */
9
- export const zhHans = (...resources: (object | (() => Promise<object>))[]) =>
10
- CultureUtils.make(DomUtils.zhHans, import('./zh-Hans.json'), ...resources);
@@ -1,10 +0,0 @@
1
- import { DomUtils } from '@etsoo/shared';
2
- import { CultureUtils } from './CultureUtils';
3
-
4
- /**
5
- * Get zh-Hant neutral cultrue
6
- * @param localResources Local resources
7
- * @returns Full culture
8
- */
9
- export const zhHant = (...resources: (object | (() => Promise<object>))[]) =>
10
- CultureUtils.make(DomUtils.zhHant, import('./zh-Hant.json'), ...resources);