EU Parliament Monitor — API Documentation - v0.8.31
    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;
        shouldSkip?(data: ArticleData): boolean;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Optional guard that lets a strategy opt out of generation when the fetched data contains only placeholder / fallback values (e.g. MCP unavailable). When true is returned the orchestrator skips writing all language variants and logs a notice rather than publishing empty placeholder articles.

      Strategies that do not implement this method are treated as always wanting to generate (i.e. the default is false).

      Parameters

      Returns boolean

      true when all fetched data is placeholder and generation should be skipped

    Properties

    The article category this strategy handles

    requiredMCPTools: readonly string[]

    Names of MCP tools this strategy calls