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

dynalite

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynalite - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

30

actions/query.js

@@ -11,3 +11,3 @@ var once = require('once'),

var i, keySchema, key, comparisonOperator, limit, firstKey
var i, keySchema, key, comparisonOperator, limit, firstKey, indexAttrs

@@ -22,2 +22,4 @@ if (data.ExclusiveStartKey && !Object.keys(data.ExclusiveStartKey).length) {

keySchema = table.LocalSecondaryIndexes[i].KeySchema
if (table.LocalSecondaryIndexes[i].Projection.ProjectionType == 'INCLUDE')
indexAttrs = table.LocalSecondaryIndexes[i].Projection.NonKeyAttributes
break

@@ -45,5 +47,18 @@ }

comparisonOperator = data.KeyConditions[firstKey].ComparisonOperator
if (~['LE', 'LT', 'GE', 'GT', 'BEGINS_WITH', 'BETWEEN'].indexOf(comparisonOperator))
if (~['LE', 'LT', 'GE', 'GT', 'BEGINS_WITH', 'BETWEEN'].indexOf(comparisonOperator) ||
(keySchema.length == 1 && Object.keys(data.KeyConditions).length > 1))
return cb(db.validationError('Query key condition not supported'))
if (indexAttrs) {
keySchema.map(function(schemaPiece) { return schemaPiece.AttributeName }).forEach(function(attr) {
if (!data.KeyConditions[attr])
data.KeyConditions[attr] = {ComparisonOperator: 'NOT_NULL'}
})
if (data.Select != 'ALL_ATTRIBUTES') {
data.AttributesToGet = indexAttrs
.concat(keySchema.map(function(schemaPiece) { return schemaPiece.AttributeName }))
.concat(table.KeySchema.map(function(schemaPiece) { return schemaPiece.AttributeName }))
}
}
data.ScanFilter = data.KeyConditions

@@ -60,2 +75,11 @@ delete data.KeyConditions

if (result.Items) {
if (data.IndexName) {
result.Items.sort(function(item1, item2) {
var type1 = Object.keys(item1[keySchema[1].AttributeName] || {})[0],
val1 = type1 ? item1[keySchema[1].AttributeName][type1] : '',
type2 = Object.keys(item2[keySchema[1].AttributeName] || {})[0],
val2 = type2 ? item2[keySchema[1].AttributeName][type2] : ''
return db.toLexiStr(val1, type1).localeCompare(db.toLexiStr(val2, type2))
})
}
if (data.ScanIndexForward === false) result.Items.reverse()

@@ -70,2 +94,4 @@ if (limit) {

}
if (result.ConsumedCapacity && indexAttrs && data.Select == 'ALL_ATTRIBUTES')
result.ConsumedCapacity.CapacityUnits *= 4
cb(null, result)

@@ -72,0 +98,0 @@ })

@@ -142,2 +142,3 @@ var once = require('once'),

if (data.Limit) result.LastEvaluatedKey = items[items.length - 1]
if (data.ReturnConsumedCapacity == 'TOTAL') result.ConsumedCapacity = {CapacityUnits: 0.5, TableName: data.TableName}
cb(null, result)

@@ -144,0 +145,0 @@ })

@@ -24,2 +24,3 @@ var Readable = require('stream').Readable,

exports.validateItem = validateItem
exports.toLexiStr = toLexiStr
exports.validationError = validationError

@@ -26,0 +27,0 @@ exports.checkConditional = checkConditional

2

package.json
{
"name": "dynalite",
"version": "0.0.20",
"version": "0.0.21",
"description": "A mock implementation of Amazon's DynamoDB built on LevelDB",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -33,5 +33,4 @@ dynalite

* Use efficient range scans for Query calls
* Implement `ReturnConsumedCapacity`/`ConsumedCapacity`/`ReturnItemCollectionMetrics` on all relevant endpoints (nearly done!)
* Check for any missing `ExclusiveStartKey`/`LastEvaluatedKey` functionality (most should be fine)
* Implement any outstanding secondary index behaviour
* Implement `ConsumedCapacity`/`ReturnItemCollectionMetrics` on all remaining endpoints
* Check for any missing `ExclusiveStartKey`/`LastEvaluatedKey` functionality
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