@capimjs/library-auth
Version:
Professional API using Clean Architecture and TDD. to group validators
1 lines • 3.85 kB
JavaScript
Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{RequiredFieldError:()=>RequiredFieldError,InvalidMimeTypeError:()=>InvalidMimeTypeError,TypeFieldError:()=>TypeFieldError,MaxFileSizeError:()=>MaxFileSizeError,InvalidFieldError:()=>InvalidFieldError,InvalidValueEndFieldError:()=>InvalidValueEndFieldError,InvalidValueStartFieldError:()=>InvalidValueStartFieldError,InvalidFieldStartFieldError:()=>InvalidFieldStartFieldError,InvalidFieldIncludesFieldError:()=>InvalidFieldIncludesFieldError,InvalidFieldEndsFieldError:()=>InvalidFieldEndsFieldError,DateNotError:()=>DateNotError,ArrayNotError:()=>ArrayNotError,DateBeforeError:()=>DateBeforeError,DateAfterError:()=>DateAfterError,InvalidUuidFieldError:()=>InvalidUuidFieldError,MinCharacterError:()=>MinCharacterError,MaxCharacterError:()=>MaxCharacterError,ValidateOptionError:()=>ValidateOptionError,NotOptionPassedError:()=>NotOptionPassedError});class RequiredFieldError extends Error{constructor(fieldName){const message=fieldName===undefined?"Field required":`The field ${fieldName} is required`;super(message);this.name="RequiredFieldError"}}class InvalidMimeTypeError extends Error{constructor(allowed){super(`Unsupported file. Allowed extensions: ${allowed.join(", ")}`);this.name="InvalidMimeTypeError"}}class TypeFieldError extends Error{constructor(field){super(`The field ${field} is invalid`);this.name="TypeFieldError"}}class MaxFileSizeError extends Error{constructor(maxSizeInMb){super(`File upload limit is ${maxSizeInMb}MB`);this.name="MaxFileSizeError"}}class InvalidFieldError extends Error{constructor(field){super(`The field ${field} is invalid`);this.name="InvalidFieldError"}}class InvalidValueEndFieldError extends Error{constructor(field){super(`The field ${field} invalid`);this.name="InvalidValueEndFieldError"}}class InvalidValueStartFieldError extends Error{constructor(field){super(`The field ${field} invalid`);this.name="InvalidValueStartFieldError"}}class InvalidFieldStartFieldError extends Error{constructor(field,startsValue){super(`The field ${field} not starts with ${startsValue}`);this.name="InvalidFieldStartFieldError"}}class InvalidFieldIncludesFieldError extends Error{constructor(field,includesValue){super(`The field ${field} not includes with ${includesValue}`);this.name="InvalidFieldIncludesFieldError"}}class InvalidFieldEndsFieldError extends Error{constructor(field,endssValue){super(`The field ${field} not ends with ${endssValue}`);this.name="InvalidFieldEndsFieldError"}}class DateNotError extends Error{constructor(field){super(`The field ${field} is not a date`);this.name="DateNotError"}}class ArrayNotError extends Error{constructor(field){super(`The field ${field} is not a array`);this.name="ArrayNotError"}}class DateBeforeError extends Error{constructor(field,value){super(`The field ${field} is before ${value}`);this.name="DateBeforeError"}}class DateAfterError extends Error{constructor(field,value){super(`The field ${field} is after ${value}`);this.name="DateAfterError"}}class InvalidUuidFieldError extends Error{constructor(field){field=field===undefined?"uuid":field;super(`The field ${field} is invalid`);this.name="InvalidUUidFieldError"}}class MinCharacterError extends Error{constructor(minNumber){super(`Min character is ${minNumber}`);this.name="MinCharacterError"}}class MaxCharacterError extends Error{constructor(maxNumber){super(`Max character is ${maxNumber}`);this.name="MaxCharacterError"}}class ValidateOptionError extends Error{constructor(options){super(`The option must be one of ${options.join(",")}`);this.name="ValidateOptionError"}}class NotOptionPassedError extends Error{constructor(){super("Should pass option");this.name="NotOptionPassedError"}}
;