Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@dazn/lambda-powertools-dynamodb-client

Package Overview
Dependencies
Maintainers
6
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dazn/lambda-powertools-dynamodb-client

Lambda client wrapper that knows how to forward correlation IDs (captured via @dazn/lambda-powertools-correlation-ids)

latest
npmnpm
Version
1.28.1
Version published
Weekly downloads
389
6.58%
Maintainers
6
Weekly downloads
 
Created
Source

lambda-powertools-dynamodb-client

DynamoDB client wrapper that knows how to forward correlation IDs (captured via @dazn/lambda-powertools-correlation-ids).

Main features:

  • auto-injects correlation IDs into the DynamoDB item(s) so they are available in the DynamoDB Stream

  • direct replacement for AWS.DynamoDB.Document client

Getting Started

Install from NPM: npm install @dazn/lambda-powertools-dynamodb-client

API

It's exactly the same as the DynamoDB Document client from the AWS SDK.

const DynamoDB = require('@dazn/lambda-powertools-dynamodb-client')

await DynamoDB.put({
  TableName: 'table-name',
  Item: {
    Id: 'theburningmonk'
  }
}).promise()

await DynamoDB.update({
  TableName: 'table-name',
  Key: { Id: 'theburningmonk' },
  UpdateExpression: 'SET #url = :url',
  ExpressionAttributeNames: {
    '#url': 'url'
  },
  ExpressionAttributeValues: {
    ':url': 'https://theburningmonk.com'
  }
}).promise()

await DynamoDB.batchWrite({
  RequestItems: {
    ['table-name']: [
      {
        DeleteRequest: {
          Key: { Id: 'theburningmonk' }
        }
      },
      {
        PutRequest: {
          Item: {
            Id: 'theburningmonk'
          }
        }
      }
    ]
  }
}).promise()

await DynamoDB.transactWrite({
  TransactItems: [
    {
      Put: {
        TableName: 'table-name',
        Item: {
          Id: 'theburningmonk'
        }
      }
    },
    {
      Update: {
        TableName: tableName,
        Key: { Id: 'theburningmonk' },
        UpdateExpression: 'SET #url = :url',
        ExpressionAttributeNames: {
          '#url': 'url'
        },
        ExpressionAttributeValues: {
          ':url': 'https://theburningmonk.com'
        }
      }
    }
  ]
}).promise()

FAQs

Package last updated on 10 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts