This project is no longer maintained and should be considered deprecated. Please do not use it.
This project contains wrappers for useful parts of the AWS SDK, which makes them easier to use in general projects.
The dynamodb.js
module includes wrappers for useful methods of the class AWS.DynamoDB.DocumentClient
. This allows you to create, read, update, and delete items from a DynamoDB table without having to worry about the complex ExpressionAttribute
syntax the native API requires.
Note that complex queries involving multiple conditions aren't supported and must be constructed using the native AWS SDK API syntax with dynamodb.operation()
.
The following query using the SDK API...
const params = {
TableName: process.env.TABLE_NAME,
IndexName: `name-index`,
KeyConditionExpression: `#name = :name`,
ExpressionAttributeNames: { ['#name']: 'name' },
ExpressionAttributeValues: { [':name']: 'Jon' },
}
AWS.DynamoDB.DocumentClient.query(params, (error, data) => {
if (error) {
console.error(error)
} else {
console.log(data)
}
})
...when using the wrapper becomes:
dynamodb.query(process.env.TABLE_NAME, 'name', 'Jon')
.then(console.log)
The cognito.js
module includes a wrapper for the adminUpdateUserAttributes
, listUsersInGroup
and adminListGroupsForUser
methods of the class AWS.CognitoIdentityServiceProvider
. It also provides a getUser
function that makes use of the listUsers
method.
Documentation is generated by jsdoc. It can be updated by running npm run doc
.