@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
|
@@ -3475,6 +3475,15 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3475
3475
|
}
|
|
3476
3476
|
};
|
|
3477
3477
|
|
|
3478
|
+
const update_xu_ref = async function () {
|
|
3479
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
3480
|
+
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
3481
|
+
if (val.ds.dsSession == dataSource) {
|
|
3482
|
+
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
};
|
|
3486
|
+
|
|
3478
3487
|
var fields_changed = [];
|
|
3479
3488
|
var datasource_changed = [];
|
|
3480
3489
|
let client_datasource_changes = {};
|
|
@@ -3492,6 +3501,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3492
3501
|
// mechanism to make update directly on the datasource object
|
|
3493
3502
|
if (record_id === 'datasource_main') {
|
|
3494
3503
|
_.set(_ds, field_id, value);
|
|
3504
|
+
update_xu_ref();
|
|
3495
3505
|
continue;
|
|
3496
3506
|
}
|
|
3497
3507
|
|
|
@@ -3509,15 +3519,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3509
3519
|
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
3510
3520
|
|
|
3511
3521
|
// search the field in refs
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
}
|
|
3522
|
+
update_xu_ref();
|
|
3523
|
+
// let _ds_0 = _session.DS_GLB[0];
|
|
3524
|
+
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
3525
|
+
// if (val.ds.dsSession == dataSource) {
|
|
3526
|
+
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
3527
|
+
// // if (!fields_changed.includes(ref_name)) {
|
|
3528
|
+
// // fields_changed.push(ref_name);
|
|
3529
|
+
// // }
|
|
3530
|
+
// }
|
|
3531
|
+
// }
|
|
3521
3532
|
|
|
3522
3533
|
if (!update_local_scope_only) {
|
|
3523
3534
|
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
@@ -8095,102 +8106,102 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
|
|
|
8095
8106
|
return new_class.get();
|
|
8096
8107
|
};
|
|
8097
8108
|
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
//
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
//
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
//
|
|
8143
|
-
|
|
8144
|
-
//
|
|
8145
|
-
//
|
|
8146
|
-
|
|
8147
|
-
//
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
//
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
//
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
//
|
|
8169
|
-
//
|
|
8170
|
-
//
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8109
|
+
func.expression.parse_org = function (strP) {
|
|
8110
|
+
var extract_str = function (strP, posP) {
|
|
8111
|
+
if (!posP) posP = 0;
|
|
8112
|
+
var clean_split_str = function (arrP) {
|
|
8113
|
+
var arr = [];
|
|
8114
|
+
if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
|
|
8115
|
+
for (var i = 1; i <= arrP.length; i++) {
|
|
8116
|
+
arr.push(arrP[i]);
|
|
8117
|
+
}
|
|
8118
|
+
return arr;
|
|
8119
|
+
} else return arrP;
|
|
8120
|
+
};
|
|
8121
|
+
var nonLettersPatt = /\W/; // non letters
|
|
8122
|
+
var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
|
|
8123
|
+
var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
|
|
8124
|
+
var validSymbols = validSymbolsNoArray;
|
|
8125
|
+
var splitTmp = strP.replace(/@/g, '^^@').split('^^');
|
|
8126
|
+
var split = clean_split_str(splitTmp);
|
|
8127
|
+
var obj = [];
|
|
8128
|
+
if (split) {
|
|
8129
|
+
for (let val of split) {
|
|
8130
|
+
// run on @ segments
|
|
8131
|
+
if (val) {
|
|
8132
|
+
var pos = strP.indexOf(val);
|
|
8133
|
+
if (val && val.substr(0, 1) === '@') {
|
|
8134
|
+
var tmpStr = '';
|
|
8135
|
+
var word_start_pos = undefined;
|
|
8136
|
+
var word_end_pos = undefined;
|
|
8137
|
+
// run on @ segment string
|
|
8138
|
+
for (var i = 0; i <= val.length; i++) {
|
|
8139
|
+
var key1 = i;
|
|
8140
|
+
var val1 = val.substr(i, 1);
|
|
8141
|
+
if (
|
|
8142
|
+
val1 === '.' &&
|
|
8143
|
+
!word_start_pos // find first dot
|
|
8144
|
+
)
|
|
8145
|
+
word_start_pos = key1;
|
|
8146
|
+
if (
|
|
8147
|
+
word_start_pos &&
|
|
8148
|
+
key1 > word_start_pos &&
|
|
8149
|
+
nonLettersPatt.test(val1) // find any sign character to mark the end of word
|
|
8150
|
+
)
|
|
8151
|
+
word_end_pos = key1;
|
|
8152
|
+
if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
|
|
8153
|
+
// find the word
|
|
8154
|
+
var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
|
|
8155
|
+
// if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
|
|
8156
|
+
// compare with internal properties
|
|
8157
|
+
tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
|
|
8158
|
+
// }
|
|
8159
|
+
if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
|
|
8160
|
+
else word_start_pos = null;
|
|
8161
|
+
word_end_pos = null;
|
|
8162
|
+
}
|
|
8163
|
+
if (val1 === '[') validSymbols = validSymbolsWithArray;
|
|
8164
|
+
if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
|
|
8165
|
+
tmpStr += '^^' + val1;
|
|
8166
|
+
} else tmpStr += val1;
|
|
8167
|
+
}
|
|
8168
|
+
// });
|
|
8169
|
+
if (tmpStr.indexOf('^^') > -1) {
|
|
8170
|
+
var obj1 = extract_str(tmpStr, pos);
|
|
8171
|
+
obj = obj.concat(obj1);
|
|
8172
|
+
} else {
|
|
8173
|
+
// push clean @var
|
|
8174
|
+
var fieldId = undefined;
|
|
8175
|
+
if (val) {
|
|
8176
|
+
fieldId = val.substr(1, val.length);
|
|
8177
|
+
if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
|
|
8178
|
+
if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
|
|
8179
|
+
//
|
|
8180
|
+
// if (val.indexOf("]") > -1)
|
|
8181
|
+
// fieldId = val.substr(1, val.indexOf("]") - 1);
|
|
8182
|
+
}
|
|
8183
|
+
obj.push({
|
|
8184
|
+
value: val,
|
|
8185
|
+
fieldId: fieldId,
|
|
8186
|
+
pos: pos + posP,
|
|
8187
|
+
});
|
|
8188
|
+
}
|
|
8189
|
+
} else {
|
|
8190
|
+
obj.push({
|
|
8191
|
+
value: val,
|
|
8192
|
+
pos: pos + posP,
|
|
8193
|
+
});
|
|
8194
|
+
}
|
|
8195
|
+
}
|
|
8196
|
+
}
|
|
8197
|
+
return obj;
|
|
8198
|
+
}
|
|
8199
|
+
};
|
|
8200
|
+
var res = extract_str(strP);
|
|
8201
|
+
return res;
|
|
8202
|
+
};
|
|
8192
8203
|
|
|
8193
|
-
func.expression.
|
|
8204
|
+
func.expression.parse_bad = function (strP) {
|
|
8194
8205
|
const nonLettersPatt = /\W/;
|
|
8195
8206
|
const validSymbolsNoArray = /[^.@\[]/;
|
|
8196
8207
|
const validSymbolsWithArray = /[^.@"'\[\]]/;
|
|
@@ -8248,6 +8259,61 @@ func.expression.parse = function (strP) {
|
|
|
8248
8259
|
return extractStr(strP);
|
|
8249
8260
|
};
|
|
8250
8261
|
|
|
8262
|
+
func.expression.parse = function (input) {
|
|
8263
|
+
if (typeof input !== 'string') return [];
|
|
8264
|
+
|
|
8265
|
+
const segments = [];
|
|
8266
|
+
let pos = 0;
|
|
8267
|
+
|
|
8268
|
+
const parts = input.split(/(@)/).filter(Boolean);
|
|
8269
|
+
|
|
8270
|
+
for (let i = 0; i < parts.length; i++) {
|
|
8271
|
+
const part = parts[i];
|
|
8272
|
+
|
|
8273
|
+
if (part === '@' && i + 1 < parts.length) {
|
|
8274
|
+
const nextPart = parts[i + 1];
|
|
8275
|
+
const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
|
|
8276
|
+
let fieldId, remainder;
|
|
8277
|
+
|
|
8278
|
+
if (varEnd > 0) {
|
|
8279
|
+
fieldId = nextPart.slice(0, varEnd);
|
|
8280
|
+
remainder = nextPart.slice(varEnd);
|
|
8281
|
+
} else {
|
|
8282
|
+
fieldId = nextPart;
|
|
8283
|
+
remainder = '';
|
|
8284
|
+
}
|
|
8285
|
+
|
|
8286
|
+
// Add @variable segment
|
|
8287
|
+
const fullVarValue = `@${fieldId}`;
|
|
8288
|
+
segments.push({
|
|
8289
|
+
value: fullVarValue,
|
|
8290
|
+
fieldId,
|
|
8291
|
+
pos,
|
|
8292
|
+
});
|
|
8293
|
+
pos += fullVarValue.length;
|
|
8294
|
+
|
|
8295
|
+
// Add remainder as a separate segment, if any
|
|
8296
|
+
if (remainder) {
|
|
8297
|
+
segments.push({
|
|
8298
|
+
value: remainder,
|
|
8299
|
+
pos,
|
|
8300
|
+
});
|
|
8301
|
+
pos += remainder.length;
|
|
8302
|
+
}
|
|
8303
|
+
|
|
8304
|
+
i++; // Skip the next part since we consumed it
|
|
8305
|
+
} else if (part !== '@') {
|
|
8306
|
+
segments.push({
|
|
8307
|
+
value: part,
|
|
8308
|
+
pos,
|
|
8309
|
+
});
|
|
8310
|
+
pos += part.length;
|
|
8311
|
+
}
|
|
8312
|
+
}
|
|
8313
|
+
|
|
8314
|
+
return segments;
|
|
8315
|
+
};
|
|
8316
|
+
|
|
8251
8317
|
func.expression.get_property = async function (valP) {
|
|
8252
8318
|
async function secure_eval(val) {
|
|
8253
8319
|
if (typeof IS_PROCESS_SERVER === 'undefined') {
|
package/js/xuda-worker-bundle.js
CHANGED
|
@@ -3475,6 +3475,15 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3475
3475
|
}
|
|
3476
3476
|
};
|
|
3477
3477
|
|
|
3478
|
+
const update_xu_ref = async function () {
|
|
3479
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
3480
|
+
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
3481
|
+
if (val.ds.dsSession == dataSource) {
|
|
3482
|
+
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
};
|
|
3486
|
+
|
|
3478
3487
|
var fields_changed = [];
|
|
3479
3488
|
var datasource_changed = [];
|
|
3480
3489
|
let client_datasource_changes = {};
|
|
@@ -3492,6 +3501,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3492
3501
|
// mechanism to make update directly on the datasource object
|
|
3493
3502
|
if (record_id === 'datasource_main') {
|
|
3494
3503
|
_.set(_ds, field_id, value);
|
|
3504
|
+
update_xu_ref();
|
|
3495
3505
|
continue;
|
|
3496
3506
|
}
|
|
3497
3507
|
|
|
@@ -3509,15 +3519,16 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
3509
3519
|
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
3510
3520
|
|
|
3511
3521
|
// search the field in refs
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
}
|
|
3522
|
+
update_xu_ref();
|
|
3523
|
+
// let _ds_0 = _session.DS_GLB[0];
|
|
3524
|
+
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
3525
|
+
// if (val.ds.dsSession == dataSource) {
|
|
3526
|
+
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
3527
|
+
// // if (!fields_changed.includes(ref_name)) {
|
|
3528
|
+
// // fields_changed.push(ref_name);
|
|
3529
|
+
// // }
|
|
3530
|
+
// }
|
|
3531
|
+
// }
|
|
3521
3532
|
|
|
3522
3533
|
if (!update_local_scope_only) {
|
|
3523
3534
|
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
@@ -8095,102 +8106,102 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
|
|
|
8095
8106
|
return new_class.get();
|
|
8096
8107
|
};
|
|
8097
8108
|
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
//
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
//
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
//
|
|
8143
|
-
|
|
8144
|
-
//
|
|
8145
|
-
//
|
|
8146
|
-
|
|
8147
|
-
//
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
//
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
//
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
//
|
|
8169
|
-
//
|
|
8170
|
-
//
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8109
|
+
func.expression.parse_org = function (strP) {
|
|
8110
|
+
var extract_str = function (strP, posP) {
|
|
8111
|
+
if (!posP) posP = 0;
|
|
8112
|
+
var clean_split_str = function (arrP) {
|
|
8113
|
+
var arr = [];
|
|
8114
|
+
if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
|
|
8115
|
+
for (var i = 1; i <= arrP.length; i++) {
|
|
8116
|
+
arr.push(arrP[i]);
|
|
8117
|
+
}
|
|
8118
|
+
return arr;
|
|
8119
|
+
} else return arrP;
|
|
8120
|
+
};
|
|
8121
|
+
var nonLettersPatt = /\W/; // non letters
|
|
8122
|
+
var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
|
|
8123
|
+
var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
|
|
8124
|
+
var validSymbols = validSymbolsNoArray;
|
|
8125
|
+
var splitTmp = strP.replace(/@/g, '^^@').split('^^');
|
|
8126
|
+
var split = clean_split_str(splitTmp);
|
|
8127
|
+
var obj = [];
|
|
8128
|
+
if (split) {
|
|
8129
|
+
for (let val of split) {
|
|
8130
|
+
// run on @ segments
|
|
8131
|
+
if (val) {
|
|
8132
|
+
var pos = strP.indexOf(val);
|
|
8133
|
+
if (val && val.substr(0, 1) === '@') {
|
|
8134
|
+
var tmpStr = '';
|
|
8135
|
+
var word_start_pos = undefined;
|
|
8136
|
+
var word_end_pos = undefined;
|
|
8137
|
+
// run on @ segment string
|
|
8138
|
+
for (var i = 0; i <= val.length; i++) {
|
|
8139
|
+
var key1 = i;
|
|
8140
|
+
var val1 = val.substr(i, 1);
|
|
8141
|
+
if (
|
|
8142
|
+
val1 === '.' &&
|
|
8143
|
+
!word_start_pos // find first dot
|
|
8144
|
+
)
|
|
8145
|
+
word_start_pos = key1;
|
|
8146
|
+
if (
|
|
8147
|
+
word_start_pos &&
|
|
8148
|
+
key1 > word_start_pos &&
|
|
8149
|
+
nonLettersPatt.test(val1) // find any sign character to mark the end of word
|
|
8150
|
+
)
|
|
8151
|
+
word_end_pos = key1;
|
|
8152
|
+
if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
|
|
8153
|
+
// find the word
|
|
8154
|
+
var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
|
|
8155
|
+
// if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
|
|
8156
|
+
// compare with internal properties
|
|
8157
|
+
tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
|
|
8158
|
+
// }
|
|
8159
|
+
if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
|
|
8160
|
+
else word_start_pos = null;
|
|
8161
|
+
word_end_pos = null;
|
|
8162
|
+
}
|
|
8163
|
+
if (val1 === '[') validSymbols = validSymbolsWithArray;
|
|
8164
|
+
if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
|
|
8165
|
+
tmpStr += '^^' + val1;
|
|
8166
|
+
} else tmpStr += val1;
|
|
8167
|
+
}
|
|
8168
|
+
// });
|
|
8169
|
+
if (tmpStr.indexOf('^^') > -1) {
|
|
8170
|
+
var obj1 = extract_str(tmpStr, pos);
|
|
8171
|
+
obj = obj.concat(obj1);
|
|
8172
|
+
} else {
|
|
8173
|
+
// push clean @var
|
|
8174
|
+
var fieldId = undefined;
|
|
8175
|
+
if (val) {
|
|
8176
|
+
fieldId = val.substr(1, val.length);
|
|
8177
|
+
if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
|
|
8178
|
+
if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
|
|
8179
|
+
//
|
|
8180
|
+
// if (val.indexOf("]") > -1)
|
|
8181
|
+
// fieldId = val.substr(1, val.indexOf("]") - 1);
|
|
8182
|
+
}
|
|
8183
|
+
obj.push({
|
|
8184
|
+
value: val,
|
|
8185
|
+
fieldId: fieldId,
|
|
8186
|
+
pos: pos + posP,
|
|
8187
|
+
});
|
|
8188
|
+
}
|
|
8189
|
+
} else {
|
|
8190
|
+
obj.push({
|
|
8191
|
+
value: val,
|
|
8192
|
+
pos: pos + posP,
|
|
8193
|
+
});
|
|
8194
|
+
}
|
|
8195
|
+
}
|
|
8196
|
+
}
|
|
8197
|
+
return obj;
|
|
8198
|
+
}
|
|
8199
|
+
};
|
|
8200
|
+
var res = extract_str(strP);
|
|
8201
|
+
return res;
|
|
8202
|
+
};
|
|
8192
8203
|
|
|
8193
|
-
func.expression.
|
|
8204
|
+
func.expression.parse_bad = function (strP) {
|
|
8194
8205
|
const nonLettersPatt = /\W/;
|
|
8195
8206
|
const validSymbolsNoArray = /[^.@\[]/;
|
|
8196
8207
|
const validSymbolsWithArray = /[^.@"'\[\]]/;
|
|
@@ -8248,6 +8259,61 @@ func.expression.parse = function (strP) {
|
|
|
8248
8259
|
return extractStr(strP);
|
|
8249
8260
|
};
|
|
8250
8261
|
|
|
8262
|
+
func.expression.parse = function (input) {
|
|
8263
|
+
if (typeof input !== 'string') return [];
|
|
8264
|
+
|
|
8265
|
+
const segments = [];
|
|
8266
|
+
let pos = 0;
|
|
8267
|
+
|
|
8268
|
+
const parts = input.split(/(@)/).filter(Boolean);
|
|
8269
|
+
|
|
8270
|
+
for (let i = 0; i < parts.length; i++) {
|
|
8271
|
+
const part = parts[i];
|
|
8272
|
+
|
|
8273
|
+
if (part === '@' && i + 1 < parts.length) {
|
|
8274
|
+
const nextPart = parts[i + 1];
|
|
8275
|
+
const varEnd = nextPart.search(/[.\[]/); // Split at first . or [
|
|
8276
|
+
let fieldId, remainder;
|
|
8277
|
+
|
|
8278
|
+
if (varEnd > 0) {
|
|
8279
|
+
fieldId = nextPart.slice(0, varEnd);
|
|
8280
|
+
remainder = nextPart.slice(varEnd);
|
|
8281
|
+
} else {
|
|
8282
|
+
fieldId = nextPart;
|
|
8283
|
+
remainder = '';
|
|
8284
|
+
}
|
|
8285
|
+
|
|
8286
|
+
// Add @variable segment
|
|
8287
|
+
const fullVarValue = `@${fieldId}`;
|
|
8288
|
+
segments.push({
|
|
8289
|
+
value: fullVarValue,
|
|
8290
|
+
fieldId,
|
|
8291
|
+
pos,
|
|
8292
|
+
});
|
|
8293
|
+
pos += fullVarValue.length;
|
|
8294
|
+
|
|
8295
|
+
// Add remainder as a separate segment, if any
|
|
8296
|
+
if (remainder) {
|
|
8297
|
+
segments.push({
|
|
8298
|
+
value: remainder,
|
|
8299
|
+
pos,
|
|
8300
|
+
});
|
|
8301
|
+
pos += remainder.length;
|
|
8302
|
+
}
|
|
8303
|
+
|
|
8304
|
+
i++; // Skip the next part since we consumed it
|
|
8305
|
+
} else if (part !== '@') {
|
|
8306
|
+
segments.push({
|
|
8307
|
+
value: part,
|
|
8308
|
+
pos,
|
|
8309
|
+
});
|
|
8310
|
+
pos += part.length;
|
|
8311
|
+
}
|
|
8312
|
+
}
|
|
8313
|
+
|
|
8314
|
+
return segments;
|
|
8315
|
+
};
|
|
8316
|
+
|
|
8251
8317
|
func.expression.get_property = async function (valP) {
|
|
8252
8318
|
async function secure_eval(val) {
|
|
8253
8319
|
if (typeof IS_PROCESS_SERVER === 'undefined') {
|