Example for synchronous responses from processes - NestJS

How would we implement this example using NextJS (Typescript)?

Duplicate thread: How do we start sync workflow, wait for result and then continue long running work - NextJS