UNPKG

@syntropysoft/praetorian

Version:

Praetorian CLI – A universal multi-environment configuration validator for DevSecOps teams. Validate, compare, and secure YAML/ENV files with ease.

72 lines 2.26 kB
"use strict"; /** * TODO: DECLARATIVE PROGRAMMING PATTERN * * This file demonstrates excellent declarative programming practices: * - Pure functions with async/await composition * - Functional array methods (map, every, forEach, filter) * - Immutable data transformations * - Object spread operator for composition * - No imperative loops or state mutations * - Clear data flow transformations * * Mutation Score: 100% - Functional composition makes testing trivial! */ Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthChecker = void 0; class HealthChecker { constructor(pluginManager) { this.pluginManager = pluginManager; } /** * Get overall health status */ async getHealth() { const plugins = this.pluginManager.getEnabledPlugins(); const healthResults = await Promise.all(plugins.map(async (plugin) => ({ name: plugin.getMetadata().name, ...(await plugin.getHealth()) }))); const healthy = healthResults.every(result => result.healthy); return { healthy, plugins: healthResults }; } /** * Check if specific plugin is healthy */ async isPluginHealthy(pluginName) { const plugin = this.pluginManager.getPlugin(pluginName); if (!plugin) { return false; } const health = await plugin.getHealth(); return health.healthy; } /** * Get detailed health information */ async getDetailedHealth() { const health = await this.getHealth(); const pluginDetails = {}; health.plugins.forEach(plugin => { pluginDetails[plugin.name] = { healthy: plugin.healthy, message: plugin.message }; }); const summary = { total: health.plugins.length, healthy: health.plugins.filter(p => p.healthy).length, unhealthy: health.plugins.filter(p => !p.healthy).length }; return { overall: health.healthy, plugins: pluginDetails, summary }; } } exports.HealthChecker = HealthChecker; //# sourceMappingURL=HealthChecker.js.map