@xyo-network/event-kit-testing

中文文档
2.3.4发布于 2026/11/03LGPL-3.0-onlyTypeScriptES Module

Shared conformance harness for Event Kit provider ports

原始使用文档
文档目录3 节
  1. Why a shared suite
  2. Declared capability, not assumed
  3. WakeQueue clauses

@xyo-network/event-kit-testing

Shared conformance harness for Event Kit provider ports.

const report = await runWakeQueueConformance('sqlite', {
  create: () => createSqliteWakeQueue({ path }),
  reopen: () => createSqliteWakeQueue({ path }),
})

Why a shared suite

A port is only swappable if every implementation agrees on the contract. The suite is what makes WakeQueue providers interchangeable rather than merely similar: adding a backend means implementing the interface and running this.

It throws on the first violated clause with the clause name and what it saw, and otherwise returns the full report, so one test surfaces which clauses ran.

Declared capability, not assumed

reopen is optional and is how a provider states it is durable. Its instances must share actual persistent authority for independent-object clauses. A subject that omits it has its durability clauses reported as skipped, never silently passed — an in-process queue must not appear to satisfy a clause it cannot. That keeps the report an honest description of what a provider proved.

WakeQueue clauses

ClauseProperty
empty-claimAn empty queue yields undefined rather than blocking
append-visibleWhat was appended comes back intact
lease-withholdsA held lease is invisible to other consumers
release-returnsReleasing makes the entry claimable again
ack-removesAcking removes it permanently
arrival-orderEntries are served in arrival order
single-claimerExactly one claimer wins a contested entry
recover-inflightAn abandoned lease is reclaimable
lease-fencingOld ack/release cannot alter the current successor
completion-fencingSame successful completion repeats are inert; opposite operations fail
survives-restartEntries and acks outlive the instance (durable only)
recovers-after-restartA lease held at process death is reclaimable (durable only)
cross-writer-claimerIndependent objects yield one winning claim (declared capability only)

Recovery uses recoverInflight({ consumersStopped: true }) after all consumers stop. Tests also invalidate deliberately captured lease closures to demonstrate fencing; the assertion does not authorize operators to recover active owners. The shared suite is supplemented by backend-specific fault, SIGKILL, custody, identity-collision and HTTP admission tests. A passing report does not establish host-loss, restore or multi-host qualification.

版本与发布记录

@xyo-network/event-kit-testing 共发布 22 个版本,首次发布于 2026/08/21;过去 12 个月发布了 22 个版本。

版本发布日期距今
2.3.4latest2026/11/03今天
2.3.32026/11/03今天
2.3.22026/10/313 天前
2.3.12026/10/303 天前
2.3.02026/10/295 天前
2.2.32026/10/286 天前

关于 @xyo-network/event-kit-testing 的常见问题

@xyo-network/event-kit-testing 是什么?

事件套件提供程序端口的共享一致性控制

如何安装 @xyo-network/event-kit-testing?

在项目目录运行 npm install @xyo-network/event-kit-testing,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:zod(^4.6)、@ariestools/sdk(^9.0)、@xyo-network/sdk(^8.1)、@opentelemetry/api(^1.10)、@xyo-network/sdk-protocol(^8.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@xyo-network/event-kit-testing 支持 TypeScript 吗?

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

@xyo-network/event-kit-testing 支持 ESM 还是 CommonJS?

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

@xyo-network/event-kit-testing 需要什么版本的 Node.js?

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

@xyo-network/event-kit-testing 可以商用吗?

@xyo-network/event-kit-testing 使用 LGPL-3.0-only 许可。弱 Copyleft:作为库被调用时通常不要求开源你自己的代码,但修改库本身需以 LGPL 开源;前端打包合并后的适用边界存在不同理解。以上为概括,不构成法律意见,请以许可原文为准。

@xyo-network/event-kit-testing 还在维护吗?

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