Member Junction
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _provider?: IMetadataProvider

    Optional provider override; falls back to Metadata.Provider when not set.

    contentSourceTypeID: string
    CrawlOtherSitesInTopLevelDomain: boolean = false
    CrawlSitesInLowerLevelDomain: boolean = true
    MaxDepth: number = 2
    RootURL: string
    sourceBudgetMap: Map<string, RunBudget> = ...

    Per-source RunBudget tracker, keyed by normalized source ID. Items processed in each batch are tallied against the budget of the source they belong to; when any budget exhausts, the engine's OnAfterBatch gate returns continue:false and the run pauses gracefully. Next invocation will re-crawl, change-detection will skip the already- processed pages, and the remaining ones get processed.

    URLPattern: string
    visitedURLs: Set<string>

    Accessors

    Methods

    • Reset crawl-related instance fields back to the class defaults. Called at the start of each content source so prior-source overrides don't leak forward. URLPattern and RootURL default to undefined — derived later if unset.

      Returns void

    • Pure helper: extract clean body text from raw HTML. No IO. Exposed as a protected method so subclasses and unit tests can exercise it without monkey-patching axios.

      Parameters

      • html: string

      Returns string

    • Fetch a URL once, extract clean text, and compute a stable checksum over that text. Returns both so callers don't have to fetch twice for "is this changed?" + "what's the content?".

      The checksum is computed over the EXTRACTED body text, NOT the raw HTML, because raw HTML routinely contains incidental changes (server timestamps, CSRF tokens, build hashes, ad rotators) that would falsely report a page as "changed" on every crawl. Hashing the extracted text is what users actually mean by "did the content change?"

      Parameters

      • url: string

      Returns Promise<{ checksum: string; text: string }>

    • Backwards-compatible array form. Drains the streaming variant.

      Parameters

      • url: string
      • rootURL: string
      • regex: RegExp

      Returns Promise<string[]>

    • Backwards-compatible Set form. Drains the streaming variant; URLs end up in this.visitedURLs as a side effect of streamLowerLevelLinks.

      Parameters

      • url: string
      • rootURL: string
      • crawlDepth: number
      • scrapedURLs: Set<string>
      • regex: RegExp

      Returns Promise<Set<string>>

    • Backwards-compatible void form. Drains the streaming variant (links go into visitedURLs as a side effect of streamTopLevelLinks).

      Parameters

      • url: string
      • rootURL: string
      • regex: RegExp

      Returns Promise<void>

    • Install the engine's OnAfterBatch hook so each batch's items are counted against the budget of the source they belong to. Returns continue:false from the gate when any source's budget exhausts, which the engine then translates into a graceful pause.

      Returns void

    • Normalize a URL for use as a dedup key in visitedURLs. Conservative normalization that catches the common variations without risking the merge of two semantically distinct pages:

      • drops the fragment (always client-side per RFC 3986)
      • collapses trailing slash on the path (except the root "/")
      • sorts query parameters for stable equality
      • host is already lower-cased by URL parser Path case is intentionally preserved — RFC 3986 says paths are case-sensitive and some servers (wikis, certain Linux file fronts) actually treat them that way.

      Parameters

      • href: string

      Returns string

    • Apply per-source ContentSourceParam rows to this crawler instance. Values stored in the DB are strings, so we coerce per-key to the right runtime type instead of bulk-assigning (which previously stuffed strings into number / boolean fields and relied on JS coercion at use sites).

      Unknown keys are silently ignored — same gate as the prior if (key in this) check, just made explicit.

      Parameters

      Returns void

    • Given a URL, extracts text from a webpage. Kept for external callers that just want the text — internal change-detection now uses fetchAndExtract to avoid redundant fetches.

      Parameters

      • url: string

      Returns Promise<string>

    • Process one URL through the change-detection pipeline. Returns the MJContentItem if the page is new or changed (caller should hand it off to the LLM stage), or null if the page is unchanged.

      One axios.get per URL: the same response body provides both the change-detection hash and the page text. Compare with byChecksum scoped to the current ContentSource so identical boilerplate (404 pages, shared error templates) from a different source can't silently mask legitimate pages here.

      Parameters

      Returns Promise<MJContentItemEntity>

    • Build a per-source RunBudget map from each source's ConfigurationObject. Sources with no budget knobs set still get a RunBudget entry (with all limits = null) so the OnAfterBatch hook can update item counts uniformly.

      Per-source overrides via ContentSourceParam rows (e.g., MaxItemsPerRun stored as a param) take precedence over the ConfigurationObject value.

      Parameters

      Returns Promise<void>

    • Streaming variant: yields each newly-discovered URL as the crawler finds it, so downstream consumers (the content-item streamer that feeds the LLM batcher) can start working before discovery completes. This is the canonical implementation; getAllLinksFromContentSource below is a backwards-compatible array-collecting wrapper.

      Parameters

      • url: string
      • rootURL: string
      • regex: RegExp

      Returns AsyncIterable<string>

    • Streaming variant of getLowerLevelLinks. Yields each newly-discovered URL the moment it's added to the visited set, then recurses depth-first into children. This is the canonical implementation — the LLM batcher gets fed in real time during crawl instead of having to wait for the entire recursive discovery to complete.

      getLowerLevelLinks below is a thin backwards-compatible wrapper that drains the stream into a Set.

      Parameters

      • url: string
      • rootURL: string
      • crawlDepth: number
      • scrapedURLs: Set<string>
      • regex: RegExp

      Returns AsyncIterable<string>

    • Streaming variant of getTopLevelLinks — yields each URL it adds to the visited set so the LLM batcher gets fed in real time.

      Parameters

      • url: string
      • rootURL: string
      • regex: RegExp

      Returns AsyncIterable<string>