@gathertown/webhook-object-types

中文文档
0.3.0发布于 2026/09/04MIT OR Apache-2.0TypeScript零依赖近 30 天下载 3.7万

为 Gather webhook-object(Smart Object)事件生成类型脚本. 只有类型,零运行时间.

中文使用文档

@gathertown/webhook-对象类型

为 Gather webhook-object( Smart Object) 事件生成类型脚本: 每条线 type (例如:. counter.increment) 及其定义 data 有效载荷外形,外加预设能力 分组。 只类型,零运行时代码,零依赖.

使用量

npm install --save-dev @gathertown/webhook-object-types
import type {
  DataFor,
  EventTypeForPreset,
  WebhookEventEnvelope,
  WebhookEventType,
  WebhookWireErrorCode,
} from "@gathertown/webhook-object-types"

// The HTTP request body for any event, fully typed per event type:
const event: WebhookEventEnvelope<"counter.increment"> = {
  type: "counter.increment",
  timestamp: new Date().toISOString(),
  data: { by: 1 }, // DataFor<"counter.increment">
}

// What a given preset accepts:
type InboxEvent = EventTypeForPreset<"inbox"> // "activity.add" | "counter.set" | …

// Error codes the receiver returns in `{ "error": "<code>" }` bodies:
const code: WebhookWireErrorCode = "token_revoked"

大多数整形师想要 @gathertown/webhook-object-sdk 相反,它将这些类型包裹在一个签名的重试客户端中.

schemas/: 语文中立合同

schemas/*.json 每场赛事拥有1个JSON Schema(草案07) data 由电线命名的有效载荷 类型(counter.increment.json) (中文(简体) ). 类型脚本在 src/ 由这些相同的 通过快取型的策略, 和其他语言上的集成器可以做同样的事情:

npx quicktype -s schema schemas/*.json --lang go --just-types
npx quicktype -s schema schemas/*.json --lang python

(明确输入文件,以快速指向 目录 令其视之为 JSON样本并生成图案文件本身的类型. )

计划还和任何JSON Schema 校验器(jav等)合作进行运行时间校验 动态制造的有效载荷,可直接导入:

import counterIncrement from "@gathertown/webhook-object-types/schemas/counter.increment.json"

这里的一切都是由同一计划产生的 验证事件服务器侧,所以 这些类型永远不会从执行中消失.

版本与发布记录

@gathertown/webhook-object-types 共发布 4 个版本,首次发布于 2026/07/20;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.3.0latest2026/09/042 个月前
0.2.02026/07/293 个月前
0.1.12026/07/203 个月前
0.1.02026/07/203 个月前

关于 @gathertown/webhook-object-types 的常见问题

@gathertown/webhook-object-types 是什么?

为 Gather webhook-object(Smart Object)事件生成类型脚本. 只有类型,零运行时间.

如何安装 @gathertown/webhook-object-types?

在项目目录运行 npm install @gathertown/webhook-object-types,或使用 pnpm add / yarn add / bun add。

@gathertown/webhook-object-types 支持 TypeScript 吗?

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

@gathertown/webhook-object-types 可以商用吗?

@gathertown/webhook-object-types 使用 MIT OR Apache-2.0 许可。可在 MIT、Apache-2.0 中任选其一遵守。选择 MIT 时,宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@gathertown/webhook-object-types 的下载量有多少?

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

@gathertown/webhook-object-types 还在维护吗?

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