@temboplus/tembo-dashboard 0.1.3-beta.5 → 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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -92
  3. package/dist/index.cjs.js +1 -1
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.d.ts +11 -10
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.esm.js +1 -1
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/lib/api/base-repository.d.ts +4 -4
  10. package/dist/lib/api/base-repository.d.ts.map +1 -0
  11. package/dist/lib/api/common-schemas.d.ts +37 -296
  12. package/dist/lib/api/common-schemas.d.ts.map +1 -0
  13. package/dist/lib/api/index.d.ts +3 -2
  14. package/dist/lib/api/index.d.ts.map +1 -0
  15. package/dist/lib/error/error.api.d.ts +3 -2
  16. package/dist/lib/error/error.api.d.ts.map +1 -0
  17. package/dist/lib/error/index.d.ts +2 -1
  18. package/dist/lib/error/index.d.ts.map +1 -0
  19. package/dist/lib/models/index.d.ts +4 -3
  20. package/dist/lib/models/index.d.ts.map +1 -0
  21. package/dist/lib/models/statement-entry.model.d.ts +3 -2
  22. package/dist/lib/models/statement-entry.model.d.ts.map +1 -0
  23. package/dist/lib/models/transaction-summary.model.d.ts +3 -2
  24. package/dist/lib/models/transaction-summary.model.d.ts.map +1 -0
  25. package/dist/lib/models/wallet-info.model.d.ts +2 -1
  26. package/dist/lib/models/wallet-info.model.d.ts.map +1 -0
  27. package/dist/lib/query/index.d.ts +3 -2
  28. package/dist/lib/query/index.d.ts.map +1 -0
  29. package/dist/lib/query/query.builder.d.ts +2 -1
  30. package/dist/lib/query/query.builder.d.ts.map +1 -0
  31. package/dist/lib/query/query.types.d.ts +1 -0
  32. package/dist/lib/query/query.types.d.ts.map +1 -0
  33. package/dist/lib/types.d.ts +1 -0
  34. package/dist/lib/types.d.ts.map +1 -0
  35. package/dist/modules/auth/auth.api-contract.d.ts +11 -108
  36. package/dist/modules/auth/auth.api-contract.d.ts.map +1 -0
  37. package/dist/modules/auth/auth.dtos.d.ts +4 -23
  38. package/dist/modules/auth/auth.dtos.d.ts.map +1 -0
  39. package/dist/modules/auth/auth.repository.d.ts +4 -3
  40. package/dist/modules/auth/auth.repository.d.ts.map +1 -0
  41. package/dist/modules/auth/index.d.ts +5 -4
  42. package/dist/modules/auth/index.d.ts.map +1 -0
  43. package/dist/modules/auth/user.model.d.ts +1 -0
  44. package/dist/modules/auth/user.model.d.ts.map +1 -0
  45. package/dist/modules/collection/collection.api-contract.d.ts +35 -387
  46. package/dist/modules/collection/collection.api-contract.d.ts.map +1 -0
  47. package/dist/modules/collection/collection.model.d.ts +7 -6
  48. package/dist/modules/collection/collection.model.d.ts.map +1 -0
  49. package/dist/modules/collection/collection.query.d.ts +3 -2
  50. package/dist/modules/collection/collection.query.d.ts.map +1 -0
  51. package/dist/modules/collection/collection.repository.d.ts +7 -6
  52. package/dist/modules/collection/collection.repository.d.ts.map +1 -0
  53. package/dist/modules/collection/collection.types.d.ts +32 -167
  54. package/dist/modules/collection/collection.types.d.ts.map +1 -0
  55. package/dist/modules/collection/index.d.ts +6 -5
  56. package/dist/modules/collection/index.d.ts.map +1 -0
  57. package/dist/modules/payout/index.d.ts +6 -5
  58. package/dist/modules/payout/index.d.ts.map +1 -0
  59. package/dist/modules/payout/payout.api-contract.d.ts +36 -402
  60. package/dist/modules/payout/payout.api-contract.d.ts.map +1 -0
  61. package/dist/modules/payout/payout.model.d.ts +4 -3
  62. package/dist/modules/payout/payout.model.d.ts.map +1 -0
  63. package/dist/modules/payout/payout.query.d.ts +3 -2
  64. package/dist/modules/payout/payout.query.d.ts.map +1 -0
  65. package/dist/modules/payout/payout.repository.d.ts +7 -6
  66. package/dist/modules/payout/payout.repository.d.ts.map +1 -0
  67. package/dist/modules/payout/payout.types.d.ts +39 -214
  68. package/dist/modules/payout/payout.types.d.ts.map +1 -0
  69. package/dist/modules/transaction/index.d.ts +4 -3
  70. package/dist/modules/transaction/index.d.ts.map +1 -0
  71. package/dist/modules/transaction/transaction.api-contract.d.ts +7 -84
  72. package/dist/modules/transaction/transaction.api-contract.d.ts.map +1 -0
  73. package/dist/modules/transaction/transaction.repository.d.ts +4 -3
  74. package/dist/modules/transaction/transaction.repository.d.ts.map +1 -0
  75. package/dist/modules/transaction/transaction.types.d.ts +3 -28
  76. package/dist/modules/transaction/transaction.types.d.ts.map +1 -0
  77. package/dist/modules/wallet/index.d.ts +5 -4
  78. package/dist/modules/wallet/index.d.ts.map +1 -0
  79. package/dist/modules/wallet/wallet.api-contract.d.ts +32 -287
  80. package/dist/modules/wallet/wallet.api-contract.d.ts.map +1 -0
  81. package/dist/modules/wallet/wallet.model.d.ts +2 -1
  82. package/dist/modules/wallet/wallet.model.d.ts.map +1 -0
  83. package/dist/modules/wallet/wallet.repository.d.ts +5 -4
  84. package/dist/modules/wallet/wallet.repository.d.ts.map +1 -0
  85. package/dist/modules/wallet/wallet.types.d.ts +8 -61
  86. package/dist/modules/wallet/wallet.types.d.ts.map +1 -0
  87. 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
