@contrail/types
Advanced tools
Comparing version 3.0.30 to 3.0.32
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FormulaFunctionProcessor = void 0; | ||
const formula_order_helper_1 = require("./formula-order-helper"); | ||
class FormulaFunctionProcessor { | ||
static async processFormulaFunctionsForEntity(entity, properties, context = {}) { | ||
for (const property of properties) { | ||
if (property.formulaFunction?.length) { | ||
const value = await this.processFormulaFunction(property.formulaFunction, entity, context); | ||
if (value) { | ||
entity[property.slug] = value; | ||
} | ||
const formulaProperties = properties.filter(property => property.formulaFunction?.length || 0 > 0); | ||
const formulaPropertiesInOrder = (0, formula_order_helper_1.getExecutionOrder)(formulaProperties); | ||
for (const property of formulaPropertiesInOrder) { | ||
const value = await this.processFormulaFunction(property.formulaFunction, entity, context); | ||
if (value) { | ||
entity[property.slug] = value; | ||
} | ||
@@ -13,0 +14,0 @@ } |
@@ -6,2 +6,3 @@ "use strict"; | ||
const util_1 = require("@contrail/util"); | ||
const formula_order_helper_1 = require("./formula-order-helper"); | ||
class FormulaProcessor { | ||
@@ -22,6 +23,6 @@ static processFormula(formula = '', data) { | ||
static processFormulasForEntity(entity, properties) { | ||
properties.forEach(property => { | ||
if (property.propertyType === type_properties_1.PropertyType.Formula) { | ||
entity[property.slug] = this.processFormula(property.formula, entity); | ||
} | ||
const formulaProperties = properties.filter(property => property.propertyType === type_properties_1.PropertyType.Formula); | ||
const formulaPropertiesInOrder = (0, formula_order_helper_1.getExecutionOrder)(formulaProperties); | ||
formulaPropertiesInOrder.forEach(property => { | ||
entity[property.slug] = this.processFormula(property.formula, entity); | ||
}); | ||
@@ -28,0 +29,0 @@ } |
@@ -23,3 +23,2 @@ "use strict"; | ||
const valuesToInclude = widthLimit > 0 ? widthLimit : nextOptionSet.optionSet.length; | ||
console.log('values to include:', valuesToInclude); | ||
for (let i = 0; i < valuesToInclude; i++) { | ||
@@ -26,0 +25,0 @@ const option = nextOptionSet.optionSet[i]; |
{ | ||
"name": "@contrail/types", | ||
"version": "3.0.30", | ||
"version": "3.0.32", | ||
"description": "Types Utility module", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
70264
72
1682