Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamoDB stream support #21

Merged
merged 17 commits into from
Mar 24, 2024
Merged

DynamoDB stream support #21

merged 17 commits into from
Mar 24, 2024

Conversation

blazejkustra
Copy link
Owner

@blazejkustra blazejkustra commented Feb 18, 2024

Summary:

This PR aims to support DynamoDB streams in dynamode, so that it's much easier to work with them.

Code sample:

import type { Context, DynamoDBStreamEvent } from 'aws-lambda';
import Stream from 'dynamode/stream';

async function itemStream(event: DynamoDBStreamEvent, context: Context): void {
  const stream = new Stream(event.Records[0]);

  // Update list progress when an item is created
  if (stream.isEntity(List)) {
    if (stream.operation === 'insert' && stream.newImage) {
      await ListManager.update(List.getPrimaryKey(stream.newImage.listId), {
        increment: {
          'progress.checked': 1,
        },
      });
    }
  }
}

Type of change:

  • Bug fix
  • Feature implementation
  • Documentation improvement
  • Testing improvement
  • Something not listed here

Is this a breaking change?

  • YES 🚨
  • No

Other:

  • I have searched through the GitHub pull requests to ensure this PR has not already been submitted
  • I have updated the Dynamode documentation (if required)
  • I have added/updated the Dynamode test cases (if required)
  • I agree that all changes made in this pull request may be distributed and are made available in accordance with the Dynamode License.

@blazejkustra blazejkustra self-assigned this Feb 18, 2024
@blazejkustra blazejkustra force-pushed the feature/dynamodb-streams branch from 54b09d3 to 1f995f9 Compare February 24, 2024 23:56
@blazejkustra blazejkustra force-pushed the feature/dynamodb-streams branch from db5b2c5 to acd1c7a Compare February 24, 2024 23:58
@blazejkustra blazejkustra changed the title WIP: DynamoDB stream support DynamoDB stream support Mar 24, 2024
@blazejkustra blazejkustra merged commit f2473af into main Mar 24, 2024
2 checks passed
@blazejkustra blazejkustra deleted the feature/dynamodb-streams branch March 24, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant