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

@huaqiu/part-search

v0.2.6

Published

Huaqiu Part Search — single source-of-truth client + domain service for the Huaqiu part-search public API (kiapi.eda.cn).

Downloads

592

Readme

@huaqiu/part-search

Single source-of-truth client + domain service for Huaqiu's public part-search API (kiapi.eda.cn).

This package is the only implementation of the Huaqiu API integration inside HQ Edge. Other packages consume its normalized model:

                Huaqiu Public API (kiapi.eda.cn)
                           │
                           ▼
                  @huaqiu/part-search
                           │
        ┌──────────────────┼──────────────────┐
        ▼                  ▼                  ▼
   HQ Edge HTTP       @huaqiu/           (future consumers)
   /api/hqsch/parts/* huaqiu-client
                           │
                           ▼
                       HQ EDA skills
                           │
                           ▼
                          DSH plugin (thin adapter — calls HQ Edge HTTP)

Public API

import { createPartSearchService } from "@huaqiu/part-search";

const ps = createPartSearchService();

// 1. Search
const page = await ps.searchParts({
  query: "STM32",
  page: 1,
  pageSize: 20,
  requireEdaModel: true,
});

// 2. Get full detail
const part = await ps.getPart({
  manufacturerId: "7189",
  mpn: "STM32F410T8Y6TR",
});

// 3. Get only EDA models (symbol / footprint / 3D / simulation)
const models = await ps.getEdaModels({
  manufacturerId: "7189",
  mpn: "STM32F410T8Y6TR",
});

// 4. Get supply-chain offers (batched)
const offers = await ps.getSupplyChain([
  { manufacturerId: "7189", mpn: "STM32H743XIH6" },
]);

Architecture

Two layers:

  • HqPartApiClient — raw wire-protocol client. Knows Huaqiu endpoints, request body shapes, response envelope. Returns Zod-parsed raw shapes. Not intended for direct consumer use.
  • PartSearchService — normalized domain service. Maps raw Huaqiu responses to typed domain models (Part, EdaModels, SupplyOffer, PartSearchPage). The only layer consumers should depend on.

Error handling

Huaqiu's envelope is { code, message, ...payload }. HTTP 200 does NOT imply success — code !== 200000 is a failure. The package surfaces both failure modes as typed errors:

  • PartSearchHttpError — non-2xx, network abort, invalid JSON, schema validation failure.
  • PartSearchApiError — HTTP 200 but code !== 200000.
  • PartSearchValidationError — response failed normalization.
  • PartNotFoundErrorproductDetail returned result: null.
  • PartModelNotFoundError — no model of the requested kind exists.

Every error carries structured context (operation, manufacturerId, mpn, status, code) so callers can branch without parsing messages.

Security

  • HTTPS only.
  • No authentication (Huaqiu's public API requires none).
  • Per-request timeout (default 15s).
  • Upstream host is restricted — there is NO generic proxy capability.
  • All inputs are validated; all responses are Zod-parsed.

License

Apache-2.0