@griddo/cx 10.1.49 → 10.1.51

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.
@@ -27,7 +27,7 @@ GFS4: `),console.error(e)});U[X]||(Qo=global[X]||[],ea(U,Qo),U.close=function(e)
27
27
  - ${t.toUpperCase()} ${n}
28
28
  - BODY: ${JSON.stringify(i)}
29
29
  - HEADERS: ${JSON.stringify(a)}
30
- - RESPONSE: ${f.response?.status,JSON.stringify(f.response?.data)}`),process.exit(1)),f.response||(console.log("Unknown error occurred"),console.log(JSON.stringify(f,null,2)),process.exit(1)),lp(f,{callInfo:{endpoint:n,body:i}}),console.warn(`Waiting for retry: ${t}`,n),await Jc(parseInt(cp)*1e3),hi({endpoint:n,body:i,cacheKey:s,attempt:o+1},t,r))}}async function Te(e){return await hi(e,"get")}async function di(e){let{endpoint:t,body:r,headers:n}=e,i=t.endsWith("/distributor")&&`# Distributor body: ${JSON.stringify(r)} lang: ${JSON.stringify(n?.lang)}`;return await hi(e,"post",i||"")}function lp(e,t){let{response:r,message:n,stack:i}=e,{callInfo:s}=t,{status:o,statusText:a,data:u}=r||{},d=[];for(let m of Object.keys(s))d.push(`${m}: ${typeof s[m]=="object"?JSON.stringify(s[m]):s[m]}`);let f=d.join(`
30
+ - RESPONSE: ${f.response?.status,JSON.stringify(f.response?.data)}`),process.exit(1)),f.response||(console.log("Unknown error occurred"),console.log(JSON.stringify(f,null,2)),process.exit(1)),lp(f,{callInfo:{endpoint:n,body:i}}),console.warn(`Waiting for retry: ${t}`,n),await Jc(parseInt(cp)*1e3),hi({endpoint:n,body:i,headers:a,cacheKey:s,attempt:o+1},t,r))}}async function Te(e){return await hi(e,"get")}async function di(e){let{endpoint:t,body:r,headers:n}=e,i=t.endsWith("/distributor")&&`# Distributor body: ${JSON.stringify(r)} lang: ${JSON.stringify(n?.lang)}`;return await hi(e,"post",i||"")}function lp(e,t){let{response:r,message:n,stack:i}=e,{callInfo:s}=t,{status:o,statusText:a,data:u}=r||{},d=[];for(let m of Object.keys(s))d.push(`${m}: ${typeof s[m]=="object"?JSON.stringify(s[m]):s[m]}`);let f=d.join(`
31
31
  `),p=r?`Code: ${o} - ${a}
32
32
  Response: ${JSON.stringify(u)}`:"",y=`${n}
33
33
  ${i}`;console.warn(Yc.default.bold.red(`
@@ -43,4 +43,5 @@ ${p}
43
43
  ${y}
44
44
 
45
45
  =============
46
- `))}Xc.default.config();var pi=process.env.API_URL,Ie=`${pi}/site/`,Ee={GET_ALL:`${pi}/sites/all`,GET_PAGE:[`${pi}/page/`,""],INFO:[`${Ie}`,"/all"],LANGUAGES:[`${Ie}`,"/languages"],BUILD_START:[`${Ie}`,"/build/start"],BUILD_END:[`${Ie}`,"/build/end"],GET_DISTRIBUTOR_DATA:[`${Ie}`,"/distributor"],GET_SITEMAP:[`${Ie}`,"/sitemap"],SOCIALS:[`${Ie}`,"/socials"],GET_PAGES:[`${Ie}`,"/pages?pagination=false"]},Nr=class{static async getAll(){let{GET_ALL:t}=Ee;return await Te({endpoint:t})}static async getPage(t,r){let{GET_PAGE:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getInfo(t,r=""){let{INFO:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getLanguages(t,r=""){let{LANGUAGES:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async startSiteRender(t){let{BUILD_START:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async endSiteRender(t,r){let{BUILD_END:[n,i]}=Ee;return await di({endpoint:`${n}${t}${i}`,body:r})}static async getDistributorData(t,r,n){let{GET_DISTRIBUTOR_DATA:[i,s]}=Ee,{language:o,site:a}=t;return o||(console.log("----Not lang found",JSON.stringify(t)),process.exit(1)),await di({endpoint:`${i}${a}${s}`,body:r,headers:{lang:o},cacheKey:n})}static async getSitemap(t){let{GET_SITEMAP:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async getSocials(t,r=""){let{SOCIALS:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}};var fp=Qc.default.sync(Lr.default.resolve(__dirname,"../..")),Zc=Lr.default.resolve(fp,"exports/sites");async function el(e){await cr.login();let t=e.sites.map(r=>{let{siteId:n,...i}=r;return ft(`Deploying ending call to site ${n}:`),Nr.endSiteRender(n,i)});await Promise.all(t),ft(`Build end signal sent for ${e.sites.length} site(s)`)}function hp(){return jr.default.readdirSync(Zc)}function dp(e){let t=[];for(let r of e){let n=Lr.default.resolve(Zc,r,"dist","__build-report__.json");if(!jr.default.existsSync(n)){console.log(`Build report "${n}" not found.`);continue}let i=JSON.parse(jr.default.readFileSync(n,"utf-8"));t.push(i)}return t}async function pp(){let e=hp(),t=dp(e);for(let r of t)await el(r)}pp();0&&(module.exports={buildComplete});
46
+ `))}Xc.default.config();var pi=process.env.API_URL,Ie=`${pi}/site/`,Ee={GET_ALL:`${pi}/sites/all`,GET_PAGE:[`${pi}/page/`,""],INFO:[`${Ie}`,"/all"],LANGUAGES:[`${Ie}`,"/languages"],BUILD_START:[`${Ie}`,"/build/start"],BUILD_END:[`${Ie}`,"/build/end"],GET_DISTRIBUTOR_DATA:[`${Ie}`,"/distributor"],GET_SITEMAP:[`${Ie}`,"/sitemap"],SOCIALS:[`${Ie}`,"/socials"],GET_PAGES:[`${Ie}`,"/pages?pagination=false"]},Nr=class{static async getAll(){let{GET_ALL:t}=Ee;return await Te({endpoint:t})}static async getPage(t,r){let{GET_PAGE:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getInfo(t,r=""){let{INFO:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getLanguages(t,r=""){let{LANGUAGES:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async startSiteRender(t){let{BUILD_START:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async endSiteRender(t,r){let{BUILD_END:[n,i]}=Ee;return await di({endpoint:`${n}${t}${i}`,body:r})}static async getDistributorData(t,r,n){let{GET_DISTRIBUTOR_DATA:[i,s]}=Ee,{language:o,site:a}=t;return o||console.log(`---- No lang found for distributor
47
+ `,JSON.stringify(t)),await di({endpoint:`${i}${a}${s}`,body:r,headers:{lang:o},cacheKey:n})}static async getSitemap(t){let{GET_SITEMAP:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async getSocials(t,r=""){let{SOCIALS:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}};var fp=Qc.default.sync(Lr.default.resolve(__dirname,"../..")),Zc=Lr.default.resolve(fp,"exports/sites");async function el(e){await cr.login();let t=e.sites.map(r=>{let{siteId:n,...i}=r;return ft(`Deploying ending call to site ${n}:`),Nr.endSiteRender(n,i)});await Promise.all(t),ft(`Build end signal sent for ${e.sites.length} site(s)`)}function hp(){return jr.default.readdirSync(Zc)}function dp(e){let t=[];for(let r of e){let n=Lr.default.resolve(Zc,r,"dist","__build-report__.json");if(!jr.default.existsSync(n)){console.log(`Build report "${n}" not found.`);continue}let i=JSON.parse(jr.default.readFileSync(n,"utf-8"));t.push(i)}return t}async function pp(){let e=hp(),t=dp(e);for(let r of t)await el(r)}pp();0&&(module.exports={buildComplete});
package/build/index.js CHANGED
@@ -25,7 +25,7 @@ GFS4: `),console.error(e)});z[Z]||(ws=global[Z]||[],xs(z,ws),z.close=function(e)
25
25
  \u2502 Access credentials failure \u2502
26
26
  \u2502 Check that the login details are correct in your .env file \u2502
27
27
  \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F
28
- `)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="10.1.49";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
28
+ `)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="10.1.51";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
29
29
  `,s=`
30
30
  \u2570${"\u2500".repeat(r)}\u256F`,o=`\u2502${n}${e}${n}\u2502`;console.log(`${i}${o}${s}`)}function fi(e){vp&&console.info(e.replace(/(\s)\s+/g,"$1"))}function Xu(e){return new Promise(t=>setTimeout(t,e))}function Dr(e,t=3){return(e/1e3).toFixed(t)}function hi(e){return"site"in e&&e.site?e?.site:void 0}function di(...e){let t=performance.now();return e.forEach(r=>r()),Dr(performance.now()-t)}function Qu(){let e=`
31
31
  \xB7\xB7
@@ -47,7 +47,7 @@ GFS4: `),console.error(e)});z[Z]||(ws=global[Z]||[],xs(z,ws),z.close=function(e)
47
47
  - ${t.toUpperCase()} ${n}
48
48
  - BODY: ${JSON.stringify(i)}
49
49
  - HEADERS: ${JSON.stringify(a)}
50
- - RESPONSE: ${f.response?.status,JSON.stringify(f.response?.data)}`),process.exit(1)),f.response||(console.log("Unknown error occurred"),console.log(JSON.stringify(f,null,2)),process.exit(1)),wp(f,{callInfo:{endpoint:n,body:i}}),console.warn(`Waiting for retry: ${t}`,n),await Xu(parseInt(bp)*1e3),nl({endpoint:n,body:i,cacheKey:s,attempt:o+1},t,r))}}async function il(e){return await nl(e,"get")}function wp(e,t){let{response:r,message:n,stack:i}=e,{callInfo:s}=t,{status:o,statusText:a,data:c}=r||{},d=[];for(let m of Object.keys(s))d.push(`${m}: ${typeof s[m]=="object"?JSON.stringify(s[m]):s[m]}`);let f=d.join(`
50
+ - RESPONSE: ${f.response?.status,JSON.stringify(f.response?.data)}`),process.exit(1)),f.response||(console.log("Unknown error occurred"),console.log(JSON.stringify(f,null,2)),process.exit(1)),wp(f,{callInfo:{endpoint:n,body:i}}),console.warn(`Waiting for retry: ${t}`,n),await Xu(parseInt(bp)*1e3),nl({endpoint:n,body:i,headers:a,cacheKey:s,attempt:o+1},t,r))}}async function il(e){return await nl(e,"get")}function wp(e,t){let{response:r,message:n,stack:i}=e,{callInfo:s}=t,{status:o,statusText:a,data:c}=r||{},d=[];for(let m of Object.keys(s))d.push(`${m}: ${typeof s[m]=="object"?JSON.stringify(s[m]):s[m]}`);let f=d.join(`
51
51
  `),p=r?`Code: ${o} - ${a}
52
52
  Response: ${JSON.stringify(c)}`:"",y=`${n}
53
53
  ${i}`;console.warn(tl.default.bold.red(`
@@ -27,7 +27,7 @@ GFS4: `),console.error(e)});H[K]||(ho=global[K]||[],mo(H,ho),H.close=function(e)
27
27
  - ${t.toUpperCase()} ${n}
28
28
  - BODY: ${JSON.stringify(i)}
29
29
  - HEADERS: ${JSON.stringify(a)}
30
- - RESPONSE: ${h.response?.status,JSON.stringify(h.response?.data)}`),process.exit(1)),h.response||(console.log("Unknown error occurred"),console.log(JSON.stringify(h,null,2)),process.exit(1)),hd(h,{callInfo:{endpoint:n,body:i}}),console.warn(`Waiting for retry: ${t}`,n),await ac(parseInt(fd)*1e3),Vn({endpoint:n,body:i,cacheKey:s,attempt:o+1},t,r))}}async function hc(e){return await Vn(e,"get")}async function dc(e){let{endpoint:t,body:r,headers:n}=e,i=t.endsWith("/distributor")&&`# Distributor body: ${JSON.stringify(r)} lang: ${JSON.stringify(n?.lang)}`;return await Vn(e,"post",i||"")}function hd(e,t){let{response:r,message:n,stack:i}=e,{callInfo:s}=t,{status:o,statusText:a,data:u}=r||{},d=[];for(let m of Object.keys(s))d.push(`${m}: ${typeof s[m]=="object"?JSON.stringify(s[m]):s[m]}`);let h=d.join(`
30
+ - RESPONSE: ${h.response?.status,JSON.stringify(h.response?.data)}`),process.exit(1)),h.response||(console.log("Unknown error occurred"),console.log(JSON.stringify(h,null,2)),process.exit(1)),hd(h,{callInfo:{endpoint:n,body:i}}),console.warn(`Waiting for retry: ${t}`,n),await ac(parseInt(fd)*1e3),Vn({endpoint:n,body:i,headers:a,cacheKey:s,attempt:o+1},t,r))}}async function hc(e){return await Vn(e,"get")}async function dc(e){let{endpoint:t,body:r,headers:n}=e,i=t.endsWith("/distributor")&&`# Distributor body: ${JSON.stringify(r)} lang: ${JSON.stringify(n?.lang)}`;return await Vn(e,"post",i||"")}function hd(e,t){let{response:r,message:n,stack:i}=e,{callInfo:s}=t,{status:o,statusText:a,data:u}=r||{},d=[];for(let m of Object.keys(s))d.push(`${m}: ${typeof s[m]=="object"?JSON.stringify(s[m]):s[m]}`);let h=d.join(`
31
31
  `),p=r?`Code: ${o} - ${a}
32
32
  Response: ${JSON.stringify(u)}`:"",y=`${n}
33
33
  ${i}`;console.warn(lc.default.bold.red(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/cx",
3
3
  "description": "Griddo SSG based on Gatsby",
4
- "version": "10.1.49",
4
+ "version": "10.1.51",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -68,7 +68,7 @@
68
68
  "react-helmet": "^6.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@griddo/eslint-config-back": "^10.1.49",
71
+ "@griddo/eslint-config-back": "^10.1.51",
72
72
  "@types/babel__core": "^7.20.0",
73
73
  "@types/babel__preset-env": "^7.9.2",
74
74
  "@types/csvtojson": "^2.0.0",
@@ -116,5 +116,5 @@
116
116
  "publishConfig": {
117
117
  "access": "public"
118
118
  },
119
- "gitHead": "c0420af93b9611000826e418ae9e04efc4b6268e"
119
+ "gitHead": "2e597c20e74f524b4288de4ef99a77759bb93ca1"
120
120
  }
@@ -134,10 +134,8 @@ class SitesService {
134
134
  GET_DISTRIBUTOR_DATA: [prefix, suffix],
135
135
  } = ENDPOINTS;
136
136
  const { language: lang, site: id } = page;
137
- if (!lang) {
138
- console.log('----Not lang found', JSON.stringify(page));
139
- process.exit(1);
140
- }
137
+ if (!lang)
138
+ console.log("---- No lang found for distributor\n", JSON.stringify(page));
141
139
  const response = await post<DistributorResponse>({
142
140
  endpoint: `${prefix}${id}${suffix}`,
143
141
  body,
package/src/utils/api.ts CHANGED
@@ -115,6 +115,7 @@ async function requestAPI<T extends APIResponses>(
115
115
  {
116
116
  endpoint,
117
117
  body,
118
+ headers,
118
119
  cacheKey,
119
120
  attempt: attempt + 1,
120
121
  },