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

itingluo-api

v0.0.1

Published

A teleman wrapper for Ivanka API

Readme

wscn-ivanka-api

WSCN Ivanka API

Features

  • 继承 teleman
  • 自动设置token
  • 自动添加请求头X-Ivanka-TokenX-Client-TypeX-Ivanka-PlatformX-Taotie-Device-IdX-Device-Id
  • 自动抛出非20000响应错误

Install

yarn add wscn-ivanka-api --registry=http://mavenhk.wallstcn.com/repository/npm-all/

Usage

import WscnIvankaAPI from 'wscn-ivanka-api'

const api = new WscnIvankaAPI({
  env: 'prod', // sit, stage, prod
  appId: 'com.wallstreetcn.web',
  appVersion: '1.2.3',

  onSafeError(e) {
    // 现实中应该使用toast等友好的UI实现
    console.error(e.code, e.message)
  }
})

api.get('/user/info/me')

API

WscnIvankaApi(options)

Options:

env

类型:String

可选,默认为prod。base默认值将从env对应的值取得。

| env | base | |-------|------------------------------------| | sit | https://api-sit.wallstreetcn.com | | stage | https://api-stage.wallstreetcn.com | | prod | https://api-prod.wallstreetcn.com |

base

类型:String

可选,默认为env指定的值。相对于请求URL的基础URL。

apiVersion

类型:String

API地址前缀。可选,默认为 apiv1

appId

类型:String

业务appId,例如com.wallstreetcn.web

参见:http://115.159.108.254:4000/gui-ze/chang-liang.html

appVersion

类型:String

app版本,例如1.2.3

cache

类型:Boolean

可选。如果该项为真,将会缓存请求,并且将请求结果内联至head,供下次初始化使用,请配合cacheUntil使用。

cacheUntil

类型:Number

可选,默认为400ms。第一个api发出并且成功响应后,如果在指定的毫秒内没有新的请求发出,那么结束缓存。

onReady(callback)

类型:Function

配合cache使用。当cache开启时,我们需要app在拉取到api缓存后替换DOM节点,以避免页面加载时闪屏的问题。

const api = const api = new WscnIvankaAPI({
  env: 'prod', // sit, stage, prod
  appId: 'com.wallstreetcn.web',
  appVersion: '1.2.3',
  cache: true,
  onReady: replaceDocument
})

const app = new Vue(...).$mount()

function replaceDocument() {
  document.body.replaceChild(app.$el, document.getElementById('app'))
}

ddcEnv

类型:String

/ddc/开头的API,URL会被改写未DDC服务的地址。ddcEnv指定DDC服务环境。

默认为prodddcBase默认值将从ddcEnv对应的值取得。 由于ddc没有stage环境,因此stage也使用prod地址。

| env | base | |-------|---------------------------------------| | sit | http://api-ddc-sit.wallstreetcn.com | | stage | http://api-ddc.wallstreetcn.com | | prod | http://api-ddc.wallstreetcn.com |

ddcBase

类型:String

可选,默认为ddcEnv指定的值。相对于请求URL的基础URL。

onSafeError

类型: Function

api.safe.* 出错后的回调函数。

实例方法

api.fetch(url, { method, headers, query, body, type })

Params: url: String. The url of the request. The final url will be base + url + querystring. method: String. HTTP methods. 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD'. Defaults to 'GET'. headers: Object | Headers. HTTP headers. query: String | Object | Array | URLSearchParams. The URL queries. String/Object/Array type will be used to create a URLSearchParams instance. body: Object | FormData | Blob | BufferSource | URLSearchParams | String. Any body that you want to add to your request. Note that a request using the GET or HEAD method cannot have a body. type: String. 'json' or 'form'.

  • If type is not defined and body is a plain object, body will be transformed to JSON.
  • If type is 'json', body will be transformed to JSON.
  • If type is 'form' and body is a key-value object, body will be transformed to FormData with formData.append(name, value).

Request method aliases

api.get(url, query, options)
api.post(url, body, options)
api.put(url, body, options)
api.patch(url, body, options)
api.delete(url, query, options)
api.head(url, query, options)

api.safe

提供了安全方法,出错后不会执行之后的代码。并且调用 onSafeError 函数,你可以在函数内弹 toast 等方式提示错误信息。

const result = await api.safe.get(...)
// 如果拉取数据失败,下面代码不会执行
console.log(result)

经常使用的方法:

  • api.safe.get()
  • api.safe.post()