
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
NDBI is a database abstraction layer (DAL) for Node.js. It is modeled after Perl's `DBI` module and PHP's `PDO` module. It is written with ES8 async/await in mind, while providing a common set of function interfaces for all supported database types, and i
NDBI is a database abstraction layer (DAL) for Node.js. It is modeled after
Perl's DBI module and PHP's PDO module. It is written with ES8 async/await
in mind, while providing a common set of function interfaces for all supported
database types, and it is easy to implement new drivers as needed.
Examples:
async function main() {
const Ndbi = require("ndbi");
const ndbi = new Ndbi("postgres:host=localhost;database=test");
await ndbi.connect();
const stmt = await ndbi.prepare("SELECT * FROM foo WHERE bar = $1");
await stmt.execute([ "baz" ]);
let row;
while (row = await stmt.fetchRow()) {
console.log(`row.spam = ${ row.spam }`);
}
await ndbi.disconnect();
}
Drivers are manage by the Ndbi.DriverManager class. An instance of this class
is created at startup and available at Ndbi.driverManager. This class holds
a registry of dsn string prefixes that map to node module names. The following
drivers are currently available:
| DSN prefix | Node Module | Description |
|---|---|---|
| postgres: | ndbi-driver-postgres | NDBI driver that wraps node-postgres |
Other drivers can easily be implemented by using ndbi-driver-postgres as a
template. Drivers need to implement constructor and a set of methods that
conform to the specifications below.
| Method Name | Required? | Signature | Description |
|---|---|---|---|
[[constructor]] | `new Driver(dsn: string, username:string | null, password:string | null, options:Object)` |
beginTransaction | N | driver.beginTransaction(): Promise<undefined> | Puts driver into transaction mode. If this method is omitted it is polyfilled with execute. |
commit | N | driver.commit(): Promise<undefined> | Commits the current transaction. If method is omitted it is polyfilled with execute. |
connect | Y | driver.connect(): Promise<undefined> | Connects to the database and updates driver instance state. |
disconnect | Y | driver.disconnect(): Promise<undefined> | Disconnects from the database and updates driver instance state, reconnection should be allowed. |
execute | N | driver.execute(sql: string, params: Array, options: {}): Promise<Statement> | Executes the sql and parameters and returns an object conforming to the Statement interface that is already resolved. If this method is omitted from the driver, then it is polyfilled using query. |
lastInsertId | Y | `driver.lastInsertId(catalog: string | null, schema: string |
prepare | Y | driver.prepare(sql: string, options:Object): Promise<Statement> | Prepares the statement and returns an object that conforms to the Statement interface. |
query | N | driver.query(sql: string, params: Array, options: {}): Promise<Statement> | Executes the sql and parameters and returns an object conforming to the Statement interface that is already resolved. If this method is omitted from the driver, then it polyfilled using prepare. |
rollback | N | driver.rollback(): Promise<undefined> | Rollsback the current transaction. If method is omitted it is polyfilled via execute. |
transaction | N | driver.transaction(promisor: (function(): Promise)): Promise | Accepts a callback. The callback should return a promise. Begin a transaction, run the callback, wait for it to resolve, and either commit or rollback depending the result of promisor. If this is omitted it is polyfilled via beginTransaction and commit/rollback |
Statements model prepared connections, and the results of an execution. A statement should be executed and then read from. Below is the interface requirements for a Statement:
| Method Name | Signature | Description |
|---|---|---|
execute | stmt.execute(params: Array?): Promise<undefined> | Tell DB server to execute prepared statement with optional arguments |
fetchRow | stmt.fetchRow(): Promise<row?> | Pull the next row from an executed statement. Returns undefined when no rows available |
fetchAll | stmt.fetchAll(): Promise<rows> | Fulfill promise with all rows received from server |
FAQs
NDBI is a database abstraction layer (DAL) for Node.js. It is modeled after Perl's `DBI` module and PHP's `PDO` module. It is written with ES8 async/await in mind, while providing a common set of function interfaces for all supported database types, and i
The npm package ndbi receives a total of 7 weekly downloads. As such, ndbi popularity was classified as not popular.
We found that ndbi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.