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

@centralx/central-studio-api

v0.0.1

Published

CentralX Dashboard API TypeScript Client

Readme

@centralx/central-studio-api

CentralX Dashboard API TypeScript Client,封装后端微服务 API 为 TypeScript npm 类库,供内部视图和外部前端项目使用。

安装

npm install @centralx/central-studio-api

快速开始

引入即可使用,无需额外配置:

import {tenantApi, applicationApi} from '@centralx/central-studio-api';

// 查询租户列表
const page = await tenantApi.page({name: '示例', page: 1, size: 20});

// 查询应用详情
const app = await applicationApi.details('app-id-123');

// 新增租户
const newTenant = await tenantApi.add({
    code: 'demo',
    name: '演示',
    databaseId: 'db-id',
    enabled: true,
});

自定义配置

如需自定义 HTTP 客户端(如添加拦截器、修改超时等),在应用入口调用一次 configureClient

// main.ts 或应用入口
import axios from 'axios';
import {configureClient} from '@centralx/central-studio-api';

configureClient(axios => {
    const client = axios.create({
        baseURL: '/dashboard/api',
        timeout: 5000,
    });

    // 添加请求拦截器(如 Token 注入)
    client.interceptors.request.use(config => {
        const token = getToken();
        if (token) {
            config.headers.Authorization = `Bearer ${token}`;
        }
        return config;
    });

    return client;
});

注意configureClient 只能调用一次,应在应用入口尽早调用。

API 列表

| 模块 | 导出 | 说明 | |-----------|-----------------------------------------------------------------|-------------| | Session | sessionApi | 会话管理、当前用户信息 | | SaaS | tenantApi, applicationApi | 租户、应用管理 | | Identity | identityAccountApi, identityGroupApi, identityStrategyApi | 账户、组、认证策略 | | Authority | roleApi, menuApi | 角色、菜单权限 | | Gateway | gatewayApi | 网关过滤器 | | Logging | logCollectorApi, logFilterApi, logStorageApi | 日志采集、过滤、存储 | | Storage | storageApi | 对象存储桶管理 | | Multicast | multicastApi | 广播消息 | | System | databaseApi, dictionaryApi | 数据库、字典配置 |

每类 API 都提供以下方法:

| 方法 | 说明 | |------------------|----------| | page(query) | 分页查询列表 | | details(id) | 根据主键查询详情 | | add(params) | 新增数据 | | update(params) | 更新数据 | | delete(ids) | 删除数据 | | enable(id) | 启用数据 | | disable(id) | 禁用数据 |

类型定义

所有类型在导入时自动可用:

import {TenantParams, TenantPageQuery, Tenant} from '@centralx/central-studio-api';

const params: TenantParams = {
    code: 'demo',
    name: '演示',
    databaseId: 'db-id',
    enabled: true,
};

License

MIT