- 后端
【免费下载链接】google-api-nodejs-client
Google's officially supported Node.js client library for accessing Google APIs. Support for authorization and authentication with OAuth 2.0, API Keys and JWT (Service Tokens) is included.
导读
本篇文章以 src/apis/certificatemanager/CHANGELOG.md 为唯一主线,系统梳理 Google 官方 Node.js API 客户端库中 certificatemanager(Certificate Manager API v1)子包的完整版本演进史:从 2023 年 8 月的 1.0.0 到 2026 年 9 月的 16.0.1,共 42 个版本条目。通过逐一解读其中记录的 Features、Bug Fixes 与 ⚠ BREAKING CHANGES,并结合 src/generator/synth.ts、release-please-config.json 与 v1.ts 等仓库源码,你将掌握该子包的版本号策略、Node.js 运行时要求演进、依赖升级路径,以及「run the generator / update the API」这类自动化变更背后的真实含义,从而能准确判断升级影响并安全使用@googleapis/certificatemanager。
一、包定位与维护状态:先弄清这个库「值不值得用」
在解读版本历史之前,先看官方在 src/apis/certificatemanager/README.md 中给出的定位声明:
- 该库处于maintenance mode(维护模式),Google 会继续为存量应用提供支持,但不再作为主推方案;
- 对于新应用或存量应用现代化改造,官方建议改用
@google-cloud/certificate-manager这一云生态专用库; - 子包以 npm 包
@googleapis/certificatemanager形式独立发布,安装命令为npm install @googleapis/certificatemanager; - 许可证为 Apache-2.0。
对应的 src/apis/certificatemanager/package.json 提供了包的技术底座:
{ "name": "@googleapis/certificatemanager", "version": "16.0.1", "main": "build/index.js", "types": "build/index.d.ts", "license": "Apache-2.0", "engines": { "node": ">=22.0.0" }, "dependencies": { "googleapis-common": "^9.0.0" } }值得注意:engines.node已收紧到>=22.0.0,这与 CHANGELOG 中 2026 年 9 月那批 "Update apiary to minimum Node version of 22" 的破坏性变更完全一致(详见第三节)。而googleapis-common依赖当前为^9.0.0,这条依赖线也是 CHANGELOG 中反复出现的 Bug Fixes 主题。
二、版本时间线全景:两份「镜像」序列背后是一次发布模型切换
通读 CHANGELOG.md 会发现一个显著特征:文件中存在两套从 1.0.0 起步的版本序列,旧序列止步于 6.0.1(2025-07-08),新序列则从 1.0.0(2025-08-07)重新计数并一路攀升到 16.0.1(2026-09-23)。从文件结构与包形态可以推断:2025 年 8 月前后,certificatemanager 子包改为以独立 npm 包(@googleapis/certificatemanager)发布,版本号随之重置。这是阅读本 CHANGELOG 时必须先建立的前提,否则很容易把两个 2.0.0、两个 6.0.0 误当成同一版本。
旧序列(2023-08 → 2025-07,作为 monorepo 内子包阶段)
| 版本 | 日期 | 变更类型 | 关键内容 |
|---|---|---|---|
| 1.0.0 | 2023-08-17 | Bug Fixes | 首次发布,同步上游 API 更新 |
| 1.0.1 | 2023-08-17 | Bug Fixes | update the API |
| 1.0.2 | 2023-08-25 | Bug Fixes | deps: googleapis-common 升至 v7 |
| 1.0.3 | 2023-10-11 | Bug Fixes | update the API;googleapis-common v7 |
| 2.0.0 | 2024-03-12 | ⚠ Breaking + Features | run the generator(PR #3434) |
| 3.0.0 | 2024-04-04 | ⚠ Breaking + Features | run the generator(#3434、#3456) |
| 3.0.1 | 2024-05-02 | Bug Fixes | update the API |
| 4.0.0 | 2024-05-02 | ⚠ Breaking + Features | run the generator(#3434、#3456) |
| 4.1.0 / 4.2.0 | 2024-08-16 | Features | update the API |
| 4.2.1 | 2025-02-04 | Bug Fixes | update the API |
| 4.3.0 / 4.4.0 | 2025-03-18 | Features | update the API |
| 4.5.0 | 2025-05-05 | Features | update the API |
| 5.0.0 | 2025-05-29 | ⚠ Breaking | upgrade to node 18 |
| 5.0.1 | 2025-06-04 | Bug Fixes | deps: googleapis-common 8.0.2-rc |
| 6.0.0 | 2025-06-30 | ⚠ Breaking + Features | upgrade to node 18;update the API |
| 6.0.1 | 2025-07-08 | Bug Fixes | update the API |
新序列(2025-08 → 2026-09,独立 npm 子包阶段)
| 版本 | 日期 | 变更类型 | 关键内容 |
|---|---|---|---|
| 1.0.0 | 2025-08-07 | Bug Fixes | update the API;googleapis-common 8.0.0 |
| 1.0.1 | 2025-08-13 | Bug Fixes | update the API;googleapis-common 8.0.0 |
| 1.0.2 | 2025-08-21 | Bug Fixes | update the API;googleapis-common 8.0.0 |
| 2.0.0 | 2025-08-25 | ⚠ Breaking | run the generator(#3751) |
| 3.0.0 | 2025-08-26 | ⚠ Breaking | run the generator(#3751) |
| 4.0.0 | 2025-08-27 | ⚠ Breaking | run the generator(#3751) |
| 5.0.0 | 2025-08-28 | ⚠ Breaking | run the generator(#3751) |
| 6.0.0 | 2025-08-29 | ⚠ Breaking | run the generator(#3751);googleapis-common 8.0.0 |
| 7.0.0 | 2025-09-16 | ⚠ Breaking | run the generator(#3751);googleapis-common 8.0.0 |
| 8.0.0 | 2025-09-30 | ⚠ Breaking | run the generator(#3795) |
| 9.0.0 | 2025-10-09 | ⚠ Breaking | run the generator(#3805) |
| 10.0.0 | 2025-10-15 | ⚠ Breaking | run the generator(#3814) |
| 11.0.0 | 2025-11-11 | ⚠ Breaking | run the generator(#3831) |
| 11.0.1 | 2025-12-05 | Bug Fixes | update the API |
| 11.1.0 | 2025-12-15 | Features | update the API |
| 11.1.1 | 2026-05-19 | Bug Fixes | update the API(两次) |
| 12.0.0 | 2026-08-03 | ⚠ Breaking | run the generator(#3955) |
| 12.1.0 | 2026-09-02 | Features | run the generator(#3992);依赖升至 Node 22 系 |
| 12.1.1 | 2026-09-09 | Bug Fixes | add back support for node 18 |
| 13.0.0 | 2026-09-09 | ⚠ Breaking | Node 22 门槛(#4011);run the generator(#3955) |
| 14.0.0 | 2026-09-10 | ⚠ Breaking | Node 22 门槛(#4011) |
| 15.0.0 | 2026-09-10 | ⚠ Breaking | Node 22 门槛(#4011);run the generator |
| 16.0.0 | 2026-09-14 | ⚠ Breaking | Node 22 门槛「again」(#4020) |
| 16.0.1 | 2026-09-23 | Bug Fixes | update the API |
三、三大变更类型的源码级解读
CHANGELOG 中的每一条都归属于三类之一,理解它们的生成机制,比只看文字更有价值。
3.1 ⚠ BREAKING CHANGES:版本号与运行时门槛的信号灯
CHANGELOG 里的破坏性变更可以归纳为三类来源:
其一,Node.js 最低版本要求的两次整体升级。旧序列中 5.0.0(2025-05-29)与 6.0.0(2025-06-30)两次出现 "upgrade to node 18";新序列中 13.0.0 / 14.0.0 / 15.0.0(2026-09-09/10)连续三次标注 "Update apiary to minimum Node version of 22"(PR #4011),16.0.0(2026-09-14)又出现 "Update apiary to minimum Node version of 22 again"(PR #4020),而 12.1.1(2026-09-09)曾短暂 "add back support for node 18"。这一来一回说明:Node 18 支持先在 12.x 被恢复,随即又被统一移除,最终所有 apiary 生成包将最低 Node 版本锁定在 22。这正是 package.json 中"engines": {"node": ">=22.0.0"}的由来。对使用者的直接后果:Node 18 环境无法再安装最新版,升级到 13.x 及以上前必须确认运行时为 Node ≥ 22。
其二,run the generator(重新运行代码生成器)。生成器会依据 discovery/certificatemanager-v1.json 这份上游 Discovery 文档重新生成 v1.ts 与 index.ts,方法签名、Schema 字段都可能变化,因此一律标记为破坏性变更。新序列中 2.0.0 → 11.0.0 连续十个大版本几乎全部由它驱动,可见上游 API 迭代之频繁。
其三,"This release has breaking changes."** 的通用占位说明,属于 release-please 自动生成的兜底描述,常见于涉及 Schema 增删或方法重命名的批次中。
3.2 Features:update the API与run the generator
update the API:表示同步了上游 Certificate Manager API 的最新定义,通常会带来新资源、新方法或新字段;run the generator:表示触发了 src/generator/synth.ts 中的synth()流程。该流程会比对 Discovery 文档差异,为每个发生变化的 API 子包生成提交,并依createChangelog()(synth.ts 第 178-204 行)生成变更日志正文、依getSemverity()(第 220-242 行)计算语义化版本等级:ADDED → MINOR,CHANGED → PATCH,DELETED → MAJOR,最终由getPrefix()(第 206-214 行)决定提交前缀是feat还是fix。也就是说,CHANGELOG 中「Features / Bug Fixes」分类并不是人工撰写的,而是对 Discovery 文档 diff 的自动化产物。
3.3 Bug Fixes:API 同步与依赖升级
Bug Fixes 主要来自两类提交:
certificatemanager: update the API:携带 Discovery 文档的增量同步(通常是小范围字段调整,语义化为 PATCH);- 依赖升级:
deps系列,如旧序列 1.0.2/1.0.3 将googleapis-common升至 v7,5.0.1/6.0.0 升至 8.0.2-rc,新序列中又统一升级至 8.0.0(PR #3731),当前 package.json 已使用^9.0.0。
googleapis-common是这些生成包共享的底层库(提供createAPIRequest、AuthPlus、getAPI等基础能力,见 index.ts),它的每个大版本升级都会辐射到所有 API 子包,因此在 CHANGELOG 中高频出现。
四、CHANGELOG 背后:这个子包实际暴露了哪些 API 能力
虽然 CHANGELOG 只记录版本事件,但通过 v1.ts 可以确认update the API每次同步的对象——当前 v1 版本共暴露 9 个资源类(v1.ts 第 900-6050 行):
Resource$Projects:顶层入口,挂载locationsResource$Projects$Locations:get/list获取区域信息(v1.ts 第 909-937 行)Resource$Projects$Locations$Certificateissuanceconfigs:证书签发配置的create/delete/get/list/patchResource$Projects$Locations$Certificatemaps:证书映射的create/delete/get/list/patchResource$Projects$Locations$Certificatemaps$Certificatemapentries:映射条目的完整 CRUDResource$Projects$Locations$Certificates:TLS 证书的create/delete/get/list/patch(v1.ts 第 3776 行起)Resource$Projects$Locations$Dnsauthorizations:DNS 授权的 CRUDResource$Projects$Locations$Operations:长时任务(Operation)的delete/get/listResource$Projects$Locations$Trustconfigs:信任配置的create/delete/get/list/patch/update
对应的 Schema 定义(如Schema$Certificate、Schema$ManagedCertificate、Schema$DnsAuthorization、Schema$TrustConfig)也随每次update the API演进。例如Schema$ManagedCertificate(v1.ts 第 662-687 行)包含domains、dnsAuthorizations、issuanceConfig、authorizationAttemptInfo等字段,其中的issuanceConfig字段即对应 2024 年前后新增的 CertificateIssuanceConfig 资源——这类能力正是旧序列 4.x 与 6.0.0 中多次update the API的落地成果。
五、实际使用:结合 CHANGELOG 判断升级,结合源码写出可运行代码
5.1 安装与运行环境前提
npm install @googleapis/certificatemanager根据 package.json 的engines与 CHANGELOG 中的破坏性变更记录,当前版本要求 Node.js ≥ 22;若项目运行在 Node 18 上,需要固定安装 12.1.1 或更早版本。
5.2 最小可用示例(来源于 v1.ts 内置 JSDoc 示例)
v1.ts 中每个方法都内嵌了可直接运行的示例(如第 939-996 行的locations.get、第 6216-6275 行的trustConfigs.delete),统一模式如下:
const {google} = require('googleapis'); const certificatemanager = google.certificatemanager('v1'); async function main() { const auth = new google.auth.GoogleAuth({ // Scopes 可传数组,也可传单个空格分隔的字符串 scopes: ['https://www.googleapis.com/auth/cloud-platform'], }); const authClient = await auth.getClient(); google.options({auth: authClient}); // 获取某个区域的信息 const res = await certificatemanager.projects.locations.get({ name: 'projects/my-project/locations/my-location', }); console.log(res.data); // 删除一个 TrustConfig(携带 etag 做乐观并发控制) const res2 = await certificatemanager.projects.locations.trustConfigs.delete({ etag: 'placeholder-value', name: 'projects/my-project/locations/my-location/trustConfigs/my-trustConfig', }); console.log(res2.data); } main().catch(e => { console.error(e); throw e; });执行前需先在 Google Cloud 控制台启用certificatemanager.googleapis.comAPI,并通过gcloud auth application-default login完成本地凭据配置——这两步同样写在 v1.ts 的示例注释中。方法均支持 Promise(async/await)与 callback 两种调用方式,返回值类型为GaxiosResponseWithHTTP2<T>,可结合 HTTP/2 传输使用。
5.3 升级决策速查
| 当前版本 | 目标版本 | 需关注点 |
|---|---|---|
| ≤ 4.5.0 | 5.0.0 / 6.0.0 | Node 最低版本升到 18,确认运行时 |
| ≤ 6.0.1 | 新序列任意版本 | 版本号已重置,按新序列比对功能差异 |
| ≤ 12.1.1 | ≥ 13.0.0 | Node 最低版本升到 22(#4011/#4020),必须升级运行时 |
| 任意版本 | 最新 16.0.1 | 大版本多为run the generator所致,关注方法签名与 Schema 字段变化 |
六、小结:从 CHANGELOG 读出「生成式客户端库」的生命周期
certificatemanager 子包的 CHANGELOG 是理解 google-api-nodejs-client 这种自动生成、批量发布的客户端库运维模式的绝佳样本:
- 版本号由 release-please 依据提交类型自动推进,破坏性变更触发大版本;
- 几乎所有功能演进都源自对上游 Discovery 文档的重新生成(
run the generator/update the API),而非人工手写代码; - 运行时要求(Node 18 → 22)与公共依赖(googleapis-common 7 → 8 → 9)的升级是跨子包统一进行的,会在所有子包 CHANGELOG 中同步出现;
- 2025 年 8 月后该子包转为独立 npm 发布,版本号从 1.0.0 重新计数,阅读历史时务必区分两个序列。
对于开发者而言,这篇 CHANGELOG 既是升级前的「影响面检查清单」,也是判断包维护活跃度、追溯某个 API 能力引入时间的可靠索引。若在升级中遇到类型错误或接口不匹配,优先对照 v1.ts 中的最新方法签名与 Schema 定义,再结合本 CHANGELOG 定位引入该变化的版本。
- 后端
【免费下载链接】google-api-nodejs-client
Google's officially supported Node.js client library for accessing Google APIs. Support for authorization and authentication with OAuth 2.0, API Keys and JWT (Service Tokens) is included.
相关推荐
google-api-nodejs-client 中 App Hub 客户端库的版本演进深度解读:从 0.1.0 到 13.0.1 的 CHANGELOG 全解析
google api nodejs client 中 App Hub 客户端库的版本演进深度解读:从 0.1.0 到 13.0.1 的 CHANGELOG 全解
后端GLM-OCR 后端服务实战:基于 FastAPI 的异步 OCR 文档处理系统部署与二次开发指南
GLM OCR 后端服务实战:基于 FastAPI 的异步 OCR 文档处理系统部署与二次开发指南 本文围绕 GLM OCR 仓库中 apps/backend/
后端google-api-nodejs-client analytics 子包版本演进全解析:从 CHANGELOG 看 Google Analytics API Node.js 客户端的变化史
google api nodejs client analytics 子包版本演进全解析:从 CHANGELOG 看 Google Analytics API
后端
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考