Skip to content

chore(deps): update dependency @datocms/cda-client to v0.3.0 - #277

Merged
Walkeezy merged 1 commit into
mainfrom
renovate/datocms-cda-client-0.x
Aug 19, 2026
Merged

chore(deps): update dependency @datocms/cda-client to v0.3.0#277
Walkeezy merged 1 commit into
mainfrom
renovate/datocms-cda-client-0.x

Conversation

@renovate

@renovate renovate Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
@datocms/cda-client ^0.2.10^0.2.10 || ^0.3.0 age confidence
@datocms/cda-client 0.2.100.3.0 age confidence

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

datocms/cda-client (@​datocms/cda-client)

v0.3.0: — instanceof ApiError now works

Compare Source

instanceof ApiError now works

Until this release, error instanceof ApiError was always false — even with a single copy of the module loaded and no bundler involved:

e.name                   : ApiError
e.constructor.name       : Error
Object.getPrototypeOf(e) : Error.prototype  ← not ApiError.prototype
e instanceof ApiError    : false
e.response.status        : 422              (payload was intact)

This failed silently: the guard compiled, type-narrowed, and simply never matched — so error handlers fell through to a generic 500 while looking perfectly correct.

Nothing to change on your side. Plain instanceof now works, including across duplicated copies of the package. If you worked around this with a name-based check, you can delete it:

- if (e instanceof Error && e.name === 'ApiError') {
+ if (e instanceof ApiError) {
What was wrong

1. ES5 downlevel. Both tsconfigs set "target": "es5", so class ApiError extends Error was emitted as _this = _super.call(this, message) || this; … return _this. Error.call(this) ignores this and returns a fresh Error — and that object, being truthy, became the instance. Its prototype was therefore Error.prototype, never ApiError.prototype.

The build target is now es2017. The package is built on the browser Fetch API, so no real ES5 runtime could ever have executed it — the ES5 target was only costing correctness.

2. Duplicate module copies. The package ships parallel CJS and ESM builds, so a bundler can load two distinct copies and therefore two distinct ApiError classes. A prototype check then fails for an error thrown by the other copy — and no packaging metadata fully prevents this, since a bundler may inline one copy while another stays external.

ApiError instances are now branded with Symbol.for('@datocms/cda-client:ApiError'), and the class implements static [Symbol.hasInstance], making instanceof structural rather than identity-based. The global symbol registry is shared across copies and realms, so the check holds wherever the error came from. Subclasses still fall back to a real prototype-chain check, so they stay exact.

Packaging

The package now declares an exports map, and relative imports carry .js extensions so the ESM build is actually loadable. Previously dist/esm used extensionless specifiers and had no "type": "module" marker, so importing it from Node failed with ERR_MODULE_NOT_FOUND — it was bundler-only.

Upgrade notes

Released as a minor rather than a patch, for two reasons:

  • Emitted syntax is now ES2017 instead of ES5. If you were feeding this package through a build that assumed ES5 output, it will now see modern syntax. (The package already required fetch, Response and promises, so this changes the syntax floor, not the practical runtime requirement.)
  • Resolution now goes through exports. The map deliberately keeps ./dist/*, ./src/* and ./package.json reachable, so existing deep imports keep working — but exports targets don't get Node's extension guessing, so a deep import must now spell out the extension: @datocms/cda-client/dist/cjs/ApiError.js, not …/ApiError.

Full Changelog: datocms/cda-client@v0.2.11...v0.3.0


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@Walkeezy
Walkeezy merged commit 1a9a1e6 into main Aug 19, 2026
2 checks passed
@Walkeezy
Walkeezy deleted the renovate/datocms-cda-client-0.x branch August 19, 2026 07:28
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant