@middy/ws-router 7.1.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.d.ts +8 -1
- package/index.js +2 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<h1>Middy ws-router
|
|
2
|
+
<h1>Middy `ws-router` router</h1>
|
|
3
3
|
<img alt="Middy logo" src="https://raw.githubusercontent.com/middyjs/middy/main/docs/img/middy-logo.svg"/>
|
|
4
4
|
<p><strong>WebSocket router for the middy framework, the stylish Node.js middleware engine for AWS Lambda</strong></p>
|
|
5
5
|
<p>
|
package/index.d.ts
CHANGED
|
@@ -8,6 +8,13 @@ interface Route<T = never> {
|
|
|
8
8
|
handler: APIGatewayProxyWebsocketHandlerV2<T>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
export interface Options {
|
|
12
|
+
routes: Route[];
|
|
13
|
+
notFoundResponse?: (input: { routeKey: string }) => never;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare function wsRouterHandler(
|
|
17
|
+
options: Options | Route[],
|
|
18
|
+
): middy.MiddyfiedHandler;
|
|
12
19
|
|
|
13
20
|
export default wsRouterHandler;
|
package/index.js
CHANGED
|
@@ -27,7 +27,7 @@ const wsRouteHandler = (opts = {}) => {
|
|
|
27
27
|
routesStatic[routeKey] = handler;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const handler = (event, context, abort) => {
|
|
31
31
|
const { routeKey } = event.requestContext ?? {};
|
|
32
32
|
if (!routeKey) {
|
|
33
33
|
throw createError(400, "Unknown WebSocket event format", {
|
|
@@ -44,6 +44,7 @@ const wsRouteHandler = (opts = {}) => {
|
|
|
44
44
|
// Not Found
|
|
45
45
|
return notFoundResponse({ routeKey });
|
|
46
46
|
};
|
|
47
|
+
return handler;
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
export default wsRouteHandler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/ws-router",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"description": "WebSocket event router for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"url": "https://github.com/sponsors/willfarrell"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@middy/util": "7.1.
|
|
68
|
+
"@middy/util": "7.1.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@middy/core": "7.1.
|
|
72
|
-
"@types/aws-lambda": "^8.
|
|
71
|
+
"@middy/core": "7.1.1",
|
|
72
|
+
"@types/aws-lambda": "^8.0.0"
|
|
73
73
|
},
|
|
74
74
|
"gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431"
|
|
75
75
|
}
|