• Version 2.7.1
  • Published
  • 126 kB
  • 3 dependencies
  • MIT license


npm i graphql-language-service-utils
yarn add graphql-language-service-utils
pnpm add graphql-language-service-utils


Utilities to support the GraphQL Language Service



variable getQueryFacts

const getQueryFacts: (schema?: any, documentString?: string) => OperationFacts;


    function collectVariables

    collectVariables: (
    schema: GraphQLSchema,
    documentAST: DocumentNode
    ) => VariableToType;

      function getASTNodeAtPosition

      getASTNodeAtPosition: (
      query: string,
      ast: ASTNode,
      point: TPosition
      ) => ASTNode | undefined;

        function getFragmentDependencies

        getFragmentDependencies: (
        operationString: string,
        fragmentDefinitions?: Map<string, FragmentDefinitionNode> | null | undefined
        ) => FragmentDefinitionNode[];

          function getFragmentDependenciesForAST

          getFragmentDependenciesForAST: (
          parsedOperation: DocumentNode,
          fragmentDefinitions: Map<string, FragmentDefinitionNode>
          ) => FragmentDefinitionNode[];

            function getOperationASTFacts

            getOperationASTFacts: (
            documentAST: DocumentNode,
            schema?: GraphQLSchema | null
            ) => OperationASTFacts;

              function getOperationFacts

              getOperationFacts: (
              schema?: GraphQLSchema | null,
              documentString?: string | null
              ) => OperationFacts | undefined;

                function getVariablesJSONSchema

                getVariablesJSONSchema: (
                variableToType: VariableToType,
                options?: JSONSchemaOptions
                ) => JSONSchema6;

                  function locToRange

                  locToRange: (text: string, loc: Location) => Range;

                    function offsetToPosition

                    offsetToPosition: (text: string, loc: number) => Position;

                      function pointToOffset

                      pointToOffset: (text: string, point: TPosition) => number;

                        function validateWithCustomRules

                        validateWithCustomRules: (
                        schema: GraphQLSchema,
                        ast: DocumentNode,
                        customRules?: Array<ValidationRule> | null,
                        isRelayCompatMode?: boolean,
                        isSchemaDocument?: boolean
                        ) => Array<GraphQLError>;


                          class Position

                          class Position implements IPosition {}


                            constructor(line: number, character: number);

                              property character

                              character: number;

                                property lessThanOrEqualTo

                                lessThanOrEqualTo: (position: IPosition) => boolean;

                                  property line

                                  line: number;

                                    method setCharacter

                                    setCharacter: (character: number) => void;

                                      method setLine

                                      setLine: (line: number) => void;

                                        class Range

                                        class Range implements IRange {}


                                          constructor(start: IPosition, end: IPosition);

                                            property containsPosition

                                            containsPosition: (position: IPosition) => boolean;

                                              property end

                                              end: IPosition;

                                                property start

                                                start: IPosition;

                                                  method setEnd

                                                  setEnd: (line: number, character: number) => void;

                                                    method setStart

                                                    setStart: (line: number, character: number) => void;

                                                      Type Aliases

                                                      type JSONSchemaOptions

                                                      type JSONSchemaOptions = {
                                                      useMarkdownDescription?: boolean;

                                                        type OperationFacts

                                                        type OperationFacts = {
                                                        documentAST: DocumentNode;
                                                        } & OperationASTFacts;

                                                          type QueryFacts

                                                          type QueryFacts = OperationFacts;

                                                            type VariableToType

                                                            type VariableToType = {
                                                            [variable: string]: GraphQLInputType;

                                                              Package Files (8)

                                                              Dependencies (3)

                                                              Dev Dependencies (2)

                                                              Peer Dependencies (1)


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

                                                              You may also use to create a custom badge linking to

                                                              • Markdown
                                                              • HTML
                                                                <a href=""><img src="" alt=""></a>