Registry / database / junction-orm

junction-orm

JSON →
library0.4.0jsnpmunverified

A JavaScript ORM that keeps domain models free from persistence logic, using plain objects (POJOs) for models. Version 0.4.0 targets Node.js 6+. It differentiates by not requiring model classes to extend or embed ORM-specific code, instead mapping plain objects to database tables via configuration.

npm install junction-orm
INSTALL
IMPORT
SIG · JUNCTION-ORM
J
junction-orm
databasejavascriptv0.4.0
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.

junction
import junction from 'junction-orm'
const junction = require('junction-orm')
Default import is ESM-style; CJS require may not work in all Node versions.
junction.define
import { define } from 'junction-orm'
const define = require('junction-orm').define
Named export for model definition.
junction.connect
import { connect } from 'junction-orm'
Used to establish database connection.

Shows how to define a model, connect to SQLite, sync schema, and create a record.

import { define, connect } from 'junction-orm'; const User = define('User', { name: String, email: { type: String, unique: true } }); async function run() { const db = await connect({ dialect: 'sqlite', storage: ':memory:' }); await db.sync(); const user = await User.create({ name: 'Alice', email: 'alice@example.com' }); console.log(user.id, user.name); } run();
Debug
Known issues
gotchaModel definitions must provide type for each field (e.g., String, Number).
fix
Always specify a type or an object with a type property.
affects: >=0.0.0
gotchaDatabase connection is asynchronous and must be awaited.
fix
Use await connect(...) or .then().
affects: >=0.0.0
gotchasync() must be called after connect to create tables.
fix
Call await db.sync() before performing queries.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'junction-orm'
Package not installed or import path incorrect.
fix
Run 'npm install junction-orm' and use correct import.
TypeError: junction is not a function
Wrong import style (e.g., const junction = require('junction-orm')) may cause issues.
fix
Use ES6 import: import junction from 'junction-orm';
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
junction-orm — npm install junction-orm · libregistry