From 23a259a4207d0a075caffbbf5d7225350fb1a72f Mon Sep 17 00:00:00 2001 From: Sumanth Chinthagunta Date: Sat, 6 Jul 2024 23:50:22 -0700 Subject: [PATCH] feat: adding spectacular/role-houdini plugin --- packages/role-houdini/src/index.js | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 packages/role-houdini/src/index.js diff --git a/packages/role-houdini/src/index.js b/packages/role-houdini/src/index.js deleted file mode 100644 index 655e29f8..00000000 --- a/packages/role-houdini/src/index.js +++ /dev/null @@ -1,29 +0,0 @@ -import { ArtifactKind, plugin } from 'houdini'; -export default plugin('role-houdini', async () => { - return { - // add the @role directive - schema() { - return ` - directive @role( - name: [String!] - ) on QUERY - `; - }, - /** - * We want to perform special logic for the the @role directive so we're going to persist - * data in the artifact if we detect it - */ - artifactData({ document }) { - // only consider queries - if (document.kind !== ArtifactKind.Query) { - return; - } - // look at the original document the user passed (only one definition) - const queryDefinition = document.originalParsed.definitions[0]; - // consider the artifact `role` if the query contains the `role` directive - const role = queryDefinition?.directives?.find((directive) => directive.name.value === 'role'); - const value = role?.arguments?.[0].value?.value; - return { role: value }; - }, - }; -});