Registry / database / exframe-sql

exframe-sql

JSON →
library1.3.4jsnpmunverified

A wrapper around Sequelize and potentially other SQL connectors, providing SQL database connections for the Harmony Framework (exframe ecosystem). Current stable version is 1.3.4. Release cadence is low, with occasional patches. It integrates with exframe-logger, exframe-health, and exframe-service for logging, health checks, and graceful shutdown. Key differentiators: abstraction over multiple SQL drivers, built-in health check, and seamless integration with the exframe framework. Not recommended for standalone use outside the exframe ecosystem.

npm install exframe-sql
INSTALL
IMPORT
SIG · EXFRAME-SQL
E
exframe-sql
databasejavascriptv1.3.4
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.

default (module)
const db = require('exframe-sql');
import db from 'exframe-sql';
Package uses CommonJS; ESM import may not work without a bundler.
Drivers
const { Drivers } = require('exframe-sql');
Exported property listing available drivers.
SqlConnector
const { SqlConnector } = require('exframe-sql');
import { SqlConnector } from 'exframe-sql';
Class for customization; CommonJS only.
Sequelize
const { Sequelize } = require('exframe-sql');
const { Sequelize } = require('sequelize');
Re-export of Sequelize core library for convenience.

Shows how to initialize a database connection using exframe-sql with required logger and optional configuration.

const db = require('exframe-sql'); const logger = require('exframe-logger').create(process.env.LOGSENE_TOKEN || 'token'); async function main() { const { connection } = db.init({ logger, name: 'mydb', username: process.env.DB_USER || 'root', password: process.env.DB_PASS || '', host: process.env.DB_HOST || 'localhost', port: parseInt(process.env.DB_PORT || '3306'), }); const result = await connection.query('SELECT 1+1'); console.log(result); } main().catch(console.error);
Debug
Known issues
gotchainit() returns an object with a 'connection' property, not the connection directly.
fix
Use destructuring: const { connection } = db.init({...});
affects: *
gotchalogger is required in init() options; omitting it will cause an error.
fix
Always pass a logger created via 'exframe-logger'.create().
affects: *
deprecatedThe package may be tied to older Sequelize versions; upgrading Sequelize outside the package can break.
fix
Do not install a different version of sequelize separately; rely on exframe-sql's version.
affects: >=1.0.0
gotchaconnector.connect() is called implicitly in init()? Not clearly documented; may cause double connection.
fix
Check source or avoid calling connect() manually after init() unless you intend to reconnect.
affects: *
gotchaThe package is CommonJS only; ESM import may fail without transpilation.
fix
Use require() instead of import.
affects: *
Errors
Common errors & fixes
TypeError: db.init is not a function
Using ESM import (e.g., import db from 'exframe-sql') when the package exports via module.exports = {...}.
fix
Use CommonJS require: const db = require('exframe-sql');
Error: logger must be provided
Missing logger in options object passed to init().
fix
Pass a logger instance: db.init({ logger: require('exframe-logger').create('...') });
SequelizeConnectionRefusedError: connect ECONNREFUSED
Database host/port are incorrect or service not running.
fix
Verify DB_HOST, DB_PORT environment variables or connection options.
Upgrade
Version history
1.3.4latest on npm
Audit
Dependencies
exframe-healthrequiredPeer dependency for health check integration
exframe-loggerrequiredPeer dependency for logging
exframe-servicerequiredPeer dependency for service lifecycle
sequelizerequiredRuntime dependency for SQL connection (implied but not listed)
Agent activity
7 hits · last 30 days
node
6
Resources
exframe-sql — npm install exframe-sql · libregistry