mhart/dynalite — pull request #12 by rclark (2014-09-06 01:44:30+00:00)
Title: Support new conditionals and error messages

Hi! I'm trying to address some of the issues in #6. Specifically, trying to build support for the new-style conditional requests.

You already had the [matchesFilter function](https://github.com/mhart/dynalite/blob/master/db/index.js#L375) that dealt with almost all the needed logic. I tweaked it a little bit such that it can support [a top-level ConditionalOperator](http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html#DDB-PutItem-request-ConditionalOperator).

Supporting these conditionals also meant adjustments to validation, and the details of some error messages seems to have changed a bit.

In the tests I replicated all your old `Exists`/`Value` tests with analogous test using `ComparisonOperator`/`AttributeValueList`. I also specifically checked pass/fail conditions for the [available ComparisonOperators](http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html#DDB-PutItem-request-Expected).

Hope this helps! This is a great library to work with!