@localazy/cdn-client 1.5.7 → 1.5.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).LocalazyCDN={})}(this,(function(e){"use strict";
|
|
2
|
-
/* @localazy/cdn-client@1.5.
|
|
2
|
+
/* @localazy/cdn-client@1.5.8
|
|
3
3
|
* (c) 2025 Localazy <team@localazy.com>
|
|
4
|
-
* @license MIT */class t{context;constructor(e){this.context=e}async fetchLocale(e){return this.context.cache.has(e)?new Promise((t=>{t(this.context.cache.get(e))})):this.context.client.get(e.metafileLocale.uri)}async fetchMetafile(){return await this.context.client.get(this.context.metafile.params.jsonPath)}}class s{map;constructor(){this.map=new Map}get(e){return this.map.get(e)}has(e){return this.map.has(e)}set(e,t){this.map.set(e,t)}flush(){this.map=new Map}}const a=e=>"string"==typeof e,i=e=>void 0===e,l=e=>Array.isArray(e),r=e=>"[object Object]"===Object.prototype.toString.call(e),o=e=>[...new Set(e)],n=(e,t)=>{const s={};return e.filter((e=>{const a=t(e);return!Object.hasOwn(s,a)&&(s[a]=!0,!0)}))};class c{context;cacheAdapter;constructor(e){this.context=e,this.cacheAdapter=new s}setIfMissed(e){const{metafileFile:t,metafileLocale:s,data:a}=e,i=this.keyFromMetafile({metafileFile:t,metafileLocale:s});this.cacheAdapter.has(i)||this.cacheAdapter.set(i,a)}has(e){const t=this.keyFromMetafile(e);return this.cacheAdapter.has(t)}get(e){const t=this.keyFromMetafile(e);return this.cacheAdapter.get(t)}flush(){this.cacheAdapter.flush()}keyFromMetafile(e){const{metafileFile:t,metafileLocale:s}=e,a=[...o(t.productFlavors)].sort().join("-");return[this.context.metafile.params.cdnId,t.id,t.file,t.path,t.library,t.module,t.buildType,a,s.locale,s.timestamp.toString()].filter((e=>""!==e)).join("-")}}class h{context;constructor(e){this.context=e}createCdnResponse(e){const{requests:t,responses:s,hasSingleFileResponse:a,hasSingleLocaleResponse:i}=e;return 0===s.length||void 0===s[0]?{}:(this.cacheResponses(t,s),a&&i?s[0]:h.transformResponses(e))}cacheResponses(e,t){t.forEach(((t,s)=>{if(void 0!==e[s]){const{metafileFile:a,metafileLocale:i}=e[s];a&&i&&this.context.cache.setIfMissed({metafileFile:a,metafileLocale:i,data:t})}}))}static transformResponses(e){const{requests:t,responses:s,hasSingleFileResponse:a}=e;return s.reduce(((e,s,i)=>{if(void 0!==t[i]){const{metafileFile:l,metafileLocale:r}=t[i];l&&r&&(a?e[r.locale]=s:(e[l.id]||(e[l.id]={}),e[l.id][r.locale]=s))}return e}),{})}}class u{metafile;cdn;client;api;cache;responseFactory;constructor(e){this.metafile=e.metafileContext,this.cdn=e.cdn,this.client=e.client,this.api=new t(this),this.cache=new c(this),this.responseFactory=new h(this)}}class d{id;file;path;library;module;buildType;timestamp;productFlavors;locales;baseUrl;constructor(e){this.id=e.id,this.file=e.file,this.path=e.path,this.library=e.library,this.module=e.module,this.buildType=e.buildType,this.timestamp=e.timestamp,this.productFlavors=e.productFlavors,this.locales=e.locales,this.baseUrl=e.baseUrl}toCdnFile(){return{id:this.id,file:this.file,path:this.path,library:this.library,module:this.module,buildType:this.buildType,productFlavors:this.productFlavors,locales:this.locales.map((e=>({locale:e.locale,isBaseLocale:e.isBaseLocale,uri:`${this.baseUrl}${e.uri}`})))}}}class f{language;region;script;isRtl;name;localizedName;uri;timestamp;baseLocale;constructor(e,t){this.language=e.language,this.region=e.region,this.script=e.script,this.isRtl=e.isRtl,this.name=e.name,this.localizedName=e.localizedName,this.uri=e.uri,this.timestamp=e.timestamp,this.baseLocale=t}get locale(){return this.language&&this.region&&this.script?`${this.language}_${this.region}#${this.script}`:this.language&&this.script?`${this.language}#${this.script}`:this.language&&this.region?`${this.language}_${this.region}`:this.language}get isBaseLocale(){return this.locale===this.baseLocale}toCdnLocale(){return{locale:this.locale,isBaseLocale:this.isBaseLocale,language:this.language,region:this.region,script:this.script,isRtl:this.isRtl,name:this.name,localizedName:this.localizedName}}}class p{projectUrl;baseLocale;locales;timestamp;files;filesMap;constructor(e,t){this.projectUrl=e.projectUrl,this.timestamp=e.timestamp,this.files=p.filesFactory(e.files,e.baseLocale,t),this.filesMap=p.filesMapFactory(this.files),this.locales=p.localesFactory(this.files),this.baseLocale=this.locales.find((e=>e.isBaseLocale))}static createEmpty(e){return new p({projectUrl:"",baseLocale:"",timestamp:0,files:{}},e)}static filesFactory(e,t,s){return Object.keys(e).reduce(((a,i)=>{if(void 0!==e[i]){const l=e[i].locales.map((e=>new f(e,t)));a.push(new d({...e[i],id:i,locales:l,baseUrl:s.baseUrl}))}return a}),[])}static filesMapFactory(e){return e.reduce(((e,t)=>(e[t.id]=t,e)),{})}static localesFactory(e){const t=e.reduce(((e,t)=>(e.push(...t.locales.map((e=>e.toCdnLocale()))),e)),[]);return n(t,(e=>e.locale))}}class m{options;constructor(e){this.options=m.parseMetafileUrl(e)}get url(){return this.options.url}get baseUrl(){return this.options.baseUrl}get cdnId(){return this.options.cdnId}get jsonPath(){return this.options.jsonPath}static parseMetafileUrl(e){let t;try{t=new URL(e)}catch{throw new Error('Invalid param: "options.metafile" cannot be parsed as url.')}const s=/^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/.exec(t.pathname);if(null===s||4!==s.length||void 0===s[1]||void 0===s[2])throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');const a=s[1],i=s[2];return{url:e,baseUrl:t.origin,cdnId:a,jsonPath:`/${a}/${i}.v2.json`}}}class g{params;parsedData;data;constructor(e){this.params=new m(e.metafile),this.parsedData=null,this.data=p.createEmpty(this.params)}setMetafile(e){this.parsedData=e,this.data=new p(e,this.params)}}class w{baseUrl;constructor(e){this.baseUrl=e}async get(e){const t=await fetch(`${this.baseUrl}${e}`),s=t.headers.get("content-type"),a="application/json5"===s||"application/json"===s;if(t.status>=400)throw new Error(`Request failed with status code ${t.status.toString()}`);let i;return i=a?await t.json():await t.text(),i}}class x{context;constructor(e){this.context=e}}class y extends x{flush=()=>{this.context.cache.flush()}}class b extends x{get projectUrl(){return this.context.metafile.data.projectUrl}get baseLocale(){return this.context.metafile.data.baseLocale}get url(){return this.context.metafile.params.url}get files(){return this.context.metafile.data.files.map((e=>e.toCdnFile()))}locales=e=>{const{excludeBaseLocale:t}=e||{},{locales:s}=this.context.metafile.data;return t?s.filter((e=>!e.isBaseLocale)):s};refresh=async()=>{const e=await this.context.api.fetchMetafile();this.context.metafile.setMetafile(e)};switch=async e=>{this.context.metafile.params=new m(e.metafile),await this.refresh()}}class F{data;context;constructor(e){this.context=e.context,this.data=e.data||{}}}class L{files;localesMap;hasSingleFileResponse;hasSingleLocaleResponse;context;constructor(e){this.files=[],this.localesMap=new F({context:e}),this.hasSingleFileResponse=!1,this.hasSingleLocaleResponse=!1,this.context=e}async execute(){const e=this.getPromises(),t=e.map((e=>e[0])),s=e.map((e=>e[1])),a=await Promise.all(t);return this.context.responseFactory.createCdnResponse({requests:s,responses:a,localesMap:this.localesMap,hasSingleFileResponse:this.hasSingleFileResponse,hasSingleLocaleResponse:this.hasSingleLocaleResponse})}getPromises(){return this.files.reduce(((e,t)=>(void 0!==this.localesMap.data?.[t.id]&&e.push(...this.localesMap.data[t.id].map((e=>{const s={metafileFile:t,metafileLocale:e};return[this.context.api.fetchLocale(s),s]}))),e)),[])}}class M{context;request;constructor(e){this.context=e,this.request=new L(this.context)}addFiles(e){if(!(r(e)||a(e)||i(e)||l(e)))throw new Error('Invalid param: "request.files" must be object, array, string or undefined.');if(l(e)&&e.forEach((e=>{if(!r(e)&&!a(e))throw new Error('Invalid param: array "request.files" must contain objects or strings.')})),a(e)){this.request.hasSingleFileResponse=!0;const t=this.context.metafile.data.files.find((t=>t.id===e));if(!(t instanceof d))throw new Error(`File not found: "${e}".`);this.request.files=[t]}else if(i(e))this.request.files=[...this.context.metafile.data.files];else if(l(e))this.request.files=e.map((e=>{let t;if(a(e)){const s=this.context.metafile.data.files.find((t=>t.id===e));if(i(s))throw new Error(`File not found: "${e}".`);t=s}else{const s=this.context.metafile.data.files.find((t=>t.id===e.id));if(i(s))throw new Error(`File not found: "${e.id}".`);t=s}return t}));else if(r(e)){this.request.hasSingleFileResponse=!0;const t=this.context.metafile.data.files.find((t=>t.id===e.id));if(i(t))throw new Error(`File not found: "${e.id}".`);this.request.files=[t]}return this}addLocales(e,t){if(!(a(e)||i(e)||l(e)))throw new Error('Invalid param: "request.locales" must be array, string or undefined.');return l(e)&&e.forEach((e=>{if(!a(e))throw new Error('Invalid param: array "request.locales" must contain strings.')})),a(e)?(this.request.hasSingleLocaleResponse=!0,this.request.files.reduce(((t,s)=>(t.data[s.id]=s.locales.filter((t=>t.locale===e)),t)),this.request.localesMap)):i(e)?this.request.files.reduce(((e,s)=>(e.data[s.id]=t?s.locales.filter((e=>!e.isBaseLocale)):s.locales,e)),this.request.localesMap):l(e)&&this.request.files.reduce(((t,s)=>(t.data[s.id]=s.locales.filter((t=>e.includes(t.locale))),t)),this.request.localesMap),this}getCdnRequest(){const e=this.request;return this.request=new L(this.context),e}}class q{metafile;cache;context;static version="1.5.7";constructor(e){const t=new g(e),s=new w(t.params.baseUrl);this.context=new u({metafileContext:t,cdn:this,client:s}),this.metafile=new b(this.context),this.cache=new y(this.context)}fetch=async e=>{const{files:t,locales:s,excludeBaseLocale:a}=e||{};return new M(this.context).addFiles(t).addLocales(s,a).getCdnRequest().execute()};static async create(e){if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!a(e.metafile))throw new Error('Invalid param: "options.metafile" must be string.');const t=new q(e);return await t.metafile.refresh(),t}}e.Api=t,e.CdnBase=x,e.CdnCache=y,e.CdnClient=q,e.CdnMetafile=b,e.Context=u,e.FetchHttpAdapter=w,e.LocalesCache=c,e.LocalesMap=F,e.MemoryCacheAdapter=s,e.MetafileContext=g,e.MetafileData=p,e.MetafileFile=d,e.MetafileLocale=f,e.MetafileParams=m,e.Request=L,e.RequestBuilder=M,e.ResponseFactory=h,e.isArray=l,e.isPlainObject=r,e.isString=a,e.isUndefined=i,e.uniq=o,e.uniqBy=n,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
4
|
+
* @license MIT */class t{context;constructor(e){this.context=e}async fetchLocale(e){return this.context.cache.has(e)?new Promise((t=>{t(this.context.cache.get(e))})):this.context.client.get(e.metafileLocale.uri)}async fetchMetafile(){return await this.context.client.get(this.context.metafile.params.jsonPath)}}class s{map;constructor(){this.map=new Map}get(e){return this.map.get(e)}has(e){return this.map.has(e)}set(e,t){this.map.set(e,t)}flush(){this.map=new Map}}const a=e=>"string"==typeof e,i=e=>void 0===e,l=e=>Array.isArray(e),r=e=>"[object Object]"===Object.prototype.toString.call(e),o=e=>[...new Set(e)],n=(e,t)=>{const s={};return e.filter((e=>{const a=t(e);return!Object.hasOwn(s,a)&&(s[a]=!0,!0)}))};class c{context;cacheAdapter;constructor(e){this.context=e,this.cacheAdapter=new s}setIfMissed(e){const{metafileFile:t,metafileLocale:s,data:a}=e,i=this.keyFromMetafile({metafileFile:t,metafileLocale:s});this.cacheAdapter.has(i)||this.cacheAdapter.set(i,a)}has(e){const t=this.keyFromMetafile(e);return this.cacheAdapter.has(t)}get(e){const t=this.keyFromMetafile(e);return this.cacheAdapter.get(t)}flush(){this.cacheAdapter.flush()}keyFromMetafile(e){const{metafileFile:t,metafileLocale:s}=e,a=[...o(t.productFlavors)].sort().join("-");return[this.context.metafile.params.cdnId,t.id,t.file,t.path,t.library,t.module,t.buildType,a,s.locale,s.timestamp.toString()].filter((e=>""!==e)).join("-")}}class h{context;constructor(e){this.context=e}createCdnResponse(e){const{requests:t,responses:s,hasSingleFileResponse:a,hasSingleLocaleResponse:i}=e;return 0===s.length||void 0===s[0]?{}:(this.cacheResponses(t,s),a&&i?s[0]:h.transformResponses(e))}cacheResponses(e,t){t.forEach(((t,s)=>{if(void 0!==e[s]){const{metafileFile:a,metafileLocale:i}=e[s];a&&i&&this.context.cache.setIfMissed({metafileFile:a,metafileLocale:i,data:t})}}))}static transformResponses(e){const{requests:t,responses:s,hasSingleFileResponse:a}=e;return s.reduce(((e,s,i)=>{if(void 0!==t[i]){const{metafileFile:l,metafileLocale:r}=t[i];l&&r&&(a?e[r.locale]=s:(e[l.id]||(e[l.id]={}),e[l.id][r.locale]=s))}return e}),{})}}class u{metafile;cdn;client;api;cache;responseFactory;constructor(e){this.metafile=e.metafileContext,this.cdn=e.cdn,this.client=e.client,this.api=new t(this),this.cache=new c(this),this.responseFactory=new h(this)}}class d{id;file;path;library;module;buildType;timestamp;productFlavors;locales;baseUrl;constructor(e){this.id=e.id,this.file=e.file,this.path=e.path,this.library=e.library,this.module=e.module,this.buildType=e.buildType,this.timestamp=e.timestamp,this.productFlavors=e.productFlavors,this.locales=e.locales,this.baseUrl=e.baseUrl}toCdnFile(){return{id:this.id,file:this.file,path:this.path,library:this.library,module:this.module,buildType:this.buildType,productFlavors:this.productFlavors,locales:this.locales.map((e=>({locale:e.locale,isBaseLocale:e.isBaseLocale,uri:`${this.baseUrl}${e.uri}`})))}}}class f{language;region;script;isRtl;name;localizedName;uri;timestamp;baseLocale;constructor(e,t){this.language=e.language,this.region=e.region,this.script=e.script,this.isRtl=e.isRtl,this.name=e.name,this.localizedName=e.localizedName,this.uri=e.uri,this.timestamp=e.timestamp,this.baseLocale=t}get locale(){return this.language&&this.region&&this.script?`${this.language}_${this.region}#${this.script}`:this.language&&this.script?`${this.language}#${this.script}`:this.language&&this.region?`${this.language}_${this.region}`:this.language}get isBaseLocale(){return this.locale===this.baseLocale}toCdnLocale(){return{locale:this.locale,isBaseLocale:this.isBaseLocale,language:this.language,region:this.region,script:this.script,isRtl:this.isRtl,name:this.name,localizedName:this.localizedName}}}class p{projectUrl;baseLocale;locales;timestamp;files;filesMap;constructor(e,t){this.projectUrl=e.projectUrl,this.timestamp=e.timestamp,this.files=p.filesFactory(e.files,e.baseLocale,t),this.filesMap=p.filesMapFactory(this.files),this.locales=p.localesFactory(this.files),this.baseLocale=this.locales.find((e=>e.isBaseLocale))}static createEmpty(e){return new p({projectUrl:"",baseLocale:"",timestamp:0,files:{}},e)}static filesFactory(e,t,s){return Object.keys(e).reduce(((a,i)=>{if(void 0!==e[i]){const l=e[i].locales.map((e=>new f(e,t)));a.push(new d({...e[i],id:i,locales:l,baseUrl:s.baseUrl}))}return a}),[])}static filesMapFactory(e){return e.reduce(((e,t)=>(e[t.id]=t,e)),{})}static localesFactory(e){const t=e.reduce(((e,t)=>(e.push(...t.locales.map((e=>e.toCdnLocale()))),e)),[]);return n(t,(e=>e.locale))}}class m{options;constructor(e){this.options=m.parseMetafileUrl(e)}get url(){return this.options.url}get baseUrl(){return this.options.baseUrl}get cdnId(){return this.options.cdnId}get jsonPath(){return this.options.jsonPath}static parseMetafileUrl(e){let t;try{t=new URL(e)}catch{throw new Error('Invalid param: "options.metafile" cannot be parsed as url.')}const s=/^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/.exec(t.pathname);if(null===s||4!==s.length||void 0===s[1]||void 0===s[2])throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');const a=s[1],i=s[2];return{url:e,baseUrl:t.origin,cdnId:a,jsonPath:`/${a}/${i}.v2.json`}}}class g{params;parsedData;data;constructor(e){this.params=new m(e.metafile),this.parsedData=null,this.data=p.createEmpty(this.params)}setMetafile(e){this.parsedData=e,this.data=new p(e,this.params)}}class w{baseUrl;constructor(e){this.baseUrl=e}async get(e){const t=await fetch(`${this.baseUrl}${e}`),s=t.headers.get("content-type"),a="application/json5"===s||"application/json"===s;if(t.status>=400)throw new Error(`Request failed with status code ${t.status.toString()}`);let i;return i=a?await t.json():await t.text(),i}}class x{context;constructor(e){this.context=e}}class y extends x{flush=()=>{this.context.cache.flush()}}class b extends x{get projectUrl(){return this.context.metafile.data.projectUrl}get baseLocale(){return this.context.metafile.data.baseLocale}get url(){return this.context.metafile.params.url}get files(){return this.context.metafile.data.files.map((e=>e.toCdnFile()))}locales=e=>{const{excludeBaseLocale:t}=e||{},{locales:s}=this.context.metafile.data;return t?s.filter((e=>!e.isBaseLocale)):s};refresh=async()=>{const e=await this.context.api.fetchMetafile();this.context.metafile.setMetafile(e)};switch=async e=>{this.context.metafile.params=new m(e.metafile),await this.refresh()}}class F{data;context;constructor(e){this.context=e.context,this.data=e.data||{}}}class L{files;localesMap;hasSingleFileResponse;hasSingleLocaleResponse;context;constructor(e){this.files=[],this.localesMap=new F({context:e}),this.hasSingleFileResponse=!1,this.hasSingleLocaleResponse=!1,this.context=e}async execute(){const e=this.getPromises(),t=e.map((e=>e[0])),s=e.map((e=>e[1])),a=await Promise.all(t);return this.context.responseFactory.createCdnResponse({requests:s,responses:a,localesMap:this.localesMap,hasSingleFileResponse:this.hasSingleFileResponse,hasSingleLocaleResponse:this.hasSingleLocaleResponse})}getPromises(){return this.files.reduce(((e,t)=>(void 0!==this.localesMap.data?.[t.id]&&e.push(...this.localesMap.data[t.id].map((e=>{const s={metafileFile:t,metafileLocale:e};return[this.context.api.fetchLocale(s),s]}))),e)),[])}}class M{context;request;constructor(e){this.context=e,this.request=new L(this.context)}addFiles(e){if(!(r(e)||a(e)||i(e)||l(e)))throw new Error('Invalid param: "request.files" must be object, array, string or undefined.');if(l(e)&&e.forEach((e=>{if(!r(e)&&!a(e))throw new Error('Invalid param: array "request.files" must contain objects or strings.')})),a(e)){this.request.hasSingleFileResponse=!0;const t=this.context.metafile.data.files.find((t=>t.id===e));if(!(t instanceof d))throw new Error(`File not found: "${e}".`);this.request.files=[t]}else if(i(e))this.request.files=[...this.context.metafile.data.files];else if(l(e))this.request.files=e.map((e=>{let t;if(a(e)){const s=this.context.metafile.data.files.find((t=>t.id===e));if(i(s))throw new Error(`File not found: "${e}".`);t=s}else{const s=this.context.metafile.data.files.find((t=>t.id===e.id));if(i(s))throw new Error(`File not found: "${e.id}".`);t=s}return t}));else if(r(e)){this.request.hasSingleFileResponse=!0;const t=this.context.metafile.data.files.find((t=>t.id===e.id));if(i(t))throw new Error(`File not found: "${e.id}".`);this.request.files=[t]}return this}addLocales(e,t){if(!(a(e)||i(e)||l(e)))throw new Error('Invalid param: "request.locales" must be array, string or undefined.');return l(e)&&e.forEach((e=>{if(!a(e))throw new Error('Invalid param: array "request.locales" must contain strings.')})),a(e)?(this.request.hasSingleLocaleResponse=!0,this.request.files.reduce(((t,s)=>(t.data[s.id]=s.locales.filter((t=>t.locale===e)),t)),this.request.localesMap)):i(e)?this.request.files.reduce(((e,s)=>(e.data[s.id]=t?s.locales.filter((e=>!e.isBaseLocale)):s.locales,e)),this.request.localesMap):l(e)&&this.request.files.reduce(((t,s)=>(t.data[s.id]=s.locales.filter((t=>e.includes(t.locale))),t)),this.request.localesMap),this}getCdnRequest(){const e=this.request;return this.request=new L(this.context),e}}class q{metafile;cache;context;static version="1.5.8";constructor(e){const t=new g(e),s=new w(t.params.baseUrl);this.context=new u({metafileContext:t,cdn:this,client:s}),this.metafile=new b(this.context),this.cache=new y(this.context)}fetch=async e=>{const{files:t,locales:s,excludeBaseLocale:a}=e||{};return new M(this.context).addFiles(t).addLocales(s,a).getCdnRequest().execute()};static async create(e){if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!a(e.metafile))throw new Error('Invalid param: "options.metafile" must be string.');const t=new q(e);return await t.metafile.refresh(),t}}e.Api=t,e.CdnBase=x,e.CdnCache=y,e.CdnClient=q,e.CdnMetafile=b,e.Context=u,e.FetchHttpAdapter=w,e.LocalesCache=c,e.LocalesMap=F,e.MemoryCacheAdapter=s,e.MetafileContext=g,e.MetafileData=p,e.MetafileFile=d,e.MetafileLocale=f,e.MetafileParams=m,e.Request=L,e.RequestBuilder=M,e.ResponseFactory=h,e.isArray=l,e.isPlainObject=r,e.isString=a,e.isUndefined=i,e.uniq=o,e.uniqBy=n,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
5
5
|
//# sourceMappingURL=localazy-cdn-client.umd.min.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @localazy/cdn-client@1.5.
|
|
1
|
+
/* @localazy/cdn-client@1.5.8
|
|
2
2
|
* (c) 2025 Localazy <team@localazy.com>
|
|
3
3
|
* @license MIT */
|
|
4
4
|
class Api {
|
|
@@ -591,7 +591,7 @@ class CdnClient {
|
|
|
591
591
|
metafile;
|
|
592
592
|
cache;
|
|
593
593
|
context;
|
|
594
|
-
static version = "1.5.
|
|
594
|
+
static version = "1.5.8";
|
|
595
595
|
constructor(options) {
|
|
596
596
|
const metafileContext = new MetafileContext(options);
|
|
597
597
|
const client = new FetchHttpAdapter(metafileContext.params.baseUrl);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* @localazy/cdn-client@1.5.
|
|
1
|
+
/* @localazy/cdn-client@1.5.8
|
|
2
2
|
* (c) 2025 Localazy <team@localazy.com>
|
|
3
3
|
* @license MIT */
|
|
4
|
-
class e{context;constructor(e){this.context=e}async fetchLocale(e){return this.context.cache.has(e)?new Promise((t=>{t(this.context.cache.get(e))})):this.context.client.get(e.metafileLocale.uri)}async fetchMetafile(){return await this.context.client.get(this.context.metafile.params.jsonPath)}}class t{map;constructor(){this.map=new Map}get(e){return this.map.get(e)}has(e){return this.map.has(e)}set(e,t){this.map.set(e,t)}flush(){this.map=new Map}}const s=e=>"string"==typeof e,a=e=>void 0===e,i=e=>Array.isArray(e),l=e=>"[object Object]"===Object.prototype.toString.call(e),r=e=>[...new Set(e)],o=(e,t)=>{const s={};return e.filter((e=>{const a=t(e);return!Object.hasOwn(s,a)&&(s[a]=!0,!0)}))};class c{context;cacheAdapter;constructor(e){this.context=e,this.cacheAdapter=new t}setIfMissed(e){const{metafileFile:t,metafileLocale:s,data:a}=e,i=this.keyFromMetafile({metafileFile:t,metafileLocale:s});this.cacheAdapter.has(i)||this.cacheAdapter.set(i,a)}has(e){const t=this.keyFromMetafile(e);return this.cacheAdapter.has(t)}get(e){const t=this.keyFromMetafile(e);return this.cacheAdapter.get(t)}flush(){this.cacheAdapter.flush()}keyFromMetafile(e){const{metafileFile:t,metafileLocale:s}=e,a=[...r(t.productFlavors)].sort().join("-");return[this.context.metafile.params.cdnId,t.id,t.file,t.path,t.library,t.module,t.buildType,a,s.locale,s.timestamp.toString()].filter((e=>""!==e)).join("-")}}class n{context;constructor(e){this.context=e}createCdnResponse(e){const{requests:t,responses:s,hasSingleFileResponse:a,hasSingleLocaleResponse:i}=e;return 0===s.length||void 0===s[0]?{}:(this.cacheResponses(t,s),a&&i?s[0]:n.transformResponses(e))}cacheResponses(e,t){t.forEach(((t,s)=>{if(void 0!==e[s]){const{metafileFile:a,metafileLocale:i}=e[s];a&&i&&this.context.cache.setIfMissed({metafileFile:a,metafileLocale:i,data:t})}}))}static transformResponses(e){const{requests:t,responses:s,hasSingleFileResponse:a}=e;return s.reduce(((e,s,i)=>{if(void 0!==t[i]){const{metafileFile:l,metafileLocale:r}=t[i];l&&r&&(a?e[r.locale]=s:(e[l.id]||(e[l.id]={}),e[l.id][r.locale]=s))}return e}),{})}}class h{metafile;cdn;client;api;cache;responseFactory;constructor(t){this.metafile=t.metafileContext,this.cdn=t.cdn,this.client=t.client,this.api=new e(this),this.cache=new c(this),this.responseFactory=new n(this)}}class u{id;file;path;library;module;buildType;timestamp;productFlavors;locales;baseUrl;constructor(e){this.id=e.id,this.file=e.file,this.path=e.path,this.library=e.library,this.module=e.module,this.buildType=e.buildType,this.timestamp=e.timestamp,this.productFlavors=e.productFlavors,this.locales=e.locales,this.baseUrl=e.baseUrl}toCdnFile(){return{id:this.id,file:this.file,path:this.path,library:this.library,module:this.module,buildType:this.buildType,productFlavors:this.productFlavors,locales:this.locales.map((e=>({locale:e.locale,isBaseLocale:e.isBaseLocale,uri:`${this.baseUrl}${e.uri}`})))}}}class p{language;region;script;isRtl;name;localizedName;uri;timestamp;baseLocale;constructor(e,t){this.language=e.language,this.region=e.region,this.script=e.script,this.isRtl=e.isRtl,this.name=e.name,this.localizedName=e.localizedName,this.uri=e.uri,this.timestamp=e.timestamp,this.baseLocale=t}get locale(){return this.language&&this.region&&this.script?`${this.language}_${this.region}#${this.script}`:this.language&&this.script?`${this.language}#${this.script}`:this.language&&this.region?`${this.language}_${this.region}`:this.language}get isBaseLocale(){return this.locale===this.baseLocale}toCdnLocale(){return{locale:this.locale,isBaseLocale:this.isBaseLocale,language:this.language,region:this.region,script:this.script,isRtl:this.isRtl,name:this.name,localizedName:this.localizedName}}}class d{projectUrl;baseLocale;locales;timestamp;files;filesMap;constructor(e,t){this.projectUrl=e.projectUrl,this.timestamp=e.timestamp,this.files=d.filesFactory(e.files,e.baseLocale,t),this.filesMap=d.filesMapFactory(this.files),this.locales=d.localesFactory(this.files),this.baseLocale=this.locales.find((e=>e.isBaseLocale))}static createEmpty(e){return new d({projectUrl:"",baseLocale:"",timestamp:0,files:{}},e)}static filesFactory(e,t,s){return Object.keys(e).reduce(((a,i)=>{if(void 0!==e[i]){const l=e[i].locales.map((e=>new p(e,t)));a.push(new u({...e[i],id:i,locales:l,baseUrl:s.baseUrl}))}return a}),[])}static filesMapFactory(e){return e.reduce(((e,t)=>(e[t.id]=t,e)),{})}static localesFactory(e){const t=e.reduce(((e,t)=>(e.push(...t.locales.map((e=>e.toCdnLocale()))),e)),[]);return o(t,(e=>e.locale))}}class f{options;constructor(e){this.options=f.parseMetafileUrl(e)}get url(){return this.options.url}get baseUrl(){return this.options.baseUrl}get cdnId(){return this.options.cdnId}get jsonPath(){return this.options.jsonPath}static parseMetafileUrl(e){let t;try{t=new URL(e)}catch{throw new Error('Invalid param: "options.metafile" cannot be parsed as url.')}const s=/^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/.exec(t.pathname);if(null===s||4!==s.length||void 0===s[1]||void 0===s[2])throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');const a=s[1],i=s[2];return{url:e,baseUrl:t.origin,cdnId:a,jsonPath:`/${a}/${i}.v2.json`}}}class m{params;parsedData;data;constructor(e){this.params=new f(e.metafile),this.parsedData=null,this.data=d.createEmpty(this.params)}setMetafile(e){this.parsedData=e,this.data=new d(e,this.params)}}class g{baseUrl;constructor(e){this.baseUrl=e}async get(e){const t=await fetch(`${this.baseUrl}${e}`),s=t.headers.get("content-type"),a="application/json5"===s||"application/json"===s;if(t.status>=400)throw new Error(`Request failed with status code ${t.status.toString()}`);let i;return i=a?await t.json():await t.text(),i}}class w{context;constructor(e){this.context=e}}class x extends w{flush=()=>{this.context.cache.flush()}}class y extends w{get projectUrl(){return this.context.metafile.data.projectUrl}get baseLocale(){return this.context.metafile.data.baseLocale}get url(){return this.context.metafile.params.url}get files(){return this.context.metafile.data.files.map((e=>e.toCdnFile()))}locales=e=>{const{excludeBaseLocale:t}=e||{},{locales:s}=this.context.metafile.data;return t?s.filter((e=>!e.isBaseLocale)):s};refresh=async()=>{const e=await this.context.api.fetchMetafile();this.context.metafile.setMetafile(e)};switch=async e=>{this.context.metafile.params=new f(e.metafile),await this.refresh()}}class b{data;context;constructor(e){this.context=e.context,this.data=e.data||{}}}class F{files;localesMap;hasSingleFileResponse;hasSingleLocaleResponse;context;constructor(e){this.files=[],this.localesMap=new b({context:e}),this.hasSingleFileResponse=!1,this.hasSingleLocaleResponse=!1,this.context=e}async execute(){const e=this.getPromises(),t=e.map((e=>e[0])),s=e.map((e=>e[1])),a=await Promise.all(t);return this.context.responseFactory.createCdnResponse({requests:s,responses:a,localesMap:this.localesMap,hasSingleFileResponse:this.hasSingleFileResponse,hasSingleLocaleResponse:this.hasSingleLocaleResponse})}getPromises(){return this.files.reduce(((e,t)=>(void 0!==this.localesMap.data?.[t.id]&&e.push(...this.localesMap.data[t.id].map((e=>{const s={metafileFile:t,metafileLocale:e};return[this.context.api.fetchLocale(s),s]}))),e)),[])}}class L{context;request;constructor(e){this.context=e,this.request=new F(this.context)}addFiles(e){if(!(l(e)||s(e)||a(e)||i(e)))throw new Error('Invalid param: "request.files" must be object, array, string or undefined.');if(i(e)&&e.forEach((e=>{if(!l(e)&&!s(e))throw new Error('Invalid param: array "request.files" must contain objects or strings.')})),s(e)){this.request.hasSingleFileResponse=!0;const t=this.context.metafile.data.files.find((t=>t.id===e));if(!(t instanceof u))throw new Error(`File not found: "${e}".`);this.request.files=[t]}else if(a(e))this.request.files=[...this.context.metafile.data.files];else if(i(e))this.request.files=e.map((e=>{let t;if(s(e)){const s=this.context.metafile.data.files.find((t=>t.id===e));if(a(s))throw new Error(`File not found: "${e}".`);t=s}else{const s=this.context.metafile.data.files.find((t=>t.id===e.id));if(a(s))throw new Error(`File not found: "${e.id}".`);t=s}return t}));else if(l(e)){this.request.hasSingleFileResponse=!0;const t=this.context.metafile.data.files.find((t=>t.id===e.id));if(a(t))throw new Error(`File not found: "${e.id}".`);this.request.files=[t]}return this}addLocales(e,t){if(!(s(e)||a(e)||i(e)))throw new Error('Invalid param: "request.locales" must be array, string or undefined.');return i(e)&&e.forEach((e=>{if(!s(e))throw new Error('Invalid param: array "request.locales" must contain strings.')})),s(e)?(this.request.hasSingleLocaleResponse=!0,this.request.files.reduce(((t,s)=>(t.data[s.id]=s.locales.filter((t=>t.locale===e)),t)),this.request.localesMap)):a(e)?this.request.files.reduce(((e,s)=>(e.data[s.id]=t?s.locales.filter((e=>!e.isBaseLocale)):s.locales,e)),this.request.localesMap):i(e)&&this.request.files.reduce(((t,s)=>(t.data[s.id]=s.locales.filter((t=>e.includes(t.locale))),t)),this.request.localesMap),this}getCdnRequest(){const e=this.request;return this.request=new F(this.context),e}}class R{metafile;cache;context;static version="1.5.7";constructor(e){const t=new m(e),s=new g(t.params.baseUrl);this.context=new h({metafileContext:t,cdn:this,client:s}),this.metafile=new y(this.context),this.cache=new x(this.context)}fetch=async e=>{const{files:t,locales:s,excludeBaseLocale:a}=e||{};return new L(this.context).addFiles(t).addLocales(s,a).getCdnRequest().execute()};static async create(e){if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!s(e.metafile))throw new Error('Invalid param: "options.metafile" must be string.');const t=new R(e);return await t.metafile.refresh(),t}}export{e as Api,w as CdnBase,x as CdnCache,R as CdnClient,y as CdnMetafile,h as Context,g as FetchHttpAdapter,c as LocalesCache,b as LocalesMap,t as MemoryCacheAdapter,m as MetafileContext,d as MetafileData,u as MetafileFile,p as MetafileLocale,f as MetafileParams,F as Request,L as RequestBuilder,n as ResponseFactory,i as isArray,l as isPlainObject,s as isString,a as isUndefined,r as uniq,o as uniqBy};
|
|
4
|
+
class e{context;constructor(e){this.context=e}async fetchLocale(e){return this.context.cache.has(e)?new Promise((t=>{t(this.context.cache.get(e))})):this.context.client.get(e.metafileLocale.uri)}async fetchMetafile(){return await this.context.client.get(this.context.metafile.params.jsonPath)}}class t{map;constructor(){this.map=new Map}get(e){return this.map.get(e)}has(e){return this.map.has(e)}set(e,t){this.map.set(e,t)}flush(){this.map=new Map}}const s=e=>"string"==typeof e,a=e=>void 0===e,i=e=>Array.isArray(e),l=e=>"[object Object]"===Object.prototype.toString.call(e),r=e=>[...new Set(e)],o=(e,t)=>{const s={};return e.filter((e=>{const a=t(e);return!Object.hasOwn(s,a)&&(s[a]=!0,!0)}))};class c{context;cacheAdapter;constructor(e){this.context=e,this.cacheAdapter=new t}setIfMissed(e){const{metafileFile:t,metafileLocale:s,data:a}=e,i=this.keyFromMetafile({metafileFile:t,metafileLocale:s});this.cacheAdapter.has(i)||this.cacheAdapter.set(i,a)}has(e){const t=this.keyFromMetafile(e);return this.cacheAdapter.has(t)}get(e){const t=this.keyFromMetafile(e);return this.cacheAdapter.get(t)}flush(){this.cacheAdapter.flush()}keyFromMetafile(e){const{metafileFile:t,metafileLocale:s}=e,a=[...r(t.productFlavors)].sort().join("-");return[this.context.metafile.params.cdnId,t.id,t.file,t.path,t.library,t.module,t.buildType,a,s.locale,s.timestamp.toString()].filter((e=>""!==e)).join("-")}}class n{context;constructor(e){this.context=e}createCdnResponse(e){const{requests:t,responses:s,hasSingleFileResponse:a,hasSingleLocaleResponse:i}=e;return 0===s.length||void 0===s[0]?{}:(this.cacheResponses(t,s),a&&i?s[0]:n.transformResponses(e))}cacheResponses(e,t){t.forEach(((t,s)=>{if(void 0!==e[s]){const{metafileFile:a,metafileLocale:i}=e[s];a&&i&&this.context.cache.setIfMissed({metafileFile:a,metafileLocale:i,data:t})}}))}static transformResponses(e){const{requests:t,responses:s,hasSingleFileResponse:a}=e;return s.reduce(((e,s,i)=>{if(void 0!==t[i]){const{metafileFile:l,metafileLocale:r}=t[i];l&&r&&(a?e[r.locale]=s:(e[l.id]||(e[l.id]={}),e[l.id][r.locale]=s))}return e}),{})}}class h{metafile;cdn;client;api;cache;responseFactory;constructor(t){this.metafile=t.metafileContext,this.cdn=t.cdn,this.client=t.client,this.api=new e(this),this.cache=new c(this),this.responseFactory=new n(this)}}class u{id;file;path;library;module;buildType;timestamp;productFlavors;locales;baseUrl;constructor(e){this.id=e.id,this.file=e.file,this.path=e.path,this.library=e.library,this.module=e.module,this.buildType=e.buildType,this.timestamp=e.timestamp,this.productFlavors=e.productFlavors,this.locales=e.locales,this.baseUrl=e.baseUrl}toCdnFile(){return{id:this.id,file:this.file,path:this.path,library:this.library,module:this.module,buildType:this.buildType,productFlavors:this.productFlavors,locales:this.locales.map((e=>({locale:e.locale,isBaseLocale:e.isBaseLocale,uri:`${this.baseUrl}${e.uri}`})))}}}class p{language;region;script;isRtl;name;localizedName;uri;timestamp;baseLocale;constructor(e,t){this.language=e.language,this.region=e.region,this.script=e.script,this.isRtl=e.isRtl,this.name=e.name,this.localizedName=e.localizedName,this.uri=e.uri,this.timestamp=e.timestamp,this.baseLocale=t}get locale(){return this.language&&this.region&&this.script?`${this.language}_${this.region}#${this.script}`:this.language&&this.script?`${this.language}#${this.script}`:this.language&&this.region?`${this.language}_${this.region}`:this.language}get isBaseLocale(){return this.locale===this.baseLocale}toCdnLocale(){return{locale:this.locale,isBaseLocale:this.isBaseLocale,language:this.language,region:this.region,script:this.script,isRtl:this.isRtl,name:this.name,localizedName:this.localizedName}}}class d{projectUrl;baseLocale;locales;timestamp;files;filesMap;constructor(e,t){this.projectUrl=e.projectUrl,this.timestamp=e.timestamp,this.files=d.filesFactory(e.files,e.baseLocale,t),this.filesMap=d.filesMapFactory(this.files),this.locales=d.localesFactory(this.files),this.baseLocale=this.locales.find((e=>e.isBaseLocale))}static createEmpty(e){return new d({projectUrl:"",baseLocale:"",timestamp:0,files:{}},e)}static filesFactory(e,t,s){return Object.keys(e).reduce(((a,i)=>{if(void 0!==e[i]){const l=e[i].locales.map((e=>new p(e,t)));a.push(new u({...e[i],id:i,locales:l,baseUrl:s.baseUrl}))}return a}),[])}static filesMapFactory(e){return e.reduce(((e,t)=>(e[t.id]=t,e)),{})}static localesFactory(e){const t=e.reduce(((e,t)=>(e.push(...t.locales.map((e=>e.toCdnLocale()))),e)),[]);return o(t,(e=>e.locale))}}class f{options;constructor(e){this.options=f.parseMetafileUrl(e)}get url(){return this.options.url}get baseUrl(){return this.options.baseUrl}get cdnId(){return this.options.cdnId}get jsonPath(){return this.options.jsonPath}static parseMetafileUrl(e){let t;try{t=new URL(e)}catch{throw new Error('Invalid param: "options.metafile" cannot be parsed as url.')}const s=/^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/.exec(t.pathname);if(null===s||4!==s.length||void 0===s[1]||void 0===s[2])throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');const a=s[1],i=s[2];return{url:e,baseUrl:t.origin,cdnId:a,jsonPath:`/${a}/${i}.v2.json`}}}class m{params;parsedData;data;constructor(e){this.params=new f(e.metafile),this.parsedData=null,this.data=d.createEmpty(this.params)}setMetafile(e){this.parsedData=e,this.data=new d(e,this.params)}}class g{baseUrl;constructor(e){this.baseUrl=e}async get(e){const t=await fetch(`${this.baseUrl}${e}`),s=t.headers.get("content-type"),a="application/json5"===s||"application/json"===s;if(t.status>=400)throw new Error(`Request failed with status code ${t.status.toString()}`);let i;return i=a?await t.json():await t.text(),i}}class w{context;constructor(e){this.context=e}}class x extends w{flush=()=>{this.context.cache.flush()}}class y extends w{get projectUrl(){return this.context.metafile.data.projectUrl}get baseLocale(){return this.context.metafile.data.baseLocale}get url(){return this.context.metafile.params.url}get files(){return this.context.metafile.data.files.map((e=>e.toCdnFile()))}locales=e=>{const{excludeBaseLocale:t}=e||{},{locales:s}=this.context.metafile.data;return t?s.filter((e=>!e.isBaseLocale)):s};refresh=async()=>{const e=await this.context.api.fetchMetafile();this.context.metafile.setMetafile(e)};switch=async e=>{this.context.metafile.params=new f(e.metafile),await this.refresh()}}class b{data;context;constructor(e){this.context=e.context,this.data=e.data||{}}}class F{files;localesMap;hasSingleFileResponse;hasSingleLocaleResponse;context;constructor(e){this.files=[],this.localesMap=new b({context:e}),this.hasSingleFileResponse=!1,this.hasSingleLocaleResponse=!1,this.context=e}async execute(){const e=this.getPromises(),t=e.map((e=>e[0])),s=e.map((e=>e[1])),a=await Promise.all(t);return this.context.responseFactory.createCdnResponse({requests:s,responses:a,localesMap:this.localesMap,hasSingleFileResponse:this.hasSingleFileResponse,hasSingleLocaleResponse:this.hasSingleLocaleResponse})}getPromises(){return this.files.reduce(((e,t)=>(void 0!==this.localesMap.data?.[t.id]&&e.push(...this.localesMap.data[t.id].map((e=>{const s={metafileFile:t,metafileLocale:e};return[this.context.api.fetchLocale(s),s]}))),e)),[])}}class L{context;request;constructor(e){this.context=e,this.request=new F(this.context)}addFiles(e){if(!(l(e)||s(e)||a(e)||i(e)))throw new Error('Invalid param: "request.files" must be object, array, string or undefined.');if(i(e)&&e.forEach((e=>{if(!l(e)&&!s(e))throw new Error('Invalid param: array "request.files" must contain objects or strings.')})),s(e)){this.request.hasSingleFileResponse=!0;const t=this.context.metafile.data.files.find((t=>t.id===e));if(!(t instanceof u))throw new Error(`File not found: "${e}".`);this.request.files=[t]}else if(a(e))this.request.files=[...this.context.metafile.data.files];else if(i(e))this.request.files=e.map((e=>{let t;if(s(e)){const s=this.context.metafile.data.files.find((t=>t.id===e));if(a(s))throw new Error(`File not found: "${e}".`);t=s}else{const s=this.context.metafile.data.files.find((t=>t.id===e.id));if(a(s))throw new Error(`File not found: "${e.id}".`);t=s}return t}));else if(l(e)){this.request.hasSingleFileResponse=!0;const t=this.context.metafile.data.files.find((t=>t.id===e.id));if(a(t))throw new Error(`File not found: "${e.id}".`);this.request.files=[t]}return this}addLocales(e,t){if(!(s(e)||a(e)||i(e)))throw new Error('Invalid param: "request.locales" must be array, string or undefined.');return i(e)&&e.forEach((e=>{if(!s(e))throw new Error('Invalid param: array "request.locales" must contain strings.')})),s(e)?(this.request.hasSingleLocaleResponse=!0,this.request.files.reduce(((t,s)=>(t.data[s.id]=s.locales.filter((t=>t.locale===e)),t)),this.request.localesMap)):a(e)?this.request.files.reduce(((e,s)=>(e.data[s.id]=t?s.locales.filter((e=>!e.isBaseLocale)):s.locales,e)),this.request.localesMap):i(e)&&this.request.files.reduce(((t,s)=>(t.data[s.id]=s.locales.filter((t=>e.includes(t.locale))),t)),this.request.localesMap),this}getCdnRequest(){const e=this.request;return this.request=new F(this.context),e}}class R{metafile;cache;context;static version="1.5.8";constructor(e){const t=new m(e),s=new g(t.params.baseUrl);this.context=new h({metafileContext:t,cdn:this,client:s}),this.metafile=new y(this.context),this.cache=new x(this.context)}fetch=async e=>{const{files:t,locales:s,excludeBaseLocale:a}=e||{};return new L(this.context).addFiles(t).addLocales(s,a).getCdnRequest().execute()};static async create(e){if(!e)throw new Error('Invalid param: missing required "options" parameter.');if(!s(e.metafile))throw new Error('Invalid param: "options.metafile" must be string.');const t=new R(e);return await t.metafile.refresh(),t}}export{e as Api,w as CdnBase,x as CdnCache,R as CdnClient,y as CdnMetafile,h as Context,g as FetchHttpAdapter,c as LocalesCache,b as LocalesMap,t as MemoryCacheAdapter,m as MetafileContext,d as MetafileData,u as MetafileFile,p as MetafileLocale,f as MetafileParams,F as Request,L as RequestBuilder,n as ResponseFactory,i as isArray,l as isPlainObject,s as isString,a as isUndefined,r as uniq,o as uniqBy};
|
|
5
5
|
//# sourceMappingURL=localazy-cdn-client.min.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* @localazy/cdn-client@1.5.
|
|
2
|
+
/* @localazy/cdn-client@1.5.8
|
|
3
3
|
* (c) 2025 Localazy <team@localazy.com>
|
|
4
4
|
* @license MIT */
|
|
5
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -593,7 +593,7 @@ class CdnClient {
|
|
|
593
593
|
metafile;
|
|
594
594
|
cache;
|
|
595
595
|
context;
|
|
596
|
-
static version = "1.5.
|
|
596
|
+
static version = "1.5.8";
|
|
597
597
|
constructor(options) {
|
|
598
598
|
const metafileContext = new MetafileContext(options);
|
|
599
599
|
const client = new FetchHttpAdapter(metafileContext.params.baseUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localazy/cdn-client",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"description": "Node.js module that allows you to easily interact with the Localazy CDN.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Localazy",
|
|
@@ -72,20 +72,20 @@
|
|
|
72
72
|
},
|
|
73
73
|
"prettier": "@localazy/prettier-config",
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@localazy/conventional-changelog-preset": "^1.3.
|
|
75
|
+
"@localazy/conventional-changelog-preset": "^1.3.3",
|
|
76
76
|
"@localazy/eslint-config": "^1.3.0",
|
|
77
77
|
"@localazy/prettier-config": "^1.2.0",
|
|
78
78
|
"@localazy/tsconfig": "^1.1.1",
|
|
79
79
|
"@rollup/plugin-terser": "^0.4.4",
|
|
80
80
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
81
|
-
"@types/node": "^22.18.
|
|
81
|
+
"@types/node": "^22.18.1",
|
|
82
82
|
"@vitest/coverage-v8": "^3.2.4",
|
|
83
83
|
"@vitest/ui": "^3.2.4",
|
|
84
84
|
"conventional-changelog": "^5.1.0",
|
|
85
85
|
"conventional-changelog-cli": "^4.1.0",
|
|
86
86
|
"conventional-changelog-writer": "github:localazy/conventional-changelog-writer",
|
|
87
87
|
"conventional-recommended-bump": "^9.0.0",
|
|
88
|
-
"eslint": "^9.
|
|
88
|
+
"eslint": "^9.35.0",
|
|
89
89
|
"fetch-mock": "^12.5.4",
|
|
90
90
|
"husky": "^9.1.7",
|
|
91
91
|
"isomorphic-fetch": "^3.0.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"reexport": "^1.4.1",
|
|
94
94
|
"typescript": "^5.9.2",
|
|
95
95
|
"unplugin-replace": "^0.6.1",
|
|
96
|
-
"vite": "^7.1.
|
|
96
|
+
"vite": "^7.1.5",
|
|
97
97
|
"vite-bundle-visualizer": "^1.2.1",
|
|
98
98
|
"vite-plugin-dts": "^4.5.4",
|
|
99
99
|
"vitest": "^3.2.4"
|