Created
May 2, 2024 21:18
-
-
Save iamandrewluca/96178edecf0d0ab4c76fffddd67a4b15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cacheControlDirective = new GraphQLDirective({ | |
name: 'cacheControl', | |
locations: [ | |
DirectiveLocation.FIELD_DEFINITION, | |
DirectiveLocation.OBJECT, | |
DirectiveLocation.INTERFACE, | |
DirectiveLocation.UNION, | |
], | |
args: { | |
maxAge: { | |
type: GraphQLInt, | |
description: 'Sets the maximum age for the cache, in seconds.', | |
}, | |
scope: { | |
type: new GraphQLEnumType({ | |
name: 'CacheControlScope', | |
values: { | |
PUBLIC: { value: 'PUBLIC' }, | |
PRIVATE: { value: 'PRIVATE' }, | |
}, | |
}), | |
description: 'Sets the cache scope to public or private.', | |
}, | |
inheritMaxAge: { | |
type: GraphQLInt, | |
description: 'Inherit the max age from a parent field.', | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment