-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support graphql
v16
#998
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
16b5226
fix: make `graphql` a peer dependency
dchambers f6f7ff1
ci: run tests against v16
dchambers feccd28
feat: support `graphql` v16
dchambers c20d7f6
Merge branch 'main' into support-graphql-v16
dchambers 3b16575
Merge branch 'main' into support-graphql-v16
rauno56 dd00556
Remove overlapping version ranges
dchambers 92be5ed
feat: use latest version of `graphql` internally
dchambers 6f88e67
Merge branch 'main' into support-graphql-v16
rauno56 25037e5
Merge branch 'main' into support-graphql-v16
rauno56 73bdebb
fix: remove comma
rauno56 69c10cf
Merge branch 'main' into support-graphql-v16
rauno56 639a77f
test: remove exceptions for node@8 and node@10
rauno56 e148301
Merge branch 'main' into support-graphql-v16
rauno56 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
graphql: | ||
# Taking a sample from the most downloaded versions in the range "14 || 15" | ||
versions: "^15.8.0 || 15.7.2 || 15.6.1 || 15.6.0 || 15.5.3 || 15.5.1 || 15.5.0 || 15.4.0 || 15.3.0 || 14.6.0 || 14.5.8 || 14.5.0 || 14.0.0" | ||
# Taking a sample from the most downloaded versions in the range "14 || 15 || 16" | ||
versions: "16.4.0 || 16.3.0 || 16.2.0 || 16.0.0 || ^15.8.0 || 15.7.2 || 15.6.1 || 15.6.0 || 15.5.3 || 15.5.1 || 15.5.0 || 15.4.0 || 15.3.0 || ^14.7.0 || 14.6.0 || 14.5.8 || 14.0.0" | ||
commands: npm run test |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
52 changes: 52 additions & 0 deletions
52
plugins/node/opentelemetry-instrumentation-graphql/test/graphql-adaptor.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import type { | ||
GraphQLFieldResolver, | ||
GraphQLSchema, | ||
GraphQLTypeResolver, | ||
Source, | ||
} from 'graphql'; | ||
import { graphql as origGraphql, version } from 'graphql'; | ||
import { Maybe } from 'graphql/jsutils/Maybe'; | ||
|
||
const variantGraphql = origGraphql as Function; | ||
|
||
interface GraphQLArgs { | ||
schema: GraphQLSchema; | ||
source: string | Source; | ||
rootValue?: unknown; | ||
contextValue?: unknown; | ||
variableValues?: Maybe<{ | ||
readonly [variable: string]: unknown; | ||
}>; | ||
operationName?: Maybe<string>; | ||
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>; | ||
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>; | ||
} | ||
|
||
export const graphql = (args: GraphQLArgs) => | ||
!version || version.startsWith('14.') || version.startsWith('15.') | ||
? variantGraphql( | ||
args.schema, | ||
args.source, | ||
args.rootValue, | ||
args.contextValue, | ||
args.variableValues, | ||
args.operationName, | ||
args.fieldResolver, | ||
args.typeResolver | ||
) | ||
: variantGraphql(args); |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
graphql
v16 flips around these two parameters 🤯 . This has no effect at runtime when using v15 Vs v16 because they both pass whatever they receive through, but needs to be changed in the case we want to compile against v16.