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.8

Published

VitalityService Node.js 客户端

Readme

@be-link/vitality-cli-nodejs

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

调用方式(与商品 SDK 相同)

import {
  frontendConfigService,
  bannerWebService,
  supplierShuttleBusService,
  bizService,
  coreTokenService,
} from '@be-link/vitality-cli-nodejs'

// 直接调方法,不是 .call({ func })
const migrationRouteConfig = await frontendConfigService.getMigrationRouteConfig()
await coreTokenService.getMiniAppVitalityToken({})
await bannerWebService.queryBannerList({})
await supplierShuttleBusService.queryShuttleBusList({ pageIndex: 0, pageSize: 20 })

// 或命名空间聚合
await bizService.banner.web.queryBannerList({})
await bizService.supplier.shuttleBus.queryShuttleBusList({ pageIndex: 0, pageSize: 20 })
await bizService.activity.venue.queryUserTaskRecords({ unionId: 'union-id' })
await bizService.activity.springAct.queryBranchVenue()
await bizService.core.config.get('CONFIG_KEY')
await bizService.core.token.batchRefreshEcommerceAccessToken([
  { appId: 'mini-app-id', secret: 'mini-app-secret' },
])

Core 按 9 个 service 聚合,冻结公开 38 个方法。Activity 按 11 个 service 聚合,冻结公开 72 个方法;transport 支持范围扩大不会自动把 manifest 中此前排除的接口加入 SDK。

Activity

Activity 按 mainvenuedoubleElevenanniversarywxLivespringActschoolActmarketingActinviteFissiondesirejob 聚合,共公开 72 个单对象参数或无参方法。

单个 object、根数组、string、number、boolean 或 null 参数都可由 SCF transport 完整表达。两个及以上业务位置参数仍无法迁移,因为 envelope 只能恢复一个 param;这类接口必须先由服务端提供单对象 adapter。服务端未注册的方法、已有 route/server 排除项和进程内 helper 不会因 transport 支持 primitive/数组而提前导出,完整冻结清单可查看 activitySdkManifest

履约/订单服务调商品服务:

import { itemQueryService } from '@be-link/cs-cli-nodejs'
await itemQueryService.byItem.queryItemSearchInfo({ itemIds: [...] })

调 VitalityService 同理:

import { coreTokenService } from '@be-link/vitality-cli-nodejs'
await coreTokenService.getMiniAppVitalityToken({})

目录约定(对齐 cs-cli)

src/vs/modules/biz/{module}/{service}/service.ts   # 一个 Service 类 + 单例 export
src/vs/modules/biz/{module}/type.ts                # 模块共享类型;也可按 service 拆 type.ts
src/vs/modules/api/{module}/{service}/service.ts   # native API Service
src/vs/modules/api/index.ts                        # api 命名空间聚合
src/vs/modules/biz/index.ts                        # 命名空间聚合
src/index.ts                                       # 对外 export 单例
  • prefixUrl = /{pkg}/{module}/{service},如 /biz/core/token
  • 路径最后一段保持原方法名,如 getMemberInfogetMemberInfo
  • /api/** 原生 HTTP Service 使用 callApi(this.getApiUrl(this.methodName), request):有参时参数直接作为 axios body,无参时 body 保持 undefined,绝不自动出现 __scfParam
  • /biz/**/web/** 云函数迁移 Service 使用 callScfApi(this.getApiUrl(this.methodName), request):非 undefined(包括 null)编码为 { __scfParam: { present: true, value: request } }undefined/无参编码为 { __scfParam: { present: false } }
  • transport 类型由 Service 显式选择,不根据参数形态或 URL 猜测。业务调用方不要自己调用 axios,也不要自己拼 __scfParam
  • callApicallScfApi 复用同一底层请求,并同时识别旧云函数 { success, data, msg, errorCode } 和 native { success, data, message }success:false 会抛 BizError,raw/null 响应原样返回。
  • frontendConfigService.getMigrationRouteConfig() 只负责拉取服务端配置;缓存时长和失败降级由调用方服务决定。

迁移期兜底

尚未封装到 cli 的接口可用 vitalityInvokeService.call({ pkg, module, service, func, param })新接口应优先补 Service 方法并发版,不要长期依赖 invoke。

命令

pnpm install
pnpm build

环境

  • 内网鉴权:process.env.authorizationTokenInside(由调用方服务从 Shield 定时刷新)
  • 链路 ID:每次请求生成 UUID,与 @be-link/cs-cli-nodejs 一致
  • 非生产环境固定走测试公网;生产环境中 SCF 走生产公网,非 SCF 容器走生产内网