Registry / database / nodeash-sql

nodeash-sql

JSON →
library2.2.54jsnpmunverified

Nodeash SQL is a lightweight Node.js package for connecting to Microsoft SQL Server databases. Current stable version is 2.2.54. The package provides a simple SQLClient function that returns a promise resolving to DBWrite, DBRead, and checkDatabaseConnection helpers. It ships TypeScript types and uses an ESM-only import pattern. Compared to libraries like mssql or tedious, it aims for minimal configuration and rapid setup, but has limited documentation and community adoption.

npm install nodeash-sql
INSTALL
IMPORT
SIG · NODEASH-SQL
N
nodeash-sql
databasejavascriptv2.2.54
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.

SQLClient
import { SQLClient } from 'nodeash-sql'
const { SQLClient } = require('nodeash-sql')
ESM-only; CommonJS require will not work. Use ES module syntax.
DBConfig
const DBConfig = { name, username, password, hostName }
const DBConfig = { database, user, password, host }
Config keys must exactly match the property names: name, username, password, hostName.
DBWrite, DBRead, checkDatabaseConnection
const { DBWrite, DBRead, checkDatabaseConnection } = await SQLClient(DBConfig)
const { DBWrite, DBRead, checkDatabaseConnection } = SQLClient(DBConfig)
SQLClient is async and returns a promise; must be awaited or used with .then().

Full example of SQLClient usage: config, connection check, write and read queries.

import { SQLClient } from 'nodeash-sql'; import dotenv from 'dotenv'; dotenv.config(); const DBConfig = { name: process.env.databaseName ?? 'mydb', username: process.env.username ?? 'sa', password: process.env.password ?? '', hostName: process.env.hostname ?? 'localhost' }; async function main() { const { DBWrite, DBRead, checkDatabaseConnection } = await SQLClient(DBConfig); const status = await checkDatabaseConnection(); console.log('Connection status:', status); // Example write const writeResult = await DBWrite(`INSERT INTO users (name) VALUES ('test')`); console.log('Write result:', writeResult); // Example read const rows = await DBRead(`SELECT * FROM users`); console.log('Read result:', rows); } main().catch(console.error);
Debug
Known issues
breakingSQLClient is async and returns a promise
fix
Use await SQLClient(config) or .then().
affects: >=2.0
gotchaConfig property names differ from common SQL libraries: use name, username, password, hostName
fix
Map typical config fields to these exact keys.
affects: all
gotchaNo error handling in basic usage; DBWrite/DBRead may throw on query failure
fix
Wrap calls in try/catch or use .catch().
affects: all
deprecatedPackage documentation is minimal; no clear migration path or release notes
fix
Review source code on GitHub for behavior details.
affects: all
Errors
Common errors & fixes
TypeError: Cannot destructure property 'DBWrite' of (intermediate value) as it is undefined.
SQLClient did not resolve to an object with those keys, likely due to wrong config or database connection failure.
fix
Ensure database server is running and config keys/values are correct. Check that SQLClient is awaited.
ReferenceError: require is not defined in ES module scope
CommonJS require used instead of ES import.
fix
Use import statement: import { SQLClient } from 'nodeash-sql';
TypeError: SQLClient is not a function
Default import used instead of named import.
fix
Use named import: import { SQLClient } from 'nodeash-sql';
Upgrade
Version history
2.2.54latest on npm
Audit
Dependencies
mssqlrequiredCore SQL Server driver used for database operations
Agent activity
5 hits · last 30 days
node
4
Resources
nodeash-sql — npm install nodeash-sql · libregistry