@middy/validator 7.1.1 → 7.1.2
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/index.d.ts +10 -4
- package/package.json +3 -3
- package/transpile.d.ts +11 -3
package/index.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
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
10
|
|
|
5
11
|
export interface Options {
|
|
6
|
-
eventSchema?:
|
|
7
|
-
contextSchema?:
|
|
8
|
-
responseSchema?:
|
|
12
|
+
eventSchema?: ValidateFunction;
|
|
13
|
+
contextSchema?: ValidateFunction;
|
|
14
|
+
responseSchema?: ValidateFunction;
|
|
9
15
|
defaultLanguage?: string;
|
|
10
|
-
languages?:
|
|
16
|
+
languages?: Record<string, (errors: ErrorObject[] | undefined) => void>;
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
declare function validator(options?: Options): middy.MiddlewareObj;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/validator",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2",
|
|
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.
|
|
78
|
+
"@middy/util": "7.1.2",
|
|
79
79
|
"ajv": "8.18.0",
|
|
80
80
|
"ajv-errors": "3.0.0",
|
|
81
81
|
"ajv-formats": "3.0.1",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"ajv-keywords": "5.1.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
-
"@middy/core": "7.1.
|
|
87
|
+
"@middy/core": "7.1.2",
|
|
88
88
|
"@types/aws-lambda": "^8.0.0",
|
|
89
89
|
"@types/http-errors": "^2.0.0",
|
|
90
90
|
"ajv-bsontype": "^1.0.7",
|
package/transpile.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import type { Ajv, Options as AjvOptions } from "ajv";
|
|
3
|
+
import type { Ajv, ErrorObject, Options as AjvOptions } from "ajv";
|
|
4
|
+
|
|
5
|
+
export type LocalizeFunction = (errors: ErrorObject[] | undefined) => void;
|
|
4
6
|
|
|
5
7
|
export function transpileSchema(
|
|
6
8
|
schema: object,
|
|
7
9
|
ajvOptions?: Partial<AjvOptions>,
|
|
8
10
|
): Ajv;
|
|
9
11
|
|
|
10
|
-
export function transpileLocale(
|
|
12
|
+
export function transpileLocale(
|
|
13
|
+
src: string,
|
|
14
|
+
options?: object | any,
|
|
15
|
+
): LocalizeFunction;
|
|
11
16
|
|
|
12
|
-
export function transpileFTL(
|
|
17
|
+
export function transpileFTL(
|
|
18
|
+
src: string,
|
|
19
|
+
options?: object | any,
|
|
20
|
+
): LocalizeFunction;
|