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

@sparqjs/api-client

v0.2.1

Published

`@sparqjs/api-client` 是 Sparq 前端共享的 HTTP 传输层。它封装 Axios、请求配置、响应 envelope 解包和统一错误,不承载 Admin、Schema、Storage、Settings 或插件业务协议。

Readme

@sparqjs/api-client

@sparqjs/api-client 是 Sparq 前端共享的 HTTP 传输层。它封装 Axios、请求配置、响应 envelope 解包和统一错误,不承载 Admin、Schema、Storage、Settings 或插件业务协议。

负责范围

  • 配置 baseURL、Cookie、Header、Token、CSRF、超时和参数序列化。
  • 解包后端 code/data/message 响应。
  • 将 HTTP、网络和业务 envelope 错误归一化为 SparqApiError
  • 提供 response、error、unauthorized 和 forbidden hooks。
  • 透传 Axios 支持的 AbortSignal、上传进度等单次请求配置。

不负责范围

  • 不增加 schemastoragesettingsadmin 等领域 namespace。
  • 不依赖 Vue、Router、Pinia、schema core 或 schema protocol。
  • 不定义业务 DTO、页面反馈、登录状态或 DataAdapter
  • 不向插件暴露宿主 Admin 已配置 Cookie 和 CSRF 的 transport 实例。

领域 HTTP adapter 应放在真实消费者中。Admin 的正式实现位于 apps/admin/src/client/api,Stage 的验证实现位于 apps/stage/src/api;两者分别满足自身运行场景,不为表面复用提前拆成新包。

使用方式

import { createSparqApiClient } from '@sparqjs/api-client'

const transport = createSparqApiClient({
    baseURL: '/api',
    withCredentials: true,
})

const result = await transport.request<{ id: string }>({
    method: 'GET',
    url: '/records/1',
})

宿主应用应按认证边界创建 transport。Admin 当前只创建一个 authority-scoped 实例,认证、管理和 schema 领域 adapter 共同复用该实例。