/**
* Cloudron API TypeScript Definitions
* MVP scope: listApps + getApp endpoints
*/
/**
* Configuration for CloudronClient - enables DI for testing
*/
export interface CloudronClientConfig {
baseUrl: string;
token: string;
}
/**
* App manifest subset containing metadata
*/
export interface AppManifest {
id: string;
version: string;
title: string;
description: string;
tagline?: string;
website?: string;
author?: string;
minBoxVersion?: string;
memoryLimit?: number;
addons?: Record<string, unknown>;
}
/**
* Manifest validation result for F23a
*/
export interface ManifestValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
}
/**
* App installation parameters for F23b
*/
export interface InstallAppParams {
manifestId: string;
location: string;
domain: string;
portBindings?: Record<string, number>;
accessRestriction: string | null;
env?: Record<string, string>;
}
/**
* Cloudron App representation
*/
export interface App {
id: string;
appStoreId: string;
installationState: 'pending_install' | 'installed' | 'pending_configure' | 'pending_uninstall' | 'pending_restore' | 'error';
installationProgress: string;
runState: 'running' | 'stopped' | 'dead';
health: 'healthy' | 'unhealthy' | 'unknown';
location: string;
domain: string;
fqdn: string;
accessRestriction: string | null;
manifest: AppManifest;
portBindings: Record<string, number> | null;
iconUrl: string | null;
memoryLimit: number;
creationTime: string;
}
/**
* API response wrapper for listing apps
*/
export interface AppsResponse {
apps: App[];
}
/**
* API response wrapper for single app
*/
export interface AppResponse {
app: App;
}
/**
* System status response from /api/v1/cloudron/status
*/
export interface SystemStatus {
version: string;
apiServerOrigin: string;
adminFqdn: string;
provider: string;
cloudronName: string;
isDemo: boolean;
disk?: {
total: number;
used: number;
free: number;
percent: number;
};
}
/**
* Extended Cloudron status with full system information (for testing)
*/
export interface CloudronStatus extends SystemStatus {
boxVersionsUrl?: string;
webServerOrigin?: string;
fqdn?: string;
isCustomDomain?: boolean;
memory?: {
total: number;
used: number;
free: number;
percent: number;
};
update?: any;
backup?: {
lastBackupTime: string;
lastBackupId: string;
};
}
/**
* Storage information for pre-flight disk space checks
*/
export interface StorageInfo {
available_mb: number;
total_mb: number;
used_mb: number;
sufficient: boolean;
warning: boolean;
critical: boolean;
}
/**
* Task status for async operations
*/
export interface TaskStatus {
id: string;
state: 'pending' | 'running' | 'success' | 'error' | 'cancelled';
progress: number;
message: string;
result?: unknown;
error?: {
message: string;
code?: string;
};
}
/**
* Operation types for pre-flight validation
*/
export type ValidatableOperation = 'uninstall_app' | 'delete_user' | 'restore_backup';
/**
* Validation result for destructive operations
*/
export interface ValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
recommendations: string[];
}
/**
* Domain configuration from Cloudron domain system
*/
export interface Domain {
domain: string;
zoneName: string;
provider: string;
config: Record<string, unknown>;
tlsConfig: {
provider: string;
wildcard: boolean;
};
wellKnown: null | unknown;
fallbackCertificate: {
cert: string;
};
}
/**
* Backup metadata from Cloudron backup system
*/
export interface Backup {
id: string;
creationTime: string;
version: string;
type: 'app' | 'box';
state: 'creating' | 'created' | 'uploading' | 'uploaded' | 'error';
size?: number;
appCount?: number;
dependsOn?: string[];
errorMessage?: string;
}
/**
* API response wrapper for listing backups
*/
export interface BackupsResponse {
backups: Backup[];
}
/**
* App Store search result
*/
export interface AppStoreApp {
id: string;
name: string;
description: string;
version: string;
iconUrl: string | null;
installCount?: number;
relevanceScore?: number;
}
/**
* API response wrapper for App Store search
*/
export interface AppStoreResponse {
apps: AppStoreApp[];
}
/**
* Cloudron User representation
*/
export interface User {
id: string;
email: string;
username: string;
role: 'admin' | 'user' | 'guest';
createdAt: string;
}
/**
* API response wrapper for listing users
*/
export interface UsersResponse {
users: User[];
}
/**
* Log type enum for cloudron_get_logs
*/
export type LogType = 'app' | 'service';
/**
* Log entry with parsed timestamp and severity
*/
export interface LogEntry {
timestamp: string;
severity: string;
message: string;
}
/**
* API response wrapper for logs
*/
export interface LogsResponse {
logs: string[];
}
/**
* App configuration object for updating app settings
*/
export interface AppConfig {
env?: Record<string, string>;
memoryLimit?: number;
accessRestriction?: string | null;
[key: string]: unknown;
}
/**
* API response for app configuration
*/
export interface ConfigureAppResponse {
app: App;
restartRequired: boolean;
}
/**
* Validation result for app manifest (pre-flight safety check for installation)
*/
export interface ManifestValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
}
//# sourceMappingURL=types.d.ts.map