@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.
Files changed (73) hide show
  1. package/dist/index.cjs.js +1 -1
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +7 -6
  4. package/dist/index.esm.js +1 -1
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/lib/api/index.d.ts +0 -1
  7. package/dist/lib/error/error.permission.d.ts +1 -1
  8. package/dist/lib/query/index.d.ts +2 -0
  9. package/dist/lib/query/pagination/pagination.d.ts +73 -0
  10. package/dist/lib/query/pagination/pagination.schemas.d.ts +83 -0
  11. package/dist/{features → modules}/auth/auth.contract.d.ts +2 -9
  12. package/dist/{features → modules}/auth/auth.manager.d.ts +2 -2
  13. package/dist/{features → modules}/auth/auth.repository.d.ts +18 -1
  14. package/dist/{features → modules}/auth/auth.store.d.ts +1 -1
  15. package/dist/modules/auth/company-membership.model.d.ts +58 -0
  16. package/dist/modules/auth/index.d.ts +4 -0
  17. package/dist/{features → modules}/auth/storage/client-store.d.ts +1 -1
  18. package/dist/{features → modules}/auth/storage/types.d.ts +1 -1
  19. package/dist/modules/auth/user.model.d.ts +140 -0
  20. package/dist/{models → modules/contact}/contact-info.model.d.ts +2 -2
  21. package/dist/{features → modules}/contact/contact-input-handler.d.ts +1 -1
  22. package/dist/{models → modules/contact}/contact.model.d.ts +1 -1
  23. package/dist/{features → modules}/contact/contact.repository.d.ts +2 -2
  24. package/dist/modules/contact/index.d.ts +4 -0
  25. package/dist/modules/login/index.d.ts +4 -0
  26. package/dist/modules/login/login.api-contract.d.ts +51 -0
  27. package/dist/modules/login/login.dtos.d.ts +85 -0
  28. package/dist/modules/login/login.model.d.ts +138 -0
  29. package/dist/{features/auth/identity/identity.repository.d.ts → modules/login/login.repository.d.ts} +1 -1
  30. package/dist/{models/permission.d.ts → modules/login/permission.type.d.ts} +8 -8
  31. package/dist/{features → modules}/payout/index.d.ts +2 -0
  32. package/dist/{features → modules}/payout/payout-channel-handler.d.ts +2 -2
  33. package/dist/{models → modules/payout}/payout.model.d.ts +2 -2
  34. package/dist/{features → modules}/payout/payout.repository.d.ts +28 -16
  35. package/dist/modules/profile/index.d.ts +3 -0
  36. package/dist/{models → modules/profile}/profile.model.d.ts +1 -1
  37. package/dist/{features/auth → modules}/profile/profile.repository.d.ts +1 -1
  38. package/dist/modules/team-member/index.d.ts +4 -0
  39. package/dist/{models → modules/team-member}/role.model.d.ts +2 -2
  40. package/dist/{features/admin/admin.contract.d.ts → modules/team-member/team-member.contract.d.ts} +230 -125
  41. package/dist/modules/team-member/team-member.dtos.d.ts +255 -0
  42. package/dist/modules/team-member/team-member.model.d.ts +137 -0
  43. package/dist/modules/team-member/team-member.repository.d.ts +179 -0
  44. package/dist/{features → modules}/wallet/index.d.ts +5 -2
  45. package/dist/{models → modules/wallet}/narration.model.d.ts +1 -1
  46. package/dist/{models → modules/wallet}/statement-entry.model.d.ts +1 -1
  47. package/dist/{features → modules}/wallet/wallet-manager.session.d.ts +2 -2
  48. package/dist/{models → modules/wallet}/wallet.model.d.ts +1 -1
  49. package/dist/{features → modules}/wallet/wallet.repository.d.ts +2 -2
  50. package/dist/{features → modules}/wallet/wallet.utils.d.ts +1 -1
  51. package/package.json +1 -1
  52. package/dist/features/admin/admin.dtos.d.ts +0 -145
  53. package/dist/features/admin/admin.repository.d.ts +0 -179
  54. package/dist/features/admin/index.d.ts +0 -2
  55. package/dist/features/auth/access/access.api-contract.d.ts +0 -13
  56. package/dist/features/auth/access/access.repository.d.ts +0 -55
  57. package/dist/features/auth/identity/identity.api-contract.d.ts +0 -22
  58. package/dist/features/auth/index.d.ts +0 -5
  59. package/dist/features/contact/index.d.ts +0 -2
  60. package/dist/lib/api/common-schemas.d.ts +0 -49
  61. package/dist/models/index.d.ts +0 -11
  62. package/dist/models/managed-user.model.d.ts +0 -108
  63. package/dist/models/user.model.d.ts +0 -65
  64. package/dist/{features → modules}/auth/storage/client-token-handler.d.ts +0 -0
  65. package/dist/{features → modules}/contact/contact.api-contract.d.ts +8 -8
  66. package/dist/{features → modules}/contact/contact.dtos.d.ts +2 -2
  67. package/dist/{features → modules}/payout/payout.api-contract.d.ts +53 -53
  68. package/dist/{features → modules}/payout/payout.dtos.d.ts +38 -38
  69. package/dist/{features → modules}/payout/payout.query.d.ts +0 -0
  70. package/dist/{features/auth → modules}/profile/profile.api-contract.d.ts +0 -0
  71. package/dist/{features/auth → modules}/profile/profile.dtos.d.ts +0 -0
  72. package/dist/{features → modules}/wallet/wallet.contract.d.ts +6 -6
  73. package/dist/{features → modules}/wallet/wallet.dtos.d.ts +12 -12
