@legalplace/prerenderx 2.5.4 → 2.5.5-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### [2.5.5](https://git.legalplace.eu/legalplace/prerenderx/compare/v2.6.3...v2.5.5) (2021-10-27)
6
+
7
+ ### [2.6.3](https://git.legalplace.eu/legalplace/prerenderx/compare/v2.6.2...v2.6.3) (2021-10-04)
8
+
9
+ ### [2.6.2](https://git.legalplace.eu/legalplace/prerenderx/compare/v2.2.0...v2.6.2) (2021-10-01)
10
+
11
+
12
+ ### Features
13
+
14
+ * adding french numbers displaying ([ffc1c1e](https://git.legalplace.eu/legalplace/prerenderx/commit/ffc1c1e4279dbd5d6529da0394cf03998fe1d4a3))
15
+ * bump version ([1b94156](https://git.legalplace.eu/legalplace/prerenderx/commit/1b941562c157e4ee368ca6ced106bf5c2d1dddd3))
16
+ * supporting parsed references ([39d5a8d](https://git.legalplace.eu/legalplace/prerenderx/commit/39d5a8d74fc9d9fd91936ab8d2c1edb9780e5afc))
17
+ * supporting parsed references and rendering documents on-demand. ([17ccbeb](https://git.legalplace.eu/legalplace/prerenderx/commit/17ccbeb8fe6ef4529864df955fd83fbe4911e252))
18
+ * Supporting variables in documents names ([da853c0](https://git.legalplace.eu/legalplace/prerenderx/commit/da853c0a1b0325d45570543195ada5f292645bad))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * add version logging ([4815571](https://git.legalplace.eu/legalplace/prerenderx/commit/4815571df9dbb1dc2a394683fe0bb16723eae57c))
24
+ * adding cache support for conditions ([34866b8](https://git.legalplace.eu/legalplace/prerenderx/commit/34866b8f7fc5b7e5d2bd1ff08dd50a80010c0262))
25
+ * bimp version ([f3fbd55](https://git.legalplace.eu/legalplace/prerenderx/commit/f3fbd55bba169a449a282c34c85fa48f98b03be5))
26
+ * datapopulator issue ([b8f8532](https://git.legalplace.eu/legalplace/prerenderx/commit/b8f8532fe7b03811e364387d3168c637d7bc6976))
27
+ * fixing cache ([53cf0dd](https://git.legalplace.eu/legalplace/prerenderx/commit/53cf0ddd2e1cd8c6c98c86869081aa949317f0cb))
28
+ * handle static chil in ovc converter ([5eadfab](https://git.legalplace.eu/legalplace/prerenderx/commit/5eadfab0aa8c0885f3e4268eb56c82e56e07d7ba))
29
+ * handle static child in prerender ([f6e6115](https://git.legalplace.eu/legalplace/prerenderx/commit/f6e6115f9d04bd585e0e05e52871217da9e1cf1b))
@@ -5,6 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var lplogic_1 = __importDefault(require("@legalplace/lplogic"));
7
7
  var DataPopulator_1 = __importDefault(require("./DataPopulator"));
8
+ var conditionsCache = {};
9
+ var createConditionCacheKey = function (condition, id, index, conditionType) {
10
+ var conditionString = JSON.stringify(condition);
11
+ return id + "-" + index + "-" + conditionType + "-" + conditionString;
12
+ };
8
13
  var ConditionsRunner = (function () {
9
14
  function ConditionsRunner(references, ovc) {
10
15
  this.references = references;
@@ -50,6 +55,9 @@ var ConditionsRunner = (function () {
50
55
  var _this = this;
51
56
  if (Array.isArray(condition))
52
57
  return condition.map(function (_condition) { return _this.executeCondition(_condition, id, index, conditionType); });
58
+ var cacheKey = createConditionCacheKey(condition, id, index, conditionType);
59
+ if (Object.prototype.hasOwnProperty.call(conditionsCache, cacheKey))
60
+ return conditionsCache[cacheKey];
53
61
  var currentData;
54
62
  if (conditionType === 'options' || conditionType === 'optionValidator') {
55
63
  currentData = new DataPopulator_1.default(this, this.references, this.ovc, condition.dataMap, id, index).getData();
@@ -61,7 +69,8 @@ var ConditionsRunner = (function () {
61
69
  else if (conditionType === 'sections' || conditionType === 'documents') {
62
70
  currentData = new DataPopulator_1.default(this, this.references, this.ovc, condition.dataMap, id, index).getData();
63
71
  }
64
- return lplogic_1.default(condition.conditions, currentData);
72
+ conditionsCache[cacheKey] = lplogic_1.default(condition.conditions, currentData);
73
+ return conditionsCache[cacheKey];
65
74
  };
66
75
  return ConditionsRunner;
67
76
  }());
@@ -8,6 +8,12 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.parseDocumentNameWithVariables = exports.parseOutputWithVariables = exports.getRelatedVariablesValues = void 0;
11
+ var frenchNumber = function (value) {
12
+ var result = typeof value === 'number' ? value.toString() : value;
13
+ if (/^([0-9]+)\.([0-9]+)$/.test(result.trim()))
14
+ result = result.trim().replace('.', ',');
15
+ return result;
16
+ };
11
17
  exports.getRelatedVariablesValues = function (optionId, index, variables, ovc, references) {
12
18
  var variablesValues = {};
13
19
  variables.forEach(function (currentVariableId) {
@@ -24,10 +30,8 @@ exports.getRelatedVariablesValues = function (optionId, index, variables, ovc, r
24
30
  if (rootVariableParentRelations.children.options.includes(optionId) || rootVariableParentRelations.dependants.includes(optionId) || optionId === rootVariableParentId)
25
31
  value = [value[index]];
26
32
  var cleanValues = value.map(function (currentValue) {
27
- if (typeof currentValue === 'number')
28
- return currentValue.toString();
29
- if (typeof currentValue === 'string')
30
- return currentValue;
33
+ if (['number', 'string'].includes(typeof currentValue))
34
+ return frenchNumber(currentValue);
31
35
  return '';
32
36
  });
33
37
  var currentVariableValue = cleanValues.length === 1 ? cleanValues[0] : cleanValues.join(', ');