@middy/http-router 3.2.0 → 3.2.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.
Files changed (3) hide show
  1. package/index.cjs +13 -11
  2. package/index.js +6 -6
  3. package/package.json +4 -4
package/index.cjs CHANGED
@@ -2,14 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- module.exports = void 0;
6
- var _util = require("@middy/util");
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: ()=>_default
8
+ });
9
+ const _util = require("@middy/util");
7
10
  const httpRouteHandler = (routes)=>{
8
11
  const routesStatic = {};
9
12
  const routesDynamic = {};
10
13
  const enumMethods = methods.concat('ANY');
11
- for (const route1 of routes){
12
- let { method , path , handler } = route1;
14
+ for (const route of routes){
15
+ let { method , path , handler } = route;
13
16
  if (!enumMethods.includes(method)) {
14
17
  throw new Error('[http-router] Method not allowed');
15
18
  }
@@ -36,7 +39,7 @@ const httpRouteHandler = (routes)=>{
36
39
  return route.handler(event, context, abort);
37
40
  }
38
41
  }
39
- throw (0, _util).createError(404, 'Route does not exist');
42
+ throw (0, _util.createError)(404, 'Route does not exist');
40
43
  };
41
44
  };
42
45
  const regexpDynamicWildcards = /\/\{proxy\+\}/g;
@@ -51,8 +54,8 @@ const methods = [
51
54
  ];
52
55
  const attachStaticRoute = (method, path, handler, routesType)=>{
53
56
  if (method === 'ANY') {
54
- for (const method of methods){
55
- attachStaticRoute(method, path, handler, routesType);
57
+ for (const method1 of methods){
58
+ attachStaticRoute(method1, path, handler, routesType);
56
59
  }
57
60
  return;
58
61
  }
@@ -63,8 +66,8 @@ const attachStaticRoute = (method, path, handler, routesType)=>{
63
66
  };
64
67
  const attachDynamicRoute = (method, path, handler, routesType)=>{
65
68
  if (method === 'ANY') {
66
- for (const method of methods){
67
- attachDynamicRoute(method, path, handler, routesType);
69
+ for (const method1 of methods){
70
+ attachDynamicRoute(method1, path, handler, routesType);
68
71
  }
69
72
  return;
70
73
  }
@@ -88,8 +91,7 @@ const getVersionRoute = {
88
91
  path: event.requestContext.http.path
89
92
  })
90
93
  };
91
- var _default = httpRouteHandler;
92
- module.exports = _default;
94
+ const _default = httpRouteHandler;
93
95
 
94
96
 
95
97
  //# sourceMappingURL=index.cjs.map
package/index.js CHANGED
@@ -3,8 +3,8 @@ const httpRouteHandler = (routes)=>{
3
3
  const routesStatic = {};
4
4
  const routesDynamic = {};
5
5
  const enumMethods = methods.concat('ANY');
6
- for (const route1 of routes){
7
- let { method , path , handler } = route1;
6
+ for (const route of routes){
7
+ let { method , path , handler } = route;
8
8
  if (!enumMethods.includes(method)) {
9
9
  throw new Error('[http-router] Method not allowed');
10
10
  }
@@ -46,8 +46,8 @@ const methods = [
46
46
  ];
47
47
  const attachStaticRoute = (method, path, handler, routesType)=>{
48
48
  if (method === 'ANY') {
49
- for (const method of methods){
50
- attachStaticRoute(method, path, handler, routesType);
49
+ for (const method1 of methods){
50
+ attachStaticRoute(method1, path, handler, routesType);
51
51
  }
52
52
  return;
53
53
  }
@@ -58,8 +58,8 @@ const attachStaticRoute = (method, path, handler, routesType)=>{
58
58
  };
59
59
  const attachDynamicRoute = (method, path, handler, routesType)=>{
60
60
  if (method === 'ANY') {
61
- for (const method of methods){
62
- attachDynamicRoute(method, path, handler, routesType);
61
+ for (const method1 of methods){
62
+ attachDynamicRoute(method1, path, handler, routesType);
63
63
  }
64
64
  return;
65
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-router",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "HTTP event router for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -62,11 +62,11 @@
62
62
  },
63
63
  "homepage": "https://middy.js.org",
64
64
  "dependencies": {
65
- "@middy/util": "3.2.0"
65
+ "@middy/util": "3.2.1"
66
66
  },
67
67
  "devDependencies": {
68
- "@middy/core": "3.2.0",
68
+ "@middy/core": "3.2.1",
69
69
  "@types/aws-lambda": "^8.10.97"
70
70
  },
71
- "gitHead": "ac46270daa388b52a81472ae8f9b8808a0136940"
71
+ "gitHead": "b4169ec20b798650e934a7c25ee80ae98d11e03a"
72
72
  }