ChemPal Documentation - v1.6.0
    Preparing search index...
    • Validates the data payload of the product info endpoint (POST /api/product/info). Confirms item.chem_mw (the molecular weight) is present so callers can safely read the chemistry fields.

      Parameters

      • data: unknown

        The unwrapped response data to validate

      Returns data is MacklinProductInfo

      Type predicate indicating the data is a valid MacklinProductInfo

      const data = await this.request("/api/product/info", { method: "POST", body: { item_code } });
      if (isMacklinProductInfo(data)) {
      builder.setMoleweight(data.item.chem_mw);
      }
      export function isMacklinProductInfo(data: unknown): data is MacklinProductInfo {
      return v.safeParse(macklinProductInfoSchema, data).success;
      }