@middy/validator 7.3.3 → 7.4.0

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 +7 -4
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -2,6 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import { createError, validateOptions } from "@middy/util";
4
4
 
5
+ const name = "validator";
6
+ const pkg = `@middy/${name}`;
7
+
5
8
  const defaults = {
6
9
  eventSchema: undefined,
7
10
  contextSchema: undefined,
@@ -26,7 +29,7 @@ const optionSchema = {
26
29
  };
27
30
 
28
31
  export const validatorValidateOptions = (options) =>
29
- validateOptions("@middy/validator", optionSchema, options);
32
+ validateOptions(pkg, optionSchema, options);
30
33
 
31
34
  const validatorMiddleware = (opts = {}) => {
32
35
  const {
@@ -50,7 +53,7 @@ const validatorMiddleware = (opts = {}) => {
50
53
  // Bad Request
51
54
  throw createError(400, "Event object failed validation", {
52
55
  cause: {
53
- package: "@middy/validator",
56
+ package: pkg,
54
57
  data: eventSchema.errors,
55
58
  },
56
59
  });
@@ -64,7 +67,7 @@ const validatorMiddleware = (opts = {}) => {
64
67
  // Internal Server Error
65
68
  throw createError(500, "Context object failed validation", {
66
69
  cause: {
67
- package: "@middy/validator",
70
+ package: pkg,
68
71
  data: contextSchema.errors,
69
72
  },
70
73
  });
@@ -79,7 +82,7 @@ const validatorMiddleware = (opts = {}) => {
79
82
  // Internal Server Error
80
83
  throw createError(500, "Response object failed validation", {
81
84
  cause: {
82
- package: "@middy/validator",
85
+ package: pkg,
83
86
  data: responseSchema.errors,
84
87
  },
85
88
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/validator",
3
- "version": "7.3.3",
3
+ "version": "7.4.0",
4
4
  "description": "Validator middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -69,7 +69,7 @@
69
69
  "url": "https://github.com/sponsors/willfarrell"
70
70
  },
71
71
  "dependencies": {
72
- "@middy/util": "7.3.3",
72
+ "@middy/util": "7.4.0",
73
73
  "ajv": "8.20.0",
74
74
  "ajv-errors": "3.0.0",
75
75
  "ajv-formats": "3.0.1",
@@ -78,7 +78,7 @@
78
78
  "ajv-keywords": "5.1.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@middy/core": "7.3.3",
81
+ "@middy/core": "7.4.0",
82
82
  "@types/aws-lambda": "^8.0.0",
83
83
  "@types/http-errors": "^2.0.0",
84
84
  "@types/node": "^22.0.0",