Package Exports
- @kartikrao/sls-dynamodb-client
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@kartikrao/sls-dynamodb-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
sls-dynamodb-client
A module to make dynamodb client creation environment agnostic.
- Use the same DynamoDB client code for local development and on AWS Lambda.
- Pass options to DynamoDB or DocumentClient
- Use a custom endpoint for dynamodb-local
Dependencies
- serverless-offline - Required to detect offline/online status
- serverless-dynamodb-local - Required to run dynamodb locally during development
Installation
npm install --save sls-dynamodb-client
Usage
const ddb = require('sls-dynamodb-client')();
// Get a DocumentClient - AWS.DynamoDB.DocumentClient()
let docClient = ddb.getDocumentClient();
// Get the low level client - AWS.DynamoDB()
let dynamodb = ddb.getClient();
Custom local endpoint
const ddb = require('sls-dynamodb-client')("customregion", "http://customhost:customport/");
// DocumentClient requests will go to "customhost:customport"
let docClient = ddb.getDocumentClient();
// DynamoDB client requests will go to "customhost:customport"
let dynamodb = ddb.getClient();
Passing Options
const ddb = require('sls-dynamodb-client')("customregion", "http://customhost:customport/");
let options = {"convertEmptyValues": true};
let docClient = ddb.getDocumentClient(options);