graphql-tools-monorepo / loaders/graphql-file/src / GraphQLFileLoader

Class: GraphQLFileLoader

loaders/graphql-file/src.GraphQLFileLoader

This loader loads documents and type definitions from .graphql files.

You can load a single source:

const schema = await loadSchema('schema.graphql', {
  loaders: [
    new GraphQLFileLoader()
  ]
});

Or provide a glob pattern to load multiple sources:

const schema = await loadSchema('graphql/*.graphql', {
  loaders: [
    new GraphQLFileLoader()
  ]
});

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new GraphQLFileLoader(): GraphQLFileLoader

Returns

GraphQLFileLoader

Methods

canLoad

canLoad(pointer, options): Promise<boolean>

Parameters

NameType
pointerstring
optionsGraphQLFileLoaderOptions

Returns

Promise<boolean>

Defined in

packages/loaders/graphql-file/src/index.ts:66


canLoadSync

canLoadSync(pointer, options): boolean

Parameters

NameType
pointerstring
optionsGraphQLFileLoaderOptions

Returns

boolean

Defined in

packages/loaders/graphql-file/src/index.ts:84


handleFileContent

handleFileContent(rawSDL, pointer, options): Object

Parameters

NameType
rawSDLstring
pointerstring
optionsGraphQLFileLoaderOptions

Returns

Object

NameType
documentDocumentNode
locationundefined | string

Defined in

packages/loaders/graphql-file/src/index.ts:200


load

load(pointer, options): Promise<Source[]>

Parameters

NameType
pointerstring
optionsGraphQLFileLoaderOptions

Returns

Promise<Source[]>

Implementation of

Loader.load

Defined in

packages/loaders/graphql-file/src/index.ts:128


loadSync

loadSync(pointer, options): Source[]

Parameters

NameType
pointerstring
optionsGraphQLFileLoaderOptions

Returns

Source[]

Implementation of

Loader.loadSync

Defined in

packages/loaders/graphql-file/src/index.ts:165


resolveGlobs

resolveGlobs(glob, options): Promise<string[]>

Parameters

NameType
globstring
optionsGraphQLFileLoaderOptions

Returns

Promise<string[]>

Defined in

packages/loaders/graphql-file/src/index.ts:102


resolveGlobsSync

resolveGlobsSync(glob, options): string[]

Parameters

NameType
globstring
optionsGraphQLFileLoaderOptions

Returns

string[]

Defined in

packages/loaders/graphql-file/src/index.ts:115