inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
440 stars 43 forks source link

Always include `builtInMiddleware` in custom middleware types #332

Open jpwilliams opened 1 year ago

jpwilliams commented 1 year ago

Summary

When creating middleware, include all internal "built-in" middleware typing, allowing users to access types such as logger to make changes and corrections.

new InngestMiddleware({
  name: "Example Middleware",
  init: () => ({
    onFunctionRun: () => ({
      transformInput: (input) => {
        input.ctx.logger;
        //        ^? (property) logger: Logger
        // This was previously undefined
      },
    }),
  }),
});

Serves as a PoC for part of resolving #331, allowing the user to see and affect the result of internal middleware.

Checklist

Related

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: 3dd89aa3f882263a6b88c37852196fdc3a20c70d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR