Documentation
¶
Index ¶
Constants ¶
View Source
const ProjectStatusQuarantined = "quarantined"
ProjectStatusQuarantined is the RegistryResponse.ProjectStatus value indicating the registry has frozen the project (it exists but is blocked from install pending a malware/abuse review).
Variables ¶
This section is empty.
Functions ¶
func ConvertToType ¶
ConvertToType converts data to a typed struct. If data is already the target type, returns it directly. If data is a map (from YAML deserialization), converts via JSON roundtrip.
Types ¶
type EcosystemUtils ¶
type EcosystemUtils interface {
NormalizeName(name string) string
CompareVersions(a, b string) (int, error)
}
EcosystemUtils defines shared utilities for ecosystem-specific operations. Used by consumers that only need name normalization or version comparison.
func MustGetEcosystemUtils ¶
func MustGetEcosystemUtils(utils map[string]EcosystemUtils, ecosystem string) EcosystemUtils
type Language ¶
type Language interface {
FetchPackageFromRegistry(ctx context.Context, pkg models.PackageInfo) (*RegistryResponse, error)
ExtractPackageMetadata(ctx context.Context, pkg models.PackageInfo, registryData any) (*models.PackageMetadata, *string, *string, error)
ExtractVersionHistory(ctx context.Context, pkg models.PackageInfo, registryData any) (*models.VersionMetadata, error)
// NormalizeName normalizes a package name according to ecosystem-specific rules.
// For npm: case-sensitive (trim whitespace only)
// For pypi: PEP 503 normalization (lowercase, [-_.] -> -)
NormalizeName(name string) string
// Metadata returns the static metadata for this language ecosystem
Metadata() *metadata.Metadata
DependencyFilePatterns() []string
CompareVersions(a, b string) (int, error)
ExtractPackageArchive(artifactPath, destDir string) error
ExtractInstallScriptsFromFiles(files map[string]string) ([]string, error)
}
type RegistryResponse ¶
type RegistryResponse struct {
// Data is the parsed response from the registry API (e.g., NPMPackageData, PyPIPackageResponse).
Data any `json:"data,omitempty"`
// ReleaseData holds release/version history from the full package endpoint.
// For PyPI with a version query, Data comes from /pypi/{name}/{version}/json
// while ReleaseData comes from /pypi/{name}/json.
// Nil when the full endpoint already provides both (npm, pypi without version).
ReleaseData any `json:"release_data,omitempty"`
// StatusCode is the HTTP status code from the registry API.
StatusCode int `json:"status_code"`
// Headers contains selected HTTP response headers.
Headers map[string]string `json:"headers,omitempty"`
// ProjectStatus is the registry's lifecycle status for the project when it exists but is
// not normally installable — e.g. "quarantined" (frozen by the registry pending a
// malware/abuse review). Currently only populated for PyPI via the PEP 792 project-status
// marker; empty for ecosystems that expose no such signal.
ProjectStatus string `json:"project_status,omitempty"`
}
RegistryResponse contains the parsed API response and metadata from a package registry fetch.
Click to show internal directories.
Click to hide internal directories.