Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "index"

Index

Functions

collectDefinitions

  • collectDefinitions(imports: string[], sdl: string, filePath: string, processedFiles?: Set<string>, typeDefinitions?: TypeDefinitionNode[][], allDefinitions?: TypeDefinitionNode[][]): object
  • Recursively process all schema files. Keeps track of both the filtered type definitions, and all type definitions, because they might be needed in post-processing (to add missing types)

    Parameters

    • imports: string[]

      Types specified in the import statement

    • sdl: string

      Current schema

    • filePath: string

      File location for current schema

    • Default value processedFiles: Set<string> = new Set()
    • Default value typeDefinitions: TypeDefinitionNode[][] = []
    • Default value allDefinitions: TypeDefinitionNode[][] = []

    Returns object

    Both the collection of all type definitions, and the collection of imported type definitions

    • allDefinitions: TypeDefinitionNode[][]
    • typeDefinitions: TypeDefinitionNode[][]

filterImportedDefinitions

  • filterImportedDefinitions(imports: string[], typeDefinitions: DefinitionNode[]): TypeDefinitionNode[]
  • Filter the types loaded from a schema, first by relevant types, then by the types specified in the import statement.

    Parameters

    • imports: string[]

      Types specified in the import statement

    • typeDefinitions: DefinitionNode[]

      All definitions from a schema

    Returns TypeDefinitionNode[]

    Filtered collection of type definitions

filterTypeDefinitions

  • filterTypeDefinitions(definitions: DefinitionNode[]): TypeDefinitionNode[]
  • Filter relevant definitions from schema

    Parameters

    • definitions: DefinitionNode[]

      All definitions from a schema

    Returns TypeDefinitionNode[]

    Relevant type definitions

importSchema

  • importSchema(filePath: string): string
  • Main entry point. Recursively process all import statement in a schema

    Parameters

    • filePath: string

      File path to the initial schema file

    Returns string

    Single bundled schema with all imported types

parseImportLine

  • parseImportLine(importLine: string): RawModule
  • Parse a single import line and extract imported types and schema filename

    Parameters

    • importLine: string

      Import line

    Returns RawModule

    Processed import line

parseSDL

  • Parse a schema and analyze all import lines

    Parameters

    • sdl: string

      Schema to parse

    Returns RawModule[]

    Array with collection of imports per import line (file)

read

  • read(f: string): string
  • Read a schema file from disk

    Parameters

    • f: string

      Filename

    Returns string

    File contents