@temboplus/afloat 0.1.77-beta.2 → 0.1.77-beta.21

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 (42) hide show
  1. package/dist/index.cjs.js +1 -1
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +1 -1
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/lib/api/base-repository.d.ts +3 -1
  6. package/dist/lib/query/query.builder.d.ts +5 -1
  7. package/dist/modules/auth/auth.contract.d.ts +2 -2
  8. package/dist/modules/auth/company-membership.model.d.ts +122 -9
  9. package/dist/modules/auth/index.d.ts +0 -1
  10. package/dist/modules/auth/user.model.d.ts +238 -15
  11. package/dist/modules/contact/contact-info.model.d.ts +183 -533
  12. package/dist/modules/contact/contact.api-contract.d.ts +8 -8
  13. package/dist/modules/contact/contact.dtos.d.ts +2 -2
  14. package/dist/modules/contact/contact.model.d.ts +309 -32
  15. package/dist/modules/login/login.api-contract.d.ts +2 -2
  16. package/dist/modules/login/login.dtos.d.ts +4 -4
  17. package/dist/modules/login/login.model.d.ts +54 -24
  18. package/dist/modules/payout/payout.api-contract.d.ts +37 -37
  19. package/dist/modules/payout/payout.dtos.d.ts +47 -39
  20. package/dist/modules/payout/payout.model.d.ts +242 -2
  21. package/dist/modules/payout/payout.query.d.ts +11 -3
  22. package/dist/modules/payout/payout.repository.d.ts +48 -25
  23. package/dist/modules/profile/profile.model.d.ts +65 -30
  24. package/dist/modules/team-member/role.model.d.ts +49 -1
  25. package/dist/modules/team-member/team-member.contract.d.ts +44 -44
  26. package/dist/modules/team-member/team-member.dtos.d.ts +14 -14
  27. package/dist/modules/team-member/team-member.model.d.ts +106 -6
  28. package/dist/modules/wallet/index.d.ts +0 -1
  29. package/dist/modules/wallet/narration.model.d.ts +34 -38
  30. package/dist/modules/wallet/statement-entry.model.d.ts +172 -73
  31. package/dist/modules/wallet/wallet.contract.d.ts +6 -6
  32. package/dist/modules/wallet/wallet.dtos.d.ts +12 -12
  33. package/dist/modules/wallet/wallet.model.d.ts +56 -19
  34. package/dist/modules/wallet/wallet.query.d.ts +95 -0
  35. package/dist/modules/wallet/wallet.repository.d.ts +45 -13
  36. package/package.json +2 -2
  37. package/dist/modules/auth/auth.manager.d.ts +0 -249
  38. package/dist/modules/auth/auth.store.d.ts +0 -139
  39. package/dist/modules/auth/storage/client-store.d.ts +0 -29
  40. package/dist/modules/auth/storage/client-token-handler.d.ts +0 -31
  41. package/dist/modules/auth/storage/types.d.ts +0 -41
  42. package/dist/modules/wallet/wallet-manager.session.d.ts +0 -143
@@ -7,6 +7,36 @@ import { PayoutChannel } from "./payout.dtos.js";
7
7
  import { PayoutQuery } from "./payout.query.js";
8
8
  import { PayoutFilters } from "./payout.dtos.js";
9
9
  import { Paged } from "@/lib/query/index.js";
10
+ import { Wallet } from "../wallet/wallet.model.js";
11
+ /**
12
+ * Input type for payout creation mutation
13
+ */
14
+ export interface CreatePayoutInput {
15
+ /** The wallet to pay from */
16
+ wallet: Wallet;
17
+ /** The payout channel to use (MOBILE or BANK) */
18
+ channel: PayoutChannel;
19
+ /** Contact information for the payout receiver */
20
+ receiver: ContactInfo;
21
+ /** The amount to pay out */
22
+ amount: Amount;
23
+ /** Optional notes/narration for the payout */
24
+ notes?: string;
25
+ }
26
+ /**
27
+ * Input type for payout approval mutation
28
+ */
29
+ export interface ApprovePayoutInput {
30
+ id: string;
31
+ notes?: string;
32
+ }
33
+ /**
34
+ * Input type for payout rejection mutation
35
+ */
36
+ export interface RejectPayoutInput {
37
+ id: string;
38
+ notes?: string;
39
+ }
10
40
  /**
11
41
  * Flexible query input type - supports the class, filters interface, URL params, etc.
12
42
  */
