@middy/ws-router 7.3.2 → 7.3.4
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/index.js +6 -3
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { createError, validateOptions } from "@middy/util";
|
|
4
4
|
|
|
5
|
+
const name = "ws-router";
|
|
6
|
+
const pkg = `@middy/${name}`;
|
|
7
|
+
|
|
5
8
|
const defaults = {
|
|
6
9
|
routes: [],
|
|
7
10
|
notFoundResponse: ({ routeKey }) => {
|
|
8
11
|
const err = createError(404, "Route does not exist", {
|
|
9
|
-
cause: { package:
|
|
12
|
+
cause: { package: pkg, data: { routeKey } },
|
|
10
13
|
});
|
|
11
14
|
throw err;
|
|
12
15
|
},
|
|
@@ -34,7 +37,7 @@ const optionSchema = {
|
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
export const wsRouterValidateOptions = (options) =>
|
|
37
|
-
validateOptions(
|
|
40
|
+
validateOptions(pkg, optionSchema, options);
|
|
38
41
|
const wsRouteHandler = (opts = {}) => {
|
|
39
42
|
let options;
|
|
40
43
|
if (Array.isArray(opts)) {
|
|
@@ -58,7 +61,7 @@ const wsRouteHandler = (opts = {}) => {
|
|
|
58
61
|
400,
|
|
59
62
|
"Unknown WebSocket event format: missing 'requestContext.routeKey'",
|
|
60
63
|
{
|
|
61
|
-
cause: { package:
|
|
64
|
+
cause: { package: pkg, data: { routeKey } },
|
|
62
65
|
},
|
|
63
66
|
);
|
|
64
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/ws-router",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.4",
|
|
4
4
|
"description": "WebSocket event router for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"url": "https://github.com/sponsors/willfarrell"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@middy/util": "7.3.
|
|
65
|
+
"@middy/util": "7.3.4"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@middy/core": "7.3.
|
|
68
|
+
"@middy/core": "7.3.4",
|
|
69
69
|
"@types/aws-lambda": "^8.0.0",
|
|
70
70
|
"@types/node": "^22.0.0"
|
|
71
71
|
}
|