You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Class method decorator, Middy middleware, and function wrapper to make your Lambda functions idempotent and prevent duplicate execution based on payload content.
Copy file name to clipboardExpand all lines: docs/getting-started/installation.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Installing Powertools for AWS Lambda
5
5
6
6
<!-- markdownlint-disable MD043 -->
7
7
8
-
You can use Powertools for AWS Lambda (TypeScript) by installing it with your favorite dependency management, or via [Lambda Layers](lambda-layers.md).
8
+
You can use Powertools for AWS Lambda (TypeScript) by installing it with your favorite dependency management, or via [Lambda Layers](./lambda-layers.md).
9
9
10
10
The toolkit is compatible with both TypeScript and JavaScript code bases, and supports both CommonJS and ES modules.
11
11
@@ -23,10 +23,10 @@ Some features use additional dependencies like the AWS SDK for JavaScript v3, wh
|**[Tracer](./features/tracer.md)**|**`npm i @aws-lambda-powertools/tracer`**{.copyMe}:clipboard:|`aws-xray-sdk-core`|
27
-
|**[Idempotency](./features/idempotency.md)**|**`npm i @aws-lambda-powertools/idempotency @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb`**{.copyMe}:clipboard:||
28
-
|**[Parameters (SSM)](./features/parameters.md)**|**`npm i @aws-lambda-powertools/parameters @aws-sdk/client-ssm`**{.copyMe}:clipboard:||
29
-
|**[Parameters (Secrets Manager)](./features/parameters.md)**|**`npm i @aws-lambda-powertools/parameters @aws-sdk/client-secrets-manager`**{.copyMe}:clipboard:||
30
-
|**[Parameters (AppConfig)](./features/parameters.md)**|**`npm i @aws-lambda-powertools/parameters @aws-sdk/client-appconfigdata`**{.copyMe}:clipboard:||
31
-
|**[Parser](./features/parser.md)**|**`npm i @aws-lambda-powertools/parser zod@~3`**{.copyMe}:clipboard:||
32
-
|**[Validation](./features/validation.md)**|**`npm i @aws-lambda-powertools/validation`**{.copyMe}:clipboard:|`ajv`|
26
+
|**[Tracer](../features/tracer.md)**|**`npm i @aws-lambda-powertools/tracer`**{.copyMe}:clipboard:|`aws-xray-sdk-core`|
27
+
|**[Idempotency](../features/idempotency.md)**|**`npm i @aws-lambda-powertools/idempotency @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb`**{.copyMe}:clipboard:||
28
+
|**[Parameters (SSM)](../features/parameters.md)**|**`npm i @aws-lambda-powertools/parameters @aws-sdk/client-ssm`**{.copyMe}:clipboard:||
29
+
|**[Parameters (Secrets Manager)](../features/parameters.md)**|**`npm i @aws-lambda-powertools/parameters @aws-sdk/client-secrets-manager`**{.copyMe}:clipboard:||
30
+
|**[Parameters (AppConfig)](../features/parameters.md)**|**`npm i @aws-lambda-powertools/parameters @aws-sdk/client-appconfigdata`**{.copyMe}:clipboard:||
31
+
|**[Parser](../features/parser.md)**|**`npm i @aws-lambda-powertools/parser zod@~3`**{.copyMe}:clipboard:||
32
+
|**[Validation](../features/validation.md)**|**`npm i @aws-lambda-powertools/validation`**{.copyMe}:clipboard:|`ajv`|
Copy file name to clipboardExpand all lines: docs/getting-started/lambda-layers.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -7,10 +7,16 @@ description: Using Powertools for AWS Lambda with Lambda layers
7
7
8
8
A [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html){target="_blank"} is a `.zip` file archive that can contain additional code, pre-packaged dependencies, data, or configuration files. We provide a Lambda Layer for Powertools for AWS Lambda (TypeScript) to help you get started quickly with the library.
9
9
10
-
You can add our layer both in the [AWS Lambda Console _(under `Layers`)_](https://eu-west-1.console.aws.amazon.com/lambda/home#/add/layer){target="_blank"}, or via your favorite infrastructure as code framework with the ARN value. You can use the Lambda Layer both with CommonJS and ESM (ECMAScript modules).
10
+
You can add our layer both in the [AWS Lambda Console _(under `Layers`)_](https://docs.aws.amazon.com/lambda/latest/dg/adding-layers.html){target="_blank"}, or via your favorite infrastructure as code framework with the ARN value. You can use the Lambda Layer both with CommonJS and ESM (ECMAScript modules).
11
11
12
12
### Layer ARNs
13
13
14
+
We publish the Lambda Layer for Powertools for AWS Lambda (TypeScript) in all commercial regions and AWS GovCloud (US) regions.
15
+
16
+
???+ tip "Spotted a missing region?"
17
+
18
+
Open an [issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new?template=feature_request.yml&title=Feature%20request%3A%20missing%20Lambda%20layer%20region) in our GitHub repository to request it.
Copy file name to clipboardExpand all lines: docs/getting-started/navigating-the-toolkit.md
+89-10
Original file line number
Diff line number
Diff line change
@@ -5,20 +5,99 @@ description: Getting to know the Powertools for AWS Lambda Toolkit
5
5
6
6
<!-- markdownlint-disable MD043 -->
7
7
8
-
## Instrumentation
8
+
Powertools for AWS Lambda (TypeScript) is a collection of utilities designed to help you build serverless applications on AWS.
9
9
10
-
Many of the utilities provided by Powertools for AWS Lambda (TypeScript) can be used with different programming paradigms:
10
+
The toolkit is designed to be modular, so you can pick and choose the utilities you need for your application. Each utility is designed to be used independently, but they can also be used together to provide a complete solution for your serverless applications.
11
11
12
-
-**Middy** middleware. It is the best choice if your existing code base relies on the [Middy.js](https://middy.js.org/docs/) middleware engine. Powertools for AWS Lambda (TypeScript) offers compatible Middy middleware to make this integration seamless.
13
-
-**Method decorator**. Use [TypeScript method decorators](https://www.typescriptlang.org/docs/handbook/decorators.html#method-decorators) if you prefer writing your business logic using [TypeScript Classes](https://www.typescriptlang.org/docs/handbook/classes.html). If you aren’t using Classes, this requires the most significant refactoring.
14
-
-**Manually**. It provides the most granular control. It’s the most verbose approach, with the added benefit of no additional dependency and no refactoring to TypeScript Classes.
12
+
## Patterns
15
13
16
-
The examples in this documentation will feature all the approaches described above wherever applicable.
14
+
Many of the utilities provided can be used with different patterns, depending on your preferences and the structure of your code.
17
15
18
-
##Examples
16
+
### Class Method Decorator
19
17
20
-
You can find examples of how to use Powertools for AWS Lambda (TypeScript) in the [examples](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples/app){target="_blank"} directory. The application is a simple REST API that can be deployed via either AWS CDK or AWS SAM.
18
+
If you prefer writing your business logic using Object-Oriented Programming (OOP) and TypeScript Classes, the Class Method decorator pattern is a good fit. This approach lets you decorate class methods with Powertools utilities, applying their functionality with minimal code changes.
21
19
22
-
If instead you want to see Powertools for AWS Lambda (TypeScript) in slightly different use cases, check the [Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo) or the [AWS Lambda performance tuning](https://github.com/aws-samples/optimizations-for-lambda-functions) repository.
20
+
This pattern works well when you want to integrate Powertools for AWS Lambda (TypeScript) into an existing codebase without significant refactoring and with no additional runtime dependencies. Note that this approach relies on TypeScript's experimental decorator feature.
23
21
24
-
Both demos use Powertools for AWS Lambda (TypeScript) as well as demonstrating other common techniques for Lambda functions written in TypeScript.
If your existing codebase relies on the [Middy.js](https://middy.js.org/docs/) middleware engine, you can use the Powertools for AWS Lambda (TypeScript) middleware to integrate with your existing code. This approach is similar to the Class Method decorator pattern but uses the Middy.js middleware engine to apply Powertools utilities.
If you prefer a more functional programming style, you can use the Powertools for AWS Lambda (TypeScript) utilities directly in your code without decorators or middleware. This approach is more verbose but provides the most control over how the utilities are applied.
Copy file name to clipboardExpand all lines: docs/getting-started/typescript-settings.md
+41-1
Original file line number
Diff line number
Diff line change
@@ -5,4 +5,44 @@ description: Configuration settings for using Powertools with TypeScript
5
5
6
6
<!-- markdownlint-disable MD043 -->
7
7
8
-
Stuff
8
+
While you can use the toolkit with JavaScript, using TypeScript is recommended.
9
+
10
+
The toolkit is written in TypeScript, and the type definitions are included in the package. This means you can take advantage of TypeScript's static typing and other features when using it.
11
+
12
+
We officially support TypeScript 5.0 and later, and our development is done using the latest version of TypeScript. We recommend using the latest version of TypeScript to take advantage of the latest features and improvements.
13
+
14
+
## TypeScript Configuration
15
+
16
+
The toolkit should work with most TypeScript configurations. The only requirement is that `experimentalDecorators` is set to `true` if you are using class method decorators. This is because we only support the legacy decorator proposal for now. We will support the new decorator proposal in the next major version of Powertools for AWS Lambda (TypeScript).
17
+
18
+
If you are looking for a starting point, the following `tsconfig.json` file is a good place to start. It includes the recommended settings along with some modern TypeScript features.
Copy file name to clipboardExpand all lines: docs/index.md
+6
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,12 @@ Powertools for AWS Lambda (TypeScript) is built as a modular toolkit, so you can
52
52
|[Parser](./features/parser.md)| Utility to parse and validate AWS Lambda event payloads using Zod, a TypeScript-first schema declaration and validation library. |
53
53
|[Validation](./features/validation.md)| JSON Schema validation for events and responses, including JMESPath support to unwrap events before validation. |
54
54
55
+
## Examples
56
+
57
+
You can find examples of how to use Powertools for AWS Lambda (TypeScript) in the [examples](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples){target="_blank"} directory, which contains both code snippets for specific use cases, as well as a full example application.
58
+
59
+
If instead you want to see Powertools for AWS Lambda (TypeScript) in a more involved context, check the [Powertools for AWS workshop](https://github.com/aws-samples/powertools-for-aws-lambda-workshop/tree/main/functions/typescript) where we demonstrate how to use toolkit in a more complex application.
60
+
55
61
## Support Powertools for AWS
56
62
57
63
There are many ways you can help us gain future investments to improve everyone's experience:
0 commit comments