Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dynamoose

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamoose - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

15

lib/Model.js

@@ -89,5 +89,2 @@ 'use strict';

options = options || {};
if(options.overwrite === null || options.overwrite === undefined) {
options.overwrite = true;
}
if(typeof options === 'function') {

@@ -102,9 +99,2 @@ next = options;

};
if(options.overwrite) {
item.Expected = {};
item.Expected[schema.hashKey.name] = {Exists: false};
if(schema.rangeKey) {
item.Expected[schema.rangeKey.name] = {Exists: false};
}
}

@@ -142,5 +132,2 @@ debug('putItem', item);

options = options || {};
if(options.overwrite === null || options.overwrite === undefined) {
options.overwrite = false;
}

@@ -249,3 +236,3 @@ if(typeof options === 'function') {

Model.update = function(NewModel, key, update, options, next) {
debug('Get %j', key);
debug('Update %j', key);
var deferred = Q.defer();

@@ -252,0 +239,0 @@ if(key === null || key === undefined) {

2

lib/Query.js

@@ -217,3 +217,3 @@ 'use strict';

if (!models || models.length === 0) {
return next();
return deferred.resolve();
}

@@ -220,0 +220,0 @@ return deferred.resolve(models[0]);

@@ -56,2 +56,3 @@ 'use strict';

} else {
table.initialized = true;
return deferred.resolve();

@@ -95,5 +96,8 @@ }

} else {
// TODO verify table keys and index's match
table.active = true;
deferred.resolve();
}
}, function (err) {
return deferred.reject(err);
});

@@ -148,2 +152,6 @@ }

addKeyAttr(schema.indexes.global[globalIndexName]);
// add the range key to the attribute definitions if specified
var rangeKeyName = schema.indexes.global[globalIndexName].indexes[globalIndexName].rangeKey;
addKeyAttr(schema.attributes[rangeKeyName]);
}

@@ -150,0 +158,0 @@ for(var indexName in schema.indexes.local) {

{
"name": "dynamoose",
"version": "0.3.0",
"version": "0.3.1",
"description": "Dynamoose is a modeling tool for Amazon's DynamoDB (inspired by Mongoose)",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/automategreen/dynamoose",

@@ -300,3 +300,3 @@ # Dynamoose [![Build Status](https://travis-ci.org/automategreen/dynamoose.png)](https://travis-ci.org/automategreen/dynamoose)

Puts the item in the DynamoDB table. Will overwrite the item.
Puts the item in the DynamoDB table.

@@ -310,8 +310,3 @@ ```js

##### Options
**overwrite**: boolean
Overwrite existing item. Defaults to true.
#### Model.create(object, options, callback)

@@ -318,0 +313,0 @@

@@ -17,2 +17,3 @@ 'use strict';

describe('Model', function (){
this.timeout(5000);

@@ -19,0 +20,0 @@

@@ -18,2 +18,3 @@ 'use strict';

describe('Query', function (){
this.timeout(5000);

@@ -20,0 +21,0 @@ before(function (done) {

@@ -18,2 +18,3 @@ 'use strict';

describe('Scan', function (){
this.timeout(5000);

@@ -20,0 +21,0 @@ before(function (done) {

@@ -18,2 +18,3 @@ 'use strict';

describe('Schema tests', function (){
this.timeout(5000);

@@ -20,0 +21,0 @@ it('Simple schema', function (done) {

@@ -19,6 +19,40 @@ 'use strict';

describe('Table tests', function (){
this.timeout(5000);
var schema = new Schema({ id: Number, name: String, childern: [Number] });
var globalIndexSchema = new Schema({
ownerId: {
type: Number,
validate: function(v) { return v > 0; },
hashKey: true
},
breed: {
type: String,
rangeKey: true,
index: {
global: true,
rangeKey: 'color',
name: 'BreedGlobalIndex',
project: true, // ProjectionType: ALL
throughput: 5 // read and write are both 5
}
},
name: {
type: String,
required: true,
index: {
global: true,
name: 'NameGlobalIndex',
project: true, // ProjectionType: ALL
throughput: 5 // read and write are both 5
}
},
color: {
type: String,
default: 'Brown'
}
});
var table = new Table('person', schema, null, dynamoose);
var globalIndexTable = new Table('dog', globalIndexSchema, null, dynamoose);

@@ -63,2 +97,18 @@ it('Create simple table', function (done) {

});
it('Create table with global index with non indexed range key', function (done) {
globalIndexTable.create(function(err) {
should.not.exist(err);
done();
});
});
it('Delete table with global index', function (done) {
globalIndexTable.delete(function(err, data) {
should.not.exist(err);
should.exist(data);
done();
});
});
});
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