@@ -0,0 +1,138 @@
1
+ import { LogInDTO } from "./login.dtos.js";
2
+ export type LogInJson = {
3
+ id: string;
4
+ profileId: string;
5
+ name: string;
6
+ identity: string;
7
+ type: string;
8
+ roleId: string;
9
+ isActive: boolean;
10
+ isArchived: boolean;
11
+ resetPassword: boolean;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ access: string[];
15
+ };
16
+ /**
17
+ * Represents the authenticated user's identity and account information.
18
+ *
19
+ * This class encapsulates the complete user account data returned from /login/me:
20
+ * - Basic identity: name, email (identity)
21
+ * - Account metadata: id, profileId, type, roleId
22
+ * - Account status: isActive, isArchived, resetPassword
23
+ * - Permissions: access array
24
+ * - Audit trail: createdAt, updatedAt
25
+ */
26
+ export declare class LogIn {
27
+ private readonly _id;
28
+ private readonly _profileId;
29
+ private readonly _name;
30
+ private readonly _identity;
31
+ private readonly _type;
32
+ private readonly _roleId;
33
+ private readonly _isActive;
34
+ private readonly _isArchived;
35
+ private readonly _resetPassword;
36
+ private readonly _createdAt;
37
+ private readonly _updatedAt;
38
+ private readonly _access;
39
+ private constructor();
40
+ /**
41
+ * Creates a LogIn instance from a validated DTO.
42
+ *
43
+ * @param dto - The login data transfer object from /login/me endpoint
44
+ * @returns A new LogIn instance
45
+ * @throws {ZodError} If the DTO fails validation
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const logIn = LogIn.from({
50
+ * id: "n4mpb2HqHUlg",
51
+ * profileId: "M63ZW3q5Mg0n",
52
+ * name: "Admin",
53
+ * identity: "admin@test.temboplus.com",
54
+ * type: "password",
55
+ * roleId: "4jS7pR8E9K6W",
56
+ * isActive: true,
57
+ * isArchived: false,
58
+ * resetPassword: false,
59
+ * createdAt: "2024-04-25T11:13:00.000Z",
60
+ * updatedAt: "2024-04-25T11:13:00.000Z",
61
+ * access: ["profile.getCurrent", "profile.update", ...]
62
+ * });
63
+ * ```
64
+ */
65
+ static from(dto: LogInDTO): LogIn;
66
+ /**
67
+ * Creates a LogIn instance from a JSON string.
68
+ *
69
+ * @param json - JSON string containing login data
70
+ * @returns A new LogIn instance, or undefined if parsing failed
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * const logIn = LogIn.fromJson('{"id":"abc","name":"John",...}');
75
+ * ```
76
+ */
77
+ static fromJson(json: string): LogIn | undefined;
78
+ /**
79
+ * Gets the user's unique identifier.
80
+ */
81
+ get id(): string;
82
+ /**
83
+ * Gets the profile ID this user belongs to.
84
+ */
85
+ get profileId(): string;
86
+ /**
87
+ * Gets the user's name.
88
+ */
89
+ get name(): string;
90
+ /**
91
+ * Gets the user's identity (email address).
92
+ */
93
+ get identity(): string;
94
+ /**
95
+ * Gets the user's authentication type (e.g., "password").
96
+ */
97
+ get type(): string;
98
+ /**
99
+ * Gets the user's role ID.
100
+ */
101
+ get roleId(): string;
102
+ /**
103
+ * Gets whether the account is active.
104
+ */
105
+ get isActive(): boolean;
106
+ /**
107
+ * Gets whether the account is archived.
108
+ */
109
+ get isArchived(): boolean;
110
+ /**
111
+ * Gets whether the user must reset their password.
112
+ */
113
+ get resetPassword(): boolean;
114
+ /**
115
+ * Gets the account creation date.
116
+ */
117
+ get createdAt(): Date;
118
+ /**
119
+ * Gets the last update date.
120
+ */
121
+ get updatedAt(): Date;
122
+ /**
123
+ * Gets the user's permissions/access list.
124
+ */
125
+ get access(): ReadonlyArray<string>;
126
+ /**
127
+ * Converts the LogIn instance to a plain object.
128
+ *
129
+ * @returns A plain object representation
130
+ */
131
+ toObject(): LogInJson;
132
+ /**
133
+ * Converts the LogIn instance to a JSON string.
134
+ *
135
+ * @returns A JSON string representation
136
+ */
137
+ toJson(): string;
138
+ }
@@ -1,4 +1,4 @@
1
- import { identityContract } from "./identity.api-contract.js";
1
+ import { identityContract } from "./login.api-contract.js";
2
2
  import type { ClientInferResponseBody } from "@ts-rest/core";
3
3
  import { BaseRepository } from "@/lib/api/base-repository.js";
4
4
  type GetUserIdentityResponse = ClientInferResponseBody<typeof identityContract.getUserCredentials>;
@@ -38,17 +38,17 @@ export declare const Permissions: {
38
38
  readonly ViewRoles: "role.findAll";
39
39
  readonly ViewRole: "role.findById";
40
40
  };
41
- readonly UserManagement: {
42
- readonly ViewUsers: "login.findAll";
43
- readonly ViewUser: "login.findById";
44
- readonly CreateUser: "login.create";
45
- readonly UpdateUser: "login.update";
46
- readonly ArchiveUser: "login.archive";
47
- readonly UnArchiveUser: "login.unarchive";
41
+ readonly TeamManagement: {
42
+ readonly ViewMembers: "login.findAll";
43
+ readonly ViewMember: "login.findById";
44
+ readonly CreateMember: "login.create";
45
+ readonly UpdateMember: "login.update";
46
+ readonly ArchiveMember: "login.archive";
47
+ readonly UnArchiveMember: "login.unarchive";
48
48
  readonly ResetPassword: "login.resetPassword";
49
49
  };
50
50
  };
51
51
  /**
52
52
  * Permission Type
53
53
  */
54
- export type Permission = (typeof Permissions.Profile)[keyof typeof Permissions.Profile] | (typeof Permissions.Contact)[keyof typeof Permissions.Contact] | (typeof Permissions.Payment)[keyof typeof Permissions.Payment] | (typeof Permissions.Payout)[keyof typeof Permissions.Payout] | (typeof Permissions.Transfer)[keyof typeof Permissions.Transfer] | (typeof Permissions.UserManagement)[keyof typeof Permissions.UserManagement] | (typeof Permissions.Role)[keyof typeof Permissions.Role] | (typeof Permissions.Wallet)[keyof typeof Permissions.Wallet];
54
+ export type Permission = (typeof Permissions.Profile)[keyof typeof Permissions.Profile] | (typeof Permissions.Contact)[keyof typeof Permissions.Contact] | (typeof Permissions.Payment)[keyof typeof Permissions.Payment] | (typeof Permissions.Payout)[keyof typeof Permissions.Payout] | (typeof Permissions.Transfer)[keyof typeof Permissions.Transfer] | (typeof Permissions.TeamManagement)[keyof typeof Permissions.TeamManagement] | (typeof Permissions.Role)[keyof typeof Permissions.Role] | (typeof Permissions.Wallet)[keyof typeof Permissions.Wallet];
@@ -1,3 +1,5 @@
1
1
  export * from "./payout.repository.js";
