dynamoose
Advanced tools
Comparing version 1.0.0 to 1.0.1
# Dynamoose ChangeLog | ||
## Version 1.0.1 | ||
Dynamoose version 1.0.1 comes with some minor bug fixes to solve problems with Dynamoose version 1.0.0. We are actively monitoring the [GitHub Issues](https://github.com/dynamoosejs/dynamoose/issues) and will continue to work to provide bug fixes as fast as possible. Please create a [GitHub Issue](https://github.com/dynamoosejs/dynamoose/issues) or [contact me](https://charlie.fish/contact) if you are having problems and we will work to address it as fast as possible. | ||
### Bug Fixes | ||
- **[Fix saveUnknown throwing errors when value where falsy](https://github.com/automategreen/dynamoose/pull/442)** #442 | ||
### Documentation | ||
- **[Fix model update add documentation](https://github.com/automategreen/dynamoose/pull/438)** #438 | ||
--- | ||
## Version 1.0.0 | ||
@@ -4,0 +18,0 @@ |
@@ -356,3 +356,3 @@ --- | ||
Adds one or more attributes to the item. | ||
Adds one or more attributes to the item. These attributes must be of the number or set type. If the attribute already exists it will be manipulated instead. If it's a number the provided value will be added mathematically to the existing value. If the attribute is a set the provided value is appended to the set. | ||
@@ -362,3 +362,3 @@ ```js | ||
if(err) { return console.log(err); } | ||
console.log('Birthday boy'); | ||
console.log('Birthday boy is one year older'); | ||
}) | ||
@@ -365,0 +365,0 @@ ``` |
@@ -91,6 +91,6 @@ 'use strict'; | ||
if(schema.hashKey.name !== this.query.hashKey.name || (this.query.rangeKey && schema.rangeKey && schema.rangeKey.name !== this.query.rangeKey.name)) { | ||
debug('query is on global secondary index'); | ||
for(indexName in schema.indexes.global) { | ||
index = schema.indexes.global[indexName]; | ||
if(index.name === this.query.hashKey.name && (!this.query.rangeKey || index.indexes[indexName].rangeKey === this.query.rangeKey.name)) { | ||
debug('query is on global secondary index'); | ||
debug('using index', indexName); | ||
@@ -120,3 +120,3 @@ queryReq.IndexName = indexName; | ||
index = schema.indexes.local[indexName]; | ||
if(index.name === rangeKey.name && index.indexes[indexName].rangeKey === this.query.rangeKey.name) { | ||
if(index.name === rangeKey.name) { | ||
debug('using local index', indexName); | ||
@@ -140,3 +140,3 @@ queryReq.IndexName = indexName; | ||
keyConditions.AttributeValueList.push( | ||
rangeAttr.toDynamo(val, true) | ||
rangeAttr.toDynamo(val, true, Model, { updateTimestamps: false }) | ||
); | ||
@@ -143,0 +143,0 @@ } |
{ | ||
"name": "dynamoose", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Dynamoose is a modeling tool for Amazon's DynamoDB (inspired by Mongoose)", | ||
@@ -5,0 +5,0 @@ "typings": "./dynamoose.d.ts", |
@@ -53,2 +53,6 @@ 'use strict'; | ||
}, | ||
origin: { | ||
type: String, | ||
index: true // name: originLocalIndex, ProjectionType: ALL | ||
}, | ||
name: { | ||
@@ -116,6 +120,6 @@ type: String, | ||
{ownerId:19, name: 'Snoopy', breed: 'beagle', color: 'black and white', age: 6}, | ||
{ownerId:20, name: 'Max', breed: 'Westie', age: 7}, | ||
{ownerId:20, name: 'Gigi', breed: 'Spaniel', color: 'Chocolate', age: 1}, | ||
{ownerId:20, name: 'Mimo', breed: 'Boxer', color: 'Chocolate', age: 2}, | ||
{ownerId:20, name: 'Bepo', breed: 'French Bulldog', color: 'Grey', age: 4}, | ||
{ownerId:20, name: 'Max', breed: 'Westie', age: 7, origin: 'Scotland'}, | ||
{ownerId:20, name: 'Gigi', breed: 'Spaniel', color: 'Chocolate', age: 1, origin: 'Great Britain'}, | ||
{ownerId:20, name: 'Mimo', breed: 'Boxer', color: 'Chocolate', age: 2, origin: 'Germany'}, | ||
{ownerId:20, name: 'Bepo', breed: 'French Bulldog', color: 'Grey', age: 4, origin: 'France'}, | ||
]); | ||
@@ -214,6 +218,6 @@ | ||
it('Query with Local Global Index as range', function (done) { | ||
it('Query with Secondary Local Index as range', function (done) { | ||
var Dog = dynamoose.model('Dog'); | ||
Dog.query('ownerId').eq(2).where('color').beginsWith('White').exec(function (err, dogs) { | ||
Dog.query('ownerId').eq(20).where('origin').beginsWith('G').exec(function (err, dogs) { | ||
should.not.exist(err); | ||
@@ -680,3 +684,3 @@ dogs.length.should.eql(2); | ||
it('Should allow multiple local indexes and query correctly', function (done) { | ||
it('Should allow multiple local indexes and query correctly', async function () { | ||
var schema = new dynamoose.Schema({ | ||
@@ -686,20 +690,21 @@ id: { | ||
hashKey: true, | ||
required: true | ||
}, | ||
orgId: { | ||
type: String, | ||
index: [{ | ||
global : false, | ||
name : 'OrganizationCreateAtIndex', | ||
rangeKey : 'createdAt', | ||
throughput: 1 | ||
}, { | ||
global : false, | ||
name : 'OrganizationExpectedArriveAtIndex', | ||
rangeKey : 'expectedArriveAt', | ||
throughput: 1 | ||
}], | ||
required: true, | ||
rangeKey: true, | ||
}, | ||
expectedArriveAt: Date | ||
updatedAt: { | ||
type: Date, | ||
index: { | ||
global: false, | ||
name : 'OrganizationUpdatedAtIndex' | ||
} | ||
}, | ||
expectedArriveAt: { | ||
type: Date, | ||
index: { | ||
global: false, | ||
name : 'OrganizationExpectedArriveAtIndex' | ||
} | ||
} | ||
},{ | ||
@@ -709,27 +714,20 @@ throughput: 1, | ||
}); | ||
var Log = dynamoose.model('Log-1', schema); | ||
var Log = dynamoose.model('Log-2', schema); | ||
var log1 = new Log({id: "test1", orgId: "org1", expectedArriveAt: Date.now()}); | ||
log1.save(function() { | ||
Log.query('orgId').eq("org1") | ||
var log2 = new Log({id: "test1", orgId: "org2", expectedArriveAt: Date.now()}); | ||
await log1.save(); | ||
await log2.save(); | ||
var res = await Log.query('id').eq("test1") | ||
.where('expectedArriveAt').lt( new Date() ) | ||
.exec() | ||
.then(function(res){ | ||
res.length.should.eql(1); | ||
Log.query('orgId').eq("org1") | ||
.where('createdAt').lt( new Date() ) | ||
.exec() | ||
.then(function(res){ | ||
res.length.should.eql(1); | ||
done(); | ||
}) | ||
.catch(function(e){ | ||
done(e); | ||
}); | ||
}) | ||
.catch(function(e){ | ||
done(e); | ||
}); | ||
}); | ||
res.length.should.eql(2); | ||
var res2 = await Log.query('id').eq("test1") | ||
.where('updatedAt').le( log1.createdAt.getTime() ) | ||
.exec(); | ||
res2.length.should.eql(1); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2118091
8
12227