@mitre/hdf-diff 3.6.0 → 3.7.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ Compares HDF documents (results, baselines, or system documents) and produces a
11
11
  - **System drift** (`diffSystems`) — compare two HDF system documents for component, data flow, and configuration changes
12
12
  - **SBOM comparison** (`diffSboms`) — CycloneDX/SPDX package-level diffs (added, removed, updated)
13
13
  - **Amendment operations** (Go only, `amend` subpackage) — merge overrides into results, verify amendment chains, compute effectiveStatus/effectiveImpact/disposition
14
- - **Requirement change events** (`changeEventFromPrevious`, `applyChangeEvents`, `foldChangeEventsIntoComparison`) — the continuous-monitoring kernel (ADR-0005): derive a per-requirement change-event stream between two scans, fold a batch of events into a comparison, and replay events onto a seed to reassemble a reconciled results document (parity law: `applyChangeEvents(A, derive(A→B)) ≡ B` at requirement level). Dual Go + TS; wrapped by the `hdf events` CLI command group.
14
+ - **Requirement change events** (`changeEventFromPrevious`, `applyChangeEvents`, `foldChangeEventsIntoComparison`) — the continuous-monitoring kernel: derive a per-requirement change-event stream between two scans, fold a batch of events into a comparison, and replay events onto a seed to reassemble a reconciled results document (parity law: `applyChangeEvents(A, derive(A→B)) ≡ B` at requirement level). Dual Go + TS; wrapped by the `hdf events` CLI command group.
15
15
 
16
16
  Additional capabilities:
17
17
  - Multiple comparison modes: temporal, baseline, fleet, multi-source