2
2
  export * from "./payout.dtos.js";
3
3
  export * from "./payout-channel-handler.js";
4
+ export * from "./payout.model.js";
5
+ export * from "./payout.query.js";
@@ -1,5 +1,5 @@
1
- import { ContactInfo, BankContactInfo } from "@/models/contact-info.model.js";
2
- import { Wallet } from "@/models/wallet.model.js";
1
+ import { ContactInfo, BankContactInfo } from "@/modules/contact/contact-info.model.js";
2
+ import { Wallet } from "@/modules/wallet/wallet.model.js";
3
3
  import { Amount, MNOId, PhoneNumber } from "@temboplus/frontend-core";
4
4
  import { PayoutChannel, PayoutInputDTO } from "./payout.dtos.js";
5
5
  /**
@@ -1,6 +1,6 @@
1
- import { PayoutDTO, PayoutStatus, PayoutApprovalStatus, PayoutAuthorizer } from "@/features/payout/payout.dtos.js";
1
+ import { PayoutDTO, PayoutStatus, PayoutApprovalStatus, PayoutAuthorizer } from "@/modules/payout/payout.dtos.js";
2
2
  import { Amount } from "@temboplus/frontend-core";
3
- import { ContactInfo } from "./contact-info.model.js";
3
+ import { ContactInfo } from "../contact/contact-info.model.js";
4
4
  /**
5
5
  * Payout class that wraps the Zod schema and provides additional functionality
6
6
  */
@@ -1,11 +1,12 @@
1
- import { BaseRepository, PaginationDTO } from "@/lib/api/index.js";
2
- import { ContactInfo } from "@/models/contact-info.model.js";
3
- import { Payout } from "@/models/payout.model.js";
1
+ import { BaseRepository } from "@/lib/api/index.js";
2
+ import { ContactInfo } from "@/modules/contact/contact-info.model.js";
3
+ import { Payout } from "@/modules/payout/payout.model.js";
4
4
  import { Amount } from "@temboplus/frontend-core";
5
5
  import { PayoutAPI } from "./payout.api-contract.js";
6
6
  import { PayoutChannel } from "./payout.dtos.js";
7
7
  import { PayoutQuery } from "./payout.query.js";
8
8
  import { PayoutFilters } from "./payout.dtos.js";
9
+ import { Paged } from "@/lib/query/index.js";
9
10
  /**
10
11
  * Flexible query input type - supports the class, filters interface, URL params, etc.
11
12
  */
