Skip to content

Commit eb3613e

Browse files
committed
chore: merge
2 parents 937c716 + 619dd2b commit eb3613e

File tree

95 files changed

+3673
-2208
lines changed

Some content is hidden

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

95 files changed

+3673
-2208
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/v0.212.0/containers/javascript-node/.devcontainer/base.Dockerfile
2-
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node@sha256:2ac7b2c5874c894d1589ab92d7d0fed0285063d3f9bfa0db1aeb8162fa2a89df
2+
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node@sha256:e2228dfc5285942804c12b897f914e3262e9bba48c2ff473bad8b9fbd9bf7d26
33

44
# Install fnm to manage Node.js versions
55
RUN curl -fsSL https://fnm.vercel.app/install -o /tmp/install \

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

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/make-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
run: |
5858
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
5959
- name: Setup dependencies
60-
uses: ./.github/actions/cached-node-modules
60+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
6161
- name: Publish to npm
6262
run: |
6363
NPM_CONFIG_PROVENANCE=true npx lerna publish from-package --git-head ${{ github.sha }} --yes

.github/workflows/make-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
node-version: "20"
2929
cache: "npm"
3030
- name: Setup dependencies
31-
uses: ./.github/actions/cached-node-modules
31+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
3232
- name: Version
3333
id: bump-version
3434
run: npx lerna version --conventional-commits --no-git-tag-version --no-push --no-commit-hooks --yes

.github/workflows/ossf_scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ jobs:
3535
# repo_token: ${{ secrets.SCORECARD_TOKEN }} # read-only fine-grained token to read branch protection settings
3636

3737
- name: "Upload results"
38-
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
38+
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
3939
with:
4040
name: SARIF file
4141
path: results.sarif
4242
retention-days: 5
4343

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

.github/workflows/publish_layer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ jobs:
3939
with:
4040
node-version: "20"
4141
- name: Setup dependencies
42-
uses: ./.github/actions/cached-node-modules
42+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
4343
- name: CDK build
4444
run: npm run cdk -w layers -- synth --context PowertoolsPackageVersion=${{ inputs.latest_published_version }} -o cdk.out
4545
- name: Zip output
4646
run: zip -r cdk.out.zip layers/cdk.out
4747
- name: Archive CDK artifacts
48-
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
48+
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
4949
with:
5050
name: cdk-layer-artifact
5151
path: cdk.out.zip

.github/workflows/record_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
script: |
5454
const script = require('.github/scripts/save_pr_details.js')
5555
await script({github, context, core})
56-
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
56+
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
5757
with:
5858
name: pr
5959
path: pr.txt

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

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,31 @@ permissions:
77
contents: read
88

99
jobs:
10+
code-quality:
11+
runs-on: ubuntu-latest
12+
env:
13+
NODE_ENV: dev
14+
strategy:
15+
matrix:
16+
version: [18, 20]
17+
workspace: ["packages/batch"]
18+
fail-fast: false
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
22+
- name: Setup NodeJS
23+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
24+
with:
25+
node-version: ${{ matrix.version }}
26+
cache: "npm"
27+
- name: Setup dependencies
28+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
29+
with:
30+
nodeVersion: ${{ matrix.version }}
31+
- name: Linting
32+
run: npm run lint -w ${{ matrix.workspace }}
33+
- name: Unit tests
34+
run: npm run test:unit:coverage -w ${{ matrix.workspace }}
1035
run-linting-check-and-unit-tests-on-utilities:
1136
runs-on: ubuntu-latest
1237
env:
@@ -24,7 +49,7 @@ jobs:
2449
node-version: ${{ matrix.version }}
2550
cache: "npm"
2651
- name: Setup dependencies
27-
uses: ./.github/actions/cached-node-modules
52+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
2853
with:
2954
nodeVersion: ${{ matrix.version }}
3055
- name: Run linting
@@ -71,7 +96,7 @@ jobs:
7196
node-version: 20
7297
cache: "npm"
7398
- name: Setup dependencies
74-
uses: ./.github/actions/cached-node-modules
99+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
75100
- name: Run linting
76101
run: npm run lint
77102
- name: Run tests
@@ -89,7 +114,7 @@ jobs:
89114
node-version: 20
90115
cache: "npm"
91116
- name: Setup dependencies
92-
uses: ./.github/actions/cached-node-modules
117+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
93118
- name: Run linting
94119
run: npm run lint -w layers
95120
- name: Run tests
@@ -107,7 +132,7 @@ jobs:
107132
node-version: 20
108133
cache: "npm"
109134
- name: Setup dependencies
110-
uses: ./.github/actions/cached-node-modules
135+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
111136
- name: Run linting
112137
run: npm run lint -w examples/snippets
113138
check-docs:
@@ -123,6 +148,6 @@ jobs:
123148
node-version: 20
124149
cache: "npm"
125150
- name: Setup dependencies
126-
uses: ./.github/actions/cached-node-modules
151+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
127152
- name: Run linting
128153
run: npm run lint:markdown

