@temboplus/afloat 0.2.0-beta.10 → 0.2.0-beta.11
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.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/modules/auth/auth.contract.d.ts +30 -28
- package/dist/modules/auth/auth.dtos.d.ts +117 -0
- package/dist/modules/auth/auth.repository.d.ts +9 -4
- package/dist/modules/auth/company-membership.model.d.ts +13 -13
- package/dist/modules/auth/index.d.ts +1 -0
- package/dist/modules/auth/user.model.d.ts +23 -35
- package/dist/modules/beneficiary/beneficiary-info.model.d.ts +32 -15
- package/dist/modules/beneficiary/beneficiary.model.d.ts +42 -62
- package/dist/modules/beneficiary/index.d.ts +1 -1
- package/dist/modules/login/login.model.d.ts +3 -3
- package/dist/modules/payout/payout.model.d.ts +4 -4
- package/dist/modules/profile/profile.model.d.ts +3 -3
- package/dist/modules/team-member/role.model.d.ts +3 -3
- package/dist/modules/team-member/team-member.model.d.ts +8 -8
- package/dist/modules/wallet/narration.model.d.ts +3 -3
- package/dist/modules/wallet/statement-entry.model.d.ts +23 -23
- package/dist/modules/wallet/wallet.model.d.ts +3 -3
- package/package.json +2 -2
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
/**
|
|
3
2
|
* Auth API contract
|
|
4
3
|
*/
|
|
5
4
|
export declare const authContract: {
|
|
6
5
|
logIn: {
|
|
7
6
|
method: "POST";
|
|
8
|
-
body:
|
|
9
|
-
type:
|
|
10
|
-
identity:
|
|
11
|
-
password:
|
|
12
|
-
}, "strip",
|
|
7
|
+
body: import("zod").ZodObject<{
|
|
8
|
+
type: import("zod").ZodDefault<import("zod").ZodString>;
|
|
9
|
+
identity: import("zod").ZodString;
|
|
10
|
+
password: import("zod").ZodString;
|
|
11
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
13
12
|
type: string;
|
|
14
13
|
identity: string;
|
|
15
14
|
password: string;
|
|
@@ -20,17 +19,17 @@ export declare const authContract: {
|
|
|
20
19
|
}>;
|
|
21
20
|
path: "/login";
|
|
22
21
|
responses: {
|
|
23
|
-
201:
|
|
24
|
-
profile:
|
|
25
|
-
id:
|
|
26
|
-
firstName:
|
|
27
|
-
lastName:
|
|
28
|
-
displayName:
|
|
29
|
-
phone:
|
|
30
|
-
accountNo:
|
|
31
|
-
email:
|
|
32
|
-
autoApprove:
|
|
33
|
-
}, "strip",
|
|
22
|
+
201: import("zod").ZodObject<{
|
|
23
|
+
profile: import("zod").ZodObject<{
|
|
24
|
+
id: import("zod").ZodString;
|
|
25
|
+
firstName: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
26
|
+
lastName: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
27
|
+
displayName: import("zod").ZodString;
|
|
28
|
+
phone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
29
|
+
accountNo: import("zod").ZodString;
|
|
30
|
+
email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
|
|
31
|
+
autoApprove: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
|
|
32
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
34
33
|
id: string;
|
|
35
34
|
displayName: string;
|
|
36
35
|
accountNo: string;
|
|
@@ -49,10 +48,10 @@ export declare const authContract: {
|
|
|
49
48
|
email?: string | null | undefined;
|
|
50
49
|
autoApprove?: boolean | null | undefined;
|
|
51
50
|
}>;
|
|
52
|
-
token:
|
|
53
|
-
access:
|
|
54
|
-
resetPassword:
|
|
55
|
-
}, "strip",
|
|
51
|
+
token: import("zod").ZodString;
|
|
52
|
+
access: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
53
|
+
resetPassword: import("zod").ZodBoolean;
|
|
54
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
56
55
|
token: string;
|
|
57
56
|
resetPassword: boolean;
|
|
58
57
|
access: string[];
|
|
@@ -81,22 +80,22 @@ export declare const authContract: {
|
|
|
81
80
|
autoApprove?: boolean | null | undefined;
|
|
82
81
|
};
|
|
83
82
|
}>;
|
|
84
|
-
400:
|
|
83
|
+
400: import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>;
|
|
85
84
|
};
|
|
86
85
|
};
|
|
87
86
|
access: {
|
|
88
87
|
method: "GET";
|
|
89
88
|
path: "/access";
|
|
90
89
|
responses: {
|
|
91
|
-
200:
|
|
90
|
+
200: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
92
91
|
};
|
|
93
92
|
};
|
|
94
93
|
resetPassword: {
|
|
95
94
|
method: "PUT";
|
|
96
|
-
body:
|
|
97
|
-
currentPassword:
|
|
98
|
-
newPassword:
|
|
99
|
-
}, "strip",
|
|
95
|
+
body: import("zod").ZodObject<{
|
|
96
|
+
currentPassword: import("zod").ZodString;
|
|
97
|
+
newPassword: import("zod").ZodString;
|
|
98
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
100
99
|
newPassword: string;
|
|
101
100
|
currentPassword: string;
|
|
102
101
|
}, {
|
|
@@ -104,6 +103,9 @@ export declare const authContract: {
|
|
|
104
103
|
currentPassword: string;
|
|
105
104
|
}>;
|
|
106
105
|
path: "/password";
|
|
107
|
-
responses: {
|
|
106
|
+
responses: {
|
|
107
|
+
200: import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>;
|
|
108
|
+
400: import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>;
|
|
109
|
+
};
|
|
108
110
|
};
|
|
109
111
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Collection of all auth-related schemas.
|
|
4
|
+
*/
|
|
5
|
+
export declare const AuthDTOSchemas: {
|
|
6
|
+
/** Schema for login request validation */
|
|
7
|
+
logInRequestDTO: z.ZodObject<{
|
|
8
|
+
type: z.ZodDefault<z.ZodString>;
|
|
9
|
+
identity: z.ZodString;
|
|
10
|
+
password: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
type: string;
|
|
13
|
+
identity: string;
|
|
14
|
+
password: string;
|
|
15
|
+
}, {
|
|
16
|
+
identity: string;
|
|
17
|
+
password: string;
|
|
18
|
+
type?: string | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
/** Schema for successful login responses */
|
|
21
|
+
logInResponseDTO: z.ZodObject<{
|
|
22
|
+
profile: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
displayName: z.ZodString;
|
|
27
|
+
phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
accountNo: z.ZodString;
|
|
29
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
id: string;
|
|
33
|
+
displayName: string;
|
|
34
|
+
accountNo: string;
|
|
35
|
+
firstName?: string | null | undefined;
|
|
36
|
+
lastName?: string | null | undefined;
|
|
37
|
+
phone?: string | null | undefined;
|
|
38
|
+
email?: string | null | undefined;
|
|
39
|
+
autoApprove?: boolean | null | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
id: string;
|
|
42
|
+
displayName: string;
|
|
43
|
+
accountNo: string;
|
|
44
|
+
firstName?: string | null | undefined;
|
|
45
|
+
lastName?: string | null | undefined;
|
|
46
|
+
phone?: string | null | undefined;
|
|
47
|
+
email?: string | null | undefined;
|
|
48
|
+
autoApprove?: boolean | null | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
token: z.ZodString;
|
|
51
|
+
access: z.ZodArray<z.ZodString, "many">;
|
|
52
|
+
resetPassword: z.ZodBoolean;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
token: string;
|
|
55
|
+
resetPassword: boolean;
|
|
56
|
+
access: string[];
|
|
57
|
+
profile: {
|
|
58
|
+
id: string;
|
|
59
|
+
displayName: string;
|
|
60
|
+
accountNo: string;
|
|
61
|
+
firstName?: string | null | undefined;
|
|
62
|
+
lastName?: string | null | undefined;
|
|
63
|
+
phone?: string | null | undefined;
|
|
64
|
+
email?: string | null | undefined;
|
|
65
|
+
autoApprove?: boolean | null | undefined;
|
|
66
|
+
};
|
|
67
|
+
}, {
|
|
68
|
+
token: string;
|
|
69
|
+
resetPassword: boolean;
|
|
70
|
+
access: string[];
|
|
71
|
+
profile: {
|
|
72
|
+
id: string;
|
|
73
|
+
displayName: string;
|
|
74
|
+
accountNo: string;
|
|
75
|
+
firstName?: string | null | undefined;
|
|
76
|
+
lastName?: string | null | undefined;
|
|
77
|
+
phone?: string | null | undefined;
|
|
78
|
+
email?: string | null | undefined;
|
|
79
|
+
autoApprove?: boolean | null | undefined;
|
|
80
|
+
};
|
|
81
|
+
}>;
|
|
82
|
+
/** Schema for access list responses */
|
|
83
|
+
accessResponseDTO: z.ZodArray<z.ZodString, "many">;
|
|
84
|
+
/** Schema for reset password request validation */
|
|
85
|
+
resetPasswordRequestDTO: z.ZodObject<{
|
|
86
|
+
currentPassword: z.ZodString;
|
|
87
|
+
newPassword: z.ZodString;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
newPassword: string;
|
|
90
|
+
currentPassword: string;
|
|
91
|
+
}, {
|
|
92
|
+
newPassword: string;
|
|
93
|
+
currentPassword: string;
|
|
94
|
+
}>;
|
|
95
|
+
/** Schema for empty responses */
|
|
96
|
+
emptyResponseDTO: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Type representing the login request payload.
|
|
100
|
+
*/
|
|
101
|
+
export type AuthLogInRequestDTO = z.infer<typeof AuthDTOSchemas.logInRequestDTO>;
|
|
102
|
+
/**
|
|
103
|
+
* Type representing a successful login response.
|
|
104
|
+
*/
|
|
105
|
+
export type AuthLogInResponseDTO = z.infer<typeof AuthDTOSchemas.logInResponseDTO>;
|
|
106
|
+
/**
|
|
107
|
+
* Type representing the access list response.
|
|
108
|
+
*/
|
|
109
|
+
export type AuthAccessResponseDTO = z.infer<typeof AuthDTOSchemas.accessResponseDTO>;
|
|
110
|
+
/**
|
|
111
|
+
* Type representing the reset password request payload.
|
|
112
|
+
*/
|
|
113
|
+
export type AuthResetPasswordRequestDTO = z.infer<typeof AuthDTOSchemas.resetPasswordRequestDTO>;
|
|
114
|
+
/**
|
|
115
|
+
* Type representing an empty auth response.
|
|
116
|
+
*/
|
|
117
|
+
export type AuthEmptyResponseDTO = z.infer<typeof AuthDTOSchemas.emptyResponseDTO>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { BaseRepository } from "@/lib/api/base-repository.js";
|
|
2
2
|
import { User } from "@/modules/auth/user.model.js";
|
|
3
3
|
import { authContract } from "./auth.contract.js";
|
|
4
|
+
export type AuthLogInResult = {
|
|
5
|
+
token: string;
|
|
6
|
+
user: User;
|
|
7
|
+
};
|
|
4
8
|
/**
|
|
5
9
|
* Repository class for handling authentication-related operations.
|
|
6
10
|
* Provides methods for user login and password management.
|
|
@@ -10,7 +14,7 @@ import { authContract } from "./auth.contract.js";
|
|
|
10
14
|
* @example
|
|
11
15
|
* ```typescript
|
|
12
16
|
* const authRepo = new AuthRepository();
|
|
13
|
-
* const user = await authRepo.logIn("user@example.com", "password");
|
|
17
|
+
* const { token, user } = await authRepo.logIn("user@example.com", "password");
|
|
14
18
|
* ```
|
|
15
19
|
*/
|
|
16
20
|
export declare class AuthRepository extends BaseRepository<typeof authContract> {
|
|
@@ -30,20 +34,21 @@ export declare class AuthRepository extends BaseRepository<typeof authContract>
|
|
|
30
34
|
*
|
|
31
35
|
* @param email - The email of the user attempting to log in
|
|
32
36
|
* @param password - The password of the user
|
|
33
|
-
* @returns Promise that resolves to
|
|
37
|
+
* @returns Promise that resolves to the auth token and User object on successful login
|
|
34
38
|
* @throws {APIError} If the email or password is invalid, or if another error occurs during login
|
|
35
39
|
*
|
|
36
40
|
* @example
|
|
37
41
|
* ```typescript
|
|
38
42
|
* try {
|
|
39
|
-
* const user = await authRepo.logIn("user@example.com", "securePassword");
|
|
43
|
+
* const { token, user } = await authRepo.logIn("user@example.com", "securePassword");
|
|
44
|
+
* tokenStore.set(token);
|
|
40
45
|
* console.log(`Welcome ${user.name}!`);
|
|
41
46
|
* } catch (error) {
|
|
42
47
|
* console.error("Login failed:", error.message);
|
|
43
48
|
* }
|
|
44
49
|
* ```
|
|
45
50
|
*/
|
|
46
|
-
logIn(email: string, password: string): Promise<
|
|
51
|
+
logIn(email: string, password: string): Promise<AuthLogInResult>;
|
|
47
52
|
/**
|
|
48
53
|
* Updates the current user's password.
|
|
49
54
|
*
|
|
@@ -14,12 +14,12 @@ export declare const CompanyMembershipJSONSchema: z.ZodObject<{
|
|
|
14
14
|
accountNo: z.ZodString;
|
|
15
15
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
16
|
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
17
|
-
|
|
17
|
+
_version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
18
18
|
}, "strip", z.ZodTypeAny, {
|
|
19
19
|
id: string;
|
|
20
20
|
displayName: string;
|
|
21
21
|
accountNo: string;
|
|
22
|
-
|
|
22
|
+
_version: string;
|
|
23
23
|
firstName?: string | null | undefined;
|
|
24
24
|
lastName?: string | null | undefined;
|
|
25
25
|
phone?: string | null | undefined;
|
|
@@ -34,7 +34,7 @@ export declare const CompanyMembershipJSONSchema: z.ZodObject<{
|
|
|
34
34
|
phone?: string | null | undefined;
|
|
35
35
|
email?: string | null | undefined;
|
|
36
36
|
autoApprove?: boolean | null | undefined;
|
|
37
|
-
|
|
37
|
+
_version?: string | undefined;
|
|
38
38
|
}>;
|
|
39
39
|
role: z.ZodOptional<z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
@@ -43,12 +43,12 @@ export declare const CompanyMembershipJSONSchema: z.ZodObject<{
|
|
|
43
43
|
access: z.ZodArray<z.ZodString, "many">;
|
|
44
44
|
createdAt: z.ZodString;
|
|
45
45
|
updatedAt: z.ZodString;
|
|
46
|
-
|
|
46
|
+
_version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
48
|
name: string;
|
|
49
49
|
createdAt: string;
|
|
50
50
|
id: string;
|
|
51
|
-
|
|
51
|
+
_version: string;
|
|
52
52
|
updatedAt: string;
|
|
53
53
|
access: string[];
|
|
54
54
|
description?: string | undefined;
|
|
@@ -58,17 +58,17 @@ export declare const CompanyMembershipJSONSchema: z.ZodObject<{
|
|
|
58
58
|
id: string;
|
|
59
59
|
updatedAt: string;
|
|
60
60
|
access: string[];
|
|
61
|
-
|
|
61
|
+
_version?: string | undefined;
|
|
62
62
|
description?: string | undefined;
|
|
63
63
|
}>>;
|
|
64
|
-
|
|
64
|
+
_version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
|
-
|
|
66
|
+
_version: string;
|
|
67
67
|
companyProfile: {
|
|
68
68
|
id: string;
|
|
69
69
|
displayName: string;
|
|
70
70
|
accountNo: string;
|
|
71
|
-
|
|
71
|
+
_version: string;
|
|
72
72
|
firstName?: string | null | undefined;
|
|
73
73
|
lastName?: string | null | undefined;
|
|
74
74
|
phone?: string | null | undefined;
|
|
@@ -79,7 +79,7 @@ export declare const CompanyMembershipJSONSchema: z.ZodObject<{
|
|
|
79
79
|
name: string;
|
|
80
80
|
createdAt: string;
|
|
81
81
|
id: string;
|
|
82
|
-
|
|
82
|
+
_version: string;
|
|
83
83
|
updatedAt: string;
|
|
84
84
|
access: string[];
|
|
85
85
|
description?: string | undefined;
|
|
@@ -94,16 +94,16 @@ export declare const CompanyMembershipJSONSchema: z.ZodObject<{
|
|
|
94
94
|
phone?: string | null | undefined;
|
|
95
95
|
email?: string | null | undefined;
|
|
96
96
|
autoApprove?: boolean | null | undefined;
|
|
97
|
-
|
|
97
|
+
_version?: string | undefined;
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
_version?: string | undefined;
|
|
100
100
|
role?: {
|
|
101
101
|
name: string;
|
|
102
102
|
createdAt: string;
|
|
103
103
|
id: string;
|
|
104
104
|
updatedAt: string;
|
|
105
105
|
access: string[];
|
|
106
|
-
|
|
106
|
+
_version?: string | undefined;
|
|
107
107
|
description?: string | undefined;
|
|
108
108
|
} | undefined;
|
|
109
109
|
}>;
|
|
@@ -22,13 +22,13 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
22
22
|
createdAt: z.ZodString;
|
|
23
23
|
updatedAt: z.ZodString;
|
|
24
24
|
access: z.ZodArray<z.ZodString, "many">;
|
|
25
|
-
|
|
25
|
+
_version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
26
26
|
}, "strip", z.ZodTypeAny, {
|
|
27
27
|
type: string;
|
|
28
28
|
name: string;
|
|
29
29
|
createdAt: string;
|
|
30
30
|
id: string;
|
|
31
|
-
|
|
31
|
+
_version: string;
|
|
32
32
|
profileId: string;
|
|
33
33
|
identity: string;
|
|
34
34
|
roleId: string;
|
|
@@ -50,7 +50,7 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
50
50
|
resetPassword: boolean;
|
|
51
51
|
updatedAt: string;
|
|
52
52
|
access: string[];
|
|
53
|
-
|
|
53
|
+
_version?: string | undefined;
|
|
54
54
|
}>;
|
|
55
55
|
companyProfile: z.ZodObject<{
|
|
56
56
|
id: z.ZodString;
|
|
@@ -61,12 +61,12 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
61
61
|
accountNo: z.ZodString;
|
|
62
62
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
63
63
|
autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
64
|
-
|
|
64
|
+
_version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
65
65
|
}, "strip", z.ZodTypeAny, {
|
|
66
66
|
id: string;
|
|
67
67
|
displayName: string;
|
|
68
68
|
accountNo: string;
|
|
69
|
-
|
|
69
|
+
_version: string;
|
|
70
70
|
firstName?: string | null | undefined;
|
|
71
71
|
lastName?: string | null | undefined;
|
|
72
72
|
phone?: string | null | undefined;
|
|
@@ -81,7 +81,7 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
81
81
|
phone?: string | null | undefined;
|
|
82
82
|
email?: string | null | undefined;
|
|
83
83
|
autoApprove?: boolean | null | undefined;
|
|
84
|
-
|
|
84
|
+
_version?: string | undefined;
|
|
85
85
|
}>;
|
|
86
86
|
role: z.ZodOptional<z.ZodObject<{
|
|
87
87
|
id: z.ZodString;
|
|
@@ -90,12 +90,12 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
90
90
|
access: z.ZodArray<z.ZodString, "many">;
|
|
91
91
|
createdAt: z.ZodString;
|
|
92
92
|
updatedAt: z.ZodString;
|
|
93
|
-
|
|
93
|
+
_version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
94
94
|
}, "strip", z.ZodTypeAny, {
|
|
95
95
|
name: string;
|
|
96
96
|
createdAt: string;
|
|
97
97
|
id: string;
|
|
98
|
-
|
|
98
|
+
_version: string;
|
|
99
99
|
updatedAt: string;
|
|
100
100
|
access: string[];
|
|
101
101
|
description?: string | undefined;
|
|
@@ -105,19 +105,17 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
105
105
|
id: string;
|
|
106
106
|
updatedAt: string;
|
|
107
107
|
access: string[];
|
|
108
|
-
|
|
108
|
+
_version?: string | undefined;
|
|
109
109
|
description?: string | undefined;
|
|
110
110
|
}>>;
|
|
111
|
-
|
|
112
|
-
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
111
|
+
_version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
113
112
|
}, "strip", z.ZodTypeAny, {
|
|
114
|
-
|
|
115
|
-
version: string;
|
|
113
|
+
_version: string;
|
|
116
114
|
companyProfile: {
|
|
117
115
|
id: string;
|
|
118
116
|
displayName: string;
|
|
119
117
|
accountNo: string;
|
|
120
|
-
|
|
118
|
+
_version: string;
|
|
121
119
|
firstName?: string | null | undefined;
|
|
122
120
|
lastName?: string | null | undefined;
|
|
123
121
|
phone?: string | null | undefined;
|
|
@@ -129,7 +127,7 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
129
127
|
name: string;
|
|
130
128
|
createdAt: string;
|
|
131
129
|
id: string;
|
|
132
|
-
|
|
130
|
+
_version: string;
|
|
133
131
|
profileId: string;
|
|
134
132
|
identity: string;
|
|
135
133
|
roleId: string;
|
|
@@ -143,13 +141,12 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
143
141
|
name: string;
|
|
144
142
|
createdAt: string;
|
|
145
143
|
id: string;
|
|
146
|
-
|
|
144
|
+
_version: string;
|
|
147
145
|
updatedAt: string;
|
|
148
146
|
access: string[];
|
|
149
147
|
description?: string | undefined;
|
|
150
148
|
} | undefined;
|
|
151
149
|
}, {
|
|
152
|
-
token: string;
|
|
153
150
|
companyProfile: {
|
|
154
151
|
id: string;
|
|
155
152
|
displayName: string;
|
|
@@ -159,7 +156,7 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
159
156
|
phone?: string | null | undefined;
|
|
160
157
|
email?: string | null | undefined;
|
|
161
158
|
autoApprove?: boolean | null | undefined;
|
|
162
|
-
|
|
159
|
+
_version?: string | undefined;
|
|
163
160
|
};
|
|
164
161
|
logIn: {
|
|
165
162
|
type: string;
|
|
@@ -174,16 +171,16 @@ export declare const UserJSONSchema: z.ZodObject<{
|
|
|
174
171
|
resetPassword: boolean;
|
|
175
172
|
updatedAt: string;
|
|
176
173
|
access: string[];
|
|
177
|
-
|
|
174
|
+
_version?: string | undefined;
|
|
178
175
|
};
|
|
179
|
-
|
|
176
|
+
_version?: string | undefined;
|
|
180
177
|
role?: {
|
|
181
178
|
name: string;
|
|
182
179
|
createdAt: string;
|
|
183
180
|
id: string;
|
|
184
181
|
updatedAt: string;
|
|
185
182
|
access: string[];
|
|
186
|
-
|
|
183
|
+
_version?: string | undefined;
|
|
187
184
|
description?: string | undefined;
|
|
188
185
|
} | undefined;
|
|
189
186
|
}>;
|
|
@@ -195,17 +192,15 @@ export type UserData = {
|
|
|
195
192
|
logIn: LogIn;
|
|
196
193
|
companyProfile: Profile;
|
|
197
194
|
role?: Role;
|
|
198
|
-
token: string;
|
|
199
195
|
};
|
|
200
196
|
/**
|
|
201
|
-
* Represents the currently authenticated user
|
|
197
|
+
* Represents the currently authenticated user context.
|
|
202
198
|
*
|
|
203
199
|
* This class combines:
|
|
204
200
|
* - LogIn: User account data (identity, permissions, resetPassword, etc.)
|
|
205
201
|
* - CompanyMembership: User's relationship to their company (company profile + role)
|
|
206
|
-
* - Token: Session authentication token
|
|
207
202
|
*
|
|
208
|
-
* The User represents "who is logged in right now" with their full context.
|
|
203
|
+
* The User represents "who is logged in right now" with their full profile context.
|
|
209
204
|
*
|
|
210
205
|
* Note: The role in CompanyMembership may be undefined if the user doesn't have
|
|
211
206
|
* permission to view role details (Permissions.Role.ViewRole).
|
|
@@ -213,7 +208,6 @@ export type UserData = {
|
|
|
213
208
|
export declare class User {
|
|
214
209
|
private readonly _logIn;
|
|
215
210
|
private readonly _membership;
|
|
216
|
-
private readonly _token;
|
|
217
211
|
private readonly _permissionMap;
|
|
218
212
|
private constructor();
|
|
219
213
|
/**
|
|
@@ -228,7 +222,6 @@ export declare class User {
|
|
|
228
222
|
* logIn: logIn,
|
|
229
223
|
* companyProfile: profile,
|
|
230
224
|
* role: role, // optional
|
|
231
|
-
* token: "auth-token"
|
|
232
225
|
* });
|
|
233
226
|
* ```
|
|
234
227
|
*/
|
|
@@ -241,10 +234,6 @@ export declare class User {
|
|
|
241
234
|
* Gets the user's company membership (includes company profile and role).
|
|
242
235
|
*/
|
|
243
236
|
get membership(): CompanyMembership;
|
|
244
|
-
/**
|
|
245
|
-
* Gets the user's authentication token.
|
|
246
|
-
*/
|
|
247
|
-
get token(): string;
|
|
248
237
|
/**
|
|
249
238
|
* Convenience getter for the user's ID.
|
|
250
239
|
*/
|
|
@@ -310,8 +299,8 @@ export declare class User {
|
|
|
310
299
|
* Serializes the User instance to a JSON-compatible object
|
|
311
300
|
*
|
|
312
301
|
* This method creates a complete snapshot of the user session including
|
|
313
|
-
* all nested objects (LogIn, Profile, Role).
|
|
314
|
-
*
|
|
302
|
+
* all nested objects (LogIn, Profile, Role). Authentication tokens are kept
|
|
303
|
+
* outside of the User model and are not serialized here.
|
|
315
304
|
*
|
|
316
305
|
* @returns {UserJSON} A plain object containing all necessary User data
|
|
317
306
|
*
|
|
@@ -349,8 +338,7 @@ export declare class User {
|
|
|
349
338
|
* // From object
|
|
350
339
|
* const userJson = {
|
|
351
340
|
* logIn: { id: "...", ... },
|
|
352
|
-
* companyProfile: { id: "...", ... }
|
|
353
|
-
* token: "..."
|
|
341
|
+
* companyProfile: { id: "...", ... }
|
|
354
342
|
* };
|
|
355
343
|
* const user = User.fromJSON(userJson);
|
|
356
344
|
* ```
|