0.0.2 โ€ข Published 1 year ago

graphql-shield-generator v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Contributors Forks Stargazers Issues MIT License

Overview

Automatically generate a GraphQL Shield from your GraphQL Schema(or type definitions and resolvers).

Installation

Using npm

npm install graphql-shield-generator

Using yarn

yarn add graphql-shield-generator

Usage

  • Don't forget to star this repo ๐Ÿ˜‰
import { generateGraphqlShield } from 'graphql-shield-generator';

await generateGraphqlShield({
  schema,
  options: {
    outputDir: './permissions',
    fileName: 'shield',
    extension: 'js',
    moduleSystem: "CommonJS"
  },
});

// or

await generateGraphqlShield({
  schema: { typeDefs, resolvers },
  options: {
    outputDir: './permissions',
    fileName: 'shield',
    extension: 'ts',
    moduleSystem: "ES modules"
  },
});

Documentation

generateGraphqlShield(schema | { typeDefs, resolvers }, options)

Generates a GraphQL Shield.

options

PropertyRequiredDefaultDescription
outputDirfalsecurrent directoryDirectory that shield will be placed in
fileNamefalse'shield'File name of the generated shield
extensionfalse'js'File extension of the generated shield
moduleSystemfalse'CommonJS'Module system of the generated shield

Contributing

We are always looking for people to help us grow graphql-shield-generator! If you have an issue, feature request, or pull request, let us know!