.github/workflows/reusable_deploy_layer_stack.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
"us-west-2",
4242
"ap-east-1",
4343
"ap-south-1",
44+
"ap-south-2",
4445
"ap-northeast-1",
4546
"ap-northeast-2",
4647
"ap-northeast-3",
@@ -58,6 +59,7 @@ jobs:
5859
"eu-north-1",
5960
"sa-east-1",
6061
"me-south-1",
62+
"me-central-1",
6163
"il-central-1",
6264
]
6365
steps:
@@ -74,7 +76,7 @@ jobs:
7476
with:
7577
node-version: "20"
7678
- name: Setup dependencies
77-
uses: ./.github/actions/cached-node-modules
79+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
7880
- name: Download artifact
7981
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
8082
with:
@@ -91,7 +93,7 @@ jobs:
9193
cat cdk-layer-stack/${{ matrix.region }}-layer-version.txt
9294
- name: Save Layer ARN artifact
9395
if: ${{ inputs.stage == 'PROD' }}
94-
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
96+
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
9597
with:
9698
name: cdk-layer-stack-${{ matrix.region }}
9799
path: ./cdk-layer-stack/* # NOTE: upload-artifact does not inherit working-directory setting.

.github/workflows/reusable_publish_docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
node-version: "20"
5858
cache: "npm"
5959
- name: Setup dependencies
60-
uses: ./.github/actions/cached-node-modules
60+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
6161
- name: Set up Python
6262
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
6363
with:
@@ -96,7 +96,7 @@ jobs:
9696
run: |
9797
cp -r api site/
9898
- name: Create Artifact (Site)
99-
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
99+
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
100100
with:
101101
name: site
102102
path: site

.github/workflows/run-e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
with:
6060
node-version: '20'
6161
- name: Setup dependencies
62-
uses: ./.github/actions/cached-node-modules
62+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
6363
with:
6464
nodeVersion: '20'
6565
- name: Setup AWS credentials

.husky/pre-push

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ npm t \
77
-w packages/idempotency \
88
-w packages/parameters \
99
-w packages/parser \
10-
-w packages/event-handler
10+
-w packages/event-handler
11+
12+
npx vitest --run --coverage --changed="$(git merge-base HEAD main)"

.markdownlintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ LICENSE
1313
# these will be removed from the ignore and linted in future PRs
1414
packages/batch/README.md
1515
packages/commons/README.md
16-
packages/idempotency/README.md
1716
packages/jmespath/README.md
1817
packages/logger/README.md
1918
packages/metrics/README.md

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [2.7.0](https://github.com/aws-powertools/powertools-lambda-typescript/compare/v2.6.0...v2.7.0) (2024-08-08)
7+
8+
9+
### Bug Fixes
10+
11+
* **logger:** invalid time zone environment variables leads to error ([#2865](https://github.com/aws-powertools/powertools-lambda-typescript/issues/2865)) ([d55465f](https://github.com/aws-powertools/powertools-lambda-typescript/commit/d55465f937390f4511e837033db0dab582cf4e14))
12+
13+
14+
### Features
15+
16+
* **metrics:** add unit None for CloudWatch EMF Metrics ([#2904](https://github.com/aws-powertools/powertools-lambda-typescript/issues/2904)) ([fa27cba](https://github.com/aws-powertools/powertools-lambda-typescript/commit/fa27cba5ffdb9d123b25d206c189ad17eeb8b44b))
17+
* **parser:** add helper function to handle JSON stringified fields ([#2901](https://github.com/aws-powertools/powertools-lambda-typescript/issues/2901)) ([806b884](https://github.com/aws-powertools/powertools-lambda-typescript/commit/806b884f51684fa4654d357fafdf8ebeda4de01b))
18+
19+
20+
21+
22+
623
# [2.6.0](https://github.com/aws-powertools/powertools-lambda-typescript/compare/v2.5.0...v2.6.0) (2024-07-25)
724

825

docs/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# version 9.5.2
2-
FROM squidfunk/mkdocs-material@sha256:257eca88da7f42242cd05e8cebf6d10ebd079edc207b089ad3f4f1ad107b0348
2+
FROM squidfunk/mkdocs-material@sha256:9919d6ee948705ce6cd05e5bc0848af47de4f037afd7c3b91e776e7b119618a4
33

4-
ADD requirements.txt /tmp/
4+
COPY requirements.txt /tmp/
55
RUN pip install --require-hashes -r /tmp/requirements.txt

docs/core/event-handler/api-gateway.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ This is the sample infrastructure for API Gateway and Lambda Function URLs we ar
4040
=== "API Gateway SAM Template"
4141

4242
```yaml title="AWS Serverless Application Model (SAM) example"
43-
--8<-- "examples/snippets/event-handler/rest/templates/template.yaml"
43+
[//]: # ( --8<-- "examples/snippets/event-handler/rest/templates/template.yaml")
4444
```
4545

4646
=== "Lambda Function URL SAM Template"
4747

4848
```yaml title="AWS Serverless Application Model (SAM) example"
49-
--8<-- "examples/event_handler_lambda_function_url/sam/template.yaml"
49+
[//]: # ( --8<-- "examples/event_handler_lambda_function_url/sam/template.yaml")
5050
```
5151

5252
<!-- remove line below while editing this doc & put it back until the doc has reached its first draft -->

docs/core/logger.md

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,26 +160,48 @@ In each case, the printed log will look like this:
160160

161161
### Log incoming event
162162

163-
When debugging in non-production environments, you can instruct Logger to log the incoming event with the middleware/decorator parameter `logEvent`.
163+
When debugging in non-production environments, you can log the incoming event using the `logEventIfEnabled()` method or by setting the `logEvent` option in the `injectLambdaContext()` Middy.js middleware or class method decorator.
164164

165165
???+ warning
166166
This is disabled by default to prevent sensitive info being logged
167167

168-
=== "Middy Middleware"
168+
=== "`logEventIfEnabled()`"
169+
170+
```typescript hl_lines="1 8"
171+
--8<-- "examples/snippets/logger/logEventManual.ts"
172+
```
173+
174+
1. You can control the event logging via the `POWERTOOLS_LOGGER_LOG_EVENT` environment variable.
169175

170-
```typescript hl_lines="15"
171-
--8<-- "examples/snippets/logger/eventMiddy.ts"
176+
=== "Middy.js Middleware"
177+
178+
```typescript hl_lines="10"
179+
--8<-- "examples/snippets/logger/logEventMiddy.ts"
172180
```
173181

182+
1. The `logEvent` option takes precedence over the `POWERTOOLS_LOGGER_LOG_EVENT` environment variable.
183+
174184
=== "Decorator"
175185

176-
```typescript hl_lines="8"
177-
--8<-- "examples/snippets/logger/eventDecorator.ts"
186+
```typescript hl_lines="7"
187+
--8<-- "examples/snippets/logger/logEventDecorator.ts"
178188
```
179189

180-
1. Binding your handler method allows your handler to access `this` within the class methods.
190+
1. The `logEvent` option takes precedence over the `POWERTOOLS_LOGGER_LOG_EVENT` environment variable.
191+
192+
=== "payload.json"
193+
194+
```json
195+
--8<-- "examples/snippets/logger/samples/logEventInput.json"
196+
```
197+
198+
=== "CloudWatch output"
199+
200+
```json hl_lines="8 13-15"
201+
--8<-- "examples/snippets/logger/samples/logEventOutput.json"
202+
```
181203

182-
Use `POWERTOOLS_LOGGER_LOG_EVENT` environment variable to enable or disable (`true`/`false`) this feature.
204+
Use `POWERTOOLS_LOGGER_LOG_EVENT` environment variable to enable or disable (`true`/`false`) this feature. When using Middy.js middleware or class method decorator, the `logEvent` option will take precedence over the environment variable.
183205

184206
### Appending additional keys
185207

@@ -454,6 +476,7 @@ We support the following log levels:
454476

455477
| Level | Numeric value |
456478
| ---------- | ------------- |
479+
| `TRACE` | 6 |
457480
| `DEBUG` | 8 |
458481
| `INFO` | 12 |
459482
| `WARN` | 16 |

0 commit comments

Comments
 (0)