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!: export v2 api #408

Merged
merged 5 commits into from
Aug 21, 2023
Merged

feat!: export v2 api #408

merged 5 commits into from
Aug 21, 2023

Conversation

Skn0tt
Copy link
Contributor

@Skn0tt Skn0tt commented Jul 10, 2023

This PR adds the V2 functions API to the exports of @netlify/functions.

@Skn0tt Skn0tt requested a review from a team as a code owner July 10, 2023 10:01
@Skn0tt
Copy link
Contributor Author

Skn0tt commented Jul 10, 2023

For testing, I published this as 1.6.0-v2api-1. You can install this using npm i @netlify/functions@v2api.

eduardoboucas
eduardoboucas previously approved these changes Jul 10, 2023
package.json Outdated
@@ -52,6 +52,7 @@
"test": "test"
},
"dependencies": {
"@netlify/serverless-functions-api": "^1.5.1",
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should lock the version, such that the entire API surface in one version of @netlify/functions is immutable? Probably not a huge deal since we're also the authors of the dependency and we can control the releases we make, but wondering if it's a good caution to put in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 423960c

@@ -2,3 +2,4 @@ export { Context as HandlerContext } from './context.js'
export { Event as HandlerEvent } from './event.js'
export { BuilderHandler, Handler, BackgroundHandler, HandlerCallback, StreamingHandler } from './handler.js'
export { BuilderResponse, Response as HandlerResponse, StreamingResponse } from './response.js'
export * from './v2.js'
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason this isn't a named export?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No particular reason, no. I put the named exports inside of v2.js, but I can also move that up if you think that's better.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine to re-export, but I think it's better to do an explicit named export in both cases if you do (and make it export type ...)

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Jul 10, 2023

I'll hold off on merging this until we want to publish it. For testing, we can use the prerelease.

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Aug 11, 2023

The change looks good @eduardoboucas. I see we have a 2nd interface in this repo called Context, maybe we should rename that to HandlerContext?

export { Context as HandlerContext } from './context.js'

@eduardoboucas
Copy link
Member

@Skn0tt Good call. In ad00548 I've renamed all those types (and their corresponding files) to have a Handler prefix, to make it clear that they relate to the legacy/Lambda API.

In a follow-up we can further clean things up, like moving those to a sub-directory or something.

@eduardoboucas eduardoboucas changed the title feat: export v2 api feat!: export v2 api Aug 21, 2023
@eduardoboucas eduardoboucas merged commit 894fb91 into main Aug 21, 2023
6 checks passed
@eduardoboucas eduardoboucas deleted the export-v2-api branch August 21, 2023 14:07
eduardoboucas pushed a commit that referenced this pull request Aug 22, 2023
🤖 I have created a release *beep* *boop*
---


## [2.0.0](v1.6.0...v2.0.0)
(2023-08-22)


### ⚠ BREAKING CHANGES

* export v2 api
([#408](#408))

### Features

* export v2 api
([#408](#408))
([894fb91](894fb91))


### Bug Fixes

* **deps:** update dependency @netlify/serverless-functions-api to
v1.7.0 ([#414](#414))
([6fba3af](6fba3af))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
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