@faiber/faiber-version

中文文档
2.8.0发布于 2026/11/14TypeScriptES Module近 30 天下载 3886

Typed client for the Faiber version registry.

原始使用文档
文档目录4 节
  1. Install and configure
  2. Capabilities
  3. APK publishing
  4. Registry behavior

@faiber/faiber-version

Typed client for the Faiber version registry.

Install and configure

npm install @faiber/faiber-version @faiber/sdk-core
import { FaiberClient } from "@faiber/sdk-core";
import { VersionApi } from "@faiber/faiber-version";

const client = new FaiberClient("version", {
  domains: { version: "https://version.example.com" },
});
const versions = new VersionApi(client);

const current = await versions.service("profile");
const history = await versions.allVersions("profile");
const latest = current.data.data.service.last_version;
if (latest) {
  const release = await versions.version(latest.id);
  console.log(release.data.data.version.download_url);
}

Capabilities

MethodRouteSDK method
GET/healthhealth()
GET/api/openapi.jsonopenapi()
GET/api/v1/servicesservices()
GET/api/v1/services/{service_slug}service(slug)
GET/api/v1/services/{service_slug}/allallVersions(slug)
GET/api/v1/versions/{version_id}version(id)
POST/api/v1/apk/releasesoperations.routerPublishApkPost(input)

Responses retain the backend envelopes: service lists use data.services, single services and their complete history use data.service, and releases use data.version. Exported types include service identity/status, latest version, version code/name, channel, scope, changelog, download URL, status, and timestamps.

All calls return full Axios responses and accept RequestOptions for cancellation, timeout, and headers. The version registry routes are public in the inspected service; no token is added unless the configured client has one.

APK publishing

versions.operations.routerPublishApkPost({serviceSlug, appName, version, versionCode, downloadUrl}, options) publishes an idempotent APK release. The download URL must use HTTPS and versionCode must be positive. Supply the sandbox's dedicated APK publisher bearer credential through the configured server client; this is not an end-user publishing permission. The raw response is {status:"success", id}. Invalid metadata returns 400, missing/incorrect credentials return 401, and unavailable publisher configuration returns 503.

The slug contains 1–100 ASCII letters, digits or hyphens. appName must contain non-whitespace text and be at most 80 characters; version contains 1–40 ASCII letters, digits, dots, hyphens or underscores. The URL must not contain user credentials. versionCode is a positive integer; use JavaScript safe integers to avoid losing precision.

Release identity is stable for the same slug and version string. A retry can update its metadata and code; an older code cannot overwrite a higher stored code. The publisher creates active Release/Closed records but leaves an existing inactive parent service inactive. A successful receipt can therefore coexist with a service lookup returning 404. Download URLs are stored as metadata; the service does not fetch or validate the APK contents.

Registry behavior

Lists return active services without pagination, filters, or populated last_version values. A service lookup accepts its slug, and resolves the highest active version_code. Complete history includes active versions with unspecified ordering. A version lookup accepts a UUID: malformed UUIDs return 400, and missing/inactive records return 404.

channel uses Release or PreRelease; scope uses Public or Closed. Scope is descriptive metadata in the inspected handler and does not enforce membership. Apply the appropriate gateway access policy for your project runtime. Do not treat Closed as a protection mechanism.

Health reports process status. The OpenAPI endpoint returns a raw document, currently describing health only; it is not a complete API inventory. Both convenience methods and generated operations use these same wire contracts.

Nullable fields are present with null, including service title, release metadata and updated_at; they are not omitted. History uses versions and has no last_version field. Version timestamps are naive database timestamp strings; no UTC offset is promised. Successful read envelopes always include status, message and data. The publisher receipt remains raw.

Use an in-memory TokenProvider for gateway credentials, or configure Axios withCredentials when your gateway supports secure HttpOnly cookies. Keep the dedicated publisher credential on a trusted server. Configure a separate publisher client when end-user and publisher tokens differ.

Axios rejects unsuccessful responses; service application errors usually expose {error: string} in error.response.data, while extractor errors may use a different body. An aborted AbortSignal rejects with Axios cancellation code ERR_CANCELED.

The complete multi-service client is @faiber/faiber-ts-sdk.

版本与发布记录

@faiber/faiber-version 共发布 66 个版本,首次发布于 2026/07/18;过去 12 个月发布了 66 个版本。

版本发布日期距今
2.8.0latest2026/11/14今天
2.7.02026/11/059 天前
2.6.02026/11/049 天前
2.5.02026/11/049 天前
2.4.02026/11/0310 天前
2.3.02026/11/0211 天前

关于 @faiber/faiber-version 的常见问题

@faiber/faiber-version 是什么?

Typed client for the Faiber version registry.

如何安装 @faiber/faiber-version?

在项目目录运行 npm install @faiber/faiber-version,或使用 pnpm add / yarn add / bun add。

@faiber/faiber-version 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@faiber/faiber-version 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@faiber/faiber-version 可以商用吗?

@faiber/faiber-version 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@faiber/faiber-version 的下载量有多少?

根据 npm 官方下载统计,@faiber/faiber-version 在 2026/10/14 – 2026/11/12 这 30 天内被下载 3,886 次,日均约 130 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@faiber/faiber-version 还在维护吗?

最新版本 2.8.0 发布于 2026/11/14(今天);至今共发布 66 个版本,其中过去 12 个月发布了 66 个;首次发布于 2026/07/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。