@middy/cloudformation-router 7.3.1 → 7.3.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.
Files changed (2) hide show
  1. package/index.js +2 -17
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -22,6 +22,7 @@ const optionSchema = {
22
22
  properties: {
23
23
  routes: {
24
24
  type: "array",
25
+ uniqueItems: true,
25
26
  items: {
26
27
  type: "object",
27
28
  required: ["requestType", "handler"],
@@ -37,24 +38,8 @@ const optionSchema = {
37
38
  additionalProperties: false,
38
39
  };
39
40
 
40
- export const cloudformationRouterValidateOptions = (options) => {
41
+ export const cloudformationRouterValidateOptions = (options) =>
41
42
  validateOptions("@middy/cloudformation-router", optionSchema, options);
42
- const routes = options?.routes;
43
- if (routes === undefined) return options;
44
- const seen = new Set();
45
- for (const { requestType } of routes) {
46
- if (seen.has(requestType)) {
47
- throw new Error("Duplicate route", {
48
- cause: {
49
- package: "@middy/cloudformation-router",
50
- data: { requestType },
51
- },
52
- });
53
- }
54
- seen.add(requestType);
55
- }
56
- return options;
57
- };
58
43
  const cloudformationCustomResourceRouteHandler = (opts = {}) => {
59
44
  let options;
60
45
  if (Array.isArray(opts)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/cloudformation-router",
3
- "version": "7.3.1",
3
+ "version": "7.3.3",
4
4
  "description": "CloudFormation Custom Response event router for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -62,7 +62,7 @@
62
62
  "url": "https://github.com/sponsors/willfarrell"
63
63
  },
64
64
  "devDependencies": {
65
- "@middy/core": "7.3.1",
65
+ "@middy/core": "7.3.3",
66
66
  "@types/aws-lambda": "^8.0.0",
67
67
  "@types/node": "^22.0.0"
68
68
  }