中文 · Documentation · Skills · Storybook · npm
Fetcher is a TypeScript HTTP-client ecosystem built around the platform
fetch API. Start with typed requests, interceptors, timeouts, and streaming;
add React, OpenAPI generation, authentication, Wow CQRS, or data-viewer packages
only when the application needs them.
pnpm add @ahoo-wang/fetcherNode.js 18.20.8 or newer is required.
import { Fetcher, FetcherError } from '@ahoo-wang/fetcher';
interface User {
id: string;
name: string;
}
const api = new Fetcher({
baseURL: 'https://api.example.com',
timeout: 10_000,
});
try {
const response = await api.get('/users/{id}', {
urlParams: {
path: { id: 'u-42' },
query: { include: 'team' },
},
});
const user: User = await response.json();
console.log(user.name);
} catch (error) {
if (error instanceof FetcherError) {
console.error(error.message);
}
}| Job | Package |
|---|---|
| HTTP client and interceptors | @ahoo-wang/fetcher |
| Declarative service classes | @ahoo-wang/fetcher-decorator |
| Typed events | @ahoo-wang/fetcher-eventbus |
| Server-Sent Events | @ahoo-wang/fetcher-eventstream |
| OpenAI Chat Completions | @ahoo-wang/fetcher-openai |
| OpenAPI TypeScript types | @ahoo-wang/fetcher-openapi |
| OpenAPI client generation | @ahoo-wang/fetcher-generator |
| React hooks | @ahoo-wang/fetcher-react |
| Typed storage | @ahoo-wang/fetcher-storage |
| CoSec authentication | @ahoo-wang/fetcher-cosec |
| Wow commands and queries | @ahoo-wang/fetcher-wow |
| Data views (new projects) | @ahoo-wang/fetcher-view-engine |
| Legacy Viewer (maintenance mode, deprecated) | @ahoo-wang/fetcher-viewer |
Choose packages explains peer dependencies and the smallest useful combination.
- Start in five minutes
- Understand the request lifecycle
- Follow developer recipes
- Use package-aware agent Skills
- Look up package APIs
- Try interactive workflows
pnpm install --frozen-lockfile
pnpm build
VITEST_MAX_WORKERS=4 pnpm test:unit
pnpm lint
pnpm verify:view-engineSee the contributor guide for focused package, integration, Wiki, and Storybook checks.