@middy/ws-router 6.0.0 → 6.1.2

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +4 -4
  3. package/package.json +6 -5
package/README.md CHANGED
@@ -39,7 +39,7 @@
39
39
 
40
40
  ## License
41
41
 
42
- Licensed under [MIT License](LICENSE). Copyright (c) 2017-2024 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
42
+ Licensed under [MIT License](LICENSE). Copyright (c) 2017-2025 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
43
43
 
44
44
  <a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy?ref=badge_large">
45
45
  <img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiddyjs%2Fmiddy.svg?type=large" alt="FOSSA Status" style="max-width:100%;">
package/index.js CHANGED
@@ -25,14 +25,14 @@ const wsRouteHandler = (opts = {}) => {
25
25
  return (event, context, abort) => {
26
26
  const { routeKey } = event.requestContext ?? {}
27
27
  if (!routeKey) {
28
- throw new Error('Unknown WebSocket event format', {
29
- cause: { package: '@middy/ws-router' }
28
+ throw createError(400, 'Unknown WebSocket event format', {
29
+ cause: { package: '@middy/ws-router', data: { routeKey } }
30
30
  })
31
31
  }
32
32
 
33
33
  // Static
34
- const handler = routesStatic[routeKey]
35
- if (typeof handler !== 'undefined') {
34
+ if (Object.hasOwnProperty.call(routesStatic, routeKey)) {
35
+ const handler = routesStatic[routeKey]
36
36
  return handler(event, context, abort)
37
37
  }
38
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/ws-router",
3
- "version": "6.0.0",
3
+ "version": "6.1.2",
4
4
  "description": "WebSocket event router for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -28,8 +28,9 @@
28
28
  "index.d.ts"
29
29
  ],
30
30
  "scripts": {
31
- "test": "npm run test:unit",
31
+ "test": "npm run test:unit && npm run test:fuzz",
32
32
  "test:unit": "node --test __tests__/index.js",
33
+ "test:fuzz": "node --test __tests__/fuzz.js",
33
34
  "test:benchmark": "node __benchmarks__/index.js"
34
35
  },
35
36
  "license": "MIT",
@@ -51,7 +52,7 @@
51
52
  },
52
53
  "repository": {
53
54
  "type": "git",
54
- "url": "github:middyjs/middy",
55
+ "url": "git+https://github.com/middyjs/middy.git",
55
56
  "directory": "packages/ws-router"
56
57
  },
57
58
  "bugs": {
@@ -63,10 +64,10 @@
63
64
  "url": "https://github.com/sponsors/willfarrell"
64
65
  },
65
66
  "dependencies": {
66
- "@middy/util": "6.0.0"
67
+ "@middy/util": "6.1.2"
67
68
  },
68
69
  "devDependencies": {
69
- "@middy/core": "6.0.0",
70
+ "@middy/core": "6.1.2",
70
71
  "@types/aws-lambda": "^8.10.100"
71
72
  },
72
73
  "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431"