{"version":3,"sources":["../../../src/configFile/loadConfigurationFile.ts"],"sourcesContent":["import { type LoadEnvFileOptions } from '../envVariables/loadEnvFile';\nimport { logger } from '../logger';\nimport type { CustomIntlayerConfig } from '../types/config';\nimport { loadExternalFile } from '../loadExternalFile';\n\nconst filterValidConfiguration = (\n  configuration: CustomIntlayerConfig\n): CustomIntlayerConfig => {\n  // @TODO Implement filtering of valid configuration\n  return configuration;\n};\n\n/**\n * Load the configuration file from the given path\n * Example of configuration file: intlayer.config.js\n *\n * Accepts JSON, JS, MJS and TS files as configuration\n */\nexport const loadConfigurationFile = (\n  configFilePath: string,\n  envVarOptions?: LoadEnvFileOptions\n): CustomIntlayerConfig | undefined => {\n  try {\n    const fileContent = loadExternalFile(configFilePath, envVarOptions);\n\n    return filterValidConfiguration(fileContent);\n  } catch (error) {\n    logger(\n      `Error: ${error} ${JSON.stringify((error as Error).stack, null, 2)}`,\n      {\n        level: 'error',\n      }\n    );\n  }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAuB;AAEvB,8BAAiC;AAEjC,MAAM,2BAA2B,CAC/B,kBACyB;AAEzB,SAAO;AACT;AAQO,MAAM,wBAAwB,CACnC,gBACA,kBACqC;AACrC,MAAI;AACF,UAAM,kBAAc,0CAAiB,gBAAgB,aAAa;AAElE,WAAO,yBAAyB,WAAW;AAAA,EAC7C,SAAS,OAAO;AACd;AAAA,MACE,UAAU,KAAK,IAAI,KAAK,UAAW,MAAgB,OAAO,MAAM,CAAC,CAAC;AAAA,MAClE;AAAA,QACE,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;","names":[]}