- A foundational library for Temboplus-Dashboard projects providing type-safe data layer abstraction with API contracts, domain models, and repositories.
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
- ## Features
5
+ ## Quick Start
6
6
 
7
- - **Type Safety**: Full TypeScript support with Zod schema validation
8
- - **API Contracts**: Type-safe API definitions using `@ts-rest/core`
9
- - **Domain Models**: Rich business logic with proper data handling
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 '@temboplus/tembo-dashboard';
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
- Each module follows a consistent pattern:
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
- module/
56
- ├── module.dtos.ts # Zod schemas and types
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
- ### Installation
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
- ```bash
74
- npm install @temboplus/frontend-core @ts-rest/core zod tslib uuid
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
- ### Basic Setup
35
+ Available repositories:
78
36
 
79
- ```typescript
80
- import { PayoutRepository } from '@temboplus/tembo-dashboard';
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
- // Use the repository
89
- const result = await payoutRepo.getPayouts({
90
- page: 1,
91
- limit: 10,
92
- status: 'PAYMENT_ACCEPTED'
93
- });
94
- ```
41
+ ### Query builders
95
42
 
96
- ### Query Building
43
+ Fluent builders for common filter shapes:
97
44
 
98
45
  ```typescript
99
- import { PayoutQueryBuilder } from '@temboplus/tembo-dashboard';
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('2024-01-01', '2024-12-31')
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
- ## Requirements
57
+ ## Consumed By
58
+
59
+ - **TemboPlus Dashboard** (Next.js frontend) — internal merchant-facing dashboard.
111
60
 
112
- - TypeScript 4.5+
113
- - Node.js 16+
61
+ ## Development
114
62
 
115
- ## Peer Dependencies
63
+ Bun for everything, Biome for lint+format, mise for the toolchain pin.
116
64
 
117
- - `@temboplus/frontend-core ^0.2.11` - Core utilities and Amount handling
118
- - `@ts-rest/core ^3.52.1` - API contract definitions
119
- - `zod ^3.24.2` - Schema validation
120
- - `tslib ^2.8.1` - TypeScript runtime helpers
121
- - `uuid ^11.1.0` - UUID generation
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
- ## Repository
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
- - **GitHub**: [tembo-dashboard-js](https://github.com/TemboPlus-Frontend/tembo-dashboard-js)
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
- TemboPlus © 2025
84
+ [MIT](./LICENSE) © TemboPlus