Skip to content

Commit fe5c61f

Browse files
authored
Merge branch 'main' into 2851_invalid_timezone_env_var
2 parents 827ac62 + 973a65e commit fe5c61f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1085
-2645
lines changed

.devcontainer/devcontainer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
"customizations": {
1515
// Add the ids of extensions you want installed when the container is created.
1616
"extensions": [
17-
"dbaeumer.vscode-eslint",
18-
"esbenp.prettier-vscode",
17+
"biomejs.biome",
1918
"firsttris.vscode-jest-runner"
2019
],
2120
"vscode": {

.eslintignore

-4
This file was deleted.

.eslintrc.js

-72
This file was deleted.

.github/actions/cached-node-modules/action.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ runs:
4343
npm run build -w packages/idempotency & \
4444
npm run build -w packages/batch & \
4545
npm run build -w packages/testing & \
46-
npm run build -w packages/parser
46+
npm run build -w packages/parser & \
47+
npm run build -w packages/event-handler
4748
shell: bash

.github/boring-cyborg.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ labelPRBasedOnFilePath:
1818
parser:
1919
- packages/parser/src/*
2020
- packages/parser/src/**/*
21+
event-handler:
22+
- packages/event-handler/src/*
23+
- packages/event-handler/src/**/*
2124
validator:
2225
- packages/validator/src/*
2326
- packages/validator/src/**/*
@@ -53,6 +56,9 @@ labelPRBasedOnFilePath:
5356
- packages/parser/tests/*
5457
- packages/parser/tests/**/*
5558
- packages/parser/jest.config.cjs
59+
- packages/event-handler/tests/*
60+
- packages/event-handler/tests/**/*
61+
- packages/event-handler/jest.config.cjs
5662
- packages/validator/tests/*
5763
- packages/validator/tests/**/*
5864
- packages/validator/jest.config.cjs
@@ -95,8 +101,7 @@ labelPRBasedOnFilePath:
95101
- LICENSE-THIRD-PARTY
96102
- lerna.json
97103
- .nvmrc
98-
- .eslintrc.cjs
99-
- .eslintignore
104+
- .biome.json
100105
- .npmignore
101106
- .gitpod.yml
102107
- .husky/*
@@ -109,6 +114,8 @@ labelPRBasedOnFilePath:
109114
- packages/tracer/README.md
110115
- packages/parser/tsconfig*.json
111116
- packages/parser/README.md
117+
- packages/event-handler/tsconfig*.json
118+
- packages/event-handler/README.md
112119
- packages/idempotency/tsconfig*.json
113120
- packages/idempotency/README.md
114121
- packages/batch/tsconfig*.json
@@ -117,8 +124,6 @@ labelPRBasedOnFilePath:
117124
- packages/commons/README.md
118125
- packages/validator/tsconfig*.json
119126
- packages/validator/README.md
120-
- packages/parser/tsconfig*.json
121-
- packages/parser/README.md
122127
- layers/tsconfig*.json
123128
- layers/README.md
124129
- examples/app/tsconfig*.json
@@ -133,6 +138,7 @@ labelPRBasedOnFilePath:
133138
- packages/parameters/package.json
134139
- packages/idempotency/package.json
135140
- packages/parser/package.json
141+
- packages/event-handler/package.json
136142
- packages/validator/package.json
137143
- packages/batch/package.json
138144
- layers/package.json

.github/scripts/release_patch_package_json.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ if (process.argv.length < 3) {
1717
}
1818
const basePath = resolve(process.argv[2]);
1919
const packageJsonPath = join(basePath, 'package.json');
20-
const alphaPackages = [];
20+
const alphaPackages = [
21+
'@aws-lambda-powertools/event-handler'
22+
];
2123
const betaPackages = [];
2224

2325
(() => {

.github/semantic.yml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ scopes:
2222
- commons
2323
- parser
2424
- jmespath
25+
- event-handler
2526
- validation
2627
- batch
2728
- layers

.github/workflows/ossf_scorecard.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
persist-credentials: false
2828

2929
- name: "Run analysis"
30-
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
30+
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
3131
with:
3232
results_file: results.sarif
3333
results_format: sarif
@@ -43,6 +43,6 @@ jobs:
4343

4444
# Upload the results to GitHub's code scanning dashboard.
4545
- name: "Upload to code-scanning"
46-
uses: github/codeql-action/upload-sarif@5cf07d8b700b67e235fbb65cbc84f69c0cf10464 # v3.25.14
46+
uses: github/codeql-action/upload-sarif@afb54ba388a7dca6ecae48f608c4ff05ff4cc77a # v3.25.15
4747
with:
4848
sarif_file: results.sarif

.github/workflows/reusable-run-linting-check-and-unit-tests.yml

+22-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,29 @@ jobs:
2828
with:
2929
nodeVersion: ${{ matrix.version }}
3030
- name: Run linting
31-
run: npm run lint -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency -w packages/batch -w packages/jmespath -w packages/parser
31+
run: |
32+
npm run lint -w packages/commons \
33+
-w packages/logger \
34+
-w packages/tracer \
35+
-w packages/metrics \
36+
-w packages/parameters \
37+
-w packages/idempotency \
38+
-w packages/batch \
39+
-w packages/jmespath \
40+
-w packages/parser \
41+
-w packages/event-handler
3242
- name: Run unit tests
33-
run: npm t -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency -w packages/batch -w packages/jmespath -w packages/parser
43+
run: |
44+
npm t -w packages/commons \
45+
-w packages/logger \
46+
-w packages/tracer \
47+
-w packages/metrics \
48+
-w packages/parameters \
49+
-w packages/idempotency \
50+
-w packages/batch \
51+
-w packages/jmespath \
52+
-w packages/parser \
53+
-w packages/event-handler
3454
check-examples:
3555
runs-on: ubuntu-latest
3656
env:

.gitpod.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ tasks:
99
npm run setup-local
1010
vscode:
1111
extensions:
12-
- dbaeumer.vscode-eslint
13-
- esbenp.prettier-vscode
12+
- biomejs.biome
1413
- firsttris.vscode-jest-runner

.husky/pre-push

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ npm t \
66
-w packages/tracer \
77
-w packages/idempotency \
88
-w packages/parameters \
9-
-w packages/parser
9+
-w packages/parser \
10+
-w packages/event-handler

.prettierrc

-8
This file was deleted.

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ You might find useful to run both the documentation website and the API referenc
126126
| Category | Convention |
127127
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
128128
| **Docstring** | We use [TypeDoc](https://typedoc.org) annotations to help generate more readable API references. For public APIs, we always include at least one **Example** to ease everyone's experience when using an IDE. |
129-
| **Style guide** | We use [Eslint](https://eslint.org) and [Prettier](https://prettier.io) to enforce beyond good practices. We use TypeScript types, function return types, and access modifiers to convey intent. |
129+
| **Style guide** | We use [Biome](http://biomejs.dev) to enforce style and format beyond good practices. We use TypeScript types, function return types, and access modifiers to convey intent. |
130130
| **Core utilities** | Core utilities always accept `serviceName` as a constructor parameter, can work in isolation, and are also available in other languages implementation. |
131131
| **Utilities** | Utilities are not as strict as core and focus on community needs: development productivity, industry leading practices, etc. Both core and general utilities follow our [Tenets](https://docs.powertools.aws.dev/lambda/typescript/#tenets). |
132132
| **Errors** | Specific errors thrown by Powertools live within utilities themselves and use `Error` suffix e.g. `IdempotencyKeyError`. |

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Knowing which companies are using this library is important to help prioritize t
6060
The following companies, among others, use Powertools:
6161

6262
- [Hashnode](https://hashnode.com/)
63+
- [Caylent](https://caylent.com/)
6364
- [Trek10](https://www.trek10.com/)
6465
- [Elva](https://elva-group.com)
6566
- [globaldatanet](https://globaldatanet.com/)

docs/contributing/conventions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ As we gather more concrete examples, this page will have one section for each ca
1414
| Category | Convention |
1515
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1616
| **Docstring** | We use [TypeDoc](https://typedoc.org){target="_blank"} annotations to help generate more readable API references. For public APIs, we always include at least one **Example** to ease everyone's experience when using an IDE. |
17-
| **Style guide** | We use [Eslint](https://eslint.org){target="_blank"} and [Prettier](https://prettier.io){target="_blank"} to enforce beyond good practices. We use TypeScript types, function return types, and access modifiers to convey intent. |
17+
| **Style guide** | We use [Biome](http://biomejs.dev){target="_blank"} for linting and formatting to enforce beyond good practices. We use TypeScript types, function return types, and access modifiers to convey intent. |
1818
| **Core utilities** | Core utilities always accept `serviceName` as a constructor parameter, can work in isolation, and are also available in other languages implementation. |
1919
| **Utilities** | Utilities are not as strict as core and focus on community needs: development productivity, industry leading practices, etc. Both core and general utilities follow our [Tenets](https://docs.powertools.aws.dev/lambda/typescript/#tenets){target="_blank"}. |
2020
| **Errors** | Specific errors thrown by Powertools live within utilities themselves and use `Error` suffix e.g. `IdempotencyKeyError`. |
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: REST API
3+
description: Core utility
4+
---
5+
6+
<!-- markdownlint-disable MD013 -->
7+
???+ warning "Don't use in production (yet)"
8+
This feature is currently under development. As such it's considered not stable and we might make significant breaking changes before going [before its release](https://github.com/aws-powertools/powertools-lambda-typescript/milestone/17){target="_blank"}. You are welcome to [provide feedback](https://github.com/aws-powertools/powertools-lambda-typescript/issues/413){target="_blank"} and [contribute to the project](../../contributing/getting_started.md){target="_blank"}.
9+
10+
Event handler for Amazon API Gateway REST and HTTP APIs, Application Loader Balancer (ALB), Lambda Function URLs, and VPC Lattice.
11+
12+
## Key Features
13+
14+
* Lightweight routing to reduce boilerplate for API Gateway REST/HTTP API, ALB and Lambda Function URLs.
15+
* Support for CORS, binary and Gzip compression, Decimals JSON encoding and bring your own JSON serializer
16+
* Built-in integration with [Parser](../../utilities/parser.md){target="_blank"} for easy payload validation and parsing
17+
* Works with micro function (one or a few routes) and monolithic functions (all routes)
18+
19+
## Getting started
20+
21+
???+ tip
22+
All examples shared in this documentation are available within the [project repository](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples/snippets/event-handler){target="_blank"}.
23+
24+
### Install
25+
26+
```shell
27+
npm install @aws-lambda-powertools/event-handler
28+
```
29+
30+
### Required resources
31+
32+
If you're using any API Gateway integration, you must have an existing [API Gateway Proxy integration](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html){target="_blank"} or [ALB](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html){target="_blank"} configured to invoke your Lambda function.
33+
34+
In case of using [VPC Lattice](https://docs.aws.amazon.com/lambda/latest/dg/services-vpc-lattice.html){target="_blank"}, you must have a service network configured to invoke your Lambda function.
35+
36+
This is the sample infrastructure for API Gateway and Lambda Function URLs we are using for the examples in this documentation.
37+
38+
???+ info "There is no additional permissions or dependencies required to use this utility."
39+
40+
=== "API Gateway SAM Template"
41+
42+
```yaml title="AWS Serverless Application Model (SAM) example"
43+
--8<-- "examples/snippets/event-handler/rest/templates/template.yaml"
44+
```
45+
46+
=== "Lambda Function URL SAM Template"
47+
48+
```yaml title="AWS Serverless Application Model (SAM) example"
49+
--8<-- "examples/event_handler_lambda_function_url/sam/template.yaml"
50+
```
51+
52+
<!-- remove line below while editing this doc & put it back until the doc has reached its first draft -->
53+
<!-- markdownlint-disable MD043 -->

docs/index.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ Knowing which companies are using this library is important to help prioritize t
387387
[**Hashnode**](https://hashnode.com/){target="_blank" rel="nofollow"}
388388
{ .card }
389389

390+
[**Caylent**](https://caylent.com/){target="_blank" rel="nofollow"}
391+
{ .card }
392+
390393
[**Trek10)**](https://www.trek10.com/){target="_blank" rel="nofollow"}
391394
{ .card }
392395

@@ -414,7 +417,13 @@ Knowing which companies are using this library is important to help prioritize t
414417
[**AppYourself**](https://appyourself.net){target="_blank" rel="nofollow"}
415418
{ .card }
416419

417-
[**Alma Media**](https://www.almamedia.fi/en/){target="_blank" rel="nofollow}
420+
[**Alma Media**](https://www.almamedia.fi/en/){target="_blank" rel="nofollow"}
421+
{ .card }
422+
423+
[**Banxware**](https://www.banxware.com){target="_blank" rel="nofollow"}
424+
{ .card }
425+
426+
[**WeSchool**](https://www.weschool.com){target="_blank" rel="nofollow"}
418427
{ .card }
419428

420429
</div>

0 commit comments

Comments
 (0)