@service_laboratory/auth 0.0.6 → 0.0.8

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/dist/index.d.ts CHANGED
@@ -1,5 +1,78 @@
1
+ import { Axios } from 'axios';
2
+ import { AxiosResponse } from 'axios';
3
+ import { Derived } from '@tanstack/store';
1
4
  import { JSX } from 'react/jsx-runtime';
5
+ import { Store } from '@tanstack/store';
6
+
7
+ declare interface AccountData {
8
+ user: AccountUser;
9
+ isLoaded: boolean;
10
+ isAuthenticated: boolean;
11
+ }
12
+
13
+ export declare interface AccountUser {
14
+ id: string | null;
15
+ email: string | null;
16
+ roles: Role[];
17
+ is_enabled: boolean;
18
+ is_active: boolean;
19
+ }
20
+
21
+ declare interface ActivateRequest {
22
+ code: string;
23
+ }
24
+
25
+ export declare class Auth {
26
+ accountStore: Store<AccountData, (cb: AccountData) => AccountData>;
27
+ httpClient: Axios;
28
+ constructor(httpClient: Axios);
29
+ initAuthData(): void;
30
+ load(): Promise<void>;
31
+ login(values: LoginRequest): Promise<any>;
32
+ register(values: RegisterRequest): Promise<AxiosResponse<any, any>>;
33
+ activate(values: ActivateRequest): Promise<void>;
34
+ logout(): void;
35
+ startResetPassword(values: StartResetPasswordRequest): Promise<AxiosResponse<any, any>>;
36
+ resetPassword(values: ResetPasswordRequest): Promise<void>;
37
+ _initUserData({ user, access_token }: {
38
+ user: AccountUser;
39
+ access_token: string;
40
+ }): void;
41
+ _setAuthData(token: string): void;
42
+ _clearAuthData(): void;
43
+ }
44
+
45
+ export declare const isAdmin: Derived<boolean, readonly [Store<AccountData, (cb: AccountData) => AccountData>]>;
2
46
 
3
47
  export declare function LoginForm(): JSX.Element;
4
48
 
49
+ declare interface LoginRequest {
50
+ email: string;
51
+ password: string;
52
+ }
53
+
54
+ declare interface Permission {
55
+ name: string;
56
+ app: string;
57
+ }
58
+
59
+ declare interface RegisterRequest {
60
+ email: string;
61
+ password: string;
62
+ }
63
+
64
+ declare interface ResetPasswordRequest {
65
+ code: string;
66
+ password: string;
67
+ }
68
+
69
+ declare interface Role {
70
+ name: string;
71
+ permissions: Permission[];
72
+ }
73
+
74
+ declare interface StartResetPasswordRequest {
75
+ email: string;
76
+ }
77
+
5
78
  export { }