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

@hubcommerce/hepsiburada

v1.1.0

Published

Hepsiburada TR Marketplace API SDK

Readme

@hubcommerce/hepsiburada

Hepsiburada TR Marketplace API SDK — multi-host REST, upload poll, webhook inbound helpers.

Yalnızca server-side kullanın. API credential tarayıcıda, mobil uygulamada veya public repo'da asla bulunmamalı.

  • Node >=20.10.0 · ESM-only · sıfır runtime dependency
  • HepsiburadaResult<T> — throw yerine ok / error
  • ~95 documented REST metodu + upload poll, order reconciler, webhook inbound

Detay: docs/CONFORMANCE.md · docs/QA.md · docs/MIGRATION.md


Kurulum

npm install @hubcommerce/hepsiburada

Monorepo yerel:

npm install file:../commerce-packages/marketplace/hepsiburada

Yapılandırma

.env.example dosyasını kopyalayın:

copy marketplace\hepsiburada\.env.example .env

| Değişken | Açıklama | |----------|----------| | HB_MERCHANT_ID | Satıcı kimliği | | HB_API_USERNAME | Basic Auth kullanıcı | | HB_API_PASSWORD | Basic Auth şifre | | HB_ENV | sit (varsayılan) veya production | | HB_INTEGRATOR_NAME | User-Agent — bare integrator adı (G1) |

Multi-host matrisi

SDK HostRouter ile host seçer — adapter host bilmez. Özet:

| Kaynak | Production host | |--------|-----------------| | Listings | listing-external.hepsiburada.com | | OMS | oms-external.hepsiburada.com | | Katalog | mpop.hepsiburada.com | | Shipping | shipping-external.hepsiburada.com |

SIT: -sit suffix. Tam tablo: CONFORMANCE.md.

Yasak: returns-external.* — iade/claim OMS + claim-stub üzerinden.


Hızlı başlangıç

import { createHepsiburadaClient } from "@hubcommerce/hepsiburada";

const client = createHepsiburadaClient({
  merchantId: process.env.HB_MERCHANT_ID!,
  apiUsername: process.env.HB_API_USERNAME!,
  apiPassword: process.env.HB_API_PASSWORD!,
  env: "sit",
  integratorName: process.env.HB_INTEGRATOR_NAME ?? "SelfIntegration",
});

const conn = await client.testConnection();
if (!conn.ok) {
  console.error(conn.error?.message ?? conn.reason);
}

Modül örnekleri

Sipariş poll reconciler (webhook yedek)

Hepsiburada stream API yok; webhook birincil, poll belt-and-braces.

for await (const order of client.orders.pollOrdersSince({
  lookbackMs: 300_000, // varsayılan 5 dk
})) {
  // adapter: map → InternalOrder
}

Listing stok/fiyat + upload poll

const submit = await client.listings.uploadPrice([
  { hepsiburadaSku: "HB-1", price: 199.9 },
]);

if (submit.ok && submit.data.id) {
  const result = await client.upload.waitForResult(submit.data.id, {
    kind: "priceUpload",
  });
  // partial fail: result.data.priceValidations / errors
}

uploadInventory (stok+fiyat+kargo) vs uploadStock (yalnız stok) — CONFORMANCE § Listings.

Katalog import

import { buildIntegratorPayload, createIntegratorImportFormData } from "@hubcommerce/hepsiburada";

const payload = buildIntegratorPayload([/* categoryId, merchantSku, attributes */]);
const form = createIntegratorImportFormData(payload);
await client.catalog.uploadProductViaFile(form);

Webhook inbound

Hepsiburada merchant endpoint'inize PUT ile 12 event gönderir. Güvenlik Basic Auth (G2 — HMAC/imza yok).

import {
  parseWebhookEvent,
  verifyWebhookBasicAuth,
  ORDER_WEBHOOK_EVENTS,
  CLAIM_WEBHOOK_EVENTS,
} from "@hubcommerce/hepsiburada";

for (const event of [...ORDER_WEBHOOK_EVENTS, ...CLAIM_WEBHOOK_EVENTS]) {
  app.put(`/hb/${event}`, express.json(), (req, res) => {
    if (!verifyWebhookBasicAuth(req.headers, process.env.HB_WEBHOOK_USER!, process.env.HB_WEBHOOK_PASS!)) {
      res.status(401).end();
      return;
    }
    const parsed = parseWebhookEvent(event, req.body);
    if (!parsed.ok) {
      res.status(400).end();
      return;
    }
    // Adapter: dedup + persist + domain event — 2xx <= 5 sn ACK
    res.status(204).end();
  });
}

HMS webhook kayıt adımları: QA.md § HMS webhook kayıt.

Exhaustive switch örneği: tests/webhook-exhaustive-switch.test.ts


Testing subpath (SIT)

import {
  assertSitEnvironment,
  createTestOrder,
  ORDER_FIXTURE,
} from "@hubcommerce/hepsiburada/testing";

assertSitEnvironment(client.config);

Production config ile stub path → forbiddenPathGuard throw.


QA smoke

npm run qa:smoke --workspace=@hubcommerce/hepsiburada

Credential yoksa exit 0 (skip). Detay: QA.md.


Dokümantasyon

| Dosya | İçerik | |-------|--------| | CONFORMANCE.md | Endpoint checklist, tuzaklar | | ADAPTER-CONTRACT.md | SDK vs adapter | | OFFICIAL-ANSWERS.md | Portal gate G1–G6 | | DOC-SOURCES.md | Resmi SoT + snapshot | | QA.md | Partner checklist, HMS webhook | | MIGRATION.md | Sürüm geçişi | | VERSIONING.md | SemVer politikası | | TECH-DEBT.md | Teknik borç |


Lisans

MIT