@@ -45,11 +46,11 @@ export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
45
46
  root?: string;
46
47
  });
47
48
  /**
48
- * Get all payouts with filtering and pagination.
49
- * Accepts flexible input types and normalizes them to PayoutQuery.
49
+ * Get paginated payouts with filtering.
50
+ * Always returns paginated results with metadata.
50
51
  *
51
52
  * @param query - Query parameters in any supported format
52
- * @returns Promise resolving to payouts and pagination info
53
+ * @returns Promise resolving to paginated payouts
53
54
  *
54
55
  * @example
55
56
  * ```typescript
@@ -66,18 +67,29 @@ export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
66
67
  * const result3 = await repo.getPayouts(query);
67
68
  * ```
68
69
  */
69
- getPayouts(query?: PayoutQueryInput): Promise<{
70
- payouts: Payout[];
71
- pagination: PaginationDTO;
72
- }>;
70
+ getPayouts(query?: PayoutQueryInput): Promise<Paged<Payout>>;
73
71
  /**
74
- * Convenience method for Next.js API routes
75
- * Extracts search params directly from Request object
72
+ * Get all payouts without pagination.
73
+ * Returns a plain array of all matching results.
74
+ *
75
+ * @param query - Query parameters (pagination params will be ignored)
76
+ * @returns Promise resolving to array of all payouts
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * // Get all pending payouts for a dropdown
81
+ * const allPending = await repo.getAllPayouts({ approvalStatus: 'Pending' });
82
+ *
83
+ * // Get all payouts without any filters
84
+ * const allPayouts = await repo.getAllPayouts();
85
+ * ```
86
+ */
87
+ getAllPayouts(query?: PayoutQueryInput): Promise<Payout[]>;
88
+ /**
89
+ * Convenience method for Next.js API routes.
90
+ * Extracts search params directly from Request object and returns paginated results.
76
91
  */
77
- getPayoutsFromRequest(req: Request): Promise<{
78
- payouts: Payout[];
79
- pagination: PaginationDTO;
80
- }>;
92
+ getPayoutsFromRequest(req: Request): Promise<Paged<Payout>>;
81
93
  /**
82
94
  * Creates a new payout with the provided input data.
83
95
  *
@@ -0,0 +1,3 @@
1
+ export * from "./profile.dtos.js";
2
+ export * from "./profile.model.js";
3
+ export * from "./profile.repository.js";
@@ -1,4 +1,4 @@
1
- import { ProfileDTO } from "@/features/auth/profile/profile.dtos.js";
1
+ import { ProfileDTO } from "./profile.dtos.js";
2
2
  /**
3
3
  * Represents a user profile in the system.
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import { BaseRepository } from "@/lib/api/base-repository.js";
2
2
  import { profileContract } from "./profile.api-contract.js";
3
- import { Profile } from "@/models/profile.model.js";
3
+ import { Profile } from "./profile.model.js";
4
4
  /**
5
5
  * Repository class for managing user profile operations.
6
6
  * Handles retrieving and updating user profile information from the API.
@@ -0,0 +1,4 @@
1
+ export * from "./team-member.repository.js";
2
+ export * from "./team-member.dtos.js";
3
+ export * from "./team-member.model.js";
4
+ export * from "./role.model.js";
@@ -1,4 +1,4 @@
1
- import { RoleDTO } from "@/features/admin/admin.dtos.js";
1
+ import { RoleDTO } from "./team-member.dtos.js";
2
2
  export declare class Role {
3
3
  readonly id: string;
4
4
  readonly name: string;
@@ -8,6 +8,6 @@ export declare class Role {
8
8
  readonly updatedAt: Date;
9
9
  constructor(data: RoleDTO);
10
10
  hasPermission(permission: string): boolean;
11
- static from(data: any): Role | undefined;
11
+ static from(data: RoleDTO): Role | undefined;
12
12
  toJSON(): any;
13
13
  }