@burdenoff/sdk-libs

中文文档
2026.1108.5发布于 2026/11/08UNLICENSEDTypeScriptESM + CJS近 30 天下载 4600

Modular SDK library shared across all Burdenoff product SDKs (vibecontrols, botlit, fluidgrids, bigconsole, healthybowl, devportal, workspaces). Each module exports an SdkModule contract with attach(ctx) returning a typed API; product SDKs become thin she

原始使用文档
文档目录6 节
  1. Architecture
  2. Build
  3. Commands
  4. Adding a module
  5. Testing
  6. Reference

@burdenoff/sdk-libs

Modular SDK library shared across all Burdenoff product SDKs (Node/TypeScript).

Each module under src/modules/<name>/ exports an SdkModule with attach(ctx) -> API. Product SDKs (@vibecontrols/sdk-node, @botlit/sdk-node, etc.) become thin shells that pick which modules to mount. Sister to @burdenoff/cli-sdk.

Architecture

  • Core (src/core/): SdkContext prop bag, SdkModule contract, BaseGraphQLClient (dual workspace+global gateway), AuthStore with pluggable TokenStore (InMemory, File, Env), error hierarchy with token redaction, ModuleRegistry for cross-module access.
  • Modules (src/modules/<name>/): index.ts (default-exports SdkModule), operations.ts (hand-written gql strings), api.ts (the class returned by attach), types.ts (re-exports from __generated__/), __generated__/types.ts (codegen output, gitignored).
  • Hard rules: Modules NEVER import each other directly — use ctx.modules.get<API>('id'). Modules NEVER call process.exit or write secrets to logs.

Build

  • tsup dual ESM+CJS, multi-entry, dts: true. Entries: src/index.ts, src/core/index.ts, src/modules/*/index.ts.
  • external: graphql, graphql-request, graphql-ws (peer deps).
  • Subpath imports: @burdenoff/sdk-libs/core, @burdenoff/sdk-libs/modules/<name>.

Commands

bun install
bun run dev               # tsup watch
bun run build             # tsup once
bun run sanity            # boff sanity: format (bun fmt), lint, typecheck (bun check), build, test
bun run test              # bun test
bun run type:check        # bun check (TypeScript 7 rules)
bun fmt                   # format src, tests and scripts
bun run codegen           # GraphQL types from pinned Hive supergraph
bun run codegen:check     # CI gate: fail if generated types drifted
bun run parity:check      # cross-language manifest diff vs sdk-libs-python

Adding a module

  1. mkdir src/modules/<name> with index.ts, operations.ts, api.ts, types.ts.
  2. Default-export an SdkModule<API> from index.ts.
  3. Add the module to schema/modules.yaml (operations + dependsOn).
  4. Mirror in ~/products/sdk-libs-python/ in the same PR pair.
  5. tsup picks it up automatically (src/modules/*/index.ts glob).

Testing

  • Unit (tests/unit/): pure logic — arg parsers, response transformers, gql doc builders. No HTTP. bun test, <5s.
  • Integration (tests/integration/): MSW intercepts GraphQL requests. Mock factories derived from __generated__/types. Schema rename breaks mock = test fail.
  • E2E (tests/e2e/): real svc + state, run nightly. Mirrors ~/products/vibecontrols/vibecontrols-doctor/scripts/test-*-crud.sh.
  • Parity (tests/parity/<scenario>.yaml): same scenario file run by node + python. CI fails if shapes diverge.

Reference

  • ~/products/burdenoff-be-sdk-node/ — reference for tsup multi-entry + verdaccio publish.
  • ~/products/cli-sdk/ — sister CLI SDK.
  • ~/products/vibecontrols/vibecontrols-sdk-node/ — first consumer (thin shell).
  • ~/products/dev/audit/index/vibecontrols.md — 23-module ground-truth.
  • docs/fluidgrids.md — the FluidGrids module: authentication, errors and misses, retries, secrets, quirks.

版本与发布记录

@burdenoff/sdk-libs 共发布 56 个版本,首次发布于 2026/05/11;过去 12 个月发布了 56 个版本。

版本发布日期距今
2026.1108.5latest2026/11/08今天
2026.1108.42026/11/08今天
2026.1108.32026/11/08今天
2026.1108.22026/11/08今天
2026.1108.12026/11/08今天
2026.1107.42026/11/081 天前

其他发布通道:alpha → 2026.523.1。

关于 @burdenoff/sdk-libs 的常见问题

@burdenoff/sdk-libs 是什么?

Modular SDK library shared across all Burdenoff product SDKs (vibecontrols, botlit, fluidgrids, bigconsole, healthybowl, devportal, workspaces). Each module exports an SdkModule contract with attach(ctx) returning a typed API; product SDKs become thin she

如何安装 @burdenoff/sdk-libs?

在项目目录运行 npm install @burdenoff/sdk-libs,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:graphql(^16.0.0)、graphql-request(^7.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@burdenoff/sdk-libs 支持 TypeScript 吗?

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

@burdenoff/sdk-libs 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@burdenoff/sdk-libs 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.11.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@burdenoff/sdk-libs 可以商用吗?

@burdenoff/sdk-libs 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@burdenoff/sdk-libs 的下载量有多少?

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

@burdenoff/sdk-libs 还在维护吗?

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