The product whose history to load.
A map of series id → PriceHistoryEntry; empty when the product can't be keyed or has no recorded history.
const byId = await getProductPriceHistory(product);
const base = byId.get(productSeriesKey(product) ?? "");
export async function getProductPriceHistory(
product: Product,
): Promise<Map<string, PriceHistoryEntry>> {
const productKey = productSeriesKey(product);
if (productKey === undefined) {
return new Map();
}
const series = await getPriceSeriesByProduct(productKey);
return new Map(series.map((entry) => [entry.id, entry]));
}
Read all recorded price-history series for a product — its base row plus any variant rows — keyed by series id for direct lookup from the detail UI.