// SPDX-License-Identifier: Apache-2.0
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import { PathEx } from './src/business/utils/path-ex.js';
import fs from 'node:fs';
import * as constants from './src/core/constants.js';
import { SemanticVersion } from './src/business/utils/semantic-version.js';
/**
 * This file should only contain versions for dependencies and the function to get the Solo version.
 */
export const HELM_VERSION = 'v3.14.2';
export const KIND_VERSION = 'v0.29.0';
export const PODMAN_VERSION = 'v5.6.0';
export const VFKIT_VERSION = 'v0.6.1';
export const GVPROXY_VERSION = 'v0.8.7';
export const KUBECTL_VERSION = 'v1.32.2';
export const SOLO_CHART_VERSION = constants.getEnvironmentVariable('SOLO_CHART_VERSION') || '0.63.2';
export const HEDERA_PLATFORM_VERSION = constants.getEnvironmentVariable('CONSENSUS_NODE_VERSION') || 'v0.71.0';
export const S6_NODE_IMAGE_VERSION = constants.getEnvironmentVariable('SOLO_S6_NODE_IMAGE_VERSION') || '0.44.0-alpha.1';
export const MIRROR_NODE_VERSION = constants.getEnvironmentVariable('MIRROR_NODE_VERSION') || 'v0.151.0';
export const EXPLORER_VERSION = constants.getEnvironmentVariable('EXPLORER_VERSION') || '26.0.0';
export const HEDERA_JSON_RPC_RELAY_VERSION = constants.getEnvironmentVariable('RELAY_VERSION') || '0.76.1';
export const INGRESS_CONTROLLER_VERSION = constants.getEnvironmentVariable('INGRESS_CONTROLLER_VERSION') || '0.14.5';
export const BLOCK_NODE_VERSION = constants.getEnvironmentVariable('BLOCK_NODE_VERSION') || 'v0.28.1';
export const NETWORK_LOAD_GENERATOR_CHART_VERSION = constants.getEnvironmentVariable('NETWORK_LOAD_GENERATOR_CHART_VERSION') || '0.8.0';
export const MINIO_OPERATOR_VERSION = constants.getEnvironmentVariable('MINIO_OPERATOR_VERSION') || '7.1.1';
export const PROMETHEUS_STACK_VERSION = constants.getEnvironmentVariable('PROMETHEUS_STACK_VERSION') || '52.0.1';
export const GRAFANA_AGENT_VERSION = constants.getEnvironmentVariable('GRAFANA_AGENT_VERSION') || '0.27.1';
export const GRAFANA_PODLOGS_CRD_VERSION = constants.getEnvironmentVariable('GRAFANA_PODLOGS_CRD_VERSION') || 'v1.11.3';
export const PROMETHEUS_OPERATOR_CRDS_VERSION = constants.getEnvironmentVariable('PROMETHEUS_OPERATOR_CRDS_VERSION') || '24.0.2';
export const REDIS_IMAGE_VERSION = constants.getEnvironmentVariable('REDIS_IMAGE_VERSION') || '8.2.2';
export const REDIS_SENTINEL_IMAGE_VERSION = constants.getEnvironmentVariable('REDIS_SENTINEL_IMAGE_VERSION') || '8.2.2';
// -------------------------------------------------------------------- //
// Edge (newer-than-default) versions used by the `--edge` preset in one-shot deploys.
export const SOLO_CHART_EDGE_VERSION = constants.getEnvironmentVariable('SOLO_CHART_EDGE_VERSION') || SOLO_CHART_VERSION;
export const HEDERA_PLATFORM_EDGE_VERSION = constants.getEnvironmentVariable('CONSENSUS_NODE_EDGE_VERSION') || HEDERA_PLATFORM_VERSION;
export const MIRROR_NODE_EDGE_VERSION = constants.getEnvironmentVariable('MIRROR_NODE_EDGE_VERSION') || MIRROR_NODE_VERSION;
export const EXPLORER_EDGE_VERSION = constants.getEnvironmentVariable('EXPLORER_EDGE_VERSION') || EXPLORER_VERSION;
export const HEDERA_JSON_RPC_RELAY_EDGE_VERSION = constants.getEnvironmentVariable('RELAY_EDGE_VERSION') || HEDERA_JSON_RPC_RELAY_VERSION;
export const BLOCK_NODE_EDGE_VERSION = constants.getEnvironmentVariable('BLOCK_NODE_EDGE_VERSION') || BLOCK_NODE_VERSION;
// -------------------------------------------------------------------- //
export const MINIMUM_HIERO_PLATFORM_VERSION_FOR_BLOCK_NODE_LEGACY_RELEASE = 'v0.62.3';
export const MINIMUM_HIERO_BLOCK_NODE_VERSION_FOR_NEW_LIVENESS_CHECK_PORT = new SemanticVersion('v0.15.0');
export const MINIMUM_HIERO_PLATFORM_VERSION_FOR_BLOCK_NODE = 'v0.64.0';
export const MINIMUM_HIERO_PLATFORM_VERSION_FOR_GRPC_WEB_ENDPOINTS = 'v0.62.0';
// pre-release specified to allow all other pre-releases
export const MINIMUM_HIERO_CONSENSUS_NODE_VERSION_FOR_LEGACY_PORT_NAME_FOR_BLOCK_NODES_JSON_FILE = '0.69.0';
export const LAST_HIERO_CONSENSUS_NODE_VERSION_NEED_CONFIG_TXT = 'v0.70.0';
export const POST_HIERO_MIGRATION_MIRROR_NODE_VERSION = '0.130.0';
export const MINIMUM_HIERO_PLATFORM_VERSION_FOR_TSS = 'v0.72.0-0';
export const MINIMUM_BLOCK_NODE_CHART_VERSION_FOR_MIRROR_NODE_INTEGRATION = '0.29.0-0';
export const MINIMUM_MIRROR_NODE_CHART_VERSION_FOR_MIRROR_NODE_INTEGRATION = '0.150.0-0';
export function needsConfigTxtForConsensusVersion(releaseTag) {
    const versionTag = new SemanticVersion(releaseTag || HEDERA_PLATFORM_VERSION);
    return versionTag.lessThanOrEqual(LAST_HIERO_CONSENSUS_NODE_VERSION_NEED_CONFIG_TXT);
}
export function getSoloVersion() {
    if (process.env.npm_package_version) {
        return process.env.npm_package_version;
    }
    const __filename = fileURLToPath(import.meta.url);
    const __dirname = path.dirname(__filename);
    const packageJsonPath = PathEx.resolve(__dirname, './package.json');
    const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
    return packageJson.version;
}
//# sourceMappingURL=version.js.map