graphql-config

  • Version 4.0.1
  • Published
  • 138 kB
  • 11 dependencies
  • MIT license

Install

npm i graphql-config
yarn add graphql-config
pnpm add graphql-config

Overview

The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs)

Index

Functions

function composeMessage

composeMessage: (...lines: string[]) => string;

    function loadConfig

    loadConfig: (options: LoadConfigOptions) => Promise<GraphQLConfig | undefined>;

      function loadConfigSync

      loadConfigSync: (options: LoadConfigOptions) => GraphQLConfig;

        Classes

        class ConfigEmptyError

        class ConfigEmptyError extends ConfigEmptyError_base {}

          constructor

          constructor(message: string);

            class ConfigInvalidError

            class ConfigInvalidError extends ConfigInvalidError_base {}

              constructor

              constructor(message: string);

                class ConfigNotFoundError

                class ConfigNotFoundError extends ConfigNotFoundError_base {}

                  constructor

                  constructor(message: string);

                    class ExtensionMissingError

                    class ExtensionMissingError extends ExtensionMissingError_base {}

                      constructor

                      constructor(message: string);

                        class GraphQLConfig

                        class GraphQLConfig {}

                          constructor

                          constructor(raw: GraphQLConfigResult, extensions: GraphQLExtensionDeclaration[]);

                            property dirpath

                            readonly dirpath: string;

                              property extensions

                              readonly extensions: GraphQLExtensionsRegistry;

                                property filepath

                                readonly filepath: string;

                                  property projects

                                  readonly projects: { [name: string]: GraphQLProjectConfig };

                                    method getDefault

                                    getDefault: () => GraphQLProjectConfig | never;

                                      method getProject

                                      getProject: (name?: string) => GraphQLProjectConfig | never;

                                        method getProjectForFile

                                        getProjectForFile: (filepath: string) => GraphQLProjectConfig | never;

                                          method isLegacy

                                          isLegacy: () => boolean;

                                            class GraphQLProjectConfig

                                            class GraphQLProjectConfig {}

                                              constructor

                                              constructor({
                                              filepath,
                                              name,
                                              config,
                                              extensionsRegistry,
                                              }: {
                                              filepath: string;
                                              name: string;
                                              config: IGraphQLProject | IGraphQLProjectLegacy;
                                              extensionsRegistry: GraphQLExtensionsRegistry;
                                              });

                                                property dirpath

                                                readonly dirpath: string;

                                                  property documents

                                                  readonly documents?: any;

                                                    property exclude

                                                    readonly exclude?: string | string[];

                                                      property extensions

                                                      readonly extensions: IExtensions;

                                                        property filepath

                                                        readonly filepath: string;

                                                          property include

                                                          readonly include?: string | string[];

                                                            property isLegacy

                                                            readonly isLegacy: boolean;

                                                              property name

                                                              readonly name: string;

                                                                property schema

                                                                readonly schema: any;

                                                                  method extension

                                                                  extension: <T = any>(name: string) => T;

                                                                    method getDocuments

                                                                    getDocuments: () => Promise<Source[]>;

                                                                      method getDocumentsSync

                                                                      getDocumentsSync: () => Source[];

                                                                        method getSchema

                                                                        getSchema: {
                                                                        (): Promise<GraphQLSchema>;
                                                                        (out: 'DocumentNode'): Promise<any>;
                                                                        (out: 'GraphQLSchema'): Promise<any>;
                                                                        (out: 'string'): Promise<string>;
                                                                        };

                                                                          method getSchemaSync

                                                                          getSchemaSync: {
                                                                          (): any;
                                                                          (out: 'DocumentNode'): any;
                                                                          (out: 'GraphQLSchema'): any;
                                                                          (out: 'string'): string;
                                                                          };

                                                                            method hasExtension

                                                                            hasExtension: (name: string) => boolean;

                                                                              method loadDocuments

                                                                              loadDocuments: (pointer: Pointer, options?: any) => Promise<Source[]>;

                                                                                method loadDocumentsSync

                                                                                loadDocumentsSync: (pointer: Pointer, options?: any) => Source[];

                                                                                  method loadSchema

                                                                                  loadSchema: {
                                                                                  (pointer: Pointer): Promise<GraphQLSchema>;
                                                                                  (pointer: any, out: 'string', options?: any): Promise<any>;
                                                                                  (pointer: any, out: 'DocumentNode', options?: any): Promise<any>;
                                                                                  (pointer: any, out: 'GraphQLSchema', options?: any): Promise<any>;
                                                                                  };

                                                                                    method loadSchemaSync

                                                                                    loadSchemaSync: {
                                                                                    (pointer: Pointer): any;
                                                                                    (pointer: any, out: 'string', options?: any): any;
                                                                                    (pointer: any, out: 'DocumentNode', options?: any): any;
                                                                                    (pointer: any, out: 'GraphQLSchema', options?: any): any;
                                                                                    };

                                                                                      method match

                                                                                      match: (filepath: string) => boolean;

                                                                                        class LoaderNoResultError

                                                                                        class LoaderNoResultError extends LoaderNoResultError_base {}

                                                                                          constructor

                                                                                          constructor(message: string);

                                                                                            class LoadersMissingError

                                                                                            class LoadersMissingError extends LoadersMissingError_base {}

                                                                                              constructor

                                                                                              constructor(message: string);

                                                                                                class ProjectNotFoundError

                                                                                                class ProjectNotFoundError extends ProjectNotFoundError_base {}

                                                                                                  constructor

                                                                                                  constructor(message: string);

                                                                                                    Interfaces

                                                                                                    interface GraphQLConfigResult

                                                                                                    interface GraphQLConfigResult {}

                                                                                                      property config

                                                                                                      config: IGraphQLConfig;

                                                                                                        property filepath

                                                                                                        filepath: string;

                                                                                                          interface IExtensions

                                                                                                          interface IExtensions {}
                                                                                                          • Configuration of each used extension

                                                                                                          index signature

                                                                                                          [name: string]: any;

                                                                                                            interface IGraphQLProject

                                                                                                            interface IGraphQLProject {}
                                                                                                            • GraphQL Project

                                                                                                            property documents

                                                                                                            documents?: DocumentPointer;

                                                                                                              property exclude

                                                                                                              exclude?: string | string[];

                                                                                                                property extensions

                                                                                                                extensions?: IExtensions;

                                                                                                                  property include

                                                                                                                  include?: string | string[];

                                                                                                                    property schema

                                                                                                                    schema: SchemaPointer;

                                                                                                                      interface IGraphQLProjectLegacy

                                                                                                                      interface IGraphQLProjectLegacy {}
                                                                                                                      • Legacy structure of GraphQL Config v2

                                                                                                                      property excludes

                                                                                                                      excludes?: string[];

                                                                                                                        property extensions

                                                                                                                        extensions?: {
                                                                                                                        [name: string]: any;
                                                                                                                        };

                                                                                                                          property includes

                                                                                                                          includes?: string[];

                                                                                                                            property schemaPath

                                                                                                                            schemaPath: string;

                                                                                                                              interface IGraphQLProjects

                                                                                                                              interface IGraphQLProjects {}
                                                                                                                              • Multiple named projects

                                                                                                                              property projects

                                                                                                                              projects: {
                                                                                                                              [name: string]: IGraphQLProject | IGraphQLProjectLegacy;
                                                                                                                              };

                                                                                                                                Type Aliases

                                                                                                                                type DocumentGlobPathPointer

                                                                                                                                type DocumentGlobPathPointer = string;

                                                                                                                                  type DocumentPointer

                                                                                                                                  type DocumentPointer = WithList<DocumentGlobPathPointer>;

                                                                                                                                    type ElementOf

                                                                                                                                    type ElementOf<TList> = TList extends Array<infer TElement> ? TElement : never;

                                                                                                                                      type GraphQLExtensionDeclaration

                                                                                                                                      type GraphQLExtensionDeclaration = (api: ExtensionAPI) => GraphQLConfigExtension;

                                                                                                                                        type IGraphQLConfig

                                                                                                                                        type IGraphQLConfig = IGraphQLProject | IGraphQLProjects | IGraphQLProjectLegacy;
                                                                                                                                        • Structure of GraphQL Config

                                                                                                                                        type PointerWithConfiguration

                                                                                                                                        type PointerWithConfiguration<T = any> = {
                                                                                                                                        [key: string]: T;
                                                                                                                                        };

                                                                                                                                          type SchemaPointer

                                                                                                                                          type SchemaPointer = WithList<string>;

                                                                                                                                            type SchemaPointerSingle

                                                                                                                                            type SchemaPointerSingle = ElementOf<SchemaPointer>;

                                                                                                                                              type WithList

                                                                                                                                              type WithList<T> = T | T[];

                                                                                                                                                Package Files (6)

                                                                                                                                                Dependencies (11)

                                                                                                                                                Dev Dependencies (0)

                                                                                                                                                No dev dependencies.

                                                                                                                                                Peer Dependencies (1)

                                                                                                                                                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-config.

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