feat(utils): Introduce promiseAll util (#5543)

This commit is contained in:
Adrien de Peretti
2023-11-08 08:48:48 +01:00
committed by GitHub
parent e4ce2f4e07
commit f90ba02087
99 changed files with 464 additions and 297 deletions

View File

@@ -4,7 +4,7 @@ import {
ModuleJoinerRelationship,
} from "@medusajs/types"
import { isObject, toPascalCase } from "@medusajs/utils"
import { isObject, promiseAll, toPascalCase } from "@medusajs/utils"
import { MedusaModule } from "./medusa-module"
export type DeleteEntityInput = {
@@ -311,10 +311,10 @@ export class RemoteLink {
deletePromises.push(...relatedServicesPromises)
}
await Promise.all(deletePromises)
await promiseAll(deletePromises)
})
await Promise.all(servicePromises)
await promiseAll(servicePromises)
return returnIdsList
}
@@ -376,7 +376,7 @@ export class RemoteLink {
promises.push(service.create(links))
}
const created = await Promise.all(promises)
const created = await promiseAll(promises)
return created.flat()
}
@@ -424,7 +424,7 @@ export class RemoteLink {
promises.push(service.dismiss(links))
}
const created = await Promise.all(promises)
const created = await promiseAll(promises)
return created.flat()
}