Enum of event types.

EventType

Type: Symbol

Properties
lambda (string)
sqs (string)

Read a JSON file. Takes a variable number of arguments with will be joined using path.join to a single file path.

readJson(path: string): Promise<Object>
Parameters
path (string) The path.
Returns
Promise<Object>: The parsed event.

Create a handler factory for EventBridge events. Handles EventBridge rule events and redriven events from SQS. See the README for an explanation of how to use the returned handler factory.

eventbridgeHandler(options: Object): Object
Parameters
options (Object) Overrides passed to createHandler.
Returns
Object: The handler factory.
Related
createHandler

Create a basic event handler factory. See the README for an explanation of how to use the returned handler factory.

createHandler(parameters: Object): Object
Parameters
parameters (Object)
Name Description
parameters.parser string (default identityParser) Event parser.
parameters.serializer string (default identitySerializer) Payload serializer.
parameters.createProcessor string (default createNullProcessor) Processor factory.
parameters.createWrapper string (default createInvokeWrapper) Wrapper factory.
parameters.createStrategy string (default createEventStrategy) Strategy factory.
parameters.registerDependencies string (default registerEmptyDependencies) Called to register dependencies.
Returns
Object: The handler factory.

Create a handler factory for invocation events. See the README for an explanation of how to use the returned handler factory.

invokeHandler(options: Object): Object
Parameters
options (Object) Overrides passed to createHandler.
Returns
Object: The handler factory.
Related
createHandler

Create a handler factory for SQS events.

sqsHandler(options: Object): Object
Parameters
options (Object) Overrides passed to createHandler.
Returns
Object: The handler factory.
Related
createHandler

Create a handler factory for SQS events with JSON body. See the README for an explanation of how to use the returned handler factory.

sqsJsonHandler(options: Object): Object
Parameters
options (Object) Overrides passed to createHandler.
Returns
Object: The handler factory.
Related
createHandler

securityHeaders

lib/headers.doc.js

Security HTTP headers.

securityHeaders

Type: Object

API Gateway Proxy event parser.

apiGatewayProxyParser(event: Object): Object
Parameters
event (Object) The event.
Returns
Object: The parsed event. Includes searchParams as an instance of URLSearchParams.

apiGatewayProxyJsonParser

lib/parsers/api-gateway-proxy.doc.js

API Gateway Proxy JSON event parser.

apiGatewayProxyJsonParser(event: Object): Object
Parameters
event (Object) The event.
Returns
Object: The parsed event with the body parsed as JSON. Includes searchParams as an instance of URLSearchParams.

Parser for EventBridge events. Parses EventBridge rule events and redriven events from SQS.

eventbridgeParser(event: Object): Array<Object>
Parameters
event (Object) The event.
Returns
Array<Object>: The parsed events.

Identity function.

identityParser(event: Object): Object
Parameters
event (Object) The event.
Returns
Object: The parsed event.

Records parser.

recordsParser(event: Object): Array<Object>
Parameters
event (Object) The event.
Returns
Array<Object>: The records from the parsed event.

SQS event parser.

sqsParser(event: Object): Array<Object>
Parameters
event (Object) The event.
Returns
Array<Object>: The messages from the parsed event. Both attributes and messageAttributes are parsed into plain objects with proper types.

SQS JSON event parser.

sqsJsonParser(event: Object): Array<Object>
Parameters
event (Object) The event.
Returns
Array<Object>: The messages from the parsed event with the body parsed as JSON. Both attributes and messageAttributes are parsed into plain objects with proper types.

API Gateway Proxy event serializer.

apiGatewayProxySerializer(event: Object): Object
Parameters
event (Object) The data.
Returns
Object: The serialized data.

apiGatewayProxyJsonSerializer

lib/serializers/api-gateway-proxy.doc.js

API Gateway Proxy JSON event serializer.

apiGatewayProxyJsonSerializer(event: Object): Object
Parameters
event (Object) The data.
Returns
Object: The serialized data with the body serialized to JSON.

Identity function.

identitySerializer(data: Object): Object
Parameters
data (Object) The data.
Returns
Object: The serialized data.

createEventStrategy

lib/strategies/event.doc.js

Create an event strategy. Resolves and calls the processor for the event. Resolves and calls onError on an event error.

createEventStrategy(container: Object): Array<Object>
Parameters
container (Object) The Awilix container.
Returns
Array<Object>: The strategy.

createEventStrategy

lib/strategies/http.doc.js

Create an HTTP strategy. Resolves and calls the processor for the event. Swallows all errors, wraps them as a Boom object, resolves and calls onError on the wrapped error, and returns a matching status code response.

createEventStrategy(container: Object): Array<Object>
Parameters
container (Object) The Awilix container.
Returns
Array<Object>: The strategy.

createParallelStrategy

lib/strategies/parallel.doc.js

Create a parallel strategy for an array of events. Resolves and calls the processor for each event element. Resolves and calls onError on each element error.

createParallelStrategy(container: Object): function
Parameters
container (Object) The Awilix container.
Returns
function: The strategy.

createInvokeWrapper

lib/wrappers/invoke.doc.js

Create an invoke wrapper.

createInvokeWrapper(parentLog: Object, strategy: function, parser: function, serializer: function): function
Parameters
parentLog (Object) The parent logger.
strategy (function) The strategy.
parser (function) The parser.
serializer (function) The serializer.
Returns
function: The wrapper.

createRecordWrapper

lib/wrappers/record.doc.js

Create a record wrapper.

createRecordWrapper(parentLog: Object, strategy: function): function
Parameters
parentLog (Object) The parent logger.
strategy (function) The strategy.
Returns
function: The wrapper.