@xuda.io/runtime-bundle 1.0.481 → 1.0.483
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/js/xuda-runtime-bundle.js +170 -104
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +170 -104
- package/js/xuda-runtime-slim.min.es.js +170 -104
- package/js/xuda-runtime-slim.min.js +2 -2
- package/js/xuda-server-bundle.min.mjs +2 -2
- package/js/xuda-server-bundle.mjs +170 -104
- package/js/xuda-worker-bundle.js +170 -104
- package/js/xuda-worker-bundle.min.js +2 -2
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -5099,6 +5099,15 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5099
5099
|
}
|
|
5100
5100
|
};
|
|
5101
5101
|
|
|
5102
|
+
const update_xu_ref = async function () {
|
|
5103
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
5104
|
+
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
5105
|
+
if (val.ds.dsSession == dataSource) {
|
|
5106
|
+
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
5107
|
+
}
|
|
5108
|
+
}
|
|
5109
|
+
};
|
|
5110
|
+
|
|
5102
5111
|
var fields_changed = [];
|
|
5103
5112
|
var datasource_changed = [];
|
|
5104
5113
|
let client_datasource_changes = {};
|
|
@@ -5116,6 +5125,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5116
5125
|
// mechanism to make update directly on the datasource object
|
|
5117
5126
|
if (record_id === 'datasource_main') {
|
|
5118
5127
|
_.set(_ds, field_id, value);
|
|
5128
|
+
update_xu_ref();
|
|
5119
5129
|
continue;
|
|
5120
5130
|
}
|
|
5121
5131
|
|
|
@@ -5133,15 +5143,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5133
5143
|
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
5134
5144
|
|
|
5135
5145
|
// search the field in refs
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
}
|
|
5146
|
+
update_xu_ref();
|
|
5147
|
+
// let _ds_0 = _session.DS_GLB[0];
|
|
5148
|
+
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
5149
|
+
// if (val.ds.dsSession == dataSource) {
|
|
5150
|
+
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
5151
|
+
// // if (!fields_changed.includes(ref_name)) {
|
|
5152
|
+
// // fields_changed.push(ref_name);
|
|
5153
|
+
// // }
|
|
5154
|
+
// }
|
|
5155
|
+
// }
|
|
5145
5156
|
|
|
5146
5157
|
if (!update_local_scope_only) {
|
|
5147
5158
|
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
@@ -10816,102 +10827,102 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
|
|
|
10816
10827
|
return new_class.get();
|
|
10817
10828
|
};
|
|
10818
10829
|
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
//
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
//
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
//
|
|
10864
|
-
|
|
10865
|
-
//
|
|
10866
|
-
//
|
|
10867
|
-
|
|
10868
|
-
//
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
//
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
//
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
//
|
|
10890
|
-
//
|
|
10891
|
-
//
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10830
|
+
func.expression.parse_org = function (strP) {
|
|
10831
|
+
var extract_str = function (strP, posP) {
|
|
10832
|
+
if (!posP) posP = 0;
|
|
10833
|
+
var clean_split_str = function (arrP) {
|
|
10834
|
+
var arr = [];
|
|
10835
|
+
if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
|
|
10836
|
+
for (var i = 1; i <= arrP.length; i++) {
|
|
10837
|
+
arr.push(arrP[i]);
|
|
10838
|
+
}
|
|
10839
|
+
return arr;
|
|
10840
|
+
} else return arrP;
|
|
10841
|
+
};
|
|
10842
|
+
var nonLettersPatt = /\W/; // non letters
|
|
10843
|
+
var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
|
|
10844
|
+
var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
|
|
10845
|
+
var validSymbols = validSymbolsNoArray;
|
|
10846
|
+
var splitTmp = strP.replace(/@/g, '^^@').split('^^');
|
|
10847
|
+
var split = clean_split_str(splitTmp);
|
|
10848
|
+
var obj = [];
|
|
10849
|
+
if (split) {
|
|
10850
|
+
for (let val of split) {
|
|
10851
|
+
// run on @ segments
|
|
10852
|
+
if (val) {
|
|
10853
|
+
var pos = strP.indexOf(val);
|
|
10854
|
+
if (val && val.substr(0, 1) === '@') {
|
|
10855
|
+
var tmpStr = '';
|
|
10856
|
+
var word_start_pos = undefined;
|
|
10857
|
+
var word_end_pos = undefined;
|
|
10858
|
+
// run on @ segment string
|
|
10859
|
+
for (var i = 0; i <= val.length; i++) {
|
|
10860
|
+
var key1 = i;
|
|
10861
|
+
var val1 = val.substr(i, 1);
|
|
10862
|
+
if (
|
|
10863
|
+
val1 === '.' &&
|
|
10864
|
+
!word_start_pos // find first dot
|
|
10865
|
+
)
|
|
10866
|
+
word_start_pos = key1;
|
|
10867
|
+
if (
|
|
10868
|
+
word_start_pos &&
|
|
10869
|
+
key1 > word_start_pos &&
|
|
10870
|
+
nonLettersPatt.test(val1) // find any sign character to mark the end of word
|
|
10871
|
+
)
|
|
10872
|
+
word_end_pos = key1;
|
|
10873
|
+
if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
|
|
10874
|
+
// find the word
|
|
10875
|
+
var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
|
|
10876
|
+
// if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
|
|
10877
|
+
// compare with internal properties
|
|
10878
|
+
tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
|
|
10879
|
+
// }
|
|
10880
|
+
if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
|
|
10881
|
+
else word_start_pos = null;
|
|
10882
|
+
word_end_pos = null;
|
|
10883
|
+
}
|
|
10884
|
+
if (val1 === '[') validSymbols = validSymbolsWithArray;
|
|
10885
|
+
if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
|
|
10886
|
+
tmpStr += '^^' + val1;
|
|
10887
|
+
} else tmpStr += val1;
|
|
10888
|
+
}
|
|
10889
|
+
// });
|
|
10890
|
+
if (tmpStr.indexOf('^^') > -1) {
|
|
10891
|
+
var obj1 = extract_str(tmpStr, pos);
|
|
10892
|
+
obj = obj.concat(obj1);
|
|
10893
|
+
} else {
|
|
10894
|
+
// push clean @var
|
|
10895
|
+
var fieldId = undefined;
|
|
10896
|
+
if (val) {
|
|
10897
|
+
fieldId = val.substr(1, val.length);
|
|
10898
|
+
if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
|
|
10899
|
+
if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
|
|
10900
|
+
//
|
|
10901
|
+
// if (val.indexOf("]") > -1)
|
|
10902
|
+
// fieldId = val.substr(1, val.indexOf("]") - 1);
|
|
10903
|
+
}
|
|
10904
|
+
obj.push({
|
|
10905
|
+
value: val,
|
|
10906
|
+
fieldId: fieldId,
|
|
10907
|
+
pos: pos + posP,
|
|
10908
|
+
});
|
|
10909
|
+
}
|
|
10910
|
+
} else {
|
|
10911
|
+
obj.push({
|
|
10912
|
+
value: val,
|
|
10913
|
+
pos: pos + posP,
|
|
10914
|
+
});
|
|
10915
|
+
}
|
|
10916
|
+
}
|
|
10917
|
+
}
|
|
10918
|
+
return obj;
|
|
10919
|
+
}
|
|
10920
|
+
};
|
|
10921
|
+
var res = extract_str(strP);
|
|
10922
|
+
return res;
|
|
10923
|
+
};
|
|
10913
10924
|
|
|
10914
|
-
func.expression.
|
|
10925
|
+
func.expression.parse_bad = function (strP) {
|
|
10915
10926
|
const nonLettersPatt = /\W/;
|
|
10916
10927
|
const validSymbolsNoArray = /[^.@\[]/;
|
|
10917
10928
|
const validSymbolsWithArray = /[^.@"'\[\]]/;
|
|
@@ -10969,6 +10980,61 @@ func.expression.parse = function (strP) {
|
|
|
10969
10980
|
return extractStr(strP);
|
|
10970
10981
|
};
|
|
10971
10982
|
|
|
10983
|
+
func.expression.parse = function (input) {
|
|
10984
|
+
if (typeof input !== 'string') return [];
|
|
10985
|
+
|
|
10986
|
+
const segments = [];
|
|
10987
|
+
let pos = 0;
|
|
10988
|
+
|
|
10989
|
+
const parts = input.split(/(@)/).filter(Boolean);
|
|
10990
|
+
|
|
10991
|
+
for (let i = 0; i < parts.length; i++) {
|
|
10992
|
+
const part = parts[i];
|
|
10993
|
+
|
|
10994
|
+
if (part === '@' && i + 1 < parts.length) {
|
|
10995
|
+
const nextPart = parts[i + 1];
|
|
10996
|
+
const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
|
|
10997
|
+
let fieldId, remainder;
|
|
10998
|
+
|
|
10999
|
+
if (varEnd > 0) {
|
|
11000
|
+
fieldId = nextPart.slice(0, varEnd);
|
|
11001
|
+
remainder = nextPart.slice(varEnd);
|
|
11002
|
+
} else {
|
|
11003
|
+
fieldId = nextPart;
|
|
11004
|
+
remainder = '';
|
|
11005
|
+
}
|
|
11006
|
+
|
|
11007
|
+
// Add @variable segment
|
|
11008
|
+
const fullVarValue = `@${fieldId}`;
|
|
11009
|
+
segments.push({
|
|
11010
|
+
value: fullVarValue,
|
|
11011
|
+
fieldId,
|
|
11012
|
+
pos,
|
|
11013
|
+
});
|
|
11014
|
+
pos += fullVarValue.length;
|
|
11015
|
+
|
|
11016
|
+
// Add remainder as a separate segment, if any
|
|
11017
|
+
if (remainder) {
|
|
11018
|
+
segments.push({
|
|
11019
|
+
value: remainder,
|
|
11020
|
+
pos,
|
|
11021
|
+
});
|
|
11022
|
+
pos += remainder.length;
|
|
11023
|
+
}
|
|
11024
|
+
|
|
11025
|
+
i++; // Skip the next part since we consumed it
|
|
11026
|
+
} else if (part !== '@') {
|
|
11027
|
+
segments.push({
|
|
11028
|
+
value: part,
|
|
11029
|
+
pos,
|
|
11030
|
+
});
|
|
11031
|
+
pos += part.length;
|
|
11032
|
+
}
|
|
11033
|
+
}
|
|
11034
|
+
|
|
11035
|
+
return segments;
|
|
11036
|
+
};
|
|
11037
|
+
|
|
10972
11038
|
func.expression.get_property = async function (valP) {
|
|
10973
11039
|
async function secure_eval(val) {
|
|
10974
11040
|
if (typeof IS_PROCESS_SERVER === 'undefined') {
|
|
@@ -5100,6 +5100,15 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5100
5100
|
}
|
|
5101
5101
|
};
|
|
5102
5102
|
|
|
5103
|
+
const update_xu_ref = async function () {
|
|
5104
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
5105
|
+
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
5106
|
+
if (val.ds.dsSession == dataSource) {
|
|
5107
|
+
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
5108
|
+
}
|
|
5109
|
+
}
|
|
5110
|
+
};
|
|
5111
|
+
|
|
5103
5112
|
var fields_changed = [];
|
|
5104
5113
|
var datasource_changed = [];
|
|
5105
5114
|
let client_datasource_changes = {};
|
|
@@ -5117,6 +5126,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5117
5126
|
// mechanism to make update directly on the datasource object
|
|
5118
5127
|
if (record_id === 'datasource_main') {
|
|
5119
5128
|
_.set(_ds, field_id, value);
|
|
5129
|
+
update_xu_ref();
|
|
5120
5130
|
continue;
|
|
5121
5131
|
}
|
|
5122
5132
|
|
|
@@ -5134,15 +5144,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
5134
5144
|
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
5135
5145
|
|
|
5136
5146
|
// search the field in refs
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
}
|
|
5147
|
+
update_xu_ref();
|
|
5148
|
+
// let _ds_0 = _session.DS_GLB[0];
|
|
5149
|
+
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
5150
|
+
// if (val.ds.dsSession == dataSource) {
|
|
5151
|
+
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
5152
|
+
// // if (!fields_changed.includes(ref_name)) {
|
|
5153
|
+
// // fields_changed.push(ref_name);
|
|
5154
|
+
// // }
|
|
5155
|
+
// }
|
|
5156
|
+
// }
|
|
5146
5157
|
|
|
5147
5158
|
if (!update_local_scope_only) {
|
|
5148
5159
|
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
@@ -14613,102 +14624,102 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
|
|
|
14613
14624
|
return new_class.get();
|
|
14614
14625
|
};
|
|
14615
14626
|
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
//
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
//
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
//
|
|
14661
|
-
|
|
14662
|
-
//
|
|
14663
|
-
//
|
|
14664
|
-
|
|
14665
|
-
//
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
//
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
14680
|
-
//
|
|
14681
|
-
|
|
14682
|
-
|
|
14683
|
-
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
//
|
|
14687
|
-
//
|
|
14688
|
-
//
|
|
14689
|
-
|
|
14690
|
-
|
|
14691
|
-
|
|
14692
|
-
|
|
14693
|
-
|
|
14694
|
-
|
|
14695
|
-
|
|
14696
|
-
|
|
14697
|
-
|
|
14698
|
-
|
|
14699
|
-
|
|
14700
|
-
|
|
14701
|
-
|
|
14702
|
-
|
|
14703
|
-
|
|
14704
|
-
|
|
14705
|
-
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14709
|
-
|
|
14627
|
+
func.expression.parse_org = function (strP) {
|
|
14628
|
+
var extract_str = function (strP, posP) {
|
|
14629
|
+
if (!posP) posP = 0;
|
|
14630
|
+
var clean_split_str = function (arrP) {
|
|
14631
|
+
var arr = [];
|
|
14632
|
+
if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
|
|
14633
|
+
for (var i = 1; i <= arrP.length; i++) {
|
|
14634
|
+
arr.push(arrP[i]);
|
|
14635
|
+
}
|
|
14636
|
+
return arr;
|
|
14637
|
+
} else return arrP;
|
|
14638
|
+
};
|
|
14639
|
+
var nonLettersPatt = /\W/; // non letters
|
|
14640
|
+
var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
|
|
14641
|
+
var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
|
|
14642
|
+
var validSymbols = validSymbolsNoArray;
|
|
14643
|
+
var splitTmp = strP.replace(/@/g, '^^@').split('^^');
|
|
14644
|
+
var split = clean_split_str(splitTmp);
|
|
14645
|
+
var obj = [];
|
|
14646
|
+
if (split) {
|
|
14647
|
+
for (let val of split) {
|
|
14648
|
+
// run on @ segments
|
|
14649
|
+
if (val) {
|
|
14650
|
+
var pos = strP.indexOf(val);
|
|
14651
|
+
if (val && val.substr(0, 1) === '@') {
|
|
14652
|
+
var tmpStr = '';
|
|
14653
|
+
var word_start_pos = undefined;
|
|
14654
|
+
var word_end_pos = undefined;
|
|
14655
|
+
// run on @ segment string
|
|
14656
|
+
for (var i = 0; i <= val.length; i++) {
|
|
14657
|
+
var key1 = i;
|
|
14658
|
+
var val1 = val.substr(i, 1);
|
|
14659
|
+
if (
|
|
14660
|
+
val1 === '.' &&
|
|
14661
|
+
!word_start_pos // find first dot
|
|
14662
|
+
)
|
|
14663
|
+
word_start_pos = key1;
|
|
14664
|
+
if (
|
|
14665
|
+
word_start_pos &&
|
|
14666
|
+
key1 > word_start_pos &&
|
|
14667
|
+
nonLettersPatt.test(val1) // find any sign character to mark the end of word
|
|
14668
|
+
)
|
|
14669
|
+
word_end_pos = key1;
|
|
14670
|
+
if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
|
|
14671
|
+
// find the word
|
|
14672
|
+
var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
|
|
14673
|
+
// if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
|
|
14674
|
+
// compare with internal properties
|
|
14675
|
+
tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
|
|
14676
|
+
// }
|
|
14677
|
+
if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
|
|
14678
|
+
else word_start_pos = null;
|
|
14679
|
+
word_end_pos = null;
|
|
14680
|
+
}
|
|
14681
|
+
if (val1 === '[') validSymbols = validSymbolsWithArray;
|
|
14682
|
+
if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
|
|
14683
|
+
tmpStr += '^^' + val1;
|
|
14684
|
+
} else tmpStr += val1;
|
|
14685
|
+
}
|
|
14686
|
+
// });
|
|
14687
|
+
if (tmpStr.indexOf('^^') > -1) {
|
|
14688
|
+
var obj1 = extract_str(tmpStr, pos);
|
|
14689
|
+
obj = obj.concat(obj1);
|
|
14690
|
+
} else {
|
|
14691
|
+
// push clean @var
|
|
14692
|
+
var fieldId = undefined;
|
|
14693
|
+
if (val) {
|
|
14694
|
+
fieldId = val.substr(1, val.length);
|
|
14695
|
+
if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
|
|
14696
|
+
if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
|
|
14697
|
+
//
|
|
14698
|
+
// if (val.indexOf("]") > -1)
|
|
14699
|
+
// fieldId = val.substr(1, val.indexOf("]") - 1);
|
|
14700
|
+
}
|
|
14701
|
+
obj.push({
|
|
14702
|
+
value: val,
|
|
14703
|
+
fieldId: fieldId,
|
|
14704
|
+
pos: pos + posP,
|
|
14705
|
+
});
|
|
14706
|
+
}
|
|
14707
|
+
} else {
|
|
14708
|
+
obj.push({
|
|
14709
|
+
value: val,
|
|
14710
|
+
pos: pos + posP,
|
|
14711
|
+
});
|
|
14712
|
+
}
|
|
14713
|
+
}
|
|
14714
|
+
}
|
|
14715
|
+
return obj;
|
|
14716
|
+
}
|
|
14717
|
+
};
|
|
14718
|
+
var res = extract_str(strP);
|
|
14719
|
+
return res;
|
|
14720
|
+
};
|
|
14710
14721
|
|
|
14711
|
-
func.expression.
|
|
14722
|
+
func.expression.parse_bad = function (strP) {
|
|
14712
14723
|
const nonLettersPatt = /\W/;
|
|
14713
14724
|
const validSymbolsNoArray = /[^.@\[]/;
|
|
14714
14725
|
const validSymbolsWithArray = /[^.@"'\[\]]/;
|
|
@@ -14766,6 +14777,61 @@ func.expression.parse = function (strP) {
|
|
|
14766
14777
|
return extractStr(strP);
|
|
14767
14778
|
};
|
|
14768
14779
|
|
|
14780
|
+
func.expression.parse = function (input) {
|
|
14781
|
+
if (typeof input !== 'string') return [];
|
|
14782
|
+
|
|
14783
|
+
const segments = [];
|
|
14784
|
+
let pos = 0;
|
|
14785
|
+
|
|
14786
|
+
const parts = input.split(/(@)/).filter(Boolean);
|
|
14787
|
+
|
|
14788
|
+
for (let i = 0; i < parts.length; i++) {
|
|
14789
|
+
const part = parts[i];
|
|
14790
|
+
|
|
14791
|
+
if (part === '@' && i + 1 < parts.length) {
|
|
14792
|
+
const nextPart = parts[i + 1];
|
|
14793
|
+
const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
|
|
14794
|
+
let fieldId, remainder;
|
|
14795
|
+
|
|
14796
|
+
if (varEnd > 0) {
|
|
14797
|
+
fieldId = nextPart.slice(0, varEnd);
|
|
14798
|
+
remainder = nextPart.slice(varEnd);
|
|
14799
|
+
} else {
|
|
14800
|
+
fieldId = nextPart;
|
|
14801
|
+
remainder = '';
|
|
14802
|
+
}
|
|
14803
|
+
|
|
14804
|
+
// Add @variable segment
|
|
14805
|
+
const fullVarValue = `@${fieldId}`;
|
|
14806
|
+
segments.push({
|
|
14807
|
+
value: fullVarValue,
|
|
14808
|
+
fieldId,
|
|
14809
|
+
pos,
|
|
14810
|
+
});
|
|
14811
|
+
pos += fullVarValue.length;
|
|
14812
|
+
|
|
14813
|
+
// Add remainder as a separate segment, if any
|
|
14814
|
+
if (remainder) {
|
|
14815
|
+
segments.push({
|
|
14816
|
+
value: remainder,
|
|
14817
|
+
pos,
|
|
14818
|
+
});
|
|
14819
|
+
pos += remainder.length;
|
|
14820
|
+
}
|
|
14821
|
+
|
|
14822
|
+
i++; // Skip the next part since we consumed it
|
|
14823
|
+
} else if (part !== '@') {
|
|
14824
|
+
segments.push({
|
|
14825
|
+
value: part,
|
|
14826
|
+
pos,
|
|
14827
|
+
});
|
|
14828
|
+
pos += part.length;
|
|
14829
|
+
}
|
|
14830
|
+
}
|
|
14831
|
+
|
|
14832
|
+
return segments;
|
|
14833
|
+
};
|
|
14834
|
+
|
|
14769
14835
|
func.expression.get_property = async function (valP) {
|
|
14770
14836
|
async function secure_eval(val) {
|
|
14771
14837
|
if (typeof IS_PROCESS_SERVER === 'undefined') {
|