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

feat: initial commit of Snapshot middleware #219

Merged
merged 23 commits into from
Oct 29, 2024
Merged

Conversation

danleyb2
Copy link
Collaborator

@danleyb2 danleyb2 commented Oct 19, 2024

Summary by CodeRabbit

  • New Feature: Introduced Snapshot middleware to format and forward requests from supported camera sources.
  • New Feature: Implemented custom error handling with retry logic for HTTP requests.
  • New Feature: Added Rollbar integration for error logging and monitoring.
  • Documentation: Provided deployment and local development instructions in README.
  • Test: Initial test suite for Cloudflare worker, ensuring basic functionality.
  • Chore: Added .editorconfig and .gitignore for consistent coding style and repository cleanliness.

Copy link

github-actions bot commented Oct 19, 2024

Image description CodeRabbit

## Walkthrough

This commit introduces a new Snapshot middleware project, including configuration files, custom error handling, utility functions, and integration with external services like Rollbar. It provides functionality for processing and forwarding requests, handling retries on errors, and logging. Initial tests and documentation are also included to support deployment and development.

## Changes

| Files                                      | Summary                                                                                                                                                                                                 |
|--------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `.editorconfig`, `.gitignore`              | Initial commit of configuration files to maintain consistent coding styles and ignore unnecessary files in the repository.                                                                              |
| `README.md`                                | Instructions for deploying and developing the Snapshot middleware locally, detailing setup steps and testing procedures.                                                                                |
| `src/exceptions.js`, `src/utils.js`        | Introduction of custom error classes and a utility function for making HTTP requests with retry logic on specific errors.                                                                               |
| `src/index.js`                             | New middleware for handling snapshot requests, validating data, and processing messages from a queue.                                                                                                   |
| `src/snapshot.js`                          | Implementation of `SnapshotApi` class for uploading images to an API endpoint using base64 encoding and handling responses.                                                                              |
| `src/rollbar.js`                           | Module for logging errors using Rollbar, providing methods to send traces and telemetry data to the Rollbar API.                                                                                        |
| `src/test.js`                              | Initial commit of a JSON template for sending detailed error or event data to a service like Rollbar.                                                                                                   |
| `test/index.spec.js`                       | Test suite for a Cloudflare worker, verifying basic response functionality.                                                                                                                             |

> In code we trust, through bytes we sail,  
> A middleware tale where errors pale.  
> With Rollbar's watchful eye, logs take flight,  
> As snapshots dance in the digital night.  
> Retry, resolve, in harmony they sing,  
> A rabbit's joy in every spring! 🐇✨

Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 39eb3e9 and 42f0016 commits.
Files selected (11)
  • snapshot-middleware/.editorconfig (1)
  • snapshot-middleware/.gitignore (1)
  • snapshot-middleware/README.md (1)
  • snapshot-middleware/src/exceptions.js (1)
  • snapshot-middleware/src/index.js (1)
  • snapshot-middleware/src/rollbar.js (1)
  • snapshot-middleware/src/snapshot.js (1)
  • snapshot-middleware/src/test.js (1)
  • snapshot-middleware/src/utils.js (1)
  • snapshot-middleware/test/index.spec.js (1)
  • snapshot-middleware/vitest.config.js (1)
Files ignored due to filter (4)
  • snapshot-middleware/package-lock.json
  • snapshot-middleware/package.json
  • snapshot-middleware/rollbar.toml
  • snapshot-middleware/wrangler.toml
Files skipped from review due to trivial changes (3)
  • snapshot-middleware/.editorconfig
  • snapshot-middleware/.gitignore
  • snapshot-middleware/src/test.js (diff too large)
Review comments generated (19)
  • Review: 7
  • LGTM: 12

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

