@hvedinich/utils 0.0.40 → 0.0.44
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
|
+
const lettersAndSpaceRegExp = '^[ёЁА-Яа-яa-zA-Z]{2,20}(\\s)?([ёЁА-Яа-яa-zA-Z]{2,20})??$';
|
|
1
2
|
const onlyLettersRegExp = '^[А-Яа-яёЁa-zA-Z]{2,30}$';
|
|
2
|
-
const passwordRegExp = '^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[|{_`\\-=+}?№!@#\\$%\\^&\\*\\(\\)\\[\\]:;\'",\\.A-Za-z
|
|
3
|
+
const passwordRegExp = '^(?=.*[a-zа-яё])(?=.*[A-ZА-ЯЁ])(?=.*\\d)[|{_`\\-=+}?№!@#\\$%\\^&\\*\\(\\)\\[\\]:;\'",\\.A-Za-zа-яА-ЯёЁ\\d]{8,30}$';
|
|
3
4
|
const descriptionRegExp = '^[А-Яа-яёЁa-zA-Z0-9_!@#№*&.,/?();:\'"=-\\s+]{2,1500}$';
|
|
4
5
|
const enumRegExp = '^[А-Яа-яёЁa-zA-Z0-9_]{2,30}$';
|
|
5
6
|
const numberLetterSymbolRegExp = '^[a-zA-ZА-Яа-яёЁ0-9_!.№,?():\'"-\\s+]{2,100}$';
|
|
@@ -9,6 +10,7 @@ const titleRegExp = '^[a-zA-ZА-Яа-яёЁ0-9_!.№,?():\'"-\\s+]{2,80}$';
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
module.exports = {
|
|
13
|
+
lettersAndSpaceRegExp,
|
|
12
14
|
onlyLettersRegExp,
|
|
13
15
|
passwordRegExp,
|
|
14
16
|
descriptionRegExp,
|
package/src/server/index.js
CHANGED
|
@@ -142,12 +142,15 @@ const waitServices = async (services = {}, logger = console) => {
|
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
let
|
|
145
|
+
let isHealthyQueue = true;
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
/**
|
|
148
|
+
* should return the general state of all health checks
|
|
149
|
+
*/
|
|
150
|
+
const checkIsAlive = () => isHealthyQueue;
|
|
148
151
|
|
|
149
152
|
const setQueueHealthCheck = (value) => {
|
|
150
|
-
|
|
153
|
+
isHealthyQueue = value;
|
|
151
154
|
};
|
|
152
155
|
|
|
153
156
|
module.exports = {
|
package/src/utils/mappers.js
CHANGED
|
@@ -19,6 +19,7 @@ const mergeWithPrevious = (curr, prev) => {
|
|
|
19
19
|
const mapAddress = ({
|
|
20
20
|
id,
|
|
21
21
|
name,
|
|
22
|
+
street,
|
|
22
23
|
location: {
|
|
23
24
|
longitude,
|
|
24
25
|
latitude,
|
|
@@ -26,6 +27,7 @@ const mapAddress = ({
|
|
|
26
27
|
}) => ({
|
|
27
28
|
id: id || `${longitude}-${latitude}`,
|
|
28
29
|
name,
|
|
30
|
+
street,
|
|
29
31
|
location: longitude && latitude ? {
|
|
30
32
|
type: 'Point',
|
|
31
33
|
coordinates: [longitude, latitude],
|
package/src/utils/queryUtils.js
CHANGED
|
@@ -8,7 +8,7 @@ const parseFilter = ({ ctx, criteria, allowed }) => {
|
|
|
8
8
|
throw new ValidationError({ ctx, message: `criteria not found id: ${cur.id}`, sanitized: 'criteria not found' });
|
|
9
9
|
}
|
|
10
10
|
if (typeof field === 'function') {
|
|
11
|
-
const { key, value } = field(cur.values);
|
|
11
|
+
const { key, value } = field(cur.values, criteria);
|
|
12
12
|
acc[key] = value;
|
|
13
13
|
} else {
|
|
14
14
|
// eslint-disable-next-line prefer-destructuring
|