@hvedinich/utils 0.0.43 → 0.0.47
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/package.json
CHANGED
package/src/constants/regExp.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const lettersAndSpaceRegExp = '^[ёЁА-Яа-яa-zA-Z]{2,20}(\\s)?([ёЁА-Яа-яa-zA-Z]{2,20})??$';
|
|
2
2
|
const onlyLettersRegExp = '^[А-Яа-яёЁa-zA-Z]{2,30}$';
|
|
3
|
+
const companyNameRegExp = '^[0-9- ёЁА-Яа-яa-zA-Z"]{2,50}$';
|
|
3
4
|
const passwordRegExp = '^(?=.*[a-zа-яё])(?=.*[A-ZА-ЯЁ])(?=.*\\d)[|{_`\\-=+}?№!@#\\$%\\^&\\*\\(\\)\\[\\]:;\'",\\.A-Za-zа-яА-ЯёЁ\\d]{8,30}$';
|
|
4
5
|
const descriptionRegExp = '^[А-Яа-яёЁa-zA-Z0-9_!@#№*&.,/?();:\'"=-\\s+]{2,1500}$';
|
|
5
6
|
const enumRegExp = '^[А-Яа-яёЁa-zA-Z0-9_]{2,30}$';
|
|
@@ -10,6 +11,7 @@ const titleRegExp = '^[a-zA-ZА-Яа-яёЁ0-9_!.№,?():\'"-\\s+]{2,80}$';
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
module.exports = {
|
|
14
|
+
componyNameRegExp,
|
|
13
15
|
lettersAndSpaceRegExp,
|
|
14
16
|
onlyLettersRegExp,
|
|
15
17
|
passwordRegExp,
|
package/src/utils/queryUtils.js
CHANGED
|
@@ -4,11 +4,12 @@ const parseFilter = ({ ctx, criteria, allowed }) => {
|
|
|
4
4
|
if (!criteria) return {};
|
|
5
5
|
return criteria.reduce((acc, cur) => {
|
|
6
6
|
const field = allowed[cur.id];
|
|
7
|
+
if ( field === 'skip') return acc
|
|
7
8
|
if (!field) {
|
|
8
9
|
throw new ValidationError({ ctx, message: `criteria not found id: ${cur.id}`, sanitized: 'criteria not found' });
|
|
9
10
|
}
|
|
10
11
|
if (typeof field === 'function') {
|
|
11
|
-
const { key, value } = field(cur.values);
|
|
12
|
+
const { key, value } = field(cur.values, criteria);
|
|
12
13
|
acc[key] = value;
|
|
13
14
|
} else {
|
|
14
15
|
// eslint-disable-next-line prefer-destructuring
|