graphql-config

  • Version 5.0.3
  • Published
  • 81.8 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: Record<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?: WithList<string>;

                                                      property extensions

                                                      readonly extensions: IExtensions;

                                                        property filepath

                                                        readonly filepath: string;

                                                          property include

                                                          readonly include?: WithList<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<DocumentNode>;
                                                                        (out: 'GraphQLSchema'): Promise<GraphQLSchema>;
                                                                        (out: 'string'): Promise<string>;
                                                                        };

                                                                          method getSchemaSync

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

                                                                            method hasExtension

                                                                            hasExtension: (name: string) => boolean;

                                                                              method loadDocuments

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

                                                                                method loadDocumentsSync

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

                                                                                  method loadSchema

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

                                                                                    method loadSchemaSync

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

                                                                                      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 LoadersRegistry

                                                                                                class LoadersRegistry {}

                                                                                                  constructor

                                                                                                  constructor({ cwd }: { cwd: string });

                                                                                                    method loadDocuments

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

                                                                                                      method loadDocumentsSync

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

                                                                                                        method loadSchema

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

                                                                                                          method loadSchemaSync

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

                                                                                                            method loadTypeDefs

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

                                                                                                              method loadTypeDefsSync

                                                                                                              loadTypeDefsSync: (
                                                                                                              pointer: Pointer,
                                                                                                              options?: ToolsLoadTypedefsOptions
                                                                                                              ) => Source[];

                                                                                                                method override

                                                                                                                override: (loaders: Loader[]) => void;

                                                                                                                  method register

                                                                                                                  register: (loader: Loader) => void;

                                                                                                                    method use

                                                                                                                    use: (middleware: MiddlewareFn<DocumentNode>) => void;

                                                                                                                      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?: WithList<string>;

                                                                                                                                      property extensions

                                                                                                                                      extensions?: IExtensions;

                                                                                                                                        property include

                                                                                                                                        include?: WithList<string>;

                                                                                                                                          property schema

                                                                                                                                          schema: SchemaPointer;

                                                                                                                                            interface IGraphQLProjectLegacy

                                                                                                                                            interface IGraphQLProjectLegacy {}
                                                                                                                                            • Legacy structure of GraphQL Config v2

                                                                                                                                            property excludes

                                                                                                                                            excludes?: string[];

                                                                                                                                              property extensions

                                                                                                                                              extensions?: IExtensions;

                                                                                                                                                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
                                                                                                                                                                | {
                                                                                                                                                                [url: string]: {
                                                                                                                                                                headers: {
                                                                                                                                                                [name: string]: string;
                                                                                                                                                                };
                                                                                                                                                                };
                                                                                                                                                                }
                                                                                                                                                                >;

                                                                                                                                                                  type SchemaPointerSingle

                                                                                                                                                                  type SchemaPointerSingle = ElementOf<SchemaPointer>;

                                                                                                                                                                    type WithList

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

                                                                                                                                                                      Package Files (7)

                                                                                                                                                                      Dependencies (11)

                                                                                                                                                                      Dev Dependencies (0)

                                                                                                                                                                      No dev dependencies.

                                                                                                                                                                      Peer Dependencies (2)

                                                                                                                                                                      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>