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()
]
});

Hierarchy#

  • GraphQLFileLoader

Implements#

Table of contents#

Constructors#

Methods#

Constructors#

constructor#

+ new GraphQLFileLoader(): GraphQLFileLoader

Returns: GraphQLFileLoader

Methods#

canLoad#

canLoad(pointer: string, options: GraphQLFileLoaderOptions): Promise<boolean\>

Parameters:#

NameType
pointerstring
optionsGraphQLFileLoaderOptions

Returns: Promise<boolean\>

Defined in: packages/loaders/graphql-file/src/index.ts:62


canLoadSync#

canLoadSync(pointer: string, options: GraphQLFileLoaderOptions): boolean

Parameters:#

NameType
pointerstring
optionsGraphQLFileLoaderOptions

Returns: boolean

Defined in: packages/loaders/graphql-file/src/index.ts:81


handleFileContent#

handleFileContent(rawSDL: string, pointer: string, options: GraphQLFileLoaderOptions): { document: DocumentNode ; location: string ; rawSDL: string } | { document: DocumentNode ; location: string }

Parameters:#

NameType
rawSDLstring
pointerstring
optionsGraphQLFileLoaderOptions

Returns: { document: DocumentNode ; location: string ; rawSDL: string } | { document: DocumentNode ; location: string }

Defined in: packages/loaders/graphql-file/src/index.ts:110


load#

load(pointer: string, options: GraphQLFileLoaderOptions): Promise<Source\>

Parameters:#

NameType
pointerstring
optionsGraphQLFileLoaderOptions

Returns: Promise<Source\>

Defined in: packages/loaders/graphql-file/src/index.ts:97


loadSync#

loadSync(pointer: string, options: GraphQLFileLoaderOptions): Source

Parameters:#

NameType
pointerstring
optionsGraphQLFileLoaderOptions

Returns: Source

Defined in: packages/loaders/graphql-file/src/index.ts:104


loaderId#

loaderId(): string

Returns: string

Defined in: packages/loaders/graphql-file/src/index.ts:58