@fnlb-project/shared 1.5.72 → 1.5.74

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.
@@ -75,11 +75,11 @@ export declare class TemporalMap<Key, Value> extends Map<Key, {
75
75
  export declare abstract class TextUtil {
76
76
  static cutText(text: string, maxLength: number, addDots?: boolean): string;
77
77
  }
78
- export declare const AU_STRING_ENCODING = "base64url";
79
78
  export declare const AU_ID_BYTE_LENGTH = 12;
80
79
  export declare const AU_AUTH_MAX_TOKEN_LENGTH = 1024;
81
80
  export declare class TokenUtil {
82
- private static isValidBase64Url;
81
+ private static base64UrlToBase64;
82
+ private static bytesToHex;
83
83
  static extractIdFromToken(token: string): string | null;
84
84
  }
85
85
 
@@ -1 +1 @@
1
- class a{lockPromise;constructor(){this.lockPromise=void 0}get isLocked(){return!!this.lockPromise}wait(){return this.lockPromise?.promise||Promise.resolve()}lock(){let t,e=new Promise((r)=>{t=r});this.lockPromise={promise:e,resolve:t}}unlock(){this.lockPromise?.resolve(),this.lockPromise=void 0}}var u;((i)=>{i.Default="en";i.EnUS="en-US";i.Es="es";i.Es419="es-419";i.Ar="ar";i.De="de";i.Fr="fr";i.He="he";i.Id="id";i.It="it";i.Ja="ja";i.Ko="ko";i.Pl="pl";i.Pt="pt";i.PtBR="pt-BR";i.Ru="ru";i.Th="th";i.Tr="tr";i.Vi="vi";i.Zh="zh";i.ZhHant="zh-Hant"})(u||={});var p=new Map([["en-US","en"],["pt","pt-BR"],["zh","zh-Hans"],["he","en"]]),c=Object.values(u),o=new Set(c);class s{static toAPILocale(t){return p.get(t)||(o.has(t)?t:"en")}static isSupportedLocale(t){return t!==void 0&&o.has(t)}static normalizeLocale(t){let e=typeof t==="string"&&t?t:"en";if(s.isSupportedLocale(e))return e;let r=e.split("-")[0];if(s.isSupportedLocale(r))return r;let n=e.split("-")[1];if(n&&s.isSupportedLocale(`${r}-${n}`))return`${r}-${n}`;return"en"}}class d{static wait(t){return new Promise((e)=>setTimeout(e,t))}}class f extends Map{ttl;constructor(t){super();this.ttl=t}pull(t){return super.get(t)?.value}push(t,e){let r=setTimeout(()=>this.delete(t),this.ttl);return super.set(t,{handle:r,value:e})}remove(t){let e=this.get(t);if(e)clearTimeout(e.handle);return super.delete(t)}modify(t,e){let r=super.get(t);if(r)return r.value=e,!0;return!1}}class m{static cutText(t,e,r=!0){return t.length>e?`${t.slice(0,r?Math.max(e-3,0):e)}${r?"...":""}`:t}}var y="base64url",H=12,S=1024;class l{static isValidBase64Url(t){if(!t)return!1;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e);if(!(r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57||r===45||r===95))return!1}return!0}static extractIdFromToken(t){if(!t)return null;if(t.length>1024)return null;let[e]=t.split(".");if(!e)return null;if(!l.isValidBase64Url(e))return null;try{let r=Buffer.from(e,"base64url");if(r.length<12)return null;return r.subarray(0,12).toString("hex")}catch{return null}}}export{l as TokenUtil,m as TextUtil,f as TemporalMap,o as SUPPORTED_LOCALES_SET,c as SUPPORTED_LOCALES,d as PromiseUtil,s as LocaleHelper,a as AsyncLock,y as AU_STRING_ENCODING,H as AU_ID_BYTE_LENGTH,S as AU_AUTH_MAX_TOKEN_LENGTH};
1
+ class c{lockPromise;constructor(){this.lockPromise=void 0}get isLocked(){return!!this.lockPromise}wait(){return this.lockPromise?.promise||Promise.resolve()}lock(){let t,e=new Promise((i)=>{t=i});this.lockPromise={promise:e,resolve:t}}unlock(){this.lockPromise?.resolve(),this.lockPromise=void 0}}var a;((r)=>{r.Default="en";r.EnUS="en-US";r.Es="es";r.Es419="es-419";r.Ar="ar";r.De="de";r.Fr="fr";r.He="he";r.Id="id";r.It="it";r.Ja="ja";r.Ko="ko";r.Pl="pl";r.Pt="pt";r.PtBR="pt-BR";r.Ru="ru";r.Th="th";r.Tr="tr";r.Vi="vi";r.Zh="zh";r.ZhHant="zh-Hant"})(a||={});var d=new Map([["en-US","en"],["pt","pt-BR"],["zh","zh-Hans"],["he","en"]]),h=Object.values(a),p=new Set(h);class o{static toAPILocale(t){return d.get(t)||(p.has(t)?t:"en")}static isSupportedLocale(t){return t!==void 0&&p.has(t)}static normalizeLocale(t){let e=typeof t==="string"&&t?t:"en";if(o.isSupportedLocale(e))return e;let i=e.split("-")[0];if(o.isSupportedLocale(i))return i;let n=e.split("-")[1];if(n&&o.isSupportedLocale(`${i}-${n}`))return`${i}-${n}`;return"en"}}class m{static wait(t){return new Promise((e)=>setTimeout(e,t))}}class f extends Map{ttl;constructor(t){super();this.ttl=t}pull(t){return super.get(t)?.value}push(t,e){let i=setTimeout(()=>this.delete(t),this.ttl);return super.set(t,{handle:i,value:e})}remove(t){let e=this.get(t);if(e)clearTimeout(e.handle);return super.delete(t)}modify(t,e){let i=super.get(t);if(i)return i.value=e,!0;return!1}}class b{static cutText(t,e,i=!0){return t.length>e?`${t.slice(0,i?Math.max(e-3,0):e)}${i?"...":""}`:t}}var S=12,P=1024;class T{static base64UrlToBase64(t){return t.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(t.length/4)*4,"=")}static bytesToHex(t){return Array.from(t).map((e)=>e.toString(16).padStart(2,"0")).join("")}static extractIdFromToken(t){if(!t)return null;if(t.length>1024)return null;let[e]=t.split(".");if(!e)return null;try{let i=this.base64UrlToBase64(e),n=atob(i),u=new Uint8Array(n.length);for(let s=0;s<n.length;s++)u[s]=n.charCodeAt(s);if(u.length<12)return null;let l=u.subarray(0,12);return this.bytesToHex(l)}catch{return null}}}export{T as TokenUtil,b as TextUtil,f as TemporalMap,p as SUPPORTED_LOCALES_SET,h as SUPPORTED_LOCALES,m as PromiseUtil,o as LocaleHelper,c as AsyncLock,S as AU_ID_BYTE_LENGTH,P as AU_AUTH_MAX_TOKEN_LENGTH};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fnlb-project/shared",
3
- "version": "1.5.72",
3
+ "version": "1.5.74",
4
4
  "description": "FNLB Shared Library",
5
5
  "files": [
6
6
  "dist"