@@ -93,17 +123,19 @@ export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
93
123
  /**
94
124
  * Creates a new payout with the provided input data.
95
125
  *
96
- * @param args - The payout creation data
97
- * @param args.channel - The payout channel to use
98
- * @param args.receiver - Contact information for the payout receiver
99
- * @param args.amount - The amount to pay out
100
- * @param args.notes - Optional notes for the payout
126
+ * @param input - The payout creation data
127
+ * @param input.wallet - The wallet to pay from
128
+ * @param input.channel - The payout channel to use
129
+ * @param input.receiver - Contact information for the payout receiver
130
+ * @param input.amount - The amount to pay out
131
+ * @param input.notes - Optional notes for the payout
101
132
  * @returns Promise that resolves to the created payout
102
133
  * @throws {APIError} If the input is invalid or if the creation operation fails
103
134
  *
104
135
  * @example
105
136
  * ```typescript
106
137
  * const payout = await repo.pay({
138
+ * wallet: selectedWallet,
107
139
  * channel: PayoutChannel.MOBILE,
108
140
  * receiver: { name: "John Doe", phone: "+255123456789" },
109
141
  * amount: Amount.from(10000, "TZS"),
@@ -111,50 +143,41 @@ export declare class PayoutRepository extends BaseRepository<PayoutAPI> {
111
143
  * });
112
144
  * ```
113
145
  */
114
- pay(args: {
115
- channel: PayoutChannel;
116
- receiver: ContactInfo;
117
- amount: Amount;
118
- notes?: string;
119
- }): Promise<Payout>;
146
+ pay(input: CreatePayoutInput): Promise<Payout>;
120
147
  /**
121
148
  * Approves a payout with optional notes.
122
149
  *
123
- * @param id - The ID of the payout to approve
124
- * @param args - Optional arguments
125
- * @param args.notes - Optional notes for the approval
150
+ * @param input.id - The ID of the payout to approve
151
+ * @param input.notes - Optional notes for the approval
126
152
  * @returns Promise that resolves to the approved payout
127
153
  * @throws {APIError} If payout is not found, already approved, or if the operation fails
128
154
  *
129
155
  * @example
130
156
  * ```typescript
131
- * const approvedPayout = await repo.approve("payout-id", {
157
+ * const approvedPayout = await repo.approve({
158
+ * id: "payout-id",
132
159
  * notes: "Approved after verification"
133
160
  * });
134
161
  * ```
135
162
  */
136
- approve(id: string, args?: {
137
- notes?: string;
138
- }): Promise<Payout>;
163
+ approve(input: ApprovePayoutInput): Promise<Payout>;
139
164
  /**
140
165
  * Rejects a payout with optional notes.
141
166
  *
142
- * @param id - The ID of the payout to reject
143
- * @param args - Optional arguments
144
- * @param args.notes - Optional notes for the rejection
167
+ * @param input.id - The ID of the payout to reject
168
+ * @param input.notes - Optional notes for the rejection
145
169
  * @returns Promise that resolves to the rejected payout
146
170
  * @throws {APIError} If payout is not found, already rejected, or if the operation fails
147
171
  *
148
172
  * @example
149
173
  * ```typescript
150
- * const rejectedPayout = await repo.reject("payout-id", {
174
+ * const rejectedPayout = await repo.reject({
175
+ * id: "payout-id",
151
176
  * notes: "Insufficient documentation"
152
177
  * });
153
178
  * ```
154
179
  */
155
- reject(id: string, args?: {
156
- notes?: string;
157
- }): Promise<Payout>;
180
+ reject(input: RejectPayoutInput): Promise<Payout>;
158
181
  /**
159
182
  * Retrieves a payout by its ID.
160
183
  *
@@ -1,4 +1,42 @@
1
- import { ProfileDTO } from "./profile.dtos.js";
1
+ import { z } from "zod";
2
+ /**
3
+ * Zod schema for Profile JSON serialization
4
+ */
5
+ export declare const ProfileJSONSchema: z.ZodObject<{
6
+ id: z.ZodString;
7
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ displayName: z.ZodString;
10
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ accountNo: z.ZodString;
12
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
14
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ id: string;
17
+ displayName: string;
18
+ accountNo: string;
19
+ version: string;
20
+ firstName?: string | null | undefined;
21
+ lastName?: string | null | undefined;
22
+ phone?: string | null | undefined;
23
+ email?: string | null | undefined;
24
+ autoApprove?: boolean | null | undefined;
25
+ }, {
26
+ id: string;
27
+ displayName: string;
28
+ accountNo: string;
29
+ firstName?: string | null | undefined;
30
+ lastName?: string | null | undefined;
31
+ phone?: string | null | undefined;
32
+ email?: string | null | undefined;
33
+ autoApprove?: boolean | null | undefined;
34
+ version?: string | undefined;
35
+ }>;
36
+ /**
37
+ * Infer the ProfileJSON type from the schema
38
+ */
39
+ export type ProfileJSON = z.infer<typeof ProfileJSONSchema>;
2
40
  /**
3
41
  * Represents a user profile in the system.
4
42
  *
@@ -25,16 +63,16 @@ export declare class Profile {
25
63
  /**
26
64
  * Gets the profile schema used for validation.
27
65
  */
