New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

connect-dynamodb

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-dynamodb - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

LICENSE.txt

5

History.md

@@ -0,1 +1,6 @@

1.0.7 / 2016-01-29
==================
* Add ability to provide a JSON object to configure AWS, specify custom hashKey (https://github.com/ca98am79/connect-dynamodb/pull/26)
1.0.6 / 2014-01-29

@@ -2,0 +7,0 @@ ==================

21

lib/connect-dynamodb.js
/*!
* Connect - DynamoDB
* Copyright(c) 2014 Mike Carson <ca98am79@gmail.com>
* Copyright(c) 2016 Mike Carson <ca98am79@gmail.com>
* MIT Licensed

@@ -43,2 +43,3 @@ */

this.prefix = null == options.prefix ? 'sess:' : options.prefix;
this.hashKey = null == options.hashKey ? 'id' : options.hashKey;

@@ -48,8 +49,10 @@ if (options.client) {

} else {
if (options.AWSConfigPath) {
AWS.config.loadFromPath(options.AWSConfigPath);
} else {
this.AWSRegion = options.AWSRegion || 'us-east-1';
AWS.config.update({region: this.AWSRegion});
}
if (options.AWSConfigPath) {
AWS.config.loadFromPath(options.AWSConfigPath);
} else if (options.AWSConfigJSON) {
AWS.config.update(options.AWSConfigJSON);
} else {
this.AWSRegion = options.AWSRegion || 'us-east-1';
AWS.config.update({region: this.AWSRegion});
}
this.client = new AWS.DynamoDB();

@@ -72,7 +75,7 @@ }

AttributeDefinitions: [{
AttributeName: 'id',
AttributeName: this.hashKey,
AttributeType: 'S'
}],
KeySchema: [{
AttributeName: 'id',
AttributeName: this.hashKey,
KeyType: 'HASH'

@@ -79,0 +82,0 @@ }],

{
"name": "connect-dynamodb",
"description": "DynamoDB session store for Connect",
"version": "1.0.6",
"version": "1.0.7",
"author": "Mike Carson <ca98am79@gmail.com> (http://ca98am79.com)",

@@ -6,0 +6,0 @@ "main": "./index.js",

@@ -5,2 +5,5 @@ # Connect DynamoDB

[![NPM](https://nodei.co/npm/connect-dynamodb.png)](https://nodei.co/npm/connect-dynamodb/)
[![NPM](https://nodei.co/npm-dl/connect-dynamodb.png)](https://nodei.co/npm-dl/connect-dynamodb/)
## Installation

@@ -11,7 +14,10 @@

## Options
- `client` An existing AWS DynamoDB object you normally get from `new AWS.DynamoDB()`
- `AWSConfigPath` Optional path to JSON document containing your [AWS credentials](http://docs.aws.amazon.com/nodejs/latest/dg/configuration-guide.html#nodejs-dg-credentials-from-disk) (defaults to loading credentials from [environment variables](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Environment_Variables))
- `AWSRegion` Optional AWS region (defaults to 'us-east-1')
- `table` Optional DynamoDB server session table name (defaults to "sessions", currently the hash key has to be `id` - see [issue #14](https://github.com/ca98am79/connect-dynamodb/issues/14))
- One of the following:
- `client` An existing AWS DynamoDB object you normally get from `new AWS.DynamoDB()`
- `AWSConfigPath` Path to JSON document containing your [AWS credentials](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Disk) (defaults to loading credentials from [environment variables](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Credentials_from_Environment_Variables)) and any additional [AWS configuration](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html) options
- `AWSConfigJSON` JSON object containing your [AWS configuration](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html) options
- `AWSRegion` Optional AWS region (defaults to 'us-east-1', ignored if using `AWSConfigPath` or `AWSConfigJSON`)
- `table` Optional DynamoDB server session table name (defaults to "sessions")
- `hashKey` Optional hash key (defaults to "id")
- `prefix` Optional key prefix (defaults to "sess")

@@ -26,6 +32,12 @@ - `reapInterval` Optional - how often expired sessions should be cleaned up (defaults to 600000)

table: 'myapp-sessions',
// Optional path to AWS credentials (loads credentials from environment variables by default)
// AWSConfigPath: './path/to/credentials.json',
// Optional JSON object of AWS configuration options
// AWSConfigJSON: {
// region: 'us-east-1',
// correctClockSkew: true
// }
// Optional. How often expired sessions should be cleaned up.

@@ -35,3 +47,3 @@ // Defaults to 600000 (10 minutes).

};
var connect = require('connect'),

@@ -43,10 +55,17 @@ DynamoDBStore = require('connect-dynamodb')(connect);

Or with [express](http://expressjs.com/)
Or with [express](http://expressjs.com/) 3.x.x
DynamoDBStore = require('connect-dynamodb')(express);
var app = express(
express.cookieParser(),
express.cookieParser(),
express.session({ store: new DynamoDBStore(options), secret: 'keyboard cat'})
);
Or with [express](http://expressjs.com/) 4.x.x
var app = express();
var session = require('express-session');
DynamoDBStore = require('connect-dynamodb')({session: session});
app.use(session({ store: new DynamoDBStore(options), secret: 'keyboard cat', resave: true, saveUninitialized: true}));
## Contributors

@@ -63,28 +82,12 @@

* [Bryce Larson](https://github.com/bryce-larson)
* [Etienne Adriaenssen](https://github.com/etiennea)
Thanks!
## LICENSE - "MIT License"
## License
Copyright (c) 2014 Mike Carson, http://ca98am79.com/
connect-dynamodb is licensed under the [MIT license.](https://github.com/ca98am79/connect-dynamodb/blob/master/LICENSE.txt)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
## Donations
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
I made this in my spare time, so if you find it useful you can donate at my BTC address: `13Bzg4reJJt43wU1QsPSCzyFZMLhJbRELA`. Thank you very much!

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc