@oudyworks/graphql

Some tooling for GraphQL

Stats

StarsIssuesVersionUpdatedCreatedSize
@oudyworks/graphql
2.0.63 years ago3 years agoMinified + gzip package size for @oudyworks/graphql in KB

Readme

@oudyworks/graphql

let's consider this type

import {
  GraphQLObjectType,
  GraphQLString,
  GraphQLID
} from '@oudyworks/graphql'

const Type = new GraphQLObjectType({
    name: 'Example',
    fields: {
        id: {
            type: GraphQLID
        },
        name: {
            type: GraphQLString
        }
    }
})

getConfig(Type)

getConfig(Type) will return the fields used of Type, in graphql fields could be an object or a function, getConfig(Type) returns the object eitherwa

import {
  getConfig
} from '@oudyworks/graphql'

let fields = getConfig(Type)
// fields = {
//     id: {
//         type: GraphQLID
//     },
//     name: {
//         type: GraphQLString
//     }
// }

getInputObjectType(Type)

getInputObjectType(Type) will create a GraphQLInputObjectType with the same fields of Type

import {
  getInputObjectType
} from '@oudyworks/graphql'

let inputType = getInputObjectType(Type)
// inputType = new GraphQLInputObjectType({
//     name: 'ExampleInput',
//     fields: {
//         id: {
//             type: GraphQLID
//         },
//         name: {
//             type: GraphQLString
//         }
//     }
// })

getErrorType(Type)

get a type with the same fields of Type for Errors

Scalar

Scalar is a scalar type for grahql, it can be a String, Boolean, Integer, Float, Object or Array

import {
  GraphQLObjectType,
  GraphQLString,
  GraphQLID,
  Scalar
} from '@oudyworks/graphql'

const Type = new GraphQLObjectType({
    name: 'ScalarExample',
    fields: {
        id: {
            type: GraphQLID
        },
        type: {
            type: GraphQLString
        },
        data: {
            type: Scalar
        }
    }
})

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.