diff --git a/.changeset/six-planets-build.md b/.changeset/six-planets-build.md new file mode 100644 index 0000000000000..9a22370ce910d --- /dev/null +++ b/.changeset/six-planets-build.md @@ -0,0 +1,6 @@ +--- +'@envelop/sentry': patch +--- + +Revert the addition of a typed context since it is a breaking change. This will be re-added in a +major release. diff --git a/packages/plugins/sentry/src/index.ts b/packages/plugins/sentry/src/index.ts index 804b66092acc5..66512b5131def 100644 --- a/packages/plugins/sentry/src/index.ts +++ b/packages/plugins/sentry/src/index.ts @@ -1,16 +1,15 @@ -import { GraphQLError, Kind, OperationDefinitionNode, print } from 'graphql'; +import { ExecutionArgs, GraphQLError, Kind, OperationDefinitionNode, print } from 'graphql'; import { getDocumentString, handleStreamOrSingleExecutionResult, isOriginalGraphQLError, OnExecuteDoneHookResultOnNextHook, - TypedExecutionArgs, type Plugin, } from '@envelop/core'; import * as Sentry from '@sentry/node'; import type { Span, TraceparentData } from '@sentry/types'; -export type SentryPluginOptions> = { +export type SentryPluginOptions = { /** * Starts a new transaction for every GraphQL Operation. * When disabled, an already existing Transaction will be used. @@ -46,34 +45,34 @@ export type SentryPluginOptions> = { /** * Adds custom tags to every Transaction. */ - appendTags?: (args: TypedExecutionArgs) => Record; + appendTags?: (args: ExecutionArgs) => Record; /** * Callback to set context information onto the scope. */ - configureScope?: (args: TypedExecutionArgs, scope: Sentry.Scope) => void; + configureScope?: (args: ExecutionArgs, scope: Sentry.Scope) => void; /** * Produces a name of Transaction (only when "renameTransaction" or "startTransaction" are enabled) and description of created Span. * * @default operation's name or "Anonymous Operation" when missing) */ - transactionName?: (args: TypedExecutionArgs) => string; + transactionName?: (args: ExecutionArgs) => string; /** * Produces tracing data for Transaction * * @default is empty */ - traceparentData?: (args: TypedExecutionArgs) => TraceparentData | undefined; + traceparentData?: (args: ExecutionArgs) => TraceparentData | undefined; /** * Produces a "op" (operation) of created Span. * * @default execute */ - operationName?: (args: TypedExecutionArgs) => string; + operationName?: (args: ExecutionArgs) => string; /** * Indicates whether or not to skip the entire Sentry flow for given GraphQL operation. * By default, no operations are skipped. */ - skip?: (args: TypedExecutionArgs) => boolean; + skip?: (args: ExecutionArgs) => boolean; /** * Indicates whether or not to skip Sentry exception reporting for a given error. * By default, this plugin skips all `GraphQLError` errors and does not report it to Sentry. @@ -83,12 +82,10 @@ export type SentryPluginOptions> = { export const defaultSkipError = isOriginalGraphQLError; -export const useSentry = = {}>( - options: SentryPluginOptions = {}, -): Plugin => { - function pick>( +export const useSentry = (options: SentryPluginOptions = {}): Plugin => { + function pick( key: K, - defaultValue: NonNullable[K]>, + defaultValue: NonNullable, ) { return options[key] ?? defaultValue; }