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

@omni-api/client

v0.0.2

Published

Type-safe HTTP client for OmniAPI: zero codegen, full TS inference from server router type

Readme

@omni/client

OmniAPI 的类型安全 HTTP 客户端。零 codegen —— 类型直接从服务端 router 推导。

用法

服务端(导出类型)

// server/router.ts
import { createRouter } from '@omni/core';
export const orderRouter = createRouter({
  namespace: 'order',
  procedures: [createOrderProcedure, getOrderProcedure /* ... */],
});
export type AppRouter = ProcedureMap<typeof orderRouter.procedures>;

客户端(自动推导)

// client.ts
import type { AppRouter } from '@my/server';
import { createClient } from '@omni/client';

const client = createClient<AppRouter>({
  baseUrl: 'https://api.example.com',
  headers: () => ({ authorization: `Bearer ${token}` }),
});

const order = await client.order.create({ sku: 'X1', qty: 1 });
//    ^? 自动推导 { id: string; sku: string; qty: number }

特性

  • 零 codegen:仅靠 TS 类型推导,无需任何生成文件
  • 路由派生与服务端一致:按 name 派生 path,按动词推断 method
  • 错误自动转回 OmniError:捕获后能拿到 code / status / details
  • headers 支持动态函数:每次请求重新求值,方便注入 token
  • resolveRoute 可覆盖:业务有自定义 RESTful path 时同步策略

API

  • createClient<TMap>(options) - 创建客户端
  • ProcedureMap<T> - 把服务端 router/procedure 集合转为类型映射
  • NestedClient<TMap> - 把扁平 dot-key 转嵌套调用类型