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

    Module utils/typeGuards/macklin

    Enumerations - Typeguards

    ApiEndpoints

    Macklin API paths used by the supplier module, relative to its API host.

    AuthRequiredEndpoints

    Macklin API paths that only respond to an authenticated session. Kept apart from ApiEndpoints so callers can tell which requests need credentials.

    Functions - Typeguards

    isTimestampResponse

    Type guard to validate if data matches the Macklin timestamp response structure. The timestamp endpoint returns the server's current Unix timestamp.

    isMacklinApiResponse

    Validates if a response matches the Macklin API response format. All API responses must have a code, message, and data field.

    isMacklinMsdsSearchResponse

    Validates the unwrapped data payload of a successful MSDS search. request strips the { code, message, data } envelope, so a success yields { url } while error responses yield [], which fails the { url } shape — a positive result therefore means an SDS URL is present.

    isMacklinProductInfo

    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.

    isAuthRequiredEndpoint

    Validates if a URL requires authentication. These endpoints require a valid user token in the X-User-Token header.

    isAuthCheckEndpoint

    Validates if a URL is an authentication check endpoint. These endpoints are used to verify the user's authentication status and will return a specific error code (1005) if authentication fails.

    isMacklinSearchResult

    Validates if data matches the Macklin search result format. Search results contain a list of products and a total count. The list property is generic to support different product types.

    isMacklinProductDetailsResponse

    Validates if data matches the Macklin product details response format. Product details response contains a list of product details.

    isMacklinProductDetails

    Validates if data matches the Macklin product details format. Product details contain comprehensive information about a specific product variant, including pricing, stock, and delivery information.

    isTimestampStorage

    Type guard for TimestampStorage objects stored in local state.