npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kontsedal/olas-zod

v0.0.6

Published

Olas Zod integration — zodValidator and formFromZod for end-to-end typed forms.

Downloads

990

Readme

@kontsedal/olas-zod

Zod ↔ Olas forms adapter. Two helpers — zodValidator (single field) and formFromZod (whole form, inferred from schema).

Olas core stays Zod-free. This package has a peer dep on zod ^4.

Install

pnpm add @kontsedal/olas-zod @kontsedal/olas-core zod

30-second example

Single-field validator

import { defineController } from '@kontsedal/olas-core'
import { zodValidator } from '@kontsedal/olas-zod'
import { z } from 'zod'

const signup = defineController((ctx) => ({
  email: ctx.field('', [zodValidator(z.string().email())]),
}))

Whole form inferred from schema

import { formFromZod } from '@kontsedal/olas-zod'
import { z } from 'zod'

const schema = z.object({
  name: z.string().min(1),
  age: z.number().int().min(0),
  address: z.object({
    street: z.string().min(1),
    city: z.string().min(1),
  }),
  tags: z.array(z.string().min(1)),
})

const profileForm = defineController((ctx) => ({
  form: formFromZod(ctx, schema),
}))

// form.value.value: { name: string; age: number; address: { street, city }; tags: string[] }

formFromZod walks the schema:

  • z.object(...)Form<...> (recurses).
  • z.array(...)FieldArray<...> (recurses on element type).
  • Anything else → Field<...> with zodValidator(...) attached.

Each leaf's initial value comes from the Zod schema's .default(...) if present, otherwise the empty value for the type ('' for string, 0 for number, etc.). Override per-field with the initials option.

API

function zodValidator<T>(schema: z.ZodType<T>): Validator<T>
function zodValidatorAsync<T>(schema: z.ZodType<T>): Validator<T>

function formFromZod<S extends z.ZodObject<z.ZodRawShape>>(
  ctx: Ctx,
  schema: S,
  options?: FormOptions<...>,
): Form<...>

zodValidator runs schema.safeParse(value) and reports the first ZodIssue's message. zodValidatorAsync awaits .safeParseAsync(...) for schemas with async .refine / .transform.

Root-level .refine(...) rules on z.object(...) are not auto-promoted to a form-level validator today. Wire one manually with ctx.form(fields, { validators: [zodValidator(schema)] }), or assert on form.isValid for leaf-level rules. Tracked in ../../BACKLOG.md.

Limitation

Array-level .min(N) rules from the outer Zod schema are not promoted to a FieldArray-level validator today — leaf and nested-object rules walk correctly. Workaround: write a manual FieldArrayValidator for that case, or assert on form.isValid (driven by leaf rules). Tracked in ../../BACKLOG.md.

Further reading