{"version":3,"sources":["../src/ingestion.ts"],"sourcesContent":["\nimport { isNil } from 'lodash'\nimport moment from 'moment'\n\nimport { Ingestion } from '@arcane-utils/types'\n\n\n/**\n * Determines if the product evolution information should be called.\n *\n * This function evaluates whether the product evolution information needs to be updated\n * based on the following criteria:\n * - The last calculation date is not the same as today.\n * - The identifier key exists.\n * - The identifier key is not empty.\n *\n * @param {Ingestion} dataIngestion - The ingestion data object containing product evolution information.\n * @returns {boolean} - Returns true if product evolution information should be called, false otherwise.\n */\nexport const shouldCallProductEvolutionCalculator = (\n  dataIngestion: Ingestion\n): boolean => {\n  const today = moment()\n  if (\n    isNil(dataIngestion.product_evolution_info) ||\n    isNil(dataIngestion.product_evolution_info.identifier_key) ||\n    dataIngestion.product_evolution_info.identifier_key.length === 0\n  ) {\n    return false\n  }\n  if (isNil(dataIngestion.product_evolution_info.last_calculation) || isNil(dataIngestion.product_evolution_info.last_calculation.date)) {\n    return true\n  }\n  const lastCalculationDate = moment(dataIngestion.product_evolution_info.last_calculation.date)\n  return !(today.isSame(lastCalculationDate, 'day'))\n}\n"],"mappings":"6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAAsB,kBACtBC,EAAmB,uBAiBNH,EACXI,GACY,CACZ,IAAMC,KAAQ,EAAAC,SAAO,EACrB,MACE,SAAMF,EAAc,sBAAsB,MAC1C,SAAMA,EAAc,uBAAuB,cAAc,GACzDA,EAAc,uBAAuB,eAAe,SAAW,EAE/D,MAAO,GAET,MAAI,SAAMA,EAAc,uBAAuB,gBAAgB,MAAK,SAAMA,EAAc,uBAAuB,iBAAiB,IAAI,EAClI,MAAO,GAET,IAAMG,KAAsB,EAAAD,SAAOF,EAAc,uBAAuB,iBAAiB,IAAI,EAC7F,MAAO,CAAEC,EAAM,OAAOE,EAAqB,KAAK,CAClD","names":["ingestion_exports","__export","shouldCallProductEvolutionCalculator","__toCommonJS","import_lodash","import_moment","dataIngestion","today","moment","lastCalculationDate"]}