vovk-ajv 0.0.0-beta.3 → 0.0.0-beta.5
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 +7 -1
- package/index.js +1 -2
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
</picture>
|
|
8
8
|
</a>
|
|
9
9
|
<br>
|
|
10
|
-
<strong>Back-end for Next.js</strong>
|
|
10
|
+
<strong>Back-end Framework for Next.js App Router</strong>
|
|
11
|
+
<br />
|
|
12
|
+
<a href="https://vovk.dev/">Documentation</a>
|
|
13
|
+
|
|
14
|
+
<a href="https://vovk.dev/quick-install">Quick Start</a>
|
|
15
|
+
|
|
16
|
+
<a href="https://vovk.dev/performance">Performance</a>
|
|
11
17
|
</p>
|
|
12
18
|
|
|
13
19
|
---
|
package/index.js
CHANGED
|
@@ -15,7 +15,6 @@ const createAjv = (options, target) => {
|
|
|
15
15
|
const ajv = new AjvClass({ allErrors: true, ...options });
|
|
16
16
|
(0, ajv_formats_1.default)(ajv);
|
|
17
17
|
(0, ajv_errors_1.default)(ajv);
|
|
18
|
-
ajv.addKeyword('x-isDto');
|
|
19
18
|
ajv.addKeyword('x-isForm');
|
|
20
19
|
ajv.addKeyword('x-tsType');
|
|
21
20
|
return ajv;
|
|
@@ -62,7 +61,7 @@ const validate = ({ input, schema, localize = 'en', type, endpoint, options, tar
|
|
|
62
61
|
const isValid = ajv.validate(schema, input);
|
|
63
62
|
if (!isValid) {
|
|
64
63
|
ajv_i18n_1.default[localize](ajv.errors);
|
|
65
|
-
throw new vovk_1.HttpException(vovk_1.HttpStatus.NULL, `
|
|
64
|
+
throw new vovk_1.HttpException(vovk_1.HttpStatus.NULL, `Client-side validation failed. Invalid ${isFormData ? 'form' : type} on client: ${ajv.errorsText()}`, { input, errors: ajv.errors, endpoint });
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vovk-ajv",
|
|
3
|
-
"version": "0.0.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.0-beta.5",
|
|
4
|
+
"description": "Client-side JSON Schema validation library for Vovk.ts",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc",
|
|
@@ -17,17 +17,16 @@
|
|
|
17
17
|
"vovk",
|
|
18
18
|
"json",
|
|
19
19
|
"ajv",
|
|
20
|
-
"validation"
|
|
21
|
-
"zod"
|
|
20
|
+
"validation"
|
|
22
21
|
],
|
|
23
22
|
"author": "Andrey Gubanov",
|
|
24
23
|
"license": "MIT",
|
|
25
24
|
"bugs": {
|
|
26
25
|
"url": "https://github.com/finom/vovk/issues"
|
|
27
26
|
},
|
|
28
|
-
"homepage": "https://
|
|
27
|
+
"homepage": "https://vovk.dev/imports",
|
|
29
28
|
"peerDependencies": {
|
|
30
|
-
"vovk": "^3.0.0-beta.
|
|
29
|
+
"vovk": "^3.0.0-beta.98"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
32
|
"ajv": "^8.17.1",
|