@naturalcycles/backend-lib 9.36.0 → 9.37.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/server/serverStatsMiddleware.js +2 -1
- package/dist/validation/ajv/ajvValidateRequest.js +1 -1
- package/dist/validation/joi/joiValidateRequest.js +1 -1
- package/package.json +2 -2
- package/src/server/serverStatsMiddleware.ts +2 -1
- package/src/validation/ajv/ajvValidateRequest.ts +1 -1
- package/src/validation/joi/joiValidateRequest.ts +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _mb } from '@naturalcycles/js-lib';
|
|
2
|
-
import {
|
|
2
|
+
import { _sum } from '@naturalcycles/js-lib/array/array.util.js';
|
|
3
|
+
import { _sortBy } from '@naturalcycles/js-lib/array/sort.js';
|
|
3
4
|
import { _ms } from '@naturalcycles/js-lib/datetime/time.util.js';
|
|
4
5
|
import { _percentile } from '@naturalcycles/js-lib/math/math.util.js';
|
|
5
6
|
import { NumberStack } from '@naturalcycles/js-lib/math/stack.util.js';
|
|
@@ -29,7 +29,7 @@ class AjvValidateRequest {
|
|
|
29
29
|
const input = req[reqProperty] || {};
|
|
30
30
|
const ajvSchema = AjvSchema.create(schema);
|
|
31
31
|
const [error, output] = ajvSchema.getValidationResult(input, {
|
|
32
|
-
inputName: `request
|
|
32
|
+
inputName: `request.${reqProperty}`,
|
|
33
33
|
});
|
|
34
34
|
if (error) {
|
|
35
35
|
handleValidationError(error, input, opt);
|
|
@@ -25,7 +25,7 @@ class ValidateRequest {
|
|
|
25
25
|
validate(req, reqProperty, schema, opt = {}) {
|
|
26
26
|
const originalProperty = req[reqProperty] || {};
|
|
27
27
|
// Joi does not mutate the input
|
|
28
|
-
const [error, value] = getValidationResult(originalProperty, schema, `request
|
|
28
|
+
const [error, value] = getValidationResult(originalProperty, schema, `request.${reqProperty}`);
|
|
29
29
|
if (error) {
|
|
30
30
|
if (opt.redactPaths) {
|
|
31
31
|
error.data.joiValidationErrorItems.length = 0; // clears the array
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/backend-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.37.0",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@sentry/node": "^10"
|
|
7
7
|
},
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@sentry/node": "^10",
|
|
30
30
|
"@types/ejs": "^3",
|
|
31
31
|
"fastify": "^5",
|
|
32
|
-
"@naturalcycles/dev-lib": "
|
|
32
|
+
"@naturalcycles/dev-lib": "20.6.0"
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": "./dist/index.js",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _mb } from '@naturalcycles/js-lib'
|
|
2
|
-
import {
|
|
2
|
+
import { _sum } from '@naturalcycles/js-lib/array/array.util.js'
|
|
3
|
+
import { _sortBy } from '@naturalcycles/js-lib/array/sort.js'
|
|
3
4
|
import { _ms } from '@naturalcycles/js-lib/datetime/time.util.js'
|
|
4
5
|
import { _percentile } from '@naturalcycles/js-lib/math/math.util.js'
|
|
5
6
|
import { NumberStack } from '@naturalcycles/js-lib/math/stack.util.js'
|
|
@@ -54,7 +54,7 @@ class ValidateRequest {
|
|
|
54
54
|
const originalProperty = req[reqProperty] || {}
|
|
55
55
|
|
|
56
56
|
// Joi does not mutate the input
|
|
57
|
-
const [error, value] = getValidationResult(originalProperty, schema, `request
|
|
57
|
+
const [error, value] = getValidationResult(originalProperty, schema, `request.${reqProperty}`)
|
|
58
58
|
|
|
59
59
|
if (error) {
|
|
60
60
|
if (opt.redactPaths) {
|