Registry / database / orchid-orm-valibot

orchid-orm-valibot

JSON →
library0.3.140jsnpmunverified

Valibot integration for OrchidORM, enabling schema-to-valibot validation in Node.js and edge environments. Version 0.3.x is the current stable line, with active weekly releases. Unlike Zod-based alternatives, it leverages Valibot's modular, tree-shakeable API for smaller bundles. It provides valibot schemas generated from OrchidORM table definitions, supporting queries and mutations.

npm install orchid-orm-valibot
INSTALL
IMPORT
SIG · ORCHID-ORM-VALIBOT
O
orchid-orm-valibot
databasejavascriptv0.3.140
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tableToValibot
import { tableToValibot } from 'orchid-orm-valibot'
const tableToValibot = require('orchid-orm-valibot')
ESM-only package, require() not supported.
ValibotSchema
import { ValibotSchema } from 'orchid-orm-valibot'
import { ValibotSchema } from 'valibot'
ValibotSchema is a type, not a runtime value; imported from this package.
valibot
import * as v from 'valibot'
import v from 'valibot'
Valibot does not have a default export; use namespace import.

Defines a simple OrchidORM table, converts it to a Valibot schema, and validates input.

import { createPool } from 'mysql'; import { orchidORM } from 'orchid-orm'; import { tableToValibot } from 'orchid-orm-valibot'; import * as v from 'valibot'; const pool = createPool({ database: process.env.DB_NAME ?? 'test' }); const db = orchidORM(pool, { user: { table: 'user', columns: { id: { type: 'integer', primaryKey: true }, name: 'string', email: 'string' } } }); const userSchema = tableToValibot(db.user); const validated = v.parse(userSchema, { id: 1, name: 'Alice', email: 'alice@example.com' }); console.log(validated); // { id: 1, name: 'Alice', email: 'alice@example.com' }
Debug
Known issues
deprecatedtableToValibot function may be renamed in future minor versions.
fix
Check changelog and update imports accordingly.
affects: 0.3.x
gotchaValibotSchema type must be used to type the result of tableToValibot; omitting it may cause TypeScript errors.
fix
Import and use ValibotSchema from this package.
affects: >=0.3.0
gotchaDo not use default export from 'valibot' (import v from 'valibot') as it does not exist.
fix
Use namespace import: import * as v from 'valibot'.
affects: >=0.30.0
breakingPackage is ESM-only and does not support CommonJS require().
fix
Use import syntax or switch to a bundler that supports ESM.
affects: >=0.3.0
Errors
Common errors & fixes
Cannot find module 'orchid-orm-valibot'
Package not installed or not in node_modules.
fix
Run npm install orchid-orm-valibot
TypeError: tableToValibot is not a function
Using default import instead of named import.
fix
Use: import { tableToValibot } from 'orchid-orm-valibot';
SyntaxError: Cannot use import statement outside a module
Project configured as CommonJS, but package is ESM-only.
fix
Set type: 'module' in package.json or use dynamic import()
Error: Unknown type 'string'
Using string type for a column without matching table definition.
fix
Use valid OrchidORM column types: string, integer, boolean, etc.
Upgrade
Version history
0.3.140latest on npm
Audit
Dependencies
orchid-ormrequiredRuntime peer dependency for table and query definitions
valibotrequiredRuntime peer dependency for schema validation
Agent activity
2 hits · last 30 days
node
2
Resources
orchid-orm-valibot — npm install orchid-orm-valibot · libregistry