@qpmtx/query-fetcher
v0.4.0
Published
Downloads
602
Readme
qpm-ts-query-fetcher
The one typed way a QPMSecondBrain client talks to an estate API. @qpmtx/query-fetcher wraps
fetch with zod-validated request/response bodies, the standard error envelope, and
abort/timeout support, plus a thin TanStack Query integration layer (typed query keys,
queryOptions/mutationOptions helpers, an SSR-safe QueryClient + prefetch/hydration flow
for the Next.js App Router, and streamIntoQuery for folding a server-sent-events response
into a query cache). It publishes to npmjs.org, public, under the @qpmtx
scope — see docs/distribution.md for how a release happens and why
this repo does not use the estate's git-tag pin.
Install
bun add @qpmtx/query-fetcher@tanstack/react-query and react are peer dependencies — the consuming app's own versions
are used (docs/usage.md).
Governing law
ts-craft(bun toolchain, ESM-only, module layout) andts-client-craft(generated clients, TanStack Query as the only server-data cache, dumb UI) — both inqpsb-skills.code-craft(cross-language writing/changing rules) andqa-craft(test strategy).docs-craft(this README's own shape).- See
INSTRUCTIONS.mdfor the full pinned skill/agent set and the gate command.
Quickstart
git config core.hooksPath .githooks # once per clone (repo-gates-and-hooks rule 2)
bun install --frozen-lockfile
./check./check is the gate — hook, CI, and a human all run exactly it (./check <stage> for one
stage: fmt, lint, typecheck, test, or build; no argument runs all of them).
Docs
docs/usage.md— install, fetcher setup, one query, one mutation, SSR hydration, streaming server-sent events into a query cache, error handling.docs/distribution.md— how this package is published to npm, why not a git-tag pin, and the temporary vendored-config deviation (QPMSEC-433).
