Matrix possibilities in javascript : **Hello**

As you can see in my gist bellow, i have 03 different properties in a object or array (I could use anyone of this as input), and I have to discover all the possibilites of combination between them.

In this case, we just have 03 properties, but we can easily have more than 20 props ...

how could i implement this in a smart way? Thinking in a bigger amount of data ...

https://gist.github.com/matheus-rossi/c0261d1d8e138475c049f500fb2616fa

    const configPossibilities = [ [ 1 ], [ 1, 2 ], [ 1, 2, 3, 4 ] ] 

    const configPossibilities2 = {
     ID_LINHA: [ 1 ],
     ID_IMPLEMENTO: [ 1 , 2 ],
     ID_COMPOSICAO: [ 1 , 2 , 3 , 4 ]
    } 
    
    const desiredResult = [
      [1, 1, 1 ],
      [1, 1, 2 ],
      [1, 1, 3 ],
      [1, 1, 4 ],
      [1, 2, 1 ],
      [1, 2, 2 ],
      [1, 2, 3 ],
      [1, 1, 4 ],
    ]