@drax/identity-front 0.0.20 → 0.0.21
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 +3 -3
- package/src/index.ts +5 -7
- package/src/interfaces/IRole.ts +12 -3
- package/src/interfaces/IRoleProvider.ts +5 -5
- package/src/interfaces/ITenant.ts +7 -3
- package/src/interfaces/ITenantProvider.ts +5 -5
- package/src/interfaces/IUser.ts +2 -2
- package/src/interfaces/IUserProvider.ts +1 -1
- package/src/providers/gql/RoleGqlProvider.ts +5 -5
- package/src/providers/gql/TenantGqlProvider.ts +2 -2
- package/src/providers/gql/UserGqlProvider.ts +2 -2
- package/src/providers/rest/RoleRestProvider.ts +5 -5
- package/src/providers/rest/TenantRestProvider.ts +2 -2
- package/src/providers/rest/UserRestProvider.ts +2 -2
- package/src/system/RoleSystem.ts +4 -4
- package/src/system/TenantSystem.ts +4 -4
- package/src/system/UserSystem.ts +1 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.21",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/common-front": "^0.0.
|
|
27
|
+
"@drax/common-front": "^0.0.21"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"vite-plugin-dts": "^3.9.1",
|
|
47
47
|
"vitest": "^1.4.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e69a9b3d6123e94549678dc865b9ba9ffe9816c9"
|
|
50
50
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,8 +29,8 @@ import type {IRoleProvider} from "./interfaces/IRoleProvider"
|
|
|
29
29
|
import type {ITenantProvider} from "./interfaces/ITenantProvider"
|
|
30
30
|
import type {IAuthUser} from "./interfaces/IAuthUser"
|
|
31
31
|
import type {IUser, IUserCreate, IUserUpdate, IUserPassword} from "./interfaces/IUser"
|
|
32
|
-
import type {IRole} from "./interfaces/IRole"
|
|
33
|
-
import type {ITenant} from "./interfaces/ITenant"
|
|
32
|
+
import type {IRole, IRoleBase} from "./interfaces/IRole"
|
|
33
|
+
import type {ITenant, ITenantBase} from "./interfaces/ITenant"
|
|
34
34
|
import type {ILoginResponse} from "./interfaces/ILoginResponse"
|
|
35
35
|
|
|
36
36
|
export type {
|
|
@@ -39,12 +39,10 @@ export type {
|
|
|
39
39
|
IRoleProvider,
|
|
40
40
|
ITenantProvider,
|
|
41
41
|
IAuthUser,
|
|
42
|
-
IUser,
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
IUser, IUserCreate, IUserUpdate,
|
|
43
|
+
IRole, IRoleBase,
|
|
44
|
+
ITenant, ITenantBase,
|
|
45
45
|
IUserPassword,
|
|
46
|
-
IRole,
|
|
47
|
-
ITenant,
|
|
48
46
|
ILoginResponse
|
|
49
47
|
}
|
|
50
48
|
|
package/src/interfaces/IRole.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
interface IRoleBase{
|
|
2
|
+
name: string
|
|
3
|
+
permissions: string[]
|
|
4
|
+
childRoles: string[]
|
|
5
|
+
readonly: boolean
|
|
6
|
+
}
|
|
1
7
|
|
|
2
8
|
interface IRole{
|
|
3
|
-
id
|
|
9
|
+
id : string
|
|
4
10
|
name: string
|
|
5
11
|
permissions: string[]
|
|
6
|
-
childRoles
|
|
12
|
+
childRoles: IRole[]
|
|
7
13
|
readonly: boolean
|
|
8
14
|
}
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export type {IRole, IRoleBase}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {IRole} from "./IRole";
|
|
1
|
+
import type {IRole, IRoleBase} from "./IRole";
|
|
2
2
|
import type {IPaginateClient} from "@drax/common-front";
|
|
3
3
|
|
|
4
4
|
interface IRoleProvider {
|
|
5
|
-
fetchRole(): Promise<
|
|
5
|
+
fetchRole(): Promise<IRole[]>
|
|
6
6
|
fetchPermissions(): Promise<any>
|
|
7
|
-
paginateRole(page: number, limit: number, search:string): Promise<IPaginateClient
|
|
8
|
-
createRole(input:
|
|
9
|
-
editRole(id: string, input:
|
|
7
|
+
paginateRole(page: number, limit: number, search:string): Promise<IPaginateClient<IRole>>
|
|
8
|
+
createRole(input: IRoleBase): Promise<IRole>
|
|
9
|
+
editRole(id: string, input: IRoleBase): Promise<IRole>
|
|
10
10
|
deleteRole(id: string): Promise<any>
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {ITenant} from "./ITenant";
|
|
1
|
+
import type {ITenant, ITenantBase} from "./ITenant";
|
|
2
2
|
import type {IPaginateClient} from "@drax/common-front";
|
|
3
3
|
|
|
4
4
|
interface ITenantProvider {
|
|
5
|
-
fetchTenant(): Promise<
|
|
6
|
-
paginateTenant(page: number, limit: number, search:string): Promise<IPaginateClient
|
|
7
|
-
createTenant(input:
|
|
8
|
-
editTenant(id: string, input:
|
|
5
|
+
fetchTenant(): Promise<ITenant[]>
|
|
6
|
+
paginateTenant(page: number, limit: number, search:string): Promise<IPaginateClient<ITenant>>
|
|
7
|
+
createTenant(input: ITenantBase): Promise<ITenant>
|
|
8
|
+
editTenant(id: string, input: ITenantBase): Promise<ITenant>
|
|
9
9
|
deleteTenant(id: string): Promise<any>
|
|
10
10
|
}
|
|
11
11
|
|
package/src/interfaces/IUser.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {IPaginateClient} from "@drax/common-front";
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
interface IUserProvider {
|
|
7
|
-
paginateUser(page: number, limit: number, search?:string): Promise<IPaginateClient
|
|
7
|
+
paginateUser(page: number, limit: number, search?:string): Promise<IPaginateClient<IUser>>
|
|
8
8
|
createUser(input: IUserCreate): Promise<IUser>
|
|
9
9
|
editUser(id: string, input: IUserUpdate): Promise<IUser>
|
|
10
10
|
deleteUser(id: string): Promise<any>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {IGqlClient, IPaginateClient} from '@drax/common-front'
|
|
2
2
|
import type {IRoleProvider} from "../../interfaces/IRoleProvider";
|
|
3
|
-
import type {IRole} from "../../interfaces/IRole";
|
|
3
|
+
import type {IRole, IRoleBase} from "../../interfaces/IRole";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class RoleGqlProvider implements IRoleProvider {
|
|
@@ -26,14 +26,14 @@ class RoleGqlProvider implements IRoleProvider {
|
|
|
26
26
|
return data.fetchPermissions
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
async fetchRole(): Promise<
|
|
29
|
+
async fetchRole(): Promise<IRole[]> {
|
|
30
30
|
const query: string = `query fetchRole { fetchRole { id name permissions childRoles{id name} readonly } }`
|
|
31
31
|
const variables = {}
|
|
32
32
|
let data = await this.gqlClient.query(query, variables)
|
|
33
33
|
return data.fetchRole
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
async createRole(payload:
|
|
36
|
+
async createRole(payload: IRoleBase): Promise<IRole> {
|
|
37
37
|
const query: string = `mutation createRole($input: RoleInput) {
|
|
38
38
|
createRole(input: $input) {id name permissions childRoles{id name} readonly }
|
|
39
39
|
}`
|
|
@@ -42,7 +42,7 @@ class RoleGqlProvider implements IRoleProvider {
|
|
|
42
42
|
return data.createRole
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
async editRole(id: string, payload:
|
|
45
|
+
async editRole(id: string, payload: IRoleBase): Promise<IRole> {
|
|
46
46
|
const query: string = `mutation updateRole($id: ID!, $input: RoleInput) { updateRole(id: $id, input: $input) {
|
|
47
47
|
id name permissions childRoles{id name} readonly } }`
|
|
48
48
|
const variables = {id, input: payload}
|
|
@@ -57,7 +57,7 @@ class RoleGqlProvider implements IRoleProvider {
|
|
|
57
57
|
return data.createRole
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
async paginateRole(page: number, limit: number, search:string = ""): Promise<IPaginateClient
|
|
60
|
+
async paginateRole(page: number, limit: number, search:string = ""): Promise<IPaginateClient<IRole>> {
|
|
61
61
|
const query: string = `query paginateRole($page: Int, $limit: Int, $search:String) {
|
|
62
62
|
paginateRole(page: $page, limit: $limit, search: $search) {
|
|
63
63
|
total, page, limit, items{id name permissions childRoles{id name} readonly }
|
|
@@ -20,7 +20,7 @@ class TenantGqlProvider implements ITenantProvider {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
async fetchTenant(): Promise<
|
|
23
|
+
async fetchTenant(): Promise<ITenant[]> {
|
|
24
24
|
const query: string = `query fetchTenant { fetchTenant { id name } }`
|
|
25
25
|
const variables = {}
|
|
26
26
|
let data = await this.gqlClient.query(query, variables)
|
|
@@ -51,7 +51,7 @@ class TenantGqlProvider implements ITenantProvider {
|
|
|
51
51
|
return data.createTenant
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
async paginateTenant(page: number, limit: number, search:string = ""): Promise<IPaginateClient
|
|
54
|
+
async paginateTenant(page: number, limit: number, search:string = ""): Promise<IPaginateClient<ITenant>> {
|
|
55
55
|
const query: string = `query paginateTenant($page: Int, $limit: Int, $search:String) {
|
|
56
56
|
paginateTenant(page: $page, limit: $limit, search: $search) {
|
|
57
57
|
total, page, limit, items{id, name }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {IGqlClient, IPaginateClient} from '@drax/common-front'
|
|
2
2
|
import type {IUserProvider} from "../../interfaces/IUserProvider";
|
|
3
|
-
import type {IUser, IUserCreate,
|
|
3
|
+
import type {IUser, IUserCreate, IUserUpdate} from "../../interfaces/IUser";
|
|
4
4
|
|
|
5
5
|
class UserGqlProvider implements IUserProvider {
|
|
6
6
|
|
|
@@ -48,7 +48,7 @@ class UserGqlProvider implements IUserProvider {
|
|
|
48
48
|
return data.createUser
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
async paginateUser(page: number, limit: number, search:string = ""): Promise<IPaginateClient
|
|
51
|
+
async paginateUser(page: number, limit: number, search:string = ""): Promise<IPaginateClient<IUser>> {
|
|
52
52
|
const query: string = `query paginateUser($page: Int, $limit: Int, $search:String) {
|
|
53
53
|
paginateUser(page: $page, limit: $limit, search: $search) {
|
|
54
54
|
total, page, limit, items{ id, name username, email, phone, active, role{id, name} tenant{id name} }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {IHttpClient, IPaginateClient} from '@drax/common-front'
|
|
2
2
|
import type {IRoleProvider} from "../../interfaces/IRoleProvider.ts";
|
|
3
|
-
import type {IRole} from "../../interfaces/IRole";
|
|
3
|
+
import type {IRole, IRoleBase} from "../../interfaces/IRole";
|
|
4
4
|
|
|
5
5
|
class RoleRestProvider implements IRoleProvider {
|
|
6
6
|
|
|
@@ -30,12 +30,12 @@ class RoleRestProvider implements IRoleProvider {
|
|
|
30
30
|
return role
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
async createRole(data:
|
|
33
|
+
async createRole(data: IRoleBase): Promise<any> {
|
|
34
34
|
const url = '/api/roles'
|
|
35
35
|
let role = await this.httpClient.post(url, data)
|
|
36
36
|
return role
|
|
37
37
|
}
|
|
38
|
-
async editRole(id: string, data:
|
|
38
|
+
async editRole(id: string, data: IRoleBase): Promise<IRole> {
|
|
39
39
|
const url = '/api/roles/' + id
|
|
40
40
|
let user = await this.httpClient.put(url, data)
|
|
41
41
|
return user as IRole
|
|
@@ -47,11 +47,11 @@ class RoleRestProvider implements IRoleProvider {
|
|
|
47
47
|
return user
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
async paginateRole(page: number = 1, limit: number = 5, search:string=""): Promise<IPaginateClient
|
|
50
|
+
async paginateRole(page: number = 1, limit: number = 5, search:string=""): Promise<IPaginateClient<IRole>> {
|
|
51
51
|
const url = '/api/roles'
|
|
52
52
|
const params = {page, limit, search}
|
|
53
53
|
let paginatedRoles = await this.httpClient.get(url, {params})
|
|
54
|
-
return paginatedRoles as IPaginateClient
|
|
54
|
+
return paginatedRoles as IPaginateClient<IRole>
|
|
55
55
|
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -42,11 +42,11 @@ class TenantRestProvider implements ITenantProvider {
|
|
|
42
42
|
return user
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
async paginateTenant(page: number = 1, limit: number = 5, search:string=""): Promise<IPaginateClient
|
|
45
|
+
async paginateTenant(page: number = 1, limit: number = 5, search:string=""): Promise<IPaginateClient<ITenant>> {
|
|
46
46
|
const url = '/api/tenants'
|
|
47
47
|
const params = {page, limit, search}
|
|
48
48
|
let paginatedTenants = await this.httpClient.get(url, {params})
|
|
49
|
-
return paginatedTenants as IPaginateClient
|
|
49
|
+
return paginatedTenants as IPaginateClient<ITenant>
|
|
50
50
|
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -36,11 +36,11 @@ class UserRestProvider implements IUserProvider {
|
|
|
36
36
|
return user
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
async paginateUser(page: number = 1, limit: number = 5, search:string = ""): Promise<IPaginateClient
|
|
39
|
+
async paginateUser(page: number = 1, limit: number = 5, search:string = ""): Promise<IPaginateClient<IUser>> {
|
|
40
40
|
const url = '/api/users'
|
|
41
41
|
const params = {page, limit, search}
|
|
42
42
|
let paginatedUsers = await this.httpClient.get(url, {params})
|
|
43
|
-
return paginatedUsers as IPaginateClient
|
|
43
|
+
return paginatedUsers as IPaginateClient<IUser>
|
|
44
44
|
|
|
45
45
|
}
|
|
46
46
|
|
package/src/system/RoleSystem.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {IRoleProvider} from "../interfaces/IRoleProvider";
|
|
2
|
-
import type {IRole} from "../interfaces/IRole";
|
|
2
|
+
import type {IRole, IRoleBase} from "../interfaces/IRole";
|
|
3
3
|
import type {IPaginateClient} from "@drax/common-front";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -21,15 +21,15 @@ class RoleSystem {
|
|
|
21
21
|
return this._provider.fetchPermissions()
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async paginateRole(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient
|
|
24
|
+
async paginateRole(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient<IRole>> {
|
|
25
25
|
return this._provider.paginateRole(page, perPage,search)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async createRole(userPayload:
|
|
28
|
+
async createRole(userPayload: IRoleBase):Promise<IRole> {
|
|
29
29
|
return this._provider.createRole(userPayload)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
async editRole(id:string, userPayload:
|
|
32
|
+
async editRole(id:string, userPayload: IRoleBase):Promise<IRole> {
|
|
33
33
|
return this._provider.editRole(id, userPayload)
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {ITenantProvider} from "../interfaces/ITenantProvider";
|
|
2
|
-
import type {ITenant} from "../interfaces/ITenant";
|
|
2
|
+
import type {ITenant, ITenantBase} from "../interfaces/ITenant";
|
|
3
3
|
import type {IPaginateClient} from "@drax/common-front";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -17,15 +17,15 @@ class TenantSystem {
|
|
|
17
17
|
return this._provider.fetchTenant()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async paginateTenant(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient
|
|
20
|
+
async paginateTenant(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient<ITenant>> {
|
|
21
21
|
return this._provider.paginateTenant(page, perPage,search)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async createTenant(userPayload:
|
|
24
|
+
async createTenant(userPayload: ITenantBase):Promise<ITenant> {
|
|
25
25
|
return this._provider.createTenant(userPayload)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async editTenant(id:string, userPayload:
|
|
28
|
+
async editTenant(id:string, userPayload: ITenantBase):Promise<ITenant> {
|
|
29
29
|
return this._provider.editTenant(id, userPayload)
|
|
30
30
|
}
|
|
31
31
|
|
package/src/system/UserSystem.ts
CHANGED
|
@@ -13,7 +13,7 @@ class UserSystem {
|
|
|
13
13
|
this.prototype = 'UserSystem'
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
async paginateUser(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient
|
|
16
|
+
async paginateUser(page:number = 1, perPage:number = 5, search:string=""):Promise<IPaginateClient<IUser>> {
|
|
17
17
|
return this._provider.paginateUser(page, perPage, search)
|
|
18
18
|
}
|
|
19
19
|
|