typescript-aws-helpers
v3.0.7
Published
Collection of AWS Lambda Helpers
Downloads
50
Maintainers
Readme
Collection of different AWS service helpers
Associated Helpers
| Helper | CI/CD | Code Coverage | Version | Downloads | | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | APIGatewayHelper | | | | | | CloudWatchHelper | | | | | | DynamoHelper | | | | | | KMSHelper | | | | | | LambdaHelper | | | | | | S3Helper | | | | | | SESHelper | | | | | | SNSHelper | | | | | | SQSHelper | | | | | | SSMHelper | | | | | | STSHelper | | | | |
Install
npm install typescript-aws-helpers@latest
Lambda Handlers
Example of a handler for a lambda:
Execute
:
const handler = new Handler(LogLevel.Information);
export async function lambdaHandler(
event: S3Event,
context: Context,
callback: Callback,
) {
return (
(await handler.Execute) <
S3Event >
(event,
context,
callback,
async () => {
this.Logger.Information('Executed');
})
);
}
Orchestrators
Examples of how to use orchestrators:
Orchestrate
:
const handler = new Handler(LogLevel.Information);
const response =
(await handler.Orchestrate) <
string >
(async () => {
// do stuff
this.Logger.Information(`Stuff was done`);
return `Done`;
});
OrchestrateSQS
:
const handler = new Handler(LogLevel.Information);
const sqsEvent: SQSEvent = {
Records: [{ body: 'body', receiptHandle: 'receipt-handle' }],
};
const response = await handler.OrchestrateSQS(
sqsEvent.Records,
'queue-url',
async () => {
// do stuff
this.Logger.Information(`Stuff was done`);
},
);
Helpers
See the appropriate helper repo for documentation on how to use them from the links in Associated Helpers
Development
Clone the latest and run
npm run prep
to install packages and prep the git hooks