@temboplus/tembo-dashboard
v0.2.9
Published
A foundational library for Temboplus-Dashboard projects providing type-safe data layer abstraction with API contracts, domain models, and repositories.
Downloads
304
Readme
@temboplus/tembo-dashboard
Type-safe client library for the TemboPlus Dashboard API. Repository classes wrap each resource (collections, payouts, auth, …) so consumers never talk to HTTP directly.
Quick Start
bun add @temboplus/tembo-dashboard
# or: npm install @temboplus/tembo-dashboardimport { AuthRepository, PayoutRepository } from "@temboplus/tembo-dashboard";
// 1. Log in. The returned User contains the token.
const authRepo = new AuthRepository();
const user = await authRepo.login({ identity: "[email protected]", password: "password" });
// 2. Pass the token to any other repository.
const payoutRepo = new PayoutRepository({ token: user.token });
const payouts = await payoutRepo.getPayouts({ page: 1, limit: 10 });Usage
Authenticated repositories share the same construction shape:
const repo = new SomeRepository({
token: "user-auth-token",
root: "https://api.example.com", // optional override
});Available repositories:
AuthRepository— login, session managementCollectionRepository— inbound payments (mobile money + bank)PayoutRepository— outbound payments
Query builders
Fluent builders for common filter shapes:
import { PayoutQueryBuilder } from "@temboplus/tembo-dashboard";
const query = new PayoutQueryBuilder()
.whereSuccessful()
.whereAmountBetween(1000, 50000)
.dateRange("2024-01-01", "2024-12-31")
.toPayoutQuery();
const payouts = await repo.getPayouts(query);Consumed By
- TemboPlus Dashboard (Next.js frontend) — internal merchant-facing dashboard.
Development
Bun for everything, Biome for lint+format, mise for the toolchain pin.
mise install # one-time: installs pinned Bun
bun install
bun run dev # rollup build in watch mode| Script | Does |
| --- | --- |
| bun run dev | Rollup build in watch mode |
| bun run build | Rollup build + tsc-alias declaration rewrite to dist/ |
| bun run test | bun:test (passes with zero tests; smoke test only) |
| bun run lint | Biome check |
| bun run format | Biome auto-fix |
| bun run typecheck | tsc --noEmit |
Tag-driven releases via .github/workflows/release.yml — update CHANGELOG.md, bump package.json, push a vX.Y.Z tag.
License
MIT © TemboPlus
