EU Parliament Monitor - API Documentation - v0.7.1
    Preparing search index...

    Non-generic base interface for ArticleStrategy used by the strategy registry. Expresses the common operations with ArticleData as the data payload type so that concrete strategies parameterised on a subtype can be stored in a single StrategyRegistry map without unsafe casts.

    This interface deliberately relies on TypeScript's bivariant method-parameter checking: a concrete strategy whose methods accept a narrower TData (extending ArticleData) still satisfies this interface structurally. That means the type is not fully sound — a caller that only sees ArticleStrategyBase could, in principle, pass an ArticleData value that does not match the concrete strategy's expected TData shape.

    To use this interface safely:

    • Only pass the data object returned by a given strategy's own fetchData to that same strategy's buildContent and getMetadata methods.
    • Never mix data payloads between different strategies, even if they share the ArticleData base type.

    External callers that need strong typing for a specific strategy should prefer the generic ArticleStrategy interface, which preserves the concrete TData type and avoids this intentional unsoundness. The ArticleStrategyBase interface is intended primarily for the internal orchestration / pipeline layer that manages a heterogeneous strategy registry.

    interface ArticleStrategyBase {
        type: ArticleCategory;
        requiredMCPTools: readonly string[];
        fetchData(
            client: EuropeanParliamentMCPClient | null,
            date: string,
        ): Promise<ArticleData>;
        buildContent(data: ArticleData, lang: LanguageCode): string;
        getMetadata(data: ArticleData, lang: LanguageCode): ArticleMetadata;
    }

    Hierarchy (View Summary)

    Index

    Properties

    The article category this strategy handles

    requiredMCPTools: readonly string[]

    Names of MCP tools this strategy calls

    Methods