kayomarz / dynamodb-data-types Goto Github PK
View Code? Open in Web Editor NEWA convenience utility for Amazon DynamoDB Data Types.
License: MIT License
A convenience utility for Amazon DynamoDB Data Types.
License: MIT License
I need something like this, but I'm just using browser JS, not node.
Walk around :
var objt = { "M": wrapped}; console.log(objt);
var objt = { "L": wrapped}; console.log(objt);
when using remove('TTL') or remove('year') the update expression doesn't handle it.
UpdateExpression =============> "SET test = :a, age = :b REMOVE year"
AWS Exception
ValidationException: Invalid UpdateExpression: Attribute name is a reserved keyword; reserved keyword: year
API limitation
Prior to trying out updateExpr(), I have a working set of UpdateItemCommand parameters that includes:
{
TableName: 'MyTable',
Key: { PK: { S: 'VDR123' }, SK: { S: 'VEHTESTER165' } },
UpdateExpression: 'ADD #data.deliveryIds :deliveryIds',
ExpressionAttributeValues: { ':deliveryIds': { SS: [Array] } },
ExpressionAttributeNames: { '#data': 'data' },
ReturnValues: 'UPDATED_NEW'
}
Note the nested attribute 'deliveryIds' in the data element, and that 'data' is a dynamoDB reserved word.
I expected that updateExpr() yield similar UpdateExpression, ExpressionAttributeValues and ExpressionAttributeNames:
const updates = updateExpr()
.add({'data.deliveryIds': [deliveryId]});
const { UpdateExpression, ExpressionAttributeValues, ExpressionAttributeNames } = updates.expr();
However, this is the result:
UpdateExpression ADD data.deliveryIds :a
ExpressionAttributeValues { ':a': { SS: [ 'DEL#31415' ] } }
ExpressionAttributeNames undefined
Note that 'data' is not aliased and when used with the UpdateItemCommand, fails.
Am I using updateExpr() incorrectly? or does it not currently support nested with reserved words?
Thanks!
Thanks for nice work.
I have question that is this module safe to use in production?
As I can see you not maintaing it from last year.
Please Update.
Is it possible to add functionality for ignored fields ?
{
id: 'abc',
$ignoredField: 'abc'
}
So at the end only "id" key will be converted.
Any chance of building a version for the browser that does not include support for Buffer?
I understand that the dynamoDB does not allow empty strings or arrays of zero length. Perhaps this lib could remove elements that are empty/null/zero length.
The reason that I'm asking is that I'm using typescript, one of the the beauties of which is interfaces. So my interface requires an attribute even if empty. So currently I have to either not use an interface, not use this lib, or roll up my sleeves and pitch in:)
..although, there would be no way to unwrap into an object that conformed to the interface so the user would have to know that. I found the following stackoverflow discussion and I'm just using a recursive clean function to remove them for now and it's working great.
You can create an object like this but you can't increment it using add(). it throws "ValidationException: Invalid UpdateExpression: Syntax error; token: "-", near: "MarketplaceFacilitatorTax-Principal""
{
"srTas.MarketplaceFacilitatorTax-Principal": -7.4
}
I'm guessing more people would use this if there were typescript types either in the project or generated in @types-
it looks like node/4.1.1 deprecated a lot of the util functions because they no longer work and dynamodb-data-types is using these util functions. so the data mapping are not correct anymore.
is someone working on this yet?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.