UNPKG

kist

Version:

Package Pipeline Processor

54 lines (53 loc) 1.77 kB
import { ConfigInterface } from "../../interface/ConfigInterface"; import { AbstractProcess } from "../abstract/AbstractProcess"; /** * ConfigStore is a singleton that loads and manages the application's configuration. * It prioritizes CLI arguments over configuration file values. */ export declare class ConfigStore extends AbstractProcess { private static instance; private config; private constructor(); /** * Retrieves the singleton instance of ConfigStore. * @returns The singleton instance of ConfigStore. */ static getInstance(): ConfigStore; /** * Retrieves a value from the configuration using dot notation. * * @param key - The key of the configuration to retrieve. * @returns The configuration value or undefined if not found. */ get<T>(key: string): T | undefined; /** * Sets a value in the configuration using dot notation. * * @param key - The key of the configuration to set. * @param value - The value to set. */ set(key: string, value: unknown): void; /** * Merges the provided configuration into the existing configuration using deep merge. * * @param newConfig - The new configuration to merge. */ merge(newConfig: Partial<ConfigInterface>): void; /** * Retrieves the current configuration object. * @returns The current configuration. */ getConfig(): ConfigInterface; /** * Prints the current configuration to the console. */ print(): void; /** * Deeply merges two objects, preventing prototype pollution. * * @param target - The target object. * @param source - The source object. * @returns The merged object. */ private deepMerge; }