@contrail/types
Advanced tools
Comparing version 3.0.89 to 3.0.90
@@ -6,2 +6,3 @@ "use strict"; | ||
const formula_order_helper_1 = require("./formula-order-helper"); | ||
const utils_1 = require("./utils"); | ||
class FormulaFunctionProcessor { | ||
@@ -12,8 +13,9 @@ static getFromFunctionCache(key) { | ||
static async processFormulaFunctionsForEntity(entity, properties, context = {}, options = { useLocalCache: true }) { | ||
const formulaProperties = properties?.filter((property) => property?.formulaFunction?.length || 0 > 0) || []; | ||
if (!formulaProperties?.length) { | ||
const formulaProperties = properties?.filter(property => property?.formulaFunction?.length || 0 > 0) || []; | ||
const filteredFormulaProperties = (0, utils_1.filterPropertiesByLevel)(entity, formulaProperties); | ||
if (!filteredFormulaProperties?.length) { | ||
console.log('FormulaFunctionProcessor: Skipping... no formula properties found.'); | ||
return; | ||
} | ||
const formulaPropertiesInOrder = (0, formula_order_helper_1.getExecutionOrder)(formulaProperties); | ||
const formulaPropertiesInOrder = (0, formula_order_helper_1.getExecutionOrder)(filteredFormulaProperties); | ||
const formatter = new formatter_1.PropertyValueFormatter(); | ||
@@ -37,3 +39,3 @@ for (const property of formulaPropertiesInOrder) { | ||
static processFormulasForEntities(entities, properties) { | ||
entities.forEach((entity) => { | ||
entities.forEach(entity => { | ||
FormulaFunctionProcessor.processFormulaFunctionsForEntity(entity, properties); | ||
@@ -40,0 +42,0 @@ }); |
@@ -8,2 +8,3 @@ "use strict"; | ||
const formatter_1 = require("../formatter"); | ||
const utils_1 = require("./utils"); | ||
class FormulaProcessor { | ||
@@ -21,3 +22,3 @@ static processFormulaForProperty(property, data) { | ||
static processFormulasForEntities(entities, properties) { | ||
entities.forEach((entity) => { | ||
entities.forEach(entity => { | ||
this.processFormulasForEntity(entity, properties); | ||
@@ -27,5 +28,6 @@ }); | ||
static processFormulasForEntity(entity, properties) { | ||
const formulaProperties = properties?.filter((property) => property.propertyType === type_properties_1.PropertyType.Formula) || []; | ||
const formulaPropertiesInOrder = (0, formula_order_helper_1.getExecutionOrder)(formulaProperties); | ||
formulaPropertiesInOrder.forEach((property) => { | ||
const formulaProperties = properties?.filter(property => property.propertyType === type_properties_1.PropertyType.Formula) || []; | ||
const filteredFormulaProperties = (0, utils_1.filterPropertiesByLevel)(entity, formulaProperties); | ||
const formulaPropertiesInOrder = (0, formula_order_helper_1.getExecutionOrder)(filteredFormulaProperties); | ||
formulaPropertiesInOrder.forEach(property => { | ||
entity[property.slug] = this.processFormulaForProperty(property, entity); | ||
@@ -32,0 +34,0 @@ }); |
{ | ||
"name": "@contrail/types", | ||
"version": "3.0.89", | ||
"version": "3.0.90", | ||
"description": "Types Utility module", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
281493
84
7639