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: support js runtime for unit resolver #613

Merged
merged 7 commits into from
Oct 12, 2023

Conversation

krml4913
Copy link
Contributor

@krml4913 krml4913 commented Sep 16, 2023

Copy link
Collaborator

@bboure bboure left a comment

Choose a reason for hiding this comment

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

Thanks @krml4913 !

I left a couple of comments I'd like your feedback on.

this.config.kind === 'UNIT' ||
'request' in this.config ||
'response' in this.config
);

if (!isJsResolver) {
if (!isUnitJsResolver && !isPipelineJsResolver) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's been a while since I wrote this code and with this change it became hard to wrap my head around it..

If I read this correctly, we should now be able to simplify this condition to something like isVTLResolver where

const isVTLResolver = 'request' in this.config || 'response' in this.config;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.
I added isVTLResolver flag.

src/resources/Resolver.ts Outdated Show resolved Hide resolved
@krml4913
Copy link
Contributor Author

@bboure thank you for review.
I added some commits for your comments and replies.

doc/resolvers.md Outdated
@@ -49,7 +49,18 @@ export function response(ctx) {
}
```

To use [direct lambda](https://docs.aws.amazon.com/appsync/latest/devguide/direct-lambda-reference.html), set `kind` to `UNIT` and don't specify `request` and `response` (only works with Lambda function data sources).
If you want to use a UNIT JavaScript resolver, you must specify `code` (the minimalistic resolver handler cannot be used for UNIT resolver).
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you mean by "minimalistic" ?

src/resources/Resolver.ts Outdated Show resolved Hide resolved
@bboure bboure merged commit 37ae9cd into sid88in:master Oct 12, 2023
2 checks passed
@bboure
Copy link
Collaborator

bboure commented Oct 12, 2023

Thank you @krml4913

@github-actions
Copy link

🎉 This PR is included in version 2.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Javascript resolvers supported now by AWS as Unit resolvers but not by the plugin
2 participants