@middy/validator 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/middlewares/validator">https://middy.js.org/docs/middlewares/validator</a></p>
31
31
  </div>
32
32
 
33
+ ## Install
34
+
35
+ ```bash
36
+ npm install --save @middy/validator
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/middlewares/validator).
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,21 +1,21 @@
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 { ErrorObject } from "ajv";
5
-
6
- export interface ValidateFunction<T = unknown> {
7
- (data: unknown): data is T;
8
- errors?: ErrorObject[] | undefined;
9
- }
4
+ import type { Ajv, ErrorObject } from "ajv";
10
5
 
11
6
  export interface Options {
12
- eventSchema?: ValidateFunction;
13
- contextSchema?: ValidateFunction;
14
- responseSchema?: ValidateFunction;
7
+ eventSchema?: Ajv;
8
+ contextSchema?: Ajv;
9
+ responseSchema?: Ajv;
15
10
  defaultLanguage?: string;
16
- languages?: Record<string, (errors: ErrorObject[] | undefined) => void>;
11
+ languages?: Record<
12
+ string,
13
+ (errors: ErrorObject[] | null | undefined) => void
14
+ >;
17
15
  }
18
16
 
19
- declare function validator(options?: Options): middy.MiddlewareObj;
17
+ declare function validator(
18
+ options?: Options,
19
+ ): middy.MiddlewareObj<unknown, unknown, Error>;
20
20
 
21
21
  export default validator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/validator",
3
- "version": "7.1.2",
3
+ "version": "7.1.3",
4
4
  "description": "Validator middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -75,7 +75,7 @@
75
75
  "url": "https://github.com/sponsors/willfarrell"
76
76
  },
77
77
  "dependencies": {
78
- "@middy/util": "7.1.2",
78
+ "@middy/util": "7.1.3",
79
79
  "ajv": "8.18.0",
80
80
  "ajv-errors": "3.0.0",
81
81
  "ajv-formats": "3.0.1",
@@ -84,11 +84,11 @@
84
84
  "ajv-keywords": "5.1.0"
85
85
  },
86
86
  "devDependencies": {
87
- "@middy/core": "7.1.2",
87
+ "@middy/core": "7.1.3",
88
88
  "@types/aws-lambda": "^8.0.0",
89
89
  "@types/http-errors": "^2.0.0",
90
+ "@types/node": "^22.0.0",
90
91
  "ajv-bsontype": "^1.0.7",
91
92
  "ajv-cmd": "^0.8.0"
92
- },
93
- "gitHead": "7a6c0fbb8ab71d6a2171e678697de9f237568431"
93
+ }
94
94
  }
package/transpile.d.ts CHANGED
@@ -2,7 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import type { Ajv, ErrorObject, Options as AjvOptions } from "ajv";
4
4
 
5
- export type LocalizeFunction = (errors: ErrorObject[] | undefined) => void;
5
+ export type LocalizeFunction = (
6
+ errors: ErrorObject[] | null | undefined,
7
+ ) => void;
6
8
 
7
9
  export function transpileSchema(
8
10
  schema: object,