28
- static get schema(): import("zod").ZodObject<{
29
- id: import("zod").ZodString;
30
- firstName: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
31
- lastName: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
32
- displayName: import("zod").ZodString;
33
- phone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
34
- accountNo: import("zod").ZodString;
35
- email: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
36
- autoApprove: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodBoolean>>;
37
- }, "strip", import("zod").ZodTypeAny, {
66
+ static get schema(): z.ZodObject<{
67
+ id: z.ZodString;
68
+ firstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ lastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
+ displayName: z.ZodString;
71
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ accountNo: z.ZodString;
73
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ autoApprove: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
75
+ }, "strip", z.ZodTypeAny, {
38
76
  id: string;
39
77
  displayName: string;
40
78
  accountNo: string;
@@ -113,31 +151,12 @@ export declare class Profile {
113
151
  * Returns the display name if it exists, otherwise returns the first and last name combined.
114
152
  */
115
153
  getName(): string;
116
- /**
117
- * Creates a plain object representation of the profile for validation or serialization.
118
- *
119
- * @returns A plain object matching the ProfileType interface
120
- */
121
- toObject(): ProfileDTO;
122
- /**
123
- * Converts the profile to a JSON string.
124
- *
125
- * @returns A JSON string representation of the profile
126
- */
127
- toJSON(): string;
128
154
  /**
129
155
  * Validates the profile data against the Zod schema.
130
156
  *
131
157
  * @returns True if the profile is valid, false otherwise
132
158
  */
133
159
  validate(): boolean;
134
- /**
135
- * Creates a Profile instance from a JSON string.
136
- *
137
- * @param jsonString - JSON string containing profile data
138
- * @returns A new Profile instance, or undefined if parsing failed
139
- */
140
- static fromJSON(jsonString: string): Profile | undefined;
141
160
  /**
142
161
  * Creates a Profile instance from a plain object.
143
162
  *
@@ -152,4 +171,20 @@ export declare class Profile {
152
171
  * @returns Type predicate indicating if the object is a valid Profile
153
172
  */
154
173
  static is(obj: unknown): obj is Profile;
174
+ /**
175
+ * Serializes the Profile instance to a JSON-compatible object
176
+ */
177
+ toJSON(): ProfileJSON;
178
+ /**
179
+ * Serializes the Profile instance to a JSON string
180
+ */
181
+ toJSONString(): string;
182
+ /**
183
+ * Creates a Profile instance from a JSON-compatible object or string
184
+ */
185
+ static fromJSON(json: ProfileJSON | string): Profile | undefined;
186
+ /**
187
+ * Type guard using Zod schema validation
188
+ */
189
+ static isProfileJSON(obj: unknown): obj is ProfileJSON;
155
190
  }
@@ -1,4 +1,37 @@
1
+ import z from "zod";
1
2
  import { RoleDTO } from "./team-member.dtos.js";
3
+ /**
4
+ * Zod schema for Role JSON serialization
5
+ */
6
+ export declare const RoleJSONSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodString;
9
+ description: z.ZodOptional<z.ZodString>;
10
+ access: z.ZodArray<z.ZodString, "many">;
11
+ createdAt: z.ZodString;
12
+ updatedAt: z.ZodString;
13
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ name: string;
16
+ createdAt: string;
17
+ id: string;
18
+ version: string;
19
+ updatedAt: string;
20
+ access: string[];
21
+ description?: string | undefined;
22
+ }, {
23
+ name: string;
24
+ createdAt: string;
25
+ id: string;
26
+ updatedAt: string;
27
+ access: string[];
28
+ version?: string | undefined;
29
+ description?: string | undefined;
30
+ }>;
31
+ /**
32
+ * Infer the RoleJSON type from the schema
33
+ */
34
+ export type RoleJSON = z.infer<typeof RoleJSONSchema>;
2
35
  export declare class Role {
3
36
  readonly id: string;
4
37
  readonly name: string;
@@ -9,5 +42,20 @@ export declare class Role {
9
42
  constructor(data: RoleDTO);
10
43
  hasPermission(permission: string): boolean;
11
44
  static from(data: RoleDTO): Role | undefined;
12
- toJSON(): any;
45
+ /**
46
+ * Serializes the Role instance to a JSON-compatible object
47
+ */
48
+ toJSON(): RoleJSON;
49
+ /**
50
+ * Serializes the Role instance to a JSON string
51
+ */
52
+ toJSONString(): string;
53
+ /**
54
+ * Creates a Role instance from a JSON-compatible object or string
55
+ */
56
+ static fromJSON(json: RoleJSON | string): Role | undefined;
57
+ /**
58
+ * Type guard using Zod schema validation
59
+ */
60
+ static isRoleJSON(obj: unknown): obj is RoleJSON;
13
61
  }