Skip to content

Commit 4533572

Browse files
committed
Merge branch 'main' into feat/parser
2 parents ebf75c6 + 004894a commit 4533572

File tree

91 files changed

+3145
-1000
lines changed

Some content is hidden

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

91 files changed

+3145
-1000
lines changed

.github/scripts/setup_tmp_layer_files.sh

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

.github/scripts/update_layer_arn.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ for file in $files; do
5656
# arn:aws:lambda:{env.region}:094274105915:layer:AWSLambdaPowertoolsTypeScript:39
5757
if [[ "$line" == *"eu-central-1"* ]]; then
5858
# These are all the framework pseudo parameters currently found in the docs
59-
for pseudo_region in '{region}' '${AWS::Region}' '${aws::region}' '{aws::region}' '{env.region}' '${cdk.Stack.of(this).region}' '${aws.getRegionOutput().name}'; do
59+
for pseudo_region in '{region}' '${AWS::Region}' '${aws:region}' '{aws::region}' '{env.region}' '${cdk.Stack.of(this).region}' '${aws.getRegionOutput().name}'; do
6060
prefix_pseudo_region=$(echo "$prefix" | sed "s/eu-central-1/${pseudo_region}/")
6161
# prefix_pseudo_region = arn:aws:lambda:${AWS::Region}:094274105915:layer:AWSLambdaPowertoolsTypeScript
6262

.github/workflows/make-v2-release.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Make Release v2 (pre-release)
2+
on:
3+
workflow_dispatch: {}
4+
concurrency:
5+
group: on-release-publish
6+
jobs:
7+
run-unit-tests:
8+
uses: ./.github/workflows/reusable-run-linting-check-and-unit-tests.yml
9+
publish-npm:
10+
needs: run-unit-tests
11+
# Needed as recommended by npm docs on publishing with provenance https://docs.npmjs.com/generating-provenance-statements
12+
permissions:
13+
id-token: write
14+
contents: write
15+
runs-on: ubuntu-latest
16+
outputs:
17+
RELEASE_VERSION: ${{ steps.set-release-version.outputs.RELEASE_VERSION }}
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
21+
- name: Setup NodeJS
22+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
23+
with:
24+
node-version: '18'
25+
cache: 'npm'
26+
- name: Setup auth tokens
27+
run: |
28+
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
29+
- name: Setup dependencies
30+
uses: ./.github/actions/cached-node-modules
31+
- name: Version
32+
run: |
33+
# Version all packages to next major version (2.0.0) without pushing to git, generating changelog or running commit hooks
34+
# Since the version stored in the lerna.json will always be a 1.x.x version, we manually set the version to 2.0.0
35+
npx lerna version major --force-publish --no-push --no-git-tag-version --no-commit-hooks --no-changelog --yes
36+
- name: Set alpha iteration
37+
run: |
38+
# Get the current alpha version from npm i.e 2.0.0-alpha.0 -> 0, 2.0.0-alpha.1 -> 1 (default to -1 if no alpha versions exist = first pre-release)
39+
ITERATION=$(npm show @aws-lambda-powertools/commons time --json | jq -r 'to_entries | map(select(.key | startswith("2.0.0-alpha"))) | sort_by(.key) | last | .key // "-1"')
40+
# Write the new version to the file
41+
echo "{ \"iteration\": $((ITERATION + 1)) }" > v2.json
42+
- name: Increment version in UA
43+
run: |
44+
# Increment the version in the UA
45+
echo "// this file is auto generated, do not modify\nexport const PT_VERSION = '2.0.0-alpha.$(jq -r '.iteration' v2.json)';" > packages/commons/src/version.ts
46+
- name: Build
47+
run: |
48+
npm run build:prod -w packages/batch \
49+
-w packages/commons \
50+
-w packages/idempotency \
51+
-w packages/logger \
52+
-w packages/metrics \
53+
-w packages/parameters \
54+
-w packages/tracer
55+
- name: Pack packages
56+
run: |
57+
npm pack -w packages/batch \
58+
-w packages/commons \
59+
-w packages/idempotency \
60+
-w packages/logger \
61+
-w packages/metrics \
62+
-w packages/parameters \
63+
-w packages/tracer
64+
- name: Publish to npm
65+
run: |
66+
npm publish aws-lambda-powertools-batch-*.tgz --tag next --provenance
67+
npm publish aws-lambda-powertools-commons-*.tgz --tag next --provenance
68+
npm publish aws-lambda-powertools-idempotency-*.tgz --tag next --provenance
69+
npm publish aws-lambda-powertools-logger-*.tgz --tag next --provenance
70+
npm publish aws-lambda-powertools-metrics-*.tgz --tag next --provenance
71+
npm publish aws-lambda-powertools-parameters-*.tgz --tag next --provenance
72+
npm publish aws-lambda-powertools-tracer-*.tgz --tag next --provenance
73+
- name: Set release version
74+
id: set-release-version
75+
run: |
76+
VERSION="2.0.0-alpha.$(cat v2.json | jq .iteration -r)"
77+
echo RELEASE_VERSION="$VERSION" >> "$GITHUB_OUTPUT"

