Nonflavored Prescription Medicine

    @dazn/lambda-powertools-dynamodb-client
    TypeScript icon, indicating that this package has built-in type declarations

    1.28.1 • Public • Published

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

    Keywords

    none

    Install

    npm i @dazn/lambda-powertools-dynamodb-client

    DownloadsWeekly Downloads

    2,144

    Version

    1.28.1

    License

    MIT

    Unpacked Size

    29.8 kB

    Total Files

    7

    Last publish

    Collaborators

    • criveindazn
    • mrwolny
    • afalzetti
    • rick-burgess-dazn
    • cirpo
    • dazn.builder.frontend
    • automation-drone
    • m.bazalik
    • dazn.oss.lambda.powertools
    • dazn.oss