@temboplus/tembo-dashboard 0.1.3-beta.4 → 0.2.0
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/api/index.d.ts +2 -2
- package/dist/lib/error/index.d.ts +1 -1
- package/dist/lib/models/index.d.ts +3 -3
- package/dist/lib/models/statement-entry.model.d.ts +1 -1
- package/dist/lib/models/transaction-summary.model.d.ts +1 -1
- package/dist/lib/query/index.d.ts +2 -2
- package/dist/lib/query/query.builder.d.ts +1 -1
- package/dist/modules/auth/auth.repository.d.ts +3 -3
- package/dist/modules/auth/index.d.ts +4 -4
- package/dist/modules/collection/collection.api-contract.d.ts +32 -20
- package/dist/modules/collection/collection.model.d.ts +6 -6
- package/dist/modules/collection/collection.query.d.ts +37 -8
- package/dist/modules/collection/collection.repository.d.ts +7 -7
- package/dist/modules/collection/collection.types.d.ts +30 -0
- package/dist/modules/collection/index.d.ts +5 -5
- package/dist/modules/payout/index.d.ts +5 -5
- package/dist/modules/payout/payout.api-contract.d.ts +38 -20
- package/dist/modules/payout/payout.model.d.ts +2 -2
- package/dist/modules/payout/payout.query.d.ts +42 -9
- package/dist/modules/payout/payout.repository.d.ts +7 -7
- package/dist/modules/payout/payout.types.d.ts +42 -0
- package/dist/modules/transaction/index.d.ts +3 -3
- package/dist/modules/transaction/transaction.repository.d.ts +3 -3
- package/dist/modules/wallet/index.d.ts +4 -4
- package/dist/modules/wallet/wallet.repository.d.ts +4 -4
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { QueryBuilder } from "../../lib/query";
|
|
2
|
-
import { PAYOUT_STATUS, PAYOUT_CHANNEL, PayoutFilters } from "./payout.types";
|
|
1
|
+
import { QueryBuilder } from "../../lib/query/index.js";
|
|
2
|
+
import { PAYOUT_STATUS, PAYOUT_CHANNEL, PayoutFilters } from "./payout.types.js";
|
|
3
|
+
type PayoutUrlParams = Record<string, string | string[]>;
|
|
3
4
|
/**
|
|
4
5
|
* Payout-specific query builder that extends the base QueryBuilder
|
|
5
6
|
* and handles all possible input conversions (DTOs, URL params, etc.)
|
|
@@ -14,9 +15,9 @@ export declare class PayoutQuery extends QueryBuilder {
|
|
|
14
15
|
*/
|
|
15
16
|
static fromFilters(filters: PayoutFilters): PayoutQuery;
|
|
16
17
|
/**
|
|
17
|
-
* Create from URL search parameters (strings)
|
|
18
|
+
* Create from URL search parameters (strings or string arrays)
|
|
18
19
|
*/
|
|
19
|
-
static fromUrlParams(params:
|
|
20
|
+
static fromUrlParams(params: PayoutUrlParams): PayoutQuery;
|
|
20
21
|
/**
|
|
21
22
|
* Create from URLSearchParams object
|
|
22
23
|
*/
|
|
@@ -28,13 +29,33 @@ export declare class PayoutQuery extends QueryBuilder {
|
|
|
28
29
|
/**
|
|
29
30
|
* Create from any supported input type
|
|
30
31
|
*/
|
|
31
|
-
static from(input: QueryBuilder | PayoutFilters |
|
|
32
|
+
static from(input: QueryBuilder | PayoutFilters | PayoutUrlParams | URLSearchParams | null | undefined): PayoutQuery;
|
|
32
33
|
/**
|
|
33
|
-
* Type guard for string
|
|
34
|
+
* Type guard for URL param records (string or string[] values)
|
|
34
35
|
*/
|
|
35
|
-
private static
|
|
36
|
+
private static isUrlParamsRecord;
|
|
37
|
+
/**
|
|
38
|
+
* Convert URLSearchParams to a record, collecting repeated keys into arrays.
|
|
39
|
+
*/
|
|
40
|
+
private static searchParamsToRecord;
|
|
41
|
+
/**
|
|
42
|
+
* Fold the various URL spellings of multi-value filters into a single
|
|
43
|
+
* canonical `${field}In` key with an array value. Accepts:
|
|
44
|
+
* - `statusIn=a,b,c`
|
|
45
|
+
* - `status:in=a,b,c` (objection-find wire format)
|
|
46
|
+
* - `status[]=a&status[]=b` (HTML-style bracket array)
|
|
47
|
+
* - `statusIn[]=a&statusIn[]=b`
|
|
48
|
+
* - `status=a&status=b` (repeated scalar)
|
|
49
|
+
*/
|
|
50
|
+
private static normalizeUrlParams;
|
|
36
51
|
whereStatus(status: PAYOUT_STATUS): this;
|
|
52
|
+
whereStatusIn(statuses: PAYOUT_STATUS[]): this;
|
|
37
53
|
whereChannel(channel: PAYOUT_CHANNEL): this;
|
|
54
|
+
whereChannelIn(channels: PAYOUT_CHANNEL[]): this;
|
|
55
|
+
whereIdIn(ids: string[]): this;
|
|
56
|
+
whereRefIn(refs: string[]): this;
|
|
57
|
+
whereChannelRef(channelRef: string): this;
|
|
58
|
+
whereChannelRefIn(channelRefs: string[]): this;
|
|
38
59
|
wherePending(): this;
|
|
39
60
|
whereSuccessful(): this;
|
|
40
61
|
whereFailed(): this;
|
|
@@ -55,7 +76,8 @@ export declare class PayoutQuery extends QueryBuilder {
|
|
|
55
76
|
*/
|
|
56
77
|
toFilters(): PayoutFilters;
|
|
57
78
|
/**
|
|
58
|
-
* Convert to URL-safe string parameters
|
|
79
|
+
* Convert to URL-safe string parameters.
|
|
80
|
+
* IN-filter arrays are emitted as comma-joined strings under the `${field}In` key.
|
|
59
81
|
*/
|
|
60
82
|
toUrlParams(): Record<string, string>;
|
|
61
83
|
/**
|
|
@@ -99,9 +121,19 @@ export declare class PayoutQuery extends QueryBuilder {
|
|
|
99
121
|
*/
|
|
100
122
|
getActiveFilters(): string[];
|
|
101
123
|
/**
|
|
102
|
-
* Extract filter values from QueryBuilder options
|
|
124
|
+
* Extract filter values from QueryBuilder options. Maps wire-field names
|
|
125
|
+
* back onto surface-filter names (statusCodeText→status, etc.) for fields
|
|
126
|
+
* that have a friendly alias on `PayoutFilters`.
|
|
103
127
|
*/
|
|
104
128
|
private extractFilterValues;
|
|
129
|
+
/**
|
|
130
|
+
* Apply an IN filter, silently no-op when the normalized list is empty.
|
|
131
|
+
*/
|
|
132
|
+
private whereInValues;
|
|
133
|
+
/** Narrow an unknown array to a `PAYOUT_STATUS[]` (preserving order). */
|
|
134
|
+
private getValidStatuses;
|
|
135
|
+
/** Narrow an unknown array to a `PAYOUT_CHANNEL[]` (preserving order). */
|
|
136
|
+
private getValidChannels;
|
|
105
137
|
/**
|
|
106
138
|
* Extract primary sort field
|
|
107
139
|
*/
|
|
@@ -119,3 +151,4 @@ export declare class PayoutQuery extends QueryBuilder {
|
|
|
119
151
|
*/
|
|
120
152
|
private isValidStatus;
|
|
121
153
|
}
|
|
154
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { BaseRepository, PaginationDTO } from "../../lib/api";
|
|
2
|
-
import { payoutContract } from "./payout.api-contract";
|
|
3
|
-
import { Payout } from "./payout.model";
|
|
4
|
-
import { PayoutQuery } from "./payout.query";
|
|
5
|
-
import { PayoutFilters } from "./payout.types";
|
|
6
|
-
import { TransactionSummary } from "../../lib/models";
|
|
1
|
+
import { BaseRepository, PaginationDTO } from "../../lib/api/index.js";
|
|
2
|
+
import { payoutContract } from "./payout.api-contract.js";
|
|
3
|
+
import { Payout } from "./payout.model.js";
|
|
4
|
+
import { PayoutQuery } from "./payout.query.js";
|
|
5
|
+
import { PayoutFilters } from "./payout.types.js";
|
|
6
|
+
import { TransactionSummary } from "../../lib/models/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* Flexible query input type - supports the class, filters interface, URL params, etc.
|
|
9
9
|
*/
|
|
10
|
-
export type PayoutQueryInput = PayoutQuery | PayoutFilters | Record<string, string> | URLSearchParams | null | undefined;
|
|
10
|
+
export type PayoutQueryInput = PayoutQuery | PayoutFilters | Record<string, string | string[]> | URLSearchParams | null | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* Repository class for managing payouts through API interactions.
|
|
13
13
|
* Handles payout operations, filtering, and summary data retrieval.
|
|
@@ -25,6 +25,12 @@ export declare enum BANK_PAYOUT_CHANNEL {
|
|
|
25
25
|
BANK = "TZ-BANK-B2C"
|
|
26
26
|
}
|
|
27
27
|
export type PAYOUT_CHANNEL = MOBILE_PAYOUT_CHANNEL | BANK_PAYOUT_CHANNEL;
|
|
28
|
+
/**
|
|
29
|
+
* Accepts a single string, a comma-separated string, or an array of strings,
|
|
30
|
+
* and normalizes to a deduplicated, trimmed, non-empty `string[]`.
|
|
31
|
+
*/
|
|
32
|
+
declare const toStringArray: (value: unknown) => string[];
|
|
33
|
+
export { toStringArray as payoutToStringArray };
|
|
28
34
|
export declare const PayoutDTOSchemas: {
|
|
29
35
|
payout: z.ZodObject<{
|
|
30
36
|
id: z.ZodString;
|
|
@@ -125,9 +131,15 @@ export declare const PayoutDTOSchemas: {
|
|
|
125
131
|
accountNo: z.ZodOptional<z.ZodString>;
|
|
126
132
|
walletId: z.ZodOptional<z.ZodString>;
|
|
127
133
|
id: z.ZodOptional<z.ZodString>;
|
|
134
|
+
idIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
128
135
|
ref: z.ZodOptional<z.ZodString>;
|
|
136
|
+
refIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
137
|
+
channelRef: z.ZodOptional<z.ZodString>;
|
|
138
|
+
channelRefIn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
129
139
|
channel: z.ZodOptional<z.ZodUnion<[z.ZodNativeEnum<typeof MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof BANK_PAYOUT_CHANNEL>]>>;
|
|
140
|
+
channelIn: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodNativeEnum<typeof MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof BANK_PAYOUT_CHANNEL>]>, "many">>;
|
|
130
141
|
status: z.ZodOptional<z.ZodNativeEnum<typeof PAYOUT_STATUS>>;
|
|
142
|
+
statusIn: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<typeof PAYOUT_STATUS>, "many">>;
|
|
131
143
|
minAmount: z.ZodOptional<z.ZodNumber>;
|
|
132
144
|
maxAmount: z.ZodOptional<z.ZodNumber>;
|
|
133
145
|
search: z.ZodOptional<z.ZodString>;
|
|
@@ -145,9 +157,15 @@ export declare const PayoutDTOSchemas: {
|
|
|
145
157
|
channel?: MOBILE_PAYOUT_CHANNEL | BANK_PAYOUT_CHANNEL | undefined;
|
|
146
158
|
startDate?: string | undefined;
|
|
147
159
|
endDate?: string | undefined;
|
|
160
|
+
idIn?: string[] | undefined;
|
|
161
|
+
channelIn?: (MOBILE_PAYOUT_CHANNEL | BANK_PAYOUT_CHANNEL.BANK)[] | undefined;
|
|
162
|
+
statusIn?: PAYOUT_STATUS[] | undefined;
|
|
148
163
|
minAmount?: number | undefined;
|
|
149
164
|
maxAmount?: number | undefined;
|
|
150
165
|
ref?: string | undefined;
|
|
166
|
+
refIn?: string[] | undefined;
|
|
167
|
+
channelRef?: string | undefined;
|
|
168
|
+
channelRefIn?: string[] | undefined;
|
|
151
169
|
}, {
|
|
152
170
|
status?: PAYOUT_STATUS | undefined;
|
|
153
171
|
page?: number | undefined;
|
|
@@ -162,9 +180,15 @@ export declare const PayoutDTOSchemas: {
|
|
|
162
180
|
sortOrder?: "asc" | "desc" | undefined;
|
|
163
181
|
startDate?: string | undefined;
|
|
164
182
|
endDate?: string | undefined;
|
|
183
|
+
idIn?: string[] | undefined;
|
|
184
|
+
channelIn?: (MOBILE_PAYOUT_CHANNEL | BANK_PAYOUT_CHANNEL.BANK)[] | undefined;
|
|
185
|
+
statusIn?: PAYOUT_STATUS[] | undefined;
|
|
165
186
|
minAmount?: number | undefined;
|
|
166
187
|
maxAmount?: number | undefined;
|
|
167
188
|
ref?: string | undefined;
|
|
189
|
+
refIn?: string[] | undefined;
|
|
190
|
+
channelRef?: string | undefined;
|
|
191
|
+
channelRefIn?: string[] | undefined;
|
|
168
192
|
}>;
|
|
169
193
|
payoutURLQueryParams: z.ZodObject<{
|
|
170
194
|
page: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
@@ -177,9 +201,15 @@ export declare const PayoutDTOSchemas: {
|
|
|
177
201
|
accountNo: z.ZodOptional<z.ZodString>;
|
|
178
202
|
walletId: z.ZodOptional<z.ZodString>;
|
|
179
203
|
id: z.ZodOptional<z.ZodString>;
|
|
204
|
+
idIn: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, string[], string | string[]>>;
|
|
180
205
|
ref: z.ZodOptional<z.ZodString>;
|
|
206
|
+
refIn: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, string[], string | string[]>>;
|
|
207
|
+
channelRef: z.ZodOptional<z.ZodString>;
|
|
208
|
+
channelRefIn: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, string[], string | string[]>>;
|
|
181
209
|
channel: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, MOBILE_PAYOUT_CHANNEL | BANK_PAYOUT_CHANNEL, string>>;
|
|
210
|
+
channelIn: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, string[], string | string[]>, z.ZodArray<z.ZodUnion<[z.ZodNativeEnum<typeof MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof BANK_PAYOUT_CHANNEL>]>, "many">>>;
|
|
182
211
|
status: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, PAYOUT_STATUS, string>>;
|
|
212
|
+
statusIn: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, string[], string | string[]>, z.ZodArray<z.ZodNativeEnum<typeof PAYOUT_STATUS>, "many">>>;
|
|
183
213
|
minAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
184
214
|
maxAmount: z.ZodOptional<z.ZodEffects<z.ZodString, number, string>>;
|
|
185
215
|
search: z.ZodOptional<z.ZodString>;
|
|
@@ -197,9 +227,15 @@ export declare const PayoutDTOSchemas: {
|
|
|
197
227
|
channel?: MOBILE_PAYOUT_CHANNEL | BANK_PAYOUT_CHANNEL | undefined;
|
|
198
228
|
startDate?: string | undefined;
|
|
199
229
|
endDate?: string | undefined;
|
|
230
|
+
idIn?: string[] | undefined;
|
|
231
|
+
channelIn?: (MOBILE_PAYOUT_CHANNEL | BANK_PAYOUT_CHANNEL.BANK)[] | undefined;
|
|
232
|
+
statusIn?: PAYOUT_STATUS[] | undefined;
|
|
200
233
|
minAmount?: number | undefined;
|
|
201
234
|
maxAmount?: number | undefined;
|
|
202
235
|
ref?: string | undefined;
|
|
236
|
+
refIn?: string[] | undefined;
|
|
237
|
+
channelRef?: string | undefined;
|
|
238
|
+
channelRefIn?: string[] | undefined;
|
|
203
239
|
}, {
|
|
204
240
|
status?: string | undefined;
|
|
205
241
|
page?: string | undefined;
|
|
@@ -214,9 +250,15 @@ export declare const PayoutDTOSchemas: {
|
|
|
214
250
|
sortOrder?: "asc" | "desc" | undefined;
|
|
215
251
|
startDate?: string | undefined;
|
|
216
252
|
endDate?: string | undefined;
|
|
253
|
+
idIn?: string | string[] | undefined;
|
|
254
|
+
channelIn?: string | string[] | undefined;
|
|
255
|
+
statusIn?: string | string[] | undefined;
|
|
217
256
|
minAmount?: string | undefined;
|
|
218
257
|
maxAmount?: string | undefined;
|
|
219
258
|
ref?: string | undefined;
|
|
259
|
+
refIn?: string | string[] | undefined;
|
|
260
|
+
channelRef?: string | undefined;
|
|
261
|
+
channelRefIn?: string | string[] | undefined;
|
|
220
262
|
}>;
|
|
221
263
|
payoutStatus: z.ZodNativeEnum<typeof PAYOUT_STATUS>;
|
|
222
264
|
payoutChannel: z.ZodUnion<[z.ZodNativeEnum<typeof MOBILE_PAYOUT_CHANNEL>, z.ZodNativeEnum<typeof BANK_PAYOUT_CHANNEL>]>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./transaction.api-contract";
|
|
2
|
-
export * from "./transaction.repository";
|
|
3
|
-
export * from "./transaction.types";
|
|
1
|
+
export * from "./transaction.api-contract.js";
|
|
2
|
+
export * from "./transaction.repository.js";
|
|
3
|
+
export * from "./transaction.types.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseRepository } from "../../lib/api";
|
|
2
|
-
import { transactionContract } from "./transaction.api-contract";
|
|
3
|
-
import { LocalTransferRequestDTO, LocalTransferResponseDTO } from "./transaction.types";
|
|
1
|
+
import { BaseRepository } from "../../lib/api/index.js";
|
|
2
|
+
import { transactionContract } from "./transaction.api-contract.js";
|
|
3
|
+
import { LocalTransferRequestDTO, LocalTransferResponseDTO } from "./transaction.types.js";
|
|
4
4
|
export declare class TransactionRepository extends BaseRepository<typeof transactionContract> {
|
|
5
5
|
constructor(options?: {
|
|
6
6
|
token?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./wallet.api-contract";
|
|
2
|
-
export * from "./wallet.model";
|
|
3
|
-
export * from "./wallet.repository";
|
|
4
|
-
export * from "./wallet.types";
|
|
1
|
+
export * from "./wallet.api-contract.js";
|
|
2
|
+
export * from "./wallet.model.js";
|
|
3
|
+
export * from "./wallet.repository.js";
|
|
4
|
+
export * from "./wallet.types.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
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";
|
|
1
|
+
import { BaseRepository } from "../../lib/api/index.js";
|
|
2
|
+
import { StatementEntry, WalletInfo } from "../../lib/models/index.js";
|
|
3
|
+
import { Wallet } from "./wallet.model.js";
|
|
4
|
+
import { walletContract } from "./wallet.api-contract.js";
|
|
5
5
|
export interface WalletStatementInput {
|
|
6
6
|
accountNo: string;
|
|
7
7
|
startDate: Date | string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temboplus/tembo-dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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",
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"typescript": "^5.8.3"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@temboplus/frontend-core": "^0.
|
|
61
|
+
"@temboplus/frontend-core": "^1.0.2"
|
|
62
62
|
}
|
|
63
63
|
}
|