# @phasma/handler-aws

> An implementation of @phasma handler designed for working with Amazon Web Services Lambda

Latest version **1.0.1** (published 2022-12-29) · 0 weekly downloads

## Install

```sh
npm install @phasma/handler-aws
pnpm add @phasma/handler-aws
yarn add @phasma/handler-aws
bun add @phasma/handler-aws
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-12-29 |
| First published | 2022-04-08 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16.12.0 |
| Dependencies | 4 |
| Unpacked size | 36 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | matt-usurp |
| Keywords | phasma, handler, middleware, aws, lambda |

## Links

- npm: https://www.npmjs.com/package/@phasma/handler-aws
- Repository: https://github.com/matt-usurp/phasma
- Homepage: https://github.com/matt-usurp/phasma/tree/main/packages/@phasma/handler-aws#readme
- Issues: https://github.com/matt-usurp/phasma/issues
- npm.io page: https://npm.io/package/@phasma/handler-aws

## Dependencies (4)

- [tslib](https://npm.io/package/tslib.md) ^2.4.0
- [@phasma/handler](https://npm.io/package/@phasma/handler.md) ^1.0.0
- [@matt-usurp/grok](https://npm.io/package/@matt-usurp/grok.md) ^1.1.0
- [@types/aws-lambda](https://npm.io/package/@types/aws-lambda.md) ^8.10.104

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-12-29
- 1.0.0-next.3 (next) — 2022-11-30
- 1.0.0 — 2022-12-15
- 1.0.0-next.2 — 2022-11-30
- 1.0.0-next.1 — 2022-11-30
- 0.4.3 — 2022-08-11
- 0.4.2 — 2022-07-11
- 0.4.1 — 2022-06-10
- 0.5.0-rc.1 — 2022-06-07
- 0.4.0 — 2022-04-22
- 0.3.3 — 2022-04-13
- 0.3.2 — 2022-04-12
- 0.3.1 — 2022-04-12
- 0.3.0 — 2022-04-12
- 0.2.0 — 2022-04-12
- … 2 more at https://npm.io/package/@phasma/handler-aws/versions

## README

# `@phasma/handler-aws`

An implementation of `@phasma/handler` designed for working with **Amazon Web Services** Lambda.

> Create simplistic and maintainable entrypoint-based applications.

For more information or raising issues please use the main [phasma](https://github.com/matt-usurp/phasma) repository on GitHub.

## Getting Started

The package is available on all registries and can be installed with your standard commands:

```
npm i @phasma/handler-aws
```

This package provides pre-defined implementations for the `lambda` technology.
Depending on the service you want to use the integration will look similar to this:

```ts
import { aws } from '@phasma/handler-aws';

export const handler = aws<'apigw:proxy:v2'>((application) => {
  return application
    .use(new WithRequestQueryValidator())
    .use(new WithRequestBodyValidator())
    .handle(new GetUserCollectionHandler())
});
```

> Where `handler` is the export that `lambda` will be pointed to to execute your function.

This will follow the following process:

1. When the `handler` is invoked by `lambda` the event is taken in and the composition is triggered.
2. The middleware `WithRequestQueryValidator` is invoked to provide any context from the provider event.
3. The middleware `WithRequestBodyValidator` is invoked to provide any context from the provider event.
4. The handler `GetUserCollectionHandler` is invoked with the context and performs some business logic, it returns a response.
5. The middleware `WithRequestBodyValidator` receives the response and does any transformation if required, if not it passes the response down the chain.
6. The middleware `WithRequestQueryValidator` receives the response and does any transformation if required, if not it passes the response down the chain.
7. The provider receives the response, does some final transformations (if required) and returns to `lambda`.

More details on how this works at its core can be found in the `@phasma/handler` package which this extends, documentation can be [found here](https://github.com/matt-usurp/phasma/tree/main/packages/@phasma/handler).

## Working with Events

> TODO

### Defining Events

> TODO

## Defining Handlers

> TODO

## Defining Middleware

> TODO

## Testing

> TODO

---
_Source: https://npm.io/package/@phasma/handler-aws · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
