npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@haatlabs-core/provider-amazon

v0.10.0

Published

Amazon search, products and suggestions as a ProductSource.

Readme

@haatlabs-core/provider-amazon

Install

pnpm add @haatlabs-core/provider-amazon

It leaves one package to your app, so the app holds one copy: zod.

What it does

Amazon search, products and suggestions through an Amazon scraper, called directly or through a services gateway: createAmazonSource(options) gives a ProductSource (search, product, autocomplete, parseLink, health). It caches nothing: wrap a call in cachedCall (@haatlabs-core/providers) for AMAZON_CACHE_SECONDS (search and product an hour, suggestions a day). AMAZON_IMAGE_HOSTS are the hosts a content security policy names.

Options

baseUrl (the scraper, the gateway's /amazon, or the hosted API), timeoutMs, apiKey (the hosted API's) or gatewayKey (the gateway's; setting both is a RangeError), proxyEnabled (Japan and Australia need a proxy that exits there), fetch, maxConcurrent (12 calls in flight), maxWaitMs (10 s for a place before the call is refused) and maxResponseBytes (2 MiB).

Errors

SOURCE_BAD_REQUEST (400), SOURCE_PRODUCT_NOT_FOUND (404, for a product only), SOURCE_UNAVAILABLE (503, transient: away, slow, busy, or no place within maxWaitMs) and SOURCE_ERROR (503: an answer that cannot be used). A project spreads PROVIDER_AMAZON_ERRORS into defineErrors. A 429 or 5xx carries retryAfterMs from its Retry-After (seconds or a date, at most five minutes). Called directly, a refusal's body is never read: the connection is let go.

Gateway and deadlines

Each call takes a CallContext (tier, priority, deadlineMs); with gatewayKey it sends the gateway's headers, tier 4 in the background when there is none. The call's time limit is timeoutMs, or deadlineMs when that is sooner (localTimeoutMs), and it starts before the wait for one of the maxConcurrent places: the wait counts, and a call whose time ran out while it waited is never made. The gateway is given what is left of that limit, never longer. The deadline is each call's: a caller's retry starts it again, so a caller that retries gives each try what is left of its own budget. Through the gateway a refusal carries an UpstreamStatusError as its cause: isGatewayRefusal(error) is true for the gateway's 401 and 403 (both SOURCE_UNAVAILABLE), and only the gateway's own bad_request 400 is a contract error.

Fixtures

@haatlabs-core/provider-amazon/fixtures: amazonFixtures.product, .search and .autocomplete, answers recorded from the real scraper.

Testing

@haatlabs-core/provider-amazon/testing: createFakeSource(options), a second ProductSource with one market, for tests that must not assume Amazon. The package's own tests are unit tests on the fixtures: pnpm --filter @haatlabs-core/provider-amazon test.

Hosted services

Without a scraper of your own, read Amazon through the Haatlabs API on RapidAPI: set haatlabsApiKey (your RapidAPI key) and baseUrl: 'https://haatlabs-api.p.rapidapi.com' (apiKey and gatewayKey stay null). Every marketplace is available; there are no suggestions (autocomplete is absent); a refusal keeps its message, and a used-up quota or a refused key is SOURCE_UNAVAILABLE that is not transient. See @haatlabs-core/services and https://haatlabs.shop/docs/services/