Wow
Use Wow clients with a service that implements the Wow command and query protocols. The builders create serializable data locally; creating a query or client does not send HTTP. Generics describe the expected response, not server authorization, schema validation or projection freshness.
Choose an entry
| Need | Entry | Check first |
|---|---|---|
| Send a write and inspect its stage | CommandClient | URL identity, command body and wait strategy; HTTP success is not business success. |
| Read current state or snapshots | QueryClientFactory | Choose state-only versus full snapshot result and correct path. |
| Construct a query without I/O | filter + pagedQuery | New filter/legacy condition forms differ; list limits default to 0/10 respectively. |
| Traverse a changing result set | Cursor queries | Stable sort and cursor rules accepted by your backend. |
| Compute grouped results | Aggregations | Metric/group expression and server capability; builders do not compute results. |
| Read an event stream or historical state | Events and history | Event envelopes versus state payloads and stream cleanup. |
Installation prerequisites
pnpm add @ahoo-wang/fetcher @ahoo-wang/fetcher-decorator @ahoo-wang/fetcher-eventstream @ahoo-wang/fetcher-wowThis reference targets 5.0.0. The library package declares Node >=18.20.8; repository development requires Node >=20.20.2 and pnpm 10.34.5. The command includes all transitive internal peers, including packages reached through Wow/React/CoSec. Direct runtime dependencies are installed automatically.
Core request
Pass a Fetcher configured with your baseURL/authentication. Calling loadUsers issues the request and returns {list,total}; the service must implement the accounts/user Wow snapshot-state paged endpoint. This example does not contact a public service.
import type { Fetcher } from '@ahoo-wang/fetcher';
import { QueryClientFactory, filter, pagedQuery } from '@ahoo-wang/fetcher-wow';
interface User {
id: string;
name: string;
}
export async function loadUsers(fetcher: Fetcher) {
const client = new QueryClientFactory<User>({
fetcher,
contextAlias: 'accounts',
aggregateName: 'user',
}).createSnapshotQueryClient();
return client.pagedState(
pagedQuery({
filter: filter.matchAll(),
pagination: { index: 1, size: 20 },
}),
);
}Topics
- Client configuration and metadata
- Commands and wait results
- Snapshot queries
- Filter expressions and legacy conditions
- Projection, sorting and pagination
- Cursor queries
- Aggregation builders
- Events and historical state
- Identity and resource attribution
- Message payloads and state metadata
- Business errors and document utilities
- Legacy operator locales
- Complete symbol index
State and resource ownership · Failure and cancellation boundaries
