@graphql-tools/optimize

Functions#

Type aliases#

DocumentOptimizer#

Ƭ DocumentOptimizer: (input: DocumentNode) => DocumentNode

Defined in: packages/optimize/src/types.ts:3

Functions#

optimizeDocumentNode#

optimizeDocumentNode(node: DocumentNode, optimizers?: DocumentOptimizer[]): DocumentNode

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

Parameters:#

NameTypeDefault valueDescription
nodeDocumentNode-document to optimize
optimizersDocumentOptimizer[]...optional, list of optimizer to use

Returns: DocumentNode

Defined in: packages/optimize/src/optimize.ts:16


removeDescriptions#

ConstremoveDescriptions(input: DocumentNode): DocumentNode

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

Parameters:#

NameTypeDescription
inputDocumentNode

Returns: DocumentNode

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


removeEmptyNodes#

ConstremoveEmptyNodes(input: DocumentNode): DocumentNode

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

Parameters:#

NameTypeDescription
inputDocumentNode

Returns: DocumentNode

Defined in: packages/optimize/src/optimizers/remove-empty-nodes.ts:8


removeLoc#

ConstremoveLoc(input: DocumentNode): DocumentNode

This optimizer removes "loc" fields

Parameters:#

NameTypeDescription
inputDocumentNode

Returns: DocumentNode

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