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

old-api

v0.0.1-alpha.14-edu

Published

1. 根据 swagger 生成 newApi 2. 通过 elk 导出 oldApi 的响应数据结构体 [urlRepos](./elk/urlRepos.json) 3. 使用[getMappingResource ](./elk/getMappingResource.ts)方法解析`urlRepos` 生成 oldApi 的返回值`key`以及`structure`(`packages/old-api/elk/sourceMappings/`) 4. 交由后端补充填写完 oldApi==>ne

Readme

Adapter 处理流程

接口[出参|入参]映射关系生成

  1. 根据 swagger 生成 newApi
  2. 通过 elk 导出 oldApi 的响应数据结构体 urlRepos
  3. 使用getMappingResource 方法解析urlRepos 生成 oldApi 的返回值key以及structure(packages/old-api/elk/sourceMappings/)
  4. 交由后端补充填写完 oldApi==>newApi 的字段映射关系,特殊结构做注释说明
  5. 使用scripts/json2mappings脚本 将补充完整的映射关系处理成按controller/method/[res|req]的目录结构生成对应的文件

适配器生成规则

  1. 根据urlRepos 以及 confluence 中维护的新旧controller|url映射关系(方法待完善,解析confluence导出word待开发)
export default {
  _newMethod: 'newMethod',
  _url_: { new: '/api/new/', old: '/api/old/' },
  _Controller: { new: 'newController', old: 'oldController' },
  // ···
}
  1. 自动生成的old-api/src/[controllers]文件对入参进行装箱
async function needInit_POST_1(
  qyIds: INeedInitPOST1QyIdsReq,
  needInit: INeedInitPOST1NeedInitReq,
): Promise<NeedInitPOST1PostRes> {
  //将参数包装到对象中
  return adapter.needInit_POST_1({
    qyIds,
    needInit,
  })
}
  1. 自动生成的 adapter 文件自动导入newApi,genNewRes等
//自动导入转换方法
import { genNewRes, invertMappings4Params } from '../utils/genNewRes'
//根据 步骤 1)自动导入controller对应的mappings
import * as queryAllProvince_GET_res from '../mappings/custom-manager-controller/queryAllProvince_GET/res'
import * as queryAllProvince_GET_req from '../mappings/custom-manager-controller/queryAllProvince_GET/req'

async function queryAllProvince_GET(params): Promise<QueryAllProvinceGETgetRes> {
  const paramsMapping = invertMappings4Params(queryAllProvince_GET_req)
  const newParams = genNewRes(params, paramsMapping)
  // #######manual ######

  //  handler-Params

  // #######manual ######

  // #######queryAllProvince_GET begin######
  //新接口传参顺序按照新接口swagger文档定义
  const _result = await newApi.commonXzqhController.getAllProvince(newParams.qyIds, newParams.needInit)
  genNewRes(_result, queryAllProvince_GET_res)

  // #######queryAllProvince_GET end######
  // #######manual ######

  //  handler-result

  // #######manual ######
  return _result
}