Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@decaf-ts/decorator-validation

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@decaf-ts/decorator-validation - npm Package Compare versions

Comparing version 1.0.7 to 1.0.11

lib/esm/reflection/decorators.d.ts

2

dist/decorator-validation.bundle.min.js
/*! For license information please see decorator-validation.bundle.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("decorator-validation",[],t):"object"==typeof exports?exports["decorator-validation"]=t():e["decorator-validation"]=t()}(this,(()=>(()=>{var e={729:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,a(r(935),t),a(r(965),t),a(r(847),t),t.VERSION="##VERSION##"},6:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Model=t.validate=void 0;const n=r(965),a=r(935),i=r(19),o=r(402),s=r(154),c=r(38),u=r(936),d=r(770);function l(e,...t){const r=[];for(const i in e)e.hasOwnProperty(i)&&-1===t.indexOf(i)&&r.push((0,a.getPropertyDecorators)(n.ValidationKeys.REFLECT,e,i));const c=r.reduce(((t,r)=>{const{prop:i,decorators:c}=r;if(!c||!c.length)return t;const u=c[0];c.find((e=>e.key===n.ValidationKeys.TYPE||!!e.props.types?.find((e=>e===u.props.name))))&&c.shift();let l=c.reduce(((t,r)=>{const n=d.Validation.get(r.key);if(!n)return t;const a=n.hasErrors(e[i.toString()],...r.key===s.ModelKeys.TYPE?[r.props]:Object.values(r.props));return a&&((t=t||{})[r.key]=a),t}),void 0);return l=l||Object.keys(e).filter((e=>!l||!l[e])).reduce(((t,r)=>{let i;const c=(0,a.getPropertyDecorators)(n.ValidationKeys.REFLECT,e,r).decorators,u=c.filter((e=>-1!==[s.ModelKeys.TYPE,n.ValidationKeys.TYPE].indexOf(e.key)));if(!u||!u.length)return t;const d=u.pop(),l=d.props.name?[d.props.name]:Array.isArray(d.props.customTypes)?d.props.customTypes:[d.props.customTypes],f=Object.values(o.ReservedModels).map((e=>e.toLowerCase()));return l.forEach((t=>{if(-1===f.indexOf(t.toLowerCase()))switch(t){case"Array":case"Set":if(c.length&&c.find((e=>e.key===n.ValidationKeys.LIST))){const o="Array"===t?e[r].find((e=>e.hasErrors())):e[r].values().find((e=>e.hasErrors()));o&&(i=(0,a.stringFormat)(n.DEFAULT_ERROR_MESSAGES.LIST_INSIDE,o.toString()))}break;default:try{e[r]&&(i=e[r].hasErrors())}catch(e){console.warn((0,a.stringFormat)("Model should be validatable but its not"))}}})),i&&((t=t||{})[r]=i),t}),void 0),l&&((t=t||{})[r.prop.toString()]=l),t}),void 0);return c?new i.ModelErrorDefinition(c):void 0}let f,y,p,h;t.validate=l;class g{constructor(e){}hasErrors(...e){return l(this,...e)}equals(e,...t){return(0,a.isEqual)(this,e,...t)}serialize(){return g.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}toHash(){return g.getHashingFunction()(this).toString()}static deserialize(e){return g.getSerializer().deserialize(e)}static serialize(e){return g.getSerializer().serialize(e)}static hash(e){return g.getHashingFunction()(e)}static fromObject(e,t){return(0,c.constructFromObject)(e,t)}static fromModel(e,t){return(0,c.constructFromModel)(e,t)}static setBuilder(e){f=e}static getBuilder(){return f}static getRegistry(){return y||(y=new u.ModelRegistryManager),y}static setRegistry(e){y=e}static register(e,t){return g.getRegistry().register(e,t)}static get(e){return g.getRegistry().get(e)}static build(e={},t){return g.getRegistry().build(e,t)}static setSerializer(e){p=e}static getSerializer(){return p||(p=new a.JSONSerializer),p}static setHashingFunction(e){h=e}static getHashingFunction(){return h||(h=a.hashObj),h}}t.Model=g},19:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelErrorDefinition=void 0,t.ModelErrorDefinition=class{constructor(e){for(const t in e)e.hasOwnProperty(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=>e.hasOwnProperty(t)&&"function"!=typeof e[t])).reduce(((t,r)=>{let n=Object.keys(e[r]).reduce(((t,n)=>(t?t+=`\n${e[r][n]}`:t=e[r][n],t)),void 0);return n&&(n=`${r} - ${n}`,t?t+=`\n${n}`:t=n),t}),"")}}},936:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bulkModelRegister=t.ModelRegistryManager=void 0;const n=r(6),a=r(935),i=r(154);t.ModelRegistryManager=class{constructor(e=i.ModelKeys.ANCHOR,t=a.isModel){this.cache={},this.testFunction=t,this.anchorKey=e}register(e,t){if("function"!=typeof e)throw new 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 new Error("Provided obj is not a Model object");const r=t||e[this.anchorKey].class;if(!(r in this.cache))throw new Error((0,a.stringFormat)("Provided class {0} is not a registered Model object",r));return new this.cache[r](e)}},t.bulkModelRegister=function(...e){e.forEach((e=>{const t=e.constructor?e.constructor:e;n.Model.register(t,e.name)}))}},402:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.ReservedModels=t.Primitives=void 0,function(e){e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"}(r||(t.Primitives=r={})),function(e){e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"}(n||(t.ReservedModels=n={}))},38:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.construct=t.constructFromModel=t.constructFromObject=void 0;const n=r(6),a=r(935),i=r(965),o=r(402),s=r(154);t.constructFromObject=function(e,t){if(!t)return e;for(const r in t)t.hasOwnProperty(r)&&(e.hasOwnProperty(r)||e.prototype&&e.prototype.hasOwnProperty(r))&&(e[r]=t[r]);return e},t.constructFromModel=function(e,t){if(!t)return e;let r,c;for(const u in t)if(t.hasOwnProperty(u)&&(e.hasOwnProperty(u)||e.prototype&&e.prototype.hasOwnProperty(u))){if(e[u]=t[u],"object"!=typeof e[u])continue;if((0,a.isModel)(e[u])){try{e[u]=n.Model.build(e[u])}catch(e){console.log(e)}continue}const d=(0,a.getPropertyDecorators)(i.ValidationKeys.REFLECT,e,u).decorators;if(r=d.filter((e=>-1!==[s.ModelKeys.TYPE,i.ValidationKeys.TYPE].indexOf(e.key))),!r||!r.length)throw new Error((0,a.stringFormat)("failed to find decorators for property {0}",u));c=r.pop();const l=c.props.name?[c.props.name]:Array.isArray(c.props.customTypes)?c.props.customTypes:[c.props.customTypes],f=Object.values(o.ReservedModels).map((e=>e.toLowerCase()));l.forEach((t=>{if(-1===f.indexOf(t.toLowerCase()))try{switch(t){case"Array":case"Set":if(d.length){const r=d.find((e=>e.key===i.ValidationKeys.LIST));if(r&&("Array"===t&&(e[u]=e[u].map((e=>n.Model.build(e,r.props.class)))),"Set"===t)){const t=new Set;for(const a of e[u])t.add(n.Model.build(a,r.props.class));e[u]=t}}break;default:e[u]&&(e[u]=n.Model.build(e[u],t))}}catch(e){console.log(e)}}))}return e},t.construct=function(e,...t){const r=(...t)=>new e(...t);return r.prototype=e.prototype,r(...t)}},893:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.model=t.getModelKey=void 0;const n=r(38),a=r(154),i=r(6);t.getModelKey=e=>a.ModelKeys.REFLECT+e,t.model=function(e,r){return o=>{const s=function(...s){const c=(0,n.construct)(o,...s),u=i.Model.getBuilder();u&&u(c,s.length?s[0]:void 0);const d=Object.assign({},{class:o.name});return Object.defineProperty(c,a.ModelKeys.ANCHOR,{writable:!1,enumerable:!1,configurable:!1,value:d}),Reflect.defineMetadata((0,t.getModelKey)(a.ModelKeys.MODEL),Object.assign(d,e||{}),c.constructor),r&&r(c,...s),c};return s.prototype=o.prototype,Object.defineProperty(s,"name",{writable:!1,enumerable:!0,configurable:!1,value:o.prototype.constructor.name}),i.Model.register(s),s}}},847:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(38),t),a(r(936),t),a(r(893),t),a(r(19),t),a(r(282),t),a(r(6),t),a(r(402),t)},282:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},154:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ModelKeys=void 0,function(e){e.REFLECT="model.definition.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__modelDefinition"}(r||(t.ModelKeys=r={}))},75:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dateFromFormat=t.evaluateDesignTypes=t.checkTypes=t.checkType=t.getClassDecorators=t.isModel=t.hashObj=t.hashSerialization=t.hashCode=t.isEqual=t.stringFormat=t.getAllProperties=t.getAllPropertyDecorators=t.getTypeFromDecorator=t.getPropertyDecorators=void 0,r(630);const n=r(965),a=r(154),i=r(847);function o(e,t,r,n=!1,i=!0,u){const d=function(e,t,r,n=!1,i){const o=Reflect.getMetadataKeys(t,r).filter((t=>n?t.toString().startsWith(e):t===a.ModelKeys.TYPE||t.toString().startsWith(e))).reduce(((n,i)=>{const o={key:i!==a.ModelKeys.TYPE?i.substring(e.length):i,props:Reflect.getMetadata(i,t,r)};return n.concat(o)}),i||[]);return{prop:r.toString(),decorators:o}}(e,t,r,n,u);return i&&Object.getPrototypeOf(t)!==Object.prototype?o(e,Object.getPrototypeOf(t.constructor),r,!0,i,d.decorators):{prop:d.prop,decorators:function(e){const r={};return e.filter((e=>e.key in r?(c(e.props,r[e.key])||console.log(s("Found a similar decorator for the {0} property of a {1} model but with different attributes. The original one will be kept",e.key,t.constructor.name)),!1):(r[e.key.toString()]=e.props,!0)))}(d.decorators)}}function s(e,...t){return e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r]:e}))}function c(e,t,...r){if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(!e||!t||"object"!=typeof e&&"object"!=typeof t)return e===t;if(null==e||null==t)return!1;if(typeof e!=typeof t)return!1;if(e.prototype!==t.prototype)return!1;const n=Object.keys(e).filter((e=>-1===r.indexOf(e)));return n.length===Object.keys(t).filter((e=>-1===r.indexOf(e))).length&&n.every((n=>-1!==r.indexOf(n)||c(e[n],t[n],...r)))}function u(e){e=String(e);let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}function d(e,t){return Reflect.getOwnMetadataKeys(t.constructor).filter((t=>t.toString().startsWith(e))).reduce(((r,n)=>{const a={key:n.substring(e.length),props:Reflect.getMetadata(n,t.constructor)};return r.concat(a)}),[])}function l(e,t){return typeof e===t||e.constructor&&e.constructor.name.toLowerCase()===t.toLowerCase()}function f(e,t){return!t.every((t=>!l(e,t)))}t.getPropertyDecorators=o,t.getTypeFromDecorator=function(e,t){const r=o(a.ModelKeys.REFLECT,e,t,!1);if(!r||!r.decorators)return;const n=r.decorators.shift(),i=n.props?n.props.name:void 0;return"Function"!==i?i:void 0},t.getAllPropertyDecorators=function(e,...t){if(t&&t.length)return Object.getOwnPropertyNames(e).reduce(((r,n)=>(t.forEach(((t,a)=>{const i=o(t,e,n,0!==a);r||(r={}),function(e,t,r){r&&r.length&&(e[t]||(e[t]=[]),e[t].push(...r))}(r,n,i.decorators)})),r)),void 0)},t.getAllProperties=function(e,t=!0,r="Object"){const n=[];let a=e;const i=function(){if(!t)return;const e=Object.getPrototypeOf(a);return e&&e.constructor.name!==r?(a=e,a):void 0};do{Object.getOwnPropertyNames(a).forEach((function(e){-1===n.indexOf(e)&&n.push(e)}))}while(i());return n},t.stringFormat=s,t.isEqual=c,t.hashCode=u,t.hashSerialization=function(e){return u(i.Model.serialize(e))},t.hashObj=function(e){const t=function(e,t){const r=n(t);return"string"==typeof r?n((e||"")+n(t)):(e=((e=e||0)<<5)-e+r)&e},r=u,n=function(e){return 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},t.isModel=function(e){return!!e[a.ModelKeys.ANCHOR]||!!d(a.ModelKeys.REFLECT,e).find((e=>e.key===a.ModelKeys.MODEL&&e.props&&e.props.class))},t.getClassDecorators=d,t.checkType=l,t.checkTypes=f,t.evaluateDesignTypes=function(e,t){switch(typeof t){case"string":return l(e,t);case"object":return!Array.isArray(t)||f(e,t);case"function":return!t.name||"Object"===t.name||l(e,t.name);default:return!0}},t.dateFromFormat=function(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 a=new RegExp(r,"g").exec(e);if(!a||!a.groups)return new Date(e);const i=function(e){if(!e)return 0;const t=parseInt(e);return isNaN(t)?0:t},o=i(a.groups.year),s=i(a.groups.day),c=a.groups.ampm;let u=i(a.groups.hour);c&&(u="PM"===c?u+12:u);const d=i(a.groups.minutes),l=i(a.groups.seconds),f=i(a.groups.milis),y=a.groups.monthname,p=a.groups.monthnamesmall;let h=a.groups.month;if(y)h=n.MONTH_NAMES.indexOf(y);else if(p){const t=n.MONTH_NAMES.find((e=>e.toLowerCase().startsWith(p.toLowerCase())));if(!t)return new Date(e);h=n.MONTH_NAMES.indexOf(t)}else h=i(`${h}`);return new Date(o,h-1,s,u,d,l,f)}},935:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(75),t),a(r(904),t),a(r(973),t),a(r(154),t)},904:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},973:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSONSerializer=void 0;const n=r(6),a=r(154);t.JSONSerializer=class{preSerialize(e){const t=Object.assign({},e);return t[a.ModelKeys.ANCHOR]=e[a.ModelKeys.ANCHOR],t}deserialize(e){const t=JSON.parse(e);return n.Model.build(t)}serialize(e){return JSON.stringify(this.preSerialize(e))}}},770:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validation=void 0;const n=r(493),a=r(935);class i{static{this.actingValidatorRegistry=void 0}constructor(){}static setRegistry(e,t){t&&i.actingValidatorRegistry&&i.actingValidatorRegistry.getKeys().forEach((r=>{const n=e.get(r);n&&e.register(t(n))})),i.actingValidatorRegistry=e}static getRegistry(){return i.actingValidatorRegistry||(i.actingValidatorRegistry=new n.ValidatorRegistry({validator:n.TypeValidator,validationKey:a.ModelKeys.TYPE,save:!1})),i.actingValidatorRegistry}static get(e){return i.getRegistry().get(e)}static register(...e){return i.getRegistry().register(...e)}}t.Validation=i},395:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.DATE){super(a.ValidationKeys.DATE,e,Number.name,Date.name,String.name)}hasErrors(e,t,r){if(void 0!==e)return"string"==typeof e&&(e=new Date(e)),isNaN(e.getDate())?this.getMessage(r||this.message):void 0}}t.DateValidator=i},335:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmailValidator=void 0;const n=r(772),a=r(273);class i extends a.PatternValidator{static{this.emailPat=/[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])?/}constructor(e=n.DEFAULT_ERROR_MESSAGES.EMAIL){super(n.ValidationKeys.EMAIL,e)}hasErrors(e,t){return super.hasErrors(e,i.emailPat,t)}}t.EmailValidator=i},407:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.LIST){super(a.ValidationKeys.LIST,e,Array.name,Set.name)}hasErrors(e,t,r){if(!e||(Array.isArray(e)?!e.length:!e.size))return;let n;for(let a=0;a<(Array.isArray(e)?e.length:e.size);a++)switch(n=e[a],typeof n){case"object":case"function":if(!n.constructor||n.constructor.name!==t)return this.getMessage(r||this.message,t);break;default:if(typeof n!==t)return this.getMessage(r||this.message,t)}}}t.ListValidator=i},169:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MaxLengthValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){super(a.ValidationKeys.MAX_LENGTH,e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length>t?this.getMessage(r||this.message,t):void 0}}t.MaxLengthValidator=i},909:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MaxValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MAX){super(a.ValidationKeys.MAX,e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Max param defined");return e>t?this.getMessage(r||this.message,t):void 0}}}t.MaxValidator=i},519:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MinLengthValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){super(a.ValidationKeys.MIN_LENGTH,e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length<t?this.getMessage(r||this.message,t):void 0}}t.MinLengthValidator=i},651:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MinValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MIN){super(a.ValidationKeys.MIN,e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Min param defined");return e<t?this.getMessage(r||this.message,t):void 0}}}t.MinValidator=i},116:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordValidator=void 0;const n=r(273),a=r(772);class i extends n.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.PASSWORD,t=a.PasswordPatterns.CHAR8_ONE_OF_EACH){super(a.ValidationKeys.PASSWORD,e),this.pattern=t}hasErrors(e,t,r){return super.hasErrors(e,t||this.pattern,r||this.message)}}t.PasswordValidator=i},273:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PatternValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{static{this.regexpParser=new RegExp("^/(.+)/([gimus]*)$")}constructor(e=a.ValidationKeys.PATTERN,t=a.DEFAULT_ERROR_MESSAGES.PATTERN){super(e,t,"string")}static getPattern(e){if(!i.regexpParser.test(e))return new RegExp(e);const t=e.match(i.regexpParser);return new RegExp(t[1],t[2])}hasErrors(e,t,r){if(e)return(t="string"==typeof t?i.getPattern(t):t).lastIndex=0,t.test(e)?void 0:this.getMessage(r||this.message)}}t.PatternValidator=i},812:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.REQUIRED){super(a.ValidationKeys.REQUIRED,e)}hasErrors(e,t){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(t||this.message):void 0;default:return e?void 0:this.getMessage(t||this.message)}}}t.RequiredValidator=i},553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StepValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.STEP){super(a.ValidationKeys.STEP,e,"number","string")}hasErrors(e,t,r){if(void 0!==e)return Number(e)%Number(t)!=0?this.getMessage(r||this.message,t):void 0}}t.StepValidator=i},375:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeValidator=void 0;const n=r(735),a=r(935),i=r(772),o=r(154);class s extends n.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.TYPE){super(o.ModelKeys.TYPE,e)}hasErrors(e,t,r){if(void 0!==e)return(0,a.evaluateDesignTypes)(e,t)?void 0:this.getMessage(r||this.message,"string"==typeof t?t:Array.isArray(t)?t.join(", "):t.name,typeof e)}}t.TypeValidator=s},964:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URLValidator=void 0;const n=r(772),a=r(273);class i extends a.PatternValidator{static{this.urlPattern=/^(?:(?:(?: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}constructor(e=n.DEFAULT_ERROR_MESSAGES.URL){super(n.ValidationKeys.URL,e)}hasErrors(e,t){return super.hasErrors(e,i.urlPattern,t)}}t.URLValidator=i},735:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validator=void 0;const n=r(935),a=r(772);t.Validator=class{constructor(e,t=a.DEFAULT_ERROR_MESSAGES.DEFAULT,...r){this.validationKey=e,this.message=t,r.length&&(this.acceptedTypes=r),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(e,...t){return(0,n.stringFormat)(e,...t)}checkTypeAndHasErrors(e){return function(t,...r){return void 0!==t&&this.acceptedTypes?(0,n.checkTypes)(t,this.acceptedTypes)?e(t,...r):this.getMessage(a.DEFAULT_ERROR_MESSAGES.TYPE,this.acceptedTypes.join(", "),typeof t):e(t,...r)}.bind(this)}}},436:(e,t)=>{"use strict";function r(e){return e.constructor&&e.hasErrors}Object.defineProperty(t,"__esModule",{value:!0}),t.ValidatorRegistry=t.isValidator=void 0,t.isValidator=r,t.ValidatorRegistry=class{constructor(...e){this.cache={},this.customKeyChache={},this.register(...e)}getCustomKeys(){return Object.assign({},this.customKeyChache)}getKeys(){return Object.keys(this.cache)}get(e){if(!(e in this.cache))return;const t=this.cache[e];if(r(t))return t;const n=new(t.default||t);return this.cache[e]=n,n}register(...e){e.forEach((e=>{if(r(e)){if(e.validationKey in this.cache)return;this.cache[e.validationKey]=e}else{const{validationKey:t,validator:r,save:n}=e;if(t in this.cache)return;if(this.cache[t]=r,!n)return;const a={};a[t.toUpperCase()]=t,this.customKeyChache=Object.assign({},this.customKeyChache,a)}}))}}},772:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordPatterns=t.DEFAULT_ERROR_MESSAGES=t.DAYS_OF_WEEK_NAMES=t.MONTH_NAMES=t.ValidationKeys=void 0,t.ValidationKeys={REFLECT:"model.validation.",REQUIRED:"required",MIN:"min",MAX:"max",STEP:"step",MIN_LENGTH:"minlength",MAX_LENGTH:"maxlength",PATTERN:"pattern",EMAIL:"email",URL:"url",DATE:"date",TYPE:"type",PASSWORD:"password",LIST:"list"},t.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],t.DAYS_OF_WEEK_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],t.DEFAULT_ERROR_MESSAGES={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}",LIST_INSIDE:"Elements of list are invalid: {0}",MODEL_NOT_FOUND:"No model registered under {0}"},t.PasswordPatterns={CHAR8_ONE_OF_EACH:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&_\-.,])[A-Za-z\d@$!%*?&_\-.,]{8,}$/g}},493:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Validators=void 0;const i=r(395),o=r(375),s=r(116),c=r(553),u=r(964),d=r(273),l=r(651),f=r(519),y=r(909),p=r(169),h=r(812),g=r(335),v=r(407);a(r(772),t),a(r(735),t),a(r(168),t),a(r(436),t),a(r(335),t),a(r(812),t),a(r(169),t),a(r(909),t),a(r(519),t),a(r(651),t),a(r(273),t),a(r(964),t),a(r(553),t),a(r(395),t),a(r(375),t),a(r(116),t),t.Validators={EmailValidator:g.EmailValidator,RequiredValidator:h.RequiredValidator,MaxLengthValidator:p.MaxLengthValidator,MaxValidator:y.MaxValidator,MinLengthValidator:f.MinLengthValidator,MinValidator:l.MinValidator,PatternValidator:d.PatternValidator,URLValidator:u.URLValidator,StepValidator:c.StepValidator,DateValidator:i.DateValidator,TypeValidator:o.TypeValidator,PasswordValidator:s.PasswordValidator,ListValidator:v.ListValidator}},168:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},475:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.set=t.list=t.password=t.date=t.parseDate=t.formatDate=t.twoDigitPad=t.isValidDate=t.bindDateToString=t.type=t.url=t.email=t.pattern=t.maxlength=t.minlength=t.step=t.max=t.min=t.required=t.getValidationKey=void 0,r(630);const n=r(493),a=r(493),i=r(935),o=r(407),s=r(770);function c(e){return n.ValidationKeys.REFLECT+e}function u(e,t=n.DEFAULT_ERROR_MESSAGES.TYPE,r=a.TypeValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.TYPE),{customTypes:e,message:t},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.TYPE,save:!0})}}function d(e,t){if(!e)return;const r=()=>y(e,t);return Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:r}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:r}),e}function l(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}function f(e){return e<10?"0"+e:e.toString()}function y(e,t="yyyy/MM/dd"){const r=e.getDate(),a=e.getMonth(),i=e.getFullYear(),o=e.getHours(),s=e.getMinutes(),c=e.getSeconds(),u=e.getMilliseconds(),d=o%12,l=f(d),y=f(o),p=f(s),h=f(c),g=o<12?"AM":"PM",v=n.DAYS_OF_WEEK_NAMES[e.getDay()],E=v.substr(0,3),M=f(r),_=a+1,m=f(_),O=n.MONTH_NAMES[a],b=O.substr(0,3),S=i+"",R=S.substr(2,2);return(t=t.replace("hh",l).replace("h",d.toString()).replace("HH",y).replace("H",o.toString()).replace("mm",p).replace("m",s.toString()).replace("ss",h).replace("s",c.toString()).replace("S",u.toString()).replace("dd",M).replace("d",r.toString()).replace("EEEE",v).replace("EEE",E).replace("yyyy",S).replace("yy",R).replace("aaa",g)).indexOf("MMM")>-1?t.replace("MMMM",O).replace("MMM",b):t.replace("MM",m).replace("M",_.toString())}function p(e,t){let r;if(t){if(t instanceof Date)try{r=(0,i.dateFromFormat)(y(t,e),e)}catch(r){throw new Error((0,i.stringFormat)("Could not convert date {0} to format: {1}",t.toString(),e))}else if("string"==typeof t)r=(0,i.dateFromFormat)(t,e);else if("number"==typeof t){const n=new Date(t);r=(0,i.dateFromFormat)(y(n,e),e)}else{if(!l(t))throw new Error(`Invalid value provided ${t}`);try{const n=new Date(t);r=(0,i.dateFromFormat)(y(n,e),e)}catch(r){throw new Error((0,i.stringFormat)("Could not convert date {0} to format: {1}",t,e))}}return d(r,e)}}function h(e,t="Array",r=n.DEFAULT_ERROR_MESSAGES.LIST,a=o.ListValidator){return(i,o)=>{u(t)(i,o),Reflect.defineMetadata(c(n.ValidationKeys.LIST),{class:e.name,type:t,message:r},i,o),s.Validation.register({validator:a,validationKey:n.ValidationKeys.LIST,save:!0})}}t.getValidationKey=c,t.required=function(e=n.DEFAULT_ERROR_MESSAGES.REQUIRED,t=a.RequiredValidator){return(r,a)=>{Reflect.defineMetadata(c(n.ValidationKeys.REQUIRED),{message:e},r,a),s.Validation.register({validator:t,validationKey:n.ValidationKeys.REQUIRED,save:!0})}},t.min=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN,r=a.MinValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.MIN),{value:e,message:t,types:[Number.name,Date.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.MIN,save:!0})}},t.max=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX,r=a.MaxValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.MAX),{value:e,message:t,types:[Number.name,Date.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.MAX,save:!0})}},t.step=function(e,t=n.DEFAULT_ERROR_MESSAGES.STEP,r=a.StepValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.STEP),{value:e,message:t,types:[Number.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.STEP,save:!0})}},t.minlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN_LENGTH,r=a.MinLengthValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.MIN_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.MIN_LENGTH,save:!0})}},t.maxlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX_LENGTH,r=a.MaxLengthValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.MAX_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.MAX_LENGTH,save:!0})}},t.pattern=function(e,t=n.DEFAULT_ERROR_MESSAGES.PATTERN,r=a.PatternValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.PATTERN),{value:"string"==typeof e?e:e.toString(),message:t,types:[String.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.PATTERN,save:!0})}},t.email=function(e=n.DEFAULT_ERROR_MESSAGES.EMAIL,t=a.EmailValidator){return(r,a)=>{Reflect.defineMetadata(c(n.ValidationKeys.EMAIL),{message:e,types:[String.name]},r,a),s.Validation.register({validator:t,validationKey:n.ValidationKeys.EMAIL,save:!0})}},t.url=function(e=n.DEFAULT_ERROR_MESSAGES.URL,t=a.URLValidator){return(r,a)=>{Reflect.defineMetadata(c(n.ValidationKeys.URL),{message:e,types:[String.name]},r,a),s.Validation.register({validator:t,validationKey:n.ValidationKeys.URL,save:!0})}},t.type=u,t.bindDateToString=d,t.isValidDate=l,t.twoDigitPad=f,t.formatDate=y,t.parseDate=p,t.date=function(e="dd/MM/yyyy",t=n.DEFAULT_ERROR_MESSAGES.DATE,r=a.DateValidator){return(a,o)=>{Reflect.defineMetadata(c(n.ValidationKeys.DATE),{format:e,message:t,types:[Date.name]},a,o),s.Validation.register({validator:r,validationKey:n.ValidationKeys.DATE,save:!0});const u=new WeakMap;Object.defineProperty(a,o,{configurable:!1,set(t){const r=Object.getOwnPropertyDescriptor(this,o);r&&!r.configurable||Object.defineProperty(this,o,{enumerable:!0,configurable:!1,get:()=>u.get(this),set:t=>{let r;try{r=p(e,t),u.set(this,r)}catch(e){console.error((0,i.stringFormat)("Failed to parse date: {0}",e.message||e))}}}),this[o]=t},get(){console.log("here")}})}},t.password=function(e=n.PasswordPatterns.CHAR8_ONE_OF_EACH,t=n.DEFAULT_ERROR_MESSAGES.PASSWORD,r=a.PasswordValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.PASSWORD),{pattern:e,message:t,types:[String.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.PASSWORD,save:!0})}},t.list=h,t.set=function(e,t=n.DEFAULT_ERROR_MESSAGES.LIST,r){return(n,a)=>{h(e,"Set",t,r)(n,a)}}},965:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Decorators=t.ValidatorRegistryImp=void 0,a(r(792),t),a(r(493),t);const i=r(493);t.ValidatorRegistryImp=i.ValidatorRegistry,t.Decorators=r(475),a(r(475),t),a(r(770),t)},792:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},630:(e,t,r)=>{var n;!function(e){!function(t){var n="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),a=i(e);function i(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==n.Reflect&&(a=i(n.Reflect,a)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,a=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!o&&!s,u={create:o?function(){return H(Object.create(null))}:s?function(){return H({__proto__:null})}:function(){return H({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},d=Object.getPrototypeOf(Function),l="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},t=[],r=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[i]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,a=r+1;a<n;a++)this._keys[a-1]=this._keys[a],this._values[a-1]=this._values[a];return this._keys.length--,this._values.length--,K(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new r(this._keys,this._values,n)},t.prototype.values=function(){return new r(this._keys,this._values,a)},t.prototype.entries=function(){return new r(this._keys,this._values,o)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[i]=function(){return this.entries()},t.prototype._find=function(e,t){if(!K(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(K(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function n(e,t){return e}function a(e,t){return t}function o(e,t){return[e,t]}}(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new l}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[i]=function(){return this.keys()},e}(),y="function"==typeof WeakMap?WeakMap:function(){var e=16,t=u.create(),n=a();return function(){function e(){this._key=a()}return e.prototype.has=function(e){var t=i(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=i(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return i(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=i(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=a()},e}();function a(){var e;do{e="@@WeakMap@@"+s()}while(u.has(t,e));return t[e]=!0,e}function i(e,t){if(!r.call(e,n)){if(!t)return;Object.defineProperty(e,n,{value:u.create()})}return e[n]}function o(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function s(){var t,r=(t=e,"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):o(new Uint8Array(t),t):o(new Array(t),t));r[6]=79&r[6]|64,r[8]=191&r[8]|128;for(var n="",a=0;a<e;++a){var i=r[a];4!==a&&6!==a&&8!==a||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}(),p=n?Symbol.for("@reflect-metadata:registry"):void 0,h=function(){var e;return!R(p)&&T(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[p]),R(e)&&(e=function(){var e,r,n,a;R(p)||void 0===t.Reflect||p in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=function(e){var t=e.defineMetadata,r=e.hasOwnMetadata,n=e.getOwnMetadata,a=e.getOwnMetadataKeys,i=e.deleteMetadata,o=new y;return{isProviderFor:function(e,t){var r=o.get(e);return R(r)?!!a(e,t).length&&(R(r)&&(r=new f,o.set(e,r)),r.add(t),!0):r.has(t)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:r,OrdinaryGetOwnMetadata:n,OrdinaryOwnMetadataKeys:a,OrdinaryDeleteMetadata:i}}(t.Reflect));var i=new y,o={registerProvider:s,getProvider:u,setProvider:h};return o;function s(t){if(!Object.isExtensible(o))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case R(r):r=t;break;case r===t:break;case R(n):n=t;break;case n===t:break;default:void 0===a&&(a=new f),a.add(t)}}function c(t,i){if(!R(r)){if(r.isProviderFor(t,i))return r;if(!R(n)){if(n.isProviderFor(t,i))return r;if(!R(a))for(var o=F(a);;){var s=k(o);if(!s)return;var c=x(s);if(c.isProviderFor(t,i))return I(o),c}}}if(!R(e)&&e.isProviderFor(t,i))return e}function u(e,t){var r,n=i.get(e);return R(n)||(r=n.get(t)),R(r)?(R(r=c(e,t))||(R(n)&&(n=new l,i.set(e,n)),n.set(t,r)),r):r}function d(e){if(R(e))throw new TypeError;return r===e||n===e||!R(a)&&a.has(e)}function h(e,t,r){if(!d(r))throw new Error("Metadata provider not registered.");var n=u(e,t);if(n!==r){if(!R(n))return!1;var a=i.get(e);R(a)&&(a=new l,i.set(e,a)),a.set(t,r)}return!0}}()),!R(p)&&T(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,p,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}(),g=function(e){var t=new y,r={isProviderFor:function(e,r){var n=t.get(e);return!R(n)&&n.has(r)},OrdinaryDefineOwnMetadata:function(e,t,r,a){n(r,a,!0).set(e,t)},OrdinaryHasOwnMetadata:function(e,t,r){var a=n(t,r,!1);return!R(a)&&P(a.has(e))},OrdinaryGetOwnMetadata:function(e,t,r){var a=n(t,r,!1);if(!R(a))return a.get(e)},OrdinaryOwnMetadataKeys:function(e,t){var r=[],a=n(e,t,!1);if(R(a))return r;for(var i=F(a.keys()),o=0;;){var s=k(i);if(!s)return r.length=o,r;var c=x(s);try{r[o]=c}catch(e){try{I(i)}finally{throw e}}o++}},OrdinaryDeleteMetadata:function(e,r,a){var i=n(r,a,!1);if(R(i))return!1;if(!i.delete(e))return!1;if(0===i.size){var o=t.get(r);R(o)||(o.delete(a),0===o.size&&t.delete(o))}return!0}};return h.registerProvider(r),r;function n(n,a,i){var o=t.get(n),s=!1;if(R(o)){if(!i)return;o=new l,t.set(n,o),s=!0}var c=o.get(a);if(R(c)){if(!i)return;if(c=new l,o.set(a,c),!e.setProvider(n,a,r))throw o.delete(a),s&&t.delete(n),new Error("Wrong provider for target.")}return c}}(h);function v(e,t,r){if(E(e,t,r))return!0;var n=U(t);return!w(n)&&v(e,n,r)}function E(e,t,r){var n=G(t,r,!1);return!R(n)&&P(n.OrdinaryHasOwnMetadata(e,t,r))}function M(e,t,r){if(E(e,t,r))return _(e,t,r);var n=U(t);return w(n)?void 0:M(e,n,r)}function _(e,t,r){var n=G(t,r,!1);if(!R(n))return n.OrdinaryGetOwnMetadata(e,t,r)}function m(e,t,r,n){G(r,n,!0).OrdinaryDefineOwnMetadata(e,t,r,n)}function O(e,t){var r=b(e,t),n=U(e);if(null===n)return r;var a=O(n,t);if(a.length<=0)return r;if(r.length<=0)return a;for(var i=new f,o=[],s=0,c=r;s<c.length;s++){var u=c[s];i.has(u)||(i.add(u),o.push(u))}for(var d=0,l=a;d<l.length;d++)u=l[d],i.has(u)||(i.add(u),o.push(u));return o}function b(e,t){var r=G(e,t,!1);return r?r.OrdinaryOwnMetadataKeys(e,t):[]}function S(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function R(e){return void 0===e}function w(e){return null===e}function T(e){return"object"==typeof e?null!==e:"function"==typeof e}function A(e,t){switch(S(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",n=N(e,a);if(void 0!==n){var i=n.call(e,r);if(T(i))throw new TypeError;return i}return function(e,t){if("string"===t){var r=e.toString;if(j(r)&&!T(a=r.call(e)))return a;if(j(n=e.valueOf)&&!T(a=n.call(e)))return a}else{var n;if(j(n=e.valueOf)&&!T(a=n.call(e)))return a;var a,i=e.toString;if(j(i)&&!T(a=i.call(e)))return a}throw new TypeError}(e,"default"===r?"number":r)}function P(e){return!!e}function V(e){var t=A(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function D(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function j(e){return"function"==typeof e}function L(e){return"function"==typeof e}function K(e,t){return e===t||e!=e&&t!=t}function N(e,t){var r=e[t];if(null!=r){if(!j(r))throw new TypeError;return r}}function F(e){var t=N(e,i);if(!j(t))throw new TypeError;var r=t.call(e);if(!T(r))throw new TypeError;return r}function x(e){return e.value}function k(e){var t=e.next();return!t.done&&t}function I(e){var t=e.return;t&&t.call(e)}function U(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===d)return t;if(t!==d)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var a=n.constructor;return"function"!=typeof a||a===e?t:a}function G(e,t,r){var n=h.getProvider(e,t);if(!R(n))return n;if(r){if(h.setProvider(e,t,g))return g;throw new Error("Illegal state.")}}function H(e){return e.__=void 0,delete e.__,e}e("decorate",(function(e,t,r,n){if(R(r)){if(!D(e))throw new TypeError;if(!L(t))throw new TypeError;return function(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!R(n)&&!w(n)){if(!L(n))throw new TypeError;t=n}}return t}(e,t)}if(!D(e))throw new TypeError;if(!T(t))throw new TypeError;if(!T(n)&&!R(n)&&!w(n))throw new TypeError;return w(n)&&(n=void 0),function(e,t,r,n){for(var a=e.length-1;a>=0;--a){var i=(0,e[a])(t,r,n);if(!R(i)&&!w(i)){if(!T(i))throw new TypeError;n=i}}return n}(e,t,r=V(r),n)})),e("metadata",(function(e,t){return function(r,n){if(!T(r))throw new TypeError;if(!R(n)&&!function(e){switch(S(e)){case 3:case 4:return!0;default:return!1}}(n))throw new TypeError;m(e,t,r,n)}})),e("defineMetadata",(function(e,t,r,n){if(!T(r))throw new TypeError;return R(n)||(n=V(n)),m(e,t,r,n)})),e("hasMetadata",(function(e,t,r){if(!T(t))throw new TypeError;return R(r)||(r=V(r)),v(e,t,r)})),e("hasOwnMetadata",(function(e,t,r){if(!T(t))throw new TypeError;return R(r)||(r=V(r)),E(e,t,r)})),e("getMetadata",(function(e,t,r){if(!T(t))throw new TypeError;return R(r)||(r=V(r)),M(e,t,r)})),e("getOwnMetadata",(function(e,t,r){if(!T(t))throw new TypeError;return R(r)||(r=V(r)),_(e,t,r)})),e("getMetadataKeys",(function(e,t){if(!T(e))throw new TypeError;return R(t)||(t=V(t)),O(e,t)})),e("getOwnMetadataKeys",(function(e,t){if(!T(e))throw new TypeError;return R(t)||(t=V(t)),b(e,t)})),e("deleteMetadata",(function(e,t,r){if(!T(t))throw new TypeError;if(R(r)||(r=V(r)),!T(t))throw new TypeError;R(r)||(r=V(r));var n=G(t,r,!1);return!R(n)&&n.OrdinaryDeleteMetadata(e,t,r)}))}(a,n),void 0===n.Reflect&&(n.Reflect=e)}()}(n||(n={}))}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(729)})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("decorator-validation",[],t):"object"==typeof exports?exports["decorator-validation"]=t():e["decorator-validation"]=t()}(this,(()=>(()=>{var e={729:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,o(r(935),t),o(r(839),t),o(r(965),t),o(r(847),t),t.VERSION="##VERSION##"},6:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Model=void 0,t.validate=h;const n=r(772),o=r(735),a=r(19),i=r(402),s=r(154),c=r(38),u=r(936),l=r(770),d=r(174),f=r(523),p=r(593),y=r(687);function h(e,...t){const r=[];for(const o in e)e.hasOwnProperty(o)&&-1===t.indexOf(o)&&r.push((0,d.getPropertyDecorators)(n.ValidationKeys.REFLECT,e,o));const o=r.reduce(((t,r)=>{const{prop:o,decorators:a}=r;if(!a||!a.length)return t;const c=a[0];a.find((e=>e.key===n.ValidationKeys.TYPE||!!e.props.types?.find((e=>e===c.props.name))))&&a.shift();let u=a.reduce(((t,r)=>{const n=l.Validation.get(r.key);if(!n)return t;const a=n.hasErrors(e[o.toString()],...r.key===s.ModelKeys.TYPE?[r.props]:Object.values(r.props));return a&&((t=t||{})[r.key]=a),t}),void 0);return u=u||Object.keys(e).filter((e=>!u||!u[e])).reduce(((t,r)=>{let o;const a=(0,d.getPropertyDecorators)(n.ValidationKeys.REFLECT,e,r).decorators,c=a.filter((e=>-1!==[s.ModelKeys.TYPE,n.ValidationKeys.TYPE].indexOf(e.key)));if(!c||!c.length)return t;const u=c.pop(),l=u.props.name?[u.props.name]:Array.isArray(u.props.customTypes)?u.props.customTypes:[u.props.customTypes],f=Object.values(i.ReservedModels).map((e=>e.toLowerCase()));return l.forEach((t=>{if(-1===f.indexOf(t.toLowerCase()))switch(t){case"Array":case"Set":if(a.length&&a.find((e=>e.key===n.ValidationKeys.LIST))){const a="Array"===t?e[r].find((e=>e.hasErrors())):e[r].values().find((e=>e.hasErrors()));a&&(o=(0,p.sf)(n.DEFAULT_ERROR_MESSAGES.LIST_INSIDE,a.toString()))}break;default:try{e[r]&&(o=e[r].hasErrors())}catch(e){console.warn((0,p.sf)("Model should be validatable but its not"))}}})),o&&((t=t||{})[r]=o),t}),void 0),u&&((t=t||{})[r.prop.toString()]=u),t}),void 0);return o?new a.ModelErrorDefinition(o):void 0}let g,v,E,_;class M{constructor(e){}hasErrors(...e){return h(this,...e)}equals(e,...t){return(0,y.isEqual)(this,e,...t)}serialize(){return M.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}toHash(){return M.getHashingFunction()(this).toString()}static deserialize(e){return M.getSerializer().deserialize(e)}static serialize(e){return M.getSerializer().serialize(e)}static hash(e){return M.getHashingFunction()(e)}static fromObject(e,t){return(0,c.constructFromObject)(e,t)}static fromModel(e,t){return(0,c.constructFromModel)(e,t)}static setBuilder(e){g=e}static getBuilder(){return g}static getRegistry(){return v||(v=new u.ModelRegistryManager),v}static setRegistry(e){v=e}static register(e,t){return M.getRegistry().register(e,t)}static get(e){return M.getRegistry().get(e)}static build(e={},t){return M.getRegistry().build(e,t)}static setSerializer(e){E=e}static getSerializer(){return E||(E=new o.JSONSerializer),E}static setHashingFunction(e){_=e}static getHashingFunction(){return _||(_=f.hashObj),_}}t.Model=M},19:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelErrorDefinition=void 0,t.ModelErrorDefinition=class{constructor(e){for(const t in e)e.hasOwnProperty(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=>e.hasOwnProperty(t)&&"function"!=typeof e[t])).reduce(((t,r)=>{let n=Object.keys(e[r]).reduce(((t,n)=>(t?t+=`\n${e[r][n]}`:t=e[r][n],t)),void 0);return n&&(n=`${r} - ${n}`,t?t+=`\n${n}`:t=n),t}),"")}}},936:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelRegistryManager=void 0,t.bulkModelRegister=function(...e){e.forEach((e=>{const t=e.constructor?e.constructor:e;n.Model.register(t,e.name)}))};const n=r(6),o=r(154),a=r(174),i=r(593);t.ModelRegistryManager=class{constructor(e=o.ModelKeys.ANCHOR,t=a.isModel){this.cache={},this.testFunction=t,this.anchorKey=e}register(e,t){if("function"!=typeof e)throw new 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 new Error("Provided obj is not a Model object");const r=t||e[this.anchorKey].class;if(!(r in this.cache))throw new Error((0,i.sf)("Provided class {0} is not a registered Model object",r));return new this.cache[r](e)}}},402:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.ReservedModels=t.Primitives=void 0,function(e){e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"}(r||(t.Primitives=r={})),function(e){e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"}(n||(t.ReservedModels=n={}))},38:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.constructFromObject=function(e,t){if(!t)return e;for(const r in t)t.hasOwnProperty(r)&&(e.hasOwnProperty(r)||e.prototype&&e.prototype.hasOwnProperty(r))&&(e[r]=t[r]||void 0);return e},t.constructFromModel=function(e,t){if(!t)return e;let r,u;for(const l in t)if(t.hasOwnProperty(l)&&(e.hasOwnProperty(l)||e.prototype&&e.prototype.hasOwnProperty(l))){if(e[l]=t[l]||void 0,"object"!=typeof e[l])continue;if((0,s.isModel)(e[l])){try{e[l]=n.Model.build(e[l])}catch(e){console.error(e)}continue}const d=(0,s.getPropertyDecorators)(o.ValidationKeys.REFLECT,e,l).decorators;if(r=d.filter((e=>-1!==[i.ModelKeys.TYPE,o.ValidationKeys.TYPE].indexOf(e.key))),!r||!r.length)throw new Error((0,c.sf)("failed to find decorators for property {0}",l));u=r.pop();const f=u.props.name?[u.props.name]:Array.isArray(u.props.customTypes)?u.props.customTypes:[u.props.customTypes],p=Object.values(a.ReservedModels).map((e=>e.toLowerCase()));f.forEach((t=>{if(-1===p.indexOf(t.toLowerCase()))try{switch(t){case"Array":case"Set":if(d.length){const r=d.find((e=>e.key===o.ValidationKeys.LIST));if(r&&("Array"===t&&(e[l]=e[l].map((e=>n.Model.build(e,r.props.class)))),"Set"===t)){const t=new Set;for(const o of e[l])t.add(n.Model.build(o,r.props.class));e[l]=t}}break;default:e[l]&&(e[l]=n.Model.build(e[l],t))}}catch(e){console.log(e)}}))}return e},t.construct=function(e,...t){const r=(...t)=>new e(...t);return r.prototype=e.prototype,r(...t)};const n=r(6),o=r(772),a=r(402),i=r(154),s=r(174),c=r(593)},893:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getModelKey=void 0,t.model=function(e,r){return i=>{const s=function(...s){const c=(0,n.construct)(i,...s),u=a.Model.getBuilder();u&&u(c,s.length?s[0]:void 0);const l=Object.assign({},{class:i.name});return Object.defineProperty(c,o.ModelKeys.ANCHOR,{writable:!1,enumerable:!1,configurable:!1,value:l}),Reflect.defineMetadata((0,t.getModelKey)(o.ModelKeys.MODEL),Object.assign(l,e||{}),c.constructor),r&&r(c,...s),c};return s.prototype=i.prototype,Object.defineProperty(s,"name",{writable:!1,enumerable:!0,configurable:!1,value:i.prototype.constructor.name}),a.Model.register(s),s}};const n=r(38),o=r(154),a=r(6);t.getModelKey=e=>o.ModelKeys.REFLECT+e},847:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(402),t),o(r(38),t),o(r(893),t),o(r(6),t),o(r(19),t),o(r(936),t),o(r(282),t)},282:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.metadata=function(e,t){return(r,n,o)=>{o?Reflect.defineMetadata(e,t,o.value):n?Reflect.defineMetadata(e,t,r,n):Reflect.defineMetadata(e,t,r)}},r(630)},839:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(501),t),o(r(174),t)},174:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAllPropertyDecorators=void 0,t.getPropertyDecorators=i,t.getTypeFromDecorator=function(e,t){const r=i(n.ModelKeys.REFLECT,e,t,!1);if(!r||!r.decorators)return;const o=r.decorators.shift(),a=o.props?o.props.name:void 0;return"Function"!==a?a:void 0},t.getAllProperties=function(e,t=!0,r="Object"){const n=[];let o=e;const a=function(){if(!t)return;const e=Object.getPrototypeOf(o);return e&&e.constructor.name!==r?(o=e,o):void 0};do{Object.getOwnPropertyNames(o).forEach((function(e){-1===n.indexOf(e)&&n.push(e)}))}while(a());return n},t.getClassDecorators=s,t.checkType=c,t.checkTypes=u,t.evaluateDesignTypes=function(e,t){switch(typeof t){case"string":return c(e,t);case"object":return!Array.isArray(t)||u(e,t);case"function":return!t.name||"Object"===t.name||c(e,t.name);default:return!0}},t.isModel=function(e){return!!e[n.ModelKeys.ANCHOR]||!!s(n.ModelKeys.REFLECT,e).find((e=>e.key===n.ModelKeys.MODEL&&e.props&&e.props.class))};const n=r(154),o=r(593),a=r(687);function i(e,t,r,s=!1,c=!0,u){const l=function(e,t,r,o=!1,a){const i=Reflect.getMetadataKeys(t,r).filter((t=>o?t.toString().startsWith(e):t===n.ModelKeys.TYPE||t.toString().startsWith(e))).reduce(((o,a)=>{const i={key:a!==n.ModelKeys.TYPE?a.substring(e.length):a,props:Reflect.getMetadata(a,t,r)};return o.concat(i)}),a||[]);return{prop:r.toString(),decorators:i}}(e,t,r,s,u);return c&&Object.getPrototypeOf(t)!==Object.prototype?i(e,Object.getPrototypeOf(t.constructor),r,!0,c,l.decorators):{prop:l.prop,decorators:function(e){const r={};return e.filter((e=>e.key in r?((0,a.isEqual)(e.props,r[e.key])||console.log((0,o.sf)("Found a similar decorator for the {0} property of a {1} model but with different attributes. The original one will be kept",e.key,t.constructor.name)),!1):(r[e.key.toString()]=e.props,!0)))}(l.decorators)}}function s(e,t){return Reflect.getOwnMetadataKeys(t.constructor).filter((t=>t.toString().startsWith(e))).reduce(((r,n)=>{const o={key:n.substring(e.length),props:Reflect.getMetadata(n,t.constructor)};return r.concat(o)}),[])}function c(e,t){return typeof e===t||e.constructor&&e.constructor.name.toLowerCase()===t.toLowerCase()}function u(e,t){return!t.every((t=>!c(e,t)))}r(630),t.getAllPropertyDecorators=function(e,...t){if(t&&t.length)return Object.getOwnPropertyNames(e).reduce(((r,n)=>(t.forEach(((t,o)=>{const a=i(t,e,n,0!==o);r||(r={}),function(e,t,r){r&&r.length&&(e[t]||(e[t]=[]),e[t].push(...r))}(r,n,a.decorators)})),r)),void 0)}},154:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ModelKeys=void 0,function(e){e.REFLECT="model.definition.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__modelDefinition"}(r||(t.ModelKeys=r={}))},46:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dateFromFormat=a,t.bindDateToString=i,t.isValidDate=s,t.twoDigitPad=c,t.formatDate=u,t.parseDate=function(e,t){let r;if(t){if(t instanceof Date)try{r=a(u(t,e),e)}catch(r){throw new Error((0,o.sf)("Could not convert date {0} to format: {1}",t.toString(),e))}else if("string"==typeof t)r=a(t,e);else if("number"==typeof t)r=a(u(new Date(t),e),e);else{if(!s(t))throw new Error(`Invalid value provided ${t}`);try{r=a(u(new Date(t),e),e)}catch(r){throw new Error((0,o.sf)("Could not convert date {0} to format: {1}",t,e))}}return i(r,e)}},r(630);const n=r(772),o=r(593);function a(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 o=new RegExp(r,"g").exec(e);if(!o||!o.groups)return new Date(e);const a=function(e){if(!e)return 0;const t=parseInt(e);return isNaN(t)?0:t},i=a(o.groups.year),s=a(o.groups.day),c=o.groups.ampm;let u=a(o.groups.hour);c&&(u="PM"===c?u+12:u);const l=a(o.groups.minutes),d=a(o.groups.seconds),f=a(o.groups.milis),p=o.groups.monthname,y=o.groups.monthnamesmall;let h=o.groups.month;if(p)h=n.MONTH_NAMES.indexOf(p);else if(y){const t=n.MONTH_NAMES.find((e=>e.toLowerCase().startsWith(y.toLowerCase())));if(!t)return new Date(e);h=n.MONTH_NAMES.indexOf(t)}else h=a(`${h}`);return new Date(i,h-1,s,u,l,d,f)}function i(e,t){if(!e)return;const r=()=>u(e,t);return Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:r}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:r}),e}function s(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}function c(e){return e<10?"0"+e:e.toString()}function u(e,t="yyyy/MM/dd"){const r=e.getDate(),o=e.getMonth(),a=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),u=e.getSeconds(),l=e.getMilliseconds(),d=i%12,f=c(d),p=c(i),y=c(s),h=c(u),g=i<12?"AM":"PM",v=n.DAYS_OF_WEEK_NAMES[e.getDay()],E=v.substr(0,3),_=c(r),M=o+1,m=c(M),O=n.MONTH_NAMES[o],b=O.substr(0,3),R=a+"",S=R.substr(2,2);return(t=t.replace("hh",f).replace("h",d.toString()).replace("HH",p).replace("H",i.toString()).replace("mm",y).replace("m",s.toString()).replace("ss",h).replace("s",u.toString()).replace("S",l.toString()).replace("dd",_).replace("d",r.toString()).replace("EEEE",v).replace("EEE",E).replace("yyyy",R).replace("yy",S).replace("aaa",g)).indexOf("MMM")>-1?t.replace("MMMM",O).replace("MMM",b):t.replace("MM",m).replace("M",M.toString())}},687:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEqual=function e(t,r,...n){if(t===r)return!0;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(!t||!r||"object"!=typeof t&&"object"!=typeof r)return t===r;if(null==t||null==r)return!1;if(typeof t!=typeof r)return!1;if(t.prototype!==r.prototype)return!1;const o=Object.keys(t).filter((e=>-1===n.indexOf(e)));return o.length===Object.keys(r).filter((e=>-1===n.indexOf(e))).length&&o.every((o=>-1!==n.indexOf(o)||e(t[o],r[o],...n)))}},523:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hashCode=o,t.hashSerialization=function(e){return o(n.Model.serialize(e))},t.hashObj=function(e){const t=function(e,t){const r=n(t);return"string"==typeof r?n((e||"")+n(t)):0|(e=((e=e||0)<<5)-e+r)},r=o,n=function(e){return 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};const n=r(6);function o(e){e=String(e);let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t}},935:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(154),t),o(r(46),t),o(r(687),t),o(r(523),t),o(r(735),t),o(r(904),t),o(r(735),t),o(r(593),t)},904:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},735:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JSONSerializer=void 0;const n=r(6),o=r(154);t.JSONSerializer=class{preSerialize(e){const t=Object.assign({},e);return t[o.ModelKeys.ANCHOR]=e[o.ModelKeys.ANCHOR],t}deserialize(e){const t=JSON.parse(e);return n.Model.build(t)}serialize(e){return JSON.stringify(this.preSerialize(e))}}},593:(e,t)=>{"use strict";function r(e,...t){return e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r]:e}))}Object.defineProperty(t,"__esModule",{value:!0}),t.sf=void 0,t.stringFormat=r,t.sf=r},770:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validation=void 0;const n=r(375),o=r(436),a=r(154);class i{static{this.actingValidatorRegistry=void 0}constructor(){}static setRegistry(e,t){t&&i.actingValidatorRegistry&&i.actingValidatorRegistry.getKeys().forEach((r=>{const n=e.get(r);n&&e.register(t(n))})),i.actingValidatorRegistry=e}static getRegistry(){return i.actingValidatorRegistry||(i.actingValidatorRegistry=new o.ValidatorRegistry({validator:n.TypeValidator,validationKey:a.ModelKeys.TYPE,save:!1})),i.actingValidatorRegistry}static get(e){return i.getRegistry().get(e)}static register(...e){return i.getRegistry().register(...e)}}t.Validation=i},395:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateValidator=void 0;const a=r(116),i=r(772),s=r(787);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.DATE){super(i.ValidationKeys.DATE,e,Number.name,Date.name,String.name)}hasErrors(e,t,r){if(void 0!==e)return"string"==typeof e&&(e=new Date(e)),isNaN(e.getDate())?this.getMessage(r||this.message):void 0}};t.DateValidator=c,t.DateValidator=c=n([(0,s.validator)(i.ValidationKeys.DATE),o("design:paramtypes",[String])],c)},335:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailValidator=void 0;const a=r(772),i=r(273),s=r(787);let c=class extends i.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.EMAIL){super(a.ValidationKeys.EMAIL,e)}hasErrors(e,t){return super.hasErrors(e,a.DEFAULT_PATTERNS.EMAIL,t)}};t.EmailValidator=c,t.EmailValidator=c=n([(0,s.validator)(a.ValidationKeys.EMAIL),o("design:paramtypes",[String])],c)},407:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ListValidator=void 0;const a=r(116),i=r(772),s=r(787);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.LIST){super(i.ValidationKeys.LIST,e,Array.name,Set.name)}hasErrors(e,t,r){if(!e||(Array.isArray(e)?!e.length:!e.size))return;let n;for(let o=0;o<(Array.isArray(e)?e.length:e.size);o++)switch(n=e[o],typeof n){case"object":case"function":if(!n.constructor||n.constructor.name!==t)return this.getMessage(r||this.message,t);break;default:if(typeof n!==t)return this.getMessage(r||this.message,t)}}};t.ListValidator=c,t.ListValidator=c=n([(0,s.validator)(i.ValidationKeys.LIST),o("design:paramtypes",[String])],c)},169:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxLengthValidator=void 0;const a=r(116),i=r(772),s=r(787);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){super(i.ValidationKeys.MAX_LENGTH,e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length>t?this.getMessage(r||this.message,t):void 0}};t.MaxLengthValidator=c,t.MaxLengthValidator=c=n([(0,s.validator)(i.ValidationKeys.MAX_LENGTH),o("design:paramtypes",[String])],c)},909:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxValidator=void 0;const a=r(116),i=r(772),s=r(787);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MAX){super(i.ValidationKeys.MAX,e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Max param defined");return e>t?this.getMessage(r||this.message,t):void 0}}};t.MaxValidator=c,t.MaxValidator=c=n([(0,s.validator)(i.ValidationKeys.MAX),o("design:paramtypes",[String])],c)},519:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinLengthValidator=void 0;const a=r(116),i=r(772),s=r(787);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){super(i.ValidationKeys.MIN_LENGTH,e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length<t?this.getMessage(r||this.message,t):void 0}};t.MinLengthValidator=c,t.MinLengthValidator=c=n([(0,s.validator)(i.ValidationKeys.MIN_LENGTH),o("design:paramtypes",[String])],c)},651:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinValidator=void 0;const a=r(116),i=r(772),s=r(787);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MIN){super(i.ValidationKeys.MIN,e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Min param defined");return e<t?this.getMessage(r||this.message,t):void 0}}};t.MinValidator=c,t.MinValidator=c=n([(0,s.validator)(i.ValidationKeys.MIN),o("design:paramtypes",[String])],c)},354:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordValidator=void 0;const a=r(273),i=r(772),s=r(787);let c=class extends a.PatternValidator{constructor(e=i.DEFAULT_ERROR_MESSAGES.PASSWORD,t=i.DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH){super(i.ValidationKeys.PASSWORD,e),this.pattern=t}hasErrors(e,t,r){return super.hasErrors(e,t||this.pattern,r||this.message)}};t.PasswordValidator=c,t.PasswordValidator=c=n([(0,s.validator)(i.ValidationKeys.PASSWORD),o("design:paramtypes",[Object,RegExp])],c)},273:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PatternValidator=t.regexpParser=void 0;const a=r(116),i=r(772),s=r(787);t.regexpParser=new RegExp("^/(.+)/([gimus]*)$");let c=class extends a.Validator{constructor(e=i.ValidationKeys.PATTERN,t=i.DEFAULT_ERROR_MESSAGES.PATTERN){super(e,t,"string")}getPattern(e){if(!t.regexpParser.test(e))return new RegExp(e);const r=e.match(t.regexpParser);return new RegExp(r[1],r[2])}hasErrors(e,t,r){if(e){if(!t)throw new Error("Missing Pattern");return(t="string"==typeof t?this.getPattern(t):t).lastIndex=0,t.test(e)?void 0:this.getMessage(r||this.message)}}};t.PatternValidator=c,t.PatternValidator=c=n([(0,s.validator)(i.ValidationKeys.PATTERN),o("design:paramtypes",[String,String])],c)},812:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredValidator=void 0;const a=r(116),i=r(772),s=r(787);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.REQUIRED){super(i.ValidationKeys.REQUIRED,e)}hasErrors(e,t){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(t||this.message):void 0;default:return e?void 0:this.getMessage(t||this.message)}}};t.RequiredValidator=c,t.RequiredValidator=c=n([(0,s.validator)(i.ValidationKeys.REQUIRED),o("design:paramtypes",[String])],c)},553:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.StepValidator=void 0;const a=r(116),i=r(772),s=r(787);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.STEP){super(i.ValidationKeys.STEP,e,"number","string")}hasErrors(e,t,r){if(void 0!==e)return Number(e)%Number(t)!=0?this.getMessage(r||this.message,t):void 0}};t.StepValidator=c,t.StepValidator=c=n([(0,s.validator)(i.ValidationKeys.STEP),o("design:paramtypes",[String])],c)},375:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeValidator=void 0;const n=r(116),o=r(772),a=r(154),i=r(174);class s extends n.Validator{constructor(e=o.DEFAULT_ERROR_MESSAGES.TYPE){super(a.ModelKeys.TYPE,e)}hasErrors(e,t,r){if(void 0!==e)return(0,i.evaluateDesignTypes)(e,t)?void 0:this.getMessage(r||this.message,"string"==typeof t?t:Array.isArray(t)?t.join(", "):t.name,typeof e)}}t.TypeValidator=s},964:function(e,t,r){"use strict";var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.URLValidator=void 0;const a=r(772),i=r(273),s=r(787);let c=class extends i.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.URL){super(a.ValidationKeys.URL,e)}hasErrors(e,t){return super.hasErrors(e,a.DEFAULT_PATTERNS.URL,t)}};t.URLValidator=c,t.URLValidator=c=n([(0,s.validator)(a.ValidationKeys.URL),o("design:paramtypes",[String])],c)},116:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validator=void 0;const n=r(772),o=r(593),a=r(174);t.Validator=class{constructor(e,t=n.DEFAULT_ERROR_MESSAGES.DEFAULT,...r){this.validationKey=e,this.message=t,r.length&&(this.acceptedTypes=r),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(e,...t){return(0,o.sf)(e,...t)}checkTypeAndHasErrors(e){return function(t,...r){return void 0!==t&&this.acceptedTypes?(0,a.checkTypes)(t,this.acceptedTypes)?e(t,...r):this.getMessage(n.DEFAULT_ERROR_MESSAGES.TYPE,this.acceptedTypes.join(", "),typeof t):e(t,...r)}.bind(this)}}},436:(e,t)=>{"use strict";function r(e){return e.constructor&&e.hasErrors}Object.defineProperty(t,"__esModule",{value:!0}),t.ValidatorRegistry=void 0,t.isValidator=r,t.ValidatorRegistry=class{constructor(...e){this.cache={},this.customKeyChache={},this.register(...e)}getCustomKeys(){return Object.assign({},this.customKeyChache)}getKeys(){return Object.keys(this.cache)}get(e){if(!(e in this.cache))return;const t=this.cache[e];if(r(t))return t;const n=new(t.default||t);return this.cache[e]=n,n}register(...e){e.forEach((e=>{if(r(e)){if(e.validationKey in this.cache)return;this.cache[e.validationKey]=e}else{const{validationKey:t,validator:r,save:n}=e;if(t in this.cache)return;if(this.cache[t]=r,!n)return;const o={};o[t.toUpperCase()]=t,this.customKeyChache=Object.assign({},this.customKeyChache,o)}}))}}},772:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PATTERNS=t.DEFAULT_ERROR_MESSAGES=t.DAYS_OF_WEEK_NAMES=t.MONTH_NAMES=t.ValidationKeys=void 0,t.ValidationKeys={REFLECT:"model.validation.",REQUIRED:"required",MIN:"min",MAX:"max",STEP:"step",MIN_LENGTH:"minlength",MAX_LENGTH:"maxlength",PATTERN:"pattern",EMAIL:"email",URL:"url",DATE:"date",TYPE:"type",PASSWORD:"password",LIST:"list"},t.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],t.DAYS_OF_WEEK_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],t.DEFAULT_ERROR_MESSAGES={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}",LIST_INSIDE:"Elements of list are invalid: {0}",MODEL_NOT_FOUND:"No model registered under {0}"},t.DEFAULT_PATTERNS={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}}},787:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validator=function(e){return t=>(n.Validation.register({validator:t,validationKey:e,save:!0}),t)};const n=r(770)},493:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Validators=void 0;const a=r(395),i=r(375),s=r(354),c=r(553),u=r(964),l=r(273),d=r(651),f=r(519),p=r(909),y=r(169),h=r(812),g=r(335),v=r(407);o(r(772),t),o(r(395),t),o(r(787),t),o(r(335),t),o(r(407),t),o(r(169),t),o(r(909),t),o(r(519),t),o(r(651),t),o(r(354),t),o(r(273),t),o(r(812),t),o(r(553),t),o(r(168),t),o(r(375),t),o(r(964),t),o(r(116),t),o(r(436),t),t.Validators={EmailValidator:g.EmailValidator,RequiredValidator:h.RequiredValidator,MaxLengthValidator:y.MaxLengthValidator,MaxValidator:p.MaxValidator,MinLengthValidator:f.MinLengthValidator,MinValidator:d.MinValidator,PatternValidator:l.PatternValidator,URLValidator:u.URLValidator,StepValidator:c.StepValidator,DateValidator:a.DateValidator,TypeValidator:i.TypeValidator,PasswordValidator:s.PasswordValidator,ListValidator:v.ListValidator}},168:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},475:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getValidationKey=l,t.required=function(e=i.DEFAULT_ERROR_MESSAGES.REQUIRED){return(0,a.metadata)(l(i.ValidationKeys.REQUIRED),{message:e})},t.min=function(e,t=i.DEFAULT_ERROR_MESSAGES.MIN){return(0,a.metadata)(l(i.ValidationKeys.MIN),{value:e,message:t,types:[Number.name,Date.name]})},t.max=function(e,t=i.DEFAULT_ERROR_MESSAGES.MAX){return(0,a.metadata)(l(i.ValidationKeys.MAX),{value:e,message:t,types:[Number.name,Date.name]})},t.step=function(e,t=i.DEFAULT_ERROR_MESSAGES.STEP){return(0,a.metadata)(l(i.ValidationKeys.STEP),{value:e,message:t,types:[Number.name]})},t.minlength=function(e,t=i.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){return(0,a.metadata)(l(i.ValidationKeys.MIN_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]})},t.maxlength=function(e,t=i.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){return(0,a.metadata)(l(i.ValidationKeys.MAX_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]})},t.pattern=function(e,t=i.DEFAULT_ERROR_MESSAGES.PATTERN){return(0,a.metadata)(l(i.ValidationKeys.PATTERN),{value:"string"==typeof e?e:e.toString(),message:t,types:[String.name]})},t.email=function(e=i.DEFAULT_ERROR_MESSAGES.EMAIL){return(0,a.metadata)(l(i.ValidationKeys.EMAIL),{message:e,types:[String.name]})},t.url=function(e=i.DEFAULT_ERROR_MESSAGES.URL){return(0,a.metadata)(l(i.ValidationKeys.URL),{message:e,types:[String.name]})},t.type=d,t.date=function(e="dd/MM/yyyy",t=i.DEFAULT_ERROR_MESSAGES.DATE){return(r,n)=>{Reflect.defineMetadata(l(i.ValidationKeys.DATE),{format:e,message:t,types:[Date.name]},r,n);const o=new WeakMap;Object.defineProperty(r,n,{configurable:!1,set(t){const r=Object.getOwnPropertyDescriptor(this,n);r&&!r.configurable||Object.defineProperty(this,n,{enumerable:!0,configurable:!1,get:()=>o.get(this),set:t=>{let r;try{r=(0,u.parseDate)(e,t),o.set(this,r)}catch(e){console.error((0,s.sf)("Failed to parse date: {0}",e.message||e))}}}),this[n]=t},get(){console.log("here")}})}},t.password=function(e=i.DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH,t=i.DEFAULT_ERROR_MESSAGES.PASSWORD,r=c.PasswordValidator){return(n,a)=>{Reflect.defineMetadata(l(i.ValidationKeys.PASSWORD),{pattern:e,message:t,types:[String.name]},n,a),o.Validation.register({validator:r,validationKey:i.ValidationKeys.PASSWORD,save:!0})}},t.list=f,t.set=function(e,t=i.DEFAULT_ERROR_MESSAGES.LIST,r){return(n,o)=>{f(e,"Set",t,r)(n,o)}},r(630);const n=r(407),o=r(770),a=r(501),i=r(772),s=r(593),c=r(354),u=r(935);function l(e){return i.ValidationKeys.REFLECT+e}function d(e,t=i.DEFAULT_ERROR_MESSAGES.TYPE){return(0,a.metadata)(l(i.ValidationKeys.TYPE),{customTypes:e,message:t})}function f(e,t="Array",r=i.DEFAULT_ERROR_MESSAGES.LIST,a=n.ListValidator){return(n,s)=>{d(t)(n,s),Reflect.defineMetadata(l(i.ValidationKeys.LIST),{class:e.name,type:t,message:r},n,s),o.Validation.register({validator:a,validationKey:i.ValidationKeys.LIST,save:!0})}}},965:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(493),t),o(r(475),t),o(r(792),t),o(r(770),t)},792:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},630:(e,t,r)=>{var n;!function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=o(e);function o(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==t.Reflect&&(n=o(t.Reflect,n)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,o=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",a=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!i&&!s,u={create:i?function(){return H(Object.create(null))}:s?function(){return H({__proto__:null})}:function(){return H({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),d="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},t=[],r=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[a]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,o=r+1;o<n;o++)this._keys[o-1]=this._keys[o],this._values[o-1]=this._values[o];return this._keys.length--,this._values.length--,N(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new r(this._keys,this._values,n)},t.prototype.values=function(){return new r(this._keys,this._values,o)},t.prototype.entries=function(){return new r(this._keys,this._values,i)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[a]=function(){return this.entries()},t.prototype._find=function(e,t){if(!N(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(N(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function n(e,t){return e}function o(e,t){return t}function i(e,t){return[e,t]}}(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new d}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[a]=function(){return this.keys()},e}(),p="function"==typeof WeakMap?WeakMap:function(){var e=u.create(),t=n();return function(){function e(){this._key=n()}return e.prototype.has=function(e){var t=o(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=o(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return o(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=o(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=n()},e}();function n(){var t;do{t="@@WeakMap@@"+i()}while(u.has(e,t));return e[t]=!0,t}function o(e,n){if(!r.call(e,t)){if(!n)return;Object.defineProperty(e,t,{value:u.create()})}return e[t]}function a(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function i(){var e=function(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):a(t,e),t}return a(new Array(e),e)}(16);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",r=0;r<16;++r){var n=e[r];4!==r&&6!==r&&8!==r||(t+="-"),n<16&&(t+="0"),t+=n.toString(16).toLowerCase()}return t}}(),y=n?Symbol.for("@reflect-metadata:registry"):void 0,h=function(){var e;return!S(y)&&P(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[y]),S(e)&&(e=function(){var e,r,n,o;S(y)||void 0===t.Reflect||y in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=function(e){var t=e.defineMetadata,r=e.hasOwnMetadata,n=e.getOwnMetadata,o=e.getOwnMetadataKeys,a=e.deleteMetadata,i=new p;return{isProviderFor:function(e,t){var r=i.get(e);return!(S(r)||!r.has(t))||!!o(e,t).length&&(S(r)&&(r=new f,i.set(e,r)),r.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:r,OrdinaryGetOwnMetadata:n,OrdinaryOwnMetadataKeys:o,OrdinaryDeleteMetadata:a}}(t.Reflect));var a=new p,i={registerProvider:s,getProvider:u,setProvider:h};return i;function s(t){if(!Object.isExtensible(i))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case S(r):r=t;break;case r===t:break;case S(n):n=t;break;case n===t:break;default:void 0===o&&(o=new f),o.add(t)}}function c(t,a){if(!S(r)){if(r.isProviderFor(t,a))return r;if(!S(n)){if(n.isProviderFor(t,a))return r;if(!S(o))for(var i=x(o);;){var s=k(i);if(!s)return;var c=F(s);if(c.isProviderFor(t,a))return I(i),c}}}if(!S(e)&&e.isProviderFor(t,a))return e}function u(e,t){var r,n=a.get(e);return S(n)||(r=n.get(t)),S(r)?(S(r=c(e,t))||(S(n)&&(n=new d,a.set(e,n)),n.set(t,r)),r):r}function l(e){if(S(e))throw new TypeError;return r===e||n===e||!S(o)&&o.has(e)}function h(e,t,r){if(!l(r))throw new Error("Metadata provider not registered.");var n=u(e,t);if(n!==r){if(!S(n))return!1;var o=a.get(e);S(o)&&(o=new d,a.set(e,o)),o.set(t,r)}return!0}}()),!S(y)&&P(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}(),g=function(e){var t=new p,r={isProviderFor:function(e,r){var n=t.get(e);return!S(n)&&n.has(r)},OrdinaryDefineOwnMetadata:function(e,t,r,o){n(r,o,!0).set(e,t)},OrdinaryHasOwnMetadata:function(e,t,r){var o=n(t,r,!1);return!S(o)&&A(o.has(e))},OrdinaryGetOwnMetadata:function(e,t,r){var o=n(t,r,!1);if(!S(o))return o.get(e)},OrdinaryOwnMetadataKeys:function(e,t){var r=[],o=n(e,t,!1);if(S(o))return r;for(var a=x(o.keys()),i=0;;){var s=k(a);if(!s)return r.length=i,r;var c=F(s);try{r[i]=c}catch(e){try{I(a)}finally{throw e}}i++}},OrdinaryDeleteMetadata:function(e,r,o){var a=n(r,o,!1);if(S(a))return!1;if(!a.delete(e))return!1;if(0===a.size){var i=t.get(r);S(i)||(i.delete(o),0===i.size&&t.delete(i))}return!0}};return h.registerProvider(r),r;function n(n,o,a){var i=t.get(n),s=!1;if(S(i)){if(!a)return;i=new d,t.set(n,i),s=!0}var c=i.get(o);if(S(c)){if(!a)return;if(c=new d,i.set(o,c),!e.setProvider(n,o,r))throw i.delete(o),s&&t.delete(n),new Error("Wrong provider for target.")}return c}}(h);function v(e,t,r){if(E(e,t,r))return!0;var n=U(t);return!w(n)&&v(e,n,r)}function E(e,t,r){var n=G(t,r,!1);return!S(n)&&A(n.OrdinaryHasOwnMetadata(e,t,r))}function _(e,t,r){if(E(e,t,r))return M(e,t,r);var n=U(t);return w(n)?void 0:_(e,n,r)}function M(e,t,r){var n=G(t,r,!1);if(!S(n))return n.OrdinaryGetOwnMetadata(e,t,r)}function m(e,t,r,n){G(r,n,!0).OrdinaryDefineOwnMetadata(e,t,r,n)}function O(e,t){var r=b(e,t),n=U(e);if(null===n)return r;var o=O(n,t);if(o.length<=0)return r;if(r.length<=0)return o;for(var a=new f,i=[],s=0,c=r;s<c.length;s++){var u=c[s];a.has(u)||(a.add(u),i.push(u))}for(var l=0,d=o;l<d.length;l++)u=d[l],a.has(u)||(a.add(u),i.push(u));return i}function b(e,t){var r=G(e,t,!1);return r?r.OrdinaryOwnMetadataKeys(e,t):[]}function R(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function S(e){return void 0===e}function w(e){return null===e}function P(e){return"object"==typeof e?null!==e:"function"==typeof e}function T(e,t){switch(R(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",n=K(e,o);if(void 0!==n){var a=n.call(e,r);if(P(a))throw new TypeError;return a}return function(e,t){if("string"===t){var r=e.toString;if(D(r)&&!P(o=r.call(e)))return o;if(D(n=e.valueOf)&&!P(o=n.call(e)))return o}else{var n;if(D(n=e.valueOf)&&!P(o=n.call(e)))return o;var o,a=e.toString;if(D(a)&&!P(o=a.call(e)))return o}throw new TypeError}(e,"default"===r?"number":r)}function A(e){return!!e}function j(e){var t=T(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function V(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function D(e){return"function"==typeof e}function L(e){return"function"==typeof e}function N(e,t){return e===t||e!=e&&t!=t}function K(e,t){var r=e[t];if(null!=r){if(!D(r))throw new TypeError;return r}}function x(e){var t=K(e,a);if(!D(t))throw new TypeError;var r=t.call(e);if(!P(r))throw new TypeError;return r}function F(e){return e.value}function k(e){var t=e.next();return!t.done&&t}function I(e){var t=e.return;t&&t.call(e)}function U(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===l)return t;if(t!==l)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var o=n.constructor;return"function"!=typeof o||o===e?t:o}function G(e,t,r){var n=h.getProvider(e,t);if(!S(n))return n;if(r){if(h.setProvider(e,t,g))return g;throw new Error("Illegal state.")}}function H(e){return e.__=void 0,delete e.__,e}e("decorate",(function(e,t,r,n){if(S(r)){if(!V(e))throw new TypeError;if(!L(t))throw new TypeError;return function(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!S(n)&&!w(n)){if(!L(n))throw new TypeError;t=n}}return t}(e,t)}if(!V(e))throw new TypeError;if(!P(t))throw new TypeError;if(!P(n)&&!S(n)&&!w(n))throw new TypeError;return w(n)&&(n=void 0),function(e,t,r,n){for(var o=e.length-1;o>=0;--o){var a=(0,e[o])(t,r,n);if(!S(a)&&!w(a)){if(!P(a))throw new TypeError;n=a}}return n}(e,t,r=j(r),n)})),e("metadata",(function(e,t){return function(r,n){if(!P(r))throw new TypeError;if(!S(n)&&!function(e){switch(R(e)){case 3:case 4:return!0;default:return!1}}(n))throw new TypeError;m(e,t,r,n)}})),e("defineMetadata",(function(e,t,r,n){if(!P(r))throw new TypeError;return S(n)||(n=j(n)),m(e,t,r,n)})),e("hasMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=j(r)),v(e,t,r)})),e("hasOwnMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=j(r)),E(e,t,r)})),e("getMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=j(r)),_(e,t,r)})),e("getOwnMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=j(r)),M(e,t,r)})),e("getMetadataKeys",(function(e,t){if(!P(e))throw new TypeError;return S(t)||(t=j(t)),O(e,t)})),e("getOwnMetadataKeys",(function(e,t){if(!P(e))throw new TypeError;return S(t)||(t=j(t)),b(e,t)})),e("deleteMetadata",(function(e,t,r){if(!P(t))throw new TypeError;if(S(r)||(r=j(r)),!P(t))throw new TypeError;S(r)||(r=j(r));var n=G(t,r,!1);return!S(n)&&n.OrdinaryDeleteMetadata(e,t,r)}))}(n,t),void 0===t.Reflect&&(t.Reflect=e)}()}(n||(n={}))}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(729)})()));
/*! For license information please see decorator-validation.bundle.min.esm.js.LICENSE.txt */
var e={729:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,a(r(935),t),a(r(965),t),a(r(847),t),t.VERSION="##VERSION##"},6:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Model=t.validate=void 0;const n=r(965),a=r(935),i=r(19),o=r(402),s=r(154),c=r(38),u=r(936),d=r(770);function l(e,...t){const r=[];for(const i in e)e.hasOwnProperty(i)&&-1===t.indexOf(i)&&r.push((0,a.getPropertyDecorators)(n.ValidationKeys.REFLECT,e,i));const c=r.reduce(((t,r)=>{const{prop:i,decorators:c}=r;if(!c||!c.length)return t;const u=c[0];c.find((e=>e.key===n.ValidationKeys.TYPE||!!e.props.types?.find((e=>e===u.props.name))))&&c.shift();let l=c.reduce(((t,r)=>{const n=d.Validation.get(r.key);if(!n)return t;const a=n.hasErrors(e[i.toString()],...r.key===s.ModelKeys.TYPE?[r.props]:Object.values(r.props));return a&&((t=t||{})[r.key]=a),t}),void 0);return l=l||Object.keys(e).filter((e=>!l||!l[e])).reduce(((t,r)=>{let i;const c=(0,a.getPropertyDecorators)(n.ValidationKeys.REFLECT,e,r).decorators,u=c.filter((e=>-1!==[s.ModelKeys.TYPE,n.ValidationKeys.TYPE].indexOf(e.key)));if(!u||!u.length)return t;const d=u.pop(),l=d.props.name?[d.props.name]:Array.isArray(d.props.customTypes)?d.props.customTypes:[d.props.customTypes],f=Object.values(o.ReservedModels).map((e=>e.toLowerCase()));return l.forEach((t=>{if(-1===f.indexOf(t.toLowerCase()))switch(t){case"Array":case"Set":if(c.length&&c.find((e=>e.key===n.ValidationKeys.LIST))){const o="Array"===t?e[r].find((e=>e.hasErrors())):e[r].values().find((e=>e.hasErrors()));o&&(i=(0,a.stringFormat)(n.DEFAULT_ERROR_MESSAGES.LIST_INSIDE,o.toString()))}break;default:try{e[r]&&(i=e[r].hasErrors())}catch(e){console.warn((0,a.stringFormat)("Model should be validatable but its not"))}}})),i&&((t=t||{})[r]=i),t}),void 0),l&&((t=t||{})[r.prop.toString()]=l),t}),void 0);return c?new i.ModelErrorDefinition(c):void 0}let f,y,p,h;t.validate=l;class g{constructor(e){}hasErrors(...e){return l(this,...e)}equals(e,...t){return(0,a.isEqual)(this,e,...t)}serialize(){return g.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}toHash(){return g.getHashingFunction()(this).toString()}static deserialize(e){return g.getSerializer().deserialize(e)}static serialize(e){return g.getSerializer().serialize(e)}static hash(e){return g.getHashingFunction()(e)}static fromObject(e,t){return(0,c.constructFromObject)(e,t)}static fromModel(e,t){return(0,c.constructFromModel)(e,t)}static setBuilder(e){f=e}static getBuilder(){return f}static getRegistry(){return y||(y=new u.ModelRegistryManager),y}static setRegistry(e){y=e}static register(e,t){return g.getRegistry().register(e,t)}static get(e){return g.getRegistry().get(e)}static build(e={},t){return g.getRegistry().build(e,t)}static setSerializer(e){p=e}static getSerializer(){return p||(p=new a.JSONSerializer),p}static setHashingFunction(e){h=e}static getHashingFunction(){return h||(h=a.hashObj),h}}t.Model=g},19:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ModelErrorDefinition=void 0,t.ModelErrorDefinition=class{constructor(e){for(const t in e)e.hasOwnProperty(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=>e.hasOwnProperty(t)&&"function"!=typeof e[t])).reduce(((t,r)=>{let n=Object.keys(e[r]).reduce(((t,n)=>(t?t+=`\n${e[r][n]}`:t=e[r][n],t)),void 0);return n&&(n=`${r} - ${n}`,t?t+=`\n${n}`:t=n),t}),"")}}},936:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bulkModelRegister=t.ModelRegistryManager=void 0;const n=r(6),a=r(935),i=r(154);t.ModelRegistryManager=class{constructor(e=i.ModelKeys.ANCHOR,t=a.isModel){this.cache={},this.testFunction=t,this.anchorKey=e}register(e,t){if("function"!=typeof e)throw new 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 new Error("Provided obj is not a Model object");const r=t||e[this.anchorKey].class;if(!(r in this.cache))throw new Error((0,a.stringFormat)("Provided class {0} is not a registered Model object",r));return new this.cache[r](e)}},t.bulkModelRegister=function(...e){e.forEach((e=>{const t=e.constructor?e.constructor:e;n.Model.register(t,e.name)}))}},402:(e,t)=>{var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.ReservedModels=t.Primitives=void 0,function(e){e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"}(r||(t.Primitives=r={})),function(e){e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"}(n||(t.ReservedModels=n={}))},38:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.construct=t.constructFromModel=t.constructFromObject=void 0;const n=r(6),a=r(935),i=r(965),o=r(402),s=r(154);t.constructFromObject=function(e,t){if(!t)return e;for(const r in t)t.hasOwnProperty(r)&&(e.hasOwnProperty(r)||e.prototype&&e.prototype.hasOwnProperty(r))&&(e[r]=t[r]);return e},t.constructFromModel=function(e,t){if(!t)return e;let r,c;for(const u in t)if(t.hasOwnProperty(u)&&(e.hasOwnProperty(u)||e.prototype&&e.prototype.hasOwnProperty(u))){if(e[u]=t[u],"object"!=typeof e[u])continue;if((0,a.isModel)(e[u])){try{e[u]=n.Model.build(e[u])}catch(e){console.log(e)}continue}const d=(0,a.getPropertyDecorators)(i.ValidationKeys.REFLECT,e,u).decorators;if(r=d.filter((e=>-1!==[s.ModelKeys.TYPE,i.ValidationKeys.TYPE].indexOf(e.key))),!r||!r.length)throw new Error((0,a.stringFormat)("failed to find decorators for property {0}",u));c=r.pop();const l=c.props.name?[c.props.name]:Array.isArray(c.props.customTypes)?c.props.customTypes:[c.props.customTypes],f=Object.values(o.ReservedModels).map((e=>e.toLowerCase()));l.forEach((t=>{if(-1===f.indexOf(t.toLowerCase()))try{switch(t){case"Array":case"Set":if(d.length){const r=d.find((e=>e.key===i.ValidationKeys.LIST));if(r&&("Array"===t&&(e[u]=e[u].map((e=>n.Model.build(e,r.props.class)))),"Set"===t)){const t=new Set;for(const a of e[u])t.add(n.Model.build(a,r.props.class));e[u]=t}}break;default:e[u]&&(e[u]=n.Model.build(e[u],t))}}catch(e){console.log(e)}}))}return e},t.construct=function(e,...t){const r=(...t)=>new e(...t);return r.prototype=e.prototype,r(...t)}},893:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.model=t.getModelKey=void 0;const n=r(38),a=r(154),i=r(6);t.getModelKey=e=>a.ModelKeys.REFLECT+e,t.model=function(e,r){return o=>{const s=function(...s){const c=(0,n.construct)(o,...s),u=i.Model.getBuilder();u&&u(c,s.length?s[0]:void 0);const d=Object.assign({},{class:o.name});return Object.defineProperty(c,a.ModelKeys.ANCHOR,{writable:!1,enumerable:!1,configurable:!1,value:d}),Reflect.defineMetadata((0,t.getModelKey)(a.ModelKeys.MODEL),Object.assign(d,e||{}),c.constructor),r&&r(c,...s),c};return s.prototype=o.prototype,Object.defineProperty(s,"name",{writable:!1,enumerable:!0,configurable:!1,value:o.prototype.constructor.name}),i.Model.register(s),s}}},847:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(38),t),a(r(936),t),a(r(893),t),a(r(19),t),a(r(282),t),a(r(6),t),a(r(402),t)},282:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},154:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ModelKeys=void 0,function(e){e.REFLECT="model.definition.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__modelDefinition"}(r||(t.ModelKeys=r={}))},75:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dateFromFormat=t.evaluateDesignTypes=t.checkTypes=t.checkType=t.getClassDecorators=t.isModel=t.hashObj=t.hashSerialization=t.hashCode=t.isEqual=t.stringFormat=t.getAllProperties=t.getAllPropertyDecorators=t.getTypeFromDecorator=t.getPropertyDecorators=void 0,r(630);const n=r(965),a=r(154),i=r(847);function o(e,t,r,n=!1,i=!0,u){const d=function(e,t,r,n=!1,i){const o=Reflect.getMetadataKeys(t,r).filter((t=>n?t.toString().startsWith(e):t===a.ModelKeys.TYPE||t.toString().startsWith(e))).reduce(((n,i)=>{const o={key:i!==a.ModelKeys.TYPE?i.substring(e.length):i,props:Reflect.getMetadata(i,t,r)};return n.concat(o)}),i||[]);return{prop:r.toString(),decorators:o}}(e,t,r,n,u);return i&&Object.getPrototypeOf(t)!==Object.prototype?o(e,Object.getPrototypeOf(t.constructor),r,!0,i,d.decorators):{prop:d.prop,decorators:function(e){const r={};return e.filter((e=>e.key in r?(c(e.props,r[e.key])||console.log(s("Found a similar decorator for the {0} property of a {1} model but with different attributes. The original one will be kept",e.key,t.constructor.name)),!1):(r[e.key.toString()]=e.props,!0)))}(d.decorators)}}function s(e,...t){return e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r]:e}))}function c(e,t,...r){if(e===t)return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(!e||!t||"object"!=typeof e&&"object"!=typeof t)return e===t;if(null==e||null==t)return!1;if(typeof e!=typeof t)return!1;if(e.prototype!==t.prototype)return!1;const n=Object.keys(e).filter((e=>-1===r.indexOf(e)));return n.length===Object.keys(t).filter((e=>-1===r.indexOf(e))).length&&n.every((n=>-1!==r.indexOf(n)||c(e[n],t[n],...r)))}function u(e){e=String(e);let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}function d(e,t){return Reflect.getOwnMetadataKeys(t.constructor).filter((t=>t.toString().startsWith(e))).reduce(((r,n)=>{const a={key:n.substring(e.length),props:Reflect.getMetadata(n,t.constructor)};return r.concat(a)}),[])}function l(e,t){return typeof e===t||e.constructor&&e.constructor.name.toLowerCase()===t.toLowerCase()}function f(e,t){return!t.every((t=>!l(e,t)))}t.getPropertyDecorators=o,t.getTypeFromDecorator=function(e,t){const r=o(a.ModelKeys.REFLECT,e,t,!1);if(!r||!r.decorators)return;const n=r.decorators.shift(),i=n.props?n.props.name:void 0;return"Function"!==i?i:void 0},t.getAllPropertyDecorators=function(e,...t){if(t&&t.length)return Object.getOwnPropertyNames(e).reduce(((r,n)=>(t.forEach(((t,a)=>{const i=o(t,e,n,0!==a);r||(r={}),function(e,t,r){r&&r.length&&(e[t]||(e[t]=[]),e[t].push(...r))}(r,n,i.decorators)})),r)),void 0)},t.getAllProperties=function(e,t=!0,r="Object"){const n=[];let a=e;const i=function(){if(!t)return;const e=Object.getPrototypeOf(a);return e&&e.constructor.name!==r?(a=e,a):void 0};do{Object.getOwnPropertyNames(a).forEach((function(e){-1===n.indexOf(e)&&n.push(e)}))}while(i());return n},t.stringFormat=s,t.isEqual=c,t.hashCode=u,t.hashSerialization=function(e){return u(i.Model.serialize(e))},t.hashObj=function(e){const t=function(e,t){const r=n(t);return"string"==typeof r?n((e||"")+n(t)):(e=((e=e||0)<<5)-e+r)&e},r=u,n=function(e){return 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},t.isModel=function(e){return!!e[a.ModelKeys.ANCHOR]||!!d(a.ModelKeys.REFLECT,e).find((e=>e.key===a.ModelKeys.MODEL&&e.props&&e.props.class))},t.getClassDecorators=d,t.checkType=l,t.checkTypes=f,t.evaluateDesignTypes=function(e,t){switch(typeof t){case"string":return l(e,t);case"object":return!Array.isArray(t)||f(e,t);case"function":return!t.name||"Object"===t.name||l(e,t.name);default:return!0}},t.dateFromFormat=function(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 a=new RegExp(r,"g").exec(e);if(!a||!a.groups)return new Date(e);const i=function(e){if(!e)return 0;const t=parseInt(e);return isNaN(t)?0:t},o=i(a.groups.year),s=i(a.groups.day),c=a.groups.ampm;let u=i(a.groups.hour);c&&(u="PM"===c?u+12:u);const d=i(a.groups.minutes),l=i(a.groups.seconds),f=i(a.groups.milis),y=a.groups.monthname,p=a.groups.monthnamesmall;let h=a.groups.month;if(y)h=n.MONTH_NAMES.indexOf(y);else if(p){const t=n.MONTH_NAMES.find((e=>e.toLowerCase().startsWith(p.toLowerCase())));if(!t)return new Date(e);h=n.MONTH_NAMES.indexOf(t)}else h=i(`${h}`);return new Date(o,h-1,s,u,d,l,f)}},935:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(75),t),a(r(904),t),a(r(973),t),a(r(154),t)},904:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},973:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JSONSerializer=void 0;const n=r(6),a=r(154);t.JSONSerializer=class{preSerialize(e){const t=Object.assign({},e);return t[a.ModelKeys.ANCHOR]=e[a.ModelKeys.ANCHOR],t}deserialize(e){const t=JSON.parse(e);return n.Model.build(t)}serialize(e){return JSON.stringify(this.preSerialize(e))}}},770:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Validation=void 0;const n=r(493),a=r(935);class i{static{this.actingValidatorRegistry=void 0}constructor(){}static setRegistry(e,t){t&&i.actingValidatorRegistry&&i.actingValidatorRegistry.getKeys().forEach((r=>{const n=e.get(r);n&&e.register(t(n))})),i.actingValidatorRegistry=e}static getRegistry(){return i.actingValidatorRegistry||(i.actingValidatorRegistry=new n.ValidatorRegistry({validator:n.TypeValidator,validationKey:a.ModelKeys.TYPE,save:!1})),i.actingValidatorRegistry}static get(e){return i.getRegistry().get(e)}static register(...e){return i.getRegistry().register(...e)}}t.Validation=i},395:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DateValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.DATE){super(a.ValidationKeys.DATE,e,Number.name,Date.name,String.name)}hasErrors(e,t,r){if(void 0!==e)return"string"==typeof e&&(e=new Date(e)),isNaN(e.getDate())?this.getMessage(r||this.message):void 0}}t.DateValidator=i},335:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EmailValidator=void 0;const n=r(772),a=r(273);class i extends a.PatternValidator{static{this.emailPat=/[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])?/}constructor(e=n.DEFAULT_ERROR_MESSAGES.EMAIL){super(n.ValidationKeys.EMAIL,e)}hasErrors(e,t){return super.hasErrors(e,i.emailPat,t)}}t.EmailValidator=i},407:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ListValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.LIST){super(a.ValidationKeys.LIST,e,Array.name,Set.name)}hasErrors(e,t,r){if(!e||(Array.isArray(e)?!e.length:!e.size))return;let n;for(let a=0;a<(Array.isArray(e)?e.length:e.size);a++)switch(n=e[a],typeof n){case"object":case"function":if(!n.constructor||n.constructor.name!==t)return this.getMessage(r||this.message,t);break;default:if(typeof n!==t)return this.getMessage(r||this.message,t)}}}t.ListValidator=i},169:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MaxLengthValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){super(a.ValidationKeys.MAX_LENGTH,e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length>t?this.getMessage(r||this.message,t):void 0}}t.MaxLengthValidator=i},909:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MaxValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MAX){super(a.ValidationKeys.MAX,e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Max param defined");return e>t?this.getMessage(r||this.message,t):void 0}}}t.MaxValidator=i},519:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MinLengthValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){super(a.ValidationKeys.MIN_LENGTH,e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length<t?this.getMessage(r||this.message,t):void 0}}t.MinLengthValidator=i},651:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MinValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.MIN){super(a.ValidationKeys.MIN,e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Min param defined");return e<t?this.getMessage(r||this.message,t):void 0}}}t.MinValidator=i},116:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordValidator=void 0;const n=r(273),a=r(772);class i extends n.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.PASSWORD,t=a.PasswordPatterns.CHAR8_ONE_OF_EACH){super(a.ValidationKeys.PASSWORD,e),this.pattern=t}hasErrors(e,t,r){return super.hasErrors(e,t||this.pattern,r||this.message)}}t.PasswordValidator=i},273:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PatternValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{static{this.regexpParser=new RegExp("^/(.+)/([gimus]*)$")}constructor(e=a.ValidationKeys.PATTERN,t=a.DEFAULT_ERROR_MESSAGES.PATTERN){super(e,t,"string")}static getPattern(e){if(!i.regexpParser.test(e))return new RegExp(e);const t=e.match(i.regexpParser);return new RegExp(t[1],t[2])}hasErrors(e,t,r){if(e)return(t="string"==typeof t?i.getPattern(t):t).lastIndex=0,t.test(e)?void 0:this.getMessage(r||this.message)}}t.PatternValidator=i},812:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.REQUIRED){super(a.ValidationKeys.REQUIRED,e)}hasErrors(e,t){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(t||this.message):void 0;default:return e?void 0:this.getMessage(t||this.message)}}}t.RequiredValidator=i},553:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StepValidator=void 0;const n=r(735),a=r(772);class i extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.STEP){super(a.ValidationKeys.STEP,e,"number","string")}hasErrors(e,t,r){if(void 0!==e)return Number(e)%Number(t)!=0?this.getMessage(r||this.message,t):void 0}}t.StepValidator=i},375:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeValidator=void 0;const n=r(735),a=r(935),i=r(772),o=r(154);class s extends n.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.TYPE){super(o.ModelKeys.TYPE,e)}hasErrors(e,t,r){if(void 0!==e)return(0,a.evaluateDesignTypes)(e,t)?void 0:this.getMessage(r||this.message,"string"==typeof t?t:Array.isArray(t)?t.join(", "):t.name,typeof e)}}t.TypeValidator=s},964:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URLValidator=void 0;const n=r(772),a=r(273);class i extends a.PatternValidator{static{this.urlPattern=/^(?:(?:(?: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}constructor(e=n.DEFAULT_ERROR_MESSAGES.URL){super(n.ValidationKeys.URL,e)}hasErrors(e,t){return super.hasErrors(e,i.urlPattern,t)}}t.URLValidator=i},735:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Validator=void 0;const n=r(935),a=r(772);t.Validator=class{constructor(e,t=a.DEFAULT_ERROR_MESSAGES.DEFAULT,...r){this.validationKey=e,this.message=t,r.length&&(this.acceptedTypes=r),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(e,...t){return(0,n.stringFormat)(e,...t)}checkTypeAndHasErrors(e){return function(t,...r){return void 0!==t&&this.acceptedTypes?(0,n.checkTypes)(t,this.acceptedTypes)?e(t,...r):this.getMessage(a.DEFAULT_ERROR_MESSAGES.TYPE,this.acceptedTypes.join(", "),typeof t):e(t,...r)}.bind(this)}}},436:(e,t)=>{function r(e){return e.constructor&&e.hasErrors}Object.defineProperty(t,"__esModule",{value:!0}),t.ValidatorRegistry=t.isValidator=void 0,t.isValidator=r,t.ValidatorRegistry=class{constructor(...e){this.cache={},this.customKeyChache={},this.register(...e)}getCustomKeys(){return Object.assign({},this.customKeyChache)}getKeys(){return Object.keys(this.cache)}get(e){if(!(e in this.cache))return;const t=this.cache[e];if(r(t))return t;const n=new(t.default||t);return this.cache[e]=n,n}register(...e){e.forEach((e=>{if(r(e)){if(e.validationKey in this.cache)return;this.cache[e.validationKey]=e}else{const{validationKey:t,validator:r,save:n}=e;if(t in this.cache)return;if(this.cache[t]=r,!n)return;const a={};a[t.toUpperCase()]=t,this.customKeyChache=Object.assign({},this.customKeyChache,a)}}))}}},772:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordPatterns=t.DEFAULT_ERROR_MESSAGES=t.DAYS_OF_WEEK_NAMES=t.MONTH_NAMES=t.ValidationKeys=void 0,t.ValidationKeys={REFLECT:"model.validation.",REQUIRED:"required",MIN:"min",MAX:"max",STEP:"step",MIN_LENGTH:"minlength",MAX_LENGTH:"maxlength",PATTERN:"pattern",EMAIL:"email",URL:"url",DATE:"date",TYPE:"type",PASSWORD:"password",LIST:"list"},t.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],t.DAYS_OF_WEEK_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],t.DEFAULT_ERROR_MESSAGES={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}",LIST_INSIDE:"Elements of list are invalid: {0}",MODEL_NOT_FOUND:"No model registered under {0}"},t.PasswordPatterns={CHAR8_ONE_OF_EACH:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&_\-.,])[A-Za-z\d@$!%*?&_\-.,]{8,}$/g}},493:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Validators=void 0;const i=r(395),o=r(375),s=r(116),c=r(553),u=r(964),d=r(273),l=r(651),f=r(519),y=r(909),p=r(169),h=r(812),g=r(335),v=r(407);a(r(772),t),a(r(735),t),a(r(168),t),a(r(436),t),a(r(335),t),a(r(812),t),a(r(169),t),a(r(909),t),a(r(519),t),a(r(651),t),a(r(273),t),a(r(964),t),a(r(553),t),a(r(395),t),a(r(375),t),a(r(116),t),t.Validators={EmailValidator:g.EmailValidator,RequiredValidator:h.RequiredValidator,MaxLengthValidator:p.MaxLengthValidator,MaxValidator:y.MaxValidator,MinLengthValidator:f.MinLengthValidator,MinValidator:l.MinValidator,PatternValidator:d.PatternValidator,URLValidator:u.URLValidator,StepValidator:c.StepValidator,DateValidator:i.DateValidator,TypeValidator:o.TypeValidator,PasswordValidator:s.PasswordValidator,ListValidator:v.ListValidator}},168:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},475:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.set=t.list=t.password=t.date=t.parseDate=t.formatDate=t.twoDigitPad=t.isValidDate=t.bindDateToString=t.type=t.url=t.email=t.pattern=t.maxlength=t.minlength=t.step=t.max=t.min=t.required=t.getValidationKey=void 0,r(630);const n=r(493),a=r(493),i=r(935),o=r(407),s=r(770);function c(e){return n.ValidationKeys.REFLECT+e}function u(e,t=n.DEFAULT_ERROR_MESSAGES.TYPE,r=a.TypeValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.TYPE),{customTypes:e,message:t},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.TYPE,save:!0})}}function d(e,t){if(!e)return;const r=()=>y(e,t);return Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:r}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:r}),e}function l(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}function f(e){return e<10?"0"+e:e.toString()}function y(e,t="yyyy/MM/dd"){const r=e.getDate(),a=e.getMonth(),i=e.getFullYear(),o=e.getHours(),s=e.getMinutes(),c=e.getSeconds(),u=e.getMilliseconds(),d=o%12,l=f(d),y=f(o),p=f(s),h=f(c),g=o<12?"AM":"PM",v=n.DAYS_OF_WEEK_NAMES[e.getDay()],E=v.substr(0,3),M=f(r),_=a+1,m=f(_),O=n.MONTH_NAMES[a],b=O.substr(0,3),S=i+"",R=S.substr(2,2);return(t=t.replace("hh",l).replace("h",d.toString()).replace("HH",y).replace("H",o.toString()).replace("mm",p).replace("m",s.toString()).replace("ss",h).replace("s",c.toString()).replace("S",u.toString()).replace("dd",M).replace("d",r.toString()).replace("EEEE",v).replace("EEE",E).replace("yyyy",S).replace("yy",R).replace("aaa",g)).indexOf("MMM")>-1?t.replace("MMMM",O).replace("MMM",b):t.replace("MM",m).replace("M",_.toString())}function p(e,t){let r;if(t){if(t instanceof Date)try{r=(0,i.dateFromFormat)(y(t,e),e)}catch(r){throw new Error((0,i.stringFormat)("Could not convert date {0} to format: {1}",t.toString(),e))}else if("string"==typeof t)r=(0,i.dateFromFormat)(t,e);else if("number"==typeof t){const n=new Date(t);r=(0,i.dateFromFormat)(y(n,e),e)}else{if(!l(t))throw new Error(`Invalid value provided ${t}`);try{const n=new Date(t);r=(0,i.dateFromFormat)(y(n,e),e)}catch(r){throw new Error((0,i.stringFormat)("Could not convert date {0} to format: {1}",t,e))}}return d(r,e)}}function h(e,t="Array",r=n.DEFAULT_ERROR_MESSAGES.LIST,a=o.ListValidator){return(i,o)=>{u(t)(i,o),Reflect.defineMetadata(c(n.ValidationKeys.LIST),{class:e.name,type:t,message:r},i,o),s.Validation.register({validator:a,validationKey:n.ValidationKeys.LIST,save:!0})}}t.getValidationKey=c,t.required=function(e=n.DEFAULT_ERROR_MESSAGES.REQUIRED,t=a.RequiredValidator){return(r,a)=>{Reflect.defineMetadata(c(n.ValidationKeys.REQUIRED),{message:e},r,a),s.Validation.register({validator:t,validationKey:n.ValidationKeys.REQUIRED,save:!0})}},t.min=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN,r=a.MinValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.MIN),{value:e,message:t,types:[Number.name,Date.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.MIN,save:!0})}},t.max=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX,r=a.MaxValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.MAX),{value:e,message:t,types:[Number.name,Date.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.MAX,save:!0})}},t.step=function(e,t=n.DEFAULT_ERROR_MESSAGES.STEP,r=a.StepValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.STEP),{value:e,message:t,types:[Number.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.STEP,save:!0})}},t.minlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN_LENGTH,r=a.MinLengthValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.MIN_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.MIN_LENGTH,save:!0})}},t.maxlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX_LENGTH,r=a.MaxLengthValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.MAX_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.MAX_LENGTH,save:!0})}},t.pattern=function(e,t=n.DEFAULT_ERROR_MESSAGES.PATTERN,r=a.PatternValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.PATTERN),{value:"string"==typeof e?e:e.toString(),message:t,types:[String.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.PATTERN,save:!0})}},t.email=function(e=n.DEFAULT_ERROR_MESSAGES.EMAIL,t=a.EmailValidator){return(r,a)=>{Reflect.defineMetadata(c(n.ValidationKeys.EMAIL),{message:e,types:[String.name]},r,a),s.Validation.register({validator:t,validationKey:n.ValidationKeys.EMAIL,save:!0})}},t.url=function(e=n.DEFAULT_ERROR_MESSAGES.URL,t=a.URLValidator){return(r,a)=>{Reflect.defineMetadata(c(n.ValidationKeys.URL),{message:e,types:[String.name]},r,a),s.Validation.register({validator:t,validationKey:n.ValidationKeys.URL,save:!0})}},t.type=u,t.bindDateToString=d,t.isValidDate=l,t.twoDigitPad=f,t.formatDate=y,t.parseDate=p,t.date=function(e="dd/MM/yyyy",t=n.DEFAULT_ERROR_MESSAGES.DATE,r=a.DateValidator){return(a,o)=>{Reflect.defineMetadata(c(n.ValidationKeys.DATE),{format:e,message:t,types:[Date.name]},a,o),s.Validation.register({validator:r,validationKey:n.ValidationKeys.DATE,save:!0});const u=new WeakMap;Object.defineProperty(a,o,{configurable:!1,set(t){const r=Object.getOwnPropertyDescriptor(this,o);r&&!r.configurable||Object.defineProperty(this,o,{enumerable:!0,configurable:!1,get:()=>u.get(this),set:t=>{let r;try{r=p(e,t),u.set(this,r)}catch(e){console.error((0,i.stringFormat)("Failed to parse date: {0}",e.message||e))}}}),this[o]=t},get(){console.log("here")}})}},t.password=function(e=n.PasswordPatterns.CHAR8_ONE_OF_EACH,t=n.DEFAULT_ERROR_MESSAGES.PASSWORD,r=a.PasswordValidator){return(a,i)=>{Reflect.defineMetadata(c(n.ValidationKeys.PASSWORD),{pattern:e,message:t,types:[String.name]},a,i),s.Validation.register({validator:r,validationKey:n.ValidationKeys.PASSWORD,save:!0})}},t.list=h,t.set=function(e,t=n.DEFAULT_ERROR_MESSAGES.LIST,r){return(n,a)=>{h(e,"Set",t,r)(n,a)}}},965:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Decorators=t.ValidatorRegistryImp=void 0,a(r(792),t),a(r(493),t);const i=r(493);t.ValidatorRegistryImp=i.ValidatorRegistry,t.Decorators=r(475),a(r(475),t),a(r(770),t)},792:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},630:(e,t,r)=>{var n;!function(e){!function(t){var n="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),a=i(e);function i(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==n.Reflect&&(a=i(n.Reflect,a)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,a=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!o&&!s,u={create:o?function(){return H(Object.create(null))}:s?function(){return H({__proto__:null})}:function(){return H({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},d=Object.getPrototypeOf(Function),l="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},t=[],r=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[i]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,a=r+1;a<n;a++)this._keys[a-1]=this._keys[a],this._values[a-1]=this._values[a];return this._keys.length--,this._values.length--,K(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new r(this._keys,this._values,n)},t.prototype.values=function(){return new r(this._keys,this._values,a)},t.prototype.entries=function(){return new r(this._keys,this._values,o)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[i]=function(){return this.entries()},t.prototype._find=function(e,t){if(!K(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(K(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function n(e,t){return e}function a(e,t){return t}function o(e,t){return[e,t]}}(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new l}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[i]=function(){return this.keys()},e}(),y="function"==typeof WeakMap?WeakMap:function(){var e=16,t=u.create(),n=a();return function(){function e(){this._key=a()}return e.prototype.has=function(e){var t=i(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=i(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return i(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=i(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=a()},e}();function a(){var e;do{e="@@WeakMap@@"+s()}while(u.has(t,e));return t[e]=!0,e}function i(e,t){if(!r.call(e,n)){if(!t)return;Object.defineProperty(e,n,{value:u.create()})}return e[n]}function o(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function s(){var t,r=(t=e,"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):o(new Uint8Array(t),t):o(new Array(t),t));r[6]=79&r[6]|64,r[8]=191&r[8]|128;for(var n="",a=0;a<e;++a){var i=r[a];4!==a&&6!==a&&8!==a||(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}(),p=n?Symbol.for("@reflect-metadata:registry"):void 0,h=function(){var e;return!R(p)&&T(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[p]),R(e)&&(e=function(){var e,r,n,a;R(p)||void 0===t.Reflect||p in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=function(e){var t=e.defineMetadata,r=e.hasOwnMetadata,n=e.getOwnMetadata,a=e.getOwnMetadataKeys,i=e.deleteMetadata,o=new y;return{isProviderFor:function(e,t){var r=o.get(e);return R(r)?!!a(e,t).length&&(R(r)&&(r=new f,o.set(e,r)),r.add(t),!0):r.has(t)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:r,OrdinaryGetOwnMetadata:n,OrdinaryOwnMetadataKeys:a,OrdinaryDeleteMetadata:i}}(t.Reflect));var i=new y,o={registerProvider:s,getProvider:u,setProvider:h};return o;function s(t){if(!Object.isExtensible(o))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case R(r):r=t;break;case r===t:break;case R(n):n=t;break;case n===t:break;default:void 0===a&&(a=new f),a.add(t)}}function c(t,i){if(!R(r)){if(r.isProviderFor(t,i))return r;if(!R(n)){if(n.isProviderFor(t,i))return r;if(!R(a))for(var o=F(a);;){var s=k(o);if(!s)return;var c=x(s);if(c.isProviderFor(t,i))return I(o),c}}}if(!R(e)&&e.isProviderFor(t,i))return e}function u(e,t){var r,n=i.get(e);return R(n)||(r=n.get(t)),R(r)?(R(r=c(e,t))||(R(n)&&(n=new l,i.set(e,n)),n.set(t,r)),r):r}function d(e){if(R(e))throw new TypeError;return r===e||n===e||!R(a)&&a.has(e)}function h(e,t,r){if(!d(r))throw new Error("Metadata provider not registered.");var n=u(e,t);if(n!==r){if(!R(n))return!1;var a=i.get(e);R(a)&&(a=new l,i.set(e,a)),a.set(t,r)}return!0}}()),!R(p)&&T(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,p,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}(),g=function(e){var t=new y,r={isProviderFor:function(e,r){var n=t.get(e);return!R(n)&&n.has(r)},OrdinaryDefineOwnMetadata:function(e,t,r,a){n(r,a,!0).set(e,t)},OrdinaryHasOwnMetadata:function(e,t,r){var a=n(t,r,!1);return!R(a)&&P(a.has(e))},OrdinaryGetOwnMetadata:function(e,t,r){var a=n(t,r,!1);if(!R(a))return a.get(e)},OrdinaryOwnMetadataKeys:function(e,t){var r=[],a=n(e,t,!1);if(R(a))return r;for(var i=F(a.keys()),o=0;;){var s=k(i);if(!s)return r.length=o,r;var c=x(s);try{r[o]=c}catch(e){try{I(i)}finally{throw e}}o++}},OrdinaryDeleteMetadata:function(e,r,a){var i=n(r,a,!1);if(R(i))return!1;if(!i.delete(e))return!1;if(0===i.size){var o=t.get(r);R(o)||(o.delete(a),0===o.size&&t.delete(o))}return!0}};return h.registerProvider(r),r;function n(n,a,i){var o=t.get(n),s=!1;if(R(o)){if(!i)return;o=new l,t.set(n,o),s=!0}var c=o.get(a);if(R(c)){if(!i)return;if(c=new l,o.set(a,c),!e.setProvider(n,a,r))throw o.delete(a),s&&t.delete(n),new Error("Wrong provider for target.")}return c}}(h);function v(e,t,r){if(E(e,t,r))return!0;var n=U(t);return!w(n)&&v(e,n,r)}function E(e,t,r){var n=G(t,r,!1);return!R(n)&&P(n.OrdinaryHasOwnMetadata(e,t,r))}function M(e,t,r){if(E(e,t,r))return _(e,t,r);var n=U(t);return w(n)?void 0:M(e,n,r)}function _(e,t,r){var n=G(t,r,!1);if(!R(n))return n.OrdinaryGetOwnMetadata(e,t,r)}function m(e,t,r,n){G(r,n,!0).OrdinaryDefineOwnMetadata(e,t,r,n)}function O(e,t){var r=b(e,t),n=U(e);if(null===n)return r;var a=O(n,t);if(a.length<=0)return r;if(r.length<=0)return a;for(var i=new f,o=[],s=0,c=r;s<c.length;s++){var u=c[s];i.has(u)||(i.add(u),o.push(u))}for(var d=0,l=a;d<l.length;d++)u=l[d],i.has(u)||(i.add(u),o.push(u));return o}function b(e,t){var r=G(e,t,!1);return r?r.OrdinaryOwnMetadataKeys(e,t):[]}function S(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function R(e){return void 0===e}function w(e){return null===e}function T(e){return"object"==typeof e?null!==e:"function"==typeof e}function A(e,t){switch(S(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",n=N(e,a);if(void 0!==n){var i=n.call(e,r);if(T(i))throw new TypeError;return i}return function(e,t){if("string"===t){var r=e.toString;if(j(r)&&!T(a=r.call(e)))return a;if(j(n=e.valueOf)&&!T(a=n.call(e)))return a}else{var n;if(j(n=e.valueOf)&&!T(a=n.call(e)))return a;var a,i=e.toString;if(j(i)&&!T(a=i.call(e)))return a}throw new TypeError}(e,"default"===r?"number":r)}function P(e){return!!e}function V(e){var t=A(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function D(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function j(e){return"function"==typeof e}function L(e){return"function"==typeof e}function K(e,t){return e===t||e!=e&&t!=t}function N(e,t){var r=e[t];if(null!=r){if(!j(r))throw new TypeError;return r}}function F(e){var t=N(e,i);if(!j(t))throw new TypeError;var r=t.call(e);if(!T(r))throw new TypeError;return r}function x(e){return e.value}function k(e){var t=e.next();return!t.done&&t}function I(e){var t=e.return;t&&t.call(e)}function U(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===d)return t;if(t!==d)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var a=n.constructor;return"function"!=typeof a||a===e?t:a}function G(e,t,r){var n=h.getProvider(e,t);if(!R(n))return n;if(r){if(h.setProvider(e,t,g))return g;throw new Error("Illegal state.")}}function H(e){return e.__=void 0,delete e.__,e}e("decorate",(function(e,t,r,n){if(R(r)){if(!D(e))throw new TypeError;if(!L(t))throw new TypeError;return function(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!R(n)&&!w(n)){if(!L(n))throw new TypeError;t=n}}return t}(e,t)}if(!D(e))throw new TypeError;if(!T(t))throw new TypeError;if(!T(n)&&!R(n)&&!w(n))throw new TypeError;return w(n)&&(n=void 0),function(e,t,r,n){for(var a=e.length-1;a>=0;--a){var i=(0,e[a])(t,r,n);if(!R(i)&&!w(i)){if(!T(i))throw new TypeError;n=i}}return n}(e,t,r=V(r),n)})),e("metadata",(function(e,t){return function(r,n){if(!T(r))throw new TypeError;if(!R(n)&&!function(e){switch(S(e)){case 3:case 4:return!0;default:return!1}}(n))throw new TypeError;m(e,t,r,n)}})),e("defineMetadata",(function(e,t,r,n){if(!T(r))throw new TypeError;return R(n)||(n=V(n)),m(e,t,r,n)})),e("hasMetadata",(function(e,t,r){if(!T(t))throw new TypeError;return R(r)||(r=V(r)),v(e,t,r)})),e("hasOwnMetadata",(function(e,t,r){if(!T(t))throw new TypeError;return R(r)||(r=V(r)),E(e,t,r)})),e("getMetadata",(function(e,t,r){if(!T(t))throw new TypeError;return R(r)||(r=V(r)),M(e,t,r)})),e("getOwnMetadata",(function(e,t,r){if(!T(t))throw new TypeError;return R(r)||(r=V(r)),_(e,t,r)})),e("getMetadataKeys",(function(e,t){if(!T(e))throw new TypeError;return R(t)||(t=V(t)),O(e,t)})),e("getOwnMetadataKeys",(function(e,t){if(!T(e))throw new TypeError;return R(t)||(t=V(t)),b(e,t)})),e("deleteMetadata",(function(e,t,r){if(!T(t))throw new TypeError;if(R(r)||(r=V(r)),!T(t))throw new TypeError;R(r)||(r=V(r));var n=G(t,r,!1);return!R(n)&&n.OrdinaryDeleteMetadata(e,t,r)}))}(a,n),void 0===n.Reflect&&(n.Reflect=e)}()}(n||(n={}))}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(729);
var e={729:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,a(r(935),t),a(r(839),t),a(r(965),t),a(r(847),t),t.VERSION="##VERSION##"},6:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Model=void 0,t.validate=h;const n=r(772),a=r(735),o=r(19),i=r(402),s=r(154),c=r(38),u=r(936),l=r(770),d=r(174),f=r(523),p=r(593),y=r(687);function h(e,...t){const r=[];for(const a in e)e.hasOwnProperty(a)&&-1===t.indexOf(a)&&r.push((0,d.getPropertyDecorators)(n.ValidationKeys.REFLECT,e,a));const a=r.reduce(((t,r)=>{const{prop:a,decorators:o}=r;if(!o||!o.length)return t;const c=o[0];o.find((e=>e.key===n.ValidationKeys.TYPE||!!e.props.types?.find((e=>e===c.props.name))))&&o.shift();let u=o.reduce(((t,r)=>{const n=l.Validation.get(r.key);if(!n)return t;const o=n.hasErrors(e[a.toString()],...r.key===s.ModelKeys.TYPE?[r.props]:Object.values(r.props));return o&&((t=t||{})[r.key]=o),t}),void 0);return u=u||Object.keys(e).filter((e=>!u||!u[e])).reduce(((t,r)=>{let a;const o=(0,d.getPropertyDecorators)(n.ValidationKeys.REFLECT,e,r).decorators,c=o.filter((e=>-1!==[s.ModelKeys.TYPE,n.ValidationKeys.TYPE].indexOf(e.key)));if(!c||!c.length)return t;const u=c.pop(),l=u.props.name?[u.props.name]:Array.isArray(u.props.customTypes)?u.props.customTypes:[u.props.customTypes],f=Object.values(i.ReservedModels).map((e=>e.toLowerCase()));return l.forEach((t=>{if(-1===f.indexOf(t.toLowerCase()))switch(t){case"Array":case"Set":if(o.length&&o.find((e=>e.key===n.ValidationKeys.LIST))){const o="Array"===t?e[r].find((e=>e.hasErrors())):e[r].values().find((e=>e.hasErrors()));o&&(a=(0,p.sf)(n.DEFAULT_ERROR_MESSAGES.LIST_INSIDE,o.toString()))}break;default:try{e[r]&&(a=e[r].hasErrors())}catch(e){console.warn((0,p.sf)("Model should be validatable but its not"))}}})),a&&((t=t||{})[r]=a),t}),void 0),u&&((t=t||{})[r.prop.toString()]=u),t}),void 0);return a?new o.ModelErrorDefinition(a):void 0}let g,v,E,_;class M{constructor(e){}hasErrors(...e){return h(this,...e)}equals(e,...t){return(0,y.isEqual)(this,e,...t)}serialize(){return M.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}toHash(){return M.getHashingFunction()(this).toString()}static deserialize(e){return M.getSerializer().deserialize(e)}static serialize(e){return M.getSerializer().serialize(e)}static hash(e){return M.getHashingFunction()(e)}static fromObject(e,t){return(0,c.constructFromObject)(e,t)}static fromModel(e,t){return(0,c.constructFromModel)(e,t)}static setBuilder(e){g=e}static getBuilder(){return g}static getRegistry(){return v||(v=new u.ModelRegistryManager),v}static setRegistry(e){v=e}static register(e,t){return M.getRegistry().register(e,t)}static get(e){return M.getRegistry().get(e)}static build(e={},t){return M.getRegistry().build(e,t)}static setSerializer(e){E=e}static getSerializer(){return E||(E=new a.JSONSerializer),E}static setHashingFunction(e){_=e}static getHashingFunction(){return _||(_=f.hashObj),_}}t.Model=M},19:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ModelErrorDefinition=void 0,t.ModelErrorDefinition=class{constructor(e){for(const t in e)e.hasOwnProperty(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=>e.hasOwnProperty(t)&&"function"!=typeof e[t])).reduce(((t,r)=>{let n=Object.keys(e[r]).reduce(((t,n)=>(t?t+=`\n${e[r][n]}`:t=e[r][n],t)),void 0);return n&&(n=`${r} - ${n}`,t?t+=`\n${n}`:t=n),t}),"")}}},936:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ModelRegistryManager=void 0,t.bulkModelRegister=function(...e){e.forEach((e=>{const t=e.constructor?e.constructor:e;n.Model.register(t,e.name)}))};const n=r(6),a=r(154),o=r(174),i=r(593);t.ModelRegistryManager=class{constructor(e=a.ModelKeys.ANCHOR,t=o.isModel){this.cache={},this.testFunction=t,this.anchorKey=e}register(e,t){if("function"!=typeof e)throw new 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 new Error("Provided obj is not a Model object");const r=t||e[this.anchorKey].class;if(!(r in this.cache))throw new Error((0,i.sf)("Provided class {0} is not a registered Model object",r));return new this.cache[r](e)}}},402:(e,t)=>{var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.ReservedModels=t.Primitives=void 0,function(e){e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"}(r||(t.Primitives=r={})),function(e){e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"}(n||(t.ReservedModels=n={}))},38:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.constructFromObject=function(e,t){if(!t)return e;for(const r in t)t.hasOwnProperty(r)&&(e.hasOwnProperty(r)||e.prototype&&e.prototype.hasOwnProperty(r))&&(e[r]=t[r]||void 0);return e},t.constructFromModel=function(e,t){if(!t)return e;let r,u;for(const l in t)if(t.hasOwnProperty(l)&&(e.hasOwnProperty(l)||e.prototype&&e.prototype.hasOwnProperty(l))){if(e[l]=t[l]||void 0,"object"!=typeof e[l])continue;if((0,s.isModel)(e[l])){try{e[l]=n.Model.build(e[l])}catch(e){console.error(e)}continue}const d=(0,s.getPropertyDecorators)(a.ValidationKeys.REFLECT,e,l).decorators;if(r=d.filter((e=>-1!==[i.ModelKeys.TYPE,a.ValidationKeys.TYPE].indexOf(e.key))),!r||!r.length)throw new Error((0,c.sf)("failed to find decorators for property {0}",l));u=r.pop();const f=u.props.name?[u.props.name]:Array.isArray(u.props.customTypes)?u.props.customTypes:[u.props.customTypes],p=Object.values(o.ReservedModels).map((e=>e.toLowerCase()));f.forEach((t=>{if(-1===p.indexOf(t.toLowerCase()))try{switch(t){case"Array":case"Set":if(d.length){const r=d.find((e=>e.key===a.ValidationKeys.LIST));if(r&&("Array"===t&&(e[l]=e[l].map((e=>n.Model.build(e,r.props.class)))),"Set"===t)){const t=new Set;for(const a of e[l])t.add(n.Model.build(a,r.props.class));e[l]=t}}break;default:e[l]&&(e[l]=n.Model.build(e[l],t))}}catch(e){console.log(e)}}))}return e},t.construct=function(e,...t){const r=(...t)=>new e(...t);return r.prototype=e.prototype,r(...t)};const n=r(6),a=r(772),o=r(402),i=r(154),s=r(174),c=r(593)},893:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getModelKey=void 0,t.model=function(e,r){return i=>{const s=function(...s){const c=(0,n.construct)(i,...s),u=o.Model.getBuilder();u&&u(c,s.length?s[0]:void 0);const l=Object.assign({},{class:i.name});return Object.defineProperty(c,a.ModelKeys.ANCHOR,{writable:!1,enumerable:!1,configurable:!1,value:l}),Reflect.defineMetadata((0,t.getModelKey)(a.ModelKeys.MODEL),Object.assign(l,e||{}),c.constructor),r&&r(c,...s),c};return s.prototype=i.prototype,Object.defineProperty(s,"name",{writable:!1,enumerable:!0,configurable:!1,value:i.prototype.constructor.name}),o.Model.register(s),s}};const n=r(38),a=r(154),o=r(6);t.getModelKey=e=>a.ModelKeys.REFLECT+e},847:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(402),t),a(r(38),t),a(r(893),t),a(r(6),t),a(r(19),t),a(r(936),t),a(r(282),t)},282:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},501:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.metadata=function(e,t){return(r,n,a)=>{a?Reflect.defineMetadata(e,t,a.value):n?Reflect.defineMetadata(e,t,r,n):Reflect.defineMetadata(e,t,r)}},r(630)},839:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(501),t),a(r(174),t)},174:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getAllPropertyDecorators=void 0,t.getPropertyDecorators=i,t.getTypeFromDecorator=function(e,t){const r=i(n.ModelKeys.REFLECT,e,t,!1);if(!r||!r.decorators)return;const a=r.decorators.shift(),o=a.props?a.props.name:void 0;return"Function"!==o?o:void 0},t.getAllProperties=function(e,t=!0,r="Object"){const n=[];let a=e;const o=function(){if(!t)return;const e=Object.getPrototypeOf(a);return e&&e.constructor.name!==r?(a=e,a):void 0};do{Object.getOwnPropertyNames(a).forEach((function(e){-1===n.indexOf(e)&&n.push(e)}))}while(o());return n},t.getClassDecorators=s,t.checkType=c,t.checkTypes=u,t.evaluateDesignTypes=function(e,t){switch(typeof t){case"string":return c(e,t);case"object":return!Array.isArray(t)||u(e,t);case"function":return!t.name||"Object"===t.name||c(e,t.name);default:return!0}},t.isModel=function(e){return!!e[n.ModelKeys.ANCHOR]||!!s(n.ModelKeys.REFLECT,e).find((e=>e.key===n.ModelKeys.MODEL&&e.props&&e.props.class))};const n=r(154),a=r(593),o=r(687);function i(e,t,r,s=!1,c=!0,u){const l=function(e,t,r,a=!1,o){const i=Reflect.getMetadataKeys(t,r).filter((t=>a?t.toString().startsWith(e):t===n.ModelKeys.TYPE||t.toString().startsWith(e))).reduce(((a,o)=>{const i={key:o!==n.ModelKeys.TYPE?o.substring(e.length):o,props:Reflect.getMetadata(o,t,r)};return a.concat(i)}),o||[]);return{prop:r.toString(),decorators:i}}(e,t,r,s,u);return c&&Object.getPrototypeOf(t)!==Object.prototype?i(e,Object.getPrototypeOf(t.constructor),r,!0,c,l.decorators):{prop:l.prop,decorators:function(e){const r={};return e.filter((e=>e.key in r?((0,o.isEqual)(e.props,r[e.key])||console.log((0,a.sf)("Found a similar decorator for the {0} property of a {1} model but with different attributes. The original one will be kept",e.key,t.constructor.name)),!1):(r[e.key.toString()]=e.props,!0)))}(l.decorators)}}function s(e,t){return Reflect.getOwnMetadataKeys(t.constructor).filter((t=>t.toString().startsWith(e))).reduce(((r,n)=>{const a={key:n.substring(e.length),props:Reflect.getMetadata(n,t.constructor)};return r.concat(a)}),[])}function c(e,t){return typeof e===t||e.constructor&&e.constructor.name.toLowerCase()===t.toLowerCase()}function u(e,t){return!t.every((t=>!c(e,t)))}r(630),t.getAllPropertyDecorators=function(e,...t){if(t&&t.length)return Object.getOwnPropertyNames(e).reduce(((r,n)=>(t.forEach(((t,a)=>{const o=i(t,e,n,0!==a);r||(r={}),function(e,t,r){r&&r.length&&(e[t]||(e[t]=[]),e[t].push(...r))}(r,n,o.decorators)})),r)),void 0)}},154:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ModelKeys=void 0,function(e){e.REFLECT="model.definition.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__modelDefinition"}(r||(t.ModelKeys=r={}))},46:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dateFromFormat=o,t.bindDateToString=i,t.isValidDate=s,t.twoDigitPad=c,t.formatDate=u,t.parseDate=function(e,t){let r;if(t){if(t instanceof Date)try{r=o(u(t,e),e)}catch(r){throw new Error((0,a.sf)("Could not convert date {0} to format: {1}",t.toString(),e))}else if("string"==typeof t)r=o(t,e);else if("number"==typeof t)r=o(u(new Date(t),e),e);else{if(!s(t))throw new Error(`Invalid value provided ${t}`);try{r=o(u(new Date(t),e),e)}catch(r){throw new Error((0,a.sf)("Could not convert date {0} to format: {1}",t,e))}}return i(r,e)}},r(630);const n=r(772),a=r(593);function o(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 a=new RegExp(r,"g").exec(e);if(!a||!a.groups)return new Date(e);const o=function(e){if(!e)return 0;const t=parseInt(e);return isNaN(t)?0:t},i=o(a.groups.year),s=o(a.groups.day),c=a.groups.ampm;let u=o(a.groups.hour);c&&(u="PM"===c?u+12:u);const l=o(a.groups.minutes),d=o(a.groups.seconds),f=o(a.groups.milis),p=a.groups.monthname,y=a.groups.monthnamesmall;let h=a.groups.month;if(p)h=n.MONTH_NAMES.indexOf(p);else if(y){const t=n.MONTH_NAMES.find((e=>e.toLowerCase().startsWith(y.toLowerCase())));if(!t)return new Date(e);h=n.MONTH_NAMES.indexOf(t)}else h=o(`${h}`);return new Date(i,h-1,s,u,l,d,f)}function i(e,t){if(!e)return;const r=()=>u(e,t);return Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:r}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:r}),e}function s(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}function c(e){return e<10?"0"+e:e.toString()}function u(e,t="yyyy/MM/dd"){const r=e.getDate(),a=e.getMonth(),o=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),u=e.getSeconds(),l=e.getMilliseconds(),d=i%12,f=c(d),p=c(i),y=c(s),h=c(u),g=i<12?"AM":"PM",v=n.DAYS_OF_WEEK_NAMES[e.getDay()],E=v.substr(0,3),_=c(r),M=a+1,m=c(M),O=n.MONTH_NAMES[a],b=O.substr(0,3),R=o+"",S=R.substr(2,2);return(t=t.replace("hh",f).replace("h",d.toString()).replace("HH",p).replace("H",i.toString()).replace("mm",y).replace("m",s.toString()).replace("ss",h).replace("s",u.toString()).replace("S",l.toString()).replace("dd",_).replace("d",r.toString()).replace("EEEE",v).replace("EEE",E).replace("yyyy",R).replace("yy",S).replace("aaa",g)).indexOf("MMM")>-1?t.replace("MMMM",O).replace("MMM",b):t.replace("MM",m).replace("M",M.toString())}},687:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEqual=function e(t,r,...n){if(t===r)return!0;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(!t||!r||"object"!=typeof t&&"object"!=typeof r)return t===r;if(null==t||null==r)return!1;if(typeof t!=typeof r)return!1;if(t.prototype!==r.prototype)return!1;const a=Object.keys(t).filter((e=>-1===n.indexOf(e)));return a.length===Object.keys(r).filter((e=>-1===n.indexOf(e))).length&&a.every((a=>-1!==n.indexOf(a)||e(t[a],r[a],...n)))}},523:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hashCode=a,t.hashSerialization=function(e){return a(n.Model.serialize(e))},t.hashObj=function(e){const t=function(e,t){const r=n(t);return"string"==typeof r?n((e||"")+n(t)):0|(e=((e=e||0)<<5)-e+r)},r=a,n=function(e){return 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)},o=Object.values(e).reduce(t,0);return"number"==typeof o?Math.abs(o):o};const n=r(6);function a(e){e=String(e);let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t}},935:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(154),t),a(r(46),t),a(r(687),t),a(r(523),t),a(r(735),t),a(r(904),t),a(r(735),t),a(r(593),t)},904:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},735:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JSONSerializer=void 0;const n=r(6),a=r(154);t.JSONSerializer=class{preSerialize(e){const t=Object.assign({},e);return t[a.ModelKeys.ANCHOR]=e[a.ModelKeys.ANCHOR],t}deserialize(e){const t=JSON.parse(e);return n.Model.build(t)}serialize(e){return JSON.stringify(this.preSerialize(e))}}},593:(e,t)=>{function r(e,...t){return e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r]:e}))}Object.defineProperty(t,"__esModule",{value:!0}),t.sf=void 0,t.stringFormat=r,t.sf=r},770:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Validation=void 0;const n=r(375),a=r(436),o=r(154);class i{static{this.actingValidatorRegistry=void 0}constructor(){}static setRegistry(e,t){t&&i.actingValidatorRegistry&&i.actingValidatorRegistry.getKeys().forEach((r=>{const n=e.get(r);n&&e.register(t(n))})),i.actingValidatorRegistry=e}static getRegistry(){return i.actingValidatorRegistry||(i.actingValidatorRegistry=new a.ValidatorRegistry({validator:n.TypeValidator,validationKey:o.ModelKeys.TYPE,save:!1})),i.actingValidatorRegistry}static get(e){return i.getRegistry().get(e)}static register(...e){return i.getRegistry().register(...e)}}t.Validation=i},395:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateValidator=void 0;const o=r(116),i=r(772),s=r(787);let c=class extends o.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.DATE){super(i.ValidationKeys.DATE,e,Number.name,Date.name,String.name)}hasErrors(e,t,r){if(void 0!==e)return"string"==typeof e&&(e=new Date(e)),isNaN(e.getDate())?this.getMessage(r||this.message):void 0}};t.DateValidator=c,t.DateValidator=c=n([(0,s.validator)(i.ValidationKeys.DATE),a("design:paramtypes",[String])],c)},335:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailValidator=void 0;const o=r(772),i=r(273),s=r(787);let c=class extends i.PatternValidator{constructor(e=o.DEFAULT_ERROR_MESSAGES.EMAIL){super(o.ValidationKeys.EMAIL,e)}hasErrors(e,t){return super.hasErrors(e,o.DEFAULT_PATTERNS.EMAIL,t)}};t.EmailValidator=c,t.EmailValidator=c=n([(0,s.validator)(o.ValidationKeys.EMAIL),a("design:paramtypes",[String])],c)},407:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ListValidator=void 0;const o=r(116),i=r(772),s=r(787);let c=class extends o.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.LIST){super(i.ValidationKeys.LIST,e,Array.name,Set.name)}hasErrors(e,t,r){if(!e||(Array.isArray(e)?!e.length:!e.size))return;let n;for(let a=0;a<(Array.isArray(e)?e.length:e.size);a++)switch(n=e[a],typeof n){case"object":case"function":if(!n.constructor||n.constructor.name!==t)return this.getMessage(r||this.message,t);break;default:if(typeof n!==t)return this.getMessage(r||this.message,t)}}};t.ListValidator=c,t.ListValidator=c=n([(0,s.validator)(i.ValidationKeys.LIST),a("design:paramtypes",[String])],c)},169:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxLengthValidator=void 0;const o=r(116),i=r(772),s=r(787);let c=class extends o.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){super(i.ValidationKeys.MAX_LENGTH,e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length>t?this.getMessage(r||this.message,t):void 0}};t.MaxLengthValidator=c,t.MaxLengthValidator=c=n([(0,s.validator)(i.ValidationKeys.MAX_LENGTH),a("design:paramtypes",[String])],c)},909:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxValidator=void 0;const o=r(116),i=r(772),s=r(787);let c=class extends o.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MAX){super(i.ValidationKeys.MAX,e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Max param defined");return e>t?this.getMessage(r||this.message,t):void 0}}};t.MaxValidator=c,t.MaxValidator=c=n([(0,s.validator)(i.ValidationKeys.MAX),a("design:paramtypes",[String])],c)},519:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinLengthValidator=void 0;const o=r(116),i=r(772),s=r(787);let c=class extends o.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){super(i.ValidationKeys.MIN_LENGTH,e,String.name,Array.name)}hasErrors(e,t,r){if(void 0!==e)return e.length<t?this.getMessage(r||this.message,t):void 0}};t.MinLengthValidator=c,t.MinLengthValidator=c=n([(0,s.validator)(i.ValidationKeys.MIN_LENGTH),a("design:paramtypes",[String])],c)},651:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinValidator=void 0;const o=r(116),i=r(772),s=r(787);let c=class extends o.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MIN){super(i.ValidationKeys.MIN,e,"number","Date","string")}hasErrors(e,t,r){if(void 0!==e){if(e instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Min param defined");return e<t?this.getMessage(r||this.message,t):void 0}}};t.MinValidator=c,t.MinValidator=c=n([(0,s.validator)(i.ValidationKeys.MIN),a("design:paramtypes",[String])],c)},354:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordValidator=void 0;const o=r(273),i=r(772),s=r(787);let c=class extends o.PatternValidator{constructor(e=i.DEFAULT_ERROR_MESSAGES.PASSWORD,t=i.DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH){super(i.ValidationKeys.PASSWORD,e),this.pattern=t}hasErrors(e,t,r){return super.hasErrors(e,t||this.pattern,r||this.message)}};t.PasswordValidator=c,t.PasswordValidator=c=n([(0,s.validator)(i.ValidationKeys.PASSWORD),a("design:paramtypes",[Object,RegExp])],c)},273:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PatternValidator=t.regexpParser=void 0;const o=r(116),i=r(772),s=r(787);t.regexpParser=new RegExp("^/(.+)/([gimus]*)$");let c=class extends o.Validator{constructor(e=i.ValidationKeys.PATTERN,t=i.DEFAULT_ERROR_MESSAGES.PATTERN){super(e,t,"string")}getPattern(e){if(!t.regexpParser.test(e))return new RegExp(e);const r=e.match(t.regexpParser);return new RegExp(r[1],r[2])}hasErrors(e,t,r){if(e){if(!t)throw new Error("Missing Pattern");return(t="string"==typeof t?this.getPattern(t):t).lastIndex=0,t.test(e)?void 0:this.getMessage(r||this.message)}}};t.PatternValidator=c,t.PatternValidator=c=n([(0,s.validator)(i.ValidationKeys.PATTERN),a("design:paramtypes",[String,String])],c)},812:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredValidator=void 0;const o=r(116),i=r(772),s=r(787);let c=class extends o.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.REQUIRED){super(i.ValidationKeys.REQUIRED,e)}hasErrors(e,t){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(t||this.message):void 0;default:return e?void 0:this.getMessage(t||this.message)}}};t.RequiredValidator=c,t.RequiredValidator=c=n([(0,s.validator)(i.ValidationKeys.REQUIRED),a("design:paramtypes",[String])],c)},553:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.StepValidator=void 0;const o=r(116),i=r(772),s=r(787);let c=class extends o.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.STEP){super(i.ValidationKeys.STEP,e,"number","string")}hasErrors(e,t,r){if(void 0!==e)return Number(e)%Number(t)!=0?this.getMessage(r||this.message,t):void 0}};t.StepValidator=c,t.StepValidator=c=n([(0,s.validator)(i.ValidationKeys.STEP),a("design:paramtypes",[String])],c)},375:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeValidator=void 0;const n=r(116),a=r(772),o=r(154),i=r(174);class s extends n.Validator{constructor(e=a.DEFAULT_ERROR_MESSAGES.TYPE){super(o.ModelKeys.TYPE,e)}hasErrors(e,t,r){if(void 0!==e)return(0,i.evaluateDesignTypes)(e,t)?void 0:this.getMessage(r||this.message,"string"==typeof t?t:Array.isArray(t)?t.join(", "):t.name,typeof e)}}t.TypeValidator=s},964:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i},a=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.URLValidator=void 0;const o=r(772),i=r(273),s=r(787);let c=class extends i.PatternValidator{constructor(e=o.DEFAULT_ERROR_MESSAGES.URL){super(o.ValidationKeys.URL,e)}hasErrors(e,t){return super.hasErrors(e,o.DEFAULT_PATTERNS.URL,t)}};t.URLValidator=c,t.URLValidator=c=n([(0,s.validator)(o.ValidationKeys.URL),a("design:paramtypes",[String])],c)},116:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Validator=void 0;const n=r(772),a=r(593),o=r(174);t.Validator=class{constructor(e,t=n.DEFAULT_ERROR_MESSAGES.DEFAULT,...r){this.validationKey=e,this.message=t,r.length&&(this.acceptedTypes=r),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(e,...t){return(0,a.sf)(e,...t)}checkTypeAndHasErrors(e){return function(t,...r){return void 0!==t&&this.acceptedTypes?(0,o.checkTypes)(t,this.acceptedTypes)?e(t,...r):this.getMessage(n.DEFAULT_ERROR_MESSAGES.TYPE,this.acceptedTypes.join(", "),typeof t):e(t,...r)}.bind(this)}}},436:(e,t)=>{function r(e){return e.constructor&&e.hasErrors}Object.defineProperty(t,"__esModule",{value:!0}),t.ValidatorRegistry=void 0,t.isValidator=r,t.ValidatorRegistry=class{constructor(...e){this.cache={},this.customKeyChache={},this.register(...e)}getCustomKeys(){return Object.assign({},this.customKeyChache)}getKeys(){return Object.keys(this.cache)}get(e){if(!(e in this.cache))return;const t=this.cache[e];if(r(t))return t;const n=new(t.default||t);return this.cache[e]=n,n}register(...e){e.forEach((e=>{if(r(e)){if(e.validationKey in this.cache)return;this.cache[e.validationKey]=e}else{const{validationKey:t,validator:r,save:n}=e;if(t in this.cache)return;if(this.cache[t]=r,!n)return;const a={};a[t.toUpperCase()]=t,this.customKeyChache=Object.assign({},this.customKeyChache,a)}}))}}},772:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PATTERNS=t.DEFAULT_ERROR_MESSAGES=t.DAYS_OF_WEEK_NAMES=t.MONTH_NAMES=t.ValidationKeys=void 0,t.ValidationKeys={REFLECT:"model.validation.",REQUIRED:"required",MIN:"min",MAX:"max",STEP:"step",MIN_LENGTH:"minlength",MAX_LENGTH:"maxlength",PATTERN:"pattern",EMAIL:"email",URL:"url",DATE:"date",TYPE:"type",PASSWORD:"password",LIST:"list"},t.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],t.DAYS_OF_WEEK_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],t.DEFAULT_ERROR_MESSAGES={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}",LIST_INSIDE:"Elements of list are invalid: {0}",MODEL_NOT_FOUND:"No model registered under {0}"},t.DEFAULT_PATTERNS={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}}},787:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validator=function(e){return t=>(n.Validation.register({validator:t,validationKey:e,save:!0}),t)};const n=r(770)},493:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Validators=void 0;const o=r(395),i=r(375),s=r(354),c=r(553),u=r(964),l=r(273),d=r(651),f=r(519),p=r(909),y=r(169),h=r(812),g=r(335),v=r(407);a(r(772),t),a(r(395),t),a(r(787),t),a(r(335),t),a(r(407),t),a(r(169),t),a(r(909),t),a(r(519),t),a(r(651),t),a(r(354),t),a(r(273),t),a(r(812),t),a(r(553),t),a(r(168),t),a(r(375),t),a(r(964),t),a(r(116),t),a(r(436),t),t.Validators={EmailValidator:g.EmailValidator,RequiredValidator:h.RequiredValidator,MaxLengthValidator:y.MaxLengthValidator,MaxValidator:p.MaxValidator,MinLengthValidator:f.MinLengthValidator,MinValidator:d.MinValidator,PatternValidator:l.PatternValidator,URLValidator:u.URLValidator,StepValidator:c.StepValidator,DateValidator:o.DateValidator,TypeValidator:i.TypeValidator,PasswordValidator:s.PasswordValidator,ListValidator:v.ListValidator}},168:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},475:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getValidationKey=l,t.required=function(e=i.DEFAULT_ERROR_MESSAGES.REQUIRED){return(0,o.metadata)(l(i.ValidationKeys.REQUIRED),{message:e})},t.min=function(e,t=i.DEFAULT_ERROR_MESSAGES.MIN){return(0,o.metadata)(l(i.ValidationKeys.MIN),{value:e,message:t,types:[Number.name,Date.name]})},t.max=function(e,t=i.DEFAULT_ERROR_MESSAGES.MAX){return(0,o.metadata)(l(i.ValidationKeys.MAX),{value:e,message:t,types:[Number.name,Date.name]})},t.step=function(e,t=i.DEFAULT_ERROR_MESSAGES.STEP){return(0,o.metadata)(l(i.ValidationKeys.STEP),{value:e,message:t,types:[Number.name]})},t.minlength=function(e,t=i.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){return(0,o.metadata)(l(i.ValidationKeys.MIN_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]})},t.maxlength=function(e,t=i.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){return(0,o.metadata)(l(i.ValidationKeys.MAX_LENGTH),{value:e,message:t,types:[String.name,Array.name,Set.name]})},t.pattern=function(e,t=i.DEFAULT_ERROR_MESSAGES.PATTERN){return(0,o.metadata)(l(i.ValidationKeys.PATTERN),{value:"string"==typeof e?e:e.toString(),message:t,types:[String.name]})},t.email=function(e=i.DEFAULT_ERROR_MESSAGES.EMAIL){return(0,o.metadata)(l(i.ValidationKeys.EMAIL),{message:e,types:[String.name]})},t.url=function(e=i.DEFAULT_ERROR_MESSAGES.URL){return(0,o.metadata)(l(i.ValidationKeys.URL),{message:e,types:[String.name]})},t.type=d,t.date=function(e="dd/MM/yyyy",t=i.DEFAULT_ERROR_MESSAGES.DATE){return(r,n)=>{Reflect.defineMetadata(l(i.ValidationKeys.DATE),{format:e,message:t,types:[Date.name]},r,n);const a=new WeakMap;Object.defineProperty(r,n,{configurable:!1,set(t){const r=Object.getOwnPropertyDescriptor(this,n);r&&!r.configurable||Object.defineProperty(this,n,{enumerable:!0,configurable:!1,get:()=>a.get(this),set:t=>{let r;try{r=(0,u.parseDate)(e,t),a.set(this,r)}catch(e){console.error((0,s.sf)("Failed to parse date: {0}",e.message||e))}}}),this[n]=t},get(){console.log("here")}})}},t.password=function(e=i.DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH,t=i.DEFAULT_ERROR_MESSAGES.PASSWORD,r=c.PasswordValidator){return(n,o)=>{Reflect.defineMetadata(l(i.ValidationKeys.PASSWORD),{pattern:e,message:t,types:[String.name]},n,o),a.Validation.register({validator:r,validationKey:i.ValidationKeys.PASSWORD,save:!0})}},t.list=f,t.set=function(e,t=i.DEFAULT_ERROR_MESSAGES.LIST,r){return(n,a)=>{f(e,"Set",t,r)(n,a)}},r(630);const n=r(407),a=r(770),o=r(501),i=r(772),s=r(593),c=r(354),u=r(935);function l(e){return i.ValidationKeys.REFLECT+e}function d(e,t=i.DEFAULT_ERROR_MESSAGES.TYPE){return(0,o.metadata)(l(i.ValidationKeys.TYPE),{customTypes:e,message:t})}function f(e,t="Array",r=i.DEFAULT_ERROR_MESSAGES.LIST,o=n.ListValidator){return(n,s)=>{d(t)(n,s),Reflect.defineMetadata(l(i.ValidationKeys.LIST),{class:e.name,type:t,message:r},n,s),a.Validation.register({validator:o,validationKey:i.ValidationKeys.LIST,save:!0})}}},965:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,a)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(493),t),a(r(475),t),a(r(792),t),a(r(770),t)},792:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},630:(e,t,r)=>{var n;!function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=a(e);function a(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==t.Reflect&&(n=a(t.Reflect,n)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,a=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!i&&!s,u={create:i?function(){return H(Object.create(null))}:s?function(){return H({__proto__:null})}:function(){return H({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),d="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},t=[],r=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[o]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,a=r+1;a<n;a++)this._keys[a-1]=this._keys[a],this._values[a-1]=this._values[a];return this._keys.length--,this._values.length--,N(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new r(this._keys,this._values,n)},t.prototype.values=function(){return new r(this._keys,this._values,a)},t.prototype.entries=function(){return new r(this._keys,this._values,i)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[o]=function(){return this.entries()},t.prototype._find=function(e,t){if(!N(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(N(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function n(e,t){return e}function a(e,t){return t}function i(e,t){return[e,t]}}(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new d}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[o]=function(){return this.keys()},e}(),p="function"==typeof WeakMap?WeakMap:function(){var e=u.create(),t=n();return function(){function e(){this._key=n()}return e.prototype.has=function(e){var t=a(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=a(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return a(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=a(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=n()},e}();function n(){var t;do{t="@@WeakMap@@"+i()}while(u.has(e,t));return e[t]=!0,t}function a(e,n){if(!r.call(e,t)){if(!n)return;Object.defineProperty(e,t,{value:u.create()})}return e[t]}function o(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function i(){var e=function(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):o(t,e),t}return o(new Array(e),e)}(16);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",r=0;r<16;++r){var n=e[r];4!==r&&6!==r&&8!==r||(t+="-"),n<16&&(t+="0"),t+=n.toString(16).toLowerCase()}return t}}(),y=n?Symbol.for("@reflect-metadata:registry"):void 0,h=function(){var e;return!S(y)&&P(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[y]),S(e)&&(e=function(){var e,r,n,a;S(y)||void 0===t.Reflect||y in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=function(e){var t=e.defineMetadata,r=e.hasOwnMetadata,n=e.getOwnMetadata,a=e.getOwnMetadataKeys,o=e.deleteMetadata,i=new p;return{isProviderFor:function(e,t){var r=i.get(e);return!(S(r)||!r.has(t))||!!a(e,t).length&&(S(r)&&(r=new f,i.set(e,r)),r.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:r,OrdinaryGetOwnMetadata:n,OrdinaryOwnMetadataKeys:a,OrdinaryDeleteMetadata:o}}(t.Reflect));var o=new p,i={registerProvider:s,getProvider:u,setProvider:h};return i;function s(t){if(!Object.isExtensible(i))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case S(r):r=t;break;case r===t:break;case S(n):n=t;break;case n===t:break;default:void 0===a&&(a=new f),a.add(t)}}function c(t,o){if(!S(r)){if(r.isProviderFor(t,o))return r;if(!S(n)){if(n.isProviderFor(t,o))return r;if(!S(a))for(var i=x(a);;){var s=k(i);if(!s)return;var c=F(s);if(c.isProviderFor(t,o))return I(i),c}}}if(!S(e)&&e.isProviderFor(t,o))return e}function u(e,t){var r,n=o.get(e);return S(n)||(r=n.get(t)),S(r)?(S(r=c(e,t))||(S(n)&&(n=new d,o.set(e,n)),n.set(t,r)),r):r}function l(e){if(S(e))throw new TypeError;return r===e||n===e||!S(a)&&a.has(e)}function h(e,t,r){if(!l(r))throw new Error("Metadata provider not registered.");var n=u(e,t);if(n!==r){if(!S(n))return!1;var a=o.get(e);S(a)&&(a=new d,o.set(e,a)),a.set(t,r)}return!0}}()),!S(y)&&P(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}(),g=function(e){var t=new p,r={isProviderFor:function(e,r){var n=t.get(e);return!S(n)&&n.has(r)},OrdinaryDefineOwnMetadata:function(e,t,r,a){n(r,a,!0).set(e,t)},OrdinaryHasOwnMetadata:function(e,t,r){var a=n(t,r,!1);return!S(a)&&A(a.has(e))},OrdinaryGetOwnMetadata:function(e,t,r){var a=n(t,r,!1);if(!S(a))return a.get(e)},OrdinaryOwnMetadataKeys:function(e,t){var r=[],a=n(e,t,!1);if(S(a))return r;for(var o=x(a.keys()),i=0;;){var s=k(o);if(!s)return r.length=i,r;var c=F(s);try{r[i]=c}catch(e){try{I(o)}finally{throw e}}i++}},OrdinaryDeleteMetadata:function(e,r,a){var o=n(r,a,!1);if(S(o))return!1;if(!o.delete(e))return!1;if(0===o.size){var i=t.get(r);S(i)||(i.delete(a),0===i.size&&t.delete(i))}return!0}};return h.registerProvider(r),r;function n(n,a,o){var i=t.get(n),s=!1;if(S(i)){if(!o)return;i=new d,t.set(n,i),s=!0}var c=i.get(a);if(S(c)){if(!o)return;if(c=new d,i.set(a,c),!e.setProvider(n,a,r))throw i.delete(a),s&&t.delete(n),new Error("Wrong provider for target.")}return c}}(h);function v(e,t,r){if(E(e,t,r))return!0;var n=U(t);return!w(n)&&v(e,n,r)}function E(e,t,r){var n=G(t,r,!1);return!S(n)&&A(n.OrdinaryHasOwnMetadata(e,t,r))}function _(e,t,r){if(E(e,t,r))return M(e,t,r);var n=U(t);return w(n)?void 0:_(e,n,r)}function M(e,t,r){var n=G(t,r,!1);if(!S(n))return n.OrdinaryGetOwnMetadata(e,t,r)}function m(e,t,r,n){G(r,n,!0).OrdinaryDefineOwnMetadata(e,t,r,n)}function O(e,t){var r=b(e,t),n=U(e);if(null===n)return r;var a=O(n,t);if(a.length<=0)return r;if(r.length<=0)return a;for(var o=new f,i=[],s=0,c=r;s<c.length;s++){var u=c[s];o.has(u)||(o.add(u),i.push(u))}for(var l=0,d=a;l<d.length;l++)u=d[l],o.has(u)||(o.add(u),i.push(u));return i}function b(e,t){var r=G(e,t,!1);return r?r.OrdinaryOwnMetadataKeys(e,t):[]}function R(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function S(e){return void 0===e}function w(e){return null===e}function P(e){return"object"==typeof e?null!==e:"function"==typeof e}function T(e,t){switch(R(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",n=K(e,a);if(void 0!==n){var o=n.call(e,r);if(P(o))throw new TypeError;return o}return function(e,t){if("string"===t){var r=e.toString;if(D(r)&&!P(a=r.call(e)))return a;if(D(n=e.valueOf)&&!P(a=n.call(e)))return a}else{var n;if(D(n=e.valueOf)&&!P(a=n.call(e)))return a;var a,o=e.toString;if(D(o)&&!P(a=o.call(e)))return a}throw new TypeError}(e,"default"===r?"number":r)}function A(e){return!!e}function j(e){var t=T(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function V(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function D(e){return"function"==typeof e}function L(e){return"function"==typeof e}function N(e,t){return e===t||e!=e&&t!=t}function K(e,t){var r=e[t];if(null!=r){if(!D(r))throw new TypeError;return r}}function x(e){var t=K(e,o);if(!D(t))throw new TypeError;var r=t.call(e);if(!P(r))throw new TypeError;return r}function F(e){return e.value}function k(e){var t=e.next();return!t.done&&t}function I(e){var t=e.return;t&&t.call(e)}function U(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===l)return t;if(t!==l)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var a=n.constructor;return"function"!=typeof a||a===e?t:a}function G(e,t,r){var n=h.getProvider(e,t);if(!S(n))return n;if(r){if(h.setProvider(e,t,g))return g;throw new Error("Illegal state.")}}function H(e){return e.__=void 0,delete e.__,e}e("decorate",(function(e,t,r,n){if(S(r)){if(!V(e))throw new TypeError;if(!L(t))throw new TypeError;return function(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!S(n)&&!w(n)){if(!L(n))throw new TypeError;t=n}}return t}(e,t)}if(!V(e))throw new TypeError;if(!P(t))throw new TypeError;if(!P(n)&&!S(n)&&!w(n))throw new TypeError;return w(n)&&(n=void 0),function(e,t,r,n){for(var a=e.length-1;a>=0;--a){var o=(0,e[a])(t,r,n);if(!S(o)&&!w(o)){if(!P(o))throw new TypeError;n=o}}return n}(e,t,r=j(r),n)})),e("metadata",(function(e,t){return function(r,n){if(!P(r))throw new TypeError;if(!S(n)&&!function(e){switch(R(e)){case 3:case 4:return!0;default:return!1}}(n))throw new TypeError;m(e,t,r,n)}})),e("defineMetadata",(function(e,t,r,n){if(!P(r))throw new TypeError;return S(n)||(n=j(n)),m(e,t,r,n)})),e("hasMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=j(r)),v(e,t,r)})),e("hasOwnMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=j(r)),E(e,t,r)})),e("getMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=j(r)),_(e,t,r)})),e("getOwnMetadata",(function(e,t,r){if(!P(t))throw new TypeError;return S(r)||(r=j(r)),M(e,t,r)})),e("getMetadataKeys",(function(e,t){if(!P(e))throw new TypeError;return S(t)||(t=j(t)),O(e,t)})),e("getOwnMetadataKeys",(function(e,t){if(!P(e))throw new TypeError;return S(t)||(t=j(t)),b(e,t)})),e("deleteMetadata",(function(e,t,r){if(!P(t))throw new TypeError;if(S(r)||(r=j(r)),!P(t))throw new TypeError;S(r)||(r=j(r));var n=G(t,r,!1);return!S(n)&&n.OrdinaryDeleteMetadata(e,t,r)}))}(n,t),void 0===t.Reflect&&(t.Reflect=e)}()}(n||(n={}))}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(729);

@@ -23,2 +23,6 @@ /**

/**
* @namespace Reflections
* @memberOf module:decorator-validation.Reflections
*/
/**
* @namespace Construction

@@ -60,4 +64,5 @@ * @memberOf module:decorator-validation

export * from "./utils";
export * from "./reflection";
export * from "./validation";
export * from "./model";
export declare const VERSION = "1.0.7";
export declare const VERSION = "1.0.11";

@@ -1,1 +0,68 @@

export*from"./utils";export*from"./validation";export*from"./model";const VERSION="1.0.7";export{VERSION};
/**
* @module decorator-validation
*/
/**
* @summary Defines the Model object
* @namespace Model
* @memberOf module:decorator-validation
*/
/**
* @summary Holds all the supported decorators
* @namespace Decorators
* @memberOf module:decorator-validation
*/
/**
* @namespace Validation
* @memberOf module:decorator-validation.Decorators
*/
/**
* @namespace Model
* @memberOf module:decorator-validation.Decorators
*/
/**
* @namespace Reflections
* @memberOf module:decorator-validation.Reflections
*/
/**
* @namespace Construction
* @memberOf module:decorator-validation
*/
/**
* @namespace Validation
* @memberOf module:decorator-validation
*/
/**
* @namespace Validators
* @memberOf module:decorator-validation.Validation
*/
/**
* @namespace Utils
* @memberOf module:decorator-validation
*/
/**
* @namespace Dates
* @memberOf module:decorator-validation.Utils
*/
/**
* @namespace Equality
* @memberOf module:decorator-validation.Utils
*/
/**
* @namespace Hashing
* @memberOf module:decorator-validation.Utils
*/
/**
* @namespace Serialization
* @memberOf module:decorator-validation.Utils
*/
/**
* @namespace Format
* @memberOf module:decorator-validation.Utils
*/
export * from "./utils";
export * from "./reflection";
export * from "./validation";
export * from "./model";
export const VERSION = "1.0.11";
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVIOzs7O0dBSUc7QUFFSDs7OztHQUlHO0FBRUg7OztHQUdHO0FBRUg7OztHQU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KiBmcm9tIFwiLi91dGlsc1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vcmVmbGVjdGlvblwiO1xuZXhwb3J0ICogZnJvbSBcIi4vdmFsaWRhdGlvblwiO1xuZXhwb3J0ICogZnJvbSBcIi4vbW9kZWxcIjtcblxuZXhwb3J0IGNvbnN0IFZFUlNJT04gPSBcIjEuMC4xMVwiO1xuIl19

@@ -1,1 +0,44 @@

var Primitives,ReservedModels;!function(e){e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"}(Primitives=Primitives||{}),function(e){e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"}(ReservedModels=ReservedModels||{});export{Primitives,ReservedModels};
/**
* @summary References the relevant JS primitives
*
* @property {string} STRING references the string primitive
* @property {string} NUMBER references the number primitive
* @property {string} BOOLEAN references the boolean primitive
* @property {string} BIGINT references the bigint primitive
*
* @constant Primitives
* @memberOf module:decorator-validation.Construction
* @category Model
*/
export var Primitives;
(function (Primitives) {
Primitives["STRING"] = "string";
Primitives["NUMBER"] = "number";
Primitives["BOOLEAN"] = "boolean";
Primitives["BIGINT"] = "bigint";
})(Primitives || (Primitives = {}));
/**
* @summary References the Reserved model names to ignore during Model rebuilding
*
* @property {string} STRING
* @property {string} OBJECT
* @property {string} NUMBER
* @property {string} BOOLEAN
* @property {string} BIGINT
* @property {string} DATE
*
* @constant ReservedModels
* @memberOf module:decorator-validation.Construction
* @category Construction
*/
export var ReservedModels;
(function (ReservedModels) {
ReservedModels["STRING"] = "string";
ReservedModels["OBJECT"] = "object";
ReservedModels["NUMBER"] = "number";
ReservedModels["BOOLEAN"] = "boolean";
ReservedModels["BIGINT"] = "bigint";
ReservedModels["DATE"] = "date";
})(ReservedModels || (ReservedModels = {}));
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tb2RlbC9jb25zdGFudHMudHMiX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yDecorators,isModel,stringFormat}from"../utils";import{ValidationKeys}from"../validation";import{ReservedModels}from"./constants";import{ModelKeys}from"../utils/constants";function constructFromObject(o,r){if(r)for(const t in r)r.hasOwnProperty(t)&&(o.hasOwnProperty(t)||o.prototype&&o.prototype.hasOwnProperty(t))&&(o[t]=r[t]);return o}function constructFromModel(s,o){if(o)for(const n in o)if(o.hasOwnProperty(n)&&(s.hasOwnProperty(n)||s.prototype&&s.prototype.hasOwnProperty(n))){if(s[n]=o[n],"object"!=typeof s[n])continue;if(isModel(s[n])){try{s[n]=Model.build(s[n])}catch(o){console.log(o)}continue}const p=getPropertyDecorators(ValidationKeys.REFLECT,s,n).decorators;if(!(r=p.filter(o=>-1!==[ModelKeys.TYPE,ValidationKeys.TYPE].indexOf(o.key)))||!r.length)throw new Error(stringFormat("failed to find decorators for property {0}",n));var r=(r=r.pop()).props.name?[r.props.name]:Array.isArray(r.props.customTypes)?r.props.customTypes:[r.props.customTypes];const a=Object.values(ReservedModels).map(o=>o.toLowerCase());r.forEach(o=>{if(-1===a.indexOf(o.toLowerCase()))try{switch(o){case"Array":case"Set":if(p.length){const t=p.find(o=>o.key===ValidationKeys.LIST);if(t&&("Array"===o&&(s[n]=s[n].map(o=>Model.build(o,t.props.class))),"Set"===o)){var r=new Set;for(const e of s[n])r.add(Model.build(e,t.props.class));s[n]=r}}break;default:s[n]&&(s[n]=Model.build(s[n],o))}}catch(o){console.log(o)}})}return s}function construct(r,...o){var t=(...o)=>new r(...o);return t.prototype=r.prototype,t(...o)}export{constructFromObject,constructFromModel,construct};
import { Model } from "./Model";
import { ValidationKeys } from "../validation/Validators/constants";
import { ReservedModels } from "./constants";
import { ModelKeys } from "../utils/constants";
import { getPropertyDecorators, isModel } from "../reflection/utils";
import { sf } from "../utils/strings";
/**
* @summary Repopulates the Object properties with the ones from the new object
* @description Iterates all common properties of obj (if existing) and self, and copies them onto self
*
* @param {T} self
* @param {T | Record<string, any>} [obj]
*
* @function constructFromObject
* @memberOf module:decorator-validation.Construction
* @category Construction
*/
export function constructFromObject(self, obj) {
if (!obj)
return self;
for (const prop in obj)
if (obj.hasOwnProperty(prop) &&
(self.hasOwnProperty(prop) ||
(self.prototype && self.prototype.hasOwnProperty(prop))))
self[prop] = obj[prop] || undefined;
return self;
}
/**
* @summary Repopulates the instance with the ones from the new Model Object
* @description Iterates all common properties of obj (if existing) and self, and copies them onto self.
* Is aware of nested Model Objects and rebuilds them also.
* When List properties are decorated with {@link list}, they list items will also be rebuilt
*
* @param {T} self
* @param {T | Record<string, any>} [obj]
*
* @function constructFromModel
* @memberOf module:decorator-validation.Construction
* @category Construction
*/
export function constructFromModel(self, obj) {
if (!obj)
return self;
let decorators, dec;
for (const prop in obj)
if (obj.hasOwnProperty(prop) &&
(self.hasOwnProperty(prop) ||
(self.prototype && self.prototype.hasOwnProperty(prop)))) {
self[prop] =
obj[prop] || undefined;
if (typeof self[prop] !== "object")
continue;
if (isModel(self[prop])) {
try {
self[prop] = Model.build(self[prop]);
}
catch (e) {
console.error(e);
}
continue;
}
const allDecorators = getPropertyDecorators(ValidationKeys.REFLECT, self, prop).decorators;
decorators = allDecorators.filter((d) => [ModelKeys.TYPE, ValidationKeys.TYPE].indexOf(d.key) !== -1);
if (!decorators || !decorators.length)
throw new Error(sf("failed to find decorators for property {0}", prop));
dec = decorators.pop();
const clazz = dec.props.name
? [dec.props.name]
: Array.isArray(dec.props.customTypes)
? dec.props.customTypes
: [dec.props.customTypes];
const reserved = Object.values(ReservedModels).map((v) => v.toLowerCase());
clazz.forEach((c) => {
if (reserved.indexOf(c.toLowerCase()) === -1)
try {
switch (c) {
case "Array":
case "Set":
if (allDecorators.length) {
const listDec = allDecorators.find((d) => d.key === ValidationKeys.LIST);
if (listDec) {
if (c === "Array")
self[prop] = self[prop].map((el) => Model.build(el, listDec.props.class));
if (c === "Set") {
const s = new Set();
for (const v of self[prop]) {
s.add(Model.build(v, listDec.props.class));
}
self[prop] = s;
}
}
}
break;
default:
if (self[prop])
self[prop] = Model.build(self[prop], c);
}
}
catch (e) {
console.log(e);
// do nothing. we have no registry of this class
}
});
}
return self;
}
/**
* @summary Helper Function to override constructors
*
* @param {Function} constructor
* @param {any[]} [args]
* @return {T} the new instance
*
* @function construct
* @memberOf module:decorator-validation.Construction
* @category Construction
*/
export function construct(constructor, ...args) {
const _constr = (...argz) => new constructor(...argz);
_constr.prototype = constructor.prototype;
return _constr(...args);
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tb2RlbC9jb25zdHJ1Y3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssRUFBRSxNQUFNLFNBQVMsQ0FBQztBQUVoQyxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sb0NBQW9DLENBQUM7QUFDcEUsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUM3QyxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDL0MsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE9BQU8sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3JFLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUV0Qzs7Ozs7Ozs7OztHQVVHO0FBQ0gsTUFBTSxVQUFVLG1CQUFtQixDQUNqQyxJQUFPLEVBQ1AsR0FBNkI7SUFFN0IsSUFBSSxDQUFDLEdBQUc7UUFBRSxPQUFPLElBQUksQ0FBQztJQUN0QixLQUFLLE1BQU0sSUFBSSxJQUFJLEdBQUc7UUFDcEIsSUFDRSxHQUFHLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQztZQUN4QixDQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDO2dCQUN4QixDQUFDLElBQUksQ0FBQyxTQUFTLElBQUksSUFBSSxDQU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dG9tVHlwZXNdO1xuICAgICAgY29uc3QgcmVzZXJ2ZWQgPSBPYmplY3QudmFsdWVzKFJlc2VydmVkTW9kZWxzKS5tYXAoKHYpID0+XG4gICAgICAgIHYudG9Mb3dlckNhc2UoKSxcbiAgICAgICkgYXMgc3RyaW5nW107XG5cbiAgICAgIGNsYXp6LmZvckVhY2goKGMpID0+IHtcbiAgICAgICAgaWYgKHJlc2VydmVkLmluZGV4T2YoYy50b0xvd2VyQ2FzZSgpKSA9PT0gLTEpXG4gICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHN3aXRjaCAoYykge1xuICAgICAgICAgICAgICBjYXNlIFwiQXJyYXlcIjpcbiAgICAgICAgICAgICAgY2FzZSBcIlNldFwiOlxuICAgICAgICAgICAgICAgIGlmIChhbGxEZWNvcmF0b3JzLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgY29uc3QgbGlzdERlYyA9IGFsbERlY29yYXRvcnMuZmluZChcbiAgICAgICAgICAgICAgICAgICAgKGQpID0+IGQua2V5ID09PSBWYWxpZGF0aW9uS2V5cy5MSVNULFxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgIGlmIChsaXN0RGVjKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjID09PSBcIkFycmF5XCIpXG4gICAgICAgICAgICAgICAgICAgICAgKHNlbGYgYXMgUmVjb3JkPHN0cmluZywgYW55PilbcHJvcF0gPSAoXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmIGFzIFJlY29yZDxzdHJpbmcsIGFueT5cbiAgICAgICAgICAgICAgICAgICAgICApW3Byb3BdLm1hcCgoZWw6IGFueSkgPT5cbiAgICAgICAgICAgICAgICAgICAgICAgIE1vZGVsLmJ1aWxkKGVsLCBsaXN0RGVjLnByb3BzLmNsYXNzKSxcbiAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PT0gXCJTZXRcIikge1xuICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHMgPSBuZXcgU2V0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCB2IG9mIChzZWxmIGFzIFJlY29yZDxzdHJpbmcsIGFueT4pW3Byb3BdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzLmFkZChNb2RlbC5idWlsZCh2LCBsaXN0RGVjLnByb3BzLmNsYXNzKSk7XG4gICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgIChzZWxmIGFzIFJlY29yZDxzdHJpbmcsIGFueT4pW3Byb3BdID0gcztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgICAgICBpZiAoKHNlbGYgYXMgUmVjb3JkPHN0cmluZywgYW55PilbcHJvcF0pXG4gICAgICAgICAgICAgICAgICAoc2VsZiBhcyBSZWNvcmQ8c3RyaW5nLCBhbnk+KVtwcm9wXSA9IE1vZGVsLmJ1aWxkKFxuICAgICAgICAgICAgICAgICAgICBzZWxmW3Byb3BdLFxuICAgICAgICAgICAgICAgICAgICBjLFxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGNhdGNoIChlOiBhbnkpIHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKGUpO1xuICAgICAgICAgICAgLy8gZG8gbm90aGluZy4gd2UgaGF2ZSBubyByZWdpc3RyeSBvZiB0aGlzIGNsYXNzXG4gICAgICAgICAgfVxuICAgICAgfSk7XG4gICAgfVxuXG4gIHJldHVybiBzZWxmO1xufVxuXG4vKipcbiAqIEBzdW1tYXJ5IEhlbHBlciBGdW5jdGlvbiB0byBvdmVycmlkZSBjb25zdHJ1Y3RvcnNcbiAqXG4gKiBAcGFyYW0ge0Z1bmN0aW9ufSBjb25zdHJ1Y3RvclxuICogQHBhcmFtIHthbnlbXX0gW2FyZ3NdXG4gKiBAcmV0dXJuIHtUfSB0aGUgbmV3IGluc3RhbmNlXG4gKlxuICogQGZ1bmN0aW9uIGNvbnN0cnVjdFxuICogQG1lbWJlck9mIG1vZHVsZTpkZWNvcmF0b3ItdmFsaWRhdGlvbi5Db25zdHJ1Y3Rpb25cbiAqIEBjYXRlZ29yeSBDb25zdHJ1Y3Rpb25cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGNvbnN0cnVjdDxUIGV4dGVuZHMgTW9kZWw+KFxuICBjb25zdHJ1Y3RvcjogYW55LFxuICAuLi5hcmdzOiBhbnlbXVxuKTogVCB7XG4gIGNvbnN0IF9jb25zdHIgPSAoLi4uYXJnejogYW55W10pID0+IG5ldyBjb25zdHJ1Y3RvciguLi5hcmd6KTtcbiAgX2NvbnN0ci5wcm90b3R5cGUgPSBjb25zdHJ1Y3Rvci5wcm90b3R5cGU7XG4gIHJldHVybiBfY29uc3RyKC4uLmFyZ3MpO1xufVxuXG4vKipcbiAqIEBzdW1tYXJ5IFR5cG8gb2YgYSBNb2RlbCBidWlsZGVyIGZ1bmN0aW9uXG4gKiBAbWVtYmVyT2YgbW9kdWxlOmRlY29yYXRvci12YWxpZGF0aW9uLkNvbnN0cnVjdGlvblxuICogQGNhdGVnb3J5IENvbnN0cnVjdGlvblxuICovXG5leHBvcnQgdHlwZSBNb2RlbEJ1aWxkZXJGdW5jdGlvbiA9IDxUIGV4dGVuZHMgTW9kZWw+KFxuICBzZWxmOiBULFxuICBvYmo/OiBUIHwgUmVjb3JkPHN0cmluZywgYW55PixcbikgPT4gVDtcbiJdfQ==

@@ -20,2 +20,3 @@ /**

* @description
*
* - Registers the class under the model registry so it can be easily rebuilt;

@@ -27,9 +28,8 @@ * - Overrides the class constructor;

*
* @prop {Record<string, any>} [props] additional properties to store as metadata
* @prop {InstanceCallback} [instanceCallback] optional callback that will be call with the instance upon instantiation. defaults to undefined
* @param {Record<string, any>} [props] additional properties to store as metadata
* @param {InstanceCallback} [instanceCallback] optional callback that will be called with the instance upon instantiation. defaults to undefined
*
* @function model
* @memberOf module:decorator-validation.Decorators.Model
* @category Decorators
*/
export declare function model(props?: Record<string, any>, instanceCallback?: InstanceCallback): (original: any) => any;

@@ -1,1 +0,68 @@

import{construct}from"./construction";import{ModelKeys}from"../utils/constants";import{Model}from"./Model";const getModelKey=e=>ModelKeys.REFLECT+e;function model(n,l){return r=>{function e(...e){var t=construct(r,...e),o=((o=Model.getBuilder())&&o(t,e.length?e[0]:void 0),Object.assign({},{class:r.name}));return Object.defineProperty(t,ModelKeys.ANCHOR,{writable:!1,enumerable:!1,configurable:!1,value:o}),Reflect.defineMetadata(getModelKey(ModelKeys.MODEL),Object.assign(o,n||{}),t.constructor),l&&l(t,...e),t}return e.prototype=r.prototype,Object.defineProperty(e,"name",{writable:!1,enumerable:!0,configurable:!1,value:r.prototype.constructor.name}),Model.register(e),e}}export{getModelKey,model};
import { construct } from "./construction";
import { ModelKeys } from "../utils/constants";
import { Model } from "./Model";
/**
* @summary Builds the key to store as Metadata under Reflections
* @description concatenates {@link ModelKeys#REFLECT} with the provided key
* @param {string} str
*
* @function getModelKey
* @memberOf module:decorator-validation.Model
* @category Utilities
*/
export const getModelKey = (str) => ModelKeys.REFLECT + str;
/**
* @summary Defines a class as a Model class
* @description
*
* - Registers the class under the model registry so it can be easily rebuilt;
* - Overrides the class constructor;
* - Runs the global {@link ModelBuilderFunction} if defined;
* - Runs the optional {@link InstanceCallback} if provided;
* - Defines an {@link ModelKeys#ANCHOR} property for serialization and model rebuilding purposes;
*
* @param {Record<string, any>} [props] additional properties to store as metadata
* @param {InstanceCallback} [instanceCallback] optional callback that will be called with the instance upon instantiation. defaults to undefined
*
* @function model
* @category Decorators
*/
export function model(props, instanceCallback) {
return (original) => {
// the new constructor behaviour
const newConstructor = function (...args) {
const instance = construct(original, ...args);
// run a builder function if defined with the first argument (The ModelArg)
const builder = Model.getBuilder();
if (builder)
builder(instance, args.length ? args[0] : undefined);
const metadata = Object.assign({}, {
class: original.name,
});
Object.defineProperty(instance, ModelKeys.ANCHOR, {
writable: false,
enumerable: false,
configurable: false,
value: metadata,
});
Reflect.defineMetadata(getModelKey(ModelKeys.MODEL), Object.assign(metadata, props || {}), instance.constructor);
if (instanceCallback)
instanceCallback(instance, ...args);
return instance;
};
// copy prototype so instanceof operator still works
newConstructor.prototype = original.prototype;
// Sets the proper constructor name for type verification
Object.defineProperty(newConstructor, "name", {
writable: false,
enumerable: true,
configurable: false,
value: original.prototype.constructor.name,
});
Model.register(newConstructor);
// return new constructor (will override original)
return newConstructor;
};
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tb2RlbC9kZWNvcmF0b3JzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMzQyxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDL0MsT0FBTyxFQUFFLEtBQUssRUFBRSxNQUFNLFNBQVMsQ0FBQztBQUVoQzs7Ozs7Ozs7R0FRRztBQUNILE1BQU0sQ0FBQyxNQUFNLFdBQVcsR0FBRyxDQUFDLEdBQVcsRUFBRSxFQUFFLENBQUMsU0FBUyxDQUFDLE9BQU8sR0FBRyxHQUFHLENBQUM7QUFRcEU7Ozs7Ozs7Ozs7Ozs7OztHQWVHO0FBQ0gsTUFBTSxVQUFVLEtBQUssQ0FDbkIsS0FBMkIsRUFDM0IsZ0JBQW1DO0lBRW5DLE9BQU8sQ0FBQyxRQUFhLEVBQUUsRUFBRTtRQUN2QixnQ0FBZ0M7UUFDaEMsTUFBTSxjQUFjLEdBQVEsVUFBVSxHQUFHLElBQVc7WUFDbEQsTUFBTSxRQUFRLEdBQWdDLFNBQVMsQ0FDckQsUUFBUSxFQUNSLEdB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ihuZXdDb25zdHJ1Y3Rvcik7XG5cbiAgICAvLyByZXR1cm4gbmV3IGNvbnN0cnVjdG9yICh3aWxsIG92ZXJyaWRlIG9yaWdpbmFsKVxuICAgIHJldHVybiBuZXdDb25zdHJ1Y3RvcjtcbiAgfTtcbn1cbiJdfQ==

@@ -0,7 +1,7 @@

export * from "./constants";
export * from "./construction";
export * from "./Registry";
export * from "./decorators";
export * from "./Model";
export * from "./ModelErrorDefinition";
export * from "./Registry";
export * from "./types";
export * from "./Model";
export * from "./constants";

@@ -1,1 +0,9 @@

export*from"./construction";export*from"./Registry";export*from"./decorators";export*from"./ModelErrorDefinition";export*from"./types";export*from"./Model";export*from"./constants";
export * from "./constants";
export * from "./construction";
export * from "./decorators";
export * from "./Model";
export * from "./ModelErrorDefinition";
export * from "./Registry";
export * from "./types";
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tb2RlbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLGdCQUFnQixDQUFDO0FBQy9CLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMsU0FBUyxDQUFDO0FBQ3hCLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxTQUFTLENBQUMiLCJmaWxlIjoibW9kZWwvaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tIFwiLi9jb25zdGFudHNcIjtcbmV4cG9ydCAqIGZyb20gXCIuL2NvbnN0cnVjdGlvblwiO1xuZXhwb3J0ICogZnJvbSBcIi4vZGVjb3JhdG9yc1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vTW9kZWxcIjtcbmV4cG9ydCAqIGZyb20gXCIuL01vZGVsRXJyb3JEZWZpbml0aW9uXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9SZWdpc3RyeVwiO1xuZXhwb3J0ICogZnJvbSBcIi4vdHlwZXNcIjtcbiJdfQ==

@@ -1,5 +0,7 @@

import { BuilderRegistry, HashingFunction, Serializer } from "../utils";
import { Serializer } from "../utils/serialization";
import { BuilderRegistry } from "../utils/registry";
import { ModelErrorDefinition } from "./ModelErrorDefinition";
import { ModelArg, ModelConstructor, Serializable, Validatable } from "./types";
import { ModelBuilderFunction } from "./construction";
import { HashingFunction } from "../utils/hashing";
/**

@@ -6,0 +8,0 @@ * @summary Analyses the decorations of the properties and validates the obj according to them

@@ -1,1 +0,316 @@

import{DEFAULT_ERROR_MESSAGES,ValidationKeys}from"../validation";import{getPropertyDecorators,hashObj,isEqual,JSONSerializer,stringFormat}from"../utils";import{ModelErrorDefinition}from"./ModelErrorDefinition";import{ReservedModels}from"./constants";import{ModelKeys}from"../utils/constants";import{constructFromModel,constructFromObject}from"./construction";import{ModelRegistryManager}from"./Registry";import{Validation}from"../validation/Validation";function validate(a,...e){var t=[];for(const i in a)a.hasOwnProperty(i)&&-1===e.indexOf(i)&&t.push(getPropertyDecorators(ValidationKeys.REFLECT,a,i));var r=t.reduce((e,r)=>{const{prop:i,decorators:o}=r;if(o&&o.length){const s=o[0];o.find(e=>e.key===ValidationKeys.TYPE||!!e.props.types?.find(e=>e===s.props.name))&&o.shift();let t=o.reduce((e,t)=>{var r=Validation.get(t.key);return r&&(r=r.hasErrors(a[i.toString()],...t.key===ModelKeys.TYPE?[t.props]:Object.values(t.props)))&&((e=e||{})[t.key]=r),e},void 0);(t=t||Object.keys(a).filter(e=>!t||!t[e]).reduce((e,r)=>{let i;const o=getPropertyDecorators(ValidationKeys.REFLECT,a,r).decorators;var t=o.filter(e=>-1!==[ModelKeys.TYPE,ValidationKeys.TYPE].indexOf(e.key));if(t&&t.length){t=t.pop(),t=t.props.name?[t.props.name]:Array.isArray(t.props.customTypes)?t.props.customTypes:[t.props.customTypes];const s=Object.values(ReservedModels).map(e=>e.toLowerCase());t.forEach(e=>{if(-1===s.indexOf(e.toLowerCase()))switch(e){case"Array":case"Set":var t;o.length&&o.find(e=>e.key===ValidationKeys.LIST)&&(t="Array"===e?a[r].find(e=>e.hasErrors()):a[r].values().find(e=>e.hasErrors()))&&(i=stringFormat(DEFAULT_ERROR_MESSAGES.LIST_INSIDE,t.toString()));break;default:try{a[r]&&(i=a[r].hasErrors())}catch(e){console.warn(stringFormat("Model should be validatable but its not"))}}}),i&&((e=e||{})[r]=i)}return e},void 0))&&((e=e||{})[r.prop.toString()]=t)}return e},void 0);return r?new ModelErrorDefinition(r):void 0}let modelBuilderFunction,actingModelRegistry,serializer,hashingFunction;class Model{constructor(e){}hasErrors(...e){return validate(this,...e)}equals(e,...t){return isEqual(this,e,...t)}serialize(){return Model.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}toHash(){return Model.getHashingFunction()(this).toString()}static deserialize(e){return Model.getSerializer().deserialize(e)}static serialize(e){return Model.getSerializer().serialize(e)}static hash(e){return Model.getHashingFunction()(e)}static fromObject(e,t){return constructFromObject(e,t)}static fromModel(e,t){return constructFromModel(e,t)}static setBuilder(e){modelBuilderFunction=e}static getBuilder(){return modelBuilderFunction}static getRegistry(){return actingModelRegistry=actingModelRegistry||new ModelRegistryManager}static setRegistry(e){actingModelRegistry=e}static register(e,t){return Model.getRegistry().register(e,t)}static get(e){return Model.getRegistry().get(e)}static build(e={},t){return Model.getRegistry().build(e,t)}static setSerializer(e){serializer=e}static getSerializer(){return serializer=serializer||new JSONSerializer}static setHashingFunction(e){hashingFunction=e}static getHashingFunction(){return hashingFunction=hashingFunction||hashObj}}export{validate,Model};
import { DEFAULT_ERROR_MESSAGES, ValidationKeys, } from "../validation/Validators/constants";
import { JSONSerializer } from "../utils/serialization";
import { ModelErrorDefinition } from "./ModelErrorDefinition";
import { ReservedModels } from "./constants";
import { ModelKeys } from "../utils/constants";
import { constructFromModel, constructFromObject, } from "./construction";
import { ModelRegistryManager } from "./Registry";
import { Validation } from "../validation/Validation";
import { getPropertyDecorators } from "../reflection/utils";
import { hashObj } from "../utils/hashing";
import { sf } from "../utils/strings";
import { isEqual } from "../utils/equality";
/**
* @summary Analyses the decorations of the properties and validates the obj according to them
*
* @typedef T extends Model
* @prop {T} obj Model object to validate
* @prop {string[]} [propsToIgnore] object properties to ignore in the validation
*
* @function validate
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export function validate(obj, ...propsToIgnore) {
const decoratedProperties = [];
for (const prop in obj)
if (obj.hasOwnProperty(prop) && propsToIgnore.indexOf(prop) === -1)
decoratedProperties.push(getPropertyDecorators(ValidationKeys.REFLECT, obj, prop));
const result = decoratedProperties.reduce((accum, decoratedProperty) => {
const { prop, decorators } = decoratedProperty;
if (!decorators || !decorators.length)
return accum;
// @ts-expect-error due to type casting in decorators
const defaultTypeDecorator = decorators[0];
// tries to find any type decorators or other decorators that already enforce type (the ones with the allowed types property defined). if so, skip the default type verification
if (decorators.find((d) => {
if (d.key === ValidationKeys.TYPE)
return true;
if (d.props.types?.find((t) => t === defaultTypeDecorator.props.name))
return true;
return false;
}))
decorators.shift(); // remove the design:type decorator, since the type will already be checked
let errs = decorators.reduce((acc, decorator) => {
const validator = Validation.get(decorator.key);
if (!validator) {
return acc;
}
const err = validator.hasErrors(obj[prop.toString()], ...(decorator.key === ModelKeys.TYPE
? [decorator.props]
: Object.values(decorator.props)));
if (err) {
acc = acc || {};
acc[decorator.key] = err;
}
return acc;
}, undefined);
errs =
errs ||
Object.keys(obj)
.filter((k) => !errs || !errs[k])
.reduce((acc, prop) => {
let err;
// if a nested Model
const allDecorators = getPropertyDecorators(ValidationKeys.REFLECT, obj, prop).decorators;
const decorators = allDecorators.filter((d) => [ModelKeys.TYPE, ValidationKeys.TYPE].indexOf(d.key) !== -1);
if (!decorators || !decorators.length)
return acc;
const dec = decorators.pop();
const clazz = dec.props.name
? [dec.props.name]
: Array.isArray(dec.props.customTypes)
? dec.props.customTypes
: [dec.props.customTypes];
const reserved = Object.values(ReservedModels).map((v) => v.toLowerCase());
clazz.forEach((c) => {
if (reserved.indexOf(c.toLowerCase()) === -1) {
switch (c) {
case "Array":
case "Set":
if (allDecorators.length) {
const listDec = allDecorators.find((d) => d.key === ValidationKeys.LIST);
if (listDec) {
const e = c === "Array"
? obj[prop].find((c) => c.hasErrors())
: obj[prop]
.values()
.find((c) => c.hasErrors());
if (e)
err = sf(DEFAULT_ERROR_MESSAGES.LIST_INSIDE, e.toString());
}
}
break;
default:
try {
if (obj[prop])
err = obj[prop].hasErrors();
}
catch (e) {
console.warn(sf("Model should be validatable but its not"));
}
}
}
});
if (err) {
acc = acc || {};
acc[prop] = err;
}
return acc;
}, undefined);
if (errs) {
accum = accum || {};
accum[decoratedProperty.prop.toString()] = errs;
}
return accum;
}, undefined);
return result ? new ModelErrorDefinition(result) : undefined;
}
let modelBuilderFunction;
let actingModelRegistry;
let serializer;
let hashingFunction;
/**
* @summary Abstract class representing a Validatable Model object
* @description Meant to be used as a base class for all Model classes
*
* Model objects must:
* - Have all their properties defined as optional;
* - Have all their properties initialized eg:
*
* <pre>
* class ClassName {
* propertyName?: PropertyType = undefined;
* }
* </pre>
*
* @param {Model | {}} model base object from which to populate properties from
*
* @class Model
* @abstract
* @implements Validatable
* @implements Serializable
*
* @category Model
*/
export class Model {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
constructor(model) { }
/**
* @summary Validates the object according to its decorated properties
*
* @param {any[]} [exceptions] properties in the object to be ignored for he validation. Marked as 'any' to allow for extension but expects strings
*/
hasErrors(...exceptions) {
return validate(this, ...exceptions);
}
/**
* @summary Compare object equality recursively
* @param {any} obj object to compare to
* @param {string} [exceptions] property names to be excluded from the comparison
*/
equals(obj, ...exceptions) {
return isEqual(this, obj, ...exceptions);
}
/**
* @summary Returns the serialized model according to the currently defined {@link Serializer}
*/
serialize() {
return Model.serialize(this);
}
/**
* @summary Override the implementation for js's 'toString()' which sucks...
* @override
*/
toString() {
return this.constructor.name + ": " + JSON.stringify(this, undefined, 2);
}
/**
* @summary Defines a default implementation for object hash. Relies on a very basic implementation based on Java's string hash;
*/
toHash() {
return Model.getHashingFunction()(this).toString();
}
/**
* @summary Deserializes a Model
* @param {string} str
*
* @throws {Error} If it fails to parse the string, or if it fails to build the model
*/
static deserialize(str) {
return Model.getSerializer().deserialize(str);
}
/**
* @summary Serializes a Model
* @param {Model} model
*/
static serialize(model) {
return Model.getSerializer().serialize(model);
}
static hash(obj) {
return Model.getHashingFunction()(obj);
}
/**
* @summary Wrapper around {@link constructFromObject}
* @param {T} self
* @param {T | Record<string, any>} obj
*/
static fromObject(self, obj) {
return constructFromObject(self, obj);
}
/**
* @summary Wrapper around {@link constructFromModel}
* @param {T} self
* @param {T | Record<string, any>} obj
*/
static fromModel(self, obj) {
return constructFromModel(self, obj);
}
/**
* @summary Sets the Global {@link ModelBuilderFunction}
* @param {ModelBuilderFunction} [builder]
*/
static setBuilder(builder) {
modelBuilderFunction = builder;
}
/**
* @summary Retrieves the current global {@link ModelBuilderFunction}
*/
static getBuilder() {
return modelBuilderFunction;
}
/**
* Returns the current {@link ModelRegistryManager}
*
* @return ModelRegistry, defaults to {@link ModelRegistryManager}
*/
static getRegistry() {
if (!actingModelRegistry)
actingModelRegistry = new ModelRegistryManager();
return actingModelRegistry;
}
/**
* Returns the current actingModelRegistry
*
* @param {BuilderRegistry} modelRegistry the new implementation of Registry
*/
static setRegistry(modelRegistry) {
actingModelRegistry = modelRegistry;
}
/**
* @summary register new Models
* @param {any} constructor
* @param {string} [name] when not defined, the name of the constructor will be used
*
* @see ModelRegistry
*/
static register(constructor, name) {
return Model.getRegistry().register(constructor, name);
}
/**
* @summary Gets a registered Model {@link ModelConstructor}
* @param {string} name
*
* @see ModelRegistry
*/
static get(name) {
return Model.getRegistry().get(name);
}
/**
* @param {Record<string, any>} obj
* @param {string} [clazz] when provided, it will attempt to find the matching constructor
*
* @throws Error If clazz is not found, or obj is not a {@link Model} meaning it has no {@link ModelKeys.ANCHOR} property
*
* @see ModelRegistry
*/
static build(obj = {}, clazz) {
return Model.getRegistry().build(obj, clazz);
}
/**
* @summary Sets the {@link Serializer}
*
* @param {Serializer} ser
*/
static setSerializer(ser) {
serializer = ser;
}
/**
* @summary Retrieves the current defined {@link Serializer}
*
*/
static getSerializer() {
if (!serializer)
serializer = new JSONSerializer();
return serializer;
}
/**
* @summary Sets the {@link HashingFunction}
*
* @param {HashingFunction} hasher
*/
static setHashingFunction(hasher) {
hashingFunction = hasher;
}
/**
* @summary Retrieves the current defined {@link HashingFunction}
*
*/
static getHashingFunction() {
if (!hashingFunction)
hashingFunction = hashObj;
return hashingFunction;
}
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tb2RlbC9Nb2RlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsc0JBQXNCLEVBQ3RCLGNBQWMsR0FDZixNQUFNLG9DQUFvQyxDQUFDO0FBTzVDLE9BQU8sRUFBRSxjQUFjLEVBQWMsTUFBTSx3QkFBd0IsQ0FBQztBQUVwRSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUU5RCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQzdDLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUMvQyxPQUFPLEVBQ0wsa0JBQWtCLEVBQ2xCLG1CQUFtQixHQUVwQixNQUFNLGdCQUFnQixDQUFDO0FBQ3hCLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUNsRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDdEQsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDNUQsT0FBTyxFQUFtQixPQUFPLEV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NpbmNlIHRoZSB0eXBlIHdpbGwgYWxyZWFkeSBiZSBjaGVja2VkXG5cbiAgICAgIGxldCBlcnJzOiB7IFtpbmRleGVyOiBzdHJpbmddOiBFcnJvcnMgfSB8IHVuZGVmaW5lZCA9IGRlY29yYXRvcnMucmVkdWNlKFxuICAgICAgICAoXG4gICAgICAgICAgYWNjOiB1bmRlZmluZWQgfCB7IFtpbmRleGVyOiBzdHJpbmddOiBFcnJvcnMgfSxcbiAgICAgICAgICBkZWNvcmF0b3I6IHsga2V5OiBzdHJpbmc7IHByb3BzOiBvYmplY3QgfSxcbiAgICAgICAgKSA9PiB7XG4gICAgICAgICAgY29uc3QgdmFsaWRhdG9yID0gVmFsaWRhdGlvbi5nZXQoZGVjb3JhdG9yLmtleSk7XG4gICAgICAgICAgaWYgKCF2YWxpZGF0b3IpIHtcbiAgICAgICAgICAgIHJldHVybiBhY2M7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY29uc3QgZXJyOiBFcnJvcnMgPSB2YWxpZGF0b3IuaGFzRXJyb3JzKFxuICAgICAgICAgICAgb2JqW3Byb3AudG9TdHJpbmcoKV0sXG4gICAgICAgICAgICAuLi4oZGVjb3JhdG9yLmtleSA9PT0gTW9kZWxLZXlzLlRZUEVcbiAgICAgICAgICAgICAgPyBbZGVjb3JhdG9yLnByb3BzXVxuICAgICAgICAgICAgICA6IE9iamVjdC52YWx1ZXMoZGVjb3JhdG9yLnByb3BzKSksXG4gICAgICAgICAgKTtcblxuICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgIGFjYyA9IGFjYyB8fCB7fTtcbiAgICAgICAgICAgIGFjY1tkZWNvcmF0b3Iua2V5XSA9IGVycjtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICByZXR1cm4gYWNjO1xuICAgICAgICB9LFxuICAgICAgICB1bmRlZmluZWQsXG4gICAgICApO1xuXG4gICAgICBlcnJzID1cbiAgICAgICAgZXJycyB8fFxuICAgICAgICBPYmplY3Qua2V5cyhvYmopXG4gICAgICAgICAgLmZpbHRlcigoaykgPT4gIWVycnMgfHwgIWVycnNba10pXG4gICAgICAgICAgLnJlZHVjZSgoYWNjOiBSZWNvcmQ8c3RyaW5nLCBhbnk+IHwgdW5kZWZpbmVkLCBwcm9wKSA9PiB7XG4gICAgICAgICAgICBsZXQgZXJyOiBFcnJvcnM7XG4gICAgICAgICAgICAvLyBpZiBhIG5lc3RlZCBNb2RlbFxuICAgICAgICAgICAgY29uc3QgYWxsRGVjb3JhdG9ycyA9IGdldFByb3BlcnR5RGVjb3JhdG9ycyhcbiAgICAgICAgICAgICAgVmFsaWRhdGlvbktleXMuUkVGTEVDVCxcbiAgICAgICAgICAgICAgb2JqLFxuICAgICAgICAgICAgICBwcm9wLFxuICAgICAgICAgICAgKS5kZWNvcmF0b3JzO1xuICAgICAgICAgICAgY29uc3QgZGVjb3JhdG9ycyA9IGFsbERlY29yYXRvcnMuZmlsdGVyKFxuICAgICAgICAgICAgICAoZCkgPT5cbiAgICAgICAgICAgICAgICBbTW9kZWxLZXlzLlRZUEUsIFZhbGlkYXRpb25LZXlzLlRZUEVdLmluZGV4T2YoZC5rZXkpICE9PSAtMSxcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgICBpZiAoIWRlY29yYXRvcnMgfHwgIWRlY29yYXRvcnMubGVuZ3RoKSByZXR1cm4gYWNjO1xuICAgICAgICAgICAgY29uc3QgZGVjID0gZGVjb3JhdG9ycy5wb3AoKSBhcyBEZWNvcmF0b3JNZXRhZGF0YTtcbiAgICAgICAgICAgIGNvbnN0IGNsYXp6ID0gZGVjLnByb3BzLm5hbWVcbiAgICAgICAgICAgICAgPyBbZGVjLnByb3BzLm5hbWVdXG4gICAgICAgICAgICAgIDogQXJyYXkuaXNBcnJheShkZWMucHJvcHMuY3VzdG9tVHlwZXMpXG4gICAgICAgICAgICAgICAgPyBkZWMucHJvcHMuY3VzdG9tVHlwZXNcbiAgICAgICAgICAgICAgICA6IFtkZWMucHJvcHMuY3VzdG9tVHlwZXNdO1xuICAgICAgICAgICAgY29uc3QgcmVzZXJ2ZWQgPSBPYmplY3QudmFsdWVzKFJlc2VydmVkTW9kZWxzKS5tYXAoKHYpID0+XG4gICAgICAgICAgICAgIHYudG9Mb3dlckNhc2UoKSxcbiAgICAgICAgICAgICkgYXMgc3RyaW5nW107XG5cbiAgICAgICAgICAgIGNsYXp6LmZvckVhY2goKGM6IHN0cmluZykgPT4ge1xuICAgICAgICAgICAgICBpZiAocmVzZXJ2ZWQuaW5kZXhPZihjLnRvTG93ZXJDYXNlKCkpID09PSAtMSkge1xuICAgICAgICAgICAgICAgIHN3aXRjaCAoYykge1xuICAgICAgICAgICAgICAgICAgY2FzZSBcIkFycmF5XCI6XG4gICAgICAgICAgICAgICAgICBjYXNlIFwiU2V0XCI6XG4gICAgICAgICAgICAgICAgICAgIGlmIChhbGxEZWNvcmF0b3JzLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGxpc3REZWMgPSBhbGxEZWNvcmF0b3JzLmZpbmQoXG4gICAgICAgICAgICAgICAgICAgICAgICAoZCkgPT4gZC5rZXkgPT09IFZhbGlkYXRpb25LZXlzLkxJU1QsXG4gICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgICAgICBpZiAobGlzdERlYykge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZSA9XG4gICAgICAgICAgICAgICAgICAgICAgICAgIGMgPT09IFwiQXJyYXlcIlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gKG9iaiBhcyBSZWNvcmQ8c3RyaW5nLCBhbnk+KVtwcm9wXS5maW5kKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYzogVmFsaWRhdGFibGUpID0+IGMuaGFzRXJyb3JzKCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiAob2JqIGFzIFJlY29yZDxzdHJpbmcsIGFueT4pW3Byb3BdXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC52YWx1ZXMoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZmluZCgoYzogVmFsaWRhdGFibGUpID0+IGMuaGFzRXJyb3JzKCkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGUpXG4gICAgICAgICAgICAgICAgICAgICAgICAgIGVyciA9IHNmKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIERFRkFVTFRfRVJST1JfTUVTU0FHRVMuTElTVF9JTlNJREUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS50b1N0cmluZygpLFxuICAgICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgICAgaWYgKChvYmogYXMgUmVjb3JkPHN0cmluZywgYW55PilbcHJvcF0pXG4gICAgICAgICAgICAgICAgICAgICAgICBlcnIgPSAob2JqIGFzIFJlY29yZDxzdHJpbmcsIGFueT4pW3Byb3BdLmhhc0Vycm9ycygpO1xuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlOiBhbnkpIHtcbiAgICAgICAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oXG4gICAgICAgICAgICAgICAgICAgICAgICBzZihcIk1vZGVsIHNob3VsZCBiZSB2YWxpZGF0YWJsZSBidXQgaXRzIG5vdFwiKSxcbiAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICBhY2MgPSBhY2MgfHwge307XG4gICA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gIHByaXZhdGUgc3RhdGljIGdldEhhc2hpbmdGdW5jdGlvbigpIHtcbiAgICBpZiAoIWhhc2hpbmdGdW5jdGlvbikgaGFzaGluZ0Z1bmN0aW9uID0gaGFzaE9iajtcbiAgICByZXR1cm4gaGFzaGluZ0Z1bmN0aW9uO1xuICB9XG59XG4iXX0=

@@ -1,2 +0,2 @@

import { Errors, ModelErrors } from "../validation";
import { Errors, ModelErrors } from "../validation/types";
/**

@@ -3,0 +3,0 @@ * @summary Helper Class to hold the error results

@@ -1,3 +0,55 @@

class ModelErrorDefinition{constructor(e){for(const r in e)e.hasOwnProperty(r)&&e[r]&&Object.defineProperty(this,r,{enumerable:!0,configurable:!1,value:e[r],writable:!1})}toString(){const o=this;return Object.keys(o).filter(e=>o.hasOwnProperty(e)&&"function"!=typeof o[e]).reduce((e,t)=>{var r=Object.keys(o[t]).reduce((e,r)=>(e?e+=`
`+o[t][r]:e=o[t][r],e),void 0);return r&&(r=t+" - "+r,e?e+=`
`+r:e=r),e},"")}}export{ModelErrorDefinition};
/**
* @summary Helper Class to hold the error results
* @description holds error results in an 'indexable' manner
* while still providing the same result on toString
*
* @param {ModelErrors} errors
*
* @class ModelErrorDefinition
*
* @category Model
*/
export class ModelErrorDefinition {
constructor(errors) {
for (const prop in errors) {
if (errors.hasOwnProperty(prop) && errors[prop])
Object.defineProperty(this, prop, {
enumerable: true,
configurable: false,
value: errors[prop],
writable: false,
});
}
}
/**
* @summary Outputs the class to a nice readable string
*
* @override
*/
toString() {
const self = this;
return Object.keys(self)
.filter((k) => self.hasOwnProperty(k) && typeof self[k] !== "function")
.reduce((accum, prop) => {
let propError = Object.keys(self[prop]).reduce((propAccum, key) => {
if (!propAccum)
// @ts-expect-error because i said so
propAccum = self[prop][key];
// @ts-expect-error because i said so
else
propAccum += `\n${self[prop][key]}`;
return propAccum;
}, undefined);
if (propError) {
propError = `${prop} - ${propError}`;
if (!accum)
accum = propError;
else
accum += `\n${propError}`;
}
return accum;
}, "");
}
}
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ZXQgcHJvcEVycm9yOiBzdHJpbmcgfCB1bmRlZmluZWQgPSBPYmplY3Qua2V5cyhzZWxmW3Byb3BdKS5yZWR1Y2UoXG4gICAgICAgICAgKHByb3BBY2N1bTogdW5kZWZpbmVkIHwgc3RyaW5nLCBrZXkpID0+IHtcbiAgICAgICAgICAgIGlmICghcHJvcEFjY3VtKVxuICAgICAgICAgICAgICAvLyBAdHMtZXhwZWN0LWVycm9yIGJlY2F1c2UgaSBzYWlkIHNvXG4gICAgICAgICAgICAgIHByb3BBY2N1bSA9IHNlbGZbcHJvcF1ba2V5XTtcbiAgICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3IgYmVjYXVzZSBpIHNhaWQgc29cbiAgICAgICAgICAgIGVsc2UgcHJvcEFjY3VtICs9IGBcXG4ke3NlbGZbcHJvcF1ba2V5XX1gO1xuICAgICAgICAgICAgcmV0dXJuIHByb3BBY2N1bTtcbiAgICAgICAgICB9LFxuICAgICAgICAgIHVuZGVmaW5lZCxcbiAgICAgICAgKTtcblxuICAgICAgICBpZiAocHJvcEVycm9yKSB7XG4gICAgICAgICAgcHJvcEVycm9yID0gYCR7cHJvcH0gLSAke3Byb3BFcnJvcn1gO1xuICAgICAgICAgIGlmICghYWNjdW0pIGFjY3VtID0gcHJvcEVycm9yO1xuICAgICAgICAgIGVsc2UgYWNjdW0gKz0gYFxcbiR7cHJvcEVycm9yfWA7XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gYWNjdW07XG4gICAgICB9LCBcIlwiKTtcbiAgfVxufVxuIl19
import { Model } from "./Model";
import { BuilderRegistry } from "../utils";
import { BuilderRegistry } from "../utils/registry";
import { Constructor, ModelConstructor } from "./types";

@@ -4,0 +4,0 @@ /**

@@ -1,1 +0,76 @@

import{Model}from"./Model";import{isModel,stringFormat}from"../utils";import{ModelKeys}from"../utils/constants";class ModelRegistryManager{constructor(e=ModelKeys.ANCHOR,t=isModel){this.cache={},this.testFunction=t,this.anchorKey=e}register(e,t){if("function"!=typeof e)throw new 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){}}build(e={},t){if(!t&&!this.testFunction(e))throw new Error("Provided obj is not a Model object");t=t||e[this.anchorKey].class;if(t in this.cache)return new this.cache[t](e);throw new Error(stringFormat("Provided class {0} is not a registered Model object",t))}}function bulkModelRegister(...e){e.forEach(e=>{var t=e.constructor||e;Model.register(t,e.name)})}export{ModelRegistryManager,bulkModelRegister};
import { Model } from "./Model";
import { ModelKeys } from "../utils/constants";
import { isModel } from "../reflection/utils";
import { sf } from "../utils/strings";
/**
* @summary Util class to enable serialization and correct rebuilding
*
* @param {string} anchorKey defaults to {@link ModelKeys.ANCHOR}. The property name where the registered class name is stored;
* @param {function(Record<string, any>): boolean} [testFunction] method to test if the provided object is a Model Object. defaults to {@link isModel}
*
* @class ModelRegistryManager
* @implements ModelRegistry
*
* @category Model
*/
export class ModelRegistryManager {
constructor(anchorKey = ModelKeys.ANCHOR, testFunction = isModel) {
this.cache = {};
this.testFunction = testFunction;
this.anchorKey = anchorKey;
}
/**
* @summary register new Models
* @param {any} constructor
* @param {string} [name] when not defined, the name of the constructor will be used
*/
register(constructor, name) {
if (typeof constructor !== "function")
throw new Error(`Model registering failed. Missing Class name or constructor`);
name = name || constructor.name;
this.cache[name] = constructor;
}
/**
* @summary Gets a registered Model {@link ModelConstructor}
* @param {string} name
*/
get(name) {
try {
return this.cache[name];
}
catch (e) {
return undefined;
}
}
/**
* @param {Record<string, any>} obj
* @param {string} [clazz] when provided, it will attempt to find the matching constructor
*
* @throws Error If clazz is not found, or obj is not a {@link Model} meaning it has no {@link ModelKeys.ANCHOR} property
*/
build(obj = {}, clazz) {
if (!clazz && !this.testFunction(obj))
throw new Error(`Provided obj is not a Model object`);
const name = clazz || obj[this.anchorKey].class;
if (!(name in this.cache))
throw new Error(sf(`Provided class {0} is not a registered Model object`, name));
return new this.cache[name](obj);
}
}
/**
* @summary Bulk Registers Models
* @description Useful when using bundlers that might not evaluate all of the code at once
*
* @param {Array<Constructor<T>> | Array<{name: string, constructor: Constructor<T>}>} [models]
*
* @memberOf module:decorator-validation.Model
* @category Model
*/
export function bulkModelRegister(...models) {
models.forEach((m) => {
const constructor = (m.constructor ? m.constructor : m);
Model.register(constructor, m.name);
});
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tb2RlbC9SZWdpc3RyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sU0FBUyxDQUFDO0FBR2hDLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUMvQyxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDOUMsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBWXRDOzs7Ozs7Ozs7O0dBVUc7QUFDSCxNQUFNLE9BQU8sb0JBQW9CO0lBSy9CLFlBQ0UsWUFBb0IsU0FBUyxDQUFDLE1BQU0sRUFDcEMsZUFBc0QsT0FBTztRQU52RCxVQUFLLEdBQXdDLEVBQUUsQ0FBQztRQVF0RCxJQUFJLENBQUMsWUFBWSxHQUFHLFlBQVksQ0FBQztRQUNqQyxJQUFJLENBQUMsU0FBUyxHQUFHLFNBQVMsQ0FBQztJQUM3QixDQUFDO0lBRUQ7Ozs7T0FJRztJQUNILFFBQVEsQ0FBQyxXQUFnQyxFQUFFLElBQWE7UUFDdEQsSUFBSSxPQUFPLFdBQVcsS0FBSyxVQUFVO1lBQ25DLE1BQU0sSUFBSSxLQUFLLENBQ2IsNkRBQTZELENBQzlELENBQUM7UUFDSixJQUFJLEdBQUcsSUFBSSxJQUFJLFdBQVcsQ0FBQyxJQUFJLENBQUM7UUFDaEMsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJL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heTxDb25zdHJ1Y3RvcjxUPj4gfCBBcnJheTx7bmFtZTogc3RyaW5nLCBjb25zdHJ1Y3RvcjogQ29uc3RydWN0b3I8VD59Pn0gW21vZGVsc11cbiAqXG4gKiBAbWVtYmVyT2YgbW9kdWxlOmRlY29yYXRvci12YWxpZGF0aW9uLk1vZGVsXG4gKiBAY2F0ZWdvcnkgTW9kZWxcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGJ1bGtNb2RlbFJlZ2lzdGVyPFQgZXh0ZW5kcyBNb2RlbD4oXG4gIC4uLm1vZGVsczogKENvbnN0cnVjdG9yPFQ+IHwgeyBuYW1lOiBzdHJpbmc7IGNvbnN0cnVjdG9yOiBDb25zdHJ1Y3RvcjxUPiB9KVtdXG4pIHtcbiAgbW9kZWxzLmZvckVhY2goXG4gICAgKG06IENvbnN0cnVjdG9yPFQ+IHwgeyBuYW1lOiBzdHJpbmc7IGNvbnN0cnVjdG9yOiBDb25zdHJ1Y3RvcjxUPiB9KSA9PiB7XG4gICAgICBjb25zdCBjb25zdHJ1Y3RvcjogQ29uc3RydWN0b3I8VD4gPSAoXG4gICAgICAgIG0uY29uc3RydWN0b3IgPyBtLmNvbnN0cnVjdG9yIDogbVxuICAgICAgKSBhcyBDb25zdHJ1Y3RvcjxUPjtcbiAgICAgIE1vZGVsLnJlZ2lzdGVyKGNvbnN0cnVjdG9yLCAobSBhcyBDb25zdHJ1Y3RvcjxUPikubmFtZSk7XG4gICAgfSxcbiAgKTtcbn1cbiJdfQ==

@@ -1,1 +0,25 @@

var ModelKeys;!function(e){e.REFLECT="model.definition.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__modelDefinition"}(ModelKeys=ModelKeys||{});export{ModelKeys};
/**
* @summary Defines the various Model keys used for reflection
*
* @property {string} REFLECT prefix to all other keys
* @property {string} TYPE type key
* @property {string} PARAMS method params key
* @property {string} RETURN method return key
* @property {string} MODEL model key
* @property {string} ANCHOR anchor key. will serve as a ghost property in the model
*
* @constant ModelKeys
* @memberOf module:decorator-validation.Model
* @category Model
*/
export var ModelKeys;
(function (ModelKeys) {
ModelKeys["REFLECT"] = "model.definition.";
ModelKeys["TYPE"] = "design:type";
ModelKeys["PARAMS"] = "design:paramtypes";
ModelKeys["RETURN"] = "design:returntype";
ModelKeys["MODEL"] = "model";
ModelKeys["ANCHOR"] = "__modelDefinition";
})(ModelKeys || (ModelKeys = {}));
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy91dGlscy9jb25zdGFudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7R0FhRztBQUNILE1BQU0sQ0FBTixJQUFZLFNBT1g7QUFQRCxXQUFZLFNBQVM7SUFDbkIsMENBQTZCLENBQUE7SUFDN0IsaUNBQW9CLENBQUE7SUFDcEIseUNBQTRCLENBQUE7SUFDNUIseUNBQTRCLENBQUE7SUFDNUIsNEJBQWUsQ0FBQTtJQUNmLHlDQUE0QixDQUFBO0FBQzlCLENBQUMsRUFQVyxTQUFTLEtBQVQsU0FBUyxRQU9wQiIsImZpbGUiOiJ1dGlscy9jb25zdGFudHMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBzdW1tYXJ5IERlZmluZXMgdGhlIHZhcmlvdXMgTW9kZWwga2V5cyB1c2VkIGZvciByZWZsZWN0aW9uXG4gKlxuICogQHByb3BlcnR5IHtzdHJpbmd9IFJFRkxFQ1QgcHJlZml4IHRvIGFsbCBvdGhlciBrZXlzXG4gKiBAcHJvcGVydHkge3N0cmluZ30gVFlQRSB0eXBlIGtleVxuICogQHByb3BlcnR5IHtzdHJpbmd9IFBBUkFNUyBtZXRob2QgcGFyYW1zIGtleVxuICogQHByb3BlcnR5IHtzdHJpbmd9IFJFVFVSTiBtZXRob2QgcmV0dXJuIGtleVxuICogQHByb3BlcnR5IHtzdHJpbmd9IE1PREVMIG1vZGVsIGtleVxuICogQHByb3BlcnR5IHtzdHJpbmd9IEFOQ0hPUiBhbmNob3Iga2V5LiB3aWxsIHNlcnZlIGFzIGEgZ2hvc3QgcHJvcGVydHkgaW4gdGhlIG1vZGVsXG4gKlxuICogQGNvbnN0YW50IE1vZGVsS2V5c1xuICogQG1lbWJlck9mIG1vZHVsZTpkZWNvcmF0b3ItdmFsaWRhdGlvbi5Nb2RlbFxuICogQGNhdGVnb3J5IE1vZGVsXG4gKi9cbmV4cG9ydCBlbnVtIE1vZGVsS2V5cyB7XG4gIFJFRkxFQ1QgPSBcIm1vZGVsLmRlZmluaXRpb24uXCIsXG4gIFRZUEUgPSBcImRlc2lnbjp0eXBlXCIsXG4gIFBBUkFNUyA9IFwiZGVzaWduOnBhcmFtdHlwZXNcIixcbiAgUkVUVVJOID0gXCJkZXNpZ246cmV0dXJudHlwZVwiLFxuICBNT0RFTCA9IFwibW9kZWxcIixcbiAgQU5DSE9SID0gXCJfX21vZGVsRGVmaW5pdGlvblwiLFxufVxuIl19

@@ -1,4 +0,8 @@

export * from "./general";
export * from "./constants";
export * from "./dates";
export * from "./equality";
export * from "./hashing";
export * from "./serialization";
export * from "./registry";
export * from "./serialization";
export * from "./constants";
export * from "./strings";

@@ -1,1 +0,10 @@

export*from"./general";export*from"./registry";export*from"./serialization";export*from"./constants";
export * from "./constants";
export * from "./dates";
export * from "./equality";
export * from "./hashing";
export * from "./serialization";
export * from "./registry";
export * from "./serialization";
export * from "./strings";
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy91dGlscy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLFNBQVMsQ0FBQztBQUN4QixjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLFdBQVcsQ0FBQztBQUMxQixjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsWUFBWSxDQUFDO0FBQzNCLGNBQWMsaUJBQWlCLENBQUM7QUFDaEMsY0FBYyxXQUFXLENBQUMiLCJmaWxlIjoidXRpbHMvaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tIFwiLi9jb25zdGFudHNcIjtcbmV4cG9ydCAqIGZyb20gXCIuL2RhdGVzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9lcXVhbGl0eVwiO1xuZXhwb3J0ICogZnJvbSBcIi4vaGFzaGluZ1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vc2VyaWFsaXphdGlvblwiO1xuZXhwb3J0ICogZnJvbSBcIi4vcmVnaXN0cnlcIjtcbmV4cG9ydCAqIGZyb20gXCIuL3NlcmlhbGl6YXRpb25cIjtcbmV4cG9ydCAqIGZyb20gXCIuL3N0cmluZ3NcIjtcbiJdfQ==

@@ -1,1 +0,53 @@

import{Model}from"../model/Model";import{ModelKeys}from"./constants";class JSONSerializer{preSerialize(e){var r=Object.assign({},e);return r[ModelKeys.ANCHOR]=e[ModelKeys.ANCHOR],r}deserialize(e){e=JSON.parse(e);return Model.build(e)}serialize(e){return JSON.stringify(this.preSerialize(e))}}export{JSONSerializer};
import { Model } from "../model/Model";
import { ModelKeys } from "./constants";
/**
* @summary Concrete implementation of a {@link Serializer} in JSON format
* @description JS's native JSON.stringify (used here) is not deterministic
* and therefore should not be used for hashing purposes
*
* To keep dependencies low, we will not implement this, but we recommend
* implementing a similar {@link JSONSerializer} using 'deterministic-json' libraries
*
* @class JSONSerializer
* @implements Serializer
*
* @category Serialization
*/
export class JSONSerializer {
/**
* @summary prepares the model for serialization
* @description returns a shallow copy of the object, containing an enumerable {@link ModelKeys#ANCHOR} property
* so the object can be recognized upon deserialization
*
* @param {T} model
* @protected
*/
preSerialize(model) {
// TODO: nested preserialization (so increase performance when deserializing)
const toSerialize = Object.assign({}, model);
toSerialize[ModelKeys.ANCHOR] = model[ModelKeys.ANCHOR];
return toSerialize;
}
/**
* @summary Rebuilds a model from a serialization
* @param {string} str
*
* @throws {Error} If it fails to parse the string, or to build the model
*/
deserialize(str) {
const deserialization = JSON.parse(str);
const model = Model.build(deserialization);
return model;
}
/**
* @summary Serializes a model
* @param {T} model
*
* @throws {Error} if fails to serialize
*/
serialize(model) {
return JSON.stringify(this.preSerialize(model));
}
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy91dGlscy9zZXJpYWxpemF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUN2QyxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBOEJ4Qzs7Ozs7Ozs7Ozs7O0dBWUc7QUFDSCxNQUFNLE9BQU8sY0FBYztJQUN6Qjs7Ozs7OztPQU9HO0lBQ08sWUFBWSxDQUFDLEtBQVE7UUFDN0IsNkVBQTZFO1FBQzdFLE1BQU0sV0FBVyxHQUFHLE1BQU0sQ0FBQyxNQUFNLENBQUMsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBQzVDLFdBQW1DLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxHQUNwRCxLQUNELENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQ3BCLE9BQU8sV0FBVyxDQUFDO0lBQ3JCLENBQUM7SUFFRDs7Ozs7T0FLRztJQUNILFdBQVcsQ0FBQyxHQUFXO1FBQ3JCLE1BQU0sZUFBZSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDeEMsTUFBTSxLQUFLLEdBQU0sS0FBSyxDQUFDLEtBQUssQ0FBQyxlQUFlLENBQWlCLENBQUM7UUFDOUQsT0FBTyxLQUFLLENBQUM7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RyaW5naWZ5KHRoaXMucHJlU2VyaWFsaXplKG1vZGVsKSk7XG4gIH1cbn1cbiJdfQ==
import "reflect-metadata";
import { Validator } from "./Validators";
import { Constructor, ModelConstructor } from "../model";
import { Constructor, ModelConstructor } from "../model/types";
import { Validator } from "./Validators/Validator";
/**

@@ -20,9 +20,8 @@ * @summary Builds the key to store as Metadata under Reflections

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#REQUIRED}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link RequiredValidator}
*
* @function required
* @memberOf module:decorator-validation.Decorators.Validation
*
* @category Decorators
*/
export declare function required(message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function required(message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -34,3 +33,2 @@ * @summary Defines a minimum value for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link MinValidator}
*

@@ -41,3 +39,3 @@ * @function min

*/
export declare function min(value: number | Date | string, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function min(value: number | Date | string, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -49,3 +47,2 @@ * @summary Defines a maximum value for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link MaxValidator}
*

@@ -56,3 +53,3 @@ * @function max

*/
export declare function max(value: number | Date | string, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function max(value: number | Date | string, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -64,3 +61,2 @@ * @summary Defines a step value for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#STEP}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link StepValidator}
*

@@ -71,3 +67,3 @@ * @function step

*/
export declare function step(value: number, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function step(value: number, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -79,3 +75,2 @@ * @summary Defines a minimum length for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN_LENGTH}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link MinLengthValidator}
*

@@ -86,3 +81,3 @@ * @function minlength

*/
export declare function minlength(value: number, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function minlength(value: number, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -94,3 +89,2 @@ * @summary Defines a maximum length for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX_LENGTH}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link MaxLengthValidator}
*

@@ -101,3 +95,3 @@ * @function maxlength

*/
export declare function maxlength(value: number, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function maxlength(value: number, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -109,3 +103,2 @@ * @summary Defines a RegExp pattern the property must respect

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PATTERN}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link PatternValidator}
*

@@ -116,3 +109,3 @@ * @function pattern

*/
export declare function pattern(value: RegExp | string, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function pattern(value: RegExp | string, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -123,3 +116,2 @@ * @summary Defines the property as an email

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#EMAIL}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link EmailValidator}
*

@@ -130,3 +122,3 @@ * @function email

*/
export declare function email(message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function email(message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -137,3 +129,2 @@ * @summary Defines the property as an URL

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#URL}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link URLValidator}
*

@@ -144,3 +135,3 @@ * @function url

*/
export declare function url(message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function url(message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -152,3 +143,2 @@ * @summary Enforces type verification

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#TYPE}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link TypeValidator}
*

@@ -159,67 +149,4 @@ * @function type

*/
export declare function type(types: string[] | string, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function type(types: string[] | string, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**
* @summary Binds a date format to a string
* @param {Date} [date]
* @param {string} [format]
* @memberOf module:decorator-validation.Utils.Format
* @category Utilities
*/
export declare function bindDateToString(date: Date | undefined, format: string): Date | undefined;
/**
* @summary Helper function to be used instead of instanceOf Date
* @param date
* @memberOf module:decorator-validation.Utils.Dates
* @category Validation
*/
export declare function isValidDate(date: any): boolean;
/**
* @summary Util function to pad numbers
* @param {number} num
*
* @return {string}
*
* @function twoDigitPad
* @memberOf module:decorator-validation.Utils.Format
* @category Format
*/
export declare function twoDigitPad(num: number): string;
/**
* @summary Date Format Handling
* @description Code from {@link https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date}
*
* <pre>
* Using similar formatting as Moment.js, Class DateTimeFormatter (Java), and Class SimpleDateFormat (Java),
* I implemented a comprehensive solution formatDate(date, patternStr) where the code is easy to read and modify.
* You can display date, time, AM/PM, etc.
*
* Date and Time Patterns
* yy = 2-digit year; yyyy = full year
* M = digit month; MM = 2-digit month; MMM = short month name; MMMM = full month name
* EEEE = full weekday name; EEE = short weekday name
* d = digit day; dd = 2-digit day
* h = hours am/pm; hh = 2-digit hours am/pm; H = hours; HH = 2-digit hours
* m = minutes; mm = 2-digit minutes; aaa = AM/PM
* s = seconds; ss = 2-digit seconds
* S = miliseconds
* </pre>
*
* @param {Date} date
* @param {string} [patternStr] defaults to 'yyyy/MM/dd'
* @return {string} the formatted date
*
* @function formatDate
* @memberOf module:decorator-validation.Utils.Dates
* @category Format
*/
export declare function formatDate(date: Date, patternStr?: string): string;
/**
* @summary Parses a date from a specified format
* @param {string} format
* @param {string | Date | number} [v]
* @memberOf module:decorator-validation.Utils.Dates
* @category Format
*/
export declare function parseDate(format: string, v?: string | Date | number): Date | undefined;
/**
* @summary Date Handler Decorator

@@ -239,3 +166,3 @@ * @description Validators to validate a decorated property must use key {@link ValidationKeys#DATE}

*/
export declare function date(format?: string, message?: string, validator?: Constructor<Validator>): (target: Record<string, any>, propertyKey: string) => any;
export declare function date(format?: string, message?: string): (target: Record<string, any>, propertyKey: string) => any;
/**

@@ -242,0 +169,0 @@ * @summary Password Handler Decorator

@@ -1,1 +0,320 @@

import"reflect-metadata";import{ValidationKeys,DEFAULT_ERROR_MESSAGES,PasswordPatterns,MONTH_NAMES,DAYS_OF_WEEK_NAMES}from"./Validators";import{DateValidator,EmailValidator,MaxLengthValidator,MaxValidator,MinLengthValidator,MinValidator,PasswordValidator,PatternValidator,RequiredValidator,StepValidator,TypeValidator,URLValidator}from"./Validators";import{dateFromFormat,stringFormat}from"../utils";import{ListValidator}from"./Validators/ListValidator";import{Validation}from"./Validation";function getValidationKey(e){return ValidationKeys.REFLECT+e}function required(t=DEFAULT_ERROR_MESSAGES.REQUIRED,i=RequiredValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.REQUIRED),{message:t},e,a),Validation.register({validator:i,validationKey:ValidationKeys.REQUIRED,save:!0})}}function min(t,i=DEFAULT_ERROR_MESSAGES.MIN,r=MinValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.MIN),{value:t,message:i,types:[Number.name,Date.name]},e,a),Validation.register({validator:r,validationKey:ValidationKeys.MIN,save:!0})}}function max(t,i=DEFAULT_ERROR_MESSAGES.MAX,r=MaxValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.MAX),{value:t,message:i,types:[Number.name,Date.name]},e,a),Validation.register({validator:r,validationKey:ValidationKeys.MAX,save:!0})}}function step(t,i=DEFAULT_ERROR_MESSAGES.STEP,r=StepValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.STEP),{value:t,message:i,types:[Number.name]},e,a),Validation.register({validator:r,validationKey:ValidationKeys.STEP,save:!0})}}function minlength(t,i=DEFAULT_ERROR_MESSAGES.MIN_LENGTH,r=MinLengthValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.MIN_LENGTH),{value:t,message:i,types:[String.name,Array.name,Set.name]},e,a),Validation.register({validator:r,validationKey:ValidationKeys.MIN_LENGTH,save:!0})}}function maxlength(t,i=DEFAULT_ERROR_MESSAGES.MAX_LENGTH,r=MaxLengthValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.MAX_LENGTH),{value:t,message:i,types:[String.name,Array.name,Set.name]},e,a),Validation.register({validator:r,validationKey:ValidationKeys.MAX_LENGTH,save:!0})}}function pattern(t,i=DEFAULT_ERROR_MESSAGES.PATTERN,r=PatternValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.PATTERN),{value:"string"==typeof t?t:t.toString(),message:i,types:[String.name]},e,a),Validation.register({validator:r,validationKey:ValidationKeys.PATTERN,save:!0})}}function email(t=DEFAULT_ERROR_MESSAGES.EMAIL,i=EmailValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.EMAIL),{message:t,types:[String.name]},e,a),Validation.register({validator:i,validationKey:ValidationKeys.EMAIL,save:!0})}}function url(t=DEFAULT_ERROR_MESSAGES.URL,i=URLValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.URL),{message:t,types:[String.name]},e,a),Validation.register({validator:i,validationKey:ValidationKeys.URL,save:!0})}}function type(t,i=DEFAULT_ERROR_MESSAGES.TYPE,r=TypeValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.TYPE),{customTypes:t,message:i},e,a),Validation.register({validator:r,validationKey:ValidationKeys.TYPE,save:!0})}}function bindDateToString(e,a){var t;if(e)return t=()=>formatDate(e,a),Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:t}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:t}),e}function isValidDate(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e)}function twoDigitPad(e){return e<10?"0"+e:e.toString()}function formatDate(e,a="yyyy/MM/dd"){var t=e.getDate(),i=e.getMonth(),r=e.getFullYear(),n=e.getHours(),o=e.getMinutes(),l=e.getSeconds(),d=e.getMilliseconds(),s=n%12,E=twoDigitPad(s),g=twoDigitPad(n),y=twoDigitPad(o),S=twoDigitPad(l),V=n<12?"AM":"PM",e=DAYS_OF_WEEK_NAMES[e.getDay()],m=e.substr(0,3),c=twoDigitPad(t),f=i+1,M=twoDigitPad(f),i=MONTH_NAMES[i],R=i.substr(0,3),r=r+"",u=r.substr(2,2);return a=-1<(a=a.replace("hh",E).replace("h",s.toString()).replace("HH",g).replace("H",n.toString()).replace("mm",y).replace("m",o.toString()).replace("ss",S).replace("s",l.toString()).replace("S",d.toString()).replace("dd",c).replace("d",t.toString()).replace("EEEE",e).replace("EEE",m).replace("yyyy",r).replace("yy",u).replace("aaa",V)).indexOf("MMM")?a.replace("MMMM",i).replace("MMM",R):a.replace("MM",M).replace("M",f.toString())}function parseDate(a,t){let e=void 0;if(t){if(t instanceof Date)try{e=dateFromFormat(formatDate(t,a),a)}catch(e){throw new Error(stringFormat("Could not convert date {0} to format: {1}",t.toString(),a))}else if("string"==typeof t)e=dateFromFormat(t,a);else if("number"==typeof t){var i=new Date(t);e=dateFromFormat(formatDate(i,a),a)}else{if(!isValidDate(t))throw new Error("Invalid value provided "+t);try{var r=new Date(t);e=dateFromFormat(formatDate(r,a),a)}catch(e){throw new Error(stringFormat("Could not convert date {0} to format: {1}",t,a))}}return bindDateToString(e,a)}}function date(r="dd/MM/yyyy",a=DEFAULT_ERROR_MESSAGES.DATE,n=DateValidator){return(e,t)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.DATE),{format:r,message:a,types:[Date.name]},e,t),Validation.register({validator:n,validationKey:ValidationKeys.DATE,save:!0});const i=new WeakMap;Object.defineProperty(e,t,{configurable:!1,set(e){var a=Object.getOwnPropertyDescriptor(this,t);a&&!a.configurable||Object.defineProperty(this,t,{enumerable:!0,configurable:!1,get:()=>i.get(this),set:e=>{var a;try{a=parseDate(r,e),i.set(this,a)}catch(e){console.error(stringFormat("Failed to parse date: {0}",e.message||e))}}}),this[t]=e},get(){console.log("here")}})}}function password(t=PasswordPatterns.CHAR8_ONE_OF_EACH,i=DEFAULT_ERROR_MESSAGES.PASSWORD,r=PasswordValidator){return(e,a)=>{Reflect.defineMetadata(getValidationKey(ValidationKeys.PASSWORD),{pattern:t,message:i,types:[String.name]},e,a),Validation.register({validator:r,validationKey:ValidationKeys.PASSWORD,save:!0})}}function list(t,i="Array",r=DEFAULT_ERROR_MESSAGES.LIST,n=ListValidator){return(e,a)=>{type(i)(e,a),Reflect.defineMetadata(getValidationKey(ValidationKeys.LIST),{class:t.name,type:i,message:r},e,a),Validation.register({validator:n,validationKey:ValidationKeys.LIST,save:!0})}}function set(t,i=DEFAULT_ERROR_MESSAGES.LIST,r){return(e,a)=>{list(t,"Set",i,r)(e,a)}}export{getValidationKey,required,min,max,step,minlength,maxlength,pattern,email,url,type,bindDateToString,isValidDate,twoDigitPad,formatDate,parseDate,date,password,list,set};
import "reflect-metadata";
import { ListValidator } from "./Validators/ListValidator";
import { Validation } from "./Validation";
import { metadata } from "../reflection/decorators";
import { DEFAULT_ERROR_MESSAGES, DEFAULT_PATTERNS, ValidationKeys, } from "./Validators/constants";
import { sf } from "../utils/strings";
import { PasswordValidator } from "./Validators/PasswordValidator";
import { parseDate } from "../utils";
/**
* @summary Builds the key to store as Metadata under Reflections
* @description concatenates {@link ValidationKeys#REFLECT} with the provided key
*
* @param {string} key
*
* @function getModelKey
* @memberOf module:decorator-validation.Utils
* @category Utilities
*/
export function getValidationKey(key) {
return ValidationKeys.REFLECT + key;
}
/**
* @summary Marks the property as required.
* @description Validators to validate a decorated property must use key {@link ValidationKeys#REQUIRED}
*
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#REQUIRED}
*
* @function required
*
* @category Decorators
*/
export function required(message = DEFAULT_ERROR_MESSAGES.REQUIRED) {
return metadata(getValidationKey(ValidationKeys.REQUIRED), {
message: message,
});
}
/**
* @summary Defines a minimum value for the property
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MIN}
*
* @param {number | Date} value
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN}
*
* @function min
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function min(value, message = DEFAULT_ERROR_MESSAGES.MIN) {
return metadata(getValidationKey(ValidationKeys.MIN), {
value: value,
message: message,
types: [Number.name, Date.name],
});
}
/**
* @summary Defines a maximum value for the property
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MAX}
*
* @param {number | Date} value
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX}
*
* @function max
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function max(value, message = DEFAULT_ERROR_MESSAGES.MAX) {
return metadata(getValidationKey(ValidationKeys.MAX), {
value: value,
message: message,
types: [Number.name, Date.name],
});
}
/**
* @summary Defines a step value for the property
* @description Validators to validate a decorated property must use key {@link ValidationKeys#STEP}
*
* @param {number} value
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#STEP}
*
* @function step
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function step(value, message = DEFAULT_ERROR_MESSAGES.STEP) {
return metadata(getValidationKey(ValidationKeys.STEP), {
value: value,
message: message,
types: [Number.name],
});
}
/**
* @summary Defines a minimum length for the property
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MIN_LENGTH}
*
* @param {string} value
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN_LENGTH}
*
* @function minlength
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function minlength(value, message = DEFAULT_ERROR_MESSAGES.MIN_LENGTH) {
return metadata(getValidationKey(ValidationKeys.MIN_LENGTH), {
value: value,
message: message,
types: [String.name, Array.name, Set.name],
});
}
/**
* @summary Defines a maximum length for the property
* @description Validators to validate a decorated property must use key {@link ValidationKeys#MAX_LENGTH}
*
* @param {string} value
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX_LENGTH}
*
* @function maxlength
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function maxlength(value, message = DEFAULT_ERROR_MESSAGES.MAX_LENGTH) {
return metadata(getValidationKey(ValidationKeys.MAX_LENGTH), {
value: value,
message: message,
types: [String.name, Array.name, Set.name],
});
}
/**
* @summary Defines a RegExp pattern the property must respect
* @description Validators to validate a decorated property must use key {@link ValidationKeys#PATTERN}
*
* @param {string} value
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PATTERN}
*
* @function pattern
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function pattern(value, message = DEFAULT_ERROR_MESSAGES.PATTERN) {
return metadata(getValidationKey(ValidationKeys.PATTERN), {
value: typeof value === "string" ? value : value.toString(),
message: message,
types: [String.name],
});
}
/**
* @summary Defines the property as an email
* @description Validators to validate a decorated property must use key {@link ValidationKeys#EMAIL}
*
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#EMAIL}
*
* @function email
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function email(message = DEFAULT_ERROR_MESSAGES.EMAIL) {
return metadata(getValidationKey(ValidationKeys.EMAIL), {
message: message,
types: [String.name],
});
}
/**
* @summary Defines the property as an URL
* @description Validators to validate a decorated property must use key {@link ValidationKeys#URL}
*
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#URL}
*
* @function url
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function url(message = DEFAULT_ERROR_MESSAGES.URL) {
return metadata(getValidationKey(ValidationKeys.URL), {
message: message,
types: [String.name],
});
}
/**
* @summary Enforces type verification
* @description Validators to validate a decorated property must use key {@link ValidationKeys#TYPE}
*
* @param {string[] | string} types accepted types
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#TYPE}
*
* @function type
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function type(types, message = DEFAULT_ERROR_MESSAGES.TYPE) {
return metadata(getValidationKey(ValidationKeys.TYPE), {
customTypes: types,
message: message,
});
}
/**
* @summary Date Handler Decorator
* @description Validators to validate a decorated property must use key {@link ValidationKeys#DATE}
*
* Will enforce serialization according to the selected format
*
* @param {string} format accepted format according to {@link formatDate}
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#DATE}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link DateValidator}
*
* @function date
*
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function date(format = "dd/MM/yyyy", message = DEFAULT_ERROR_MESSAGES.DATE) {
return (target, propertyKey) => {
Reflect.defineMetadata(getValidationKey(ValidationKeys.DATE), {
format: format,
message: message,
types: [Date.name],
}, target, propertyKey);
const values = new WeakMap();
Object.defineProperty(target, propertyKey, {
configurable: false,
set(newValue) {
const descriptor = Object.getOwnPropertyDescriptor(this, propertyKey);
if (!descriptor || descriptor.configurable)
Object.defineProperty(this, propertyKey, {
enumerable: true,
configurable: false,
get: () => values.get(this),
set: (newValue) => {
let val;
try {
val = parseDate(format, newValue);
values.set(this, val);
}
catch (e) {
console.error(sf("Failed to parse date: {0}", e.message || e));
}
},
});
this[propertyKey] = newValue;
},
get() {
console.log("here");
},
});
};
}
/**
* @summary Password Handler Decorator
* @description Validators to validate a decorated property must use key {@link ValidationKeys#PASSWORD}
*
* @param {RegExp} [pattern] defaults to {@link PasswordPatterns#CHAR8_ONE_OF_EACH}
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PASSWORD}
* @param {Constructor<Validator>} [validator] Defaults to {@link PasswordValidator}
*
* @function password
*
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function password(pattern = DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH, message = DEFAULT_ERROR_MESSAGES.PASSWORD, validator = PasswordValidator) {
return (target, propertyKey) => {
Reflect.defineMetadata(getValidationKey(ValidationKeys.PASSWORD), {
pattern: pattern,
message: message,
types: [String.name],
}, target, propertyKey);
Validation.register({
validator: validator,
validationKey: ValidationKeys.PASSWORD,
save: true,
});
};
}
/**
* @summary List Decorator
* @description Also sets the {@link type} to the provided collection
*
* @param {ModelConstructor} clazz
* @param {string} [collection] The collection being used. defaults to Array
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
* @param {Constructor<Validator>} [validator] defaults to {@link ListValidator}
*
* @function list
*
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function list(clazz, collection = "Array", message = DEFAULT_ERROR_MESSAGES.LIST, validator = ListValidator) {
return (target, propertyKey) => {
type(collection)(target, propertyKey);
Reflect.defineMetadata(getValidationKey(ValidationKeys.LIST), {
class: clazz.name,
type: collection,
message: message,
}, target, propertyKey);
Validation.register({
validator: validator,
validationKey: ValidationKeys.LIST,
save: true,
});
};
}
/**
* @summary Set Decorator
* @description Wrapper for {@link list} with the 'Set' Collection
*
* @param {ModelConstructor} clazz
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
* @param {Constructor<Validator>} [validator]
*
* @function set
*
* @memberOf module:decorator-validation.Decorators.Validation
* @category Decorators
*/
export function set(clazz, message = DEFAULT_ERROR_MESSAGES.LIST, validator) {
return (target, propertyKey) => {
list(clazz, "Set", message, validator)(target, propertyKey);
};
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL2RlY29yYXRvcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxrQkFBa0IsQ0FBQztBQUMxQixPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFDM0QsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUUxQyxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDcEQsT0FBTyxFQUNMLHNCQUFzQixFQUN0QixnQkFBZ0IsRUFDaEIsY0FBYyxHQUNmLE1BQU0sd0JBQXdCLENBQUM7QUFDaEMsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXRDLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBR25FLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxVQUFVLENBQUM7QUFFckM7Ozs7Ozs7OztHQVNHO0FBQ0gsTUFBTSxVQUFVLGdCQUFnQixDQUFDLEdBQVc7SUFDMUMsT0FBTyxjQUFjLENBQUMsT0FBTyxHQUFHLEdBQUcsQ0FBQztBQUN0QyxDQUFDO0FBRUQ7Ozs7Ozs7OztHQVNHO0FBQ0gsTUFBTSxVQUFVLFFBQVEsQ0FBQyxVQUFrQixzQkFBc0IsQ0FBQyxRQUFRO0lBQ3hFLE9BQU8sUUFBUSxDQUNiLGdCQUFnQixDQUFDLGNBQWMsQ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xWYWxpZGF0b3I+LFxuKSB7XG4gIHJldHVybiAodGFyZ2V0OiBhbnksIHByb3BlcnR5S2V5OiBzdHJpbmcpOiBhbnkgPT4ge1xuICAgIGxpc3QoY2xhenosIFwiU2V0XCIsIG1lc3NhZ2UsIHZhbGlkYXRvcikodGFyZ2V0LCBwcm9wZXJ0eUtleSk7XG4gIH07XG59XG4iXX0=

@@ -1,13 +0,4 @@

export * from "./types";
export * from "./Validators";
import { ValidatorRegistry } from "./Validators";
/**
* @summary exports the Validator Registry
* @constant ValidatorRegistryImp
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const ValidatorRegistryImp: typeof ValidatorRegistry;
export * as Decorators from "./decorators";
export * from "./decorators";
export * from "./types";
export * from "./Validation";

@@ -1,1 +0,6 @@

export*from"./types";export*from"./Validators";import{ValidatorRegistry}from"./Validators";const ValidatorRegistryImp=ValidatorRegistry;export*as Decorators from"./decorators";export*from"./decorators";export*from"./Validation";export{ValidatorRegistryImp};
export * from "./Validators";
export * from "./decorators";
export * from "./types";
export * from "./Validation";
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMsU0FBUyxDQUFDO0FBQ3hCLGNBQWMsY0FBYyxDQUFDIiwiZmlsZSI6InZhbGlkYXRpb24vaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tIFwiLi9WYWxpZGF0b3JzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9kZWNvcmF0b3JzXCI7XG5leHBvcnQgKiBmcm9tIFwiLi90eXBlc1wiO1xuZXhwb3J0ICogZnJvbSBcIi4vVmFsaWRhdGlvblwiO1xuIl19

@@ -8,2 +8,13 @@ /**

/**
* @summary Type for validation decorator metadata
* @memberOf module:decorator-validation.Reflection
* @category Reflection
*/
export type ValidationMetadata = {
[indexer: string]: any;
args?: any[];
message: string;
types?: string[];
};
/**
* @summary Type for decorator metadata

@@ -10,0 +21,0 @@ * @memberOf module:decorator-validation.Reflection

@@ -1,2 +0,3 @@

import { IValidatorRegistry, Validator, ValidatorDefinition } from "./Validators";
import { Validator } from "./Validators/Validator";
import { IValidatorRegistry, ValidatorDefinition } from "./Validators/types";
/**

@@ -3,0 +4,0 @@ * @summary Static class acting as a namespace for the Validation

@@ -1,1 +0,63 @@

import{TypeValidator,ValidatorRegistry}from"./Validators";import{ModelKeys}from"../utils";class Validation{static{this.actingValidatorRegistry=void 0}constructor(){}static setRegistry(i,a){a&&Validation.actingValidatorRegistry&&Validation.actingValidatorRegistry.getKeys().forEach(t=>{t=i.get(t);t&&i.register(a(t))}),Validation.actingValidatorRegistry=i}static getRegistry(){return Validation.actingValidatorRegistry||(Validation.actingValidatorRegistry=new ValidatorRegistry({validator:TypeValidator,validationKey:ModelKeys.TYPE,save:!1})),Validation.actingValidatorRegistry}static get(t){return Validation.getRegistry().get(t)}static register(...t){return Validation.getRegistry().register(...t)}}export{Validation};
import { TypeValidator } from "./Validators/TypeValidator";
import { ValidatorRegistry } from "./Validators/ValidatorRegistry";
import { ModelKeys } from "../utils/constants";
/**
* @summary Static class acting as a namespace for the Validation
*
* @class Validation
* @static
*
* @category Validation
*/
export class Validation {
static { this.actingValidatorRegistry = undefined; }
constructor() { }
/**
* @summary Defines the acting ValidatorRegistry
*
* @param {IValidatorRegistry} validatorRegistry the new implementation of the validator Registry
* @param {function(Validator): Validator} [migrationHandler] the method to map the validator if required;
*/
static setRegistry(validatorRegistry, migrationHandler) {
if (migrationHandler && Validation.actingValidatorRegistry)
Validation.actingValidatorRegistry.getKeys().forEach((k) => {
const validator = validatorRegistry.get(k);
if (validator)
validatorRegistry.register(migrationHandler(validator));
});
Validation.actingValidatorRegistry = validatorRegistry;
}
/**
* @summary Returns the current ValidatorRegistry
*
* @return IValidatorRegistry, defaults to {@link ValidatorRegistry}
*/
static getRegistry() {
if (!Validation.actingValidatorRegistry)
Validation.actingValidatorRegistry = new ValidatorRegistry({
validator: TypeValidator,
validationKey: ModelKeys.TYPE,
save: false,
});
return Validation.actingValidatorRegistry;
}
/**
* @summary Retrieves a validator
*
* @param {string} validatorKey one of the {@link ValidationKeys}
* @return {Validator | undefined} the registered Validator or undefined if there is nono matching the provided key
*/
static get(validatorKey) {
return Validation.getRegistry().get(validatorKey);
}
/**
* @summary Registers the provided validators onto the registry
*
* @param {T[] | ValidatorDefinition[]} validator
*/
static register(...validator) {
return Validation.getRegistry().register(...validator);
}
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQzNELE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ25FLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUUvQzs7Ozs7OztHQU9HO0FBQ0gsTUFBTSxPQUFPLFVBQVU7YUFDTiw0QkFBdUIsR0FDcEMsU0FBUyxDQUFDO0lBRVosZ0JBQXVCLENBQUM7SUFFeEI7Ozs7O09BS0c7SUFDSCxNQUFNLENBQUMsV0FBVyxDQUNoQixpQkFBZ0QsRUFDaEQsZ0JBQXNEO1FBRXRELElBQUksZ0JBQWdCLElBQUksVUFBVSxDQUFDLHVCQUF1QjtZQUN4RCxVQUFVLENBQUMsdUJBQXVCLENBQUMsT0FBTyxFQUFFLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUU7Z0JBQ3pELE1BQU0sU0FBUyxHQUF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pZGF0b3JEZWZpbml0aW9uIHwgVClbXVxuICApOiB2b2lkIHtcbiAgICByZXR1cm4gVmFsaWRhdGlvbi5nZXRSZWdpc3RyeSgpLnJlZ2lzdGVyKC4uLnZhbGlkYXRvcik7XG4gIH1cbn1cbiJdfQ==

@@ -83,10 +83,14 @@ /**

/**
* @summary Defines a Password validation regexp
* @summary Defines the various default regexp patterns used
*
* @enum DEFAULT_ERROR_MESSAGES
* @enum DEFAULT_PATTERNS
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const PasswordPatterns: {
CHAR8_ONE_OF_EACH: RegExp;
export declare const DEFAULT_PATTERNS: {
EMAIL: RegExp;
URL: RegExp;
PASSWORD: {
CHAR8_ONE_OF_EACH: RegExp;
};
};

@@ -1,1 +0,135 @@

const ValidationKeys={REFLECT:"model.validation.",REQUIRED:"required",MIN:"min",MAX:"max",STEP:"step",MIN_LENGTH:"minlength",MAX_LENGTH:"maxlength",PATTERN:"pattern",EMAIL:"email",URL:"url",DATE:"date",TYPE:"type",PASSWORD:"password",LIST:"list"},MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],DAYS_OF_WEEK_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],DEFAULT_ERROR_MESSAGES={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}",LIST_INSIDE:"Elements of list are invalid: {0}",MODEL_NOT_FOUND:"No model registered under {0}"},PasswordPatterns={CHAR8_ONE_OF_EACH:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&_\-.,])[A-Za-z\d@$!%*?&_\-.,]{8,}$/g};export{ValidationKeys,MONTH_NAMES,DAYS_OF_WEEK_NAMES,DEFAULT_ERROR_MESSAGES,PasswordPatterns};
/**
* @summary The keys used for validation
*
* @property {string} REFLECT prefixes others
* @property {string} REQUIRED sets as required
* @property {string} MIN defines min value
* @property {string} MAX defines max value
* @property {string} STEP defines step
* @property {string} MIN_LENGTH defines min length
* @property {string} MAX_LENGTH defines max length
* @property {string} PATTERN defines pattern
* @property {string} EMAIL defines email
* @property {string} URL defines url
* @property {string} DATE defines date
* @property {string} TYPE defines type
* @property {string} PASSWORD defines password
* @property {string} LIST defines list
*
* @constant ValidationKeys
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export const ValidationKeys = {
REFLECT: "model.validation.",
REQUIRED: "required",
MIN: "min",
MAX: "max",
STEP: "step",
MIN_LENGTH: "minlength",
MAX_LENGTH: "maxlength",
PATTERN: "pattern",
EMAIL: "email",
URL: "url",
DATE: "date",
TYPE: "type",
PASSWORD: "password",
LIST: "list",
};
/**
* @summary list of month names
* @description Stores month names. Can be changed for localization purposes
*
* @constant MONTH_NAMES
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export const MONTH_NAMES = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
/**
* @summary list of names of days of the week
* @description Stores names for days of the week. Can be changed for localization purposes
*
* @constant DAYS_OF_WEEK_NAMES
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export const DAYS_OF_WEEK_NAMES = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];
/**
* @summary Defines the default error messages
*
* @property {string} REQUIRED default error message
* @property {string} MIN default error message
* @property {string} MAX default error message
* @property {string} MIN_LENGTH default error message
* @property {string} MAX_LENGTH default error message
* @property {string} PATTERN default error message
* @property {string} EMAIL default error message
* @property {string} URL default error message
* @property {string} TYPE default error message
* @property {string} STEP default error message
* @property {string} DATE default error message
* @property {string} DEFAULT default error message
* @property {string} PASSWORD default error message
* @property {string} LIST default error message
* @property {string} LIST_INSIDE default error message
* @property {string} MODEL_NOT_FOUND default error message
*
* @constant DEFAULT_ERROR_MESSAGES
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export const DEFAULT_ERROR_MESSAGES = {
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}",
LIST_INSIDE: "Elements of list are invalid: {0}",
MODEL_NOT_FOUND: "No model registered under {0}",
};
/**
* @summary Defines the various default regexp patterns used
*
* @enum DEFAULT_PATTERNS
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export const DEFAULT_PATTERNS = {
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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MDBhMS1cXHVmZmZmXXsyLH1cXC4/KSkoPzo6XFxkezIsNX0pPyg/OlsvPyNdXFxTKik/JC9pLFxuICBQQVNTV09SRDoge1xuICAgIENIQVI4X09ORV9PRl9FQUNIOlxuICAgICAgL14oPz0uKlthLXpdKSg/PS4qW0EtWl0pKD89LipcXGQpKD89LipbQCQhJSo/Jl9cXC0uLF0pW0EtWmEtelxcZEAkISUqPyZfXFwtLixdezgsfSQvZyxcbiAgfSxcbn07XG4iXX0=

@@ -1,1 +0,55 @@

import{Validator}from"./Validator";import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";class DateValidator extends Validator{constructor(a=DEFAULT_ERROR_MESSAGES.DATE){super(ValidationKeys.DATE,a,Number.name,Date.name,String.name)}hasErrors(a,t,e){if(void 0!==a)return"string"==typeof a&&(a=new Date(a)),isNaN(a.getDate())?this.getMessage(e||this.message):void 0}}export{DateValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { ValidationKeys, DEFAULT_ERROR_MESSAGES } from "./constants";
import { validator } from "./decorators";
/**
* @summary Date Validator
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#DATE}
*
* @class DateValidator
* @extends Validator
*
* @category Validators
*/
let DateValidator = class DateValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.DATE) {
super(ValidationKeys.DATE, message, Number.name, Date.name, String.name);
}
/**
* @summary Validates a model
*
* @param {Date | string} value
* @param {string} format
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, format, message) {
if (value === undefined)
return;
if (typeof value === "string")
value = new Date(value);
if (isNaN(value.getDate()))
return this.getMessage(message || this.message);
}
};
DateValidator = __decorate([
validator(ValidationKeys.DATE),
__metadata("design:paramtypes", [String])
], DateValidator);
export { DateValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvRGF0ZVZhbGlkYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQ3hDLE9BQU8sRUFBRSxjQUFjLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFckUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUV6Qzs7Ozs7Ozs7O0dBU0c7QUFFSSxJQUFNLGFBQWEsR0FBbkIsTUFBTSxhQUFjLFNBQVEsU0FBUztJQUMxQyxZQUFZLFVBQWtCLHNCQUFzQixDQUFDLElBQUk7UUFDdkQsS0FBSyxDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsT0FBTyxFQUFFLE1BQU0sQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLElBQUksRUFBRSxNQUFNLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDM0UsQ0FBQztJQUVEOzs7Ozs7Ozs7Ozs7T0FZRztJQUNJLFNBQVMsQ0FDZCxLQUFvQixFQUNwQixNQUFjLEVBQ2QsT0FBZ0I7UUFFaEIsSUFBSSxLQUFLLEtBQUssU0FBUztZQUFFLE9BQU87UUFFaEMsSUFBSSxPQUFPLEtBQUssS0FBSyxRQUFRO1lBQUUsS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gY29uc3RydWN0b3IobWVzc2FnZTogc3RyaW5nID0gREVGQVVMVF9FUlJPUl9NRVNTQUdFUy5EQVRFKSB7XG4gICAgc3VwZXIoVmFsaWRhdGlvbktleXMuREFURSwgbWVzc2FnZSwgTnVtYmVyLm5hbWUsIERhdGUubmFtZSwgU3RyaW5nLm5hbWUpO1xuICB9XG5cbiAgLyoqXG4gICAqIEBzdW1tYXJ5IFZhbGlkYXRlcyBhIG1vZGVsXG4gICAqXG4gICAqIEBwYXJhbSB7RGF0ZSB8IHN0cmluZ30gdmFsdWVcbiAgICogQHBhcmFtIHtzdHJpbmd9IGZvcm1hdFxuICAgKiBAcGFyYW0ge3N0cmluZ30gW21lc3NhZ2VdXG4gICAqXG4gICAqIEByZXR1cm4gRXJyb3JzXG4gICAqXG4gICAqIEBvdmVycmlkZVxuICAgKlxuICAgKiBAc2VlIFZhbGlkYXRvciNoYXNFcnJvcnNcbiAgICovXG4gIHB1YmxpYyBoYXNFcnJvcnMoXG4gICAgdmFsdWU6IERhdGUgfCBzdHJpbmcsXG4gICAgZm9ybWF0OiBzdHJpbmcsXG4gICAgbWVzc2FnZT86IHN0cmluZyxcbiAgKTogRXJyb3JzIHtcbiAgICBpZiAodmFsdWUgPT09IHVuZGVmaW5lZCkgcmV0dXJuO1xuXG4gICAgaWYgKHR5cGVvZiB2YWx1ZSA9PT0gXCJzdHJpbmdcIikgdmFsdWUgPSBuZXcgRGF0ZSh2YWx1ZSk7XG5cbiAgICBpZiAoaXNOYU4odmFsdWUuZ2V0RGF0ZSgpKSkgcmV0dXJuIHRoaXMuZ2V0TWVzc2FnZShtZXNzYWdlIHx8IHRoaXMubWVzc2FnZSk7XG4gIH1cbn1cbiJdfQ==

@@ -14,3 +14,2 @@ import { Errors } from "../types";

export declare class EmailValidator extends PatternValidator {
private static readonly emailPat;
constructor(message?: string);

@@ -17,0 +16,0 @@ /**

@@ -1,1 +0,49 @@

import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";import{PatternValidator}from"./PatternValidator";class EmailValidator extends PatternValidator{static{this.emailPat=/[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])?/}constructor(a=DEFAULT_ERROR_MESSAGES.EMAIL){super(ValidationKeys.EMAIL,a)}hasErrors(a,t){return super.hasErrors(a,EmailValidator.emailPat,t)}}export{EmailValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { ValidationKeys, DEFAULT_ERROR_MESSAGES, DEFAULT_PATTERNS, } from "./constants";
import { PatternValidator } from "./PatternValidator";
import { validator } from "./decorators";
/**
* @summary Email Validator
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#EMAIL}
*
* @class EmailValidator
* @extends PatternValidator
*
* @category Validators
*/
let EmailValidator = class EmailValidator extends PatternValidator {
constructor(message = DEFAULT_ERROR_MESSAGES.EMAIL) {
super(ValidationKeys.EMAIL, message);
}
/**
* @summary Validates a model
*
* @param {string} value
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, message) {
return super.hasErrors(value, DEFAULT_PATTERNS.EMAIL, message);
}
};
EmailValidator = __decorate([
validator(ValidationKeys.EMAIL),
__metadata("design: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saWRhdG9yI2hhc0Vycm9yc1xuICAgKi9cbiAgcHVibGljIGhhc0Vycm9ycyh2YWx1ZTogc3RyaW5nLCBtZXNzYWdlPzogc3RyaW5nKTogRXJyb3JzIHtcbiAgICByZXR1cm4gc3VwZXIuaGFzRXJyb3JzKHZhbHVlLCBERUZBVUxUX1BBVFRFUk5TLkVNQUlMLCBtZXNzYWdlKTtcbiAgfVxufVxuIl19

@@ -15,7 +15,6 @@ import { DateValidator } from "./DateValidator";

export * from "./constants";
export * from "./Validator";
export * from "./types";
export * from "./ValidatorRegistry";
export * from "./DateValidator";
export * from "./decorators";
export * from "./EmailValidator";
export * from "./RequiredValidator";
export * from "./ListValidator";
export * from "./MaxLengthValidator";

@@ -25,8 +24,11 @@ export * from "./MaxValidator";

export * from "./MinValidator";
export * from "./PasswordValidator";
export * from "./PatternValidator";
export * from "./URLValidator";
export * from "./RequiredValidator";
export * from "./StepValidator";
export * from "./DateValidator";
export * from "./types";
export * from "./TypeValidator";
export * from "./PasswordValidator";
export * from "./URLValidator";
export * from "./Validator";
export * from "./ValidatorRegistry";
/**

@@ -33,0 +35,0 @@ * @summary constant holding all {@link Validator}s

@@ -1,1 +0,54 @@

import{DateValidator}from"./DateValidator";import{TypeValidator}from"./TypeValidator";import{PasswordValidator}from"./PasswordValidator";import{StepValidator}from"./StepValidator";import{URLValidator}from"./URLValidator";import{PatternValidator}from"./PatternValidator";import{MinValidator}from"./MinValidator";import{MinLengthValidator}from"./MinLengthValidator";import{MaxValidator}from"./MaxValidator";import{MaxLengthValidator}from"./MaxLengthValidator";import{RequiredValidator}from"./RequiredValidator";import{EmailValidator}from"./EmailValidator";import{ListValidator}from"./ListValidator";export*from"./constants";export*from"./Validator";export*from"./types";export*from"./ValidatorRegistry";export*from"./EmailValidator";export*from"./RequiredValidator";export*from"./MaxLengthValidator";export*from"./MaxValidator";export*from"./MinLengthValidator";export*from"./MinValidator";export*from"./PatternValidator";export*from"./URLValidator";export*from"./StepValidator";export*from"./DateValidator";export*from"./TypeValidator";export*from"./PasswordValidator";const Validators={EmailValidator:EmailValidator,RequiredValidator:RequiredValidator,MaxLengthValidator:MaxLengthValidator,MaxValidator:MaxValidator,MinLengthValidator:MinLengthValidator,MinValidator:MinValidator,PatternValidator:PatternValidator,URLValidator:URLValidator,StepValidator:StepValidator,DateValidator:DateValidator,TypeValidator:TypeValidator,PasswordValidator:PasswordValidator,ListValidator:ListValidator};export{Validators};
import { DateValidator } from "./DateValidator";
import { TypeValidator } from "./TypeValidator";
import { PasswordValidator } from "./PasswordValidator";
import { StepValidator } from "./StepValidator";
import { URLValidator } from "./URLValidator";
import { PatternValidator } from "./PatternValidator";
import { MinValidator } from "./MinValidator";
import { MinLengthValidator } from "./MinLengthValidator";
import { MaxValidator } from "./MaxValidator";
import { MaxLengthValidator } from "./MaxLengthValidator";
import { RequiredValidator } from "./RequiredValidator";
import { EmailValidator } from "./EmailValidator";
import { ListValidator } from "./ListValidator";
export * from "./constants";
export * from "./DateValidator";
export * from "./decorators";
export * from "./EmailValidator";
export * from "./ListValidator";
export * from "./MaxLengthValidator";
export * from "./MaxValidator";
export * from "./MinLengthValidator";
export * from "./MinValidator";
export * from "./PasswordValidator";
export * from "./PatternValidator";
export * from "./RequiredValidator";
export * from "./StepValidator";
export * from "./types";
export * from "./TypeValidator";
export * from "./URLValidator";
export * from "./Validator";
export * from "./ValidatorRegistry";
/**
* @summary constant holding all {@link Validator}s
* @constant Validators
* @memberOf module:decorator-validation.Validation.Validators
* @category Validation
*/
export const Validators = {
EmailValidator,
RequiredValidator,
MaxLengthValidator,
MaxValidator,
MinLengthValidator,
MinValidator,
PatternValidator,
URLValidator,
StepValidator,
DateValidator,
TypeValidator,
PasswordValidator,
ListValidator,
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5nc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dG9yXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9SZXF1aXJlZFZhbGlkYXRvclwiO1xuZXhwb3J0ICogZnJvbSBcIi4vU3RlcFZhbGlkYXRvclwiO1xuZXhwb3J0ICogZnJvbSBcIi4vdHlwZXNcIjtcbmV4cG9ydCAqIGZyb20gXCIuL1R5cGVWYWxpZGF0b3JcIjtcbmV4cG9ydCAqIGZyb20gXCIuL1VSTFZhbGlkYXRvclwiO1xuZXhwb3J0ICogZnJvbSBcIi4vVmFsaWRhdG9yXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9WYWxpZGF0b3JSZWdpc3RyeVwiO1xuLyoqXG4gKiBAc3VtbWFyeSBjb25zdGFudCBob2xkaW5nIGFsbCB7QGxpbmsgVmFsaWRhdG9yfXNcbiAqIEBjb25zdGFudCBWYWxpZGF0b3JzXG4gKiBAbWVtYmVyT2YgbW9kdWxlOmRlY29yYXRvci12YWxpZGF0aW9uLlZhbGlkYXRpb24uVmFsaWRhdG9yc1xuICogQGNhdGVnb3J5IFZhbGlkYXRpb25cbiAqL1xuZXhwb3J0IGNvbnN0IFZhbGlkYXRvcnMgPSB7XG4gIEVtYWlsVmFsaWRhdG9yLFxuICBSZXF1aXJlZFZhbGlkYXRvcixcbiAgTWF4TGVuZ3RoVmFsaWRhdG9yLFxuICBNYXhWYWxpZGF0b3IsXG4gIE1pbkxlbmd0aFZhbGlkYXRvcixcbiAgTWluVmFsaWRhdG9yLFxuICBQYXR0ZXJuVmFsaWRhdG9yLFxuICBVUkxWYWxpZGF0b3IsXG4gIFN0ZXBWYWxpZGF0b3IsXG4gIERhdGVWYWxpZGF0b3IsXG4gIFR5cGVWYWxpZGF0b3IsXG4gIFBhc3N3b3JkVmFsaWRhdG9yLFxuICBMaXN0VmFsaWRhdG9yLFxufTtcbiJdfQ==

@@ -1,1 +0,67 @@

import{Validator}from"./Validator";import{DEFAULT_ERROR_MESSAGES,ValidationKeys}from"./constants";class ListValidator extends Validator{constructor(t=DEFAULT_ERROR_MESSAGES.LIST){super(ValidationKeys.LIST,t,Array.name,Set.name)}hasErrors(r,a,e){var s;if(r&&(Array.isArray(r)?r.length:r.size))for(let t=0;t<(Array.isArray(r)?r.length:r.size);t++)switch(typeof(s=r[t])){case"object":case"function":if(s.constructor&&s.constructor.name===a)break;return this.getMessage(e||this.message,a);default:if(typeof s!==a)return this.getMessage(e||this.message,a)}}}export{ListValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { DEFAULT_ERROR_MESSAGES, ValidationKeys } from "./constants";
import { validator } from "./decorators";
/**
* @summary List Validator
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
*
* @class ListValidator
* @extends Validator
*
* @category Validators
*/
let ListValidator = class ListValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.LIST) {
super(ValidationKeys.LIST, message, Array.name, Set.name);
}
/**
* @summary Validates a model
*
* @param {any[] | Set<any>} value
* @param {string} clazz
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, clazz, message) {
if (!value || (Array.isArray(value) ? !value.length : !value.size))
return;
let val;
for (let i = 0; i < (Array.isArray(value) ? value.length : value.size); i++) {
val = value[i];
switch (typeof val) {
case "object":
case "function":
if (!val.constructor ||
val.constructor.name !== clazz)
return this.getMessage(message || this.message, clazz);
break;
default:
if (typeof val !== clazz)
return this.getMessage(message || this.message, clazz);
}
}
return undefined;
}
};
ListValidator = __decorate([
validator(ValidationKeys.LIST),
__metadata("design:paramtypes", [String])
], ListValidator);
export { ListValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvTGlzdFZhbGlkYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBRXhDLE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxjQUFjLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDckUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUV6Qzs7Ozs7Ozs7O0dBU0c7QUFFSSxJQUFNLGFBQWEsR0FBbkIsTUFBTSxhQUFjLFNBQVEsU0FBUztJQUMxQyxZQUFZLFVBQWtCLHNCQUFzQixDQUFDLElBQUk7UUFDdkQsS0FBSyxDQUFDLGNBQWMsQ0FBQyxJQUFJLEVBQUUsT0FBTyxFQUFFLEtBQUssQ0FBQyxJQUFJLEVBQUUsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQzVELENBQUM7SUFFRDs7Ozs7Ozs7Ozs7O09BWUc7SUFDSCxTQUFTLENBQUMsS0FBdUIsRUFBRSxLQUFhLEVBQUUsT0FBZ0I7UUFDaEUsSUFBSSxDQUFDLEtBQUssSUFBSSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDO1lBQUUsT0FBTztRQUUzRSxJQUFJLEdBQUcsQ0FBQztRQUNSLEtBQ0UsSUFBSSxDQUFDLEdBQ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gIGhhc0Vycm9ycyh2YWx1ZTogYW55W10gfCBTZXQ8YW55PiwgY2xheno6IHN0cmluZywgbWVzc2FnZT86IHN0cmluZyk6IEVycm9ycyB7XG4gICAgaWYgKCF2YWx1ZSB8fCAoQXJyYXkuaXNBcnJheSh2YWx1ZSkgPyAhdmFsdWUubGVuZ3RoIDogIXZhbHVlLnNpemUpKSByZXR1cm47XG5cbiAgICBsZXQgdmFsO1xuICAgIGZvciAoXG4gICAgICBsZXQgaSA9IDA7XG4gICAgICBpIDwgKEFycmF5LmlzQXJyYXkodmFsdWUpID8gdmFsdWUubGVuZ3RoIDogdmFsdWUuc2l6ZSk7XG4gICAgICBpKytcbiAgICApIHtcbiAgICAgIHZhbCA9ICh2YWx1ZSBhcyBhbnkpW2ldO1xuICAgICAgc3dpdGNoICh0eXBlb2YgdmFsKSB7XG4gICAgICAgIGNhc2UgXCJvYmplY3RcIjpcbiAgICAgICAgY2FzZSBcImZ1bmN0aW9uXCI6XG4gICAgICAgICAgaWYgKFxuICAgICAgICAgICAgISh2YWwgYXMgb2JqZWN0KS5jb25zdHJ1Y3RvciB8fFxuICAgICAgICAgICAgKHZhbCBhcyBvYmplY3QpLmNvbnN0cnVjdG9yLm5hbWUgIT09IGNsYXp6XG4gICAgICAgICAgKVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuZ2V0TWVzc2FnZShtZXNzYWdlIHx8IHRoaXMubWVzc2FnZSwgY2xhenopO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgIGlmICh0eXBlb2YgdmFsICE9PSBjbGF6eilcbiAgICAgICAgICAgIHJldHVybiB0aGlzLmdldE1lc3NhZ2UobWVzc2FnZSB8fCB0aGlzLm1lc3NhZ2UsIGNsYXp6KTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gdW5kZWZpbmVkO1xuICB9XG59XG4iXX0=

@@ -1,1 +0,55 @@

import{Validator}from"./Validator";import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";class MaxLengthValidator extends Validator{constructor(a=DEFAULT_ERROR_MESSAGES.MAX_LENGTH){super(ValidationKeys.MAX_LENGTH,a,String.name,Array.name)}hasErrors(a,t,r){return void 0!==a&&a.length>t?this.getMessage(r||this.message,t):void 0}}export{MaxLengthValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { ValidationKeys, DEFAULT_ERROR_MESSAGES } from "./constants";
import { validator } from "./decorators";
/**
* @summary Maximum Length Validator
* @description Validates strings and Arrays on their maximum length
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#MAX_LENGTH}
*
* @class MinLengthValidator
* @extends Validator
*
* @category Validators
*/
let MaxLengthValidator = class MaxLengthValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.MAX_LENGTH) {
super(ValidationKeys.MAX_LENGTH, message, String.name, Array.name);
}
/**
* @summary Validates a model
*
* @param {string} value
* @param {number} maxlength
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, maxlength, message) {
if (value === undefined)
return;
return value.length > maxlength
? this.getMessage(message || this.message, maxlength)
: undefined;
}
};
MaxLengthValidator = __decorate([
validator(ValidationKeys.MAX_LENGTH),
__metadata("design:paramtypes", [String])
], MaxLengthValidator);
export { MaxLengthValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2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mF5Lm5hbWUpO1xuICB9XG5cbiAgLyoqXG4gICAqIEBzdW1tYXJ5IFZhbGlkYXRlcyBhIG1vZGVsXG4gICAqXG4gICAqIEBwYXJhbSB7c3RyaW5nfSB2YWx1ZVxuICAgKiBAcGFyYW0ge251bWJlcn0gbWF4bGVuZ3RoXG4gICAqIEBwYXJhbSB7c3RyaW5nfSBbbWVzc2FnZV1cbiAgICpcbiAgICogQHJldHVybiBFcnJvcnNcbiAgICpcbiAgICogQG92ZXJyaWRlXG4gICAqXG4gICAqIEBzZWUgVmFsaWRhdG9yI2hhc0Vycm9yc1xuICAgKi9cbiAgcHVibGljIGhhc0Vycm9ycyhcbiAgICB2YWx1ZTogc3RyaW5nIHwgYW55W10sXG4gICAgbWF4bGVuZ3RoOiBudW1iZXIsXG4gICAgbWVzc2FnZT86IHN0cmluZyxcbiAgKTogRXJyb3JzIHtcbiAgICBpZiAodmFsdWUgPT09IHVuZGVmaW5lZCkgcmV0dXJuO1xuICAgIHJldHVybiB2YWx1ZS5sZW5ndGggPiBtYXhsZW5ndGhcbiAgICAgID8gdGhpcy5nZXRNZXNzYWdlKG1lc3NhZ2UgfHwgdGhpcy5tZXNzYWdlLCBtYXhsZW5ndGgpXG4gICAgICA6IHVuZGVmaW5lZDtcbiAgfVxufVxuIl19

@@ -1,1 +0,59 @@

import{Validator}from"./Validator";import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";class MaxValidator extends Validator{constructor(a=DEFAULT_ERROR_MESSAGES.MAX){super(ValidationKeys.MAX,a,"number","Date","string")}hasErrors(a,t,e){if(void 0!==a){if(a instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Max param defined");return t<a?this.getMessage(e||this.message,t):void 0}}}export{MaxValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { ValidationKeys, DEFAULT_ERROR_MESSAGES } from "./constants";
import { validator } from "./decorators";
/**
* @summary Max Validator
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#MAX}
*
* @class MaxValidator
* @extends Validator
*
* @category Validators
*/
let MaxValidator = class MaxValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.MAX) {
super(ValidationKeys.MAX, message, "number", "Date", "string");
}
/**
* @summary Validates a Model
*
* @param {string} value
* @param {number | Date | string} max
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, max, message) {
if (value === undefined)
return;
if (value instanceof Date && !(max instanceof Date)) {
max = new Date(max);
if (isNaN(max.getDate()))
throw new Error(`Invalid Max param defined`);
}
return value > max
? this.getMessage(message || this.message, max)
: undefined;
}
};
MaxValidator = __decorate([
validator(ValidationKeys.MAX),
__metadata("design:paramtypes", [String])
], MaxValidator);
export { MaxValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvTWF4VmFsaWRhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDeEMsT0FBTyxFQUFFLGNBQWMsRUFBRSxzQkFBc0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUVyRSxPQUFPLEVBQUUsU0FBU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IEByZXR1cm4gRXJyb3JzXG4gICAqXG4gICAqIEBvdmVycmlkZVxuICAgKlxuICAgKiBAc2VlIFZhbGlkYXRvciNoYXNFcnJvcnNcbiAgICovXG4gIHB1YmxpYyBoYXNFcnJvcnMoXG4gICAgdmFsdWU6IG51bWJlciB8IERhdGUgfCBzdHJpbmcsXG4gICAgbWF4OiBudW1iZXIgfCBEYXRlIHwgc3RyaW5nLFxuICAgIG1lc3NhZ2U/OiBzdHJpbmcsXG4gICk6IEVycm9ycyB7XG4gICAgaWYgKHZhbHVlID09PSB1bmRlZmluZWQpIHJldHVybjtcblxuICAgIGlmICh2YWx1ZSBpbnN0YW5jZW9mIERhdGUgJiYgIShtYXggaW5zdGFuY2VvZiBEYXRlKSkge1xuICAgICAgbWF4ID0gbmV3IERhdGUobWF4KTtcbiAgICAgIGlmIChpc05hTihtYXguZ2V0RGF0ZSgpKSkgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIE1heCBwYXJhbSBkZWZpbmVkYCk7XG4gICAgfVxuXG4gICAgcmV0dXJuIHZhbHVlID4gbWF4XG4gICAgICA/IHRoaXMuZ2V0TWVzc2FnZShtZXNzYWdlIHx8IHRoaXMubWVzc2FnZSwgbWF4KVxuICAgICAgOiB1bmRlZmluZWQ7XG4gIH1cbn1cbiJdfQ==

@@ -1,1 +0,55 @@

import{Validator}from"./Validator";import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";class MinLengthValidator extends Validator{constructor(t=DEFAULT_ERROR_MESSAGES.MIN_LENGTH){super(ValidationKeys.MIN_LENGTH,t,String.name,Array.name)}hasErrors(t,a,r){return void 0!==t&&t.length<a?this.getMessage(r||this.message,a):void 0}}export{MinLengthValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { ValidationKeys, DEFAULT_ERROR_MESSAGES } from "./constants";
import { validator } from "./decorators";
/**
* @summary Minimum Length Validator
* @description Validates strings and Arrays on their minimum length
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#MIN_LENGTH}
*
* @class MinLengthValidator
* @extends Validator
*
* @category Validators
*/
let MinLengthValidator = class MinLengthValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.MIN_LENGTH) {
super(ValidationKeys.MIN_LENGTH, message, String.name, Array.name);
}
/**
*
* @param {string | Array} value
* @param {number} minlength
* @param {string} [message]
*
* @return Errors
*
* @memberOf MinLengthValidator
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, minlength, message) {
if (value === undefined)
return;
return value.length < minlength
? this.getMessage(message || this.message, minlength)
: undefined;
}
};
MinLengthValidator = __decorate([
validator(ValidationKeys.MIN_LENGTH),
__metadata("design:paramtypes", [String])
], MinLengthValidator);
export { MinLengthValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvTWluTGVuZ3RoVmFsaWRhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDeEMsT0FBTyxFQUFFLGNBQWMsRUFBRSxzQkFBc0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUVyRSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sY0FBYyxDQU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vcnNcbiAgICovXG4gIHB1YmxpYyBoYXNFcnJvcnMoXG4gICAgdmFsdWU6IHN0cmluZyB8IGFueVtdLFxuICAgIG1pbmxlbmd0aDogbnVtYmVyLFxuICAgIG1lc3NhZ2U/OiBzdHJpbmcsXG4gICk6IEVycm9ycyB7XG4gICAgaWYgKHZhbHVlID09PSB1bmRlZmluZWQpIHJldHVybjtcbiAgICByZXR1cm4gdmFsdWUubGVuZ3RoIDwgbWlubGVuZ3RoXG4gICAgICA/IHRoaXMuZ2V0TWVzc2FnZShtZXNzYWdlIHx8IHRoaXMubWVzc2FnZSwgbWlubGVuZ3RoKVxuICAgICAgOiB1bmRlZmluZWQ7XG4gIH1cbn1cbiJdfQ==

@@ -1,1 +0,59 @@

import{Validator}from"./Validator";import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";class MinValidator extends Validator{constructor(a=DEFAULT_ERROR_MESSAGES.MIN){super(ValidationKeys.MIN,a,"number","Date","string")}hasErrors(a,t,i){if(void 0!==a){if(a instanceof Date&&!(t instanceof Date)&&(t=new Date(t),isNaN(t.getDate())))throw new Error("Invalid Min param defined");return a<t?this.getMessage(i||this.message,t):void 0}}}export{MinValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { ValidationKeys, DEFAULT_ERROR_MESSAGES } from "./constants";
import { validator } from "./decorators";
/**
* @summary Min Validator
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#MIN}
*
* @class MinValidator
* @extends Validator
*
* @category Validators
*/
let MinValidator = class MinValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.MIN) {
super(ValidationKeys.MIN, message, "number", "Date", "string");
}
/**
* @summary Validates Model
*
* @param {string} value
* @param {number | Date | string} min
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, min, message) {
if (value === undefined)
return;
if (value instanceof Date && !(min instanceof Date)) {
min = new Date(min);
if (isNaN(min.getDate()))
throw new Error(`Invalid Min param defined`);
}
return value < min
? this.getMessage(message || this.message, min)
: undefined;
}
};
MinValidator = __decorate([
validator(ValidationKeys.MIN),
__metadata("design:paramtypes", [String])
], MinValidator);
export { MinValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvTWluVmFsaWRhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFDeEMsT0FBTyxFQUFFLGNBQWMsRUFBRSxzQkFBc0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUVyRSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBRXpDOzs7Ozs7Ozs7R0FTRztBQUVJLElBQU0sWUFBWSxHQUFsQixNQUFNLFlBQWEsU0FBUSxTQUFTO0lBQ3pDLFlBQVksVUFBa0Isc0JBQXNCLENBQUMsR0FBRztRQUN0RCxLQUFLLENBQUMsY0FBYyxDQUFDLEdBQUcsRUFBRSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sRUFBRSxRQUFRLENBQUMsQ0FBQztJQUNqRSxDQUFDO0lBRUQ7Ozs7Ozs7Ozs7OztPQVlHO0lBQ0ks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5cbiAgICBpZiAodmFsdWUgaW5zdGFuY2VvZiBEYXRlICYmICEobWluIGluc3RhbmNlb2YgRGF0ZSkpIHtcbiAgICAgIG1pbiA9IG5ldyBEYXRlKG1pbik7XG4gICAgICBpZiAoaXNOYU4obWluLmdldERhdGUoKSkpIHRocm93IG5ldyBFcnJvcihgSW52YWxpZCBNaW4gcGFyYW0gZGVmaW5lZGApO1xuICAgIH1cbiAgICByZXR1cm4gdmFsdWUgPCBtaW5cbiAgICAgID8gdGhpcy5nZXRNZXNzYWdlKG1lc3NhZ2UgfHwgdGhpcy5tZXNzYWdlLCBtaW4pXG4gICAgICA6IHVuZGVmaW5lZDtcbiAgfVxufVxuIl19

@@ -1,1 +0,52 @@

import{PatternValidator}from"./PatternValidator";import{DEFAULT_ERROR_MESSAGES,PasswordPatterns,ValidationKeys}from"./constants";class PasswordValidator extends PatternValidator{constructor(r=DEFAULT_ERROR_MESSAGES.PASSWORD,t=PasswordPatterns.CHAR8_ONE_OF_EACH){super(ValidationKeys.PASSWORD,r),this.pattern=t}hasErrors(r,t,a){return super.hasErrors(r,t||this.pattern,a||this.message)}}export{PasswordValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { PatternValidator } from "./PatternValidator";
import { DEFAULT_ERROR_MESSAGES, DEFAULT_PATTERNS, ValidationKeys, } from "./constants";
import { validator } from "./decorators";
/**
* @summary Handles Password Validation
*
* @param {string} [errorMessage] defaults to {@link DEFAULT_ERROR_MESSAGES#PASSWORD}
* @param {RegExp} [passwordPattern] defaults to {@link PasswordPatterns.CHAR8_ONE_OF_EACH}
*
* @class PasswordValidator
* @extends PatternValidator
*
* @category Validators
*/
let PasswordValidator = class PasswordValidator extends PatternValidator {
constructor(errorMessage = DEFAULT_ERROR_MESSAGES.PASSWORD, passwordPattern = DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH) {
super(ValidationKeys.PASSWORD, errorMessage);
this.pattern = passwordPattern;
}
/**
* @summary Validates a model
*
* @param {string} value
* @param {RegExp} [pattern]
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see PatternValidator#hasErrors
*/
hasErrors(value, pattern, message) {
return super.hasErrors(value, pattern || this.pattern, message || this.message);
}
};
PasswordValidator = __decorate([
validator(ValidationKeys.PASSWORD),
__metadata("design:paramtypes", [Object, RegExp])
], PasswordValidator);
export { PasswordValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvUGFzc3dvcmRWYWxpZGF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDdEQsT0FBTyxFQUNMLHNCQUFzQixFQUN0QixnQkFBZ0IsRUFDaEIsY0FBYyxHQUNmLE1BQU0sYUFBYSxDQUFDO0FBRXJCLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFFekM7Ozs7Ozs7Ozs7R0FVRztBQUVJLElBQU0saUJBQWlCLEdBQXZCLE1BQU0saUJBQWtCLFNBQVEsZ0JBQWdCO0lBR3JELFlBQ0UsWUFBWSxHQUFHLHNCQUFzQixDQUFDLFFBQVEsRUFDOUMsa0JBQTBCLGdCQUFnQixDQUFDLFFBQVEsQ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ICogQHNlZSBQYXR0ZXJuVmFsaWRhdG9yI2hhc0Vycm9yc1xuICAgKi9cbiAgcHVibGljIGhhc0Vycm9ycyh2YWx1ZTogc3RyaW5nLCBwYXR0ZXJuOiBSZWdFeHAsIG1lc3NhZ2U/OiBzdHJpbmcpOiBFcnJvcnMge1xuICAgIHJldHVybiBzdXBlci5oYXNFcnJvcnMoXG4gICAgICB2YWx1ZSxcbiAgICAgIHBhdHRlcm4gfHwgdGhpcy5wYXR0ZXJuLFxuICAgICAgbWVzc2FnZSB8fCB0aGlzLm1lc3NhZ2UsXG4gICAgKTtcbiAgfVxufVxuIl19
import { Validator } from "./Validator";
import { Errors } from "../types";
export declare const regexpParser: RegExp;
/**

@@ -15,3 +16,2 @@ * @summary Pattern Validator

export declare class PatternValidator extends Validator {
private static readonly regexpParser;
constructor(key?: string, message?: string);

@@ -24,3 +24,3 @@ /**

*/
private static getPattern;
private getPattern;
/**

@@ -39,3 +39,3 @@ * @summary Validates a Model

*/
hasErrors(value: string, pattern: RegExp | string, message?: string): Errors;
hasErrors(value: string, pattern?: RegExp | string, message?: string): Errors;
}

@@ -1,1 +0,72 @@

import{Validator}from"./Validator";import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";class PatternValidator extends Validator{static{this.regexpParser=new RegExp("^/(.+)/([gimus]*)$")}constructor(t=ValidationKeys.PATTERN,r=DEFAULT_ERROR_MESSAGES.PATTERN){super(t,r,"string")}static getPattern(t){var r;return PatternValidator.regexpParser.test(t)?(r=t.match(PatternValidator.regexpParser),new RegExp(r[1],r[2])):new RegExp(t)}hasErrors(t,r,e){if(t)return(r="string"==typeof r?PatternValidator.getPattern(r):r).lastIndex=0,r.test(t)?void 0:this.getMessage(e||this.message)}}export{PatternValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { ValidationKeys, DEFAULT_ERROR_MESSAGES } from "./constants";
import { validator } from "./decorators";
export const regexpParser = new RegExp("^/(.+)/([gimus]*)$");
/**
* @summary Pattern Validator
*
* @param {string} [key] defaults to {@link ValidationKeys#PATTERN}
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#PATTERN}
*
* @class PatternValidator
* @extends Validator
*
* @category Validators
*/
let PatternValidator = class PatternValidator extends Validator {
constructor(key = ValidationKeys.PATTERN, message = DEFAULT_ERROR_MESSAGES.PATTERN) {
super(key, message, "string");
}
/**
* @summary parses and validates a pattern
*
* @param {string} pattern
* @private
*/
getPattern(pattern) {
if (!regexpParser.test(pattern))
return new RegExp(pattern);
const match = pattern.match(regexpParser);
return new RegExp(match[1], match[2]);
}
/**
* @summary Validates a Model
*
* @param {string} value
* @param {RegExp | string} pattern
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, pattern, message) {
if (!value)
return;
if (!pattern)
throw new Error("Missing Pattern");
pattern = typeof pattern === "string" ? this.getPattern(pattern) : pattern;
pattern.lastIndex = 0; // resets pattern position for repeat validation requests
return !pattern.test(value)
? this.getMessage(message || this.message)
: undefined;
}
};
PatternValidator = __decorate([
validator(ValidationKeys.PATTERN),
__metadata("design:paramtypes", [String, String])
], PatternValidator);
export { PatternValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvUGF0dGVyblZhbGlkYXRvci50cyJdLC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_MESSAGES}from"./constants";class RequiredValidator extends Validator{constructor(e=DEFAULT_ERROR_MESSAGES.REQUIRED){super(ValidationKeys.REQUIRED,e)}hasErrors(e,s){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(s||this.message):void 0;default:return e?void 0:this.getMessage(s||this.message)}}}export{RequiredValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { ValidationKeys, DEFAULT_ERROR_MESSAGES } from "./constants";
import { validator } from "./decorators";
/**
* @summary Required Validator
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#REQUIRED}
*
* @class RequiredValidator
* @extends Validator
*
* @category Validators
*/
let RequiredValidator = class RequiredValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.REQUIRED) {
super(ValidationKeys.REQUIRED, message);
}
/**
* @summary Validates a model
*
* @param {string} value
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, message) {
switch (typeof value) {
case "boolean":
case "number":
return typeof value === "undefined"
? this.getMessage(message || this.message)
: undefined;
default:
return !value ? this.getMessage(message || this.message) : undefined;
}
}
};
RequiredValidator = __decorate([
validator(ValidationKeys.REQUIRED),
__metadata("design:paramtypes", [String])
], RequiredValidator);
export { RequiredValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92Y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ZGVsXG4gICAqXG4gICAqIEBwYXJhbSB7c3RyaW5nfSB2YWx1ZVxuICAgKiBAcGFyYW0ge3N0cmluZ30gW21lc3NhZ2VdXG4gICAqXG4gICAqIEByZXR1cm4gRXJyb3JzXG4gICAqXG4gICAqIEBvdmVycmlkZVxuICAgKlxuICAgKiBAc2VlIFZhbGlkYXRvciNoYXNFcnJvcnNcbiAgICovXG4gIHB1YmxpYyBoYXNFcnJvcnModmFsdWU6IGFueSwgbWVzc2FnZT86IHN0cmluZyk6IEVycm9ycyB7XG4gICAgc3dpdGNoICh0eXBlb2YgdmFsdWUpIHtcbiAgICAgIGNhc2UgXCJib29sZWFuXCI6XG4gICAgICBjYXNlIFwibnVtYmVyXCI6XG4gICAgICAgIHJldHVybiB0eXBlb2YgdmFsdWUgPT09IFwidW5kZWZpbmVkXCJcbiAgICAgICAgICA/IHRoaXMuZ2V0TWVzc2FnZShtZXNzYWdlIHx8IHRoaXMubWVzc2FnZSlcbiAgICAgICAgICA6IHVuZGVmaW5lZDtcbiAgICAgIGRlZmF1bHQ6XG4gICAgICAgIHJldHVybiAhdmFsdWUgPyB0aGlzLmdldE1lc3NhZ2UobWVzc2FnZSB8fCB0aGlzLm1lc3NhZ2UpIDogdW5kZWZpbmVkO1xuICAgIH1cbiAgfVxufVxuIl19

@@ -1,1 +0,54 @@

import{Validator}from"./Validator";import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";class StepValidator extends Validator{constructor(r=DEFAULT_ERROR_MESSAGES.STEP){super(ValidationKeys.STEP,r,"number","string")}hasErrors(r,t,a){return void 0!==r&&Number(r)%Number(t)!=0?this.getMessage(a||this.message,t):void 0}}export{StepValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Validator } from "./Validator";
import { ValidationKeys, DEFAULT_ERROR_MESSAGES } from "./constants";
import { validator } from "./decorators";
/**
* @summary Step Validator
*
* @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#STEP}
*
* @class StepValidator
* @extends Validator
*
* @category Validators
*/
let StepValidator = class StepValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.STEP) {
super(ValidationKeys.STEP, message, "number", "string");
}
/**
* @summary Validates a model
*
* @param {string} value
* @param {number} step
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, step, message) {
if (value === undefined)
return;
return Number(value) % Number(step) !== 0
? this.getMessage(message || this.message, step)
: undefined;
}
};
StepValidator = __decorate([
validator(ValidationKeys.STEP),
__metadata("design:paramtypes", [String])
], StepValidator);
export { StepValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvU3RlcFZhbGlkYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQ3hDLE9BQU8sRUFBRSxjQUFjLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFckUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUV6Qzs7Ozs7Ozs7O0dBU0c7QUFFSSxJQUFNLGFBQWEsR0FBbkIsTUFBTSxhQUFjLFNBQVEsU0FBUztJQUMxQyxZQUFZ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nZXRNZXNzYWdlKG1lc3NhZ2UgfHwgdGhpcy5tZXNzYWdlLCBzdGVwKVxuICAgICAgOiB1bmRlZmluZWQ7XG4gIH1cbn1cbiJdfQ==
import { Validator } from "./Validator";
import { IRegistry } from "../../utils";
import { Constructor } from "../../model";
import { IRegistry } from "../../utils/registry";
import { Constructor } from "../../model/types";
/**

@@ -5,0 +5,0 @@ * @summary Util type for {@link Validator} configuration

@@ -1,1 +0,42 @@

import{Validator}from"./Validator";import{evaluateDesignTypes}from"../../utils";import{DEFAULT_ERROR_MESSAGES}from"./constants";import{ModelKeys}from"../../utils/constants";class TypeValidator extends Validator{constructor(t=DEFAULT_ERROR_MESSAGES.TYPE){super(ModelKeys.TYPE,t)}hasErrors(t,e,r){return void 0===t||evaluateDesignTypes(t,e)?void 0:this.getMessage(r||this.message,"string"==typeof e?e:Array.isArray(e)?e.join(", "):e.name,typeof t)}}export{TypeValidator};
import { Validator } from "./Validator";
import { DEFAULT_ERROR_MESSAGES } from "./constants";
import { ModelKeys } from "../../utils/constants";
import { evaluateDesignTypes } from "../../reflection/utils";
/**
* @summary Required Validator
*
* @class RequiredValidator
* @extends Validator
*
* @category Validators
*/
// @validator(ValidationKeys.TYPE)
export class TypeValidator extends Validator {
constructor(message = DEFAULT_ERROR_MESSAGES.TYPE) {
super(ModelKeys.TYPE, message);
}
/**
* @summary Validates a model
* @param {string} value
* @param {string | string[] | {name: string}} types
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, types, message) {
if (value === undefined)
return; // Dont try and enforce type if undefined
if (!evaluateDesignTypes(value, types))
return this.getMessage(message || this.message, typeof types === "string"
? types
: Array.isArray(types)
? types.join(", ")
: types.name, typeof value);
}
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvVHlwZVZhbGlkYXRvci50cyJdLCJuYW1lcyI6W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KlxuICAgKiBAcmV0dXJuIEVycm9yc1xuICAgKlxuICAgKiBAb3ZlcnJpZGVcbiAgICpcbiAgICogQHNlZSBWYWxpZGF0b3IjaGFzRXJyb3JzXG4gICAqL1xuICBwdWJsaWMgaGFzRXJyb3JzKFxuICAgIHZhbHVlOiBhbnksXG4gICAgdHlwZXM6IHN0cmluZyB8IHN0cmluZ1tdIHwgeyBuYW1lOiBzdHJpbmcgfSxcbiAgICBtZXNzYWdlPzogc3RyaW5nLFxuICApOiBFcnJvcnMge1xuICAgIGlmICh2YWx1ZSA9PT0gdW5kZWZpbmVkKSByZXR1cm47IC8vIERvbnQgdHJ5IGFuZCBlbmZvcmNlIHR5cGUgaWYgdW5kZWZpbmVkXG4gICAgaWYgKCFldmFsdWF0ZURlc2lnblR5cGVzKHZhbHVlLCB0eXBlcykpXG4gICAgICByZXR1cm4gdGhpcy5nZXRNZXNzYWdlKFxuICAgICAgICBtZXNzYWdlIHx8IHRoaXMubWVzc2FnZSxcbiAgICAgICAgdHlwZW9mIHR5cGVzID09PSBcInN0cmluZ1wiXG4gICAgICAgICAgPyB0eXBlc1xuICAgICAgICAgIDogQXJyYXkuaXNBcnJheSh0eXBlcylcbiAgICAgICAgICAgID8gdHlwZXMuam9pbihcIiwgXCIpXG4gICAgICAgICAgICA6IHR5cGVzLm5hbWUsXG4gICAgICAgIHR5cGVvZiB2YWx1ZSxcbiAgICAgICk7XG4gIH1cbn1cbiJdfQ==

@@ -13,3 +13,2 @@ import { Errors } from "../types";

export declare class URLValidator extends PatternValidator {
private static readonly urlPattern;
constructor(message?: string);

@@ -16,0 +15,0 @@ /**

@@ -1,1 +0,48 @@

import{ValidationKeys,DEFAULT_ERROR_MESSAGES}from"./constants";import{PatternValidator}from"./PatternValidator";class URLValidator extends PatternValidator{static{this.urlPattern=/^(?:(?:(?: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}constructor(a=DEFAULT_ERROR_MESSAGES.URL){super(ValidationKeys.URL,a)}hasErrors(a,t){return super.hasErrors(a,URLValidator.urlPattern,t)}}export{URLValidator};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { ValidationKeys, DEFAULT_ERROR_MESSAGES, DEFAULT_PATTERNS, } from "./constants";
import { PatternValidator } from "./PatternValidator";
import { validator } from "./decorators";
/**
* @summary URL Validator
* @description Pattern from {@link https://gist.github.com/dperini/729294}
*
* @class URLValidator
* @extends PatternValidator
*
* @category Validators
*/
let URLValidator = class URLValidator extends PatternValidator {
constructor(message = DEFAULT_ERROR_MESSAGES.URL) {
super(ValidationKeys.URL, message);
}
/**
* @summary Validates a model
*
* @param {string} value
* @param {string} [message]
*
* @return Errors
*
* @override
*
* @see Validator#hasErrors
*/
hasErrors(value, message) {
return super.hasErrors(value, DEFAULT_PATTERNS.URL, message);
}
};
URLValidator = __decorate([
validator(ValidationKeys.URL),
__metadata("design:paramtypes", [String])
], URLValidator);
export { URLValidator };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvVVJMVmFsaWRhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7OztBQUFBLE9BQU8sRUFDTCxjQUFjLEVBQ2Qsc0JBQXNCLEVBQ3RCLGdCQUFnQixHQUNqQixNQUFNLGFBQWEsQ0FBQztBQUVyQixPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBRXpDOzs7Ozs7OztHQVFHO0FBRUksSUFBTSxZQUFZLEdBQWxCLE1BQU0sWUFBYSxTQUFRLGdCQUFnQjtJQUNoRCxZQUFZLFVBQWtCLHNCQUFzQixDQUFDLEdBQUc7UUFDdEQsS0FBSyxDQUFDLGNBQWMsQ0FBQyxHQUFHLEVBQUUsT0FBTyxDQUFDLENBQUM7SUFDckMsQ0FBQztJQUVEOzs7Ozs7Ozs7OztPQVdHO0lBQ0ksU0FBUyxDQUFDLEtBQWEsRUFBRSxPQUFnQjtRQUM5QyxPQUFPLEtBQUssQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLGdCQUFnQixDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQztJQUMvRCxDQUFDO0NBQ0YsQ0FBQTtBQXBCWSxZQUFZO0lBRHhCLFNBQVMsQ0FBQyxjQUFjLENBQUMsR0FBRyxDQUFDOztHQUNqQixZQUFZLENBb0J4QiIsImZpbGUiOiJ2YWxpZGF0aW9uL1ZhbGlkYXRvcnMvVVJMVmFsaWRhdG9yLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHt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AgKlxuICAgKiBAc2VlIFZhbGlkYXRvciNoYXNFcnJvcnNcbiAgICovXG4gIHB1YmxpYyBoYXNFcnJvcnModmFsdWU6IHN0cmluZywgbWVzc2FnZT86IHN0cmluZyk6IEVycm9ycyB7XG4gICAgcmV0dXJuIHN1cGVyLmhhc0Vycm9ycyh2YWx1ZSwgREVGQVVMVF9QQVRURVJOUy5VUkwsIG1lc3NhZ2UpO1xuICB9XG59XG4iXX0=

@@ -1,1 +0,50 @@

import{checkTypes,stringFormat}from"../../utils";import{DEFAULT_ERROR_MESSAGES}from"./constants";class Validator{constructor(s,t=DEFAULT_ERROR_MESSAGES.DEFAULT,...e){this.validationKey=s,this.message=t,e.length&&(this.acceptedTypes=e),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(s,...t){return stringFormat(s,...t)}checkTypeAndHasErrors(e){return function(s,...t){return void 0===s||!this.acceptedTypes||checkTypes(s,this.acceptedTypes)?e(s,...t):this.getMessage(DEFAULT_ERROR_MESSAGES.TYPE,this.acceptedTypes.join(", "),typeof s)}.bind(this)}}export{Validator};
import { DEFAULT_ERROR_MESSAGES } from "./constants";
import { sf } from "../../utils/strings";
import { checkTypes } from "../../reflection/utils";
/**
* @summary Base Implementation for Validators
* @description Provides the underlying functionality for {@link Validator}s
*
* @param {string} validationKey the key to register the validator under
* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#DEFAULT}
* @param {string[]} [acceptedTypes] defines the value types this validator can validate
*
* @class Validator
* @abstract
* @category Validators
*/
export class Validator {
constructor(validationKey, message = DEFAULT_ERROR_MESSAGES.DEFAULT, ...acceptedTypes) {
this.validationKey = validationKey;
this.message = message;
if (acceptedTypes.length)
this.acceptedTypes = acceptedTypes;
if (this.acceptedTypes)
this.hasErrors = this.checkTypeAndHasErrors(this.hasErrors.bind(this));
}
/**
* @summary builds the error message
* @param {string} message
* @param {any[]} args
* @protected
*/
getMessage(message, ...args) {
return sf(message, ...args);
}
/**
* @summary Validates type
* @param {any} unbound
* @private
*/
checkTypeAndHasErrors(unbound) {
return function (value, ...args) {
if (value === undefined || !this.acceptedTypes)
return unbound(value, ...args);
if (!checkTypes(value, this.acceptedTypes))
return this.getMessage(DEFAULT_ERROR_MESSAGES.TYPE, this.acceptedTypes.join(", "), typeof value);
return unbound(value, ...args);
}.bind(this);
}
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvVmFsaWRhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxzQkFBc0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNyRCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDekMsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRXBEOzs7Ozs7Ozs7OztHQVdHO0FBQ0gsTUFBTSxPQUFnQixTQUFTO0lBSzdCLFlBQ0UsYUFBcUIsRUFDckIsVUFBa0Isc0JBQXNCLENBQUMsT0FBTyxFQUNoRCxHQUFHLGFBQXVCO1FBRTFCLElBQUksQ0FBQyxhQUFhLEdBQUcsYUFBYSxDQUFDO1FBQ25DLElBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDO1FBRXZCLElBQUksYUFBYSxDQUFDLE1BQU07WUFBRSxJQUFJLENBQUMsYUFBYSxHQUFHLGFBQWEsQ0FBQztRQUM3RCxJQUFJLElBQUksQ0FBQyxhQUFhO1lBQ3BCLElBQUksQ0FBQyxTQUFTLEdBQUcsSUFBSSxDQUFDLHFCQUFxQixDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUM7SUFDM0UsQ0FBQztJQUVEOzs7OztPQUtHO0lBQ08sVUFBV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Jncyk7XG4gICAgICBpZiAoIWNoZWNrVHlwZXModmFsdWUsIHRoaXMuYWNjZXB0ZWRUeXBlcykpXG4gICAgICAgIHJldHVybiB0aGlzLmdldE1lc3NhZ2UoXG4gICAgICAgICAgREVGQVVMVF9FUlJPUl9NRVNTQUdFUy5UWVBFLFxuICAgICAgICAgIHRoaXMuYWNjZXB0ZWRUeXBlcy5qb2luKFwiLCBcIiksXG4gICAgICAgICAgdHlwZW9mIHZhbHVlLFxuICAgICAgICApO1xuICAgICAgcmV0dXJuIHVuYm91bmQodmFsdWUsIC4uLmFyZ3MpO1xuICAgIH0uYmluZCh0aGlzKTtcbiAgfVxuXG4gIC8qKlxuICAgKiBAc3VtbWFyeSBWYWxpZGF0ZXMgYW4gYXR0cmlidXRlXG4gICAqIEBwYXJhbSB7YW55fSB2YWx1ZVxuICAgKiBAcGFyYW0ge2FueVtdfSBhcmdzXG4gICAqXG4gICAqIEBhYnN0cmFjdFxuICAgKlxuICAgKiBAc2VlIE1vZGVsI2hhc0Vycm9yc1xuICAgKi9cbiAgcHVibGljIGFic3RyYWN0IGhhc0Vycm9ycyh2YWx1ZTogYW55LCAuLi5hcmdzOiBhbnlbXSk6IEVycm9ycztcbn1cbiJdfQ==

@@ -1,1 +0,81 @@

function isValidator(t){return t.constructor&&t.hasErrors}class ValidatorRegistry{constructor(...t){this.cache={},this.customKeyChache={},this.register(...t)}getCustomKeys(){return Object.assign({},this.customKeyChache)}getKeys(){return Object.keys(this.cache)}get(t){var e;if(t in this.cache)return isValidator(e=this.cache[t])?e:(e=new(e.default||e),this.cache[t]=e)}register(...t){t.forEach(t=>{var e,a;isValidator(t)?t.validationKey in this.cache||(this.cache[t.validationKey]=t):({validationKey:t,validator:a,save:e}=t,t in this.cache||(this.cache[t]=a,e&&((a={})[t.toUpperCase()]=t,this.customKeyChache=Object.assign({},this.customKeyChache,a))))})}}export{isValidator,ValidatorRegistry};
/**
* @summary Duck typing for Validators
* @function isValidator
* @param val
*/
export function isValidator(val) {
return val.constructor && val["hasErrors"];
}
/**
* @summary Base Implementation of a Validator Registry
*
* @prop {Validator[]} [validators] the initial validators to register
*
* @class ValidatorRegistry
* @implements IValidatorRegistry<T>
*
* @category Validation
*/
export class ValidatorRegistry {
constructor(...validators) {
this.cache = {};
this.customKeyChache = {};
this.register(...validators);
}
/**
* @summary retrieves the custom keys
*/
getCustomKeys() {
return Object.assign({}, this.customKeyChache);
}
/**
* @summary retrieves the registered validators keys
*/
getKeys() {
return Object.keys(this.cache);
}
/**
* @summary Retrieves a validator
*
* @param {string} validatorKey one of the {@link ValidationKeys}
* @return {Validator | undefined} the registered Validator or undefined if there is nono matching the provided key
*/
get(validatorKey) {
if (!(validatorKey in this.cache))
return undefined;
const classOrInstance = this.cache[validatorKey];
if (isValidator(classOrInstance))
return classOrInstance;
const constructor = classOrInstance.default || classOrInstance;
const instance = new constructor();
this.cache[validatorKey] = instance;
return instance;
}
/**
* @summary Registers the provided validators onto the registry
*
* @param {T[] | ValidatorDefinition[]} validator
*/
register(...validator) {
validator.forEach((v) => {
if (isValidator(v)) {
if (v.validationKey in this.cache)
return;
this.cache[v.validationKey] = v;
}
else {
const { validationKey, validator, save } = v;
if (validationKey in this.cache)
return;
this.cache[validationKey] = validator;
if (!save)
return;
const obj = {};
obj[validationKey.toUpperCase()] = validationKey;
this.customKeyChache = Object.assign({}, this.customKeyChache, obj);
}
});
}
}
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy92YWxpZGF0aW9uL1ZhbGlkYXRvcnMvVmFsaWRhdG9yUmVnaXN0cnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUE7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxXQUFXLENBQUMsR0FBUTtJQUNsQyxPQUFPLEdBQUcsQ0FBQyxXQUFXLElBQUksR0FBRyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQzdDLENBQUM7QUFFRDs7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ICAgICBjb25zdCBvYmo6IFJlY29yZDxzdHJpbmcsIHN0cmluZz4gPSB7fTtcbiAgICAgICAgb2JqW3ZhbGlkYXRpb25LZXkudG9VcHBlckNhc2UoKV0gPSB2YWxpZGF0aW9uS2V5O1xuXG4gICAgICAgIHRoaXMuY3VzdG9tS2V5Q2hhY2hlID0gT2JqZWN0LmFzc2lnbih7fSwgdGhpcy5jdXN0b21LZXlDaGFjaGUsIG9iaik7XG4gICAgICB9XG4gICAgfSk7XG4gIH1cbn1cbiJdfQ==

@@ -23,2 +23,6 @@ /**

/**
* @namespace Reflections
* @memberOf module:decorator-validation.Reflections
*/
/**
* @namespace Construction

@@ -60,4 +64,5 @@ * @memberOf module:decorator-validation

export * from "./utils";
export * from "./reflection";
export * from "./validation";
export * from "./model";
export declare const VERSION = "1.0.7";
export declare const VERSION = "1.0.11";

@@ -20,2 +20,3 @@ /**

* @description
*
* - Registers the class under the model registry so it can be easily rebuilt;

@@ -27,9 +28,8 @@ * - Overrides the class constructor;

*
* @prop {Record<string, any>} [props] additional properties to store as metadata
* @prop {InstanceCallback} [instanceCallback] optional callback that will be call with the instance upon instantiation. defaults to undefined
* @param {Record<string, any>} [props] additional properties to store as metadata
* @param {InstanceCallback} [instanceCallback] optional callback that will be called with the instance upon instantiation. defaults to undefined
*
* @function model
* @memberOf module:decorator-validation.Decorators.Model
* @category Decorators
*/
export declare function model(props?: Record<string, any>, instanceCallback?: InstanceCallback): (original: any) => any;

@@ -0,7 +1,7 @@

export * from "./constants";
export * from "./construction";
export * from "./Registry";
export * from "./decorators";
export * from "./Model";
export * from "./ModelErrorDefinition";
export * from "./Registry";
export * from "./types";
export * from "./Model";
export * from "./constants";

@@ -1,5 +0,7 @@

import { BuilderRegistry, HashingFunction, Serializer } from "../utils";
import { Serializer } from "../utils/serialization";
import { BuilderRegistry } from "../utils/registry";
import { ModelErrorDefinition } from "./ModelErrorDefinition";
import { ModelArg, ModelConstructor, Serializable, Validatable } from "./types";
import { ModelBuilderFunction } from "./construction";
import { HashingFunction } from "../utils/hashing";
/**

@@ -6,0 +8,0 @@ * @summary Analyses the decorations of the properties and validates the obj according to them

@@ -1,2 +0,2 @@

import { Errors, ModelErrors } from "../validation";
import { Errors, ModelErrors } from "../validation/types";
/**

@@ -3,0 +3,0 @@ * @summary Helper Class to hold the error results

import { Model } from "./Model";
import { BuilderRegistry } from "../utils";
import { BuilderRegistry } from "../utils/registry";
import { Constructor, ModelConstructor } from "./types";

@@ -4,0 +4,0 @@ /**

@@ -1,4 +0,8 @@

export * from "./general";
export * from "./constants";
export * from "./dates";
export * from "./equality";
export * from "./hashing";
export * from "./serialization";
export * from "./registry";
export * from "./serialization";
export * from "./constants";
export * from "./strings";
import "reflect-metadata";
import { Validator } from "./Validators";
import { Constructor, ModelConstructor } from "../model";
import { Constructor, ModelConstructor } from "../model/types";
import { Validator } from "./Validators/Validator";
/**

@@ -20,9 +20,8 @@ * @summary Builds the key to store as Metadata under Reflections

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#REQUIRED}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link RequiredValidator}
*
* @function required
* @memberOf module:decorator-validation.Decorators.Validation
*
* @category Decorators
*/
export declare function required(message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function required(message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -34,3 +33,2 @@ * @summary Defines a minimum value for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link MinValidator}
*

@@ -41,3 +39,3 @@ * @function min

*/
export declare function min(value: number | Date | string, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function min(value: number | Date | string, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -49,3 +47,2 @@ * @summary Defines a maximum value for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link MaxValidator}
*

@@ -56,3 +53,3 @@ * @function max

*/
export declare function max(value: number | Date | string, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function max(value: number | Date | string, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -64,3 +61,2 @@ * @summary Defines a step value for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#STEP}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link StepValidator}
*

@@ -71,3 +67,3 @@ * @function step

*/
export declare function step(value: number, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function step(value: number, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -79,3 +75,2 @@ * @summary Defines a minimum length for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN_LENGTH}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link MinLengthValidator}
*

@@ -86,3 +81,3 @@ * @function minlength

*/
export declare function minlength(value: number, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function minlength(value: number, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -94,3 +89,2 @@ * @summary Defines a maximum length for the property

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX_LENGTH}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link MaxLengthValidator}
*

@@ -101,3 +95,3 @@ * @function maxlength

*/
export declare function maxlength(value: number, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function maxlength(value: number, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -109,3 +103,2 @@ * @summary Defines a RegExp pattern the property must respect

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PATTERN}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link PatternValidator}
*

@@ -116,3 +109,3 @@ * @function pattern

*/
export declare function pattern(value: RegExp | string, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function pattern(value: RegExp | string, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -123,3 +116,2 @@ * @summary Defines the property as an email

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#EMAIL}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link EmailValidator}
*

@@ -130,3 +122,3 @@ * @function email

*/
export declare function email(message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function email(message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -137,3 +129,2 @@ * @summary Defines the property as an URL

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#URL}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link URLValidator}
*

@@ -144,3 +135,3 @@ * @function url

*/
export declare function url(message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function url(message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**

@@ -152,3 +143,2 @@ * @summary Enforces type verification

* @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#TYPE}
* @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link TypeValidator}
*

@@ -159,67 +149,4 @@ * @function type

*/
export declare function type(types: string[] | string, message?: string, validator?: Constructor<Validator>): (target: any, propertyKey: string) => void;
export declare function type(types: string[] | string, message?: string): import("../reflection/decorators").CustomDecorator<V>;
/**
* @summary Binds a date format to a string
* @param {Date} [date]
* @param {string} [format]
* @memberOf module:decorator-validation.Utils.Format
* @category Utilities
*/
export declare function bindDateToString(date: Date | undefined, format: string): Date | undefined;
/**
* @summary Helper function to be used instead of instanceOf Date
* @param date
* @memberOf module:decorator-validation.Utils.Dates
* @category Validation
*/
export declare function isValidDate(date: any): boolean;
/**
* @summary Util function to pad numbers
* @param {number} num
*
* @return {string}
*
* @function twoDigitPad
* @memberOf module:decorator-validation.Utils.Format
* @category Format
*/
export declare function twoDigitPad(num: number): string;
/**
* @summary Date Format Handling
* @description Code from {@link https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date}
*
* <pre>
* Using similar formatting as Moment.js, Class DateTimeFormatter (Java), and Class SimpleDateFormat (Java),
* I implemented a comprehensive solution formatDate(date, patternStr) where the code is easy to read and modify.
* You can display date, time, AM/PM, etc.
*
* Date and Time Patterns
* yy = 2-digit year; yyyy = full year
* M = digit month; MM = 2-digit month; MMM = short month name; MMMM = full month name
* EEEE = full weekday name; EEE = short weekday name
* d = digit day; dd = 2-digit day
* h = hours am/pm; hh = 2-digit hours am/pm; H = hours; HH = 2-digit hours
* m = minutes; mm = 2-digit minutes; aaa = AM/PM
* s = seconds; ss = 2-digit seconds
* S = miliseconds
* </pre>
*
* @param {Date} date
* @param {string} [patternStr] defaults to 'yyyy/MM/dd'
* @return {string} the formatted date
*
* @function formatDate
* @memberOf module:decorator-validation.Utils.Dates
* @category Format
*/
export declare function formatDate(date: Date, patternStr?: string): string;
/**
* @summary Parses a date from a specified format
* @param {string} format
* @param {string | Date | number} [v]
* @memberOf module:decorator-validation.Utils.Dates
* @category Format
*/
export declare function parseDate(format: string, v?: string | Date | number): Date | undefined;
/**
* @summary Date Handler Decorator

@@ -239,3 +166,3 @@ * @description Validators to validate a decorated property must use key {@link ValidationKeys#DATE}

*/
export declare function date(format?: string, message?: string, validator?: Constructor<Validator>): (target: Record<string, any>, propertyKey: string) => any;
export declare function date(format?: string, message?: string): (target: Record<string, any>, propertyKey: string) => any;
/**

@@ -242,0 +169,0 @@ * @summary Password Handler Decorator

@@ -1,13 +0,4 @@

export * from "./types";
export * from "./Validators";
import { ValidatorRegistry } from "./Validators";
/**
* @summary exports the Validator Registry
* @constant ValidatorRegistryImp
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const ValidatorRegistryImp: typeof ValidatorRegistry;
export * as Decorators from "./decorators";
export * from "./decorators";
export * from "./types";
export * from "./Validation";

@@ -8,2 +8,13 @@ /**

/**
* @summary Type for validation decorator metadata
* @memberOf module:decorator-validation.Reflection
* @category Reflection
*/
export type ValidationMetadata = {
[indexer: string]: any;
args?: any[];
message: string;
types?: string[];
};
/**
* @summary Type for decorator metadata

@@ -10,0 +21,0 @@ * @memberOf module:decorator-validation.Reflection

@@ -1,2 +0,3 @@

import { IValidatorRegistry, Validator, ValidatorDefinition } from "./Validators";
import { Validator } from "./Validators/Validator";
import { IValidatorRegistry, ValidatorDefinition } from "./Validators/types";
/**

@@ -3,0 +4,0 @@ * @summary Static class acting as a namespace for the Validation

@@ -83,10 +83,14 @@ /**

/**
* @summary Defines a Password validation regexp
* @summary Defines the various default regexp patterns used
*
* @enum DEFAULT_ERROR_MESSAGES
* @enum DEFAULT_PATTERNS
* @memberOf module:decorator-validation.Validation
* @category Validation
*/
export declare const PasswordPatterns: {
CHAR8_ONE_OF_EACH: RegExp;
export declare const DEFAULT_PATTERNS: {
EMAIL: RegExp;
URL: RegExp;
PASSWORD: {
CHAR8_ONE_OF_EACH: RegExp;
};
};

@@ -14,3 +14,2 @@ import { Errors } from "../types";

export declare class EmailValidator extends PatternValidator {
private static readonly emailPat;
constructor(message?: string);

@@ -17,0 +16,0 @@ /**

@@ -15,7 +15,6 @@ import { DateValidator } from "./DateValidator";

export * from "./constants";
export * from "./Validator";
export * from "./types";
export * from "./ValidatorRegistry";
export * from "./DateValidator";
export * from "./decorators";
export * from "./EmailValidator";
export * from "./RequiredValidator";
export * from "./ListValidator";
export * from "./MaxLengthValidator";

@@ -25,8 +24,11 @@ export * from "./MaxValidator";

export * from "./MinValidator";
export * from "./PasswordValidator";
export * from "./PatternValidator";
export * from "./URLValidator";
export * from "./RequiredValidator";
export * from "./StepValidator";
export * from "./DateValidator";
export * from "./types";
export * from "./TypeValidator";
export * from "./PasswordValidator";
export * from "./URLValidator";
export * from "./Validator";
export * from "./ValidatorRegistry";
/**

@@ -33,0 +35,0 @@ * @summary constant holding all {@link Validator}s

import { Validator } from "./Validator";
import { Errors } from "../types";
export declare const regexpParser: RegExp;
/**

@@ -15,3 +16,2 @@ * @summary Pattern Validator

export declare class PatternValidator extends Validator {
private static readonly regexpParser;
constructor(key?: string, message?: string);

@@ -24,3 +24,3 @@ /**

*/
private static getPattern;
private getPattern;
/**

@@ -39,3 +39,3 @@ * @summary Validates a Model

*/
hasErrors(value: string, pattern: RegExp | string, message?: string): Errors;
hasErrors(value: string, pattern?: RegExp | string, message?: string): Errors;
}
import { Validator } from "./Validator";
import { IRegistry } from "../../utils";
import { Constructor } from "../../model";
import { IRegistry } from "../../utils/registry";
import { Constructor } from "../../model/types";
/**

@@ -5,0 +5,0 @@ * @summary Util type for {@link Validator} configuration

@@ -13,3 +13,2 @@ import { Errors } from "../types";

export declare class URLValidator extends PatternValidator {
private static readonly urlPattern;
constructor(message?: string);

@@ -16,0 +15,0 @@ /**

{
"name": "@decaf-ts/decorator-validation",
"version": "1.0.7",
"version": "1.0.11",
"description": "simple decorator based validation engine",

@@ -22,2 +22,3 @@ "type": "module",

"lint-fix": "eslint . && eslint --fix ./src/*",
"test:circular": "dpdm -T --no-warning --no-tree ./src/index.ts",
"prepare-release": "npm run lint-fix && npm run build:prod && npm run test && npm run docs",

@@ -61,9 +62,10 @@ "release": "./bin/tag-release.sh",

"devDependencies": {
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.13",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"clean-publish": "^4.3.0",
"clean-publish": "^5.0.0",
"dpdm": "^3.14.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"gulp": "^4.0.2",
"gulp": "^5.0.0",
"gulp-if": "^3.0.0",

@@ -79,21 +81,23 @@ "gulp-rename": "^2.0.0",

"jest-junit": "^16.0.0",
"jsdoc": "^4.0.2",
"jsdoc": "^4.0.3",
"jsdoc-mermaid": "^1.0.0",
"markdown-include": "^0.4.3",
"merge-stream": "^2.0.0",
"nodemon": "^3.1.0",
"npm-check-updates": "^16.14.15",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.2",
"nodemon": "^3.1.7",
"npm-check-updates": "^17.1.3",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.2",
"typescript": "^5.6.2",
"vinyl-named": "^1.1.0",
"webpack-stream": "^7.0.0"
},
"peerDependencies": {
"reflect-metadata": "^0.2.1"
},
"dependencies": {
"install": "^0.13.0",
"reflect-metadata": "^0.2.1"
"install": "^0.13.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc