enrichment

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package enrichment adapts github.com/git-pkgs/enrichment to the proxy's enrichment API. It builds package URLs from the proxy's ecosystem names, normalizes licenses for display and treats retracted versions as yanked.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnrichmentResult

type EnrichmentResult struct {
	Package         *PackageInfo
	Version         *VersionInfo
	Vulnerabilities []VulnInfo
	IsOutdated      bool
	LicenseCategory shared.LicenseCategory
}

EnrichmentResult contains all enrichment data for a package version.

type PackageInfo

type PackageInfo = shared.PackageInfo

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service looks up package, version and vulnerability data.

func New

func New(logger *slog.Logger) *Service

New creates a new enrichment service.

func (*Service) BulkEnrichPackages

func (s *Service) BulkEnrichPackages(ctx context.Context, packages []struct{ Ecosystem, Name string }) map[string]*PackageInfo

BulkEnrichPackages fetches metadata for multiple packages in parallel, keyed by PURL. Packages that can't be fetched are left out.

func (*Service) CheckVulnerabilities

func (s *Service) CheckVulnerabilities(ctx context.Context, ecosystem, name, version string) ([]VulnInfo, error)

CheckVulnerabilities queries for vulnerabilities affecting a package version.

func (*Service) EnrichFull

func (s *Service) EnrichFull(ctx context.Context, ecosystem, name, version string) (*EnrichmentResult, error)

EnrichFull fetches package, version and vulnerability data for a package version concurrently. Unsupported vulnerability identities return an error; other failed lookups are logged and left empty.

func (*Service) EnrichPackage

func (s *Service) EnrichPackage(ctx context.Context, ecosystem, name string) (*PackageInfo, error)

EnrichPackage fetches metadata for a package from its registry. It returns nil without an error when the registry doesn't have the package or the name can't be expressed as a PURL.

func (*Service) EnrichVersion

func (s *Service) EnrichVersion(ctx context.Context, ecosystem, name, version string) (*VersionInfo, error)

EnrichVersion fetches metadata for a specific package version.

func (*Service) GetLatestVersion

func (s *Service) GetLatestVersion(ctx context.Context, ecosystem, name string) (string, error)

GetLatestVersion fetches the latest version for a package.

type VersionInfo

type VersionInfo = shared.VersionInfo

type VulnInfo

type VulnInfo = shared.VulnInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL