@drax/identity-front 0.37.1 → 0.39.0
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/package.json +5 -5
- package/src/index.ts +2 -2
- package/src/interfaces/{IAuthUser.ts → IAuthFullUser.ts} +2 -2
- package/src/interfaces/IAuthProvider.ts +2 -2
- package/src/providers/gql/AuthGqlProvider.ts +2 -2
- package/src/providers/rest/AuthRestProvider.ts +3 -3
- package/src/system/AuthSystem.ts +3 -3
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.39.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"format": "prettier --write src/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@drax/common-front": "^0.
|
|
29
|
-
"@drax/crud-share": "^0.
|
|
30
|
-
"@drax/identity-share": "^0.
|
|
28
|
+
"@drax/common-front": "^0.39.0",
|
|
29
|
+
"@drax/crud-share": "^0.39.0",
|
|
30
|
+
"@drax/identity-share": "^0.39.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"vite-plugin-dts": "^3.9.1",
|
|
50
50
|
"vitest": "^1.4.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "b019c40f954cf60e4ff61c53e27d5bafaea6f16c"
|
|
53
53
|
}
|
package/src/index.ts
CHANGED
|
@@ -47,7 +47,7 @@ import type {IUserProvider} from "./interfaces/IUserProvider"
|
|
|
47
47
|
import type {IRoleProvider} from "./interfaces/IRoleProvider"
|
|
48
48
|
import type {ITenantProvider} from "./interfaces/ITenantProvider"
|
|
49
49
|
import type {IUserApiKeyProvider} from "./interfaces/IUserApiKeyProvider"
|
|
50
|
-
import type {
|
|
50
|
+
import type {IAuthFullUser} from "./interfaces/IAuthFullUser"
|
|
51
51
|
import type {IUserPassword} from "./interfaces/IUserPassword"
|
|
52
52
|
import type {ILoginResponse} from "./interfaces/ILoginResponse"
|
|
53
53
|
import type {IUserRegistration} from "./interfaces/IUserRegistration"
|
|
@@ -58,7 +58,7 @@ export type {
|
|
|
58
58
|
IRoleProvider,
|
|
59
59
|
ITenantProvider,
|
|
60
60
|
IUserApiKeyProvider,
|
|
61
|
-
|
|
61
|
+
IAuthFullUser,
|
|
62
62
|
IUserPassword,
|
|
63
63
|
ILoginResponse,
|
|
64
64
|
IUserRegistration
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {IRole, ITenant} from "@drax/identity-share";
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface IAuthFullUser {
|
|
4
4
|
id: string
|
|
5
5
|
username: string
|
|
6
6
|
email: string
|
|
@@ -12,4 +12,4 @@ interface IAuthUser {
|
|
|
12
12
|
tenant?: ITenant
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export type {
|
|
15
|
+
export type {IAuthFullUser}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {IAuthFullUser} from "./IAuthFullUser";
|
|
2
2
|
import type {ILoginResponse} from "./ILoginResponse";
|
|
3
3
|
import type {IUserRegistration} from "./IUserRegistration";
|
|
4
4
|
|
|
5
5
|
interface IAuthProvider {
|
|
6
6
|
login(username: string, password: string): Promise<ILoginResponse>
|
|
7
|
-
me(): Promise<
|
|
7
|
+
me(): Promise<IAuthFullUser>
|
|
8
8
|
switchTenant(tenantId: string): Promise<ILoginResponse>
|
|
9
9
|
logout(): void
|
|
10
10
|
changeOwnPassword(currentPassword:string, newPassword:string):Promise<boolean>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {IGqlClient} from '@drax/common-front'
|
|
2
2
|
import type {IAuthProvider} from "../../interfaces/IAuthProvider.ts";
|
|
3
|
-
import type {
|
|
3
|
+
import type {IAuthFullUser} from "../../interfaces/IAuthFullUser";
|
|
4
4
|
import type {ILoginResponse} from "../../interfaces/ILoginResponse";
|
|
5
5
|
import type {IUserRegistration} from "../../interfaces/IUserRegistration";
|
|
6
6
|
|
|
@@ -43,7 +43,7 @@ class AuthGqlProvider implements IAuthProvider {
|
|
|
43
43
|
return {accessToken}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
async me(): Promise<
|
|
46
|
+
async me(): Promise<IAuthFullUser> {
|
|
47
47
|
const query: string = `query me { me {id, username, email, phone, role {id, name, permissions}, avatar} }`
|
|
48
48
|
let data = await this.gqlClient.query(query)
|
|
49
49
|
return data.me
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import type {IHttpClient} from '@drax/common-front'
|
|
3
3
|
import type {IAuthProvider} from "../../interfaces/IAuthProvider";
|
|
4
|
-
import type {
|
|
4
|
+
import type {IAuthFullUser} from "../../interfaces/IAuthFullUser";
|
|
5
5
|
import type {ILoginResponse} from "../../interfaces/ILoginResponse";
|
|
6
6
|
import type {IUserRegistration} from "../../interfaces/IUserRegistration";
|
|
7
7
|
|
|
@@ -42,9 +42,9 @@ class AuthRestProvider implements IAuthProvider {
|
|
|
42
42
|
this.removeHttpClientToken()
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
async me(): Promise<
|
|
45
|
+
async me(): Promise<IAuthFullUser> {
|
|
46
46
|
const url = '/api/auth/me'
|
|
47
|
-
let r = await this.httpClient.get(url) as
|
|
47
|
+
let r = await this.httpClient.get(url) as IAuthFullUser
|
|
48
48
|
return r
|
|
49
49
|
}
|
|
50
50
|
|
package/src/system/AuthSystem.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {IAuthProvider} from "../interfaces/IAuthProvider";
|
|
2
|
-
import type {
|
|
2
|
+
import type {IAuthFullUser} from "../interfaces/IAuthFullUser";
|
|
3
3
|
import type {ILoginResponse} from "../interfaces/ILoginResponse";
|
|
4
4
|
import type {IUserRegistration} from "../interfaces/IUserRegistration";
|
|
5
5
|
|
|
@@ -26,8 +26,8 @@ class AuthSystem implements IAuthProvider {
|
|
|
26
26
|
this._provider.logout()
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
async me():Promise<
|
|
30
|
-
const authUser:
|
|
29
|
+
async me():Promise<IAuthFullUser> {
|
|
30
|
+
const authUser: IAuthFullUser = await this._provider.me()
|
|
31
31
|
return authUser
|
|
32
32
|
}
|
|
33
33
|
|