@warlock.js/seal 3.0.14 → 3.0.15

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/cjs/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var anyValidator=require('./validators/any-validator.js'),arrayValidator=require('./validators/array-validator.js'),baseValidator=require('./validators/base-validator.js'),booleanValidator=require('./validators/boolean-validator.js'),dateValidator=require('./validators/date-validator.js'),floatValidator=require('./validators/float-validator.js'),intValidator=require('./validators/int-validator.js'),numberValidator=require('./validators/number-validator.js'),objectValidator=require('./validators/object-validator.js'),scalarValidator=require('./validators/scalar-validator.js'),stringValidator=require('./validators/string-validator.js'),dateTypes=require('./types/date-types.js'),dateHelpers=require('./helpers/date-helpers.js'),getFieldValue=require('./helpers/get-field-value.js'),pathHelpers=require('./helpers/path-helpers.js'),validationHelpers=require('./helpers/validation-helpers.js'),arrayMutators=require('./mutators/array-mutators.js'),dateMutators=require('./mutators/date-mutators.js'),numberMutators=require('./mutators/number-mutators.js'),objectMutators=require('./mutators/object-mutators.js'),stringMutators=require('./mutators/string-mutators.js'),equal=require('./rules/core/equal.js'),forbidden=require('./rules/core/forbidden.js'),required=require('./rules/core/required.js'),when=require('./rules/core/when.js'),alpha=require('./rules/string/alpha.js'),creditCard=require('./rules/string/credit-card.js'),email=require('./rules/string/email.js'),ip=require('./rules/string/ip.js'),matches=require('./rules/string/matches.js'),pattern=require('./rules/string/pattern.js'),stringComparison=require('./rules/string/string-comparison.js'),strongPasswordRule=require('./rules/string/strong-password-rule.js'),url=require('./rules/string/url.js'),withoutWhitespace=require('./rules/string/without-whitespace.js'),numberRules=require('./rules/number/number-rules.js'),lengthRules=require('./rules/length/length-rules.js'),arrayRules=require('./rules/array/array-rules.js'),date=require('./rules/date/date.js'),dateComparisonRules=require('./rules/date/date-comparison-rules.js'),dateDayRules=require('./rules/date/date-day-rules.js'),dateFieldComparisonRules=require('./rules/date/date-field-comparison-rules.js'),datePeriodRules=require('./rules/date/date-period-rules.js'),dateRelativeRules=require('./rules/date/date-relative-rules.js'),dateSpecialRules=require('./rules/date/date-special-rules.js'),dimensions=require('./rules/file/dimensions.js'),fileSize=require('./rules/file/file-size.js'),colorRules=require('./rules/color/color-rules.js'),requiredIfRules=require('./rules/conditional/required-if-rules.js'),requiredUnlessRules=require('./rules/conditional/required-unless-rules.js'),requiredWithRules=require('./rules/conditional/required-with-rules.js'),requiredWithoutRules=require('./rules/conditional/required-without-rules.js'),presentIfRules=require('./rules/conditional/present-if-rules.js'),presentUnlessRules=require('./rules/conditional/present-unless-rules.js'),presentWithRules=require('./rules/conditional/present-with-rules.js'),presentWithoutRules=require('./rules/conditional/present-without-rules.js'),_enum=require('./rules/common/enum.js'),equalsFieldRules=require('./rules/common/equals-field-rules.js'),typeRules=require('./rules/common/type-rules.js'),unknownKey=require('./rules/common/unknown-key.js'),validate=require('./factory/validate.js'),validators=require('./factory/validators.js'),pluginSystem=require('./plugins/plugin-system.js'),config=require('./config.js');exports.AnyValidator=anyValidator.AnyValidator;exports.ArrayValidator=arrayValidator.ArrayValidator;exports.BaseValidator=baseValidator.BaseValidator;exports.BooleanValidator=booleanValidator.BooleanValidator;exports.DateValidator=dateValidator.DateValidator;exports.FloatValidator=floatValidator.FloatValidator;exports.IntValidator=intValidator.IntValidator;exports.NumberValidator=numberValidator.NumberValidator;exports.ObjectValidator=objectValidator.ObjectValidator;exports.ScalarValidator=scalarValidator.ScalarValidator;exports.StringValidator=stringValidator.StringValidator;exports.WEEK_DAYS=dateTypes.WEEK_DAYS;exports.isDateValue=dateHelpers.isDateValue;exports.getFieldValue=getFieldValue.getFieldValue;exports.setKeyPath=pathHelpers.setKeyPath;exports.VALID_RULE=validationHelpers.VALID_RULE;exports.invalidRule=validationHelpers.invalidRule;exports.flipArrayMutator=arrayMutators.flipArrayMutator;exports.removeEmptyArrayElementsMutator=arrayMutators.removeEmptyArrayElementsMutator;exports.reverseArrayMutator=arrayMutators.reverseArrayMutator;exports.sortArrayMutator=arrayMutators.sortArrayMutator;exports.uniqueArrayMutator=arrayMutators.uniqueArrayMutator;exports.addDaysMutator=dateMutators.addDaysMutator;exports.addHoursMutator=dateMutators.addHoursMutator;exports.addMonthsMutator=dateMutators.addMonthsMutator;exports.addYearsMutator=dateMutators.addYearsMutator;exports.dateMutator=dateMutators.dateMutator;exports.toDateOnlyMutator=dateMutators.toDateOnlyMutator;exports.toEndOfDayMutator=dateMutators.toEndOfDayMutator;exports.toEndOfMonthMutator=dateMutators.toEndOfMonthMutator;exports.toEndOfYearMutator=dateMutators.toEndOfYearMutator;exports.toFormatMutator=dateMutators.toFormatMutator;exports.toISOStringMutator=dateMutators.toISOStringMutator;exports.toStartOfDayMutator=dateMutators.toStartOfDayMutator;exports.toStartOfMonthMutator=dateMutators.toStartOfMonthMutator;exports.toStartOfYearMutator=dateMutators.toStartOfYearMutator;exports.toTimeOnlyMutator=dateMutators.toTimeOnlyMutator;exports.toTimestampMutator=dateMutators.toTimestampMutator;exports.toUTCMutator=dateMutators.toUTCMutator;exports.booleanMutator=numberMutators.booleanMutator;exports.numberMutator=numberMutators.numberMutator;exports.roundNumberMutator=numberMutators.roundNumberMutator;exports.jsonMutator=objectMutators.jsonMutator;exports.objectTrimMutator=objectMutators.objectTrimMutator;exports.stripUnknownMutator=objectMutators.stripUnknownMutator;exports.alphaOnlyMutator=stringMutators.alphaOnlyMutator;exports.alphanumericOnlyMutator=stringMutators.alphanumericOnlyMutator;exports.appendMutator=stringMutators.appendMutator;exports.base64DecodeMutator=stringMutators.base64DecodeMutator;exports.base64EncodeMutator=stringMutators.base64EncodeMutator;exports.camelCaseMutator=stringMutators.camelCaseMutator;exports.capitalizeMutator=stringMutators.capitalizeMutator;exports.htmlEscapeMutator=stringMutators.htmlEscapeMutator;exports.kebabCaseMutator=stringMutators.kebabCaseMutator;exports.lowercaseMutator=stringMutators.lowercaseMutator;exports.ltrimMutator=stringMutators.ltrimMutator;exports.maskMutator=stringMutators.maskMutator;exports.padEndMutator=stringMutators.padEndMutator;exports.padStartMutator=stringMutators.padStartMutator;exports.pascalCaseMutator=stringMutators.pascalCaseMutator;exports.prependMutator=stringMutators.prependMutator;exports.removeNumbersMutator=stringMutators.removeNumbersMutator;exports.removeSpecialCharactersMutator=stringMutators.removeSpecialCharactersMutator;exports.repeatMutator=stringMutators.repeatMutator;exports.replaceAllMutator=stringMutators.replaceAllMutator;exports.replaceMutator=stringMutators.replaceMutator;exports.reverseMutator=stringMutators.reverseMutator;exports.rtrimMutator=stringMutators.rtrimMutator;exports.safeHtmlMutator=stringMutators.safeHtmlMutator;exports.slugMutator=stringMutators.slugMutator;exports.snakeCaseMutator=stringMutators.snakeCaseMutator;exports.stringifyMutator=stringMutators.stringifyMutator;exports.titleCaseMutator=stringMutators.titleCaseMutator;exports.trimMultipleWhitespaceMutator=stringMutators.trimMultipleWhitespaceMutator;exports.trimMutator=stringMutators.trimMutator;exports.truncateMutator=stringMutators.truncateMutator;exports.unescapeHtmlMutator=stringMutators.unescapeHtmlMutator;exports.uppercaseMutator=stringMutators.uppercaseMutator;exports.urlDecodeMutator=stringMutators.urlDecodeMutator;exports.urlEncodeMutator=stringMutators.urlEncodeMutator;exports.equalRule=equal.equalRule;exports.forbiddenRule=forbidden.forbiddenRule;exports.presentRule=required.presentRule;exports.requiredRule=required.requiredRule;exports.whenRule=when.whenRule;exports.alphaNumericRule=alpha.alphaNumericRule;exports.alphaRule=alpha.alphaRule;exports.isNumericRule=alpha.isNumericRule;exports.isCreditCardRule=creditCard.isCreditCardRule;exports.emailRule=email.emailRule;exports.ip4Rule=ip.ip4Rule;exports.ip6Rule=ip.ip6Rule;exports.ipRule=ip.ipRule;exports.matchesRule=matches.matchesRule;exports.patternRule=pattern.patternRule;exports.containsRule=stringComparison.containsRule;exports.endsWithRule=stringComparison.endsWithRule;exports.notContainsRule=stringComparison.notContainsRule;exports.startsWithRule=stringComparison.startsWithRule;exports.strongPasswordRule=strongPasswordRule.strongPasswordRule;exports.urlRule=url.urlRule;exports.withoutWhitespaceRule=withoutWhitespace.withoutWhitespaceRule;exports.betweenNumbersRule=numberRules.betweenNumbersRule;exports.evenRule=numberRules.evenRule;exports.maxRule=numberRules.maxRule;exports.minRule=numberRules.minRule;exports.moduloRule=numberRules.moduloRule;exports.negativeRule=numberRules.negativeRule;exports.oddRule=numberRules.oddRule;exports.positiveRule=numberRules.positiveRule;exports.betweenLengthRule=lengthRules.betweenLengthRule;exports.lengthRule=lengthRules.lengthRule;exports.maxLengthRule=lengthRules.maxLengthRule;exports.maxWordsRule=lengthRules.maxWordsRule;exports.minLengthRule=lengthRules.minLengthRule;exports.minWordsRule=lengthRules.minWordsRule;exports.wordsRule=lengthRules.wordsRule;exports.sortedArrayRule=arrayRules.sortedArrayRule;exports.uniqueArrayRule=arrayRules.uniqueArrayRule;exports.ageRule=date.ageRule;exports.beforeHourRule=date.beforeHourRule;exports.beforeMinuteRule=date.beforeMinuteRule;exports.beforeTodayRule=date.beforeTodayRule;exports.betweenHoursRule=date.betweenHoursRule;exports.betweenMinutesRule=date.betweenMinutesRule;exports.dateRule=date.dateRule;exports.fromHourRule=date.fromHourRule;exports.fromMinuteRule=date.fromMinuteRule;exports.fromTodayRule=date.fromTodayRule;exports.maxAgeRule=date.maxAgeRule;exports.maxDateRule=date.maxDateRule;exports.minAgeRule=date.minAgeRule;exports.minDateRule=date.minDateRule;exports.weekDayRule=date.weekDayRule;exports.afterTodayRule=dateComparisonRules.afterTodayRule;exports.betweenDatesRule=dateComparisonRules.betweenDatesRule;exports.futureRule=dateComparisonRules.futureRule;exports.pastRule=dateComparisonRules.pastRule;exports.todayRule=dateComparisonRules.todayRule;exports.businessDayRule=dateDayRules.businessDayRule;exports.weekdayRule=dateDayRules.weekdayRule;exports.weekdaysRule=dateDayRules.weekdaysRule;exports.weekendRule=dateDayRules.weekendRule;exports.afterFieldRule=dateFieldComparisonRules.afterFieldRule;exports.beforeFieldRule=dateFieldComparisonRules.beforeFieldRule;exports.sameAsFieldDateRule=dateFieldComparisonRules.sameAsFieldDateRule;exports.betweenDaysRule=datePeriodRules.betweenDaysRule;exports.betweenMonthsRule=datePeriodRules.betweenMonthsRule;exports.betweenTimesRule=datePeriodRules.betweenTimesRule;exports.betweenYearsRule=datePeriodRules.betweenYearsRule;exports.maxDayRule=datePeriodRules.maxDayRule;exports.maxMonthRule=datePeriodRules.maxMonthRule;exports.maxYearRule=datePeriodRules.maxYearRule;exports.minDayRule=datePeriodRules.minDayRule;exports.minMonthRule=datePeriodRules.minMonthRule;exports.minYearRule=datePeriodRules.minYearRule;exports.monthRule=datePeriodRules.monthRule;exports.quarterRule=datePeriodRules.quarterRule;exports.yearRule=datePeriodRules.yearRule;exports.withinDaysRule=dateRelativeRules.withinDaysRule;exports.withinFutureDaysRule=dateRelativeRules.withinFutureDaysRule;exports.withinPastDaysRule=dateRelativeRules.withinPastDaysRule;exports.betweenAgeRule=dateSpecialRules.betweenAgeRule;exports.birthdayRule=dateSpecialRules.birthdayRule;exports.leapYearRule=dateSpecialRules.leapYearRule;exports.maxHeightRule=dimensions.maxHeightRule;exports.maxWidthRule=dimensions.maxWidthRule;exports.minHeightRule=dimensions.minHeightRule;exports.minWidthRule=dimensions.minWidthRule;exports.maxFileSizeRule=fileSize.maxFileSizeRule;exports.minFileSizeRule=fileSize.minFileSizeRule;exports.colorRule=colorRules.colorRule;exports.darkColorRule=colorRules.darkColorRule;exports.hexColorRule=colorRules.hexColorRule;exports.hslColorRule=colorRules.hslColorRule;exports.lightColorRule=colorRules.lightColorRule;exports.rgbColorRule=colorRules.rgbColorRule;exports.rgbaColorRule=colorRules.rgbaColorRule;exports.requiredIfEmptyRule=requiredIfRules.requiredIfEmptyRule;exports.requiredIfInRule=requiredIfRules.requiredIfInRule;exports.requiredIfNotEmptyRule=requiredIfRules.requiredIfNotEmptyRule;exports.requiredIfNotInRule=requiredIfRules.requiredIfNotInRule;exports.requiredIfRule=requiredIfRules.requiredIfRule;exports.requiredUnlessRule=requiredUnlessRules.requiredUnlessRule;exports.requiredWithAllRule=requiredWithRules.requiredWithAllRule;exports.requiredWithAnyRule=requiredWithRules.requiredWithAnyRule;exports.requiredWithRule=requiredWithRules.requiredWithRule;exports.requiredWithoutAllRule=requiredWithoutRules.requiredWithoutAllRule;exports.requiredWithoutAnyRule=requiredWithoutRules.requiredWithoutAnyRule;exports.requiredWithoutRule=requiredWithoutRules.requiredWithoutRule;exports.presentIfEmptyRule=presentIfRules.presentIfEmptyRule;exports.presentIfInRule=presentIfRules.presentIfInRule;exports.presentIfNotEmptyRule=presentIfRules.presentIfNotEmptyRule;exports.presentIfNotInRule=presentIfRules.presentIfNotInRule;exports.presentIfRule=presentIfRules.presentIfRule;exports.presentUnlessRule=presentUnlessRules.presentUnlessRule;exports.presentWithAllRule=presentWithRules.presentWithAllRule;exports.presentWithAnyRule=presentWithRules.presentWithAnyRule;exports.presentWithRule=presentWithRules.presentWithRule;exports.presentWithoutAllRule=presentWithoutRules.presentWithoutAllRule;exports.presentWithoutAnyRule=presentWithoutRules.presentWithoutAnyRule;exports.presentWithoutRule=presentWithoutRules.presentWithoutRule;exports.allowedValuesRule=_enum.allowedValuesRule;exports.enumRule=_enum.enumRule;exports.inRule=_enum.inRule;exports.notAllowedValuesRule=_enum.notAllowedValuesRule;exports.equalsFieldRule=equalsFieldRules.equalsFieldRule;exports.notEqualsFieldRule=equalsFieldRules.notEqualsFieldRule;exports.arrayRule=typeRules.arrayRule;exports.booleanRule=typeRules.booleanRule;exports.floatRule=typeRules.floatRule;exports.intRule=typeRules.intRule;exports.numberRule=typeRules.numberRule;exports.objectRule=typeRules.objectRule;exports.scalarRule=typeRules.scalarRule;exports.stringRule=typeRules.stringRule;exports.unknownKeyRule=unknownKey.unknownKeyRule;exports.validate=validate.validate;exports.v=validators.v;exports.getInstalledPlugins=pluginSystem.getInstalledPlugins;exports.hasPlugin=pluginSystem.hasPlugin;exports.registerPlugin=pluginSystem.registerPlugin;exports.unregisterPlugin=pluginSystem.unregisterPlugin;exports.configureSeal=config.configureSeal;exports.getSealConfig=config.getSealConfig;exports.resetSealConfig=config.resetSealConfig;//# sourceMappingURL=index.js.map
1
+ 'use strict';var anyValidator=require('./validators/any-validator.js'),arrayValidator=require('./validators/array-validator.js'),baseValidator=require('./validators/base-validator.js'),booleanValidator=require('./validators/boolean-validator.js'),dateValidator=require('./validators/date-validator.js'),floatValidator=require('./validators/float-validator.js'),intValidator=require('./validators/int-validator.js'),numberValidator=require('./validators/number-validator.js'),objectValidator=require('./validators/object-validator.js'),scalarValidator=require('./validators/scalar-validator.js'),stringValidator=require('./validators/string-validator.js'),dateTypes=require('./types/date-types.js'),dateHelpers=require('./helpers/date-helpers.js'),getFieldValue=require('./helpers/get-field-value.js'),pathHelpers=require('./helpers/path-helpers.js'),validationHelpers=require('./helpers/validation-helpers.js'),arrayMutators=require('./mutators/array-mutators.js'),dateMutators=require('./mutators/date-mutators.js'),numberMutators=require('./mutators/number-mutators.js'),objectMutators=require('./mutators/object-mutators.js'),stringMutators=require('./mutators/string-mutators.js'),equal=require('./rules/core/equal.js'),forbidden=require('./rules/core/forbidden.js'),required=require('./rules/core/required.js'),when=require('./rules/core/when.js'),alpha=require('./rules/string/alpha.js'),creditCard=require('./rules/string/credit-card.js'),email=require('./rules/string/email.js'),ip=require('./rules/string/ip.js'),matches=require('./rules/string/matches.js'),pattern=require('./rules/string/pattern.js'),stringComparison=require('./rules/string/string-comparison.js'),strongPasswordRule=require('./rules/string/strong-password-rule.js'),url=require('./rules/string/url.js'),withoutWhitespace=require('./rules/string/without-whitespace.js'),numberRules=require('./rules/number/number-rules.js'),lengthRules=require('./rules/length/length-rules.js'),arrayRules=require('./rules/array/array-rules.js'),date=require('./rules/date/date.js'),dateComparisonRules=require('./rules/date/date-comparison-rules.js'),dateDayRules=require('./rules/date/date-day-rules.js'),dateFieldComparisonRules=require('./rules/date/date-field-comparison-rules.js'),datePeriodRules=require('./rules/date/date-period-rules.js'),dateRelativeRules=require('./rules/date/date-relative-rules.js'),dateSpecialRules=require('./rules/date/date-special-rules.js'),dimensions=require('./rules/file/dimensions.js'),fileSize=require('./rules/file/file-size.js'),colorRules=require('./rules/color/color-rules.js'),requiredIfRules=require('./rules/conditional/required-if-rules.js'),requiredUnlessRules=require('./rules/conditional/required-unless-rules.js'),requiredWithRules=require('./rules/conditional/required-with-rules.js'),requiredWithoutRules=require('./rules/conditional/required-without-rules.js'),presentIfRules=require('./rules/conditional/present-if-rules.js'),presentUnlessRules=require('./rules/conditional/present-unless-rules.js'),presentWithRules=require('./rules/conditional/present-with-rules.js'),presentWithoutRules=require('./rules/conditional/present-without-rules.js'),_enum=require('./rules/common/enum.js'),equalsFieldRules=require('./rules/common/equals-field-rules.js'),typeRules=require('./rules/common/type-rules.js'),unknownKey=require('./rules/common/unknown-key.js'),validate=require('./factory/validate.js'),validators=require('./factory/validators.js'),pluginSystem=require('./plugins/plugin-system.js'),config=require('./config.js');exports.AnyValidator=anyValidator.AnyValidator;exports.ArrayValidator=arrayValidator.ArrayValidator;exports.BaseValidator=baseValidator.BaseValidator;exports.BooleanValidator=booleanValidator.BooleanValidator;exports.DateValidator=dateValidator.DateValidator;exports.FloatValidator=floatValidator.FloatValidator;exports.IntValidator=intValidator.IntValidator;exports.NumberValidator=numberValidator.NumberValidator;exports.ObjectValidator=objectValidator.ObjectValidator;exports.ScalarValidator=scalarValidator.ScalarValidator;exports.StringValidator=stringValidator.StringValidator;exports.WEEK_DAYS=dateTypes.WEEK_DAYS;exports.isDateValue=dateHelpers.isDateValue;exports.getFieldValue=getFieldValue.getFieldValue;exports.setKeyPath=pathHelpers.setKeyPath;exports.VALID_RULE=validationHelpers.VALID_RULE;exports.invalidRule=validationHelpers.invalidRule;exports.flipArrayMutator=arrayMutators.flipArrayMutator;exports.removeEmptyArrayElementsMutator=arrayMutators.removeEmptyArrayElementsMutator;exports.reverseArrayMutator=arrayMutators.reverseArrayMutator;exports.sortArrayMutator=arrayMutators.sortArrayMutator;exports.uniqueArrayMutator=arrayMutators.uniqueArrayMutator;exports.addDaysMutator=dateMutators.addDaysMutator;exports.addHoursMutator=dateMutators.addHoursMutator;exports.addMonthsMutator=dateMutators.addMonthsMutator;exports.addYearsMutator=dateMutators.addYearsMutator;exports.dateMutator=dateMutators.dateMutator;exports.toDateOnlyMutator=dateMutators.toDateOnlyMutator;exports.toEndOfDayMutator=dateMutators.toEndOfDayMutator;exports.toEndOfMonthMutator=dateMutators.toEndOfMonthMutator;exports.toEndOfYearMutator=dateMutators.toEndOfYearMutator;exports.toFormatMutator=dateMutators.toFormatMutator;exports.toISOStringMutator=dateMutators.toISOStringMutator;exports.toStartOfDayMutator=dateMutators.toStartOfDayMutator;exports.toStartOfMonthMutator=dateMutators.toStartOfMonthMutator;exports.toStartOfYearMutator=dateMutators.toStartOfYearMutator;exports.toTimeOnlyMutator=dateMutators.toTimeOnlyMutator;exports.toTimestampMutator=dateMutators.toTimestampMutator;exports.toUTCMutator=dateMutators.toUTCMutator;exports.booleanMutator=numberMutators.booleanMutator;exports.numberMutator=numberMutators.numberMutator;exports.roundNumberMutator=numberMutators.roundNumberMutator;exports.jsonMutator=objectMutators.jsonMutator;exports.objectTrimMutator=objectMutators.objectTrimMutator;exports.stripUnknownMutator=objectMutators.stripUnknownMutator;exports.alphaOnlyMutator=stringMutators.alphaOnlyMutator;exports.alphanumericOnlyMutator=stringMutators.alphanumericOnlyMutator;exports.appendMutator=stringMutators.appendMutator;exports.base64DecodeMutator=stringMutators.base64DecodeMutator;exports.base64EncodeMutator=stringMutators.base64EncodeMutator;exports.camelCaseMutator=stringMutators.camelCaseMutator;exports.capitalizeMutator=stringMutators.capitalizeMutator;exports.htmlEscapeMutator=stringMutators.htmlEscapeMutator;exports.kebabCaseMutator=stringMutators.kebabCaseMutator;exports.lowercaseMutator=stringMutators.lowercaseMutator;exports.ltrimMutator=stringMutators.ltrimMutator;exports.maskMutator=stringMutators.maskMutator;exports.padEndMutator=stringMutators.padEndMutator;exports.padStartMutator=stringMutators.padStartMutator;exports.pascalCaseMutator=stringMutators.pascalCaseMutator;exports.prependMutator=stringMutators.prependMutator;exports.removeNumbersMutator=stringMutators.removeNumbersMutator;exports.removeSpecialCharactersMutator=stringMutators.removeSpecialCharactersMutator;exports.repeatMutator=stringMutators.repeatMutator;exports.replaceAllMutator=stringMutators.replaceAllMutator;exports.replaceMutator=stringMutators.replaceMutator;exports.reverseMutator=stringMutators.reverseMutator;exports.rtrimMutator=stringMutators.rtrimMutator;exports.safeHtmlMutator=stringMutators.safeHtmlMutator;exports.slugMutator=stringMutators.slugMutator;exports.snakeCaseMutator=stringMutators.snakeCaseMutator;exports.stringifyMutator=stringMutators.stringifyMutator;exports.titleCaseMutator=stringMutators.titleCaseMutator;exports.trimMultipleWhitespaceMutator=stringMutators.trimMultipleWhitespaceMutator;exports.trimMutator=stringMutators.trimMutator;exports.truncateMutator=stringMutators.truncateMutator;exports.unescapeHtmlMutator=stringMutators.unescapeHtmlMutator;exports.uppercaseMutator=stringMutators.uppercaseMutator;exports.urlDecodeMutator=stringMutators.urlDecodeMutator;exports.urlEncodeMutator=stringMutators.urlEncodeMutator;exports.equalRule=equal.equalRule;exports.forbiddenRule=forbidden.forbiddenRule;exports.presentRule=required.presentRule;exports.requiredRule=required.requiredRule;exports.whenRule=when.whenRule;exports.alphaNumericRule=alpha.alphaNumericRule;exports.alphaRule=alpha.alphaRule;exports.isNumericRule=alpha.isNumericRule;exports.isCreditCardRule=creditCard.isCreditCardRule;exports.emailRule=email.emailRule;exports.ip4Rule=ip.ip4Rule;exports.ip6Rule=ip.ip6Rule;exports.ipRule=ip.ipRule;exports.matchesRule=matches.matchesRule;exports.patternRule=pattern.patternRule;exports.containsRule=stringComparison.containsRule;exports.endsWithRule=stringComparison.endsWithRule;exports.notContainsRule=stringComparison.notContainsRule;exports.startsWithRule=stringComparison.startsWithRule;exports.strongPasswordRule=strongPasswordRule.strongPasswordRule;exports.urlRule=url.urlRule;exports.withoutWhitespaceRule=withoutWhitespace.withoutWhitespaceRule;exports.betweenNumbersRule=numberRules.betweenNumbersRule;exports.evenRule=numberRules.evenRule;exports.greaterThanRule=numberRules.greaterThanRule;exports.lessThanRule=numberRules.lessThanRule;exports.maxRule=numberRules.maxRule;exports.minRule=numberRules.minRule;exports.moduloRule=numberRules.moduloRule;exports.negativeRule=numberRules.negativeRule;exports.oddRule=numberRules.oddRule;exports.positiveRule=numberRules.positiveRule;exports.betweenLengthRule=lengthRules.betweenLengthRule;exports.lengthRule=lengthRules.lengthRule;exports.maxLengthRule=lengthRules.maxLengthRule;exports.maxWordsRule=lengthRules.maxWordsRule;exports.minLengthRule=lengthRules.minLengthRule;exports.minWordsRule=lengthRules.minWordsRule;exports.wordsRule=lengthRules.wordsRule;exports.sortedArrayRule=arrayRules.sortedArrayRule;exports.uniqueArrayRule=arrayRules.uniqueArrayRule;exports.ageRule=date.ageRule;exports.beforeHourRule=date.beforeHourRule;exports.beforeMinuteRule=date.beforeMinuteRule;exports.beforeTodayRule=date.beforeTodayRule;exports.betweenHoursRule=date.betweenHoursRule;exports.betweenMinutesRule=date.betweenMinutesRule;exports.dateRule=date.dateRule;exports.fromHourRule=date.fromHourRule;exports.fromMinuteRule=date.fromMinuteRule;exports.fromTodayRule=date.fromTodayRule;exports.maxAgeRule=date.maxAgeRule;exports.maxDateRule=date.maxDateRule;exports.minAgeRule=date.minAgeRule;exports.minDateRule=date.minDateRule;exports.weekDayRule=date.weekDayRule;exports.afterTodayRule=dateComparisonRules.afterTodayRule;exports.betweenDatesRule=dateComparisonRules.betweenDatesRule;exports.futureRule=dateComparisonRules.futureRule;exports.pastRule=dateComparisonRules.pastRule;exports.todayRule=dateComparisonRules.todayRule;exports.businessDayRule=dateDayRules.businessDayRule;exports.weekdayRule=dateDayRules.weekdayRule;exports.weekdaysRule=dateDayRules.weekdaysRule;exports.weekendRule=dateDayRules.weekendRule;exports.afterFieldRule=dateFieldComparisonRules.afterFieldRule;exports.beforeFieldRule=dateFieldComparisonRules.beforeFieldRule;exports.sameAsFieldDateRule=dateFieldComparisonRules.sameAsFieldDateRule;exports.betweenDaysRule=datePeriodRules.betweenDaysRule;exports.betweenMonthsRule=datePeriodRules.betweenMonthsRule;exports.betweenTimesRule=datePeriodRules.betweenTimesRule;exports.betweenYearsRule=datePeriodRules.betweenYearsRule;exports.maxDayRule=datePeriodRules.maxDayRule;exports.maxMonthRule=datePeriodRules.maxMonthRule;exports.maxYearRule=datePeriodRules.maxYearRule;exports.minDayRule=datePeriodRules.minDayRule;exports.minMonthRule=datePeriodRules.minMonthRule;exports.minYearRule=datePeriodRules.minYearRule;exports.monthRule=datePeriodRules.monthRule;exports.quarterRule=datePeriodRules.quarterRule;exports.yearRule=datePeriodRules.yearRule;exports.withinDaysRule=dateRelativeRules.withinDaysRule;exports.withinFutureDaysRule=dateRelativeRules.withinFutureDaysRule;exports.withinPastDaysRule=dateRelativeRules.withinPastDaysRule;exports.betweenAgeRule=dateSpecialRules.betweenAgeRule;exports.birthdayRule=dateSpecialRules.birthdayRule;exports.leapYearRule=dateSpecialRules.leapYearRule;exports.maxHeightRule=dimensions.maxHeightRule;exports.maxWidthRule=dimensions.maxWidthRule;exports.minHeightRule=dimensions.minHeightRule;exports.minWidthRule=dimensions.minWidthRule;exports.maxFileSizeRule=fileSize.maxFileSizeRule;exports.minFileSizeRule=fileSize.minFileSizeRule;exports.colorRule=colorRules.colorRule;exports.darkColorRule=colorRules.darkColorRule;exports.hexColorRule=colorRules.hexColorRule;exports.hslColorRule=colorRules.hslColorRule;exports.lightColorRule=colorRules.lightColorRule;exports.rgbColorRule=colorRules.rgbColorRule;exports.rgbaColorRule=colorRules.rgbaColorRule;exports.requiredIfEmptyRule=requiredIfRules.requiredIfEmptyRule;exports.requiredIfInRule=requiredIfRules.requiredIfInRule;exports.requiredIfNotEmptyRule=requiredIfRules.requiredIfNotEmptyRule;exports.requiredIfNotInRule=requiredIfRules.requiredIfNotInRule;exports.requiredIfRule=requiredIfRules.requiredIfRule;exports.requiredUnlessRule=requiredUnlessRules.requiredUnlessRule;exports.requiredWithAllRule=requiredWithRules.requiredWithAllRule;exports.requiredWithAnyRule=requiredWithRules.requiredWithAnyRule;exports.requiredWithRule=requiredWithRules.requiredWithRule;exports.requiredWithoutAllRule=requiredWithoutRules.requiredWithoutAllRule;exports.requiredWithoutAnyRule=requiredWithoutRules.requiredWithoutAnyRule;exports.requiredWithoutRule=requiredWithoutRules.requiredWithoutRule;exports.presentIfEmptyRule=presentIfRules.presentIfEmptyRule;exports.presentIfInRule=presentIfRules.presentIfInRule;exports.presentIfNotEmptyRule=presentIfRules.presentIfNotEmptyRule;exports.presentIfNotInRule=presentIfRules.presentIfNotInRule;exports.presentIfRule=presentIfRules.presentIfRule;exports.presentUnlessRule=presentUnlessRules.presentUnlessRule;exports.presentWithAllRule=presentWithRules.presentWithAllRule;exports.presentWithAnyRule=presentWithRules.presentWithAnyRule;exports.presentWithRule=presentWithRules.presentWithRule;exports.presentWithoutAllRule=presentWithoutRules.presentWithoutAllRule;exports.presentWithoutAnyRule=presentWithoutRules.presentWithoutAnyRule;exports.presentWithoutRule=presentWithoutRules.presentWithoutRule;exports.allowedValuesRule=_enum.allowedValuesRule;exports.enumRule=_enum.enumRule;exports.inRule=_enum.inRule;exports.notAllowedValuesRule=_enum.notAllowedValuesRule;exports.equalsFieldRule=equalsFieldRules.equalsFieldRule;exports.notEqualsFieldRule=equalsFieldRules.notEqualsFieldRule;exports.arrayRule=typeRules.arrayRule;exports.booleanRule=typeRules.booleanRule;exports.floatRule=typeRules.floatRule;exports.intRule=typeRules.intRule;exports.numberRule=typeRules.numberRule;exports.objectRule=typeRules.objectRule;exports.scalarRule=typeRules.scalarRule;exports.stringRule=typeRules.stringRule;exports.unknownKeyRule=unknownKey.unknownKeyRule;exports.validate=validate.validate;exports.v=validators.v;exports.getInstalledPlugins=pluginSystem.getInstalledPlugins;exports.hasPlugin=pluginSystem.hasPlugin;exports.registerPlugin=pluginSystem.registerPlugin;exports.unregisterPlugin=pluginSystem.unregisterPlugin;exports.configureSeal=config.configureSeal;exports.getSealConfig=config.getSealConfig;exports.resetSealConfig=config.resetSealConfig;//# sourceMappingURL=index.js.map
@@ -1,15 +1,35 @@
1
1
  import type { SchemaRule } from "../../types";
