@@ -9,8 +9,8 @@ import type { DirectiveDefinitionNode } from '../language/ast';
99import { DirectiveLocation } from '../language/directiveLocation' ;
1010
1111import type {
12- GraphQLArgument ,
13- GraphQLFieldConfigArgumentMap ,
12+ GraphQLArgument , GraphQLEnumValue , GraphQLField ,
13+ GraphQLFieldConfigArgumentMap , GraphQLInputField , GraphQLType ,
1414} from './definition' ;
1515import { assertName } from './assertName' ;
1616import { GraphQLString , GraphQLBoolean } from './scalars' ;
@@ -109,6 +109,8 @@ export class GraphQLDirective {
109109 }
110110}
111111
112+ type DirectiveExposeArgs = ( definition : GraphQLType | GraphQLField < unknown , unknown > | GraphQLEnumValue | GraphQLInputField | GraphQLArgument ) => Record < string , string >
113+
112114export interface GraphQLDirectiveConfig {
113115 name : string ;
114116 description ?: Maybe < string > ;
@@ -117,6 +119,7 @@ export interface GraphQLDirectiveConfig {
117119 isRepeatable ?: Maybe < boolean > ;
118120 extensions ?: Maybe < Readonly < GraphQLDirectiveExtensions > > ;
119121 astNode ?: Maybe < DirectiveDefinitionNode > ;
122+ exposeArgs ?: Maybe < DirectiveExposeArgs >
120123}
121124
122125interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {
@@ -191,6 +194,15 @@ export const GraphQLDeprecatedDirective: GraphQLDirective =
191194 defaultValue : DEFAULT_DEPRECATION_REASON ,
192195 } ,
193196 } ,
197+ exposeArgs : ( definition : GraphQLField < unknown , unknown > | GraphQLInputField | GraphQLEnumValue ) => {
198+ if ( definition . deprecationReason != null ) {
199+ return [
200+ definition . deprecationReason === DEFAULT_DEPRECATION_REASON
201+ ? { }
202+ : { reason : definition . deprecationReason } ,
203+ ] ;
204+ }
205+ }
194206 } ) ;
195207
196208/**
0 commit comments