Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "internal/graph/graphQL"

Index

Variables

Const FragmentExpression

FragmentExpression: RegExp = /\.\.\.\s*([_A-Za-z][_0-9A-Za-z]*)/gi

Const OperationNameExpression

OperationNameExpression: RegExp = /(subscription|query)[\s]*([^({\s]*)/i

Const OperationParameterExpression

OperationParameterExpression: RegExp = /(?:subscription|query)[\s]*([\S]*?)\s*(\([\S\s]*?\))\s*[\S\s]*?{/i

Const schema

schema: any = require("../../graph/schema.cortex.json")

Functions

enumValue

ingester

inlineFragments

  • inlineFragments(q: string, name: string, moduleDir: string, fragmentDir: string): string

inlineQuery

  • inlineQuery(q: string): string

locateAndLoadGraphql

  • locateAndLoadGraphql(options: object, subfolder: string, moduleDir: string): string
  • Parameters

    • options: object
      • Optional name?: string
      • Optional path?: string
    • subfolder: string
    • moduleDir: string

    Returns string

mutate

  • Prepare a GraphQL mutation string for the use with Apollo.

    Mutations can be provided by the following options:

    • mutation: string containing the subscription GraphQL, or
    • path: absolute or relative path to a .graphql file to load; if provided a relative
         path this will resolve the relative path to an absolute given the location
         of the calling script.
      
    • name: name of the .graphql file to load; this will walk up the directory structure
         starting a t the location of the calling script and look for a folder called
         'graphql'. Once that folder is found, by convention name is being looked for
         in the 'mutation' sub directory.
      
    • moduleDir: location of the calling script
    • inline: remove any unneeded whitespace and line breaks from returned GraphQL string

    Type parameters

    • T

    • Q

    Parameters

    Returns string

operationName

  • operationName(q: string): string

prettyPrintErrors

  • prettyPrintErrors(errors: GraphQLError[], q?: string): string

query

  • Prepare a GraphQL query string for the use with Apollo.

    Queries can be provided by the following options:

    • query: string containing the subscription GraphQL, or
    • path: absolute or relative path to a .graphql file to load; if provided a relative
         path this will resolve the relative path to an absolute given the location
         of the calling script.
      
    • name: name of the .graphql file to load; this will walk up the directory structure
         starting at the location of the calling script and look for a folder called
         'graphql'. Once that folder is found, by convention name is being looked for
         in the 'query' sub directory.
      
    • fragmentsDir: location of fragment .graphql files
    • moduleDir: location of the calling script
    • inline: remove any unneeded whitespace and line breaks from returned GraphQL string

    Type parameters

    • T

    • Q

    Parameters

    Returns string

replace

  • replace(q: string, key: string, value: string): string

replaceOperationName

  • replaceOperationName(q: string, name: string): string
  • Replace the operation name in the query or subscription

    Parameters

    • q: string
    • name: string

    Returns string

replaceParameters

  • replaceParameters(q: string, parameters?: object): string

resolveAndReadFileSync

  • resolveAndReadFileSync(path: string, current?: string, parameters?: object): string
  • Parameters

    • path: string
    • Default value current: string = appRoot.path
    • Default value parameters: object = {}

    Returns string

subscription

validateQuery

  • validateQuery(q: string): GraphQLError[]

Generated using TypeDoc