@astral/validations 4.25.0 → 4.26.1

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 CHANGED
@@ -76,6 +76,7 @@
76
76
  - [Доступ к ctx.global.values](#доступ-к-высокоуровневым-values-ctxglobalvalues)
77
77
  - [Переиспользуемое правило](#переиспользуемое-правило)
78
78
  - [Кастомная условная валидация](#кастомная-условная-валидация)
79
+ - [Aggregate](#aggregate)
79
80
  - [Common](#common)
80
81
  - [optional](#optional)
81
82
  - [when. Условная валидация](#when-условная-валидация)
@@ -1856,6 +1857,67 @@ const validate = object<Values>({
1856
1857
 
1857
1858
  ---
1858
1859
 
1860
+ # Aggregate
1861
+
1862
+ Агрегация валидаций. Возвращает массив всех ошибок.
1863
+
1864
+ Пример:
1865
+
1866
+ ```typescript
1867
+ type Values = {
1868
+ password: string;
1869
+ };
1870
+
1871
+ const validate = string(aggregate(
1872
+ min(8),
1873
+ containsNumbers(),
1874
+ containsDifferentCases(),
1875
+ ));
1876
+
1877
+ const result = validate('user');
1878
+
1879
+ // [
1880
+ // {
1881
+ // message: Мин. символов: 8
1882
+ // cause: { code: 'astral-validations-string-min', errors: undefined }
1883
+ // },
1884
+ // {
1885
+ // message: Строка должна содержать числа
1886
+ // cause: { code: 'astral-validations-containsNumbers', errors: undefined }
1887
+ // },
1888
+ // {
1889
+ // messgae: Строка должна содержать символы разного регистра
1890
+ // cause: { code: 'astral-validations-containsDifferentCases', errors: undefined }
1891
+ // },
1892
+ // ]
1893
+ result.cause.errors;
1894
+ ```
1895
+
1896
+ ## Основная ошибка
1897
+
1898
+ В основную ошибку результата помещается первое правило, которое не прошло проверку:
1899
+
1900
+ ```typescript
1901
+ type Values = {
1902
+ password: string;
1903
+ };
1904
+
1905
+ const validate = string(aggregate(
1906
+ min(8),
1907
+ containsNumbers(),
1908
+ ));
1909
+
1910
+ const result = validate('user');
1911
+
1912
+ // astral-validations-string-min
1913
+ result.cause.code;
1914
+
1915
+ // Мин. символов: 8
1916
+ result.message;
1917
+ ```
1918
+
1919
+ ---
1920
+
1859
1921
  # Common
1860
1922
 
1861
1923
  ## optional
@@ -2123,112 +2185,20 @@ toPrettyError(result);
2123
2185
 
2124
2186
  # Integrations
2125
2187
 
2126
- ## react-hook-form
2127
-
2128
- Для интеграции с react-hook-form необходимо использовать пакет ```@astral/validations-react-hook-form-resolver```.
2129
-
2130
- ### [Codesandbox](https://codesandbox.io/s/astral-validations-react-hook-form-tnq4of?file=/src/Form.tsx)
2131
-
2132
- ### Basic usage
2133
-
2134
- ```tsx
2135
- import { object, string, optional } from '@astral/validations';
2136
- import { resolver } from '@astral/validations-react-hook-form-resolver';
2137
- import { useForm } from 'react-hook-form';
2188
+ Пакет `@astral/ui` поддерживает схему валидации с помощью хука `useForm`
2138
2189
 
2139
- type Values = {
2140
- name: string;
2141
- info: { description?: string }
2142
- };
2143
-
2144
- const validationSchema = object<Values>({
2190
+ ```typescript
2191
+ const validationSchema = object<FormValues>({
2192
+ lastName: string(),
2145
2193
  name: string(),
2146
- info: object<Values['info']>({
2147
- description: optional(string()),
2148
- }),
2194
+ patronymic: optional(string()),
2195
+ phone: string(mobilePhone()),
2196
+ email: string(email()),
2149
2197
  });
2150
2198
 
2151
- const Form = () => {
2152
- const { register, handleSubmit, formState } = useForm<Values>({
2153
- resolver: resolver<Values>(validationSchema),
2154
- });
2155
-
2156
- return (
2157
- <form onSubmit={handleSubmit(() => {})}>
2158
- <input {...register('name')} />
2159
- {formState.errors.name && (
2160
- <p>{formState.errors.name.message}</p>
2161
- )}
2162
- <input {...register('info.description')} />
2163
- {formState.errors.info?.description && (
2164
- <p>{formState.errors.info.description.message}</p>
2165
- )}
2166
- <button type="submit">submit</button>
2167
- </form>
2168
- );
2169
- };
2199
+ const form = useForm<FormValues>({ validationSchema });
2170
2200
  ```
2171
2201
 
2172
- ### Переиспользуемый useForm
2173
-
2174
- ```tsx
2175
- import { ObjectGuard, object, optional, string } from '@astral/validations';
2176
- import { resolver } from '@astral/validations-react-hook-form-resolver';
2177
- import {
2178
- FieldValues,
2179
- UseFormReturn,
2180
- UseFormProps as UseReactHookFormProps,
2181
- useForm as useReactHookForm,
2182
- } from 'react-hook-form';
2183
-
2184
- type UseFormProps<TFieldValues extends FieldValues = FieldValues> = Omit<
2185
- UseReactHookFormProps<TFieldValues>,
2186
- 'resolver'
2187
- > & {
2188
- validationSchema?: ObjectGuard<TFieldValues, TFieldValues>;
2189
- };
2190
-
2191
- const useForm = <TFieldValues extends FieldValues = FieldValues>({
2192
- validationSchema,
2193
- defaultValues,
2194
- ...params
2195
- }: UseFormProps<TFieldValues>): UseFormReturn<TFieldValues> =>
2196
- useReactHookForm<TFieldValues>({
2197
- ...params,
2198
- defaultValues,
2199
- resolver: validationSchema && resolver(validationSchema),
2200
- });
2201
-
2202
- type Values = {
2203
- name: string;
2204
- info: { description?: string };
2205
- };
2206
-
2207
- const validationSchema = object<Values>({
2208
- name: string(),
2209
- info: object<Values['info']>({
2210
- description: optional(string()),
2211
- }),
2212
- });
2213
-
2214
- const Form = () => {
2215
- const { register, handleSubmit, formState } = useForm<Values>({
2216
- validationSchema,
2217
- });
2218
-
2219
- return (
2220
- <form onSubmit={handleSubmit(() => {})}>
2221
- <input {...register('name')} />
2222
- {formState.errors.name && <p>{formState.errors.name.message}</p>}
2223
- <input {...register('info.description')} />
2224
- {formState.errors.info?.description && (
2225
- <p>{formState.errors.info.description.message}</p>
2226
- )}
2227
- <button type="submit">submit</button>
2228
- </form>
2229
- );
2230
- };
2231
- ```
2232
2202
 
2233
2203
  # Guides
2234
2204
 
@@ -0,0 +1,6 @@
1
+ import { type IndependentValidationRule, type ValidationRule } from '../rule';
2
+ /**
3
+ * Объединяет переданные правила в цепочку правил, выполняет все правила и собирает все ошибки в массив.
4
+ * @example aggregate(min(), max(), guid());
5
+ */
6
+ export declare const aggregate: <TValidationType, TLastSchemaValues extends Record<string, unknown>>(...rules: Array<IndependentValidationRule<TValidationType, TLastSchemaValues> | ValidationRule<TValidationType, TLastSchemaValues>>) => IndependentValidationRule<TValidationType, Record<string, unknown>>;
@@ -0,0 +1,20 @@
1
+ import { createSimpleError, ValidationSimpleError } from '../errors';
2
+ import { callRule, } from '../rule';
3
+ /**
4
+ * Объединяет переданные правила в цепочку правил, выполняет все правила и собирает все ошибки в массив.
5
+ * @example aggregate(min(), max(), guid());
6
+ */
7
+ export const aggregate = (...rules) => (value, ctx) => {
8
+ const errors = [];
9
+ for (const rule of rules) {
10
+ const result = callRule(rule, value, ctx);
11
+ if (result instanceof ValidationSimpleError) {
12
+ errors.push(result);
13
+ }
14
+ }
15
+ if (errors.length > 0) {
16
+ const firstError = errors[0];
17
+ return createSimpleError({ message: firstError.message, code: firstError.cause.code }, errors);
18
+ }
19
+ return undefined;
20
+ };
@@ -0,0 +1 @@
1
+ export * from './aggregate';
@@ -0,0 +1 @@
1
+ export * from './aggregate';
@@ -5,10 +5,11 @@ import { type ErrorCode } from '../types';
5
5
  export type ValidationErrorData<TAddCause extends Record<string, unknown>> = {
6
6
  cause: TAddCause & {
7
7
  code: ErrorCode;
8
+ errors?: ValidationSimpleError[];
8
9
  };
9
10
  };
10
11
  /**
11
- * Простая ошибка правил валидации. Не имеет вложенных ошибок
12
+ * Простая ошибка правил валидации. Может содержать массив ошибок при использовании aggregate
12
13
  */
13
14
  export declare class ValidationSimpleError<TAddCause extends Record<string, unknown> = {}> extends Error {
14
15
  cause: ValidationErrorData<TAddCause>['cause'];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Простая ошибка правил валидации. Не имеет вложенных ошибок
2
+ * Простая ошибка правил валидации. Может содержать массив ошибок при использовании aggregate
3
3
  */
4
4
  export class ValidationSimpleError extends Error {
5
5
  constructor(message, data) {
@@ -3,4 +3,7 @@ import { ValidationSimpleError } from '../SimpleError';
3
3
  /**
4
4
  * Создает простую ошибки валидации. Используется в обычных rules
5
5
  */
6
- export declare const createSimpleError: ({ message, code }: ErrorInfo) => ValidationSimpleError<{}>;
6
+ export declare const createSimpleError: ({ message, code }: ErrorInfo, errors?: ValidationSimpleError[]) => ValidationSimpleError<{
7
+ code: string;
8
+ errors: ValidationSimpleError<{}>[] | undefined;
9
+ }>;
@@ -2,4 +2,4 @@ import { ValidationSimpleError } from '../SimpleError';
2
2
  /**
3
3
  * Создает простую ошибки валидации. Используется в обычных rules
4
4
  */
5
- export const createSimpleError = ({ message, code }) => new ValidationSimpleError(message, { cause: { code } });
5
+ export const createSimpleError = ({ message, code }, errors) => new ValidationSimpleError(message, { cause: { code, errors } });
package/core/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './compose';
2
2
  export * from './composeAsync';
3
+ export * from './aggregate';
3
4
  export * from './context';
4
5
  export * from './errors';
5
6
  export * from './errors';
package/core/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './compose';
2
2
  export * from './composeAsync';
3
+ export * from './aggregate';
3
4
  export * from './context';
4
5
  export * from './errors';
5
6
  export * from './errors';
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { BOOLEAN_TYPE_ERROR_INFO, boolean } from './boolean';
5
5
  export { CONTAINS_DIFFERENT_CASES_ERROR_CODE, containsDifferentCases, } from './containsDifferentCases';
6
6
  export { CONTAINS_NUMBERS_ERROR_CODE, containsNumbers, } from './containsNumbers';
7
7
  export { CONTAINS_PUNCTUATION_MARKS_ERROR_CODE, containsPunctuationMarks, } from './containsPunctuationMarks';
8
- export { createRule, REQUIRED_ERROR_INFO, type ValidationRule } from './core';
8
+ export { aggregate, createRule, REQUIRED_ERROR_INFO, type ValidationRule, } from './core';
9
9
  export { DATE_TYPE_ERROR_INFO, date, INVALID_DATE_ERROR_INFO } from './date';
10
10
  export { deepPartial } from './deepPartial';
11
11
  export { email, INVALID_EMAIL_ERROR_INFO, LENGTH_EMAIL_ERROR_INFO, } from './email';
package/index.js CHANGED
@@ -5,7 +5,7 @@ export { BOOLEAN_TYPE_ERROR_INFO, boolean } from './boolean';
5
5
  export { CONTAINS_DIFFERENT_CASES_ERROR_CODE, containsDifferentCases, } from './containsDifferentCases';
6
6
  export { CONTAINS_NUMBERS_ERROR_CODE, containsNumbers, } from './containsNumbers';
7
7
  export { CONTAINS_PUNCTUATION_MARKS_ERROR_CODE, containsPunctuationMarks, } from './containsPunctuationMarks';
8
- export { createRule, REQUIRED_ERROR_INFO } from './core';
8
+ export { aggregate, createRule, REQUIRED_ERROR_INFO, } from './core';
9
9
  export { DATE_TYPE_ERROR_INFO, date, INVALID_DATE_ERROR_INFO } from './date';
10
10
  export { deepPartial } from './deepPartial';
11
11
  export { email, INVALID_EMAIL_ERROR_INFO, LENGTH_EMAIL_ERROR_INFO, } from './email';
@@ -0,0 +1,6 @@
1
+ import { type IndependentValidationRule, type ValidationRule } from '../rule';
2
+ /**
3
+ * Объединяет переданные правила в цепочку правил, выполняет все правила и собирает все ошибки в массив.
4
+ * @example aggregate(min(), max(), guid());
5
+ */
6
+ export declare const aggregate: <TValidationType, TLastSchemaValues extends Record<string, unknown>>(...rules: Array<IndependentValidationRule<TValidationType, TLastSchemaValues> | ValidationRule<TValidationType, TLastSchemaValues>>) => IndependentValidationRule<TValidationType, Record<string, unknown>>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aggregate = void 0;
4
+ const errors_1 = require("../errors");
5
+ const rule_1 = require("../rule");
6
+ /**
7
+ * Объединяет переданные правила в цепочку правил, выполняет все правила и собирает все ошибки в массив.
8
+ * @example aggregate(min(), max(), guid());
9
+ */
10
+ const aggregate = (...rules) => (value, ctx) => {
11
+ const errors = [];
12
+ for (const rule of rules) {
13
+ const result = (0, rule_1.callRule)(rule, value, ctx);
14
+ if (result instanceof errors_1.ValidationSimpleError) {
15
+ errors.push(result);
16
+ }
17
+ }
18
+ if (errors.length > 0) {
19
+ const firstError = errors[0];
20
+ return (0, errors_1.createSimpleError)({ message: firstError.message, code: firstError.cause.code }, errors);
21
+ }
22
+ return undefined;
23
+ };
24
+ exports.aggregate = aggregate;
@@ -0,0 +1 @@
1
+ export * from './aggregate';
@@ -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("./aggregate"), exports);
@@ -5,10 +5,11 @@ import { type ErrorCode } from '../types';
5
5
  export type ValidationErrorData<TAddCause extends Record<string, unknown>> = {
6
6
  cause: TAddCause & {
7
7
  code: ErrorCode;
8
+ errors?: ValidationSimpleError[];
8
9
  };
9
10
  };
10
11
  /**
11
- * Простая ошибка правил валидации. Не имеет вложенных ошибок
12
+ * Простая ошибка правил валидации. Может содержать массив ошибок при использовании aggregate
12
13
  */
13
14
  export declare class ValidationSimpleError<TAddCause extends Record<string, unknown> = {}> extends Error {
14
15
  cause: ValidationErrorData<TAddCause>['cause'];
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ValidationSimpleError = void 0;
4
4
  /**
5
- * Простая ошибка правил валидации. Не имеет вложенных ошибок
5
+ * Простая ошибка правил валидации. Может содержать массив ошибок при использовании aggregate
6
6
  */
7
7
  class ValidationSimpleError extends Error {
8
8
  constructor(message, data) {
@@ -3,4 +3,7 @@ import { ValidationSimpleError } from '../SimpleError';
3
3
  /**
4
4
  * Создает простую ошибки валидации. Используется в обычных rules
5
5
  */
6
- export declare const createSimpleError: ({ message, code }: ErrorInfo) => ValidationSimpleError<{}>;
6
+ export declare const createSimpleError: ({ message, code }: ErrorInfo, errors?: ValidationSimpleError[]) => ValidationSimpleError<{
7
+ code: string;
8
+ errors: ValidationSimpleError<{}>[] | undefined;
9
+ }>;
@@ -5,5 +5,5 @@ const SimpleError_1 = require("../SimpleError");
5
5
  /**
6
6
  * Создает простую ошибки валидации. Используется в обычных rules
7
7
  */
8
- const createSimpleError = ({ message, code }) => new SimpleError_1.ValidationSimpleError(message, { cause: { code } });
8
+ const createSimpleError = ({ message, code }, errors) => new SimpleError_1.ValidationSimpleError(message, { cause: { code, errors } });
9
9
  exports.createSimpleError = createSimpleError;
@@ -1,5 +1,6 @@
1
1
  export * from './compose';
2
2
  export * from './composeAsync';
3
+ export * from './aggregate';
3
4
  export * from './context';
4
5
  export * from './errors';
5
6
  export * from './errors';
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./compose"), exports);
18
18
  __exportStar(require("./composeAsync"), exports);
19
+ __exportStar(require("./aggregate"), exports);
19
20
  __exportStar(require("./context"), exports);
20
21
  __exportStar(require("./errors"), exports);
21
22
  __exportStar(require("./errors"), exports);
package/node/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { BOOLEAN_TYPE_ERROR_INFO, boolean } from './boolean';
5
5
  export { CONTAINS_DIFFERENT_CASES_ERROR_CODE, containsDifferentCases, } from './containsDifferentCases';
6
6
  export { CONTAINS_NUMBERS_ERROR_CODE, containsNumbers, } from './containsNumbers';
7
7
  export { CONTAINS_PUNCTUATION_MARKS_ERROR_CODE, containsPunctuationMarks, } from './containsPunctuationMarks';
8
- export { createRule, REQUIRED_ERROR_INFO, type ValidationRule } from './core';
8
+ export { aggregate, createRule, REQUIRED_ERROR_INFO, type ValidationRule, } from './core';
9
9
  export { DATE_TYPE_ERROR_INFO, date, INVALID_DATE_ERROR_INFO } from './date';
10
10
  export { deepPartial } from './deepPartial';
11
11
  export { email, INVALID_EMAIL_ERROR_INFO, LENGTH_EMAIL_ERROR_INFO, } from './email';
package/node/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.min = exports.DATE_MIN_ERROR_CODE = exports.ARRAY_MIN_ERROR_CODE = exports.STRING_MAX_ERROR_CODE = exports.NUMBER_MAX_ERROR_CODE = exports.max = exports.DATE_MAX_ERROR_CODE = exports.ARRAY_MAX_ERROR_CODE = exports.STRING_LENGTH_ERROR_CODE = exports.length = exports.kpp = exports.KPP_ZEROS_ONLY_ERROR_INFO = exports.KPP_DOUBLE_ZERO_START_ERROR_INFO = exports.INVALID_KPP_ERROR_INFO = exports.integer = exports.INTEGER_ERROR_INFO = exports.innUL = exports.INN_UL_ERROR_INFO = exports.innTwelveSymbols = exports.INN_12_SYMBOLS_ERROR_INFO = exports.innIP = exports.INN_IP_ERROR_INFO = exports.innFL = exports.INN_FL_ERROR_INFO = exports.INVALID_GUID_ERROR_INFO = exports.guid = exports.enabled = exports.emailOrPhone = exports.EMAIL_OR_PHONE_ERROR_INFO = exports.LENGTH_EMAIL_ERROR_INFO = exports.INVALID_EMAIL_ERROR_INFO = exports.email = exports.deepPartial = exports.INVALID_DATE_ERROR_INFO = exports.date = exports.DATE_TYPE_ERROR_INFO = exports.REQUIRED_ERROR_INFO = exports.createRule = exports.containsPunctuationMarks = exports.CONTAINS_PUNCTUATION_MARKS_ERROR_CODE = exports.containsNumbers = exports.CONTAINS_NUMBERS_ERROR_CODE = exports.containsDifferentCases = exports.CONTAINS_DIFFERENT_CASES_ERROR_CODE = exports.boolean = exports.BOOLEAN_TYPE_ERROR_INFO = exports.arrayItem = exports.array = exports.ARRAY_TYPE_ERROR_INFO = exports.any = void 0;
4
- 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.positiveNumber = exports.POSITIVE_NUMBER_ERROR_INFO = exports.personSurname = exports.PERSON_SURNAME_ERROR_INFO = exports.personPatronymic = exports.PERSON_PATRONYMIC_ERROR_INFO = exports.personName = exports.PERSON_NAME_ERROR_INFO = exports.pattern = exports.PATTERN_ERROR_CODE = exports.passportSeries = exports.PASSPORT_SERIES_ONLY_DIGITS_ERROR_INFO = exports.PASSPORT_SERIES_ERROR_LENGTH_INFO = exports.PASSPORT_SERIES_ERROR_INFO = exports.passportNumber = exports.PASSPORT_NUMBER_ONLY_DIGITS_ERROR_INFO = exports.PASSPORT_NUMBER_LENGTH_ERROR_INFO = exports.PASSPORT_NUMBER_ERROR_INFO = exports.passportCode = exports.PASSPORT_CODE_ONLY_DIGITS_ERROR_INFO = exports.PASSPORT_CODE_LENGTH_ERROR_INFO = exports.PASSPORT_CODE_ERROR_INFO = exports.partial = exports.or = exports.optionalAsync = exports.optional = exports.onlyNumber = exports.ONLY_NUMBER_ERROR_CODE = exports.ogrnUL = exports.OGRN_UL_ERROR_INFO = exports.ogrnIP = exports.OGRN_IP_ERROR_INFO = exports.objectAsync = exports.object = exports.OBJECT_TYPE_ERROR_INFO = exports.number = exports.NUMBER_TYPE_ERROR_INFO = exports.NAN_NUMBER_ERROR_INFO = exports.INFINITY_NUMBER_ERROR_INFO = exports.mobilePhone = exports.MOBILE_PHONE_ERROR_INFO = exports.minYearsOld = exports.BIRTH_DATE_MIN_ERROR_CODE = exports.BIRTH_DATE_MAX_ERROR_CODE = exports.STRING_MIN_ERROR_CODE = exports.NUMBER_MIN_ERROR_CODE = void 0;
5
- exports.when = exports.uploadedFileList = exports.FILE_LIST_NOT_ARRAY_ERROR_INFO = exports.uploadedFile = exports.FILE_UPLOAD_ERROR_INFO = exports.FILE_RESTRICTION_ERROR_INFO = exports.FILE_REQUIRED_ERROR_INFO = exports.FILE_LOADING_ERROR_INFO = exports.transform = exports.toPrettyError = exports.toPlainError = exports.textField = exports.LENGTH_TEXT_FIELD_ERROR_INFO = exports.INVALID_TEXT_FIELD_ERROR_INFO = exports.stringAsync = exports.string = exports.STRING_TYPE_ERROR_INFO = exports.snils = exports.SNILS_ERROR_INFO = exports.rangeDateNotEqual = exports.RANGE_DATE_NOT_EQUAL_ERROR_INFO = exports.rangeDateMinMax = exports.RANGE_DATE_MIN_ERROR_INFO = exports.RANGE_DATE_MAX_ERROR_INFO = exports.rangeDateInterval = exports.RANGE_DATE_INTERVAL_ERROR_INFO = exports.rangeDate = exports.RANGE_DATE_START_REQUIRED_ERROR_INFO = exports.RANGE_DATE_START_INVALID_ERROR_INFO = void 0;
3
+ exports.DATE_MIN_ERROR_CODE = exports.ARRAY_MIN_ERROR_CODE = exports.STRING_MAX_ERROR_CODE = exports.NUMBER_MAX_ERROR_CODE = exports.max = exports.DATE_MAX_ERROR_CODE = exports.ARRAY_MAX_ERROR_CODE = exports.STRING_LENGTH_ERROR_CODE = exports.length = exports.kpp = exports.KPP_ZEROS_ONLY_ERROR_INFO = exports.KPP_DOUBLE_ZERO_START_ERROR_INFO = exports.INVALID_KPP_ERROR_INFO = exports.integer = exports.INTEGER_ERROR_INFO = exports.innUL = exports.INN_UL_ERROR_INFO = exports.innTwelveSymbols = exports.INN_12_SYMBOLS_ERROR_INFO = exports.innIP = exports.INN_IP_ERROR_INFO = exports.innFL = exports.INN_FL_ERROR_INFO = exports.INVALID_GUID_ERROR_INFO = exports.guid = exports.enabled = exports.emailOrPhone = exports.EMAIL_OR_PHONE_ERROR_INFO = exports.LENGTH_EMAIL_ERROR_INFO = exports.INVALID_EMAIL_ERROR_INFO = exports.email = exports.deepPartial = exports.INVALID_DATE_ERROR_INFO = exports.date = exports.DATE_TYPE_ERROR_INFO = exports.REQUIRED_ERROR_INFO = exports.createRule = exports.aggregate = exports.containsPunctuationMarks = exports.CONTAINS_PUNCTUATION_MARKS_ERROR_CODE = exports.containsNumbers = exports.CONTAINS_NUMBERS_ERROR_CODE = exports.containsDifferentCases = exports.CONTAINS_DIFFERENT_CASES_ERROR_CODE = exports.boolean = exports.BOOLEAN_TYPE_ERROR_INFO = exports.arrayItem = exports.array = exports.ARRAY_TYPE_ERROR_INFO = exports.any = void 0;
4
+ exports.RANGE_DATE_END_REQUIRED_ERROR_INFO = exports.RANGE_DATE_END_INVALID_ERROR_INFO = exports.RANGE_DATE_END_EARLIER_START_ERROR_INFO = exports.positiveNumber = exports.POSITIVE_NUMBER_ERROR_INFO = exports.personSurname = exports.PERSON_SURNAME_ERROR_INFO = exports.personPatronymic = exports.PERSON_PATRONYMIC_ERROR_INFO = exports.personName = exports.PERSON_NAME_ERROR_INFO = exports.pattern = exports.PATTERN_ERROR_CODE = exports.passportSeries = exports.PASSPORT_SERIES_ONLY_DIGITS_ERROR_INFO = exports.PASSPORT_SERIES_ERROR_LENGTH_INFO = exports.PASSPORT_SERIES_ERROR_INFO = exports.passportNumber = exports.PASSPORT_NUMBER_ONLY_DIGITS_ERROR_INFO = exports.PASSPORT_NUMBER_LENGTH_ERROR_INFO = exports.PASSPORT_NUMBER_ERROR_INFO = exports.passportCode = exports.PASSPORT_CODE_ONLY_DIGITS_ERROR_INFO = exports.PASSPORT_CODE_LENGTH_ERROR_INFO = exports.PASSPORT_CODE_ERROR_INFO = exports.partial = exports.or = exports.optionalAsync = exports.optional = exports.onlyNumber = exports.ONLY_NUMBER_ERROR_CODE = exports.ogrnUL = exports.OGRN_UL_ERROR_INFO = exports.ogrnIP = exports.OGRN_IP_ERROR_INFO = exports.objectAsync = exports.object = exports.OBJECT_TYPE_ERROR_INFO = exports.number = exports.NUMBER_TYPE_ERROR_INFO = exports.NAN_NUMBER_ERROR_INFO = exports.INFINITY_NUMBER_ERROR_INFO = exports.mobilePhone = exports.MOBILE_PHONE_ERROR_INFO = exports.minYearsOld = exports.BIRTH_DATE_MIN_ERROR_CODE = exports.BIRTH_DATE_MAX_ERROR_CODE = exports.STRING_MIN_ERROR_CODE = exports.NUMBER_MIN_ERROR_CODE = exports.min = void 0;
5
+ exports.when = exports.uploadedFileList = exports.FILE_LIST_NOT_ARRAY_ERROR_INFO = exports.uploadedFile = exports.FILE_UPLOAD_ERROR_INFO = exports.FILE_RESTRICTION_ERROR_INFO = exports.FILE_REQUIRED_ERROR_INFO = exports.FILE_LOADING_ERROR_INFO = exports.transform = exports.toPrettyError = exports.toPlainError = exports.textField = exports.LENGTH_TEXT_FIELD_ERROR_INFO = exports.INVALID_TEXT_FIELD_ERROR_INFO = exports.stringAsync = exports.string = exports.STRING_TYPE_ERROR_INFO = exports.snils = exports.SNILS_ERROR_INFO = exports.rangeDateNotEqual = exports.RANGE_DATE_NOT_EQUAL_ERROR_INFO = exports.rangeDateMinMax = exports.RANGE_DATE_MIN_ERROR_INFO = exports.RANGE_DATE_MAX_ERROR_INFO = exports.rangeDateInterval = exports.RANGE_DATE_INTERVAL_ERROR_INFO = exports.rangeDate = exports.RANGE_DATE_START_REQUIRED_ERROR_INFO = exports.RANGE_DATE_START_INVALID_ERROR_INFO = exports.RANGE_DATE_REQUIRED_ERROR_INFO = void 0;
6
6
  var any_1 = require("./any");
7
7
  Object.defineProperty(exports, "any", { enumerable: true, get: function () { return any_1.any; } });
8
8
  var array_1 = require("./array");
@@ -23,6 +23,7 @@ var containsPunctuationMarks_1 = require("./containsPunctuationMarks");
23
23
  Object.defineProperty(exports, "CONTAINS_PUNCTUATION_MARKS_ERROR_CODE", { enumerable: true, get: function () { return containsPunctuationMarks_1.CONTAINS_PUNCTUATION_MARKS_ERROR_CODE; } });
24
24
  Object.defineProperty(exports, "containsPunctuationMarks", { enumerable: true, get: function () { return containsPunctuationMarks_1.containsPunctuationMarks; } });
25
25
  var core_1 = require("./core");
26
+ Object.defineProperty(exports, "aggregate", { enumerable: true, get: function () { return core_1.aggregate; } });
26
27
  Object.defineProperty(exports, "createRule", { enumerable: true, get: function () { return core_1.createRule; } });
27
28
  Object.defineProperty(exports, "REQUIRED_ERROR_INFO", { enumerable: true, get: function () { return core_1.REQUIRED_ERROR_INFO; } });
28
29
  var date_1 = require("./date");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/validations",
3
- "version": "4.25.0",
3
+ "version": "4.26.1",
4
4
  "main": "./node/index.js",
5
5
  "dependencies": {
6
6
  "@astral/utils": "^1.11.0",