← All provider guides

cloudflare-typescript v6 to v7 migration: the breaking renames and what a codemod can safely do

cloudflare sdk migration 54 tracked change records

The cloudflare-typescript v7.0.0 release is a wide but mechanical breaking release. Method names change casing, response types are renamed, deep import paths move, a file helper disappears, and the calling convention for nested resources changes shape. None of it is conceptually hard. All of it touches many call sites at once, which is exactly the profile of a migration that should be done by a codemod and reviewed as one diff, not typed by hand across a weekend.

The deterministic renames

This list is read directly from the mendapi migration pack registry (cloudflare-typescript-v7-deterministic-renames) at page build time, so it matches what the codemod actually does:

  • Rename Id-suffixed SDK methods to their v7 ID-cased names (whitelisted map, syntax-aware)
  • Rename removed DEXTest* response types to their SchemaHTTP/SchemaHTTPS successors
  • Move the APIClient base-class import from cloudflare/core to BaseCloudflare from cloudflare/client
  • Rewrite removed cloudflare/src/* import paths to cloudflare/*
  • Replace the removed fileFromPath helper with fs.createReadStream

The method renames are the bulk of the surface: v7 fixed the SDK's ID casing, so getById-style names became getByID-style names across whole resource families. Each rename is applied from a whitelisted map and only at call position: the same word inside a string literal, a comment, or a log line is left exactly where it is. The fileFromPath removal is the one that fails at require time: the helper is gone in v7, and the pack replaces it with the fs.createReadStream equivalent the changelog prescribes.

The calling-convention change

The second pack (cloudflare-typescript-v7-named-path-params) handles the structural half of the release:

  • Move intermediate positional path parameters into the options object (last path parameter stays positional)

In v6, nested resources took every path segment positionally: client.zones.records.get(zoneId, recordId). In v7, only the last path parameter stays positional and every intermediate one moves into the options object, as client.zones.records.get(recordId, { zone_id: zoneId }). This is the rewrite that a find-and-replace cannot do, because the correct parameter name depends on which resource you are calling. The pack drives the rewrite from Cloudflare's own migration table (the migration-config.json the SDK repo ships), so the parameter names come from the vendor, not from guesses.

What the codemod refuses to touch

A migration tool earns trust by what it leaves alone. Calls that are not in the whitelisted rename map stay untouched, and a nested call whose receiver cannot be resolved to a known resource path is reported instead of rewritten. Every rule in both packs is locked by golden-fixture regression tests with negative controls (fixture lines that must survive byte-for-byte), so a rule that starts over-firing fails our build before it reaches your repo.

Preview the whole migration as one diff

Both packs run locally as a dry run by default. On the bundled v6 fixture repos, the rename pack rewrites three files across five rules and the path-parameter pack rewrites the nested calls, each writing a unified patch you can read before anything is applied:

npx mendapi scan
# -> which files touch the cloudflare SDK, with line numbers
mendapi fix --migration cloudflare-typescript-v7-deterministic-renames
# -> dry run: changes.patch + fix-report.json, nothing applied
mendapi fix --migration cloudflare-typescript-v7-named-path-params
# -> the calling-convention half, same dry-run discipline
mendapi fix --migration cloudflare-typescript-v7-deterministic-renames --apply
# -> applies the reviewed diff

Nothing leaves your machine at any step; zero network calls is the default and only mode. The report records which rule fired where, and every rewritten file carries a syntax-check verdict, so review is a read of the patch, not an audit of the tool.

The part no codemod fixes

Honest scope: the packs handle the mechanical rewrites. They do not decide how your code should adopt v7-only behavior: changed pagination shapes, error-class differences, or code that built resource paths dynamically at runtime. The tracked Cloudflare history counts 13 breaking or deprecation entries, and the platform-behavior ones stay not code-fixable by verdict, because pretending a codemod covers them is how migrations go wrong.

Related

Every entry on this page is generated from the mendapi change database at build time and links its upstream source.