Socket
Socket
Sign inDemoInstall

machinepack-redis

Package Overview
Dependencies
14
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 2.0.0

test/.eslintrc

36

machines/authenticate.js
module.exports = {
//
//
friendlyName: 'Authenticate',
//
//
description: 'Authenticate an active connection with its connected Redis server.',

@@ -11,6 +11,6 @@

sideEffects: 'idempotent',
//
//
//
//
inputs: {
//
//
connection: {

@@ -23,3 +23,3 @@ friendlyName: 'Connection',

},
//
//
password: {

@@ -32,3 +32,3 @@ friendlyName: 'Password',

},
//
//
meta: {

@@ -40,8 +40,8 @@ friendlyName: 'Meta (custom)',

}
//
//
},
//
//
//
//
exits: {
//
//
success: {

@@ -55,3 +55,3 @@ description: 'The authentication process succeeded.',

},
//
//
failed: {

@@ -66,5 +66,5 @@ description: 'The attempt to authenticate failed.',

},
//
//
badConnection: require('../constants/badConnection.exit')
//
//
},

@@ -84,3 +84,3 @@

redisClient.auth(inputs.password, function (err){
redisClient.auth(inputs.password, (err)=>{
if (err) {

@@ -93,3 +93,3 @@ if (err.message === '') {

return exits.success();
});
});//_∏_

@@ -96,0 +96,0 @@ }

@@ -5,7 +5,7 @@ module.exports = {

friendlyName: 'Cache value',
//
//
//
//
description: 'Cache a value using the specified key.',
//
//
//
//
extendedDescription: 'If a `ttl` ("time-to-live") timeout is specified, the key will be deleted automatically after the specified number of seconds.',

@@ -15,6 +15,6 @@

sideEffects: 'idempotent',
//
//
//
//
inputs: {
//
//
connection: {

@@ -27,3 +27,3 @@ friendlyName: 'Connection',

},
//
//
key: {

@@ -36,3 +36,3 @@ friendlyName: 'Key',

},
//
//
value: {

@@ -45,3 +45,3 @@ friendlyName: 'Value',

},
//
//
ttl: {

@@ -53,3 +53,3 @@ friendlyName: 'Time-to-live (TTL)',

},
//
//
meta: {

@@ -61,8 +61,8 @@ friendlyName: 'Meta (custom)',

}
//
//
},
//
//
//
//
exits: {
//
//
success: {

@@ -76,8 +76,8 @@ description: 'Value was sucessfully written.',

},
//
//
badConnection: require('../constants/badConnection.exit')
//
//
},
//
//
//
//
fn: function (inputs, exits){

@@ -116,3 +116,3 @@ var _ = require('@sailshq/lodash');

}
})(function afterSetOrSetEx(err){
})((err)=>{
if (err) {

@@ -119,0 +119,0 @@ return exits.error(err);

@@ -5,12 +5,12 @@ module.exports = {

friendlyName: 'Create connection URL',
//
//
//
//
sync: true,
//
//
//
//
description: 'Build a Redis connection URL out of a dictionary of connection options.',
//
//
//
//
inputs: {
//
//
host: {

@@ -21,3 +21,3 @@ description: 'The host (IP or domain) on which the Redis server is running.',

},
//
//
port: {

@@ -28,3 +28,3 @@ description: 'The port on which the Redis server is running.',

},
//
//
pass: {

@@ -34,3 +34,3 @@ description: 'The password (if any) for the Redis server.',

},
//
//
db: {

@@ -40,8 +40,8 @@ description: 'The index of the database to connect to.',

}
//
//
},
//
//
//
//
exits: {
//
//
success: {

@@ -52,6 +52,6 @@ outputFriendlyName: 'Redis URL',

},
//
//
},
//
//
//
//
fn: function (inputs, exits){

@@ -58,0 +58,0 @@

@@ -5,7 +5,7 @@ module.exports = {

friendlyName: 'Create manager',
//
//
//
//
description: 'Build and initialize a connection manager instance for this Redis database.',
//
//
//
//
extendedDescription:

@@ -20,8 +20,8 @@ 'The `manager` instance returned by this method contains any configuration that is necessary ' +

'(e.g. a PoolCluster from felixge\'s `mysql` package).',
//
//
moreInfoUrl: 'https://github.com/NodeRedis/node_redis#rediscreateclient',
//
//
//
//
inputs: {
//
//
connectionString: {

@@ -32,3 +32,3 @@ description: 'A string containing all metadata and credentials necessary for connecting to the Redis database.',

},
//
//
onUnexpectedFailure: {

@@ -48,3 +48,3 @@ description: 'A function to call any time an unexpected error event is received from this manager or any of its connections.',

},
//
//
meta: {

@@ -57,8 +57,8 @@ friendlyName: 'Meta (custom)',

}
//
//
},
//
//
//
//
exits: {
//
//
success: {

@@ -79,3 +79,3 @@ description: 'The manager was successfully created.',

},
//
//
malformed: {

@@ -90,3 +90,3 @@ description: 'The provided connection string is not valid for MySQL.',

},
//
//
failed: {

@@ -116,6 +116,6 @@ description: 'Could not create a connection manager for this database using the specified connection string.',

}
//
//
},
//
//
//
//
fn: function (inputs, exits){

@@ -122,0 +122,0 @@ var Url = require('url');

@@ -5,4 +5,4 @@ module.exports = {

friendlyName: 'Destroy cached values',
//
//
//
//
description: 'Destroy the values stored under the specified keys.',

@@ -12,6 +12,6 @@

sideEffects: 'idempotent',
//
//
//
//
inputs: {
//
//
connection: {

@@ -24,3 +24,3 @@ friendlyName: 'Connection',

},
//
//
keys: {

@@ -35,3 +35,3 @@ friendlyName: 'Keys',

},
//
//
meta: {

@@ -43,8 +43,8 @@ friendlyName: 'Meta (custom)',

}
//
//
},
//
//
//
//
exits: {
//
//
success: {

@@ -58,3 +58,3 @@ description: 'The specified array of keys were deleted.',

},
//
//
invalidKeys: {

@@ -69,3 +69,3 @@ description: 'The specified array of keys contains one or more keys which are not valid for this cache.',

},
//
//
failed: {

@@ -80,8 +80,8 @@ description: 'The cache encountered an error while attempting to destroy one or more of the specified keys.',

},
//
//
badConnection: require('../constants/badConnection.exit')
//
//
},
//
//
//
//
fn: function (inputs, exits){

@@ -102,3 +102,3 @@ var _ = require('@sailshq/lodash');

redisClient.del(inputs.keys, function (err){
redisClient.del(inputs.keys, (err) => {
if (err) {

@@ -105,0 +105,0 @@ return exits.failed({error: new Error('There was an error deleting the keys passed. Details: ' + err.stack)});

@@ -5,4 +5,4 @@ module.exports = {

friendlyName: 'Destroy manager',
//
//
//
//
description: 'Destroy the specified connection manager and destroy all of its active connections.',

@@ -12,6 +12,6 @@

sideEffects: 'idempotent',
//
//
//
//
inputs: {
//
//
manager: {

@@ -24,3 +24,3 @@ friendlyName: 'Manager',

},
//
//
meta: {

@@ -32,8 +32,8 @@ friendlyName: 'Meta (custom)',

}
//
//
},
//
//
//
//
exits: {
//
//
success: {

@@ -47,3 +47,3 @@ description: 'The specified manager and all of its active connections were successfully destroyed.',

},
//
//
failed: {

@@ -63,6 +63,6 @@ friendlyName: 'Failed',

}
//
//
},
//
//
//
//
fn: function (inputs, exits){

@@ -77,7 +77,7 @@ var Pack = require('../');

// Now call releaseConnection() on each redis client under management.
async.each(_redisClients, function _eachRedisClient (redisClient, next){
async.each(_redisClients, (redisClient, next) => {
Pack.releaseConnection({
connection: redisClient
}).exec(next);
}, function afterwards (err){
}, (err) => {
if (err) {

@@ -84,0 +84,0 @@ return exits.failed({

@@ -5,12 +5,12 @@ module.exports = {

friendlyName: 'Get cached value',
//
//
//
//
description: 'Look up the cached value associated with the specified key.',
//
//
//
//
sideEffects: 'cacheable',
//
//
//
//
inputs: {
//
//
connection: {

@@ -23,3 +23,3 @@ friendlyName: 'Connection',

},
//
//
key: {

@@ -32,3 +32,3 @@ friendlyName: 'Key',

},
//
//
meta: {

@@ -40,8 +40,8 @@ friendlyName: 'Meta (custom)',

}
//
//
},
//
//
//
//
exits: {
//
//
success: {

@@ -56,3 +56,3 @@ description: 'Value was sucessfully fetched.',

},
//
//
notFound: {

@@ -66,5 +66,5 @@ description: 'No value exists under the specified key.',

},
//
//
badConnection: require('../constants/badConnection.exit')
//
//
},

@@ -85,3 +85,3 @@

redisClient.get(inputs.key, function (err, foundValue){
redisClient.get(inputs.key, (err, foundValue) => {
if (err) {

@@ -88,0 +88,0 @@ return exits.error(err);

@@ -5,9 +5,9 @@ module.exports = {

friendlyName: 'Get connection',
//
//
//
//
description: 'Get an active connection to Redis.',
//
//
//
//
inputs: {
//
//
manager: {

@@ -32,3 +32,3 @@ friendlyName: 'Manager',

},
//
//
meta: {

@@ -40,8 +40,8 @@ friendlyName: 'Meta (custom)',

}
//
//
},
//
//
//
//
exits: {
//
//
success: {

@@ -63,3 +63,3 @@ description: 'A connection was successfully acquired.',

},
//
//
failed: {

@@ -86,6 +86,6 @@ description: 'Could not acquire a connection to the database using the specified manager.',

}
//
//
},
//
//
//
//
fn: function (inputs, exits){

@@ -138,3 +138,3 @@ var _ = require('@sailshq/lodash');

// Swallow follow-on errors.
client.on('error', function(){});
client.on('error', () => {});
return exits.failed({

@@ -150,3 +150,3 @@ error: flaverr('ERR_BAD_PASSWORD', new Error('The password supplied to the Redis server was incorrect.'))

// Swallow follow-on errors.
client.on('error', function(){});
client.on('error', () => {});
return exits.failed({

@@ -172,3 +172,3 @@ error: flaverr('ERR_NO_PASSWORD', new Error('The Redis server requires a password, but none was supplied.'))

// Add a timeout for the initial Redis session connection.
redisConnectionTimeout = setTimeout(function() {
redisConnectionTimeout = setTimeout(() => {
return exits.error(flaverr('E_REDIS_CONNECTION_TIMED_OUT', new Error('Took too long to connect to the specified Redis session server.\nYou can change the allowed connection time by setting the `timeout` input (currently ' + inputs.timeout + 'ms).')));

@@ -188,3 +188,3 @@ }, inputs.timeout);

// Bind a "ready" listener so that we know when the client has connected.
client.once('ready', function onConnectionReady (){
client.once('ready', () => {
clearTimeout(redisConnectionTimeout);

@@ -198,3 +198,3 @@ client.removeListener('end', onPreConnectionEnd);

// See https://github.com/mikermcneil/waterline-query-builder/blob/master/docs/errors.md#when-a-connection-is-interrupted
client.on('error', function onIntraConnectionError (err){
client.on('error', (err) => {
// If manager was not provisioned with an `onUnexpectedFailure`,

@@ -228,3 +228,3 @@ // we'll just handle this error event silently (to prevent crashing).

client.on('end', function onIntraConnectionEnd () {
client.on('end', () => {
// If manager was not provisioned with an `onUnexpectedFailure`,

@@ -231,0 +231,0 @@ // we'll just handle this error event silently (to prevent crashing).

{
"name": "machinepack-redis",
"version": "1.3.0",
"version": "2.0.0",
"description": "Structured Node.js bindings for Redis.",
"scripts": {
"test": "node ./node_modules/mocha/bin/mocha tests/*.js --timeout 5000 --slow 2000",
"coverage": "node ./node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha tests/*.js",
"test": "node ./node_modules/mocha/bin/mocha test/*.js --timeout 5000 --slow 2000",
"posttest": "npm run lint",

@@ -31,12 +30,13 @@ "lint": "node ./node_modules/eslint/bin/eslint machines index.js"

"async": "2.0.1",
"flaverr": "^1.1.1",
"machine": "^13.0.0-11",
"redis": "2.6.3"
"flaverr": "^1.9.2",
"machine": "^15.2.2",
"redis": "2.8.0"
},
"devDependencies": {
"eslint": "2.11.1",
"istanbul": "0.4.5",
"mocha": "3.0.2",
"test-machinepack-mocha": "^0.2.2"
"eslint": "4.11.0",
"mocha": "3.0.2"
},
"engines": {
"node": "^6.0"
},
"machinepack": {

@@ -43,0 +43,0 @@ "friendlyName": "Redis",

@@ -249,3 +249,3 @@

## About   [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/node-machine/general?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## About   [![Gitter](https://badges.gitter.im/JoinChat.svg)](https://gitter.im/node-machine/general?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

@@ -252,0 +252,0 @@ This is a [machinepack](http://node-machine.org/machinepacks), an NPM module which exposes a set of related Node.js [machines](http://node-machine.org/spec/machine) according to the [machinepack specification](http://node-machine.org/spec/machinepack).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc