@drax/identity-front 0.36.0 → 0.37.1
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/factory/UserLoginFailSystemFactory.ts +32 -0
- package/src/factory/UserSessionSystemFactory.ts +32 -0
- package/src/index.ts +22 -0
- package/src/interfaces/IUserLoginFailProvider.ts +17 -0
- package/src/interfaces/IUserSessionProvider.ts +17 -0
- package/src/providers/gql/UserLoginFailGqlProvider.ts +43 -0
- package/src/providers/gql/UserSessionGqlProvider.ts +42 -0
- package/src/providers/rest/RoleRestProvider.ts +5 -4
- package/src/providers/rest/TenantRestProvider.ts +7 -8
- package/src/providers/rest/UserApiKeyRestProvider.ts +5 -3
- package/src/providers/rest/UserLoginFailRestProvider.ts +54 -0
- package/src/providers/rest/UserRestProvider.ts +14 -6
- package/src/providers/rest/UserSessionRestProvider.ts +55 -0
- package/src/system/RoleSystem.ts +13 -1
- package/src/system/TenantSystem.ts +13 -1
- package/src/system/UserApiKeySystem.ts +12 -0
- package/src/system/UserLoginFailSystem.ts +64 -0
- package/src/system/UserSessionSystem.ts +64 -0
- package/src/system/UserSystem.ts +28 -4
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.37.1",
|
|
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.37.0",
|
|
29
|
+
"@drax/crud-share": "^0.37.0",
|
|
30
|
+
"@drax/identity-share": "^0.37.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": "e4be12cd506bf5255e0f8b26b89cdd2a660a523d"
|
|
53
53
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import UserLoginFailSystem from "../system/UserLoginFailSystem.js";
|
|
2
|
+
import UserLoginFailGqlProvider from "../providers/gql/UserLoginFailGqlProvider.js";
|
|
3
|
+
import UserLoginFailRestClientProvider from "../providers/rest/UserLoginFailRestProvider.js";
|
|
4
|
+
import {HttpGqlClientFactory, HttpRestClientFactory} from "@drax/common-front"
|
|
5
|
+
const HTTP_TRANSPORT = import.meta.env.VITE_HTTP_TRANSPORT || 'REST';
|
|
6
|
+
|
|
7
|
+
class UserLoginFailSystemFactory{
|
|
8
|
+
|
|
9
|
+
static singleton: UserLoginFailSystem
|
|
10
|
+
|
|
11
|
+
static getInstance(httpTransport: string = HTTP_TRANSPORT): UserLoginFailSystem {
|
|
12
|
+
if(!UserLoginFailSystemFactory.singleton){
|
|
13
|
+
if(httpTransport === 'GRAPHQL') {
|
|
14
|
+
const httpGqlClient = HttpGqlClientFactory.getInstance()
|
|
15
|
+
const provider = new UserLoginFailGqlProvider(httpGqlClient)
|
|
16
|
+
UserLoginFailSystemFactory.singleton = new UserLoginFailSystem(provider)
|
|
17
|
+
} else if(httpTransport === 'REST') {
|
|
18
|
+
const httpRestClient = HttpRestClientFactory.getInstance()
|
|
19
|
+
const provider = new UserLoginFailRestClientProvider(httpRestClient)
|
|
20
|
+
UserLoginFailSystemFactory.singleton = new UserLoginFailSystem(provider)
|
|
21
|
+
}else{
|
|
22
|
+
throw new Error('UserLoginFailSystemFactory ERROR: Invalid HTTP_TRANSPORT environment variable')
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return UserLoginFailSystemFactory.singleton
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export default UserLoginFailSystemFactory
|
|
32
|
+
export {UserLoginFailSystemFactory}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import UserSessionSystem from "../system/UserSessionSystem.js";
|
|
2
|
+
import UserSessionGqlProvider from "../providers/gql/UserSessionGqlProvider.js";
|
|
3
|
+
import UserSessionRestClientProvider from "../providers/rest/UserSessionRestProvider.js";
|
|
4
|
+
import {HttpGqlClientFactory, HttpRestClientFactory} from "@drax/common-front"
|
|
5
|
+
const HTTP_TRANSPORT = import.meta.env.VITE_HTTP_TRANSPORT || 'REST';
|
|
6
|
+
|
|
7
|
+
class UserSessionSystemFactory{
|
|
8
|
+
|
|
9
|
+
static singleton: UserSessionSystem
|
|
10
|
+
|
|
11
|
+
static getInstance(httpTransport: string = HTTP_TRANSPORT): UserSessionSystem {
|
|
12
|
+
if(!UserSessionSystemFactory.singleton){
|
|
13
|
+
if(httpTransport === 'GRAPHQL') {
|
|
14
|
+
const httpGqlClient = HttpGqlClientFactory.getInstance()
|
|
15
|
+
const provider = new UserSessionGqlProvider(httpGqlClient)
|
|
16
|
+
UserSessionSystemFactory.singleton = new UserSessionSystem(provider)
|
|
17
|
+
} else if(httpTransport === 'REST') {
|
|
18
|
+
const httpRestClient = HttpRestClientFactory.getInstance()
|
|
19
|
+
const provider = new UserSessionRestClientProvider(httpRestClient)
|
|
20
|
+
UserSessionSystemFactory.singleton = new UserSessionSystem(provider)
|
|
21
|
+
}else{
|
|
22
|
+
throw new Error('UserSessionSystemFactory ERROR: Invalid HTTP_TRANSPORT environment variable')
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return UserSessionSystemFactory.singleton
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export default UserSessionSystemFactory
|
|
32
|
+
export {UserSessionSystemFactory}
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,17 @@ import TenantSystem from "./system/TenantSystem.js"
|
|
|
29
29
|
import TenantSystemFactory from "./factory/TenantSystemFactory.js"
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
import UserSessionRestProvider from "./providers/rest/UserSessionRestProvider.js";
|
|
33
|
+
import UserSessionGqlProvider from "./providers/gql/UserSessionGqlProvider.js";
|
|
34
|
+
import UserSessionSystem from "./system/UserSessionSystem.js"
|
|
35
|
+
import UserSessionSystemFactory from "./factory/UserSessionSystemFactory.js"
|
|
36
|
+
|
|
37
|
+
import UserLoginFailRestProvider from "./providers/rest/UserLoginFailRestProvider.js";
|
|
38
|
+
import UserLoginFailGqlProvider from "./providers/gql/UserLoginFailGqlProvider.js";
|
|
39
|
+
import UserLoginFailSystem from "./system/UserLoginFailSystem.js"
|
|
40
|
+
import UserLoginFailSystemFactory from "./factory/UserLoginFailSystemFactory.js"
|
|
41
|
+
|
|
42
|
+
|
|
32
43
|
import {IdentityI18nMessages} from "./i18n/index.js"
|
|
33
44
|
|
|
34
45
|
import type {IAuthProvider} from "./interfaces/IAuthProvider"
|
|
@@ -71,12 +82,21 @@ export {
|
|
|
71
82
|
UserApiKeyRestProvider,
|
|
72
83
|
UserApiKeyGqlProvider,
|
|
73
84
|
|
|
85
|
+
UserSessionRestProvider,
|
|
86
|
+
UserSessionGqlProvider,
|
|
87
|
+
|
|
88
|
+
UserLoginFailRestProvider,
|
|
89
|
+
UserLoginFailGqlProvider,
|
|
90
|
+
|
|
91
|
+
|
|
74
92
|
//Systems
|
|
75
93
|
AuthSystem,
|
|
76
94
|
UserSystem,
|
|
77
95
|
RoleSystem,
|
|
78
96
|
TenantSystem,
|
|
79
97
|
UserApiKeySystem,
|
|
98
|
+
UserSessionSystem,
|
|
99
|
+
UserLoginFailSystem,
|
|
80
100
|
|
|
81
101
|
//Factory
|
|
82
102
|
AuthSystemFactory,
|
|
@@ -84,6 +104,8 @@ export {
|
|
|
84
104
|
RoleSystemFactory,
|
|
85
105
|
TenantSystemFactory,
|
|
86
106
|
UserApiKeySystemFactory,
|
|
107
|
+
UserSessionSystemFactory,
|
|
108
|
+
UserLoginFailSystemFactory,
|
|
87
109
|
|
|
88
110
|
//Helpers
|
|
89
111
|
AuthHelper,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {IUserLoginFail} from "@drax/identity-share";
|
|
2
|
+
import type {
|
|
3
|
+
IDraxCrudProviderExportResult,
|
|
4
|
+
IDraxExportOptions,
|
|
5
|
+
IDraxPaginateOptions,
|
|
6
|
+
IDraxPaginateResult,
|
|
7
|
+
IDraxGroupByOptions
|
|
8
|
+
} from "@drax/crud-share";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
interface IUserLoginFailProvider{
|
|
12
|
+
paginate(options: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserLoginFail>>
|
|
13
|
+
groupBy?(options: IDraxGroupByOptions): Promise<Array<any>>
|
|
14
|
+
export?(options: IDraxExportOptions): Promise<IDraxCrudProviderExportResult>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type {IUserLoginFailProvider}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type {IUserSession} from "@drax/identity-share";
|
|
2
|
+
import type {
|
|
3
|
+
IDraxCrudProviderExportResult,
|
|
4
|
+
IDraxExportOptions,
|
|
5
|
+
IDraxPaginateOptions,
|
|
6
|
+
IDraxPaginateResult,
|
|
7
|
+
IDraxGroupByOptions
|
|
8
|
+
} from "@drax/crud-share";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
interface IUserSessionProvider{
|
|
12
|
+
paginate(options: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserSession>>
|
|
13
|
+
groupBy?(options: IDraxGroupByOptions): Promise<Array<any>>
|
|
14
|
+
export?(options: IDraxExportOptions): Promise<IDraxCrudProviderExportResult>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type {IUserSessionProvider}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type {IGqlClient} from '@drax/common-front'
|
|
2
|
+
import type {IUserLoginFailProvider} from "../../interfaces/IUserLoginFailProvider";
|
|
3
|
+
import type {IUserLoginFail} from "@drax/identity-share";
|
|
4
|
+
import type {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class UserLoginFailGqlProvider implements IUserLoginFailProvider {
|
|
8
|
+
|
|
9
|
+
gqlClient: IGqlClient
|
|
10
|
+
|
|
11
|
+
constructor(gqlClient: IGqlClient) {
|
|
12
|
+
this.gqlClient = gqlClient
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setHttpClientToken(token: string): void {
|
|
16
|
+
this.gqlClient.addHeader('Authorization', `Bearer ${token}`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
removeHttpClientToken(): void {
|
|
20
|
+
this.gqlClient.removeHeader('Authorization')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get gqlFields(){
|
|
24
|
+
return `_id user{_id username} agent ip createdAt`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
async paginate({page= 1, limit= 5, orderBy="", order='asc', search = ""}: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserLoginFail>> {
|
|
30
|
+
const query: string = `query paginateUserLoginFail($options: PaginateOptions) {
|
|
31
|
+
paginateUserLoginFail(options: $options) {
|
|
32
|
+
total, page, limit, items{ ${this.gqlFields} }
|
|
33
|
+
}
|
|
34
|
+
}`
|
|
35
|
+
const variables = {options: {page, limit, orderBy, order, search}}
|
|
36
|
+
let data = await this.gqlClient.query(query, variables)
|
|
37
|
+
return data.paginateUserLoginFail
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default UserLoginFailGqlProvider
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type {IGqlClient} from '@drax/common-front'
|
|
2
|
+
import type {IUserSessionProvider} from "../../interfaces/IUserSessionProvider";
|
|
3
|
+
import type {IUserSession} from "@drax/identity-share";
|
|
4
|
+
import type {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class UserSessionProvider implements IUserSessionProvider {
|
|
8
|
+
|
|
9
|
+
gqlClient: IGqlClient
|
|
10
|
+
|
|
11
|
+
constructor(gqlClient: IGqlClient) {
|
|
12
|
+
this.gqlClient = gqlClient
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setHttpClientToken(token: string): void {
|
|
16
|
+
this.gqlClient.addHeader('Authorization', `Bearer ${token}`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
removeHttpClientToken(): void {
|
|
20
|
+
this.gqlClient.removeHeader('Authorization')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get gqlFields(){
|
|
24
|
+
return `_id uuid user{_id username} agent ip createdAt`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
async paginate({page= 1, limit= 5, orderBy="", order='asc', search = ""}: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserSession>> {
|
|
29
|
+
const query: string = `query paginateUserSession($options: PaginateOptions) {
|
|
30
|
+
paginateUserLoginFail(options: $options) {
|
|
31
|
+
total, page, limit, items{ ${this.gqlFields} }
|
|
32
|
+
}
|
|
33
|
+
}`
|
|
34
|
+
const variables = {options: {page, limit, orderBy, order, search}}
|
|
35
|
+
let data = await this.gqlClient.query(query, variables)
|
|
36
|
+
return data.paginateUserLoginFail
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default UserSessionProvider
|
|
@@ -3,16 +3,18 @@ import type {IRoleProvider} from "../../interfaces/IRoleProvider.ts";
|
|
|
3
3
|
import type {IRole, IRoleBase} from "@drax/identity-share";
|
|
4
4
|
import type {
|
|
5
5
|
IDraxCrudProviderExportResult,
|
|
6
|
-
IDraxExportOptions,
|
|
6
|
+
IDraxExportOptions,
|
|
7
7
|
IDraxPaginateOptions,
|
|
8
8
|
IDraxPaginateResult
|
|
9
9
|
} from "@drax/crud-share";
|
|
10
|
+
import {AbstractBaseRestProvider} from "@drax/crud-front";
|
|
10
11
|
|
|
11
|
-
class RoleRestProvider implements IRoleProvider {
|
|
12
|
+
class RoleRestProvider extends AbstractBaseRestProvider implements IRoleProvider {
|
|
12
13
|
|
|
13
14
|
httpClient: IHttpClient
|
|
14
15
|
|
|
15
16
|
constructor(httpClient: IHttpClient) {
|
|
17
|
+
super('/api/roles');
|
|
16
18
|
this.httpClient = httpClient
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -72,8 +74,7 @@ class RoleRestProvider implements IRoleProvider {
|
|
|
72
74
|
filters = []
|
|
73
75
|
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
74
76
|
const url = '/api/roles/export'
|
|
75
|
-
const
|
|
76
|
-
const params: any = {format, headers, separator, limit, orderBy, order, search, filters: sFilters}
|
|
77
|
+
const params: any = {format, headers, separator, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
77
78
|
return await this.httpClient.get(url, {params}) as IDraxCrudProviderExportResult
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -3,21 +3,21 @@ import type {ITenantProvider} from "../../interfaces/ITenantProvider.ts";
|
|
|
3
3
|
import type {ITenant, ITenantBase} from "@drax/identity-share";
|
|
4
4
|
import type {
|
|
5
5
|
IDraxCrudProviderExportResult,
|
|
6
|
-
IDraxExportOptions,
|
|
6
|
+
IDraxExportOptions,
|
|
7
7
|
IDraxPaginateOptions,
|
|
8
8
|
IDraxPaginateResult
|
|
9
9
|
} from "@drax/crud-share";
|
|
10
|
+
import {AbstractBaseRestProvider} from "@drax/crud-front";
|
|
10
11
|
|
|
11
|
-
class TenantRestProvider implements ITenantProvider {
|
|
12
|
+
class TenantRestProvider extends AbstractBaseRestProvider implements ITenantProvider {
|
|
12
13
|
|
|
13
14
|
httpClient: IHttpClient
|
|
14
15
|
|
|
15
16
|
constructor(httpClient: IHttpClient) {
|
|
17
|
+
super('/api/tenants');
|
|
16
18
|
this.httpClient = httpClient
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
21
|
async fetchTenant(): Promise<any> {
|
|
22
22
|
const url = '/api/tenants/all'
|
|
23
23
|
let tenant = await this.httpClient.get(url)
|
|
@@ -41,9 +41,9 @@ class TenantRestProvider implements ITenantProvider {
|
|
|
41
41
|
return user
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
async paginate({page= 1, limit= 5, orderBy="", order= "asc", search = ""}: IDraxPaginateOptions): Promise<IDraxPaginateResult<ITenant>> {
|
|
44
|
+
async paginate({page= 1, limit= 5, orderBy="", order= "asc", search = "", filters= []}: IDraxPaginateOptions): Promise<IDraxPaginateResult<ITenant>> {
|
|
45
45
|
const url = '/api/tenants'
|
|
46
|
-
const params = {page, limit, orderBy, order, search}
|
|
46
|
+
const params = {page, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
47
47
|
let paginatedTenants = await this.httpClient.get(url, {params})
|
|
48
48
|
return paginatedTenants as IDraxPaginateResult<ITenant>
|
|
49
49
|
|
|
@@ -60,8 +60,7 @@ class TenantRestProvider implements ITenantProvider {
|
|
|
60
60
|
filters = []
|
|
61
61
|
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
62
62
|
const url = '/api/tenants/export'
|
|
63
|
-
const
|
|
64
|
-
const params: any = {format, headers, separator, limit, orderBy, order, search, filters: sFilters}
|
|
63
|
+
const params: any = {format, headers, separator, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
65
64
|
return await this.httpClient.get(url, {params}) as IDraxCrudProviderExportResult
|
|
66
65
|
}
|
|
67
66
|
|
|
@@ -2,13 +2,15 @@ import type {IHttpClient} from '@drax/common-front'
|
|
|
2
2
|
import type {IUserApiKeyProvider} from "../../interfaces/IUserApiKeyProvider";
|
|
3
3
|
import type {IUserApiKey, IUserApiKeyBase} from "@drax/identity-share";
|
|
4
4
|
import type {IDraxPaginateOptions, IDraxPaginateResult} from "@drax/crud-share";
|
|
5
|
+
import {AbstractBaseRestProvider} from "@drax/crud-front";
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
class UserApiKeyRestProvider implements IUserApiKeyProvider {
|
|
8
|
+
class UserApiKeyRestProvider extends AbstractBaseRestProvider implements IUserApiKeyProvider {
|
|
8
9
|
|
|
9
10
|
httpClient: IHttpClient
|
|
10
11
|
|
|
11
12
|
constructor(httpClient: IHttpClient) {
|
|
13
|
+
super('/api/user-api-keys');
|
|
12
14
|
this.httpClient = httpClient
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -31,9 +33,9 @@ class UserApiKeyRestProvider implements IUserApiKeyProvider {
|
|
|
31
33
|
return result
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
async paginate({page= 1, limit= 5, orderBy="", order="asc", search = ""}: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserApiKey>> {
|
|
36
|
+
async paginate({page= 1, limit= 5, orderBy="", order="asc", search = "", filters=[]}: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserApiKey>> {
|
|
35
37
|
const url = '/api/user-api-keys'
|
|
36
|
-
const params = {page, limit, orderBy, order, search}
|
|
38
|
+
const params = {page, limit, orderBy, order, search, filters: this.prepareFilters(filters) }
|
|
37
39
|
let paginatedUserApiKeys = await this.httpClient.get(url, {params})
|
|
38
40
|
return paginatedUserApiKeys as IDraxPaginateResult<IUserApiKey>
|
|
39
41
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type {IHttpClient} from "@drax/common-front";
|
|
2
|
+
import type {
|
|
3
|
+
IDraxCrudProviderExportResult,
|
|
4
|
+
IDraxExportOptions,
|
|
5
|
+
IDraxGroupByOptions,
|
|
6
|
+
IDraxPaginateOptions,
|
|
7
|
+
IDraxPaginateResult
|
|
8
|
+
} from "@drax/crud-share";
|
|
9
|
+
import {AbstractBaseRestProvider} from "@drax/crud-front";
|
|
10
|
+
import type {IUserLoginFail} from "@drax/identity-share";
|
|
11
|
+
import type {IUserLoginFailProvider} from "../../interfaces/IUserLoginFailProvider";
|
|
12
|
+
|
|
13
|
+
class UserLoginFailRestProvider extends AbstractBaseRestProvider implements IUserLoginFailProvider {
|
|
14
|
+
|
|
15
|
+
httpClient: IHttpClient
|
|
16
|
+
|
|
17
|
+
constructor(httpClient: IHttpClient) {
|
|
18
|
+
super('/api/user-login-fails');
|
|
19
|
+
this.httpClient = httpClient
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async paginate({page= 1, limit= 5, orderBy="",order= "asc", search = "", filters= []}: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserLoginFail>> {
|
|
23
|
+
const url = '/api/user-login-fails'
|
|
24
|
+
const params = {page, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
25
|
+
let paginatedUsers = await this.httpClient.get(url, {params})
|
|
26
|
+
return paginatedUsers as IDraxPaginateResult<IUserLoginFail>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async groupBy({fields = [], filters = []}: IDraxGroupByOptions): Promise<Array<any>> {
|
|
30
|
+
const url = '/api/user-login-fails/group-by'
|
|
31
|
+
const params = {fields: fields ? fields.join(',') : '',filters: this.prepareFilters(filters)}
|
|
32
|
+
const items = await this.httpClient.get(url, {params})
|
|
33
|
+
return items as any[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async export({
|
|
37
|
+
format = 'JSON',
|
|
38
|
+
headers = [],
|
|
39
|
+
separator = ';',
|
|
40
|
+
limit = 0,
|
|
41
|
+
orderBy = "",
|
|
42
|
+
order = false,
|
|
43
|
+
search = "",
|
|
44
|
+
filters = []
|
|
45
|
+
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
46
|
+
const url = '/api/user-login-fails/export'
|
|
47
|
+
const params: any = {format, headers, separator, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
48
|
+
return await this.httpClient.get(url, {params}) as IDraxCrudProviderExportResult
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default UserLoginFailRestProvider
|
|
54
|
+
|
|
@@ -3,17 +3,19 @@ import type {IUserProvider} from "../../interfaces/IUserProvider.ts";
|
|
|
3
3
|
import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
|
|
4
4
|
import type {
|
|
5
5
|
IDraxCrudProviderExportResult,
|
|
6
|
-
IDraxExportOptions,
|
|
6
|
+
IDraxExportOptions, IDraxGroupByOptions,
|
|
7
7
|
IDraxPaginateOptions,
|
|
8
8
|
IDraxPaginateResult
|
|
9
9
|
} from "@drax/crud-share";
|
|
10
|
+
import {AbstractBaseRestProvider} from "@drax/crud-front";
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
class UserRestProvider implements IUserProvider {
|
|
13
|
+
class UserRestProvider extends AbstractBaseRestProvider implements IUserProvider {
|
|
13
14
|
|
|
14
15
|
httpClient: IHttpClient
|
|
15
16
|
|
|
16
17
|
constructor(httpClient: IHttpClient) {
|
|
18
|
+
super('/api/users');
|
|
17
19
|
this.httpClient = httpClient
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -36,9 +38,9 @@ class UserRestProvider implements IUserProvider {
|
|
|
36
38
|
return user
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
async paginate({page= 1, limit= 5, orderBy="",order= "asc", search = ""}: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUser>> {
|
|
41
|
+
async paginate({page= 1, limit= 5, orderBy="",order= "asc", search = "", filters=[]}: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUser>> {
|
|
40
42
|
const url = '/api/users'
|
|
41
|
-
const params = {page, limit, orderBy, order, search}
|
|
43
|
+
const params = {page, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
42
44
|
let paginatedUsers = await this.httpClient.get(url, {params})
|
|
43
45
|
return paginatedUsers as IDraxPaginateResult<IUser>
|
|
44
46
|
|
|
@@ -70,11 +72,17 @@ class UserRestProvider implements IUserProvider {
|
|
|
70
72
|
filters = []
|
|
71
73
|
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
72
74
|
const url = '/api/users/export'
|
|
73
|
-
const
|
|
74
|
-
const params: any = {format, headers, separator, limit, orderBy, order, search, filters: sFilters}
|
|
75
|
+
const params: any = {format, headers, separator, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
75
76
|
return await this.httpClient.get(url, {params}) as IDraxCrudProviderExportResult
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
async groupBy({fields = [], filters = []}: IDraxGroupByOptions): Promise<Array<any>> {
|
|
80
|
+
const url = '/api/users/group-by'
|
|
81
|
+
const params = {fields: fields ? fields.join(',') : '',filters: this.prepareFilters(filters)}
|
|
82
|
+
const items = await this.httpClient.get(url, {params})
|
|
83
|
+
return items as any[]
|
|
84
|
+
}
|
|
85
|
+
|
|
78
86
|
|
|
79
87
|
}
|
|
80
88
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type {IHttpClient} from "@drax/common-front";
|
|
2
|
+
import type {
|
|
3
|
+
IDraxCrudProviderExportResult,
|
|
4
|
+
IDraxExportOptions,
|
|
5
|
+
IDraxGroupByOptions,
|
|
6
|
+
IDraxPaginateOptions,
|
|
7
|
+
IDraxPaginateResult
|
|
8
|
+
} from "@drax/crud-share";
|
|
9
|
+
import type {IUserSession} from "@drax/identity-share";
|
|
10
|
+
import type {IUserSessionProvider} from "../../interfaces/IUserSessionProvider";
|
|
11
|
+
import {AbstractBaseRestProvider} from "@drax/crud-front";
|
|
12
|
+
|
|
13
|
+
class UserSessionRestProvider extends AbstractBaseRestProvider implements IUserSessionProvider {
|
|
14
|
+
|
|
15
|
+
httpClient: IHttpClient
|
|
16
|
+
|
|
17
|
+
constructor(httpClient: IHttpClient) {
|
|
18
|
+
super('/api/user-sessions');
|
|
19
|
+
this.httpClient = httpClient
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
async paginate({page= 1, limit= 5, orderBy="",order= "asc", search = "", filters=[]}: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserSession>> {
|
|
24
|
+
const url = '/api/user-sessions'
|
|
25
|
+
const params = {page, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
26
|
+
let paginatedUsers = await this.httpClient.get(url, {params})
|
|
27
|
+
return paginatedUsers as IDraxPaginateResult<IUserSession>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async groupBy({fields = [], filters = []}: IDraxGroupByOptions): Promise<Array<any>> {
|
|
31
|
+
const url = '/api/user-sessions/group-by'
|
|
32
|
+
const params = {fields: fields ? fields.join(',') : '',filters: this.prepareFilters(filters)}
|
|
33
|
+
const items = await this.httpClient.get(url, {params})
|
|
34
|
+
return items as any[]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async export({
|
|
38
|
+
format = 'JSON',
|
|
39
|
+
headers = [],
|
|
40
|
+
separator = ';',
|
|
41
|
+
limit = 0,
|
|
42
|
+
orderBy = "",
|
|
43
|
+
order = false,
|
|
44
|
+
search = "",
|
|
45
|
+
filters = []
|
|
46
|
+
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
47
|
+
const url = '/api/user-sessions/export'
|
|
48
|
+
const params: any = {format, headers, separator, limit, orderBy, order, search, filters: this.prepareFilters(filters)}
|
|
49
|
+
return await this.httpClient.get(url, {params}) as IDraxCrudProviderExportResult
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default UserSessionRestProvider
|
|
55
|
+
|
package/src/system/RoleSystem.ts
CHANGED
|
@@ -40,14 +40,26 @@ class RoleSystem implements IRoleProvider {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
async create(userPayload: IRoleBase):Promise<IRole> {
|
|
43
|
+
if(!this._provider.create){
|
|
44
|
+
throw new Error("Create method not implemented")
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
return this._provider.create(userPayload)
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
async update(id:string, userPayload: IRoleBase):Promise<IRole> {
|
|
51
|
+
if(!this._provider.update){
|
|
52
|
+
throw new Error("Update method not implemented")
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
return this._provider.update(id, userPayload)
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
async delete(id: string):Promise<any> {
|
|
59
|
+
if(!this._provider.delete){
|
|
60
|
+
throw new Error("Delete method not implemented")
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
return this._provider.delete(id)
|
|
52
64
|
}
|
|
53
65
|
|
|
@@ -63,7 +75,7 @@ class RoleSystem implements IRoleProvider {
|
|
|
63
75
|
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
64
76
|
|
|
65
77
|
if(!this._provider.export){
|
|
66
|
-
throw new Error(`RoleSystem.provider does not support export`)
|
|
78
|
+
throw new Error(`RoleSystem.provider does not support export`)
|
|
67
79
|
}
|
|
68
80
|
|
|
69
81
|
return this._provider.export({
|
|
@@ -43,14 +43,26 @@ class TenantSystem implements IDraxCrudProvider<ITenant, ITenantBase, ITenantBas
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
async create(userPayload: ITenantBase): Promise<ITenant> {
|
|
46
|
+
if(!this._provider.create){
|
|
47
|
+
throw new Error("Create method not implemented")
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
return this._provider.create(userPayload)
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
async update(id: string, userPayload: ITenantBase): Promise<ITenant> {
|
|
54
|
+
if(!this._provider.update){
|
|
55
|
+
throw new Error("Update method not implemented")
|
|
56
|
+
}
|
|
57
|
+
|
|
50
58
|
return this._provider.update(id, userPayload)
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
async delete(id: string): Promise<any> {
|
|
62
|
+
if(!this._provider.delete){
|
|
63
|
+
throw new Error("Delete method not implemented")
|
|
64
|
+
}
|
|
65
|
+
|
|
54
66
|
return this._provider.delete(id)
|
|
55
67
|
}
|
|
56
68
|
|
|
@@ -66,7 +78,7 @@ class TenantSystem implements IDraxCrudProvider<ITenant, ITenantBase, ITenantBas
|
|
|
66
78
|
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
67
79
|
|
|
68
80
|
if(!this._provider.export){
|
|
69
|
-
throw new Error(`TenantSystem.provider does not support export`)
|
|
81
|
+
throw new Error(`TenantSystem.provider does not support export`)
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
return this._provider.export({
|
|
@@ -27,14 +27,26 @@ class UserApiKeySystem implements IUserApiKeyProvider{
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async create(userPayload: IUserApiKeyBase):Promise<IUserApiKey> {
|
|
30
|
+
if(!this._provider.create){
|
|
31
|
+
throw new Error("Create method not implemented")
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
return this._provider.create(userPayload)
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
async update(id:string, userPayload: IUserApiKeyBase):Promise<IUserApiKey> {
|
|
38
|
+
if(!this._provider.update){
|
|
39
|
+
throw new Error("Update method not implemented")
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
return this._provider.update(id, userPayload)
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
async delete(id: string):Promise<any> {
|
|
46
|
+
if(!this._provider.delete){
|
|
47
|
+
throw new Error("Delete method not implemented")
|
|
48
|
+
}
|
|
49
|
+
|
|
38
50
|
return this._provider.delete(id)
|
|
39
51
|
}
|
|
40
52
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type {IUserLoginFailProvider} from "../interfaces/IUserLoginFailProvider";
|
|
2
|
+
import type {IUserLoginFail} from "@drax/identity-share";
|
|
3
|
+
import type {
|
|
4
|
+
IDraxCrudProviderExportResult,
|
|
5
|
+
IDraxExportOptions, IDraxGroupByOptions,
|
|
6
|
+
IDraxPaginateOptions,
|
|
7
|
+
IDraxPaginateResult
|
|
8
|
+
} from "@drax/crud-share";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class UserLoginFailSystem implements IUserLoginFailProvider{
|
|
12
|
+
|
|
13
|
+
_provider: IUserLoginFailProvider
|
|
14
|
+
prototype: string;
|
|
15
|
+
|
|
16
|
+
constructor(provider: IUserLoginFailProvider) {
|
|
17
|
+
this._provider = provider;
|
|
18
|
+
this.prototype = 'UserLoginFailSystem'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async paginate({page= 1, limit= 5, orderBy= "", order= "asc", search = "", filters = []}: IDraxPaginateOptions):Promise<IDraxPaginateResult<IUserLoginFail>> {
|
|
22
|
+
return this._provider.paginate({page, limit, orderBy, order, search, filters})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async groupBy({fields = [], filters = []}: IDraxGroupByOptions): Promise<Array<any>> {
|
|
26
|
+
if(!this._provider.groupBy){
|
|
27
|
+
throw new Error("groupBy method not implemented")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const result: any[] = await this._provider.groupBy({fields,filters})
|
|
31
|
+
return result
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async export({
|
|
35
|
+
format = 'JSON',
|
|
36
|
+
headers = [],
|
|
37
|
+
separator = ';',
|
|
38
|
+
limit = 0,
|
|
39
|
+
orderBy = "",
|
|
40
|
+
order = false,
|
|
41
|
+
search = "",
|
|
42
|
+
filters = []
|
|
43
|
+
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
44
|
+
|
|
45
|
+
if(!this._provider.export){
|
|
46
|
+
throw new Error(`export method not implemented`) // assuming we have a custom error for this case // replace with actual error handling as needed // see: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#error-handling-changes for more details on custom error classes in TypeScript 3.1+ // or use a library like 'ts-error' for a more robust and flexible error handling solution // or use a custom error type if you want to have a specific error type for this operation // or use a custom interface or class for the export result if you want to have a specific structure for the result // or use a custom function that returns the result if you want to have a specific function for the result // or use a custom interface or class if you want to have a specific structure for the result // or use a custom function that returns the result
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return this._provider.export({
|
|
50
|
+
format,
|
|
51
|
+
headers,
|
|
52
|
+
separator,
|
|
53
|
+
limit,
|
|
54
|
+
orderBy,
|
|
55
|
+
order,
|
|
56
|
+
search,
|
|
57
|
+
filters
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default UserLoginFailSystem
|
|
64
|
+
export {UserLoginFailSystem}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type {IUserSessionProvider} from "../interfaces/IUserSessionProvider";
|
|
2
|
+
import type {IUserSession} from "@drax/identity-share";
|
|
3
|
+
import type {
|
|
4
|
+
IDraxCrudProviderExportResult,
|
|
5
|
+
IDraxExportOptions, IDraxGroupByOptions,
|
|
6
|
+
IDraxPaginateOptions,
|
|
7
|
+
IDraxPaginateResult
|
|
8
|
+
} from "@drax/crud-share";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class UserSessionSystem implements IUserSessionProvider{
|
|
12
|
+
|
|
13
|
+
_provider: IUserSessionProvider
|
|
14
|
+
prototype: string;
|
|
15
|
+
|
|
16
|
+
constructor(provider: IUserSessionProvider) {
|
|
17
|
+
this._provider = provider;
|
|
18
|
+
this.prototype = 'UserSessionSystem'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async paginate({page= 1, limit= 5, orderBy= "", order= "asc", search = "", filters = []}: IDraxPaginateOptions):Promise<IDraxPaginateResult<IUserSession>> {
|
|
22
|
+
return this._provider.paginate({page, limit, orderBy, order, search, filters})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async groupBy({fields = [], filters = []}: IDraxGroupByOptions): Promise<Array<any>> {
|
|
26
|
+
if(!this._provider.groupBy){
|
|
27
|
+
throw new Error("groupBy method not implemented")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const result: any[] = await this._provider.groupBy({fields,filters})
|
|
31
|
+
return result
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async export({
|
|
35
|
+
format = 'JSON',
|
|
36
|
+
headers = [],
|
|
37
|
+
separator = ';',
|
|
38
|
+
limit = 0,
|
|
39
|
+
orderBy = "",
|
|
40
|
+
order = false,
|
|
41
|
+
search = "",
|
|
42
|
+
filters = []
|
|
43
|
+
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
44
|
+
|
|
45
|
+
if(!this._provider.export){
|
|
46
|
+
throw new Error(`export method not implemented`) // assuming we have a custom error for this case // replace with actual error handling as needed // see: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#error-handling-changes for more details on custom error classes in TypeScript 3.1+ // or use a library like 'ts-error' for a more robust and flexible error handling solution // or use a custom error type if you want to have a specific error type for this operation // or use a custom interface or class for the export result if you want to have a specific structure for the result // or use a custom function that returns the result if you want to have a specific function for the result // or use a custom interface or class if you want to have a specific structure for the result // or use a custom function that returns the result
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return this._provider.export({
|
|
50
|
+
format,
|
|
51
|
+
headers,
|
|
52
|
+
separator,
|
|
53
|
+
limit,
|
|
54
|
+
orderBy,
|
|
55
|
+
order,
|
|
56
|
+
search,
|
|
57
|
+
filters
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default UserSessionSystem
|
|
64
|
+
export {UserSessionSystem}
|
package/src/system/UserSystem.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type {IUserProvider} from "../interfaces/IUserProvider";
|
|
|
2
2
|
import type {IUser, IUserCreate, IUserUpdate} from "@drax/identity-share";
|
|
3
3
|
import type {
|
|
4
4
|
IDraxCrudProviderExportResult,
|
|
5
|
-
IDraxExportOptions,
|
|
5
|
+
IDraxExportOptions, IDraxGroupByOptions,
|
|
6
6
|
IDraxPaginateOptions,
|
|
7
7
|
IDraxPaginateResult
|
|
8
8
|
} from "@drax/crud-share";
|
|
@@ -21,7 +21,7 @@ class UserSystem implements IUserProvider{
|
|
|
21
21
|
async search(value: any):Promise<IUser[]> {
|
|
22
22
|
|
|
23
23
|
if(!this._provider.search){
|
|
24
|
-
throw new Error("
|
|
24
|
+
throw new Error("search method not implemented")
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return this._provider.search(value)
|
|
@@ -32,23 +32,47 @@ class UserSystem implements IUserProvider{
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
async create(userPayload: IUserCreate):Promise<IUser> {
|
|
35
|
+
if(!this._provider.create){
|
|
36
|
+
throw new Error("Create method not implemented")
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
return this._provider.create(userPayload)
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
async update(id:string, userPayload: IUserUpdate):Promise<IUser> {
|
|
43
|
+
if(!this._provider.update){
|
|
44
|
+
throw new Error("Update method not implemented")
|
|
45
|
+
}
|
|
46
|
+
|
|
39
47
|
return this._provider.update(id, userPayload)
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
async delete(id: string):Promise<any> {
|
|
51
|
+
if(!this._provider.delete){
|
|
52
|
+
throw new Error("Delete method not implemented")
|
|
53
|
+
}
|
|
54
|
+
|
|
43
55
|
return this._provider.delete(id)
|
|
44
56
|
}
|
|
45
57
|
|
|
46
58
|
async changeUserPassword(userId:string, newPassword:string):Promise<boolean> {
|
|
47
|
-
|
|
59
|
+
if(!this._provider.changeUserPassword){
|
|
60
|
+
throw new Error("changeUserPassword method not implemented")
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
const result: boolean = await this._provider.changeUserPassword(userId,newPassword)
|
|
49
64
|
return result
|
|
50
65
|
}
|
|
51
66
|
|
|
67
|
+
async groupBy({fields = [], filters = []}: IDraxGroupByOptions): Promise<Array<any>> {
|
|
68
|
+
if(!this._provider.groupBy){
|
|
69
|
+
throw new Error("groupBy method not implemented")
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const result: any[] = await this._provider.groupBy({fields,filters})
|
|
73
|
+
return result
|
|
74
|
+
}
|
|
75
|
+
|
|
52
76
|
async export({
|
|
53
77
|
format = 'JSON',
|
|
54
78
|
headers = [],
|
|
@@ -61,7 +85,7 @@ class UserSystem implements IUserProvider{
|
|
|
61
85
|
}: IDraxExportOptions): Promise<IDraxCrudProviderExportResult> {
|
|
62
86
|
|
|
63
87
|
if(!this._provider.export){
|
|
64
|
-
throw new Error(`
|
|
88
|
+
throw new Error(`export method not implemented`)
|
|
65
89
|
}
|
|
66
90
|
|
|
67
91
|
return this._provider.export({
|