Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A Javascript Data Broker.
Who doesn't love writing the same code over and over again? Good question. Anybody who doesn't probably wants something to do simple data access stuff. And some of the complicated interactions as well. Meadow aims to provide a simple “magic where you want it, programmability where you don't” pattern.
$ npm install meadow
Because meadow requires the fable library, you will also need to install that dependency:
$ npm install fable
It is pretty easy to perform CRUD access on your database. And facilities are there to go crazy with custom queries and stored procedures.
// These settings are read automatically from the fable.settings object by meadow
var databaseSettings = {
MySQL:
{
Server: "localhost",
Port: 3306,
User: "root",
Password: "",
Database: "sales_data",
ConnectionPoolLimit: 20
}
};
var fable = require('fable').new();
// Create a MySQL connection pool (assuming MySQL is the provider you are using)
var libMySQL = require('mysql2');
fable.MeadowMySQLConnectionPool = libMySQL.createPool
(
{
connectionLimit: _Fable.settings.MySQL.ConnectionPoolLimit,
host: _Fable.settings.MySQL.Server,
port: _Fable.settings.MySQL.Port,
user: _Fable.settings.MySQL.User,
password: _Fable.settings.MySQL.Password,
database: _Fable.settings.MySQL.Database,
namedPlaceholders: true
}
);
// Create a new meadow DAL object for the "Customers" data set
var meadow = require('meadow').new(fable, 'Customers')
.setProvider('MySQL')
.setDefaultIdentifier('customerID');
// Construct a query, filtering to a specific customer, number 17
var queryDescription = meadow.query.addFilter('customerID', 17);
// Now pass the read query into the customer DAL, with a callback
meadow.doRead(queryDescription,
function(error, query, customer)
{
// The customer parameter will contain a javascript object if there is:
// 1) a record with customerID = 17
// 2) in the customers table
// 3) in the sales_data database
if (error)
{
return console.log('Error querying customer data: '+error);
}
console.log('Found customer ID '+customer.customerID+' who is named '+customer.name);
}
);
// These settings are read automatically from the fable.settings object by meadow
var fable = require('fable').new();
// Create the IndexdDB database [example], attach and use it
var libALASQL = require('alasql');
libALASQL('CREATE INDEXEDDB DATABASE IF NOT EXISTS example;');
libALASQL('ATTACH INDEXEDDB DATABASE example;');
libALASQL('USE example;');
fable.ALASQL = libALASQL;
// Create a new meadow DAL object for the "Customers" data set
var meadow = require('meadow').new(fable, 'Customers')
.setProvider('ALASQL')
.setDefaultIdentifier('customerID');
// Construct a query, filtering to a specific customer, number 17
var queryDescription = meadow.query.addFilter('customerID', 17);
// Now pass the read query into the customer DAL, with a callback
meadow.doRead(queryDescription,
function(error, query, customer)
{
// The customer parameter will contain a javascript object if there is:
// 1) a record with customerID = 17
// 2) in the customers table
// 3) in the sales_data database
if (error)
{
return console.log('Error querying customer data: '+error);
}
console.log('Found customer ID '+customer.customerID+' who is named '+customer.name);
}
);
docker build ./ -t retold/meadow:local
docker run -it --name meadow-dev -p 127.0.0.1:12342:8080 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/meadow" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" retold/meadow:local
Go to http://localhost:12342/ in a web browser
The password is "retold"
Right now you (may) need to delete the node_modules
folders and regenerate it for Linux.
FAQs
A data access library.
The npm package meadow receives a total of 150 weekly downloads. As such, meadow popularity was classified as not popular.
We found that meadow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.