# easygraphql-parser-gamechanger

> Parse GraphQL Schema adapted to GameChanger

Latest version **1.1.0** (published 2022-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install easygraphql-parser-gamechanger
pnpm add easygraphql-parser-gamechanger
yarn add easygraphql-parser-gamechanger
bun add easygraphql-parser-gamechanger
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-12-19 |
| First published | 2021-06-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 160.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | GameChanger |
| Maintainers | bpinel, aguard, isaoud, bfournet, nathandoyen, cfaboumyippon |
| Keywords | nodejs, graphql, parser, schema |

## Links

- npm: https://www.npmjs.com/package/easygraphql-parser-gamechanger
- Repository: https://github.com/GameChangerCloud/easygraphql-parser-gamechanger
- Issues: https://github.com/EasyGraphQL/easygraphql-parser/issues
- npm.io page: https://npm.io/package/easygraphql-parser-gamechanger

## Dependencies (10)

- [fs](https://npm.io/package/fs.md) 0.0.1-security
- [tscp](https://npm.io/package/tscp.md) ^1.0.0
- [chance](https://npm.io/package/chance.md) ^1.1.8
- [graphql](https://npm.io/package/graphql.md) ^15.8.0
- [describe](https://npm.io/package/describe.md) ^1.2.0
- [pluralize](https://npm.io/package/pluralize.md) ^8.0.0
- [typescript](https://npm.io/package/typescript.md) ^4.5.4
- [typescript-cp](https://npm.io/package/typescript-cp.md) ^0.1.5
- [easygraphql-parser](https://npm.io/package/easygraphql-parser.md) ^0.0.15
- [@graphql-tools/merge](https://npm.io/package/@graphql-tools/merge.md) ^8.3.14

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2022-12-19
- 1.0.6 — 2022-11-28
- 1.0.5 — 2022-11-21
- 1.0.4 — 2022-07-07
- 1.0.3 — 2022-04-20
- 1.0.2 — 2022-04-19
- 1.0.1 — 2022-04-15
- 1.0.0 — 2022-04-04
- 0.0.17 — 2021-09-29
- 0.0.16 — 2021-09-29
- 0.0.15 — 2021-06-02

## README

# graphql-parser-gamechanger
json parser form grapqhl schema based on easygrapqhl-parser

## Installation

```bash
$ npm install easygraphql-parser
```

## Specification
This parser is based on easygraphql-parser From EasyGraphql. It extends its use to manage both field directives and type directives

```gql
actors: [Actor] @hasInverse(field: movies)
```
the parser can now handle more than the 3 native graphql directives ( @include, @skip and @deprecated). it now includes detailed info about custom directives
and their arguments :
- directive name : hasInverse
- directive arguments : field 
        
       - value : movies


## Get Started

this will be our schema in a folder named _graphql-examples_ and file named _movies.graphql_ :

```gql
type Movie {
  id: ID!
  title: String @search
  actors: [Actor] @hasInverse(field: movies)
  studio: Studio!
}

type Actor {
  id: ID!
  name: String
  movies: [Movie]
}

type Studio {
  id: ID!
  name: String!
}
```
You can generate the json schema which represents the above graphql schema by following the next steps:

```js
const fs = require('fs')
const path = require('path')
const easygraphqlSchemaParser = require('easygraphql-parser-gamechanger')

const schemaCode = fs.readFileSync(path.join(__dirname, './graphql-examples', 'movies.graphql'), 'utf8')


schemaJSON = easygraphqlSchemaParser(schema)

```

the output schema has this form

```js
{
  "Movie": {
    "type": "ObjectTypeDefinition",
    "fields": [
      {
        "name": "id",
        "arguments": [],
        "isDeprecated": false,
        "directives": [],
        "noNull": true,
        "isArray": false,
        "noNullArrayValues": false,
        "type": "ID"
      },
      {
        "name": "title",
        "arguments": [],
        "isDeprecated": false,
        "directives": [
          {
            "name": "search",
            "args": []
          }
        ],
        "noNull": false,
        "isArray": false,
        "noNullArrayValues": false,
        "type": "String"
      },
      {
        "name": "actors",
        "arguments": [],
        "isDeprecated": false,
        "directives": [
          {
            "name": "hasInverse",
            "args": [
              {
                "name": "field",
                "value": "movies"
              }
            ]
          }
        ],
        "noNull": false,
        "isArray": true,
        "noNullArrayValues": false,
        "type": "Actor"
      },
      {
        "name": "studio",
        "arguments": [],
        "isDeprecated": false,
        "directives": [],
        "noNull": true,
        "isArray": false,
        "noNullArrayValues": false,
        "type": "Studio"
      }
    ],
    "values": [],
    "types": [],
    "implementedTypes": [],
    "directives": []
  },
  "Actor": {
    "type": "ObjectTypeDefinition",
    "fields": [
      {
        "name": "id",
        "arguments": [],
        "isDeprecated": false,
        "directives": [],
        "noNull": true,
        "isArray": false,
        "noNullArrayValues": false,
        "type": "ID"
      },
      {
        "name": "name",
        "arguments": [],
        "isDeprecated": false,
        "directives": [],
        "noNull": false,
        "isArray": false,
        "noNullArrayValues": false,
        "type": "String"
      },
      {
        "name": "movies",
        "arguments": [],
        "isDeprecated": false,
        "directives": [],
        "noNull": false,
        "isArray": true,
        "noNullArrayValues": false,
        "type": "Movie"
      }
    ],
    "values": [],
    "types": [],
    "implementedTypes": [],
    "directives": []
  },
  "Studio": {
    "type": "ObjectTypeDefinition",
    "fields": [
      {
        "name": "id",
        "arguments": [],
        "isDeprecated": false,
        "directives": [],
        "noNull": true,
        "isArray": false,
        "noNullArrayValues": false,
        "type": "ID"
      },
      {
        "name": "name",
        "arguments": [],
        "isDeprecated": false,
        "directives": [],
        "noNull": true,
        "isArray": false,
        "noNullArrayValues": false,
        "type": "String"
      }
    ],
    "values": [],
    "types": [],
    "implementedTypes": [],
    "directives": []
  }
}
```

we get a json object representing the graphql schema of movies. now we can easily acces to fields (names, directives, non null constraint, etc...)

# Tester vos modifications 
###### tags: `GameChanger`

Pour tester la migration faites des fonctions/constantes/classes utilitaires concernant le gestion du type des schemas etc.

## Easygraphql-parser-gamechanger

Cloner le repo github
```
https://github.com/GameChangerCloud/easygraphql-parser-gamechanger.git
```
Une fois le repo cloné. Ne pas oublier oublier d'installer les dépendances :
```
npm i
```

Une fois cela fait la prochaine étape consiste à link cette version du parser à vos `node_modules` en utilisant :
```
npm link
```

## Générateur AWS

Cloner le repo github
```
https://github.com/GameChangerCloud/generator-aws-server-gamechanger.git
```
Une fois le repo cloné. Ne pas oublier oublier d'installer les dépendances :
```
npm i
```

Une fois cela fait la prochaine étape consiste à link cette version du générateur à vos `node_modules` en utilisant :
```
npm link
```
Il vous faudra ensuite vous link à la version d'`easygraphql-parser-gamechanger`, que vous avez link juste avant, en utilisant :
```
npm link "easygraphql-parser-gamechanger"
```

## Générateur React

Cloner le repo github
```
https://github.com/GameChangerCloud/generator-react-client-gamechanger.git
```
Une fois le repo cloné. Ne pas oublier oublier d'installer les dépendances :
```
npm i
```

Une fois cela fait la prochaine étape consiste à link cette version du générateur à vos `node_modules` en utilisant :
```
npm link
```
Il vous faudra ensuite vous link à la version d'`easygraphql-parser-gamechanger`, que vous avez link juste avant, en utilisant :
```
npm link "easygraphql-parser-gamechanger"
```

## Vous êtes prêt

Une fois ces étapes réalisées, vous êtes prêt à tester en lançant une génération. Cette dernière va alors utiliser les modules que vous avez link.

---
_Source: https://npm.io/package/easygraphql-parser-gamechanger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
