@middy/ws-router 7.3.1 → 7.3.3
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 +2 -17
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const optionSchema = {
|
|
|
17
17
|
properties: {
|
|
18
18
|
routes: {
|
|
19
19
|
type: "array",
|
|
20
|
+
uniqueItems: true,
|
|
20
21
|
items: {
|
|
21
22
|
type: "object",
|
|
22
23
|
required: ["routeKey", "handler"],
|
|
@@ -32,24 +33,8 @@ const optionSchema = {
|
|
|
32
33
|
additionalProperties: false,
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
export const wsRouterValidateOptions = (options) =>
|
|
36
|
+
export const wsRouterValidateOptions = (options) =>
|
|
36
37
|
validateOptions("@middy/ws-router", optionSchema, options);
|
|
37
|
-
const routes = options?.routes;
|
|
38
|
-
if (routes === undefined) return options;
|
|
39
|
-
const seen = new Set();
|
|
40
|
-
for (const { routeKey } of routes) {
|
|
41
|
-
if (seen.has(routeKey)) {
|
|
42
|
-
throw new Error("Duplicate route", {
|
|
43
|
-
cause: {
|
|
44
|
-
package: "@middy/ws-router",
|
|
45
|
-
data: { routeKey },
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
seen.add(routeKey);
|
|
50
|
-
}
|
|
51
|
-
return options;
|
|
52
|
-
};
|
|
53
38
|
const wsRouteHandler = (opts = {}) => {
|
|
54
39
|
let options;
|
|
55
40
|
if (Array.isArray(opts)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/ws-router",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.3",
|
|
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.3"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@middy/core": "7.3.
|
|
68
|
+
"@middy/core": "7.3.3",
|
|
69
69
|
"@types/aws-lambda": "^8.0.0",
|
|
70
70
|
"@types/node": "^22.0.0"
|
|
71
71
|
}
|