@apollo/usage-reporting-protobuf

中文文档
4.1.2发布于 2026/05/05MITTypeScriptESM + CJS构建来源已验证近 30 天下载 1379万

Protobuf format for Apollo usage reporting

原始使用文档

apollo-reporting-protobuf

Note: The Apollo usage reporting API is subject to change. We strongly encourage developers to contact Apollo support at [email protected] to discuss their use case prior to building their own reporting agent using this module.

This module provides JavaScript/TypeScript Protocol buffer definitions for the Apollo usage reporting API. These definitions are generated for consumption from the reports.proto file which is defined internally within Apollo.

Development

Note: Due to a dependency on Unix tools (e.g. bash, grep, etc.), the development of this module requires a Unix system. There is no reason why this can't be avoided, the time just hasn't been taken to make those changes. We'd happily accept a PR which makes the appropriate changes!

Currently, this package generates a majority of its code with @apollo/protobufjs (a fork of protobufjs that we maintain specifically for this package) based on the reports.proto file. The output is generated with the generate npm script.

The root of the repository provides some devDependencies necessary to build these definitions; these will be installed by running npm install at the root of this workspace. When making changes to this module, run scripts via npm run SCRIPTNAME -w @apollo/usage-reporting-protobuf in the root of this monorepo in order to update the definitions in this module. The -w flag is shorthand for --workspace; this monorepo leverages NPM workspaces to manage its packages.

To update reports.proto to the current version recognized by the Studio usage reporting ingress, run npm run update-proto -w @apollo/usage-reporting-protobuf. To then regenerate the JS and TS files, run npm run generate -w @apollo/usage-reporting-protobuf. We check in the generated code and only regenerate it manually, partially to make builds faster (no need to run pbjs on every npm install) and partially so that we don't have to make sure that pbjs runs on every Node version that we support.

版本与发布记录

@apollo/usage-reporting-protobuf 共发布 9 个版本,首次发布于 2022/07/14;过去 12 个月发布了 1 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.1.2latest2026/05/056 个月前
4.1.12023/06/273 年前
4.1.02023/03/033 年前
4.0.22022/11/103 年前
4.0.12022/10/294 年前
4.0.02022/10/114 年前

其他发布通道:alpha → 4.0.0-alpha.0,rc → 4.0.0-rc.2。

关于 @apollo/usage-reporting-protobuf 的常见问题

@apollo/usage-reporting-protobuf 是什么?

Protobuf format for Apollo usage reporting

如何安装 @apollo/usage-reporting-protobuf?

在项目目录运行 npm install @apollo/usage-reporting-protobuf,或使用 pnpm add / yarn add / bun add。

@apollo/usage-reporting-protobuf 支持 TypeScript 吗?

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

@apollo/usage-reporting-protobuf 支持 ESM 还是 CommonJS?

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

@apollo/usage-reporting-protobuf 可以商用吗?

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

@apollo/usage-reporting-protobuf 的下载量有多少?

根据 npm 官方下载统计,@apollo/usage-reporting-protobuf 在 2026/10/07 – 2026/11/05 这 30 天内被下载 13,789,889 次,日均约 459,663 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@apollo/usage-reporting-protobuf 还在维护吗?

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