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

@resili/axios

v0.1.0-alpha.1

Published

Axios-compatible adapter for Resili.

Readme

@resili/axios

Minimal Axios-compatible adapter for Resili.

@resili/axios wraps an Axios-compatible request implementation with @resili/core and returns a small callable client with familiar methods such as get(), post(), put(), patch(), delete(), and request().

This package does not depend on Axios directly. It uses structural TypeScript types so you can provide any compatible implementation.

For the full framework overview, see the repository README.

Installation

pnpm add @resili/core @resili/axios
npm install @resili/core @resili/axios
yarn add @resili/core @resili/axios

Node.js 20 or newer is required.

Quick Start

import { createAxios, type AxiosImplementation, type AxiosRequestConfig } from "@resili/axios";

const axiosImplementation: AxiosImplementation = async <T, D>(config: AxiosRequestConfig<D>) => ({
  data: { ok: true } as T,
  status: 200,
  statusText: "OK",
  config,
});

const axios = createAxios({
  axios: axiosImplementation,
  timeout: { perAttemptMs: 1_000 },
  retry: { maxAttempts: 3, jitter: "none" },
});

const response = await axios.get("/users");

createAxios() requires an injected Axios-compatible implementation. The package currently does not import or bundle the real axios package.

createAxios()

import { createAxios, type AxiosImplementation, type AxiosRequestConfig } from "/axios";

const axiosImplementation: AxiosImplementation = async (config) => {
  return {
    data: undefined,
    status: 204,
    statusText: "No Content",
    config,
  };
};

const axios = createAxios({
  axios: axiosImplementation,
  circuitBreaker: { minimumThroughput: 10 },
});

Supported core config fields:

| Field | Purpose | | ---------------- | ------------------------------------------- | | retry | Retry failed calls. | | timeout | Apply per-attempt timeout behavior. | | circuitBreaker | Stop calls while a dependency is unhealthy. | | bulkhead | Bound concurrency and queue depth. | | rateLimiter | Limit request rate in memory. | | fallback | Return an alternate Axios response. | | classifier | Override failure classification. | | store | Override the state store service. | | clock | Override timers and time source. | | policies | Register custom policy factories. |

The axios option is adapter-specific and is removed before configuration is passed to @resili/core.

GET Example

import { createAxios, type AxiosImplementation, type AxiosRequestConfig } from "/axios";

const axiosImplementation: AxiosImplementation = async <T, D>(config: AxiosRequestConfig<D>) => ({
  data: { users: [] } as T,
  status: 200,
  statusText: "OK",
  config,
});

const axios = createAxios({ axios: axiosImplementation });

const response = await axios.get<{ users: string[] }>("/users", {
  headers: { accept: "application/json" },
});

The adapter shallow-copies config and sets config.signal to the Resili context signal for the active execution.

POST Example

import { createAxios, type AxiosImplementation, type AxiosRequestConfig } from "/axios";

const axiosImplementation: AxiosImplementation = async <T, D>(config: AxiosRequestConfig<D>) => ({
  data: { id: "42" } as T,
  status: 201,
  statusText: "Created",
  config,
});

const axios = createAxios({ axios: axiosImplementation });

const response = await axios.post<{ id: string }, { name: string }>(
  "/users",
  { name: "Ada" },
  { headers: { "content-type": "application/json" } },
);

For post(), put(), and patch(), the adapter copies the supplied data into the request config.

Retry Example

import { createAxios, type AxiosImplementation, type AxiosRequestConfig } from "/axios";

const axiosImplementation: AxiosImplementation = async <T, D>(config: AxiosRequestConfig<D>) => ({
  data: { ok: true } as T,
  status: 200,
  statusText: "OK",
  config,
});

const axios = createAxios({
  axios: axiosImplementation,
  retry: {
    maxAttempts: 3,
    backoff: "fixed",
    baseDelayMs: 100,
    jitter: "none",
  },
  timeout: { perAttemptMs: 1_000 },
});

const response = await axios.request({ method: "get", url: "/status" });

Retry behavior is delegated to @resili/core.

Callable Client

The returned object is callable and also exposes named methods:

const direct = await axios({ method: "get", url: "/users" });
const viaRequest = await axios.request({ method: "get", url: "/users" });
const viaGet = await axios.get("/users");

Supported methods are request, get, delete, post, put, and patch.

Current Limitations

  • No real Axios runtime dependency is included.
  • No interceptors.
  • No request transforms.
  • No response transforms.
  • No axios.create().
  • No cancel token support.
  • No HTTP status classification.
  • No response body handling beyond returning the injected implementation result.
  • No OpenTelemetry or metrics exporters.

The adapter is intentionally thin. Use @resili/core policies or custom policies for behavior beyond request wrapping.

Documentation

License

MIT © Resili contributors.