@temboplus/afloat 0.1.13 → 0.1.31

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 (145) hide show
  1. package/esm/src/features/auth/access/contract.d.ts +14 -0
  2. package/esm/src/features/auth/access/contract.d.ts.map +1 -0
  3. package/esm/src/features/auth/access/contract.js +14 -0
  4. package/esm/src/features/auth/contract.d.ts +20 -20
  5. package/esm/src/features/auth/contract.js +2 -2
  6. package/esm/src/features/auth/identity/contract.d.ts +0 -7
  7. package/esm/src/features/auth/identity/contract.d.ts.map +1 -1
  8. package/esm/src/features/auth/identity/contract.js +0 -1
  9. package/esm/src/features/auth/identity/repository.d.ts +2 -2
  10. package/esm/src/features/auth/identity/repository.d.ts.map +1 -1
  11. package/esm/src/features/auth/identity/repository.js +5 -5
  12. package/esm/src/features/auth/manager.js +1 -1
  13. package/esm/src/features/auth/profile/contract.d.ts +17 -25
  14. package/esm/src/features/auth/profile/contract.d.ts.map +1 -1
  15. package/esm/src/features/auth/profile/contract.js +2 -4
  16. package/esm/src/features/auth/repository.d.ts +0 -1
  17. package/esm/src/features/auth/repository.d.ts.map +1 -1
  18. package/esm/src/features/auth/repository.js +3 -11
  19. package/esm/src/features/auth/storage/server_token_handler.d.ts +7 -6
  20. package/esm/src/features/auth/storage/server_token_handler.d.ts.map +1 -1
  21. package/esm/src/features/auth/storage/server_token_handler.js +73 -26
  22. package/esm/src/features/contact/contract.d.ts +10 -10
  23. package/esm/src/features/payout/contract.d.ts +16 -16
  24. package/esm/src/features/wallet/contract.d.ts +3 -6
  25. package/esm/src/features/wallet/contract.d.ts.map +1 -1
  26. package/esm/src/features/wallet/repository.d.ts +1 -28
  27. package/esm/src/features/wallet/repository.d.ts.map +1 -1
  28. package/esm/src/features/wallet/repository.js +0 -51
  29. package/esm/src/models/contact/derivatives/contact.js +2 -2
  30. package/esm/src/models/contact/derivatives/contact_info.d.ts +8 -8
  31. package/esm/src/models/contact/derivatives/contact_info.d.ts.map +1 -1
  32. package/esm/src/models/contact/derivatives/contact_info.js +12 -12
  33. package/esm/src/models/payout/channel.d.ts +4 -4
  34. package/esm/src/models/payout/channel.d.ts.map +1 -1
  35. package/esm/src/models/payout/channel.js +10 -3
  36. package/esm/src/models/payout/derivatives/payout.d.ts.map +1 -1
  37. package/esm/src/models/payout/derivatives/payout.js +2 -2
  38. package/esm/src/models/payout/schemas.d.ts +2 -1
  39. package/esm/src/models/payout/schemas.d.ts.map +1 -1
  40. package/esm/src/models/payout/schemas.js +1 -0
  41. package/esm/src/models/payout/status.d.ts +1 -0
  42. package/esm/src/models/payout/status.d.ts.map +1 -1
  43. package/esm/src/models/payout/status.js +1 -0
  44. package/esm/src/models/user/profile.d.ts +135 -12
  45. package/esm/src/models/user/profile.d.ts.map +1 -1
  46. package/esm/src/models/user/profile.js +321 -12
  47. package/esm/src/models/user/user.d.ts +14 -17
  48. package/esm/src/models/user/user.d.ts.map +1 -1
  49. package/esm/src/models/user/user.js +109 -26
  50. package/esm/src/models/wallet/guards.d.ts.map +1 -1
  51. package/esm/src/models/wallet/guards.js +8 -2
  52. package/esm/src/models/wallet/index.d.ts +0 -1
  53. package/esm/src/models/wallet/index.d.ts.map +1 -1
  54. package/esm/src/models/wallet/index.js +0 -1
  55. package/esm/src/models/wallet/schemas.d.ts +1 -2
  56. package/esm/src/models/wallet/schemas.d.ts.map +1 -1
  57. package/esm/src/models/wallet/schemas.js +3 -12
  58. package/esm/src/shared/token_required_repository.d.ts +78 -0
  59. package/esm/src/shared/token_required_repository.d.ts.map +1 -0
  60. package/esm/src/shared/token_required_repository.js +128 -0
  61. package/package.json +7 -7
  62. package/script/src/features/auth/access/contract.d.ts +14 -0
  63. package/script/src/features/auth/access/contract.d.ts.map +1 -0
  64. package/script/src/features/auth/access/contract.js +17 -0
  65. package/script/src/features/auth/contract.d.ts +20 -20
  66. package/script/src/features/auth/contract.js +1 -1
  67. package/script/src/features/auth/identity/contract.d.ts +0 -7
  68. package/script/src/features/auth/identity/contract.d.ts.map +1 -1
  69. package/script/src/features/auth/identity/contract.js +0 -1
  70. package/script/src/features/auth/identity/repository.d.ts +2 -2
  71. package/script/src/features/auth/identity/repository.d.ts.map +1 -1
  72. package/script/src/features/auth/identity/repository.js +5 -5
  73. package/script/src/features/auth/manager.js +1 -1
  74. package/script/src/features/auth/profile/contract.d.ts +17 -25
  75. package/script/src/features/auth/profile/contract.d.ts.map +1 -1
  76. package/script/src/features/auth/profile/contract.js +1 -3
  77. package/script/src/features/auth/repository.d.ts +0 -1
  78. package/script/src/features/auth/repository.d.ts.map +1 -1
  79. package/script/src/features/auth/repository.js +3 -11
  80. package/script/src/features/auth/storage/server_token_handler.d.ts +7 -6
  81. package/script/src/features/auth/storage/server_token_handler.d.ts.map +1 -1
  82. package/script/src/features/auth/storage/server_token_handler.js +72 -25
  83. package/script/src/features/contact/contract.d.ts +10 -10
  84. package/script/src/features/payout/contract.d.ts +16 -16
  85. package/script/src/features/wallet/contract.d.ts +3 -6
  86. package/script/src/features/wallet/contract.d.ts.map +1 -1
  87. package/script/src/features/wallet/repository.d.ts +1 -28
  88. package/script/src/features/wallet/repository.d.ts.map +1 -1
  89. package/script/src/features/wallet/repository.js +0 -51
  90. package/script/src/models/contact/derivatives/contact.js +1 -1
  91. package/script/src/models/contact/derivatives/contact_info.d.ts +8 -8
  92. package/script/src/models/contact/derivatives/contact_info.d.ts.map +1 -1
  93. package/script/src/models/contact/derivatives/contact_info.js +11 -11
  94. package/script/src/models/payout/channel.d.ts +4 -4
  95. package/script/src/models/payout/channel.d.ts.map +1 -1
  96. package/script/src/models/payout/channel.js +10 -3
  97. package/script/src/models/payout/derivatives/payout.d.ts.map +1 -1
  98. package/script/src/models/payout/derivatives/payout.js +1 -1
  99. package/script/src/models/payout/schemas.d.ts +2 -1
  100. package/script/src/models/payout/schemas.d.ts.map +1 -1
  101. package/script/src/models/payout/schemas.js +1 -0
  102. package/script/src/models/payout/status.d.ts +1 -0
  103. package/script/src/models/payout/status.d.ts.map +1 -1
  104. package/script/src/models/payout/status.js +1 -0
  105. package/script/src/models/user/profile.d.ts +135 -12
  106. package/script/src/models/user/profile.d.ts.map +1 -1
  107. package/script/src/models/user/profile.js +323 -13
  108. package/script/src/models/user/user.d.ts +14 -17
  109. package/script/src/models/user/user.d.ts.map +1 -1
  110. package/script/src/models/user/user.js +109 -26
  111. package/script/src/models/wallet/guards.d.ts.map +1 -1
  112. package/script/src/models/wallet/guards.js +8 -2
  113. package/script/src/models/wallet/index.d.ts +0 -1
  114. package/script/src/models/wallet/index.d.ts.map +1 -1
  115. package/script/src/models/wallet/index.js +0 -1
  116. package/script/src/models/wallet/schemas.d.ts +1 -2
  117. package/script/src/models/wallet/schemas.d.ts.map +1 -1
  118. package/script/src/models/wallet/schemas.js +3 -12
  119. package/script/src/shared/token_required_repository.d.ts +78 -0
  120. package/script/src/shared/token_required_repository.d.ts.map +1 -0
  121. package/script/src/shared/token_required_repository.js +132 -0
  122. package/esm/src/features/auth/profile/repository.d.ts +0 -11
  123. package/esm/src/features/auth/profile/repository.d.ts.map +0 -1
  124. package/esm/src/features/auth/profile/repository.js +0 -21
  125. package/esm/src/features/files-gen/contract.d.ts +0 -67
  126. package/esm/src/features/files-gen/contract.d.ts.map +0 -1
  127. package/esm/src/features/files-gen/contract.js +0 -40
  128. package/esm/src/features/files-gen/repository.d.ts +0 -50
  129. package/esm/src/features/files-gen/repository.d.ts.map +0 -1
  130. package/esm/src/features/files-gen/repository.js +0 -56
  131. package/esm/src/models/wallet/statement.d.ts +0 -27
  132. package/esm/src/models/wallet/statement.d.ts.map +0 -1
  133. package/esm/src/models/wallet/statement.js +0 -13
  134. package/script/src/features/auth/profile/repository.d.ts +0 -11
  135. package/script/src/features/auth/profile/repository.d.ts.map +0 -1
  136. package/script/src/features/auth/profile/repository.js +0 -25
  137. package/script/src/features/files-gen/contract.d.ts +0 -67
  138. package/script/src/features/files-gen/contract.d.ts.map +0 -1
  139. package/script/src/features/files-gen/contract.js +0 -43
  140. package/script/src/features/files-gen/repository.d.ts +0 -50
  141. package/script/src/features/files-gen/repository.d.ts.map +0 -1
  142. package/script/src/features/files-gen/repository.js +0 -60
  143. package/script/src/models/wallet/statement.d.ts +0 -27
  144. package/script/src/models/wallet/statement.d.ts.map +0 -1
  145. package/script/src/models/wallet/statement.js +0 -16
