Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8bb4af8
AIDLC Execution Plan Step
sdangol Nov 7, 2025
891d420
Application Design
sdangol Nov 7, 2025
d0b88b6
NFR design
sdangol Nov 7, 2025
ac127db
First iteration of code generation
sdangol Nov 7, 2025
cfe1bc4
First iteration of code generation
sdangol Nov 7, 2025
552eb12
Fixed implementation logic
sdangol Nov 11, 2025
2da4094
Updated documentation
sdangol Nov 11, 2025
c527e69
Reverted README changes
sdangol Nov 11, 2025
bda2cf6
fixed lint issue
sdangol Nov 11, 2025
34ad6dd
Removed aidlc docs from git
sdangol Dec 4, 2025
40d66c0
Updated logic with the latest changes in issue description
sdangol Dec 4, 2025
f0b1d40
Updated handler registration methods to thread the new types through
sdangol Dec 4, 2025
624c61d
Update get method with the overloads as in the issue description
sdangol Dec 6, 2025
7352ae2
Fixed other methods
sdangol Dec 6, 2025
0649425
fixed tests
sdangol Dec 6, 2025
70a47a8
Added TypedRequestContext to Middleware type
sdangol Dec 6, 2025
77aa5c5
Fixed merge conflicts
sdangol Dec 6, 2025
29eb70c
Removed catch block for schema validation
sdangol Dec 6, 2025
e26f35e
Increased the test coverage
sdangol Dec 6, 2025
aebbfbb
Restored package-lock.json
sdangol Dec 6, 2025
761ee09
Addressed feedbacks
sdangol Dec 6, 2025
b6931d0
Reverted request body extraction simplification
sdangol Dec 6, 2025
87c7c1b
removeed doc update
sdangol Dec 9, 2025
aa387ce
Merge branch 'main' into aidlc
sdangol Dec 9, 2025
f91d95f
fixed sonar findigns
sdangol Dec 9, 2025
fa72189
consolidateed tests
sdangol Dec 10, 2025
b20e56c
fixed ts warning
sdangol Dec 10, 2025
56fca71
moved standard schema to dependency
sdangol Dec 10, 2025
477594d
Merge branch 'main' into aidlc
sdangol Dec 10, 2025
835cba2
fixed errors
sdangol Dec 10, 2025
1cfa818
removed powertools dev var reset
sdangol Dec 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ tsconfig.tsbuildinfo
.claude
.amazonq
.kiro
.github/instructions
.github/instructions
aidlc-docs
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/event-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@
"url": "https://github.com/aws-powertools/powertools-lambda-typescript/issues"
},
"dependencies": {
"@aws-lambda-powertools/commons": "2.29.0"
"@aws-lambda-powertools/commons": "2.29.0",
"@standard-schema/spec": "^1.0.0"
},
"keywords": [
"aws",
Expand Down
11 changes: 8 additions & 3 deletions packages/event-handler/src/http/Route.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import type {
HandlerResponse,
HttpMethod,
Middleware,
Path,
RouteHandler,
TypedRouteHandler,
} from '../types/http.js';

class Route {
class Route<
TReqBody = never,
TResBody extends HandlerResponse = HandlerResponse,
> {
readonly id: string;
readonly method: string;
readonly path: Path;
readonly handler: RouteHandler;
readonly handler: RouteHandler | TypedRouteHandler<TReqBody, TResBody>;
readonly middleware: Middleware[];

constructor(
method: HttpMethod,
path: Path,
handler: RouteHandler,
handler: RouteHandler | TypedRouteHandler<TReqBody, TResBody>,
middleware: Middleware[] = []
) {
this.id = `${method}:${path}`;
Expand Down
17 changes: 11 additions & 6 deletions packages/event-handler/src/http/RouteHandlerRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import type { GenericLogger } from '@aws-lambda-powertools/commons/types';
import { isRegExp } from '@aws-lambda-powertools/commons/typeutils';
import type {
DynamicRoute,
HandlerResponse,
HttpMethod,
HttpRouteHandlerOptions,
Path,
RouteHandler,
RouteRegistryOptions,
ValidationResult,
} from '../types/http.js';
Expand Down Expand Up @@ -94,7 +96,10 @@ class RouteHandlerRegistry {
*
* @param route - The route to register
*/
public register(route: Route): void {
public register<
TReqBody = never,
TResBody extends HandlerResponse = HandlerResponse,
>(route: Route<TReqBody, TResBody>): void {
this.#shouldSort = true;
const { isValid, issues } = validatePathPattern(route.path);
if (!isValid) {
Expand All @@ -115,14 +120,14 @@ class RouteHandlerRegistry {
this.#regexRoutes.set(route.id, {
...route,
...compiled,
});
} as DynamicRoute);
return;
}
if (compiled.isDynamic) {
const dynamicRoute = {
...route,
...compiled,
};
} as DynamicRoute;
if (this.#dynamicRoutesSet.has(route.id)) {
this.#logger.warn(
`Handler for method: ${route.method} and path: ${route.path} already exists. The previous handler will be replaced.`
Expand All @@ -144,7 +149,7 @@ class RouteHandlerRegistry {
`Handler for method: ${route.method} and path: ${route.path} already exists. The previous handler will be replaced.`
);
}
this.#staticRoutes.set(route.id, route);
this.#staticRoutes.set(route.id, route as unknown as Route);
}
}
/**
Expand Down Expand Up @@ -179,7 +184,7 @@ class RouteHandlerRegistry {
const staticRoute = this.#staticRoutes.get(routeId);
if (staticRoute != null) {
return {
handler: staticRoute.handler,
handler: staticRoute.handler as RouteHandler,
rawParams: {},
params: {},
middleware: staticRoute.middleware,
Expand Down Expand Up @@ -241,7 +246,7 @@ class RouteHandlerRegistry {
}

return {
handler: route.handler,
handler: route.handler as RouteHandler,
params: processedParams,
rawParams: params,
middleware: route.middleware,
Expand Down
Loading