node-aws-utils
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

node-aws-utils

install dependencies

yarn install
# or
npm install

build

yarn run build
# or
npm run build

Dynamo

get item

import {DynamoDB} from "aws-sdk";
import {DynamoDocumentClient} from "node-aws-utils";

(async () => {
    const tableName = 'store';
    const where = {id: 1};
    const dynamo = new DynamoDB.DocumentClient();
    const storeData = (await DynamoDocumentClient.get(dynamo, tableName, where)).unwrap();
    console.log(storeData);
    // object or null
})();

put or update item

import {DynamoDB} from "aws-sdk";
import {DynamoDocumentClient} from "node-aws-utils";

(async () => {
    const tableName = 'store';
    const where = {id: 1};
    const data = {email: 'user@store.com'};
    const dynamo = new DynamoDB.DocumentClient();
    const updatedData = (await DynamoDocumentClient.update(dynamo, tableName, where, data)).unwrap();
    console.log(updatedData);
    // object or empty object
})();

Readme

Keywords

Package Sidebar

Install

npm i node-aws-utils

Weekly Downloads

0

Version

2.1.0

License

MIT

Unpacked Size

9.12 kB

Total Files

5

Last publish

Collaborators

  • watchdg