@bloom/api-client
The Bloom API fetch core and auth hooks, extracted from bloom-web (#481).
apiFetch/ApiError/apiUrl- the thin fetch wrapper (always sends credentials so the httpOnly session cookie rides along). The base URL is injectable: callsetApiBaseUrl(import.meta.env.VITE_API_BASE_URL ?? "")once at app startup instead of the old module-scope env read. Unset it stays""(same-origin, the dev-proxy default).useCurrentUser/useAuthConfig/useTestLogin/useLogout+ theCurrentUser/AuthConfigtypes.@bloom/api-client/testing- shared test utilities:renderWithProviders,createTestQueryClient,MockEventSource.
Source-only package: consumers compile src/ with their own bundler (Vite).
Generated types (M29-1, frozen TS-side in #803)
The committed openapi.json in this package is the frozen source of truth for response types
(byte-parity with the FastAPI app at the time of freezing; the Python backend is being
decommissioned). src/generated/api.ts is generated (never hand-edited) from it by
openapi-typescript; CurrentUser / AuthConfig are aliases into it, and
the full paths / components / operations surface is exported for other endpoint shapes.
After editing the spec, regenerate the types and commit both:
pnpm --filter @bloom/api-client gen:api # regenerate src/generated/api.ts from ./openapi.json
CI fails on drift: a workflow step regenerates the types and requires a clean git diff against
the committed spec.