.github/workflows/publish_layer.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ jobs:
4242
node-version: "18"
4343
- name: Setup dependencies
4444
uses: ./.github/actions/cached-node-modules
45-
- name: Create layer files
46-
run: |
47-
export VERSION=${{ inputs.latest_published_version }}
48-
bash .github/scripts/setup_tmp_layer_files.sh
4945
- name: CDK build
5046
run: npm run cdk -w layers -- synth --context PowertoolsPackageVersion=${{ inputs.latest_published_version }} -o cdk.out
5147
- name: Zip output

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ jobs:
6969
uses: ./.github/actions/cached-node-modules
7070
- name: Run linting
7171
run: npm run lint -w layers
72-
- name: Create layer files
73-
run: |
74-
export VERSION=latest
75-
bash .github/scripts/setup_tmp_layer_files.sh
7672
- name: Run tests
7773
run: npm run test:unit -w layers
7874
check-docs-snippets:

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

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
prNumber:
7-
description: "(Optional) PR Number. If you specify a value the value of the branch field will be ignored."
7+
description: '(Optional) PR Number. If you specify a value the value of the branch field will be ignored.'
88
required: false
9-
default: ""
9+
default: ''
1010

1111
jobs:
1212
run-e2e-tests-on-utils:
@@ -19,12 +19,21 @@ jobs:
1919
contents: read
2020
strategy:
2121
matrix:
22-
package: [layers, packages/logger, packages/metrics, packages/tracer, packages/parameters, packages/idempotency]
22+
package:
23+
[
24+
layers,
25+
packages/logger,
26+
packages/metrics,
27+
packages/tracer,
28+
packages/parameters,
29+
packages/idempotency,
30+
]
2331
version: [14, 16, 18]
32+
arch: [x86_64, arm64]
2433
fail-fast: false
2534
steps:
2635
- name: Checkout Repo
27-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
36+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
2837
# If we pass a PR Number when triggering the workflow we will retrieve the PR info and get its headSHA
2938
- name: Extract PR details
3039
id: extract_PR_details
@@ -38,7 +47,7 @@ jobs:
3847
# we checkout the PR at that point in time
3948
- name: Checkout PR code
4049
if: ${{ inputs.prNumber != '' }}
41-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
50+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
4251
with:
4352
ref: ${{ steps.extract_PR_details.outputs.headSHA }}
4453
- name: Setup NodeJS
@@ -55,14 +64,10 @@ jobs:
5564
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
5665
aws-region: eu-west-1
5766
mask-aws-account-id: true
58-
- name: Create layer files
59-
if: ${{ matrix.package == 'layers' }}
60-
run: |
61-
export VERSION=latest
62-
bash .github/scripts/setup_tmp_layer_files.sh
6367
- name: Run integration tests on utils
6468
env:
6569
RUNTIME: nodejs${{ matrix.version }}x
6670
CI: true
71+
ARCH: ${{ matrix.arch }}
6772
JSII_SILENCE_WARNING_DEPRECATED_NODE_VERSION: true
6873
run: npm run test:e2e -w ${{ matrix.package }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
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+
## [1.13.1](https://github.com/aws-powertools/powertools-lambda-typescript/compare/v1.13.0...v1.13.1) (2023-09-21)
7+
8+
### Bug Fixes
9+
10+
- **maintenance:** remove upper peer dependency Middy ([#1705](https://github.com/aws-powertools/powertools-lambda-typescript/issues/1705)) ([df21ec8](https://github.com/aws-powertools/powertools-lambda-typescript/commit/df21ec8761b1be511c13c28fedd41bf0e2851061))
11+
612
# [1.13.0](https://github.com/aws-powertools/powertools-lambda-typescript/compare/v1.12.1...v1.13.0) (2023-09-18)
713

814
### Bug Fixes

docs/core/tracer.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,22 @@ When using the `captureLambdaHandler` decorator or middleware, Tracer performs t
129129
=== "Annotations"
130130
You can add annotations using `putAnnotation` method.
131131

132-
```typescript hl_lines="9"
132+
```typescript hl_lines="12"
133133
--8<-- "docs/snippets/tracer/putAnnotation.ts"
134134
```
135+
136+
1. When Lambda starts an invocation [the X-Ray SDk creates a segment called `facade`](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-subsegments.html#xray-sdk-nodejs-subsegments-lambda). This segment cannot be annotated or modified by your code, so you need to create a new subsegment. This is done automatically by Tracer when using the [decorator or middleware patterns](./tracer.md/#lambda-handler)
137+
2. To correctly trace the current and subsequent invocations you need to restore the original segment, this is done automatically by Tracer when using the [decorator or middleware patterns](./tracer.md/#lambda-handler).
135138
=== "Metadata"
136139
You can add metadata using `putMetadata` method.
137140

138-
```typescript hl_lines="9-11"
141+
```typescript hl_lines="12-14"
139142
--8<-- "docs/snippets/tracer/putMetadata.ts"
140143
```
141144

145+
1. When Lambda starts an invocation [the X-Ray SDk creates a segment called `facade`](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-subsegments.html#xray-sdk-nodejs-subsegments-lambda). This segment cannot be modified by your code, so you need to create a new subsegment. This is done automatically by Tracer when using the [decorator or middleware patterns](./tracer.md/#lambda-handler)
146+
2. To correctly trace the current and subsequent invocations you need to restore the original segment, this is done automatically by Tracer when using the [decorator or middleware patterns](./tracer.md/#lambda-handler).
147+
142148
<figure>
143149
<img src="../../media/tracer_utility_showcase_2.png" loading="lazy" alt="Screenshot of the Amazon CloudWatch Console showing an example of segments and subsegments generated and with metadata set for the handler"/>
144150
<figcaption>Tracer showcase - Handler Metadata</figcaption>

0 commit comments

Comments
 (0)