@temboplus/afloat 0.1.75-0 → 0.1.77-beta.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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/api/index.d.ts +0 -1
- package/dist/lib/error/error.permission.d.ts +1 -1
- package/dist/lib/query/index.d.ts +2 -0
- package/dist/lib/query/pagination/pagination.d.ts +73 -0
- package/dist/lib/query/pagination/pagination.schemas.d.ts +83 -0
- package/dist/{features → modules}/auth/auth.contract.d.ts +2 -9
- package/dist/{features → modules}/auth/auth.manager.d.ts +2 -2
- package/dist/{features → modules}/auth/auth.repository.d.ts +18 -1
- package/dist/{features → modules}/auth/auth.store.d.ts +1 -1
- package/dist/modules/auth/company-membership.model.d.ts +58 -0
- package/dist/modules/auth/index.d.ts +4 -0
- package/dist/{features → modules}/auth/storage/client-store.d.ts +1 -1
- package/dist/{features → modules}/auth/storage/types.d.ts +1 -1
- package/dist/modules/auth/user.model.d.ts +140 -0
- package/dist/{models → modules/contact}/contact-info.model.d.ts +2 -2
- package/dist/{features → modules}/contact/contact-input-handler.d.ts +1 -1
- package/dist/{models → modules/contact}/contact.model.d.ts +1 -1
- package/dist/{features → modules}/contact/contact.repository.d.ts +2 -2
- package/dist/modules/contact/index.d.ts +4 -0
- package/dist/modules/login/index.d.ts +4 -0
- package/dist/modules/login/login.api-contract.d.ts +51 -0
- package/dist/modules/login/login.dtos.d.ts +85 -0
- package/dist/modules/login/login.model.d.ts +138 -0
- package/dist/{features/auth/identity/identity.repository.d.ts → modules/login/login.repository.d.ts} +1 -1
- package/dist/{models/permission.d.ts → modules/login/permission.type.d.ts} +8 -8
- package/dist/{features → modules}/payout/index.d.ts +2 -0
- package/dist/{features → modules}/payout/payout-channel-handler.d.ts +2 -2
- package/dist/{models → modules/payout}/payout.model.d.ts +2 -2
- package/dist/{features → modules}/payout/payout.repository.d.ts +28 -16
- package/dist/modules/profile/index.d.ts +3 -0
- package/dist/{models → modules/profile}/profile.model.d.ts +1 -1
- package/dist/{features/auth → modules}/profile/profile.repository.d.ts +1 -1
- package/dist/modules/team-member/index.d.ts +4 -0
- package/dist/{models → modules/team-member}/role.model.d.ts +2 -2
- package/dist/{features/admin/admin.contract.d.ts → modules/team-member/team-member.contract.d.ts} +230 -125
- package/dist/modules/team-member/team-member.dtos.d.ts +255 -0
- package/dist/modules/team-member/team-member.model.d.ts +137 -0
- package/dist/modules/team-member/team-member.repository.d.ts +179 -0
- package/dist/{features → modules}/wallet/index.d.ts +5 -2
- package/dist/{models → modules/wallet}/narration.model.d.ts +1 -1
- package/dist/{models → modules/wallet}/statement-entry.model.d.ts +1 -1
- package/dist/{features → modules}/wallet/wallet-manager.session.d.ts +2 -2
- package/dist/{models → modules/wallet}/wallet.model.d.ts +1 -1
- package/dist/{features → modules}/wallet/wallet.repository.d.ts +2 -2
- package/dist/{features → modules}/wallet/wallet.utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/features/admin/admin.dtos.d.ts +0 -145
- package/dist/features/admin/admin.repository.d.ts +0 -179
- package/dist/features/admin/index.d.ts +0 -2
- package/dist/features/auth/access/access.api-contract.d.ts +0 -13
- package/dist/features/auth/access/access.repository.d.ts +0 -55
- package/dist/features/auth/identity/identity.api-contract.d.ts +0 -22
- package/dist/features/auth/index.d.ts +0 -5
- package/dist/features/contact/index.d.ts +0 -2
- package/dist/lib/api/common-schemas.d.ts +0 -49
- package/dist/models/index.d.ts +0 -11
- package/dist/models/managed-user.model.d.ts +0 -108
- package/dist/models/user.model.d.ts +0 -65
- package/dist/{features → modules}/auth/storage/client-token-handler.d.ts +0 -0
- package/dist/{features → modules}/contact/contact.api-contract.d.ts +8 -8
- package/dist/{features → modules}/contact/contact.dtos.d.ts +2 -2
- package/dist/{features → modules}/payout/payout.api-contract.d.ts +53 -53
- package/dist/{features → modules}/payout/payout.dtos.d.ts +38 -38
- package/dist/{features → modules}/payout/payout.query.d.ts +0 -0
- package/dist/{features/auth → modules}/profile/profile.api-contract.d.ts +0 -0
- package/dist/{features/auth → modules}/profile/profile.dtos.d.ts +0 -0
- package/dist/{features → modules}/wallet/wallet.contract.d.ts +6 -6
- package/dist/{features → modules}/wallet/wallet.dtos.d.ts +12 -12
package/dist/lib/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Permission } from "@/
|
|
1
|
+
import { Permission } from "@/modules/login/permission.type.js";
|
|
2
2
|
/**
|
|
3
3
|
* Custom error class representing an error caused by missing required permissions.
|
|
4
4
|
* Extends the built-in {@link Error} class to include the `requiredPermissions` property.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Serialized pagination metadata for API responses */
|
|
2
|
+
export type PaginationJson = {
|
|
3
|
+
page: number;
|
|
4
|
+
limit: number;
|
|
5
|
+
total: number;
|
|
6
|
+
totalPages: number;
|
|
7
|
+
hasNext: boolean;
|
|
8
|
+
hasPrev: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Represents pagination metadata for paginated API responses.
|
|
12
|
+
* Provides computed properties for navigation and page calculations.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Pagination {
|
|
15
|
+
readonly page: number;
|
|
16
|
+
readonly limit: number;
|
|
17
|
+
readonly total: number;
|
|
18
|
+
/**
|
|
19
|
+
* @param page - Current page number (1-based)
|
|
20
|
+
* @param limit - Number of items per page
|
|
21
|
+
* @param total - Total number of items across all pages
|
|
22
|
+
*/
|
|
23
|
+
constructor(page: number, limit: number, total: number);
|
|
24
|
+
/** Total number of pages */
|
|
25
|
+
get totalPages(): number;
|
|
26
|
+
/** Whether there is a next page available */
|
|
27
|
+
get hasNext(): boolean;
|
|
28
|
+
/** Whether there is a previous page available */
|
|
29
|
+
get hasPrev(): boolean;
|
|
30
|
+
/** Offset for database queries (0-based) */
|
|
31
|
+
get offset(): number;
|
|
32
|
+
/** Whether this is the first page */
|
|
33
|
+
get isFirstPage(): boolean;
|
|
34
|
+
/** Whether this is the last page */
|
|
35
|
+
get isLastPage(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a Pagination instance for the next page.
|
|
38
|
+
* @returns New Pagination instance or null if no next page exists
|
|
39
|
+
*/
|
|
40
|
+
nextPage(): Pagination | null;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a Pagination instance for the previous page.
|
|
43
|
+
* @returns New Pagination instance or null if no previous page exists
|
|
44
|
+
*/
|
|
45
|
+
prevPage(): Pagination | null;
|
|
46
|
+
/** Converts to a plain object for JSON serialization */
|
|
47
|
+
toJSON(): {
|
|
48
|
+
page: number;
|
|
49
|
+
limit: number;
|
|
50
|
+
total: number;
|
|
51
|
+
totalPages: number;
|
|
52
|
+
hasNext: boolean;
|
|
53
|
+
hasPrev: boolean;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Generic paginated response structure */
|
|
57
|
+
export interface Paged<T> {
|
|
58
|
+
results: T[];
|
|
59
|
+
pagination: Pagination;
|
|
60
|
+
}
|
|
61
|
+
/** Type for paginated responses after JSON serialization */
|
|
62
|
+
export type PaginatedApiResponse<T> = {
|
|
63
|
+
results: T[];
|
|
64
|
+
pagination: PaginationJson;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Creates a paginated response from query results.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createPaginatedResponse<T>(results: T[], page: number, limit: number, total: number): Paged<T>;
|
|
70
|
+
/**
|
|
71
|
+
* Creates an empty paginated response.
|
|
72
|
+
*/
|
|
73
|
+
export declare function emptyPaginatedResponse<T>(page?: number, limit?: number): Paged<T>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Zod schema for validating pagination query parameters */
|
|
3
|
+
export declare const PaginationParamsSchema: z.ZodObject<{
|
|
4
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
page: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
}, {
|
|
10
|
+
page?: number | undefined;
|
|
11
|
+
limit?: number | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
/** Zod schema for validating pagination metadata */
|
|
14
|
+
export declare const PaginationSchema: z.ZodObject<{
|
|
15
|
+
page: z.ZodNumber;
|
|
16
|
+
limit: z.ZodNumber;
|
|
17
|
+
total: z.ZodNumber;
|
|
18
|
+
totalPages: z.ZodNumber;
|
|
19
|
+
hasNext: z.ZodBoolean;
|
|
20
|
+
hasPrev: z.ZodBoolean;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
page: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
total: number;
|
|
25
|
+
totalPages: number;
|
|
26
|
+
hasNext: boolean;
|
|
27
|
+
hasPrev: boolean;
|
|
28
|
+
}, {
|
|
29
|
+
page: number;
|
|
30
|
+
limit: number;
|
|
31
|
+
total: number;
|
|
32
|
+
totalPages: number;
|
|
33
|
+
hasNext: boolean;
|
|
34
|
+
hasPrev: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a Zod schema for a paginated response with typed results.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createPaginatedResponseSchema<T extends z.ZodTypeAny>(itemSchema: T): z.ZodObject<{
|
|
40
|
+
results: z.ZodArray<T, "many">;
|
|
41
|
+
pagination: z.ZodObject<{
|
|
42
|
+
page: z.ZodNumber;
|
|
43
|
+
limit: z.ZodNumber;
|
|
44
|
+
total: z.ZodNumber;
|
|
45
|
+
totalPages: z.ZodNumber;
|
|
46
|
+
hasNext: z.ZodBoolean;
|
|
47
|
+
hasPrev: z.ZodBoolean;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
page: number;
|
|
50
|
+
limit: number;
|
|
51
|
+
total: number;
|
|
52
|
+
totalPages: number;
|
|
53
|
+
hasNext: boolean;
|
|
54
|
+
hasPrev: boolean;
|
|
55
|
+
}, {
|
|
56
|
+
page: number;
|
|
57
|
+
limit: number;
|
|
58
|
+
total: number;
|
|
59
|
+
totalPages: number;
|
|
60
|
+
hasNext: boolean;
|
|
61
|
+
hasPrev: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
results: T["_output"][];
|
|
65
|
+
pagination: {
|
|
66
|
+
page: number;
|
|
67
|
+
limit: number;
|
|
68
|
+
total: number;
|
|
69
|
+
totalPages: number;
|
|
70
|
+
hasNext: boolean;
|
|
71
|
+
hasPrev: boolean;
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
results: T["_input"][];
|
|
75
|
+
pagination: {
|
|
76
|
+
page: number;
|
|
77
|
+
limit: number;
|
|
78
|
+
total: number;
|
|
79
|
+
totalPages: number;
|
|
80
|
+
hasNext: boolean;
|
|
81
|
+
hasPrev: boolean;
|
|
82
|
+
};
|
|
83
|
+
}>;
|
|
@@ -54,6 +54,7 @@ export declare const authContract: {
|
|
|
54
54
|
resetPassword: z.ZodBoolean;
|
|
55
55
|
}, "strip", z.ZodTypeAny, {
|
|
56
56
|
resetPassword: boolean;
|
|
57
|
+
access: string[];
|
|
57
58
|
profile: {
|
|
58
59
|
id: string;
|
|
59
60
|
displayName: string;
|
|
@@ -65,9 +66,9 @@ export declare const authContract: {
|
|
|
65
66
|
autoApprove?: boolean | null | undefined;
|
|
66
67
|
};
|
|
67
68
|
token: string;
|
|
68
|
-
access: string[];
|
|
69
69
|
}, {
|
|
70
70
|
resetPassword: boolean;
|
|
71
|
+
access: string[];
|
|
71
72
|
profile: {
|
|
72
73
|
id: string;
|
|
73
74
|
displayName: string;
|
|
@@ -79,7 +80,6 @@ export declare const authContract: {
|
|
|
79
80
|
autoApprove?: boolean | null | undefined;
|
|
80
81
|
};
|
|
81
82
|
token: string;
|
|
82
|
-
access: string[];
|
|
83
83
|
}>;
|
|
84
84
|
400: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
85
85
|
};
|
|
@@ -87,13 +87,6 @@ export declare const authContract: {
|
|
|
87
87
|
access: {
|
|
88
88
|
method: "GET";
|
|
89
89
|
path: "/access";
|
|
90
|
-
headers: z.ZodObject<{
|
|
91
|
-
token: z.ZodString;
|
|
92
|
-
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
token: string;
|
|
94
|
-
}, {
|
|
95
|
-
token: string;
|
|
96
|
-
}>;
|
|
97
90
|
responses: {
|
|
98
91
|
200: z.ZodArray<z.ZodString, "many">;
|
|
99
92
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Permission } from "@/
|
|
2
|
-
import { User } from "@/
|
|
1
|
+
import { Permission } from "@/modules/login/permission.type.js";
|
|
2
|
+
import { User } from "@/modules/auth/user.model.js";
|
|
3
3
|
/**
|
|
4
4
|
* Clean authentication manager for client-side usage only.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseRepository } from "@/lib/api/base-repository.js";
|
|
2
|
-
import { User } from "@/
|
|
2
|
+
import { User } from "@/modules/auth/user.model.js";
|
|
3
3
|
import { authContract } from "./auth.contract.js";
|
|
4
4
|
/**
|
|
5
5
|
* Repository class for handling authentication-related operations.
|
|
@@ -63,4 +63,21 @@ export declare class AuthRepository extends BaseRepository<typeof authContract>
|
|
|
63
63
|
* ```
|
|
64
64
|
*/
|
|
65
65
|
updatePassword(currentPassword: string, newPassword: string): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Retrieves the current user's access list.
|
|
68
|
+
*
|
|
69
|
+
* @returns Promise that resolves to an array of access permissions/roles
|
|
70
|
+
* @throws {APIError} If the request fails or returns an unexpected status
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* try {
|
|
75
|
+
* const accessList = await repo.getAccessList();
|
|
76
|
+
* console.log("User has access to:", accessList);
|
|
77
|
+
* } catch (error) {
|
|
78
|
+
* console.error("Failed to get access list:", error.message);
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
getAccessList(): Promise<string[]>;
|
|
66
83
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Profile } from "../profile/profile.model.js";
|
|
2
|
+
import { Role } from "../team-member/role.model.js";
|
|
3
|
+
export interface CompanyMembershipData {
|
|
4
|
+
companyProfile: Profile;
|
|
5
|
+
role?: Role;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Represents a user's membership within a company.
|
|
9
|
+
*
|
|
10
|
+
* This class encapsulates the relationship between a user and their company:
|
|
11
|
+
* - The company profile the user belongs to
|
|
12
|
+
* - The user's role within that company (optional - depends on permissions)
|
|
13
|
+
*
|
|
14
|
+
* Note: Permissions are stored in LogIn.access, not here.
|
|
15
|
+
* This model focuses purely on the company-user relationship.
|
|
16
|
+
*
|
|
17
|
+
* The role may be undefined if the user doesn't have permission to view
|
|
18
|
+
* role details (Permissions.Role.ViewRole).
|
|
19
|
+
*/
|
|
20
|
+
export declare class CompanyMembership {
|
|
21
|
+
private readonly _companyProfile;
|
|
22
|
+
private readonly _role?;
|
|
23
|
+
private constructor();
|
|
24
|
+
/**
|
|
25
|
+
* Creates a CompanyMembership instance from the required data.
|
|
26
|
+
*
|
|
27
|
+
* @param data - The membership data
|
|
28
|
+
* @returns A new CompanyMembership instance, or undefined if invalid
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const membership = CompanyMembership.from({
|
|
33
|
+
* companyProfile: profile,
|
|
34
|
+
* role: role // optional
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
static from(data: CompanyMembershipData): CompanyMembership | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Gets the company profile.
|
|
41
|
+
*/
|
|
42
|
+
get companyProfile(): Profile;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the user's role (may be undefined if user lacks permission to view it).
|
|
45
|
+
*/
|
|
46
|
+
get role(): Role | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Converts the membership to a plain object.
|
|
49
|
+
*/
|
|
50
|
+
toObject(): {
|
|
51
|
+
companyProfile: ReturnType<Profile['toObject']>;
|
|
52
|
+
role?: ReturnType<Role['toJSON']>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Converts the membership to a JSON string.
|
|
56
|
+
*/
|
|
57
|
+
toJson(): string;
|
|
58
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type StoreApi, type UseBoundStore } from "zustand";
|
|
2
2
|
import type { AuthStore } from "./types.js";
|
|
3
|
-
import { User } from "@/
|
|
3
|
+
import { User } from "@/modules/auth/user.model.js";
|
|
4
4
|
/** Type definition for the store's state */
|
|
5
5
|
type State = {
|
|
6
6
|
user: string | undefined;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Permission } from "../login/permission.type.js";
|
|
2
|
+
import { Profile } from "../profile/profile.model.js";
|
|
3
|
+
import { LogIn } from "../login/login.model.js";
|
|
4
|
+
import { CompanyMembership } from "./company-membership.model.js";
|
|
5
|
+
import { Role } from "../team-member/role.model.js";
|
|
6
|
+
export interface UserData {
|
|
7
|
+
logIn: LogIn;
|
|
8
|
+
companyProfile: Profile;
|
|
9
|
+
role?: Role;
|
|
10
|
+
token: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Represents the currently authenticated user session.
|
|
14
|
+
*
|
|
15
|
+
* This class combines:
|
|
16
|
+
* - LogIn: User account data (identity, permissions, resetPassword, etc.)
|
|
17
|
+
* - CompanyMembership: User's relationship to their company (company profile + role)
|
|
18
|
+
* - Token: Session authentication token
|
|
19
|
+
*
|
|
20
|
+
* The User represents "who is logged in right now" with their full context.
|
|
21
|
+
*
|
|
22
|
+
* Note: The role in CompanyMembership may be undefined if the user doesn't have
|
|
23
|
+
* permission to view role details (Permissions.Role.ViewRole).
|
|
24
|
+
*/
|
|
25
|
+
export declare class User {
|
|
26
|
+
private readonly _logIn;
|
|
27
|
+
private readonly _membership;
|
|
28
|
+
private readonly _token;
|
|
29
|
+
private readonly _permissionMap;
|
|
30
|
+
private constructor();
|
|
31
|
+
/**
|
|
32
|
+
* Creates a User instance from the provided data.
|
|
33
|
+
*
|
|
34
|
+
* @param data - User session data
|
|
35
|
+
* @returns A new User instance, or undefined if data is invalid
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const user = User.from({
|
|
40
|
+
* logIn: logIn,
|
|
41
|
+
* companyProfile: profile,
|
|
42
|
+
* role: role, // optional
|
|
43
|
+
* token: "auth-token"
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
static from(data: UserData): User | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a User instance from a JSON string.
|
|
50
|
+
*
|
|
51
|
+
* @param jsonString - JSON string containing user data
|
|
52
|
+
* @returns A new User instance, or undefined if parsing failed
|
|
53
|
+
*/
|
|
54
|
+
static fromJson(jsonString: string): User | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the user's login data.
|
|
57
|
+
*/
|
|
58
|
+
get logIn(): LogIn;
|
|
59
|
+
/**
|
|
60
|
+
* Gets the user's company membership (includes company profile and role).
|
|
61
|
+
*/
|
|
62
|
+
get membership(): CompanyMembership;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the user's authentication token.
|
|
65
|
+
*/
|
|
66
|
+
get token(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Convenience getter for the user's ID.
|
|
69
|
+
*/
|
|
70
|
+
get id(): string;
|
|
71
|
+
/**
|
|
72
|
+
* Convenience getter for the user's name.
|
|
73
|
+
*/
|
|
74
|
+
get name(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Convenience getter for the user's identity (email).
|
|
77
|
+
*/
|
|
78
|
+
get identity(): string;
|
|
79
|
+
/**
|
|
80
|
+
* Convenience getter for the user's role ID.
|
|
81
|
+
*/
|
|
82
|
+
get roleId(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Convenience getter for whether the user must reset their password.
|
|
85
|
+
*/
|
|
86
|
+
get resetPassword(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Convenience getter for the company profile.
|
|
89
|
+
*/
|
|
90
|
+
get profile(): Profile;
|
|
91
|
+
/**
|
|
92
|
+
* Convenience getter for the user's role (may be undefined).
|
|
93
|
+
*/
|
|
94
|
+
get role(): Role | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Convenience getter for permissions array.
|
|
97
|
+
*/
|
|
98
|
+
get access(): ReadonlyArray<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Checks if the user has a specific permission.
|
|
101
|
+
*
|
|
102
|
+
* @param permission - The permission to check
|
|
103
|
+
* @returns true if the user has the permission
|
|
104
|
+
*/
|
|
105
|
+
can(permission: Permission): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Checks if the user has any of the specified permissions.
|
|
108
|
+
*
|
|
109
|
+
* @param permissions - Array of permissions to check
|
|
110
|
+
* @returns true if the user has at least one permission
|
|
111
|
+
*/
|
|
112
|
+
canAny(permissions: Permission[]): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Checks if the user has all of the specified permissions.
|
|
115
|
+
*
|
|
116
|
+
* @param permissions - Array of permissions to check
|
|
117
|
+
* @returns true if the user has all permissions
|
|
118
|
+
*/
|
|
119
|
+
canAll(permissions: Permission[]): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Checks if the user can manage team members.
|
|
122
|
+
*/
|
|
123
|
+
canManageTeam(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Checks if the user can view role details.
|
|
126
|
+
*/
|
|
127
|
+
canViewRoles(): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Converts the User instance to a plain object.
|
|
130
|
+
*
|
|
131
|
+
* @returns A plain object representation suitable for serialization
|
|
132
|
+
*/
|
|
133
|
+
toObject(): Record<string, any>;
|
|
134
|
+
/**
|
|
135
|
+
* Converts the User instance to a JSON string.
|
|
136
|
+
*
|
|
137
|
+
* @returns A JSON string representation
|
|
138
|
+
*/
|
|
139
|
+
toJson(): string;
|
|
140
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContactType, ContactDTO } from "@/
|
|
2
|
-
import { PayoutDTO } from "@/
|
|
1
|
+
import { ContactType, ContactDTO } from "@/modules/contact/contact.dtos.js";
|
|
2
|
+
import { PayoutDTO } from "@/modules/payout/payout.dtos.js";
|
|
3
3
|
import { Bank, ISO2CountryCode, PhoneNumber } from "@temboplus/frontend-core";
|
|
4
4
|
import type { BankSwiftCode, MNOId } from "@temboplus/frontend-core";
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContactInfo } from "@/
|
|
1
|
+
import { ContactInfo } from "@/modules/contact/contact-info.model.js";
|
|
2
2
|
import { ContactInputDTO } from "./contact.dtos.js";
|
|
3
3
|
/**
|
|
4
4
|
* Factory for resolving and validating a raw `ContactInput` into a typed and valid version.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContactDTO, ContactType } from "@/
|
|
1
|
+
import { ContactDTO, ContactType } from "@/modules/contact/contact.dtos.js";
|
|
2
2
|
import { ContactInfo } from "./contact-info.model.js";
|
|
3
3
|
/**
|
|
4
4
|
* Contact class that wraps the Zod schema and provides additional functionality
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRepository } from "@/lib/api/base-repository.js";
|
|
2
|
-
import { ContactInfo } from "@/
|
|
3
|
-
import { Contact } from "@/
|
|
2
|
+
import { ContactInfo } from "@/modules/contact/contact-info.model.js";
|
|
3
|
+
import { Contact } from "@/modules/contact/contact.model.js";
|
|
4
4
|
import { contract } from "./contact.api-contract.js";
|
|
5
5
|
/**
|
|
6
6
|
* Repository class for managing Contact data through API interactions.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity API contract
|
|
3
|
+
*/
|
|
4
|
+
export declare const identityContract: {
|
|
5
|
+
getUserCredentials: {
|
|
6
|
+
method: "GET";
|
|
7
|
+
path: "/me";
|
|
8
|
+
responses: {
|
|
9
|
+
200: import("zod").ZodObject<{
|
|
10
|
+
id: import("zod").ZodString;
|
|
11
|
+
profileId: import("zod").ZodString;
|
|
12
|
+
name: import("zod").ZodString;
|
|
13
|
+
identity: import("zod").ZodString;
|
|
14
|
+
type: import("zod").ZodString;
|
|
15
|
+
roleId: import("zod").ZodString;
|
|
16
|
+
isActive: import("zod").ZodBoolean;
|
|
17
|
+
isArchived: import("zod").ZodBoolean;
|
|
18
|
+
resetPassword: import("zod").ZodBoolean;
|
|
19
|
+
createdAt: import("zod").ZodString;
|
|
20
|
+
updatedAt: import("zod").ZodString;
|
|
21
|
+
access: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
22
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
23
|
+
type: string;
|
|
24
|
+
name: string;
|
|
25
|
+
id: string;
|
|
26
|
+
profileId: string;
|
|
27
|
+
identity: string;
|
|
28
|
+
roleId: string;
|
|
29
|
+
isActive: boolean;
|
|
30
|
+
isArchived: boolean;
|
|
31
|
+
resetPassword: boolean;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
access: string[];
|
|
35
|
+
}, {
|
|
36
|
+
type: string;
|
|
37
|
+
name: string;
|
|
38
|
+
id: string;
|
|
39
|
+
profileId: string;
|
|
40
|
+
identity: string;
|
|
41
|
+
roleId: string;
|
|
42
|
+
isActive: boolean;
|
|
43
|
+
isArchived: boolean;
|
|
44
|
+
resetPassword: boolean;
|
|
45
|
+
createdAt: string;
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
access: string[];
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
declare const LogInDTOSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
profileId: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
identity: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
8
|
+
roleId: z.ZodString;
|
|
9
|
+
isActive: z.ZodBoolean;
|
|
10
|
+
isArchived: z.ZodBoolean;
|
|
11
|
+
resetPassword: z.ZodBoolean;
|
|
12
|
+
createdAt: z.ZodString;
|
|
13
|
+
updatedAt: z.ZodString;
|
|
14
|
+
access: z.ZodArray<z.ZodString, "many">;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
type: string;
|
|
17
|
+
name: string;
|
|
18
|
+
id: string;
|
|
19
|
+
profileId: string;
|
|
20
|
+
identity: string;
|
|
21
|
+
roleId: string;
|
|
22
|
+
isActive: boolean;
|
|
23
|
+
isArchived: boolean;
|
|
24
|
+
resetPassword: boolean;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
access: string[];
|
|
28
|
+
}, {
|
|
29
|
+
type: string;
|
|
30
|
+
name: string;
|
|
31
|
+
id: string;
|
|
32
|
+
profileId: string;
|
|
33
|
+
identity: string;
|
|
34
|
+
roleId: string;
|
|
35
|
+
isActive: boolean;
|
|
36
|
+
isArchived: boolean;
|
|
37
|
+
resetPassword: boolean;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
access: string[];
|
|
41
|
+
}>;
|
|
42
|
+
export declare const LogInSchemas: {
|
|
43
|
+
loginDTO: z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
profileId: z.ZodString;
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
identity: z.ZodString;
|
|
48
|
+
type: z.ZodString;
|
|
49
|
+
roleId: z.ZodString;
|
|
50
|
+
isActive: z.ZodBoolean;
|
|
51
|
+
isArchived: z.ZodBoolean;
|
|
52
|
+
resetPassword: z.ZodBoolean;
|
|
53
|
+
createdAt: z.ZodString;
|
|
54
|
+
updatedAt: z.ZodString;
|
|
55
|
+
access: z.ZodArray<z.ZodString, "many">;
|
|
56
|
+
}, "strip", z.ZodTypeAny, {
|
|
57
|
+
type: string;
|
|
58
|
+
name: string;
|
|
59
|
+
id: string;
|
|
60
|
+
profileId: string;
|
|
61
|
+
identity: string;
|
|
62
|
+
roleId: string;
|
|
63
|
+
isActive: boolean;
|
|
64
|
+
isArchived: boolean;
|
|
65
|
+
resetPassword: boolean;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
access: string[];
|
|
69
|
+
}, {
|
|
70
|
+
type: string;
|
|
71
|
+
name: string;
|
|
72
|
+
id: string;
|
|
73
|
+
profileId: string;
|
|
74
|
+
identity: string;
|
|
75
|
+
roleId: string;
|
|
76
|
+
isActive: boolean;
|
|
77
|
+
isArchived: boolean;
|
|
78
|
+
resetPassword: boolean;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
updatedAt: string;
|
|
81
|
+
access: string[];
|
|
82
|
+
}>;
|
|
83
|
+
};
|
|
84
|
+
export type LogInDTO = z.infer<typeof LogInDTOSchema>;
|
|
85
|
+
export {};
|