@middy/cloudformation-router 7.1.2 → 7.1.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/README.md CHANGED
@@ -30,6 +30,23 @@
30
30
  <p>You can read the documentation at: <a href="https://middy.js.org/docs/routers/cloudformation-router">https://middy.js.org/docs/routers/cloudformation-router</a></p>
31
31
  </div>
32
32
 
33
+ ## Install
34
+
35
+ ```bash
36
+ npm install --save @middy/cloudformation-router
37
+ ```
38
+
39
+
40
+ ## Documentation and examples
41
+
42
+ For documentation and examples, refer to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org/docs/routers/cloudformation-router).
43
+
44
+
45
+ ## Contributing
46
+
47
+ Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
48
+
49
+
33
50
  ## License
34
51
 
35
52
  Licensed under [MIT License](LICENSE). Copyright (c) 2017-2026 [will Farrell](https://github.com/willfarrell), [Luciano Mammino](https://github.com/lmammino), and [Middy contributors](https://github.com/middyjs/middy/graphs/contributors).
package/index.d.ts CHANGED
@@ -1,20 +1,27 @@
1
1
  // Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
2
2
  // SPDX-License-Identifier: MIT
3
3
  import type middy from "@middy/core";
4
- import type { CloudFormationCustomResourceHandler } from "aws-lambda";
4
+ import type {
5
+ CloudFormationCustomResourceEvent,
6
+ CloudFormationCustomResourceHandler,
7
+ } from "aws-lambda";
5
8
 
6
- interface Route<T = never> {
9
+ export interface Route<TResult = never> {
7
10
  requestType: string;
8
- handler: CloudFormationCustomResourceHandler<T>;
11
+ handler: CloudFormationCustomResourceHandler<TResult>;
9
12
  }
10
13
 
14
+ export type RouteNotFoundResponseFn = (input: {
15
+ requestType: string;
16
+ }) => unknown;
17
+
11
18
  export interface Options {
12
19
  routes: Route[];
13
- notFoundResponse?: (input: { requestType: string }) => never;
20
+ notFoundResponse?: RouteNotFoundResponseFn;
14
21
  }
15
22
 
16
23
  declare function cloudformationRouterHandler(
17
24
  options: Options | Route[],
18
- ): middy.MiddyfiedHandler;
25
+ ): middy.MiddyfiedHandler<CloudFormationCustomResourceEvent, void>;
19
26
 
20
27
  export default cloudformationRouterHandler;
package/index.js CHANGED
@@ -20,7 +20,7 @@ const cloudformationCustomResourceRouteHandler = (opts = {}) => {
20
20
  options ??= opts;
21
21
  const { routes, notFoundResponse } = { ...defaults, ...options };
22
22
 
23
- const routesStatic = {};
23
+ const routesStatic = Object.create(null);
24
24
  for (const route of routes) {
25
25
  const { requestType, handler } = route;
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/cloudformation-router",
3
- "version": "7.1.2",
3
+ "version": "7.1.3",
4
4
  "description": "CloudFormation Custom Response event router for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -65,8 +65,8 @@
65
65
  "url": "https://github.com/sponsors/willfarrell"
66
66
  },
67
67
  "devDependencies": {
68
- "@middy/core": "7.1.2",
69
- "@types/aws-lambda": "^8.0.0"
70
- },
71
- "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431"
68
+ "@middy/core": "7.1.3",
69
+ "@types/aws-lambda": "^8.0.0",
70
+ "@types/node": "^22.0.0"
71
+ }
72
72
  }