Open moeriki opened 4 years ago
Sounds like a great idea.
I think I would like the property to live on ctx
, not ctx.request
.
Since the last curveball version Context
is now an interface, so it's possible to also get full typing for it via declaration merging.
So maybe ctx.aws.context
and ctx.aws.event
?
Oh yeah ctx.aws
makes total sense.
I made a WIP PR to get the idea across. Is that what you had in mind?
I set the context for now to any
. I was wondering if you know about @types/aws-lambda? It's got types for the AWS context, event (request), response, and context. At the moment these are typed within this package. Is there a reason for not using it? And would you mind using aws-lambda
types instead.
I'm very down with using @types/aws-lamba! I recently worked on https://github.com/curveball/azure-function/ , and did the same there.
Makes total sense.
Great. I will make the PR for that first then. So I can immediately use the existing aws Context interface.
The default AWS handler has two arguments:
event
, andcontext
.It seems like context is not used in curveball, which is fine. But it would be convenient to have it available on the
ctx.request
.Right now if I want to access the AWS context I have to do this before forwarding the event to Curveball.
Additionally there are internal types for
AwsRequest
andAwsResponse
that are not exposed. I had to type them asany
in the code above.Would you accept PR to:
ctx.request.awsContext
, or other suggestions?AwsRequest
andAwsResponse