Skip to content

chore: add middy like interfaces to commons package #500

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

Closed
wants to merge 1 commit into from

Conversation

dreamorosi
Copy link
Contributor

Description of your changes

This PR is a pre-requisite to be able to start working on issue #373 and it proposes to add two interfaces and one type that mirror the ones defined in @middy/core here.

Before going on and adding our own interfaces in @aws-lambda-powertools/commons I have attempted to search for existing ones in the npm registry and in the DefinitelyTyped repo but found none.

How to verify this change

Check out this branch, run npm pack in packages/commons and try to import MiddyLikeMiddlewareObj or MiddyLikeRequest in your code after installing the tar archive.

Related issues, RFCs

#373

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

Breaking change checklist

N/A


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dreamorosi dreamorosi added this to the production-ready-release milestone Jan 21, 2022
@dreamorosi dreamorosi self-assigned this Jan 21, 2022
@github-actions github-actions bot added the internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) label Jan 21, 2022
Copy link
Contributor

@flochaz flochaz left a comment

Choose a reason for hiding this comment

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

should we add a simple test to check that export are working as expected, like done for LambdaInterface https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/packages/commons/tests/unit/LambdaInterface.test.ts ?

@dreamorosi dreamorosi marked this pull request as draft January 21, 2022 16:08
@dreamorosi
Copy link
Contributor Author

should we add a simple test to check that export are working as expected, like done for LambdaInterface https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/packages/commons/tests/unit/LambdaInterface.test.ts ?

You were right, while adding the tests I realised they weren't exported properly. Good catch!

@dreamorosi
Copy link
Contributor Author

Closing this PR as it's unnecessary. After talking with @saragerion she pointed out (correctly) that just moving middy as devDependency and changing the imports to import type middy from "@middy/core" already allows us to use the types in our middleware and removes @middy/core itself form the package once you run npm pack.

I've tested this on a local branch and it works, will open a PR for it in the coming days.

@dreamorosi dreamorosi closed this Jan 21, 2022
@dreamorosi dreamorosi deleted the chore/add_middy_like_interfaces branch January 21, 2022 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants