Docs
API Reference
Packages
optimize

@graphql-tools/optimize

Table of contents

Type Aliases

Functions

Type Aliases

DocumentOptimizer

Ƭ DocumentOptimizer: (input: DocumentNode) => DocumentNode

Type declaration

▸ (input): DocumentNode

Parameters
NameType
inputDocumentNode
Returns

DocumentNode

Defined in

packages/optimize/src/types.ts:3 (opens in a new tab)

Functions

optimizeDocumentNode

optimizeDocumentNode(node, optimizers?): DocumentNode

This method accept a DocumentNode and applies the optimizations you wish to use. You can override the default ones or provide you own optimizers if you wish.

Parameters

NameTypeDefault valueDescription
nodeDocumentNodeundefineddocument to optimize
optimizersDocumentOptimizer[]DEFAULT_OPTIMIZERSoptional, list of optimizer to use

Returns

DocumentNode

Defined in

packages/optimize/src/optimize.ts:16 (opens in a new tab)


removeDescriptions

removeDescriptions(input): DocumentNode

This optimizer removes "description" field from schema AST definitions.

Parameters

NameType
inputDocumentNode

Returns

DocumentNode

Defined in

packages/optimize/src/types.ts:3 (opens in a new tab)


removeEmptyNodes

removeEmptyNodes(input): DocumentNode

This optimizer removes empty nodes/arrays (directives/argument/variableDefinitions) from a given DocumentNode of operation/fragment.

Parameters

NameType
inputDocumentNode

Returns

DocumentNode

Defined in

packages/optimize/src/types.ts:3 (opens in a new tab)


removeLoc

removeLoc(input): DocumentNode

This optimizer removes "loc" fields

Parameters

NameType
inputDocumentNode

Returns

DocumentNode

Defined in

packages/optimize/src/types.ts:3 (opens in a new tab)