Documentation
API Reference
Packages
optimize

@graphql-tools/optimize

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

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


removeDescriptions

removeDescriptions(input): DocumentNode

This optimizer removes “description” field from schema AST definitions.

Parameters

NameType
inputDocumentNode

Returns

DocumentNode

Defined in

packages/optimize/src/optimizers/remove-description.ts:8


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/optimizers/remove-empty-nodes.ts:8


removeLoc

removeLoc(input): DocumentNode

This optimizer removes “loc” fields

Parameters

NameType
inputDocumentNode

Returns

DocumentNode

Defined in

packages/optimize/src/optimizers/remove-loc.ts:8