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

@hanmotec/aoss-client-library

v0.0.10

Published

This is a library to connect to the aoss service.

Readme

AOSS Client API

这是一组用于和AOSS交互的API接口,当前包括以下内容,接口封装中类AossClientAPI中,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);

获取当前用户

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

let aossApi = AossClientAPI.getInstance();
let me = await aossApi.getMe();

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

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

let aossApi = AossClientAPI.getInstance();
let permission = await aossApi.getPermission('saas-platform');
console.log(permission);

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

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

let aossApi = AossClientAPI.getInstance();
let pmList = [
    {key: 'createNew', pos: 0},  //新增的权利
    {key: 'modify', pos: 1}, //修改的权利
    {key: 'remove', pos: 2}, //删除的权利
    {key: 'activate', pos: 3}, //激活的权利
]
let permission = await aossApi.getModulePermission('saas-platform', 'dic-group', pmList);

console.log('是否有新增的权利', permission.createNew);

数据字典

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

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]);

多级数据选项获取下级数据接口

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

let aossApi = AossClientAPI.getInstance();

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

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

处理令牌过期

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

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

let aossApi = AossClientAPI.getInstance();

aossApi.handleTokenExpiry();

打开新模块页面

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

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

let aossApi = AossClientAPI.getInstance();

aossApi.openModule(modHash, {});