How to simplify my transformer

I eventually replied by myself with the help of the forum.
I though to use that approach : calling query 1 from query 2.
But I eventually created global app function in [...]Script and Styles
image

Then go to the tab Javascript:
image.

My transformer is now a bit more verbose, but more readable and maintainable :

columns=[];
columns.push({"name":"Day","type":"string"});
let d = new Date();
let currentyear = d.getFullYear();
let max_month_index = d.getMonth(); //renvoie un entier en 0 et 11
if ({{year.value}} != currentyear) {
  max_month_index = 11; } 
const _today = "'"+((new Date()).toISOString()).substr(0,10)+"'";
for (let idx = 0; idx <= max_month_index; idx++) {
  let j=idx+1;
  let columnJ = (j+'').padStart(2, '0') ;
  let myStringYearMonth = "'"+{{year.value}}+"-"+columnJ+"-'+";
  let conditionDateExist = '!(DateExists('+myStringYearMonth+'currentRow.Day))';
  let conditionFallOnWE = 'IsDayFallingOnAWeekend('+myStringYearMonth+'currentRow.Day)';
  let condition3rdFriday = 'IsDayA3rdFriday('+myStringYearMonth+'currentRow.Day)';
  let conditionIsToday = _today+'=='+myStringYearMonth+'currentRow.Day';
  let mapperForBackgroundColor = "{\{"+conditionDateExist+" ? '#f8958d' : ( "+conditionFallOnWE+" ? '#eeeeee' :("+condition3rdFriday+" ? '#ffe599' :'white'))\}}";
  let mapper = "{\{"+condition3rdFriday+" ? '**'+(self+0).toLocaleString('en-US')+'**' : (self+0).toLocaleString('en-US')\}}"+"{\{"+conditionIsToday+" ? ' `TODAY`':''\}}";
  columns.push({"name":columnJ,"type":"markdown","colorMapper":mapperForBackgroundColor,"mapper":mapper});
}

return columns ;