reslib 2.3.2 → 2.4.0

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.
Files changed (48) hide show
  1. package/build/auth/errors.js +2 -2
  2. package/build/auth/index.js +2 -2
  3. package/build/countries/countries.d.ts +2 -1454
  4. package/build/countries/countries.js +1 -1
  5. package/build/countries/index.d.ts +33 -25
  6. package/build/countries/index.js +2 -2
  7. package/build/countries/types.d.ts +304 -11
  8. package/build/currency/index.js +2 -2
  9. package/build/currency/session.js +2 -2
  10. package/build/exception/index.js +2 -2
  11. package/build/i18n/index.js +2 -2
  12. package/build/inputFormatter/index.d.ts +1 -1
  13. package/build/inputFormatter/index.js +2 -2
  14. package/build/logger/index.js +2 -2
  15. package/build/resources/ResourcePaginationHelper.js +1 -1
  16. package/build/resources/index.js +3 -3
  17. package/build/session/index.d.ts +14 -0
  18. package/build/session/index.js +1 -1
  19. package/build/translations/index.d.ts +1 -1454
  20. package/build/translations/index.js +2 -2
  21. package/build/utils/date/dateHelper.js +2 -2
  22. package/build/utils/date/index.js +2 -2
  23. package/build/utils/index.js +3 -3
  24. package/build/utils/interpolate.js +1 -1
  25. package/build/utils/isTime.js +1 -1
  26. package/build/utils/json.js +1 -1
  27. package/build/utils/numbers.js +2 -2
  28. package/build/utils/object.d.ts +8 -8
  29. package/build/utils/object.js +1 -1
  30. package/build/validator/index.js +3 -3
  31. package/build/validator/rules/array.js +2 -2
  32. package/build/validator/rules/boolean.js +2 -2
  33. package/build/validator/rules/date.js +2 -2
  34. package/build/validator/rules/default.js +2 -2
  35. package/build/validator/rules/enum.js +2 -2
  36. package/build/validator/rules/file.js +2 -2
  37. package/build/validator/rules/format.d.ts +1 -1
  38. package/build/validator/rules/format.js +3 -3
  39. package/build/validator/rules/ifRule.js +2 -2
  40. package/build/validator/rules/index.js +3 -3
  41. package/build/validator/rules/multiRules.js +2 -2
  42. package/build/validator/rules/numeric.js +2 -2
  43. package/build/validator/rules/object.js +2 -2
  44. package/build/validator/rules/string.js +2 -2
  45. package/build/validator/rules/target.js +2 -2
  46. package/build/validator/validator.d.ts +1 -1
  47. package/build/validator/validator.js +2 -2
  48. package/package.json +6 -6
@@ -14,6 +14,20 @@ declare class Manager {
14
14
  * This property is optional and can be set using the `keyNamespace` setter.
15
15
  */
16
16
  private static _keyNamespace?;
17
+ /**
18
+ * In-memory storage used as a fallback when no other storage mechanism is available.
19
+ *
20
+ * This property is a private dictionary that stores session data in memory.
21
+ * It is used when the application is running in a server-side environment
22
+ * or when the browser's localStorage is not available or disabled.
23
+ *
24
+ * The in-memory storage is automatically garbage collected when the application ends.
25
+ *
26
+ * @private
27
+ * @type {Dictionary}
28
+ * @default {}
29
+ */
30
+ private static __inMemoryStorage;
17
31
  /**
18
32
  * Retrieves or initializes the session storage implementation used by the Manager.
19
33
  *
@@ -1 +1 @@
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
+ '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 g(e){return e&&Object.prototype.toString.call(e)==="[object Promise]"?true:h(e)}function d(){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",y=()=>!!(typeof window!="undefined"&&typeof window=="object"&&window),A=()=>{if(!d()||typeof navigator!="object"||!navigator||typeof navigator.userAgent!="string")return false;let e=navigator.userAgent.toLowerCase();return /android/i.test(e)},D=()=>{var e;return !y()||!(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:d,isLinux:C,isDarwin:P,isWin32:x,isNode:c,isElectron:S,isTouchDevice:v,isServerSide:N,isClientSide:y,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,b])=>[o,e.decycle(b,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;try{let n=JSON.parse(r);return n!==null&&typeof n=="object"}catch(n){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);return l(t)&&(this._storage=t),this._storage?this._storage:(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()}:this._storage={get:n=>this.__inMemoryStorage[n],set:(n,o)=>this.__inMemoryStorage[n]=o,remove:n=>{delete this.__inMemoryStorage[n];},removeAll:()=>this.__inMemoryStorage={}},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,s.__inMemoryStorage={};var i=s;function f(e){return i.sanitizeKey(e)}var p=(e,t)=>(e=e&&a.stringify(e,t),e==null&&(e=""),e),w=e=>{if(g(e))return new Promise((t,r)=>{e.then(n=>{t(a.parse(n));}).catch(n=>{r(n);});});if(e!=null)return a.parse(e)},M=e=>{if(e=f(e),i.storage&&e&&typeof e=="string"){let t=i.storage.get(e);return w(t)}},_=e=>{if(e=f(e),i.storage&&e&&typeof e=="string")return i.storage.remove(e)},O=()=>{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}},K={get:M,set:(e,t,r=true)=>(e=f(e),i.storage.set(e,p(t,r))),remove:_,handleGetValue:w,sanitizeKey:f,handleSetValue:p,isValidStorage:l,Manager:i,removeAll:O};function L(){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=L;exports.Session=K;