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 🙏

© 2024 – Pkg Stats / Ryan Hefner

trc-ucenter

v1.2.20

Published

ucenter api for node.js

Downloads

2

Readme

ucenter api for node.js

install

npm install ucenter ucenter --save

Compatibility

Node.js >= 8.0.0 required.

Usage

// init
const ucenter = require('ucenter');
ucenter.init({ appId, appSecret, gateway, store: { getToken, setToken } });

// use
const ucenter = require('ucenter').instance();

Summary

foundation-tenant

batchQueryUser(userId)

通过用户 ID或者手机号批量获取用户信息

  • [params] {Array[Object]} 用户id或手机号
    • [userId] {String} 用户id
    • [phone] {String|Number} 手机号
  • [concurrency] {Number} 最大同时并发数
const res = await ucenter.tenant.batchQueryUser(params, concurrency);

getInviterById(userId)

通过用户 ID 获取邀请人信息

  • [userId] {String} 用户的 id
const res = await ucenter.tenant.getInviterById(userId);

getInviterByCode(inviteCode)

通过邀请码获取邀请人信息

  • [inviteCode] {String} 邀请码
const res = await ucenter.tenant.getInviterByCode(inviteCode);

getInviteCode(param,queryType)

根据手机号或者用户 ID 获取用户邀请码

  • [param] {String} 查询参数
  • [queryType] {String}  查询方式 BY_ID BY_PHONE
const res = await ucenter.tenant.getInviteCode('18666666666', 'BY_PHONE');

getSingleUser(param,queryType)

通过 userId、手机号获取单个用户信息

  • [param] {String} 查询参数
  • [queryType] {String}  查询方式 BY_USER_ID BY_USER_PHONE
const res = await ucenter.tenant.getSingleUser('18666666666', 'BY_USER_PHONE');

getBatchUsers(params,queryType)

通过 userId、手机号获取单个用户信息

  • [params] {Array[String]} 查询参数
  • [queryType] {String}  查询方式 BY_USER_ID BY_USER_PHONE
const res = await ucenter.tenant.getBatchUsers(['18666666666'], 'BY_USER_PHONE');

getUserMenu(userId,appPropertyId,menuResourceId)

通过userId、appPropertyId、menuResourceId获取用户拥有权限的菜单

  • [userId] {String} 用户id
  • [appPropertyId] {String} 应用appPropertyId
  • [menuResourceId] {String} 根目录菜单resourceId
const res = await ucenter.tenant.getUserMenu(userId,appPropertyId,menuResourceId);

getUserRoleByUri(uri, method, userId, appPropertyId)

通过用户请求的uri获取用户对该uri的所拥有的角色

  • [userId] {String} 用户id
  • [appPropertyId] {String} 应用appPropertyId
  • [uri] {String} http请求uri
  • [method] {String} http method
const res = await ucenter.tenant.getUserRoleByUri(uri, method, userId, appPropertyId);

getUserInfoById(id)

通过用户中心用户id查询用户信息

  • [id] {String} 用户id
const res = await ucenter.tenant.getUserInfoById(id);

getServerToken()

签发应用 token

const res = await ucenter.tenant.getServerToken();

verifyToken(token)

验证 token

  • [token] {String} 用户 token
await ucenter.tenant.verifyToken(token);

getPublicKey()

 获取 public_key

const res = await ucenter.tenant.getPublicKey(token);

validateToken(tokenInfo)

根据 token 中间部分的提取信息去校验其有效性

  • [tokenInfo] {Object} tokenInfo
    • [sub] {String}
    • [p_v] {String}
    • [ident_id] {String}
    • [i_v] {String}
    • [jti] {String}
const res = await ucenter.tenant.validateToken(tokenInfo);

getAppApis(appPropertyId)

根据应用appPropertyId查询当前应用的api及对应的权限角色

  • [appPropertyId] {String} 应用appPropertyId
const res = await ucenter.tenant.getAppApis(appPropertyId);

foundation-user