@driimus/aws-event-factory
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

@driimus/aws-event-factory

npm

Test data factories for different AWS Lambda event sources. Built using fishery.

Supported Lambda event sources

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:

Prior art

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @driimus/aws-event-factory

      Weekly Downloads

      1

      Version

      0.2.1

      License

      MIT

      Unpacked Size

      43.5 kB

      Total Files

      55

      Last publish

      Collaborators

      • driimus