@exodus/analytics-validation

中文文档
3.18.0发布于 2026/11/13MITTypeScriptESM + CJS零依赖近 30 天下载 1.3万

JSON schemas for analytics events, to prevent sensitive data from being sent up to the infamous cloud

原始使用文档
文档目录4 节
  1. Why
  2. Development
  3. Do I need to add a new schema?
  4. JSON Schema Development

@exodus/analytics-validation

Why

This helps prevent that we do not accidentally collect any sensitive and/or private information, therefore all events must pass a validation layer.

Examples of what could go wrong:

Development

Do I need to add a new schema?

flowchart TD
    Title(Adding a new telemetry event) --> A
    A{Does your event\nhave properties?}
    A -->|Yes| C
    A -->|No| B
    B(You're done!)
    C{Does it only require\n the 'origin' property?}
    C -->|Yes| B
    C -->|No| E[Generate a new JSON Schema: \npnpm generate analytics-validation]
    E --> D[Adjust the schema and tests]
    D --> B

JSON Schema Development

To add a new schema run

pnpm generate analytics-validation

in the project root. The CLI tool will ask you for all details needed. Once the schema is created, make sure to

  1. Before adding a new schema, double check if a subdirectory (essentially an event domain, e.g. dapps) already exists in ./src. If not, you will have to come up with a subdirectory name during the next steps;
  2. Fill the schema with the expected properties and their types. The property names must be in the snake_case (e.g. expected_property);
  3. Fix the generated unit test as it will be intentionally failing;
  4. Add your own test cases to ensure the schema works properly before merging the PR and publishing a new version.

List of string formats

Schemasafe ships with a bunch of default formats, you can find the implementation of these here!

  • email
  • hostname
  • uuid
  • date
  • time
  • date-time
  • duration
  • ipv4
  • ipv6
  • uri
  • uri-reference
  • uri-template
  • alpha
  • alphanumeric
  • base64
  • hex-digits
  • hex-digits-prefixed
  • hex-bytes
  • hex-bytes-prefixed
  • json-pointer
  • relative-json-pointer

版本与发布记录

@exodus/analytics-validation 共发布 192 个版本,首次发布于 2023/04/15;过去 12 个月发布了 54 个版本。

版本发布日期距今
3.18.0latest2026/11/13今天
3.17.02026/11/122 天前
3.16.02026/11/112 天前
3.15.02026/11/067 天前
3.14.02026/11/059 天前
3.13.02026/10/3014 天前

关于 @exodus/analytics-validation 的常见问题

@exodus/analytics-validation 是什么?

JSON schemas for analytics events, to prevent sensitive data from being sent up to the infamous cloud

如何安装 @exodus/analytics-validation?

在项目目录运行 npm install @exodus/analytics-validation,或使用 pnpm add / yarn add / bun add。

@exodus/analytics-validation 支持 TypeScript 吗?

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

@exodus/analytics-validation 支持 ESM 还是 CommonJS?

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

@exodus/analytics-validation 可以商用吗?

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

@exodus/analytics-validation 的下载量有多少?

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

@exodus/analytics-validation 还在维护吗?

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