1.0.39 • Published 3 years ago

@crawlo/graphql v1.0.39

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@crawlo/graphql

let's consider this type

import { GraphQLObjectType, GraphQLString, GraphQLID } from "@crawlo/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 "@crawlo/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 "@crawlo/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 "@crawlo/graphql";

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

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

2.0.6

3 years ago