Skip to content

Commit 364ed19

Browse files
committed
update v1 and v2 type names to ApiGatewayV1 and ApiGatewayV2
1 parent 21ca074 commit 364ed19

File tree

12 files changed

+55
-48
lines changed

12 files changed

+55
-48
lines changed

.github/workflows/make-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Make Release
55
# === Automated activities ===
66
# 1. [Quality check] run unit tests, linting, examples, layer, doc snippets
77
# 2. [Release] publish all packages to npmjs.org using the latest git commit, ensure provenance with NPM_CONFIG_PROVENANCE=true
8-
# 3. [Create tag] create a new git tag using released version, i.e. v1.13.1
8+
# 3. [Create tag] create a new git tag using released version, i.e. ApiGatewayV1.13.1
99
# 4. [Publish layer] build and package layer, kick off the workflow for beta and prod deployment, including canary tests
1010
# 5. [Publish layer] update documentation with the latest layer ARN version of the prod deployment
1111
# 6. [Publish layer] create PR to merge the updated documentation
@@ -69,7 +69,7 @@ jobs:
6969
VERSION=$(cat packages/commons/package.json | jq .version -r)
7070
echo RELEASE_VERSION="$VERSION" >> "$GITHUB_OUTPUT"
7171
72-
# This job creates a new git tag using the released version (v1.18.1)
72+
# This job creates a new git tag using the released version (ApiGatewayV1.18.1)
7373
create_tag:
7474
needs: [publish-npm]
7575
permissions:

.github/workflows/make-version.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ jobs:
4040
node-version: ${{ env.NODE_VERSION }}
4141
cache: "npm"
4242
- name: Setup dependencies
43-
uses: aws-powertools/actions/.github/actions/cached-node-modules@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
43+
uses: aws-powertools/actions/.github/actions/cached-node-modules@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # ApiGatewayV1.5.0
4444
with:
4545
node-version: ${{ env.NODE_VERSION }}
4646
build: "false"
4747
- name: Version and changelog
4848
id: version-n-changelog
49-
uses: aws-powertools/actions/.github/actions/version-n-changelog@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
49+
uses: aws-powertools/actions/.github/actions/version-n-changelog@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # ApiGatewayV1.5.0
5050
with:
5151
release-type: ${{ github.event.inputs.release-type }}
5252
- name: Update user agent version
@@ -56,7 +56,7 @@ jobs:
5656
run: git add .
5757
- name: Create PR
5858
id: create-pr
59-
uses: aws-powertools/actions/.github/actions/create-pr@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
59+
uses: aws-powertools/actions/.github/actions/create-pr@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # ApiGatewayV1.5.0
6060
with:
6161
temp_branch_prefix: "ci-bump"
6262
pull_request_title: "chore(ci): bump version to ${{ steps.version-n-changelog.outputs.new-version }}"

.github/workflows/post-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
versionNumber:
88
required: true
99
type: string
10-
description: "If running this manually please insert a version number that corresponds to the latest published in the GitHub releases (i.e. v1.1.1)"
10+
description: "If running this manually please insert a version number that corresponds to the latest published in the GitHub releases (i.e. ApiGatewayV1.1.1)"
1111
# Or triggered as result of a release
1212
release:
1313
types: [released]

.github/workflows/publish_layer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
run: git add .
127127
- name: Create PR
128128
id: create-pr
129-
uses: aws-powertools/actions/.github/actions/create-pr@da5bcb1a3d22f87bc48b570c818d26f44c0fc960 # v1.3.0
129+
uses: aws-powertools/actions/.github/actions/create-pr@da5bcb1a3d22f87bc48b570c818d26f44c0fc960 # ApiGatewayV1.3.0
130130
with:
131131
temp_branch_prefix: 'ci-layer-docs'
132132
pull_request_title: 'chore(ci): update layer ARN on documentation'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
with:
5555
node-version: '22'
5656
- name: Setup dependencies
57-
uses: aws-powertools/actions/.github/actions/cached-node-modules@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # v1.5.0
57+
uses: aws-powertools/actions/.github/actions/cached-node-modules@3b5b8e2e58b7af07994be982e83584a94e8c76c5 # ApiGatewayV1.5.0
5858
with:
5959
node-version: '22'
6060
- name: Setup AWS credentials