@@ -1,6 +1,8 @@
1
+ // deno-lint-ignore-file no-explicit-any
1
2
  import { Permissions } from "../permission.js";
3
+ import { Profile } from "./profile.js";
2
4
  /**
3
- * Represents a user in Afloat
5
+ * Represents a user in Afloat.
4
6
  *
5
7
  * This class centralizes user-related logic, simplifying interaction
6
8
  * with user-related data and ensuring consistent permission checks across the application.
@@ -9,7 +11,7 @@ export class User {
9
11
  /**
10
12
  * Creates a new instance of the `User` class.
11
13
  *
12
- * @param userData - An object of type `CoreUser` containing the user's profile, token,
14
+ * @param userData - An object containing the user's profile, token,
13
15
  * permissions (access list), and the `resetPassword` flag.
14
16
  */
15
17
  constructor(data) {
@@ -72,12 +74,12 @@ export class User {
72
74
  writable: true,
73
75
  value: void 0
74
76
  });
75
- const { profile, token, access, resetPassword } = data;
77
+ const { profile, token, access, resetPassword, name, identity } = data;
76
78
  this.profile = profile;
77
79
  this.token = token;
78
80
  this.resetPassword = resetPassword;
79
- this.name = data.loginCredentials.name;
80
- this.identity = data.loginCredentials.identity;
81
+ this.name = name;
82
+ this.identity = identity;
81
83
  // Initialize the permissions map
