v4.0.0
What changed
Rouzer v4 removes the low-level client request descriptor API and makes generated, route-backed clients the only supported client shape.
Breaking changes
createClientnow requiresroutes.- Use
createClient({ baseURL, routes })and call generated action functions likeclient.users.get(...).
- Use
- HTTP actions no longer expose nested
.request(...)factories. - Generated clients no longer expose
client.request(...)orclient.json(...)helpers. - The client metadata property was renamed from
configtoclientConfig.- This allows route trees to define an action named
configwithout being overwritten, soclient.config(...)can be a route.
- This allows route trees to define an action named
Why
The removed request factory path was ambiguous for nested resources because action-local factories did not carry parent resource paths. Requiring createClient({ routes }) keeps URL construction, validation, response maps, and response plugins on the same generated action path.
Migration
Before:
const client = createClient({ baseURL })
await client.json(routes.getUser.request({ path: { id: '42' } }))After:
const client = createClient({ baseURL, routes })
await client.getUser({ path: { id: '42' } })If you read the client options from the returned client, use client.clientConfig instead of client.config.
Full Changelog: v3.2.0...v4.0.0