@qubit-ltd/common-decorator 3.10.7 → 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 +19 -19
|
@@ -9,7 +9,7 @@ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
|
9
9
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
10
10
|
import { NamingStyle } from '@qubit-ltd/naming-style';
|
|
11
11
|
import Json from '@qubit-ltd/json';
|
|
12
|
-
import
|
|
12
|
+
import { ValidationResult } from '@qubit-ltd/validation-rule';
|
|
13
13
|
|
|
14
14
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
15
15
|
|
|
@@ -87,10 +87,10 @@ function requireSharedStore () {
|
|
|
87
87
|
var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
|
|
88
88
|
|
|
89
89
|
(store.versions || (store.versions = [])).push({
|
|
90
|
-
version: '3.
|
|
90
|
+
version: '3.48.0',
|
|
91
91
|
mode: IS_PURE ? 'pure' : 'global',
|
|
92
|
-
copyright: '©
|
|
93
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
92
|
+
copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
|
|
93
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE',
|
|
94
94
|
source: 'https://github.com/zloirock/core-js'
|
|
95
95
|
});
|
|
96
96
|
return sharedStore.exports;
|
|
@@ -4852,8 +4852,6 @@ function toJsonStringImpl(Class, obj, options) {
|
|
|
4852
4852
|
return Json.stringify(target, null, opt.space);
|
|
4853
4853
|
}
|
|
4854
4854
|
|
|
4855
|
-
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)}}])}();
|
|
4856
|
-
|
|
4857
4855
|
////////////////////////////////////////////////////////////////////////////////
|
|
4858
4856
|
|
|
4859
4857
|
/**
|
|
@@ -5073,9 +5071,9 @@ function validateEmptyField(metadata, obj, field, value, context) {
|
|
|
5073
5071
|
var owner = (_context$owner = context.owner) !== null && _context$owner !== void 0 ? _context$owner : getInstanceName(metadata, obj);
|
|
5074
5072
|
// TODO: make the message i18n
|
|
5075
5073
|
var message = owner ? "The ".concat(label, " of ").concat(owner, " cannot be empty.") : "The ".concat(label, " cannot be empty.");
|
|
5076
|
-
return new
|
|
5074
|
+
return new ValidationResult(false, message);
|
|
5077
5075
|
} else {
|
|
5078
|
-
return new
|
|
5076
|
+
return new ValidationResult(true);
|
|
5079
5077
|
}
|
|
5080
5078
|
}
|
|
5081
5079
|
return null;
|
|
@@ -5128,7 +5126,7 @@ function validateArrayField(Class, metadata, obj, field, value, validator, conte
|
|
|
5128
5126
|
ctx.index = i;
|
|
5129
5127
|
return validator(e, ctx);
|
|
5130
5128
|
});
|
|
5131
|
-
return
|
|
5129
|
+
return ValidationResult.merge(results);
|
|
5132
5130
|
}
|
|
5133
5131
|
return null;
|
|
5134
5132
|
}
|
|
@@ -5189,7 +5187,7 @@ function validateMapField(Class, metadata, obj, field, value, validator, context
|
|
|
5189
5187
|
ctx.index = i;
|
|
5190
5188
|
return validator(e[1], ctx); // only validate the value, not the key
|
|
5191
5189
|
});
|
|
5192
|
-
return
|
|
5190
|
+
return ValidationResult.merge(results);
|
|
5193
5191
|
}
|
|
5194
5192
|
return null;
|
|
5195
5193
|
}
|
|
@@ -5352,7 +5350,7 @@ function validateSetField(Class, metadata, obj, field, value, validator, context
|
|
|
5352
5350
|
ctx.index = i;
|
|
5353
5351
|
return validator(e, ctx);
|
|
5354
5352
|
});
|
|
5355
|
-
return
|
|
5353
|
+
return ValidationResult.merge(results);
|
|
5356
5354
|
}
|
|
5357
5355
|
return null;
|
|
5358
5356
|
}
|
|
@@ -5409,7 +5407,7 @@ function validateFieldImpl(Class, obj, field, context) {
|
|
|
5409
5407
|
var validator = getFieldMetadata(metadata, field, KEY_FIELD_VALIDATOR);
|
|
5410
5408
|
if (validator === undefined) {
|
|
5411
5409
|
// the field is not decorated with @Validatable
|
|
5412
|
-
return new
|
|
5410
|
+
return new ValidationResult(true);
|
|
5413
5411
|
}
|
|
5414
5412
|
var value = obj[field];
|
|
5415
5413
|
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);
|
|
@@ -5448,15 +5446,15 @@ function validateImpl(Class, obj, fields, context) {
|
|
|
5448
5446
|
var results = Object.keys(obj).map(function (f) {
|
|
5449
5447
|
return obj.validateField(f, context);
|
|
5450
5448
|
});
|
|
5451
|
-
return
|
|
5449
|
+
return ValidationResult.merge(results);
|
|
5452
5450
|
} else if (Array.isArray(fields)) {
|
|
5453
5451
|
var _results = fields.map(function (f) {
|
|
5454
5452
|
return obj.validateField(f, context);
|
|
5455
5453
|
});
|
|
5456
|
-
return
|
|
5454
|
+
return ValidationResult.merge(_results);
|
|
5457
5455
|
} else if (typeof fields === 'string') {
|
|
5458
5456
|
var result = obj.validateField(fields, context);
|
|
5459
|
-
return result !== null && result !== void 0 ? result : new
|
|
5457
|
+
return result !== null && result !== void 0 ? result : new ValidationResult(true);
|
|
5460
5458
|
} else {
|
|
5461
5459
|
throw new TypeError("The argument of ".concat(Class.name, ".validate()") + ' must be a string or an array of strings.');
|
|
5462
5460
|
}
|
|
@@ -7115,14 +7113,14 @@ function defaultValidator(value, _ref) {
|
|
|
7115
7113
|
nonEmpty = _ref.nonEmpty;
|
|
7116
7114
|
if (value === undefined || value === null) {
|
|
7117
7115
|
if (nullable) {
|
|
7118
|
-
return new
|
|
7116
|
+
return new ValidationResult(true);
|
|
7119
7117
|
} else {
|
|
7120
7118
|
// TODO: make the message i18n
|
|
7121
7119
|
// const message = owner
|
|
7122
7120
|
// ? `The ${label} of ${owner} must be specified.`
|
|
7123
7121
|
// : `The ${label} must be specified.`;
|
|
7124
7122
|
var message = owner ? "\u5FC5\u987B\u8BBE\u7F6E".concat(owner, "\u7684").concat(label, "\u7684\u503C") : "\u5FC5\u987B\u8BBE\u7F6E".concat(label, "\u7684\u503C");
|
|
7125
|
-
return new
|
|
7123
|
+
return new ValidationResult(false, message);
|
|
7126
7124
|
}
|
|
7127
7125
|
}
|
|
7128
7126
|
if (isEmpty(value)) {
|
|
@@ -7132,7 +7130,7 @@ function defaultValidator(value, _ref) {
|
|
|
7132
7130
|
// ? `The ${label} of ${owner} cannot be empty.`
|
|
7133
7131
|
// : `The ${label} cannot be empty.`;
|
|
7134
7132
|
var _message = owner ? "".concat(owner, "\u7684").concat(label, "\u4E0D\u80FD\u4E3A\u7A7A") : "".concat(label, "\u4E0D\u80FD\u4E3A\u7A7A");
|
|
7135
|
-
return new
|
|
7133
|
+
return new ValidationResult(false, _message);
|
|
7136
7134
|
}
|
|
7137
7135
|
}
|
|
7138
7136
|
if (type) {
|
|
@@ -7140,14 +7138,14 @@ function defaultValidator(value, _ref) {
|
|
|
7140
7138
|
// special deal with the case that the type is an enumeration class
|
|
7141
7139
|
if (isEnumClass(type) && typeof value === 'string') {
|
|
7142
7140
|
if (type.hasValue(value)) {
|
|
7143
|
-
return new
|
|
7141
|
+
return new ValidationResult(true);
|
|
7144
7142
|
} else {
|
|
7145
7143
|
// TODO: i18n the following message
|
|
7146
7144
|
// const message = owner
|
|
7147
7145
|
// ? `The ${label} of ${owner} is not supported: ${value}`
|
|
7148
7146
|
// : `The ${label} is not supported: ${value}`;
|
|
7149
7147
|
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);
|
|
7150
|
-
return new
|
|
7148
|
+
return new ValidationResult(false, _message2);
|
|
7151
7149
|
}
|
|
7152
7150
|
}
|
|
7153
7151
|
// note that the following test also covers the case that the value is a primitive
|
|
@@ -7157,7 +7155,7 @@ function defaultValidator(value, _ref) {
|
|
|
7157
7155
|
// ? `The ${label} of ${owner} must be of the type ${type.name}.`
|
|
7158
7156
|
// : `The ${label} must be of the type ${type.name}.`;
|
|
7159
7157
|
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");
|
|
7160
|
-
return new
|
|
7158
|
+
return new ValidationResult(false, _message3);
|
|
7161
7159
|
}
|
|
7162
7160
|
}
|
|
7163
7161
|
if (_typeof(value) === 'object' && typeof value.validate === 'function') {
|
|
@@ -7165,7 +7163,7 @@ function defaultValidator(value, _ref) {
|
|
|
7165
7163
|
owner: owner
|
|
7166
7164
|
});
|
|
7167
7165
|
}
|
|
7168
|
-
return new
|
|
7166
|
+
return new ValidationResult(true);
|
|
7169
7167
|
}
|
|
7170
7168
|
|
|
7171
7169
|
/**
|