@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
package/__tests__/app/TestApp.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from
|
|
2
|
+
INotificaseBase,
|
|
3
|
+
INotification,
|
|
4
|
+
Notification,
|
|
5
|
+
NotificationCallProps,
|
|
6
|
+
NotificationContainer,
|
|
7
|
+
NotificationRenderProps
|
|
8
|
+
} from "@etsoo/notificationbase";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from
|
|
20
|
-
import { DataTypes, DomUtils, Utils, WindowStorage } from '@etsoo/shared';
|
|
10
|
+
AddressUtils,
|
|
11
|
+
CoreApp,
|
|
12
|
+
createClient,
|
|
13
|
+
Culture,
|
|
14
|
+
ExternalSettings,
|
|
15
|
+
IAppSettings,
|
|
16
|
+
InitCallResultData,
|
|
17
|
+
IUser
|
|
18
|
+
} from "../../src";
|
|
19
|
+
import { DataTypes, DomUtils, Utils, WindowStorage } from "@etsoo/shared";
|
|
21
20
|
|
|
22
21
|
// Detected country or region
|
|
23
22
|
const { detectedCountry } = DomUtils;
|
|
@@ -26,27 +25,30 @@ const { detectedCountry } = DomUtils;
|
|
|
26
25
|
const { detectedCulture } = DomUtils;
|
|
27
26
|
|
|
28
27
|
// Supported cultures
|
|
29
|
-
const supportedCultures: DataTypes.CultureDefinition[] = [
|
|
28
|
+
const supportedCultures: DataTypes.CultureDefinition[] = [
|
|
29
|
+
Culture.zhHans({}),
|
|
30
|
+
Culture.en({})
|
|
31
|
+
];
|
|
30
32
|
|
|
31
33
|
// Supported regions
|
|
32
|
-
const supportedRegions = [
|
|
34
|
+
const supportedRegions = ["CN"];
|
|
33
35
|
|
|
34
36
|
// Class implementation for tests
|
|
35
37
|
class NotificationTest extends Notification<any, NotificationCallProps> {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
render(props: NotificationRenderProps, className?: string, options?: any) {
|
|
39
|
+
throw new Error("Method not implemented.");
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
class NotificationContainerTest extends NotificationContainer<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
any,
|
|
45
|
+
NotificationCallProps
|
|
44
46
|
> {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
protected addRaw(
|
|
48
|
+
data: INotificaseBase<any, NotificationCallProps>
|
|
49
|
+
): INotification<any, NotificationCallProps> {
|
|
50
|
+
return new NotificationTest(data.type, data.content);
|
|
51
|
+
}
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
// Container
|
|
@@ -54,83 +56,83 @@ var container = new NotificationContainerTest((update) => {});
|
|
|
54
56
|
|
|
55
57
|
// Is local test (integration test)
|
|
56
58
|
// Make sure your local environment is ready
|
|
57
|
-
export const isLocalTest = process.env.NODE_ENV ===
|
|
59
|
+
export const isLocalTest = process.env.NODE_ENV === "local";
|
|
58
60
|
|
|
59
61
|
// Test application class
|
|
60
62
|
export class TestApp extends CoreApp<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
IUser,
|
|
64
|
+
IAppSettings,
|
|
65
|
+
{},
|
|
66
|
+
NotificationCallProps
|
|
65
67
|
> {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Constructor
|
|
70
|
+
* @param settings Settings
|
|
71
|
+
* @param name Application name
|
|
72
|
+
*/
|
|
73
|
+
constructor() {
|
|
74
|
+
super(
|
|
75
|
+
ExternalSettings.format({
|
|
76
|
+
/**
|
|
77
|
+
* Endpoint of the API service
|
|
78
|
+
*/
|
|
79
|
+
endpoint: "http://{hostname}:9000/api/",
|
|
80
|
+
|
|
81
|
+
endpoints: {
|
|
82
|
+
core: {
|
|
83
|
+
endpoint: "https://{hostname}:9001/api/",
|
|
84
|
+
webUrl: ""
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* App root url
|
|
90
|
+
*/
|
|
91
|
+
homepage: "/cms",
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Web url of the cloud
|
|
95
|
+
*/
|
|
96
|
+
webUrl: "https://localhost",
|
|
97
|
+
|
|
98
|
+
// Detected culture
|
|
99
|
+
detectedCulture,
|
|
100
|
+
|
|
101
|
+
// Supported cultures
|
|
102
|
+
cultures: supportedCultures,
|
|
103
|
+
|
|
104
|
+
// Supported regions
|
|
105
|
+
regions: supportedRegions,
|
|
106
|
+
|
|
107
|
+
// Browser's time zone
|
|
108
|
+
timeZone: Utils.getTimeZone(),
|
|
109
|
+
|
|
110
|
+
// Current country or region
|
|
111
|
+
currentRegion: AddressUtils.getRegion(
|
|
112
|
+
supportedRegions,
|
|
113
|
+
detectedCountry,
|
|
114
|
+
detectedCulture
|
|
115
|
+
),
|
|
116
|
+
|
|
117
|
+
// Current culture
|
|
118
|
+
currentCulture: DomUtils.getCulture(
|
|
119
|
+
supportedCultures,
|
|
120
|
+
detectedCulture
|
|
121
|
+
)![0]
|
|
122
|
+
}),
|
|
123
|
+
createClient(),
|
|
124
|
+
container,
|
|
125
|
+
new WindowStorage(),
|
|
126
|
+
"SmartERP"
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
freshCountdownUI(callback?: () => PromiseLike<unknown>): void {
|
|
131
|
+
throw new Error("Method not implemented.");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
initCallUpdateLocal(data: InitCallResultData, timestamp: number) {
|
|
135
|
+
this.initCallUpdate(data, timestamp);
|
|
136
|
+
return this.passphrase;
|
|
137
|
+
}
|
|
136
138
|
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { ArrayUtils } from
|
|
2
|
-
import { CultureGridItem } from
|
|
3
|
-
import { BusinessUtils } from
|
|
1
|
+
import { ArrayUtils } from "@etsoo/shared";
|
|
2
|
+
import { CultureGridItem } from "../../src";
|
|
3
|
+
import { BusinessUtils } from "../../src/business/BusinessUtils";
|
|
4
4
|
|
|
5
5
|
// Import the ArrayUtils
|
|
6
6
|
ArrayUtils.differences([], []);
|
|
7
7
|
|
|
8
|
-
test(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
test("Tests for BusinessUtils.formatAvatarTitle", () => {
|
|
9
|
+
// Assert
|
|
10
|
+
expect(BusinessUtils.formatAvatarTitle("Garry Xiao")).toBe("GX");
|
|
11
|
+
expect(BusinessUtils.formatAvatarTitle("Etsoo")).toBe("ME");
|
|
12
|
+
expect(BusinessUtils.formatAvatarTitle("Etsoo", 3, "E")).toBe("E");
|
|
13
|
+
expect(BusinessUtils.formatAvatarTitle("Etsoo", 5)).toBe("ETSOO");
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
test(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
16
|
+
test("Tests for BusinessUtils.formatCultues", () => {
|
|
17
|
+
// Arrange
|
|
18
|
+
const cultures = [
|
|
19
|
+
{
|
|
20
|
+
id: "zh-Hans",
|
|
21
|
+
label: "中文(简体), Chinese (Simplified)"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "en",
|
|
25
|
+
label: "英语, English"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "de",
|
|
29
|
+
label: "德语, German"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "zh-Hant",
|
|
33
|
+
label: "中文(繁体), Chinese (Traditional)"
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
const data: { cultures: CultureGridItem[] } = {
|
|
37
|
+
cultures: [{ id: "zh-Hant", title: "繁体" }]
|
|
38
|
+
};
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
// Act
|
|
41
|
+
BusinessUtils.formatCultues(cultures, data);
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
// Assert
|
|
44
|
+
expect(data.cultures[0].id).toBe("en");
|
|
45
|
+
expect(data.cultures.slice(-1)[0].id).toBe("zh-Hant");
|
|
46
46
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { ApiError } from
|
|
2
|
-
import { ActionResult, ActionResultError } from
|
|
1
|
+
import { ApiError } from "@etsoo/restclient";
|
|
2
|
+
import { ActionResult, ActionResultError } from "../../src";
|
|
3
3
|
|
|
4
4
|
// Arrange
|
|
5
|
-
var message =
|
|
5
|
+
var message = "Not Found";
|
|
6
6
|
var status = 500;
|
|
7
7
|
var error: ApiError = new ApiError(message, status);
|
|
8
8
|
|
|
9
9
|
// Act
|
|
10
10
|
var result = ActionResult.create(error);
|
|
11
11
|
|
|
12
|
-
test(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
test("Tests for ActionResult.Create", () => {
|
|
13
|
+
// Assert
|
|
14
|
+
expect(result.type).toBe("ApiError");
|
|
15
|
+
expect(result.title).toBe(message);
|
|
16
|
+
expect(result.status).toBe(status);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
test(
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
test("Tests for ActionResultError.format", () => {
|
|
20
|
+
// Arrange & act
|
|
21
|
+
var error = new ActionResultError(result);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
// Assert
|
|
24
|
+
expect(error.name).toBe("ActionResultError");
|
|
25
|
+
expect(error.message).toBe(`${message} (${status}, ApiError)`);
|
|
26
26
|
});
|
package/__tests__/tsconfig.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node10",
|
|
6
|
+
"allowJs": false,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"declaration": true
|
|
16
|
+
},
|
|
17
|
+
"include": [".."]
|
|
18
18
|
}
|
|
@@ -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
|
*/
|
|
@@ -32,62 +32,62 @@ exports.AddressRegion = AddressRegion;
|
|
|
32
32
|
/**
|
|
33
33
|
* CN - China
|
|
34
34
|
*/
|
|
35
|
-
AddressRegion.CN = new AddressRegion(
|
|
35
|
+
AddressRegion.CN = new AddressRegion("CN", "CHN", "156", AddressContinent_1.AddressContinent.AS, "00", "+86", "0", "CNY", ["zh-Hans-CN", "zh-CN"]);
|
|
36
36
|
/**
|
|
37
37
|
* HK - HK, China
|
|
38
38
|
* 中国香港
|
|
39
39
|
*/
|
|
40
|
-
AddressRegion.HK = new AddressRegion(
|
|
40
|
+
AddressRegion.HK = new AddressRegion("HK", "HKG", "344", AddressContinent_1.AddressContinent.AS, "001", "+852", undefined, "HKD", ["zh-Hant-HK", "zh-HK", "en-HK"]);
|
|
41
41
|
/**
|
|
42
42
|
* SG - Singapore
|
|
43
43
|
* 新加坡
|
|
44
44
|
*/
|
|
45
|
-
AddressRegion.SG = new AddressRegion(
|
|
45
|
+
AddressRegion.SG = new AddressRegion("SG", "SGP", "702", AddressContinent_1.AddressContinent.AS, "000", "+65", undefined, "SGD", ["zh-Hans-SG", "zh-SG", "en-SG"]);
|
|
46
46
|
/**
|
|
47
47
|
* JP - Japan
|
|
48
48
|
* 日本
|
|
49
49
|
*/
|
|
50
|
-
AddressRegion.JP = new AddressRegion(
|
|
50
|
+
AddressRegion.JP = new AddressRegion("JP", "JPN", "392", AddressContinent_1.AddressContinent.AS, "010", "+81", "0", "JPY", ["ja-JP"]);
|
|
51
51
|
/**
|
|
52
52
|
* US - United States
|
|
53
53
|
* 美国
|
|
54
54
|
*/
|
|
55
|
-
AddressRegion.US = new AddressRegion(
|
|
55
|
+
AddressRegion.US = new AddressRegion("US", "USA", "840", AddressContinent_1.AddressContinent.NA, "011", "+1", "1", "USD", ["en-US"]);
|
|
56
56
|
/**
|
|
57
57
|
* CA - Canada
|
|
58
58
|
* 加拿大
|
|
59
59
|
*/
|
|
60
|
-
AddressRegion.CA = new AddressRegion(
|
|
60
|
+
AddressRegion.CA = new AddressRegion("CA", "CAN", "124", AddressContinent_1.AddressContinent.NA, "011", "+1", "1", "CAD", ["en-CA", "fr-CA"]);
|
|
61
61
|
/**
|
|
62
62
|
* AU - Australia
|
|
63
63
|
* 澳大利亚
|
|
64
64
|
*/
|
|
65
|
-
AddressRegion.AU = new AddressRegion(
|
|
65
|
+
AddressRegion.AU = new AddressRegion("AU", "AUS", "036", AddressContinent_1.AddressContinent.OC, "0011", "+61", "0", "AUD", ["en-AU"]);
|
|
66
66
|
/**
|
|
67
67
|
* NZ - New Zealand
|
|
68
68
|
* 新西兰
|
|
69
69
|
*/
|
|
70
|
-
AddressRegion.NZ = new AddressRegion(
|
|
70
|
+
AddressRegion.NZ = new AddressRegion("NZ", "NZL", "554", AddressContinent_1.AddressContinent.OC, "00", "+64", "0", "NZD", ["en-NZ", "mi-NZ"]);
|
|
71
71
|
/**
|
|
72
72
|
* GB - Great Britain
|
|
73
73
|
* 英国
|
|
74
74
|
*/
|
|
75
|
-
AddressRegion.GB = new AddressRegion(
|
|
75
|
+
AddressRegion.GB = new AddressRegion("GB", "GBR", "826", AddressContinent_1.AddressContinent.EU, "00", "+44", "0", "GBP", ["en-GB"]);
|
|
76
76
|
/**
|
|
77
77
|
* IE - Ireland
|
|
78
78
|
* 爱尔兰
|
|
79
79
|
*/
|
|
80
|
-
AddressRegion.IE = new AddressRegion(
|
|
80
|
+
AddressRegion.IE = new AddressRegion("IE", "IRL", "372", AddressContinent_1.AddressContinent.EU, "00", "+353", "0", "EUR", ["en-IE"]);
|
|
81
81
|
/**
|
|
82
82
|
* DE - Germany
|
|
83
83
|
* 德国
|
|
84
84
|
*/
|
|
85
|
-
AddressRegion.DE = new AddressRegion(
|
|
85
|
+
AddressRegion.DE = new AddressRegion("DE", "DEU", "276", AddressContinent_1.AddressContinent.EU, "00", "+49", "0", "EUR", ["de-DE"]);
|
|
86
86
|
/**
|
|
87
87
|
* FR - France
|
|
88
88
|
* 法国
|
|
89
89
|
*/
|
|
90
|
-
AddressRegion.FR = new AddressRegion(
|
|
90
|
+
AddressRegion.FR = new AddressRegion("FR", "FRA", "250", AddressContinent_1.AddressContinent.EU, "00", "+33", "0", "EUR", ["fr-FR"]);
|
|
91
91
|
/**
|
|
92
92
|
* All countries and regions
|
|
93
93
|
*/
|
package/lib/cjs/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
|
*/
|