UNPKG

forge-deploy-cli

Version:

Professional CLI for local deployments with automatic subdomain routing, SSL certificates, and infrastructure management

93 lines 3.12 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ForgeApiService = void 0; const axios_1 = __importDefault(require("axios")); class ForgeApiService { constructor(baseURL = 'https://api.forgecli.tech') { this.client = axios_1.default.create({ baseURL, headers: { 'Content-Type': 'application/json', }, timeout: 30000, }); this.client.interceptors.request.use((config) => { if (this.apiKey) { config.headers.Authorization = `Bearer ${this.apiKey}`; } return config; }); } setApiKey(apiKey) { this.apiKey = apiKey; } async login(email, password) { const response = await this.client.post('/api/auth/login', { email, password, }); return response.data; } async signup(email, password, username) { const response = await this.client.post('/api/auth/signup', { email, password, username, }); return response.data; } async verifyApiKey() { const response = await this.client.get('/api/auth/verify'); return response.data; } async createDeployment(deploymentData) { const response = await this.client.post('/api/deployments', deploymentData); return response.data; } async getDeployments(filters) { const params = new URLSearchParams(); if (filters) { Object.keys(filters).forEach(key => { if (filters[key]) params.append(key, filters[key]); }); } const response = await this.client.get(`/api/deployments?${params.toString()}`); return response.data; } async getDeploymentLogs(deploymentId) { const response = await this.client.get(`/api/deployments/${deploymentId}/logs`); return response.data; } async getHealthStatus() { const response = await this.client.get('/api/health'); return response.data; } async createSubdomain(subdomainData) { const response = await this.client.post('/api/subdomains', subdomainData); return response.data; } async updateSubdomain(deploymentId, publicIP) { const response = await this.client.put('/api/subdomains', { deploymentId, publicIP }); return response.data; } async getSubdomains(filters) { const params = new URLSearchParams(); if (filters) { Object.keys(filters).forEach(key => { if (filters[key]) params.append(key, filters[key]); }); } const response = await this.client.get(`/api/subdomains?${params.toString()}`); return response.data; } } exports.ForgeApiService = ForgeApiService; //# sourceMappingURL=api.js.map