New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dynamo-butter

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamo-butter

A dynamo client enhancer

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dynamo-butter

If you are going to use the AWS "Thick" Client, you might as well add butter

dynamo-butter is inspired by the AWS Dynamo Thin Client. It uses util.promsify of the client methods, adds the same Quality-of-Life methods (e.g. batchGetAll), and sets up the keep-alive agent by default.

Since AWS Lambda provides aws-sdk by default, this library does not declare a dependency on it. However, it is required. If you need to run unit tests, make sure to add aws-sdk to your own devDepdendencies.

Installation

npm i dynamo-butter

Quick Start

const Butter = require('dynamo-butter')
const client = Butter.up({ region: 'us-west-2' })
const data = await client.scanAll({ TableName: 'some-table' })

API

dynamo-butter exports one method: up(). Which can be used in two different modes. The first parameter depends on the mode, while the second parameter provides config options to dynamo-butter.

Configuration-Passthrough Mode

Uses the recommended defaults, with a configuration object that is passed to the DynamoDB DocumentClient constructor.

const Butter = require('dynamo-butter')
const client = Butter.up({
  region: 'us-west-2',
  endpoint: IS_TESTING && TEST_SERVER_ENDPOINT,
  convertEmptyValues: true // optional, defaults to true
})

Client-Wrap Mode

If you want to configure the DynamoDB DocumentClient yourself, you can pass it to butter instead of a config object.

const Butter = require('dynamo-butter')
const Dynamo = require('aws-sdk/clients/dynamodb')
const dynamo = new Dynamo.DocumentClient({
  convertEmptyValues,
  service: new Dynamo({
    region,
    endpoint
  })
})
const client = Butter.up(dynamo)
Config Options

The second parameter to Butter.up() is an options object for butter. It is optional, and each property is optional and defaults to true.

  • includeAutoPagingMethods: set to false to not add batchWriteAll batchGetAll queryAll and scanAll to the client.
  • useKeepAlive: set to false to disable keepAlive on the configured agent.
const client = Butter.up({
  region: 'us-west-2',
  endpoint: IS_TESTING && TEST_SERVER_ENDPOINT,
  convertEmptyValues: true // optional, defaults to true
}, {
  includeAutoPagingMethods: true,
  useKeepAlive: true
}

FAQs

Package last updated on 07 Oct 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc