ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function getProductExclusionKey

    • Derive the stable exclusion key for a product. This mirrors the key shape used by SupplierCache.getProductDataCacheKey (see SupplierBase.ts line 1337) so that exclusion checks performed inside the supplier's product detail path can be compared against entries written from the UI context menu without the two sides drifting.

      Uses md5({ url, params: {}, supplier }) — identical to the no-params branch of getProductDataCacheKey.

      Parameters

      • url: string

        Canonical product URL (same URL the supplier fetches).

      • supplierName: string

        Supplier name, e.g. "Loudwolf".

      Returns string

      MD5 hex digest used as the exclusion key.

      const key = getProductExclusionKey(
      "https://example.com/acetone",
      "Loudwolf",
      );
      // → "a1b2c3..."
      export function getProductExclusionKey(url: string, supplierName: string): string {
      return md5(JSON.stringify({ url, params: {}, supplier: supplierName }));
      }