@devmoods/express-extras 0.30.0 → 0.31.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.
- package/dist/validate.js +9 -5
- package/package.json +11 -11
package/dist/validate.js
CHANGED
|
@@ -32,11 +32,18 @@ export function validateParams(schema) {
|
|
|
32
32
|
next();
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
function createAjv(options) {
|
|
36
36
|
const ajv = new Ajv({
|
|
37
37
|
allErrors: true,
|
|
38
|
+
validateFormats: false,
|
|
38
39
|
...options,
|
|
39
40
|
});
|
|
41
|
+
ajv.addKeyword('$enumNames');
|
|
42
|
+
ajv.addKeyword('$bitiforms');
|
|
43
|
+
return ajv;
|
|
44
|
+
}
|
|
45
|
+
export function compileValidateSchema(schema, options = {}) {
|
|
46
|
+
const ajv = createAjv(options);
|
|
40
47
|
const validate = ajv.compile(schema);
|
|
41
48
|
return (data) => {
|
|
42
49
|
const valid = validate(data);
|
|
@@ -55,10 +62,7 @@ export function compileValidateSchema(schema, options = {}) {
|
|
|
55
62
|
};
|
|
56
63
|
}
|
|
57
64
|
export function validateSchema(data, schema, options = {}) {
|
|
58
|
-
const ajv =
|
|
59
|
-
allErrors: true,
|
|
60
|
-
...options,
|
|
61
|
-
});
|
|
65
|
+
const ajv = createAjv(options);
|
|
62
66
|
const valid = ajv.validate(schema, data);
|
|
63
67
|
if (valid) {
|
|
64
68
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devmoods/express-extras",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Kubernetes-ready utilities for rapid Node.js application development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,22 +23,22 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@devmoods/eslint-config": "^1.
|
|
26
|
+
"@devmoods/eslint-config": "^1.13.1",
|
|
27
27
|
"@types/koa-compose": "^3.2.8",
|
|
28
|
-
"@types/node": "20.
|
|
28
|
+
"@types/node": "20.14.2",
|
|
29
29
|
"@types/supertest": "^6.0.2",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
31
|
-
"@typescript-eslint/parser": "^7.
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
|
31
|
+
"@typescript-eslint/parser": "^7.12.0",
|
|
32
32
|
"@vitest/coverage-v8": "^1.3.1",
|
|
33
33
|
"chalk": "^5.3.0",
|
|
34
34
|
"eslint": "^8.57.0",
|
|
35
35
|
"eslint-plugin-import": "^2.29.1",
|
|
36
36
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
37
37
|
"eslint-plugin-prettier": "^5.1.3",
|
|
38
|
-
"eslint-plugin-react": "^7.
|
|
38
|
+
"eslint-plugin-react": "^7.34.2",
|
|
39
39
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
40
40
|
"faktory-worker": "^4.5.1",
|
|
41
|
-
"prettier": "3.
|
|
41
|
+
"prettier": "3.3.1",
|
|
42
42
|
"supertest": "7.0.0",
|
|
43
43
|
"ts-node": "10.9.2",
|
|
44
44
|
"typescript": "5.4.5",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"@types/pg": "^8.11.2",
|
|
57
57
|
"@types/superagent": "^8.1.4",
|
|
58
58
|
"@types/uuid": "^9.0.8",
|
|
59
|
-
"ajv": "^8.
|
|
59
|
+
"ajv": "^8.16.0",
|
|
60
60
|
"bcrypt": "^5.1.1",
|
|
61
61
|
"body-parser": "^1.20.2",
|
|
62
|
-
"commander": "^12.
|
|
62
|
+
"commander": "^12.1.0",
|
|
63
63
|
"compose-middleware": "^5.0.1",
|
|
64
64
|
"cookie-parser": "^1.4.6",
|
|
65
65
|
"dotenv": "^16.4.5",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"jsonwebtoken": "^9.0.2",
|
|
70
70
|
"meow": "^13.2.0",
|
|
71
71
|
"nodemailer": "^6.9.11",
|
|
72
|
-
"pg": "^8.
|
|
72
|
+
"pg": "^8.12.0",
|
|
73
73
|
"redis": "^4.6.13",
|
|
74
74
|
"sql-template-strings": "^2.2.2",
|
|
75
75
|
"uuid": "^9.0.1",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"faktory-worker": "^4.5.1"
|
|
94
94
|
},
|
|
95
95
|
"engines": {
|
|
96
|
-
"node": ">=20.3.0 <
|
|
96
|
+
"node": ">=20.3.0 <23"
|
|
97
97
|
},
|
|
98
98
|
"scripts": {
|
|
99
99
|
"start": "ts-node --esm example/index.ts",
|