@temboplus/afloat 0.2.0-beta.1 → 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.
Files changed (30) hide show
  1. package/README.md +150 -238
  2. package/dist/index.cjs.js +1 -1
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.esm.js +1 -1
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/lib/api/base-repository.d.ts +8 -8
  7. package/dist/lib/query/query.builder.d.ts +6 -1
  8. package/dist/modules/auth/auth.contract.d.ts +30 -28
  9. package/dist/modules/auth/auth.dtos.d.ts +117 -0
  10. package/dist/modules/auth/auth.repository.d.ts +9 -4
  11. package/dist/modules/auth/company-membership.model.d.ts +13 -13
  12. package/dist/modules/auth/index.d.ts +1 -0
  13. package/dist/modules/auth/user.model.d.ts +23 -35
  14. package/dist/modules/beneficiary/beneficiary-info.model.d.ts +113 -56
  15. package/dist/modules/beneficiary/beneficiary.model.d.ts +53 -64
  16. package/dist/modules/beneficiary/index.d.ts +2 -2
  17. package/dist/modules/login/login.model.d.ts +3 -3
  18. package/dist/modules/login/permission.type.d.ts +2 -2
  19. package/dist/modules/payout/payout-channel-handler.d.ts +7 -6
  20. package/dist/modules/payout/payout.model.d.ts +4 -4
  21. package/dist/modules/payout/payout.query.d.ts +54 -3
  22. package/dist/modules/profile/profile.model.d.ts +3 -3
  23. package/dist/modules/team-member/role.model.d.ts +3 -3
  24. package/dist/modules/team-member/team-member.model.d.ts +8 -8
  25. package/dist/modules/wallet/narration.model.d.ts +5 -5
  26. package/dist/modules/wallet/statement-entry.model.d.ts +23 -23
  27. package/dist/modules/wallet/wallet.model.d.ts +3 -3
  28. package/dist/modules/wallet/wallet.query.d.ts +31 -0
  29. package/dist/modules/wallet/wallet.repository.d.ts +2 -2
  30. package/package.json +3 -4
@@ -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?: {
@@ -64,7 +64,12 @@ export declare class QueryBuilder {
64
64
  */
65
65
  countAs(expression: string, alias: string): this;
66
66
  /**
67
- * @returns an objection-find query
67
+ * Build the query into an objection-find compatible object.
68
+ *
69
+ * Pagination (rangeStart/rangeEnd) is only included if both `page` and `limit`
70
+ * have been explicitly set via `.paginate()` or in the constructor options.
71
+ *
72
+ * @returns An objection-find query object
68
73
  */
69
74
  build(): Record<string, any>;
70
75
  /**
@@ -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";
@@ -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
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
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
- version: string;
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
- version?: string | undefined;
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
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
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
- version: string;
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
- version?: string | undefined;
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
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
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
- version: string;
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
- version?: string | undefined;
108
+ _version?: string | undefined;
109
109
  description?: string | undefined;
110
110
  }>>;
111
- token: z.ZodString;
112
- version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
111
+ _version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
113
112
  }, "strip", z.ZodTypeAny, {
114
- token: string;
115
- version: string;
113
+ _version: string;
116
114
  companyProfile: {
117
115
  id: string;
118
116
  displayName: string;
119
117
  accountNo: string;
120
- version: string;
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
- version: string;
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
- version: string;
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
- version?: string | undefined;
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
- version?: string | undefined;
174
+ _version?: string | undefined;
178
175
  };
179
- version?: string | undefined;
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
- version?: string | undefined;
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 session.
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). All data can be reconstructed
314
- * from this JSON representation without needing backend calls.
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
  * ```