snapshot-middleware/src/snapshot.js Outdated Show resolved Hide resolved
snapshot-middleware/src/utils.js Outdated Show resolved Hide resolved
snapshot-middleware/test/index.spec.js Outdated Show resolved Hide resolved
snapshot-middleware/src/rollbar.js Outdated Show resolved Hide resolved
snapshot-middleware/src/rollbar.js Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 42f0016 and 3eb603b commits.
Files selected (4)
  • snapshot-middleware/src/index.js (1)
  • snapshot-middleware/src/rollbar.js (1)
  • snapshot-middleware/src/snapshot.js (1)
  • snapshot-middleware/test/index.spec.js (1)
Review comments generated (14)
  • Review: 5
  • LGTM: 9

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

snapshot-middleware/src/rollbar.js Outdated Show resolved Hide resolved
snapshot-middleware/src/rollbar.js Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
@marcbelmont marcbelmont requested review from Pefington and removed request for stevelukis October 21, 2024 09:56
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 39eb3e9 and 3eb603b commits.
Files selected (10)
  • snapshot-middleware/.editorconfig (1)
  • snapshot-middleware/.gitignore (1)
  • snapshot-middleware/README.md (1)
  • snapshot-middleware/src/exceptions.js (1)
  • snapshot-middleware/src/index.js (1)
  • snapshot-middleware/src/rollbar.js (1)
  • snapshot-middleware/src/snapshot.js (1)
  • snapshot-middleware/src/utils.js (1)
  • snapshot-middleware/test/index.spec.js (1)
  • snapshot-middleware/vitest.config.js (1)
Files ignored due to filter (4)
  • snapshot-middleware/package-lock.json
  • snapshot-middleware/package.json
  • snapshot-middleware/rollbar.toml
  • snapshot-middleware/wrangler.toml
Files skipped from review due to trivial changes (2)
  • snapshot-middleware/.editorconfig
  • snapshot-middleware/.gitignore
Review comments generated (26)
  • Review: 8
  • LGTM: 18

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

snapshot-middleware/src/snapshot.js Outdated Show resolved Hide resolved
snapshot-middleware/src/rollbar.js Outdated Show resolved Hide resolved
snapshot-middleware/src/rollbar.js Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
snapshot-middleware/src/utils.js Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 3eb603b and 8100555 commits.
Files selected (3)
  • .github/workflows/code-review.yml (1)
  • snapshot-middleware/src/index.js (1)
  • snapshot-middleware/src/rollbar.js (1)
Review comments generated (5)
  • Review: 3
  • LGTM: 2

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

.github/workflows/code-review.yml Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
snapshot-middleware/src/index.js Outdated Show resolved Hide resolved
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 8100555 and 718791d commits.
Files selected (1)
  • snapshot-middleware/README.md (1)
Files ignored due to filter (2)
  • snapshot-middleware/rollbar.toml
  • snapshot-middleware/wrangler.toml
Review comments generated (1)
  • Review: 0
  • LGTM: 1

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Copy link
Contributor

@Pefington Pefington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good but I can't test. Left comments

snapshot-middleware/src/rollbar.js Outdated Show resolved Hide resolved
snapshot-middleware/test/index.spec.js Show resolved Hide resolved
snapshot-middleware/README.md Outdated Show resolved Hide resolved
snapshot-middleware/package-lock.json Outdated Show resolved Hide resolved
snapshot-middleware/README.md Show resolved Hide resolved
Copy link
Collaborator

@marcbelmont marcbelmont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

nit: could you use 2 or 4 spaces for indentation?

@Pefington
Copy link
Contributor

LGTM

nit: could you use 2 or 4 spaces for indentation?

@danleyb2 Don't hesitate to install and use Prettier and eslint for JS/TS.

@marcbelmont
Copy link
Collaborator

@danleyb2
don't forget to update the indentation.

@marcbelmont marcbelmont merged commit 7645a7f into master Oct 29, 2024
@marcbelmont marcbelmont deleted the snapshot-middleware branch October 29, 2024 15:41
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.

3 participants