FieldCollectionPipeline class exported ✓ 100.0%

Last updated: 2026-03-01T23:35:47.796Z

Metrics

LOC: 28 Complexity: 1 Params: 0 Coverage: 100.0% (9/9 lines, 0x executed)

Signature

class FieldCollectionPipeline

Summary

Orchestrates an ordered list of PageDetectors, running each one and aggregating their results into a single FormField array. Usage: const allFields = DEFAULT_COLLECTION_PIPELINE.run(); // add a new scanner const extended = DEFAULT_COLLECTION_PIPELINE.with(myPageDetector); // remove a scanner by name const noInteractive = DEFAULT_COLLECTION_PIPELINE.without("interactive-fields");

Source Code

export class FieldCollectionPipeline {
  constructor(readonly detectors: ReadonlyArray<PageDetector>) {}

  /** Run all detectors in order and return the concatenated list of fields. */
  run(): FormField[] {
    return this.detectors.flatMap((d) => d.detect());
  }

  /** Returns a new pipeline with the given detector appended. */
  with(detector: PageDetector): FieldCollectionPipeline {
    return new FieldCollectionPipeline([...this.detectors, detector]);
  }

  /** Returns a new pipeline excluding detectors with any of the given names. */
  without(...names: string[]): FieldCollectionPipeline {
    return new FieldCollectionPipeline(
      this.detectors.filter((d) => !names.includes(d.name)),
    );
  }

  /** Returns a new pipeline with detectors reordered by name. */
  withOrder(names: string[]): FieldCollectionPipeline {
    const ordered = names
      .map((n) => this.detectors.find((d) => d.name === n))
      .filter((d): d is PageDetector => d !== undefined);
    return new FieldCollectionPipeline(ordered);
  }
}

Members

Name Kind Visibility Status Signature
constructor method - constructor(readonly detectors: ReadonlyArray<PageDetector>)
run method - run(): : FormField[]
with method - with(detector: PageDetector): : FieldCollectionPipeline
without method - without(...names: string[]): : FieldCollectionPipeline
withOrder method - withOrder(names: string[]): : FieldCollectionPipeline

No outgoing dependencies.

Impact (Incoming)

graph LR FieldCollectionPipeline["FieldCollectionPipeline"] getActiveClassifiers["getActiveClassifiers"] with["with"] without["without"] withOrder["withOrder"] makeField["makeField"] getActiveClassifiers -->|uses| FieldCollectionPipeline with -.->|instantiates| FieldCollectionPipeline without -.->|instantiates| FieldCollectionPipeline withOrder -.->|instantiates| FieldCollectionPipeline makeField -->|uses| FieldCollectionPipeline style FieldCollectionPipeline fill:#dbeafe,stroke:#2563eb,stroke-width:2px click FieldCollectionPipeline "9f83a3f75784d358.html" click getActiveClassifiers "94c3286cfdb569c3.html" click with "1fc816e8cb905ec6.html" click without "f903396d2ca4f08c.html" click withOrder "9e9296596d1d2db5.html" click makeField "40cb7e5a6354eaea.html"
SourceType
getActiveClassifiers uses
with instantiates
without instantiates
withOrder instantiates
makeField uses