Skip to content

Commit d751cb3

Browse files
committed
Merge branch 'main' into feat/parser
2 parents 0012f92 + 92193e7 commit d751cb3

File tree

197 files changed

+17545
-4300
lines changed

Some content is hidden

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

197 files changed

+17545
-4300
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ runs:
4545
npm run build -w packages/parameters & \
4646
npm run build -w packages/idempotency & \
4747
npm run build -w packages/batch & \
48-
npm run build -w packages/testing
48+
npm run build -w packages/testing & \
49+
npm run build -w packages/jmespath
4950
shell: bash

.github/boring-cyborg.yml

+3-20
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,7 @@ labelPRBasedOnFilePath:
7171
- docs/**/*
7272
- mkdocs.yml
7373
- typedoc.js
74-
- examples/cdk/bin/*
75-
- examples/cdk/functions/*
76-
- examples/cdk/functions/**/*
77-
- examples/cdk/src/*
78-
- examples/cdk/src/**/*
79-
- examples/cdk/tests/*
80-
- examples/cdk/tests/**/*
81-
- examples/cdk/README.md
82-
- examples/cdk/cdk.json
83-
- examples/sam/events/*
84-
- examples/sam/src/*
85-
- examples/sam/src/**/*
86-
- examples/sam/tests/*
87-
- examples/sam/tests/**/*
88-
- examples/sam/README.md
89-
- examples/sam/template.yaml
74+
- examples/app/*
9075

9176
area/automation:
9277
- .github/scripts/*
@@ -137,8 +122,7 @@ labelPRBasedOnFilePath:
137122
- packages/parser/README.md
138123
- layers/tsconfig*.json
139124
- layers/README.md
140-
- examples/sam/tsconfig*.json
141-
- examples/cdk/tsconfig*.json
125+
- examples/app/tsconfig*.json
142126

143127
type/dependencies:
144128
- package.json
@@ -153,8 +137,7 @@ labelPRBasedOnFilePath:
153137
- packages/validator/package.json
154138
- packages/batch/package.json
155139
- layers/package.json
156-
- examples/cdk/package.json
157-
- examples/sam/package.json
140+
- examples/app/package.json
158141

159142
##### Greetings ########################################################################################################
160143
firstPRWelcomeComment: >

.github/workflows/dependency-review.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: 'Checkout Repository'
20-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
20+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
2121
- name: 'Dependency Review'
22-
uses: actions/dependency-review-action@9129d7d40b8c12c1ed0f60400d00c92d437adcce # v4.1.3
22+
uses: actions/dependency-review-action@5bbc3ba658137598168acb2ab73b21c432dd411b # v4.2.5

.github/workflows/label_pr_on_title.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
pull-requests: write # label respective PR
5050
steps:
5151
- name: Checkout repository
52-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
52+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
5353
- name: "Label PR based on title"
5454
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5555
env:

.github/workflows/make-release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
RELEASE_VERSION: ${{ steps.set-release-version.outputs.RELEASE_VERSION }}
4646
steps:
4747
- name: Checkout code
48-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
48+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
4949
with:
5050
ref: ${{ github.sha }}
5151
- name: Setup NodeJS
@@ -75,7 +75,7 @@ jobs:
7575
runs-on: ubuntu-latest
7676
steps:
7777
- name: Checkout code
78-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
78+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
7979
with:
8080
ref: ${{ github.sha }}
8181
- name: Git client setup

.github/workflows/make-version.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
RELEASE_VERSION: ${{ steps.set-release-version.outputs.RELEASE_VERSION }}
1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
21+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
2222
with:
2323
ref: ${{ github.ref }}
2424
- name: Setup NodeJS

.github/workflows/on_merged_pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
issues: write # label issue with pending-release
5050
if: needs.get_pr_details.outputs.prIsMerged == 'true'
5151
steps:
52-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
52+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
5353
- name: "Label PR related issue for release"
5454
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5555
env:

.github/workflows/on_opened_pr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
needs: get_pr_details
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
50+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
5151
- name: "Ensure related issue is present"
5252
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5353
env:
@@ -66,7 +66,7 @@ jobs:
6666
permissions:
6767
pull-requests: write # label and comment on PR if missing acknowledge section (requirement)
6868
steps:
69-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
69+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
7070
- name: "Ensure acknowledgement section is present"
7171
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
7272
env:

.github/workflows/ossf_scorecard.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: "Checkout code"
25-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
25+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
2626
with:
2727
persist-credentials: false
2828

@@ -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@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
46+
uses: github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
4747
with:
4848
sarif_file: results.sarif

.github/workflows/post-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
env:
2727
RELEASE_VERSION: ${{ inputs.versionNumber }}
2828
steps:
29-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
29+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3030
- name: Get release version
3131
run: |
3232
# The code below does the following:

.github/workflows/publish_layer.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
if: ${{ (github.event.workflow_run.conclusion == 'success') || (github.event_name == 'workflow_dispatch') }}
3232
steps:
3333
- name: checkout
34-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
34+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3535
with:
3636
ref: ${{ github.sha }}
3737
- name: Setup Node.js
@@ -93,7 +93,7 @@ jobs:
9393
id-token: none
9494
steps:
9595
- name: Checkout repository # reusable workflows start clean, so we need to checkout again
96-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
96+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
9797
with:
9898
ref: ${{ github.sha }}
9999
- name: Download CDK layer artifacts

.github/workflows/record_pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
permissions:
4747
contents: read # NOTE: treat as untrusted location
4848
steps:
49-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
49+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
5050
- name: "Extract PR details"
5151
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5252
with:

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
20+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
2121
- name: Setup NodeJS
2222
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
2323
with:
@@ -28,23 +28,23 @@ 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
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
3232
- 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
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
3434
check-examples:
3535
runs-on: ubuntu-latest
3636
env:
3737
NODE_ENV: dev
3838
strategy:
3939
matrix:
40-
example: ["sam", "cdk"]
40+
example: ["app"]
4141
fail-fast: false
4242
defaults:
4343
run:
4444
working-directory: examples/${{ matrix.example }}
4545
steps:
4646
- name: Checkout code
47-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
47+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
4848
- name: Setup NodeJS
4949
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
5050
with:
@@ -62,7 +62,7 @@ jobs:
6262
NODE_ENV: dev
6363
steps:
6464
- name: Checkout code
65-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
65+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
6666
- name: Setup NodeJS
6767
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
6868
with:
@@ -80,7 +80,7 @@ jobs:
8080
NODE_ENV: dev
8181
steps:
8282
- name: Checkout code
83-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
83+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
8484
- name: Setup NodeJS
8585
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
8686
with:

.github/workflows/reusable_deploy_layer_stack.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
]
6363
steps:
6464
- name: checkout
65-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
65+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
6666
- name: aws credentials
6767
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
6868
with:

.github/workflows/reusable_export_pr_details.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
prLabels: ${{ steps.prLabels.outputs.prLabels }}
7676
steps:
7777
- name: Checkout repository # in case caller workflow doesn't checkout thus failing with file not found
78-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
78+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
7979
- name: "Download previously saved PR"
8080
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
8181
env:

.github/workflows/reusable_publish_docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
id-token: write # trade JWT token for AWS credentials in AWS Docs account
5151
steps:
5252
- name: Checkout code
53-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
53+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
5454
- name: Setup NodeJS
5555
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
5656
with:
@@ -59,7 +59,7 @@ jobs:
5959
- name: Setup dependencies
6060
uses: ./.github/actions/cached-node-modules
6161
- name: Set up Python
62-
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
62+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
6363
with:
6464
python-version: "3.12"
6565
- name: Install doc generation dependencies

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
fail-fast: false
3737
steps:
3838
- name: Checkout Repo
39-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
39+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
4040
# If we pass a PR Number when triggering the workflow we will retrieve the PR info and get its headSHA
4141
- name: Extract PR details
4242
id: extract_PR_details
@@ -50,7 +50,7 @@ jobs:
5050
# we checkout the PR at that point in time
5151
- name: Checkout PR code
5252
if: ${{ inputs.prNumber != '' }}
53-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
53+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
5454
with:
5555
ref: ${{ steps.extract_PR_details.outputs.headSHA }}
5656
- name: Setup NodeJS

.github/workflows/secure-workflows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
contents: read # checkout code and subsequently GitHub action workflows
3131
steps:
3232
- name: Checkout code
33-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
33+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3434
- name: Ensure 3rd party workflows have SHA pinned
3535
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@ba37328d4ea95eaf8b3bd6c6cef308f709a5f2ec # v3.0.3
3636
with:

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ site
4141
# Generated API documentation (from TypeDoc)
4242
/api
4343

44-
# SAM Example copies files
45-
/examples/sam/src/handlers/*
46-
!/examples/sam/src/handlers/COPY_LAMBDA_FUNCTIONS_HERE
47-
4844
# Layer temp files
4945
tmp
5046

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
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.0.3 (2024-03-15)
7+
8+
**feat(logger):** improve regex in stack trace parsing ([#2121](https://github.com/aws-powertools/powertools-lambda-typescript/issues/2121)) ([ebe5eef](https://github.com/aws-powertools/powertools-lambda-typescript/commit/ebe5eef3319fc95070c2c33c0ac64b8e42443b38))
9+
**fix(idempotency):** transform private class fields ([#2230](https://github.com/aws-powertools/powertools-lambda-typescript/issues/2230)) ([aa6e6e0](https://github.com/aws-powertools/powertools-lambda-typescript/commit/aa6e6e0c25bbc93151cc5cddc584400575604f05))
10+
**improv(commons):**: expand type utils functions ([#2191](https://github.com/aws-powertools/powertools-lambda-typescript/issues/2191)) ([9208393](https://github.com/aws-powertools/powertools-lambda-typescript/commit/9208393fe07d33cb35ea479b3c0866c8a7b91a21))
11+
**feat(commons):** add fromBase64 helper function ([#2188](https://github.com/aws-powertools/powertools-lambda-typescript/issues/2188)) ([133159b](https://github.com/aws-powertools/powertools-lambda-typescript/commit/133159ba4cca41a61c14d62f9356bb89a7f0a08f))
12+
**fix(layers):**: add createRequire banner in esm build ([#2231](https://github.com/aws-powertools/powertools-lambda-typescript/issues/2231)) ([730bcc9](https://github.com/aws-powertools/powertools-lambda-typescript/commit/730bcc93c027f4d60788badb6c5c01a09b3c70be))
13+
614
## 2.0.2 (2024-03-05)
715

816

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ Or refer to the installation guide of each utility:
8484

8585
### Examples
8686

87-
* [CDK](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples/cdk)
88-
* [SAM](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples/sam)
87+
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) directory. The application is a simple REST API that can be deployed via either AWS CDK or AWS SAM.
8988

9089
### Demo applications
9190

docs/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# version 9.5.2
2-
FROM squidfunk/mkdocs-material@sha256:3678304a65e17660953a30c0a0be0bc2fb8f55ac450216c14af6ba942badc4dc
2+
FROM squidfunk/mkdocs-material@sha256:065f3afa6121fba3a02d03c8f393610e1a2de837548e349b884c02779e6196e5
33

44
ADD requirements.txt /tmp/
55
RUN pip install --require-hashes -r /tmp/requirements.txt

docs/contributing/conventions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Whenever possible, we use the same directory structure for all utilities. This m
3131
There are also a few other workspaces that are not utilities published to npm, but that still share dependencies and/or runtime code with the utilities. These workspaces are:
3232

3333
* `docs/snippets`: contains the documentation code snippets
34-
* `examples/*`: contains the example projects deployed via AWS CDK or AWS SAM
34+
* `examples/app`: contains an example project that can be deployed via AWS CDK or AWS SAM
3535
* `layers`: contains the code used to build and publish the [Lambda layers](../index.md#lambda-layer)
3636

3737
## Testing definition

docs/core/metrics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ You can add default dimensions to your metrics by passing them as parameters in
200200
=== "Middy middleware"
201201

202202
!!! tip "A note about Middy"
203-
Currently we support only Middy `v3.x` that you can install it by running `npm i @middy/core@~3`.
203+
Currently we support up to Middy `v4.x` that you can install it by running `npm i @middy/core@~4`.
204204
Check their docs to learn more about [Middy and its middleware stack](https://middy.js.org/docs/intro/getting-started){target="_blank"} as well as [best practices when working with Powertools](https://middy.js.org/docs/integrations/lambda-powertools#best-practices){target="_blank"}.
205205

206206
```typescript hl_lines="24-26"

docs/core/tracer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The library has three optional settings. You can set them as environment variabl
5555
| **Capture Errors** | Defines whether functions errors are serialized as metadata | `POWERTOOLS_TRACER_CAPTURE_ERROR` | `true` | `true` or `false` | `false` | N/A |
5656

5757
!!! note
58-
Before your use this utility, your AWS Lambda function must have [Active Tracing enabled](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html) as well as [have permissions](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-permissions) to send traces to AWS X-Ray
58+
Before you use this utility, your AWS Lambda function must have [Active Tracing enabled](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html) as well as [have permissions](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-permissions) to send traces to AWS X-Ray
5959

6060
#### Example using AWS Serverless Application Model (SAM)
6161

0 commit comments

Comments
 (0)