@temboplus/tembo-dashboard 0.2.0 → 0.2.2
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/LICENSE +21 -0
- package/README.md +46 -92
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/api/base-repository.d.ts +4 -4
- package/dist/lib/api/base-repository.d.ts.map +1 -0
- package/dist/lib/api/common-schemas.d.ts +37 -296
- package/dist/lib/api/common-schemas.d.ts.map +1 -0
- package/dist/lib/api/index.d.ts +1 -0
- package/dist/lib/api/index.d.ts.map +1 -0
- package/dist/lib/error/error.api.d.ts +3 -2
- package/dist/lib/error/error.api.d.ts.map +1 -0
- package/dist/lib/error/index.d.ts +1 -0
- package/dist/lib/error/index.d.ts.map +1 -0
- package/dist/lib/models/index.d.ts +2 -1
- package/dist/lib/models/index.d.ts.map +1 -0
- package/dist/lib/models/statement-entry.model.d.ts +3 -2
- package/dist/lib/models/statement-entry.model.d.ts.map +1 -0
- package/dist/lib/models/transaction-summary.model.d.ts +3 -2
- package/dist/lib/models/transaction-summary.model.d.ts.map +1 -0
- package/dist/lib/models/wallet-info.model.d.ts +2 -1
- package/dist/lib/models/wallet-info.model.d.ts.map +1 -0
- package/dist/lib/query/index.d.ts +1 -0
- package/dist/lib/query/index.d.ts.map +1 -0
- package/dist/lib/query/query.builder.d.ts +2 -1
- package/dist/lib/query/query.builder.d.ts.map +1 -0
- package/dist/lib/query/query.types.d.ts +1 -0
- package/dist/lib/query/query.types.d.ts.map +1 -0
- package/dist/lib/types.d.ts +1 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/modules/auth/auth.api-contract.d.ts +11 -108
- package/dist/modules/auth/auth.api-contract.d.ts.map +1 -0
- package/dist/modules/auth/auth.dtos.d.ts +4 -23
- package/dist/modules/auth/auth.dtos.d.ts.map +1 -0
- package/dist/modules/auth/auth.repository.d.ts +1 -0
- package/dist/modules/auth/auth.repository.d.ts.map +1 -0
- package/dist/modules/auth/index.d.ts +3 -2
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/user.model.d.ts +1 -0
- package/dist/modules/auth/user.model.d.ts.map +1 -0
- package/dist/modules/collection/collection.api-contract.d.ts +35 -387
- package/dist/modules/collection/collection.api-contract.d.ts.map +1 -0
- package/dist/modules/collection/collection.model.d.ts +3 -2
- package/dist/modules/collection/collection.model.d.ts.map +1 -0
- package/dist/modules/collection/collection.query.d.ts +2 -1
- package/dist/modules/collection/collection.query.d.ts.map +1 -0
- package/dist/modules/collection/collection.repository.d.ts +4 -3
- package/dist/modules/collection/collection.repository.d.ts.map +1 -0
- package/dist/modules/collection/collection.types.d.ts +32 -167
- package/dist/modules/collection/collection.types.d.ts.map +1 -0
- package/dist/modules/collection/index.d.ts +3 -2
- package/dist/modules/collection/index.d.ts.map +1 -0
- package/dist/modules/payout/index.d.ts +3 -2
- package/dist/modules/payout/index.d.ts.map +1 -0
- package/dist/modules/payout/payout.api-contract.d.ts +36 -402
- package/dist/modules/payout/payout.api-contract.d.ts.map +1 -0
- package/dist/modules/payout/payout.model.d.ts +4 -3
- package/dist/modules/payout/payout.model.d.ts.map +1 -0
- package/dist/modules/payout/payout.query.d.ts +2 -1
- package/dist/modules/payout/payout.query.d.ts.map +1 -0
- package/dist/modules/payout/payout.repository.d.ts +4 -3
- package/dist/modules/payout/payout.repository.d.ts.map +1 -0
- package/dist/modules/payout/payout.types.d.ts +39 -214
- package/dist/modules/payout/payout.types.d.ts.map +1 -0
- package/dist/modules/transaction/index.d.ts +1 -0
- package/dist/modules/transaction/index.d.ts.map +1 -0
- package/dist/modules/transaction/transaction.api-contract.d.ts +7 -84
- package/dist/modules/transaction/transaction.api-contract.d.ts.map +1 -0
- package/dist/modules/transaction/transaction.repository.d.ts +2 -1
- package/dist/modules/transaction/transaction.repository.d.ts.map +1 -0
- package/dist/modules/transaction/transaction.types.d.ts +3 -28
- package/dist/modules/transaction/transaction.types.d.ts.map +1 -0
- package/dist/modules/wallet/index.d.ts +1 -0
- package/dist/modules/wallet/index.d.ts.map +1 -0
- package/dist/modules/wallet/wallet.api-contract.d.ts +32 -287
- package/dist/modules/wallet/wallet.api-contract.d.ts.map +1 -0
- package/dist/modules/wallet/wallet.model.d.ts +2 -1
- package/dist/modules/wallet/wallet.model.d.ts.map +1 -0
- package/dist/modules/wallet/wallet.repository.d.ts +2 -1
- package/dist/modules/wallet/wallet.repository.d.ts.map +1 -0
- package/dist/modules/wallet/wallet.types.d.ts +8 -61
- package/dist/modules/wallet/wallet.types.d.ts.map +1 -0
- package/package.json +34 -23
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 TemboPlus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,130 +1,84 @@
|
|
|
1
1
|
# @temboplus/tembo-dashboard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Type-safe client library for the TemboPlus Dashboard API. Repository classes wrap each resource (collections, payouts, auth, …) so consumers never talk to HTTP directly.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Quick Start
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- **Query Builders**: Fluent API for building complex queries
|
|
11
|
-
- **Repository Pattern**: Clean data access layer with error handling
|
|
12
|
-
|
|
13
|
-
## Modules
|
|
14
|
-
|
|
15
|
-
### Collections
|
|
16
|
-
Handle incoming payments from mobile money and bank channels.
|
|
17
|
-
|
|
18
|
-
```typescript
|
|
19
|
-
import { CollectionRepository } from '@temboplus/tembo-dashboard';
|
|
20
|
-
|
|
21
|
-
const repo = new CollectionRepository();
|
|
22
|
-
const collections = await repo.getCollections();
|
|
23
|
-
const summary = await repo.getSummary();
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Payouts
|
|
27
|
-
Manage outbound payments to mobile money and bank accounts.
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
import { PayoutRepository } from '@temboplus/tembo-dashboard';
|
|
31
|
-
|
|
32
|
-
const repo = new PayoutRepository();
|
|
33
|
-
const payouts = await repo.getPayouts();
|
|
34
|
-
const payout = await repo.getPayout('id');
|
|
7
|
+
```bash
|
|
8
|
+
bun add @temboplus/tembo-dashboard
|
|
9
|
+
# or: npm install @temboplus/tembo-dashboard
|
|
35
10
|
```
|
|
36
11
|
|
|
37
|
-
### Authentication
|
|
38
|
-
User authentication and session management.
|
|
39
|
-
|
|
40
12
|
```typescript
|
|
41
|
-
import { AuthRepository } from
|
|
42
|
-
|
|
43
|
-
const repo = new AuthRepository();
|
|
44
|
-
const user = await repo.login({
|
|
45
|
-
identity: 'user@example.com',
|
|
46
|
-
password: 'password'
|
|
47
|
-
});
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Architecture
|
|
13
|
+
import { AuthRepository, PayoutRepository } from "@temboplus/tembo-dashboard";
|
|
51
14
|
|
|
52
|
-
|
|
15
|
+
// 1. Log in. The returned User contains the token.
|
|
16
|
+
const authRepo = new AuthRepository();
|
|
17
|
+
const user = await authRepo.login({ identity: "user@example.com", password: "password" });
|
|
53
18
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
├── module.api-contract.ts # API contract definitions
|
|
58
|
-
├── module.model.ts # Domain models with business logic
|
|
59
|
-
├── module.query-builder.ts # Query building utilities
|
|
60
|
-
└── module.repository.ts # Data access layer
|
|
19
|
+
// 2. Pass the token to any other repository.
|
|
20
|
+
const payoutRepo = new PayoutRepository({ token: user.token });
|
|
21
|
+
const payouts = await payoutRepo.getPayouts({ page: 1, limit: 10 });
|
|
61
22
|
```
|
|
62
23
|
|
|
63
24
|
## Usage
|
|
64
25
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
npm install @temboplus/tembo-dashboard
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
The library has peer dependencies that need to be installed:
|
|
26
|
+
Authenticated repositories share the same construction shape:
|
|
72
27
|
|
|
73
|
-
```
|
|
74
|
-
|
|
28
|
+
```typescript
|
|
29
|
+
const repo = new SomeRepository({
|
|
30
|
+
token: "user-auth-token",
|
|
31
|
+
root: "https://api.example.com", // optional override
|
|
32
|
+
});
|
|
75
33
|
```
|
|
76
34
|
|
|
77
|
-
|
|
35
|
+
Available repositories:
|
|
78
36
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// Initialize with optional config
|
|
83
|
-
const payoutRepo = new PayoutRepository({
|
|
84
|
-
token: 'your-auth-token',
|
|
85
|
-
root: 'https://api.example.com'
|
|
86
|
-
});
|
|
37
|
+
- `AuthRepository` — login, session management
|
|
38
|
+
- `CollectionRepository` — inbound payments (mobile money + bank)
|
|
39
|
+
- `PayoutRepository` — outbound payments
|
|
87
40
|
|
|
88
|
-
|
|
89
|
-
const result = await payoutRepo.getPayouts({
|
|
90
|
-
page: 1,
|
|
91
|
-
limit: 10,
|
|
92
|
-
status: 'PAYMENT_ACCEPTED'
|
|
93
|
-
});
|
|
94
|
-
```
|
|
41
|
+
### Query builders
|
|
95
42
|
|
|
96
|
-
|
|
43
|
+
Fluent builders for common filter shapes:
|
|
97
44
|
|
|
98
45
|
```typescript
|
|
99
|
-
import { PayoutQueryBuilder } from
|
|
46
|
+
import { PayoutQueryBuilder } from "@temboplus/tembo-dashboard";
|
|
100
47
|
|
|
101
48
|
const query = new PayoutQueryBuilder()
|
|
102
49
|
.whereSuccessful()
|
|
103
50
|
.whereAmountBetween(1000, 50000)
|
|
104
|
-
.dateRange(
|
|
51
|
+
.dateRange("2024-01-01", "2024-12-31")
|
|
105
52
|
.toPayoutQuery();
|
|
106
53
|
|
|
107
54
|
const payouts = await repo.getPayouts(query);
|
|
108
55
|
```
|
|
109
56
|
|
|
110
|
-
##
|
|
57
|
+
## Consumed By
|
|
58
|
+
|
|
59
|
+
- **TemboPlus Dashboard** (Next.js frontend) — internal merchant-facing dashboard.
|
|
111
60
|
|
|
112
|
-
|
|
113
|
-
- Node.js 16+
|
|
61
|
+
## Development
|
|
114
62
|
|
|
115
|
-
|
|
63
|
+
Bun for everything, Biome for lint+format, mise for the toolchain pin.
|
|
116
64
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
65
|
+
```bash
|
|
66
|
+
mise install # one-time: installs pinned Bun
|
|
67
|
+
bun install
|
|
68
|
+
bun run dev # rollup build in watch mode
|
|
69
|
+
```
|
|
122
70
|
|
|
123
|
-
|
|
71
|
+
| Script | Does |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `bun run dev` | Rollup build in watch mode |
|
|
74
|
+
| `bun run build` | Rollup build + `tsc-alias` declaration rewrite to `dist/` |
|
|
75
|
+
| `bun run test` | `bun:test` (passes with zero tests; smoke test only) |
|
|
76
|
+
| `bun run lint` | Biome check |
|
|
77
|
+
| `bun run format` | Biome auto-fix |
|
|
78
|
+
| `bun run typecheck` | `tsc --noEmit` |
|
|
124
79
|
|
|
125
|
-
-
|
|
126
|
-
- **Issues**: [Report issues](https://github.com/TemboPlus-Frontend/tembo-dashboard-js/issues)
|
|
80
|
+
Tag-driven releases via `.github/workflows/release.yml` — update `CHANGELOG.md`, bump `package.json`, push a `vX.Y.Z` tag.
|
|
127
81
|
|
|
128
82
|
## License
|
|
129
83
|
|
|
130
|
-
|
|
84
|
+
[MIT](./LICENSE) © TemboPlus
|