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

@vibeorm/schema

v5.11.0

Published

Canonical schema IR, validation, dialect/capability types, and error codes for VibeORM v2

Readme

@vibeorm/schema

Part of VibeORM — a type-safe TypeScript ORM for Bun and Node. Prisma-schema or TypeScript-DSL input, a canonical schema IR, a generated client, and a dialect-aware SQL layer over PostgreSQL, PGlite, SQLite and MySQL.

The canonical Schema IR: the data shape every other VibeORM package reads. It exists as its own package because the parser, the DSL, the generator, migrate and the runtime all need the same schema type without depending on each other.

bun add @vibeorm/schema

Stable. 2.0.0, published under the latest dist-tag. The v1 line stays installable as vibeorm@1.

Most users never install this directly — it ships as a dependency of vibeorm. Reach for it when you are building tooling on the IR or SQL layer.

What it exports

  • The IR types: SchemaIR, ModelIR, FieldIR, RelationIR, IndexIR, IndexFieldIR, EnumIR, DatasourceIR, ExtensionDeclIR, plus the enumerations FieldType, ScalarType, RelationType, IndexKind, CascadeAction, DefaultValueIR. Helpers: isEnumType, providerToDialect, DIALECTS.
  • Validation: validateSchemaIR({ schema }) returns ValidationIssue[]; assertValidSchemaIR throws instead. Both are shared by the parser and the DSL, so an IR built either way is held to one set of structural rules.
  • Dialect identity: the Provider and Dialect types, and the DialectCapabilities / FullTextEngine shapes. The capability tables themselves live in @vibeorm/sql; this package only fixes their shape.
  • Errors: VibeError, the VibeErrorCode union, the VIBE_ERROR_CODES list, and the constructors internalError and unsupportedCapability. Every error VibeORM throws is a VibeError with a stable code, so callers branch on codes and never on message text.
  • Reserved names: RESERVED_CLIENT_NAMES, RESERVED_DELEGATE_NAMES, isReservedClientName, isReservedDelegateName — the collision guard between user models and the client surface.
  • The implicit many-to-many rule: implicitJoinTable and ImplicitJoinTable. One shared definition of the join table an implicit m2m relation maps to, used by the parser and by migrate. Self relations are refused rather than supported (validateSchemaIR rule implicit-self-many-to-many): one model name on both ends means both relation fields would own column "A". The function still derives a self join table's NAME, because introspection and the migration differ must recognise one that already exists in a database.
  • The extension framework: defineExtension, buildExtensionRegistry, extensionDeclarations, mergeExtensionDeclarations, extensionManifestEntry, extensionOptionsHash, EMPTY_EXTENSION_REGISTRY, and the VibeExtension / ExtensionRegistry types.

The error codes

| Code | Meaning | |---|---| | VIBE_NOT_FOUND | findUniqueOrThrow / findFirstOrThrow / update / delete target missing | | VIBE_UNIQUE_VIOLATION | unique constraint violation (driver-mapped) | | VIBE_FK_VIOLATION | foreign key constraint violation (driver-mapped) | | VIBE_VALIDATION | input failed validation before reaching the database | | VIBE_SCHEMA_INVALID | schema failed structural validation | | VIBE_UNSUPPORTED_CAPABILITY | feature requested on a dialect that does not support it | | VIBE_STALE_CLIENT | generated client is stale relative to config/schema | | VIBE_CONFIG | configuration problem (config file, flags, env) | | VIBE_MIGRATION | migration engine failure, including checksum mismatch | | VIBE_TRANSACTION | transaction begin/commit/rollback/serialization failure | | VIBE_ADAPTER | driver or connection failure without a more specific code | | VIBE_INTERNAL | invariant broken inside VibeORM; always a bug |

Why the IR is the only currency

Both schema inputs compile to SchemaIR: the .prisma parser (@vibeorm/parser) and the TypeScript DSL (@vibeorm/dsl). Nothing downstream parses schema text.

The generator, migrate and the runtime read the IR and only the IR. That is what makes the two input formats interchangeable, and what makes vibeorm convert a mechanical translation in both directions rather than a rewrite.

Links