@temboplus/afloat 0.2.0-beta.8 → 0.2.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.
@@ -6,24 +6,24 @@ export declare const setGlobalTokenGetter: (getter: TokenGetter) => void;
6
6
  * BaseRepository - Generic base class for API repositories
7
7
  *
8
8
  * Provides a consistent way to interact with the Afloat API using ts-rest contracts.
9
- * Handles authentication token management through multiple fallback mechanisms.
9
+ * Handles authentication token management through explicit repository options
10
+ * or a host-provided global token getter.
10
11
  *
11
12
  * **Token Resolution Order:**
12
13
  * 1. Direct token provided in constructor
13
- * 2. Global authentication state via getCurrentToken()
14
+ * 2. Global token getter configured by the host app
14
15
  *
15
16
  * @template TContract - The API contract extending `AppRouter` from `@ts-rest/core`
16
17
  *
17
18
  * @example
18
19
  * ```typescript
19
- * // Usage 1: Direct token usage (Recommended for server-side usage)
20
+ * // Recommended authenticated usage
20
21
  * const repo = new WalletRepository("wallet", walletContract, {
21
22
  * token: "user-auth-token"
22
23
  * });
23
24
  *
24
- * // Usage 2: Global auth state (Recommended for client-side usage)
25
- * // Token automatically retrieved from AfloatAuth.instance
26
- * const repo = new WalletRepository("wallet", walletContract);
25
+ * // Advanced: the host app may also provide a global token getter,
26
+ * // but explicit tokens are the recommended integration path.
27
27
  * ```
28
28
  */
29
29
  export declare class BaseRepository<TContract extends AppRouter> {
@@ -64,8 +64,8 @@ export declare class BaseRepository<TContract extends AppRouter> {
64
64
  * root: "https://api-staging.afloat.money/v1"
65
65
  * });
66
66
  *
