ChemPal Documentation - v1.6.0
    Preparing search index...

    Function getAllSupplierStats

    • Reads every day of supplier stats, flattened into a dateKey -> suppliers map.

      Returns Promise<SupplierStatsData>

      All recorded stats, or {} when none exist or the read fails.

      const stats = await getAllSupplierStats();
      stats["2026-07-18"].Loudwolf.queries; // => 3
      export async function getAllSupplierStats(): Promise<SupplierStatsData> {
      try {
      const db = await getDB();
      const all = await db.getAll(IDB_STORE.SUPPLIER_STATS);
      const result: SupplierStatsData = {};
      for (const record of all) {
      result[record.dateKey] = record.suppliers;
      }
      return result;
      } catch (error) {
      logger.error('Failed to get all supplier stats from IndexedDB', { error });
      return {};
      }
      }