Skip to content

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

NeedEntryCheck first
Send a write and inspect its stageCommandClientURL identity, command body and wait strategy; HTTP success is not business success.
Read current state or snapshotsQueryClientFactoryChoose state-only versus full snapshot result and correct path.
Construct a query without I/Ofilter + pagedQueryNew filter/legacy condition forms differ; list limits default to 0/10 respectively.
Traverse a changing result setCursor queriesStable sort and cursor rules accepted by your backend.
Compute grouped resultsAggregationsMetric/group expression and server capability; builders do not compute results.
Read an event stream or historical stateEvents and historyEvent envelopes versus state payloads and stream cleanup.

Installation prerequisites

sh
pnpm add @ahoo-wang/fetcher @ahoo-wang/fetcher-decorator @ahoo-wang/fetcher-eventstream @ahoo-wang/fetcher-wow

This 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.

ts
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

State and resource ownership · Failure and cancellation boundaries

Released under the Apache License 2.0.