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

@be-link/vitality-cli-nodejs

v0.0.46

Published

VitalityService Node.js 客户端

Readme

@be-link/vitality-cli-nodejs

VitalityService 的 Node.js SDK,用法与 @be-link/cs-cli-nodejs 一致。

旅顾 Shield Token transport(开发中)

src/vs/advisorProtection.ts 提供 createAdvisorTokenTransport({origin, send}) 与严格 canonicalAdvisorJson。每次请求动态读取 process.env.authorizationTokenInside,不缓存; 缺失/空值在 HTTP 前拒绝。仅使用既有 SDK headers: x-belink-accessType: authorizationTokenInside、x-belink-authorization: <当前 token>。 不再使用旅顾独立签名、私钥或 actor 票据;原签名/验签 API 已移除。 服务端 Shield 及业务授权负责可信调用方与旅顾资格,SDK 不证明用户身份。 保留五条准确协议路径及 AdvisorAdjustmentService(transport);本轮不改变旧 BaseService 环境/目标选择。

旅顾创建(内部 DS 调用,默认未启用)

AdvisorAdjustmentService 必须注入由 createAdvisorTokenTransport 装配的受保护 transport;未提供时拒绝,不使用旧 callApi 回退。Token transport 的 sender 使用 createAdvisorHttpsSender,目标由显式配置的 HTTPS origin 构造,不依赖 旧 BaseService 的环境域名。五个新方法只传准确协议路径;transport也兼容准确的同origin绝对URL,拒绝路径归一化、query/hash或其他origin。创建只尝试一次,安全业务拒绝码保真,网络失败/不合法成功响应为 RESULT_UNKNOWN,不能自动重提。

内部请求是 {orderId,type,unitFeeCent,quantity,description,actor:{advisorId,name}}。 DS 必须在每次请求前重新检查认证用户的当前 AdvisorUser 资格,并从服务端记录取得 actor; SDK 不提供用户认证或资格证明。客户端到 DS 的公开请求不得包含 actor。 SDK 拒绝买家身份、creatorId、settlementPrice、total 等额外字段,私有快照后发送, 响应固定为 {adjustmentOrderId,status:'NOT_PAID',feeCent}。

四个读取方法同样要求服务端可信 actor:capabilities 接受1–50个唯一 orderIds;list 接受 orderId;shareContext 接受 adjustmentOrderId;operationsList 接受 adjustmentOrderId 及可选 cursor/pageSize。路径显式沿协议映射,share-context/operations-list 不依赖 BaseService 的方法名转换。cursor 原样传递;返回只保留固定内部 DTO,人员稳定 ID 仍须由 DS 对外裁剪。读取错误保留受控业务码,其余统一为 DEPENDENCY_UNAVAILABLE,不重试。分享仍使用 mainOrderId 差价集合页,不虚构单张定位。

创建和读取切片离线验证:

out=$(mktemp -d /tmp/vs-advisor-create-sdk.XXXXXX)
tsc src/vs/modules/api/adjustment/advisor/service.ts src/vs/advisorHttpSender.ts --rootDir src \
  --strict --target ES2020 --module commonjs \
  --typeRoots /opt/homebrew/lib/node_modules/ts-node/node_modules/@types --types node --outDir "$out"
node src/vs/modules/api/adjustment/advisor/service.offline.cjs "$out"
node src/vs/modules/api/adjustment/advisor/reads.offline.cjs "$out"

这不是 Jest、完整应用构建或真实网络验收。

createAdvisorHttpsSender 提供专用原生 HTTPS sender:显式 origin、timeoutMs 和 maxResponseBytes(传输容量,不是业务金额上限),固定五条协议路径,校验证书,不使用环境代理、 不跟随重定向、不重试、不记录 Token 或正文。仅接受本需求有 data 的 native 成功响应; 不改变旧 transport 的 void/SCF 语义。没有默认域名,尚未验证真实网络。

合法 4xx native 失败 envelope 的七项契约白名单 errorCode 可保留为本地 AdvisorBusinessError; 服务器 message/details/requestId/headers 不复制。VS 服务端仍需把实际拒绝映射为这些字符串码, 通用 native 数字 errorCode 不会被猜测转换。内部 transport 只尝试一次,未知 sender 失败时 create 抛 RESULT_UNKNOWN,其他动作抛 DEPENDENCY_UNAVAILABLE,不推断创建未执行。 旧 HTTP transport 和重试行为未改。

无项目依赖时的离线验证(不是 Jest 或全仓构建):

out=$(mktemp -d /tmp/vs-advisor-protocol.XXXXXX)
tsc src/vs/advisorProtection.ts src/vs/advisorHttpSender.ts --strict --target ES2020 --module commonjs \
  --typeRoots /opt/homebrew/lib/node_modules/ts-node/node_modules/@types --types node --outDir "$out"
node src/vs/advisorProtection.offline.cjs "$out"
node src/vs/advisorHttpSender.offline.cjs "$out"

typeRoots 是本机已有 Node 声明路径,其他机器应使用实际安装位置。本测试仅使用虚构 Token 与 mock HTTPS,不联网,不加载证书或密钥。