🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@epilot/validators

Package Overview
Dependencies
Maintainers
49
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@epilot/validators - npm Package Compare versions

Comparing version
0.0.22
to
0.0.23
+1
-1
package.json
{
"name": "@epilot/validators",
"version": "0.0.22",
"version": "0.0.23",
"author": {

@@ -5,0 +5,0 @@ "name": "epilot GmbH",

@@ -12,3 +12,3 @@ type RegExpStatment = {

name: 'email',
regex: /^\s*[_a-zA-Z0-9-+]+(\.[_a-zA-Z0-9-+]+)*(\+[a-zA-Z0-9-]+)?@[a-zA-Z0-9-.]+(\.[a-zA-Z0-9]+)\s*$/,
regex: /^\s*[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}\s*$/,
description: 'this pattern is used to check if the email is valid'

@@ -15,0 +15,0 @@ },

# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.0.22](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.21...v0.0.22) (2022-08-12)
### [0.0.21](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.20...v0.0.21) (2022-08-11)
### [0.0.20](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.19...v0.0.20) (2022-07-06)
### [0.0.19](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.18...v0.0.19) (2022-02-17)
### Features
* new blockName regex ([eeaa2a9](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/eeaa2a9bfe660d381c9989c1ecc52c7065ffa34d))
### [0.0.18](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.17...v0.0.18) (2021-11-02)
### Bug Fixes
* changed incorrect rule name ([ccbb5b0](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/ccbb5b09c8247a6283a225d6547ead59abedb361))
### [0.0.17](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.15...v0.0.17) (2021-07-30)
### [0.0.16](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.15...v0.0.16) (2021-07-29)
### [0.0.15](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.14...v0.0.15) (2021-07-06)
### Bug Fixes
* german telephone name ([a94d87d](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/a94d87dacadb27b25ea4834d42e63ac7d976e2ea))
### [0.0.14](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.13...v0.0.14) (2021-07-06)
### Features
* german telephone format ([2f71df6](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/2f71df6f52298ab9a9390b7ee0de93803023f9d2))
### [0.0.13](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.12...v0.0.13) (2021-06-30)
### [0.0.12](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.11...v0.0.12) (2021-06-30)
### Features
* date range validator ([0bd0367](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/0bd03671432751e1eedc76bba375c049a78bcdf7))
### [0.0.11](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.10...v0.0.11) (2021-05-21)
### Features
* mo-274 translate error messages ([39b5da7](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/39b5da77320693115a5ec71c7b2fe82d3d6b15d9))
### [0.0.10](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.9...v0.0.10) (2021-05-04)
### Bug Fixes
* **future-date:** fix incorrect validation ([bf0a6e7](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/bf0a6e7b0cabd10d4ebc7d95dc282fb4f774c6b6))
### [0.0.9](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.8...v0.0.9) (2021-05-04)
### Features
* **future-date:** add future date validator ([4c2db1c](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/4c2db1c71c4d493282c4f23e609492606071a18f))
### [0.0.8](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.7...v0.0.8) (2021-05-04)
### [0.0.7](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.6...v0.0.7) (2021-03-19)
### [0.0.6](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.5...v0.0.6) (2021-03-19)
### [0.0.5](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.4...v0.0.5) (2021-03-16)
### Bug Fixes
* validators type ([85f75d4](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/85f75d4113b3c06170bea6462d52a2f21a73dc12))
### [0.0.4](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.3...v0.0.4) (2021-03-16)
### Bug Fixes
* regexp types ([cd35ec8](https://gitlab.com/e-pilot/product/frontend/base/validators/commit/cd35ec89cc6bec0ef429b6d2b6f192c2553d0ed3))
### [0.0.3](https://gitlab.com/e-pilot/product/frontend/base/validators/compare/v0.0.2...v0.0.3) (2021-03-15)
### 0.0.2 (2021-03-15)
export * from './utils';
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./validators.cjs.production.min.js')
} else {
module.exports = require('./validators.cjs.development.js')
}
export { default as regExpStatments } from './reg_exps';
export * from './validators';
export * from './schema_keywords';
declare type RegExpStatment = {
[key: string]: {
name: string;
regex: RegExp;
description: string;
};
};
declare const regExpStatments: RegExpStatment;
export default regExpStatments;
import { ErrorObject } from 'ajv';
declare type SchemaValidateFunction = {
(schema: any, data: any): boolean | Promise<any>;
errors?: Partial<ErrorObject>[];
};
declare type SchemaKeyword = {
keyword: string;
callback: (schema: any, data: any) => boolean;
errorMessage: {
[locale: string]: string;
};
};
export declare const schemaKeywords: SchemaKeyword[];
export declare function validateSchemaKeyword(schemaKeyword: SchemaKeyword, locale?: string): SchemaValidateFunction;
export {};
import IBAN from 'iban';
/**
* Validates that a date is actually valid
* @param data date as string in DD.MM.YYYY
* @returns boolean
*/
export declare function validateDate(data: string): boolean;
/**
* Validate date in german format is in the past
* @param data date as string DD.MM.YYY
* @returns boolean
*/
export declare function validateBirthDate(data: string): boolean;
/**
* Validate date is 14 days in the future
* @param data date as string DD.MM.YYY
* @returns boolean
*/
export declare function validateFutureDate(data: string): boolean;
export declare function parseDateDE(dateStr: string): Date;
declare type FunctionalValidators = {
[key: string]: {
name: string;
callback: (data: string) => boolean;
description: string;
};
};
/**
* Validate iban and validate its syntax
* @param data iban string
* @returns boolean
*/
export declare function validateIBAN(data: string): boolean;
export declare const functionalValidators: FunctionalValidators;
export declare const IBAN_Specifications: Record<string, IBAN.Specification>;
export {};
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var IBAN = _interopDefault(require('iban'));
var dayjs = _interopDefault(require('dayjs'));
var customParseFormat = _interopDefault(require('dayjs/plugin/customParseFormat'));
var regExpStatments = {
email: {
name: 'email',
regex: /^\s*[_a-zA-Z0-9-+]+(\.[_a-zA-Z0-9-+]+)*(\+[a-zA-Z0-9-]+)?@[a-zA-Z0-9-.]+(\.[a-zA-Z0-9]+)\s*$/,
description: 'this pattern is used to check if the email is valid'
},
lettersMinimum_3: {
name: 'lettersMinimum_3',
regex: /^[a-zA-Z]{3,}$/,
description: 'this pattern is used to validate that the input length is at least 3 letter'
},
name: {
name: 'name',
regex: /^([^0-9!“§$%&/()=?`;:_.,#+*’^°´@{}"[\]<>±|\\]*)$/,
description: 'This pattern is used to validate that the input does not contain numbers, and some symbols.'
},
blockName: {
name: 'name',
regex: /^([^!“§$%&/()=?`;:_.,#+*’^°´@{}"[\]<>±|\\]*)$/,
description: 'This pattern is used to validate that the input does not contain special symbols'
},
numbersMinimum_6: {
name: 'numbersMinimum_6',
regex: /^[0-9]{6,}$/,
description: 'this pattern is used to validate that the input length is at least 6 numbers'
},
numbersTelephone_6: {
name: 'numbersTelephone_6',
regex: /^[+]*[0-9]{6,}$/,
description: 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'
},
numbersExact_11: {
name: 'numbersExact_11',
regex: /^[0-9]{11,11}$/,
description: 'this pattern is used to validate that the input length exactly 12 numbers'
},
numbersMaximum_11: {
name: 'numbersMaximum_11',
regex: /^[0-9]{1,11}$/,
description: 'this pattern is used to validate that the input length is maximum 11 numbers'
},
date_de: {
name: 'date_de',
regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,
description: 'this pattern is used to validate that the input is valid german date DD.MM.YYYY'
},
telephone_de: {
name: 'telephone_de',
regex: /^([+][0-9]{1,3}[ .-]?)?([(]{1}[0-9]{1,6}[)])?([0-9 .-/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
description: 'this pattern is used to validate that the input is a german telephone'
}
};
dayjs.extend(customParseFormat);
/**
* Validates that a date is actually valid
* @param data date as string in DD.MM.YYYY
* @returns boolean
*/
function validateDate(data) {
return dayjs(data, 'DD.MM.YYYY', true).isValid();
}
/**
* Validate date in german format is in the past
* @param data date as string DD.MM.YYY
* @returns boolean
*/
function validateBirthDate(data) {
var de_date = regExpStatments.date_de.regex; // check if the data format matches the de format and the date in the past
if (de_date.test(data)) {
if (parseDateDE(data).getTime() < new Date().getTime()) {
return true;
}
}
return false;
}
/**
* Validate date is 14 days in the future
* @param data date as string DD.MM.YYY
* @returns boolean
*/
function validateFutureDate(data) {
var de_date = regExpStatments.date_de.regex; // check if the data format matches the de format
if (de_date.test(data)) {
if (parseDateDE(data).getTime() > new Date().getTime() + 14 * 24 * 60 * 60 * 1000) {
return true;
}
}
return false;
}
function parseDateDE(dateStr) {
var dateArray = dateStr.split('.');
var date = new Date();
date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0]);
return date;
}
/**
* Validate iban and validate its syntax
* @param data iban string
* @returns boolean
*/
function validateIBAN(data) {
return IBAN.isValid(data);
}
var functionalValidators = {
iban: {
name: 'iban',
callback: validateIBAN,
description: 'this validation function will validate the syntax of the provided iban'
},
birth_date: {
name: 'birth_date',
callback: validateBirthDate,
description: 'this function will validate that the date is in the past'
},
future_date_14: {
name: 'future_date_14',
callback: validateFutureDate,
description: 'this function will validate that the date is in the future with 14 days at least'
}
};
var IBAN_Specifications = IBAN.countries;
var schemaKeywords = [{
keyword: 'email',
callback: function callback(schema, data) {
return schema ? regExpStatments.email.regex.test(data) : false;
},
errorMessage: {
en: 'Please enter a valid email address.',
de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'
}
}, {
keyword: 'onlyLetters',
callback: function callback(schema, data) {
return schema ? /^[a-zA-Z]+$/.test(data) : false;
},
errorMessage: {
en: 'Only letters allowed.',
de: 'Nur Buchstaben erlaubt.'
}
}, {
keyword: 'onlyNumbers',
callback: function callback(schema, data) {
return schema ? /^[0-9]+$/.test(data) : false;
},
errorMessage: {
en: 'Only numbers allowed.',
de: 'Nur Zahlen erlaubt.'
}
}, {
keyword: 'dateDE',
callback: function callback(schema, data) {
return schema ? regExpStatments.date_de.regex.test(data) : false;
},
errorMessage: {
en: 'Date should have the format DD.MM.YYYY.',
de: 'Das Datum sollte das Format TT.MM.JJJJ haben.'
}
}, {
keyword: 'minNumbersTelephone',
callback: function callback(schema, data) {
return schema && typeof schema === 'number' ? new RegExp("^[+]*[0-9]{" + schema + ",}$").test(data) : false;
},
errorMessage: {
en: 'Please enter a valid telephone number.',
de: 'Bitte geben Sie eine gültige Telefonnummer ein.'
}
}, {
keyword: 'validDateDE',
callback: function callback(schema, data) {
return schema ? validateDate(data) : false;
},
errorMessage: {
en: 'Please enter a valid date.',
de: 'Bitte geben Sie ein gültiges datum ein.'
}
}, {
keyword: 'futureDateDE',
callback: function callback(schema, data) {
return schema && typeof schema === 'number' ? parseDateDE(data).getTime() > new Date().getTime() + schema * 24 * 60 * 60 * 1000 : false;
},
errorMessage: {
en: 'The date must be at least {schema} days in the future.',
de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.'
}
}, {
keyword: 'rangeDateDE',
callback: function callback(schema, data) {
return schema && Array.isArray(schema) && schema.length === 2 ? parseDateDE(data).getTime() >= new Date().getTime() + schema[0] * 24 * 60 * 60 * 1000 && parseDateDE(data).getTime() <= new Date().getTime() + schema[1] * 24 * 60 * 60 * 1000 : false;
},
errorMessage: {
en: 'Date must be between {minDate} and {maxDate}.',
de: 'Datum muss zwischen {minDate} und {maxDate} liegen.'
}
}, {
keyword: 'birthdateDE',
callback: function callback(schema, data) {
return schema ? parseDateDE(data).getTime() < new Date().getTime() : false;
},
errorMessage: {
en: 'Please enter a valid date of birth.',
de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.'
}
}];
function convertDate(date, separator) {
if (separator === void 0) {
separator = '.';
}
function pad(s) {
return s < 10 ? '0' + s : s;
}
return [pad(date.getDate()), pad(date.getMonth() + 1), date.getFullYear()].join(separator);
}
function validateSchemaKeyword(schemaKeyword, locale) {
var keyword = schemaKeyword.keyword,
callback = schemaKeyword.callback,
errorMessage = schemaKeyword.errorMessage;
var validate = function validate(schema, data) {
switch (keyword) {
case 'rangeDateDE':
{
var minDays = schema[0],
maxDays = schema[1];
var minDate = new Date();
minDate.setDate(minDate.getDate() + minDays);
var maxDate = new Date();
maxDate.setDate(maxDate.getDate() + maxDays);
validate.errors = [{
keyword: keyword,
message: errorMessage[locale || 'de'].replace('{minDate}', convertDate(minDate)).replace('{maxDate}', convertDate(maxDate)),
params: {
keyword: keyword
}
}];
break;
}
default:
validate.errors = [{
keyword: keyword,
message: errorMessage ? errorMessage[locale || 'de'].replace('{schema}', schema) : locale === 'en' ? 'The entered format is invalid.' : 'Das eingegebene Format ist ungültig.',
params: {
keyword: keyword
}
}];
break;
}
return callback(schema, data);
};
return validate;
}
exports.IBAN_Specifications = IBAN_Specifications;
exports.functionalValidators = functionalValidators;
exports.parseDateDE = parseDateDE;
exports.regExpStatments = regExpStatments;
exports.schemaKeywords = schemaKeywords;
exports.validateBirthDate = validateBirthDate;
exports.validateDate = validateDate;
exports.validateFutureDate = validateFutureDate;
exports.validateIBAN = validateIBAN;
exports.validateSchemaKeyword = validateSchemaKeyword;
//# sourceMappingURL=validators.cjs.development.js.map
{"version":3,"file":"validators.cjs.development.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts","../src/utils/schema_keywords.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^\\s*[_a-zA-Z0-9-+]+(\\.[_a-zA-Z0-9-+]+)*(\\+[a-zA-Z0-9-]+)?@[a-zA-Z0-9-.]+(\\.[a-zA-Z0-9]+)\\s*$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n name: {\n name: 'name',\n regex: /^([^0-9!“§$%&/()=?`;:_.,#+*’^°´@{}\"[\\]<>±|\\\\]*)$/,\n description:\n 'This pattern is used to validate that the input does not contain numbers, and some symbols.'\n },\n blockName: {\n name: 'name',\n regex: /^([^!“§$%&/()=?`;:_.,#+*’^°´@{}\"[\\]<>±|\\\\]*)$/,\n description:\n 'This pattern is used to validate that the input does not contain special symbols'\n },\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYYY'\n },\n\n telephone_de: {\n name: 'telephone_de',\n regex: /^([+][0-9]{1,3}[ .-]?)?([(]{1}[0-9]{1,6}[)])?([0-9 .-/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,\n description: 'this pattern is used to validate that the input is a german telephone'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat'\n\ndayjs.extend(customParseFormat)\n\n/**\n * Validates that a date is actually valid\n * @param data date as string in DD.MM.YYYY\n * @returns boolean\n */\nexport function validateDate(data: string): boolean {\n return dayjs(data, 'DD.MM.YYYY', true).isValid()\n}\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nexport function parseDateDE(dateStr: string): Date {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries","import regExpStatments from './reg_exps'\nimport { ErrorObject } from 'ajv'\nimport { parseDateDE, validateDate } from './validators'\n\ntype SchemaValidateFunction = {\n (schema: any, data: any):\n | boolean\n | Promise<any>\n errors?: Partial<ErrorObject>[]\n}\n\ntype SchemaKeyword = {\n keyword: string\n callback: (schema: any, data: any) => boolean\n errorMessage: {\n [locale: string]: string\n }\n}\n\nexport const schemaKeywords: SchemaKeyword[] = [\n {\n keyword: 'email',\n callback: (schema: boolean, data: string) =>\n schema ? regExpStatments.email.regex.test(data) : false,\n errorMessage: {\n en: 'Please enter a valid email address.',\n de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'\n }\n },\n {\n keyword: 'onlyLetters',\n callback: (schema: boolean, data: string) =>\n schema ? /^[a-zA-Z]+$/.test(data) : false,\n errorMessage: {\n en: 'Only letters allowed.',\n de: 'Nur Buchstaben erlaubt.'\n }\n },\n {\n keyword: 'onlyNumbers',\n callback: (schema: boolean, data: string) =>\n schema ? /^[0-9]+$/.test(data) : false,\n errorMessage: {\n en: 'Only numbers allowed.',\n de: 'Nur Zahlen erlaubt.'\n }\n },\n {\n keyword: 'dateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? regExpStatments.date_de.regex.test(data)\n : false,\n errorMessage: {\n en: 'Date should have the format DD.MM.YYYY.',\n de: 'Das Datum sollte das Format TT.MM.JJJJ haben.'\n }\n },\n {\n keyword: 'minNumbersTelephone',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? new RegExp(`^[+]*[0-9]{${schema},}$`).test(data)\n : false,\n errorMessage: {\n en: 'Please enter a valid telephone number.',\n de: 'Bitte geben Sie eine gültige Telefonnummer ein.'\n }\n },\n {\n keyword: 'validDateDE',\n callback: (schema: boolean, data: string ) =>\n schema? validateDate(data): false,\n errorMessage: {\n en: 'Please enter a valid date.',\n de: 'Bitte geben Sie ein gültiges datum ein.'\n }\n },\n {\n keyword: 'futureDateDE',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? parseDateDE(data).getTime() > new Date().getTime()+(schema*24*60*60*1000)\n : false,\n errorMessage: {\n en: 'The date must be at least {schema} days in the future.',\n de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.'\n }\n },\n {\n keyword: 'rangeDateDE',\n callback: (schema: number[], data: string) => {\n return schema && Array.isArray(schema) && schema.length === 2\n ? parseDateDE(data).getTime() >= new Date().getTime()+(schema[0]*24*60*60*1000) && parseDateDE(data).getTime() <= new Date().getTime()+(schema[1]*24*60*60*1000)\n : false\n },\n errorMessage: {\n en: 'Date must be between {minDate} and {maxDate}.',\n de: 'Datum muss zwischen {minDate} und {maxDate} liegen.'\n }\n },\n {\n keyword: 'birthdateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? parseDateDE(data).getTime() < new Date().getTime()\n : false,\n errorMessage: {\n en: 'Please enter a valid date of birth.',\n de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.'\n }\n }\n]\n\nfunction convertDate(date: Date, separator = '.') {\n function pad(s: number) { return (s < 10) ? '0' + s : s; }\n return [pad(date.getDate()), pad(date.getMonth()+1), date.getFullYear()].join(separator)\n}\n\nexport function validateSchemaKeyword(\n schemaKeyword: SchemaKeyword,\n locale?: string\n): SchemaValidateFunction {\n const { keyword, callback, errorMessage } = schemaKeyword\n\n const validate: SchemaValidateFunction = (schema: any, data: any) => {\n switch(keyword) {\n case 'rangeDateDE': {\n const [minDays, maxDays] = schema\n const minDate = new Date()\n minDate.setDate(minDate.getDate() + minDays)\n const maxDate = new Date()\n maxDate.setDate(maxDate.getDate() + maxDays)\n\n validate.errors = [\n {\n keyword,\n message: errorMessage[locale || 'de'].replace('{minDate}', convertDate(minDate)).replace('{maxDate}', convertDate(maxDate)),\n params: { keyword }\n }\n ]\n break\n }\n default:\n validate.errors = [\n {\n keyword,\n message: errorMessage\n ? errorMessage[locale || 'de'].replace('{schema}', schema)\n : locale === 'en'\n ? 'The entered format is invalid.'\n : 'Das eingegebene Format ist ungültig.',\n params: { keyword }\n }\n ]\n break\n }\n\n return callback(schema, data)\n }\n\n return validate\n}\n"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","blockName","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","telephone_de","dayjs","extend","customParseFormat","validateDate","data","isValid","validateBirthDate","de_date","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","functionalValidators","iban","callback","birth_date","future_date_14","IBAN_Specifications","countries","schemaKeywords","keyword","schema","errorMessage","en","de","RegExp","Array","isArray","length","convertDate","separator","pad","s","getDate","getMonth","getFullYear","join","validateSchemaKeyword","schemaKeyword","locale","validate","minDays","maxDays","minDate","setDate","maxDate","errors","message","replace","params"],"mappings":";;;;;;;;;;AAQA,IAAMA,eAAe,GAAmB;AACtCC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAE,OADD;AAELC,IAAAA,KAAK,EAAE,8FAFF;AAGLC,IAAAA,WAAW,EAAE;AAHR,GAD+B;AAOtCC,EAAAA,gBAAgB,EAAE;AAChBH,IAAAA,IAAI,EAAE,kBADU;AAEhBC,IAAAA,KAAK,EAAE,gBAFS;AAGhBC,IAAAA,WAAW,EACT;AAJc,GAPoB;AAatCF,EAAAA,IAAI,EAAE;AACJA,IAAAA,IAAI,EAAE,MADF;AAEJC,IAAAA,KAAK,EAAE,kDAFH;AAG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;AAOA;AACD;;AACD;AACEoB,QAAAA,QAAQ,CAACM,MAAT,GAAkB,CAChB;AACE1B,UAAAA,OAAO,EAAPA,OADF;AAEE2B,UAAAA,OAAO,EAAEzB,YAAY,GACjBA,YAAY,CAACiB,MAAM,IAAI,IAAX,CAAZ,CAA6BS,OAA7B,CAAqC,UAArC,EAAiD3B,MAAjD,CADiB,GAEjBkB,MAAM,KAAK,IAAX,GACA,gCADA,GAEA,sCANN;AAOEU,UAAAA,MAAM,EAAE;AAAE7B,YAAAA,OAAO,EAAPA;AAAF;AAPV,SADgB,CAAlB;AAWA;AA7BJ;;AAgCA,WAAON,QAAQ,CAACO,MAAD,EAASzB,IAAT,CAAf;AACD,GAlCD;;AAoCA,SAAO4C,QAAP;AACD;;;;;;;;;;;;;"}
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("iban")),a=e(require("dayjs")),n=e(require("dayjs/plugin/customParseFormat")),r={email:{name:"email",regex:/^\s*[_a-zA-Z0-9-+]+(\.[_a-zA-Z0-9-+]+)*(\+[a-zA-Z0-9-]+)?@[a-zA-Z0-9-.]+(\.[a-zA-Z0-9]+)\s*$/,description:"this pattern is used to check if the email is valid"},lettersMinimum_3:{name:"lettersMinimum_3",regex:/^[a-zA-Z]{3,}$/,description:"this pattern is used to validate that the input length is at least 3 letter"},name:{name:"name",regex:/^([^0-9!“§$%&/()=?`;:_.,#+*’^°´@{}"[\]<>±|\\]*)$/,description:"This pattern is used to validate that the input does not contain numbers, and some symbols."},blockName:{name:"name",regex:/^([^!“§$%&/()=?`;:_.,#+*’^°´@{}"[\]<>±|\\]*)$/,description:"This pattern is used to validate that the input does not contain special symbols"},numbersMinimum_6:{name:"numbersMinimum_6",regex:/^[0-9]{6,}$/,description:"this pattern is used to validate that the input length is at least 6 numbers"},numbersTelephone_6:{name:"numbersTelephone_6",regex:/^[+]*[0-9]{6,}$/,description:"this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign"},numbersExact_11:{name:"numbersExact_11",regex:/^[0-9]{11,11}$/,description:"this pattern is used to validate that the input length exactly 12 numbers"},numbersMaximum_11:{name:"numbersMaximum_11",regex:/^[0-9]{1,11}$/,description:"this pattern is used to validate that the input length is maximum 11 numbers"},date_de:{name:"date_de",regex:/^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,description:"this pattern is used to validate that the input is valid german date DD.MM.YYYY"},telephone_de:{name:"telephone_de",regex:/^([+][0-9]{1,3}[ .-]?)?([(]{1}[0-9]{1,6}[)])?([0-9 .-/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,description:"this pattern is used to validate that the input is a german telephone"}};function i(e){return a(e,"DD.MM.YYYY",!0).isValid()}function s(e){return!!(r.date_de.regex.test(e)&&d(e).getTime()<(new Date).getTime())}function l(e){return!!(r.date_de.regex.test(e)&&d(e).getTime()>(new Date).getTime()+12096e5)}function d(e){var t=e.split("."),a=new Date;return a.setFullYear(+t[2],+t[1]-1,+t[0]),a}function u(e){return t.isValid(e)}a.extend(n);var o={iban:{name:"iban",callback:u,description:"this validation function will validate the syntax of the provided iban"},birth_date:{name:"birth_date",callback:s,description:"this function will validate that the date is in the past"},future_date_14:{name:"future_date_14",callback:l,description:"this function will validate that the date is in the future with 14 days at least"}},m=[{keyword:"email",callback:function(e,t){return!!e&&r.email.regex.test(t)},errorMessage:{en:"Please enter a valid email address.",de:"Bitte geben Sie eine gültige E-Mail-Adresse ein."}},{keyword:"onlyLetters",callback:function(e,t){return!!e&&/^[a-zA-Z]+$/.test(t)},errorMessage:{en:"Only letters allowed.",de:"Nur Buchstaben erlaubt."}},{keyword:"onlyNumbers",callback:function(e,t){return!!e&&/^[0-9]+$/.test(t)},errorMessage:{en:"Only numbers allowed.",de:"Nur Zahlen erlaubt."}},{keyword:"dateDE",callback:function(e,t){return!!e&&r.date_de.regex.test(t)},errorMessage:{en:"Date should have the format DD.MM.YYYY.",de:"Das Datum sollte das Format TT.MM.JJJJ haben."}},{keyword:"minNumbersTelephone",callback:function(e,t){return!(!e||"number"!=typeof e)&&new RegExp("^[+]*[0-9]{"+e+",}$").test(t)},errorMessage:{en:"Please enter a valid telephone number.",de:"Bitte geben Sie eine gültige Telefonnummer ein."}},{keyword:"validDateDE",callback:function(e,t){return!!e&&i(t)},errorMessage:{en:"Please enter a valid date.",de:"Bitte geben Sie ein gültiges datum ein."}},{keyword:"futureDateDE",callback:function(e,t){return!(!e||"number"!=typeof e)&&d(t).getTime()>(new Date).getTime()+24*e*60*60*1e3},errorMessage:{en:"The date must be at least {schema} days in the future.",de:"Das Datum muss mind. {schema} Tage in der Zukunft liegen."}},{keyword:"rangeDateDE",callback:function(e,t){return!(!e||!Array.isArray(e)||2!==e.length)&&d(t).getTime()>=(new Date).getTime()+24*e[0]*60*60*1e3&&d(t).getTime()<=(new Date).getTime()+24*e[1]*60*60*1e3},errorMessage:{en:"Date must be between {minDate} and {maxDate}.",de:"Datum muss zwischen {minDate} und {maxDate} liegen."}},{keyword:"birthdateDE",callback:function(e,t){return!!e&&d(t).getTime()<(new Date).getTime()},errorMessage:{en:"Please enter a valid date of birth.",de:"Bitte geben Sie ein gültiges Geburtsdatum ein."}}];function c(e,t){function a(e){return e<10?"0"+e:e}return void 0===t&&(t="."),[a(e.getDate()),a(e.getMonth()+1),e.getFullYear()].join(t)}exports.IBAN_Specifications=t.countries,exports.functionalValidators=o,exports.parseDateDE=d,exports.regExpStatments=r,exports.schemaKeywords=m,exports.validateBirthDate=s,exports.validateDate=i,exports.validateFutureDate=l,exports.validateIBAN=u,exports.validateSchemaKeyword=function(e,t){var a=e.keyword,n=e.callback,r=e.errorMessage;return function e(i,s){switch(a){case"rangeDateDE":var l=i[0],d=i[1],u=new Date;u.setDate(u.getDate()+l);var o=new Date;o.setDate(o.getDate()+d),e.errors=[{keyword:a,message:r[t||"de"].replace("{minDate}",c(u)).replace("{maxDate}",c(o)),params:{keyword:a}}];break;default:e.errors=[{keyword:a,message:r?r[t||"de"].replace("{schema}",i):"en"===t?"The entered format is invalid.":"Das eingegebene Format ist ungültig.",params:{keyword:a}}]}return n(i,s)}};
//# sourceMappingURL=validators.cjs.production.min.js.map
{"version":3,"file":"validators.cjs.production.min.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts","../src/utils/schema_keywords.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^\\s*[_a-zA-Z0-9-+]+(\\.[_a-zA-Z0-9-+]+)*(\\+[a-zA-Z0-9-]+)?@[a-zA-Z0-9-.]+(\\.[a-zA-Z0-9]+)\\s*$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n name: {\n name: 'name',\n regex: /^([^0-9!“§$%&/()=?`;:_.,#+*’^°´@{}\"[\\]<>±|\\\\]*)$/,\n description:\n 'This pattern is used to validate that the input does not contain numbers, and some symbols.'\n },\n blockName: {\n name: 'name',\n regex: /^([^!“§$%&/()=?`;:_.,#+*’^°´@{}\"[\\]<>±|\\\\]*)$/,\n description:\n 'This pattern is used to validate that the input does not contain special symbols'\n },\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYYY'\n },\n\n telephone_de: {\n name: 'telephone_de',\n regex: /^([+][0-9]{1,3}[ .-]?)?([(]{1}[0-9]{1,6}[)])?([0-9 .-/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,\n description: 'this pattern is used to validate that the input is a german telephone'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat'\n\ndayjs.extend(customParseFormat)\n\n/**\n * Validates that a date is actually valid\n * @param data date as string in DD.MM.YYYY\n * @returns boolean\n */\nexport function validateDate(data: string): boolean {\n return dayjs(data, 'DD.MM.YYYY', true).isValid()\n}\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nexport function parseDateDE(dateStr: string): Date {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries","import regExpStatments from './reg_exps'\nimport { ErrorObject } from 'ajv'\nimport { parseDateDE, validateDate } from './validators'\n\ntype SchemaValidateFunction = {\n (schema: any, data: any):\n | boolean\n | Promise<any>\n errors?: Partial<ErrorObject>[]\n}\n\ntype SchemaKeyword = {\n keyword: string\n callback: (schema: any, data: any) => boolean\n errorMessage: {\n [locale: string]: string\n }\n}\n\nexport const schemaKeywords: SchemaKeyword[] = [\n {\n keyword: 'email',\n callback: (schema: boolean, data: string) =>\n schema ? regExpStatments.email.regex.test(data) : false,\n errorMessage: {\n en: 'Please enter a valid email address.',\n de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'\n }\n },\n {\n keyword: 'onlyLetters',\n callback: (schema: boolean, data: string) =>\n schema ? /^[a-zA-Z]+$/.test(data) : false,\n errorMessage: {\n en: 'Only letters allowed.',\n de: 'Nur Buchstaben erlaubt.'\n }\n },\n {\n keyword: 'onlyNumbers',\n callback: (schema: boolean, data: string) =>\n schema ? /^[0-9]+$/.test(data) : false,\n errorMessage: {\n en: 'Only numbers allowed.',\n de: 'Nur Zahlen erlaubt.'\n }\n },\n {\n keyword: 'dateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? regExpStatments.date_de.regex.test(data)\n : false,\n errorMessage: {\n en: 'Date should have the format DD.MM.YYYY.',\n de: 'Das Datum sollte das Format TT.MM.JJJJ haben.'\n }\n },\n {\n keyword: 'minNumbersTelephone',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? new RegExp(`^[+]*[0-9]{${schema},}$`).test(data)\n : false,\n errorMessage: {\n en: 'Please enter a valid telephone number.',\n de: 'Bitte geben Sie eine gültige Telefonnummer ein.'\n }\n },\n {\n keyword: 'validDateDE',\n callback: (schema: boolean, data: string ) =>\n schema? validateDate(data): false,\n errorMessage: {\n en: 'Please enter a valid date.',\n de: 'Bitte geben Sie ein gültiges datum ein.'\n }\n },\n {\n keyword: 'futureDateDE',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? parseDateDE(data).getTime() > new Date().getTime()+(schema*24*60*60*1000)\n : false,\n errorMessage: {\n en: 'The date must be at least {schema} days in the future.',\n de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.'\n }\n },\n {\n keyword: 'rangeDateDE',\n callback: (schema: number[], data: string) => {\n return schema && Array.isArray(schema) && schema.length === 2\n ? parseDateDE(data).getTime() >= new Date().getTime()+(schema[0]*24*60*60*1000) && parseDateDE(data).getTime() <= new Date().getTime()+(schema[1]*24*60*60*1000)\n : false\n },\n errorMessage: {\n en: 'Date must be between {minDate} and {maxDate}.',\n de: 'Datum muss zwischen {minDate} und {maxDate} liegen.'\n }\n },\n {\n keyword: 'birthdateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? parseDateDE(data).getTime() < new Date().getTime()\n : false,\n errorMessage: {\n en: 'Please enter a valid date of birth.',\n de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.'\n }\n }\n]\n\nfunction convertDate(date: Date, separator = '.') {\n function pad(s: number) { return (s < 10) ? '0' + s : s; }\n return [pad(date.getDate()), pad(date.getMonth()+1), date.getFullYear()].join(separator)\n}\n\nexport function validateSchemaKeyword(\n schemaKeyword: SchemaKeyword,\n locale?: string\n): SchemaValidateFunction {\n const { keyword, callback, errorMessage } = schemaKeyword\n\n const validate: SchemaValidateFunction = (schema: any, data: any) => {\n switch(keyword) {\n case 'rangeDateDE': {\n const [minDays, maxDays] = schema\n const minDate = new Date()\n minDate.setDate(minDate.getDate() + minDays)\n const maxDate = new Date()\n maxDate.setDate(maxDate.getDate() + maxDays)\n\n validate.errors = [\n {\n keyword,\n message: errorMessage[locale || 'de'].replace('{minDate}', convertDate(minDate)).replace('{maxDate}', convertDate(maxDate)),\n params: { keyword }\n }\n ]\n break\n }\n default:\n validate.errors = [\n {\n keyword,\n message: errorMessage\n ? errorMessage[locale || 'de'].replace('{schema}', schema)\n : locale === 'en'\n ? 'The entered format is invalid.'\n : 'Das eingegebene Format ist ungültig.',\n params: { keyword }\n }\n ]\n break\n }\n\n return callback(schema, data)\n }\n\n return validate\n}\n"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","blockName","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","telephone_de","validateDate","data","dayjs","isValid","validateBirthDate","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","extend","customParseFormat","functionalValidators","iban","callback","birth_date","future_date_14","schemaKeywords","keyword","schema","errorMessage","en","de","RegExp","Array","isArray","length","convertDate","separator","pad","s","getDate","getMonth","getFullYear","join","countries","schemaKeyword","locale","validate","minDays","maxDays","minDate","setDate","maxDate","errors","message","replace","params"],"mappings":"wOAQMA,EAAkC,CACtCC,MAAO,CACLC,KAAM,QACNC,MAAO,+FACPC,YAAa,uDAGfC,iBAAkB,CAChBH,KAAM,mBACNC,MAAO,iBACPC,YACE,+EAEJF,KAAM,CACJA,KAAM,OACNC,MAAO,mDACPC,YACA,+FAEFE,UAAW,CACTJ,KAAM,OACNC,MAAO,gDACPC,YACA,oFAEFG,iBAAkB,CAChBL,KAAM,mBACNC,MAAO,cACPC,YACE,gFAGJI,mBAAoB,CAClBN,KAAM,qBACNC,MAAO,kBACPC,YACE,+GAGJK,gBAAiB,CACfP,KAAM,kBACNC,MAAO,iBACPC,YACE,6EAGJM,kBAAmB,CACjBR,KAAM,oBACNC,MAAO,gBACPC,YACE,gFAGJO,QAAS,CACPT,KAAM,UACNC,MAAO,4CACP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CkB,EAAoCnB,EAAazB,UAC9CwB,OACA,kBACIqB,EAAoBpB,KAAXqB,EAAWrB,KACrBsB,EAAU,IAAIxC,KACpBwC,EAAQC,QAAQD,EAAQV,UAAYQ,OAC9BI,EAAU,IAAI1C,KACpB0C,EAAQD,QAAQC,EAAQZ,UAAYS,GAEpCF,EAASM,OAAS,CAChB,CACE1B,QAAAA,EACA2B,QAASzB,EAAaiB,GAAU,MAAMS,QAAQ,YAAanB,EAAYc,IAAUK,QAAQ,YAAanB,EAAYgB,IAClHI,OAAQ,CAAE7B,QAAAA,mBAMdoB,EAASM,OAAS,CAChB,CACE1B,QAAAA,EACA2B,QAASzB,EACLA,EAAaiB,GAAU,MAAMS,QAAQ,WAAY3B,GACtC,OAAXkB,EACA,iCACA,uCACJU,OAAQ,CAAE7B,QAAAA,YAMXJ,EAASK,EAAQzB"}
import IBAN from 'iban';
import dayjs from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat';
var regExpStatments = {
email: {
name: 'email',
regex: /^\s*[_a-zA-Z0-9-+]+(\.[_a-zA-Z0-9-+]+)*(\+[a-zA-Z0-9-]+)?@[a-zA-Z0-9-.]+(\.[a-zA-Z0-9]+)\s*$/,
description: 'this pattern is used to check if the email is valid'
},
lettersMinimum_3: {
name: 'lettersMinimum_3',
regex: /^[a-zA-Z]{3,}$/,
description: 'this pattern is used to validate that the input length is at least 3 letter'
},
name: {
name: 'name',
regex: /^([^0-9!“§$%&/()=?`;:_.,#+*’^°´@{}"[\]<>±|\\]*)$/,
description: 'This pattern is used to validate that the input does not contain numbers, and some symbols.'
},
blockName: {
name: 'name',
regex: /^([^!“§$%&/()=?`;:_.,#+*’^°´@{}"[\]<>±|\\]*)$/,
description: 'This pattern is used to validate that the input does not contain special symbols'
},
numbersMinimum_6: {
name: 'numbersMinimum_6',
regex: /^[0-9]{6,}$/,
description: 'this pattern is used to validate that the input length is at least 6 numbers'
},
numbersTelephone_6: {
name: 'numbersTelephone_6',
regex: /^[+]*[0-9]{6,}$/,
description: 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'
},
numbersExact_11: {
name: 'numbersExact_11',
regex: /^[0-9]{11,11}$/,
description: 'this pattern is used to validate that the input length exactly 12 numbers'
},
numbersMaximum_11: {
name: 'numbersMaximum_11',
regex: /^[0-9]{1,11}$/,
description: 'this pattern is used to validate that the input length is maximum 11 numbers'
},
date_de: {
name: 'date_de',
regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,
description: 'this pattern is used to validate that the input is valid german date DD.MM.YYYY'
},
telephone_de: {
name: 'telephone_de',
regex: /^([+][0-9]{1,3}[ .-]?)?([(]{1}[0-9]{1,6}[)])?([0-9 .-/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
description: 'this pattern is used to validate that the input is a german telephone'
}
};
dayjs.extend(customParseFormat);
/**
* Validates that a date is actually valid
* @param data date as string in DD.MM.YYYY
* @returns boolean
*/
function validateDate(data) {
return dayjs(data, 'DD.MM.YYYY', true).isValid();
}
/**
* Validate date in german format is in the past
* @param data date as string DD.MM.YYY
* @returns boolean
*/
function validateBirthDate(data) {
var de_date = regExpStatments.date_de.regex; // check if the data format matches the de format and the date in the past
if (de_date.test(data)) {
if (parseDateDE(data).getTime() < new Date().getTime()) {
return true;
}
}
return false;
}
/**
* Validate date is 14 days in the future
* @param data date as string DD.MM.YYY
* @returns boolean
*/
function validateFutureDate(data) {
var de_date = regExpStatments.date_de.regex; // check if the data format matches the de format
if (de_date.test(data)) {
if (parseDateDE(data).getTime() > new Date().getTime() + 14 * 24 * 60 * 60 * 1000) {
return true;
}
}
return false;
}
function parseDateDE(dateStr) {
var dateArray = dateStr.split('.');
var date = new Date();
date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0]);
return date;
}
/**
* Validate iban and validate its syntax
* @param data iban string
* @returns boolean
*/
function validateIBAN(data) {
return IBAN.isValid(data);
}
var functionalValidators = {
iban: {
name: 'iban',
callback: validateIBAN,
description: 'this validation function will validate the syntax of the provided iban'
},
birth_date: {
name: 'birth_date',
callback: validateBirthDate,
description: 'this function will validate that the date is in the past'
},
future_date_14: {
name: 'future_date_14',
callback: validateFutureDate,
description: 'this function will validate that the date is in the future with 14 days at least'
}
};
var IBAN_Specifications = IBAN.countries;
var schemaKeywords = [{
keyword: 'email',
callback: function callback(schema, data) {
return schema ? regExpStatments.email.regex.test(data) : false;
},
errorMessage: {
en: 'Please enter a valid email address.',
de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'
}
}, {
keyword: 'onlyLetters',
callback: function callback(schema, data) {
return schema ? /^[a-zA-Z]+$/.test(data) : false;
},
errorMessage: {
en: 'Only letters allowed.',
de: 'Nur Buchstaben erlaubt.'
}
}, {
keyword: 'onlyNumbers',
callback: function callback(schema, data) {
return schema ? /^[0-9]+$/.test(data) : false;
},
errorMessage: {
en: 'Only numbers allowed.',
de: 'Nur Zahlen erlaubt.'
}
}, {
keyword: 'dateDE',
callback: function callback(schema, data) {
return schema ? regExpStatments.date_de.regex.test(data) : false;
},
errorMessage: {
en: 'Date should have the format DD.MM.YYYY.',
de: 'Das Datum sollte das Format TT.MM.JJJJ haben.'
}
}, {
keyword: 'minNumbersTelephone',
callback: function callback(schema, data) {
return schema && typeof schema === 'number' ? new RegExp("^[+]*[0-9]{" + schema + ",}$").test(data) : false;
},
errorMessage: {
en: 'Please enter a valid telephone number.',
de: 'Bitte geben Sie eine gültige Telefonnummer ein.'
}
}, {
keyword: 'validDateDE',
callback: function callback(schema, data) {
return schema ? validateDate(data) : false;
},
errorMessage: {
en: 'Please enter a valid date.',
de: 'Bitte geben Sie ein gültiges datum ein.'
}
}, {
keyword: 'futureDateDE',
callback: function callback(schema, data) {
return schema && typeof schema === 'number' ? parseDateDE(data).getTime() > new Date().getTime() + schema * 24 * 60 * 60 * 1000 : false;
},
errorMessage: {
en: 'The date must be at least {schema} days in the future.',
de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.'
}
}, {
keyword: 'rangeDateDE',
callback: function callback(schema, data) {
return schema && Array.isArray(schema) && schema.length === 2 ? parseDateDE(data).getTime() >= new Date().getTime() + schema[0] * 24 * 60 * 60 * 1000 && parseDateDE(data).getTime() <= new Date().getTime() + schema[1] * 24 * 60 * 60 * 1000 : false;
},
errorMessage: {
en: 'Date must be between {minDate} and {maxDate}.',
de: 'Datum muss zwischen {minDate} und {maxDate} liegen.'
}
}, {
keyword: 'birthdateDE',
callback: function callback(schema, data) {
return schema ? parseDateDE(data).getTime() < new Date().getTime() : false;
},
errorMessage: {
en: 'Please enter a valid date of birth.',
de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.'
}
}];
function convertDate(date, separator) {
if (separator === void 0) {
separator = '.';
}
function pad(s) {
return s < 10 ? '0' + s : s;
}
return [pad(date.getDate()), pad(date.getMonth() + 1), date.getFullYear()].join(separator);
}
function validateSchemaKeyword(schemaKeyword, locale) {
var keyword = schemaKeyword.keyword,
callback = schemaKeyword.callback,
errorMessage = schemaKeyword.errorMessage;
var validate = function validate(schema, data) {
switch (keyword) {
case 'rangeDateDE':
{
var minDays = schema[0],
maxDays = schema[1];
var minDate = new Date();
minDate.setDate(minDate.getDate() + minDays);
var maxDate = new Date();
maxDate.setDate(maxDate.getDate() + maxDays);
validate.errors = [{
keyword: keyword,
message: errorMessage[locale || 'de'].replace('{minDate}', convertDate(minDate)).replace('{maxDate}', convertDate(maxDate)),
params: {
keyword: keyword
}
}];
break;
}
default:
validate.errors = [{
keyword: keyword,
message: errorMessage ? errorMessage[locale || 'de'].replace('{schema}', schema) : locale === 'en' ? 'The entered format is invalid.' : 'Das eingegebene Format ist ungültig.',
params: {
keyword: keyword
}
}];
break;
}
return callback(schema, data);
};
return validate;
}
export { IBAN_Specifications, functionalValidators, parseDateDE, regExpStatments, schemaKeywords, validateBirthDate, validateDate, validateFutureDate, validateIBAN, validateSchemaKeyword };
//# sourceMappingURL=validators.esm.js.map
{"version":3,"file":"validators.esm.js","sources":["../src/utils/reg_exps.ts","../src/utils/validators.ts","../src/utils/schema_keywords.ts"],"sourcesContent":["type RegExpStatment = {\n [key: string]: {\n name: string\n regex: RegExp\n description: string\n }\n}\n\nconst regExpStatments: RegExpStatment = {\n email: {\n name: 'email',\n regex: /^\\s*[_a-zA-Z0-9-+]+(\\.[_a-zA-Z0-9-+]+)*(\\+[a-zA-Z0-9-]+)?@[a-zA-Z0-9-.]+(\\.[a-zA-Z0-9]+)\\s*$/,\n description: 'this pattern is used to check if the email is valid'\n },\n\n lettersMinimum_3: {\n name: 'lettersMinimum_3',\n regex: /^[a-zA-Z]{3,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 3 letter'\n },\n name: {\n name: 'name',\n regex: /^([^0-9!“§$%&/()=?`;:_.,#+*’^°´@{}\"[\\]<>±|\\\\]*)$/,\n description:\n 'This pattern is used to validate that the input does not contain numbers, and some symbols.'\n },\n blockName: {\n name: 'name',\n regex: /^([^!“§$%&/()=?`;:_.,#+*’^°´@{}\"[\\]<>±|\\\\]*)$/,\n description:\n 'This pattern is used to validate that the input does not contain special symbols'\n },\n numbersMinimum_6: {\n name: 'numbersMinimum_6',\n regex: /^[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers'\n },\n\n numbersTelephone_6: {\n name: 'numbersTelephone_6',\n regex: /^[+]*[0-9]{6,}$/,\n description:\n 'this pattern is used to validate that the input length is at least 6 numbers and it could start with + sign'\n },\n\n numbersExact_11: {\n name: 'numbersExact_11',\n regex: /^[0-9]{11,11}$/,\n description:\n 'this pattern is used to validate that the input length exactly 12 numbers'\n },\n\n numbersMaximum_11: {\n name: 'numbersMaximum_11',\n regex: /^[0-9]{1,11}$/,\n description:\n 'this pattern is used to validate that the input length is maximum 11 numbers'\n },\n\n date_de: {\n name: 'date_de',\n regex: /^[0-3][0-9][.][0-1][0-9][.][1|2][0-9]{3}$/,\n description:\n 'this pattern is used to validate that the input is valid german date DD.MM.YYYY'\n },\n\n telephone_de: {\n name: 'telephone_de',\n regex: /^([+][0-9]{1,3}[ .-]?)?([(]{1}[0-9]{1,6}[)])?([0-9 .-/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,\n description: 'this pattern is used to validate that the input is a german telephone'\n }\n}\n\nexport default regExpStatments\n","import regExpStatments from './reg_exps'\nimport IBAN from 'iban'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat'\n\ndayjs.extend(customParseFormat)\n\n/**\n * Validates that a date is actually valid\n * @param data date as string in DD.MM.YYYY\n * @returns boolean\n */\nexport function validateDate(data: string): boolean {\n return dayjs(data, 'DD.MM.YYYY', true).isValid()\n}\n\n/**\n * Validate date in german format is in the past\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateBirthDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format and the date in the past\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() < new Date().getTime()) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * Validate date is 14 days in the future\n * @param data date as string DD.MM.YYY\n * @returns boolean\n */\nexport function validateFutureDate(data: string): boolean {\n const de_date = regExpStatments.date_de.regex\n // check if the data format matches the de format\n\n if (de_date.test(data)) {\n if (parseDateDE(data).getTime() > new Date().getTime()+(14*24*60*60*1000)) {\n return true\n }\n }\n\n return false\n}\n\nexport function parseDateDE(dateStr: string): Date {\n const dateArray = dateStr.split('.')\n const date = new Date()\n\n date.setFullYear(+dateArray[2], +dateArray[1] - 1, +dateArray[0])\n\n return date\n}\n\ntype FunctionalValidators = {\n [key: string]: {\n name: string\n callback: (data: string) => boolean\n description: string\n }\n}\n\n/**\n * Validate iban and validate its syntax\n * @param data iban string\n * @returns boolean\n */\nexport function validateIBAN(data: string): boolean {\n return IBAN.isValid(data)\n}\n\nexport const functionalValidators: FunctionalValidators = {\n iban: {\n name: 'iban',\n callback: validateIBAN,\n description:\n 'this validation function will validate the syntax of the provided iban'\n },\n birth_date: {\n name: 'birth_date',\n callback: validateBirthDate,\n description:\n 'this function will validate that the date is in the past'\n },\n future_date_14: {\n name: 'future_date_14',\n callback: validateFutureDate,\n description:\n 'this function will validate that the date is in the future with 14 days at least'\n }\n}\n\nexport const IBAN_Specifications = IBAN.countries","import regExpStatments from './reg_exps'\nimport { ErrorObject } from 'ajv'\nimport { parseDateDE, validateDate } from './validators'\n\ntype SchemaValidateFunction = {\n (schema: any, data: any):\n | boolean\n | Promise<any>\n errors?: Partial<ErrorObject>[]\n}\n\ntype SchemaKeyword = {\n keyword: string\n callback: (schema: any, data: any) => boolean\n errorMessage: {\n [locale: string]: string\n }\n}\n\nexport const schemaKeywords: SchemaKeyword[] = [\n {\n keyword: 'email',\n callback: (schema: boolean, data: string) =>\n schema ? regExpStatments.email.regex.test(data) : false,\n errorMessage: {\n en: 'Please enter a valid email address.',\n de: 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'\n }\n },\n {\n keyword: 'onlyLetters',\n callback: (schema: boolean, data: string) =>\n schema ? /^[a-zA-Z]+$/.test(data) : false,\n errorMessage: {\n en: 'Only letters allowed.',\n de: 'Nur Buchstaben erlaubt.'\n }\n },\n {\n keyword: 'onlyNumbers',\n callback: (schema: boolean, data: string) =>\n schema ? /^[0-9]+$/.test(data) : false,\n errorMessage: {\n en: 'Only numbers allowed.',\n de: 'Nur Zahlen erlaubt.'\n }\n },\n {\n keyword: 'dateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? regExpStatments.date_de.regex.test(data)\n : false,\n errorMessage: {\n en: 'Date should have the format DD.MM.YYYY.',\n de: 'Das Datum sollte das Format TT.MM.JJJJ haben.'\n }\n },\n {\n keyword: 'minNumbersTelephone',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? new RegExp(`^[+]*[0-9]{${schema},}$`).test(data)\n : false,\n errorMessage: {\n en: 'Please enter a valid telephone number.',\n de: 'Bitte geben Sie eine gültige Telefonnummer ein.'\n }\n },\n {\n keyword: 'validDateDE',\n callback: (schema: boolean, data: string ) =>\n schema? validateDate(data): false,\n errorMessage: {\n en: 'Please enter a valid date.',\n de: 'Bitte geben Sie ein gültiges datum ein.'\n }\n },\n {\n keyword: 'futureDateDE',\n callback: (schema: number, data: string) =>\n schema && typeof schema === 'number'\n ? parseDateDE(data).getTime() > new Date().getTime()+(schema*24*60*60*1000)\n : false,\n errorMessage: {\n en: 'The date must be at least {schema} days in the future.',\n de: 'Das Datum muss mind. {schema} Tage in der Zukunft liegen.'\n }\n },\n {\n keyword: 'rangeDateDE',\n callback: (schema: number[], data: string) => {\n return schema && Array.isArray(schema) && schema.length === 2\n ? parseDateDE(data).getTime() >= new Date().getTime()+(schema[0]*24*60*60*1000) && parseDateDE(data).getTime() <= new Date().getTime()+(schema[1]*24*60*60*1000)\n : false\n },\n errorMessage: {\n en: 'Date must be between {minDate} and {maxDate}.',\n de: 'Datum muss zwischen {minDate} und {maxDate} liegen.'\n }\n },\n {\n keyword: 'birthdateDE',\n callback: (schema: boolean, data: string) =>\n schema\n ? parseDateDE(data).getTime() < new Date().getTime()\n : false,\n errorMessage: {\n en: 'Please enter a valid date of birth.',\n de: 'Bitte geben Sie ein gültiges Geburtsdatum ein.'\n }\n }\n]\n\nfunction convertDate(date: Date, separator = '.') {\n function pad(s: number) { return (s < 10) ? '0' + s : s; }\n return [pad(date.getDate()), pad(date.getMonth()+1), date.getFullYear()].join(separator)\n}\n\nexport function validateSchemaKeyword(\n schemaKeyword: SchemaKeyword,\n locale?: string\n): SchemaValidateFunction {\n const { keyword, callback, errorMessage } = schemaKeyword\n\n const validate: SchemaValidateFunction = (schema: any, data: any) => {\n switch(keyword) {\n case 'rangeDateDE': {\n const [minDays, maxDays] = schema\n const minDate = new Date()\n minDate.setDate(minDate.getDate() + minDays)\n const maxDate = new Date()\n maxDate.setDate(maxDate.getDate() + maxDays)\n\n validate.errors = [\n {\n keyword,\n message: errorMessage[locale || 'de'].replace('{minDate}', convertDate(minDate)).replace('{maxDate}', convertDate(maxDate)),\n params: { keyword }\n }\n ]\n break\n }\n default:\n validate.errors = [\n {\n keyword,\n message: errorMessage\n ? errorMessage[locale || 'de'].replace('{schema}', schema)\n : locale === 'en'\n ? 'The entered format is invalid.'\n : 'Das eingegebene Format ist ungültig.',\n params: { keyword }\n }\n ]\n break\n }\n\n return callback(schema, data)\n }\n\n return validate\n}\n"],"names":["regExpStatments","email","name","regex","description","lettersMinimum_3","blockName","numbersMinimum_6","numbersTelephone_6","numbersExact_11","numbersMaximum_11","date_de","telephone_de","dayjs","extend","customParseFormat","validateDate","data","isValid","validateBirthDate","de_date","test","parseDateDE","getTime","Date","validateFutureDate","dateStr","dateArray","split","date","setFullYear","validateIBAN","IBAN","functionalValidators","iban","callback","birth_date","future_date_14","IBAN_Specifications","countries","schemaKeywords","keyword","schema","errorMessage","en","de","RegExp","Array","isArray","length","convertDate","separator","pad","s","getDate","getMonth","getFullYear","join","validateSchemaKeyword","schemaKeyword","locale","validate","minDays","maxDays","minDate","setDate","maxDate","errors","message","replace","params"],"mappings":";;;;AAQA,IAAMA,eAAe,GAAmB;AACtCC,EAAAA,KAAK,EAAE;AACLC,IAAAA,IAAI,EAAE,OADD;AAELC,IAAAA,KAAK,EAAE,8FAFF;AAGLC,IAAAA,WAAW,EAAE;AAHR,GAD+B;AAOtCC,EAAAA,gBAAgB,EAAE;AAChBH,IAAAA,IAAI,EAAE,kBADU;AAEhBC,IAAAA,KAAK,EAAE,gBAFS;AAGhBC,IAAAA,WAAW,EACT;AAJc,GAPoB;AAatCF,EAAAA,IAAI,EAAE;AACJA,IAAAA,IAAI,EAAE,MADF;AAEJC,IAAAA,KAAK,EAAE,kDAFH;AAGJC,IAAAA,WAAW,EACX;AAJI,GAbgC;AAmBtCE,EAAAA,SAAS,EAAE;AACTJ,IAAAA,IAAI,EAAE,MADG;AAETC,IAAAA,KAAK,EAAE,+CAFE;AAGTC,IAAAA,WAAW,EACX;AAJS,GAnB2B;AAyBtCG,EAAAA,gBAAgB,EAAE;AAChBL,IAAAA,IAAI,EAAE,kBADU;AAEhBC,I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