/** * Coolify SDK — Fluent, resource-based API for Coolify. * * Every parameter from CoolifyService is exposed. Nothing is lost. * * @module */ import { CoolifyService } from "./coolify/index.js"; import type { ICoolifyAppOptions, ICoolifyApplication, ICoolifyDatabase, ICoolifyDatabaseBackup, ICoolifyDeleteResult, ICoolifyDeployment, ICoolifyDeployResult, ICoolifyDestination, ICoolifyEnvironment, ICoolifyLogs, ICoolifyLogsOptions, ICoolifyPrivateKey, ICoolifyProject, ICoolifyServer, ICoolifyServerDomain, ICoolifyServerResource, ICoolifyService as ICoolifyServiceType, ICoolifyTeam, ICoolifyUpdateOptions, ICoolifyVersion, IProgressCallback } from "./coolify/types.js"; import type { ICoolifyEnvVar } from "./coolify/index.js"; /** SDK configuration options. */ export interface ICoolifyOptions { /** Coolify instance URL (e.g., https://coolify.example.com) */ url: string; /** API token (generate in Coolify > Settings > API Tokens) */ token: string; } /** Cascade delete options. */ export interface IDeleteOptions { deleteConfigurations?: boolean; deleteVolumes?: boolean; dockerCleanup?: boolean; deleteConnectedNetworks?: boolean; } /** Pagination options. */ export interface IPaginationOptions { page?: number; perPage?: number; } declare class ApplicationsResource { private svc; constructor(svc: CoolifyService); /** List all applications. Supports filtering and pagination. */ list(options?: { teamId?: string; projectId?: string; } & IPaginationOptions): Promise; listSummaries(): Promise<{ uuid: string; name: string; status: string; fqdn: string | null; }[]>; /** Get a single application by UUID with full details (including settings and watch_paths). */ get(uuid: string): Promise; /** Resolve application by name, domain, or UUID. */ resolve(query: string): Promise; /** Create a new application. All ICoolifyAppOptions supported. */ create(options: ICoolifyAppOptions, onProgress?: IProgressCallback): Promise; /** Deploy an application. Supports force rebuild and progress tracking. */ deploy(uuid: string, options?: { force?: boolean; tag?: string; }, onProgress?: IProgressCallback): Promise; /** Start application. Supports force and instant_deploy. */ start(uuid: string, options?: { force?: boolean; instantDeploy?: boolean; }): Promise; stop(uuid: string): Promise; restart(uuid: string): Promise; /** Delete application with optional cascade options. */ delete(uuid: string, options?: IDeleteOptions): Promise; /** Update application configuration. All ICoolifyUpdateOptions supported. */ update(uuid: string, options: ICoolifyUpdateOptions): Promise; /** Get application logs. Supports lines, serviceName, follow. */ logs(uuid: string, options?: ICoolifyLogsOptions): Promise; /** Get deployment history with optional pagination. */ deployments(uuid: string, skip?: number, take?: number): Promise; exec(uuid: string, command: string): Promise<{ message?: string; response?: string; }>; envVars(uuid: string): Promise; setEnv(uuid: string, key: string, value: string, isBuildTime?: boolean): Promise; bulkSetEnv(uuid: string, vars: Array<{ key: string; value: string; is_preview?: boolean; }>): Promise<{ message: string; }>; deleteEnv(uuid: string, key: string): Promise; /** * Sync environment variables from a local .env file to Coolify. * * @param uuid - Application UUID * @param options - Sync options * @returns Sync result with changes applied */ syncEnv(uuid: string, options?: { /** Path to .env file (default: reads from .env in cwd) */ filePath?: string; /** Preview changes without applying */ dryRun?: boolean; /** Delete vars not in file */ prune?: boolean; /** Callback for progress updates (optional) */ onProgress?: (update: { type: 'add' | 'update' | 'remove'; key: string; value?: string; }) => void; }): Promise<{ added: Array<{ key: string; value: string; }>; updated: Array<{ key: string; value: string; oldValue: string; }>; removed: string[]; skipped: number; }>; /** * Parse .env file content into a Map. * Delegates to the shared utility in `./utils/env-parser.js` so the SDK * and CLI use a single implementation. * * @param content - The .env file content * @returns Map of environment variables */ private parseEnvContent; } declare class DatabasesResource { private svc; constructor(svc: CoolifyService); list(options?: IPaginationOptions): Promise; listSummaries(): Promise<{ uuid: string; name: string; type: string; status: string; }[]>; get(uuid: string): Promise; create(type: string, data: Record): Promise<{ uuid: string; }>; update(uuid: string, data: Record): Promise; start(uuid: string): Promise<{ message: string; }>; stop(uuid: string): Promise<{ message: string; }>; restart(uuid: string): Promise<{ message: string; }>; /** Delete with optional cascade options. */ delete(uuid: string, options?: IDeleteOptions): Promise; backups(uuid: string): Promise; getBackup(dbUuid: string, backupUuid: string): Promise; createBackup(dbUuid: string, data: Record): Promise; deleteBackup(dbUuid: string, backupUuid: string): Promise<{ message: string; }>; /** List env vars for a database. */ envVars(uuid: string): Promise; /** * Bulk set (create-or-update) env vars for a database. * * Note: the database schema is narrower than applications — only * `is_literal`, `is_multiline`, `is_shown_once` are accepted. No * `is_preview` / `is_buildtime` / `is_runtime`. */ bulkSetEnv(uuid: string, vars: Array<{ key: string; value: string; is_literal?: boolean; is_multiline?: boolean; is_shown_once?: boolean; }>): Promise<{ message: string; }>; /** Delete a database env var by key. Resolves key → UUID, then DELETE. */ deleteEnv(uuid: string, key: string): Promise; } declare class ServicesResource { private svc; constructor(svc: CoolifyService); list(options?: IPaginationOptions): Promise; listSummaries(): Promise<{ uuid: string; name: string; type: string; status: string; }[]>; get(uuid: string): Promise; create(data: Record): Promise<{ uuid: string; }>; update(uuid: string, data: Record): Promise; start(uuid: string): Promise<{ message: string; }>; stop(uuid: string): Promise<{ message: string; }>; restart(uuid: string): Promise<{ message: string; }>; /** Delete with optional cascade options. */ delete(uuid: string, options?: IDeleteOptions): Promise; envVars(uuid: string): Promise; /** * Sets (creates or updates) a single env var for a service. * * Delegates to the bulk endpoint `PATCH /services/{uuid}/envs/bulk`, * which has create-or-update semantics — calling this for the same key * a second time updates the override value rather than failing with * 409 "already exists" (which is what the raw `POST /services/{uuid}/envs` * endpoint does). Mirrors `ApplicationsResource.setEnv`. * * @param uuid - Service UUID * @param data - Env var data (key, value, is_preview) */ setEnv(uuid: string, data: { key: string; value: string; is_preview?: boolean; }): Promise<{ message: string; }>; /** * Bulk set (create-or-update) env vars for a service. * Mirrors `ApplicationsResource.bulkSetEnv`. * * @param uuid - Service UUID * @param vars - Array of env var definitions to upsert */ bulkSetEnv(uuid: string, vars: Array<{ key: string; value: string; is_preview?: boolean; is_buildtime?: boolean; is_runtime?: boolean; }>): Promise<{ message: string; }>; /** Delete a service env var by key. Resolves key → UUID, then DELETE. */ deleteEnv(uuid: string, key: string): Promise; } declare class ServersResource { private svc; constructor(svc: CoolifyService); list(options?: IPaginationOptions): Promise; listSummaries(): Promise<{ uuid: string; name: string; ip: string; is_reachable: boolean; }[]>; resolve(query: string): Promise; get(uuid: string): Promise; create(data: Record): Promise<{ uuid: string; }>; delete(uuid: string): Promise<{ message: string; }>; resources(uuid: string): Promise; domains(uuid: string): Promise; destinations(uuid: string): Promise; validate(uuid: string): Promise<{ message: string; }>; } declare class ProjectsResource { private svc; constructor(svc: CoolifyService); list(options?: IPaginationOptions): Promise; create(name: string, description?: string): Promise; update(uuid: string, data: { name?: string; description?: string; }): Promise; delete(uuid: string): Promise<{ message: string; }>; environments(projectUuid: string): Promise; createEnvironment(projectUuid: string, data: { name: string; description?: string; }): Promise<{ uuid: string; }>; } declare class TeamsResource { private svc; constructor(svc: CoolifyService); list(options?: IPaginationOptions): Promise; current(): Promise; get(id: number): Promise; members(teamId: number): Promise<{ id: number; name: string; email: string; }[]>; } declare class KeysResource { private svc; constructor(svc: CoolifyService); list(): Promise; get(uuid: string): Promise; create(data: { name: string; private_key: string; description?: string; }): Promise<{ uuid: string; }>; update(uuid: string, data: { name?: string; private_key?: string; description?: string; }): Promise; delete(uuid: string): Promise<{ message: string; }>; } declare class DeploymentsResource { private svc; constructor(svc: CoolifyService); active(options?: IPaginationOptions): Promise; get(uuid: string): Promise; /** Get deployment with build logs. */ logs(uuid: string): Promise<{ status: string; logs: string; deployment_uuid: string; }>; cancel(uuid: string): Promise<{ message: string; }>; } declare class DiagnoseResource { private svc; constructor(svc: CoolifyService); app(query: string): Promise<{ application: ICoolifyApplication; recentDeployments: ICoolifyDeployment[]; envVarCount: number; recentLogs: string[]; issues: string[]; }>; server(query: string): Promise<{ server: ICoolifyServer; resources: ICoolifyServerResource[]; domains: ICoolifyServerDomain[]; issues: string[]; }>; infrastructure(): Promise<{ totalServers: number; totalApps: number; totalDatabases: number; totalServices: number; issues: Array<{ type: string; resource: string; uuid: string; message: string; }>; }>; /** Analyze a failed deployment — extracts errors from build logs. */ deployFailure(deploymentUuid: string): Promise; } /** * Network diagnostics — inspect Docker networks, proxy, DNS, connectivity. */ declare class NetworkResource { private svc; constructor(svc: CoolifyService); /** * Inspect container network environment. * * @param appUuid - Application UUID * @param servicesToTest - Service names to test connectivity (e.g., ['db', 'redis']) */ inspect(appUuid: string, servicesToTest?: string[]): Promise; } declare class BatchResource { private svc; constructor(svc: CoolifyService); restartProject(projectUuid: string): Promise<{ total: number; succeeded: number; failed: string[]; }>; redeployProject(projectUuid: string, force?: boolean): Promise<{ total: number; succeeded: number; failed: string[]; }>; stopAll(): Promise<{ total: number; succeeded: number; failed: string[]; }>; } declare class GitHubAppsResource { private svc; constructor(svc: CoolifyService); list(options?: IPaginationOptions): Promise; create(data: Record): Promise<{ id: number; uuid: string; }>; update(id: number, data: Record): Promise<{ message: string; }>; delete(id: number): Promise<{ message: string; }>; } /** * Coolify SDK — The main entry point for interacting with a Coolify instance. * * Every parameter from the internal CoolifyService is exposed. * Nothing is lost — progress callbacks, pagination, cascade deletes, all supported. */ export declare class Coolify { /** @internal */ readonly svc: CoolifyService; private initialized; readonly applications: ApplicationsResource; readonly databases: DatabasesResource; readonly services: ServicesResource; readonly servers: ServersResource; readonly projects: ProjectsResource; readonly teams: TeamsResource; readonly keys: KeysResource; readonly deployments: DeploymentsResource; readonly diagnose: DiagnoseResource; readonly network: NetworkResource; readonly batch: BatchResource; readonly githubApps: GitHubAppsResource; constructor(options?: ICoolifyOptions); static fromEnv(): Coolify; private ensureInit; version(): Promise; } export {}; //# sourceMappingURL=sdk.d.ts.map