UNPKG

@decaf-ts/decorator-validation

Version:
3 lines (2 loc) 40.4 kB
import{Metadata as e,DecorationKeys as t,Decoration as r}from"@decaf-ts/decoration";import"reflect-metadata";import{apply as s,metadata as a,Reflection as n,isEqual as o}from"@decaf-ts/reflection";import{__decorate as i,__metadata as c}from"tslib";const u={INVALID_PATH:"Invalid path argument. Expected non-empty string but received: '{0}'",CONTEXT_NOT_OBJECT_COMPARISON:"Unable to access parent at level {0} for path '{1}': current context is not an object",PROPERTY_INVALID:"Failed to resolve path {0}: property '{1}' is invalid or does not exist.",PROPERTY_NOT_EXIST:"Failed to resolve path: property '{0}' does not exist.",UNSUPPORTED_TYPES_COMPARISON:"Unsupported types for comparison: '{0}' and '{1}'",NULL_OR_UNDEFINED_COMPARISON:"Comparison failed due to null or undefined value",INVALID_DATE_COMPARISON:"Invalid Date objects are not comparable",TYPE_MISMATCH_COMPARISON:"Cannot compare values of different types: {0} and {1}.",NAN_COMPARISON:"Comparison not supported for NaN values"},l=Symbol("_parent"),d=Symbol("isAsync");var f;(e=>{e.REFLECT="decaf.model.",e.DESCRIPTION="decaf.description.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__model",e.CONSTRUCTION="constructed-by",e.ATTRIBUTE="__attributes",e.HASHING="hashing",e.SERIALIZATION="serialization"})(f||(f={}));const g="decaf",p={EQUALS:"equals",DIFF:"different",LESS_THAN:"lessThan",LESS_THAN_OR_EQUAL:"lessThanOrEqual",GREATER_THAN:"greaterThan",GREATER_THAN_OR_EQUAL:"greaterThanOrEqual"},h={REFLECT:f.REFLECT+"validation.",DATE:"date",EMAIL:"email",FORMAT:"format",LIST:"list",MAX:"max",MAX_LENGTH:"maxlength",MIN:"min",MIN_LENGTH:"minlength",PASSWORD:"password",PATTERN:"pattern",REQUIRED:"required",STEP:"step",TYPE:"type",UNIQUE:"unique",URL:"url",VALIDATOR:"validator",...p},y=["January","February","March","April","May","June","July","August","September","October","November","December"],m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],E={REQUIRED:"This field is required",MIN:"The minimum value is {0}",MAX:"The maximum value is {0}",MIN_LENGTH:"The minimum length is {0}",MAX_LENGTH:"The maximum length is {0}",PATTERN:"The value does not match the pattern",EMAIL:"The value is not a valid email",URL:"The value is not a valid URL",TYPE:"Invalid type. Expected {0}, received {1}",STEP:"Invalid value. Not a step of {0}",DATE:"Invalid value. not a valid Date",DEFAULT:"There is an Error",PASSWORD:"Must be at least 8 characters and contain one of number, lower and upper case letters, and special character (@$!%*?&_-.,)",LIST:"Invalid list of {0}",MODEL_NOT_FOUND:"No model registered under {0}",EQUALS:"This field must be equal to field {0}",DIFF:"This field must be different from field {0}",LESS_THAN:"This field must be less than field {0}",LESS_THAN_OR_EQUAL:"This field must be less than or equal to field {0}",GREATER_THAN:"This field must be greater than field {0}",GREATER_THAN_OR_EQUAL:"This field must be greater than or equal to field {0}",UNIQUE:"Duplicate found, this field must be unique."},T={EMAIL:/[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,URL:/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i,PASSWORD:{CHAR8_ONE_OF_EACH:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&_\-.,])[A-Za-z\d@$!%*?&_\-.,]{8,}$/g}};function A(e,...t){return e.replace(/{(\d+)}/g,(e,r)=>void 0!==t[r]?t[r].toString():"undefined")}const b=A;function N(e,t){let r=t;r.match(/hh/)?r=r.replace("hh","(?<hour>\\d{2})"):r.match(/h/)?r=r.replace("h","(?<hour>\\d{1,2})"):r.match(/HH/)?r=r.replace("HH","(?<hour>\\d{2})"):r.match(/H/)&&(r=r.replace("H","(?<hour>\\d{1,2})")),r.match(/mm/)?r=r.replace("mm","(?<minutes>\\d{2})"):r.match(/m/)&&(r=r.replace("m","(?<minutes>\\d{1,2})")),r.match(/ss/)?r=r.replace("ss","(?<seconds>\\d{2})"):r.match(/s/)&&(r=r.replace("s","(?<seconds>\\d{1,2})")),r.match(/dd/)?r=r.replace("dd","(?<day>\\d{2})"):r.match(/d/)&&(r=r.replace("d","(?<day>\\d{1,2})")),r.match(/EEEE/)?r=r.replace("EEEE","(?<dayofweek>\\w+)"):r.match(/EEEE/)&&(r=r.replace("EEE","(?<dayofweek>\\w+)")),r.match(/yyyy/)?r=r.replace("yyyy","(?<year>\\d{4})"):r.match(/yy/)&&(r=r.replace("yy","(?<year>\\d{2})")),r.match(/MMMM/)?r=r.replace("MMMM","(?<monthname>\\w+)"):r.match(/MMM/)&&(r=r.replace("MMM","(?<monthnamesmall>\\w+)")),r.match(/MM/)?r=r.replace("MM","(?<month>\\d{2})"):r.match(/M/)&&(r=r.replace("M","(?<month>\\d{1,2})")),r=r.replace("S","(?<milis>\\d{1,3})").replace("aaa","(?<ampm>\\w{2})");const s=RegExp(r,"g").exec(e);if(!s||!s.groups)return new Date(e);const a=e=>{if(!e)return 0;const t=parseInt(e);return isNaN(t)?0:t},n=a(s.groups.year),o=a(s.groups.day),i=s.groups.ampm;let c=a(s.groups.hour);i&&(c="PM"===i?c+12:c);const u=a(s.groups.minutes),l=a(s.groups.seconds),d=a(s.groups.milis),f=s.groups.monthname,g=s.groups.monthnamesmall;let p=s.groups.month;if(f)p=y.indexOf(f);else if(g){const t=y.find(e=>e.toLowerCase().startsWith(g.toLowerCase()));if(!t)return new Date(e);p=y.indexOf(t)}else p=a(""+p);return new Date(n,p-1,o,c,u,l,d)}function S(e,t){if(e)return Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:new Proxy(e.toISOString,{apply:(e,r)=>M(r,t)})}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:new Proxy(e.toISOString,{apply:(e,r)=>M(r,t)})}),e}function O(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!Number.isNaN(e)}function R(e){return 10>e?"0"+e:e.toString()}function M(e,t="yyyy/MM/dd"){const r=e.getDate(),s=e.getMonth(),a=e.getFullYear(),n=e.getHours(),o=e.getMinutes(),i=e.getSeconds(),c=e.getMilliseconds(),u=n%12,l=R(u),d=R(n),f=R(o),g=R(i),p=12>n?"AM":"PM",h=m[e.getDay()],E=h.substr(0,3),T=R(r),A=s+1,b=R(A),N=y[s],S=N.substr(0,3),O=a+"",M=O.substr(2,2);return(t=t.replace("hh",l).replace("h",u.toString()).replace("HH",d).replace("H",n.toString()).replace("mm",f).replace("m",o.toString()).replace("ss",g).replace("s",i.toString()).replace("S",c.toString()).replace("dd",T).replace("d",r.toString()).replace("EEEE",h).replace("EEE",E).replace("yyyy",O).replace("yy",M).replace("aaa",p)).indexOf("MMM")>-1?t.replace("MMMM",N).replace("MMM",S):t.replace("MM",b).replace("M",A.toString())}function P(e,t){let r;if(t){if(t instanceof Date)try{r=N(M(t,e),e)}catch(r){throw Error(b("Could not convert date {0} to format: {1}",t.toString(),e))}else if("string"==typeof t)r=N(t,e);else if("number"==typeof t)r=N(M(new Date(t),e),e);else{if(!O(t))throw Error("Invalid value provided "+t);try{r=N(M(new Date(t),e),e)}catch(r){throw Error(b("Could not convert date {0} to format: {1}",t,e))}}return S(r,e)}}function _(e){return g}class v{static{this.decorators={}}static{this.flavourResolver=_}constructor(e=g){this.flavour=e}for(e){return this.key=e,this}decorate(e=!1,...t){if(!this.key)throw Error("key must be provided before decorators can be added");if(!(t&&t.length||e||this.flavour===g))throw Error("Must provide overrides or addons to override or extend decaf's decorators");if(this.flavour===g&&e)throw Error("Default flavour cannot be extended");return this[e?"extras":"decorators"]=new Set([...(this[e?"extras":"decorators"]||new Set).values(),...t]),this}define(...e){return this.decorate(!1,...e)}extend(...e){return this.decorate(!0,...e)}decoratorFactory(e,t=g){const r=(t,r,s)=>{const a=v.flavourResolver(t),n=v.decorators[e];let o;const i=n[a]?n[a].extras:n[g].extras,c=[...n[g].extras?n[g].extras.values():[]].reduce((e,t,r)=>(t.args&&(e[r]=t.args),e),{});o=n&&n[a]&&n[a].decorators&&n[a].decorators.size?n[a].decorators:n[g].decorators;const u=[...n[g].decorators.values()].reduce((e,t,r)=>(t.args&&(e[r]=t.args),e),{});return[...o?o.values():[],...i?i.values():[]].reduce((e,a,n)=>{switch(typeof a){case"object":{const{decorator:e,args:i,transform:l}=a,d=i||n<(o?o.size:0)?u[n]:c[n-(o?o.size:0)]||(o?u[n-o.size]:[]);return e(...l?l(d||[]):d||[])(t,r,s)}case"function":return a(t,r,s);default:throw Error("Unexpected decorator type: "+typeof a)}},{target:t,propertyKey:r,descriptor:s})};return Object.defineProperty(r,"name",{value:[t,e].join("_decorator_for_"),writable:!1}),r}apply(){if(!this.key)throw Error("No key provided for the decoration builder");return v.register(this.key,this.flavour,this.decorators||new Set,this.extras),this.decoratorFactory(this.key,this.flavour)}static register(e,t,r,s){if(!e)throw Error("No key provided for the decoration builder");if(!r)throw Error("No decorators provided for the decoration builder");if(!t)throw Error("No flavour provided for the decoration builder");v.decorators[e]||(v.decorators[e]={}),v.decorators[e][t]||(v.decorators[e][t]={}),r&&(v.decorators[e][t].decorators=r),s&&(v.decorators[e][t].extras=s)}static setFlavourResolver(e){v.flavourResolver=e}static for(e){return(new v).for(e)}static flavouredAs(e){return new v(e)}}function I(e=f.ATTRIBUTE){return v.for(e).define((t,r)=>{let s;Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!1,value:[]}),s=t[e],s.includes(r)||s.push(r)}).apply()}function L(e,t){return s(I(),a(e,t))}function w(e){e+="";let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t.toString()}function D(e){const t=(e,t)=>{const r=s(t);return"string"==typeof r?s((e||"")+s(t)):(e=((e=e||0)<<5)-e+r)&e},r=w,s=e=>void 0===e?"":-1!==["string","number","symbol"].indexOf(typeof e)?r(e.toString()):e instanceof Date?r(e.getTime()):Array.isArray(e)?e.reduce(t,void 0):Object.values(e).reduce(t,void 0),a=Object.values(e).reduce(t,0);return("number"==typeof a?Math.abs(a):a).toString()}const j="default";class H{static{this.current=j}static{this.cache={default:D}}constructor(){}static get(e){if(e in this.cache)return this.cache[e];throw Error("No hashing method registered under "+e)}static register(e,t,r=!1){if(e in this.cache)throw Error(`Hashing method ${e} already registered`);this.cache[e]=t,r&&(this.current=e)}static hash(e,t,...r){return t?this.get(t)(e,...r):this.get(this.current)(e,...r)}static setDefault(e){this.current=this.get(e)}}const U=e=>e[l],k=(e,t)=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw Error(b(u.PROPERTY_NOT_EXIST,t));return e[t]};class C{static create(e,t){const{getValue:r,getParent:s,ignoreUndefined:a,ignoreNull:n}={getParent:U,getValue:k,ignoreNull:!1,ignoreUndefined:!1,...t},o=new Proxy({},{get:(t,o)=>"getValueFromPath"===o?t=>{const o=C.parsePath(t);let i=e;for(let e=0;e<o.length;e++){const c=o[e];if(".."===c){const r=s(i);if(!r||"object"!=typeof r)throw Error(b(u.CONTEXT_NOT_OBJECT_COMPARISON,e+1,t));i=r;continue}if(i=r(i,c),!a&&void 0===i)throw Error(b(u.PROPERTY_INVALID,t,c));if(!n&&null===i)throw Error(b(u.PROPERTY_INVALID,t,c))}return i}:t[o]});return o}static parsePath(e){if("string"!=typeof e||!e.trim())throw Error(b(u.INVALID_PATH,e));return e.match(/(\.\.|[^/.]+)/g)||[]}}class x{constructor(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t]&&Object.defineProperty(this,t,{enumerable:!0,configurable:!1,value:e[t],writable:!1})}toString(){const e=this;return Object.keys(e).filter(t=>Object.prototype.hasOwnProperty.call(e,t)&&"function"!=typeof e[t]).reduce((t,r)=>{let s=Object.keys(e[r]).reduce((t,s)=>(t?t+="\n"+e[r][s]:t=e[r][s],t),void 0);return s&&(s=`${r} - ${s}`,t?t+="\n"+s:t=s),t},"")}}class z{constructor(e,t=E.DEFAULT,...r){this.async=e,this.message=t,r.length&&(this.acceptedTypes=r),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(e,...t){return b(e,...t)}checkTypeAndHasErrors(e){return function(t,r,s,...a){return void 0!==t&&this.acceptedTypes?n.checkTypes(t,this.acceptedTypes)?e(t,r,s,...a):this.getMessage(E.TYPE,this.acceptedTypes.join(", "),typeof t):e(t,r,s,...a)}.bind(this)}static isValidator(e){return e.constructor&&!!e.hasErrors}}class F extends z{constructor(e=E.DEFAULT,...t){super(!1,e,...t)}}class Y{constructor(...e){this.cache={},this.customKeyCache={},this.register(...e)}getCustomKeys(){return Object.assign({},this.customKeyCache)}getKeys(){return Object.keys(this.cache)}get(e){if(!(e in this.cache))return;const t=this.cache[e];if(F.isValidator(t))return t;const r=new(t.default||t);return this.cache[e]=r,r}register(...e){e.forEach(e=>{if(F.isValidator(e)){if(e.validationKey in this.cache)return;this.cache[e.validationKey]=e}else{const{validationKey:t,validator:r,save:s}=e;if(t in this.cache)return;if(this.cache[t]=r,!s)return;const a={};a[t.toUpperCase()]=t,this.customKeyCache=Object.assign({},this.customKeyCache,a)}})}}class G{static{this.actingValidatorRegistry=void 0}static{this.loadedDecorators={}}constructor(){}static setRegistry(e,t){t&&G.actingValidatorRegistry&&G.actingValidatorRegistry.getKeys().forEach(r=>{const s=e.get(r);s&&e.register(t(s))}),G.actingValidatorRegistry=e}static getRegistry(){return G.actingValidatorRegistry||(G.actingValidatorRegistry=new Y),G.actingValidatorRegistry}static get(e){return G.getRegistry().get(e)}static register(...e){return G.getRegistry().register(...e)}static key(e){return h.REFLECT+e}static keys(){return this.getRegistry().getKeys()}static registerDecorator(e,t){e in this.loadedDecorators||(this.loadedDecorators[e]=t)}static decoratorFromKey(e){if(!(e in this.loadedDecorators))throw Error("No decorator registered under "+e);return this.loadedDecorators[e]}}function Q(e){return f.REFLECT+e}function V(e){const t=Reflect.getMetadata(Q(f.MODEL),e.constructor);if(!t)throw Error("could not find metadata for provided "+e.constructor.name);return t}function $(e,t){return t?Promise.resolve(e):e}function K(e,t,r=h.REFLECT){return n.getPropertyDecorators(r,e,t)}function X(e,t){const r=[];for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&!t.includes(s)){const t=K(e,s);t&&r.push(t)}return r}function q(e,t,r){Object.hasOwnProperty.call(e,t)||(e[t]=r)}function B(e,t){Object.hasOwnProperty.call(e,t)&&delete e[t]}function Z(e,t,r,...s){t&&q(e,l,t),q(e,d,!!r);const a=e.hasErrors(...s);return B(e,l),B(e,d),a}function W(e,t,r,s,a,...n){let o,i=!1;for(const c of s){const s=ue.get(c);if(s||(o=new x({[e]:{[h.TYPE]:"Unable to verify type consistency, missing model registry for "+c}})),t instanceof s){i=!0,o=Z(t,r,a,...n);break}}return i?o:o||new x({[e]:{[h.TYPE]:"Value must be an instance of one of the expected types: "+s.join(", ")}})}function J(e,t,r,s){const a=G.get(r.key);if(!a)throw Error("Missing validator for "+r.key);if(!s&&r.props.async)return;const n=r.key===f.TYPE?[r.props]:r.props||{},o=C.create(e,{ignoreUndefined:!0,ignoreNull:!0}),i=r.key===f.TYPE?{type:n[0].name}:n;return $(a.hasErrors(t,i,o),s)}function ee(e,t,r,s,a,...n){const o={};for(const i of s){if(!a&&i.props.async)continue;let s=J(e,r,i,a);if(i.key===h.LIST&&(!s||a)){const o=r instanceof Set?[...r]:r;if(o&&o.length>0){let r=i.props.class||i.props.clazz||i.props.customTypes;r=(Array.isArray(r)?r:[r]).map(e=>(e="function"!=typeof e||e.name?e:e()).name?e.name:e);const c=[r].flat().map(e=>(e+"").toLowerCase()),u=o.map(s=>ue.isModel(s)?W(t,s,e,r.flat(),!!a,...n):c.includes(typeof s)?void 0:"Value has no validatable type");if(a)s=Promise.all(u).then(e=>e.every(e=>!e)?void 0:e);else{const e=u.every(e=>!e);s=u.length>0&&!e?u:void 0}}}const c=i.key===f.TYPE?h.TYPE:i.key;s&&(o[c]=s)}if(!a)return Object.keys(o).length>0?o:void 0;const i=Object.keys(o),c=Object.values(o);return Promise.all(c).then(e=>{const t={};for(let r=0;r<e.length;r++){const s=e[r];void 0!==s&&(t[i[r]]=s)}return Object.keys(t).length>0?t:void 0})}function te(e,t,...r){const s=X(e,r),a={},n={};for(const{prop:o,decorators:i}of s){const s=o+"";let c=e[o];if(!i?.length)continue;const u=[h.TYPE,f.TYPE].map(e=>i.find(t=>t.key===e)).find(Boolean);if(u?.key===h.TYPE&&i.splice(0,i.length,...i.filter(e=>e.key!==f.TYPE)),!u)continue;const l=u.props.class||u.props.clazz||u.props.customTypes||u.props.name;u.key===f.TYPE&&"Object"===l&&i.shift();const d=(Array.isArray(l)?l:[l]).map(e=>(e="function"!=typeof e||e.name?e:e()).name?e.name:e);if(d.some(e=>[Array.name,Set.name].includes(e))){if(!i.some(e=>e.key===h.LIST)){a[s]={[h.TYPE]:`Array or Set property '${s}' requires a @list decorator`};continue}if(c&&!(Array.isArray(c)||c instanceof Set)){a[s]={[h.TYPE]:`Property '${o+""}' must be either an Array or a Set`};continue}for(let e=i.length-1;e>=0;e--)i[e].key===f.TYPE&&i.splice(e,1);c=c instanceof Set?[...c]:c}const g=ee(e,s,c,i,t,...r)||{};if(ue.isPropertyModel(e,s)&&null!=c){const a=c;if("object"!=typeof a||"function"!=typeof a.hasErrors);else{const o=(Array.isArray(l)?l:[l]).map(e=>("function"!=typeof e||e.name||(e=e()),ue.get(e.name||e))).find(e=>!!e);o&&a instanceof o?n[s]=Z(a,e,t,...r):(g[h.TYPE]=o?"Value must be an instance of "+o.name:`Unable to verify type consistency, missing model registry for ${d.toString()} on prop ${s}`,delete g[f.TYPE])}}(Object.keys(g).length>0||t)&&(a[s]=g),t||Object.entries(n[s]||{}).forEach(([e,t])=>{void 0!==t&&(a[`${s}.${e}`]=t)})}if(!t)return Object.keys(a).length>0?new x(a):void 0;const o=a,i=Object.keys(o),c=Object.values(o);return Promise.allSettled(c).then(async e=>{const t={};for(const[e,r]of Object.entries(n)){const s=await r;s&&Object.entries(s).forEach(([r,s])=>{void 0!==s&&(t[[e,r].join(".")]=s)})}for(let r=0;r<e.length;r++){const s=i[r],a=e[r];"fulfilled"===a.status&&void 0!==a.value?t[s]=a.value:"rejected"===a.status&&(t[s]=a.reason instanceof Error?a.reason.message:(a.reason||"Validation failed")+"")}return Object.keys(t).length>0?new x(t):void 0})}var re,se;(e=>{e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"})(re||(re={})),(e=>{e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"})(se||(se={}));const ae=["string","array","number","boolean","symbol","function","object","undefined","null","bigint"];let ne,oe;class ie{constructor(e=ue.isModel){this.cache={},this.testFunction=e}register(e,t){if("function"!=typeof e)throw Error("Model registering failed. Missing Class name or constructor");t=t||e.name,this.cache[t]=e}get(e){try{return this.cache[e]}catch(e){return}}build(e={},t){if(!t&&!this.testFunction(e))throw Error("Provided obj is not a Model object");const r=t||ue.getMetadata(e);if(!(r in this.cache))throw Error(`Provided class ${r} is not a registered Model object`);return new this.cache[r](e)}}function ce(...e){e.forEach(e=>{const t=e.constructor?e.constructor:e;ue.register(t,e.name)})}class ue{constructor(e=void 0){}isAsync(){return!!(this[d]??this?.constructor[d])}hasErrors(...e){return te(this,this.isAsync(),...e)}equals(e,...t){return o(this,e,...t)}serialize(){return ue.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}hash(){return ue.hash(this)}static deserialize(e){const t=Reflect.getMetadata(ue.key(f.SERIALIZATION),this.constructor);return t&&t.serializer?fe.deserialize(e,t.serializer,...t.args||[]):fe.deserialize(e)}static fromObject(e,t){t||(t={});for(const r of ue.getAttributes(e))e[r]=t[r]??e[r]??void 0;return e}static fromModel(e,t){let r,s;t||(t={});const a=ue.getAttributes(e),o=Object.getPrototypeOf(e);let i;for(const c of a){try{e[c]=t[c]??e[c]??void 0}catch(e){if(i=Object.getOwnPropertyDescriptor(o,c),!i||i.writable)throw Error(`Unable to write property ${c} to model: ${e}`)}if("object"!=typeof e[c])continue;const a=ue.isPropertyModel(e,c);if(a){try{e[c]=ue.build(e[c],"string"==typeof a?a:void 0)}catch(e){}continue}const u=n.getPropertyDecorators(h.REFLECT,e,c).decorators;if(r=u.filter(e=>-1!==[f.TYPE,h.TYPE].indexOf(e.key)),!r||!r.length)throw Error("failed to find decorators for property "+c);s=r.pop();const l=s.props.name?[s.props.name]:(Array.isArray(s.props.customTypes)?s.props.customTypes:[s.props.customTypes]).map(e=>"function"==typeof e?e():e),d=Object.values(se).map(e=>e.toLowerCase());l.forEach(t=>{if("function"==typeof t&&(t=t.name?t.name:t()),-1===d.indexOf(t.toLowerCase()))try{switch(t){case"Array":case"Set":if(u.length){const r=u.find(e=>e.key===h.LIST);if(r){let s=r.props.clazz.find(e=>(e=(e="function"==typeof e?e():e).name?e.name:e,!ae.includes(e)));if(s="string"==typeof s?s:s(),s="string"==typeof s?s:s.name,"Array"===t&&(e[c]=e[c].map(e=>["object","function"].includes(typeof e)&&s?ue.build(e,s):e)),"Set"===t){const t=new Set;for(const r of e[c])["object","function"].includes(typeof r)&&s?t.add(ue.build(r,s)):t.add(r);e[c]=t}}}break;default:void 0!==e[c]&&ue.get(t)&&(e[c]=ue.build(e[c],t))}}catch(e){}})}return e}static setBuilder(e){ne=e}static getBuilder(){return ne||ue.fromModel}static getRegistry(){return oe||(oe=new ie),oe}static setRegistry(e){oe=e}static register(e,t){return ue.getRegistry().register(e,t)}static get(e){return ue.getRegistry().get(e)}static build(e={},t){return ue.getRegistry().build(e,t)}static getMetadata(e){return V(e)}static getAttributes(e){const t=[];let r=e instanceof ue?Object.getPrototypeOf(e):e.prototype;for(;null!=r;){const e=r[f.ATTRIBUTE];e&&t.push(...e),r=Object.getPrototypeOf(r)}return t}static equals(e,t,...r){return o(e,t,...r)}static hasErrors(e,t,...r){return te(e,t,...r)}static serialize(e){const t=Reflect.getMetadata(ue.key(f.SERIALIZATION),e.constructor);return t&&t.serializer?fe.serialize(this,t.serializer,...t.args||[]):fe.serialize(e)}static hash(e){const t=Reflect.getMetadata(ue.key(f.HASHING),e.constructor);return t&&t.algorithm?H.hash(e,t.algorithm,...t.args||[]):H.hash(e)}static key(e){return Q(e)}static isModel(e){try{return e instanceof ue||!!ue.getMetadata(e)}catch(e){return!1}}static isPropertyModel(e,t){if(ue.isModel(e[t]))return!0;const r=Reflect.getMetadata(f.TYPE,e,t);return ue.get(r.name)?r.name:void 0}static describe(e,t){const r=ue.key(f.DESCRIPTION);return t?(e=e instanceof ue?e:new e,Reflect.getMetadataKeys(e.constructor,t.toString()).find(e=>e===r)?.toString()||e.toString()):Reflect.getMetadata(ue.key(f.DESCRIPTION),e instanceof ue?e.constructor:e)||e.toString()}}const le="json";class de{constructor(){}preSerialize(e){const t=Object.assign({},e),r=V(e);return t[f.ANCHOR]=r||e.constructor.name,t}deserialize(e){const t=JSON.parse(e),r=t[f.ANCHOR];if(!r)throw Error("Could not find class reference in serialized model");return ue.build(t,r)}serialize(e){return JSON.stringify(this.preSerialize(e))}}class fe{static{this.current=le}static{this.cache={json:new de}}constructor(){}static get(e){if(e in this.cache)return this.cache[e];throw Error("No serialization method registered under "+e)}static register(e,t,r=!1){if(e in this.cache)throw Error(`Serialization method ${e} already registered`);this.cache[e]=new t,r&&(this.current=e)}static serialize(e,t,...r){return t?this.get(t).serialize(e,...r):this.get(this.current).serialize(e,...r)}static deserialize(e,t,...r){return t?this.get(t).deserialize(e,...r):this.get(this.current).deserialize(e,...r)}static setDefault(e){this.current=this.get(e)}}class ge extends z{constructor(e=E.DEFAULT,...t){super(!0,e,...t)}}function pe(...e){return s(t=>(e.forEach(e=>{G.register({validator:t,validationKey:e,save:!0})}),t),a(G.key(h.VALIDATOR),e))}let he=class extends F{constructor(e=E.DATE){super(e,Number.name,Date.name,String.name)}hasErrors(e,t={}){if(void 0!==e&&("string"==typeof e&&(e=new Date(e)),Number.isNaN(e.getDate()))){const{message:e=""}=t;return this.getMessage(e||this.message)}}};he=i([pe(h.DATE),c("design:paramtypes",[String])],he);let ye=class extends F{constructor(e=E.DIFF){super(e)}hasErrors(e,t,r){let s;try{s=r.getValueFromPath(t[h.DIFF])}catch(e){return this.getMessage(e.message||this.message)}return o(e,s)?this.getMessage(t.message||this.message,t.label||t[h.DIFF]):void 0}};ye=i([pe(h.DIFF),c("design:paramtypes",[String])],ye);const me=RegExp("^/(.+)/([gimus]*)$");let Ee=class extends F{constructor(e=E.PATTERN){super(e,"string")}getPattern(e){if(!me.test(e))return RegExp(e);const t=e.match(me);return RegExp(t[1],t[2])}hasErrors(e,t){if(!e)return;let{pattern:r}=t;if(!r)throw Error("Missing Pattern");return r="string"==typeof r?this.getPattern(r):r,r.lastIndex=0,r.test(e)?void 0:this.getMessage(t.message||this.message)}};Ee=i([pe(h.PATTERN),c("design:paramtypes",[String])],Ee);let Te=class extends Ee{constructor(e=E.EMAIL){super(e)}hasErrors(e,t={}){return super.hasErrors(e,{...t,message:t.message||this.message,pattern:t?.pattern||T.EMAIL})}};Te=i([pe(h.EMAIL),c("design:paramtypes",[String])],Te);let Ae=class extends F{constructor(e=E.EQUALS){super(e)}hasErrors(e,t,r){let s;try{s=r.getValueFromPath(t[h.EQUALS])}catch(e){return this.getMessage(e.message||this.message)}return o(e,s)?void 0:this.getMessage(t.message||this.message,t.label||t[h.EQUALS])}};Ae=i([pe(h.EQUALS),c("design:paramtypes",[String])],Ae);const be=e=>null===e?"null":e instanceof Date?"Date":Number.isNaN(e)?"NaN":e===1/0?"Infinity":e===-1/0?"-Infinity":Array.isArray(e)?"array":typeof e,Ne=e=>void 0===e||e instanceof Date||"bigint"==typeof e||"number"==typeof e&&Number.isFinite(e);function Se(e,t){if(Ne(e)&&Ne(t))return!0;throw new TypeError(b(u.UNSUPPORTED_TYPES_COMPARISON,be(e),be(t)))}function Oe(e,t){if([null,void 0].includes(e)||[null,void 0].includes(t))throw Error(u.NULL_OR_UNDEFINED_COMPARISON);const r=typeof e,s=typeof t;if(r!==s){if("bigint"===r&&"number"===s)return t>Number(e);if("number"===r&&"bigint"===s)return Number(t)>e;throw new TypeError(b(u.TYPE_MISMATCH_COMPARISON,r,s))}if("number"===r&&"number"===s||"bigint"===r&&"bigint"===s){if(Number.isNaN(e)||Number.isNaN(t))throw new TypeError(u.NAN_COMPARISON);return t>e}if(e instanceof Date&&t instanceof Date){if(isNaN(e.getTime())||isNaN(t.getTime()))throw new TypeError(u.INVALID_DATE_COMPARISON);return e.getTime()<t.getTime()}throw new TypeError(b(u.UNSUPPORTED_TYPES_COMPARISON,be(e),be(t)))}function Re(e,t){if([null,void 0].includes(e)||[null,void 0].includes(t))throw Error(u.NULL_OR_UNDEFINED_COMPARISON);const r=typeof e,s=typeof t;if(r!==s){if("bigint"===r&&"number"===s)return Number(e)>t;if("number"===r&&"bigint"===s)return e>Number(t);throw Error(b(u.TYPE_MISMATCH_COMPARISON,r,s))}if("number"===r&&"number"===s||"bigint"===r&&"bigint"===s){if(Number.isNaN(e)||Number.isNaN(t))throw new TypeError(u.NAN_COMPARISON);return e>t}if(e instanceof Date&&t instanceof Date){if(isNaN(e.getTime())||isNaN(t.getTime()))throw new TypeError(u.INVALID_DATE_COMPARISON);return e.getTime()>t.getTime()}throw new TypeError(b(u.UNSUPPORTED_TYPES_COMPARISON,be(e),be(t)))}let Me=class extends F{constructor(e=E.GREATER_THAN){super(e)}hasErrors(e,t,r){let s;try{s=r.getValueFromPath(t[h.GREATER_THAN])}catch(e){return this.getMessage(e.message||this.message)}try{if(!Re(e,s))throw Error(t.message||this.message)}catch(e){return this.getMessage(e.message,t.label||t[h.GREATER_THAN])}}};Me=i([pe(h.GREATER_THAN),c("design:paramtypes",[String])],Me);let Pe=class extends F{constructor(e=E.GREATER_THAN_OR_EQUAL){super(e)}hasErrors(e,t,r){let s;try{s=r.getValueFromPath(t[h.GREATER_THAN_OR_EQUAL])}catch(e){return this.getMessage(e.message||this.message)}try{if(Se(e,s)&&o(e,s)||Re(e,s))return;throw Error(t.message||this.message)}catch(e){return this.getMessage(e.message,t.label||t[h.GREATER_THAN_OR_EQUAL])}}};Pe=i([pe(h.GREATER_THAN_OR_EQUAL),c("design:paramtypes",[String])],Pe);let _e=class extends F{constructor(e=E.LESS_THAN){super(e)}hasErrors(e,t,r){let s;try{s=r.getValueFromPath(t[h.LESS_THAN])}catch(e){return this.getMessage(e.message||this.message)}try{if(!Oe(e,s))throw Error(t.message||this.message)}catch(e){return this.getMessage(e.message,t.label||t[h.LESS_THAN])}}};_e=i([pe(h.LESS_THAN),c("design:paramtypes",[String])],_e);let ve=class extends F{constructor(e=E.LESS_THAN_OR_EQUAL){super(e)}hasErrors(e,t,r){let s;try{s=r.getValueFromPath(t[h.LESS_THAN_OR_EQUAL])}catch(e){return this.getMessage(e.message||this.message)}try{if(Se(e,s)&&o(e,s)||Oe(e,s))return;throw Error(t.message||this.message)}catch(e){return this.getMessage(e.message,t.label||t[h.LESS_THAN_OR_EQUAL])}}};ve=i([pe(h.LESS_THAN_OR_EQUAL),c("design:paramtypes",[String])],ve);let Ie=class extends F{constructor(e=E.LIST){super(e,Array.name,Set.name)}hasErrors(e,t){if(!e||(Array.isArray(e)?!e.length:!e.size))return;const r=(Array.isArray(t.clazz)?t.clazz:[t.clazz]).map(e=>"string"==typeof e?e:e.name?e.name:e().name);let s,a=!0;for(let t=0;t<(Array.isArray(e)?e.length:e.size);t++)switch(s=e[t],typeof s){case"object":case"function":a=r.includes((s??{}).constructor?.name);break;default:a=r.some(e=>typeof s===e.toLowerCase())}return a?void 0:this.getMessage(t.message||this.message,r)}};Ie=i([pe(h.LIST),c("design:paramtypes",[String])],Ie);let Le=class extends F{constructor(e=E.MAX_LENGTH){super(e,String.name,Array.name)}hasErrors(e,t){if(void 0!==e)return e.length>t.maxlength?this.getMessage(t.message||this.message,t.maxlength):void 0}};Le=i([pe(h.MAX_LENGTH),c("design:paramtypes",[String])],Le);let we=class extends F{constructor(e=E.MAX){super(e,"number","Date","string")}hasErrors(e,t){if(void 0===e)return;let{max:r}=t;if(e instanceof Date&&!(r instanceof Date)&&(r=new Date(r),Number.isNaN(r.getDate())))throw Error("Invalid Max param defined");return e>r?this.getMessage(t.message||this.message,r):void 0}};we=i([pe(h.MAX),c("design:paramtypes",[String])],we);let De=class extends F{constructor(e=E.MIN_LENGTH){super(e,String.name,Array.name)}hasErrors(e,t){if(void 0!==e)return e.length<t.minlength?this.getMessage(t.message||this.message,t.minlength):void 0}};De=i([pe(h.MIN_LENGTH),c("design:paramtypes",[String])],De);let je=class extends F{constructor(e=E.MIN){super(e,"number","Date","string")}hasErrors(e,t){if(void 0===e)return;let{min:r}=t;if(e instanceof Date&&!(r instanceof Date)&&(r=new Date(r),Number.isNaN(r.getDate())))throw Error("Invalid Min param defined");return r>e?this.getMessage(t.message||this.message,r):void 0}};je=i([pe(h.MIN),c("design:paramtypes",[String])],je);let He=class extends Ee{constructor(e=E.PASSWORD){super(e)}hasErrors(e,t={}){return super.hasErrors(e,{...t,message:t.message||this.message,[h.PATTERN]:t?.pattern||T.PASSWORD.CHAR8_ONE_OF_EACH})}};He=i([pe(h.PASSWORD),c("design:paramtypes",[Object])],He);let Ue=class extends F{constructor(e=E.REQUIRED){super(e)}hasErrors(e,t={}){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(t.message||this.message):void 0;default:return e?void 0:this.getMessage(t.message||this.message)}}};Ue=i([pe(h.REQUIRED),c("design:paramtypes",[String])],Ue);let ke=class extends F{constructor(e=E.STEP){super(e,"number","string")}hasErrors(e,t){if(void 0!==e)return Number(e)%Number(t.step)!==0?this.getMessage(t.message||this.message,t.step):void 0}};ke=i([pe(h.STEP),c("design:paramtypes",[String])],ke);let Ce=class extends F{constructor(e=E.TYPE){super(e)}hasErrors(e,t){if(void 0===e)return;const{type:r,message:s,customTypes:a}=t;let o=a||r;return o=(Array.isArray(o)?o:[o]).map(e=>"string"==typeof e?e:("function"!=typeof e||e.name||(e=e()),e.name||e)),n.evaluateDesignTypes(e,o)?void 0:this.getMessage(s||this.message,"string"==typeof o?o:Array.isArray(o)?o.join(", "):o,typeof e)}};Ce=i([pe(h.TYPE),c("design:paramtypes",[String])],Ce),G.register({validator:Ce,validationKey:f.TYPE,save:!1});let xe=class extends Ee{constructor(e=E.URL){super(e)}hasErrors(e,t={}){return super.hasErrors(e,{...t,message:t.message||this.message,pattern:t.pattern||T.URL})}};function ze(e,t,r){return G.registerDecorator(t,e),s(L(t,r))}function Fe(){return e=>{Object.prototype.hasOwnProperty.call(e,d)||(e[d]=!0)}}function Ye(e=E.REQUIRED){const t=G.key(h.REQUIRED),r={message:e,description:"defines the attribute as required",async:!1};return v.for(t).define({decorator:ze,args:[Ye,t,r]}).apply()}function Ge(e,t=E.MIN){const r=G.key(h.MIN),s={[h.MIN]:e,message:t,types:[Number.name,Date.name],description:`defines the max value of the attribute as ${e} (applies to numbers or Dates)`,async:!1};return v.for(r).define({decorator:ze,args:[Ge,r,s]}).apply()}function Qe(e,t=E.MAX){const r=G.key(h.MAX),s={[h.MAX]:e,message:t,types:[Number.name,Date.name],description:`defines the max value of the attribute as ${e} (applies to numbers or Dates)`,async:!1};return v.for(r).define({decorator:ze,args:[Qe,r,s]}).apply()}function Ve(e,t=E.STEP){const r=G.key(h.STEP),s={[h.STEP]:e,message:t,types:[Number.name],description:"defines the step of the attribute as "+e,async:!1};return v.for(r).define({decorator:ze,args:[Ve,r,s]}).apply()}function $e(e,t=E.MIN_LENGTH){const r=G.key(h.MIN_LENGTH),s={[h.MIN_LENGTH]:e,message:t,types:[String.name,Array.name,Set.name],description:`defines the min length of the attribute as ${e} (applies to strings or lists)`,async:!1};return v.for(r).define({decorator:ze,args:[$e,r,s]}).apply()}function Ke(e,t=E.MAX_LENGTH){const r=G.key(h.MAX_LENGTH),s={[h.MAX_LENGTH]:e,message:t,types:[String.name,Array.name,Set.name],description:`defines the max length of the attribute as ${e} (applies to strings or lists)`,async:!1};return v.for(r).define({decorator:ze,args:[Ke,r,s]}).apply()}function Xe(e,t=E.PATTERN){const r=G.key(h.PATTERN),s={[h.PATTERN]:"string"==typeof e?e:e.toString(),message:t,types:[String.name],description:`assigns the ${"string"===e?e:e.toString()} pattern to the attribute`,async:!1};return v.for(r).define({decorator:ze,args:[Xe,r,s]}).apply()}function qe(e=E.EMAIL){const t=G.key(h.EMAIL),r={[h.PATTERN]:T.EMAIL.toString(),message:e,types:[String.name],description:"marks the attribute as an email",async:!1};return v.for(t).define({decorator:ze,args:[qe,t,r]}).apply()}function Be(e=E.URL){const t=G.key(h.URL),r={[h.PATTERN]:T.URL.toString(),message:e,types:[String.name],description:"marks the attribute as an url",async:!1};return v.for(t).define({decorator:ze,args:[Be,t,r]}).apply()}function Ze(e,t=E.TYPE){const r=G.key(h.TYPE),s={customTypes:e,message:t,description:"defines the accepted types for the attribute",async:!1};return v.for(r).define({decorator:ze,args:[Ze,r,s]}).apply()}function We(e="dd/MM/yyyy",t=E.DATE){const r=G.key(h.DATE);return v.for(r).define({decorator:function(e,t){const s={[h.FORMAT]:e,message:t,types:[Date.name],description:"defines the attribute as a date with the format "+e,async:!1};return function(t,a){const n=new WeakMap;return Object.defineProperty(t,a,{configurable:!1,set(t){const r=Object.getOwnPropertyDescriptor(this,a);r&&!r.configurable||Object.defineProperty(this,a,{enumerable:!0,configurable:!1,get:()=>n.get(this),set:t=>{let r;try{r=P(e,t),n.set(this,r)}catch(e){}}}),this[a]=t},get(){return n.get(this)}}),ze(We,r,s)(t,a)}},args:[e,t]}).apply()}function Je(e=T.PASSWORD.CHAR8_ONE_OF_EACH,t=E.PASSWORD){const r=G.key(h.PASSWORD),s={[h.PATTERN]:e.toString(),message:t,types:[String.name],description:"attribute as a password",async:!1};return v.for(r).define({decorator:ze,args:[Je,r,s]}).apply()}function et(e,t="Array",r=E.LIST){const s=G.key(h.LIST),a={clazz:Array.isArray(e)?e.map(e=>e.name?e.name:e):[e.name?e.name:e],type:t,message:r,async:!1,description:`defines the attribute as a ${t} of ${e.name}`};return v.for(s).define({decorator:ze,args:[et,s,a]}).apply()}function tt(e,t=E.LIST){return et(e,"Set",t)}function rt(e,t){const r={label:t?.label||e,message:t?.message||E.EQUALS,[h.EQUALS]:e,description:"defines attribute as equal to "+e};return ze(rt,G.key(h.EQUALS),{...r,async:!1})}function st(e,t){const r={label:t?.label||e,message:t?.message||E.DIFF,[h.DIFF]:e,description:"defines attribute as different to "+e};return ze(st,G.key(h.DIFF),{...r,async:!1})}function at(e,t){const r={label:t?.label||e,message:t?.message||E.LESS_THAN,[h.LESS_THAN]:e,description:"defines attribute as less than to "+e};return ze(at,G.key(h.LESS_THAN),{...r,async:!1})}function nt(e,t){const r={label:t?.label||e,message:t?.message||E.LESS_THAN_OR_EQUAL,[h.LESS_THAN_OR_EQUAL]:e,description:"defines attribute as less or equal to "+e};return ze(nt,G.key(h.LESS_THAN_OR_EQUAL),{...r,async:!1})}function ot(e,t){const r={label:t?.label||e,message:t?.message||E.GREATER_THAN,[h.GREATER_THAN]:e,description:"defines attribute as greater than "+e};return ze(ot,G.key(h.GREATER_THAN),{...r,async:!1})}function it(e,t){const r={label:t?.label||e,message:t?.message||E.GREATER_THAN_OR_EQUAL,[h.GREATER_THAN_OR_EQUAL]:e,description:"defines attribute as greater or equal to "+e};return ze(it,G.key(h.GREATER_THAN_OR_EQUAL),{...r,async:!1})}function ct(e,...t){const r=(...t)=>new e(...t);return r.prototype=e.prototype,r(...t)}function ut(e){let t=Object.getPrototypeOf(e);if(t===Object.prototype)return e;for(;t!==Object.prototype;){if(t=Object.getPrototypeOf(t),t===Object.prototype)return t;if(Object.getPrototypeOf(t)===Object.prototype)return t}throw Error("Could not find proper prototype")}function lt(e){if(e instanceof ue)return;function t(e,t){Object.setPrototypeOf(e,t)}const r=Object.getPrototypeOf(e);if(r===Object.prototype)return t(e,ue.prototype);for(;r!==Object.prototype;){const e=Object.getPrototypeOf(r);if(e===Object.prototype||Object.getPrototypeOf(e)===Object.prototype)return t(r,ue.prototype)}throw Error("Could not find proper prototype to bind")}function dt(r){const s=(...e)=>{const t=ct(r,...e);lt(t);const s=ue.getBuilder();return s&&s(t,e.length?e[0]:void 0),a(ue.key(f.MODEL),r.name)(t.constructor),t};return s.prototype=r.prototype,a(ue.key(f.MODEL),r.name)(r),Reflect.getMetadataKeys(r).forEach(e=>{Reflect.defineMetadata(e,Reflect.getMetadata(e,r),s)}),Object.defineProperty(s,"name",{writable:!1,enumerable:!0,configurable:!1,value:r.prototype.constructor.name}),Object.defineProperty(s,f.ANCHOR,{writable:!1,enumerable:!1,configurable:!1,value:r}),e.set(s,t.CONSTRUCTOR,r),ue.register(s,r.name),s}function ft(){const e=ue.key(f.MODEL);return r.for(e).define(dt).apply()}function gt(e,...t){return a(ue.key(f.HASHING),{algorithm:e,args:t})}function pt(e,...t){return a(ue.key(f.SERIALIZATION),{serializer:e,args:t})}function ht(e){return a(ue.key(f.DESCRIPTION),e)}xe=i([pe(h.URL),c("design:paramtypes",[String])],xe);const yt="##VERSION##",mt="##PACKAGE##";e.registerLibrary(mt,yt);export{d as ASYNC_META_KEY,ge as AsyncValidator,u as COMPARISON_ERROR_MESSAGES,p as ComparisonValidationKeys,m as DAYS_OF_WEEK_NAMES,E as DEFAULT_ERROR_MESSAGES,T as DEFAULT_PATTERNS,he as DateValidator,v as Decoration,g as DefaultFlavour,j as DefaultHashingMethod,le as DefaultSerializationMethod,ye as DiffValidator,Te as EmailValidator,Ae as EqualsValidator,Pe as GreaterThanOrEqualValidator,Me as GreaterThanValidator,H as Hashing,de as JSONSerializer,ve as LessThanOrEqualValidator,_e as LessThanValidator,Ie as ListValidator,y as MONTH_NAMES,Le as MaxLengthValidator,we as MaxValidator,De as MinLengthValidator,je as MinValidator,ue as Model,x as ModelErrorDefinition,f as ModelKeys,ie as ModelRegistryManager,mt as PACKAGE_NAME,He as PasswordValidator,C as PathProxyEngine,Ee as PatternValidator,re as Primitives,Ue as RequiredValidator,se as ReservedModels,fe as Serialization,ke as StepValidator,Ce as TypeValidator,xe as URLValidator,l as VALIDATION_PARENT_KEY,yt as VERSION,G as Validation,h as ValidationKeys,F as Validator,Y as ValidatorRegistry,Fe as async,S as bindDateToString,lt as bindModelPrototype,ce as bulkModelRegister,ct as construct,We as date,N as dateFromFormat,ht as description,st as diff,qe as email,rt as eq,ut as findLastProtoBeforeObject,M as formatDate,V as getMetadata,Q as getModelKey,X as getValidatableProperties,K as getValidationDecorators,ot as gt,it as gte,w as hashCode,D as hashObj,gt as hashedBy,Re as isGreaterThan,Oe as isLessThan,O as isValidDate,Se as isValidForGteOrLteComparison,ae as jsTypes,et as list,at as lt,nt as lte,Qe as max,Ke as maxlength,Ge as min,$e as minlength,ft as model,dt as modelBaseDecorator,P as parseDate,Je as password,Xe as pattern,I as prop,L as propMetadata,me as regexpParser,Ye as required,pt as serializedBy,tt as set,b as sf,Ve as step,A as stringFormat,$ as toConditionalPromise,R as twoDigitPad,Ze as type,Be as url,te as validate,W as validateChildValue,J as validateDecorator,ee as validateDecorators,ze as validationMetadata,pe as validator}; //# sourceMappingURL=decorator-validation.js.map