Releases: kizunajs/kizuna
Release list
v2.0.0-beta.9
2.0.0-beta.9
⚠ BREAKING CHANGES
.kizuna/diff.yaml is now .kizuna/snapshot.yaml
Before
.kizuna/diff.yaml
.kizuna/admin.diff.yaml
After
.kizuna/snapshot.yaml
.kizuna/admin.snapshot.yaml
The file holds the API as it stands at a commit, and kizuna diff compares two of them. The command keeps its name.
Rename the committed file and let kizuna generate confirm it matches:
git mv .kizuna/diff.yaml .kizuna/snapshot.yaml
kizuna generate --check
Bug Fixes
Documentation
Contributors
- Sondre Ørland (@sondreorland)
v2.0.0-beta.8
v2.0.0-beta.7
v2.0.0-beta.6
v2.0.0-beta.5
v2.0.0-beta.4
2.0.0-beta.4
Features
- eslint-plugin: flag schemas no client can type (f5723c4)
Bug Fixes
- cli: diff a committed snapshot instead of the config (da0b56c)
- fetch: name a model and type every literal (6e22775)
- native-clients: type a record and a nullable list entry (d5302bb)
- openapi: give a date and a bigint a type (4665a38)
Chores
- generate every client from the config (b100d3d)
Documentation
- generate every client from the config (63791cc)
Contributors
- Sondre Ørland (@sondreorland)
v2.0.0-beta.3
2.0.0-beta.3
⚠ BREAKING CHANGES
- fetch: omit body for a route that declares z.void() (1f40ba2)
- core: keep .nullable() required and its null in the type (a6ee91e)
Bug Fixes
- cli: load configs that use path aliases and reach JSX files (5d10c27)
- cli: write the generated Config's imports relative to its output file (b1f28d2)
- core: keep .nullable() required and its null in the type (a6ee91e)
- fetch: omit body for a route that declares z.void() (1f40ba2)
CI
- point the npm badge at the current beta (6c21f78)
Contributors
- Sondre Ørland (@sondreorland)
v2.0.0-beta.2
v2.0.0-beta.1
2.0.0-beta.1
Documentation
- note the 2.0 pre-release (8c6eca6)
Contributors
- Sondre Ørland (@sondreorland)
v2.0.0-beta.0
ts-kizuna is now Kizuna.js.
Kizuna.js 2.0 changes how an API is declared. A route carries its own handler, and kizuna.config.ts assembles everything the server, the clients and the generators read. The separate contract, server and router layers are gone.
It also publishes under a new name. Core is unscoped, everything else moved scope.
| 1.x | 2.0 |
|---|---|
@ts-kizuna/core |
kizunajs |
@ts-kizuna/<name> |
@kizunajs/<name> |
pnpm add kizunajs@betaThis is a pre-release, so it publishes under the beta tag.
The handler lives on the route
A route used to be a plain object, with its handler declared separately on a router. Now they are one thing.
// 1.x
export const users = k.routes({
getUser: {
method: 'GET',
path: '/users/:id',
responses: {
200: UserSchema,
},
},
});
export const router = server.router({
users: {
getUser: async ({ params }) => {
/* ... */
},
},
});// 2.0
export const users = k.routes({
getUser: k
.route({
method: 'GET',
path: '/users/:id',
responses: {
200: UserSchema,
},
})
.handler(async ({ params }) => {
/* ... */
}),
});The same is true of jobs and tools, and a tool is now an ordinary route that says tool.
The config assembles the API
k.contract() and new KizunaServer() are gone. kizuna.config.ts default-exports a defineConfig call naming your adapter, your routes, and your identities, and you mount what it returns.
// kizuna.config.ts
import { defineConfig } from 'kizunajs';
import { expressAdapter } from '@kizunajs/express';
import { users } from './src/routes/users';
export default defineConfig({
adapter: expressAdapter(),
routes: {
users,
},
typescript: {
outputFile: './kizuna.types.ts',
},
});The adapter is a factory call, and it decides what your handlers get alongside their validated input. auth is declared per route rather than wired separately.
Clients are generated
KizunaClient is gone. kizuna generate writes a typed client from your config, and TanStack Query takes that generated client directly. The generated client carries each route's method and the automatic 400 in its own types.
The CLI is new
In 1.x, @ts-kizuna/cli was a library the Swift and Kotlin generators loaded contracts with. It ships no command. In 2.0 it is a real one.
kizuna generate # write the types and every client the config declares
kizuna generate --check # fail when one of them is behind
kizuna routes # print every route the config serves
kizuna diff --against main # exit 1 when a change breaks callers@ts-kizuna/typescript-plugin is retired. A stale client is caught by kizuna generate --check, which CI and coding agents can run too.
2.0.0-beta.0
⚠ BREAKING CHANGES
- publish as kizunajs (23212b6)
- cli: move the editor's job into the terminal (149372a)
- cli: drop watchConfig and require typescript.outputFile (fe74596)
- core: make routes optional on defineConfig (263f696)
- fetch: remove KizunaClient (14aeb6e)
- tanstack-query: take a generated client (93bc8b1)
- fetch: carry the route and the automatic 400 in the generated client (d23ab35)
- core: rename Contract to ApiDefinition (547bebd)
- name the generators' parameter api (c1862e2)
- fetch: name the onRequest argument OutgoingRequest (5226a2a)
- core: say api where the code still said contract, and remove two dead types (75c5962)
- next: drop the onError that defineConfig never passed (3ee9901)
- fetch: bring the generated client to parity, and take the client alone in tanstack (5505874)
- docs: restructure the docs and retire contract from the vocabulary (ee80b0f)
- config: group auth, validation and the job runner settings (d970b7b)
- adapters: drop RouteHandler, Router and JobsRouter (9242fc7)
- default-export the config from kizuna.config.ts (ccc3ace)
- plugins: key a plugin by a slug it defaults and an app can override (3dd6646)
- adapters: take the adapter as a factory call (ff99a20)
- core: turn tools into routes (fffc11d)
- demos: give each demo its own config and adapter-typed routes (baab54f)
- core: move every implementation onto its declaration (8623833)
- core: assemble everything in kizuna.config.ts (2d3fb01)
- core: put the handler on the job and the tool (a20e25e)
- core: replace the server layer with k.api (a6d0875)
- core: declare auth on the route (ad3c642)
- core: put the handler on the route (be8224b)
Features
- cli: add kizuna diff (ad5896f)
- cli: add kizuna generate, which writes a config's types and clients (0cf7bb3)
- cli: compare schemas in kizuna diff (f7b7556)
- cli: diff a contract against a git ref (4df5c9f)
- cli: drop watchConfig and require typescript.outputFile (fe74596)
- cli: fail generate --check when a client is stale (18e1cbe)
- cli: move the editor's job into the terminal (149372a)
- cli: report deprecations and sunsets while watching (6989ab8)
- cli: watch a contract and re-emit on change (2eb7051)
- core: add kizuna.config (83911f2)
- core: assemble everything in kizuna.config.ts (2d3fb01)
- core: declare auth on the route (ad3c642)
- core: make routes optional on defineConfig (263f696)
- core: put the handler on the job and the tool (a20e25e)
- core: put the handler on the route (be8224b)
- core: replace the server layer with k.api (a6d0875)
- demos: give each demo its own config and adapter-typed routes (baab54f)
- fetch: bring the generated client to parity, and take the client alone in tanstack (5505874)
- fetch: carry the route and the automatic 400 in the generated client ([d...