{"version":3,"file":"config-manager.cjs","sources":["../../src/interfaces/config-manager.ts"],"sourcesContent":["/**\n * Available configuration sources\n */\nexport const ConfigSource = {\n  env: 'env',\n  db: 'db',\n} as const;\nexport type ConfigSource = (typeof ConfigSource)[keyof typeof ConfigSource];\n\n/**\n * Metadata for a configuration value\n */\nexport interface ConfigDefinition<T> {\n  defaultValue: T;\n  envVarName?: string;\n  isSecret?: boolean;\n}\n\n/**\n * Helper function for defining configurations with type safety\n */\nexport const defineConfig = <T>(\n  config: ConfigDefinition<T>,\n): ConfigDefinition<T> => config;\n\n/**\n * Interface for loading configuration values\n */\n// biome-ignore lint/suspicious/noExplicitAny: ignore\nexport interface IConfigLoader<K extends string, V extends Record<K, any>> {\n  /**\n   * Load configurations from environment variables\n   */\n  loadFromEnv(): Promise<RawConfigData<K, V>>;\n\n  /**\n   * Load configurations from database\n   */\n  loadFromDB(): Promise<RawConfigData<K, V>>;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: ignore\nexport type RawConfigData<K extends string, V extends Record<K, any>> = Record<\n  K,\n  {\n    value: V[K];\n    definition?: ConfigDefinition<V[K]>;\n  }\n>;\n\nexport type UpdateConfigOptions = {\n  skipPubsub?: boolean;\n  removeIfUndefined?: boolean;\n};\n\n/**\n * Interface for managing configuration values\n */\n// biome-ignore lint/suspicious/noExplicitAny: ignore\nexport interface IConfigManager<K extends string, V extends Record<K, any>> {\n  /**\n   * Load configurations\n   * @param options.source - Specify which source to load from\n   */\n  loadConfigs(options?: { source?: ConfigSource }): Promise<void>;\n\n  /**\n   * Get a configuration value\n   */\n  getConfig<T extends K>(key: T, source?: ConfigSource): V[T];\n\n  /**\n   * Update a configuration value\n   */\n  updateConfig<T extends K>(\n    key: T,\n    value: V[T],\n    options?: UpdateConfigOptions,\n  ): Promise<void>;\n\n  /**\n   * Update multiple configuration values\n   */\n  updateConfigs(\n    updates: Partial<{ [T in K]: V[T] }>,\n    options?: UpdateConfigOptions,\n  ): Promise<void>;\n\n  /**\n   * Remove multiple configuration values\n   */\n  removeConfigs(keys: K[], options?: UpdateConfigOptions): Promise<void>;\n\n  /**\n   * Get environment variables managed with ConfigDefinitions\n   */\n  getManagedEnvVars(showSecretValues: boolean): Record<string, string>;\n}\n"],"names":["ConfigSource","defineConfig","config"],"mappings":"gFAGO,MAAMA,EAAe,CAC1B,IAAK,MACL,GAAI,IACN,EAeaC,EACXC,GACwBA"}