Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ The package exports the following TypeScript types:
- `UnknownComponentMetadata` - Metadata for an unknown/unresolvable component, carrying only an `unknownReason`
- `ComponentMetadata` - Union of `EolScanComponentMetadata` and `UnknownComponentMetadata`; the type of `EolScanComponent.metadata`
- `UnknownReason` - Reason a component is unknown (`not_identifiable`, `no_listed_versions`, `unsupported_ecosystem`, `queued`)
- `EolScanComponent` - Component data for EOL scanning with metadata, PURL, and optional NES remediation
- `DependencySummary` - Dependency graph classification for a component; individual classifications may be unknown, while a `null` summary means the SBOM graph could not be parsed
- `EolScanComponent` - Component data for EOL scanning with metadata, PURL, dependency summary, and optional remediation details
- `EolReportMetadata` - Report-level metadata including component counts
- `EolReport` - Complete EOL scan report with components and metadata
- `EolReportQueryResponse` - GraphQL response type for EOL report queries
Expand Down
34 changes: 34 additions & 0 deletions src/types/eol-scan.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { DependencySummary, EolScanComponent } from './eol-scan.js';

type Equal<Left, Right> =
(<Value>() => Value extends Left ? 1 : 2) extends <
Value,
>() => Value extends Right ? 1 : 2
? true
: false;

type Assert<Condition extends true> = Condition;

export type DependencySummaryMatchesApiContract = Assert<
Equal<
DependencySummary,
{
directDependency: boolean | null;
transitiveDependency: boolean | null;
prodDependency: boolean | null;
devDependency: boolean | null;
dependencies: string[];
}
>
>;

export type ComponentDependencySummaryMatchesApiContract = Assert<
Equal<EolScanComponent['dependencySummary'], DependencySummary | null>
>;

export type ComponentDependencySummaryIsRequired = Assert<
Equal<
{} extends Pick<EolScanComponent, 'dependencySummary'> ? true : false,
false
>
>;
9 changes: 9 additions & 0 deletions src/types/eol-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,18 @@ export interface Remediation {
target?: RemediationTarget;
}

export interface DependencySummary {
directDependency: boolean | null;
transitiveDependency: boolean | null;
prodDependency: boolean | null;
devDependency: boolean | null;
dependencies: string[];
}

export interface EolScanComponent {
metadata: ComponentMetadata | null;
purl: string;
dependencySummary: DependencySummary | null;
nesRemediation?: NesRemediation | null;
remediations?: Remediation[] | null;
}
Expand Down
Loading