@gqloom/valibot
TypeScript icon, indicating that this package has built-in type declarations

0.8.1 • Public • Published

GQLoom Logo

GQLoom

GQLoom is a Code-First GraphQL Schema Loom used to weave runtime types in the TypeScript/JavaScript ecosystem into GraphQL Schema, helping you build GraphQL server enjoyably and efficiently.

Runtime validation libraries such as Zod, Valibot, and Yup have been widely used in backend application development. Meanwhile, when using ORM libraries like Prisma, MikroORM, and Drizzle, we also pre-define database table structures or entity models that contain runtime types. The responsibility of GQLoom is to weave these runtime types into a GraphQL Schema.

When developing backend applications with GQLoom, you only need to write types using the Schema libraries you're familiar with. Modern Schema libraries will infer TypeScript types for you, and GQLoom will weave GraphQL types for you. In addition, the resolver factory of GQLoom can create CRUD interfaces for Prisma, MikroORM, and Drizzle, and supports custom input and adding middleware.

@gqloom/valibot

This package provides GQLoom integration with Valibot to weave Valibot Schema to GraphQL Schema.

Hello World

import { resolver, query, weave } from "@gqloom/core"
import { ValibotWeaver } from "@gqloom/valibot"
import * as v from "valibot"

const helloResolver = resolver({
  hello: query(v.string())
    .input({ name: v.nullish(v.string(), "World") })
    .resolve(({ name }) => `Hello, ${name}!`),
})

export const schema = weave(ValibotWeaver, helloResolver)

Read more at GQLoom Document.

Package Sidebar

Install

npm i @gqloom/valibot

Homepage

gqloom.dev/

Weekly Downloads

20

Version

0.8.1

License

MIT

Unpacked Size

53.3 kB

Total Files

7

Last publish

Collaborators

  • xcfox