Giter Club home page Giter Club logo

hono-adapter-aws-lambda's Issues

`.route()` grouping breaks trigger event routes.

Trigger event routes/paths support works as a simple wrapper that gets the eventSource, and transforms it into method:TRIGGER path:eventSource Request for Hono to process, we would then register routes on TRIGGER method.
For it to work perfectly, the paths of the eventSource should never intended to be prefixed, i.e: TRIGGER method should never be prefixed

Currently Hono doesn't provide any (and I can't find hack-able) way to get or skip the prefix of .route() grouping, so, Hono instances with trigger events would break after getting grouped with .route()

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
.devcontainer/Dockerfile
npm
package.json
  • @namesmt/utils-lambda ^0.0.2
  • @types/aws-lambda ^8.10.141
  • consola ^3.2.3
  • hono ^4.5.0
  • std-env ^3.7.0
  • @antfu/eslint-config ^2.23.0
  • @types/node ^20.14.11
  • @unocss/eslint-plugin ^0.61.5
  • @vitest/coverage-v8 ^2.0.3
  • eslint ^9.7.0
  • klona ^2.0.6
  • lint-staged ^15.2.7
  • simple-git-hooks ^2.11.1
  • tsx ^4.16.2
  • typescript ^5.5.3
  • unbuild ^2.0.0
  • vitest ^2.0.3
  • node >=18.20.3
  • pnpm 9.5.0
  • hasown ^1
  • is-core-module ^1
playground/package.json
  • nodemon ^3.1.4
  • vite ^5.3.4
  • vite-plugin-inspect ^0.8.5

  • Check this box to trigger a request for Renovate to run again on this repository

[RFC] Improving/rethinking the trigger events processing

The current implementation simply declares a custom method (TRIGGER) and lets hono internal processes mostly everything, this approach allows a familiar syntax with normal hono routes and allowing using the same processing logic via with the current adapter but poses some limitation:

  • fixTriggerRoutes is required if basePath / .route grouping is used.
  • Only one route is possible for each source of event.

In lambda-voie, I designed the .eventRoute (trigger events) processing to be able to register multiple routes for the same eventSource (like: aws:s3), so that we could do many things for the same event and it would returns an object containing all responses from all registered handlers, something like:

app.eventRoute('aws:s3', 'log')
app.eventRoute('aws:s3', 'copyToPrivateStoreIfNeeded') // If condition met then copy and returns the new path
app.eventRoute('aws:s3', 'emailIfNeeded') // If condition met then sends email and returns true

One event comes in and it returns something like:

const res = {
  log: true,
  copyToPrivateStoreIfNeeded: "a/b/c.file",
  emailIfNeeded: false,
}

It was amazing and supports the usecase of a complex applications, like what if both api/book/* and api/user/* both wants to register a trigger handler on aws:s3?.

I hope we could bring it to this adapter too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.