@hanzo/events

中文文档
0.3.3发布于 2026/11/02MITTypeScriptESM + CJS零依赖近 30 天下载 1.8万

The canonical Hanzo event schema: which events exist, what each means, and what it carries.

原始使用文档
文档目录3 节
  1. The rules this file keeps
  2. For readers that are not TypeScript
  3. Unknown events are recorded, not refused

@hanzo/events

The canonical Hanzo event schema: which events exist, what each one means, and what it carries.

import { EVENTS, SCHEMA, isKnown, specFor } from '@hanzo/events'

SCHEMA['first_action']
// { summary: 'Activation: the first moment of real value…',
//   props: { action: { type:'string', values:['api_call','app_live','chat_reply'] } } }

isKnown('deploy_succeeded')  // true
isKnown('deploy_static_ok')  // false — flagged on ingest, not refused

To send an event, use @hanzo/event. Plural is the catalog, singular is the client: many events are defined here, one event is sent by a call there. The client depends on this package and re-exports EVENTS, so either import works and there is still one definition.

The rules this file keeps

A dimension is a property, never part of the name. deploy_succeeded with {framework:'static'}, never deploy_static_succeeded. That is what makes a funnel line up across console, chat, app, site and admin — and it is the reason a catalog like this can exist at all.

A property is listed only where there is evidence for it — a docstring in the vocabulary or a live capture() call in a surface. An invented property is worse than an absent one: it teaches a wrong shape to the next reader and to anything trained on the corpus.

Every event is open. props is what an event is known to carry, never the exhaustive set. A property absent here is undocumented, not forbidden.

For readers that are not TypeScript

catalog.json ships in the package — the same catalog as data. The ingest endpoint is Go and cannot import TypeScript, so it reads that. One source, two readers.

@hanzo/events/catalog.json
  { version, names[], reserved[], schema{} }

Unknown events are recorded, not refused

The ingest endpoint records an event whose name is not in this catalog and flags it. Refusing would mean a surface that ships a new event before the catalog does loses the data outright — and the data is the part you cannot recover. A flag you can act on later.

版本与发布记录

@hanzo/events 共发布 8 个版本,首次发布于 2026/08/15;过去 12 个月发布了 8 个版本。

版本发布日期距今
0.3.3latest2026/11/0215 天前
0.3.22026/10/3017 天前
0.3.12026/09/301 个月前
0.3.02026/09/301 个月前
0.2.22026/08/212 个月前
0.2.12026/08/163 个月前

关于 @hanzo/events 的常见问题

@hanzo/events 是什么?

The canonical Hanzo event schema: which events exist, what each means, and what it carries.

如何安装 @hanzo/events?

在项目目录运行 npm install @hanzo/events,或使用 pnpm add / yarn add / bun add。

@hanzo/events 支持 TypeScript 吗?

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

@hanzo/events 支持 ESM 还是 CommonJS?

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

@hanzo/events 可以商用吗?

@hanzo/events 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@hanzo/events 的下载量有多少?

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

@hanzo/events 还在维护吗?

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