@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.
- package/.github/workflows/main.yml +6 -5
- package/__tests__/app/CoreApp.ts +141 -143
- package/__tests__/app/Culture.ts +23 -23
- package/__tests__/app/TestApp.ts +107 -105
- package/__tests__/business/BusinessUtils.ts +37 -37
- package/__tests__/result/ActionResult.ts +14 -14
- package/__tests__/tsconfig.json +16 -16
- package/lib/cjs/address/AddressAutocomplete.d.ts +1 -1
- package/lib/cjs/address/AddressPlace.d.ts +3 -3
- package/lib/cjs/address/AddressPlaceBase.d.ts +1 -1
- package/lib/cjs/address/AddressRegion.d.ts +2 -2
- package/lib/cjs/address/AddressRegion.js +12 -12
- package/lib/cjs/address/AddressUtils.d.ts +1 -1
- package/lib/cjs/api/AuthApi.d.ts +14 -14
- package/lib/cjs/api/AuthApi.js +17 -17
- package/lib/cjs/api/BaseApi.d.ts +1 -1
- package/lib/cjs/api/EntityApi.d.ts +8 -8
- package/lib/cjs/api/EntityApi.js +4 -4
- package/lib/cjs/api/dto/IdLabelDto.d.ts +1 -1
- package/lib/cjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
- package/lib/cjs/api/dto/ResultPayload.d.ts +2 -2
- package/lib/cjs/api/rq/AuthRequest.d.ts +1 -1
- package/lib/cjs/api/rq/LoginRQ.d.ts +2 -2
- package/lib/cjs/api/rq/MergeRQ.d.ts +1 -1
- package/lib/cjs/api/rq/QueryRQ.d.ts +2 -2
- package/lib/cjs/api/rq/StatusQueryRQ.d.ts +3 -3
- package/lib/cjs/api/rq/UpdateModel.d.ts +2 -2
- package/lib/cjs/api/rq/UpdateStatusRQ.d.ts +2 -2
- package/lib/cjs/app/AppSettings.d.ts +3 -3
- package/lib/cjs/bridges/FlutterHost.d.ts +2 -2
- package/lib/cjs/bridges/FlutterHost.js +11 -11
- package/lib/cjs/business/BusinessTax.js +6 -6
- package/lib/cjs/business/BusinessUtils.d.ts +2 -2
- package/lib/cjs/business/BusinessUtils.js +5 -5
- package/lib/cjs/business/Currency.d.ts +1 -1
- package/lib/cjs/business/Currency.js +10 -10
- package/lib/cjs/business/ProductUnit.d.ts +1 -1
- package/lib/cjs/business/ShoppingCart.d.ts +9 -9
- package/lib/cjs/business/ShoppingCart.js +11 -11
- package/lib/cjs/custom/CustomField.d.ts +1 -1
- package/lib/cjs/custom/CustomFieldData.d.ts +2 -2
- package/lib/cjs/i18n/Culture.d.ts +31 -0
- package/lib/cjs/i18n/Culture.js +51 -0
- package/lib/cjs/index.d.ts +1 -4
- package/lib/cjs/index.js +1 -4
- package/lib/cjs/result/ActionResult.d.ts +1 -1
- package/lib/cjs/result/ActionResultError.d.ts +1 -1
- package/lib/cjs/result/ActionResultError.js +3 -3
- package/lib/cjs/result/InitCallResult.d.ts +1 -1
- package/lib/cjs/state/Culture.d.ts +2 -2
- package/lib/cjs/state/User.d.ts +1 -1
- package/lib/mjs/address/AddressAutocomplete.d.ts +1 -1
- package/lib/mjs/address/AddressPlace.d.ts +3 -3
- package/lib/mjs/address/AddressPlaceBase.d.ts +1 -1
- package/lib/mjs/address/AddressRegion.d.ts +2 -2
- package/lib/mjs/address/AddressRegion.js +13 -13
- package/lib/mjs/address/AddressUtils.d.ts +1 -1
- package/lib/mjs/address/AddressUtils.js +1 -1
- package/lib/mjs/api/AuthApi.d.ts +14 -14
- package/lib/mjs/api/AuthApi.js +19 -19
- package/lib/mjs/api/BaseApi.d.ts +1 -1
- package/lib/mjs/api/EntityApi.d.ts +8 -8
- package/lib/mjs/api/EntityApi.js +5 -5
- package/lib/mjs/api/dto/IdLabelDto.d.ts +1 -1
- package/lib/mjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
- package/lib/mjs/api/dto/ResultPayload.d.ts +2 -2
- package/lib/mjs/api/rq/AuthRequest.d.ts +1 -1
- package/lib/mjs/api/rq/LoginRQ.d.ts +2 -2
- package/lib/mjs/api/rq/MergeRQ.d.ts +1 -1
- package/lib/mjs/api/rq/QueryRQ.d.ts +2 -2
- package/lib/mjs/api/rq/StatusQueryRQ.d.ts +3 -3
- package/lib/mjs/api/rq/UpdateModel.d.ts +2 -2
- package/lib/mjs/api/rq/UpdateStatusRQ.d.ts +2 -2
- package/lib/mjs/app/AppSettings.d.ts +3 -3
- package/lib/mjs/bridges/FlutterHost.d.ts +2 -2
- package/lib/mjs/bridges/FlutterHost.js +13 -13
- package/lib/mjs/business/BusinessTax.js +6 -6
- package/lib/mjs/business/BusinessUtils.d.ts +2 -2
- package/lib/mjs/business/BusinessUtils.js +5 -5
- package/lib/mjs/business/Currency.d.ts +1 -1
- package/lib/mjs/business/Currency.js +10 -10
- package/lib/mjs/business/ProductUnit.d.ts +1 -1
- package/lib/mjs/business/ProductUnit.js +1 -1
- package/lib/mjs/business/ShoppingCart.d.ts +9 -9
- package/lib/mjs/business/ShoppingCart.js +12 -12
- package/lib/mjs/custom/CustomField.d.ts +1 -1
- package/lib/mjs/custom/CustomFieldData.d.ts +2 -2
- package/lib/mjs/i18n/Culture.d.ts +31 -0
- package/lib/mjs/i18n/Culture.js +48 -0
- package/lib/mjs/index.d.ts +1 -4
- package/lib/mjs/index.js +1 -4
- package/lib/mjs/result/ActionResult.d.ts +1 -1
- package/lib/mjs/result/ActionResult.js +1 -1
- package/lib/mjs/result/ActionResultError.d.ts +1 -1
- package/lib/mjs/result/ActionResultError.js +3 -3
- package/lib/mjs/result/InitCallResult.d.ts +1 -1
- package/lib/mjs/state/Culture.d.ts +2 -2
- package/lib/mjs/state/User.d.ts +1 -1
- package/package.json +1 -1
- package/src/address/AddressAutocomplete.ts +16 -16
- package/src/address/AddressCity.ts +12 -12
- package/src/address/AddressContinent.ts +35 -35
- package/src/address/AddressDistrict.ts +12 -12
- package/src/address/AddressLocation.ts +8 -8
- package/src/address/AddressPlace.ts +23 -23
- package/src/address/AddressPlaceBase.ts +31 -31
- package/src/address/AddressRegion.ts +286 -286
- package/src/address/AddressState.ts +12 -12
- package/src/address/AddressUtils.ts +27 -27
- package/src/api/AuthApi.ts +194 -194
- package/src/api/BaseApi.ts +13 -13
- package/src/api/EntityApi.ts +181 -194
- package/src/api/dto/AntiforgeryRequestToken.ts +15 -15
- package/src/api/dto/ApiRefreshTokenDto.ts +16 -16
- package/src/api/dto/IdLabelDto.ts +3 -3
- package/src/api/dto/IdLabelPrimaryDto.ts +7 -7
- package/src/api/dto/InitCallDto.ts +12 -12
- package/src/api/dto/ResultPayload.ts +6 -6
- package/src/api/rq/ApiRefreshTokenRQ.ts +8 -8
- package/src/api/rq/AuthRequest.ts +40 -40
- package/src/api/rq/GetLogInUrlRQ.ts +8 -8
- package/src/api/rq/LoginIdRQ.ts +12 -12
- package/src/api/rq/LoginRQ.ts +18 -18
- package/src/api/rq/MergeRQ.ts +13 -13
- package/src/api/rq/QueryPagingData.ts +16 -16
- package/src/api/rq/QueryRQ.ts +22 -22
- package/src/api/rq/RefreshTokenRQ.ts +4 -4
- package/src/api/rq/ResetPasswordRQ.ts +20 -20
- package/src/api/rq/SignoutRQ.ts +8 -8
- package/src/api/rq/StatusQueryRQ.ts +11 -11
- package/src/api/rq/SwitchOrgRQ.ts +8 -8
- package/src/api/rq/TokenRQ.ts +4 -4
- package/src/api/rq/UpdateModel.ts +12 -12
- package/src/api/rq/UpdateStatusRQ.ts +10 -10
- package/src/app/AppSettings.ts +27 -27
- package/src/app/UserRole.ts +44 -44
- package/src/bridges/FlutterHost.ts +92 -97
- package/src/bridges/IBridgeHost.ts +49 -51
- package/src/business/ApiService.ts +25 -25
- package/src/business/BusinessTax.ts +63 -63
- package/src/business/BusinessUtils.ts +75 -75
- package/src/business/CultureItem.ts +43 -43
- package/src/business/Currency.ts +11 -11
- package/src/business/DataPrivacy.ts +35 -35
- package/src/business/EntityStatus.ts +44 -44
- package/src/business/ProductUnit.ts +58 -58
- package/src/business/RepeatOption.ts +50 -50
- package/src/business/ShoppingCart.ts +696 -706
- package/src/custom/CustomField.ts +20 -20
- package/src/custom/CustomFieldData.ts +43 -43
- package/src/def/ListItem.ts +12 -12
- package/src/i18n/Culture.ts +60 -0
- package/src/i18n/en.json +244 -244
- package/src/i18n/zh-Hans.json +244 -244
- package/src/i18n/zh-Hant.json +244 -244
- package/src/index.ts +1 -4
- package/src/result/ActionResult.ts +19 -19
- package/src/result/ActionResultError.ts +30 -30
- package/src/result/InitCallResult.ts +21 -21
- package/src/state/Culture.ts +3 -3
- package/src/state/State.ts +5 -5
- package/src/state/User.ts +92 -92
- package/lib/cjs/i18n/CultureUtils.d.ts +0 -13
- package/lib/cjs/i18n/CultureUtils.js +0 -32
- package/lib/cjs/i18n/en.d.ts +0 -6
- package/lib/cjs/i18n/en.js +0 -12
- package/lib/cjs/i18n/zhHans.d.ts +0 -6
- package/lib/cjs/i18n/zhHans.js +0 -12
- package/lib/cjs/i18n/zhHant.d.ts +0 -6
- package/lib/cjs/i18n/zhHant.js +0 -12
- package/lib/mjs/i18n/CultureUtils.d.ts +0 -13
- package/lib/mjs/i18n/CultureUtils.js +0 -29
- package/lib/mjs/i18n/en.d.ts +0 -6
- package/lib/mjs/i18n/en.js +0 -8
- package/lib/mjs/i18n/zhHans.d.ts +0 -6
- package/lib/mjs/i18n/zhHans.js +0 -8
- package/lib/mjs/i18n/zhHant.d.ts +0 -6
- package/lib/mjs/i18n/zhHant.js +0 -8
- package/src/i18n/CultureUtils.ts +0 -36
- package/src/i18n/en.ts +0 -10
- package/src/i18n/zhHans.ts +0 -10
- package/src/i18n/zhHant.ts +0 -10
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IdType, ListType2 } from
|
|
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 =
|
|
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 = {}));
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -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/
|
|
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/
|
|
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; } });
|
|
@@ -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 ||
|
|
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 =
|
|
32
|
+
this.name = "ActionResultError";
|
|
33
33
|
// Hold the result
|
|
34
34
|
this.result = result;
|
|
35
35
|
}
|
package/lib/cjs/state/User.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AddressLocation } from
|
|
2
|
-
import { AddressPlaceBase } from
|
|
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,
|
|
7
|
+
export type AddressPlace = Omit<AddressPlaceBase, "location"> & {
|
|
8
8
|
/**
|
|
9
9
|
* Place id
|
|
10
10
|
* 地点编号
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Currency } from
|
|
2
|
-
import { AddressContinent, AddressContinentId } from
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
*/
|
package/lib/mjs/api/AuthApi.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IApiPayload } from
|
|
2
|
-
import { IUser } from
|
|
3
|
-
import { BaseApi } from
|
|
4
|
-
import { ResultPayload } from
|
|
5
|
-
import { IActionResult } from
|
|
6
|
-
import { RefreshTokenProps, RefreshTokenResult } from
|
|
7
|
-
import { TokenRQ } from
|
|
8
|
-
import { ApiRefreshTokenDto } from
|
|
9
|
-
import { GetLogInUrlRQ } from
|
|
10
|
-
import { LoginRQ } from
|
|
11
|
-
import { ResetPasswordRQ } from
|
|
12
|
-
import { SignoutRQ } from
|
|
13
|
-
import { SwitchOrgRQ } from
|
|
14
|
-
import { AuthRequest } from
|
|
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
|
*/
|
package/lib/mjs/api/AuthApi.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseApi } from
|
|
2
|
-
import { ActionResult } from
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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 =
|
|
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:
|
|
91
|
-
field:
|
|
92
|
-
title: this.app.get(
|
|
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:
|
|
117
|
-
field:
|
|
118
|
-
title: this.app.get(
|
|
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(
|
|
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(
|
|
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(
|
|
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 =
|
|
156
|
+
AuthApi.HeaderTokenField = "Etsoo-Refresh-Token";
|
package/lib/mjs/api/BaseApi.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IApi, IApiPayload } from
|
|
2
|
-
import { IActionResult, IdType } from
|
|
3
|
-
import { IApp } from
|
|
4
|
-
import { BaseApi } from
|
|
5
|
-
import { ResultPayload } from
|
|
6
|
-
import { MergeRQ } from
|
|
7
|
-
import { QueryRQ } from
|
|
8
|
-
import { UpdateStatusRQ } from
|
|
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
|
package/lib/mjs/api/EntityApi.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseApi } from
|
|
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
|
-
?
|
|
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 ===
|
|
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 =
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { IApiPayload } from
|
|
2
|
-
import { IActionResult, IdActionResult, IdMsgActionResult, MsgActionResult } from
|
|
1
|
+
import { IApiPayload } from "@etsoo/restclient";
|
|
2
|
+
import { IActionResult, IdActionResult, IdMsgActionResult, MsgActionResult } from "@etsoo/shared";
|
|
3
3
|
/**
|
|
4
4
|
* Action result payload
|
|
5
5
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IdType } from
|
|
2
|
-
import { QueryRQ } from
|
|
3
|
-
import { EntityStatus } from
|
|
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
|
|
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,
|
|
17
|
+
changedFields?: Exclude<keyof this, "changedFields">[];
|
|
18
18
|
}
|