-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Rauno Viskus <Rauno56@users.noreply.github.com> Co-authored-by: Rauno Viskus <rauno56@gmail.com>
- Loading branch information
1 parent
502caae
commit 5da46ef
Showing
7 changed files
with
99 additions
and
32 deletions.
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