1- import { GraphQLError , Kind , OperationDefinitionNode , print } from 'graphql' ;
1+ import { ExecutionArgs , GraphQLError , Kind , OperationDefinitionNode , print } from 'graphql' ;
22import {
33 getDocumentString ,
44 handleStreamOrSingleExecutionResult ,
55 isOriginalGraphQLError ,
66 OnExecuteDoneHookResultOnNextHook ,
7- TypedExecutionArgs ,
87 type Plugin ,
98} from '@envelop/core' ;
109import * as Sentry from '@sentry/node' ;
1110import type { Span , TraceparentData } from '@sentry/types' ;
1211
13- export type SentryPluginOptions < PluginContext extends Record < string , any > > = {
12+ export type SentryPluginOptions = {
1413 /**
1514 * Starts a new transaction for every GraphQL Operation.
1615 * When disabled, an already existing Transaction will be used.
@@ -46,34 +45,34 @@ export type SentryPluginOptions<PluginContext extends Record<string, any>> = {
4645 /**
4746 * Adds custom tags to every Transaction.
4847 */
49- appendTags ?: ( args : TypedExecutionArgs < PluginContext > ) => Record < string , unknown > ;
48+ appendTags ?: ( args : ExecutionArgs ) => Record < string , unknown > ;
5049 /**
5150 * Callback to set context information onto the scope.
5251 */
53- configureScope ?: ( args : TypedExecutionArgs < PluginContext > , scope : Sentry . Scope ) => void ;
52+ configureScope ?: ( args : ExecutionArgs , scope : Sentry . Scope ) => void ;
5453 /**
5554 * Produces a name of Transaction (only when "renameTransaction" or "startTransaction" are enabled) and description of created Span.
5655 *
5756 * @default operation's name or "Anonymous Operation" when missing)
5857 */
59- transactionName ?: ( args : TypedExecutionArgs < PluginContext > ) => string ;
58+ transactionName ?: ( args : ExecutionArgs ) => string ;
6059 /**
6160 * Produces tracing data for Transaction
6261 *
6362 * @default is empty
6463 */
65- traceparentData ?: ( args : TypedExecutionArgs < PluginContext > ) => TraceparentData | undefined ;
64+ traceparentData ?: ( args : ExecutionArgs ) => TraceparentData | undefined ;
6665 /**
6766 * Produces a "op" (operation) of created Span.
6867 *
6968 * @default execute
7069 */
71- operationName ?: ( args : TypedExecutionArgs < PluginContext > ) => string ;
70+ operationName ?: ( args : ExecutionArgs ) => string ;
7271 /**
7372 * Indicates whether or not to skip the entire Sentry flow for given GraphQL operation.
7473 * By default, no operations are skipped.
7574 */
76- skip ?: ( args : TypedExecutionArgs < PluginContext > ) => boolean ;
75+ skip ?: ( args : ExecutionArgs ) => boolean ;
7776 /**
7877 * Indicates whether or not to skip Sentry exception reporting for a given error.
7978 * By default, this plugin skips all `GraphQLError` errors and does not report it to Sentry.
@@ -83,12 +82,10 @@ export type SentryPluginOptions<PluginContext extends Record<string, any>> = {
8382
8483export const defaultSkipError = isOriginalGraphQLError ;
8584
86- export const useSentry = < PluginContext extends Record < string , any > = { } > (
87- options : SentryPluginOptions < PluginContext > = { } ,
88- ) : Plugin < PluginContext > => {
89- function pick < K extends keyof SentryPluginOptions < PluginContext > > (
85+ export const useSentry = ( options : SentryPluginOptions = { } ) : Plugin => {
86+ function pick < K extends keyof SentryPluginOptions > (
9087 key : K ,
91- defaultValue : NonNullable < SentryPluginOptions < PluginContext > [ K ] > ,
88+ defaultValue : NonNullable < SentryPluginOptions [ K ] > ,
9289 ) {
9390 return options [ key ] ?? defaultValue ;
9491 }
0 commit comments