1 | import { DirectiveLocation, GraphQLBoolean, GraphQLDirective, GraphQLInt, GraphQLNonNull, GraphQLString, } from 'graphql';
|
2 |
|
3 |
|
4 |
|
5 | export const GraphQLDeferDirective = new GraphQLDirective({
|
6 | name: 'defer',
|
7 | description: 'Directs the executor to defer this fragment when the `if` argument is true or undefined.',
|
8 | locations: [DirectiveLocation.FRAGMENT_SPREAD, DirectiveLocation.INLINE_FRAGMENT],
|
9 | args: {
|
10 | if: {
|
11 | type: new GraphQLNonNull(GraphQLBoolean),
|
12 | description: 'Deferred when true or undefined.',
|
13 | defaultValue: true,
|
14 | },
|
15 | label: {
|
16 | type: GraphQLString,
|
17 | description: 'Unique name',
|
18 | },
|
19 | },
|
20 | });
|
21 |
|
22 |
|
23 |
|
24 | export const GraphQLStreamDirective = new GraphQLDirective({
|
25 | name: 'stream',
|
26 | description: 'Directs the executor to stream plural fields when the `if` argument is true or undefined.',
|
27 | locations: [DirectiveLocation.FIELD],
|
28 | args: {
|
29 | if: {
|
30 | type: new GraphQLNonNull(GraphQLBoolean),
|
31 | description: 'Stream when true or undefined.',
|
32 | defaultValue: true,
|
33 | },
|
34 | label: {
|
35 | type: GraphQLString,
|
36 | description: 'Unique name',
|
37 | },
|
38 | initialCount: {
|
39 | defaultValue: 0,
|
40 | type: GraphQLInt,
|
41 | description: 'Number of items to return immediately',
|
42 | },
|
43 | },
|
44 | });
|