UNPKG

1.66 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.GraphQLStreamDirective = exports.GraphQLDeferDirective = void 0;
4const graphql_1 = require("graphql");
5/**
6 * Used to conditionally defer fragments.
7 */
8exports.GraphQLDeferDirective = new graphql_1.GraphQLDirective({
9 name: 'defer',
10 description: 'Directs the executor to defer this fragment when the `if` argument is true or undefined.',
11 locations: [graphql_1.DirectiveLocation.FRAGMENT_SPREAD, graphql_1.DirectiveLocation.INLINE_FRAGMENT],
12 args: {
13 if: {
14 type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLBoolean),
15 description: 'Deferred when true or undefined.',
16 defaultValue: true,
17 },
18 label: {
19 type: graphql_1.GraphQLString,
20 description: 'Unique name',
21 },
22 },
23});
24/**
25 * Used to conditionally stream list fields.
26 */
27exports.GraphQLStreamDirective = new graphql_1.GraphQLDirective({
28 name: 'stream',
29 description: 'Directs the executor to stream plural fields when the `if` argument is true or undefined.',
30 locations: [graphql_1.DirectiveLocation.FIELD],
31 args: {
32 if: {
33 type: new graphql_1.GraphQLNonNull(graphql_1.GraphQLBoolean),
34 description: 'Stream when true or undefined.',
35 defaultValue: true,
36 },
37 label: {
38 type: graphql_1.GraphQLString,
39 description: 'Unique name',
40 },
41 initialCount: {
42 defaultValue: 0,
43 type: graphql_1.GraphQLInt,
44 description: 'Number of items to return immediately',
45 },
46 },
47});