Socket
Socket
Sign inDemoInstall

@brightcove/dynamodb-connector

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brightcove/dynamodb-connector

Provides a set of helpful functions for connecting to DynamoDB and performing operations


Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

DynamoDB Connector

package-info NPM NodeJS Build Status

Provides a standardized way to connect to an AWS DynamoDB database using the v3 AWS javascript SDK.

Install

npm install @brightcove/dynamodb-connector --save

Usage

Version 2.x

const { DynamoDBConnector } = require('@brightcove/dynamodb-connector');

// Localstack configuration example
const db = new DynamoDBConnector({
    clientConfig: {
        endpoint: 'http://localhost:4566,
        region: 'us-east-1'
    }
});
...
const result = await db.query({
    TableName: 'my-table',
    ...
});
Options
ParamTypeDescriptionRequired
clientConfigDynamoDBClientConfighttps://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-dynamodb/TypeAlias/DynamoDBClientConfigTypeyes
translateConfigTranslateConfighttps://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/TypeAlias/TranslateConfigno
loggerLoggerWhat will be used for logging errors (ie. logger.error()). console is used by default if not specifiedno

Version 3.x

This version includes breaking changes by requiring the DynamoDBDocument to be passed in as an option. This drasticaly reduces the size of this package and removes all external dependencies.

import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DynamoDBConnector } from '@brightcove/dynamodb-connector';

const client = new DynamoDBClient({
    endpoint: 'http://localhost:4566',
    region: 'us-east-1'
});
const document = DynamoDBDocument.from(client);

const db = new DynamoDBConnector({ document });
...
const result = await db.query({
    TableName: 'my-table',
    ...
});
Options
ParamTypeDescriptionRequired
documentDynamoDBDocumenthttps://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/Class/DynamoDBDocumentyes
loggerLoggerWhat will be used for logging errors (ie. logger.error()). console is used by default if not specifiedno

FAQs

Package last updated on 30 Jul 2024

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