Options
All
  • Public
  • Public/Protected
  • All
Menu

Package graphql-language-service-utils

graphql-language-service-utils

NPM npm downloads LicenseAPI DocsDiscord Channel

Utilities to support the GraphQL Language Service and the rest of the language ecosystem.

Index

References

Position

Re-exports Position

Range

Re-exports Range

getASTNodeAtPosition

Re-exports getASTNodeAtPosition

getFragmentDependencies

Re-exports getFragmentDependencies

getFragmentDependenciesForAST

Re-exports getFragmentDependenciesForAST

locToRange

Re-exports locToRange

offsetToPosition

Re-exports offsetToPosition

pointToOffset

Re-exports pointToOffset

validateWithCustomRules

Re-exports validateWithCustomRules

Functions

getASTNodeAtPosition

  • getASTNodeAtPosition(query: string, ast: ASTNode, point: TPosition): ASTNode | undefined
  • Parameters

    • query: string
    • ast: ASTNode
    • point: TPosition

    Returns ASTNode | undefined

Const getFragmentDependencies

  • getFragmentDependencies(operationString: string, fragmentDefinitions?: Map<string, FragmentDefinitionNode> | null): FragmentDefinitionNode[]
  • Parameters

    • operationString: string
    • Optional fragmentDefinitions: Map<string, FragmentDefinitionNode> | null

    Returns FragmentDefinitionNode[]

Const getFragmentDependenciesForAST

  • getFragmentDependenciesForAST(parsedOperation: DocumentNode, fragmentDefinitions: Map<string, FragmentDefinitionNode>): FragmentDefinitionNode[]
  • Parameters

    • parsedOperation: DocumentNode
    • fragmentDefinitions: Map<string, FragmentDefinitionNode>

    Returns FragmentDefinitionNode[]

locToRange

  • locToRange(text: string, loc: Location): Range
  • Parameters

    • text: string
    • loc: Location

    Returns Range

offsetToPosition

  • offsetToPosition(text: string, loc: number): Position
  • Parameters

    • text: string
    • loc: number

    Returns Position

pointToOffset

  • pointToOffset(text: string, point: TPosition): number
  • Parameters

    • text: string
    • point: TPosition

    Returns number

validateWithCustomRules

  • validateWithCustomRules(schema: GraphQLSchema, ast: DocumentNode, customRules?: Array<ValidationRule> | null, isRelayCompatMode?: boolean): Array<GraphQLError>
  • Validate a GraphQL Document optionally with custom validation rules.

    Parameters

    • schema: GraphQLSchema
    • ast: DocumentNode
    • Optional customRules: Array<ValidationRule> | null
    • Optional isRelayCompatMode: boolean

    Returns Array<GraphQLError>

Generated using TypeDoc