67
- * // Client-side using global auth state
68
- * const repo = new WalletRepository("wallet", walletContract);
67
+ * // Advanced global token getter fallback is supported,
68
+ * // but explicit tokens are the recommended integration path.
69
69
  * ```
70
70
  */
71
71
  constructor(endpoint: string, contract: TContract, options?: {
@@ -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: z.ZodObject<{
9
- type: z.ZodDefault<z.ZodString>;
10
- identity: z.ZodString;
11
- password: z.ZodString;
12
- }, "strip", z.ZodTypeAny, {
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: z.ZodObject<{
24
- profile: z.ZodObject<{
25
- id: z.ZodString;
26
- firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
- lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
- displayName: z.ZodString;
29
- phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
- accountNo: z.ZodString;
31
- email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
- autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
33
- }, "strip", z.ZodTypeAny, {
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: z.ZodString;
53
- access: z.ZodArray<z.ZodString, "many">;
54
- resetPassword: z.ZodBoolean;
55
- }, "strip", z.ZodTypeAny, {
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: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
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: z.ZodArray<z.ZodString, "many">;
90
+ 200: import("zod").ZodArray<import("zod").ZodString, "many">;
92
91
  };
93
92
  };
94
93
  resetPassword: {
95
94
  method: "PUT";
96
- body: z.ZodObject<{
97
- currentPassword: z.ZodString;
98
- newPassword: z.ZodString;
99
- }, "strip", z.ZodTypeAny, {
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 a User object on successful login
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<User>;
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
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
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
- version: string;
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
- version?: string | undefined;
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
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
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
- version: string;
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
- version?: string | undefined;
61
+ _version?: string | undefined;
62
62
  description?: string | undefined;
63
63
  }>>;
64
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
64
+ _version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
65
65
  }, "strip", z.ZodTypeAny, {
66
- version: string;
66
+ _version: string;
67
67
  companyProfile: {
68
68
  id: string;
69
69
  displayName: string;
70
70
  accountNo: string;
71
- version: string;
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
- version: string;
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
- version?: string | undefined;
97
+ _version?: string | undefined;
98
98
  };
99
- version?: string | undefined;
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
- version?: string | undefined;
106
+ _version?: string | undefined;
107
107
  description?: string | undefined;
108
108
  } | undefined;
109
109
  }>;
@@ -1,3 +1,4 @@
1
1
  export * from "./auth.repository.js";
2
+ export * from "./auth.dtos.js";
2
3
  export * from "./user.model.js";
3
4
  export * from "./company-membership.model.js";
@@ -1,4 +1,3 @@
1
- import { Permission } from "../login/permission.type.js";
2
1
  import { Profile } from "../profile/profile.model.js";
3
2
  import { LogIn } from "../login/login.model.js";
4
3
  import { CompanyMembership } from "./company-membership.model.js";
@@ -22,13 +21,13 @@ export declare const UserJSONSchema: z.ZodObject<{
22
21
  createdAt: z.ZodString;
23
22
  updatedAt: z.ZodString;
24
23
  access: z.ZodArray<z.ZodString, "many">;
25
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
24
+ _version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
26
25
  }, "strip", z.ZodTypeAny, {
27
26
  type: string;
28
27
  name: string;
29
28
  createdAt: string;
30
29
  id: string;
31
- version: string;
30
+ _version: string;
32
31
  profileId: string;
33
32
  identity: string;
34
33
  roleId: string;
@@ -50,7 +49,7 @@ export declare const UserJSONSchema: z.ZodObject<{
50
49
  resetPassword: boolean;
51
50
  updatedAt: string;
52
51
  access: string[];
53
- version?: string | undefined;
52
+ _version?: string | undefined;
54
53
  }>;
55
54
  companyProfile: z.ZodObject<{
56
55
  id: z.ZodString;
@@ -61,12 +60,12 @@ export declare const UserJSONSchema: z.ZodObject<{
61
60
  accountNo: z.ZodString;
62
61
  email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
62
  autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
64
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
63
+ _version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
65
64
  }, "strip", z.ZodTypeAny, {
66
65
  id: string;
67
66
  displayName: string;
68
67
  accountNo: string;
69
- version: string;
68
+ _version: string;
70
69
  firstName?: string | null | undefined;
71
70
  lastName?: string | null | undefined;
72
71
  phone?: string | null | undefined;
@@ -81,7 +80,7 @@ export declare const UserJSONSchema: z.ZodObject<{
81
80
  phone?: string | null | undefined;
82
81
  email?: string | null | undefined;
83
82
  autoApprove?: boolean | null | undefined;
84
- version?: string | undefined;
83
+ _version?: string | undefined;
85
84
  }>;
86
85
  role: z.ZodOptional<z.ZodObject<{
87
86
  id: z.ZodString;
@@ -90,12 +89,12 @@ export declare const UserJSONSchema: z.ZodObject<{
90
89
  access: z.ZodArray<z.ZodString, "many">;
91
90
  createdAt: z.ZodString;
92
91
  updatedAt: z.ZodString;
93
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
92
+ _version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
94
93
  }, "strip", z.ZodTypeAny, {
95
94
  name: string;
96
95
  createdAt: string;
97
96
  id: string;
98
- version: string;
97
+ _version: string;
99
98
  updatedAt: string;
100
99
  access: string[];
101
100
  description?: string | undefined;
@@ -105,19 +104,17 @@ export declare const UserJSONSchema: z.ZodObject<{
105
104
  id: string;
106
105
  updatedAt: string;
107
106
  access: string[];
108
- version?: string | undefined;
107
+ _version?: string | undefined;
109
108
  description?: string | undefined;
110
109
  }>>;
111
- token: z.ZodString;
112
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
110
+ _version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
113
111
  }, "strip", z.ZodTypeAny, {
114
- token: string;
115
- version: string;
112
+ _version: string;
116
113
  companyProfile: {
117
114
  id: string;
118
115
  displayName: string;
119
116
  accountNo: string;
120
- version: string;
117
+ _version: string;
121
118
  firstName?: string | null | undefined;
122
119
  lastName?: string | null | undefined;
123
120
  phone?: string | null | undefined;
@@ -129,7 +126,7 @@ export declare const UserJSONSchema: z.ZodObject<{
129
126
  name: string;
130
127
  createdAt: string;
131
128
  id: string;
132
- version: string;
129
+ _version: string;
133
130
  profileId: string;
134
131
  identity: string;
135
132
  roleId: string;
@@ -143,13 +140,12 @@ export declare const UserJSONSchema: z.ZodObject<{
143
140
  name: string;
144
141
  createdAt: string;
145
142
  id: string;
146
- version: string;
143
+ _version: string;
147
144
  updatedAt: string;
148
145
  access: string[];
149
146
  description?: string | undefined;
150
147
  } | undefined;
151
148
  }, {
152
- token: string;
153
149
  companyProfile: {
154
150
  id: string;
155
151
  displayName: string;
@@ -159,7 +155,7 @@ export declare const UserJSONSchema: z.ZodObject<{
159
155
  phone?: string | null | undefined;
160
156
  email?: string | null | undefined;
161
157
  autoApprove?: boolean | null | undefined;
162
- version?: string | undefined;
158
+ _version?: string | undefined;
163
159
  };
164
160
  logIn: {
165
161
  type: string;
@@ -174,16 +170,16 @@ export declare const UserJSONSchema: z.ZodObject<{
174
170
  resetPassword: boolean;
175
171
  updatedAt: string;
176
172
  access: string[];
177
- version?: string | undefined;
173
+ _version?: string | undefined;
178
174
  };
179
- version?: string | undefined;
175
+ _version?: string | undefined;
180
176
  role?: {
181
177
  name: string;
182
178
  createdAt: string;
183
179
  id: string;
184
180
  updatedAt: string;
185
181
  access: string[];
186
- version?: string | undefined;
182
+ _version?: string | undefined;
187
183
  description?: string | undefined;
188
184
  } | undefined;
189
185
  }>;
@@ -195,17 +191,15 @@ export type UserData = {
195
191
  logIn: LogIn;
196
192
  companyProfile: Profile;
197
193
  role?: Role;
198
- token: string;
199
194
  };
200
195
  /**
201
- * Represents the currently authenticated user session.
196
+ * Represents the currently authenticated user context.
202
197
  *
203
198
  * This class combines:
204
199
  * - LogIn: User account data (identity, permissions, resetPassword, etc.)
205
200
  * - CompanyMembership: User's relationship to their company (company profile + role)
206
- * - Token: Session authentication token
207
201
  *
208
- * The User represents "who is logged in right now" with their full context.
202
+ * The User represents "who is logged in right now" with their full profile context.
209
203
  *
210
204
  * Note: The role in CompanyMembership may be undefined if the user doesn't have
211
205
  * permission to view role details (Permissions.Role.ViewRole).
@@ -213,8 +207,6 @@ export type UserData = {
213
207
  export declare class User {
214
208
  private readonly _logIn;
215
209
  private readonly _membership;
216
- private readonly _token;
217
- private readonly _permissionMap;
218
210
  private constructor();
219
211
  /**
220
212
  * Creates a User instance from the provided data.
@@ -228,7 +220,6 @@ export declare class User {
228
220
  * logIn: logIn,
229
221
  * companyProfile: profile,
230
222
  * role: role, // optional
231
- * token: "auth-token"
232
223
  * });
233
224
  * ```
