Given the following array of objects, I need to collect a series of observables from calls to an endpoint
const data = [
{
body: [{ id: 1 }, { id: 2 }],
},
{
body: [{ id: 3 }],
},
];
const requests = data.map((entry) => entry.body.map((item) => this.someService.query(item.id).pipe(take(1))));
The result of this operation is similar to this
[ [ 1, 2 ], [ 3 ] ]
or
[[Observable, Observable], [Observable]]
In other cases I have passed to forkJoin flat arrays of observables and I get the results I require. But in this case with an array of nested arrays. What is the correct way to use forkJoin with an array containing nested arrays?