Skip to main content

Function: extractContent()

extractContent(root, extractor, renderer, transforms?, transformContext?): Promise<string[] | GroupedExtraction[] | Readonly<Record<string, string | string[]>>[]>

Defined in: packages/core/src/domain/services/content-extraction.ts:381

Generic extraction engine — runs a single extractor against an AST root.

Pure function — no I/O. Handles single-value, array-value, grouped, and structured extraction modes based on the extractor configuration.

Parameters​

root​

SelectorNode

The AST root node to extract from

extractor​

Extractor

The extraction configuration

renderer​

SubtreeRenderer

Serializer for rendering AST subtrees to text

transforms?​

ExtractorTransformRegistry

Named transform callbacks (for example resolveSpecPath)

transformContext?​

ExtractorTransformContext = EMPTY_TRANSFORM_CONTEXT

Opaque caller-owned transform context bag

Returns​

Promise<string[] | GroupedExtraction[] | Readonly<Record<string, string | string[]>>[]>

Extracted values as strings, grouped objects, or structured objects

Throws​

When transform lookup or execution fails