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

@foxpage/foxpage-api-handler

v1.0.13

Published

response handler

Downloads

29

Readme

背景

toast 展示信息空间较少,覆盖了后端的错误详情,难以提供更加准确的信息

问题

errorToast 函数,错误信息通过前端定义,基本没有用到后端的返回结果

前端现有文案

| Error Code | Description | | --------------------------------------- | ----------------------------- | | fetchListFailed | | | deleteContentFailed | 删除失败,此${type}正在被使用 | | obtainFailed | 获取动态,mock | | uploadFailed | | | deleteFailed | | | updateFailed | | | fetchFailed | | | saveFailed | | | publishFailed | | | offlineFailed | 下线 | | liveFailed | 激活 | | previewFailed | | | fetchUpdateInfoFailed | | | saveResourceFiled | | | saveComponentFiled | | | copyFailed | | | commitFailed | 上架 | | revokeFailed | 下架 | | fetchDetailFailed | | | addFailed | | | fetchPageListFailed | | | checkFailed | | | lockFailed | | | unlockFailed | | | searchFailed | | | cloneFailed | | | disabledFailed | 禁用 | | fetchComponentVersionResourceInfoFailed | 查询组件版本资源信息失败 | | fetchMockFailed | | | parsePageFailed | | | fetchTemplateFailed | | | fetchCatalogFailed | 查询目录失败 | | fetchHtmlFailed | | | fetchDslFailed | | | uploadScreenshotFailed | | | fetchVersionsFailed | 历史版本 | | tagSaveFailed | 标签同步失败 |

服务端

接口返回状态码 status 字段由 3 部分组成,动作,模块,数据,结果

在返回的 status 使用常量的方式传入,组合成最终的一个数值结果

动作

{
   "action": {
     "create": "10",
     "update": "11",
     "remove": "12",
     "query": "13",
     "publish": "14",
     "live": "15",
     "offline": "16",
     "clone": "17",
     "purchase": "18",
     "deprecate": "19",
     "sync": "20",
     ...
   }
}

模块

{
  "module": {
    "organization": "01",
    "team": "02",
    "application": "03"
    ...
  }
}

数据

{
  "dataType": {
    "folder": "01",
    "file": "02",
    "content": "03",
    "version": "04",
    "detail": "05",
    "builder": "06",
    "setting": "07",
    "tag": "08",
    ...
  }
}

结果

{
   "result": {
      "success": "01",
      "params-invalid": "02",
      "error": "03",
      "access-deny": "04"
      ...
   }
}

样例

获取应用详情成功:13-03-05-01

更新应用详情失败:11-03-05-03