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

@zarex/client

v0.1.5

Published

Zarex — client HTTP du Decision Engine (fetch, délai, disjoncteur, fail-open)

Readme

@zarex/client

Client HTTP bas niveau du SDK Zarex, avec disjoncteur (circuit breaker) intégré pour échouer vite plutôt que de faire attendre vos visiteurs quand Zarex est lent ou injoignable.

Vous n'avez normalement pas besoin d'installer ce paquet directement. Il est utilisé par @zarex/core et, par transitivité, par tous les adaptateurs de framework (@zarex/express, @zarex/fastify, @zarex/next, @zarex/sveltekit, @zarex/bun). Installez-le directement seulement si vous construisez votre propre intégration, en dehors de @zarex/core.

Qu'est-ce que Zarex ?

Zarex est une plateforme de sécurité applicative : un service qui protège une application web contre les bots, les abus de trafic, les injections et les fuites de données sensibles.

Utilisation

import { createClient, parseDecision } from "@zarex/client";

const client = createClient({ key: process.env.ZAREX_KEY! });
const response = await client.decide(request);
const decision = parseDecision(response);

ClientOptions

| Option | Type | Description | |---|---|---| | key | string | Clé API du projet. | | timeoutMs | number | Délai maximal avant d'abandonner l'appel (défaut 500 ms). | | breaker | BreakerOptions \| false | Configuration du disjoncteur, ou false pour le désactiver. | | baseUrl | string | Inutile en usage normal. À ne définir que pour les tests ou un environnement local. |

Le disjoncteur (CircuitBreaker)

Après un nombre configurable d'échecs consécutifs, le disjoncteur s'ouvre : les appels suivants échouent immédiatement (sans round-trip réseau) pendant une période de pause, puis une requête de sonde est tentée pour voir si le service est de nouveau disponible. Ce comportement évite qu'un ralentissement ne se répercute sur chaque requête de votre application par un délai d'attente répété.

import { CircuitBreaker } from "@zarex/client";

const breaker = new CircuitBreaker({ failureThreshold: 5, cooldownMs: 10_000 });

Erreurs

| Classe | Quand | |---|---| | ZarexConfigError | Configuration invalide (clé manquante, option hors bornes…) — levée à la construction, jamais pendant le traitement d'une requête. | | ZarexClientError | Erreur réseau ou réponse inattendue lors d'un appel — voir error.code (ClientErrorCode). |

Dans tous les adaptateurs de haut niveau, ces erreurs sont systématiquement interceptées : elles ne remontent jamais jusqu'à votre application (fail-open — si Zarex est injoignable, lent ou répond de façon inattendue, la requête du visiteur passe toujours).

Licence

MIT