Registry / database / noboxout-orm

noboxout-orm

JSON →
library0.0.9jsnpmunverified

Noboxout ORM (norm) v0.0.9 is a Node.js ORM for MySQL with a classical object-oriented inheritance style using node-class. It focuses on transactions and error handling, but only supports MySQL and Memcached backends. The library provides a Norm object for setup, model definition, connection reservation, schema synchronization (destructive only), and error registration. It is in an early stage with no incremental sync and a low release frequency. Compared to alternatives like Sequelize or TypeORM, it lacks features but offers a simpler, transaction-first approach.

npm install noboxout-orm
INSTALL
IMPORT
SIG · NOBOXOUT-ORM
N
noboxout-orm
databasejavascriptv0.0.9
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.

Norm
import { Norm } from 'noboxout-orm'
const Norm = require('noboxout-orm'); const { Norm } = require('noboxout-orm');
ESM-only from v0.0.9; use named import.
norm
import { Norm } from 'noboxout-orm'; const norm = new Norm();
import norm from 'noboxout-orm';
Norm is a class; instantiate it to get the singleton.
define
const User = norm.define('User', { ... }, { ... });
norm.define('User', { ... }); without storing return
define returns the model class; store it for queries.

Initialize norm, define a User model, and save a new record using a reserved connection.

import { Norm } from 'noboxout-orm'; import mysql from 'mysql2/promise'; const norm = new Norm(); norm.setup({ database: { host: process.env.DB_HOST ?? '127.0.0.1', user: process.env.DB_USER ?? 'root', password: process.env.DB_PASS ?? '', database: process.env.DB_NAME ?? 'norm_test' } }); // define a model const User = norm.define('User', { id: norm.Number.LENGTH(10).UNSIGNED, login: norm.String.LENGTH(100), email: norm.String.LENGTH(255) }, { tableName: 'users', primaryKey: 'id' }); // reserve connection, create and save norm.reserve((err, con) => { if (err) throw err; const user = new User({ login: 'john', email: 'john@example.com' }); user.save(con, (err2) => { if (err2) throw err2; console.log('User saved'); norm.release(con); }); });
Debug
Known issues
breakingnorm.sync() drops all tables before recreating schema.
fix
Do not call sync() in production. Use manual migration scripts.
affects: >=0.0.1
breakingRequires mysql2; does not support other databases.
fix
Use only with MySQL. For other databases, consider Sequelize or TypeORM.
affects: >=0.0.1
deprecatedv0.0.9 is in early alpha; API may change without notice.
fix
Pin exact version and test after updates.
affects: >=0.0.1
gotchaPrefix is recommended but not enforced; column name collisions can cause silent bugs.
fix
Always set prefix in model definition to avoid collisions.
affects: >=0.0.1
gotchainitialize() must call this.__parent(data) or undefined behavior.
fix
Always call this.__parent(data) first in initialize.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'mysql2'
Missing required peer dependency mysql2.
fix
npm install mysql2
TypeError: norm.setup is not a function
Norm is a class; you must instantiate it.
fix
Use const norm = new Norm(); then norm.setup(...)
TypeError: this.__parent is not a function
initialize did not call this.__parent(data).
fix
Add this.__parent(data); as first line in initialize.
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies
mysql2requiredMySQL database driver; required for database operations.
Agent activity
4 hits · last 30 days
node
4
Resources
noboxout-orm — npm install noboxout-orm · libregistry