234
225
  */
@@ -238,13 +229,13 @@ export declare class User {
238
229
  */
239
230
  get logIn(): LogIn;
240
231
  /**
241
- * Gets the user's company membership (includes company profile and role).
232
+ * Gets the user's login data.
242
233
  */
243
- get membership(): CompanyMembership;
234
+ get login(): LogIn;
244
235
  /**
245
- * Gets the user's authentication token.
236
+ * Gets the user's company membership (includes company profile and role).
246
237
  */
247
- get token(): string;
238
+ get membership(): CompanyMembership;
248
239
  /**
249
240
  * Convenience getter for the user's ID.
250
241
  */
@@ -277,41 +268,12 @@ export declare class User {
277
268
  * Convenience getter for permissions array.
278
269
  */
279
270
  get access(): ReadonlyArray<string>;
280
- /**
281
- * Checks if the user has a specific permission.
282
- *
283
- * @param permission - The permission to check
284
- * @returns true if the user has the permission
285
- */
286
- can(permission: Permission): boolean;
287
- /**
288
- * Checks if the user has any of the specified permissions.
289
- *
290
- * @param permissions - Array of permissions to check
291
- * @returns true if the user has at least one permission
292
- */
293
- canAny(permissions: Permission[]): boolean;
294
- /**
295
- * Checks if the user has all of the specified permissions.
296
- *
297
- * @param permissions - Array of permissions to check
298
- * @returns true if the user has all permissions
299
- */
300
- canAll(permissions: Permission[]): boolean;
301
- /**
302
- * Checks if the user can manage team members.
303
- */
304
- canManageTeam(): boolean;
305
- /**
306
- * Checks if the user can view role details.
307
- */
308
- canViewRoles(): boolean;
309
271
  /**
310
272
  * Serializes the User instance to a JSON-compatible object
311
273
  *
312
274
  * This method creates a complete snapshot of the user session including
313
- * all nested objects (LogIn, Profile, Role). All data can be reconstructed
314
- * from this JSON representation without needing backend calls.
275
+ * all nested objects (LogIn, Profile, Role). Authentication tokens are kept
276
+ * outside of the User model and are not serialized here.
315
277
  *
316
278
  * @returns {UserJSON} A plain object containing all necessary User data
317
279
  *
@@ -349,8 +311,7 @@ export declare class User {
349
311
  * // From object
350
312
  * const userJson = {
351
313
  * logIn: { id: "...", ... },
352
- * companyProfile: { id: "...", ... },
353
- * token: "..."
314
+ * companyProfile: { id: "...", ... }
354
315
  * };
355
316
  * const user = User.fromJSON(userJson);
356
317
  * ```