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 🙏

© 2025 – Pkg Stats / Ryan Hefner

riot-bridge

v1.0.2

Published

A secure and expandable wrapper for Valorant Riot Client APIs

Readme

riot-bridge

TypeScript client for Valorant local and remote APIs with built‑in auth, rate limiting, retries, and WebSocket helpers. Designed for Bun and Node 18+.

Installation

bun add riot-bridge

Quick start

import { RiotClient } from "riot-bridge";

const client = new RiotClient();
await client.init();

const me = await client.user.getRSOUser();
if (me.error) throw new Error(me.error);
console.log(me.data);

API overview

  • RiotClient: Initializes local auth (lockfile), derives remote tokens, and exposes endpoints.
  • Response shape (ApiResponse<T>): { error: string | null; status: number; data: T | null; rateLimitInfo?: { remaining: number; resetTime: number; retryAfter?: number } }
  • Request options (RequestOptions): { method, params, body, headers, isRemote, timeoutMs, retries }

Constructor

new RiotClient(lockFilePath?: string, logger?: Logger, interceptors?: Interceptors, tls?: TLSOptions)
  • lockFilePath: override lockfile path if needed.
  • logger: { debug, info, warn, error } optional.
  • interceptors: { beforeRequest, afterResponse, onError } optional hooks.
  • tls: { rejectUnauthorized?: boolean } for local HTTPS/WebSocket calls.

Endpoints quick reference

| Endpoint | Key on client | Highlights | | ------------------- | -------------------- | -------------------------------------------------- | | AuthEndpoint | client.auth | Auth flows, geo, PAS token, client config | | UserEndpoint | client.user | RSO user, sessions, region, entitlements, presence | | FriendsEndpoint | client.friends | Friends list and requests | | ChatEndpoint | client.chat | Conversations, history, send message | | PartyEndpoint | client.party | Party lifecycle, matchmaking, custom games | | PreGameEndpoint | client.pregame | Agent select/lock before match | | CurrentGameEndpoint | client.currentgame | Live match info and loadouts | | PvpEndpoint | client.pvp | MMR, matches, leaderboard, content meta | | StoreEndpoint | client.store | Wallet, storefront, owned items, prices | | ContentEndpoint | client.content | Public content (agents, maps, skins, etc.) | | PremierEndpoint | client.premier | Premier player profile | | WebSocketEndpoint | client.websocket | Connect and subscribe to events |

Example:

const mmr = await client.pvp.getPlayerMMR("your-puuid");
const wallet = await client.store.getWallet("your-puuid");
const chat = await client.chat.getChatSession();

Requests, timeouts, retries

const res = await client.get("/some/endpoint", {
  timeoutMs: 10_000,
  retries: 2, // retries 5xx and 429 with exponential backoff
});

External APIs (no Riot auth)

const external = client.createRequester({
  baseUrl: "https://api.example.com",
  skipAuth: true,
  remote: true,
});

const r = await external<{ ok: boolean }>("/objects", { method: "GET" });

You can wrap this into a custom endpoint and register it:

class CustomEndpoint {
  constructor(
    private doRequest: <T>(
      url: string,
      opts?: RequestOptions
    ) => Promise<ApiResponse<T>>
  ) {}
  getCustomData() {
    return this.doRequest<unknown>("/objects", { method: "GET" });
  }
}

const custom = new CustomEndpoint(external);
client.registerEndpoint("customProducts", custom);
const retrieved = client.getEndpoint("customProducts")
  ?.instance as CustomEndpoint;
const resp = await retrieved.getCustomData();

WebSocket

Use the dedicated websocket endpoint for auto‑reconnect helpers, or create a raw socket bound to the local client:

// Auto‑reconnect utilities
const ws = await client.websocket.connectAndSubscribeToAll({
  onMessage: (evt) => console.log(evt.uri, evt.eventType),
});

// Or a raw socket to a specific path
const raw = client.createWebSocket("/socket", {
  onMessage: (msg) => console.log(msg),
});

Rate limiting

Token‑bucket limiter with request scheduling and rateLimitInfo on responses. Helpers:

client.isRateLimited();
client.getRateLimitInfo();
client.getTimeUntilReset();

Build

bun x tsc -p tsconfig.build.json

The package publishes CommonJS (dist/index.js) with type declarations (dist/index.d.ts). See the exports map in package.json.

Notes

  • The Valorant client must be running for local endpoints; TLS validation is relaxed for local self‑signed certs by default and can be controlled via tls.rejectUnauthorized.
  • Remote requests use tokens derived from local session where possible.

License

MIT