@qubit-ltd/common-decorator 3.10.8 → 3.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common-decorator.cjs +20 -22
- package/dist/common-decorator.cjs.map +1 -1
- package/dist/common-decorator.min.cjs +1 -1
- package/dist/common-decorator.min.cjs.map +1 -1
- package/dist/common-decorator.min.mjs +1 -1
- package/dist/common-decorator.min.mjs.map +1 -1
- package/dist/common-decorator.mjs +20 -22
- package/dist/common-decorator.mjs.map +1 -1
- package/doc/api/DefaultAssignmentOptions.html +1 -1
- package/doc/api/DefaultOptions.html +1 -1
- package/doc/api/DefaultToJsonOptions.html +1 -1
- package/doc/api/Enum.html +1 -1
- package/doc/api/Model.html +1 -1
- package/doc/api/Page.html +1 -1
- package/doc/api/global.html +1 -1
- package/doc/api/index.html +1 -1
- package/doc/common-decorator.min.visualization.html +1 -1
- package/doc/common-decorator.visualization.html +1 -1
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
|
11
11
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
12
12
|
var namingStyle = require('@qubit-ltd/naming-style');
|
|
13
13
|
var Json = require('@qubit-ltd/json');
|
|
14
|
-
var
|
|
14
|
+
var validationRule = require('@qubit-ltd/validation-rule');
|
|
15
15
|
|
|
16
16
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
17
17
|
|
|
@@ -89,10 +89,10 @@ function requireSharedStore () {
|
|
|
89
89
|
var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
|
|
90
90
|
|
|
91
91
|
(store.versions || (store.versions = [])).push({
|
|
92
|
-
version: '3.
|
|
92
|
+
version: '3.48.0',
|
|
93
93
|
mode: IS_PURE ? 'pure' : 'global',
|
|
94
|
-
copyright: '©
|
|
95
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
94
|
+
copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
|
|
95
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE',
|
|
96
96
|
source: 'https://github.com/zloirock/core-js'
|
|
97
97
|
});
|
|
98
98
|
return sharedStore.exports;
|
|
@@ -4854,8 +4854,6 @@ function toJsonStringImpl(Class, obj, options) {
|
|
|
4854
4854
|
return Json.stringify(target, null, opt.space);
|
|
4855
4855
|
}
|
|
4856
4856
|
|
|
4857
|
-
function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var E,w={};var L,b,F,A,$,_,q,N,P,V,v,k,O,H,x,T,j,z,M,Z,G,W,B,K,Q,Y,X,J;getDefaultExportFromCjs(function requireEmailValidator(){if(E)return w;E=1;var e=/^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;return w.validate=function(t){if(!t)return false;if(t.length>254)return false;if(!e.test(t))return false;var r=t.split("@");return !(r[0].length>64)&&!r[1].split(".").some((function(e){return e.length>63}))},w}());function requireObject(){if(b)return L;b=1;const e=function exists(e){return !(null==e||Number.isNaN(e))};return L=Object.freeze({exists:e,is:function is(t,r){return e(t)&&e(r)&&(r.constructor===t||r instanceof t)}})}function requireCast(){if(A)return F;A=1;const{is:e,exists:t}=requireObject(),r=function number(r){let n;if(t(r)){const t=r.valueOf();if(e(Number,t))Number.isFinite(t)&&(n=t);else if(e(String,t)||e(Boolean,t)){const e=Number(t);Number.isFinite(e)&&(n=e);}}return n},n=function integer(e){const t=r(e);let n;if(void 0!==t){const e=parseInt(t,10);Number.isNaN(e)||(n=e);}return n};return F=Object.freeze({number:r,num:function num(e,{ge:t,le:n}={}){let i=r(e);if(void 0!==i){const e=r(n),o=r(t);void 0!==e&&void 0!==o?(i<o||i>e)&&(i=void 0):(void 0!==e&&i>e||void 0!==o&&i<o)&&(i=void 0);}return i},int:function int(e,{le:t,ge:r}={}){let i=n(e);if(void 0!==i){const e=n(t),o=n(r);void 0!==e&&void 0!==o?(i<o||i>e)&&(i=void 0):(void 0!==e&&i>e||void 0!==o&&i<o)&&(i=void 0);}return i},integer:n})}function requireHelpers(){if(_)return $;_=1;const e=requireCast(),t=requireObject();return $=Object.freeze({cast:e,object:t})}function requireIp(){if(N)return q;N=1;const{object:{is:e}}=requireHelpers(),t="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",r="[a-fA-F\\d]{1,4}",n=`\n(\n(?:${r}:){7}(?:${r}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${r}:){6}(?:${t}|:${r}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${r}:){5}(?::${t}|(:${r}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${r}:){4}(?:(:${r}){0,1}:${t}|(:${r}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${r}:){3}(?:(:${r}){0,2}:${t}|(:${r}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${r}:){2}(?:(:${r}){0,3}:${t}|(:${r}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${r}:){1}(?:(:${r}){0,4}:${t}|(:${r}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::((?::${r}){0,5}:${t}|(?::${r}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim();return q=Object.freeze({isIP:function isIP(r){return !!e(String,r)&&new RegExp(`(?:^${t}$)|(?:^${n}$)`).test(r)},isIPv4:function isIPv4(r){return !!e(String,r)&&new RegExp(`^${t}$`).test(r)},isIPv6:function isIPv6(t){return !!e(String,t)&&new RegExp(`^${n}$`).test(t)}})}function requirePunycode(){if(V)return P;V=1;const{domainToASCII:e,domainToUnicode:t}=o,{isIPv6:r}=requireIp(),{object:{is:n}}=requireHelpers();return P=Object.freeze({punycode:function punycode(t){return r(t)?t:n(String,t)?e(t):""},punydecode:function punydecode(e){return r(e)?e:n(String,e)?t(e):""}}),P}function requireConfig(){if(k)return v;k=1;return v=Object.freeze({maxLengthURL:2048,minPortInteger:0,maxPortInteger:65535})}function requireParser(){if(H)return O;H=1;const{punycode:e,punydecode:t}=requirePunycode(),{isIPv6:r}=requireIp(),{cast:{int:n},object:{exists:i,is:o}}=requireHelpers(),{minPortInteger:u,maxPortInteger:s}=requireConfig(),c=/^(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,a=/^(?:\[([^\]]+)\]:?)([0-9]+)?$/,h=function hostToURI(e){return o(String,e)?r(e)?`[${e}]`:e:""},d=function recomposeURI(e){const t=e||{};if(!(o(String,t.scheme)&&t.scheme.length>0&&o(String,t.path)))return "";let r=t.scheme;if(o(String,t.host)){if(""!==t.path&&!t.path.startsWith("/"))return "";if(t.host.length<=2)return "";r+="://",o(String,t.userinfo)&&t.userinfo.length>0&&(r+=`${t.userinfo}@`),r+=h(t.host),i(t.port)&&void 0!==n(t.port,{ge:u,le:s})&&(r+=`:${t.port}`);}else {if(t.path.startsWith("//"))return "";r+=":";}return ""===t.path&&o(String,t.host)?r+="/":r+=t.path,o(String,t.query)&&t.query.length>0&&(r+=`?${t.query}`),o(String,t.fragment)&&t.fragment.length>0&&(r+=`#${t.fragment}`),r};return O=Object.freeze({hostToURI:h,recomposeURI:d,parseURI:function parseURI(r){const u={scheme:null,authority:null,authorityPunydecoded:null,userinfo:null,host:null,hostPunydecoded:null,port:null,path:null,pathqf:null,query:null,fragment:null,href:null};if(!(o(String,r)&&r.length>0))return u;const[,s,l,f,p,m]=r.match(c);if(!(o(String,s)&&s.length>0))return u;let g=null,I=null,D=null,R=null,U=null,C=null;if(o(String,l)){let r=null;if([D=null,r=null]=l.split("@"),!i(r)&&i(D)&&(r=D,D=null),o(String,r)){const u=r.match(a);let s,c;o(Array,u)?[,s=null,c=null]=u:[s=null,c=null]=r.split(":");const d=o(String,s)?s.toLowerCase():null,l=e(d),f=t(d);d!==l?(R=l,U=d):d!==f?(R=d,U=f):(R=d,U=d),""!==R&&""!==U||(R=null),C=n(c)||c,i(U)&&(I="",i(D)&&(I+=`${D}@`),I+=h(U),i(C)&&(I+=`:${C}`)),i(R)?(g="",i(D)&&(g+=`${D}@`),g+=h(R),i(C)&&(g+=`:${C}`)):(D=null,C=null);}}const S=o(String,p)&&p.length>0?p:null,y=o(String,m)&&m.length>0?m:null;u.pathqf=o(String,f)?f.valueOf():null,o(String,u.pathqf)&&(o(String,S)&&(u.pathqf+=`?${S}`),o(String,y)&&(u.pathqf+=`#${y}`)),u.scheme=s.toLowerCase(),u.authority=g,u.authorityPunydecoded=I,u.userinfo=D,u.host=R,u.hostPunydecoded=U,u.port=C,u.path=f,u.query=S,u.fragment=y;const E=d({scheme:u.scheme,userinfo:u.userinfo,host:u.host,port:u.port,path:u.path,query:u.query,fragment:u.fragment});return u.href=""!==E?E:null,u}}),O}function requireChars(){if(T)return x;T=1;const{object:{is:e}}=requireHelpers(),t=function isPathChar(t,r){if(!e(String,t))return false;const n=true===r,i=t.charCodeAt();return 37===i?!n:i>=36&&i<=59||i>=64&&i<=90||i>=97&&i<=122||33===i||61===i||95===i||126===i},r=function isSitemapPathChar(t,r){if(!e(String,t))return false;const n=true===r,i=t.charCodeAt();return 37===i?!n:i>=36&&i<=38||i>=40&&i<=41||i>=43&&i<=59||i>=97&&i<=122||33===i||61===i||64===i||95===i||126===i};return x=Object.freeze({isSchemeChar:function isSchemeChar(t,{start:r}={}){if(!e(String,t))return false;const n=t.charCodeAt();return r?n>=97&&n<=122:n>=48&&n<=57||n>=97&&n<=122||43===n||45===n||46===n},isUserinfoChar:function isUserinfoChar(t,r){if(!e(String,t))return false;const n=true===r,i=t.charCodeAt();return 37===i?!n:i>=38&&i<=46||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||33===i||36===i||58===i||59===i||61===i||95===i||126===i},isSitemapUserinfoChar:function isSitemapUserinfoChar(t,r){if(!e(String,t))return false;const n=true===r,i=t.charCodeAt();return 37===i?!n:i>=40&&i<=41||i>=43&&i<=46||i>=48&&i<=57||i>=97&&i<=122||33===i||36===i||38===i||58===i||59===i||61===i||95===i||126===i},isDomainChar:function isDomainChar(t,{start:r,end:n}={}){if(!e(String,t))return false;const i=t.charCodeAt();return (true!==r&&true!==n||45!==i)&&(i>=48&&i<=57||i>=97&&i<=122||45===i)},isPathChar:t,isSitemapPathChar:r,isQueryOrFragmentChar:function isQueryOrFragmentChar(r,n){return !!t(r,n)||e(String,r)&&63===r.charCodeAt()},isSitemapQueryOrFragmentChar:function isSitemapQueryOrFragmentChar(t,n){return !!r(t,n)||e(String,t)&&63===t.charCodeAt()},isPercentEncodingChar:function isPercentEncodingChar(t){if(!e(String,t))return false;const r=t.charCodeAt();return r>=48&&r<=57||r>=65&&r<=70}})}function requireDomain(){if(z)return j;z=1;const{punycode:e}=requirePunycode(),{isDomainChar:t}=requireChars(),{object:{is:r}}=requireHelpers(),n=function isDomainLabel(e){if(!r(String,e))return false;const n=e.length;if(n<1||n>63)return false;for(let r=0;r<n;r+=1){if(!t(e[r],{start:0===r,end:r===n-1}))return false;if("-"===e[r]&&r+1<n&&"-"===e[r+1])return false}return true};return j=Object.freeze({isDomainLabel:n,isDomain:function isDomain(t){if(!r(String,t))return false;const i=e(t);if("localhost"===i)return true;const o=i.length;if(o<=0||o>255)return false;const u=i.split("."),s=u.length;if(s<=1)return false;const c={};for(let e=0;e<s;e+=1)if(e!==s-1||""!==u[e]){const t=u[e].startsWith("xn--")?u[e].slice(4):u[e];if(!n(t))return false;if(c[u[e]]=(c[u[e]]||0)+1,c[u[e]]>1)return false}return true}})}function requireSitemap(){if(Z)return M;Z=1;const e={"*":"%2A"},t=Object.keys(e),r={};t.forEach((t=>{r[e[t]]=t;}));const n=Object.keys(r),i={"&":"&","'":"'"},o=Object.keys(i),u={};o.forEach((e=>{u[i[e]]=e;}));const s=Object.keys(u),c=s.length;return M=Object.freeze({specialChars:e,specialCharsKeys:t,pencodings:r,pencodingsKeys:n,entities:i,entitiesKeys:o,escapeCodes:u,escapeCodesKeys:s,escapeCodesKeysLen:c})}function requireCheckers(){if(W)return G;W=1;const{maxLengthURL:e,minPortInteger:t,maxPortInteger:r}=requireConfig(),{parseURI:n}=requireParser(),{isDomain:i}=requireDomain(),{cast:{int:o},object:{exists:u,is:s}}=requireHelpers(),{isIP:c}=requireIp(),{escapeCodesKeys:a,escapeCodesKeysLen:h}=requireSitemap(),{isSchemeChar:d,isUserinfoChar:l,isPathChar:f,isQueryOrFragmentChar:p,isSitemapUserinfoChar:m,isSitemapPathChar:g,isSitemapQueryOrFragmentChar:I,isPercentEncodingChar:D}=requireChars(),R=function checkPercentEncoding(e,t,r){if(!s(String,e)){const e=new URIError("a string is required when checking for percent encoding");throw e.code="URI_INVALID_PERCENT_ENCODING",e}const n=s(Number,r)&&r>=0?r:e.length,i=s(Number,t)&&t<n?t:0;let o=0;if(n>0&&"%"===e[i]){if(!(i+2<n)){const e=new URIError("incomplete percent encoding found");throw e.code="URI_INVALID_PERCENT_ENCODING",e}if(!D(e[i+1])){const t=new URIError(`invalid percent encoding char '${e[i+1]}'`);throw t.code="URI_INVALID_PERCENT_ENCODING",t}if(!D(e[i+2])){const t=new URIError(`invalid percent encoding char '${e[i+2]}'`);throw t.code="URI_INVALID_PERCENT_ENCODING",t}o=2;}return o},U=function checkSitemapEncoding(e,t,r){if(!s(String,e)){const e=new URIError("a string is required when checking for sitemap encoding");throw e.code="URI_INVALID_SITEMAP_ENCODING",e}const n=s(Number,r)&&r>=0?r:e.length,i=s(Number,t)&&t<n?t:0;let o=0;if(n>0&&"&"===e[i]){let t;for(let r=0;r<h;r+=1){const o=a[r],u=o.length;if(i+u<=n&&o===e.substring(i,i+u)){t=u-1;break}}if(!u(t)){const t=new URIError(`entity '${e[i]}' is not properly escaped`);throw t.code="URI_INVALID_SITEMAP_ENCODING",t}o=t;}return o},C=function checkComponent({type:e,string:t,sitemap:r}={}){if(!["userinfo","path","query","fragment"].includes(e)){const t=new URIError(`unable to check pathqf, got '${e}' component to check`);throw t.code="URI_INVALID_CHECKING_COMPONENT",t}if("path"===e&&(!u(t)||""===t)||!u(t))return true;const n=t.length,i=true===r;let o;switch(e){case "userinfo":o=i?m:l;break;case "path":o=i?g:f;break;case "query":case "fragment":o=i?I:p;}for(let r=0;r<n;r+=1){if(!o(t[r])){const n=new URIError(`invalid ${e} char '${t[r]}'`);throw n.code=`URI_INVALID_${e.toUpperCase()}_CHAR`,n}r+=R(t,r,n),i&&(r+=U(t,r,n));}return true},S=function checkSchemeChars(e,t){if(!s(String,e)){const e=new URIError("scheme must be a string");throw e.code="URI_INVALID_SCHEME",e}const r=s(Number,t)&&t>0?t:e.length;if(r<=0){const e=new URIError("scheme cannot be empty");throw e.code="URI_INVALID_SCHEME",e}for(let t=0;t<r;t+=1)if(!d(e[t],{start:0===t})){const r=new URIError(`invalid scheme char '${e[t]}'`);throw r.code="URI_INVALID_SCHEME_CHAR",r}return true},y=function checkLowercase(e){if(!s(String,e)){const e=new URIError("uri must be a string");throw e.code="URI_INVALID_TYPE",e}if(e.toLowerCase()!==e){const e=new URIError("uri cannot contain any uppercase characters");throw e.code="URI_INVALID_CHAR",e}return true},E=function checkURISyntax(e){if(!s(String,e)){const e=new URIError("uri must be a string");throw e.code="URI_INVALID_TYPE",e}const{scheme:t,authority:r,authorityPunydecoded:i,userinfo:o,host:c,hostPunydecoded:a,port:h,path:d,pathqf:l,query:f,fragment:p,href:m}=n(e),g=s(String,t)?t.length:0;if(!s(String,t)){const e=new URIError("uri scheme is required");throw e.code="URI_MISSING_SCHEME",e}if(g<=0){const e=new URIError("uri scheme must not be empty");throw e.code="URI_EMPTY_SCHEME",e}if(!s(String,d)){const e=new URIError("uri path is required");throw e.code="URI_MISSING_PATH",e}if(s(String,r)&&r.length>0){if(""!==d&&!d.startsWith("/")){const e=new URIError("path must be empty or start with '/' when authority is present");throw e.code="URI_INVALID_PATH",e}}else if(d.startsWith("//")){const e=new URIError("path must not start with '//' when authority is not present");throw e.code="URI_INVALID_PATH",e}if(!u(r)&&u(i)){const e=new URIError(`host must be a valid ip or domain name, got '${a}'`);throw e.code="URI_INVALID_HOST",e}return {scheme:t,authority:r,authorityPunydecoded:i,userinfo:o,host:c,hostPunydecoded:a,port:h,path:d,pathqf:l,query:f,fragment:p,href:m,schemeLen:g,valid:true}},w=function checkURI(e,{sitemap:n}={}){const{scheme:s,authority:a,authorityPunydecoded:h,userinfo:d,host:l,hostPunydecoded:f,port:p,path:m,pathqf:g,query:I,fragment:D,href:R,schemeLen:U}=E(e);if(S(s,U),u(a)){if(C({sitemap:n,type:"userinfo",string:d}),!c(l)&&!i(l)){const e=new URIError(`host must be a valid ip or domain name, got '${l}'`);throw e.code="URI_INVALID_HOST",e}if(u(p)&&void 0===o(p,{ge:t,le:r})){const e=new URIError(`port must be an integer between ${t}-${r}, got '${p}'`);throw e.code="URI_INVALID_PORT",e}}return C({sitemap:n,type:"path",string:m}),C({sitemap:n,type:"query",string:I}),C({sitemap:n,type:"fragment",string:D}),{scheme:s,authority:a,authorityPunydecoded:h,userinfo:d,host:l,hostPunydecoded:f,port:p,path:m,pathqf:g,query:I,fragment:D,href:R,valid:true}},L=function checkHttpURL(t,{https:r,web:n,sitemap:i}={}){ true===i&&y(t);const o=[];true===r?o.push("https"):true===n?o.push("http","https"):o.push("http");const{scheme:u,authority:c,authorityPunydecoded:a,userinfo:h,host:d,hostPunydecoded:l,port:f,path:p,pathqf:m,query:g,fragment:I,href:D}=w(t,{sitemap:i});if(!o.includes(u)){const e=new URIError(`scheme must be ${o.join(" or ")}, got '${u}'`);throw e.code="URI_INVALID_SCHEME",e}if(!s(String,c)){const e=new URIError("authority is required");throw e.code="URI_MISSING_AUTHORITY",e}if(s(String,D)&&D.length>e){const t=new URIError(`max URL length of ${e} reached: ${D.length}`);throw t.code="URI_MAX_LENGTH_URL",t}return {scheme:u,authority:c,authorityPunydecoded:a,userinfo:h,host:d,hostPunydecoded:l,port:f,path:p,pathqf:m,query:g,fragment:I,href:D,valid:true}};return G=Object.freeze({checkPercentEncoding:R,checkSitemapEncoding:U,checkComponent:C,checkSchemeChars:S,checkLowercase:y,checkURISyntax:E,checkURI:w,checkHttpURL:L,checkHttpsURL:function checkHttpsURL(e){return L(e,{https:true})},checkHttpSitemapURL:function checkHttpSitemapURL(e){return L(e,{sitemap:true})},checkHttpsSitemapURL:function checkHttpsSitemapURL(e){return L(e,{https:true,sitemap:true})},checkWebURL:function checkWebURL(e){return L(e,{web:true})},checkSitemapURL:function checkSitemapURL(e){return L(e,{web:true,sitemap:true})}}),G}var $e=function requireSrc(){if(J)return X;J=1;const{punycode:e,punydecode:t}=requirePunycode(),{parseURI:r,recomposeURI:n}=requireParser(),{isDomainLabel:i,isDomain:o}=requireDomain(),{isIP:u,isIPv4:s,isIPv6:c}=requireIp(),{checkURI:a,checkHttpURL:h,checkHttpsURL:d,checkHttpSitemapURL:l,checkHttpsSitemapURL:f,checkWebURL:p,checkSitemapURL:m}=requireCheckers(),{encodeURIComponentString:g,encodeURIString:I,encodeWebURL:D,encodeSitemapURL:R}=function requireEncoders(){if(K)return B;K=1;const{maxLengthURL:e,minPortInteger:t,maxPortInteger:r}=requireConfig(),{checkURISyntax:n,checkSchemeChars:i}=requireCheckers(),{isUserinfoChar:o,isPathChar:u,isQueryOrFragmentChar:s,isSitemapUserinfoChar:c,isSitemapPathChar:a,isSitemapQueryOrFragmentChar:h}=requireChars(),{recomposeURI:d}=requireParser(),{entities:l,specialChars:f}=requireSitemap(),{isDomain:p}=requireDomain(),{isIP:m}=requireIp(),{cast:{int:g},object:{exists:I,is:D}}=requireHelpers(),R=function encodeURIComponentString(e,{type:t,sitemap:r,lowercase:n}={}){if(!D(String,e))return "";const i=true===n||true===r?e.toLowerCase():e,d=i.length;let p="";for(let e=0;e<d;e+=1){let n=false;if(true===r&&(I(l[i[e]])?(p+=l[i[e]],n=true):I(f[i[e]])&&(p+=f[i[e]],n=true)),!n){let n;switch(t){case "userinfo":n=r&&c(i[e],true)||o(i[e],true);break;case "path":n=r&&a(i[e],true)||u(i[e],true);break;case "query":case "fragment":n=r&&h(i[e],true)||s(i[e],true);break;default:n=false;}p+=n?i[e]:encodeURIComponent(i[e]);}}return p},U=function encodeURIString(o,{web:u,sitemap:s,lowercase:c}={}){const a=D(String,o)&&true===c?o.toLowerCase():o,h=true===u||true===s,{scheme:l,authority:f,userinfo:U,host:C,port:S,path:y,query:E,fragment:w,schemeLen:L}=n(a);if(h){if("http"!==l&&"https"!==l){const e=new URIError(`scheme must be http or https, got '${l}'`);throw e.code="URI_INVALID_SCHEME",e}}else i(l,L);if(h&&!D(String,f)){const e=new URIError("authority is required");throw e.code="URI_MISSING_AUTHORITY",e}if(I(C)&&!m(C)&&!p(C)){const e=new URIError(`host must be a valid ip or domain name, got '${C}'`);throw e.code="URI_INVALID_HOST",e}if(I(S)&&void 0===g(S,{ge:t,le:r})){const e=new URIError(`port must be an integer between ${t}-${r}, got '${S}'`);throw e.code="URI_INVALID_PORT",e}const b=R(U,{sitemap:s,type:"userinfo",lowercase:false}),F=R(y,{sitemap:s,type:"path",lowercase:false}),A=R(E,{sitemap:s,type:"query",lowercase:false}),$=R(w,{sitemap:s,type:"fragment",lowercase:false}),_=d({scheme:l,host:C,port:S,userinfo:b,path:F,query:A,fragment:$});if(h&&_.length>e){const t=new URIError(`max URL length of ${e} reached: ${_.length}`);throw t.code="URI_MAX_LENGTH_URL",t}return _};return B=Object.freeze({encodeURIComponentString:R,encodeURIString:U,encodeWebURL:function encodeWebURL(e,{lowercase:t}={}){return U(e,{lowercase:t,web:true})},encodeSitemapURL:function encodeSitemapURL(e){return U(e,{lowercase:true,sitemap:true})}}),B}(),{decodeURIComponentString:U,decodeURIString:C,decodeWebURL:S,decodeSitemapURL:y}=function requireDecoders(){if(Y)return Q;Y=1;const{maxLengthURL:e,minPortInteger:t,maxPortInteger:r}=requireConfig(),{checkURISyntax:n,checkSchemeChars:i}=requireCheckers(),{cast:{int:o},object:{exists:u,is:s}}=requireHelpers(),{recomposeURI:c}=requireParser(),{isDomain:a}=requireDomain(),{isIP:h}=requireIp(),{escapeCodes:d,escapeCodesKeys:l,pencodings:f,pencodingsKeys:p}=requireSitemap(),m=function decodeURIComponentString(e,{sitemap:t,lowercase:r}={}){if(!s(String,e))return "";const n=true===r?e.toLowerCase():e;if(true===t){const e=new RegExp(l.concat(p).join("|"),"g"),t=n.replace(e,(e=>d[e]||f[e]));try{return decodeURIComponent(t)}catch(e){return ""}}try{return decodeURIComponent(n)}catch(e){return ""}},g=function decodeURIString(d,{web:l,sitemap:f,lowercase:p}={}){const g=s(String,d)&&true===p?d.toLowerCase():d,I=true===l||true===f,{scheme:D,authority:R,userinfo:U,host:C,hostPunydecoded:S,port:y,path:E,query:w,fragment:L,schemeLen:b}=n(g);if(I){if("http"!==D&&"https"!==D){const e=new URIError(`scheme must be http or https, got '${D}'`);throw e.code="URI_INVALID_SCHEME",e}}else i(D,b);if(I&&!s(String,R)){const e=new URIError("authority is required");throw e.code="URI_MISSING_AUTHORITY",e}if(u(C)&&!h(C)&&!a(C)){const e=new URIError(`host must be a valid ip or domain name, got '${C}'`);throw e.code="URI_INVALID_HOST",e}if(u(y)&&void 0===o(y,{ge:t,le:r})){const e=new URIError(`port must be an integer between ${t}-${r}, got '${y}'`);throw e.code="URI_INVALID_PORT",e}const F=m(U,{sitemap:f,lowercase:false}),A=m(E,{sitemap:f,lowercase:false}),$=m(w,{sitemap:f,lowercase:false}),_=m(L,{sitemap:f,lowercase:false}),q=c({scheme:D,port:y,host:S,userinfo:F,path:A,query:$,fragment:_});if(I&&q.length>e){const t=new URIError(`max URL length of ${e} reached: ${q.length}`);throw t.code="URI_MAX_LENGTH_URL",t}return q};return Q=Object.freeze({decodeURIComponentString:m,decodeURIString:g,decodeWebURL:function decodeWebURL(e,{lowercase:t}={}){return g(e,{lowercase:t,web:true})},decodeSitemapURL:function decodeSitemapURL(e,{lowercase:t}={}){return g(e,{lowercase:t,sitemap:true})}}),Q}();return X=Object.freeze({punycode:e,punydecode:t,parseURI:r,recomposeURI:n,isDomainLabel:i,isDomain:o,isIP:u,isIPv4:s,isIPv6:c,checkURI:a,checkHttpURL:h,checkHttpsURL:d,checkHttpSitemapURL:l,checkHttpsSitemapURL:f,checkWebURL:p,checkSitemapURL:m,encodeURIComponentString:g,encodeURIString:I,encodeWebURL:D,encodeSitemapURL:R,decodeURIComponentString:U,decodeURIString:C,decodeWebURL:S,decodeSitemapURL:y})}();getDefaultExportFromCjs($e);var Ve=function(){function ValidationResult(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";_classCallCheck(this,ValidationResult),_defineProperty(this,"success",true),_defineProperty(this,"description",""),_defineProperty(this,"next",null),this.success=null==e||e,this.description=null!=t?t:"",this.next=null;}return _createClass(ValidationResult,null,[{key:"merge",value:function merge(e){if(Array.isArray(e)&&e.length>0){for(var t=new ValidationResult(true),r=t,n=0;n<e.length;++n){var i=e[n];i&&!i.success&&(r.next=i,r=i);}return r.next=null,t.next?(r=t.next,t.next=null,r):t}return new ValidationResult(true)}}])}();
|
|
4858
|
-
|
|
4859
4857
|
////////////////////////////////////////////////////////////////////////////////
|
|
4860
4858
|
|
|
4861
4859
|
/**
|
|
@@ -5075,9 +5073,9 @@ function validateEmptyField(metadata, obj, field, value, context) {
|
|
|
5075
5073
|
var owner = (_context$owner = context.owner) !== null && _context$owner !== void 0 ? _context$owner : getInstanceName(metadata, obj);
|
|
5076
5074
|
// TODO: make the message i18n
|
|
5077
5075
|
var message = owner ? "The ".concat(label, " of ").concat(owner, " cannot be empty.") : "The ".concat(label, " cannot be empty.");
|
|
5078
|
-
return new
|
|
5076
|
+
return new validationRule.ValidationResult(false, message);
|
|
5079
5077
|
} else {
|
|
5080
|
-
return new
|
|
5078
|
+
return new validationRule.ValidationResult(true);
|
|
5081
5079
|
}
|
|
5082
5080
|
}
|
|
5083
5081
|
return null;
|
|
@@ -5130,7 +5128,7 @@ function validateArrayField(Class, metadata, obj, field, value, validator, conte
|
|
|
5130
5128
|
ctx.index = i;
|
|
5131
5129
|
return validator(e, ctx);
|
|
5132
5130
|
});
|
|
5133
|
-
return
|
|
5131
|
+
return validationRule.ValidationResult.merge(results);
|
|
5134
5132
|
}
|
|
5135
5133
|
return null;
|
|
5136
5134
|
}
|
|
@@ -5191,7 +5189,7 @@ function validateMapField(Class, metadata, obj, field, value, validator, context
|
|
|
5191
5189
|
ctx.index = i;
|
|
5192
5190
|
return validator(e[1], ctx); // only validate the value, not the key
|
|
5193
5191
|
});
|
|
5194
|
-
return
|
|
5192
|
+
return validationRule.ValidationResult.merge(results);
|
|
5195
5193
|
}
|
|
5196
5194
|
return null;
|
|
5197
5195
|
}
|
|
@@ -5354,7 +5352,7 @@ function validateSetField(Class, metadata, obj, field, value, validator, context
|
|
|
5354
5352
|
ctx.index = i;
|
|
5355
5353
|
return validator(e, ctx);
|
|
5356
5354
|
});
|
|
5357
|
-
return
|
|
5355
|
+
return validationRule.ValidationResult.merge(results);
|
|
5358
5356
|
}
|
|
5359
5357
|
return null;
|
|
5360
5358
|
}
|
|
@@ -5411,7 +5409,7 @@ function validateFieldImpl(Class, obj, field, context) {
|
|
|
5411
5409
|
var validator = getFieldMetadata(metadata, field, KEY_FIELD_VALIDATOR);
|
|
5412
5410
|
if (validator === undefined) {
|
|
5413
5411
|
// the field is not decorated with @Validatable
|
|
5414
|
-
return new
|
|
5412
|
+
return new validationRule.ValidationResult(true);
|
|
5415
5413
|
}
|
|
5416
5414
|
var value = obj[field];
|
|
5417
5415
|
return (_ref = (_ref2 = (_validateArrayField = validateArrayField(Class, metadata, obj, field, value, validator, context)) !== null && _validateArrayField !== void 0 ? _validateArrayField : validateSetField(Class, metadata, obj, field, value, validator, context)) !== null && _ref2 !== void 0 ? _ref2 : validateMapField(Class, metadata, obj, field, value, validator, context)) !== null && _ref !== void 0 ? _ref : validateNormalField(Class, metadata, obj, field, value, validator, context);
|
|
@@ -5450,15 +5448,15 @@ function validateImpl(Class, obj, fields, context) {
|
|
|
5450
5448
|
var results = Object.keys(obj).map(function (f) {
|
|
5451
5449
|
return obj.validateField(f, context);
|
|
5452
5450
|
});
|
|
5453
|
-
return
|
|
5451
|
+
return validationRule.ValidationResult.merge(results);
|
|
5454
5452
|
} else if (Array.isArray(fields)) {
|
|
5455
5453
|
var _results = fields.map(function (f) {
|
|
5456
5454
|
return obj.validateField(f, context);
|
|
5457
5455
|
});
|
|
5458
|
-
return
|
|
5456
|
+
return validationRule.ValidationResult.merge(_results);
|
|
5459
5457
|
} else if (typeof fields === 'string') {
|
|
5460
5458
|
var result = obj.validateField(fields, context);
|
|
5461
|
-
return result !== null && result !== void 0 ? result : new
|
|
5459
|
+
return result !== null && result !== void 0 ? result : new validationRule.ValidationResult(true);
|
|
5462
5460
|
} else {
|
|
5463
5461
|
throw new TypeError("The argument of ".concat(Class.name, ".validate()") + ' must be a string or an array of strings.');
|
|
5464
5462
|
}
|
|
@@ -7117,14 +7115,14 @@ function defaultValidator(value, _ref) {
|
|
|
7117
7115
|
nonEmpty = _ref.nonEmpty;
|
|
7118
7116
|
if (value === undefined || value === null) {
|
|
7119
7117
|
if (nullable) {
|
|
7120
|
-
return new
|
|
7118
|
+
return new validationRule.ValidationResult(true);
|
|
7121
7119
|
} else {
|
|
7122
7120
|
// TODO: make the message i18n
|
|
7123
7121
|
// const message = owner
|
|
7124
7122
|
// ? `The ${label} of ${owner} must be specified.`
|
|
7125
7123
|
// : `The ${label} must be specified.`;
|
|
7126
7124
|
var message = owner ? "\u5FC5\u987B\u8BBE\u7F6E".concat(owner, "\u7684").concat(label, "\u7684\u503C") : "\u5FC5\u987B\u8BBE\u7F6E".concat(label, "\u7684\u503C");
|
|
7127
|
-
return new
|
|
7125
|
+
return new validationRule.ValidationResult(false, message);
|
|
7128
7126
|
}
|
|
7129
7127
|
}
|
|
7130
7128
|
if (commonUtil.isEmpty(value)) {
|
|
@@ -7134,7 +7132,7 @@ function defaultValidator(value, _ref) {
|
|
|
7134
7132
|
// ? `The ${label} of ${owner} cannot be empty.`
|
|
7135
7133
|
// : `The ${label} cannot be empty.`;
|
|
7136
7134
|
var _message = owner ? "".concat(owner, "\u7684").concat(label, "\u4E0D\u80FD\u4E3A\u7A7A") : "".concat(label, "\u4E0D\u80FD\u4E3A\u7A7A");
|
|
7137
|
-
return new
|
|
7135
|
+
return new validationRule.ValidationResult(false, _message);
|
|
7138
7136
|
}
|
|
7139
7137
|
}
|
|
7140
7138
|
if (type) {
|
|
@@ -7142,14 +7140,14 @@ function defaultValidator(value, _ref) {
|
|
|
7142
7140
|
// special deal with the case that the type is an enumeration class
|
|
7143
7141
|
if (isEnumClass(type) && typeof value === 'string') {
|
|
7144
7142
|
if (type.hasValue(value)) {
|
|
7145
|
-
return new
|
|
7143
|
+
return new validationRule.ValidationResult(true);
|
|
7146
7144
|
} else {
|
|
7147
7145
|
// TODO: i18n the following message
|
|
7148
7146
|
// const message = owner
|
|
7149
7147
|
// ? `The ${label} of ${owner} is not supported: ${value}`
|
|
7150
7148
|
// : `The ${label} is not supported: ${value}`;
|
|
7151
7149
|
var _message2 = owner ? "".concat(owner, "\u7684").concat(label, "\u7684\u503C\u4E0D\u53D7\u652F\u6301: ").concat(value) : "".concat(label, "\u7684\u503C\u4E0D\u53D7\u652F\u6301: ").concat(value);
|
|
7152
|
-
return new
|
|
7150
|
+
return new validationRule.ValidationResult(false, _message2);
|
|
7153
7151
|
}
|
|
7154
7152
|
}
|
|
7155
7153
|
// note that the following test also covers the case that the value is a primitive
|
|
@@ -7159,7 +7157,7 @@ function defaultValidator(value, _ref) {
|
|
|
7159
7157
|
// ? `The ${label} of ${owner} must be of the type ${type.name}.`
|
|
7160
7158
|
// : `The ${label} must be of the type ${type.name}.`;
|
|
7161
7159
|
var _message3 = owner ? "".concat(owner, "\u7684").concat(label, "\u5FC5\u987B\u662F ").concat(type.name, " \u7C7B\u578B") : "".concat(label, "\u5FC5\u987B\u662F ").concat(type.name, " \u7C7B\u578B");
|
|
7162
|
-
return new
|
|
7160
|
+
return new validationRule.ValidationResult(false, _message3);
|
|
7163
7161
|
}
|
|
7164
7162
|
}
|
|
7165
7163
|
if (_typeof(value) === 'object' && typeof value.validate === 'function') {
|
|
@@ -7167,7 +7165,7 @@ function defaultValidator(value, _ref) {
|
|
|
7167
7165
|
owner: owner
|
|
7168
7166
|
});
|
|
7169
7167
|
}
|
|
7170
|
-
return new
|
|
7168
|
+
return new validationRule.ValidationResult(true);
|
|
7171
7169
|
}
|
|
7172
7170
|
|
|
7173
7171
|
/**
|