@astral/validations 4.21.3 → 4.23.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/README.md +104 -2
- package/any/any.d.ts +1 -1
- package/array/array.d.ts +2 -2
- package/arrayItem/arrayItem.d.ts +2 -2
- package/containsDifferentCases/containsDifferentCases.d.ts +1 -1
- package/containsNumbers/containsNumbers.d.ts +1 -1
- package/containsPunctuationMarks/containsPunctuationMarks.d.ts +1 -1
- package/core/errors/ArrayError/createArrayError/createArrayError.d.ts +1 -1
- package/core/errors/ErrorMap/createErrorMap/createErrorMap.d.ts +1 -1
- package/core/rule/createRule/createRule.d.ts +1 -1
- package/core/rule/required/required.d.ts +1 -1
- package/core/utils/index.d.ts +1 -0
- package/core/utils/index.js +1 -0
- package/core/utils/removeNonDigits/index.d.ts +1 -0
- package/core/utils/removeNonDigits/index.js +1 -0
- package/core/utils/removeNonDigits/removeNonDigits.d.ts +4 -0
- package/core/utils/removeNonDigits/removeNonDigits.js +6 -0
- package/deepPartial/deepPartial.d.ts +1 -1
- package/email/email.d.ts +2 -3
- package/emailOrPhone/constants.d.ts +2 -0
- package/emailOrPhone/constants.js +5 -0
- package/emailOrPhone/emailOrPhone.d.ts +12 -0
- package/emailOrPhone/emailOrPhone.js +38 -0
- package/emailOrPhone/index.d.ts +2 -0
- package/emailOrPhone/index.js +2 -0
- package/emailOrPhone/types.d.ts +5 -0
- package/emailOrPhone/types.js +1 -0
- package/enabled/enabled.d.ts +1 -1
- package/guid/guid.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/innFL/innFL.d.ts +1 -1
- package/innIP/innIP.d.ts +1 -1
- package/innTwelveSymbols/innTwelveSymbols.d.ts +1 -1
- package/innUL/innUL.d.ts +1 -1
- package/integer/integer.d.ts +1 -1
- package/kpp/kpp.d.ts +1 -1
- package/length/length.d.ts +1 -1
- package/minYearsOld/minYearsOld.d.ts +1 -1
- package/mobilePhone/mobilePhone.d.ts +2 -3
- package/node/any/any.d.ts +1 -1
- package/node/array/array.d.ts +2 -2
- package/node/arrayItem/arrayItem.d.ts +2 -2
- package/node/containsDifferentCases/containsDifferentCases.d.ts +1 -1
- package/node/containsNumbers/containsNumbers.d.ts +1 -1
- package/node/containsPunctuationMarks/containsPunctuationMarks.d.ts +1 -1
- package/node/core/context/createContext/createContext.js +1 -2
- package/node/core/errors/ArrayError/createArrayError/createArrayError.d.ts +1 -1
- package/node/core/errors/ErrorMap/createErrorMap/createErrorMap.d.ts +1 -1
- package/node/core/guard/createGuard/createGuard.js +1 -2
- package/node/core/rule/createRule/createRule.d.ts +1 -1
- package/node/core/rule/required/required.d.ts +1 -1
- package/node/core/utils/index.d.ts +1 -0
- package/node/core/utils/index.js +1 -0
- package/node/core/utils/removeNonDigits/index.d.ts +1 -0
- package/node/core/utils/removeNonDigits/index.js +17 -0
- package/node/core/utils/removeNonDigits/removeNonDigits.d.ts +4 -0
- package/node/core/utils/removeNonDigits/removeNonDigits.js +10 -0
- package/node/deepPartial/deepPartial.d.ts +1 -1
- package/node/email/email.d.ts +2 -3
- package/node/emailOrPhone/constants.d.ts +2 -0
- package/node/emailOrPhone/constants.js +8 -0
- package/node/emailOrPhone/emailOrPhone.d.ts +12 -0
- package/node/emailOrPhone/emailOrPhone.js +42 -0
- package/node/emailOrPhone/index.d.ts +2 -0
- package/node/emailOrPhone/index.js +18 -0
- package/node/emailOrPhone/types.d.ts +5 -0
- package/node/emailOrPhone/types.js +2 -0
- package/node/enabled/enabled.d.ts +1 -1
- package/node/guid/guid.d.ts +1 -1
- package/node/index.d.ts +1 -0
- package/node/index.js +5 -2
- package/node/innFL/innFL.d.ts +1 -1
- package/node/innIP/innIP.d.ts +1 -1
- package/node/innTwelveSymbols/innTwelveSymbols.d.ts +1 -1
- package/node/innUL/innUL.d.ts +1 -1
- package/node/integer/integer.d.ts +1 -1
- package/node/kpp/kpp.d.ts +1 -1
- package/node/length/length.d.ts +1 -1
- package/node/max/max.js +1 -2
- package/node/min/min.js +1 -2
- package/node/minYearsOld/minYearsOld.d.ts +1 -1
- package/node/minYearsOld/minYearsOld.js +1 -2
- package/node/mobilePhone/mobilePhone.d.ts +2 -3
- package/node/ogrnIP/ogrnIP.d.ts +1 -1
- package/node/ogrnUL/ogrnUL.d.ts +1 -1
- package/node/onlyNumber/onlyNumber.d.ts +1 -1
- package/node/or/or.d.ts +2 -2
- package/node/partial/partial.d.ts +1 -1
- package/node/passportCode/passportCode.d.ts +1 -1
- package/node/passportNumber/passportNumber.d.ts +1 -1
- package/node/passportSeries/passportSeries.d.ts +1 -1
- package/node/pattern/pattern.d.ts +1 -1
- package/node/personName/personName.d.ts +1 -1
- package/node/personPatronymic/personPatronymic.d.ts +1 -1
- package/node/personSurname/personSurname.d.ts +1 -1
- package/node/positiveNumber/positiveNumber.d.ts +1 -1
- package/node/rangeDateInterval/rangeDateInterval.d.ts +1 -1
- package/node/rangeDateMinMax/rangeDateMinMax.d.ts +1 -1
- package/node/rangeDateNotEqual/rangeDateNotEqual.d.ts +1 -1
- package/node/snils/snils.d.ts +1 -1
- package/node/snils/snils.js +1 -4
- package/node/textField/textField.d.ts +1 -1
- package/node/transform/transform.d.ts +2 -2
- package/node/when/when.d.ts +1 -1
- package/ogrnIP/ogrnIP.d.ts +1 -1
- package/ogrnUL/ogrnUL.d.ts +1 -1
- package/onlyNumber/onlyNumber.d.ts +1 -1
- package/or/or.d.ts +2 -2
- package/package.json +2 -2
- package/partial/partial.d.ts +1 -1
- package/passportCode/passportCode.d.ts +1 -1
- package/passportNumber/passportNumber.d.ts +1 -1
- package/passportSeries/passportSeries.d.ts +1 -1
- package/pattern/pattern.d.ts +1 -1
- package/personName/personName.d.ts +1 -1
- package/personPatronymic/personPatronymic.d.ts +1 -1
- package/personSurname/personSurname.d.ts +1 -1
- package/positiveNumber/positiveNumber.d.ts +1 -1
- package/rangeDateInterval/rangeDateInterval.d.ts +1 -1
- package/rangeDateMinMax/rangeDateMinMax.d.ts +1 -1
- package/rangeDateNotEqual/rangeDateNotEqual.d.ts +1 -1
- package/snils/snils.d.ts +1 -1
- package/snils/snils.js +2 -5
- package/textField/textField.d.ts +1 -1
- package/transform/transform.d.ts +2 -2
- package/when/when.d.ts +1 -1
package/node/core/utils/index.js
CHANGED
@@ -22,3 +22,4 @@ __exportStar(require("./isStartsWithAndEndsWithLetter"), exports);
|
|
22
22
|
__exportStar(require("./isStringOfZeros"), exports);
|
23
23
|
__exportStar(require("./isValidFullNameLength"), exports);
|
24
24
|
__exportStar(require("./resetTime"), exports);
|
25
|
+
__exportStar(require("./removeNonDigits"), exports);
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './removeNonDigits';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./removeNonDigits"), exports);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.removeNonDigits = void 0;
|
4
|
+
/**
|
5
|
+
* Удаляет из строки все символы, кроме цифр
|
6
|
+
*/
|
7
|
+
const removeNonDigits = (value) => {
|
8
|
+
return value.replace(/\D/g, '');
|
9
|
+
};
|
10
|
+
exports.removeNonDigits = removeNonDigits;
|
@@ -18,4 +18,4 @@ import { type Guard } from '../core';
|
|
18
18
|
* const result = validate({ info: { info: {} } });
|
19
19
|
* ```
|
20
20
|
*/
|
21
|
-
export declare const deepPartial: <TLastSchemaValues extends Record<string, unknown>>(guard: Guard<TLastSchemaValues>) => (value: unknown, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
21
|
+
export declare const deepPartial: <TLastSchemaValues extends Record<string, unknown>>(guard: Guard<TLastSchemaValues>) => (value: unknown, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<unknown, TLastSchemaValues>>;
|
package/node/email/email.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
type EmailParams = {
|
1
|
+
export type EmailParams = {
|
2
2
|
/**
|
3
3
|
* Замена стандартного сообщения ошибки.
|
4
4
|
*/
|
@@ -26,5 +26,4 @@ type EmailParams = {
|
|
26
26
|
* validate('example@mail.ru');
|
27
27
|
* ```
|
28
28
|
*/
|
29
|
-
export declare const email: <TLastSchemaValues extends Record<string, unknown>>(params?: EmailParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
30
|
-
export {};
|
29
|
+
export declare const email: <TLastSchemaValues extends Record<string, unknown>>(params?: EmailParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.EMAIL_OR_PHONE_ERROR_INFO = void 0;
|
4
|
+
const core_1 = require("../core");
|
5
|
+
exports.EMAIL_OR_PHONE_ERROR_INFO = {
|
6
|
+
code: (0, core_1.createErrorCode)('mobileOrPhone'),
|
7
|
+
message: 'Некорректный формат',
|
8
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Guard для поля "Email или телефон". Проверяет валидность email или мобильного телефона.
|
3
|
+
* - Если строка содержит кириллицу, латиницу или символ @ - проверяется как email
|
4
|
+
* - Иначе убираются все символы, кроме digits, и проверяется как mobilePhone
|
5
|
+
* @example
|
6
|
+
* ```ts
|
7
|
+
* const validate = emailOrPhone();
|
8
|
+
* validate({ value: 'example@mail.ru', normalizedValue: 'example@mail.ru', type: 'email' });
|
9
|
+
* validate({ value: '+7 (999) 999-99-99', normalizedValue: '79999999999', type: 'phone' });
|
10
|
+
* ```
|
11
|
+
*/
|
12
|
+
export declare const emailOrPhone: <TLastSchemaValues extends Record<string, unknown>>() => import("../core").Guard<TLastSchemaValues, {}>;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.emailOrPhone = void 0;
|
4
|
+
const core_1 = require("../core");
|
5
|
+
const email_1 = require("../email");
|
6
|
+
const mobilePhone_1 = require("../mobilePhone");
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
/**
|
9
|
+
* Guard для поля "Email или телефон". Проверяет валидность email или мобильного телефона.
|
10
|
+
* - Если строка содержит кириллицу, латиницу или символ @ - проверяется как email
|
11
|
+
* - Иначе убираются все символы, кроме digits, и проверяется как mobilePhone
|
12
|
+
* @example
|
13
|
+
* ```ts
|
14
|
+
* const validate = emailOrPhone();
|
15
|
+
* validate({ value: 'example@mail.ru', normalizedValue: 'example@mail.ru', type: 'email' });
|
16
|
+
* validate({ value: '+7 (999) 999-99-99', normalizedValue: '79999999999', type: 'phone' });
|
17
|
+
* ```
|
18
|
+
*/
|
19
|
+
const emailOrPhone = () => (0, core_1.createGuard)((value, ctx) => {
|
20
|
+
if (!value ||
|
21
|
+
typeof value !== 'object' ||
|
22
|
+
!('value' in value) ||
|
23
|
+
!('normalizedValue' in value) ||
|
24
|
+
!('type' in value)) {
|
25
|
+
return ctx.createError({
|
26
|
+
code: constants_1.EMAIL_OR_PHONE_ERROR_INFO.code,
|
27
|
+
message: constants_1.EMAIL_OR_PHONE_ERROR_INFO.message,
|
28
|
+
});
|
29
|
+
}
|
30
|
+
const { value: formattedValue = '', normalizedValue = '', type, } = value;
|
31
|
+
if (type === 'email') {
|
32
|
+
return (0, email_1.email)()(formattedValue, ctx);
|
33
|
+
}
|
34
|
+
if (type === 'phone') {
|
35
|
+
return (0, mobilePhone_1.mobilePhone)()(normalizedValue, ctx);
|
36
|
+
}
|
37
|
+
return ctx.createError({
|
38
|
+
message: constants_1.EMAIL_OR_PHONE_ERROR_INFO.message,
|
39
|
+
code: constants_1.EMAIL_OR_PHONE_ERROR_INFO.code,
|
40
|
+
});
|
41
|
+
});
|
42
|
+
exports.emailOrPhone = emailOrPhone;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./constants"), exports);
|
18
|
+
__exportStar(require("./emailOrPhone"), exports);
|
@@ -30,5 +30,5 @@ type Params<TLastSchemaValues extends Record<string, unknown>> = {
|
|
30
30
|
* const result2 = validate({ isAgree: true, name: '' });
|
31
31
|
* ```
|
32
32
|
*/
|
33
|
-
export declare const enabled: <TLastSchemaValues extends Record<string, unknown>>({ is, then, }: Params<TLastSchemaValues>) => (value: unknown, prevCtx?: ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
33
|
+
export declare const enabled: <TLastSchemaValues extends Record<string, unknown>>({ is, then, }: Params<TLastSchemaValues>) => (value: unknown, prevCtx?: ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<unknown, TLastSchemaValues>>;
|
34
34
|
export {};
|
package/node/guid/guid.d.ts
CHANGED
@@ -12,5 +12,5 @@ type GuidParams = {
|
|
12
12
|
* validate('C56A4180-65AA-42EC-A945-5FD21DEC0538');
|
13
13
|
* ```
|
14
14
|
*/
|
15
|
-
export declare const guid: <TLastSchemaValues extends Record<string, unknown>>(params?: GuidParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
15
|
+
export declare const guid: <TLastSchemaValues extends Record<string, unknown>>(params?: GuidParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
16
16
|
export {};
|
package/node/index.d.ts
CHANGED
@@ -22,6 +22,7 @@ export { containsPunctuationMarks, CONTAINS_PUNCTUATION_MARKS_ERROR_CODE, } from
|
|
22
22
|
export { containsDifferentCases, CONTAINS_DIFFERENT_CASES_ERROR_CODE, } from './containsDifferentCases';
|
23
23
|
export { toPlainError } from './toPlainError';
|
24
24
|
export { email, LENGTH_EMAIL_ERROR_INFO, INVALID_EMAIL_ERROR_INFO, } from './email';
|
25
|
+
export { emailOrPhone, EMAIL_OR_PHONE_ERROR_INFO } from './emailOrPhone';
|
25
26
|
export { guid, INVALID_GUID_ERROR_INFO } from './guid';
|
26
27
|
export { length, STRING_LENGTH_ERROR_CODE } from './length';
|
27
28
|
export { mobilePhone, MOBILE_PHONE_ERROR_INFO } from './mobilePhone';
|
package/node/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.containsPunctuationMarks = exports.CONTAINS_NUMBERS_ERROR_CODE = exports.containsNumbers = exports.ONLY_NUMBER_ERROR_CODE = exports.onlyNumber = exports.PATTERN_ERROR_CODE = exports.pattern = exports.or = exports.POSITIVE_NUMBER_ERROR_INFO = exports.positiveNumber = exports.INTEGER_ERROR_INFO = exports.integer = exports.NUMBER_MAX_ERROR_CODE = exports.DATE_MAX_ERROR_CODE = exports.ARRAY_MAX_ERROR_CODE = exports.STRING_MAX_ERROR_CODE = exports.max = exports.NUMBER_MIN_ERROR_CODE = exports.DATE_MIN_ERROR_CODE = exports.ARRAY_MIN_ERROR_CODE = exports.STRING_MIN_ERROR_CODE = exports.min = exports.BIRTH_DATE_MAX_ERROR_CODE = exports.BIRTH_DATE_MIN_ERROR_CODE = exports.minYearsOld = exports.partial = exports.deepPartial = exports.arrayItem = exports.ARRAY_TYPE_ERROR_INFO = exports.array = exports.BOOLEAN_TYPE_ERROR_INFO = exports.boolean = exports.INFINITY_NUMBER_ERROR_INFO = exports.NUMBER_TYPE_ERROR_INFO = exports.NAN_NUMBER_ERROR_INFO = exports.number = exports.DATE_TYPE_ERROR_INFO = exports.INVALID_DATE_ERROR_INFO = exports.date = exports.LENGTH_TEXT_FIELD_ERROR_INFO = exports.INVALID_TEXT_FIELD_ERROR_INFO = exports.textField = exports.stringAsync = exports.STRING_TYPE_ERROR_INFO = exports.string = exports.optionalAsync = exports.optional = exports.OBJECT_TYPE_ERROR_INFO = exports.objectAsync = exports.object = void 0;
|
4
|
-
exports.
|
5
|
-
exports.FILE_LIST_NOT_ARRAY_ERROR_INFO = exports.uploadedFileList = exports.FILE_RESTRICTION_ERROR_INFO = exports.FILE_REQUIRED_ERROR_INFO = exports.FILE_LOADING_ERROR_INFO = exports.FILE_UPLOAD_ERROR_INFO = exports.uploadedFile = exports.RANGE_DATE_NOT_EQUAL_ERROR_INFO = exports.rangeDateNotEqual = exports.RANGE_DATE_MIN_ERROR_INFO = exports.RANGE_DATE_MAX_ERROR_INFO = exports.rangeDateMinMax = exports.RANGE_DATE_INTERVAL_ERROR_INFO = exports.rangeDateInterval = exports.RANGE_DATE_START_REQUIRED_ERROR_INFO = exports.RANGE_DATE_START_INVALID_ERROR_INFO = exports.RANGE_DATE_REQUIRED_ERROR_INFO = exports.RANGE_DATE_END_REQUIRED_ERROR_INFO = exports.RANGE_DATE_END_INVALID_ERROR_INFO = exports.RANGE_DATE_END_EARLIER_START_ERROR_INFO = exports.rangeDate = exports.enabled = exports.transform = exports.toPrettyError = exports.when = exports.any = exports.PERSON_PATRONYMIC_ERROR_INFO = void 0;
|
4
|
+
exports.PASSPORT_CODE_LENGTH_ERROR_INFO = exports.PASSPORT_CODE_ERROR_INFO = exports.passportCode = exports.PASSPORT_NUMBER_ONLY_DIGITS_ERROR_INFO = exports.PASSPORT_NUMBER_LENGTH_ERROR_INFO = exports.PASSPORT_NUMBER_ERROR_INFO = exports.passportNumber = exports.PASSPORT_SERIES_ONLY_DIGITS_ERROR_INFO = exports.PASSPORT_SERIES_ERROR_LENGTH_INFO = exports.PASSPORT_SERIES_ERROR_INFO = exports.passportSeries = exports.PERSON_SURNAME_ERROR_INFO = exports.personSurname = exports.PERSON_NAME_ERROR_INFO = exports.personName = exports.OGRN_IP_ERROR_INFO = exports.ogrnIP = exports.OGRN_UL_ERROR_INFO = exports.ogrnUL = exports.REQUIRED_ERROR_INFO = exports.createRule = exports.SNILS_ERROR_INFO = exports.snils = exports.KPP_ZEROS_ONLY_ERROR_INFO = exports.KPP_DOUBLE_ZERO_START_ERROR_INFO = exports.INVALID_KPP_ERROR_INFO = exports.kpp = exports.INN_FL_ERROR_INFO = exports.innFL = exports.INN_IP_ERROR_INFO = exports.innIP = exports.INN_12_SYMBOLS_ERROR_INFO = exports.innTwelveSymbols = exports.INN_UL_ERROR_INFO = exports.innUL = exports.MOBILE_PHONE_ERROR_INFO = exports.mobilePhone = exports.STRING_LENGTH_ERROR_CODE = exports.length = exports.INVALID_GUID_ERROR_INFO = exports.guid = exports.EMAIL_OR_PHONE_ERROR_INFO = exports.emailOrPhone = exports.INVALID_EMAIL_ERROR_INFO = exports.LENGTH_EMAIL_ERROR_INFO = exports.email = exports.toPlainError = exports.CONTAINS_DIFFERENT_CASES_ERROR_CODE = exports.containsDifferentCases = exports.CONTAINS_PUNCTUATION_MARKS_ERROR_CODE = void 0;
|
5
|
+
exports.FILE_LIST_NOT_ARRAY_ERROR_INFO = exports.uploadedFileList = exports.FILE_RESTRICTION_ERROR_INFO = exports.FILE_REQUIRED_ERROR_INFO = exports.FILE_LOADING_ERROR_INFO = exports.FILE_UPLOAD_ERROR_INFO = exports.uploadedFile = exports.RANGE_DATE_NOT_EQUAL_ERROR_INFO = exports.rangeDateNotEqual = exports.RANGE_DATE_MIN_ERROR_INFO = exports.RANGE_DATE_MAX_ERROR_INFO = exports.rangeDateMinMax = exports.RANGE_DATE_INTERVAL_ERROR_INFO = exports.rangeDateInterval = exports.RANGE_DATE_START_REQUIRED_ERROR_INFO = exports.RANGE_DATE_START_INVALID_ERROR_INFO = exports.RANGE_DATE_REQUIRED_ERROR_INFO = exports.RANGE_DATE_END_REQUIRED_ERROR_INFO = exports.RANGE_DATE_END_INVALID_ERROR_INFO = exports.RANGE_DATE_END_EARLIER_START_ERROR_INFO = exports.rangeDate = exports.enabled = exports.transform = exports.toPrettyError = exports.when = exports.any = exports.PERSON_PATRONYMIC_ERROR_INFO = exports.personPatronymic = exports.PASSPORT_CODE_ONLY_DIGITS_ERROR_INFO = void 0;
|
6
6
|
var object_1 = require("./object");
|
7
7
|
Object.defineProperty(exports, "object", { enumerable: true, get: function () { return object_1.object; } });
|
8
8
|
Object.defineProperty(exports, "objectAsync", { enumerable: true, get: function () { return object_1.objectAsync; } });
|
@@ -84,6 +84,9 @@ var email_1 = require("./email");
|
|
84
84
|
Object.defineProperty(exports, "email", { enumerable: true, get: function () { return email_1.email; } });
|
85
85
|
Object.defineProperty(exports, "LENGTH_EMAIL_ERROR_INFO", { enumerable: true, get: function () { return email_1.LENGTH_EMAIL_ERROR_INFO; } });
|
86
86
|
Object.defineProperty(exports, "INVALID_EMAIL_ERROR_INFO", { enumerable: true, get: function () { return email_1.INVALID_EMAIL_ERROR_INFO; } });
|
87
|
+
var emailOrPhone_1 = require("./emailOrPhone");
|
88
|
+
Object.defineProperty(exports, "emailOrPhone", { enumerable: true, get: function () { return emailOrPhone_1.emailOrPhone; } });
|
89
|
+
Object.defineProperty(exports, "EMAIL_OR_PHONE_ERROR_INFO", { enumerable: true, get: function () { return emailOrPhone_1.EMAIL_OR_PHONE_ERROR_INFO; } });
|
87
90
|
var guid_1 = require("./guid");
|
88
91
|
Object.defineProperty(exports, "guid", { enumerable: true, get: function () { return guid_1.guid; } });
|
89
92
|
Object.defineProperty(exports, "INVALID_GUID_ERROR_INFO", { enumerable: true, get: function () { return guid_1.INVALID_GUID_ERROR_INFO; } });
|
package/node/innFL/innFL.d.ts
CHANGED
@@ -13,5 +13,5 @@ type InnFLParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('7728168971');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const innFL: <TLastSchemaValues extends Record<string, unknown>>(params?: InnFLParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const innFL: <TLastSchemaValues extends Record<string, unknown>>(params?: InnFLParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
package/node/innIP/innIP.d.ts
CHANGED
@@ -13,5 +13,5 @@ type InnIPParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('384212952720');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const innIP: <TLastSchemaValues extends Record<string, unknown>>(params?: InnIPParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const innIP: <TLastSchemaValues extends Record<string, unknown>>(params?: InnIPParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -13,5 +13,5 @@ type InnTwelveSymbolsParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('7728168971');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const innTwelveSymbols: <TLastSchemaValues extends Record<string, unknown>>(params?: InnTwelveSymbolsParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const innTwelveSymbols: <TLastSchemaValues extends Record<string, unknown>>(params?: InnTwelveSymbolsParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
package/node/innUL/innUL.d.ts
CHANGED
@@ -13,5 +13,5 @@ type InnULParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('7728168971');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const innUL: <TLastSchemaValues extends Record<string, unknown>>(params?: InnULParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const innUL: <TLastSchemaValues extends Record<string, unknown>>(params?: InnULParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -21,5 +21,5 @@ type IntegerParams = {
|
|
21
21
|
* validate(3.14)
|
22
22
|
* ```
|
23
23
|
*/
|
24
|
-
export declare const integer: <TLastSchemaValues extends Record<string, unknown>>(params?: IntegerParams) => (value: number, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
24
|
+
export declare const integer: <TLastSchemaValues extends Record<string, unknown>>(params?: IntegerParams) => (value: number, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<number, TLastSchemaValues>>;
|
25
25
|
export {};
|
package/node/kpp/kpp.d.ts
CHANGED
@@ -13,5 +13,5 @@ type KPPParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('770201001');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const kpp: <TLastSchemaValues extends Record<string, unknown>>(params?: KPPParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const kpp: <TLastSchemaValues extends Record<string, unknown>>(params?: KPPParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
package/node/length/length.d.ts
CHANGED
@@ -18,5 +18,5 @@ type LengthParams = {
|
|
18
18
|
* validate('va')
|
19
19
|
*
|
20
20
|
*/
|
21
|
-
export declare const length: <TLastSchemaValues extends Record<string, unknown>>(len: number, params?: LengthParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
21
|
+
export declare const length: <TLastSchemaValues extends Record<string, unknown>>(len: number, params?: LengthParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
22
22
|
export {};
|
package/node/max/max.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.max =
|
3
|
+
exports.max = max;
|
4
4
|
const core_1 = require("../core");
|
5
5
|
const constants_1 = require("./constants");
|
6
6
|
function max(threshold, params) {
|
@@ -43,4 +43,3 @@ function max(threshold, params) {
|
|
43
43
|
return undefined;
|
44
44
|
});
|
45
45
|
}
|
46
|
-
exports.max = max;
|
package/node/min/min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.min =
|
3
|
+
exports.min = min;
|
4
4
|
const core_1 = require("../core");
|
5
5
|
const constants_1 = require("./constants");
|
6
6
|
function min(threshold, params) {
|
@@ -43,4 +43,3 @@ function min(threshold, params) {
|
|
43
43
|
return undefined;
|
44
44
|
});
|
45
45
|
}
|
46
|
-
exports.min = min;
|
@@ -20,5 +20,5 @@ type MinYearsOldParams = {
|
|
20
20
|
* );
|
21
21
|
* ```
|
22
22
|
*/
|
23
|
-
export declare function minYearsOld<ValidationType, TLastSchemaValues extends Record<string, unknown> = {}>(age: number, params?: MinYearsOldParams): (value: ValidationType, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
23
|
+
export declare function minYearsOld<ValidationType, TLastSchemaValues extends Record<string, unknown> = {}>(age: number, params?: MinYearsOldParams): (value: ValidationType, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<ValidationType, TLastSchemaValues>>;
|
24
24
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.minYearsOld =
|
3
|
+
exports.minYearsOld = minYearsOld;
|
4
4
|
const core_1 = require("../core");
|
5
5
|
const constants_1 = require("./constants");
|
6
6
|
/**
|
@@ -45,4 +45,3 @@ function minYearsOld(age, params) {
|
|
45
45
|
return undefined;
|
46
46
|
});
|
47
47
|
}
|
48
|
-
exports.minYearsOld = minYearsOld;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type CommonRuleParams } from '../core';
|
2
|
-
type MobilePhoneParams = CommonRuleParams<string> & {
|
2
|
+
export type MobilePhoneParams = CommonRuleParams<string> & {
|
3
3
|
/**
|
4
4
|
* Замена стандартного сообщения ошибки.
|
5
5
|
*/
|
@@ -15,5 +15,4 @@ type MobilePhoneParams = CommonRuleParams<string> & {
|
|
15
15
|
* validate('79999999999');
|
16
16
|
* ```
|
17
17
|
*/
|
18
|
-
export declare const mobilePhone: <TLastSchemaValues extends Record<string, unknown>>(params?: MobilePhoneParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
19
|
-
export {};
|
18
|
+
export declare const mobilePhone: <TLastSchemaValues extends Record<string, unknown>>(params?: MobilePhoneParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
package/node/ogrnIP/ogrnIP.d.ts
CHANGED
@@ -13,5 +13,5 @@ type OgrnIPParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('7728168971');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const ogrnIP: <TLastSchemaValues extends Record<string, unknown>>(params?: OgrnIPParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const ogrnIP: <TLastSchemaValues extends Record<string, unknown>>(params?: OgrnIPParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
package/node/ogrnUL/ogrnUL.d.ts
CHANGED
@@ -13,5 +13,5 @@ type OgrnULParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('7728168971');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const ogrnUL: <TLastSchemaValues extends Record<string, unknown>>(params?: OgrnULParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const ogrnUL: <TLastSchemaValues extends Record<string, unknown>>(params?: OgrnULParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -12,5 +12,5 @@ type OnlyNumberParams = {
|
|
12
12
|
* validate('123');
|
13
13
|
* ```
|
14
14
|
*/
|
15
|
-
export declare const onlyNumber: <TLastSchemaValues extends Record<string, unknown>>(params?: OnlyNumberParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
15
|
+
export declare const onlyNumber: <TLastSchemaValues extends Record<string, unknown>>(params?: OnlyNumberParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
16
16
|
export {};
|
package/node/or/or.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type
|
1
|
+
import { type ValidationRule } from '../core';
|
2
2
|
/**
|
3
3
|
* Если все переданные правила завершились с ошибкой, то вернется ошибка из последнего правила
|
4
4
|
* Если хотя бы одно из правил не завершилось ошибкой, то or вернет undefined
|
@@ -14,4 +14,4 @@ import { type ValidationResult, type ValidationRule } from '../core';
|
|
14
14
|
* const result = validate('string');
|
15
15
|
* ```
|
16
16
|
*/
|
17
|
-
export declare const or: <TLastSchemaValues extends Record<string, unknown>>(...rules: ValidationRule<unknown, TLastSchemaValues>[]) => (value: unknown, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) =>
|
17
|
+
export declare const or: <TLastSchemaValues extends Record<string, unknown>>(...rules: ValidationRule<unknown, TLastSchemaValues>[]) => (value: unknown, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<unknown, TLastSchemaValues>>;
|
@@ -13,5 +13,5 @@ type PassportCodeParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('123456');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const passportCode: <TLastSchemaValues extends Record<string, unknown>>(params?: PassportCodeParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const passportCode: <TLastSchemaValues extends Record<string, unknown>>(params?: PassportCodeParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -13,5 +13,5 @@ type PassportNumberParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('704564');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const passportNumber: <TLastSchemaValues extends Record<string, unknown>>(params?: PassportNumberParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const passportNumber: <TLastSchemaValues extends Record<string, unknown>>(params?: PassportNumberParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -13,5 +13,5 @@ type PassportSeriesParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('9217');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const passportSeries: <TLastSchemaValues extends Record<string, unknown>>(params?: PassportSeriesParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const passportSeries: <TLastSchemaValues extends Record<string, unknown>>(params?: PassportSeriesParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -14,5 +14,5 @@ type PatternParams = {
|
|
14
14
|
* string(pattern(/[0-9]/))
|
15
15
|
* ```
|
16
16
|
*/
|
17
|
-
export declare const pattern: <TLastSchemaValues extends Record<string, unknown>>(regex: RegExp, params?: PatternParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
17
|
+
export declare const pattern: <TLastSchemaValues extends Record<string, unknown>>(regex: RegExp, params?: PatternParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
18
18
|
export {};
|
@@ -13,5 +13,5 @@ type PersonNameParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate("Иван");
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const personName: <TLastSchemaValues extends Record<string, unknown>>(params?: PersonNameParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const personName: <TLastSchemaValues extends Record<string, unknown>>(params?: PersonNameParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -13,5 +13,5 @@ type PersonPatronymicParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate("Иванович");
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const personPatronymic: <TLastSchemaValues extends Record<string, unknown>>(params?: PersonPatronymicParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const personPatronymic: <TLastSchemaValues extends Record<string, unknown>>(params?: PersonPatronymicParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -13,5 +13,5 @@ type PersonSurnameParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate("Иванов");
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const personSurname: <TLastSchemaValues extends Record<string, unknown>>(params?: PersonSurnameParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const personSurname: <TLastSchemaValues extends Record<string, unknown>>(params?: PersonSurnameParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -21,5 +21,5 @@ type PositiveNumberParams = {
|
|
21
21
|
* validate(-1)
|
22
22
|
* ```
|
23
23
|
*/
|
24
|
-
export declare const positiveNumber: <TLastSchemaValues extends Record<string, unknown>>(params?: PositiveNumberParams) => (value: number, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
24
|
+
export declare const positiveNumber: <TLastSchemaValues extends Record<string, unknown>>(params?: PositiveNumberParams) => (value: number, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<number, TLastSchemaValues>>;
|
25
25
|
export {};
|
@@ -19,5 +19,5 @@ type RangeDateIntervalParams = {
|
|
19
19
|
* validate({ start: new Date('2024.08.15'), end: new Date('2024.09.05') });
|
20
20
|
* ```
|
21
21
|
*/
|
22
|
-
export declare const rangeDateInterval: <TLastSchemaValues extends Record<string, unknown>>(params: RangeDateIntervalParams) => (value: RangeDateValue, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
22
|
+
export declare const rangeDateInterval: <TLastSchemaValues extends Record<string, unknown>>(params: RangeDateIntervalParams) => (value: RangeDateValue, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<RangeDateValue, TLastSchemaValues>>;
|
23
23
|
export {};
|
@@ -30,5 +30,5 @@ type RangeDateMinMaxParams = {
|
|
30
30
|
* validate({ start: new Date(), end: new Date() });
|
31
31
|
* ```
|
32
32
|
*/
|
33
|
-
export declare const rangeDateMinMax: <TLastSchemaValues extends Record<string, unknown>>(params?: RangeDateMinMaxParams) => (value: RangeDateValue, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
33
|
+
export declare const rangeDateMinMax: <TLastSchemaValues extends Record<string, unknown>>(params?: RangeDateMinMaxParams) => (value: RangeDateValue, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<RangeDateValue, TLastSchemaValues>>;
|
34
34
|
export {};
|
@@ -16,5 +16,5 @@ type RangeDateNotEqualParams = {
|
|
16
16
|
* validate({ start: new Date(), end: new Date() });
|
17
17
|
* ```
|
18
18
|
*/
|
19
|
-
export declare const rangeDateNotEqual: <TLastSchemaValues extends Record<string, unknown>>(params?: RangeDateNotEqualParams) => (value: RangeDateValue, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
19
|
+
export declare const rangeDateNotEqual: <TLastSchemaValues extends Record<string, unknown>>(params?: RangeDateNotEqualParams) => (value: RangeDateValue, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<RangeDateValue, TLastSchemaValues>>;
|
20
20
|
export {};
|
package/node/snils/snils.d.ts
CHANGED
@@ -13,5 +13,5 @@ type SnilsParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('15657325992');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const snils: <TLastSchemaValues extends Record<string, unknown>>(params?: SnilsParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const snils: <TLastSchemaValues extends Record<string, unknown>>(params?: SnilsParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
package/node/snils/snils.js
CHANGED
@@ -3,9 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.snils = void 0;
|
4
4
|
const core_1 = require("../core");
|
5
5
|
const constants_1 = require("./constants");
|
6
|
-
const removeSpecialCharacters = (value) => {
|
7
|
-
return value.replace(/\D/g, '');
|
8
|
-
};
|
9
6
|
const calcCheckSumForSNILS = (digitsOfValue) => digitsOfValue
|
10
7
|
.slice(0, 9)
|
11
8
|
.split('')
|
@@ -32,7 +29,7 @@ const snils = (params) => (0, core_1.createRule)((value, ctx) => {
|
|
32
29
|
if ((0, core_1.isStringOfZeros)(value)) {
|
33
30
|
return createSnilsError();
|
34
31
|
}
|
35
|
-
const formattedValue =
|
32
|
+
const formattedValue = (0, core_1.removeNonDigits)(value);
|
36
33
|
if (formattedValue.length !== value.length) {
|
37
34
|
return createSnilsError();
|
38
35
|
}
|
@@ -20,5 +20,5 @@ type TextFieldParams = {
|
|
20
20
|
* validate('Авада кедавра...');
|
21
21
|
* ```
|
22
22
|
*/
|
23
|
-
export declare const textField: <TLastSchemaValues extends Record<string, unknown>>(params?: TextFieldParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
23
|
+
export declare const textField: <TLastSchemaValues extends Record<string, unknown>>(params?: TextFieldParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
24
24
|
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type ValidationRule } from '../core';
|
1
|
+
import { type ValidationRule, type ValidationTypes } from '../core';
|
2
2
|
type Transformer<TValue, TResult> = (value: TValue) => TResult;
|
3
3
|
/**
|
4
4
|
* Трансформирует value в новый тип для валидации
|
@@ -14,5 +14,5 @@ type Transformer<TValue, TResult> = (value: TValue) => TResult;
|
|
14
14
|
* );
|
15
15
|
* ```
|
16
16
|
*/
|
17
|
-
export declare const transform: <TValue extends
|
17
|
+
export declare const transform: <TValue extends ValidationTypes, TResult extends ValidationTypes, TLastSchemaValues extends Record<string, unknown> = {}>(transformer: Transformer<TValue, TResult>, ...rules: ValidationRule<TResult, TLastSchemaValues>[]) => (value: TValue, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<TValue, TLastSchemaValues>>;
|
18
18
|
export {};
|
package/node/when/when.d.ts
CHANGED
@@ -35,5 +35,5 @@ type Params<TLastSchemaValues extends Record<string, unknown>> = {
|
|
35
35
|
* const result2 = validate({ isAgree: true, name: '' });
|
36
36
|
* ```
|
37
37
|
*/
|
38
|
-
export declare const when: <TLastSchemaValues extends Record<string, unknown>>({ is, then, otherwise, }: Params<TLastSchemaValues>) => (value: unknown, prevCtx?: ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
38
|
+
export declare const when: <TLastSchemaValues extends Record<string, unknown>>({ is, then, otherwise, }: Params<TLastSchemaValues>) => (value: unknown, prevCtx?: ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<unknown, TLastSchemaValues>>;
|
39
39
|
export {};
|
package/ogrnIP/ogrnIP.d.ts
CHANGED
@@ -13,5 +13,5 @@ type OgrnIPParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('7728168971');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const ogrnIP: <TLastSchemaValues extends Record<string, unknown>>(params?: OgrnIPParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const ogrnIP: <TLastSchemaValues extends Record<string, unknown>>(params?: OgrnIPParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
package/ogrnUL/ogrnUL.d.ts
CHANGED
@@ -13,5 +13,5 @@ type OgrnULParams = CommonRuleParams<string> & {
|
|
13
13
|
* validate('7728168971');
|
14
14
|
* ```
|
15
15
|
*/
|
16
|
-
export declare const ogrnUL: <TLastSchemaValues extends Record<string, unknown>>(params?: OgrnULParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
16
|
+
export declare const ogrnUL: <TLastSchemaValues extends Record<string, unknown>>(params?: OgrnULParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
17
17
|
export {};
|
@@ -12,5 +12,5 @@ type OnlyNumberParams = {
|
|
12
12
|
* validate('123');
|
13
13
|
* ```
|
14
14
|
*/
|
15
|
-
export declare const onlyNumber: <TLastSchemaValues extends Record<string, unknown>>(params?: OnlyNumberParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => import("../core").
|
15
|
+
export declare const onlyNumber: <TLastSchemaValues extends Record<string, unknown>>(params?: OnlyNumberParams) => (value: string, prevCtx?: import("../core").ValidationContext<TLastSchemaValues> | undefined) => ReturnType<import("../core").IndependentValidationRule<string, TLastSchemaValues>>;
|
16
16
|
export {};
|