@temboplus/afloat 0.1.77-beta.8 → 0.1.77-beta.9

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.
@@ -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
+ id: string;
17
+ version: string;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ access: string[];
21
+ description?: string | undefined;
22
+ }, {
23
+ name: string;
24
+ id: string;
25
+ createdAt: 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
  }
@@ -1,3 +1,4 @@
1
+ import z from "zod";
1
2
  import { Role } from "./role.model.js";
2
3
  import { RoleDTO } from "./team-member.dtos.js";
3
4
  export interface TeamMemberData {
@@ -14,6 +15,93 @@ export interface TeamMemberData {
14
15
  createdAt: string;
15
16
  updatedAt: string;
16
17
  }
18
+ /**
19
+ * Zod schema for TeamMember JSON serialization
20
+ */
21
+ export declare const TeamMemberJSONSchema: z.ZodObject<{
22
+ id: z.ZodString;
23
+ name: z.ZodString;
24
+ identity: z.ZodString;
25
+ type: z.ZodString;
26
+ profileId: z.ZodString;
27
+ roleId: z.ZodString;
28
+ resetPassword: z.ZodBoolean;
29
+ isActive: z.ZodBoolean;
30
+ isArchived: z.ZodBoolean;
31
+ role: z.ZodOptional<z.ZodObject<{
32
+ id: z.ZodString;
33
+ name: z.ZodString;
34
+ description: z.ZodOptional<z.ZodString>;
35
+ access: z.ZodArray<z.ZodString, "many">;
36
+ createdAt: z.ZodString;
37
+ updatedAt: z.ZodString;
38
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ name: string;
41
+ id: string;
42
+ version: string;
43
+ createdAt: string;
44
+ updatedAt: string;
45
+ access: string[];
46
+ description?: string | undefined;
47
+ }, {
48
+ name: string;
49
+ id: string;
50
+ createdAt: string;
51
+ updatedAt: string;
52
+ access: string[];
53
+ version?: string | undefined;
54
+ description?: string | undefined;
55
+ }>>;
56
+ createdAt: z.ZodString;
57
+ updatedAt: z.ZodString;
58
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
59
+ }, "strip", z.ZodTypeAny, {
60
+ type: string;
61
+ name: string;
62
+ id: string;
63
+ version: string;
64
+ profileId: string;
65
+ identity: string;
66
+ roleId: string;
67
+ isActive: boolean;
68
+ isArchived: boolean;
69
+ resetPassword: boolean;
70
+ createdAt: string;
71
+ updatedAt: string;
72
+ role?: {
73
+ name: string;
74
+ id: string;
75
+ version: string;
76
+ createdAt: string;
77
+ updatedAt: string;
78
+ access: string[];
79
+ description?: string | undefined;
80
+ } | undefined;
81
+ }, {
82
+ type: string;
83
+ name: string;
84
+ id: string;
85
+ profileId: string;
86
+ identity: string;
87
+ roleId: string;
88
+ isActive: boolean;
89
+ isArchived: boolean;
90
+ resetPassword: boolean;
91
+ createdAt: string;
92
+ updatedAt: string;
93
+ version?: string | undefined;
94
+ role?: {
95
+ name: string;
96
+ id: string;
97
+ createdAt: string;
98
+ updatedAt: string;
99
+ access: string[];
100
+ version?: string | undefined;
101
+ description?: string | undefined;
102
+ } | undefined;
103
+ }>;
104
+ export type TeamMemberJSON = z.infer<typeof TeamMemberJSONSchema>;
17
105
  /**
18
106
  * Represents a team member from the admin management perspective.
19
107
  *
@@ -123,15 +211,27 @@ export declare class TeamMember {
123
211
  */
124
212
  getLastUpdateInfo(): string;
125
213
  /**
126
- * Converts the TeamMember instance to a plain object.
214
+ * Serializes the TeamMember instance to a JSON-compatible object
215
+ */
216
+ toJSON(): TeamMemberJSON;
217
+ /**
218
+ * Serializes the TeamMember instance to a JSON string
219
+ */
220
+ toJSONString(): string;
221
+ /**
222
+ * Creates a TeamMember instance from a JSON-compatible object or string
223
+ */
224
+ static fromJSON(json: TeamMemberJSON | string): TeamMember | undefined;
225
+ /**
226
+ * Type guard using Zod schema validation
127
227
  */
128
- toObject(): any;
228
+ static isTeamMemberJSON(obj: unknown): obj is TeamMemberJSON;
129
229
  /**
130
- * Converts the TeamMember instance to a JSON string.
230
+ * Creates multiple TeamMember instances from a JSON array
131
231
  */
132
- toJson(): string;
232
+ static fromJSONArray(jsonArray: TeamMemberJSON[] | string): TeamMember[];
133
233
  /**
134
- * Alias for toJson() to maintain consistency with other models
234
+ * Serializes an array of TeamMember instances to JSON
135
235
  */
136
- toJSON(): any;
236
+ static toJSONArray(members: TeamMember[]): TeamMemberJSON[];
137
237
  }
