fix(deps): support graphql 16 and 17#503
Open
smartive-nicolai[bot] wants to merge 6 commits into
Open
Conversation
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>
1e5448b to
c45c618
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.0rather than v17-only).Changes
package.json— widen thegraphqlrange to^16.12.0 || ^17.0.0in bothdependenciesand a newpeerDependenciesentry (it's a library, so it declares the peer contract while keeping the dep for its own build/test).src/errors.ts— the positionalGraphQLErrorconstructor was removed in v17; switched to the object formsuper(message, { extensions }), typed viaGraphQLErrorOptions['extensions']. Valid on v16 (≥16.0) and v17.src/resolvers/utils.ts+src/resolvers/arguments.ts—info.variableValueschanged shape: v16 exposes a plain{ [name]: value }record, v17 wraps it as{ sources, coerced }(runtime values under.coerced). Added agetVariableValues(info)accessor that reads either shape. Plus anever-narrowing cast in agetTypeNameswitch 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:
The
@graphql-codegen/*packages (runtime deps here, used by thegqmCLI) still cap theirgraphqlpeer 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 anERESOLVEpeer conflict unless--legacy-peer-deps(or anoverrides) 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