Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

studionone/aws-sdk-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS JavaScript SDK wrapper

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.

DynamoDB wrapper

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().

Example

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)

Cognito wrapper

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.

Contents:

Documentation is generated by jsdoc. It can be updated by running npm run doc.

About

A wrapper for useful parts of the AWS JavaScript SDK

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •