Constructor
new HandlerWrapper(appName)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
appName |
String | The name of the application to which the lambda functions returned by this object belong. This value will be injected into log statements emitted by the logger. |
Methods
wrap(handler, handlerName) → {HandlerWrapper.Wrapper}
- Source:
Creates and returns a wrapper lambda handler.
Parameters:
Name | Type | Description |
---|---|---|
handler |
HandlerWrapper.Handler | A function that contains the intended lambda functionality. |
handlerName |
String | The name of the handler. Used for logging. |
Returns:
A function that can be used as the
AWS lambda handler.
Type Definitions
Handler(event, contex, ext) → {Promise|*}
- Source:
A function that contains the core execution logic of the lambda function.
This function receives the input and context from the AWS lambda, along
with some extended properties, and can return any value, including a
Promise for asynchronous operations.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
event |
Object | The input to the lambda function, not altered in any way by the wrapper. | ||||||||||||
contex |
Object | The AWS lambda context, not altered in any way by the wrapper. | ||||||||||||
ext |
Object | Extended parameters passed to the handler. These
are values injected by the wrapper, providing utility objects
that the handler can optionally utilize.
Properties
|
Returns:
The response from the lambda handler execution. If
a promise is returned, the the wrapper will wait for resolution
or rejection of the promise, and use the corresponding result
as the response value of the lambda.
- Type
- Promise | *
Wrapper(event, contex, callback)
- Source:
A function that conforms to the AWS signature. This function initializes
the logger and config objects, and delegates actual execution to a
handler function.
The wrapper also provides lambda keep warm capability that can be
used to keep the lambda in cache without actually invoking the
handler function.
This can be accomplished by passing a parameter called
__LAMBDA_KEEP_WARM
with a truthy value to the wrapper.
Parameters:
Name | Type | Description |
---|---|---|
event |
Object | The input to the lambda function, not altered in any way by the wrapper. |
contex |
Object | The AWS lambda context. |
callback |
function | The callback function passed to the AWS lambda. |