π GraphQL Shield Generator v1.0.0
This is a major stable release with powerful new features and improvements!
β¨ New Features
π Custom Authentication Rules
- Replace default
allowwith your custom authentication rules - Smart imports - only imports what's actually used
customruleandcustomrulepathoptions
π‘οΈ Security-First Fallback Rules
fallbackRule: 'deny'- Adds'*': denyfor secure by defaultfallbackRule: 'allow'- Adds'*': allowfor permissive approachfallbackRule: false- Clean output with no fallback rules
π Smart Type Ordering
groupbyobjects: true- Orders types by priority (Query β Mutation β Subscription β Others)- Much more logical than the previous broken implementation
βοΈ Shield Constructor Options
shieldoptions- Pass custom options directly to GraphQL Shield- Example:
'{ allowExternalErrors: true }'
π§ Critical Fixes
- β
Fixed missing
denyimport when using fallback rules - β Fixed import formatting with proper newlines
- β
Replaced broken
groupbyobjectslogic with meaningful type ordering - β Smart conditional imports (only imports what's needed)
π Infrastructure Improvements
- β Updated all dependencies to latest versions
- β Comprehensive example directory with 8+ test scenarios
- β Modern, professional README with real examples
- β GitHub Sponsors integration
- β Perfect TypeScript support
- β Both ES modules and CommonJS support
π Usage Examples
// Security-first approach
await generateGraphqlShield({
schema: { typeDefs, resolvers },
options: {
customrule: 'hasAuth',
customrulepath: './auth/hasAuth',
fallbackRule: 'deny', // Secure by default
groupbyobjects: true, // Organized output
shieldoptions: '{ allowExternalErrors: true }',
},
});π₯ Breaking Changes
groupbyobjectsbehavior changed from broken reverse logic to meaningful type priority ordering- Import behavior is now smarter and conditional
π Links
Installation:
npm install [email protected]β If this release helped you, please consider starring the repo and sponsoring the project!