Registry / database / omni-orm

omni-orm

JSON →
library2.0.2jsnpmunverified

Omni ORM is a next-generation TypeScript ORM spanning MySQL, MSSQL, and PostgreSQL with a minimal footprint (~500b). Version 2.0.2 is the current stable release, relying on decorators and emitDecoratorMetadata for operation. It is designed exclusively for TypeScript and requires the reflect-metadata polyfill and injector-next as a peer dependency. Differentiators: ultra-small bundle, multi-dialect support, and a promise-heavy API. Release cadence is irregular; breaking changes are expected as the API is not yet final.

npm install omni-orm
INSTALL
IMPORT
SIG · OMNI-ORM
O
omni-orm
databasejavascriptv2.0.2
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.

OmniORM
import { OmniORM } from 'omni-orm'
import OmniORM from 'omni-orm'
Named export only; default import will cause runtime error in ESM.
OmniORM
const { OmniORM } = require('omni-orm')
const OmniORM = require('omni-orm')
CommonJS: destructure the named export; direct require returns an object.
OmniORM
import { OmniORM } from 'omni-orm'
const OmniORM = require('omni-orm').default
No default export in CJS; use destructuring.

Demonstrates setup, entity definition with decorators, and a simple findOne query against a PostgreSQL database.

import 'reflect-metadata'; import { OmniORM } from 'omni-orm'; const orm = new OmniORM({ dialect: 'postgresql', host: 'localhost', port: 5432, username: process.env.DB_USER ?? 'postgres', password: process.env.DB_PASSWORD ?? '', database: 'mydb' }); // Define entity with decorators @orm.Entity() class User { @orm.PrimaryKey() id!: number; @orm.Column() name!: string; } async function main() { await orm.connect(); const user = await orm.findOne(User, { where: { id: 1 } }); console.log(user); await orm.close(); } main().catch(console.error);
Debug
Known issues
deprecatedAPI is not yet final; breaking changes may occur in minor/patch releases
fix
Pin to exact version and test upgrades thoroughly
affects: >=2.0.0 <2.0.2
gotchaRequires reflect-metadata polyfill to be imported at the entry point
fix
Add import 'reflect-metadata' at the top of your main file or tsconfig 'types' field
affects: >=2.0.0
gotchaMissing 'experimentalDecorators' and 'emitDecoratorMetadata' in tsconfig will cause runtime reflection errors
fix
Enable both flags in tsconfig.json compilerOptions
affects: >=2.0.0
gotchaNo browser support; attempting to use in browser will fail due to missing Node APIs
fix
Use only in Node.js environment
affects: >=2.0.0
deprecatedinjector-next peer dependency may have breaking changes
fix
Maintain injector-next version as specified in peerDependencies
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot reflect metadata for property 'id' of class User. Ensure 'emitDecoratorMetadata' and 'experimentalDecorators' are enabled.
Missing or incorrect tsconfig compiler options
fix
Set 'experimentalDecorators': true and 'emitDecoratorMetadata': true in tsconfig.json
TypeError: Reflect is not defined
reflect-metadata polyfill not imported
fix
Add import 'reflect-metadata' at the top of your entry file
Error: Cannot find module 'injector-next'
Missing peer dependency injector-next
fix
Run 'npm install injector-next@^1.1.1'
TypeError: omni_orm_1.default is not a function
Using import OmniORM from 'omni-orm' instead of named import
fix
Use import { OmniORM } from 'omni-orm'
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
injector-nextrequiredPeer dependency required for dependency injection decorators
reflect-metadatarequiredRequired for decorator metadata emission in TypeScript
Agent activity
6 hits · last 30 days
node
6
Resources
omni-orm — npm install omni-orm · libregistry