82
84
  this.permissionsMap = {};
83
85
  for (const permission of Object.values(Permissions)) {
@@ -86,6 +88,9 @@ export class User {
86
88
  this.permissionsMap[perm] = access.includes(perm);
87
89
  });
88
90
  }
91
+ else {
92
+ this.permissionsMap[permission] = access.includes(permission);
93
+ }
89
94
  }
90
95
  }
91
96
  /**
@@ -101,14 +106,14 @@ export class User {
101
106
  * Serializes the `User` instance to a JSON string.
102
107
  *
103
108
  * @returns A JSON string representation of the `User` instance, including:
104
- * - `profile`: The user's profile information.
109
+ * - `profile`: The user's profile information. (Requires profile.toJSON() method)
105
110
  * - `token`: The user's authentication token.
106
111
  * - `resetPassword`: Indicates whether the user must reset their password.
107
112
  * - `permissions`: An array of permission keys the user has.
108
113
  */
109
114
  toJSON() {
110
115
  return JSON.stringify({
111
- profile: this.profile,
116
+ profile: this.profile.toObject(),
112
117
  token: this.token,
113
118
  resetPassword: this.resetPassword,
114
119
  name: this.name,
@@ -120,29 +125,107 @@ export class User {
120
125
  * Creates a new `User` instance from a JSON string.
121
126
  *
122
127
  * @param jsonString - A JSON string containing user data.
123
- * @returns A `User` instance reconstructed from the JSON data.
124
- * @throws Will throw an error if the JSON data is invalid or incomplete.
128
+ * @returns A `User` instance reconstructed from the JSON data, or undefined if jsonString is invalid.
125
129
  */
126
130
  static fromJSON(jsonString) {
127
- const data = JSON.parse(jsonString);
128
- if (!data.profile ||
129
- !data.token ||
130
- !data.name ||
131
- !data.identity ||
132
- !Array.isArray(data.permissions) ||
133
- typeof data.resetPassword !== "boolean") {
134
- throw new Error("Invalid JSON data for User");
131
+ try {
132
+ return User.from(JSON.parse(jsonString));
133
+ }
134
+ catch (e) {
135
+ console.error("Invalid JSON string:", e);
136
+ return undefined;
137
+ }
138
+ }
139
+ /**
140
+ * Creates a new `User` instance from a data object, JSON string, or object with a Profile instance/object.
141
+ *
142
+ * @param data - The data object, JSON string, or object with Profile instance/object containing user information.
143
+ * @returns A `User` instance, or undefined if data is invalid.
144
+ */
145
+ static from(data) {
146
+ let parsedData;
147
+ // Parse JSON string if needed
148
+ if (typeof data === "string") {
149
+ try {
150
+ parsedData = JSON.parse(data);
151
+ }
152
+ catch (error) {
153
+ console.error("Invalid JSON string:", error);
154
+ return undefined;
155
+ }
156
+ }
157
+ else {
158
+ parsedData = data;
159
+ }
160
+ if (!parsedData) {
161
+ console.error("Data is null or undefined.");
162
+ return undefined;
163
+ }
164
+ // Handle different profile formats
165
+ let profile;
166
+ let rawProfile = parsedData.profile;
167
+ // Handle stringified profile (the case in the provided sample)
168
+ if (typeof rawProfile === "string") {
169
+ try {
170
+ // Attempt to parse the stringified profile
171
+ rawProfile = JSON.parse(rawProfile);
172
+ }
173
+ catch (error) {
174
+ console.error("Failed to parse profile JSON string:", error);
175
+ return undefined;
176
+ }
177
+ }
178
+ // Create Profile instance based on what we received
179
+ if (Profile.is(rawProfile)) {
180
+ // Already a Profile instance
181
+ profile = rawProfile;
182
+ }
183
+ else if (typeof rawProfile === "object" && rawProfile !== null) {
184
+ // Convert object to Profile instance
185
+ profile = Profile.from(rawProfile);
186
+ if (!profile) {
187
+ console.error("Failed to create Profile from data:", rawProfile);
188
+ return undefined;
189
+ }
190
+ }
191
+ else if (typeof rawProfile === "string") {
192
+ profile = Profile.fromJSON(rawProfile);
193
+ if (!profile) {
194
+ console.error("Failed to create Profile from JSON data:", rawProfile);
195
+ return undefined;
196
+ }
197
+ }
198
+ else {
199
+ console.error("Invalid profile format:", typeof rawProfile);
200
+ return undefined;
201
+ }
202
+ // Validate other required fields
203
+ if (!parsedData.token || typeof parsedData.token !== "string" ||
204
+ !parsedData.name || typeof parsedData.name !== "string" ||
205
+ !parsedData.identity || typeof parsedData.identity !== "string" ||
206
+ !Array.isArray(parsedData.permissions) &&
207
+ !Array.isArray(parsedData.access) ||
208
+ typeof parsedData.resetPassword !== "boolean") {
209
+ console.error("Missing or invalid required User fields:", {
210
+ token: typeof parsedData.token,
211
+ name: typeof parsedData.name,
212
+ identity: typeof parsedData.identity,
213
+ permissions: Array.isArray(parsedData.permissions),
214
+ access: Array.isArray(parsedData.access),
215
+ resetPassword: typeof parsedData.resetPassword,
216
+ });
217
+ return undefined;
135
218
  }
136
- // Reconstruct the CoreUser structure
219
+ // Support both 'permissions' and 'access' field names
220
+ const access = parsedData.access || parsedData.permissions;
221
+ // Create and return the User instance
137
222
  const args = {
138
- profile: data.profile,
139
- token: data.token,
140
- access: data.permissions,
141
- resetPassword: data.resetPassword,
142
- loginCredentials: {
143
- name: data.name,
144
- identity: data.identity,
145
- },
223
+ profile: profile,
224
+ token: parsedData.token,
225
+ access: access,
226
+ resetPassword: parsedData.resetPassword,
227
+ name: parsedData.name,
228
+ identity: parsedData.identity,
146
229
  };
147
230
  return new User(args);
148
231
  }
@@ -1 +1 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/guards.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAEtB;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,mBAAmB,EAAE,CAG/B"}
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/guards.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAEtB;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,mBAAmB,EAAE,CAQ/B"}
@@ -9,6 +9,12 @@ import { WalletSchemas, } from "./schemas.js";
9
9
  * false otherwise
10
10
  */
11
11
  export function isWalletStatementItemArray(data) {
12
- const result = z.array(WalletSchemas.statementEntry).safeParse(data);
13
- return result.success;
12
+ try {
13
+ z.array(WalletSchemas.statementEntry).parse(data);
14
+ return true;
15
+ }
16
+ catch (error) {
17
+ console.log("isWalletStatementItemArray?: false. Why?: ", error);
18
+ return false;
19
+ }
14
20
  }
@@ -1,4 +1,3 @@
1
1
  export * from "./guards.js";
2
2
  export * from "./schemas.js";
3
- export * from "./statement.js";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export * from "./guards.js";
2
2
  export * from "./schemas.js";
3
- export * from "./statement.js";
@@ -4,8 +4,7 @@ import { z } from "zod";
4
4
  * This is used as a TypeScript type helper for the actual schema implementation.
5
5
  */
6
6
  type _StatementEntryType = z.ZodObject<{
7
- accountNo: z.ZodEffects<z.ZodOptional<z.ZodString>>;
8
- cbaRefNo: z.ZodEffects<z.ZodOptional<z.ZodString>>;
7
+ accountNo: z.ZodString;
9
8
  debitOrCredit: z.ZodString;
10
9
  tranRefNo: z.ZodString;
11
10
  narration: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB;;;GAGG;AACH,KAAK,mBAAmB,GAAG,CAAC,CAAC,SAAS,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACnD,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC;IACnB,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC;IACrB,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC;IAC5B,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;CACtB,CAAC,CAAC;AA8BH;;;GAGG;AACH,KAAK,WAAW,GAAG,CAAC,CAAC,SAAS,CAAC;IAC7B,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC;IAChB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACzB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;CACxB,CAAC,CAAC;AAwBH;;;GAGG;AACH,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,KAAK,mBAAmB,GAAG,CAAC,CAAC,SAAS,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC;IACnB,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC;IACrB,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC;IAC5B,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;CACtB,CAAC,CAAC;AA4BH;;;GAGG;AACH,KAAK,WAAW,GAAG,CAAC,CAAC,SAAS,CAAC;IAC7B,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC;IAChB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;IACzB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;CACxB,CAAC,CAAC;AAwBH;;;GAGG;AACH,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC"}
@@ -1,17 +1,9 @@
1
1
  import { z } from "zod";
2
- /**
3
- * Helper function to make a field optional with undefined
4
- * Transforms null values to undefined for consistency
5
- * @param schema - The Zod schema to make optional
6
- * @returns A schema that only allows string or undefined (no null)
7
- */
8
- const makeOptional = (schema) => schema.optional().transform((val) => val ?? undefined);
9
2
  /**
10
3
  * Schema definition for a statement entry.
11
4
  * Represents a single transaction in a wallet's statement history.
12
5
  *
13
- * @property {string} accountNo - The account number associated with the transaction (optional)
14
- * @property {string} cbaRefNo - Core banking system reference number (optional)
6
+ * @property {string} accountNo - The account number associated with the transaction
15
7
  * @property {string} debitOrCredit - Indicator if transaction is debit or credit
16
8
  * @property {string} tranRefNo - Transaction reference number
17
9
  * @property {string} narration - Description of the transaction
@@ -22,8 +14,7 @@ const makeOptional = (schema) => schema.optional().transform((val) => val ?? und
22
14
  * @property {number} balance - Running balance after transaction
23
15
  */
24
16
  const statementEntrySchema = z.object({
25
- accountNo: makeOptional(z.string()),
26
- cbaRefNo: makeOptional(z.string()),
17
+ accountNo: z.string(),
27
18
  debitOrCredit: z.string().min(1, "Transaction type is required"),
28
19
  tranRefNo: z.string().min(1, "Transaction reference is required"),
29
20
  narration: z.string().min(1, "Transaction description is required"),
@@ -46,7 +37,7 @@ const statementEntrySchema = z.object({
46
37
  * @property {string} updatedAt - ISO datetime string of last wallet update
47
38
  */
48
39
  const walletSchema = z.object({
49
- id: z.string().uuid("Invalid wallet ID format"),
40
+ id: z.string().min(1),
50
41
  profileId: z.string().min(1, "Profile ID is required"),
51
42
  accountNo: z.string().min(1, "Account number is required"),
52
43
  accountName: z.string().min(1, "Account name is required"),
@@ -0,0 +1,78 @@
1
+ import { type AppRouter } from "@ts-rest/core";
2
+ import type { InitClientArgs } from "@ts-rest/core";
3
+ /**
4
+ * TokenRequiredRepository
5
+ *
6
+ * A generic base class to build repositories for interacting with the API,
7
+ * without any dependency on AfloatAuth. Instead, it requires token to be
8
+ * explicitly provided when initializing the repository.
9
+ *
10
+ * @template TContract - The API contract extending `AppRouter` from `@ts-rest/core`.
11
+ */
12
+ export declare class TokenRequiredRepository<TContract extends AppRouter> {
13
+ /**
14
+ * A "ts-rest" contract
15
+ *
16
+ * @protected
17
+ */
18
+ protected contract: TContract;
19
+ /**
20
+ * An API endpoint
21
+ *
22
+ * @protected
23
+ */
24
+ protected endpoint: string;
25
+ /**
26
+ * An API Root URL
27
+ *
28
+ * @protected
29
+ */
30
+ protected root: string | undefined;
31
+ /**
32
+ * Authentication token
33
+ *
34
+ * @protected
35
+ */
36
+ protected token: string;
37
+ /**
38
+ * Constructs a new instance of `TokenRequiredRepository`.
39
+ *
40
+ * @param endpoint - API endpoint
41
+ * @param contract - The "ts-rest" contract
42
+ * @param token - Authentication token (required)
43
+ * @param root - Optional API root URL
44
+ */
45
+ constructor(endpoint: string, contract: TContract, token: string, root?: string);
46
+ /**
47
+ * Gets the initialized client for making API requests.
48
+ * Uses the provided authentication token.
49
+ */
50
+ get client(): { [TKey in keyof TContract]: TContract[TKey] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey], InitClientArgs>> : TContract[TKey] extends AppRouter ? TContract[TKey] extends infer T extends AppRouter ? { [TKey_1 in keyof T]: TContract[TKey][TKey_1] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1], InitClientArgs>> : TContract[TKey][TKey_1] extends AppRouter ? TContract[TKey][TKey_1] extends infer T_1 extends AppRouter ? { [TKey_2 in keyof T_1]: TContract[TKey][TKey_1][TKey_2] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2] extends AppRouter ? TContract[TKey][TKey_1][TKey_2] extends infer T_2 extends AppRouter ? { [TKey_3 in keyof T_2]: TContract[TKey][TKey_1][TKey_2][TKey_3] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3] extends infer T_3 extends AppRouter ? { [TKey_4 in keyof T_3]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends infer T_4 extends AppRouter ? { [TKey_5 in keyof T_4]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends infer T_5 extends AppRouter ? { [TKey_6 in keyof T_5]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends infer T_6 extends AppRouter ? { [TKey_7 in keyof T_6]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends infer T_7 extends AppRouter ? { [TKey_8 in keyof T_7]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends infer T_8 extends AppRouter ? { [TKey_9 in keyof T_8]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends infer T_9 extends AppRouter ? { [TKey_10 in keyof T_9]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10] extends AppRouter ? any : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; };
51
+ /**
52
+ * Updates the token used by this repository
53
+ *
54
+ * @param token - New authentication token
55
+ */
56
+ setToken(token: string): void;
57
+ /**
58
+ * Gets the current token
59
+ *
60
+ * @returns The current authentication token
61
+ */
62
+ getToken(): string;
63
+ /**
64
+ * Handles the API response by checking the HTTP status code and returning the response body
65
+ * for successful requests or throwing an `APIError` for errors.
66
+ *
67
+ * @template T - The expected type of the successful response body.
68
+ * @param result - The API response object containing the status code and response body.
69
+ * @param successStatusCode - The expected HTTP status code indicating success (e.g., 200, 201).
70
+ * @returns The response body typed as `T` if the status code matches the success criteria.
71
+ * @throws `APIError` - If the status code indicates a failure.
72
+ */
73
+ handleResponse<T>(result: {
74
+ status: number;
75
+ body: unknown;
76
+ }, successStatusCode: number): T;
77
+ }
78
+ //# sourceMappingURL=token_required_repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token_required_repository.d.ts","sourceRoot":"","sources":["../../../src/src/shared/token_required_repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,eAAe,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD;;;;;;;;GAQG;AACH,qBAAa,uBAAuB,CAAC,SAAS,SAAS,SAAS;IAC9D;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE9B;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;gBAED,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM;IAQf;;;OAGG;IACH,IAAI,MAAM,k0LAcT;IAED;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EACd,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,EACzC,iBAAiB,EAAE,MAAM,GACxB,CAAC;CAgBL"}
@@ -0,0 +1,128 @@
1
+ import { initClient } from "@ts-rest/core";
2
+ import { APIError } from "../errors/api_error.js";
3
+ import { v4 as uuidv4 } from "uuid";
4
+ /**
5
+ * TokenRequiredRepository
6
+ *
7
+ * A generic base class to build repositories for interacting with the API,
8
+ * without any dependency on AfloatAuth. Instead, it requires token to be
9
+ * explicitly provided when initializing the repository.
10
+ *
11
+ * @template TContract - The API contract extending `AppRouter` from `@ts-rest/core`.
12
+ */
13
+ export class TokenRequiredRepository {
14
+ /**
15
+ * Constructs a new instance of `TokenRequiredRepository`.
16
+ *
17
+ * @param endpoint - API endpoint
18
+ * @param contract - The "ts-rest" contract
19
+ * @param token - Authentication token (required)
20
+ * @param root - Optional API root URL
21
+ */
22
+ constructor(endpoint, contract, token, root) {
23
+ /**
24
+ * A "ts-rest" contract
25
+ *
26
+ * @protected
27
+ */
28
+ Object.defineProperty(this, "contract", {
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true,
32
+ value: void 0
33
+ });
34
+ /**
35
+ * An API endpoint
36
+ *
37
+ * @protected
38
+ */
39
+ Object.defineProperty(this, "endpoint", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+ /**
46
+ * An API Root URL
47
+ *
48
+ * @protected
49
+ */
50
+ Object.defineProperty(this, "root", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: void 0
55
+ });
56
+ /**
57
+ * Authentication token
58
+ *
59
+ * @protected
60
+ */
61
+ Object.defineProperty(this, "token", {
62
+ enumerable: true,
63
+ configurable: true,
64
+ writable: true,
65
+ value: void 0
66
+ });
67
+ this.contract = contract;
68
+ this.endpoint = endpoint;
69
+ this.token = token;
70
+ this.root = root;
71
+ }
72
+ /**
73
+ * Gets the initialized client for making API requests.
74
+ * Uses the provided authentication token.
75
+ */
76
+ get client() {
77
+ const baseUrl = this.root
78
+ ? `${this.root}/${this.endpoint}`
79
+ : `https://api.afloat.money/v1/${this.endpoint}`;
80
+ const args = {
81
+ baseUrl,
82
+ baseHeaders: {
83
+ "token": this.token,
84
+ "x-request-id": uuidv4(),
85
+ },
86
+ };
87
+ return initClient(this.contract, args);
88
+ }
89
+ /**
90
+ * Updates the token used by this repository
91
+ *
92
+ * @param token - New authentication token
93
+ */
94
+ setToken(token) {
95
+ this.token = token;
96
+ }
97
+ /**
98
+ * Gets the current token
99
+ *
100
+ * @returns The current authentication token
101
+ */
102
+ getToken() {
103
+ return this.token;
104
+ }
105
+ /**
106
+ * Handles the API response by checking the HTTP status code and returning the response body
107
+ * for successful requests or throwing an `APIError` for errors.
108
+ *
109
+ * @template T - The expected type of the successful response body.
110
+ * @param result - The API response object containing the status code and response body.
111
+ * @param successStatusCode - The expected HTTP status code indicating success (e.g., 200, 201).
112
+ * @returns The response body typed as `T` if the status code matches the success criteria.
113
+ * @throws `APIError` - If the status code indicates a failure.
114
+ */
115
+ handleResponse(result, successStatusCode) {
116
+ if (successStatusCode === result.status) {
117
+ return result.body;
118
+ }
119
+ if (result.status === 400) {
120
+ throw new APIError(result.body);
121
+ }
122
+ throw new APIError({
123
+ message: "We encountered an error trying to process your request. Please try again later",
124
+ statusCode: 520,
125
+ error: "UNKNOWN ERROR",
126
+ });
127
+ }
128
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/afloat",
3
- "version": "0.1.13",
3
+ "version": "0.1.31",
4
4
  "description": "A JavaScript/TypeScript package providing common utilities and logic shared across all Temboplus-Afloat Projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,12 +23,12 @@
23
23
  },
24
24
  "private": false,
25
25
  "dependencies": {
26
- "@temboplus/frontend-core": "^0.2.0",
27
- "@ts-rest/core": "^3.51.0",
28
- "antd": "^5.22.7",
29
- "uuid": "^11.0.3",
30
- "zod": "^3.24.1",
31
- "zustand": "^5.0.2"
26
+ "@temboplus/frontend-core": "^0.2.4",
27
+ "@ts-rest/core": "^3.52.1",
28
+ "antd": "^5.24.5",
29
+ "uuid": "^11.1.0",
30
+ "zod": "^3.24.2",
31
+ "zustand": "^5.0.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.9.0",
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Auth API contract
4
+ */
5
+ export declare const accessContract: {
6
+ getAccessList: {
7
+ method: "GET";
8
+ path: "/access";
9
+ responses: {
10
+ 200: z.ZodArray<z.ZodString, "many">;
11
+ };
12
+ };
13
+ };
14
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/access/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;CAQzB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.accessContract = void 0;
4
+ const zod_1 = require("zod");
5
+ const core_1 = require("@ts-rest/core");
6
+ /**
7
+ * Auth API contract
8
+ */
9
+ exports.accessContract = (0, core_1.initContract)().router({
10
+ getAccessList: {
11
+ method: "GET",
12
+ path: "/access",
13
+ responses: {
14
+ 200: zod_1.z.string().array(),
15
+ },
16
+ },
17
+ });
@@ -23,28 +23,28 @@ export declare const authContract: {
23
23
  201: z.ZodObject<{
24
24
  profile: z.ZodObject<{
25
25
  id: z.ZodString;
26
- firstName: z.ZodString;
27
- lastName: z.ZodString;
26
+ firstName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
27
+ lastName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
28
28
  displayName: z.ZodString;
29
- phone: z.ZodString;
29
+ phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
30
30
  accountNo: z.ZodString;
31
- email: z.ZodString;
31
+ email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
32
32
  }, z.UnknownKeysParam, z.ZodTypeAny, {
33
33
  id: string;
34
- firstName: string;
35
- lastName: string;
36
34
  displayName: string;
37
- phone: string;
38
35
  accountNo: string;
39
- email: string;
36
+ firstName?: string | null | undefined;
37
+ lastName?: string | null | undefined;
38
+ phone?: string | null | undefined;
39
+ email?: string | null | undefined;
40
40
  }, {
41
41
  id: string;
42
- firstName: string;
43
- lastName: string;
44
42
  displayName: string;
45
- phone: string;
46
43
  accountNo: string;
47
- email: string;
44
+ firstName?: string | null | undefined;
45
+ lastName?: string | null | undefined;
46
+ phone?: string | null | undefined;
47
+ email?: string | null | undefined;
48
48
  }>;
49
49
  token: z.ZodString;
50
50
  access: z.ZodArray<z.ZodString, "many">;
@@ -53,12 +53,12 @@ export declare const authContract: {
53
53
  resetPassword: boolean;
54
54
  profile: {
55
55
  id: string;
56
- firstName: string;
57
- lastName: string;
58
56
  displayName: string;
59
- phone: string;
60
57
  accountNo: string;
61
- email: string;
58
+ firstName?: string | null | undefined;
59
+ lastName?: string | null | undefined;
60
+ phone?: string | null | undefined;
61
+ email?: string | null | undefined;
62
62
  };
63
63
  token: string;
64
64
  access: string[];
@@ -66,12 +66,12 @@ export declare const authContract: {
66
66
  resetPassword: boolean;
67
67
  profile: {
68
68
  id: string;
69
- firstName: string;
70
- lastName: string;
71
69
  displayName: string;
72
- phone: string;
73
70
  accountNo: string;
74
- email: string;
71
+ firstName?: string | null | undefined;
72
+ lastName?: string | null | undefined;
73
+ phone?: string | null | undefined;
74
+ email?: string | null | undefined;
75
75
  };
76
76
  token: string;
77
77
  access: string[];
@@ -18,7 +18,7 @@ exports.authContract = (0, core_1.initContract)().router({
18
18
  }),
19
19
  responses: {
20
20
  201: zod_1.z.object({
21
- profile: index_js_1.profileSchema,
21
+ profile: index_js_1.Profile.schema,
22
22
  token: zod_1.z.string(),
23
23
  access: zod_1.z.array(zod_1.z.string()),
24
24
  resetPassword: zod_1.z.boolean(),