3.0.7 • Published 2 years ago

typescript-aws-helpers v3.0.7

Weekly downloads
43
License
MIT
Repository
github
Last release
2 years ago

Associated Helpers

HelperCI/CDCode CoverageVersionDownloads
APIGatewayHelperCI/CDcodecovNPM VersionDownloads
CloudWatchHelperCI/CDcodecovNPM VersionDownloads
DynamoHelperCI/CDcodecovNPM VersionDownloads
KMSHelperCI/CDcodecovNPM VersionDownloads
LambdaHelperCI/CDcodecovNPM VersionDownloads
S3HelperCI/CDcodecovNPM VersionDownloads
SESHelperCI/CDcodecovNPM VersionDownloads
SNSHelperCI/CDcodecovNPM VersionDownloads
SQSHelperCI/CDcodecovNPM VersionDownloads
SSMHelperCI/CDcodecovNPM VersionDownloads
STSHelperCI/CDcodecovNPM VersionDownloads

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