Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/omar-dulaimi/graphql-shield-generator
Emits a GraphQL Shield from your GraphQL schema
https://github.com/omar-dulaimi/graphql-shield-generator
Last synced: 3 months ago
JSON representation
Emits a GraphQL Shield from your GraphQL schema
- Host: GitHub
- URL: https://github.com/omar-dulaimi/graphql-shield-generator
- Owner: omar-dulaimi
- License: mit
- Created: 2022-12-30T19:11:19.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-27T12:17:36.000Z (9 months ago)
- Last Synced: 2024-11-04T10:51:52.202Z (4 months ago)
- Language: TypeScript
- Size: 36.1 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-graphql - graphql-shield-generator - Emits a GraphQL Shield from your GraphQL schema. (Implementations / JavaScript/TypeScript)
README
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
Table of Contents
## Overview
Automatically generate a GraphQL Shield from your GraphQL Schema(or type definitions and resolvers).
## Installation
#### Using npm
```sh
npm install graphql-shield-generator
```#### Using yarn
```sh
yarn add graphql-shield-generator
```## Usage
- Don't forget to star this repo ๐
```ts
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`
| Property | Required | Default | Description |
| ------------ | -------- | ----------------- | --------------------------------------- |
| outputDir | false | current directory | Directory that shield will be placed in |
| fileName | false | 'shield' | File name of the generated shield |
| extension | false | 'js' | File extension of the generated shield |
| moduleSystem | false | '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!
[contributors-shield]: https://img.shields.io/github/contributors/omar-dulaimi/graphql-shield-generator.svg?style=for-the-badge
[contributors-url]: https://github.com/omar-dulaimi/graphql-shield-generator/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/omar-dulaimi/graphql-shield-generator.svg?style=for-the-badge
[forks-url]: https://github.com/omar-dulaimi/graphql-shield-generator/network/members
[stars-shield]: https://img.shields.io/github/stars/omar-dulaimi/graphql-shield-generator.svg?style=for-the-badge
[stars-url]: https://github.com/omar-dulaimi/graphql-shield-generator/stargazers
[issues-shield]: https://img.shields.io/github/issues/omar-dulaimi/graphql-shield-generator.svg?style=for-the-badge
[issues-url]: https://github.com/omar-dulaimi/graphql-shield-generator/issues
[license-shield]: https://img.shields.io/github/license/omar-dulaimi/graphql-shield-generator?style=for-the-badge
[license-url]: https://github.com/omar-dulaimi/graphql-shield-generator/blob/master/LICENSE