Proper way for async/await process?

I am searching for a proper way to do this for days now. I seem not to find the proper example for my process wish. :slight_smile:

There is a lot of information on async/await/promise processes. A lot of them are dated before the official statement that PM supports promises.

What do I want to accomplish?
I need to update the body of my request before it is send.
So I have written a function that traverses the body and makes its changes and returns it. I then replace the body in the request.
As it turns out this processing sometimes can take some time.
So I need the sending of the request to wait for this process to end.
I found a simple example but that uses a setTimeOut which needs a specific value to wait for. I managed to put my own function in that process but cannot find the way to code the promise wait for that function itself.
Can someone explain (or give an example) on how to package my own function into this async/await/promise structure?
This is what I have in my pre-request script (I left out my own function for convenience).

async function bakeCookies(timeout) {
    let newBody = deleteEmptyElements(pm.request.body.raw);
    pm.request.body.update(newBody);
    await new Promise((resolve) => setTimeout(resolve, timeout));
}
async function serveCookies() { 
  const cookies = await bakeCookies(10000);
}
serveCookies()

I have PM version 10.24.18 and am running on Windows.