@xuda.io/xuda-worker-bundle-min 1.3.1514 → 1.3.1516
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/index.js +12 -70
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -7753,7 +7753,7 @@ func.events.invoke = async function (event_id) {
|
|
|
7753
7753
|
};
|
|
7754
7754
|
func.expression = {};
|
|
7755
7755
|
|
|
7756
|
-
func.expression.
|
|
7756
|
+
func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, rowIdP, sourceActionP, secondPassP, calling_fieldIdP, fieldsP, debug_infoP, iterate_info, js_script_callback, jobNo, api_output_type) {
|
|
7757
7757
|
class xu_class {
|
|
7758
7758
|
async get() {
|
|
7759
7759
|
var ret;
|
|
@@ -8107,7 +8107,7 @@ func.expression.get_org = async function (SESSION_ID, valP, dsSessionP, sourceP,
|
|
|
8107
8107
|
return new_class.get();
|
|
8108
8108
|
};
|
|
8109
8109
|
|
|
8110
|
-
func.expression.
|
|
8110
|
+
func.expression.get_bad = async function (SESSION_ID, valP, dsSessionP, sourceP, rowIdP, sourceActionP, secondPassP, calling_fieldIdP, fieldsP = {}, debug_infoP, iterate_info, js_script_callback, jobNo, api_output_type) {
|
|
8111
8111
|
const evalJson = (text) => eval(`(${text})`);
|
|
8112
8112
|
const replaceQuotes = (str) => {
|
|
8113
8113
|
for (const [key, val] of Object.entries(fields)) {
|
|
@@ -8373,64 +8373,6 @@ func.expression.parse_org = function (strP) {
|
|
|
8373
8373
|
return res;
|
|
8374
8374
|
};
|
|
8375
8375
|
|
|
8376
|
-
func.expression.parse_bad = function (strP) {
|
|
8377
|
-
const nonLettersPatt = /\W/;
|
|
8378
|
-
const validSymbolsNoArray = /[^.@\[]/;
|
|
8379
|
-
const validSymbolsWithArray = /[^.@"'\[\]]/;
|
|
8380
|
-
|
|
8381
|
-
function extractStr(str, startPos = 0) {
|
|
8382
|
-
const cleanSplit = (arr) => (arr?.length > 1 && arr[0] === '' && arr[1].includes('@') ? arr.slice(1) : arr);
|
|
8383
|
-
|
|
8384
|
-
const segments = cleanSplit(str.replace(/@/g, '^^@').split('^^'));
|
|
8385
|
-
const result = [];
|
|
8386
|
-
|
|
8387
|
-
for (const val of segments || []) {
|
|
8388
|
-
if (!val) continue;
|
|
8389
|
-
const pos = str.indexOf(val) + startPos;
|
|
8390
|
-
|
|
8391
|
-
if (val.startsWith('@')) {
|
|
8392
|
-
let tmpStr = '';
|
|
8393
|
-
let wordStart = null;
|
|
8394
|
-
let wordEnd = null;
|
|
8395
|
-
let validSymbols = validSymbolsNoArray;
|
|
8396
|
-
|
|
8397
|
-
for (let i = 0; i < val.length; i++) {
|
|
8398
|
-
const char = val[i];
|
|
8399
|
-
|
|
8400
|
-
if (char === '[') validSymbols = validSymbolsWithArray;
|
|
8401
|
-
if (char === '.' && wordStart === null) wordStart = i;
|
|
8402
|
-
else if (wordStart !== null && nonLettersPatt.test(char)) wordEnd = i;
|
|
8403
|
-
|
|
8404
|
-
if (wordStart !== null && wordEnd !== null) {
|
|
8405
|
-
const word = val.slice(wordStart + 1, wordEnd);
|
|
8406
|
-
tmpStr = tmpStr.slice(0, wordStart) + '^^' + tmpStr.slice(wordStart, wordEnd);
|
|
8407
|
-
wordStart = char === '.' ? wordEnd : null;
|
|
8408
|
-
wordEnd = null;
|
|
8409
|
-
}
|
|
8410
|
-
|
|
8411
|
-
tmpStr += nonLettersPatt.test(char) && validSymbols.test(char) && !tmpStr.includes('^^') ? '^^' + char : char;
|
|
8412
|
-
}
|
|
8413
|
-
|
|
8414
|
-
if (tmpStr.includes('^^')) {
|
|
8415
|
-
result.push(...extractStr(tmpStr, pos));
|
|
8416
|
-
} else {
|
|
8417
|
-
const fieldIdMatch = val.match(/^@([^.\[]+)/);
|
|
8418
|
-
result.push({
|
|
8419
|
-
value: val,
|
|
8420
|
-
fieldId: fieldIdMatch ? fieldIdMatch[1] : undefined,
|
|
8421
|
-
pos,
|
|
8422
|
-
});
|
|
8423
|
-
}
|
|
8424
|
-
} else {
|
|
8425
|
-
result.push({ value: val, pos });
|
|
8426
|
-
}
|
|
8427
|
-
}
|
|
8428
|
-
return result;
|
|
8429
|
-
}
|
|
8430
|
-
|
|
8431
|
-
return extractStr(strP);
|
|
8432
|
-
};
|
|
8433
|
-
|
|
8434
8376
|
func.expression.parse = function (input) {
|
|
8435
8377
|
if (typeof input !== 'string') return [];
|
|
8436
8378
|
|
|
@@ -8459,7 +8401,7 @@ func.expression.parse = function (input) {
|
|
|
8459
8401
|
return segments;
|
|
8460
8402
|
};
|
|
8461
8403
|
|
|
8462
|
-
func.expression.
|
|
8404
|
+
func.expression.get_property = async function (valP) {
|
|
8463
8405
|
async function secure_eval(val) {
|
|
8464
8406
|
if (typeof IS_PROCESS_SERVER === 'undefined') {
|
|
8465
8407
|
try {
|
|
@@ -8498,7 +8440,7 @@ func.expression.get_property_org = async function (valP) {
|
|
|
8498
8440
|
};
|
|
8499
8441
|
};
|
|
8500
8442
|
|
|
8501
|
-
func.expression.
|
|
8443
|
+
func.expression.get_property_bad = async function (valP) {
|
|
8502
8444
|
if (typeof valP !== 'string') return { property1: undefined, property2: undefined };
|
|
8503
8445
|
|
|
8504
8446
|
const secureEval = async (expr) => {
|
|
@@ -8543,27 +8485,27 @@ func.expression.get_property = async function (valP) {
|
|
|
8543
8485
|
return { property1, property2 };
|
|
8544
8486
|
};
|
|
8545
8487
|
|
|
8546
|
-
func.expression.
|
|
8488
|
+
func.expression.validate_constant = function (valP) {
|
|
8547
8489
|
var patt = /["']/;
|
|
8548
8490
|
if (typeof valP === 'string' && patt.test(valP.substr(0, 1)) && patt.test(valP.substr(0, valP.length - 1))) return true;
|
|
8549
8491
|
else return false;
|
|
8550
8492
|
};
|
|
8551
|
-
func.expression.
|
|
8493
|
+
func.expression.validate_variables = function (valP) {
|
|
8552
8494
|
if (typeof valP === 'string' && valP.indexOf('@') > -1) return true;
|
|
8553
8495
|
else return false;
|
|
8554
8496
|
};
|
|
8555
|
-
func.expression.
|
|
8497
|
+
func.expression.remove_quotes = function (valP) {
|
|
8556
8498
|
if (func.expression.validate_constant(valP)) return valP.substr(1, valP.length - 2);
|
|
8557
8499
|
else return valP;
|
|
8558
8500
|
};
|
|
8559
8501
|
|
|
8560
|
-
func.expression.
|
|
8502
|
+
func.expression.validate_constant_bad = (valP) => typeof valP === 'string' && /^["'].*["']$/.test(valP);
|
|
8561
8503
|
|
|
8562
|
-
func.expression.
|
|
8504
|
+
func.expression.validate_variables_bad = (valP) => typeof valP === 'string' && valP.includes('@');
|
|
8563
8505
|
|
|
8564
|
-
func.expression.
|
|
8506
|
+
func.expression.remove_quotes_bad = (valP) => (func.expression.validate_constant(valP) && typeof valP === 'string' ? valP.slice(1, -1) : valP);
|
|
8565
8507
|
|
|
8566
|
-
func.expression.
|
|
8508
|
+
func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id, dsSessionP, js_script_callback, evt) {
|
|
8567
8509
|
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
8568
8510
|
func,
|
|
8569
8511
|
glb,
|
|
@@ -8665,7 +8607,7 @@ func.expression.secure_eval_org = async function (SESSION_ID, sourceP, val, job_
|
|
|
8665
8607
|
}
|
|
8666
8608
|
};
|
|
8667
8609
|
|
|
8668
|
-
func.expression.
|
|
8610
|
+
func.expression.secure_eval_bad = async function (SESSION_ID, sourceP, val, job_id, dsSessionP, js_script_callback, evt) {
|
|
8669
8611
|
if (typeof val !== 'string') return val;
|
|
8670
8612
|
|
|
8671
8613
|
const xu = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|