@sudobility/testomniac_client
v0.0.73
Published
Testomniac API client library with TanStack Query hooks
Downloads
5,969
Maintainers
Readme
@sudobility/starter_client
API client SDK for Starter with TanStack Query hooks.
Installation
bun add @sudobility/starter_clientPeer dependencies:
bun add react @tanstack/react-query @sudobility/typesUsage
import { StarterClient } from "@sudobility/starter_client";
import { useHistories, useHistoriesTotal } from "@sudobility/starter_client/hooks";
// Create the HTTP client (dependency-injected NetworkClient)
const client = new StarterClient({ baseUrl: "https://api.example.com", networkClient });
// In a React component:
const { data, createHistory, updateHistory, deleteHistory } = useHistories(config);
const { data: total } = useHistoriesTotal(config);API
StarterClient
HTTP client class constructed with { baseUrl, networkClient }. Uses dependency injection via the NetworkClient interface -- no direct fetch calls.
Hooks
useHistories(config)-- Fetches user history list; providescreateHistory,updateHistory,deleteHistorymutations with automatic cache invalidation.useHistoriesTotal(config)-- Fetches global total (public endpoint).
Utilities
createAuthHeaders(token)-- Builds auth header objectbuildUrl(base, path)-- URL construction helperhandleApiError(error)-- Standardized API error handlingQUERY_KEYS-- Type-safe TanStack Query cache key factory
Development
bun run build # Build ESM
bun run clean # Remove dist/
bun test # Run Vitest tests
bun run typecheck # TypeScript check
bun run lint # ESLint
bun run verify # All checks + build (use before commit)Related Packages
- starter_types -- Shared type definitions (imported for API types)
- starter_api -- Backend server this client communicates with
- starter_lib -- Business logic library that wraps this client's hooks
- starter_app -- Web frontend (consumes transitively via starter_lib)
- starter_app_rn -- React Native app (consumes transitively via starter_lib)
License
BUSL-1.1
