return an empty array from backend

@yisrael-wix :
I am having a scenario where I am not sure how I would chain all the then Promise call: and all the parameter that need to be passed till the last level of chain call.

How would you rewrite the promiseCall

export function ABC(p1, p2, p3, p4) {
I need to convert p1 and p2.
d1 = promiseCallD(p1);
d2 = promiseCallD(p2);
let isActive = true;

while (isActive) {
    wixData.query("collection")
     .eq("d1", d1)
     .lt("d2"), d2)
     .find()
     .then (results => {
       row = results.items[0];
       ...
       return  {"data":row.data,
               "d1": d1,
               "d2": d2
              }; 
       })
      .then (res => {
        let tmp = null
        f1 = PromiseCallF(p3, res.d1);
        f2 = PromiseCallF(p4, res.d2);
        row = {"f1": f1,
               "f2": f2,
               "d1": d1,
               "d2": d2
               };
        return tbl.push(row); =        
       })
     }
  return  data
  }     

Saying that a Promise call should be code like that:

return PromiseCallD(a) {
  .then(result => {
  ...
    return data;
    })
  }