The products to record; each may carry variants.
Optionalsettings: PriceHistorySettingsThe user's price-history settings (trackPriceHistory,
priceHistoryMaxPoints). Tracking is on unless explicitly disabled.
Resolves once all series have been processed.
void recordProductPrices(finalResults, appContext.userSettings);
export async function recordProductPrices(
products: Product[],
settings?: PriceHistorySettings,
): Promise<void> {
if (settings?.trackPriceHistory === false) {
return;
}
const maxPoints = normalizeMaxPoints(settings?.priceHistoryMaxPoints);
const now = Date.now();
for (const product of products) {
for (const input of collectSeriesInputs(product)) {
await recordSeries(input, maxPoints, now);
}
}
}
Record the current USD price of each product (and its variants) into the price-history store. A no-op when tracking is disabled. Fire-and-forget: the caller wraps this in
voidfrom the search flow. Only writes when a price changes, so repeated searches over cached results add nothing.