Package Exports
- @lunora/values
- @lunora/values/package.json
Readme
Validators for Lunora: the v.* validator suite with end-to-end return-type inference
Daniel Bannert's open source work is supported by the community on GitHub Sponsors
The v validator namespace for Lunora — a small runtime validator suite that doubles as a schema descriptor. Every validator carries a runtime parse / safeParse plus a phantom type that Infer<…> reads to recover the TypeScript type end-to-end. It also speaks Standard Schema in both directions. Usually consumed transitively via @lunora/server, which re-exports v.
Part of the Lunora framework — a type-safe, real-time backend on Cloudflare Workers + Durable Objects with a Vite-first DX.
Install
npm install @lunora/valuesyarn add @lunora/valuespnpm add @lunora/valuesUsage
import { type Infer, v } from "@lunora/values";
const Message = v.object({
id: v.id("messages"),
body: v.string(),
edited: v.optional(v.boolean()),
status: v.union(v.literal("draft"), v.literal("sent")),
});
type Message = Infer<typeof Message>;
// { id: Id<"messages">; body: string; edited?: boolean; status: "draft" | "sent" }
const parsed = Message.parse(input); // throws ValidationError on mismatch
const result = Message.safeParse(input);
if (!result.ok) console.error(result.error.path, result.error.expected);This README covers the basics. For the full API, options, and guides, see the documentation.
Related
@lunora/server— re-exportsvfor single-import usage in your functions.@lunora/codegen— reads validator metadata to emit the typed data model.
Supported Node.js Versions
Libraries in this ecosystem make the best effort to track Node.js' release schedule. Here's a post on why we think this is important.
Contributing
If you would like to help take a look at the list of issues and check our Contributing guidelines.
Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Credits
Made with ❤️ at Anolilab
This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. Anolilab is a Development and AI Studio. Contact us at hello@anolilab.com if you need any help with these technologies or just want to say hi!
License
The Lunora values package is open-sourced software licensed under the FSL-1.1-Apache-2.0.