Registry / database / betajs-sql

betajs-sql

JSON →
library1.0.8jsnpmunverified

BetaJS-SQL is a SQL wrapper for BetaJS providing database access and store functionality with support for PostgreSQL. Version 1.0.8 is the current stable release. It extends the BetaJS ecosystem with promise-based database operations using mapSuccess/mapError callbacks. Dependencies include betajs and betajs-data, and it is designed for Node.js 0.10+. The library is not actively maintained and has no recent updates.

npm install betajs-sql
INSTALL
IMPORT
SIG · BETAJS-SQL
B
betajs-sql
databasejavascriptv1.0.8
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.

SqlDatabase
const BetaJS = require('betajs'); require('betajs-data'); require('betajs-sql'); const sqldb = new BetaJS.Data.Databases.SqlDatabase({...})
This library does not export its own symbols; it extends BetaJS namespace. Must require betajs and betajs-data first.

Shows how to set up a PostgreSQL database connection, create a store, and perform insert/query/update/remove operations.

const BetaJS = require('betajs'); require('betajs-data'); require('betajs-sql'); const sqldb = new BetaJS.Data.Databases.SqlDatabase({ user: process.env.DB_USER ?? 'user', database: process.env.DB_NAME ?? 'db', password: process.env.DB_PASSWORD ?? 'pass', port: process.env.DB_PORT ?? '5432', host: process.env.DB_HOST ?? 'localhost' }); const store = new BetaJS.Data.Stores.SqlDatabaseStore(sqldb, 'table'); store.insert({x: 1}).mapSuccess(function (res) { console.log('Inserted'); }).mapError(function (err) { console.error(err); }); const query = store.query({x: 1}, {orderBy: 'id DESC'}); query.mapSuccess(function (res) { var r = res.next(); if (r) store.update({x: 1}, {x: 3}).mapSuccess(function () { store.remove({x: 3}).mapSuccess(function () { console.log('Done'); }); }); }).mapError(function (err) { console.error(err); });
Debug
Known issues
gotchaThe library uses its own promise-like pattern (mapSuccess/mapError) instead of standard Promises or async/await. Mixing with native promises can cause confusion.
fix
Always use .mapSuccess and .mapError for chaining.
affects: *
gotchaBetaJS's SqlDatabase and SqlDatabaseStore expect the 'pg' module to be installed. It is not listed as a dependency, so you must install it manually.
fix
npm install pg
affects: *
deprecatedThe library has not been updated in years and may use outdated patterns or have vulnerabilities. No modern PostgreSQL features are supported.
fix
Consider using a more modern library such as knex or sequelize.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'betajs-data'
betajs-data is not installed.
fix
npm install betajs betajs-data betajs-sql
Error: Module not found: Can't resolve 'betajs' in ...
Webpack or bundler cannot resolve BetaJS modules because they are not CommonJS modules.
fix
Ensure betajs is installed and required before betajs-sql.
Upgrade
Version history
1.0.8latest on npm
Audit
Dependencies
betajsrequiredCore framework dependency
betajs-datarequiredProvides data store base classes
Agent activity
13 hits · last 30 days
node
10
Bingbot
1
OpenAI (training)
1
Resources
betajs-sql — npm install betajs-sql · libregistry