Interface EnrichmentData<ElementContent, ElementArguments, SearchContent, SearchArguments>

interface EnrichmentData<
    ElementContent extends MergeableRecord,
    ElementArguments = undefined,
    SearchContent extends MergeableRecord = never,
    SearchArguments = ElementArguments,
> {
    enrichElement?: (
        element: FlowrSearchElement<ParentInformation>,
        search: FlowrSearchElements<ParentInformation>,
        data: PipelineOutput<
            Pipeline<IPipelineStep<PipelineStepName, (...args: any[]) => any>>,
        > & {
            config: FlowrConfigOptions;
            dataflow: DataflowInformation;
            normalize: NormalizedAst;
        },
        args: undefined | ElementArguments,
        previousValue: undefined | ElementContent,
    ) => ElementContent;
    enrichSearch?: (
        search: FlowrSearchElements<ParentInformation>,
        data: PipelineOutput<
            Pipeline<IPipelineStep<PipelineStepName, (...args: any[]) => any>>,
        > & {
            config: FlowrConfigOptions;
            dataflow: DataflowInformation;
            normalize: NormalizedAst;
        },
        args: undefined | SearchArguments,
        previousValue: undefined | SearchContent,
    ) => SearchContent;
    mapper?: (
        content: ElementContent,
    ) => FlowrSearchElement<ParentInformation>[];
}

Type Parameters

Properties

enrichElement?: (
    element: FlowrSearchElement<ParentInformation>,
    search: FlowrSearchElements<ParentInformation>,
    data: PipelineOutput<
        Pipeline<IPipelineStep<PipelineStepName, (...args: any[]) => any>>,
    > & {
        config: FlowrConfigOptions;
        dataflow: DataflowInformation;
        normalize: NormalizedAst;
    },
    args: undefined | ElementArguments,
    previousValue: undefined | ElementContent,
) => ElementContent

A function that is applied to each element of the search to enrich it with additional data.

enrichSearch?: (
    search: FlowrSearchElements<ParentInformation>,
    data: PipelineOutput<
        Pipeline<IPipelineStep<PipelineStepName, (...args: any[]) => any>>,
    > & {
        config: FlowrConfigOptions;
        dataflow: DataflowInformation;
        normalize: NormalizedAst;
    },
    args: undefined | SearchArguments,
    previousValue: undefined | SearchContent,
) => SearchContent

The mapping function used by the Mapper.Enrichment mapper.