pi-kiosk-shared 1.0.1 → 1.0.2
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/validation.d.ts +1 -1
- package/dist/validation.js +7 -7
- package/package.json +1 -1
package/dist/validation.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface ValidationResult {
|
|
|
3
3
|
errors: Record<string, string>;
|
|
4
4
|
}
|
|
5
5
|
export declare const validators: {
|
|
6
|
-
required: (value: any
|
|
6
|
+
required: (value: any) => string | null;
|
|
7
7
|
email: (value: string) => string | null;
|
|
8
8
|
minLength: (value: string, min: number, fieldName: string) => string | null;
|
|
9
9
|
maxLength: (value: string, max: number, fieldName: string) => string | null;
|
package/dist/validation.js
CHANGED
|
@@ -5,9 +5,9 @@ exports.validationSchemas = exports.validateSchema = exports.validators = void 0
|
|
|
5
5
|
// ValidationError is imported but not used directly in this file
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
7
|
exports.validators = {
|
|
8
|
-
required: (value
|
|
8
|
+
required: (value) => {
|
|
9
9
|
if (value === null || value === undefined || value === '') {
|
|
10
|
-
return
|
|
10
|
+
return constants_1.UI_MESSAGES.REQUIRED_FIELD;
|
|
11
11
|
}
|
|
12
12
|
return null;
|
|
13
13
|
},
|
|
@@ -86,28 +86,28 @@ exports.validateSchema = validateSchema;
|
|
|
86
86
|
exports.validationSchemas = {
|
|
87
87
|
login: {
|
|
88
88
|
username: [
|
|
89
|
-
(value) => exports.validators.required(value
|
|
89
|
+
(value) => exports.validators.required(value),
|
|
90
90
|
exports.validators.username
|
|
91
91
|
],
|
|
92
92
|
password: [
|
|
93
|
-
(value) => exports.validators.required(value
|
|
93
|
+
(value) => exports.validators.required(value),
|
|
94
94
|
exports.validators.password
|
|
95
95
|
]
|
|
96
96
|
},
|
|
97
97
|
customerEmail: {
|
|
98
98
|
email: [
|
|
99
|
-
(value) => exports.validators.required(value
|
|
99
|
+
(value) => exports.validators.required(value),
|
|
100
100
|
exports.validators.email
|
|
101
101
|
]
|
|
102
102
|
},
|
|
103
103
|
product: {
|
|
104
104
|
name: [
|
|
105
|
-
(value) => exports.validators.required(value
|
|
105
|
+
(value) => exports.validators.required(value),
|
|
106
106
|
(value) => exports.validators.minLength(value, 2, 'Název produktu'),
|
|
107
107
|
(value) => exports.validators.maxLength(value, constants_1.APP_CONFIG.MAX_PRODUCT_NAME_LENGTH, 'Název produktu')
|
|
108
108
|
],
|
|
109
109
|
price: [
|
|
110
|
-
(value) => exports.validators.required(value
|
|
110
|
+
(value) => exports.validators.required(value),
|
|
111
111
|
(value) => exports.validators.positiveNumber(value, 'Cena')
|
|
112
112
|
],
|
|
113
113
|
description: [
|