-
Notifications
You must be signed in to change notification settings - Fork 189
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
Conversation
There was a problem hiding this 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.
src/resources/Resolver.ts
Outdated
this.config.kind === 'UNIT' || | ||
'request' in this.config || | ||
'response' in this.config | ||
); | ||
|
||
if (!isJsResolver) { | ||
if (!isUnitJsResolver && !isPipelineJsResolver) { |
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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.
@bboure thank you for review. |
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). |
There was a problem hiding this comment.
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" ?
Thank you @krml4913 |
🎉 This PR is included in version 2.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Added support javascript runtime for unit resolver.
https://aws.amazon.com/jp/blogs/mobile/aws-appsync-now-supports-javascript-for-all-resolvers-in-graphql-apis/
Closes #616