graphql-binding

  • Version 2.5.2
  • Published
  • 150 kB
  • 8 dependencies
  • MIT license

Install

npm i graphql-binding
yarn add graphql-binding
pnpm add graphql-binding

Overview

[![CircleCI](https://circleci.com/gh/graphql-binding/graphql-binding.svg?style=shield)](https://circleci.com/gh/graphql-binding/graphql-binding) [![npm version](https://badge.fury.io/js/graphql-binding.svg)](https://badge.fury.io/js/graphql-binding)

Index

Functions

function addFragmentToInfo

addFragmentToInfo: (
info: GraphQLResolveInfo,
fragment: string
) => GraphQLResolveInfo;

    function buildInfo

    buildInfo: (
    rootFieldName: string,
    operation: Operation,
    schema: GraphQLSchema,
    info?: GraphQLResolveInfo | string | DocumentNode
    ) => GraphQLResolveInfo;

      function extractFragmentReplacements

      extractFragmentReplacements: (resolvers: IResolvers) => FragmentReplacement[];

        function forwardTo

        forwardTo: (
        bindingName: string
        ) => <PARENT, ARGS, CONTEXT>(
        parent: PARENT,
        args: ARGS,
        context: CONTEXT,
        info: GraphQLResolveInfo
        ) => any;

          function makeBindingClass

          makeBindingClass: <T>({ schema }: { schema: GraphQLSchema }) => T;

            Classes

            class Binding

            class Binding extends Delegate {}

              constructor

              constructor({
              schema,
              fragmentReplacements,
              before,
              disableCache,
              }: BindingOptions);

                property mutation

                mutation: QueryMap;

                  property query

                  query: QueryMap;

                    property subscription

                    subscription: SubscriptionMap;

                      method buildMethods

                      buildMethods: () => any;

                        method buildQueryMethods

                        buildQueryMethods: (operation: QueryOrMutation) => QueryMap;

                          method buildSubscriptionMethods

                          buildSubscriptionMethods: () => SubscriptionMap;

                            class Delegate

                            class Delegate {}

                              constructor

                              constructor({
                              schema,
                              fragmentReplacements,
                              before,
                              disableCache,
                              }: BindingOptions);

                                property before

                                before: () => void;

                                  property disableCache

                                  disableCache: boolean;

                                    property schema

                                    schema: GraphQLSchema;

                                      method delegate

                                      delegate: (
                                      operation: QueryOrMutation,
                                      fieldName: string,
                                      args: { [key: string]: any },
                                      infoOrQuery?: GraphQLResolveInfo | string,
                                      options?: Options
                                      ) => Promise<any>;

                                        method delegateSubscription

                                        delegateSubscription: (
                                        fieldName: string,
                                        args?: { [key: string]: any },
                                        infoOrQuery?: GraphQLResolveInfo | string,
                                        options?: Options
                                        ) => Promise<AsyncIterator<any>>;

                                          method getAbstractResolvers

                                          getAbstractResolvers: (filterSchema?: GraphQLSchema | string) => IResolvers;

                                            method request

                                            request: <T = any>(
                                            query: string,
                                            variables?: { [key: string]: any }
                                            ) => Promise<T>;

                                              class FlowGenerator

                                              class FlowGenerator extends Generator {}

                                                constructor

                                                constructor({
                                                schema,
                                                inputSchemaPath,
                                                outputBindingPath,
                                                isDefaultExport,
                                                }: {
                                                schema: GraphQLSchema;
                                                inputSchemaPath: string;
                                                outputBindingPath: string;
                                                isDefaultExport: boolean;
                                                });

                                                  property graphqlRenderers

                                                  graphqlRenderers: {
                                                  GraphQLUnionType: (type: GraphQLUnionType) => string;
                                                  GraphQLObjectType: (type: any) => string;
                                                  GraphQLInterfaceType: (type: any) => string;
                                                  GraphQLInputObjectType: (type: any) => string;
                                                  GraphQLScalarType: (type: GraphQLScalarType) => string;
                                                  GraphQLIDType: (type: GraphQLScalarType) => string;
                                                  GraphQLEnumType: (type: GraphQLEnumType) => string;
                                                  };

                                                    property scalarMapping

                                                    scalarMapping: {
                                                    Int: string;
                                                    String: string;
                                                    ID: string;
                                                    Float: string;
                                                    Boolean: string;
                                                    DateTime: string;
                                                    };

                                                      method getPayloadType

                                                      getPayloadType: (operation: string, type: string) => string;

                                                        method getTypeNames

                                                        getTypeNames: () => string[];

                                                          method render

                                                          render: () => string;

                                                            method renderDescription

                                                            renderDescription: (description: Maybe<string>) => string;

                                                              method renderExports

                                                              renderExports: () => string;

                                                                method renderFieldName

                                                                renderFieldName: (field: GraphQLInputField | GraphQLField<any, any>) => string;

                                                                  method renderFieldType

                                                                  renderFieldType: (type: GraphQLInputType | GraphQLOutputType) => string;

                                                                    method renderImports

                                                                    renderImports: () => string;

                                                                      method renderInputFieldType

                                                                      renderInputFieldType: (type: GraphQLInputType | GraphQLOutputType) => any;

                                                                        method renderInterfaceOrObject

                                                                        renderInterfaceOrObject: (
                                                                        type: GraphQLObjectType | GraphQLInputObjectType | GraphQLInterfaceType
                                                                        ) => string;

                                                                          method renderInterfaceWrapper

                                                                          renderInterfaceWrapper: (
                                                                          typeName: string,
                                                                          typeDescription: Maybe<string>,
                                                                          interfaces: GraphQLInterfaceType[],
                                                                          fieldDefinition: string
                                                                          ) => string;

                                                                            method renderMainMethodFields

                                                                            renderMainMethodFields: (
                                                                            operation: string,
                                                                            fields: GraphQLFieldMap<any, any>
                                                                            ) => string;

                                                                              method renderMutations

                                                                              renderMutations: () => string;

                                                                                method renderObjectWrapper

                                                                                renderObjectWrapper: (
                                                                                typeName: string,
                                                                                typeDescription: Maybe<string>,
                                                                                objects: GraphQLObjectType[],
                                                                                fieldDefinition: string
                                                                                ) => string;

                                                                                  method renderQueries

                                                                                  renderQueries: () => string;

                                                                                    method renderSubscriptions

                                                                                    renderSubscriptions: () => string;

                                                                                      method renderTypes

                                                                                      renderTypes: () => string;

                                                                                        method renderTypeWrapper

                                                                                        renderTypeWrapper: (
                                                                                        typeName: string,
                                                                                        typeDescription: Maybe<string>,
                                                                                        fieldDefinition: string
                                                                                        ) => string;

                                                                                          class Generator

                                                                                          class Generator {}

                                                                                            constructor

                                                                                            constructor({
                                                                                            schema,
                                                                                            inputSchemaPath,
                                                                                            outputBindingPath,
                                                                                            isDefaultExport,
                                                                                            }: {
                                                                                            schema: GraphQLSchema;
                                                                                            inputSchemaPath: string;
                                                                                            outputBindingPath: string;
                                                                                            isDefaultExport: boolean;
                                                                                            });

                                                                                              property inputSchemaPath

                                                                                              inputSchemaPath: string;

                                                                                                property isDefaultExport

                                                                                                isDefaultExport: boolean;

                                                                                                  property outputBindingPath

                                                                                                  outputBindingPath: string;

                                                                                                    property schema

                                                                                                    schema: GraphQLSchema;

                                                                                                      method compile

                                                                                                      compile: (
                                                                                                      strings: TemplateStringsArray,
                                                                                                      ...interpolations: Interpolation<Generator>[]
                                                                                                      ) => string;

                                                                                                        method getRelativeSchemaPath

                                                                                                        getRelativeSchemaPath: () => string;

                                                                                                          method render

                                                                                                          render: () => string;

                                                                                                            method renderExports

                                                                                                            renderExports: () => string;

                                                                                                              method renderImports

                                                                                                              renderImports: () => string;

                                                                                                                class TypescriptGenerator

                                                                                                                class TypescriptGenerator extends Generator {}

                                                                                                                  constructor

                                                                                                                  constructor({
                                                                                                                  schema,
                                                                                                                  inputSchemaPath,
                                                                                                                  outputBindingPath,
                                                                                                                  isDefaultExport,
                                                                                                                  }: {
                                                                                                                  schema: GraphQLSchema;
                                                                                                                  inputSchemaPath: string;
                                                                                                                  outputBindingPath: string;
                                                                                                                  isDefaultExport: boolean;
                                                                                                                  });

                                                                                                                    property graphqlRenderers

                                                                                                                    graphqlRenderers: {
                                                                                                                    GraphQLUnionType: (type: GraphQLUnionType) => string;
                                                                                                                    GraphQLObjectType: (type: any) => string;
                                                                                                                    GraphQLInterfaceType: (type: any) => string;
                                                                                                                    GraphQLInputObjectType: (type: any) => string;
                                                                                                                    GraphQLScalarType: (type: GraphQLScalarType) => string;
                                                                                                                    GraphQLIDType: (type: GraphQLScalarType) => string;
                                                                                                                    GraphQLEnumType: (type: GraphQLEnumType) => string;
                                                                                                                    };

                                                                                                                      property scalarMapping

                                                                                                                      scalarMapping: {
                                                                                                                      Int: string;
                                                                                                                      String: string;
                                                                                                                      ID: string;
                                                                                                                      Float: string;
                                                                                                                      Boolean: string;
                                                                                                                      DateTime: string;
                                                                                                                      Json: string;
                                                                                                                      };

                                                                                                                        method getPayloadType

                                                                                                                        getPayloadType: (operation: string, nonNullType: boolean) => string;

                                                                                                                          method getTypeNames

                                                                                                                          getTypeNames: () => string[];

                                                                                                                            method render

                                                                                                                            render: () => string;

                                                                                                                              method renderDescription

                                                                                                                              renderDescription: (description: Maybe<string>) => string;

                                                                                                                                method renderExports

                                                                                                                                renderExports: () => string;

                                                                                                                                  method renderFieldName

                                                                                                                                  renderFieldName: (field: GraphQLInputField | GraphQLField<any, any>) => string;

                                                                                                                                    method renderFieldType

                                                                                                                                    renderFieldType: (type: GraphQLInputType | GraphQLOutputType) => string;

                                                                                                                                      method renderImports

                                                                                                                                      renderImports: () => string;

                                                                                                                                        method renderInputFieldType

                                                                                                                                        renderInputFieldType: (type: GraphQLInputType | GraphQLOutputType) => string;

                                                                                                                                          method renderInterfaceOrObject

                                                                                                                                          renderInterfaceOrObject: (
                                                                                                                                          type: GraphQLObjectType | GraphQLInputObjectType | GraphQLInterfaceType
                                                                                                                                          ) => string;

                                                                                                                                            method renderInterfaceWrapper

                                                                                                                                            renderInterfaceWrapper: (
                                                                                                                                            typeName: string,
                                                                                                                                            typeDescription: Maybe<string>,
                                                                                                                                            interfaces: GraphQLInterfaceType[],
                                                                                                                                            fieldDefinition: string
                                                                                                                                            ) => string;

                                                                                                                                              method renderMainMethodFields

                                                                                                                                              renderMainMethodFields: (
                                                                                                                                              operation: string,
                                                                                                                                              fields: GraphQLFieldMap<any, any>
                                                                                                                                              ) => string;

                                                                                                                                                method renderMutations

                                                                                                                                                renderMutations: () => string;

                                                                                                                                                  method renderQueries

                                                                                                                                                  renderQueries: () => string;

                                                                                                                                                    method renderSubscriptions

                                                                                                                                                    renderSubscriptions: () => string;

                                                                                                                                                      method renderTypes

                                                                                                                                                      renderTypes: () => string;

                                                                                                                                                        method renderTypeWrapper

                                                                                                                                                        renderTypeWrapper: (
                                                                                                                                                        typeName: string,
                                                                                                                                                        typeDescription: Maybe<string>,
                                                                                                                                                        fieldDefinition: string
                                                                                                                                                        ) => string;

                                                                                                                                                          Interfaces

                                                                                                                                                          interface BindingOptions

                                                                                                                                                          interface BindingOptions {}

                                                                                                                                                            property before

                                                                                                                                                            before?: () => void;

                                                                                                                                                              property disableCache

                                                                                                                                                              disableCache?: boolean;

                                                                                                                                                                property fragmentReplacements

                                                                                                                                                                fragmentReplacements?: FragmentReplacement[];

                                                                                                                                                                  property schema

                                                                                                                                                                  schema: GraphQLSchema;

                                                                                                                                                                    interface FragmentReplacement

                                                                                                                                                                    interface FragmentReplacement {}

                                                                                                                                                                      property field

                                                                                                                                                                      field: string;

                                                                                                                                                                        property fragment

                                                                                                                                                                        fragment: string;

                                                                                                                                                                          interface Options

                                                                                                                                                                          interface Options {}

                                                                                                                                                                            property context

                                                                                                                                                                            context?: Context;

                                                                                                                                                                              property transforms

                                                                                                                                                                              transforms?: Transform[];

                                                                                                                                                                                Package Files (12)

                                                                                                                                                                                Dependencies (8)

                                                                                                                                                                                Dev Dependencies (18)

                                                                                                                                                                                Peer Dependencies (0)

                                                                                                                                                                                No peer dependencies.

                                                                                                                                                                                Badge

                                                                                                                                                                                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/graphql-binding.

                                                                                                                                                                                • Markdown
                                                                                                                                                                                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/graphql-binding)
                                                                                                                                                                                • HTML
                                                                                                                                                                                  <a href="https://www.jsdocs.io/package/graphql-binding"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>