Skip to content

Commit 32500bf

Browse files
committed
added GraphQLDeferDirective
1 parent 576682f commit 32500bf

File tree

6 files changed

+30
-0
lines changed

6 files changed

+30
-0
lines changed

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export {
5454
specifiedDirectives,
5555
GraphQLIncludeDirective,
5656
GraphQLSkipDirective,
57+
GraphQLDeferDirective,
5758
GraphQLDeprecatedDirective,
5859
// "Enum" of Type Kinds
5960
TypeKind,

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export {
5555
specifiedDirectives,
5656
GraphQLIncludeDirective,
5757
GraphQLSkipDirective,
58+
GraphQLDeferDirective,
5859
GraphQLDeprecatedDirective,
5960
// "Enum" of Type Kinds
6061
TypeKind,

src/type/directives.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ export const GraphQLIncludeDirective: GraphQLDirective;
5454
*/
5555
export const GraphQLSkipDirective: GraphQLDirective;
5656

57+
/**
58+
* Used to conditionally defer fragments.
59+
*/
60+
export const GraphQLDeferDirective: GraphQLDirective;
61+
5762
/**
5863
* Constant string used for default reason for a deprecation.
5964
*/

src/type/directives.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,26 @@ export const GraphQLSkipDirective = new GraphQLDirective({
167167
},
168168
});
169169

170+
/**
171+
* Used to conditionally defer fragments.
172+
*/
173+
export const GraphQLDeferDirective = new GraphQLDirective({
174+
name: 'defer',
175+
description:
176+
'Directs the executor to defer fragment when the `if` argument is true.',
177+
locations: [DirectiveLocation.FRAGMENT_SPREAD],
178+
args: {
179+
if: {
180+
type: GraphQLBoolean,
181+
description: 'Deferred when true.',
182+
},
183+
label: {
184+
type: GraphQLNonNull(GraphQLString),
185+
description: 'label',
186+
},
187+
},
188+
});
189+
170190
/**
171191
* Constant string used for default reason for a deprecation.
172192
*/
@@ -195,6 +215,7 @@ export const GraphQLDeprecatedDirective = new GraphQLDirective({
195215
export const specifiedDirectives = Object.freeze([
196216
GraphQLIncludeDirective,
197217
GraphQLSkipDirective,
218+
GraphQLDeferDirective,
198219
GraphQLDeprecatedDirective,
199220
]);
200221

src/type/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export {
114114
specifiedDirectives,
115115
GraphQLIncludeDirective,
116116
GraphQLSkipDirective,
117+
GraphQLDeferDirective,
117118
GraphQLDeprecatedDirective,
118119
// Constant Deprecation Reason
119120
DEFAULT_DEPRECATION_REASON,

src/type/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export {
7878
specifiedDirectives,
7979
GraphQLIncludeDirective,
8080
GraphQLSkipDirective,
81+
GraphQLDeferDirective,
8182
GraphQLDeprecatedDirective,
8283
// Constant Deprecation Reason
8384
DEFAULT_DEPRECATION_REASON,

0 commit comments

Comments
 (0)