Skip to content

fix(deps): support graphql 16 and 17#503

Merged
mfeltscher merged 10 commits into
mainfrom
feat/graphql-16-17-compat
Jul 6, 2026
Merged

fix(deps): support graphql 16 and 17#503
mfeltscher merged 10 commits into
mainfrom
feat/graphql-16-17-compat

Conversation

@smartive-nicolai

Copy link
Copy Markdown
Contributor

Makes the library support both graphql 16 and 17 (the goal of #496 — renovate's bare bump to ^17.0.0 — but implemented so the supported range is ^16.12.0 || ^17.0.0 rather than v17-only).

Changes

  • package.json — widen the graphql range to ^16.12.0 || ^17.0.0 in both dependencies and a new peerDependencies entry (it's a library, so it declares the peer contract while keeping the dep for its own build/test).
  • src/errors.ts — the positional GraphQLError constructor was removed in v17; switched to the object form super(message, { extensions }), typed via GraphQLErrorOptions['extensions']. Valid on v16 (≥16.0) and v17.
  • src/resolvers/utils.ts + src/resolvers/arguments.tsinfo.variableValues changed shape: v16 exposes a plain { [name]: value } record, v17 wraps it as { sources, coerced } (runtime values under .coerced). Added a getVariableValues(info) accessor that reads either shape. Plus a never-narrowing cast in a getTypeName switch default.

All fixes use the v16 ∩ v17 API intersection — no version-pinned behavior.

Verification

Lint + build + full jest suite (api tests against a real Postgres), run against each version:

graphql build lint tests
16.14.2 96/96 + 19 snapshots ✅
17.0.1 96/96 + 19 snapshots ✅

⚠️ Blocked by

The @graphql-codegen/* packages (runtime deps here, used by the gqm CLI) still cap their graphql peer at ^16.0.0 — even the latest @graphql-codegen/cli@7.1.3 / typescript-resolvers@6.0.2. So installing graphql-magic alongside graphql 17 currently triggers an ERESOLVE peer conflict unless --legacy-peer-deps (or an overrides) is used. graphql-magic's own code is fully v17-clean; the only friction is the codegen toolchain's conservative peer range, which the blocker PR above resolves upstream. Once codegen ships graphql-17 peer support, the codegen deps here can be bumped and the install works cleanly without --legacy-peer-deps.

Supersedes #496.

🤖 Generated with Claude Code

@smartive-nicolai smartive-nicolai Bot force-pushed the feat/graphql-16-17-compat branch from 1e5448b to c45c618 Compare June 30, 2026 09:49
nicola-smartive and others added 7 commits July 6, 2026 20:24
Widen the graphql range to ^16.12.0 || ^17.0.0 (dependency + new
peerDependency) and adjust the code to the v16-and-v17 API intersection:

- errors.ts: use the object-form GraphQLError constructor (the positional
  form was removed in v17).
- resolvers: read info.variableValues via a getVariableValues() helper that
  handles both v16's plain record and v17's { sources, coerced } shape.

Verified: build + lint + full jest suite green against both graphql@16.14.2
and graphql@17.0.1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mfeltscher mfeltscher force-pushed the feat/graphql-16-17-compat branch from 0befced to 0379c83 Compare July 6, 2026 18:29
nicola-smartive and others added 3 commits July 6, 2026 18:54
The 'upgrade packages' commit regenerated the lockfile, which pulled:
- @typescript-eslint 8.63 — now flags the pre-existing union
  `Knex.RawBinding | Knex.ValueDict` in permissions/check.ts as
  no-redundant-type-constituents (RawBinding already subsumes it / collapses
  to any). Neither caller passes a ValueDict, so narrow the param to
  Knex.RawBinding.
- @types/node 25.9.4 (was 25.3.3) — no longer auto-included into the build
  tsconfig's global scope, so tsc fails with TS2591 (Cannot find name
  'process'/'http'/'crypto'). Add "types": ["node"] to tsconfig.json as TS
  itself recommends; version-independent and the build only needs node globals.

Both issues fail 'npm run test' on every matrix cell (lint runs first, so the
graphql-16/pg14 cell that finished first is what CI reported; fail-fast
cancelled the rest). Verified green under graphql 16 and 17.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mfeltscher mfeltscher merged commit 01b9e80 into main Jul 6, 2026
22 checks passed
@mfeltscher mfeltscher deleted the feat/graphql-16-17-compat branch July 6, 2026 19:20
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 28.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.

2 participants