@astral/validations 4.13.0 → 4.13.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.
Files changed (103) hide show
  1. package/README.md +1 -1
  2. package/any/any.d.ts +1 -1
  3. package/array/array.d.ts +1 -1
  4. package/array/array.js +1 -1
  5. package/array/constants.d.ts +1 -1
  6. package/arrayItem/arrayItem.d.ts +1 -1
  7. package/boolean/boolean.d.ts +1 -1
  8. package/boolean/constants.d.ts +1 -1
  9. package/containsDifferentCases/constants.d.ts +1 -1
  10. package/containsNumbers/constants.d.ts +1 -1
  11. package/containsPunctuationMarks/constants.d.ts +1 -1
  12. package/core/compose/compose.d.ts +1 -1
  13. package/core/compose/compose.js +1 -1
  14. package/core/composeAsync/composeAsync.d.ts +1 -1
  15. package/core/context/createContext/createContext.d.ts +3 -3
  16. package/core/context/types.d.ts +2 -2
  17. package/core/errors/ArrayError/ArrayError.d.ts +2 -2
  18. package/core/errors/ArrayError/ArrayError.js +1 -1
  19. package/core/errors/ArrayError/createArrayError/createArrayError.d.ts +1 -1
  20. package/core/errors/ArrayError/createArrayError/createArrayError.js +1 -1
  21. package/core/errors/ErrorMap/ErrorMap.d.ts +2 -2
  22. package/core/errors/ErrorMap/ErrorMap.js +1 -1
  23. package/core/errors/ErrorMap/createErrorMap/createErrorMap.d.ts +1 -1
  24. package/core/errors/ErrorMap/createErrorMap/createErrorMap.js +1 -1
  25. package/core/errors/SimpleError/SimpleError.d.ts +1 -1
  26. package/core/errors/SimpleError/createSimpleError/createSimpleError.d.ts +1 -1
  27. package/core/errors/constants.d.ts +1 -1
  28. package/core/errors/createErrorCode/createErrorCode.d.ts +1 -1
  29. package/core/errors/types.d.ts +3 -3
  30. package/core/guard/createGuard/createGuard.d.ts +2 -2
  31. package/core/rule/callAsyncRule/callAsyncRule.d.ts +3 -3
  32. package/core/rule/callRule/callRule.d.ts +3 -3
  33. package/core/rule/createRule/createRule.d.ts +3 -3
  34. package/core/rule/required/constants.d.ts +1 -1
  35. package/core/rule/types.d.ts +2 -2
  36. package/core/types.d.ts +1 -1
  37. package/date/constants.d.ts +1 -1
  38. package/date/date.d.ts +1 -1
  39. package/deepPartial/deepPartial.d.ts +1 -1
  40. package/email/constants.d.ts +1 -1
  41. package/guid/constants.d.ts +1 -1
  42. package/innFL/constants.d.ts +1 -1
  43. package/innFL/innFL.d.ts +1 -1
  44. package/innIP/constants.d.ts +1 -1
  45. package/innIP/innIP.d.ts +1 -1
  46. package/innTwelveSymbols/constants.d.ts +1 -1
  47. package/innTwelveSymbols/innTwelveSymbols.d.ts +1 -1
  48. package/innUL/constants.d.ts +1 -1
  49. package/innUL/innUL.d.ts +1 -1
  50. package/integer/constants.d.ts +1 -1
  51. package/kpp/constants.d.ts +1 -1
  52. package/kpp/kpp.d.ts +1 -1
  53. package/length/constants.d.ts +1 -1
  54. package/max/constants.d.ts +1 -1
  55. package/max/max.d.ts +1 -1
  56. package/min/constants.d.ts +1 -1
  57. package/min/min.d.ts +1 -1
  58. package/minYearsOld/constants.d.ts +1 -1
  59. package/mobilePhone/constants.d.ts +1 -1
  60. package/mobilePhone/mobilePhone.d.ts +1 -1
  61. package/number/constants.d.ts +1 -1
  62. package/number/number.d.ts +1 -1
  63. package/object/constants.d.ts +1 -1
  64. package/object/isEmptyErrors/isEmptyErrors.d.ts +1 -1
  65. package/object/object.d.ts +1 -1
  66. package/object/objectAsync/objectAsync.d.ts +1 -1
  67. package/ogrnIP/constants.d.ts +1 -1
  68. package/ogrnIP/ogrnIP.d.ts +1 -1
  69. package/ogrnUL/constants.d.ts +1 -1
  70. package/ogrnUL/ogrnUL.d.ts +1 -1
  71. package/onlyNumber/constants.d.ts +1 -1
  72. package/optional/optional.d.ts +1 -1
  73. package/optional/optionalAsync/optionalAsync.d.ts +1 -1
  74. package/or/or.d.ts +1 -1
  75. package/package.json +1 -1
  76. package/partial/partial.d.ts +1 -1
  77. package/passportCode/constants.d.ts +1 -1
  78. package/passportCode/passportCode.d.ts +1 -1
  79. package/passportCode/passportCode.js +1 -1
  80. package/passportNumber/constants.d.ts +1 -1
  81. package/passportNumber/passportNumber.d.ts +1 -1
  82. package/passportSeries/constants.d.ts +1 -1
  83. package/passportSeries/passportSeries.d.ts +1 -1
  84. package/passportSeries/passportSeries.js +1 -1
  85. package/pattern/constants.d.ts +1 -1
  86. package/personName/constants.d.ts +1 -1
  87. package/personName/personName.d.ts +1 -1
  88. package/personPatronymic/constants.d.ts +1 -1
  89. package/personPatronymic/personPatronymic.d.ts +1 -1
  90. package/personSurname/constants.d.ts +1 -1
  91. package/personSurname/personSurname.d.ts +1 -1
  92. package/positiveNumber/constants.d.ts +1 -1
  93. package/snils/constants.d.ts +1 -1
  94. package/snils/snils.d.ts +1 -1
  95. package/string/constants.d.ts +1 -1
  96. package/string/string.d.ts +1 -1
  97. package/string/stringAsync/stringAsync.d.ts +1 -1
  98. package/textField/constants.d.ts +1 -1
  99. package/toPlainError/toPlainError.d.ts +1 -1
  100. package/toPrettyError/toPrettyError.d.ts +2 -2
  101. package/transform/transform.d.ts +1 -1
  102. package/transform/transform.js +1 -1
  103. package/when/when.d.ts +1 -1
