一覧へ戻る
Nano-Collective/json-up(新しいタブで開きます)
主要言語: TypeScript
TypeScript JSON migration tool with Zod schema validation
- star 数
- 19
- watcher 数
- 0
- fork 数
- 2
- issue 数
- 6
- 最終更新
- 2026/10/31
主要言語: TypeScript
TypeScript JSON migration tool with Zod schema validation
A fast, type-safe JSON migration tool with Zod schema validation — built by the Nano Collective, a community collective building AI tooling not for profit, but for the community. Everything we build is open, transparent, and driven by the people who use it.
npm install @nanocollective/json-up zod
import { createMigrations, migrate } from "@nanocollective/json-up"; import { z } from "zod"; const migrations = createMigrations() .add({ version: 1, schema: z.object({ name: z.string() }), up: (data) => ({ name: data.name ?? "Unknown" }), }) .add({ version: 2, schema: z.object({ firstName: z.string(), lastName: z.string() }), up: (data) => { const [firstName = "", lastName = ""] = data.name.split(" "); return { firstName, lastName }; }, }) .build(); const result = migrate({ state: { _version: 1, name: "Jane Doe" }, migrations, }); console.log(result); // { _version: 2, firstName: "Jane", lastName: "Doe" }
When your migrations need to perform async operations, use the async API:
import { createAsyncMigrations, migrateAsync } from "@nanocollective/json-up"; import { z } from "zod"; const migrations = createAsyncMigrations() .add({ version: 1, schema: z.object({ name: z.string() }), up: (data) => ({ name: data.name ?? "" }), }) .add({ version: 2, schema: z.object({ name: z.string(), key: z.string() }), up: async (data) => ({ name: data.name, key: await generateKey(), }), }) .build(); const result = await migrateAsync({ state, migrations });
For full documentation, see docs/index.md:
The Nano Collective is a community collective building AI tooling for the community, not for profit. We'd love your help.