@middy/ws-router 4.6.1 → 4.6.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/index.cjs +3 -0
  2. package/index.js +3 -0
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -13,6 +13,7 @@ const wsRouteHandler = (routes)=>{
13
13
  const routesStatic = {};
14
14
  for (const route of routes){
15
15
  const { routeKey, handler } = route;
16
+ // Static
16
17
  routesStatic[routeKey] = handler;
17
18
  }
18
19
  return (event, context, abort)=>{
@@ -20,10 +21,12 @@ const wsRouteHandler = (routes)=>{
20
21
  if (!routeKey) {
21
22
  throw new Error('[ws-router] Unknown ws event format');
22
23
  }
24
+ // Static
23
25
  const handler = routesStatic[routeKey];
24
26
  if (typeof handler !== 'undefined') {
25
27
  return handler(event, context, abort);
26
28
  }
29
+ // Not Found
27
30
  throw (0, _util.createError)(404, 'Route does not exist');
28
31
  };
29
32
  };
package/index.js CHANGED
@@ -3,6 +3,7 @@ const wsRouteHandler = (routes)=>{
3
3
  const routesStatic = {};
4
4
  for (const route of routes){
5
5
  const { routeKey, handler } = route;
6
+ // Static
6
7
  routesStatic[routeKey] = handler;
7
8
  }
8
9
  return (event, context, abort)=>{
@@ -10,10 +11,12 @@ const wsRouteHandler = (routes)=>{
10
11
  if (!routeKey) {
11
12
  throw new Error('[ws-router] Unknown ws event format');
12
13
  }
14
+ // Static
13
15
  const handler = routesStatic[routeKey];
14
16
  if (typeof handler !== 'undefined') {
15
17
  return handler(event, context, abort);
16
18
  }
19
+ // Not Found
17
20
  throw createError(404, 'Route does not exist');
18
21
  };
19
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/ws-router",
3
- "version": "4.6.1",
3
+ "version": "4.6.2",
4
4
  "description": "WebSocket event router for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -66,11 +66,11 @@
66
66
  "url": "https://github.com/sponsors/willfarrell"
67
67
  },
68
68
  "dependencies": {
69
- "@middy/util": "4.6.1"
69
+ "@middy/util": "4.6.2"
70
70
  },
71
71
  "devDependencies": {
72
- "@middy/core": "4.6.1",
72
+ "@middy/core": "4.6.2",
73
73
  "@types/aws-lambda": "^8.10.100"
74
74
  },
75
- "gitHead": "253ed0e4ca95623decbade03938a07d837a1eba2"
75
+ "gitHead": "8b03a01abf5a9c08231ec5ced775e87f8be8f67d"
76
76
  }