package/dist/index.d.ts CHANGED
@@ -39,7 +39,7 @@ interface SbomDiffResult {
39
39
  * @returns Structured diff result with per-package state and aggregate counts
40
40
  * @throws Error if either input is not valid JSON or not a recognized SBOM format
41
41
  */
42
- declare function diffSboms(oldJson: string, newJson: string): SbomDiffResult;
42
+ export declare function diffSboms(oldJson: string, newJson: string): SbomDiffResult;
43
43
  //#endregion
44
44
  //#region src/types.d.ts
45
45
  /**
@@ -299,7 +299,7 @@ interface DiffOptions {
299
299
  * For fleet mode, `newResults` can be an array of documents, each compared
300
300
  * pairwise against `oldResults` (the reference).
301
301
  */
302
- declare function diffHdf(oldResults: Record<string, unknown>, newResults: Record<string, unknown> | Record<string, unknown>[], options?: DiffOptions): HDFComparison;
302
+ export declare function diffHdf(oldResults: Record<string, unknown>, newResults: Record<string, unknown> | Record<string, unknown>[], options?: DiffOptions): HDFComparison;
303
303
  /**
304
304
  * Compare two HDF baseline documents and produce a structured comparison
305
305
  * showing requirement changes between baseline versions.
@@ -308,7 +308,7 @@ declare function diffHdf(oldResults: Record<string, unknown>, newResults: Record
308
308
  * definitions — requirements without results. There is no status-based classification
309
309
  * (fixed/regressed); only metadata changes (title, impact, descriptions, tags) are tracked.
310
310
  */
311
- declare function diffBaselines(oldBaseline: Record<string, unknown>, newBaseline: Record<string, unknown>, options?: DiffOptions): HDFComparison;
311
+ export declare function diffBaselines(oldBaseline: Record<string, unknown>, newBaseline: Record<string, unknown>, options?: DiffOptions): HDFComparison;
312
312
  /**
313
313
  * Compare two HDF system documents and produce a structured comparison
314
314
  * showing component-level changes between system versions.
@@ -317,7 +317,7 @@ declare function diffBaselines(oldBaseline: Record<string, unknown>, newBaseline
317
317
  * to exact name matching. Top-level system fields, data flows, and embedded
318
318
  * SBOMs are also compared.
319
319
  */
320
- declare function diffSystems(oldSystem: Record<string, unknown>, newSystem: Record<string, unknown>, options?: DiffOptions): HDFComparison;
320
+ export declare function diffSystems(oldSystem: Record<string, unknown>, newSystem: Record<string, unknown>, options?: DiffOptions): HDFComparison;
321
321
  //#endregion
322
322
  //#region src/status.d.ts
323
323
  /**
@@ -332,12 +332,12 @@ declare function diffSystems(oldSystem: Record<string, unknown>, newSystem: Reco
332
332
  *
333
333
  * The stored effectiveStatus field is an output cache and is never read.
334
334
  */
335
- declare function computeEffectiveStatus(requirement: Record<string, unknown>, referenceTimestamp?: string): string;
335
+ export declare function computeEffectiveStatus(requirement: Record<string, unknown>, referenceTimestamp?: string): string;
336
336
  /**
337
337
  * Classify why the status changed between two requirements.
338
338
  * Returns an array of change reasons (a status change can have multiple causes).
339
339
  */
340
- declare function classifyChangeReasons(oldReq: Record<string, unknown>, newReq: Record<string, unknown>, oldTimestamp?: string, newTimestamp?: string): ChangeReason[];
340
+ export declare function classifyChangeReasons(oldReq: Record<string, unknown>, newReq: Record<string, unknown>, oldTimestamp?: string, newTimestamp?: string): ChangeReason[];
341
341
  /**
342
342
  * Classify the overall diff status based on old and new effective statuses.
343
343
  *
@@ -346,7 +346,7 @@ declare function classifyChangeReasons(oldReq: Record<string, unknown>, newReq:
346
346
  * - If statuses are equal → 'unchanged'
347
347
  * - Otherwise → 'updated'
348
348
  */
349
- declare function classifyDiffStatus(oldEffectiveStatus: string, newEffectiveStatus: string): RequirementState;
349
+ export declare function classifyDiffStatus(oldEffectiveStatus: string, newEffectiveStatus: string): RequirementState;
350
350
  //#endregion
351
351
  //#region src/effective-checksum.d.ts
352
352
  interface EffectiveChecksum {
@@ -360,13 +360,13 @@ interface EffectiveChecksum {
360
360
  * overrides, a stored effectiveImpact field is honored; otherwise the base
361
361
  * impact. (Go parity: ComputeEffectiveImpact in hdf-diff/go/effective_checksum.go.)
362
362
  */
363
- declare function computeEffectiveImpact(requirement: Record<string, unknown>, referenceTimestamp?: string): number;
363
+ export declare function computeEffectiveImpact(requirement: Record<string, unknown>, referenceTimestamp?: string): number;
364
364
  /**
365
365
  * Return the Override_Type of the governing (most recently applied
366
366
  * non-expired) override, a stored disposition field when no overrides are
367
367
  * present, or null. (Go parity: ComputeDisposition.)
368
368
  */
369
- declare function computeDisposition(requirement: Record<string, unknown>, referenceTimestamp?: string): string | null;
369
+ export declare function computeDisposition(requirement: Record<string, unknown>, referenceTimestamp?: string): string | null;
370
370
  /**
371
371
  * Hash the resolved effective posture of a requirement: sha256 over the
372
372
  * canonical JSON {"status":<resolved>,"impact":<resolved>,"disposition":<type|null>}.
@@ -379,7 +379,7 @@ declare function computeDisposition(requirement: Record<string, unknown>, refere
379
379
  * so callers that need reproducible output must always supply a valid
380
380
  * timestamp.
381
381
  */
382
- declare function computeEffectiveChecksum(requirement: Record<string, unknown>, referenceTimestamp?: string): Promise<EffectiveChecksum>;
382
+ export declare function computeEffectiveChecksum(requirement: Record<string, unknown>, referenceTimestamp?: string): Promise<EffectiveChecksum>;
383
383
  //#endregion
384
384
  //#region src/change-event.d.ts
385
385
  /**
@@ -430,7 +430,7 @@ interface EventInputs {
430
430
  * (impactChanged) are emitted. Byte-parity with the Go kernel
431
431
  * (ChangeEventFromPrevious) is pinned by shared test vectors.
432
432
  */
433
- declare function changeEventFromPrevious(prev: KeyState | null, newReq: Record<string, unknown> | null, prevReq: Record<string, unknown> | null, inputs: EventInputs): Promise<Record<string, unknown> | null>;
433
+ export declare function changeEventFromPrevious(prev: KeyState | null, newReq: Record<string, unknown> | null, prevReq: Record<string, unknown> | null, inputs: EventInputs): Promise<Record<string, unknown> | null>;
434
434
  //#endregion
435
435
  //#region src/apply-events.d.ts
436
436
  /**
@@ -476,7 +476,7 @@ type Doc$1 = Record<string, unknown>;
476
476
  * anomalies surface as warnings, never as refusal. Go parity:
477
477
  * ApplyChangeEvents.
478
478
  */
479
- declare function applyChangeEvents(seedJson: string, events: Doc$1[], inputs: ApplyInputs): Promise<ApplyResult>;
479
+ export declare function applyChangeEvents(seedJson: string, events: Doc$1[], inputs: ApplyInputs): Promise<ApplyResult>;
480
480
  //#endregion
481
481
  //#region src/fold-events.d.ts
482
482
  type Doc = Record<string, unknown>;
@@ -496,13 +496,13 @@ interface FoldResult {
496
496
  * seed's own timestamp (falling back to the event occurrence when the seed
497
497
  * has none) — never wall clock. Go parity: FoldChangeEventsIntoComparison.
498
498
  */
499
- declare function foldChangeEventsIntoComparison(seedJson: string, events: Doc[]): Promise<FoldResult>;
499
+ export declare function foldChangeEventsIntoComparison(seedJson: string, events: Doc[]): Promise<FoldResult>;
500
500
  //#endregion
501
501
  //#region src/summary.d.ts
502
502
  /**
503
503
  * Compute summary counts from an array of RequirementDiff entries.
504
504
  */
505
- declare function computeSummary(requirements: RequirementDiff[]): ComparisonSummary;
505
+ export declare function computeSummary(requirements: RequirementDiff[]): ComparisonSummary;
506
506
  //#endregion
507
507
  //#region src/normalize.d.ts
508
508
  /**
@@ -518,12 +518,12 @@ declare function computeSummary(requirements: RequirementDiff[]): ComparisonSumm
518
518
  * Detect whether a document is v1 (InSpec exec-json) format.
519
519
  * V1 has `profiles` at the top level; v2 has `baselines`.
520
520
  */
521
- declare function isV1Format(doc: Record<string, unknown>): boolean;
521
+ export declare function isV1Format(doc: Record<string, unknown>): boolean;
522
522
  /**
523
523
  * Normalize a document to v2-like structure. If already v2, returns as-is.
524
524
  * If v1, converts profiles→baselines, controls→requirements, and snake_case→camelCase.
525
525
  */
526
- declare function normalizeToV2(doc: Record<string, unknown>): Record<string, unknown>;
526
+ export declare function normalizeToV2(doc: Record<string, unknown>): Record<string, unknown>;
527
527
  //#endregion
528
528
  //#region src/matching/types.d.ts
529
529
  /**
@@ -569,7 +569,7 @@ interface MatchStrategy {
569
569
  * Matches requirements by their `id` field with exact string equality.
570
570
  * Confidence is always 1.0 for matches.
571
571
  */
572
- declare function createExactIdStrategy(): MatchStrategy;
572
+ export declare function createExactIdStrategy(): MatchStrategy;
573
573
  //#endregion
574
574
  //#region src/matching/mapped-id.d.ts
575
575
  /**
@@ -582,7 +582,7 @@ declare function createExactIdStrategy(): MatchStrategy;
582
582
  * Confidence is 0.95 for mapped matches (slightly less than exact ID
583
583
  * because the match depends on the accuracy of the mapping table).
584
584
  */
585
- declare function createMappedIdStrategy(mapping: Record<string, string>): MatchStrategy;
585
+ export declare function createMappedIdStrategy(mapping: Record<string, string>): MatchStrategy;
586
586
  //#endregion
587
587
  //#region src/matching/cci-match.d.ts
588
588
  /**
@@ -600,7 +600,7 @@ declare function createMappedIdStrategy(mapping: Record<string, string>): MatchS
600
600
  *
601
601
  * Confidence is 0.8 for CCI matches and 0.6 for CWE-fallback matches.
602
602
  */
603
- declare function createCciMatchStrategy(): MatchStrategy;
603
+ export declare function createCciMatchStrategy(): MatchStrategy;
604
604
  //#endregion
605
605
  //#region src/matching/fuzzy-match.d.ts
606
606
  /**
@@ -611,12 +611,12 @@ declare function createCciMatchStrategy(): MatchStrategy;
611
611
  * - Filters out common stop words
612
612
  * - Returns unique tokens as a Set
613
613
  */
614
- declare function tokenize(text: string): Set<string>;
614
+ export declare function tokenize(text: string): Set<string>;
615
615
  /**
616
616
  * Compute Jaccard similarity between two sets.
617
617
  * Returns |intersection| / |union|, or 0 if both sets are empty.
618
618
  */
619
- declare function jaccardSimilarity(a: Set<string>, b: Set<string>): number;
619
+ export declare function jaccardSimilarity(a: Set<string>, b: Set<string>): number;
620
620
  /**
621
621
  * Create a fuzzy title matching strategy.
622
622
  *
@@ -626,7 +626,7 @@ declare function jaccardSimilarity(a: Set<string>, b: Set<string>): number;
626
626
  *
627
627
  * @param minConfidence Minimum Jaccard similarity to accept a match (default: 0.6)
628
628
  */
629
- declare function createFuzzyTitleStrategy(minConfidence?: number): MatchStrategy;
629
+ export declare function createFuzzyTitleStrategy(minConfidence?: number): MatchStrategy;
630
630
  //#endregion
631
631
  //#region src/matching/srg-deterministic.d.ts
632
632
  /**
@@ -642,7 +642,7 @@ declare function createFuzzyTitleStrategy(minConfidence?: number): MatchStrategy
642
642
  *
643
643
  * Requirements without a gtitle pass through as unmatched.
644
644
  */
645
- declare function createSrgDeterministicStrategy(): MatchStrategy;
645
+ export declare function createSrgDeterministicStrategy(): MatchStrategy;
646
646
  //#endregion
647
647
  //#region src/matching/srg-cci-tiebreak.d.ts
648
648
  /**
@@ -655,17 +655,17 @@ declare function createSrgDeterministicStrategy(): MatchStrategy;
655
655
  * Only activates for gtitle groups with multiple candidates (>1 old or >1 new).
656
656
  * 1:1 matches are left for srgDeterministic (Tier 1).
657
657
  */
658
- declare function createSrgCciTiebreakStrategy(): MatchStrategy;
658
+ export declare function createSrgCciTiebreakStrategy(): MatchStrategy;
659
659
  //#endregion
660
660
  //#region src/matching/vendor-fuzzy-title.d.ts
661
661
  /**
662
662
  * Compute the Levenshtein edit distance between two strings.
663
663
  */
664
- declare function levenshteinDistance(a: string, b: string): number;
664
+ export declare function levenshteinDistance(a: string, b: string): number;
665
665
  /**
666
666
  * Normalized Levenshtein distance (0.0 = identical, 1.0 = completely different).
667
667
  */
668
- declare function normalizedLevenshtein(a: string, b: string): number;
668
+ export declare function normalizedLevenshtein(a: string, b: string): number;
669
669
  /**
670
670
  * Create a vendor fuzzy title matching strategy (Tier 3 of the delta pipeline).
671
671
  *
@@ -678,7 +678,7 @@ declare function normalizedLevenshtein(a: string, b: string): number;
678
678
  *
679
679
  * @param acceptThreshold Max normalized Levenshtein distance to accept (default: 0.45)
680
680
  */
681
- declare function createVendorFuzzyTitleStrategy(acceptThreshold?: number): MatchStrategy;
681
+ export declare function createVendorFuzzyTitleStrategy(acceptThreshold?: number): MatchStrategy;
682
682
  //#endregion
683
683
  //#region src/matching/index.d.ts
684
684
  /**
@@ -709,7 +709,7 @@ interface MatchOptions {
709
709
  * @param options Matching configuration
710
710
  * @returns Combined match result from all strategies
711
711
  */
712
- declare function matchRequirements(oldReqs: Record<string, unknown>[], newReqs: Record<string, unknown>[], options?: MatchOptions): MatchResult;
712
+ export declare function matchRequirements(oldReqs: Record<string, unknown>[], newReqs: Record<string, unknown>[], options?: MatchOptions): MatchResult;
713
713
  //#endregion
714
714
  //#region src/validate.d.ts
715
715
  /**
@@ -730,21 +730,21 @@ interface ValidationResult {
730
730
  * @param doc - The document to validate (typically the output of `diffHdf()`)
731
731
  * @returns Validation result with `valid` boolean and optional `errors` array
732
732
  */
733
- declare function validateComparison(doc: unknown): ValidationResult;
733
+ export declare function validateComparison(doc: unknown): ValidationResult;
734
734
  //#endregion
735
735
  //#region src/exit-codes.d.ts
736
736
  /** GNU diff compatible exit codes (--exit-code mode) */
737
- declare const EXIT_IDENTICAL = 0;
738
- declare const EXIT_DIFFERENCES = 1;
739
- declare const EXIT_ERROR = 2;
737
+ export declare const EXIT_IDENTICAL = 0;
738
+ export declare const EXIT_DIFFERENCES = 1;
739
+ export declare const EXIT_ERROR = 2;
740
740
  /** Detailed exit codes (--detailed-exitcode mode) */
741
- declare const EXIT_DETAILED_IDENTICAL = 0;
742
- declare const EXIT_DETAILED_ERROR = 1;
743
- declare const EXIT_DETAILED_FIXES_ONLY = 10;
744
- declare const EXIT_DETAILED_REGRESSIONS_ONLY = 11;
745
- declare const EXIT_DETAILED_MIXED = 12;
746
- declare const EXIT_DETAILED_BASELINE_CHANGED = 13;
747
- declare const EXIT_DETAILED_DRIFT_ONLY = 14;
741
+ export declare const EXIT_DETAILED_IDENTICAL = 0;
742
+ export declare const EXIT_DETAILED_ERROR = 1;
743
+ export declare const EXIT_DETAILED_FIXES_ONLY = 10;
744
+ export declare const EXIT_DETAILED_REGRESSIONS_ONLY = 11;
745
+ export declare const EXIT_DETAILED_MIXED = 12;
746
+ export declare const EXIT_DETAILED_BASELINE_CHANGED = 13;
747
+ export declare const EXIT_DETAILED_DRIFT_ONLY = 14;
748
748
  /**
749
749
  * Compute the GNU diff compatible exit code from a comparison summary.
750
750
  *
@@ -755,7 +755,7 @@ declare const EXIT_DETAILED_DRIFT_ONLY = 14;
755
755
  * Note: error (exit code 2) is not computed from the summary — callers
756
756
  * should return EXIT_ERROR directly when I/O or parse errors occur.
757
757
  */
758
- declare function computeExitCode(summary: ComparisonSummary): number;
758
+ export declare function computeExitCode(summary: ComparisonSummary): number;
759
759
  /**
760
760
  * Compute the detailed exit code from a comparison summary.
761
761
  *
@@ -772,7 +772,7 @@ declare function computeExitCode(summary: ComparisonSummary): number;
772
772
  *
773
773
  * Priority order: mixed(12) > regressions(11) > fixes(10) > baseline(13) > drift(14)
774
774
  */
775
- declare function computeDetailedExitCode(summary: ComparisonSummary): number;
775
+ export declare function computeDetailedExitCode(summary: ComparisonSummary): number;
776
776
  //#endregion
777
777
  //#region src/renderers/types.d.ts
778
778
  type DetailLevel = 'summary' | 'control' | 'full';
@@ -797,7 +797,7 @@ interface RenderOptions {
797
797
  *
798
798
  * Default detail level: `'control'`.
799
799
  */
800
- declare function renderJson(comparison: HDFComparison, options?: RenderOptions): string;
800
+ export declare function renderJson(comparison: HDFComparison, options?: RenderOptions): string;
801
801
  //#endregion
802
802
  //#region src/renderers/markdown.d.ts
803
803
  /**
@@ -809,7 +809,7 @@ declare function renderJson(comparison: HDFComparison, options?: RenderOptions):
809
809
  *
810
810
  * Default detail level: `'control'`.
811
811
  */
812
- declare function renderMarkdown(comparison: HDFComparison, options?: RenderOptions): string;
812
+ export declare function renderMarkdown(comparison: HDFComparison, options?: RenderOptions): string;
813
813
  //#endregion
814
814
  //#region src/renderers/terminal.d.ts
815
815
  /**
@@ -822,7 +822,7 @@ declare function renderMarkdown(comparison: HDFComparison, options?: RenderOptio
822
822
  * When `color: false`, no ANSI escape codes are emitted.
823
823
  * Default detail level: `'control'`. Default color: `true`.
824
824
  */
825
- declare function renderTerminal(comparison: HDFComparison, options?: RenderOptions): string;
825
+ export declare function renderTerminal(comparison: HDFComparison, options?: RenderOptions): string;
826
826
  //#endregion
827
827
  //#region src/renderers/csv.d.ts
828
828
  /**
@@ -836,7 +836,7 @@ declare function renderTerminal(comparison: HDFComparison, options?: RenderOptio
836
836
  * Header row is always included. Standard CSV escaping (RFC 4180).
837
837
  * Default detail level: `'control'`.
838
838
  */
839
- declare function renderCsv(comparison: HDFComparison, options?: RenderOptions): string;
839
+ export declare function renderCsv(comparison: HDFComparison, options?: RenderOptions): string;
840
840
  //#endregion
841
841
  //#region src/renderers/index.d.ts
842
842
  /**
@@ -847,7 +847,7 @@ declare function renderCsv(comparison: HDFComparison, options?: RenderOptions):
847
847
  * @param options - Rendering options (detail level, filters, color)
848
848
  * @returns The rendered string
849
849
  */
850
- declare function render(comparison: HDFComparison, format: 'json' | 'markdown' | 'terminal' | 'csv', options?: RenderOptions): string;
850
+ export declare function render(comparison: HDFComparison, format: 'json' | 'markdown' | 'terminal' | 'csv', options?: RenderOptions): string;
851
851
  //#endregion
852
- export { type Annotation, type ApplyInputs, type ApplyResult, type ApplyWarning, type BaselineDiff, type ChangeReason, type ComparisonSummary, type ComponentDiff, type DetailLevel, type DiffOptions, type DiffStatus, type DiffSummary, EXIT_DETAILED_BASELINE_CHANGED, EXIT_DETAILED_DRIFT_ONLY, EXIT_DETAILED_ERROR, EXIT_DETAILED_FIXES_ONLY, EXIT_DETAILED_IDENTICAL, EXIT_DETAILED_MIXED, EXIT_DETAILED_REGRESSIONS_ONLY, EXIT_DIFFERENCES, EXIT_ERROR, EXIT_IDENTICAL, type EffectiveChecksum, type EventInputs, type FieldChange, type FoldResult, type HDFComparison, type HdfComparison, type HdfDiff, type KeyState, type MatchOptions, type MatchPair, type MatchResult, type MatchStrategy, type MatchingConfig, type PackageDiff, type RenderOptions, type RequirementDiff, type RequirementState, type SbomDiffResult, type Source, type ValidationResult, applyChangeEvents, changeEventFromPrevious, classifyChangeReasons, classifyDiffStatus, computeDetailedExitCode, computeDisposition, computeEffectiveChecksum, computeEffectiveImpact, computeEffectiveStatus, computeExitCode, computeSummary, createCciMatchStrategy, createExactIdStrategy, createFuzzyTitleStrategy, createMappedIdStrategy, createSrgCciTiebreakStrategy, createSrgDeterministicStrategy, createVendorFuzzyTitleStrategy, diffBaselines, diffHdf, diffSboms, diffSystems, foldChangeEventsIntoComparison, isV1Format, jaccardSimilarity, levenshteinDistance, matchRequirements, normalizeToV2, normalizedLevenshtein, render, renderCsv, renderJson, renderMarkdown, renderTerminal, tokenize, validateComparison };
852
+ export type { Annotation, ApplyInputs, ApplyResult, ApplyWarning, BaselineDiff, ChangeReason, ComparisonSummary, ComponentDiff, DetailLevel, DiffOptions, DiffStatus, DiffSummary, EffectiveChecksum, EventInputs, FieldChange, FoldResult, HDFComparison, HdfComparison, HdfDiff, KeyState, MatchOptions, MatchPair, MatchResult, MatchStrategy, MatchingConfig, PackageDiff, RenderOptions, RequirementDiff, RequirementState, SbomDiffResult, Source, ValidationResult };
853
853
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/sbom.ts","../src/types.ts","../src/diff.ts","../src/status.ts","../src/effective-checksum.ts","../src/change-event.ts","../src/apply-events.ts","../src/fold-events.ts","../src/summary.ts","../src/normalize.ts","../src/matching/types.ts","../src/matching/exact-id.ts","../src/matching/mapped-id.ts","../src/matching/cci-match.ts","../src/matching/fuzzy-match.ts","../src/matching/srg-deterministic.ts","../src/matching/srg-cci-tiebreak.ts","../src/matching/vendor-fuzzy-title.ts","../src/matching/index.ts","../src/validate.ts","../src/exit-codes.ts","../src/renderers/types.ts","../src/renderers/json.ts","../src/renderers/markdown.ts","../src/renderers/terminal.ts","../src/renderers/csv.ts","../src/renderers/index.ts"],"mappings":";;;;;;;;;;;;;;UAciB;EACf;EACA;EACA;EACA;EACA;EACA;;;;;UAMe;EACf,cAAc;EACd;EACA;EACA;EACA;;;;;;;;;;;iBAsBc,UAAU,iBAAiB,kBAAkB;;;;;;;;;;;;;;;;;;;;KCpCjD;;;;;;;;;;;;;;;KA8BA;;;;UAcK;;EAEf;;;;;;;;;;EAUA;;EAEA;;EAEA;;;;;;EAMA;;;;;UAwBe;;EAEf;;EAEA,OAAO;;EAEP,eAAe;;EAGf,QAAQ;;EAER,OAAO;;EAGP;;EAEA;;EAEA;;EAEA;;EAEA;;EAGA,cAAc;;EAGd;;EAEA;;EAGA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;UAOe;;EAEf;;EAEA;;EAEA,QAAQ;;EAER,OAAO;;EAEP,cAAc;;;;;UAMC;;EAEf;;EAEA;;EAEA;;EAEA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA,SAAS;;EAET,WAAW;;EAEX,SAAS;;EAET,eAAe;;EAEf,kBAAkB;;;EAGlB,iBAAiB;;;;;EAKjB,eALiB;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":["../src/sbom.ts","../src/types.ts","../src/diff.ts","../src/status.ts","../src/effective-checksum.ts","../src/change-event.ts","../src/apply-events.ts","../src/fold-events.ts","../src/summary.ts","../src/normalize.ts","../src/matching/types.ts","../src/matching/exact-id.ts","../src/matching/mapped-id.ts","../src/matching/cci-match.ts","../src/matching/fuzzy-match.ts","../src/matching/srg-deterministic.ts","../src/matching/srg-cci-tiebreak.ts","../src/matching/vendor-fuzzy-title.ts","../src/matching/index.ts","../src/validate.ts","../src/exit-codes.ts","../src/renderers/types.ts","../src/renderers/json.ts","../src/renderers/markdown.ts","../src/renderers/terminal.ts","../src/renderers/csv.ts","../src/renderers/index.ts"],"mappings":";;;;;;;;;;;;;;UAciB;EACf;EACA;EACA;EACA;EACA;EACA;;;;;UAMe;EACf,cAAc;EACd;EACA;EACA;EACA;;;;;;;;;;;wBAsBc,UAAU,iBAAiB,kBAAkB;;;;;;;;;;;;;;;;;;;;KCpCjD;;;;;;;;;;;;;;;KA8BA;;;;UAcK;;EAEf;;;;;;;;;;EAUA;;EAEA;;EAEA;;;;;;EAMA;;;;;UAwBe;;EAEf;;EAEA,OAAO;;EAEP,eAAe;;EAGf,QAAQ;;EAER,OAAO;;EAGP;;EAEA;;EAEA;;EAEA;;EAEA;;EAGA,cAAc;;EAGd;;EAEA;;EAGA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;UAOe;;EAEf;;EAEA;;EAEA,QAAQ;;EAER,OAAO;;EAEP,cAAc;;;;;UAMC;;EAEf;;EAEA;;EAEA;;EAEA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;;;;UAMe;;EAEf;;EAEA;;EAEA;;EAEA,SAAS;;EAET,WAAW;;EAEX,SAAS;;EAET,eAAe;;EAEf,kBAAkB;;;EAGlB,iBAAiB;;;;;EAKjB,eALiB;;EAOjB;;EAEA,QA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eSummary(requirements) {
132
132
  case "updated":
133
133
  summary.updated++;
134
134
  summary.matchedCount++;
135
- break;
136
135
  }
137
136
  return summary;
138
137
  }
@@ -961,6 +960,7 @@ function createSrgCciTiebreakStrategy() {
961
960
  //#region src/matching/vendor-fuzzy-title.ts
962
961
  /** Default threshold for accepting a Levenshtein match. */
963
962
  const DEFAULT_ACCEPT_THRESHOLD = .45;
963
+ const MAX_LEVENSHTEIN_LENGTH = 4096;
964
964
  /** Modal verbs that mark the start of compliance statements. */
965
965
  const COMPLIANCE_MODALS = /* @__PURE__ */ new Set([
966
966
  "must",
@@ -978,6 +978,7 @@ function levenshteinDistance(a, b) {
978
978
  const n = b.length;
979
979
  if (m === 0) return n;
980
980
  if (n === 0) return m;
981
+ if (m > MAX_LEVENSHTEIN_LENGTH || n > MAX_LEVENSHTEIN_LENGTH) return Math.max(m, n);
981
982
  let prev = new Array(n + 1);
982
983
  let curr = new Array(n + 1);
983
984
  for (let j = 0; j <= n; j++) prev[j] = j;
@@ -1519,22 +1520,24 @@ function computeFieldChanges(oldReq, newReq, trackedFields) {
1519
1520
  if (CVE_ECOSYSTEM_FIELDS.has(field)) continue;
1520
1521
  const oldVal = oldReq[field];
1521
1522
  const newVal = newReq[field];
1522
- if (JSON.stringify(oldVal) !== JSON.stringify(newVal)) if (oldVal === void 0 && newVal !== void 0) changes.push({
1523
- op: "add",
1524
- path: field,
1525
- newValue: newVal
1526
- });
1527
- else if (oldVal !== void 0 && newVal === void 0) changes.push({
1528
- op: "remove",
1529
- path: field,
1530
- oldValue: oldVal
1531
- });
1532
- else changes.push({
1533
- op: "replace",
1534
- path: field,
1535
- oldValue: oldVal,
1536
- newValue: newVal
1537
- });
1523
+ if (JSON.stringify(oldVal) !== JSON.stringify(newVal)) {
1524
+ if (oldVal === void 0 && newVal !== void 0) changes.push({
1525
+ op: "add",
1526
+ path: field,
1527
+ newValue: newVal
1528
+ });
1529
+ else if (oldVal !== void 0 && newVal === void 0) changes.push({
1530
+ op: "remove",
1531
+ path: field,
1532
+ oldValue: oldVal
1533
+ });
1534
+ else changes.push({
1535
+ op: "replace",
1536
+ path: field,
1537
+ oldValue: oldVal,
1538
+ newValue: newVal
1539
+ });
1540
+ }
1538
1541
  }
1539
1542
  changes.push(...diffCvssArray(oldReq["cvss"], newReq["cvss"]));
1540
1543
  changes.push(...diffEpss(oldReq["epss"], newReq["epss"]));
@@ -2240,22 +2243,24 @@ function computeComponentFieldChanges(oldObj, newObj, trackedFields) {
2240
2243
  for (const field of trackedFields) {
2241
2244
  const oldVal = oldObj[field];
2242
2245
  const newVal = newObj[field];
2243
- if (JSON.stringify(oldVal) !== JSON.stringify(newVal)) if (oldVal === void 0 && newVal !== void 0) changes.push({
2244
- op: "add",
2245
- path: field,
2246
- newValue: newVal
2247
- });
2248
- else if (oldVal !== void 0 && newVal === void 0) changes.push({
2249
- op: "remove",
2250
- path: field,
2251
- oldValue: oldVal
2252
- });
2253
- else changes.push({
2254
- op: "replace",
2255
- path: field,
2256
- oldValue: oldVal,
2257
- newValue: newVal
2258
- });
2246
+ if (JSON.stringify(oldVal) !== JSON.stringify(newVal)) {
2247
+ if (oldVal === void 0 && newVal !== void 0) changes.push({
2248
+ op: "add",
2249
+ path: field,
2250
+ newValue: newVal
2251
+ });
2252
+ else if (oldVal !== void 0 && newVal === void 0) changes.push({
2253
+ op: "remove",
2254
+ path: field,
2255
+ oldValue: oldVal
2256
+ });
2257
+ else changes.push({
2258
+ op: "replace",
2259
+ path: field,
2260
+ oldValue: oldVal,
2261
+ newValue: newVal
2262
+ });
2263
+ }
2259
2264
  }
2260
2265
  return changes;
2261
2266
  }
@@ -2315,13 +2320,14 @@ function computeDisposition(requirement, referenceTimestamp) {
2315
2320
  * timestamp.
2316
2321
  */
2317
2322
  async function computeEffectiveChecksum(requirement, referenceTimestamp) {
2323
+ const canonical = JSON.stringify({
2324
+ status: computeEffectiveStatus(requirement, referenceTimestamp),
2325
+ impact: computeEffectiveImpact(requirement, referenceTimestamp),
2326
+ disposition: computeDisposition(requirement, referenceTimestamp)
2327
+ });
2318
2328
  return {
2319
2329
  algorithm: "sha256",
2320
- value: await sha256(JSON.stringify({
2321
- status: computeEffectiveStatus(requirement, referenceTimestamp),
2322
- impact: computeEffectiveImpact(requirement, referenceTimestamp),
2323
- disposition: computeDisposition(requirement, referenceTimestamp)
2324
- }))
2330
+ value: await sha256(canonical)
2325
2331
  };
2326
2332
  }
2327
2333
  //#endregion
@@ -3229,20 +3235,21 @@ function diffSboms(oldJson, newJson) {
3229
3235
  for (const [key, oldPkg] of oldMap) {
3230
3236
  seen.add(key);
3231
3237
  const newPkg = newMap.get(key);
3232
- if (newPkg) if (oldPkg.version !== newPkg.version) diffs.push({
3233
- purl: newPkg.purl || newPkg.name,
3234
- name: newPkg.name,
3235
- state: "updated",
3236
- oldVersion: oldPkg.version,
3237
- newVersion: newPkg.version,
3238
- licenses: newPkg.licenses.length > 0 ? newPkg.licenses : void 0
3239
- });
3240
- else diffs.push({
3241
- purl: oldPkg.purl || oldPkg.name,
3242
- name: oldPkg.name,
3243
- state: "unchanged"
3244
- });
3245
- else diffs.push({
3238
+ if (newPkg) {
3239
+ if (oldPkg.version !== newPkg.version) diffs.push({
3240
+ purl: newPkg.purl || newPkg.name,
3241
+ name: newPkg.name,
3242
+ state: "updated",
3243
+ oldVersion: oldPkg.version,
3244
+ newVersion: newPkg.version,
3245
+ licenses: newPkg.licenses.length > 0 ? newPkg.licenses : void 0
3246
+ });
3247
+ else diffs.push({
3248
+ purl: oldPkg.purl || oldPkg.name,
3249
+ name: oldPkg.name,
3250
+ state: "unchanged"
3251
+ });
3252
+ } else diffs.push({
3246
3253
  purl: oldPkg.purl || oldPkg.name,
3247
3254
  name: oldPkg.name,
3248
3255
  state: "removed",
@@ -3271,9 +3278,7 @@ function diffSboms(oldJson, newJson) {
3271
3278
  case "updated":
3272
3279
  updated++;
3273
3280
  break;
3274
- case "unchanged":
3275
- unchanged++;
3276
- break;
3281
+ case "unchanged": unchanged++;
3277
3282
  }
3278
3283
  return {
3279
3284
  packageDiffs: diffs,