async function solve_many_chunk(json, orientServer = 'http://127.0.0.1:8000') {
const promised = await Promise.all(chunk(json, 10).map(chunk_json => {
return fetch(orientServer + '/solve-many', {
body: JSON.stringify(chunk_json),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
method: 'POST'
}).then(res => {
return res.json()
}).then(res => {
return res
.filter(d => d !== null)
.map(d => d.flat())
.flat()
.filter(d => d !== null)
.map(d => {
const results = {}
Object.keys(d)
.filter(key => !key.includes('%'))
.map(key => {
results[key] = d[key]
})
return results
})
})
}))
return promised.flat()
}