@etsoo/appscript 1.6.59 → 1.6.60

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.
@@ -6,6 +6,92 @@ const AddressContinent_1 = require("./AddressContinent");
6
6
  * Address or region
7
7
  */
8
8
  class AddressRegion {
9
+ id;
10
+ id3;
11
+ nid;
12
+ continent;
13
+ exitCode;
14
+ idd;
15
+ nationalPrefix;
16
+ currency;
17
+ languages;
18
+ label;
19
+ /**
20
+ * CN - China
21
+ */
22
+ static CN = new AddressRegion("CN", "CHN", "156", AddressContinent_1.AddressContinent.AS, "00", "+86", "0", "CNY", ["zh-Hans-CN", "zh-CN"]);
23
+ /**
24
+ * HK - HK, China
25
+ * 中国香港
26
+ */
27
+ static HK = new AddressRegion("HK", "HKG", "344", AddressContinent_1.AddressContinent.AS, "001", "+852", undefined, "HKD", ["zh-Hant-HK", "zh-HK", "en-HK"]);
28
+ /**
29
+ * SG - Singapore
30
+ * 新加坡
31
+ */
32
+ static SG = new AddressRegion("SG", "SGP", "702", AddressContinent_1.AddressContinent.AS, "000", "+65", undefined, "SGD", ["zh-Hans-SG", "zh-SG", "en-SG"]);
33
+ /**
34
+ * JP - Japan
35
+ * 日本
36
+ */
37
+ static JP = new AddressRegion("JP", "JPN", "392", AddressContinent_1.AddressContinent.AS, "010", "+81", "0", "JPY", ["ja-JP"]);
38
+ /**
39
+ * US - United States
40
+ * 美国
41
+ */
42
+ static US = new AddressRegion("US", "USA", "840", AddressContinent_1.AddressContinent.NA, "011", "+1", "1", "USD", ["en-US"]);
43
+ /**
44
+ * CA - Canada
45
+ * 加拿大
46
+ */
47
+ static CA = new AddressRegion("CA", "CAN", "124", AddressContinent_1.AddressContinent.NA, "011", "+1", "1", "CAD", ["en-CA", "fr-CA"]);
48
+ /**
49
+ * AU - Australia
50
+ * 澳大利亚
51
+ */
52
+ static AU = new AddressRegion("AU", "AUS", "036", AddressContinent_1.AddressContinent.OC, "0011", "+61", "0", "AUD", ["en-AU"]);
53
+ /**
54
+ * NZ - New Zealand
55
+ * 新西兰
56
+ */
57
+ static NZ = new AddressRegion("NZ", "NZL", "554", AddressContinent_1.AddressContinent.OC, "00", "+64", "0", "NZD", ["en-NZ", "mi-NZ"]);
58
+ /**
59
+ * GB - Great Britain
60
+ * 英国
61
+ */
62
+ static GB = new AddressRegion("GB", "GBR", "826", AddressContinent_1.AddressContinent.EU, "00", "+44", "0", "GBP", ["en-GB"]);
63
+ /**
64
+ * IE - Ireland
65
+ * 爱尔兰
66
+ */
67
+ static IE = new AddressRegion("IE", "IRL", "372", AddressContinent_1.AddressContinent.EU, "00", "+353", "0", "EUR", ["en-IE"]);
68
+ /**
69
+ * DE - Germany
70
+ * 德国
71
+ */
72
+ static DE = new AddressRegion("DE", "DEU", "276", AddressContinent_1.AddressContinent.EU, "00", "+49", "0", "EUR", ["de-DE"]);
73
+ /**
74
+ * FR - France
75
+ * 法国
76
+ */
77
+ static FR = new AddressRegion("FR", "FRA", "250", AddressContinent_1.AddressContinent.EU, "00", "+33", "0", "EUR", ["fr-FR"]);
78
+ /**
79
+ * All countries and regions
80
+ */
81
+ static all = [
82
+ AddressRegion.CN,
83
+ AddressRegion.HK,
84
+ AddressRegion.SG,
85
+ AddressRegion.JP,
86
+ AddressRegion.US,
87
+ AddressRegion.CA,
88
+ AddressRegion.AU,
89
+ AddressRegion.NZ,
90
+ AddressRegion.GB,
91
+ AddressRegion.IE,
92
+ AddressRegion.DE,
93
+ AddressRegion.FR
94
+ ];
9
95
  /**
10
96
  * Get country or region by id
11
97
  * @param id Country id
@@ -13,6 +99,11 @@ class AddressRegion {
13
99
  static getById(id) {
14
100
  return AddressRegion.all.find((c) => c.id === id);
15
101
  }
102
+ /**
103
+ * Continent id
104
+ * 洲编号
105
+ */
106
+ continentId;
16
107
  // Typescript constructor shorthand
17
108
  constructor(id, id3, nid, continent, exitCode, idd, nationalPrefix, currency, languages, label = id) {
18
109
  this.id = id;
@@ -29,79 +120,3 @@ class AddressRegion {
29
120
  }
30
121
  }
31
122
  exports.AddressRegion = AddressRegion;
32
- /**
33
- * CN - China
34
- */
35
- AddressRegion.CN = new AddressRegion("CN", "CHN", "156", AddressContinent_1.AddressContinent.AS, "00", "+86", "0", "CNY", ["zh-Hans-CN", "zh-CN"]);
36
- /**
37
- * HK - HK, China
38
- * 中国香港
39
- */
40
- AddressRegion.HK = new AddressRegion("HK", "HKG", "344", AddressContinent_1.AddressContinent.AS, "001", "+852", undefined, "HKD", ["zh-Hant-HK", "zh-HK", "en-HK"]);
41
- /**
42
- * SG - Singapore
43
- * 新加坡
44
- */
45
- AddressRegion.SG = new AddressRegion("SG", "SGP", "702", AddressContinent_1.AddressContinent.AS, "000", "+65", undefined, "SGD", ["zh-Hans-SG", "zh-SG", "en-SG"]);
46
- /**
47
- * JP - Japan
48
- * 日本
49
- */
50
- AddressRegion.JP = new AddressRegion("JP", "JPN", "392", AddressContinent_1.AddressContinent.AS, "010", "+81", "0", "JPY", ["ja-JP"]);
51
- /**
52
- * US - United States
53
- * 美国
54
- */
55
- AddressRegion.US = new AddressRegion("US", "USA", "840", AddressContinent_1.AddressContinent.NA, "011", "+1", "1", "USD", ["en-US"]);
56
- /**
57
- * CA - Canada
58
- * 加拿大
59
- */
60
- AddressRegion.CA = new AddressRegion("CA", "CAN", "124", AddressContinent_1.AddressContinent.NA, "011", "+1", "1", "CAD", ["en-CA", "fr-CA"]);
61
- /**
62
- * AU - Australia
63
- * 澳大利亚
64
- */
65
- AddressRegion.AU = new AddressRegion("AU", "AUS", "036", AddressContinent_1.AddressContinent.OC, "0011", "+61", "0", "AUD", ["en-AU"]);
66
- /**
67
- * NZ - New Zealand
68
- * 新西兰
69
- */
70
- AddressRegion.NZ = new AddressRegion("NZ", "NZL", "554", AddressContinent_1.AddressContinent.OC, "00", "+64", "0", "NZD", ["en-NZ", "mi-NZ"]);
71
- /**
72
- * GB - Great Britain
73
- * 英国
74
- */
75
- AddressRegion.GB = new AddressRegion("GB", "GBR", "826", AddressContinent_1.AddressContinent.EU, "00", "+44", "0", "GBP", ["en-GB"]);
76
- /**
77
- * IE - Ireland
78
- * 爱尔兰
79
- */
80
- AddressRegion.IE = new AddressRegion("IE", "IRL", "372", AddressContinent_1.AddressContinent.EU, "00", "+353", "0", "EUR", ["en-IE"]);
81
- /**
82
- * DE - Germany
83
- * 德国
84
- */
85
- AddressRegion.DE = new AddressRegion("DE", "DEU", "276", AddressContinent_1.AddressContinent.EU, "00", "+49", "0", "EUR", ["de-DE"]);
86
- /**
87
- * FR - France
88
- * 法国
89
- */
90
- AddressRegion.FR = new AddressRegion("FR", "FRA", "250", AddressContinent_1.AddressContinent.EU, "00", "+33", "0", "EUR", ["fr-FR"]);
91
- /**
92
- * All countries and regions
93
- */
94
- AddressRegion.all = [
95
- AddressRegion.CN,
96
- AddressRegion.HK,
97
- AddressRegion.SG,
98
- AddressRegion.JP,
99
- AddressRegion.US,
100
- AddressRegion.CA,
101
- AddressRegion.AU,
102
- AddressRegion.NZ,
103
- AddressRegion.GB,
104
- AddressRegion.IE,
105
- AddressRegion.DE,
106
- AddressRegion.FR
107
- ];
@@ -7,6 +7,10 @@ const shared_1 = require("@etsoo/shared");
7
7
  * Authentication API
8
8
  */
9
9
  class AuthApi extends BaseApi_1.BaseApi {
10
+ /**
11
+ * Header token field name
12
+ */
13
+ static HeaderTokenField = "Etsoo-Refresh-Token";
10
14
  /**
11
15
  * Admin support
12
16
  * @param rq Request data
@@ -113,8 +117,8 @@ class AuthApi extends BaseApi_1.BaseApi {
113
117
  */
114
118
  async login(rq, payload, tokenKey) {
115
119
  // Default values
116
- payload ?? (payload = {});
117
- tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
120
+ payload ??= {};
121
+ tokenKey ??= AuthApi.HeaderTokenField;
118
122
  const data = {
119
123
  ...rq,
120
124
  deviceId: this.app.deviceId,
@@ -228,8 +232,8 @@ class AuthApi extends BaseApi_1.BaseApi {
228
232
  */
229
233
  async switchOrg(rq, payload, tokenKey) {
230
234
  // Default values
231
- payload ?? (payload = {});
232
- tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
235
+ payload ??= {};
236
+ tokenKey ??= AuthApi.HeaderTokenField;
233
237
  // Call the API
234
238
  const result = await this.api.put("Auth/SwitchOrg", rq, payload);
235
239
  // Get the refresh token
@@ -241,7 +245,3 @@ class AuthApi extends BaseApi_1.BaseApi {
241
245
  }
242
246
  }
243
247
  exports.AuthApi = AuthApi;
244
- /**
245
- * Header token field name
246
- */
247
- AuthApi.HeaderTokenField = "Etsoo-Refresh-Token";
@@ -5,6 +5,8 @@ exports.BaseApi = void 0;
5
5
  * SmartERP base API
6
6
  */
7
7
  class BaseApi {
8
+ app;
9
+ api;
8
10
  /**
9
11
  * API Last error
10
12
  */
@@ -8,6 +8,7 @@ const BusinessUtils_1 = require("../business/BusinessUtils");
8
8
  * Follow com.etsoo.CoreFramework.Services.EntityServiceBase
9
9
  */
10
10
  class EntityApi extends BaseApi_1.BaseApi {
11
+ flag;
11
12
  /**
12
13
  * Constructor
13
14
  * @param flag Identity flag, like 'Product' for product APIs
@@ -65,7 +66,7 @@ class EntityApi extends BaseApi_1.BaseApi {
65
66
  * @returns Result
66
67
  */
67
68
  async queryFavoredCountryIdsBase(api) {
68
- api ?? (api = `${this.flag}/QueryFavoredCountryIds`);
69
+ api ??= `${this.flag}/QueryFavoredCountryIds`;
69
70
  const result = await this.api.get(api, undefined, {
70
71
  showLoading: false
71
72
  });
@@ -21,24 +21,64 @@ const systemApi = "system";
21
21
  * Core application
22
22
  */
23
23
  class CoreApp {
24
+ /**
25
+ * Settings
26
+ */
27
+ settings;
28
+ /**
29
+ * Default region
30
+ */
31
+ defaultRegion;
32
+ /**
33
+ * Fields
34
+ */
35
+ fields;
36
+ /**
37
+ * API, not recommend to use it directly in code, wrap to separate methods
38
+ */
39
+ api;
40
+ /**
41
+ * Application name
42
+ */
43
+ name;
44
+ /**
45
+ * Notifier
46
+ */
47
+ notifier;
48
+ /**
49
+ * Storage
50
+ */
51
+ storage;
52
+ /**
53
+ * Pending actions
54
+ */
55
+ pendings = [];
56
+ /**
57
+ * Debug mode
58
+ */
59
+ debug;
60
+ _culture;
24
61
  /**
25
62
  * Culture, like zh-CN
26
63
  */
27
64
  get culture() {
28
65
  return this._culture;
29
66
  }
67
+ _currency;
30
68
  /**
31
69
  * Currency, like USD for US dollar
32
70
  */
33
71
  get currency() {
34
72
  return this._currency;
35
73
  }
74
+ _region;
36
75
  /**
37
76
  * Country or region, like CN
38
77
  */
39
78
  get region() {
40
79
  return this._region;
41
80
  }
81
+ _deviceId;
42
82
  /**
43
83
  * Device id, randome string from ServiceBase.InitCallAsync
44
84
  */
@@ -55,6 +95,7 @@ class CoreApp {
55
95
  get labelDelegate() {
56
96
  return this.get.bind(this);
57
97
  }
98
+ _ipData;
58
99
  /**
59
100
  * IP data
60
101
  */
@@ -64,6 +105,7 @@ class CoreApp {
64
105
  set ipData(value) {
65
106
  this._ipData = value;
66
107
  }
108
+ _userData;
67
109
  /**
68
110
  * User data
69
111
  */
@@ -73,6 +115,13 @@ class CoreApp {
73
115
  set userData(value) {
74
116
  this._userData = value;
75
117
  }
118
+ // IP detect ready callbacks
119
+ ipDetectCallbacks;
120
+ /**
121
+ * Search input element
122
+ */
123
+ searchInput;
124
+ _authorized = false;
76
125
  /**
77
126
  * Is current authorized
78
127
  */
@@ -82,6 +131,7 @@ class CoreApp {
82
131
  set authorized(value) {
83
132
  this._authorized = value;
84
133
  }
134
+ _isReady = false;
85
135
  /**
86
136
  * Is the app ready
87
137
  */
@@ -119,12 +169,14 @@ class CoreApp {
119
169
  }
120
170
  this.storage.setData(this.fields.keepLogin, value);
121
171
  }
172
+ _embedded;
122
173
  /**
123
174
  * Is embedded
124
175
  */
125
176
  get embedded() {
126
177
  return this._embedded;
127
178
  }
179
+ _isTryingLogin = false;
128
180
  /**
129
181
  * Is trying login
130
182
  */
@@ -140,6 +192,25 @@ class CoreApp {
140
192
  get coreName() {
141
193
  return "core";
142
194
  }
195
+ /**
196
+ * Last called with token refresh
197
+ */
198
+ lastCalled = false;
199
+ /**
200
+ * Init call Api URL
201
+ */
202
+ initCallApi = "Auth/WebInitCall";
203
+ /**
204
+ * Passphrase for encryption
205
+ */
206
+ passphrase = "";
207
+ apis = {};
208
+ tasks = [];
209
+ clearInterval;
210
+ /**
211
+ * Get persisted fields
212
+ */
213
+ persistedFields;
143
214
  /**
144
215
  * Protected constructor
145
216
  * @param settings Settings
@@ -150,27 +221,6 @@ class CoreApp {
150
221
  * @param debug Debug mode
151
222
  */
152
223
  constructor(settings, api, notifier, storage, name, debug = false) {
153
- /**
154
- * Pending actions
155
- */
156
- this.pendings = [];
157
- this._authorized = false;
158
- this._isReady = false;
159
- this._isTryingLogin = false;
160
- /**
161
- * Last called with token refresh
162
- */
163
- this.lastCalled = false;
164
- /**
165
- * Init call Api URL
166
- */
167
- this.initCallApi = "Auth/WebInitCall";
168
- /**
169
- * Passphrase for encryption
170
- */
171
- this.passphrase = "";
172
- this.apis = {};
173
- this.tasks = [];
174
224
  // Format settings
175
225
  this.settings = this.formatSettings(settings);
176
226
  // Current region
@@ -459,7 +509,7 @@ class CoreApp {
459
509
  // Global API error handler
460
510
  this.setApiErrorHandler(api);
461
511
  // Setup API countdown
462
- refresh ?? (refresh = this.apiRefreshToken.bind(this));
512
+ refresh ??= this.apiRefreshToken.bind(this);
463
513
  this.apis[api.name] = [api, -1, -1, refresh];
464
514
  }
465
515
  /**
@@ -541,7 +591,7 @@ class CoreApp {
541
591
  * @param preventDefault Is prevent default action
542
592
  */
543
593
  setupLogging(action, preventDefault) {
544
- action ?? (action = (data) => {
594
+ action ??= (data) => {
545
595
  this.api.post("Auth/LogFrontendError", data, {
546
596
  onError: (error) => {
547
597
  // Use 'debug' to avoid infinite loop
@@ -550,7 +600,7 @@ class CoreApp {
550
600
  return false;
551
601
  }
552
602
  });
553
- });
603
+ };
554
604
  shared_1.DomUtils.setupLogging(action, preventDefault);
555
605
  }
556
606
  /**
@@ -740,7 +790,7 @@ class CoreApp {
740
790
  // State, when token is null, means logout
741
791
  const authorized = token != null;
742
792
  // Token
743
- schema ?? (schema = "Bearer");
793
+ schema ??= "Bearer";
744
794
  this.api.authorize(schema, token);
745
795
  // Overwrite the current value
746
796
  if (refreshToken !== "") {
@@ -1021,7 +1071,7 @@ class CoreApp {
1021
1071
  */
1022
1072
  encrypt(message, passphrase, iterations) {
1023
1073
  // Default 1 * 1000
1024
- iterations ?? (iterations = 1);
1074
+ iterations ??= 1;
1025
1075
  const { lib, PBKDF2, algo, enc, AES, pad, mode } = CJ;
1026
1076
  const bits = 16; // 128 / 8
1027
1077
  const salt = lib.WordArray.random(bits);
@@ -1086,7 +1136,7 @@ class CoreApp {
1086
1136
  */
1087
1137
  formatDate(input, options, timeZone) {
1088
1138
  const { currentCulture } = this.settings;
1089
- timeZone ?? (timeZone = this.getTimeZone());
1139
+ timeZone ??= this.getTimeZone();
1090
1140
  return shared_1.DateUtils.format(input, currentCulture.name, options, timeZone);
1091
1141
  }
1092
1142
  /**
@@ -1310,7 +1360,7 @@ class CoreApp {
1310
1360
  getRoleLabel(role, joinChar) {
1311
1361
  if (role == null)
1312
1362
  return "";
1313
- joinChar ?? (joinChar = ", ");
1363
+ joinChar ??= ", ";
1314
1364
  const roles = this.getRoles(role);
1315
1365
  return roles.map((r) => r.label).join(joinChar);
1316
1366
  }
@@ -1511,7 +1561,7 @@ class CoreApp {
1511
1561
  * @param message Success message
1512
1562
  */
1513
1563
  ok(callback, message) {
1514
- message ?? (message = this.get("operationSucceeded"));
1564
+ message ??= this.get("operationSucceeded");
1515
1565
  this.notifier.succeed(message, undefined, callback);
1516
1566
  }
1517
1567
  /**
@@ -1528,8 +1578,8 @@ class CoreApp {
1528
1578
  */
1529
1579
  async refreshToken(props, callback) {
1530
1580
  // Check props
1531
- props ?? (props = {});
1532
- props.token ?? (props.token = this.getCacheToken());
1581
+ props ??= {};
1582
+ props.token ??= this.getCacheToken();
1533
1583
  // Call refresh token API
1534
1584
  let data = await this.createAuthApi().refreshToken(props);
1535
1585
  let r;
@@ -1679,7 +1729,7 @@ class CoreApp {
1679
1729
  */
1680
1730
  async apiRefreshTokenData(api, rq) {
1681
1731
  // Default appId
1682
- rq.appId ?? (rq.appId = this.settings.appId);
1732
+ rq.appId ??= this.settings.appId;
1683
1733
  // Call the API quietly, no loading bar and no error popup
1684
1734
  return this.createAuthApi(api).apiRefreshToken(rq, {
1685
1735
  showLoading: false,
@@ -1885,6 +1935,7 @@ class CoreApp {
1885
1935
  userUnauthorized() {
1886
1936
  this.authorize(undefined, undefined);
1887
1937
  }
1938
+ lastWarning;
1888
1939
  /**
1889
1940
  * Show warning message
1890
1941
  * @param message Message
@@ -17,7 +17,7 @@ var ExternalSettings;
17
17
  */
18
18
  function create(settings, hostname) {
19
19
  // Default settings reading from globalThis
20
- settings ?? (settings = Reflect.get(globalThis, "settings"));
20
+ settings ??= Reflect.get(globalThis, "settings");
21
21
  if (settings) {
22
22
  if (typeof settings === "string") {
23
23
  settings = JSON.parse(settings);
@@ -48,7 +48,7 @@ var ExternalSettings;
48
48
  ExternalSettings.formatApp = formatApp;
49
49
  function formatHost(setting, hostname) {
50
50
  // Default hostname
51
- hostname ?? (hostname = globalThis.location.hostname);
51
+ hostname ??= globalThis.location.hostname;
52
52
  if (typeof setting === "string") {
53
53
  return setting.replace("{hostname}", hostname);
54
54
  }
@@ -8,20 +8,25 @@ const IBridgeHost_1 = require("./IBridgeHost");
8
8
  * https://inappwebview.dev/docs/javascript/communication/
9
9
  */
10
10
  class FlutterHost {
11
+ host;
12
+ /**
13
+ * Name
14
+ */
15
+ name = IBridgeHost_1.BridgeHostName.Flutter;
16
+ /**
17
+ * Start Url
18
+ */
19
+ startUrl;
20
+ /**
21
+ * Cached commands
22
+ */
23
+ cachedCommands = {};
11
24
  /**
12
25
  * Constructor
13
26
  * @param callHandler Call handler
14
27
  */
15
28
  constructor(host) {
16
29
  this.host = host;
17
- /**
18
- * Name
19
- */
20
- this.name = IBridgeHost_1.BridgeHostName.Flutter;
21
- /**
22
- * Cached commands
23
- */
24
- this.cachedCommands = {};
25
30
  window.addEventListener("flutterInAppWebViewPlatformReady", (_event) => {
26
31
  if (this.host.callHandler == null)
27
32
  return;
@@ -6,6 +6,41 @@ exports.BusinessTax = void 0;
6
6
  * https://imask.js.org/
7
7
  */
8
8
  class BusinessTax {
9
+ id;
10
+ name;
11
+ mask;
12
+ /**
13
+ * CN
14
+ * Unified Social Credit Code (USCC) / 统一信用代码
15
+ * https://zh.wikisource.org/wiki/GB_32100-2015_%E6%B3%95%E4%BA%BA%E5%92%8C%E5%85%B6%E4%BB%96%E7%BB%84%E7%BB%87%E7%BB%9F%E4%B8%80%E7%A4%BE%E4%BC%9A%E4%BF%A1%E7%94%A8%E4%BB%A3%E7%A0%81%E7%BC%96%E7%A0%81%E8%A7%84%E5%88%99
16
+ */
17
+ static CN = new BusinessTax("CN", "USCC", "*0-000000-**********");
18
+ /**
19
+ * NZ, Inland Revenue (IRD)
20
+ */
21
+ static NZ = new BusinessTax("NZ", "IRD", "00[0]-000-000");
22
+ /**
23
+ * US, Employer Identification Number (EIN)
24
+ */
25
+ static US = new BusinessTax("US", "EIN", "00-0000000");
26
+ /**
27
+ * CA, tax ID number (Business Number, BN)
28
+ */
29
+ static CA = new BusinessTax("CA", "BN", "000000000");
30
+ /**
31
+ * HK, Business Registration Number (BRN)
32
+ */
33
+ static HK = new BusinessTax("HK", "BRN", "00000000");
34
+ /**
35
+ * All countries and regions
36
+ */
37
+ static all = [
38
+ BusinessTax.CN,
39
+ BusinessTax.NZ,
40
+ BusinessTax.US,
41
+ BusinessTax.CA,
42
+ BusinessTax.HK
43
+ ];
9
44
  /**
10
45
  * Get country or region by id
11
46
  * @param id Country id
@@ -27,35 +62,3 @@ class BusinessTax {
27
62
  }
28
63
  }
29
64
  exports.BusinessTax = BusinessTax;
30
- /**
31
- * CN
32
- * Unified Social Credit Code (USCC) / 统一信用代码
33
- * https://zh.wikisource.org/wiki/GB_32100-2015_%E6%B3%95%E4%BA%BA%E5%92%8C%E5%85%B6%E4%BB%96%E7%BB%84%E7%BB%87%E7%BB%9F%E4%B8%80%E7%A4%BE%E4%BC%9A%E4%BF%A1%E7%94%A8%E4%BB%A3%E7%A0%81%E7%BC%96%E7%A0%81%E8%A7%84%E5%88%99
34
- */
35
- BusinessTax.CN = new BusinessTax("CN", "USCC", "*0-000000-**********");
36
- /**
37
- * NZ, Inland Revenue (IRD)
38
- */
39
- BusinessTax.NZ = new BusinessTax("NZ", "IRD", "00[0]-000-000");
40
- /**
41
- * US, Employer Identification Number (EIN)
42
- */
43
- BusinessTax.US = new BusinessTax("US", "EIN", "00-0000000");
44
- /**
45
- * CA, tax ID number (Business Number, BN)
46
- */
47
- BusinessTax.CA = new BusinessTax("CA", "BN", "000000000");
48
- /**
49
- * HK, Business Registration Number (BRN)
50
- */
51
- BusinessTax.HK = new BusinessTax("HK", "BRN", "00000000");
52
- /**
53
- * All countries and regions
54
- */
55
- BusinessTax.all = [
56
- BusinessTax.CN,
57
- BusinessTax.NZ,
58
- BusinessTax.US,
59
- BusinessTax.CA,
60
- BusinessTax.HK
61
- ];
@@ -143,10 +143,9 @@ var BusinessUtils;
143
143
  * @param fields Fields map
144
144
  */
145
145
  function setupPagingKeysets(data, lastItem, idField, fields) {
146
- var _a;
147
146
  // If the id field is not set for ordering, add it with descending
148
147
  if (typeof data.queryPaging === "object") {
149
- const orderBy = ((_a = data.queryPaging).orderBy ?? (_a.orderBy = []));
148
+ const orderBy = (data.queryPaging.orderBy ??= []);
150
149
  const idUpper = idField.toUpperCase();
151
150
  if (!orderBy.find((o) => o.field.toUpperCase() === idUpper)) {
152
151
  orderBy.push({ field: idField, desc: true, unique: true });
@@ -21,6 +21,10 @@ class ActionResultError extends Error {
21
21
  const add = addtions.length > 0 ? ` (${addtions.join(", ")})` : "";
22
22
  return `${result.title || "Error"}${add}`;
23
23
  }
24
+ /**
25
+ * Related result
26
+ */
27
+ result;
24
28
  /**
25
29
  * Constructor
26
30
  * @param result Result