EU Parliament Monitor — API Documentation - v0.8.45
    Preparing search index...

    Read/write cache for EP procedure dateLastActivity values.

    Usage:

    const cache = new ProcedureSeenCache();
    const newIds = cache.getNewOrUpdatedIds(freshItems);
    for (const item of freshItems) {
    cache.upsert(item.id, item.dateLastActivity);
    }
    cache.save();
    Index

    Constructors

    • Create a new cache instance, loading any previously-persisted data from disk.

      Parameters

      • OptionalstorePath: string

        Path to the JSON cache file. Defaults to data/procedure-seen-cache.json (relative to cwd). Override for test isolation.

      Returns ProcedureSeenCache

    Methods

    • Load existing cache from disk. Returns an empty Map when the file does not exist or is malformed.

      Returns Map<string, ProcedureCacheEntry>

      Map of procedure ID → cache entry

    • Upsert a procedure entry. Marks the cache dirty only when the dateLastActivity value has changed (new ID or updated activity date).

      Parameters

      • procedureId: string

        Procedure identifier (e.g. "2026-0042")

      • dateLastActivity: string

        ISO date string or empty string

      Returns void

    • Return the last-seen dateLastActivity for a procedure, or undefined when the procedure has not been seen before.

      Parameters

      • procedureId: string

        Procedure identifier

      Returns string | undefined

      ISO date string or undefined

    • Whether the cache contains an entry for the given procedure ID.

      Parameters

      • procedureId: string

        Procedure identifier

      Returns boolean

      true when the procedure ID is known

    • Filter a list of candidate procedures to those that are new or whose dateLastActivity has changed since the last run.

      Parameters

      • items: readonly { id: string; dateLastActivity: string }[]

        Candidate procedures

      Returns readonly string[]

      IDs of procedures that are new or have an updated activity date

    • Persist the cache to disk. No-op when nothing has changed since the last save (or load).

      Creates the parent directory if it does not exist.

      Returns void

    Properties

    storePath: string
    entries: Map<string, ProcedureCacheEntry>
    dirty: boolean = false