@coralreefventures/contact

中文文档
0.7.0发布于 2026/10/20MITES Module构建来源已验证近 30 天下载 2063

The contact-form Lambda handler behind a Coral Reef public site: validates a posted message, drops bots, and hands the message on.

原始使用文档

@coralreefventures/contact

The Lambda handler behind a Coral Reef public site's contact or early-access form, behind a function URL: POST only, a JSON body, each field trimmed and held to its length, the required ones present, the email address shaped like one, and a filled-in honeypot answered as if it worked and dropped.

Both sites carried a 60-line copy of this, differing only in the fields the form sends. A product's amplify/functions/contact/handler.ts becomes its field table and a call:

import { createContactHandler } from "@coralreefventures/contact";

export const handler = createContactHandler({
  fields: { name: 200, email: 320, company: 200, people: 50, message: 5000, about: 100 },
  required: ["name", "email", "message"],
  email: "email",
});

honeypot names the hidden field (website by default). deliver is what happens to a valid message; the default, which both sites' stubs do today, logs it as one JSON line with receivedAt. When a product wires the form somewhere (a Request in a Streamlane workspace, an email through SES), it passes a deliver and nothing else changes. CORS is not here: a function URL answers preflights itself, and the product's amplify/backend.ts names the origins.

parseContact(body, config) is exported on its own, for a test or a second route.

Installing

Ships TypeScript source; Amplify's function bundler (esbuild) and tsc -p amplify --noEmit both read it. @types/aws-lambda comes with it, since the handler's signature is typed with it.

版本与发布记录

@coralreefventures/contact 共发布 11 个版本,首次发布于 2026/10/05;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.7.0latest2026/10/2025 天前
0.6.02026/10/1926 天前
0.5.02026/10/1827 天前
0.4.32026/10/1827 天前
0.4.22026/10/131 个月前
0.4.12026/10/131 个月前

关于 @coralreefventures/contact 的常见问题

@coralreefventures/contact 是什么?

The contact-form Lambda handler behind a Coral Reef public site: validates a posted message, drops bots, and hands the message on.

如何安装 @coralreefventures/contact?

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

@coralreefventures/contact 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/coralreefventures__contact 是否存在。

@coralreefventures/contact 支持 ESM 还是 CommonJS?

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

@coralreefventures/contact 需要什么版本的 Node.js?

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

@coralreefventures/contact 可以商用吗?

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

@coralreefventures/contact 的下载量有多少?

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

@coralreefventures/contact 还在维护吗?

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