2
2
  /**
3
3
  * Min rule - value must be equal or greater than minimum
4
+ * Supports field names with sibling scope
4
5
  */
5
6
  export declare const minRule: SchemaRule<{
6
- min: number;
7
+ min: number | string;
8
+ scope?: "global" | "sibling";
7
9
  }>;
8
10
  /**
9
11
  * Max rule - value must be equal or less than maximum
12
+ * Supports field names with sibling scope
10
13
  */
11
14
  export declare const maxRule: SchemaRule<{
12
- max: number;
15
+ max: number | string;
16
+ scope?: "global" | "sibling";
17
+ }>;
18
+ /**
19
+ * Greater than rule - value must be strictly greater than minimum
20
+ * Supports field names with sibling scope
21
+ */
22
+ export declare const greaterThanRule: SchemaRule<{
23
+ value: number | string;
24
+ scope?: "global" | "sibling";
25
+ }>;
26
+ /**
27
+ * Less than rule - value must be strictly less than maximum
28
+ * Supports field names with sibling scope
29
+ */
30
+ export declare const lessThanRule: SchemaRule<{
31
+ value: number | string;
32
+ scope?: "global" | "sibling";
13
33
  }>;
14
34
  /**
15
35
  * Positive rule - value must be greater than 0
@@ -35,9 +55,11 @@ export declare const moduloRule: SchemaRule<{
35
55
  }>;
36
56
  /**
37
57
  * Between rule - value must be between the given two numbers (Inclusive)
58
+ * Supports field names with sibling scope
38
59
  */
