@etsoo/appscript 1.6.10 → 1.6.12
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/lib/cjs/api/AuthApi.d.ts +5 -2
- package/lib/cjs/api/AuthApi.js +8 -2
- package/lib/cjs/api/rq/LoginIdRQ.d.ts +10 -5
- package/lib/cjs/api/rq/LoginRQ.d.ts +14 -5
- package/lib/mjs/api/AuthApi.d.ts +5 -2
- package/lib/mjs/api/AuthApi.js +8 -2
- package/lib/mjs/api/rq/LoginIdRQ.d.ts +10 -5
- package/lib/mjs/api/rq/LoginRQ.d.ts +14 -5
- package/package.json +1 -1
- package/src/api/AuthApi.ts +15 -6
- package/src/api/rq/LoginIdRQ.ts +11 -6
- package/src/api/rq/LoginRQ.ts +15 -5
package/lib/cjs/api/AuthApi.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { DataTypes, IActionResult } from "@etsoo/shared";
|
|
|
6
6
|
import { RefreshTokenProps, RefreshTokenResult } from "../app/IApp";
|
|
7
7
|
import { TokenInputRQ } from "./rq/TokenRQ";
|
|
8
8
|
import { ApiRefreshTokenDto } from "./dto/ApiRefreshTokenDto";
|
|
9
|
-
import {
|
|
9
|
+
import { LoginInputAuthResult, LoginInputRQ } from "./rq/LoginRQ";
|
|
10
10
|
import { ResetPasswordInputRQ } from "./rq/ResetPasswordRQ";
|
|
11
11
|
import { SignoutRQ } from "./rq/SignoutRQ";
|
|
12
12
|
import { SwitchOrgRQ } from "./rq/SwitchOrgRQ";
|
|
@@ -71,7 +71,10 @@ export declare class AuthApi extends BaseApi {
|
|
|
71
71
|
* @param tokenKey Refresh token key
|
|
72
72
|
* @returns Result
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
login<T extends IUser>(rq: LoginInputRQ, payload?: IApiPayload<IActionResult<T | LoginInputAuthResult>>, tokenKey?: string): Promise<[
|
|
75
|
+
IActionResult<T | LoginInputAuthResult> | undefined,
|
|
76
|
+
string | null
|
|
77
|
+
]>;
|
|
75
78
|
/**
|
|
76
79
|
* Login id check
|
|
77
80
|
* @param id Check id
|
package/lib/cjs/api/AuthApi.js
CHANGED
|
@@ -88,12 +88,18 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
88
88
|
* @param tokenKey Refresh token key
|
|
89
89
|
* @returns Result
|
|
90
90
|
*/
|
|
91
|
-
async
|
|
91
|
+
async login(rq, payload, tokenKey) {
|
|
92
92
|
// Default values
|
|
93
93
|
payload ?? (payload = {});
|
|
94
94
|
tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
|
|
95
|
+
const data = {
|
|
96
|
+
...rq,
|
|
97
|
+
deviceId: this.app.deviceId,
|
|
98
|
+
region: this.app.region,
|
|
99
|
+
timeZone: this.app.getTimeZone()
|
|
100
|
+
};
|
|
95
101
|
// Call the API
|
|
96
|
-
const result = await this.api.post("Auth/Login",
|
|
102
|
+
const result = await this.api.post("Auth/Login", data, payload);
|
|
97
103
|
// Get the refresh token
|
|
98
104
|
const refreshToken = result?.ok
|
|
99
105
|
? this.app.getResponseToken(payload.response, tokenKey)
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Login id input request data
|
|
3
|
+
*/
|
|
4
|
+
export type LoginIdInputRQ = {
|
|
5
|
+
/**
|
|
6
|
+
* Username, Email or mobile
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
* Login id request data
|
|
3
12
|
*/
|
|
4
|
-
export type LoginIdRQ = {
|
|
13
|
+
export type LoginIdRQ = LoginIdInputRQ & {
|
|
5
14
|
/**
|
|
6
15
|
* Device id
|
|
7
16
|
*/
|
|
8
17
|
deviceId: string;
|
|
9
|
-
/**
|
|
10
|
-
* Username, Email or mobile
|
|
11
|
-
*/
|
|
12
|
-
id: string;
|
|
13
18
|
/**
|
|
14
19
|
* Country or region
|
|
15
20
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthRequest } from "./AuthRequest";
|
|
2
|
-
import { LoginIdRQ } from "./LoginIdRQ";
|
|
2
|
+
import { LoginIdInputRQ, LoginIdRQ } from "./LoginIdRQ";
|
|
3
3
|
/**
|
|
4
|
-
* Login request data
|
|
4
|
+
* Login input request data
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type LoginInputRQ = LoginIdInputRQ & {
|
|
7
7
|
/**
|
|
8
8
|
* Password
|
|
9
9
|
*/
|
|
@@ -18,6 +18,15 @@ export type LoginRQ = LoginIdRQ & {
|
|
|
18
18
|
auth?: AuthRequest;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* Login input
|
|
21
|
+
* Login input auth result
|
|
22
|
+
*/
|
|
23
|
+
export type LoginInputAuthResult = {
|
|
24
|
+
/**
|
|
25
|
+
* Redirect URI
|
|
26
|
+
*/
|
|
27
|
+
uri: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Login request data
|
|
22
31
|
*/
|
|
23
|
-
export type
|
|
32
|
+
export type LoginRQ = LoginIdRQ & LoginInputRQ;
|
package/lib/mjs/api/AuthApi.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { DataTypes, IActionResult } from "@etsoo/shared";
|
|
|
6
6
|
import { RefreshTokenProps, RefreshTokenResult } from "../app/IApp";
|
|
7
7
|
import { TokenInputRQ } from "./rq/TokenRQ";
|
|
8
8
|
import { ApiRefreshTokenDto } from "./dto/ApiRefreshTokenDto";
|
|
9
|
-
import {
|
|
9
|
+
import { LoginInputAuthResult, LoginInputRQ } from "./rq/LoginRQ";
|
|
10
10
|
import { ResetPasswordInputRQ } from "./rq/ResetPasswordRQ";
|
|
11
11
|
import { SignoutRQ } from "./rq/SignoutRQ";
|
|
12
12
|
import { SwitchOrgRQ } from "./rq/SwitchOrgRQ";
|
|
@@ -71,7 +71,10 @@ export declare class AuthApi extends BaseApi {
|
|
|
71
71
|
* @param tokenKey Refresh token key
|
|
72
72
|
* @returns Result
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
login<T extends IUser>(rq: LoginInputRQ, payload?: IApiPayload<IActionResult<T | LoginInputAuthResult>>, tokenKey?: string): Promise<[
|
|
75
|
+
IActionResult<T | LoginInputAuthResult> | undefined,
|
|
76
|
+
string | null
|
|
77
|
+
]>;
|
|
75
78
|
/**
|
|
76
79
|
* Login id check
|
|
77
80
|
* @param id Check id
|
package/lib/mjs/api/AuthApi.js
CHANGED
|
@@ -85,12 +85,18 @@ export class AuthApi extends BaseApi {
|
|
|
85
85
|
* @param tokenKey Refresh token key
|
|
86
86
|
* @returns Result
|
|
87
87
|
*/
|
|
88
|
-
async
|
|
88
|
+
async login(rq, payload, tokenKey) {
|
|
89
89
|
// Default values
|
|
90
90
|
payload ?? (payload = {});
|
|
91
91
|
tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
|
|
92
|
+
const data = {
|
|
93
|
+
...rq,
|
|
94
|
+
deviceId: this.app.deviceId,
|
|
95
|
+
region: this.app.region,
|
|
96
|
+
timeZone: this.app.getTimeZone()
|
|
97
|
+
};
|
|
92
98
|
// Call the API
|
|
93
|
-
const result = await this.api.post("Auth/Login",
|
|
99
|
+
const result = await this.api.post("Auth/Login", data, payload);
|
|
94
100
|
// Get the refresh token
|
|
95
101
|
const refreshToken = result?.ok
|
|
96
102
|
? this.app.getResponseToken(payload.response, tokenKey)
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Login id input request data
|
|
3
|
+
*/
|
|
4
|
+
export type LoginIdInputRQ = {
|
|
5
|
+
/**
|
|
6
|
+
* Username, Email or mobile
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
* Login id request data
|
|
3
12
|
*/
|
|
4
|
-
export type LoginIdRQ = {
|
|
13
|
+
export type LoginIdRQ = LoginIdInputRQ & {
|
|
5
14
|
/**
|
|
6
15
|
* Device id
|
|
7
16
|
*/
|
|
8
17
|
deviceId: string;
|
|
9
|
-
/**
|
|
10
|
-
* Username, Email or mobile
|
|
11
|
-
*/
|
|
12
|
-
id: string;
|
|
13
18
|
/**
|
|
14
19
|
* Country or region
|
|
15
20
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthRequest } from "./AuthRequest";
|
|
2
|
-
import { LoginIdRQ } from "./LoginIdRQ";
|
|
2
|
+
import { LoginIdInputRQ, LoginIdRQ } from "./LoginIdRQ";
|
|
3
3
|
/**
|
|
4
|
-
* Login request data
|
|
4
|
+
* Login input request data
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type LoginInputRQ = LoginIdInputRQ & {
|
|
7
7
|
/**
|
|
8
8
|
* Password
|
|
9
9
|
*/
|
|
@@ -18,6 +18,15 @@ export type LoginRQ = LoginIdRQ & {
|
|
|
18
18
|
auth?: AuthRequest;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
* Login input
|
|
21
|
+
* Login input auth result
|
|
22
|
+
*/
|
|
23
|
+
export type LoginInputAuthResult = {
|
|
24
|
+
/**
|
|
25
|
+
* Redirect URI
|
|
26
|
+
*/
|
|
27
|
+
uri: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Login request data
|
|
22
31
|
*/
|
|
23
|
-
export type
|
|
32
|
+
export type LoginRQ = LoginIdRQ & LoginInputRQ;
|
package/package.json
CHANGED
package/src/api/AuthApi.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { RefreshTokenProps, RefreshTokenResult } from "../app/IApp";
|
|
|
7
7
|
import { TokenInputRQ, TokenRQ } from "./rq/TokenRQ";
|
|
8
8
|
import { ApiRefreshTokenDto } from "./dto/ApiRefreshTokenDto";
|
|
9
9
|
import { GetLogInUrlRQ } from "./rq/GetLogInUrlRQ";
|
|
10
|
-
import { LoginRQ } from "./rq/LoginRQ";
|
|
10
|
+
import { LoginInputAuthResult, LoginInputRQ, LoginRQ } from "./rq/LoginRQ";
|
|
11
11
|
import { LoginIdRQ } from "./rq/LoginIdRQ";
|
|
12
12
|
import { RefreshTokenRQ } from "./rq/RefreshTokenRQ";
|
|
13
13
|
import { ResetPasswordInputRQ, ResetPasswordRQ } from "./rq/ResetPasswordRQ";
|
|
@@ -125,17 +125,26 @@ export class AuthApi extends BaseApi {
|
|
|
125
125
|
* @param tokenKey Refresh token key
|
|
126
126
|
* @returns Result
|
|
127
127
|
*/
|
|
128
|
-
|
|
129
|
-
rq:
|
|
130
|
-
payload?: IApiPayload<IActionResult<T>>,
|
|
128
|
+
async login<T extends IUser>(
|
|
129
|
+
rq: LoginInputRQ,
|
|
130
|
+
payload?: IApiPayload<IActionResult<T | LoginInputAuthResult>>,
|
|
131
131
|
tokenKey?: string
|
|
132
|
-
): Promise<
|
|
132
|
+
): Promise<
|
|
133
|
+
[IActionResult<T | LoginInputAuthResult> | undefined, string | null]
|
|
134
|
+
> {
|
|
133
135
|
// Default values
|
|
134
136
|
payload ??= {};
|
|
135
137
|
tokenKey ??= AuthApi.HeaderTokenField;
|
|
136
138
|
|
|
139
|
+
const data: LoginRQ = {
|
|
140
|
+
...rq,
|
|
141
|
+
deviceId: this.app.deviceId,
|
|
142
|
+
region: this.app.region,
|
|
143
|
+
timeZone: this.app.getTimeZone()
|
|
144
|
+
};
|
|
145
|
+
|
|
137
146
|
// Call the API
|
|
138
|
-
const result = await this.api.post("Auth/Login",
|
|
147
|
+
const result = await this.api.post("Auth/Login", data, payload);
|
|
139
148
|
|
|
140
149
|
// Get the refresh token
|
|
141
150
|
const refreshToken = result?.ok
|
package/src/api/rq/LoginIdRQ.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Login id request data
|
|
2
|
+
* Login id input request data
|
|
3
3
|
*/
|
|
4
|
-
export type
|
|
4
|
+
export type LoginIdInputRQ = {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Username, Email or mobile
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Login id request data
|
|
13
|
+
*/
|
|
14
|
+
export type LoginIdRQ = LoginIdInputRQ & {
|
|
10
15
|
/**
|
|
11
|
-
*
|
|
16
|
+
* Device id
|
|
12
17
|
*/
|
|
13
|
-
|
|
18
|
+
deviceId: string;
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* Country or region
|
package/src/api/rq/LoginRQ.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AuthRequest } from "./AuthRequest";
|
|
2
|
-
import { LoginIdRQ } from "./LoginIdRQ";
|
|
2
|
+
import { LoginIdInputRQ, LoginIdRQ } from "./LoginIdRQ";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Login request data
|
|
5
|
+
* Login input request data
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type LoginInputRQ = LoginIdInputRQ & {
|
|
8
8
|
/**
|
|
9
9
|
* Password
|
|
10
10
|
*/
|
|
@@ -22,6 +22,16 @@ export type LoginRQ = LoginIdRQ & {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Login input
|
|
25
|
+
* Login input auth result
|
|
26
|
+
*/
|
|
27
|
+
export type LoginInputAuthResult = {
|
|
28
|
+
/**
|
|
29
|
+
* Redirect URI
|
|
30
|
+
*/
|
|
31
|
+
uri: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Login request data
|
|
26
36
|
*/
|
|
27
|
-
export type
|
|
37
|
+
export type LoginRQ = LoginIdRQ & LoginInputRQ;
|