@temboplus/tembo-dashboard 0.0.26-beta.0 → 0.0.26-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.
@@ -0,0 +1,406 @@
1
+ import { z } from "zod";
2
+ export declare const walletContract: {
3
+ listWallets: {
4
+ summary: "List wallets";
5
+ description: "Retrieve all wallets linked to the account across supported currencies.";
6
+ method: "GET";
7
+ path: "";
8
+ responses: {
9
+ 200: z.ZodArray<z.ZodObject<{
10
+ accountNo: z.ZodString;
11
+ accountName: z.ZodString;
12
+ type: z.ZodString;
13
+ balance: z.ZodNumber;
14
+ currency: z.ZodString;
15
+ countryCode: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ type: string;
18
+ balance: number;
19
+ accountName: string;
20
+ accountNo: string;
21
+ countryCode: string;
22
+ currency: string;
23
+ }, {
24
+ type: string;
25
+ balance: number;
26
+ accountName: string;
27
+ accountNo: string;
28
+ countryCode: string;
29
+ currency: string;
30
+ }>, "many">;
31
+ 401: z.ZodObject<{
32
+ reason: z.ZodOptional<z.ZodString>;
33
+ error: z.ZodOptional<z.ZodString>;
34
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
35
+ message: z.ZodOptional<z.ZodString>;
36
+ } & {
37
+ statusCode: z.ZodLiteral<401>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ statusCode: 401;
40
+ message?: string | undefined;
41
+ error?: string | undefined;
42
+ details?: Record<string, unknown> | undefined;
43
+ reason?: string | undefined;
44
+ }, {
45
+ statusCode: 401;
46
+ message?: string | undefined;
47
+ error?: string | undefined;
48
+ details?: Record<string, unknown> | undefined;
49
+ reason?: string | undefined;
50
+ }>;
51
+ 500: z.ZodObject<{
52
+ reason: z.ZodOptional<z.ZodString>;
53
+ error: z.ZodOptional<z.ZodString>;
54
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
55
+ message: z.ZodOptional<z.ZodString>;
56
+ } & {
57
+ statusCode: z.ZodLiteral<500>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ statusCode: 500;
60
+ message?: string | undefined;
61
+ error?: string | undefined;
62
+ details?: Record<string, unknown> | undefined;
63
+ reason?: string | undefined;
64
+ }, {
65
+ statusCode: 500;
66
+ message?: string | undefined;
67
+ error?: string | undefined;
68
+ details?: Record<string, unknown> | undefined;
69
+ reason?: string | undefined;
70
+ }>;
71
+ };
72
+ };
73
+ getWalletInfo: {
74
+ pathParams: z.ZodObject<{
75
+ accountNo: z.ZodString;
76
+ }, "strip", z.ZodTypeAny, {
77
+ accountNo: string;
78
+ }, {
79
+ accountNo: string;
80
+ }>;
81
+ summary: "Get wallet info";
82
+ description: "Retrieve wallet metadata including balance, currency, and type for a specific wallet.";
83
+ method: "GET";
84
+ path: "/:accountNo";
85
+ responses: {
86
+ 200: z.ZodObject<{
87
+ accountNo: z.ZodString;
88
+ accountName: z.ZodString;
89
+ type: z.ZodString;
90
+ balance: z.ZodNumber;
91
+ currency: z.ZodString;
92
+ countryCode: z.ZodString;
93
+ }, "strip", z.ZodTypeAny, {
94
+ type: string;
95
+ balance: number;
96
+ accountName: string;
97
+ accountNo: string;
98
+ countryCode: string;
99
+ currency: string;
100
+ }, {
101
+ type: string;
102
+ balance: number;
103
+ accountName: string;
104
+ accountNo: string;
105
+ countryCode: string;
106
+ currency: string;
107
+ }>;
108
+ 401: z.ZodObject<{
109
+ reason: z.ZodOptional<z.ZodString>;
110
+ error: z.ZodOptional<z.ZodString>;
111
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
112
+ message: z.ZodOptional<z.ZodString>;
113
+ } & {
114
+ statusCode: z.ZodLiteral<401>;
115
+ }, "strip", z.ZodTypeAny, {
116
+ statusCode: 401;
117
+ message?: string | undefined;
118
+ error?: string | undefined;
119
+ details?: Record<string, unknown> | undefined;
120
+ reason?: string | undefined;
121
+ }, {
122
+ statusCode: 401;
123
+ message?: string | undefined;
124
+ error?: string | undefined;
125
+ details?: Record<string, unknown> | undefined;
126
+ reason?: string | undefined;
127
+ }>;
128
+ 500: z.ZodObject<{
129
+ reason: z.ZodOptional<z.ZodString>;
130
+ error: z.ZodOptional<z.ZodString>;
131
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
132
+ message: z.ZodOptional<z.ZodString>;
133
+ } & {
134
+ statusCode: z.ZodLiteral<500>;
135
+ }, "strip", z.ZodTypeAny, {
136
+ statusCode: 500;
137
+ message?: string | undefined;
138
+ error?: string | undefined;
139
+ details?: Record<string, unknown> | undefined;
140
+ reason?: string | undefined;
141
+ }, {
142
+ statusCode: 500;
143
+ message?: string | undefined;
144
+ error?: string | undefined;
145
+ details?: Record<string, unknown> | undefined;
146
+ reason?: string | undefined;
147
+ }>;
148
+ };
149
+ };
150
+ getWalletBalance: {
151
+ summary: "Get wallet balance";
152
+ description: "Retrieve the current and available balance for a specific wallet account number.";
153
+ method: "POST";
154
+ body: z.ZodObject<{
155
+ accountNo: z.ZodString;
156
+ }, "strip", z.ZodTypeAny, {
157
+ accountNo: string;
158
+ }, {
159
+ accountNo: string;
160
+ }>;
161
+ path: "/balance";
162
+ responses: {
163
+ 200: z.ZodObject<{
164
+ availableBalance: z.ZodNumber;
165
+ currentBalance: z.ZodNumber;
166
+ accountStatus: z.ZodString;
167
+ accountNo: z.ZodString;
168
+ accountName: z.ZodString;
169
+ type: z.ZodString;
170
+ currencyCode: z.ZodString;
171
+ countryCode: z.ZodString;
172
+ }, "strip", z.ZodTypeAny, {
173
+ type: string;
174
+ availableBalance: number;
175
+ accountName: string;
176
+ accountNo: string;
177
+ currencyCode: string;
178
+ countryCode: string;
179
+ currentBalance: number;
180
+ accountStatus: string;
181
+ }, {
182
+ type: string;
183
+ availableBalance: number;
184
+ accountName: string;
185
+ accountNo: string;
186
+ currencyCode: string;
187
+ countryCode: string;
188
+ currentBalance: number;
189
+ accountStatus: string;
190
+ }>;
191
+ 400: z.ZodObject<{
192
+ reason: z.ZodOptional<z.ZodString>;
193
+ error: z.ZodOptional<z.ZodString>;
194
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
195
+ message: z.ZodOptional<z.ZodString>;
196
+ } & {
197
+ statusCode: z.ZodLiteral<400>;
198
+ }, "strip", z.ZodTypeAny, {
199
+ statusCode: 400;
200
+ message?: string | undefined;
201
+ error?: string | undefined;
202
+ details?: Record<string, unknown> | undefined;
203
+ reason?: string | undefined;
204
+ }, {
205
+ statusCode: 400;
206
+ message?: string | undefined;
207
+ error?: string | undefined;
208
+ details?: Record<string, unknown> | undefined;
209
+ reason?: string | undefined;
210
+ }>;
211
+ 401: z.ZodObject<{
212
+ reason: z.ZodOptional<z.ZodString>;
213
+ error: z.ZodOptional<z.ZodString>;
214
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
215
+ message: z.ZodOptional<z.ZodString>;
216
+ } & {
217
+ statusCode: z.ZodLiteral<401>;
218
+ }, "strip", z.ZodTypeAny, {
219
+ statusCode: 401;
220
+ message?: string | undefined;
221
+ error?: string | undefined;
222
+ details?: Record<string, unknown> | undefined;
223
+ reason?: string | undefined;
224
+ }, {
225
+ statusCode: 401;
226
+ message?: string | undefined;
227
+ error?: string | undefined;
228
+ details?: Record<string, unknown> | undefined;
229
+ reason?: string | undefined;
230
+ }>;
231
+ 404: z.ZodObject<{
232
+ reason: z.ZodOptional<z.ZodString>;
233
+ error: z.ZodOptional<z.ZodString>;
234
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
235
+ message: z.ZodOptional<z.ZodString>;
236
+ } & {
237
+ statusCode: z.ZodLiteral<404>;
238
+ }, "strip", z.ZodTypeAny, {
239
+ statusCode: 404;
240
+ message?: string | undefined;
241
+ error?: string | undefined;
242
+ details?: Record<string, unknown> | undefined;
243
+ reason?: string | undefined;
244
+ }, {
245
+ statusCode: 404;
246
+ message?: string | undefined;
247
+ error?: string | undefined;
248
+ details?: Record<string, unknown> | undefined;
249
+ reason?: string | undefined;
250
+ }>;
251
+ 500: z.ZodObject<{
252
+ reason: z.ZodOptional<z.ZodString>;
253
+ error: z.ZodOptional<z.ZodString>;
254
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
255
+ message: z.ZodOptional<z.ZodString>;
256
+ } & {
257
+ statusCode: z.ZodLiteral<500>;
258
+ }, "strip", z.ZodTypeAny, {
259
+ statusCode: 500;
260
+ message?: string | undefined;
261
+ error?: string | undefined;
262
+ details?: Record<string, unknown> | undefined;
263
+ reason?: string | undefined;
264
+ }, {
265
+ statusCode: 500;
266
+ message?: string | undefined;
267
+ error?: string | undefined;
268
+ details?: Record<string, unknown> | undefined;
269
+ reason?: string | undefined;
270
+ }>;
271
+ };
272
+ };
273
+ getWalletStatement: {
274
+ summary: "Get wallet statement";
275
+ description: "Retrieve statement entries for a specific wallet within a date range.";
276
+ method: "POST";
277
+ body: z.ZodObject<{
278
+ accountNo: z.ZodString;
279
+ startDate: z.ZodString;
280
+ endDate: z.ZodString;
281
+ }, "strip", z.ZodTypeAny, {
282
+ startDate: string;
283
+ endDate: string;
284
+ accountNo: string;
285
+ }, {
286
+ startDate: string;
287
+ endDate: string;
288
+ accountNo: string;
289
+ }>;
290
+ path: "/statement";
291
+ responses: {
292
+ 200: z.ZodArray<z.ZodObject<{
293
+ accountNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
294
+ debitOrCredit: z.ZodEnum<["CR", "DR"]>;
295
+ tranRefNo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
296
+ narration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
+ txnDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
298
+ valueDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
299
+ amountCredited: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, number, string>]>>>;
300
+ amountDebited: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodString, number, string>]>>>;
301
+ balance: z.ZodNumber;
302
+ }, "strip", z.ZodTypeAny, {
303
+ balance: number;
304
+ debitOrCredit: "CR" | "DR";
305
+ txnDate: string | null;
306
+ valueDate: string | null;
307
+ accountNo?: string | null | undefined;
308
+ tranRefNo?: string | null | undefined;
309
+ narration?: string | null | undefined;
310
+ amountCredited?: number | null | undefined;
311
+ amountDebited?: number | null | undefined;
312
+ }, {
313
+ balance: number;
314
+ debitOrCredit: "CR" | "DR";
315
+ accountNo?: string | null | undefined;
316
+ tranRefNo?: string | null | undefined;
317
+ narration?: string | null | undefined;
318
+ txnDate?: string | null | undefined;
319
+ valueDate?: string | null | undefined;
320
+ amountCredited?: string | number | null | undefined;
321
+ amountDebited?: string | number | null | undefined;
322
+ }>, "many">;
323
+ 400: z.ZodObject<{
324
+ reason: z.ZodOptional<z.ZodString>;
325
+ error: z.ZodOptional<z.ZodString>;
326
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
327
+ message: z.ZodOptional<z.ZodString>;
328
+ } & {
329
+ statusCode: z.ZodLiteral<400>;
330
+ }, "strip", z.ZodTypeAny, {
331
+ statusCode: 400;
332
+ message?: string | undefined;
333
+ error?: string | undefined;
334
+ details?: Record<string, unknown> | undefined;
335
+ reason?: string | undefined;
336
+ }, {
337
+ statusCode: 400;
338
+ message?: string | undefined;
339
+ error?: string | undefined;
340
+ details?: Record<string, unknown> | undefined;
341
+ reason?: string | undefined;
342
+ }>;
343
+ 401: z.ZodObject<{
344
+ reason: z.ZodOptional<z.ZodString>;
345
+ error: z.ZodOptional<z.ZodString>;
346
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
347
+ message: z.ZodOptional<z.ZodString>;
348
+ } & {
349
+ statusCode: z.ZodLiteral<401>;
350
+ }, "strip", z.ZodTypeAny, {
351
+ statusCode: 401;
352
+ message?: string | undefined;
353
+ error?: string | undefined;
354
+ details?: Record<string, unknown> | undefined;
355
+ reason?: string | undefined;
356
+ }, {
357
+ statusCode: 401;
358
+ message?: string | undefined;
359
+ error?: string | undefined;
360
+ details?: Record<string, unknown> | undefined;
361
+ reason?: string | undefined;
362
+ }>;
363
+ 404: z.ZodObject<{
364
+ reason: z.ZodOptional<z.ZodString>;
365
+ error: z.ZodOptional<z.ZodString>;
366
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
367
+ message: z.ZodOptional<z.ZodString>;
368
+ } & {
369
+ statusCode: z.ZodLiteral<404>;
370
+ }, "strip", z.ZodTypeAny, {
371
+ statusCode: 404;
372
+ message?: string | undefined;
373
+ error?: string | undefined;
374
+ details?: Record<string, unknown> | undefined;
375
+ reason?: string | undefined;
376
+ }, {
377
+ statusCode: 404;
378
+ message?: string | undefined;
379
+ error?: string | undefined;
380
+ details?: Record<string, unknown> | undefined;
381
+ reason?: string | undefined;
382
+ }>;
383
+ 500: z.ZodObject<{
384
+ reason: z.ZodOptional<z.ZodString>;
385
+ error: z.ZodOptional<z.ZodString>;
386
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
387
+ message: z.ZodOptional<z.ZodString>;
388
+ } & {
389
+ statusCode: z.ZodLiteral<500>;
390
+ }, "strip", z.ZodTypeAny, {
391
+ statusCode: 500;
392
+ message?: string | undefined;
393
+ error?: string | undefined;
394
+ details?: Record<string, unknown> | undefined;
395
+ reason?: string | undefined;
396
+ }, {
397
+ statusCode: 500;
398
+ message?: string | undefined;
399
+ error?: string | undefined;
400
+ details?: Record<string, unknown> | undefined;
401
+ reason?: string | undefined;
402
+ }>;
403
+ };
404
+ };
405
+ };
406
+ export type WalletContract = typeof walletContract;
@@ -0,0 +1,35 @@
1
+ import { Amount, AmountJson, CurrencyCode } from "@temboplus/frontend-core";
2
+ export interface WalletData {
3
+ accountNo: string;
4
+ accountName: string;
5
+ type: string;
6
+ balance: number;
7
+ currency: string;
8
+ countryCode: string;
9
+ }
10
+ export interface WalletJson {
11
+ accountNo: string;
12
+ accountName: string;
13
+ type: string;
14
+ balance: AmountJson;
15
+ currency: CurrencyCode;
16
+ countryCode: string;
17
+ }
18
+ export declare class Wallet {
19
+ readonly accountNo: string;
20
+ readonly accountName: string;
21
+ readonly type: string;
22
+ readonly balance: Amount;
23
+ readonly currency: CurrencyCode;
24
+ readonly countryCode: string;
25
+ private readonly _originalData;
26
+ constructor(data: WalletData);
27
+ getOriginalData(): Readonly<WalletData>;
28
+ isCollectionWallet(): boolean;
29
+ isDisbursementWallet(): boolean;
30
+ isDefaultWallet(): boolean;
31
+ static from(data: WalletData): Wallet;
32
+ static createMany(dataArray: WalletData[]): Wallet[];
33
+ toJSON(): WalletJson;
34
+ static fromJSON(json: WalletJson): Wallet | undefined;
35
+ }
@@ -0,0 +1,20 @@
1
+ import { BaseRepository } from "@/lib/api";
2
+ import { StatementEntry, WalletInfo } from "@/lib/models";
3
+ import { Wallet } from "./wallet.model";
4
+ import { walletContract } from "./wallet.api-contract";
5
+ export interface WalletStatementInput {
6
+ accountNo: string;
7
+ startDate: Date | string;
8
+ endDate: Date | string;
9
+ }
10
+ export declare class WalletRepository extends BaseRepository<typeof walletContract> {
11
+ constructor(options?: {
12
+ token?: string;
13
+ root?: string;
14
+ });
15
+ listWallets(): Promise<Wallet[]>;
16
+ getWalletInfo(accountNo: string): Promise<Wallet>;
17
+ getWalletBalance(accountNo: string): Promise<WalletInfo>;
18
+ getWalletStatement(input: WalletStatementInput): Promise<StatementEntry[]>;
19
+ private formatStatementDate;
20
+ }
@@ -0,0 +1,84 @@
1
+ import { z } from "zod";
2
+ export declare enum WALLET_TYPE {
3
+ DEFAULT_DISBURSEMENT = "DEFAULT DISBURSEMENT",
4
+ DEFAULT_COLLECTION = "DEFAULT COLLECTION",
5
+ COLLECTION = "COLLECTION",
6
+ DISBURSEMENT = "DISBURSEMENT"
7
+ }
8
+ export declare const WalletDTOSchemas: {
9
+ wallet: z.ZodObject<{
10
+ accountNo: z.ZodString;
11
+ accountName: z.ZodString;
12
+ type: z.ZodString;
13
+ balance: z.ZodNumber;
14
+ currency: z.ZodString;
15
+ countryCode: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ type: string;
18
+ balance: number;
19
+ accountName: string;
20
+ accountNo: string;
21
+ countryCode: string;
22
+ currency: string;
23
+ }, {
24
+ type: string;
25
+ balance: number;
26
+ accountName: string;
27
+ accountNo: string;
28
+ countryCode: string;
29
+ currency: string;
30
+ }>;
31
+ walletType: z.ZodNativeEnum<typeof WALLET_TYPE>;
32
+ walletBalanceRequest: z.ZodObject<{
33
+ accountNo: z.ZodString;
34
+ }, "strip", z.ZodTypeAny, {
35
+ accountNo: string;
36
+ }, {
37
+ accountNo: string;
38
+ }>;
39
+ walletBalance: z.ZodObject<{
40
+ availableBalance: z.ZodNumber;
41
+ currentBalance: z.ZodNumber;
42
+ accountStatus: z.ZodString;
43
+ accountNo: z.ZodString;
44
+ accountName: z.ZodString;
45
+ type: z.ZodString;
46
+ currencyCode: z.ZodString;
47
+ countryCode: z.ZodString;
48
+ }, "strip", z.ZodTypeAny, {
49
+ type: string;
50
+ availableBalance: number;
51
+ accountName: string;
52
+ accountNo: string;
53
+ currencyCode: string;
54
+ countryCode: string;
55
+ currentBalance: number;
56
+ accountStatus: string;
57
+ }, {
58
+ type: string;
59
+ availableBalance: number;
60
+ accountName: string;
61
+ accountNo: string;
62
+ currencyCode: string;
63
+ countryCode: string;
64
+ currentBalance: number;
65
+ accountStatus: string;
66
+ }>;
67
+ walletStatementRequest: z.ZodObject<{
68
+ accountNo: z.ZodString;
69
+ startDate: z.ZodString;
70
+ endDate: z.ZodString;
71
+ }, "strip", z.ZodTypeAny, {
72
+ startDate: string;
73
+ endDate: string;
74
+ accountNo: string;
75
+ }, {
76
+ startDate: string;
77
+ endDate: string;
78
+ accountNo: string;
79
+ }>;
80
+ };
81
+ export type WalletDTO = z.infer<typeof WalletDTOSchemas.wallet>;
82
+ export type WalletBalanceRequestDTO = z.infer<typeof WalletDTOSchemas.walletBalanceRequest>;
83
+ export type WalletBalanceDTO = z.infer<typeof WalletDTOSchemas.walletBalance>;
84
+ export type WalletStatementRequestDTO = z.infer<typeof WalletDTOSchemas.walletStatementRequest>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/tembo-dashboard",
3
- "version": "0.0.26-beta.0",
3
+ "version": "0.0.26-beta.1",
4
4
  "description": "A foundational library for Temboplus-Dashboard projects providing type-safe data layer abstraction with API contracts, domain models, and repositories.",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -57,6 +57,6 @@
57
57
  "typescript": "^5.8.3"
58
58
  },
59
59
  "dependencies": {
60
- "@temboplus/frontend-core": "^0.2.20-beta.3"
60
+ "@temboplus/frontend-core": "^0.3.0-beta.2"
61
61
  }
62
62
  }