// ============================================================================ // Catalog Component Interfaces // These are the prop shapes accepted by sg-* components. // They are decoupled from backend models for reusability. // ============================================================================ export type TSgProtocol = 'oci' | 'npm' | 'maven' | 'cargo' | 'composer' | 'pypi' | 'rubygems'; export type TSgOrgRole = 'owner' | 'admin' | 'member'; export interface ISgStat { title: string; value: string | number; icon?: string; trend?: 'up' | 'down' | 'neutral'; trendValue?: string; } export interface ISgOrganization { id: string; name: string; displayName: string; description?: string; avatarUrl?: string; isPublic: boolean; memberCount: number; createdAt: string; } export interface ISgOrganizationDetail extends ISgOrganization { website?: string; usedStorageBytes: number; storageQuotaBytes: number; } export interface ISgOrganizationMember { userId: string; role: TSgOrgRole; addedAt: string; user: { username: string; displayName: string; avatarUrl?: string; } | null; } export interface ISgOrgRedirect { id: string; oldName: string; organizationId: string; createdAt: string; } export interface ISgRepository { id: string; organizationId: string; name: string; description?: string; protocol: TSgProtocol; visibility: 'public' | 'private' | 'internal'; isPublic: boolean; packageCount: number; createdAt: string; } export interface ISgPackage { id: string; name: string; description?: string; protocol: TSgProtocol; organizationId: string; repositoryId: string; latestVersion?: string; isPrivate: boolean; downloadCount: number; updatedAt: string; } export interface ISgPackageDetail extends ISgPackage { distTags: Record; versions: string[]; starCount: number; storageBytes: number; createdAt: string; } export interface ISgPackageVersion { version: string; publishedAt: string; size: number; downloads: number; } export interface ISgToken { id: string; name: string; tokenPrefix: string; protocols: TSgProtocol[]; scopes: ISgTokenScope[]; organizationId?: string; expiresAt?: string; lastUsedAt?: string; usageCount: number; createdAt: string; } export interface ISgTokenScope { protocol: TSgProtocol | '*'; organizationId?: string; actions: ('read' | 'write' | 'delete' | '*')[]; } export interface ISgUser { id: string; email: string; username: string; displayName: string; avatarUrl?: string; isSystemAdmin: boolean; } export interface ISgSession { id: string; userAgent: string; ipAddress: string; isValid: boolean; lastActivityAt: string; createdAt: string; } export interface ISgAuthProvider { id: string; name: string; displayName: string; type: 'oidc' | 'ldap'; } export interface ISgAuthProviderDetail extends ISgAuthProvider { status: 'active' | 'disabled' | 'testing'; priority: number; createdAt: string; updatedAt: string; lastTestedAt?: string; lastTestResult?: 'success' | 'failure'; lastTestError?: string; } export interface ISgPlatformSettings { localAuthEnabled: boolean; allowUserRegistration: boolean; sessionDurationMinutes: number; defaultProviderId?: string; } export interface ISgDashboardStats { organizationCount: number; packageCount: number; totalDownloads: number; tokenCount: number; }