@legalplace/prerenderx 2.3.3 → 2.3.4
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.
|
@@ -36,6 +36,7 @@ export interface ConditionDataMap {
|
|
|
36
36
|
c: {
|
|
37
37
|
o: number[];
|
|
38
38
|
s: number[];
|
|
39
|
+
v: number[];
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
export interface ConditionData {
|
|
@@ -44,6 +45,7 @@ export interface ConditionData {
|
|
|
44
45
|
c: {
|
|
45
46
|
o: Record<string, boolean[]>;
|
|
46
47
|
s: Record<string, boolean[]>;
|
|
48
|
+
v: Record<string, boolean[]>;
|
|
47
49
|
};
|
|
48
50
|
}
|
|
49
51
|
export default DataPopulator;
|
|
@@ -14,7 +14,8 @@ var DataPopulator = (function () {
|
|
|
14
14
|
v: {},
|
|
15
15
|
c: {
|
|
16
16
|
o: {},
|
|
17
|
-
s: {}
|
|
17
|
+
s: {},
|
|
18
|
+
v: {}
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
this.id = id;
|
|
@@ -41,16 +42,30 @@ var DataPopulator = (function () {
|
|
|
41
42
|
var optionCondition = this.optionConditionValue(optionId);
|
|
42
43
|
this.data.c.o[optionId] = optionCondition === undefined ? [false] : optionCondition;
|
|
43
44
|
}
|
|
45
|
+
for (var i = 0; i < this.dataMap.c.v.length; i += 1) {
|
|
46
|
+
var variableId = this.dataMap.c.v[i];
|
|
47
|
+
var variableCondition = this.variableConditionValue(variableId);
|
|
48
|
+
this.data.c.v[variableId] = variableCondition === undefined ? [false] : variableCondition;
|
|
49
|
+
}
|
|
44
50
|
};
|
|
45
51
|
DataPopulator.prototype.populateVariables = function () {
|
|
46
|
-
|
|
47
|
-
var variableId =
|
|
48
|
-
var variableReference =
|
|
49
|
-
var values =
|
|
52
|
+
var _loop_1 = function (i) {
|
|
53
|
+
var variableId = this_1.dataMap.v[i];
|
|
54
|
+
var variableReference = this_1.references.variables[variableId];
|
|
55
|
+
var values = this_1.getVariableValues(variableId);
|
|
56
|
+
var parseNumber = function (v) {
|
|
57
|
+
var result = parseFloat(v);
|
|
58
|
+
return Number.isNaN(result) ? 0 : result;
|
|
59
|
+
};
|
|
50
60
|
if (variableReference.type === 'number') {
|
|
51
|
-
values = values.map(function (v) { return (typeof v === 'number' ? v :
|
|
61
|
+
values = values.map(function (v) { return (typeof v === 'number' ? v : parseNumber(v)); });
|
|
52
62
|
}
|
|
53
|
-
|
|
63
|
+
this_1.data.v[variableId] = __spreadArrays(values);
|
|
64
|
+
console.log(variableId, values);
|
|
65
|
+
};
|
|
66
|
+
var this_1 = this;
|
|
67
|
+
for (var i = 0; i < this.dataMap.v.length; i += 1) {
|
|
68
|
+
_loop_1(i);
|
|
54
69
|
}
|
|
55
70
|
};
|
|
56
71
|
DataPopulator.prototype.getVariableValues = function (variableId) {
|
|
@@ -130,9 +145,13 @@ var DataPopulator = (function () {
|
|
|
130
145
|
if (conditions === undefined)
|
|
131
146
|
return undefined;
|
|
132
147
|
var inputs = this.ovc.variables[variableId];
|
|
133
|
-
|
|
148
|
+
var result = inputs.map(function (input, index) {
|
|
134
149
|
return _this.conditionsRunner.executeCondition(conditions, variableId, index, 'variables');
|
|
135
150
|
});
|
|
151
|
+
console.log(variableId, 281);
|
|
152
|
+
if (variableId === 281)
|
|
153
|
+
console.log(result);
|
|
154
|
+
return result;
|
|
136
155
|
};
|
|
137
156
|
DataPopulator.prototype.sectionConditionValue = function (sectionId) {
|
|
138
157
|
var conditions = this.references.conditions.sections.main[sectionId];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/prerenderx",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"description": "PrerenderX",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://git.legalplace.eu/legalplace/prerenderx",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"build": "tsc"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@legalplace/lplogic": "^2.
|
|
17
|
+
"@legalplace/lplogic": "^2.1.4",
|
|
18
18
|
"@legalplace/models-v3-types": "^3.4.47",
|
|
19
19
|
"@legalplace/referencesparser": "^1.4.1",
|
|
20
20
|
"crypto": "^1.0.1",
|
|
@@ -28,7 +28,8 @@ class DataPopulator {
|
|
|
28
28
|
v: {},
|
|
29
29
|
c: {
|
|
30
30
|
o: {},
|
|
31
|
-
s: {}
|
|
31
|
+
s: {},
|
|
32
|
+
v: {}
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -71,6 +72,13 @@ class DataPopulator {
|
|
|
71
72
|
const optionCondition = this.optionConditionValue(optionId)
|
|
72
73
|
this.data.c.o[optionId] = optionCondition === undefined ? [false] : optionCondition
|
|
73
74
|
}
|
|
75
|
+
|
|
76
|
+
// Variables
|
|
77
|
+
for (let i = 0; i < this.dataMap.c.v.length; i += 1) {
|
|
78
|
+
const variableId = this.dataMap.c.v[i]
|
|
79
|
+
const variableCondition = this.variableConditionValue(variableId)
|
|
80
|
+
this.data.c.v[variableId] = variableCondition === undefined ? [false] : variableCondition
|
|
81
|
+
}
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
/**
|
|
@@ -82,13 +90,18 @@ class DataPopulator {
|
|
|
82
90
|
const variableReference = this.references.variables[variableId]
|
|
83
91
|
let values = this.getVariableValues(variableId)
|
|
84
92
|
|
|
93
|
+
const parseNumber = (v: string) => {
|
|
94
|
+
const result = parseFloat(v)
|
|
95
|
+
return Number.isNaN(result) ? 0 : result
|
|
96
|
+
}
|
|
85
97
|
// If variable is of type number
|
|
86
98
|
if (variableReference.type === 'number') {
|
|
87
|
-
values = values.map(v => (typeof v === 'number' ? v :
|
|
99
|
+
values = values.map(v => (typeof v === 'number' ? v : parseNumber(v)))
|
|
88
100
|
}
|
|
89
101
|
|
|
90
102
|
// Adding variables
|
|
91
103
|
this.data.v[variableId] = [...values]
|
|
104
|
+
console.log(variableId, values)
|
|
92
105
|
}
|
|
93
106
|
}
|
|
94
107
|
|
|
@@ -216,9 +229,14 @@ class DataPopulator {
|
|
|
216
229
|
// Getting variable inputs length
|
|
217
230
|
const inputs = this.ovc.variables[variableId]
|
|
218
231
|
|
|
219
|
-
|
|
232
|
+
const result = inputs.map((input, index) => {
|
|
220
233
|
return this.conditionsRunner.executeCondition(conditions, variableId, index, 'variables')
|
|
221
234
|
})
|
|
235
|
+
|
|
236
|
+
console.log(variableId, 281)
|
|
237
|
+
if (variableId === 281) console.log(result)
|
|
238
|
+
|
|
239
|
+
return result
|
|
222
240
|
}
|
|
223
241
|
|
|
224
242
|
/**
|
|
@@ -239,6 +257,7 @@ export interface ConditionDataMap {
|
|
|
239
257
|
c: {
|
|
240
258
|
o: number[]
|
|
241
259
|
s: number[]
|
|
260
|
+
v: number[]
|
|
242
261
|
}
|
|
243
262
|
}
|
|
244
263
|
|
|
@@ -248,6 +267,7 @@ export interface ConditionData {
|
|
|
248
267
|
c: {
|
|
249
268
|
o: Record<string, boolean[]>
|
|
250
269
|
s: Record<string, boolean[]>
|
|
270
|
+
v: Record<string, boolean[]>
|
|
251
271
|
}
|
|
252
272
|
}
|
|
253
273
|
|