
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
modli-redis
Advanced tools
This module provides adapter for the Redis datasource for integration with Modli.
npm install modli-redis --save
import { model, adapter, Joi, use } from 'modli';
import redis from 'modli-redis';
model.add({
name: 'foo',
version: 1,
schema: {
id: Joi.number().integer(),
fname: Joi.string().min(3).max(30),
lname: Joi.string().min(3).max(30),
email: Joi.string().email().min(3).max(254).required()
}
});
Then add the adapter as per usual with the following config object structure:
adapter.add({
name: 'redisFoo',
source: redis
config: {
host: {HOST_IP},
port: {HOST_PORT},
password: {PASSWORD},
opts: {OPTIONAL_PARAMS}
}
});
You can then use the adapter with a model via:
// Use(MODEL, ADAPTER)
const redisTest = use('foo', 'redisFoo');
The following methods exist natively on the Redis adapter:
execute
Allows for executing methods directly on the client:
redisTest.execute('set', 'key-name', { /*...record...*/ })
.then(/*...*/)
.catch(/*...*/);
create
Creates a new record based on object passed:
redisTest.create('some-key', {
fname: 'John',
lname: 'Smith',
email: 'jsmith@gmail.com'
}, [version])
.then(/*...*/)
.catch(/*...*/);
read
Returns records matching a key:
redisTest.read('some-key', [version])
.then(/*...*/)
.catch(/*...*/);
update
Updates record(s) based on key and body:
redisTest.update('some-key', {
fname: 'Bob',
email: 'bsmith@gmail.com'
}, [version])
.then(/*...*/)
.catch(/*...*/);
Note: will create a new record if no existing record present
delete
Deletes record based on key:
redisTest.delete('some-key')
.then(/*...*/)
.catch(/*...*/);
publish
Publishes data to a channel:
redisTest.publish('fooChannel', {
fname: 'John',
lname: 'Smith',
email: 'jsmith@gmail.com'
}, [version])
.then(/*...*/)
.catch(/*...*/);
subscribe
Subscribes to a channel:
redisTest.subscribe('fooChannel', (data) => {
return data;
}, [version]);
extend
Extends the adapter to allow for custom methods:
redisTest.extend('myMethod', () => {
/*...*/
});
The Redis adapter requires the following environment variables to be set for running the tests. These should be associated with the Redis instance running locally.
MODLI_REDIS_HOST,
MODLI_REDIS_PORT,
MODLI_REDIS_PASSWORD
This repository includes a base container config for running locally which is located in the /docker directory.
A Makefile
is included for managing build and install tasks. The commands are
then referenced in the package.json
scripts
if that is the preferred
task method:
all
(default) will run all build tasksstart
will run the main scriptclean
will remove the /node_modules
directoriesbuild
will transpile ES2015 code in /src
to /build
test
will run all spec files in /test/src
test-cover
will run code coverage on all testslint
will lint all files in /src
Running make test
will run the full test suite. Since adapters require a data
source if one is not configured the tests will fail. To counter this tests are
able to be broken up.
Test Inidividual File
An individual spec can be run by specifying the FILE
. This is convenient when
working on an individual adapter.
make test FILE=some.spec.js
The FILE
is relative to the test/src/
directory.
Deploys
For deploying releases, the deploy TAG={VERSION}
can be used where VERSION
can be:
<newversion> | major | minor | patch | premajor
Both make {COMMAND}
and npm run {COMMAND}
work for any of the above commands.
Modli-Redis is licensed under the MIT license. Please see LICENSE.txt
for full details.
Modli-Redis was designed and created at TechnologyAdvice.
FAQs
Modli adapter for Redis
We found that modli-redis 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.