package/README.md CHANGED
@@ -554,7 +554,7 @@ validate('156-573-259 92')
554
554
 
555
555
  ### textField
556
556
 
557
- Проверяет валидно ли текстовое поле
557
+ Правило реализует [дефолтные ограничения](https://track.astral.ru/soft/wiki/pages/viewpage.action?pageId=3813152849#id-%D0%A2%D1%80%D0%B5%D0%B1%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F%D0%BD%D0%B0%D1%80%D0%B5%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8E-%D0%A2%D1%80%D0%B5%D0%B1%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B514.%D0%9F%D1%80%D0%BE%D0%B8%D0%B7%D0%B2%D0%BE%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5%D1%82%D0%B5%D0%BA%D1%81%D1%82%D0%BE%D0%B2%D1%8B%D0%B5%D0%BF%D0%BE%D0%BB%D1%8F) для произвольных текстовых полей форм Астрал-Софт.
558
558
 
559
559
  ```ts
560
560
  import { string, textField } from '@astral/validations';
package/any/any.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationRule } from '../core';
1
+ import { type ValidationRule } from '../core';
2
2
  /**
3
3
  * @description Выключает любые проверки и валидирует value
4
4
  * @param rules - правила, валидирующие любые значения
package/array/array.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationRule } from '../core';
1
+ import { type ValidationRule } from '../core';
2
2
  /**
3
3
  * @description Guard для массива. Проверяет value на соответствие типу array
4
4
  * @param rules - правила валидаций, применяющиеся ко всему массиву
package/array/array.js CHANGED
@@ -1,4 +1,4 @@
1
- import { compose, createGuard } from '../core';
1
+ import { compose, createGuard, } from '../core';
2
2
  import { ARRAY_TYPE_ERROR_INFO } from './constants';
3
3
  /**
4
4
  * @description Guard для массива. Проверяет value на соответствие типу array
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const ARRAY_TYPE_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { ValidationRule } from '../core';
1
+ import { type ValidationRule } from '../core';
2
2
  /**
3
3
  * @description Применяет правила к каждому элементу массива
4
4
  * @param rules - правила валидации, которое применится к каждому элементу массива
@@ -1,4 +1,4 @@
1
- import { ValidationRule } from '../core';
1
+ import { type ValidationRule } from '../core';
2
2
  /**
3
3
  * @description Guard для boolean. Проверяет значение на тип boolean
4
4
  * @param rules - правила, валидирующие boolean или unknown value
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const BOOLEAN_TYPE_ERROR_INFO: ErrorInfo;
@@ -1,2 +1,2 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const CONTAINS_DIFFERENT_CASES_ERROR_CODE: ErrorCode;
@@ -1,2 +1,2 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const CONTAINS_NUMBERS_ERROR_CODE: ErrorCode;
@@ -1,2 +1,2 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const CONTAINS_PUNCTUATION_MARKS_ERROR_CODE: ErrorCode;
@@ -1,4 +1,4 @@
1
- import { IndependentValidationRule, ValidationRule } from '../rule';
1
+ import { type IndependentValidationRule, type ValidationRule } from '../rule';
2
2
  /**
3
3
  * @description Объединяет переданные правила в цепочку правил, останавливает выполнение цепочки, если появилась ошибка. Выполняет правила слева направо
4
4
  * @example compose(min(), max());
@@ -1,4 +1,4 @@
1
- import { callRule } from '../rule';
1
+ import { callRule, } from '../rule';
2
2
  /**
3
3
  * @description Объединяет переданные правила в цепочку правил, останавливает выполнение цепочки, если появилась ошибка. Выполняет правила слева направо
4
4
  * @example compose(min(), max());
@@ -1,4 +1,4 @@
1
- import { AsyncIndependentValidationRule, AsyncValidationRule, IndependentValidationRule, ValidationRule } from '../rule';
1
+ import { type AsyncIndependentValidationRule, type AsyncValidationRule, type IndependentValidationRule, type ValidationRule } from '../rule';
2
2
  /**
3
3
  * Объединяет переданные асинхронные правила в цепочку правил, останавливает выполнение цепочки, если появилась ошибка. Выполняет правила слева направо
4
4
  * @example composeAsync(stringAsync(), max());
@@ -1,6 +1,6 @@
1
- import { DeepPartial } from 'utility-types';
2
- import { ValidationContext } from '../types';
3
- import { ValidationTypes } from '../../types';
1
+ import { type DeepPartial } from 'utility-types';
2
+ import { type ValidationContext } from '../types';
3
+ import { type ValidationTypes } from '../../types';
4
4
  type Params<TLastSchemaValues extends Record<string, unknown>> = {
5
5
  /**
6
6
  * Value последнего валидируемого объекта
@@ -1,5 +1,5 @@
1
- import { DeepPartial, DeepReadonly } from 'utility-types';
2
- import { createSimpleError } from '../errors';
1
+ import { type DeepPartial, type DeepReadonly } from 'utility-types';
2
+ import { type createSimpleError } from '../errors';
3
3
  /**
4
4
  * @description Контекст, который доступен в каждом правиле
5
5
  */
@@ -1,5 +1,5 @@
1
- import { ValidationResult } from '../../types';
2
- import { ValidationErrorData, ValidationSimpleError } from '../SimpleError';
1
+ import { type ValidationResult } from '../../types';
2
+ import { type ValidationErrorData, ValidationSimpleError } from '../SimpleError';
3
3
  /**
4
4
  * @description Доп. поля для ошибок элементов массива
5
5
  */
@@ -1,4 +1,4 @@
1
- import { ValidationSimpleError } from '../SimpleError';
1
+ import { ValidationSimpleError, } from '../SimpleError';
2
2
  /**
3
3
  * @description Array ошибок для массива
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ValidationArrayError, ValidationArrayErrorCause } from '../ArrayError';
1
+ import { ValidationArrayError, type ValidationArrayErrorCause } from '../ArrayError';
2
2
  /**
3
3
  * @description Создает array ошибок. Ошибка предназначена для результата валидации массива
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ValidationArrayError } from '../ArrayError';
1
+ import { ValidationArrayError, } from '../ArrayError';
2
2
  /**
3
3
  * @description Создает array ошибок. Ошибка предназначена для результата валидации массива
4
4
  */
@@ -1,5 +1,5 @@
1
- import { ValidationErrorData, ValidationSimpleError } from '../SimpleError';
2
- import { ValidationResult } from '../../types';
1
+ import { type ValidationErrorData, ValidationSimpleError } from '../SimpleError';
2
+ import { type ValidationResult } from '../../types';
3
3
  /**
4
4
  * @description Map, которое содержит результат валидации свойств
5
5
  */
@@ -1,4 +1,4 @@
1
- import { ValidationSimpleError } from '../SimpleError';
1
+ import { ValidationSimpleError, } from '../SimpleError';
2
2
  /**
3
3
  * @description Map ошибок для объекта
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ValidationErrorMap, ValidationObjectErrorCause } from '../ErrorMap';
1
+ import { ValidationErrorMap, type ValidationObjectErrorCause } from '../ErrorMap';
2
2
  /**
3
3
  * @description Создает map ошибок валидаций. Ошибка предназначена для генерации результата валидации объекта
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ValidationErrorMap } from '../ErrorMap';
1
+ import { ValidationErrorMap, } from '../ErrorMap';
2
2
  /**
3
3
  * @description Создает map ошибок валидаций. Ошибка предназначена для генерации результата валидации объекта
4
4
  */
@@ -1,4 +1,4 @@
1
- import { ErrorCode } from '../types';
1
+ import { type ErrorCode } from '../types';
2
2
  /**
3
3
  * @description Причина ошибки валидации
4
4
  */
@@ -1,5 +1,5 @@
1
1
  import { ValidationSimpleError } from '../SimpleError';
2
- import { ErrorInfo } from '../../types';
2
+ import { type ErrorInfo } from '../../types';
3
3
  /**
4
4
  * @description Создает простую ошибки валидации. Используется в обычных rules
5
5
  */
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from './types';
1
+ import { type ErrorInfo } from './types';
2
2
  export declare const REJECT_PROMISE_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { ErrorCode } from '../types';
1
+ import { type ErrorCode } from '../types';
2
2
  /**
3
3
  * @description Создает уникальный код ошибки
4
4
  */
@@ -1,6 +1,6 @@
1
- import { ValidationErrorMap } from './ErrorMap';
2
- import { ValidationSimpleError } from './SimpleError';
3
- import { ValidationArrayError } from './ArrayError';
1
+ import { type ValidationErrorMap } from './ErrorMap';
2
+ import { type ValidationSimpleError } from './SimpleError';
3
+ import { type ValidationArrayError } from './ArrayError';
4
4
  /**
5
5
  * @description Уникальный код ошибки валидации
6
6
  */
@@ -1,5 +1,5 @@
1
- import { ValidationResult } from '../../types';
2
- import { ValidationContext } from '../../context';
1
+ import { type ValidationResult } from '../../types';
2
+ import { type ValidationContext } from '../../context';
3
3
  export type GuardDefOptions<AddDefOptions extends Record<string, unknown>> = Partial<AddDefOptions> & {
4
4
  /**
5
5
  * @description Переопределяет дефолтное сообщения ошибки для required
@@ -1,6 +1,6 @@
1
- import { AsyncValidationRule, ValidationRule } from '../types';
2
- import { ValidationResult } from '../../types';
3
- import { ValidationContext } from '../../context';
1
+ import { type AsyncValidationRule, type ValidationRule } from '../types';
2
+ import { type ValidationResult } from '../../types';
3
+ import { type ValidationContext } from '../../context';
4
4
  /**
5
5
  * Позволяет рекурсивно вызывать асинхронные правила. Rule может возвращать другой rule
6
6
  * Если один из rule выбросит exception, то функция его обработает и вернет дефолтную ошибку
@@ -1,6 +1,6 @@
1
- import { ValidationRule } from '../types';
2
- import { ValidationResult } from '../../types';
3
- import { ValidationContext } from '../../context';
1
+ import { type ValidationRule } from '../types';
2
+ import { type ValidationResult } from '../../types';
3
+ import { type ValidationContext } from '../../context';
4
4
  /**
5
5
  * Позволяет рекурсивно вызывать правила. Rule может возвращать другой rule
6
6
  */
@@ -1,6 +1,6 @@
1
- import { ValidationResult, ValidationTypes } from '../../types';
2
- import { ValidationContext } from '../../context';
3
- import { IndependentValidationRule } from '../types';
1
+ import { type ValidationResult, type ValidationTypes } from '../../types';
2
+ import { type ValidationContext } from '../../context';
3
+ import { type IndependentValidationRule } from '../types';
4
4
  /**
5
5
  * @description Единые параметры для всех правил
6
6
  */
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../../errors';
1
+ import { type ErrorInfo } from '../../errors';
2
2
  export declare const REQUIRED_ERROR_INFO: ErrorInfo;
@@ -1,5 +1,5 @@
1
- import { ValidationContext } from '../context';
2
- import { ValidationResult } from '../types';
1
+ import { type ValidationContext } from '../context';
2
+ import { type ValidationResult } from '../types';
3
3
  /**
4
4
  * @description Самостоятельное правило для валидации. Может использоваться вне guard'ов
5
5
  */
package/core/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationError } from './errors';
1
+ import { type ValidationError } from './errors';
2
2
  /**
3
3
  * @description Результат работы валидации
4
4
  */
@@ -1,3 +1,3 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const DATE_TYPE_ERROR_INFO: ErrorInfo;
3
3
  export declare const INVALID_DATE_ERROR_INFO: ErrorInfo;
package/date/date.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationRule } from '../core';
1
+ import { type ValidationRule } from '../core';
2
2
  type AdditionalDefOptions = {
3
3
  invalidDateErrorMessage?: string;
4
4
  };
@@ -1,4 +1,4 @@
1
- import { Guard } from '../core';
1
+ import { type Guard } from '../core';
2
2
  /**
3
3
  * @description Делает partial все object в схеме, независимо от уровня вложенности правил
4
4
  * @param guard - любой guard
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const EMAIL_REGEXP: RegExp;
3
3
  export declare const EMAIL_MAX_LENGTH = 256;
4
4
  export declare const INVALID_EMAIL_ERROR_INFO: ErrorInfo;
@@ -1,3 +1,3 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const GUID_REGEXP: RegExp;
3
3
  export declare const INVALID_GUID_ERROR_INFO: ErrorInfo;
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const INN_FL_ERROR_INFO: ErrorInfo;
package/innFL/innFL.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type InnFLParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const INN_IP_ERROR_INFO: ErrorInfo;
package/innIP/innIP.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type InnIPParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const INN_12_SYMBOLS_ERROR_INFO: ErrorInfo;
3
3
  export declare const INN_12_SYMBOLS_LENGTH = 12;
4
4
  export declare const FIRST_INN_12_SYMBOLS_DECODING: number[];
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type InnTwelveSymbolsParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const INN_UL_ERROR_INFO: ErrorInfo;
3
3
  export declare const INN_UL_LENGTH = 10;
4
4
  export declare const INN_UL_DECODING: number[];
package/innUL/innUL.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type InnULParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const INTEGER_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const INVALID_KPP_ERROR_INFO: ErrorInfo;
3
3
  export declare const KPP_ZEROS_ONLY_ERROR_INFO: ErrorInfo;
4
4
  export declare const KPP_DOUBLE_ZERO_START_ERROR_INFO: ErrorInfo;
package/kpp/kpp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type KPPParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,2 +1,2 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const STRING_LENGTH_ERROR_CODE: ErrorCode;
@@ -1,4 +1,4 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const STRING_MAX_ERROR_CODE: ErrorCode;
3
3
  export declare const NUMBER_MAX_ERROR_CODE: ErrorCode;
4
4
  export declare const DATE_MAX_ERROR_CODE: ErrorCode;
package/max/max.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationContext, createRule } from '../core';
1
+ import { type ValidationContext, createRule } from '../core';
2
2
  type BaseMaxValidationTypes = number | string | Array<unknown>;
3
3
  type CommonThreshold = number | Date;
4
4
  type MaxParams<ValidationType> = {
@@ -1,4 +1,4 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const STRING_MIN_ERROR_CODE: ErrorCode;
3
3
  export declare const NUMBER_MIN_ERROR_CODE: ErrorCode;
4
4
  export declare const DATE_MIN_ERROR_CODE: ErrorCode;
package/min/min.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationContext, createRule } from '../core';
1
+ import { type ValidationContext, createRule } from '../core';
2
2
  type BaseMinValidationTypes = number | string | Array<unknown>;
3
3
  type CommonThreshold = number | Date;
4
4
  type MinParams<ValidationType> = {
@@ -1,4 +1,4 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const BIRTH_DATE_MAX_ERROR_CODE: ErrorCode;
3
3
  export declare const BIRTH_DATE_MIN_ERROR_CODE: ErrorCode;
4
4
  export declare const BIRTH_DATE_MIN: Date;
@@ -1,3 +1,3 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const MOBILE_PHONE_ERROR_INFO: ErrorInfo;
3
3
  export declare const MOBILE_PHONE_REGEX: RegExp;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type MobilePhoneParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const NUMBER_TYPE_ERROR_INFO: ErrorInfo;
3
3
  export declare const NAN_NUMBER_ERROR_INFO: ErrorInfo;
4
4
  export declare const INFINITY_NUMBER_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { ValidationRule } from '../core';
1
+ import { type ValidationRule } from '../core';
2
2
  type AdditionalDefOptions = {
3
3
  nanErrorMessage?: string;
4
4
  infinityErrorMessage?: string;
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const OBJECT_TYPE_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { ErrorMap } from '../../core';
1
+ import { type ErrorMap } from '../../core';
2
2
  /**
3
3
  * @description Проверяет есть ли errorMap ошибки
4
4
  */
@@ -1,4 +1,4 @@
1
- import { Guard, ValidationContext, ValidationRule } from '../core';
1
+ import { type Guard, type ValidationContext, type ValidationRule } from '../core';
2
2
  /**
3
3
  * @description Специальный итерфейс Guard для object. В данном интерфейсе ctx required
4
4
  * Переопределение необходимо для того, чтобы ts показывал, что ctx required в кастомных правилах
@@ -1,4 +1,4 @@
1
- import { AsyncGuard, AsyncValidationRule, Guard, ValidationContext, ValidationRule } from '../../core';
1
+ import { type AsyncGuard, type AsyncValidationRule, type Guard, type ValidationContext, type ValidationRule } from '../../core';
2
2
  /**
3
3
  * @description Специальный итерфейс Guard для object. В данном интерфейсе ctx required
4
4
  * Переопределение необходимо для того, чтобы ts показывал, что ctx required в кастомных правилах
@@ -1,3 +1,3 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const OGRN_IP_ERROR_INFO: ErrorInfo;
3
3
  export declare const OGRN_IP_LENGTH = 15;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type OgrnIPParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,3 +1,3 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const OGRN_UL_ERROR_INFO: ErrorInfo;
3
3
  export declare const OGRN_UL_LENGTH = 13;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type OgrnULParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,2 +1,2 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const ONLY_NUMBER_ERROR_CODE: ErrorCode;
@@ -1,4 +1,4 @@
1
- import { IndependentValidationRule, ValidationRule } from '../core';
1
+ import { type IndependentValidationRule, type ValidationRule } from '../core';
2
2
  /**
3
3
  * @description Выключает проверку на required в guard
4
4
  * @example object({ name: optional(string(min(22))) })
@@ -1,4 +1,4 @@
1
- import { AsyncIndependentValidationRule, AsyncValidationRule, ValidationRule } from '../../core';
1
+ import { type AsyncIndependentValidationRule, type AsyncValidationRule, type ValidationRule } from '../../core';
2
2
  /**
3
3
  * @description Выключает проверку на required в guard. Предназначен для асинхронных правил.
4
4
  * @example object({ name: optionalAsync(stringAsync(min(22))) })
package/or/or.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationResult, ValidationRule } from '../core';
1
+ import { type ValidationResult, type ValidationRule } from '../core';
2
2
  /**
3
3
  * @description Выполняет переданные правила аналогично оператору ||. Если одно из правил не завершилось ошибкой, то or вернет undefined
4
4
  * Если все переданные правила завершились с ошибкой, то вернется ошибка из последнего правила
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/validations",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
4
  "browser": "./index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
@@ -1,4 +1,4 @@
1
- import { object } from '../object';
1
+ import { type object } from '../object';
2
2
  /**
3
3
  * @description Выключает проверку на required для всех полей объекта
4
4
  * @param objectGuard
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const PASSPORT_CODE_ERROR_INFO: ErrorInfo;
3
3
  export declare const PASSPORT_CODE_LENGTH_ERROR_INFO: ErrorInfo;
4
4
  export declare const PASSPORT_CODE_ONLY_DIGITS_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type PassportCodeParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,4 +1,4 @@
1
- import { createRule, isNoDoubleZeroStart } from '../core';
1
+ import { createRule, isNoDoubleZeroStart, } from '../core';
2
2
  import { onlyNumber } from '../onlyNumber';
3
3
  import { PASSPORT_CODE_ERROR_INFO, PASSPORT_CODE_LENGTH_ERROR_INFO, PASSPORT_CODE_ONLY_DIGITS_ERROR_INFO, } from './constants';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const PASSPORT_NUMBER_ERROR_INFO: ErrorInfo;
3
3
  export declare const PASSPORT_NUMBER_LENGTH_ERROR_INFO: ErrorInfo;
4
4
  export declare const PASSPORT_NUMBER_ONLY_DIGITS_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type PassportNumberParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const PASSPORT_SERIES_ERROR_INFO: ErrorInfo;
3
3
  export declare const PASSPORT_SERIES_ERROR_LENGTH_INFO: ErrorInfo;
4
4
  export declare const PASSPORT_SERIES_ONLY_DIGITS_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type PassportSeriesParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,4 +1,4 @@
1
- import { createRule, isNoDoubleZeroStart } from '../core';
1
+ import { createRule, isNoDoubleZeroStart, } from '../core';
2
2
  import { onlyNumber } from '../onlyNumber';
3
3
  import { PASSPORT_SERIES_ERROR_INFO, PASSPORT_SERIES_ERROR_LENGTH_INFO, PASSPORT_SERIES_ONLY_DIGITS_ERROR_INFO, } from './constants';
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { ErrorCode } from '../core';
1
+ import { type ErrorCode } from '../core';
2
2
  export declare const PATTERN_ERROR_CODE: ErrorCode;
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const PERSON_NAME_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type PersonNameParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const PERSON_PATRONYMIC_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type PersonPatronymicParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const PERSON_SURNAME_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type PersonSurnameParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const POSITIVE_NUMBER_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const SNILS_ERROR_INFO: ErrorInfo;
3
3
  export declare const RESTRICTED_VALUES: string[];
4
4
  export declare const DEFAULT_CHECKED_SUM: number[];
package/snils/snils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommonRuleParams } from '../core';
1
+ import { type CommonRuleParams } from '../core';
2
2
  type SnilsParams = CommonRuleParams<string> & {
3
3
  /**
4
4
  * @description Замена стандартного сообщения ошибки.
@@ -1,2 +1,2 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const STRING_TYPE_ERROR_INFO: ErrorInfo;
@@ -1,2 +1,2 @@
1
- import { ValidationRule } from '../core';
1
+ import { type ValidationRule } from '../core';
2
2
  export declare const string: <TLastSchemaValues extends Record<string, unknown>>(...rules: ValidationRule<string, TLastSchemaValues>[]) => import("../core").Guard<TLastSchemaValues, {}>;
@@ -1,4 +1,4 @@
1
- import { AsyncValidationRule, ValidationRule } from '../../core';
1
+ import { type AsyncValidationRule, type ValidationRule } from '../../core';
2
2
  /**
3
3
  * Позволяет использовать для валидации асинхронные правила
4
4
  * @example stringAsync(async () => undefined)
@@ -1,4 +1,4 @@
1
- import { ErrorInfo } from '../core';
1
+ import { type ErrorInfo } from '../core';
2
2
  export declare const TEXT_FIELD_REGEXP: RegExp;
3
3
  export declare const TEXT_FIELD_MAX_LENGTH = 256;
4
4
  export declare const INVALID_TEXT_FIELD_ERROR_INFO: ErrorInfo;
@@ -1,4 +1,4 @@
1
- import { ValidationResult, ValidationSimpleError } from '../core';
1
+ import { type ValidationResult, type ValidationSimpleError } from '../core';
2
2
  type PlainArrayResult<TPlainSimpleError> = Array<TPlainSimpleError | TPlainSimpleError[] | PlainErrorMap<TPlainSimpleError> | PlainArrayResult<TPlainSimpleError> | undefined>;
3
3
  type PlainErrorMap<TPlainSimpleError> = {
4
4
  [key: string]: TPlainSimpleError | PlainArrayResult<TPlainSimpleError> | PlainErrorMap<TPlainSimpleError>;
@@ -1,5 +1,5 @@
1
- import { ValidationResult } from '../core';
2
- import { PlainValidationResult } from '../toPlainError';
1
+ import { type ValidationResult } from '../core';
2
+ import { type PlainValidationResult } from '../toPlainError';
3
3
  /**
4
4
  * @description Преобразует ошибку валидации в формат для вывода (например, в консоль)
5
5
  * @param validationResult
@@ -1,4 +1,4 @@
1
- import { ValidationRule } from '../core';
1
+ import { type ValidationRule } from '../core';
2
2
  type Transformer<TValue, TResult> = (value: TValue) => TResult;
3
3
  /**
4
4
  * @description Трансформирует value в новый тип для валидации
@@ -1,4 +1,4 @@
1
- import { compose, createRule } from '../core';
1
+ import { compose, createRule, } from '../core';
2
2
  /**
3
3
  * @description Трансформирует value в новый тип для валидации
4
4
  * @param transformer - функция трансформации value в новый тип
package/when/when.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationContext, ValidationRule } from '../core';
1
+ import { type ValidationContext, type ValidationRule } from '../core';
2
2
  type Params<TLastSchemaValues extends Record<string, unknown>> = {
3
3
  /**
4
4
  * @description Условие для выбора ветки