@lifeomic/aws-sdk-helpers
TypeScript icon, indicating that this package has built-in type declarations

3.3.0 • Public • Published

aws-sdk-helpers

DynamoDB

Converter

Methods are provided to handle un/marshal calls to DynamoDB.Converter.marshal/unmarshal.
These convenience methods are meant to handle instances where the item isn't provided, thus avoiding extra tests to get code coverage.

import { dynamodb } from 'aws-sdk-helpers';
const { marshalItem, unmarshalItem } = dynamodb;

Lambda Stream Event

These methods provide easy mocking of DyanmoDB Stream records.

createStreamRecord

Provides some defaults, and properly structures the Records[].dynamodb object.

createCustomStreamRecord

Provides some defaults and properly structures the Records[] entry.

createCustomStreamRecord

A convenience method that converts Keys, OldImage, and NewImage and returns a DynamoDB Stream Record.

import { dynamodb } from 'aws-sdk-helpers';
const { stream: { createCustomStreamRecord, createDynamoDBRecord } } = dynamodb;

const dynamodbRecords = originalData.map(([Keys, OldImage, NewImage]) => createCustomStreamRecord({
  Keys,
  OldImage,
  NewImage,
}));

const Records = dynamodbRecords.map(dynamodb => createDynamoDBRecord({dynamodb}));
const event = { Records };
await lambda.invoke(event, context);

Releasing

This project uses semantic release. To trigger a release, merge a PR to master that includes commits prefixed with the relevant strings. For more info, see the spec.

Package Sidebar

Install

npm i @lifeomic/aws-sdk-helpers

Weekly Downloads

94

Version

3.3.0

License

MIT

Unpacked Size

75.1 kB

Total Files

59

Last publish

Collaborators

  • lifeomicdev
  • npm-lifeomicdev-github