39
60
  export declare const betweenNumbersRule: SchemaRule<{
40
- min: number;
41
- max: number;
61
+ min: number | string;
62
+ max: number | string;
63
+ scope?: "global" | "sibling";
42
64
  }>;
43
65
  //# sourceMappingURL=number-rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-rules.d.ts","sourceRoot":"","sources":["../../../src/rules/number/number-rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,UAAU,CAAC;IAAE,GAAG,EAAE,MAAM,C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F;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC;IACpC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CA4BA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,UAS1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,UAS1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,UASrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAStB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,UAAU,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CASpD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC;IAC1C,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAiDA,CAAC"}
@@ -1,11 +1,28 @@
1
- 'use strict';require('@mongez/reinforcements');var validationHelpers=require('../../helpers/validation-helpers.js');/**
1
+ 'use strict';var reinforcements=require('@mongez/reinforcements'),validationHelpers=require('../../helpers/validation-helpers.js');/**
2
2
  * Min rule - value must be equal or greater than minimum
3
+ * Supports field names with sibling scope
3
4
  */
4
5
  const minRule = {
5
6
  name: "min",
6
7
  defaultErrorMessage: "The :input must be at least :min",
7
8
  async validate(value, context) {
8
- if (value >= this.context.options.min) {
9
+ const { min, scope = "global" } = this.context.options;
10
+ let compareMin;
11
+ if (typeof min === "number") {
12
+ compareMin = min;
13
+ }
14
+ else {
15
+ const source = scope === "sibling" ? context.parent : context.allValues;
16
+ const fieldValue = reinforcements.get(source, min);
17
+ if (fieldValue === undefined) {
18
+ return validationHelpers.VALID_RULE;
19
+ }
20
+ compareMin = Number(fieldValue);
21
+ if (isNaN(compareMin)) {
22
+ return validationHelpers.VALID_RULE;
23
+ }
24
+ }
25
+ if (value >= compareMin) {
9
26
  return validationHelpers.VALID_RULE;
10
27
  }
11
28
  return validationHelpers.invalidRule(this, context);
@@ -13,12 +30,89 @@ const minRule = {
13
30
  };
14
31
  /**
15
32
  * Max rule - value must be equal or less than maximum
33
+ * Supports field names with sibling scope
16
34
  */
17
35
  const maxRule = {
18
36
  name: "max",
19
37
  defaultErrorMessage: "The :input must equal to or less than :max",
20
38
  async validate(value, context) {
21
- if (value <= this.context.options.max) {
39
+ const { max, scope = "global" } = this.context.options;
40
+ let compareMax;
41
+ if (typeof max === "number") {
42
+ compareMax = max;
43
+ }
44
+ else {
45
+ const source = scope === "sibling" ? context.parent : context.allValues;
46
+ const fieldValue = reinforcements.get(source, max);
47
+ if (fieldValue === undefined) {
48
+ return validationHelpers.VALID_RULE;
49
+ }
50
+ compareMax = Number(fieldValue);
51
+ if (isNaN(compareMax)) {
52
+ return validationHelpers.VALID_RULE;
53
+ }
54
+ }
55
+ if (value <= compareMax) {
56
+ return validationHelpers.VALID_RULE;
57
+ }
58
+ return validationHelpers.invalidRule(this, context);
59
+ },
60
+ };
61
+ /**
62
+ * Greater than rule - value must be strictly greater than minimum
63
+ * Supports field names with sibling scope
64
+ */
65
+ const greaterThanRule = {
66
+ name: "greaterThan",
67
+ defaultErrorMessage: "The :input must be greater than :value",
68
+ async validate(value, context) {
69
+ const { value: compareValue, scope = "global" } = this.context.options;
70
+ let compareNumber;
71
+ if (typeof compareValue === "number") {
72
+ compareNumber = compareValue;
73
+ }
74
+ else {
75
+ const source = scope === "sibling" ? context.parent : context.allValues;
76
+ const fieldValue = reinforcements.get(source, compareValue);
77
+ if (fieldValue === undefined) {
78
+ return validationHelpers.VALID_RULE;
79
+ }
80
+ compareNumber = Number(fieldValue);
81
+ if (isNaN(compareNumber)) {
82
+ return validationHelpers.VALID_RULE;
83
+ }
84
+ }
85
+ if (value > compareNumber) {
86
+ return validationHelpers.VALID_RULE;
87
+ }
88
+ return validationHelpers.invalidRule(this, context);
89
+ },
90
+ };
91
+ /**
92
+ * Less than rule - value must be strictly less than maximum
93
+ * Supports field names with sibling scope
94
+ */
95
+ const lessThanRule = {
96
+ name: "lessThan",
97
+ defaultErrorMessage: "The :input must be less than :value",
98
+ async validate(value, context) {
99
+ const { value: compareValue, scope = "global" } = this.context.options;
100
+ let compareNumber;
101
+ if (typeof compareValue === "number") {
102
+ compareNumber = compareValue;
103
+ }
104
+ else {
105
+ const source = scope === "sibling" ? context.parent : context.allValues;
106
+ const fieldValue = reinforcements.get(source, compareValue);
107
+ if (fieldValue === undefined) {
108
+ return validationHelpers.VALID_RULE;
109
+ }
110
+ compareNumber = Number(fieldValue);
111
+ if (isNaN(compareNumber)) {
112
+ return validationHelpers.VALID_RULE;
113
+ }
114
+ }
115
+ if (value < compareNumber) {
22
116
  return validationHelpers.VALID_RULE;
23
117
  }
24
118
  return validationHelpers.invalidRule(this, context);
@@ -91,17 +185,50 @@ const moduloRule = {
91
185
  };
92
186
  /**
93
187
  * Between rule - value must be between the given two numbers (Inclusive)
188
+ * Supports field names with sibling scope
94
189
  */
95
190
  const betweenNumbersRule = {
96
191
  name: "betweenNumbers",
97
192
  defaultErrorMessage: "The :input must be between :min and :max",
98
193
  async validate(value, context) {
99
- if (value >= this.context.options.min &&
100
- value <= this.context.options.max) {
194
+ const { min, max, scope = "global" } = this.context.options;
195
+ // Extract min value
196
+ let compareMin;
197
+ if (typeof min === "number") {
198
+ compareMin = min;
199
+ }
200
+ else {
201
+ const source = scope === "sibling" ? context.parent : context.allValues;
202
+ const fieldValue = reinforcements.get(source, min);
203
+ if (fieldValue === undefined) {
204
+ return validationHelpers.VALID_RULE;
205
+ }
206
+ compareMin = Number(fieldValue);
207
+ if (isNaN(compareMin)) {
208
+ return validationHelpers.VALID_RULE;
209
+ }
210
+ }
211
+ // Extract max value
212
+ let compareMax;
213
+ if (typeof max === "number") {
214
+ compareMax = max;
215
+ }
216
+ else {
217
+ const source = scope === "sibling" ? context.parent : context.allValues;
218
+ const fieldValue = reinforcements.get(source, max);
219
+ if (fieldValue === undefined) {
220
+ return validationHelpers.VALID_RULE;
221
+ }
222
+ compareMax = Number(fieldValue);
223
+ if (isNaN(compareMax)) {
224
+ return validationHelpers.VALID_RULE;
225
+ }
226
+ }
227
+ if (value >= compareMin && value <= compareMax) {
101
228
  this.context.options.betweenNumbers =
102
- `${this.context.options.min} and ${this.context.options.max}`;
229
+ `${compareMin} and ${compareMax}`;
103
230
  return validationHelpers.VALID_RULE;
104
231
  }
105
232
  return validationHelpers.invalidRule(this, context);
106
233
  },
107
- };exports.betweenNumbersRule=betweenNumbersRule;exports.evenRule=evenRule;exports.maxRule=maxRule;exports.minRule=minRule;exports.moduloRule=moduloRule;exports.negativeRule=negativeRule;exports.oddRule=oddRule;exports.positiveRule=positiveRule;//# sourceMappingURL=number-rules.js.map
234
+ };exports.betweenNumbersRule=betweenNumbersRule;exports.evenRule=evenRule;exports.greaterThanRule=greaterThanRule;exports.lessThanRule=lessThanRule;exports.maxRule=maxRule;exports.minRule=minRule;exports.moduloRule=moduloRule;exports.negativeRule=negativeRule;exports.oddRule=oddRule;exports.positiveRule=positiveRule;//# sourceMappingURL=number-rules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-rules.js","sources":["../../../src/rules/number/number-rules.ts"],"sourcesContent":[null],"names":["VALID_RULE","invalidRule"],"mappings":"oHAGA;;AAEG;AACU,MAAA,OAAO,GAAgC;AAClD,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,mBAAmB,EAAE,kCAAkC;AACvD,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,IAAI,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;AACrC,YAAA,OAAOA,4BAAU,CAAC;AACnB,SAAA;AACD,QAAA,OAAOC,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,C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AC,GAAG,EAAE,CAAC;AAChE,YAAA,OAAOD,4BAAU,CAAC;AACnB,SAAA;AACD,QAAA,OAAOC,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;"}
1
+ {"version":3,"file":"number-rules.js","sources":["../../../src/rules/number/number-rules.ts"],"sourcesContent":[null],"names":["get","VALID_RULE","invalidRule"],"mappings":"mIAIA;;;AAGG;AACU,MAAA,OAAO,GAGf;AACH,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,mBAAmB,EAAE,kCAAkC;AACvD,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;AAChC,QAAA,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;AACvD,QAAA,IAAI,UAAkB,CAAC;AAEvB,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,UAAU,GAAG,GAAG,CAAC;AAClB,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;YACxE,MAAM,UAAU,GAAGA,kBAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAEpC,IAAI,UAAU,KAAK,SAAS,EAAE;AAC5B,gBAAA,OAAOC,4BAAU,CAAC;AACnB,aAAA;AAED,YAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAChC,YAAA,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE;AACrB,gBAAA,OAAOA,4BAAU,CAAC;AACnB,aAAA;AACF,SAAA;QAED,IAAI,KAAK,IAAI,UAAU,EAAE;AACvB,YAAA,OAAOA,4BAAU,CAAC;AACnB,SAAA;AACD,QAAA,OAAOC,6BAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;EACD;AAEF;;;AAGG;AACU,MAAA,OAAO,GAGf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,EAAE,OAAO,CAAC,CAAC;KACnC;"}
@@ -6,10 +6,74 @@ import { StringValidator } from "./string-validator";
6
6
  */
7
7
  export declare class NumberValidator extends BaseValidator {
8
8
  constructor(errorMessage?: string);
9
- /** Value must be equal or higher than the given number */
10
- min(min: number, errorMessage?: string): this;
11
- /** Value must be equal or less than the given number */
12
- max(max: number, errorMessage?: string): this;
9
+ /**
10
+ * Value must be equal or higher than the given number or field
11
+ * Smart detection: number or field name
12
+ *
13
+ * @category Validation Rule
14
+ */
15
+ min(min: number | string, errorMessage?: string): this;
16
+ /**
17
+ * Value must be equal or less than the given number or field
18
+ * Smart detection: number or field name
19
+ *
20
+ * @category Validation Rule
21
+ */
22
+ max(max: number | string, errorMessage?: string): this;
23
+ /**
24
+ * Value must be >= sibling field value
25
+ * @category Validation Rule
26
+ */
27
+ minSibling(field: string, errorMessage?: string): this;
28
+ /**
29
+ * Value must be <= sibling field value
30
+ * @category Validation Rule
31
+ */
32
+ maxSibling(field: string, errorMessage?: string): this;
33
+ /**
34
+ * Value must be strictly greater than the given number or field (>)
35
+ * Smart detection: number or field name
36
+ *
37
+ * @category Validation Rule
38
+ */
39
+ greaterThan(value: number | string, errorMessage?: string): this;
40
+ /**
41
+ * Value must be strictly less than the given number or field (<)
42
+ * Smart detection: number or field name
43
+ *
44
+ * @category Validation Rule
45
+ */
46
+ lessThan(value: number | string, errorMessage?: string): this;
47
+ /**
48
+ * Alias for greaterThan() - shorter syntax
49
+ * @category Validation Rule
50
+ */
51
+ gt(value: number | string, errorMessage?: string): this;
52
+ /**
53
+ * Alias for lessThan() - shorter syntax
54
+ * @category Validation Rule
55
+ */
56
+ lt(value: number | string, errorMessage?: string): this;
57
+ /**
58
+ * Value must be > sibling field value
59
+ * @category Validation Rule
60
+ */
61
+ greaterThanSibling(field: string, errorMessage?: string): this;
62
+ /**
63
+ * Alias for greaterThanSibling() - shorter syntax
64
+ * @category Validation Rule
65
+ */
66
+ gtSibling(field: string, errorMessage?: string): this;
67
+ /**
68
+ * Value must be < sibling field value
69
+ * @category Validation Rule
70
+ */
71
+ lessThanSibling(field: string, errorMessage?: string): this;
72
+ /**
73
+ * Alias for lessThanSibling() - shorter syntax
74
+ * @category Validation Rule
75
+ */
76
+ ltSibling(field: string, errorMessage?: string): this;
13
77
  /** Value must be a modulo of the given number */
14
78
  modulo(value: number, errorMessage?: string): this;
15
79
  /** Accept only numbers higher than 0 */
@@ -20,8 +84,18 @@ export declare class NumberValidator extends BaseValidator {
20
84
  odd(errorMessage?: string): this;
21
85
  /** Accept only even numbers */
22
86
  even(errorMessage?: string): this;
23
- /** Accept only numbers between the given two numbers (Inclusive) */
24
- between(min: number, max: number, errorMessage?: string): this;
87
+ /**
88
+ * Accept only numbers between the given two numbers or fields (Inclusive)
89
+ * Smart detection: number or field name
90
+ *
91
+ * @category Validation Rule
92
+ */
93
+ between(min: number | string, max: number | string, errorMessage?: string): this;
94
+ /**
95
+ * Value must be between sibling field values
96
+ * @category Validation Rule
97
+ */
98
+ betweenSibling(minField: string, maxField: string, errorMessage?: string): this;
25
99
  enum: (values: any, errorMessage?: string) => ScalarValidator;
26
100
  in: (values: any[], errorMessage?: string) => ScalarValidator;
27
101
  oneOf: (values: any[], errorMessage?: string) => ScalarValidator;
@@ -1 +1 @@
1
- {"version":3,"file":"number-validator.d.ts","sourceRoot":"","sources":["../../src/validators/number-validator.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;gBAC7B,YAAY,CAAC,EAAE,MAAM;IAMxC,0DAA0D;IACnD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAM7C,wDAAwD;IACjD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE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;OAGG;IACI,cAAc,CACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM;IAUhB,IAAI,0DAAkC;IACtC,EAAE,4DAAgC;IAClC,KAAK,4DAAgC;IACrC,UAAU,4DAAwC;IAClD,OAAO,4DAAqC;IAC5C,KAAK,4DAAqC;IAG1C,MAAM,6DAAoC;IAC1C,SAAS,6DAAuC;IAChD,SAAS,6DAAuC;CAKxD"}
@@ -7,18 +7,122 @@ class NumberValidator extends baseValidator.BaseValidator {
7
7
  this.addRule(typeRules.numberRule, errorMessage);
8
8
  this.addMutator(numberMutators.numberMutator);
9
9
  }
10
- /** Value must be equal or higher than the given number */
10
+ /**
11
+ * Value must be equal or higher than the given number or field
12
+ * Smart detection: number or field name
13
+ *
14
+ * @category Validation Rule
15
+ */
11
16
  min(min, errorMessage) {
12
17
  const rule = this.addRule(numberRules.minRule, errorMessage);
13
18
  rule.context.options.min = min;
19
+ rule.context.options.scope = "global";
14
20
  return this;
15
21
  }
16
- /** Value must be equal or less than the given number */
22
+ /**
23
+ * Value must be equal or less than the given number or field
24
+ * Smart detection: number or field name
25
+ *
26
+ * @category Validation Rule
27
+ */
17
28
  max(max, errorMessage) {
18
29
  const rule = this.addRule(numberRules.maxRule, errorMessage);
19
30
  rule.context.options.max = max;
31
+ rule.context.options.scope = "global";
20
32
  return this;
21
33
  }
34
+ /**
35
+ * Value must be >= sibling field value
36
+ * @category Validation Rule
37
+ */
38
+ minSibling(field, errorMessage) {
39
+ const rule = this.addRule(numberRules.minRule, errorMessage);
40
+ rule.context.options.min = field;
41
+ rule.context.options.scope = "sibling";
42
+ return this;
43
+ }
44
+ /**
45
+ * Value must be <= sibling field value
46
+ * @category Validation Rule
47
+ */
48
+ maxSibling(field, errorMessage) {
49
+ const rule = this.addRule(numberRules.maxRule, errorMessage);
50
+ rule.context.options.max = field;
51
+ rule.context.options.scope = "sibling";
52
+ return this;
53
+ }
54
+ /**
55
+ * Value must be strictly greater than the given number or field (>)
56
+ * Smart detection: number or field name
57
+ *
58
+ * @category Validation Rule
59
+ */
60
+ greaterThan(value, errorMessage) {
61
+ const rule = this.addRule(numberRules.greaterThanRule, errorMessage);
62
+ rule.context.options.value = value;
63
+ rule.context.options.scope = "global";
64
+ return this;
65
+ }
66
+ /**
67
+ * Value must be strictly less than the given number or field (<)
68
+ * Smart detection: number or field name
69
+ *
70
+ * @category Validation Rule
71
+ */
72
+ lessThan(value, errorMessage) {
73
+ const rule = this.addRule(numberRules.lessThanRule, errorMessage);
74
+ rule.context.options.value = value;
75
+ rule.context.options.scope = "global";
76
+ return this;
77
+ }
78
+ /**
79
+ * Alias for greaterThan() - shorter syntax
80
+ * @category Validation Rule
81
+ */
82
+ gt(value, errorMessage) {
83
+ return this.greaterThan(value, errorMessage);
84
+ }
85
+ /**
86
+ * Alias for lessThan() - shorter syntax
87
+ * @category Validation Rule
88
+ */
89
+ lt(value, errorMessage) {
90
+ return this.lessThan(value, errorMessage);
91
+ }
92
+ /**
93
+ * Value must be > sibling field value
94
+ * @category Validation Rule
95
+ */
96
+ greaterThanSibling(field, errorMessage) {
97
+ const rule = this.addRule(numberRules.greaterThanRule, errorMessage);
98
+ rule.context.options.value = field;
99
+ rule.context.options.scope = "sibling";
100
+ return this;
101
+ }
102
+ /**
103
+ * Alias for greaterThanSibling() - shorter syntax
104
+ * @category Validation Rule
105
+ */
106
+ gtSibling(field, errorMessage) {
107
+ return this.greaterThanSibling(field, errorMessage);
108
+ }
109
+ /**
110
+ * Value must be < sibling field value
111
+ * @category Validation Rule
112
+ */
113
+ lessThanSibling(field, errorMessage) {
114
+ const rule = this.addRule(numberRules.lessThanRule, errorMessage);
115
+ rule.context.options.value = field;
116
+ rule.context.options.scope = "sibling";
117
+ return this;
118
+ }
119
+ /**
120
+ * Alias for lessThanSibling() - shorter syntax
121
+ * @category Validation Rule
122
+ */
123
+ ltSibling(field, errorMessage) {
124
+ return this.lessThanSibling(field, errorMessage);
125
+ }
22
126
  /** Value must be a modulo of the given number */
23
127
  modulo(value, errorMessage) {
24
128
  const rule = this.addRule(numberRules.moduloRule, errorMessage);
@@ -45,11 +149,28 @@ class NumberValidator extends baseValidator.BaseValidator {
45
149
  this.addRule(numberRules.evenRule, errorMessage);
46
150
  return this;
47
151
  }
48
- /** Accept only numbers between the given two numbers (Inclusive) */
152
+ /**
153
+ * Accept only numbers between the given two numbers or fields (Inclusive)
154
+ * Smart detection: number or field name
155
+ *
156
+ * @category Validation Rule
157
+ */
49
158
  between(min, max, errorMessage) {
50
159
  const rule = this.addRule(numberRules.betweenNumbersRule, errorMessage);
51
160
  rule.context.options.min = min;
52
161
  rule.context.options.max = max;
162
+ rule.context.options.scope = "global";
163
+ return this;
164
+ }
165
+ /**
166
+ * Value must be between sibling field values
167
+ * @category Validation Rule
168
+ */
169
+ betweenSibling(minField, maxField, errorMessage) {
170
+ const rule = this.addRule(numberRules.betweenNumbersRule, errorMessage);
171
+ rule.context.options.min = minField;
172
+ rule.context.options.max = maxField;
173
+ rule.context.options.scope = "sibling";
53
174
  return this;
54
175
  }
55
176
  // Enum and value checking methods from ScalarValidator
@@ -1 +1 @@
1
- {"version":3,"file":"number-validator.js","sources":["../../src/validators/number-validator.ts"],"sourcesContent":[null],"names":["BaseValidator","numberRule","numberMutator","minRule","maxRule","moduloRule","positiveRule","negativeRule","oddRule","evenRule","betweenNumbersRule","ScalarValidator","StringValidator"],"mappings":"0aAgBA;;AAEG;AACG,MAAO,eAAgB,SAAQA,2BAAa,CAAA;AAChD,IAAA,WAAA,CAAmB,YAAqB,EAAA;AACtC,QAAA,KAAK,EAAE,CAAC;AACR,QAAA,IAAI,CAAC,OAAO,CAACC,oBAAU,EAAE,YAAY,CAAC,CAAC;AACvC,QAAA,IAAI,CAAC,UAAU,CAACC,4BAAa,CAAC,CAAC;KAChC;;IAGM,GAAG,CAAC,GAAW,EAAE,YAAqB,EAAA;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC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,IAAI,GAAG,IAAI,CAAC,OAAO,CAACC,8BAAkB,EAAE,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;QAC/B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAC/B,QAAA,OAAO,IAAI,CAAC;KACb;;AAGM,IAAA,IAAI,GAAGC,+BAAe,CAAC,SAAS,CAAC,IAAI,CAAC;AACtC,IAAA,EAAE,GAAGA,+BAAe,CAAC,SAAS,CAAC,EAAE,CAAC;AAClC,IAAA,KAAK,GAAGA,+BAAe,CAAC,SAAS,CAAC,EAAE,CAAC;AACrC,IAAA,UAAU,GAAGA,+BAAe,CAAC,SAAS,CAAC,UAAU,CAAC;AAClD,IAAA,OAAO,GAAGA,+BAAe,CAAC,SAAS,CAAC,OAAO,CAAC;AAC5C,IAAA,KAAK,GAAGA,+BAAe,CAAC,SAAS,CAAC,OAAO,CAAC;;AAG1C,IAAA,MAAM,GAAGC,+BAAe,CAAC,SAAS,CAAC,MAAM,CAAC;AAC1C,IAAA,SAAS,GAAGA,+BAAe,CAAC,SAAS,CAAC,SAAS,CAAC;AAChD,IAAA,SAAS,GAAGA,+BAAe,CAAC,SAAS,CAAC,SAAS,CAAC;AAKxD"}
1
+ {"version":3,"file":"number-validator.js","sources":["../../src/validators/number-validator.ts"],"sourcesContent":[null],"names":["BaseValidator","numberRule","numberMutator","minRule","maxRule","greaterThanRule","lessThanRule","moduloRule","positiveRule","negativeRule","oddRule","evenRule","betweenNumbersRule","ScalarValidator","StringValidator"],"mappings":"0aAkBA;;AAEG;AACG,MAAO,eAAgB,SAAQA,2BAAa,CAAA;AAChD,IAAA,WAAA,CAAmB,YAAqB,EAAA;AACtC,QAAA,KAAK,EAAE,CAAC;AACR,QAAA,IAAI,CAAC,OAAO,CAACC,oBAAU,EAAE,YAAY,CAAC,CAAC;AACvC,QAAA,IAAI,CAAC,UAAU,CAACC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SAAS,CAAC,OAAO,CAAC;;AAG1C,IAAA,MAAM,GAAGC,+BAAe,CAAC,SAAS,CAAC,MAAM,CAAC;AAC1C,IAAA,SAAS,GAAGA,+BAAe,CAAC,SAAS,CAAC,SAAS,CAAC;AAChD,IAAA,SAAS,GAAGA,+BAAe,CAAC,SAAS,CAAC,SAAS,CAAC;AAKxD"}
package/esm/index.js CHANGED
@@ -1 +1 @@
1
- export{AnyValidator}from'./validators/any-validator.js';export{ArrayValidator}from'./validators/array-validator.js';export{BaseValidator}from'./validators/base-validator.js';export{BooleanValidator}from'./validators/boolean-validator.js';export{DateValidator}from'./validators/date-validator.js';export{FloatValidator}from'./validators/float-validator.js';export{IntValidator}from'./validators/int-validator.js';export{NumberValidator}from'./validators/number-validator.js';export{ObjectValidator}from'./validators/object-validator.js';export{ScalarValidator}from'./validators/scalar-validator.js';export{StringValidator}from'./validators/string-validator.js';export{WEEK_DAYS}from'./types/date-types.js';export{isDateValue}from'./helpers/date-helpers.js';export{getFieldValue}from'./helpers/get-field-value.js';export{setKeyPath}from'./helpers/path-helpers.js';export{VALID_RULE,invalidRule}from'./helpers/validation-helpers.js';export{flipArrayMutator,removeEmptyArrayElementsMutator,reverseArrayMutator,sortArrayMutator,uniqueArrayMutator}from'./mutators/array-mutators.js';export{addDaysMutator,addHoursMutator,addMonthsMutator,addYearsMutator,dateMutator,toDateOnlyMutator,toEndOfDayMutator,toEndOfMonthMutator,toEndOfYearMutator,toFormatMutator,toISOStringMutator,toStartOfDayMutator,toStartOfMonthMutator,toStartOfYearMutator,toTimeOnlyMutator,toTimestampMutator,toUTCMutator}from'./mutators/date-mutators.js';export{booleanMutator,numberMutator,roundNumberMutator}from'./mutators/number-mutators.js';export{jsonMutator,objectTrimMutator,stripUnknownMutator}from'./mutators/object-mutators.js';export{alphaOnlyMutator,alphanumericOnlyMutator,appendMutator,base64DecodeMutator,base64EncodeMutator,camelCaseMutator,capitalizeMutator,htmlEscapeMutator,kebabCaseMutator,lowercaseMutator,ltrimMutator,maskMutator,padEndMutator,padStartMutator,pascalCaseMutator,prependMutator,removeNumbersMutator,removeSpecialCharactersMutator,repeatMutator,replaceAllMutator,replaceMutator,reverseMutator,rtrimMutator,safeHtmlMutator,slugMutator,snakeCaseMutator,stringifyMutator,titleCaseMutator,trimMultipleWhitespaceMutator,trimMutator,truncateMutator,unescapeHtmlMutator,uppercaseMutator,urlDecodeMutator,urlEncodeMutator}from'./mutators/string-mutators.js';export{equalRule}from'./rules/core/equal.js';export{forbiddenRule}from'./rules/core/forbidden.js';export{presentRule,requiredRule}from'./rules/core/required.js';export{whenRule}from'./rules/core/when.js';export{alphaNumericRule,alphaRule,isNumericRule}from'./rules/string/alpha.js';export{isCreditCardRule}from'./rules/string/credit-card.js';export{emailRule}from'./rules/string/email.js';export{ip4Rule,ip6Rule,ipRule}from'./rules/string/ip.js';export{matchesRule}from'./rules/string/matches.js';export{patternRule}from'./rules/string/pattern.js';export{containsRule,endsWithRule,notContainsRule,startsWithRule}from'./rules/string/string-comparison.js';export{strongPasswordRule}from'./rules/string/strong-password-rule.js';export{urlRule}from'./rules/string/url.js';export{withoutWhitespaceRule}from'./rules/string/without-whitespace.js';export{betweenNumbersRule,evenRule,maxRule,minRule,moduloRule,negativeRule,oddRule,positiveRule}from'./rules/number/number-rules.js';export{betweenLengthRule,lengthRule,maxLengthRule,maxWordsRule,minLengthRule,minWordsRule,wordsRule}from'./rules/length/length-rules.js';export{sortedArrayRule,uniqueArrayRule}from'./rules/array/array-rules.js';export{ageRule,beforeHourRule,beforeMinuteRule,beforeTodayRule,betweenHoursRule,betweenMinutesRule,dateRule,fromHourRule,fromMinuteRule,fromTodayRule,maxAgeRule,maxDateRule,minAgeRule,minDateRule,weekDayRule}from'./rules/date/date.js';export{afterTodayRule,betweenDatesRule,futureRule,pastRule,todayRule}from'./rules/date/date-comparison-rules.js';export{businessDayRule,weekdayRule,weekdaysRule,weekendRule}from'./rules/date/date-day-rules.js';export{afterFieldRule,beforeFieldRule,sameAsFieldDateRule}from'./rules/date/date-field-comparison-rules.js';export{betweenDaysRule,betweenMonthsRule,betweenTimesRule,betweenYearsRule,maxDayRule,maxMonthRule,maxYearRule,minDayRule,minMonthRule,minYearRule,monthRule,quarterRule,yearRule}from'./rules/date/date-period-rules.js';export{withinDaysRule,withinFutureDaysRule,withinPastDaysRule}from'./rules/date/date-relative-rules.js';export{betweenAgeRule,birthdayRule,leapYearRule}from'./rules/date/date-special-rules.js';export{maxHeightRule,maxWidthRule,minHeightRule,minWidthRule}from'./rules/file/dimensions.js';export{maxFileSizeRule,minFileSizeRule}from'./rules/file/file-size.js';export{colorRule,darkColorRule,hexColorRule,hslColorRule,lightColorRule,rgbColorRule,rgbaColorRule}from'./rules/color/color-rules.js';export{requiredIfEmptyRule,requiredIfInRule,requiredIfNotEmptyRule,requiredIfNotInRule,requiredIfRule}from'./rules/conditional/required-if-rules.js';export{requiredUnlessRule}from'./rules/conditional/required-unless-rules.js';export{requiredWithAllRule,requiredWithAnyRule,requiredWithRule}from'./rules/conditional/required-with-rules.js';export{requiredWithoutAllRule,requiredWithoutAnyRule,requiredWithoutRule}from'./rules/conditional/required-without-rules.js';export{presentIfEmptyRule,presentIfInRule,presentIfNotEmptyRule,presentIfNotInRule,presentIfRule}from'./rules/conditional/present-if-rules.js';export{presentUnlessRule}from'./rules/conditional/present-unless-rules.js';export{presentWithAllRule,presentWithAnyRule,presentWithRule}from'./rules/conditional/present-with-rules.js';export{presentWithoutAllRule,presentWithoutAnyRule,presentWithoutRule}from'./rules/conditional/present-without-rules.js';export{allowedValuesRule,enumRule,inRule,notAllowedValuesRule}from'./rules/common/enum.js';export{equalsFieldRule,notEqualsFieldRule}from'./rules/common/equals-field-rules.js';export{arrayRule,booleanRule,floatRule,intRule,numberRule,objectRule,scalarRule,stringRule}from'./rules/common/type-rules.js';export{unknownKeyRule}from'./rules/common/unknown-key.js';export{validate}from'./factory/validate.js';export{v}from'./factory/validators.js';export{getInstalledPlugins,hasPlugin,registerPlugin,unregisterPlugin}from'./plugins/plugin-system.js';export{configureSeal,getSealConfig,resetSealConfig}from'./config.js';//# sourceMappingURL=index.js.map
1
+ export{AnyValidator}from'./validators/any-validator.js';export{ArrayValidator}from'./validators/array-validator.js';export{BaseValidator}from'./validators/base-validator.js';export{BooleanValidator}from'./validators/boolean-validator.js';export{DateValidator}from'./validators/date-validator.js';export{FloatValidator}from'./validators/float-validator.js';export{IntValidator}from'./validators/int-validator.js';export{NumberValidator}from'./validators/number-validator.js';export{ObjectValidator}from'./validators/object-validator.js';export{ScalarValidator}from'./validators/scalar-validator.js';export{StringValidator}from'./validators/string-validator.js';export{WEEK_DAYS}from'./types/date-types.js';export{isDateValue}from'./helpers/date-helpers.js';export{getFieldValue}from'./helpers/get-field-value.js';export{setKeyPath}from'./helpers/path-helpers.js';export{VALID_RULE,invalidRule}from'./helpers/validation-helpers.js';export{flipArrayMutator,removeEmptyArrayElementsMutator,reverseArrayMutator,sortArrayMutator,uniqueArrayMutator}from'./mutators/array-mutators.js';export{addDaysMutator,addHoursMutator,addMonthsMutator,addYearsMutator,dateMutator,toDateOnlyMutator,toEndOfDayMutator,toEndOfMonthMutator,toEndOfYearMutator,toFormatMutator,toISOStringMutator,toStartOfDayMutator,toStartOfMonthMutator,toStartOfYearMutator,toTimeOnlyMutator,toTimestampMutator,toUTCMutator}from'./mutators/date-mutators.js';export{booleanMutator,numberMutator,roundNumberMutator}from'./mutators/number-mutators.js';export{jsonMutator,objectTrimMutator,stripUnknownMutator}from'./mutators/object-mutators.js';export{alphaOnlyMutator,alphanumericOnlyMutator,appendMutator,base64DecodeMutator,base64EncodeMutator,camelCaseMutator,capitalizeMutator,htmlEscapeMutator,kebabCaseMutator,lowercaseMutator,ltrimMutator,maskMutator,padEndMutator,padStartMutator,pascalCaseMutator,prependMutator,removeNumbersMutator,removeSpecialCharactersMutator,repeatMutator,replaceAllMutator,replaceMutator,reverseMutator,rtrimMutator,safeHtmlMutator,slugMutator,snakeCaseMutator,stringifyMutator,titleCaseMutator,trimMultipleWhitespaceMutator,trimMutator,truncateMutator,unescapeHtmlMutator,uppercaseMutator,urlDecodeMutator,urlEncodeMutator}from'./mutators/string-mutators.js';export{equalRule}from'./rules/core/equal.js';export{forbiddenRule}from'./rules/core/forbidden.js';export{presentRule,requiredRule}from'./rules/core/required.js';export{whenRule}from'./rules/core/when.js';export{alphaNumericRule,alphaRule,isNumericRule}from'./rules/string/alpha.js';export{isCreditCardRule}from'./rules/string/credit-card.js';export{emailRule}from'./rules/string/email.js';export{ip4Rule,ip6Rule,ipRule}from'./rules/string/ip.js';export{matchesRule}from'./rules/string/matches.js';export{patternRule}from'./rules/string/pattern.js';export{containsRule,endsWithRule,notContainsRule,startsWithRule}from'./rules/string/string-comparison.js';export{strongPasswordRule}from'./rules/string/strong-password-rule.js';export{urlRule}from'./rules/string/url.js';export{withoutWhitespaceRule}from'./rules/string/without-whitespace.js';export{betweenNumbersRule,evenRule,greaterThanRule,lessThanRule,maxRule,minRule,moduloRule,negativeRule,oddRule,positiveRule}from'./rules/number/number-rules.js';export{betweenLengthRule,lengthRule,maxLengthRule,maxWordsRule,minLengthRule,minWordsRule,wordsRule}from'./rules/length/length-rules.js';export{sortedArrayRule,uniqueArrayRule}from'./rules/array/array-rules.js';export{ageRule,beforeHourRule,beforeMinuteRule,beforeTodayRule,betweenHoursRule,betweenMinutesRule,dateRule,fromHourRule,fromMinuteRule,fromTodayRule,maxAgeRule,maxDateRule,minAgeRule,minDateRule,weekDayRule}from'./rules/date/date.js';export{afterTodayRule,betweenDatesRule,futureRule,pastRule,todayRule}from'./rules/date/date-comparison-rules.js';export{businessDayRule,weekdayRule,weekdaysRule,weekendRule}from'./rules/date/date-day-rules.js';export{afterFieldRule,beforeFieldRule,sameAsFieldDateRule}from'./rules/date/date-field-comparison-rules.js';export{betweenDaysRule,betweenMonthsRule,betweenTimesRule,betweenYearsRule,maxDayRule,maxMonthRule,maxYearRule,minDayRule,minMonthRule,minYearRule,monthRule,quarterRule,yearRule}from'./rules/date/date-period-rules.js';export{withinDaysRule,withinFutureDaysRule,withinPastDaysRule}from'./rules/date/date-relative-rules.js';export{betweenAgeRule,birthdayRule,leapYearRule}from'./rules/date/date-special-rules.js';export{maxHeightRule,maxWidthRule,minHeightRule,minWidthRule}from'./rules/file/dimensions.js';export{maxFileSizeRule,minFileSizeRule}from'./rules/file/file-size.js';export{colorRule,darkColorRule,hexColorRule,hslColorRule,lightColorRule,rgbColorRule,rgbaColorRule}from'./rules/color/color-rules.js';export{requiredIfEmptyRule,requiredIfInRule,requiredIfNotEmptyRule,requiredIfNotInRule,requiredIfRule}from'./rules/conditional/required-if-rules.js';export{requiredUnlessRule}from'./rules/conditional/required-unless-rules.js';export{requiredWithAllRule,requiredWithAnyRule,requiredWithRule}from'./rules/conditional/required-with-rules.js';export{requiredWithoutAllRule,requiredWithoutAnyRule,requiredWithoutRule}from'./rules/conditional/required-without-rules.js';export{presentIfEmptyRule,presentIfInRule,presentIfNotEmptyRule,presentIfNotInRule,presentIfRule}from'./rules/conditional/present-if-rules.js';export{presentUnlessRule}from'./rules/conditional/present-unless-rules.js';export{presentWithAllRule,presentWithAnyRule,presentWithRule}from'./rules/conditional/present-with-rules.js';export{presentWithoutAllRule,presentWithoutAnyRule,presentWithoutRule}from'./rules/conditional/present-without-rules.js';export{allowedValuesRule,enumRule,inRule,notAllowedValuesRule}from'./rules/common/enum.js';export{equalsFieldRule,notEqualsFieldRule}from'./rules/common/equals-field-rules.js';export{arrayRule,booleanRule,floatRule,intRule,numberRule,objectRule,scalarRule,stringRule}from'./rules/common/type-rules.js';export{unknownKeyRule}from'./rules/common/unknown-key.js';export{validate}from'./factory/validate.js';export{v}from'./factory/validators.js';export{getInstalledPlugins,hasPlugin,registerPlugin,unregisterPlugin}from'./plugins/plugin-system.js';export{configureSeal,getSealConfig,resetSealConfig}from'./config.js';//# sourceMappingURL=index.js.map
@@ -1,15 +1,35 @@
1
1
  import type { SchemaRule } from "../../types";
2
2
  /**
3
3
  * Min rule - value must be equal or greater than minimum
4
+ * Supports field names with sibling scope
4
5
  */
5
6
  export declare const minRule: SchemaRule<{
6
- min: number;
7
+ min: number | string;
8
+ scope?: "global" | "sibling";
7
9
  }>;
8
10
  /**
9
11
  * Max rule - value must be equal or less than maximum
12
+ * Supports field names with sibling scope
10
13
  */
11
14
  export declare const maxRule: SchemaRule<{
12
- max: number;
15
+ max: number | string;
16
+ scope?: "global" | "sibling";
17
+ }>;
18
+ /**
19
+ * Greater than rule - value must be strictly greater than minimum
20
+ * Supports field names with sibling scope
21
+ */
22
+ export declare const greaterThanRule: SchemaRule<{
23
+ value: number | string;
24
+ scope?: "global" | "sibling";
25
+ }>;
26
+ /**
27
+ * Less than rule - value must be strictly less than maximum
28
+ * Supports field names with sibling scope
29
+ */
30
+ export declare const lessThanRule: SchemaRule<{
31
+ value: number | string;
32
+ scope?: "global" | "sibling";
13
33
  }>;
14
34
  /**
15
35
  * Positive rule - value must be greater than 0
@@ -35,9 +55,11 @@ export declare const moduloRule: SchemaRule<{
35
55
  }>;
36
56
  /**
37
57
  * Between rule - value must be between the given two numbers (Inclusive)
58
+ * Supports field names with sibling scope
38
59
  */
39
60
  export declare const betweenNumbersRule: SchemaRule<{
40
- min: number;
41
- max: number;
61
+ min: number | string;
62
+ max: number | string;
63
+ scope?: "global" | "sibling";
42
64
  }>;
43
65
  //# sourceMappingURL=number-rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-rules.d.ts","sourceRoot":"","sources":["../../../src/rules/number/number-rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,UAAU,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAS/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,UAAU,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAS/C,CAAC;AAEF;;GAEG;A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;CAC9B,CA4BA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,UAS1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,UAS1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,UASrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,UAStB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,UAAU,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CASpD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC;IAC1C,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC9B,CAiDA,CAAC"}
@@ -1,11 +1,28 @@
1
- import'@mongez/reinforcements';import {VALID_RULE,invalidRule}from'../../helpers/validation-helpers.js';/**
1
+ import {get}from'@mongez/reinforcements';import {VALID_RULE,invalidRule}from'../../helpers/validation-helpers.js';/**
2
2
  * Min rule - value must be equal or greater than minimum
3
+ * Supports field names with sibling scope
3
4
  */
4
5
  const minRule = {
5
6
  name: "min",
6
7
  defaultErrorMessage: "The :input must be at least :min",
7
8
  async validate(value, context) {
8
- if (value >= this.context.options.min) {
9
+ const { min, scope = "global" } = this.context.options;
10
+ let compareMin;
11
+ if (typeof min === "number") {
12
+ compareMin = min;
13
+ }
14
+ else {
15
+ const source = scope === "sibling" ? context.parent : context.allValues;
16
+ const fieldValue = get(source, min);
17
+ if (fieldValue === undefined) {
18
+ return VALID_RULE;
19
+ }
20
+ compareMin = Number(fieldValue);
21
+ if (isNaN(compareMin)) {
22
+ return VALID_RULE;
23
+ }
24
+ }
25
+ if (value >= compareMin) {
9
26
  return VALID_RULE;
10
27
  }
11
28
  return invalidRule(this, context);
@@ -13,12 +30,89 @@ const minRule = {
13
30
  };
14
31
  /**
15
32
  * Max rule - value must be equal or less than maximum
33
+ * Supports field names with sibling scope
16
34
  */
17
35
  const maxRule = {
18
36
  name: "max",
19
37
  defaultErrorMessage: "The :input must equal to or less than :max",
20
38
  async validate(value, context) {
21
- if (value <= this.context.options.max) {
39
+ const { max, scope = "global" } = this.context.options;
40
+ let compareMax;
41
+ if (typeof max === "number") {
42
+ compareMax = max;
43
+ }
44
+ else {
45
+ const source = scope === "sibling" ? context.parent : context.allValues;
46
+ const fieldValue = get(source, max);
47
+ if (fieldValue === undefined) {
48
+ return VALID_RULE;
49
+ }
50
+ compareMax = Number(fieldValue);
51
+ if (isNaN(compareMax)) {
52
+ return VALID_RULE;
53
+ }
54
+ }
55
+ if (value <= compareMax) {
56
+ return VALID_RULE;
57
+ }
58
+ return invalidRule(this, context);
59
+ },
60
+ };
61
+ /**
62
+ * Greater than rule - value must be strictly greater than minimum
63
+ * Supports field names with sibling scope
64
+ */
65
+ const greaterThanRule = {
66
+ name: "greaterThan",
67
+ defaultErrorMessage: "The :input must be greater than :value",
68
+ async validate(value, context) {
69
+ const { value: compareValue, scope = "global" } = this.context.options;
70
+ let compareNumber;
71
+ if (typeof compareValue === "number") {
72
+ compareNumber = compareValue;
73
+ }
74
+ else {
75
+ const source = scope === "sibling" ? context.parent : context.allValues;
76
+ const fieldValue = get(source, compareValue);
77
+ if (fieldValue === undefined) {
78
+ return VALID_RULE;
79
+ }
80
+ compareNumber = Number(fieldValue);
81
+ if (isNaN(compareNumber)) {
82
+ return VALID_RULE;
83
+ }
84
+ }
85
+ if (value > compareNumber) {
86
+ return VALID_RULE;
87
+ }
88
+ return invalidRule(this, context);
89
+ },
90
+ };
91
+ /**
92
+ * Less than rule - value must be strictly less than maximum
93
+ * Supports field names with sibling scope
94
+ */
95
+ const lessThanRule = {
96
+ name: "lessThan",
97
+ defaultErrorMessage: "The :input must be less than :value",
98
+ async validate(value, context) {
99
+ const { value: compareValue, scope = "global" } = this.context.options;
100
+ let compareNumber;
101
+ if (typeof compareValue === "number") {
102
+ compareNumber = compareValue;
103
+ }
104
+ else {
105
+ const source = scope === "sibling" ? context.parent : context.allValues;
106
+ const fieldValue = get(source, compareValue);
107
+ if (fieldValue === undefined) {
108
+ return VALID_RULE;
109
+ }
110
+ compareNumber = Number(fieldValue);
111
+ if (isNaN(compareNumber)) {
112
+ return VALID_RULE;
113
+ }
114
+ }
115
+ if (value < compareNumber) {
22
116
  return VALID_RULE;
23
117
  }
24
118
  return invalidRule(this, context);
@@ -91,17 +185,50 @@ const moduloRule = {
91
185
  };
92
186
  /**
93
187
  * Between rule - value must be between the given two numbers (Inclusive)
188
+ * Supports field names with sibling scope
94
189
  */
95
190
  const betweenNumbersRule = {
96
191
  name: "betweenNumbers",
97
192
  defaultErrorMessage: "The :input must be between :min and :max",
98
193
  async validate(value, context) {
99
- if (value >= this.context.options.min &&
100
- value <= this.context.options.max) {
194
+ const { min, max, scope = "global" } = this.context.options;
195
+ // Extract min value
196
+ let compareMin;
197
+ if (typeof min === "number") {
198
+ compareMin = min;
199
+ }
200
+ else {
201
+ const source = scope === "sibling" ? context.parent : context.allValues;
202
+ const fieldValue = get(source, min);
203
+ if (fieldValue === undefined) {
204
+ return VALID_RULE;
205
+ }
206
+ compareMin = Number(fieldValue);
207
+ if (isNaN(compareMin)) {
208
+ return VALID_RULE;
209
+ }
210
+ }
211
+ // Extract max value
212
+ let compareMax;
213
+ if (typeof max === "number") {
214
+ compareMax = max;
215
+ }
216
+ else {
217
+ const source = scope === "sibling" ? context.parent : context.allValues;
218
+ const fieldValue = get(source, max);
219
+ if (fieldValue === undefined) {
220
+ return VALID_RULE;
221
+ }
222
+ compareMax = Number(fieldValue);
223
+ if (isNaN(compareMax)) {
224
+ return VALID_RULE;
225
+ }
226
+ }
227
+ if (value >= compareMin && value <= compareMax) {
101
228
  this.context.options.betweenNumbers =
102
- `${this.context.options.min} and ${this.context.options.max}`;
229
+ `${compareMin} and ${compareMax}`;
103
230
  return VALID_RULE;
104
231
  }
105
232
  return invalidRule(this, context);
106
233
  },
107
- };export{betweenNumbersRule,evenRule,maxRule,minRule,moduloRule,negativeRule,oddRule,positiveRule};//# sourceMappingURL=number-rules.js.map
234
+ };export{betweenNumbersRule,evenRule,greaterThanRule,lessThanRule,maxRule,minRule,moduloRule,negativeRule,oddRule,positiveRule};//# sourceMappingURL=number-rules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-rules.js","sources":["../../../src/rules/number/number-rules.ts"],"sourcesContent":[null],"names":[],"mappings":"wGAGA;;AAEG;AACU,MAAA,OAAO,GAAgC;AAClD,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,mBAAmB,EAAE,kCAAkC;AACvD,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,IAAI,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;AACrC,YAAA,OAAO,UAAU,CAAC;AACnB,SAAA;AACD,QAAA,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;EACD;AAEF;;AAEG;AACU,MAAA,OAAO,GAAgC;AAClD,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,mBAAmB,EAAE,4CAA4C;AACjE,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,IAAI,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;AACrC,YAAA,OAAO,UAAU,CAAC;AACnB,SAAA;AACD,QAAA,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;EACD;AAEF;;AAEG;AACU,MAAA,YAAY,GAAe;AACtC,IAAA,IAAI,EAAE,UAAU;AAChB,IAAA,mBAAmB,EAAE,sCAAsC;AAC3D,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,IAAI,KAAK,GAAG,CAAC,EAAE;AACb,YAAA,OAAO,UAAU,CAAC;AACn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pC,IAAI,UAAU,KAAK,SAAS,EAAE;AAC5B,gBAAA,OAAO,UAAU,CAAC;AACnB,aAAA;AAED,YAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAChC,YAAA,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE;AACrB,gBAAA,OAAO,UAAU,CAAC;AACnB,aAAA;AACF,SAAA;AAED,QAAA,IAAI,KAAK,IAAI,UAAU,IAAI,KAAK,IAAI,UAAU,EAAE;AAC7C,YAAA,IAAI,CAAC,OAAO,CAAC,OAAe,CAAC,cAAc;AAC1C,gBAAA,CAAA,EAAG,UAAU,CAAA,KAAA,EAAQ,UAAU,CAAA,CAAE,CAAC;AACpC,YAAA,OAAO,UAAU,CAAC;AACnB,SAAA;AACD,QAAA,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACnC;"}
@@ -6,10 +6,74 @@ import { StringValidator } from "./string-validator";
6
6
  */
7
7
  export declare class NumberValidator extends BaseValidator {
8
8
  constructor(errorMessage?: string);
9
- /** Value must be equal or higher than the given number */
10
- min(min: number, errorMessage?: string): this;
11
- /** Value must be equal or less than the given number */
12
- max(max: number, errorMessage?: string): this;
9
+ /**
10
+ * Value must be equal or higher than the given number or field
11
+ * Smart detection: number or field name
12
+ *
13
+ * @category Validation Rule
14
+ */
15
+ min(min: number | string, errorMessage?: string): this;
16
+ /**
17
+ * Value must be equal or less than the given number or field
18
+ * Smart detection: number or field name
19
+ *
20
+ * @category Validation Rule
21
+ */
22
+ max(max: number | string, errorMessage?: string): this;
23
+ /**
24
+ * Value must be >= sibling field value
25
+ * @category Validation Rule
26
+ */
27
+ minSibling(field: string, errorMessage?: string): this;
28
+ /**
29
+ * Value must be <= sibling field value
30
+ * @category Validation Rule
31
+ */
32
+ maxSibling(field: string, errorMessage?: string): this;
33
+ /**
34
+ * Value must be strictly greater than the given number or field (>)
35
+ * Smart detection: number or field name
36
+ *
37
+ * @category Validation Rule
38
+ */
39
+ greaterThan(value: number | string, errorMessage?: string): this;
40
+ /**
41
+ * Value must be strictly less than the given number or field (<)
42
+ * Smart detection: number or field name
43
+ *
44
+ * @category Validation Rule
45
+ */
46
+ lessThan(value: number | string, errorMessage?: string): this;
47
+ /**
48
+ * Alias for greaterThan() - shorter syntax
49
+ * @category Validation Rule
50
+ */
51
+ gt(value: number | string, errorMessage?: string): this;
52
+ /**
53
+ * Alias for lessThan() - shorter syntax
54
+ * @category Validation Rule
55
+ */
56
+ lt(value: number | string, errorMessage?: string): this;
57
+ /**
58
+ * Value must be > sibling field value
59
+ * @category Validation Rule
60
+ */
61
+ greaterThanSibling(field: string, errorMessage?: string): this;
62
+ /**
63
+ * Alias for greaterThanSibling() - shorter syntax
64
+ * @category Validation Rule
65
+ */
66
+ gtSibling(field: string, errorMessage?: string): this;
67
+ /**
68
+ * Value must be < sibling field value
69
+ * @category Validation Rule
70
+ */
71
+ lessThanSibling(field: string, errorMessage?: string): this;
72
+ /**
73
+ * Alias for lessThanSibling() - shorter syntax
74
+ * @category Validation Rule
75
+ */
76
+ ltSibling(field: string, errorMessage?: string): this;
13
77
  /** Value must be a modulo of the given number */
14
78
  modulo(value: number, errorMessage?: string): this;
15
79
  /** Accept only numbers higher than 0 */
@@ -20,8 +84,18 @@ export declare class NumberValidator extends BaseValidator {
20
84
  odd(errorMessage?: string): this;
21
85
  /** Accept only even numbers */
22
86
  even(errorMessage?: string): this;
23
- /** Accept only numbers between the given two numbers (Inclusive) */
24
- between(min: number, max: number, errorMessage?: string): this;
87
+ /**
88
+ * Accept only numbers between the given two numbers or fields (Inclusive)
89
+ * Smart detection: number or field name
90
+ *
91
+ * @category Validation Rule
92
+ */
93
+ between(min: number | string, max: number | string, errorMessage?: string): this;
94
+ /**
95
+ * Value must be between sibling field values
96
+ * @category Validation Rule
97
+ */
98
+ betweenSibling(minField: string, maxField: string, errorMessage?: string): this;
25
99
  enum: (values: any, errorMessage?: string) => ScalarValidator;
26
100
  in: (values: any[], errorMessage?: string) => ScalarValidator;
27
101
  oneOf: (values: any[], errorMessage?: string) => ScalarValidator;
@@ -1 +1 @@
1
- {"version":3,"file":"number-validator.d.ts","sourceRoot":"","sources":["../../src/validators/number-validator.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;gBAC7B,YAAY,CAAC,EAAE,MAAM;IAMxC,0DAA0D;IACnD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAM7C,wDAAwD;IACjD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAM7C,iDAAiD;IAC1C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAMlD,wCAAwC;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM;IAKrC,mCAAmC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM;IAKrC,8BAA8B;IACvB,GAAG,CAAC,YAAY,CAAC,EAAE,MAAM;IAKhC,+BAA+B;IACxB,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM;IAKjC,oEAAoE;IAC7D,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAQvD,IAAI,0DAAkC;IACtC,EAAE,4DAAgC;IAClC,KAAK,4DAAgC;IACrC,UAAU,4DAAwC;IAClD,OAAO,4DAAqC;IAC5C,KAAK,4DAAqC;IAG1C,MAAM,6DAAoC;IAC1C,SAAS,6DAAuC;IAChD,SAAS,6DAAuC;CAKxD"}
1
+ {"version":3,"file":"number-validator.d.ts","sourceRoot":"","sources":["../../src/validators/number-validator.ts"],"names":[],"mappings":"A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,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAIrD,iDAAiD;IAC1C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAMlD,wCAAwC;IACjC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM;IAKrC,mCAAmC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM;IAKrC,8BAA8B;IACvB,GAAG,CAAC,YAAY,CAAC,EAAE,MAAM;IAKhC,+BAA+B;IACxB,IAAI,CAAC,YAAY,CAAC,EAAE,MAAM;IAKjC;;;;;OAKG;IACI,OAAO,CACZ,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM;IASvB;;;OAGG;IACI,cAAc,CACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM;IAUhB,IAAI,0DAAkC;IACtC,EAAE,4DAAgC;IAClC,KAAK,4DAAgC;IACrC,UAAU,4DAAwC;IAClD,OAAO,4DAAqC;IAC5C,KAAK,4DAAqC;IAG1C,MAAM,6DAAoC;IAC1C,SAAS,6DAAuC;IAChD,SAAS,6DAAuC;CAKxD"}
@@ -1,4 +1,4 @@
1
- import'@mongez/reinforcements';import'@mongez/supportive-is';import'dayjs';import {numberMutator}from'../mutators/number-mutators.js';import'net';import {minRule,maxRule,moduloRule,positiveRule,negativeRule,oddRule,evenRule,betweenNumbersRule}from'../rules/number/number-rules.js';import {numberRule}from'../rules/common/type-rules.js';import {BaseValidator}from'./base-validator.js';import {ScalarValidator}from'./scalar-validator.js';import {StringValidator}from'./string-validator.js';/**
1
+ import'@mongez/reinforcements';import'@mongez/supportive-is';import'dayjs';import {numberMutator}from'../mutators/number-mutators.js';import'net';import {minRule,maxRule,greaterThanRule,lessThanRule,moduloRule,positiveRule,negativeRule,oddRule,evenRule,betweenNumbersRule}from'../rules/number/number-rules.js';import {numberRule}from'../rules/common/type-rules.js';import {BaseValidator}from'./base-validator.js';import {ScalarValidator}from'./scalar-validator.js';import {StringValidator}from'./string-validator.js';/**
2
2
  * Number validator class - base for Int and Float validators
3
3
  */
4
4
  class NumberValidator extends BaseValidator {
@@ -7,18 +7,122 @@ class NumberValidator extends BaseValidator {
7
7
  this.addRule(numberRule, errorMessage);
8
8
  this.addMutator(numberMutator);
9
9
  }
10
- /** Value must be equal or higher than the given number */
10
+ /**
11
+ * Value must be equal or higher than the given number or field
12
+ * Smart detection: number or field name
13
+ *
14
+ * @category Validation Rule
15
+ */
11
16
  min(min, errorMessage) {
12
17
  const rule = this.addRule(minRule, errorMessage);
13
18
  rule.context.options.min = min;
19
+ rule.context.options.scope = "global";
14
20
  return this;
15
21
  }
16
- /** Value must be equal or less than the given number */
22
+ /**
23
+ * Value must be equal or less than the given number or field
24
+ * Smart detection: number or field name
25
+ *
26
+ * @category Validation Rule
27
+ */
17
28
  max(max, errorMessage) {
18
29
  const rule = this.addRule(maxRule, errorMessage);
19
30
  rule.context.options.max = max;
31
+ rule.context.options.scope = "global";
20
32
  return this;
21
33
  }
34
+ /**
35
+ * Value must be >= sibling field value
36
+ * @category Validation Rule
37
+ */
38
+ minSibling(field, errorMessage) {
39
+ const rule = this.addRule(minRule, errorMessage);
40
+ rule.context.options.min = field;
41
+ rule.context.options.scope = "sibling";
42
+ return this;
43
+ }
44
+ /**
45
+ * Value must be <= sibling field value
46
+ * @category Validation Rule
47
+ */
48
+ maxSibling(field, errorMessage) {
49
+ const rule = this.addRule(maxRule, errorMessage);
50
+ rule.context.options.max = field;
51
+ rule.context.options.scope = "sibling";
52
+ return this;
53
+ }
54
+ /**
55
+ * Value must be strictly greater than the given number or field (>)
56
+ * Smart detection: number or field name
57
+ *
58
+ * @category Validation Rule
59
+ */
60
+ greaterThan(value, errorMessage) {
61
+ const rule = this.addRule(greaterThanRule, errorMessage);
62
+ rule.context.options.value = value;
63
+ rule.context.options.scope = "global";
64
+ return this;
65
+ }
66
+ /**
67
+ * Value must be strictly less than the given number or field (<)
68
+ * Smart detection: number or field name
69
+ *
70
+ * @category Validation Rule
71
+ */
72
+ lessThan(value, errorMessage) {
73
+ const rule = this.addRule(lessThanRule, errorMessage);
74
+ rule.context.options.value = value;
75
+ rule.context.options.scope = "global";
76
+ return this;
77
+ }
78
+ /**
79
+ * Alias for greaterThan() - shorter syntax
80
+ * @category Validation Rule
81
+ */
82
+ gt(value, errorMessage) {
83
+ return this.greaterThan(value, errorMessage);
84
+ }
85
+ /**
86
+ * Alias for lessThan() - shorter syntax
87
+ * @category Validation Rule
88
+ */
89
+ lt(value, errorMessage) {
90
+ return this.lessThan(value, errorMessage);
91
+ }
92
+ /**
93
+ * Value must be > sibling field value
94
+ * @category Validation Rule
95
+ */
96
+ greaterThanSibling(field, errorMessage) {
97
+ const rule = this.addRule(greaterThanRule, errorMessage);
98
+ rule.context.options.value = field;
99
+ rule.context.options.scope = "sibling";
100
+ return this;
101
+ }
102
+ /**
103
+ * Alias for greaterThanSibling() - shorter syntax
104
+ * @category Validation Rule
105
+ */
106
+ gtSibling(field, errorMessage) {
107
+ return this.greaterThanSibling(field, errorMessage);
108
+ }
109
+ /**
110
+ * Value must be < sibling field value
111
+ * @category Validation Rule
112
+ */
113
+ lessThanSibling(field, errorMessage) {
114
+ const rule = this.addRule(lessThanRule, errorMessage);
115
+ rule.context.options.value = field;
116
+ rule.context.options.scope = "sibling";
117
+ return this;
118
+ }
119
+ /**
120
+ * Alias for lessThanSibling() - shorter syntax
121
+ * @category Validation Rule
122
+ */
123
+ ltSibling(field, errorMessage) {
124
+ return this.lessThanSibling(field, errorMessage);
125
+ }
22
126
  /** Value must be a modulo of the given number */
23
127
  modulo(value, errorMessage) {
24
128
  const rule = this.addRule(moduloRule, errorMessage);
@@ -45,11 +149,28 @@ class NumberValidator extends BaseValidator {
45
149
  this.addRule(evenRule, errorMessage);
46
150
  return this;
47
151
  }
48
- /** Accept only numbers between the given two numbers (Inclusive) */
152
+ /**
153
+ * Accept only numbers between the given two numbers or fields (Inclusive)
154
+ * Smart detection: number or field name
155
+ *
156
+ * @category Validation Rule
157
+ */
49
158
  between(min, max, errorMessage) {
50
159
  const rule = this.addRule(betweenNumbersRule, errorMessage);
51
160
  rule.context.options.min = min;
52
161
  rule.context.options.max = max;
162
+ rule.context.options.scope = "global";
163
+ return this;
164
+ }
165
+ /**
166
+ * Value must be between sibling field values
167
+ * @category Validation Rule
168
+ */
169
+ betweenSibling(minField, maxField, errorMessage) {
170
+ const rule = this.addRule(betweenNumbersRule, errorMessage);
171
+ rule.context.options.min = minField;
172
+ rule.context.options.max = maxField;
173
+ rule.context.options.scope = "sibling";
53
174
  return this;
54
175
  }
55
176
  // Enum and value checking methods from ScalarValidator
@@ -1 +1 @@
1
- {"version":3,"file":"number-validator.js","sources":["../../src/validators/number-validator.ts"],"sourcesContent":[null],"names":[],"mappings":"weAgBA;;AAEG;AACG,MAAO,eAAgB,SAAQ,aAAa,CAAA;AAChD,IAAA,WAAA,CAAmB,YAAqB,EAAA;AACtC,QAAA,KAAK,EAAE,CAAC;AACR,QAAA,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AACvC,QAAA,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;KAChC;;IAGM,GAAG,CAAC,GAAW,EAAE,YAAqB,EAAA;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAC/B,QAAA,OAAO,IAAI,CAAC;KACb;;IAGM,GAAG,CAAC,GAAW,EAAE,YAAqB,EAAA;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,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KACb;AAED;;;AAGG;AACI,IAAA,cAAc,CACnB,QAAgB,EAChB,QAAgB,EAChB,YAAqB,EAAA;QAErB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;AACvC,QAAA,OAAO,IAAI,CAAC;KACb;;AAGM,IAAA,IAAI,GAAG,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC;AACtC,IAAA,EAAE,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;AAClC,IAAA,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC;AACrC,IAAA,UAAU,GAAG,eAAe,CAAC,SAAS,CAAC,UAAU,CAAC;AAClD,IAAA,OAAO,GAAG,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC;AAC5C,IAAA,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC;;AAG1C,IAAA,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC;AAC1C,IAAA,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC,SAAS,CAAC;AAChD,IAAA,SAAS,GAAG,eAAe,CAAC,SAAS,CAAC,SAAS,CAAC;AAKxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warlock.js/seal",
3
- "version": "3.0.14",
3
+ "version": "3.0.15",
4
4
  "description": "Comprehensive Validation library",
5
5
  "main": "./cjs/index.js",
6
6
  "dependencies": {