feat: Change to a different interface

This commit is contained in:
Blu-J
2023-05-30 16:28:01 -06:00
parent a6514161ba
commit 19e3af3536
4 changed files with 63 additions and 72 deletions

View File

@@ -38,37 +38,20 @@ const makeManyInterfaceFilled = async ({
),
),
)
const primaryHostIdsRecord = Object.fromEntries(
await Promise.all(
Array.from(
new Set(
interfaceValues.flatMap((x) => x.addresses).map((x) => x.hostId),
),
).map(
async (hostId) =>
[
hostId,
await effects.getPrimaryHostname({
packageId,
hostId,
callback,
}),
] as const,
),
),
)
const fillAddress = filledAddress.bind(
null,
hostIdsRecord,
primaryHostIdsRecord,
)
const fillAddress = filledAddress.bind(null, hostIdsRecord)
const interfacesFilled: NetworkInterfaceFilled[] = interfaceValues.map(
(interfaceValue) =>
const interfacesFilled: NetworkInterfaceFilled[] = await Promise.all(
interfaceValues.map(async (interfaceValue) =>
networkInterfaceFilled(
interfaceValue,
await effects.getPrimaryUrl({
interfaceId: interfaceValue.interfaceId,
packageId,
callback,
}),
interfaceValue.addresses.map(fillAddress),
),
),
)
return interfacesFilled
}