Upgrade to KatanaKit v4
This guide migrates you from 3.x to 4.x. Two changes need attention: the logger API and the query layer's return shape.
npm install katanakit-js@^4Breaking changes
Logger API simplified (4.0.1)
useLogger now takes (message, data?, level?) with levels reduced to log | warn | error. The info and debug levels are gone.
The Strategy abstraction — LogStrategy, ConsoleStrategy, useSetLogLevel, useSetStrategy — and useLog were removed. Logging maps directly onto the native console.
Before (3.x):
import { useLog, useSetLogLevel } from "katanakit-js";
useSetLogLevel("debug");
useLog("fetching users", { id: 25 }, "info");After (4.x):
import { useLogger } from "katanakit-js";
useLogger("fetching users", { id: 25 }, "log");Query layer runs on TanStack Query Core (4.0.3)
@tanstack/query-core ships as a dependency (no separate install), the full engine is re-exported from katanakit-js, and every adapter — useQuery/useMutation for React, Vue, Solid, Svelte and Angular — is now a thin binding over it.
This changes the result object you receive. You get TanStack's native shape back: isPending, isFetching, isSuccess, isError, data, error, status, fetchStatus, refetch, mutate, reset.
Before (3.x, hand-rolled QueryClient/QueryCache): a custom result shape with correctness gaps — no-op invalidateQueries, blocking refetch instead of stale-while-revalidate, no infinite queries, no optimistic updates.
After (4.x):
const { data, isPending, isError, refetch } = useQuery({ queryKey: ["users"], queryFn });If you destructured fields that no longer exist, they are the breaking part — the query keys themselves are unchanged, and invalidateQueries now matches by array prefix instead of serialized string, so ["users"] correctly invalidates ["users", 1].
Changes that alter behaviour
None of these are import-breaking, but they change what your code does:
useKatanaFetchrenamed touseRequest(4.0.0) — the Vue reactive-fetch composable.useKatanaFetchremains as a deprecated alias, so you can move at your own pace.- SSRF hardening (4.0.0) —
useFetchfails closed on redirects (redirect: "error"). If a configured endpoint redirects, the request now errors instead of following it. - DOM sanitizer (4.0.0) —
srcdocis rejected outright, anddata:URIs are restricted to raster images. - Express
appexport is now lazy (4.0.1) — importingkatanakit-js/adapters/expressno longer builds the app as a side effect. - Prisma subpath no longer throws without
DATABASE_URL(4.0.0) — the client loads lazily. - Notion and WordPress return Safe Results when unconfigured (4.0.0) — instead of throwing.
- Pagination caps (4.0.1) —
useWpListAllPosts,useNotionListAllBlockChildrenanduseNotionListAllDatabasePagesnow default tomaxItems = 1000.
Added in v4
- Framework adapters — React, Solid, Svelte and Angular as new optional subpaths (
katanakit-js/adapters/react,/solid,/svelte,/angular), each bridging the shared query cache and HTTP layer to its native reactivity. - Notion adapter (
katanakit-js/adapters/notion) — Pages, Blocks, Databases, Users and Search with auto-pagination helpers, all returningFetchResult. - WordPress adapter (
katanakit-js/adapters/wordpress) — CRUD over Posts, Pages, Media, Categories, Tags, Comments and Users, plus_fields,_embed, ACF support and batch operations. - Bun server adapter (4.0.1) —
katanakit-js/adapters/bun, a Bun-native alternative to Express with a typed route table and a dummyjson.com demo.
Migration checklist
- Install
katanakit-js@^4. - Replace
useLog/useSetLogLevelcall sites withuseLogger, droppinginfoanddebug. - Re-check every
useQuery/useMutationdestructure against TanStack's result object. - Rename
useKatanaFetchtouseRequest(the alias still works). - Revisit anything relying on redirects being followed.
- Run your test suite.
Full detail per release: changelog.