npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

easygraphql-parser-gamechanger

v1.1.0

Published

Parse GraphQL Schema adapted to GameChanger

Downloads

4

Readme

graphql-parser-gamechanger

json parser form grapqhl schema based on easygrapqhl-parser

Installation

$ 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

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 :

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:

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

{
  "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.