examples/snippets/event-handler/bedrock-agents/templates/gettingStartedSam.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Resources:
5252
Properties:
5353
AgentName: AirlineAgent
5454
Description: 'A simple Airline agent'
55-
FoundationModel: !Sub 'arn:aws:bedrock:us-west-2:${AWS::AccountId}:inference-profile/us.amazon.nova-pro-v1:0'
55+
FoundationModel: !Sub 'arn:aws:bedrock:us-west-2:${AWS::AccountId}:inference-profile/us.amazon.nova-pro-ApiGatewayV1:0'
5656
Instruction: |
5757
You are an airport traffic control agent. You will be given a city name and you will return the airport code for that city.
5858
AgentResourceRoleArn: !GetAtt AirlineAgentRole.Arn

packages/event-handler/src/appsync-events/RouteHandlerRegistry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ class RouteHandlerRegistry {
8989
* If no handler is found, it returns `undefined`.
9090
*
9191
* Examples of specificity:
92-
* - `'/default/v1/users'` -> score: 14 (len=14, wildcards=0)
93-
* - `'/default/v1/users/*'` -> score: 14 (len=15, wildcards=1)
94-
* - `'/default/v1/*'` -> score: 8 (len=9, wildcards=1)
92+
* - `'/default/ApiGatewayV1/users'` -> score: 14 (len=14, wildcards=0)
93+
* - `'/default/ApiGatewayV1/users/*'` -> score: 14 (len=15, wildcards=1)
94+
* - `'/default/ApiGatewayV1/*'` -> score: 8 (len=9, wildcards=1)
9595
* - `'/*'` -> score: 0 (len=1, wildcards=1)
9696
*
9797
* @param path - The path of the event to be resolved

packages/event-handler/src/rest/Router.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
RequestContext,
2525
ResolveStreamOptions,
2626
ResponseStream,
27+
ResponseType,
2728
RestRouteOptions,
2829
RestRouterOptions,
2930
RouteHandler,
@@ -217,7 +218,9 @@ class Router {
217218
throw new InvalidEventError();
218219
}
219220

220-
const responseType = isAPIGatewayProxyEventV2(event) ? 'v2' : 'v1';
221+
const responseType: ResponseType = isAPIGatewayProxyEventV2(event)
222+
? 'ApiGatewayV2'
223+
: 'ApiGatewayV1';
221224

222225
let req: Request;
223226
try {

packages/event-handler/src/rest/converters.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,17 @@ const webHeadersToApiGatewayV2Headers = (webHeaders: Headers) => {
198198
const webHeadersToApiGatewayHeaders = <T extends ResponseType>(
199199
webHeaders: Headers,
200200
responseType: T
201-
): T extends 'v1' ? V1Headers : { headers: Record<string, string> } => {
202-
if (responseType === 'v1') {
203-
return webHeadersToApiGatewayV1Headers(webHeaders) as T extends 'v1'
201+
): T extends 'ApiGatewayV1'
202+
? V1Headers
203+
: { headers: Record<string, string> } => {
204+
if (responseType === 'ApiGatewayV1') {
205+
return webHeadersToApiGatewayV1Headers(
206+
webHeaders
207+
) as T extends 'ApiGatewayV1'
204208
? V1Headers
205209
: { headers: Record<string, string> };
206210
}
207-
return webHeadersToApiGatewayV2Headers(webHeaders) as T extends 'v1'
211+
return webHeadersToApiGatewayV2Headers(webHeaders) as T extends 'ApiGatewayV1'
208212
? V1Headers
209213
: { headers: Record<string, string> };
210214
};
@@ -317,7 +321,7 @@ const webResponseToProxyResult = <T extends ResponseType>(
317321
response: Response,
318322
responseType: T
319323
): Promise<ResponseTypeMap[T]> => {
320-
if (responseType === 'v1') {
324+
if (responseType === 'ApiGatewayV1') {
321325
return webResponseToProxyResultV1(response) as Promise<ResponseTypeMap[T]>;
322326
}
323327
return webResponseToProxyResultV2(response) as Promise<ResponseTypeMap[T]>;

packages/event-handler/src/types/rest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import type { Route } from '../rest/Route.js';
1515
import type { HttpResponseStream } from '../rest/utils.js';
1616
import type { ResolveOptions } from './common.js';
1717

18-
type ResponseType = 'v1' | 'v2';
18+
type ResponseType = 'ApiGatewayV1' | 'ApiGatewayV2';
1919

2020
type ResponseTypeMap = {
21-
v1: APIGatewayProxyResult;
22-
v2: APIGatewayProxyStructuredResultV2;
21+
ApiGatewayV1: APIGatewayProxyResult;
22+
ApiGatewayV2: APIGatewayProxyStructuredResultV2;
2323
};
2424

2525
type RequestContext = {

0 commit comments

Comments
 (0)