Security News
Supply Chain Attack Detected in @solana/web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
knex-utils
Advanced tools
Common utilities for knex.js
const knexUtils = require('knex-utils');
gulp.task('migrateDb', (cb) => { knexUtils.tools.migrateDb('./db/migrations', 'migrations') .then(() => knexUtils.tools.closeConnection().then(() => cb())) .catch(() => knexUtils.tools.closeConnection().then(() => cb())); });
gulp.task('cleanDb', (cb) => { knexUtils.tools.cleanDb(['TABLE_1', 'TABLE_2']) .then(() => knexUtils.tools.closeConnection().then(() => cb())) .catch(() => knexUtils.tools.closeConnection().then(() => cb())); });
gulp.task('seedDb', (cb) => { knexUtils.tools.seedDb('./db/seeds') .then(() => { setTimeout(() => { knexUtils.tools.closeConnection().then(() => cb()); // this totally shouldn't be necessary but otherwise it tries to close connection with unfinished calls }, 5000); }) .catch(() => knexUtils.tools.closeConnection().then(() => cb())); });
##Example of a usage inside actual application
knex.instance.js:
const config = require('../config/config'); const logger = require('./logger'); const knexUtils = require('knex-utils');
const dbConfig = config.get('DB');
knexUtils.config.setLogger(logger); knexUtils.config.setConfig({ client: dbConfig.CLIENT, username: dbConfig.USER, password: dbConfig.PASSWORD, hostname: dbConfig.HOST, database: dbConfig.DATABASE, connectionTimeout: dbConfig.ACQUIRE_CONNECTION_TIMEOUT, minPoolSize: dbConfig.MIN_POOL_SIZE, maxPoolSize: dbConfig.MAX_POOL_SIZE, heartbeatQuery: dbConfig.HEARTBEAT_QUERY });
module.exports = dbUtils.knexHelperFactory.getInstance();
let knex = require('../helpers/knex.instance').getKnexInstance();
FAQs
Useful utilities for Knex.js
The npm package knex-utils receives a total of 485 weekly downloads. As such, knex-utils popularity was classified as not popular.
We found that knex-utils 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.