@middy/http-router 3.3.2 → 3.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.
Files changed (2) hide show
  1. package/index.d.ts +16 -4
  2. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -1,18 +1,30 @@
1
1
  import middy from '@middy/core'
2
2
  import {
3
3
  APIGatewayProxyEvent,
4
+ APIGatewayProxyEventV2,
4
5
  APIGatewayProxyResult,
5
6
  Handler as LambdaHandler
6
7
  } from 'aws-lambda'
7
8
 
8
- export type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'ANY'
9
+ export type Method =
10
+ | 'GET'
11
+ | 'POST'
12
+ | 'PUT'
13
+ | 'PATCH'
14
+ | 'DELETE'
15
+ | 'OPTIONS'
16
+ | 'ANY'
9
17
 
10
- export interface Route {
18
+ export interface Route<TEvent> {
11
19
  method: Method
12
20
  path: string
13
- handler: LambdaHandler<APIGatewayProxyEvent, APIGatewayProxyResult>
21
+ handler: LambdaHandler<TEvent, APIGatewayProxyResult>
14
22
  }
15
23
 
16
- declare function httpRouterHandler (routes: Route[]): middy.MiddyfiedHandler
24
+ declare function httpRouterHandler<
25
+ TEvent extends
26
+ | APIGatewayProxyEvent
27
+ | APIGatewayProxyEventV2 = APIGatewayProxyEvent
28
+ > (routes: Array<Route<TEvent>>): middy.MiddyfiedHandler
17
29
 
18
30
  export default httpRouterHandler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-router",
3
- "version": "3.3.2",
3
+ "version": "3.3.4",
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.3.2"
65
+ "@middy/util": "3.3.4"
66
66
  },
67
67
  "devDependencies": {
68
- "@middy/core": "3.3.2",
68
+ "@middy/core": "3.3.4",
69
69
  "@types/aws-lambda": "^8.10.97"
70
70
  },
71
- "gitHead": "5fcd6655e7f076615c2dcb877a36f6c4fc3164d3"
71
+ "gitHead": "8f4a4fec7cdd827441ed33e2b20611f5518f2767"
72
72
  }