@@ -9,8 +9,8 @@ import type { DirectiveDefinitionNode } from '../language/ast';
9
9
import { DirectiveLocation } from '../language/directiveLocation' ;
10
10
11
11
import type {
12
- GraphQLArgument ,
13
- GraphQLFieldConfigArgumentMap ,
12
+ GraphQLArgument , GraphQLEnumValue , GraphQLField ,
13
+ GraphQLFieldConfigArgumentMap , GraphQLInputField , GraphQLType ,
14
14
} from './definition' ;
15
15
import { assertName } from './assertName' ;
16
16
import { GraphQLString , GraphQLBoolean } from './scalars' ;
@@ -109,6 +109,8 @@ export class GraphQLDirective {
109
109
}
110
110
}
111
111
112
+ type DirectiveExposeArgs = ( definition : GraphQLType | GraphQLField < unknown , unknown > | GraphQLEnumValue | GraphQLInputField | GraphQLArgument ) => Record < string , string >
113
+
112
114
export interface GraphQLDirectiveConfig {
113
115
name : string ;
114
116
description ?: Maybe < string > ;
@@ -117,6 +119,7 @@ export interface GraphQLDirectiveConfig {
117
119
isRepeatable ?: Maybe < boolean > ;
118
120
extensions ?: Maybe < Readonly < GraphQLDirectiveExtensions > > ;
119
121
astNode ?: Maybe < DirectiveDefinitionNode > ;
122
+ exposeArgs ?: Maybe < DirectiveExposeArgs >
120
123
}
121
124
122
125
interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {
@@ -191,6 +194,15 @@ export const GraphQLDeprecatedDirective: GraphQLDirective =
191
194
defaultValue : DEFAULT_DEPRECATION_REASON ,
192
195
} ,
193
196
} ,
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
+ }
194
206
} ) ;
195
207
196
208
/**
0 commit comments