@etsoo/appscript 1.5.94 → 1.5.96
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/__tests__/app/CoreApp.ts +2 -1
- package/__tests__/app/TestApp.ts +0 -3
- package/__tests__/tsconfig.json +2 -2
- package/lib/cjs/api/AuthApi.d.ts +2 -2
- package/lib/cjs/api/AuthApi.js +9 -2
- package/lib/cjs/api/rq/CheckUserIdentifierRQ.d.ts +5 -0
- package/lib/cjs/api/rq/LoginRQ.d.ts +8 -4
- package/lib/cjs/api/rq/ResetPasswordRQ.d.ts +8 -0
- package/lib/cjs/app/AppSettings.d.ts +1 -1
- package/lib/cjs/app/CoreApp.d.ts +1 -1
- package/lib/cjs/app/CoreApp.js +3 -4
- package/lib/cjs/app/IApp.d.ts +1 -1
- package/lib/mjs/api/AuthApi.d.ts +2 -2
- package/lib/mjs/api/AuthApi.js +9 -2
- package/lib/mjs/api/rq/CheckUserIdentifierRQ.d.ts +5 -0
- package/lib/mjs/api/rq/LoginRQ.d.ts +8 -4
- package/lib/mjs/api/rq/ResetPasswordRQ.d.ts +8 -0
- package/lib/mjs/app/AppSettings.d.ts +1 -1
- package/lib/mjs/app/CoreApp.d.ts +1 -1
- package/lib/mjs/app/CoreApp.js +3 -4
- package/lib/mjs/app/IApp.d.ts +1 -1
- package/package.json +7 -7
- package/src/api/AuthApi.ts +11 -4
- package/src/api/rq/CheckUserIdentifierRQ.ts +6 -0
- package/src/api/rq/LoginRQ.ts +9 -4
- package/src/api/rq/ResetPasswordRQ.ts +10 -0
- package/src/app/AppSettings.ts +1 -1
- package/src/app/CoreApp.ts +4 -5
- package/src/app/IApp.ts +1 -1
package/__tests__/app/CoreApp.ts
CHANGED
|
@@ -13,7 +13,8 @@ function EnhanceApp<TBase extends DataTypes.MConstructor<TestApp>>(
|
|
|
13
13
|
|
|
14
14
|
const appClass = EnhanceApp(TestApp);
|
|
15
15
|
const app = new appClass();
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
await app.changeCulture(app.settings.cultures[0]);
|
|
17
18
|
|
|
18
19
|
test("Test for domain replacement", () => {
|
|
19
20
|
expect(app.settings.endpoint).toBe("http://localhost:9000/api/");
|
package/__tests__/app/TestApp.ts
CHANGED
|
@@ -104,9 +104,6 @@ export class TestApp extends CoreApp<
|
|
|
104
104
|
// Supported regions
|
|
105
105
|
regions: supportedRegions,
|
|
106
106
|
|
|
107
|
-
// Browser's time zone
|
|
108
|
-
timeZone: Utils.getTimeZone(),
|
|
109
|
-
|
|
110
107
|
// Current country or region
|
|
111
108
|
currentRegion: AddressUtils.getRegion(
|
|
112
109
|
supportedRegions,
|
package/__tests__/tsconfig.json
CHANGED
package/lib/cjs/api/AuthApi.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { TokenRQ } from "./rq/TokenRQ";
|
|
|
8
8
|
import { ApiRefreshTokenDto } from "./dto/ApiRefreshTokenDto";
|
|
9
9
|
import { GetLogInUrlRQ } from "./rq/GetLogInUrlRQ";
|
|
10
10
|
import { LoginRQ } from "./rq/LoginRQ";
|
|
11
|
-
import {
|
|
11
|
+
import { ResetPasswordInputRQ } from "./rq/ResetPasswordRQ";
|
|
12
12
|
import { SignoutRQ } from "./rq/SignoutRQ";
|
|
13
13
|
import { SwitchOrgRQ } from "./rq/SwitchOrgRQ";
|
|
14
14
|
import { AuthRequest } from "./rq/AuthRequest";
|
|
@@ -91,7 +91,7 @@ export declare class AuthApi extends BaseApi {
|
|
|
91
91
|
* @param payload Payload
|
|
92
92
|
* @returns Result
|
|
93
93
|
*/
|
|
94
|
-
resetPassword(rq:
|
|
94
|
+
resetPassword(rq: ResetPasswordInputRQ, payload?: ResultPayload): Promise<IActionResult<{}> | undefined>;
|
|
95
95
|
/**
|
|
96
96
|
* Signout
|
|
97
97
|
* @param rq Request data
|
package/lib/cjs/api/AuthApi.js
CHANGED
|
@@ -51,7 +51,8 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
51
51
|
const rq = {
|
|
52
52
|
type,
|
|
53
53
|
openid: this.app.encrypt(openid),
|
|
54
|
-
deviceId: this.app.deviceId
|
|
54
|
+
deviceId: this.app.deviceId,
|
|
55
|
+
region: this.app.region
|
|
55
56
|
};
|
|
56
57
|
return this.api.post("Auth/CheckUserIdentifier", rq, payload);
|
|
57
58
|
}
|
|
@@ -164,7 +165,13 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
164
165
|
* @returns Result
|
|
165
166
|
*/
|
|
166
167
|
resetPassword(rq, payload) {
|
|
167
|
-
|
|
168
|
+
const data = {
|
|
169
|
+
...rq,
|
|
170
|
+
deviceId: this.app.deviceId,
|
|
171
|
+
region: this.app.region,
|
|
172
|
+
timezone: this.app.getTimeZone()
|
|
173
|
+
};
|
|
174
|
+
return this.api.put("Auth/ResetPassword", data, payload);
|
|
168
175
|
}
|
|
169
176
|
/**
|
|
170
177
|
* Signout
|
|
@@ -9,15 +9,19 @@ export type LoginRQ = LoginIdRQ & {
|
|
|
9
9
|
*/
|
|
10
10
|
pwd: string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Time zone
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
timezone: string;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Organization
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
org?: number;
|
|
19
19
|
/**
|
|
20
20
|
* Authorization request data
|
|
21
21
|
*/
|
|
22
22
|
auth?: AuthRequest;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Login input request data
|
|
26
|
+
*/
|
|
27
|
+
export type LoginInputRQ = Pick<LoginRQ, "id" | "pwd" | "org" | "auth">;
|
|
@@ -15,4 +15,12 @@ export type ResetPasswordRQ = {
|
|
|
15
15
|
* Country or region
|
|
16
16
|
*/
|
|
17
17
|
region: string;
|
|
18
|
+
/**
|
|
19
|
+
* Time zone
|
|
20
|
+
*/
|
|
21
|
+
timezone: string;
|
|
18
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Reset password input request data
|
|
25
|
+
*/
|
|
26
|
+
export type ResetPasswordInputRQ = Pick<ResetPasswordRQ, "id" | "password">;
|
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -543,7 +543,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
543
543
|
* Get time zone
|
|
544
544
|
* @returns Time zone
|
|
545
545
|
*/
|
|
546
|
-
getTimeZone(): string
|
|
546
|
+
getTimeZone(): string;
|
|
547
547
|
/**
|
|
548
548
|
* Hash message, SHA3 or HmacSHA512, 512 as Base64
|
|
549
549
|
* https://cryptojs.gitbook.io/docs/
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -1021,8 +1021,8 @@ class CoreApp {
|
|
|
1021
1021
|
* @returns string
|
|
1022
1022
|
*/
|
|
1023
1023
|
formatDate(input, options, timeZone) {
|
|
1024
|
-
const { currentCulture
|
|
1025
|
-
timeZone ?? (timeZone =
|
|
1024
|
+
const { currentCulture } = this.settings;
|
|
1025
|
+
timeZone ?? (timeZone = this.getTimeZone());
|
|
1026
1026
|
return shared_1.DateUtils.format(input, currentCulture.name, options, timeZone);
|
|
1027
1027
|
}
|
|
1028
1028
|
/**
|
|
@@ -1295,8 +1295,7 @@ class CoreApp {
|
|
|
1295
1295
|
* @returns Time zone
|
|
1296
1296
|
*/
|
|
1297
1297
|
getTimeZone() {
|
|
1298
|
-
|
|
1299
|
-
return this.settings.timeZone ?? this.ipData?.timezone;
|
|
1298
|
+
return this.settings.timeZone ?? shared_1.Utils.getTimeZone(this.ipData?.timezone);
|
|
1300
1299
|
}
|
|
1301
1300
|
/**
|
|
1302
1301
|
* Hash message, SHA3 or HmacSHA512, 512 as Base64
|
package/lib/cjs/app/IApp.d.ts
CHANGED
package/lib/mjs/api/AuthApi.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { TokenRQ } from "./rq/TokenRQ";
|
|
|
8
8
|
import { ApiRefreshTokenDto } from "./dto/ApiRefreshTokenDto";
|
|
9
9
|
import { GetLogInUrlRQ } from "./rq/GetLogInUrlRQ";
|
|
10
10
|
import { LoginRQ } from "./rq/LoginRQ";
|
|
11
|
-
import {
|
|
11
|
+
import { ResetPasswordInputRQ } from "./rq/ResetPasswordRQ";
|
|
12
12
|
import { SignoutRQ } from "./rq/SignoutRQ";
|
|
13
13
|
import { SwitchOrgRQ } from "./rq/SwitchOrgRQ";
|
|
14
14
|
import { AuthRequest } from "./rq/AuthRequest";
|
|
@@ -91,7 +91,7 @@ export declare class AuthApi extends BaseApi {
|
|
|
91
91
|
* @param payload Payload
|
|
92
92
|
* @returns Result
|
|
93
93
|
*/
|
|
94
|
-
resetPassword(rq:
|
|
94
|
+
resetPassword(rq: ResetPasswordInputRQ, payload?: ResultPayload): Promise<IActionResult<{}> | undefined>;
|
|
95
95
|
/**
|
|
96
96
|
* Signout
|
|
97
97
|
* @param rq Request data
|
package/lib/mjs/api/AuthApi.js
CHANGED
|
@@ -48,7 +48,8 @@ export class AuthApi extends BaseApi {
|
|
|
48
48
|
const rq = {
|
|
49
49
|
type,
|
|
50
50
|
openid: this.app.encrypt(openid),
|
|
51
|
-
deviceId: this.app.deviceId
|
|
51
|
+
deviceId: this.app.deviceId,
|
|
52
|
+
region: this.app.region
|
|
52
53
|
};
|
|
53
54
|
return this.api.post("Auth/CheckUserIdentifier", rq, payload);
|
|
54
55
|
}
|
|
@@ -161,7 +162,13 @@ export class AuthApi extends BaseApi {
|
|
|
161
162
|
* @returns Result
|
|
162
163
|
*/
|
|
163
164
|
resetPassword(rq, payload) {
|
|
164
|
-
|
|
165
|
+
const data = {
|
|
166
|
+
...rq,
|
|
167
|
+
deviceId: this.app.deviceId,
|
|
168
|
+
region: this.app.region,
|
|
169
|
+
timezone: this.app.getTimeZone()
|
|
170
|
+
};
|
|
171
|
+
return this.api.put("Auth/ResetPassword", data, payload);
|
|
165
172
|
}
|
|
166
173
|
/**
|
|
167
174
|
* Signout
|
|
@@ -9,15 +9,19 @@ export type LoginRQ = LoginIdRQ & {
|
|
|
9
9
|
*/
|
|
10
10
|
pwd: string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Time zone
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
timezone: string;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Organization
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
org?: number;
|
|
19
19
|
/**
|
|
20
20
|
* Authorization request data
|
|
21
21
|
*/
|
|
22
22
|
auth?: AuthRequest;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Login input request data
|
|
26
|
+
*/
|
|
27
|
+
export type LoginInputRQ = Pick<LoginRQ, "id" | "pwd" | "org" | "auth">;
|
|
@@ -15,4 +15,12 @@ export type ResetPasswordRQ = {
|
|
|
15
15
|
* Country or region
|
|
16
16
|
*/
|
|
17
17
|
region: string;
|
|
18
|
+
/**
|
|
19
|
+
* Time zone
|
|
20
|
+
*/
|
|
21
|
+
timezone: string;
|
|
18
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Reset password input request data
|
|
25
|
+
*/
|
|
26
|
+
export type ResetPasswordInputRQ = Pick<ResetPasswordRQ, "id" | "password">;
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -543,7 +543,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
543
543
|
* Get time zone
|
|
544
544
|
* @returns Time zone
|
|
545
545
|
*/
|
|
546
|
-
getTimeZone(): string
|
|
546
|
+
getTimeZone(): string;
|
|
547
547
|
/**
|
|
548
548
|
* Hash message, SHA3 or HmacSHA512, 512 as Base64
|
|
549
549
|
* https://cryptojs.gitbook.io/docs/
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -1018,8 +1018,8 @@ export class CoreApp {
|
|
|
1018
1018
|
* @returns string
|
|
1019
1019
|
*/
|
|
1020
1020
|
formatDate(input, options, timeZone) {
|
|
1021
|
-
const { currentCulture
|
|
1022
|
-
timeZone ?? (timeZone =
|
|
1021
|
+
const { currentCulture } = this.settings;
|
|
1022
|
+
timeZone ?? (timeZone = this.getTimeZone());
|
|
1023
1023
|
return DateUtils.format(input, currentCulture.name, options, timeZone);
|
|
1024
1024
|
}
|
|
1025
1025
|
/**
|
|
@@ -1292,8 +1292,7 @@ export class CoreApp {
|
|
|
1292
1292
|
* @returns Time zone
|
|
1293
1293
|
*/
|
|
1294
1294
|
getTimeZone() {
|
|
1295
|
-
|
|
1296
|
-
return this.settings.timeZone ?? this.ipData?.timezone;
|
|
1295
|
+
return this.settings.timeZone ?? Utils.getTimeZone(this.ipData?.timezone);
|
|
1297
1296
|
}
|
|
1298
1297
|
/**
|
|
1299
1298
|
* Hash message, SHA3 or HmacSHA512, 512 as Base64
|
package/lib/mjs/app/IApp.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.96",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/ETSOO/AppScript#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@etsoo/notificationbase": "^1.1.
|
|
39
|
-
"@etsoo/restclient": "^1.1.
|
|
40
|
-
"@etsoo/shared": "^1.2.
|
|
38
|
+
"@etsoo/notificationbase": "^1.1.58",
|
|
39
|
+
"@etsoo/restclient": "^1.1.23",
|
|
40
|
+
"@etsoo/shared": "^1.2.60",
|
|
41
41
|
"crypto-js": "^4.2.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@babel/cli": "^7.26.4",
|
|
45
|
-
"@babel/core": "^7.26.
|
|
45
|
+
"@babel/core": "^7.26.7",
|
|
46
46
|
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
47
|
-
"@babel/preset-env": "^7.26.
|
|
48
|
-
"@babel/runtime-corejs3": "^7.26.
|
|
47
|
+
"@babel/preset-env": "^7.26.7",
|
|
48
|
+
"@babel/runtime-corejs3": "^7.26.7",
|
|
49
49
|
"@types/crypto-js": "^4.2.2",
|
|
50
50
|
"@vitejs/plugin-react": "^4.3.4",
|
|
51
51
|
"jsdom": "^26.0.0",
|
package/src/api/AuthApi.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { GetLogInUrlRQ } from "./rq/GetLogInUrlRQ";
|
|
|
10
10
|
import { LoginRQ } from "./rq/LoginRQ";
|
|
11
11
|
import { LoginIdRQ } from "./rq/LoginIdRQ";
|
|
12
12
|
import { RefreshTokenRQ } from "./rq/RefreshTokenRQ";
|
|
13
|
-
import { ResetPasswordRQ } from "./rq/ResetPasswordRQ";
|
|
13
|
+
import { ResetPasswordInputRQ, ResetPasswordRQ } from "./rq/ResetPasswordRQ";
|
|
14
14
|
import { SignoutRQ } from "./rq/SignoutRQ";
|
|
15
15
|
import { SwitchOrgRQ } from "./rq/SwitchOrgRQ";
|
|
16
16
|
import { AuthRequest } from "./rq/AuthRequest";
|
|
@@ -81,7 +81,8 @@ export class AuthApi extends BaseApi {
|
|
|
81
81
|
const rq: CheckUserIdentifierRQ = {
|
|
82
82
|
type,
|
|
83
83
|
openid: this.app.encrypt(openid),
|
|
84
|
-
deviceId: this.app.deviceId
|
|
84
|
+
deviceId: this.app.deviceId,
|
|
85
|
+
region: this.app.region
|
|
85
86
|
};
|
|
86
87
|
return this.api.post("Auth/CheckUserIdentifier", rq, payload);
|
|
87
88
|
}
|
|
@@ -222,8 +223,14 @@ export class AuthApi extends BaseApi {
|
|
|
222
223
|
* @param payload Payload
|
|
223
224
|
* @returns Result
|
|
224
225
|
*/
|
|
225
|
-
resetPassword(rq:
|
|
226
|
-
|
|
226
|
+
resetPassword(rq: ResetPasswordInputRQ, payload?: ResultPayload) {
|
|
227
|
+
const data: ResetPasswordRQ = {
|
|
228
|
+
...rq,
|
|
229
|
+
deviceId: this.app.deviceId,
|
|
230
|
+
region: this.app.region,
|
|
231
|
+
timezone: this.app.getTimeZone()
|
|
232
|
+
};
|
|
233
|
+
return this.api.put("Auth/ResetPassword", data, payload);
|
|
227
234
|
}
|
|
228
235
|
|
|
229
236
|
/**
|
package/src/api/rq/LoginRQ.ts
CHANGED
|
@@ -11,17 +11,22 @@ export type LoginRQ = LoginIdRQ & {
|
|
|
11
11
|
pwd: string;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Time zone
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
timezone: string;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Organization
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
org?: number;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Authorization request data
|
|
25
25
|
*/
|
|
26
26
|
auth?: AuthRequest;
|
|
27
27
|
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Login input request data
|
|
31
|
+
*/
|
|
32
|
+
export type LoginInputRQ = Pick<LoginRQ, "id" | "pwd" | "org" | "auth">;
|
|
@@ -18,4 +18,14 @@ export type ResetPasswordRQ = {
|
|
|
18
18
|
* Country or region
|
|
19
19
|
*/
|
|
20
20
|
region: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Time zone
|
|
24
|
+
*/
|
|
25
|
+
timezone: string;
|
|
21
26
|
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Reset password input request data
|
|
30
|
+
*/
|
|
31
|
+
export type ResetPasswordInputRQ = Pick<ResetPasswordRQ, "id" | "password">;
|
package/src/app/AppSettings.ts
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -1473,8 +1473,8 @@ export abstract class CoreApp<
|
|
|
1473
1473
|
options?: DateUtils.FormatOptions,
|
|
1474
1474
|
timeZone?: string
|
|
1475
1475
|
) {
|
|
1476
|
-
const { currentCulture
|
|
1477
|
-
timeZone ??=
|
|
1476
|
+
const { currentCulture } = this.settings;
|
|
1477
|
+
timeZone ??= this.getTimeZone();
|
|
1478
1478
|
return DateUtils.format(input, currentCulture.name, options, timeZone);
|
|
1479
1479
|
}
|
|
1480
1480
|
|
|
@@ -1796,9 +1796,8 @@ export abstract class CoreApp<
|
|
|
1796
1796
|
* Get time zone
|
|
1797
1797
|
* @returns Time zone
|
|
1798
1798
|
*/
|
|
1799
|
-
getTimeZone()
|
|
1800
|
-
|
|
1801
|
-
return this.settings.timeZone ?? this.ipData?.timezone;
|
|
1799
|
+
getTimeZone() {
|
|
1800
|
+
return this.settings.timeZone ?? Utils.getTimeZone(this.ipData?.timezone);
|
|
1802
1801
|
}
|
|
1803
1802
|
|
|
1804
1803
|
/**
|