@creem_io/webhook-types
Creim webhook 有效载荷的共享类型脚本和工具。 克里姆餐厅 框架集成使用此套件作为其共同的webhook合同.
安装
pnpm add @creem_io/webhook-types
使用量
import {
isWebhookEventEntity,
parseWebhookEvent,
type WebhookEvent,
} from "@creem_io/webhook-types";
const event: WebhookEvent = parseWebhookEvent(requestBody);
if (isWebhookEventEntity(event)) {
console.log(event.eventType, event.id);
}
软件包导出 webhook 实体和事件类型, 规范的事件类型,
运行时间类型警卫, generateSignature,以及 parseWebhookEvent。 。 。 .
发展
从寄存器根 :
pnpm --filter @creem_io/webhook-types build
pnpm --filter @creem_io/webhook-types typecheck
pnpm --filter @creem_io/webhook-types test