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

@ticatec/aoss-client-library

v0.0.1

Published

This is a library to connect to the aoss service.

Readme

aoss-client-library

AOSS Client API

这是一组用于和AOSS客户端API,用于从aoss获取各种基础数据。

使用方法

1. 初始化ClientAPI

AossClientAPI是一个单列类,在使用前首先需要初始化,然后通过静态方法获取实例。

初始化

示例代码

import AossClientAPI from "./aoss-client-api";

/**
 * 创建接口服务代理类
 */
const serviceProxy = new RestService(getPath(), (ex): boolean => {
    if (ex instanceof ApiError) {
        window.Toast.show(appCtx.getError(ex['code']));
    } else {
        window.Toast.show('发生系统错误');
    }

    return true;
}, (headers, method, url) => {
    appCtx.appendHeader(headers);
});

AossClientAPI.initialize(serviceProxy);

2. 获取当前用户

通过此接口可以获取当前登录的用户。

  • 接口方法: async getMe()
  • 参数:
  • 返回值: 用户对象

示例数据

{
  "code": "admin@saas",
  "name": "系统管理员",
  "tenant": {
    "code": "00000000",
    "name": "北京滴答科技有限公司"
  },
  "dept": {
    "id": "8eafde981496478ab80096f548ebc4f2",
    "name": "北京滴答科技有限公司"
  }
}

示例代码

import AossClientAPI from "./aoss-client-api";

let aossApi = AossClientAPI.getInstance();
let me = await aossApi.getMe();
console.log('当前登录用户:', me);

3. 获取指定应用的实体权限定义

获取当前用户在指定应用中的权限

  • 接口方法: async getPermission(appCode)
  • 参数: appCode 应用的编码

示例数据

{
    "dic-group": {
      "maintain": true,
      "discard": true
    },
    "ts-role": {
      "maintain": true,
      "mngRoleUser": true
    },
    "ts-app-package": {
      "maintain": true
    },
    "ts-role-user": {},
    "ts-tenant": {
      "maintain": true,
      "maintainStatus": true
    },
    "dic-data": {
      "maintain": true
    },
    "ts-usr": {
      "maintain": true,
      "mngUserRole": true
    },
    "ts-application": {
      "maintain": true,
      "maintainStatus": true
    },
    "ts-organization": {
      "maintain": true
    },
    "ts-tenant-app": {
      "maintain": true
    },
    "ts-app-module": {
      "maintain": true
    }
}

示例代码

import AossClientAPI from "./aoss-client-api";

let aossApi = AossClientAPI.getInstance();
let permission = await aossApi.getPermission('saas-platform');
console.log("模块权限:", permission);

4. 获取应用中指定模块的权限

获取当前应用中某个模块的权限

  • 接口方法: async getModulePermission(appCode, modCode)
  • 参数:
    • appCode: 应用编码
    • modCode: 模块编码

返回示例数据

{
  "maintain": true,
  "maintainStatus": true
}
import AossClientAPI from "./aoss-client-api";

let aossApi = AossClientAPI.getInstance();

let permission = await aossApi.getModulePermission('saas-platform', 'dic-group');

console.log('是否有维护的权利', permission.maintain!=false);

5. 获取字典数据

获取指定的数据字典组的数据,对于平层数据,获取的数据格式为code/text数据组,对于多层数据,仅仅返回顶层数据。

  • 接口方法: async getDataOptions(dicNames)
  • 参数:
    • dicNames 字符串或者字符串数组,带读取的数据字典组名称

5.1 读取用于下拉框的数据选项接口

import AossClientAPI from "./aoss-client-api";

let aossApi = AossClientAPI.getInstance();

let dataOptions = await aossApi.getDataOptions(['ops-gender', 'ops-card-type', 'ops-nationality']);

console.log('性别选项:', dataOptions[ops-gender]);

5.2 读取多层级数据字典的子项目。

  • 接口方法: async getChildrenOptions(dicName, parentCode);
  • 参数:
    • dicName 数据字典的名称
    • parentCode 待读取子节点的节点值
import AossClientAPI from "./aoss-client-api";

let aossApi = AossClientAPI.getInstance();

let regions = await aossApi.getChildrenOptions('region', '130100');

console.log('下级地区:', regions);

6. 处理令牌过期

当应用请求后端返回401的时候,通知顶层窗口,平台客户端将要求用户重新登录

import AossClientAPI from "./aoss-client-api";

let aossApi = AossClientAPI.getInstance();

aossApi.handleTokenExpiry();

7. 打开新模块页面

不用菜单打开一个新的功能页面,此函数包括两个参数,页面的hash编码和启动参数,启动参数为一个对象。

import AossClientAPI from "./aoss-client-api";

let aossApi = AossClientAPI.getInstance();
//启动随访管理
aossApi.openModule('/#/plan/PlanHomePage', {status: 'A'});