Skip to content

Instantly share code, notes, and snippets.

@iamandrewluca
Created May 2, 2024 21:18
Show Gist options
  • Save iamandrewluca/96178edecf0d0ab4c76fffddd67a4b15 to your computer and use it in GitHub Desktop.
Save iamandrewluca/96178edecf0d0ab4c76fffddd67a4b15 to your computer and use it in GitHub Desktop.
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