reslib 2.2.0 → 2.3.1
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/build/auth/errors.d.ts +4 -0
- package/build/auth/errors.js +5 -0
- package/build/auth/index.d.ts +65 -1963
- package/build/auth/index.js +2 -2
- package/build/auth/types.d.ts +42 -0
- package/build/exception/index.js +2 -2
- package/build/inputFormatter/index.js +2 -2
- package/build/resources/ResourcePaginationHelper.js +1 -1
- package/build/resources/index.d.ts +5 -5
- package/build/resources/index.js +3 -3
- package/build/session/index.js +1 -1
- package/build/utils/defaultStr.js +1 -1
- package/build/utils/image.js +1 -1
- package/build/utils/index.js +3 -3
- package/build/utils/interpolate.js +1 -1
- package/build/utils/isEmail.d.ts +1 -1
- package/build/utils/isEmail.js +1 -1
- package/build/utils/isEmpty.d.ts +2 -2
- package/build/utils/isEmpty.js +1 -1
- package/build/utils/isNonNullString.d.ts +2 -2
- package/build/utils/isNumber.d.ts +1 -1
- package/build/utils/isNumber.js +1 -1
- package/build/utils/isPrimitive.d.ts +2 -2
- package/build/utils/isPrimitive.js +1 -1
- package/build/utils/isPromise.d.ts +2 -2
- package/build/utils/isPromise.js +1 -1
- package/build/utils/isRegex.d.ts +2 -2
- package/build/utils/isRegex.js +1 -1
- package/build/utils/isTime.js +1 -1
- package/build/utils/numbers.js +2 -2
- package/build/utils/object.js +1 -1
- package/build/utils/string.js +1 -1
- package/build/utils/stringify.js +1 -1
- package/build/utils/uri/index.d.ts +1 -1
- package/build/validator/index.js +3 -3
- package/build/validator/rules/array.js +2 -2
- package/build/validator/rules/boolean.js +2 -2
- package/build/validator/rules/date.js +2 -2
- package/build/validator/rules/default.js +2 -2
- package/build/validator/rules/enum.js +2 -2
- package/build/validator/rules/file.js +2 -2
- package/build/validator/rules/format.d.ts +1 -1
- package/build/validator/rules/format.js +3 -3
- package/build/validator/rules/ifRule.d.ts +76 -0
- package/build/validator/rules/ifRule.js +5 -0
- package/build/validator/rules/index.d.ts +1 -0
- package/build/validator/rules/index.js +3 -3
- package/build/validator/rules/multiRules.js +2 -2
- package/build/validator/rules/numeric.js +2 -2
- package/build/validator/rules/object.js +2 -2
- package/build/validator/rules/string.js +2 -2
- package/build/validator/rules/target.js +2 -2
- package/build/validator/rules/utils.js +1 -1
- package/build/validator/rulesMarkers.d.ts +1 -0
- package/build/validator/rulesMarkers.js +1 -1
- package/build/validator/types.d.ts +399 -48
- package/build/validator/validator.d.ts +376 -5
- package/build/validator/validator.js +2 -2
- package/package.json +248 -253
package/build/session/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('reflect-metadata');function
|
|
1
|
+
'use strict';require('reflect-metadata');function h(e){return typeof e=="boolean"||!e||typeof e=="number"||typeof e=="string"||typeof e=="symbol"?false:Object(e).constructor===Promise||e.constructor&&(e.constructor.name==="Promise"||e.constructor.name==="AsyncFunction")||e instanceof Promise||typeof(e==null?void 0:e.then)=="function"&&typeof(e==null?void 0:e.catch)=="function"&&typeof(e==null?void 0:e.finally)=="function"?true:e&&typeof e.constructor=="function"&&Function.prototype.toString.call(e.constructor).replace(/\(.*\)/,"()")===Function.prototype.toString.call(Function).replace("Function","Promise").replace(/\(.*\)/,"()")}function d(e){return e&&Object.prototype.toString.call(e)==="[object Promise]"?true:h(e)}function y(){return typeof window!="undefined"&&(window==null?void 0:window.document)!==void 0&&typeof document!="undefined"&&typeof navigator!="undefined"}var c=()=>{var e;try{if(typeof process!="undefined"&&(process!=null&&process.versions)&&((e=process==null?void 0:process.versions)!=null&&e.node)||typeof global=="object"&&(global==null?void 0:global.toString.call(global))==="[object global]")return !0}catch(t){}return false},S=()=>{var e,t;return !!(typeof window!="undefined"&&window&&typeof(window==null?void 0:window.process)=="object"&&((e=window==null?void 0:window.process)==null?void 0:e.type)==="renderer"||typeof process!="undefined"&&typeof(process==null?void 0:process.versions)=="object"&&((t=process.versions)!=null&&t.electron)||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&String(navigator==null?void 0:navigator.userAgent).toLowerCase().indexOf("electron")>=0)},v=()=>{if(typeof document!="undefined"&&document)try{return document.createEvent("TouchEvent"),!0}catch(e){try{return "ontouchstart"in window||"onmsgesturechange"in window}catch(t){}}return false},N=()=>typeof window=="undefined"&&typeof process!="undefined",p=()=>!!(typeof window!="undefined"&&typeof window=="object"&&window),A=()=>{if(!y()||typeof navigator!="object"||!navigator||typeof navigator.userAgent!="string")return false;let e=navigator.userAgent.toLowerCase();return /android/i.test(e)},D=()=>{var e;return !p()||!(window!=null&&window.ReactNativeWebView)?false:typeof((e=window==null?void 0:window.ReactNativeWebView)==null?void 0:e.postMessage)=="function"},P=()=>c()&&process.platform==="darwin",x=()=>c()&&process.platform==="win32",C=()=>c()&&process.platform==="linux",m={isWeb:y,isLinux:C,isDarwin:P,isWin32:x,isNode:c,isElectron:S,isTouchDevice:v,isServerSide:N,isClientSide:p,isAndroidMobileBrowser:A,isReactNativeWebview:D};function u(e){return !!(e&&typeof e=="string")}var a=class e{static decycle(t,r=[]){if(typeof t=="function")return;if(!t||typeof t!="object")return t;if(r.includes(t))return null;let n=r.concat([t]);return Array.isArray(t)?t.map(o=>e.decycle(o,n)):Object.fromEntries(Object.entries(t).map(([o,g])=>[o,e.decycle(g,n)]))}static stringify(t,r=false,n,o){return typeof t=="string"?t:JSON.stringify(r!==false?e.decycle(t):t,n,o)}static isJSON(t){if(typeof t!="string")return false;let r=t.trim();if(r.length===0)return false;let n=r[0];if(n!=="{"&&n!=="[")return false;try{let o=JSON.parse(r);return o!==null&&typeof o=="object"}catch(o){return false}}static parse(t,r){if(typeof t=="string")try{t=JSON.parse(t,r);}catch(n){return t}if(t&&typeof t=="object")for(let n in t){let o=t[n];e.isJSON(o)&&(t[n]=e.parse(o,r));}return t}};var s=class s{static get storage(){var r;let t=Reflect.getMetadata(s.sessionStorageMetaData,s);if(l(t)&&(this._storage=t),this._storage)return this._storage;if(m.isClientSide()&&typeof window!="undefined"&&window.localStorage&&((r=window.localStorage)!=null&&r.getItem))this._storage={get:n=>window.localStorage.getItem(n),set:(n,o)=>window.localStorage.setItem(n,o),remove:n=>window.localStorage.removeItem(n),removeAll:()=>window.localStorage.clear()};else {let n={};this._storage={get:o=>n[o],set:(o,g)=>n[o]=g,remove:o=>{delete n[o];},removeAll:()=>n={}};}return this._storage}static set storage(t){l(t)&&Reflect.defineMetadata(s.sessionStorageMetaData,t,s);}static get keyNamespace(){return u(this._keyNamespace)?this._keyNamespace:""}static set keyNamespace(t){u(t)&&(this._keyNamespace=t.trim().replace(/\s+/g,"-"));}static sanitizeKey(t){if(!t||!u(t))return "";t=t.trim().replace(/\s+/g,"-");let r=this.keyNamespace;return r?`${r}-${t}`:t}};s.sessionStorageMetaData=Symbol("sessionStorage"),s._keyNamespace=void 0;var i=s;function f(e){return i.sanitizeKey(e)}var w=(e,t)=>(e=e&&a.stringify(e,t),e==null&&(e=""),e),b=e=>{if(d(e))return new Promise((t,r)=>{e.then(n=>{t(a.parse(n));}).catch(n=>{r(n);});});if(e!=null)return a.parse(e)},O=e=>{if(e=f(e),i.storage&&e&&typeof e=="string"){let t=i.storage.get(e);return b(t)}},T=e=>{if(e=f(e),i.storage&&e&&typeof e=="string")return i.storage.remove(e)},W=()=>{if(i.storage)return i.storage.removeAll()},l=e=>{if(!e)return false;try{return ["get","set","remove","removeAll"].every(t=>typeof e[t]=="function")}catch(t){return false}},L={get:O,set:(e,t,r=true)=>(e=f(e),i.storage.set(e,w(t,r))),remove:T,handleGetValue:b,sanitizeKey:f,handleSetValue:w,isValidStorage:l,Manager:i,removeAll:W};function $(){return function(e){try{let t=new e;if(!l(t))return;i.storage=t;}catch(t){console.error(t," registering session storage");}}}exports.AttachSessionStorage=$;exports.Session=L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function t(n){return !!(n&&typeof n=="string")}function
|
|
1
|
+
'use strict';function t(n){return !!(n&&typeof n=="string")}function e(...n){for(var i in n){let r=n[i];if(t(r))return r}return ""}exports.defaultStr=e;
|
package/build/utils/image.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('qs');function U(t,e){var c;let r=(c=e==null?void 0:e.withoutDot)!=null?c:false;if(!t||typeof t!="string")return "";let n=t.trim();if(n==="")return "";let a=n.split("/").pop()||n.split("\\").pop()||n,i=a.lastIndexOf(".");if(i<=0||i===a.length-1)return "";let
|
|
1
|
+
'use strict';require('qs');function U(t,e){var c;let r=(c=e==null?void 0:e.withoutDot)!=null?c:false;if(!t||typeof t!="string")return "";let n=t.trim();if(n==="")return "";let a=n.split("/").pop()||n.split("\\").pop()||n,i=a.lastIndexOf(".");if(i<=0||i===a.length-1)return "";let u=a.substring(i);return r?u.substring(1):u}function o(t){return !!(t&&typeof t=="string")}var C=function(t,e=""){if(!t||typeof t!="string")return "";if(!e||typeof e!="string")return t.trim();let r=t.length;for(;t.startsWith(e)&&r>=0;)t=t.slice(e.length),--r;return t.toString()},A=function(t,e=""){if(!t||typeof t!="string")return "";if(!e||typeof e!="string")return t.trim();let r=t.length;for(;t.endsWith(e)&&r>=0;)t=t.slice(0,-e.length),--r;return t.toString()},R=(t,e=true)=>typeof t!="string"?false:e!==false?/^\d*\.?\d+$/.test(t):/^\d+$/.test(t);String.prototype.ltrim=function(t){return C(this.toString(),t)};String.prototype.rtrim=function(t){return A(this.toString(),t)};String.prototype.isNumber=function(t=true){return R(this.toString(),t)};String.prototype.replaceAll=function(t,e){return !o(t)||!o(e)?this.toString():this.toString().split(t).join(e)};var L=t=>o(t)?(t=t.trim(),t.replace(/(.)([A-Z][a-z]+)/,"$1_$2").replace(/([a-z0-9])([A-Z])/,"$1_$2").toUpperCase()):"";String.prototype.toSnakeCase=function(){return L(this.toString())};var N=t=>o(t)?(t=t.trim(),t.charAt(0)+t.replace(/(_\w)/g,e=>e[1].toUpperCase()).substring(1)):"";String.prototype.toCamelCase=function(){return N(this.toString())};var z=function(t){return !t||typeof t!="string"?"":(t=t.trim(),t.charAt(0).toUpperCase()+t.slice(1))};String.prototype.upperFirst=function(){return z(this.toString())};var D=function(t){return !t||typeof t!="string"?"":(t=t.trim(),t.charAt(0).toLowerCase()+t.slice(1))};String.prototype.lowerFirst=function(){return D(this.toString())};function $(t,e={}){let{allowedMimeTypes:r,requireBase64:n=false,validateBase64:a=false}=Object.assign({},e);if(typeof t!="string"||t.trim()==="")return false;let i=t.trim();if(!i.toLowerCase().startsWith("data:"))return false;if(typeof URL!="undefined")try{if(new URL(i).protocol!=="data:")return !1;let l=/^data:([^,;]*)(;[^,]*)?,(.*)$/i,d=i.match(l);if(!d)return !1;let[,p,x,s]=d;if(s===void 0||s.length===0)return !1;let S=(p||"text/plain").trim().toLowerCase();if(p&&p.trim()!==""&&!/^[a-z]+\/[a-z0-9][a-z0-9\-+.]*$/i.test(S)||r&&r.length>0&&!r.some(m=>m.toLowerCase()===S))return !1;let I=(x==null?void 0:x.toLowerCase().includes("base64"))||!1;if(n&&!I)return !1;if(a&&I){if(!/^[A-Za-z0-9+/]*={0,2}$/.test(s)||s.length%4!==0)return !1;let m=s.match(/=+$/);if(m&&m[0].length>2)return !1;if(s.includes("=")){let j=s.indexOf("="),P=s.slice(j);if(!/^=+$/.test(P))return !1}}return !0}catch(g){return false}let u=/^data:([^,;]*)(;[^,]*)?,(.+)$/i,c=i.match(u);if(!c)return false;let[,h,y,f]=c,b=(h||"text/plain").trim().toLowerCase();if(h&&h.trim()!==""&&!/^[a-z]+\/[a-z0-9][a-z0-9\-+.]*$/i.test(b)||r&&r.length>0&&!r.some(l=>l.toLowerCase()===b))return false;let w=(y==null?void 0:y.toLowerCase().includes("base64"))||false;if(n&&!w)return false;if(a&&w){if(!/^[A-Za-z0-9+/]*={0,2}$/.test(f)||f.length%4!==0)return false;let l=f.match(/=+$/);if(l&&l[0].length>2)return false;if(f.includes("=")){let d=f.indexOf("="),p=f.slice(d);if(!/^=+$/.test(p))return false}}return true}var tt=(t,e)=>o(t)?(t=t.trim(),t.startsWith("blob:http")&&(t=t.ltrim("blob:")),$(t,{validateBase64:true})||E(t,e==null?void 0:e.supportedExtensions)):false,T=[".jpg",".jpeg",".jpe",".jfif",".png",".gif",".bmp",".dib",".tiff",".tif",".webp",".svg",".ico",".cur",".avif",".heic",".heif",".jp2",".j2k",".jpf",".jpx",".psd",".apng",".tga",".icb",".vda",".vst",".pbm",".pgm",".ppm",".xbm",".xpm",".pcx",".ras",".sgi",".rgb",".bw",".cr2",".nef",".arw",".dng",".orf",".rw2",".pef",".srw",".bpg",".flif",".jxr",".hdp"];function E(t,e){let r=t.split("?")[0].split("#")[0].toLowerCase(),n=U(r,{withoutDot:false}).toLowerCase().trim();return (Array.isArray(e)&&e.length>0?e:T).includes(n)}exports.isImageSrc=tt;
|