@finsys/core 1.2.0 → 1.3.1
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/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
generateSurveyJson: () => generateSurveyJson,
|
|
47
47
|
getBaseCategories: () => getBaseCategories,
|
|
48
48
|
getBaseFieldNames: () => getBaseFieldNames,
|
|
49
|
+
getBaseFieldSpecMap: () => getBaseFieldSpecMap,
|
|
49
50
|
getBaseFieldSpecs: () => getBaseFieldSpecs,
|
|
50
51
|
getCategoryName: () => getCategoryName,
|
|
51
52
|
getPastMonthLabel: () => getPastMonthLabel,
|
|
@@ -77,6 +78,22 @@ function evaluateExpression(expression, data) {
|
|
|
77
78
|
return `this['${key.trim()}']`;
|
|
78
79
|
});
|
|
79
80
|
jsExpression = jsExpression.replace(/(?<![<>!=])=(?![=])/g, "==");
|
|
81
|
+
jsExpression = jsExpression.replace(
|
|
82
|
+
/(this\['[^']+'\])\s+anyof\s+(\[[^\]]+\])/gi,
|
|
83
|
+
(_, ref, arr) => `(${arr}).includes(${ref})`
|
|
84
|
+
);
|
|
85
|
+
jsExpression = jsExpression.replace(
|
|
86
|
+
/(this\['[^']+'\])\s+allof\s+(\[[^\]]+\])/gi,
|
|
87
|
+
(_, ref, arr) => `${arr}.every(item => (${ref} || []).includes(item))`
|
|
88
|
+
);
|
|
89
|
+
jsExpression = jsExpression.replace(
|
|
90
|
+
/(this\['[^']+'\])\s+contains\s+'([^']+)'/gi,
|
|
91
|
+
(_, ref, val) => `(${ref} || []).includes('${val}')`
|
|
92
|
+
);
|
|
93
|
+
jsExpression = jsExpression.replace(
|
|
94
|
+
/(this\['[^']+'\])\s+notcontains\s+'([^']+)'/gi,
|
|
95
|
+
(_, ref, val) => `!(${ref} || []).includes('${val}')`
|
|
96
|
+
);
|
|
80
97
|
const func = new Function(`return ${jsExpression};`);
|
|
81
98
|
return !!func.call(data || {});
|
|
82
99
|
} catch (e) {
|
|
@@ -9051,6 +9068,20 @@ function getBaseFieldSpecs() {
|
|
|
9051
9068
|
function getBaseCategories() {
|
|
9052
9069
|
return BASE_FIELD_SPECS.categories;
|
|
9053
9070
|
}
|
|
9071
|
+
var cachedFieldSpecMap = null;
|
|
9072
|
+
function getBaseFieldSpecMap() {
|
|
9073
|
+
if (cachedFieldSpecMap) {
|
|
9074
|
+
return cachedFieldSpecMap;
|
|
9075
|
+
}
|
|
9076
|
+
const map = /* @__PURE__ */ new Map();
|
|
9077
|
+
for (const field of BASE_FIELD_SPECS.fields) {
|
|
9078
|
+
if (field.name) {
|
|
9079
|
+
map.set(field.name, field);
|
|
9080
|
+
}
|
|
9081
|
+
}
|
|
9082
|
+
cachedFieldSpecMap = map;
|
|
9083
|
+
return cachedFieldSpecMap;
|
|
9084
|
+
}
|
|
9054
9085
|
var cachedFieldNames = null;
|
|
9055
9086
|
function getBaseFieldNames() {
|
|
9056
9087
|
if (cachedFieldNames) {
|
|
@@ -9086,6 +9117,7 @@ function getBaseFieldNames() {
|
|
|
9086
9117
|
generateSurveyJson,
|
|
9087
9118
|
getBaseCategories,
|
|
9088
9119
|
getBaseFieldNames,
|
|
9120
|
+
getBaseFieldSpecMap,
|
|
9089
9121
|
getBaseFieldSpecs,
|
|
9090
9122
|
getCategoryName,
|
|
9091
9123
|
getPastMonthLabel,
|