@@ -1,4 +1,5 @@
1
1
  import { ContactInfo, MobileContactInfo, BankContactInfo } from "../contact/contact-info.model.js";
2
+ import z from "zod";
2
3
  /** Prefix for Ecobank mobile transfer narrations */
3
4
  export declare const ECOBANK_PREFIX = "MOBILE TRANSFER ";
4
5
  /** V2 format prefix for payout narrations using contact details */
@@ -12,12 +13,19 @@ export declare const MOBILE_NARR_PREFIX: string;
12
13
  /** Legacy format prefix for mobile money payout narrations */
13
14
  export declare const LEGACY_MOBILE_NARR_PREFIX: string;
14
15
  /**
15
- * Interface for the JSON representation of Narration
16
+ * Zod schema for Narration JSON serialization
16
17
  */
17
- export interface NarrationJson {
18
+ export declare const NarrationJSONSchema: z.ZodObject<{
19
+ text: z.ZodString;
20
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ version: string;
18
23
  text: string;
19
- version?: string;
20
- }
24
+ }, {
25
+ text: string;
26
+ version?: string | undefined;
27
+ }>;
28
+ export type NarrationJSON = z.infer<typeof NarrationJSONSchema>;
21
29
  /**
22
30
  * Handles payout narration generation and parsing for the Afloat platform.
23
31
  *
@@ -184,46 +192,34 @@ export declare class Narration {
184
192
  */
185
193
  getMobileContactDetails: () => MobileContactInfo | undefined;
186
194
  /**
187
- * Serializes the Narration instance to a JSON-compatible object.
188
- *
189
- * @returns {NarrationJson} A plain object containing the narration data
195
+ * Type guard to check if an unknown object is a valid Narration instance.
190
196
  *
191
- * @example
192
- * ```typescript
193
- * const narration = new Narration("PAYOUT +255123456789 JOHN DOE");
194
- * const json = narration.toJson();
195
- * // Returns: { text: "PAYOUT +255123456789 JOHN DOE", version: "2.0" }
196
- * ```
197
+ * @param obj - The object to check
198
+ * @returns Type predicate indicating if the object is a Narration instance
197
199
  */
198
- toJson(): NarrationJson;
200
+ static is(obj: unknown): obj is Narration;
199
201
  /**
200
- * Creates a Narration instance from a JSON-compatible object.
201
- *
202
- * @param {NarrationJson | string} json - Either a NarrationJson object or a JSON string
203
- * @returns {Narration | undefined} A Narration instance if valid, undefined otherwise
204
- *
205
- * @example
206
- * ```typescript
207
- * // From object
208
- * const narration = Narration.fromJson({ text: "PAYOUT +255123456789 JOHN DOE" });
209
- *
210
- * // From JSON string
211
- * const narration = Narration.fromJson('{"text":"PAYOUT +255123456789 JOHN DOE"}');
212
- * ```
202
+ * Serializes the Narration instance to a JSON-compatible object
203
+ */
204
+ toJSON(): NarrationJSON;
205
+ /**
206
+ * Serializes the Narration instance to a JSON string
213
207
  */
214
- static fromJson(json: NarrationJson | string): Narration | undefined;
208
+ toJSONString(): string;
215
209
  /**
216
- * Type guard to check if an object is a valid NarrationJson
217
- *
218
- * @param obj - The object to validate
219
- * @returns True if the object conforms to NarrationJson structure
210
+ * Creates a Narration instance from a JSON-compatible object or string
220
211
  */
221
- static isNarrationJson(obj: unknown): obj is NarrationJson;
212
+ static fromJSON(json: NarrationJSON | string): Narration | undefined;
222
213
  /**
223
- * Type guard to check if an unknown object is a valid Narration instance.
224
- *
225
- * @param obj - The object to check
226
- * @returns Type predicate indicating if the object is a Narration instance
214
+ * Type guard using Zod schema validation
227
215
  */
228
- static is(obj: unknown): obj is Narration;
216
+ static isNarrationJSON(obj: unknown): obj is NarrationJSON;
217
+ /**
218
+ * @deprecated Use toJSON() instead
219
+ */
220
+ toJson(): NarrationJSON;
221
+ /**
222
+ * @deprecated Use fromJSON() instead
223
+ */
224
+ static fromJson(json: NarrationJSON | string): Narration | undefined;
229
225
  }