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

@lonca/core

v0.7.0

Published

Shared primitives for Lonca marketplace SDKs: money, errors, retry, logger, rate limiter.

Readme

@lonca/core

Shared primitives for Lonca marketplace SDKs.

Type-safe building blocks reused across every @lonca/<marketplace> SDK: money, errors, pagination, retry, logger, rate limiter.

[!IMPORTANT] Unofficial. Part of Lonca, an independent, community-maintained project — not affiliated with, endorsed by, or supported by any marketplace. All marketplace names and trademarks belong to their respective owners.

Install

pnpm add @lonca/core

What's inside

| Primitive | Purpose | | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Money, Currency | ISO 4217 currency codes; integer minor-unit money representation; moneyFromMajor/moneyToMajor lira↔kuruş converters | | CursorPage, paginate | Cursor-based pagination + async iterator helper | | LoncaError hierarchy | Structured errors (AuthError, RateLimitError, ValidationError, NotFoundError, ServerError, NetworkError, TimeoutError) with retryable flag and a normalized issues array | | NormalizedOrderStatus | Closed cross-marketplace order-status vocabulary + createStatusNormalizer (surfaces unmapped statuses via mapped: false, never a silent default) | | MarketplaceCapabilities | Cross-marketplace feature-flag contract each SDK's *Capabilities constant satisfies, so consumers feature-detect via client.capabilities with a key set that can't drift between SDKs | | retry | Exponential backoff with jitter, honors retryAfterMs, supports AbortSignal. parseRetryAfter parses Retry-After; isRetryableIdempotentOnly gates non-idempotent writes to 429-only replays | | createRequester | Shared HTTP request lifecycle (rate-limit → fetch under a composed timeout → 204/error mapping → idempotency-aware retry → structured logging) that each SDK transport is built on; inject marketplace-specific URL/header/error-map seams | | Logger | Structured logger interface (debug/info/warn/error/child) with noopLogger and consoleLogger | | TokenBucketRateLimiter | Async token-bucket rate limiter with AbortSignal support |

Design principles

  • Money is an integer in minor units{ amount: 12550, currency: 'TRY' } means 125.50 TRY. No floats, no surprises. Marketplace SDKs hand you raw major-unit numbers (e.g. 199.9 lira); wrap them once with moneyFromMajor(price, TRY) instead of a hand-rolled Math.round(price * 100).
  • Cursor pagination over offset — opaque cursors compose better with async iterators and stay stable as datasets grow.
  • Errors are typed and taggederr.code plus a retryable boolean tells retry helpers what to do without sniffing messages.
  • Logger is an interface, not an implementation — wire your own (pino, winston, console). A no-op default is provided.

Stability

0.x — alpha. Public APIs may change between minor versions until 1.0.0.

License

MIT