@driimus/aws-event-factory
v0.2.3
Published
Test data factories for AWS Lambda event sources
Downloads
77
Maintainers
Readme
@driimus/aws-event-factory
Test data factories for different AWS Lambda event sources. Built using fishery.
Supported Lambda event sources
- Amazon API Gateway
- Amazon CloudWatch Logs
- Amazon Cognito
- Amazon DynamoDB Streams
- Amazon EventBridge
- Amazon Kinesis Data Streams
- Amazon Lex v2
- Amazon MSK
- Amazon S3
- Amazon SNS
- Amazon SQS
- Amazon SecretsManager
Goals
This package prioritizes structural integrity over veracity. While some of the generated data is truthful, explicit inputs should always be provided for the parts of an event that you really care about.
Installation
[!WARNING] This is an ES only package. Before installing, make sure that your project's configuration supports ECMAScript modules.
pnpm add --save-dev @faker-js/faker fishery @driimus/aws-event-factory
Type hints
For types to work as expected, @types/aws-lambda
must be installed:
pnpm add --save-dev @types/aws-lambda
Usage
Make sure to check out fishery's documentation for a more detailed API Reference of the exposed factories.
import {
dynamodbEventFactory,
dynamodbRecordFactory,
sqsEventFactory,
} from '@driimus/aws-event-factory';
const sqsEvent = sqsEventFactory.build(); // { Records: [...] }
const ddbEvent = dynamodbEventFactory.build({
Records: [
dynamodbRecordFactory.insert().build(), // { eventName: 'INSERT', ...}
dynamodbRecordFactory.modify().build(), // { eventName: 'MODIFY', ...}
dynamodbRecordFactory.remove().build(), // { eventName: 'REMOVE', ...}
],
}); // { Records: [...] }
More examples: