@cdmbase/graphql-shield
v7.6.6
Published
GraphQL Server permissions as another layer of abstraction!
Readme
@cdmbase/graphql-shield
GraphQL Server permissions as another layer of abstraction!
A published fork of graphql-shield maintained at
reboxjs/graphql-shield. It exists to ship fixes that have
landed on upstream master but have not been released to npm - starting with the removal of the
deprecated util.isUndefined call (upstream #1552),
which crashes RuleChain/RuleRace on Node runtimes where that API no longer exists.
The API is identical to upstream; only the package name differs.
Installation
npm install @cdmbase/graphql-shieldUsage
import { shield, rule, and } from '@cdmbase/graphql-shield'
const isAuthenticated = rule()((parent, args, ctx) => ctx.user !== null)
const permissions = shield({
Query: {
me: isAuthenticated,
},
})If you are migrating from upstream, changing the import specifier is the only step:
- import { shield } from 'graphql-shield'
+ import { shield } from '@cdmbase/graphql-shield'Documentation
Upstream documentation applies as-is: the-guild.dev/graphql/shield.
License
MIT @ Matic Zavadlal
