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

@eve-online-tools/esi-provider

v0.2.0

Published

ESI provider for React

Readme

@eve-online-tools/esi-provider

React provider for typed ESI clients via openapi-fetch and openapi-typescript.

Installation

pnpm add @eve-online-tools/esi-provider openapi-fetch openapi-typescript react react-dom

Generating ESI types

The package includes a CLI for maintaining generated ESI artifacts in your project.

update-compatibility-date

Fetches the latest compatibility date from ESI and updates compatibility-date.ts only. Does not download the spec or regenerate types.

npx @eve-online-tools/esi-provider update-compatibility-date -o ./src/esi/generated

download-spec

Fetches the OpenAPI spec (using the compatibility date in the output dir), and generates types:

npx @eve-online-tools/esi-provider download-spec -o ./src/esi/generated

Writes or updates:

  • openapi.json — stripped spec (the provider sets CompatibilityDate/Tenant headers)
  • esi-schema.d.ts — types generated via openapi-typescript
  • types.d.ts — helper types for extracting response bodies from paths and operations
  • compatibility-date.ts — created automatically if missing
  • index.ts — created on first run only; includes a createESIProvider helper and re-exports schema/types helpers

download-spec --update-only

Updates compatibility-date.ts first, then downloads and regenerates the spec only if the compatibility date changed:

npx @eve-online-tools/esi-provider download-spec -o ./src/esi --update-only

Recommended usage (after download-spec)

import { createRateLimitMiddleware, useRateLimits } from "@eve-online-tools/esi-provider";
import { createESIProvider } from "./esi";

const rateLimit = createRateLimitMiddleware();

const [ESIProvider, useESIClient] = createESIProvider({
  appName: "my-app",
  appVersion: "1.0.0",
  appContact: "mailto:[email protected]",
  middleware: [rateLimit],
});

createESIProvider applies the generated baseUrl and compatibilityDate automatically. Pass any NewProviderProps field to override defaults (for example tenant or middleware).

Manual setup

If you manage the schema yourself, use newESIProvider<paths>(...) directly:

import type { paths } from "./esi-schema";
import { newESIProvider } from "@eve-online-tools/esi-provider";

const [ESIProvider, useESIClient] = newESIProvider<paths>({
  appName: "my-app",
  appVersion: "1.0.0",
  appContact: "mailto:[email protected]",
});

Usage

import { createRateLimitMiddleware, useRateLimits } from "@eve-online-tools/esi-provider";
import { createESIProvider } from "./esi";

const rateLimit = createRateLimitMiddleware();

const [ESIProvider, useESIClient] = createESIProvider({
  appName: "my-app",
  appVersion: "1.0.0",
  appContact: "mailto:[email protected]",
  middleware: [rateLimit],
});

function App() {
  return (
    <ESIProvider>
      <Dashboard />
    </ESIProvider>
  );
}

function Dashboard() {
  const client = useESIClient();
  const rateLimits = useRateLimits();

  // client.GET("/status/", ...) — typed against your OpenAPI schema
  // rateLimits?.groups — per-group token usage for UI
}

Calling ESI

The generated types contain a ResponseFor helper to type response bodies.

import { ESIError } from "./error";
import type { Client, ResponseFor } from "./generated"; // 
import { useESIClient } from "./provider";

type StatusResponse = ResponseFor<"/status/", "get", 200>;
type ErrorResponse = ResponseFor<"/status/", "get", "default">;

export const getServerStatus = async (client: Client) => {
  const response = await client.GET("/status/");

  switch (response.response.status) {
    case 200:
      return response.data as StatusResponse;
    default:
      throw new ESIError<ErrorResponse>(
        "Failed to get server status",
        response.error,
      );
  }
};

Middleware

Middleware plugs into the provider reducer and openapi-fetch. Each middleware has a unique key, initialState, reducer, and optional onRequest / onResponse / onError handlers.

createRateLimitMiddleware learns ESI rate-limit groups from response headers, tracks token usage per group and character, and proactively delays outbound requests when a bucket is low.

Development

pnpm --filter @eve-online-tools/esi-provider build
pnpm --filter @eve-online-tools/esi-provider test
pnpm --filter @eve-online-tools/esi-provider typecheck

License

MIT