Registry / database / devbox-sql

devbox-sql

JSON →
library1.2.4jsnpmunverified

A SQL connection management library for Node.js that wraps the mssql package, providing a simplified API for executing queries with input/output parameters and transaction support. Current stable version is 1.2.4. Release cadence is low (few updates). Key differentiator: it offers a thin convenience layer over mssql, but note the code appears to have a bug (require('devbox-box') instead of 'devbox-sql'). It supports both without-transaction and with-transaction request patterns and has a getOutput method to retrieve output parameters. Limited documentation and likely unstable for production use.

npm install devbox-sql
INSTALL
IMPORT
SIG · DEVBOX-SQL
D
devbox-sql
databasejavascriptv1.2.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
const sql = require('devbox-sql')(connectionConfig);
const sql = require('devbox-sql');
The default export is a function that requires a connection configuration object.
request
sql.request();
sql.request
request is a method that returns a request object, not a direct export.
transaction
sql.transaction();
const transaction = require('devbox-sql').transaction;
transaction is a method on the sql instance, not a standalone export.

Initialize connection with config, execute a simple parameterized query using promise chain.

const config = { server: 'localhost', user: 'sa', password: 'pass', database: 'test' }; const sql = require('devbox-sql')(config); sql.request() .input('id', sql.types.Int, 1) .query('SELECT * FROM Users WHERE id = @id') .then(result => { console.log(result); }) .catch(err => { console.error(err); });
Debug
Known issues
breakingThe library may have a bug in the require statement in its documentation (require('devbox-box') instead of 'devbox-sql').
fix
Use require('devbox-sql') correctly.
affects: all
gotchaThe default export is a function that must be called with a config object before using request/transaction methods.
fix
Const sql = require('devbox-sql')(config);
affects: all
deprecatedThe getOutput method returns only the first output parameter if called without argument, which may be confusing.
fix
Use getOutput('paramName') to specify which output parameter to retrieve.
affects: <=1.2.4
Errors
Common errors & fixes
TypeError: sql.request is not a function
Forgetting to call the default export with a config object, so sql is a function instead of the returned instance.
fix
const sql = require('devbox-sql')(config);
ReferenceError: sql is not defined
The package might not be installed or may have been imported incorrectly (e.g., using non-existent name).
fix
npm install devbox-sql
Upgrade
Version history
1.2.4latest on npm
Audit
Dependencies
mssqlrequiredCore dependency for SQL Server connectivity
Agent activity
5 hits · last 30 days
node
4
Resources
devbox-sql — npm install devbox-sql · libregistry