128 lines
3.4 KiB
TypeScript
128 lines
3.4 KiB
TypeScript
/**
|
|
* Maven registry type definitions
|
|
* Supports Maven repository protocol for Java artifacts
|
|
*/
|
|
|
|
/**
|
|
* Maven coordinate system (GAV + optional classifier)
|
|
* Example: com.example:my-library:1.0.0:sources:jar
|
|
*/
|
|
export interface IMavenCoordinate {
|
|
groupId: string; // e.g., "com.example.myapp"
|
|
artifactId: string; // e.g., "my-library"
|
|
version: string; // e.g., "1.0.0" or "1.0-SNAPSHOT"
|
|
classifier?: string; // e.g., "sources", "javadoc"
|
|
extension: string; // e.g., "jar", "war", "pom"
|
|
}
|
|
|
|
/**
|
|
* Maven metadata (maven-metadata.xml) structure
|
|
* Contains version list and latest/release information
|
|
*/
|
|
export interface IMavenMetadata {
|
|
groupId: string;
|
|
artifactId: string;
|
|
versioning: IMavenVersioning;
|
|
}
|
|
|
|
/**
|
|
* Maven versioning information
|
|
*/
|
|
export interface IMavenVersioning {
|
|
latest?: string; // Latest version (including SNAPSHOTs)
|
|
release?: string; // Latest release version (excluding SNAPSHOTs)
|
|
versions: string[]; // List of all versions
|
|
lastUpdated: string; // Format: yyyyMMddHHmmss
|
|
snapshot?: IMavenSnapshot; // For SNAPSHOT versions
|
|
snapshotVersions?: IMavenSnapshotVersion[]; // For SNAPSHOT builds
|
|
}
|
|
|
|
/**
|
|
* SNAPSHOT build information
|
|
*/
|
|
export interface IMavenSnapshot {
|
|
timestamp: string; // Format: yyyyMMdd.HHmmss
|
|
buildNumber: number; // Incremental build number
|
|
}
|
|
|
|
/**
|
|
* SNAPSHOT version entry
|
|
*/
|
|
export interface IMavenSnapshotVersion {
|
|
classifier?: string;
|
|
extension: string;
|
|
value: string; // Timestamped version
|
|
updated: string; // Format: yyyyMMddHHmmss
|
|
}
|
|
|
|
/**
|
|
* Checksums for Maven artifacts
|
|
* Maven requires separate checksum files for each artifact
|
|
*/
|
|
export interface IChecksums {
|
|
md5: string; // MD5 hash
|
|
sha1: string; // SHA-1 hash (required)
|
|
sha256?: string; // SHA-256 hash (optional)
|
|
sha512?: string; // SHA-512 hash (optional)
|
|
}
|
|
|
|
/**
|
|
* Maven artifact file information
|
|
*/
|
|
export interface IMavenArtifactFile {
|
|
filename: string; // Full filename with extension
|
|
data: Buffer; // File content
|
|
coordinate: IMavenCoordinate; // Parsed GAV coordinates
|
|
checksums?: IChecksums; // Calculated checksums
|
|
}
|
|
|
|
/**
|
|
* Maven upload request
|
|
* Contains all files for a single version (JAR, POM, sources, etc.)
|
|
*/
|
|
export interface IMavenUploadRequest {
|
|
groupId: string;
|
|
artifactId: string;
|
|
version: string;
|
|
files: IMavenArtifactFile[];
|
|
}
|
|
|
|
/**
|
|
* Maven protocol configuration
|
|
*/
|
|
export interface IMavenProtocolConfig {
|
|
enabled: boolean;
|
|
basePath: string; // Default: '/maven'
|
|
features?: {
|
|
snapshots?: boolean; // Support SNAPSHOT versions (default: true)
|
|
checksums?: boolean; // Auto-generate checksums (default: true)
|
|
metadata?: boolean; // Auto-generate maven-metadata.xml (default: true)
|
|
allowedExtensions?: string[]; // Allowed file extensions (default: jar, war, pom, etc.)
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Maven POM (Project Object Model) minimal structure
|
|
* Only essential fields for validation
|
|
*/
|
|
export interface IMavenPom {
|
|
modelVersion: string; // Always "4.0.0"
|
|
groupId: string;
|
|
artifactId: string;
|
|
version: string;
|
|
packaging?: string; // jar, war, pom, etc.
|
|
name?: string;
|
|
description?: string;
|
|
}
|
|
|
|
/**
|
|
* Maven repository search result
|
|
*/
|
|
export interface IMavenSearchResult {
|
|
groupId: string;
|
|
artifactId: string;
|
|
latestVersion: string;
|
|
versions: string[];
|
|
lastUpdated: string;
|
|
}
|