Docs
API Reference
Packages
import

@graphql-tools/import

Table of contents

Type Aliases

Functions

Type Aliases

VisitedFilesMap

Ƭ VisitedFilesMap: Map<string, Map<string, Set<DefinitionNode>>>

Defined in

packages/import/src/index.ts:62 (opens in a new tab)

Functions

extractDependencies

extractDependencies(filePath, fileContents): Object

Parameters

NameType
filePathstring
fileContentsstring

Returns

Object

NameType
definitionsByNameMap<string, Set<DefinitionNode>>
dependenciesByDefinitionNameMap<string, Set<string>>

Defined in

packages/import/src/index.ts:242 (opens in a new tab)


extractImportLines

extractImportLines(fileContent): Object

Splits the contents of a GraphQL file into lines that are imports and other lines which define the actual GraphQL document.

Parameters

NameType
fileContentstring

Returns

Object

NameType
importLinesstring[]
otherLinesstring

Defined in

packages/import/src/index.ts:462 (opens in a new tab)


parseImportLine

parseImportLine(importLine): Object

Parses an import line, returning a list of entities imported and the file from which they are imported.

Throws if the import line does not have a correct format.

Parameters

NameType
importLinestring

Returns

Object

NameType
fromstring
importsstring[]

Defined in

packages/import/src/index.ts:485 (opens in a new tab)


processImport

processImport(filePath, cwd?, predefinedImports?, visitedFiles?): DocumentNode

Loads the GraphQL document and recursively resolves all the imports and copies them into the final document. processImport does not merge the typeDefs as designed ( https://github.com/ardatan/graphql-tools/issues/2980#issuecomment-1003692728 (opens in a new tab) )

Parameters

NameType
filePathstring
cwdstring
predefinedImportsRecord<string, string>
visitedFilesVisitedFilesMap

Returns

DocumentNode

Defined in

packages/import/src/index.ts:69 (opens in a new tab)


processImports

processImports(importLines, filePath, visitedFiles, predefinedImports): Object

Parameters

NameType
importLinesstring[]
filePathstring
visitedFilesVisitedFilesMap
predefinedImportsRecord<string, string>

Returns

Object

NameType
allImportedDefinitionsMapMap<string, Set<DefinitionNode>>
potentialTransitiveDefinitionsMapMap<string, Set<DefinitionNode>>

Defined in

packages/import/src/index.ts:396 (opens in a new tab)