@xuda.io/runtime-bundle 1.0.779 → 1.0.781
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 +396 -394
- package/js/xuda-runtime-bundle.min.js +3 -3
- package/js/xuda-runtime-slim.js +398 -396
- package/js/xuda-runtime-slim.min.es.js +398 -396
- package/js/xuda-runtime-slim.min.js +3 -3
- package/js/xuda-server-bundle.min.mjs +3 -3
- package/js/xuda-server-bundle.mjs +402 -400
- package/js/xuda-worker-bundle.js +402 -400
- package/js/xuda-worker-bundle.min.js +3 -3
- package/js/xuda_common-bundle.js +13 -13
- package/js/xuda_common-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -24501,19 +24501,19 @@ func.api.call_javascript = async function (prog_id, params, evaluate) {
|
|
|
24501
24501
|
return await api_utils.call_javascript(prog_id, params, evaluate);
|
|
24502
24502
|
};
|
|
24503
24503
|
|
|
24504
|
-
func.api.call_javascript = async function (prog_id, params, evaluate) {
|
|
24505
|
-
|
|
24506
|
-
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
|
|
24513
|
-
|
|
24504
|
+
// func.api.call_javascript = async function (prog_id, params, evaluate) {
|
|
24505
|
+
// const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24506
|
+
// const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24507
|
+
// func,
|
|
24508
|
+
// glb,
|
|
24509
|
+
// SESSION_OBJ,
|
|
24510
|
+
// SESSION_ID,
|
|
24511
|
+
// APP_OBJ,
|
|
24512
|
+
// dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24513
|
+
// });
|
|
24514
24514
|
|
|
24515
|
-
|
|
24516
|
-
};
|
|
24515
|
+
// return await api_utils.call_javascript(prog_id, params, evaluate);
|
|
24516
|
+
// };
|
|
24517
24517
|
|
|
24518
24518
|
glb.rpi_request_queue_num = 0;
|
|
24519
24519
|
func.common.perform_rpi_request = async function (SESSION_ID, serviceP, opt = {}, data) {
|
|
@@ -35375,271 +35375,271 @@ func.expression.get = async function (SESSION_ID, valP, dsSessionP, sourceP, row
|
|
|
35375
35375
|
return new_class.get();
|
|
35376
35376
|
};
|
|
35377
35377
|
|
|
35378
|
-
func.expression.get_bad1 = async function (SESSION_ID, valP, dsSessionP, sourceP, rowIdP, sourceActionP, secondPassP, calling_fieldIdP, fieldsP = {}, debug_infoP, iterate_info, js_script_callback, jobNo, api_output_type) {
|
|
35379
|
-
|
|
35380
|
-
|
|
35381
|
-
|
|
35382
|
-
|
|
35383
|
-
|
|
35384
|
-
|
|
35385
|
-
|
|
35378
|
+
// func.expression.get_bad1 = async function (SESSION_ID, valP, dsSessionP, sourceP, rowIdP, sourceActionP, secondPassP, calling_fieldIdP, fieldsP = {}, debug_infoP, iterate_info, js_script_callback, jobNo, api_output_type) {
|
|
35379
|
+
// const evalJson = (text) => eval(`(${text})`);
|
|
35380
|
+
// const replaceQuotes = (str) => {
|
|
35381
|
+
// for (const [key, val] of Object.entries(fields)) {
|
|
35382
|
+
// if (typeof val === 'string') str = str.replace(`"${val}"`, val.replace(/"/g, ''));
|
|
35383
|
+
// }
|
|
35384
|
+
// return str;
|
|
35385
|
+
// };
|
|
35386
35386
|
|
|
35387
|
-
|
|
35388
|
-
|
|
35387
|
+
// let ret, error, warning, var_error_found;
|
|
35388
|
+
// const fields = { ...fieldsP };
|
|
35389
35389
|
|
|
35390
|
-
|
|
35391
|
-
|
|
35392
|
-
|
|
35393
|
-
|
|
35390
|
+
// // Initial value processing
|
|
35391
|
+
// if (valP === null || typeof valP === 'undefined') ret = '';
|
|
35392
|
+
// else if (typeof valP === 'boolean') ret = valP ? 'Y' : 'N';
|
|
35393
|
+
// else ret = valP.toString();
|
|
35394
35394
|
|
|
35395
|
-
|
|
35396
|
-
|
|
35395
|
+
// ret = ret.replace(/\&/g, '&');
|
|
35396
|
+
// ret = func.utils.replace_studio_drive_url(SESSION_ID, ret);
|
|
35397
35397
|
|
|
35398
|
-
|
|
35399
|
-
|
|
35400
|
-
|
|
35401
|
-
|
|
35402
|
-
|
|
35403
|
-
|
|
35404
|
-
|
|
35405
|
-
|
|
35406
|
-
|
|
35407
|
-
|
|
35408
|
-
|
|
35409
|
-
|
|
35410
|
-
|
|
35411
|
-
|
|
35412
|
-
|
|
35413
|
-
|
|
35414
|
-
|
|
35415
|
-
|
|
35416
|
-
|
|
35417
|
-
|
|
35418
|
-
|
|
35419
|
-
|
|
35420
|
-
|
|
35398
|
+
// // End results helper
|
|
35399
|
+
// const endResults = () => {
|
|
35400
|
+
// if (['update', 'javascript'].includes(sourceP) && typeof ret === 'string') {
|
|
35401
|
+
// ret = replaceQuotes(ret);
|
|
35402
|
+
// }
|
|
35403
|
+
// if ((error || warning) && SESSION_OBJ[SESSION_ID]?.DS_GLB[dsSessionP]) {
|
|
35404
|
+
// func.utils.debug.log(SESSION_ID, SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP].nodeId, {
|
|
35405
|
+
// module: 'expression',
|
|
35406
|
+
// action: sourceP,
|
|
35407
|
+
// source: calling_fieldIdP,
|
|
35408
|
+
// prop: ret,
|
|
35409
|
+
// details: ret,
|
|
35410
|
+
// result: ret,
|
|
35411
|
+
// error,
|
|
35412
|
+
// warning,
|
|
35413
|
+
// fields: null,
|
|
35414
|
+
// type: 'exp',
|
|
35415
|
+
// prog_id: SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP].prog_id,
|
|
35416
|
+
// debug_info: debug_infoP,
|
|
35417
|
+
// });
|
|
35418
|
+
// }
|
|
35419
|
+
// return { result: ret, fields, error, warning, req: valP, var_error_found };
|
|
35420
|
+
// };
|
|
35421
35421
|
|
|
35422
|
-
|
|
35423
|
-
|
|
35424
|
-
|
|
35425
|
-
|
|
35426
|
-
|
|
35427
|
-
|
|
35428
|
-
|
|
35429
|
-
|
|
35430
|
-
|
|
35431
|
-
|
|
35432
|
-
|
|
35433
|
-
|
|
35434
|
-
|
|
35435
|
-
|
|
35436
|
-
|
|
35437
|
-
|
|
35422
|
+
// // Handle non-variable cases
|
|
35423
|
+
// const handleNonVariable = async () => {
|
|
35424
|
+
// try {
|
|
35425
|
+
// if (sourceP !== 'arguments') {
|
|
35426
|
+
// if (ret.startsWith('_DATE_')) ret = ret.slice(6);
|
|
35427
|
+
// else if (/^\d{4}-\d{2}-\d{2}$/.test(ret) || ret === 'self') return endResults();
|
|
35428
|
+
// else ret = await func.expression.secure_eval(SESSION_ID, sourceP, ret, jobNo, dsSessionP, js_script_callback);
|
|
35429
|
+
// } else {
|
|
35430
|
+
// ret = ret.replace(/_NULL/gi, '');
|
|
35431
|
+
// }
|
|
35432
|
+
// return endResults();
|
|
35433
|
+
// } catch (err) {
|
|
35434
|
+
// error = err.message;
|
|
35435
|
+
// return endResults();
|
|
35436
|
+
// }
|
|
35437
|
+
// };
|
|
35438
35438
|
|
|
35439
|
-
|
|
35440
|
-
|
|
35441
|
-
|
|
35442
|
-
|
|
35443
|
-
|
|
35439
|
+
// // Early return for simple cases
|
|
35440
|
+
// if (!func.expression.validate_variables(valP)) return await handleNonVariable();
|
|
35441
|
+
// if (glb.emailRegex.test(await func.expression.secure_eval(SESSION_ID, sourceP, valP, jobNo, dsSessionP, js_script_callback))) {
|
|
35442
|
+
// return await handleNonVariable();
|
|
35443
|
+
// }
|
|
35444
35444
|
|
|
35445
|
-
|
|
35446
|
-
|
|
35447
|
-
|
|
35448
|
-
|
|
35449
|
-
|
|
35445
|
+
// // Parse and process variables
|
|
35446
|
+
// const split = func.expression.parse(ret) || [];
|
|
35447
|
+
// const var_Arr = await Promise.all(
|
|
35448
|
+
// split.map(async (val, key) => {
|
|
35449
|
+
// const result = { value: val.value, fieldId: val.fieldId };
|
|
35450
35450
|
|
|
35451
|
-
|
|
35451
|
+
// if (!val.fieldId) return result;
|
|
35452
35452
|
|
|
35453
|
-
|
|
35454
|
-
|
|
35455
|
-
|
|
35456
|
-
|
|
35453
|
+
// // Handle _THIS substitution
|
|
35454
|
+
// if (val.fieldId.startsWith('_THIS') && calling_fieldIdP) {
|
|
35455
|
+
// result.fieldId = val.fieldId.length === 5 ? calling_fieldIdP : calling_fieldIdP + val.fieldId.slice(5);
|
|
35456
|
+
// }
|
|
35457
35457
|
|
|
35458
|
-
|
|
35459
|
-
|
|
35460
|
-
|
|
35461
|
-
|
|
35458
|
+
// // Fetch value from datasource
|
|
35459
|
+
// const { ret: fetchedValue, fieldIdP } = await func.datasource.get_value(SESSION_ID, result.fieldId, dsSessionP, rowIdP);
|
|
35460
|
+
// result.value = fetchedValue?.value ?? (sourceP === 'exp' ? fetchedValue?.value : '""');
|
|
35461
|
+
// result.type = fetchedValue?.type;
|
|
35462
35462
|
|
|
35463
|
-
|
|
35464
|
-
|
|
35465
|
-
|
|
35466
|
-
|
|
35467
|
-
|
|
35463
|
+
// // Handle iteration
|
|
35464
|
+
// if (iterate_info) {
|
|
35465
|
+
// if (iterate_info.iterator_key === fieldIdP) result.value = iterate_info._key;
|
|
35466
|
+
// if (iterate_info.iterator_val === fieldIdP) result.value = iterate_info._val;
|
|
35467
|
+
// }
|
|
35468
35468
|
|
|
35469
|
-
|
|
35470
|
-
|
|
35471
|
-
|
|
35472
|
-
|
|
35469
|
+
// // Process nested properties
|
|
35470
|
+
// if (val.value.includes('[') || val.value.includes('.')) {
|
|
35471
|
+
// const { property1, property2 } = await func.expression.get_property(val.value);
|
|
35472
|
+
// const data = fetchedValue?.type === 'object' ? fetchedValue.value : fetchedValue?.prop;
|
|
35473
35473
|
|
|
35474
|
-
|
|
35475
|
-
|
|
35476
|
-
|
|
35477
|
-
|
|
35478
|
-
|
|
35479
|
-
|
|
35480
|
-
|
|
35481
|
-
|
|
35482
|
-
|
|
35483
|
-
|
|
35484
|
-
|
|
35474
|
+
// if (key > 0 && val.value.includes(']') && !val.value.includes('[') && split[key - 1].value) {
|
|
35475
|
+
// const prevData = split[key - 1].value;
|
|
35476
|
+
// result.value = prevData[fieldIdP];
|
|
35477
|
+
// if (val.value.includes('.') && prevData[fieldIdP]) {
|
|
35478
|
+
// result.value = prevData[fieldIdP][property2] ?? '';
|
|
35479
|
+
// }
|
|
35480
|
+
// } else if (data) {
|
|
35481
|
+
// if (property1) result.value = data[property1] ?? '';
|
|
35482
|
+
// if (property2) result.value = (property1 ? data[property1]?.[property2] : data[property2]) ?? '';
|
|
35483
|
+
// }
|
|
35484
|
+
// }
|
|
35485
35485
|
|
|
35486
|
-
|
|
35487
|
-
|
|
35488
|
-
|
|
35489
|
-
|
|
35486
|
+
// fields[fieldIdP] = result.value;
|
|
35487
|
+
// return result;
|
|
35488
|
+
// }),
|
|
35489
|
+
// );
|
|
35490
35490
|
|
|
35491
|
-
|
|
35492
|
-
|
|
35493
|
-
|
|
35494
|
-
|
|
35495
|
-
|
|
35496
|
-
|
|
35497
|
-
|
|
35491
|
+
// // Final evaluation
|
|
35492
|
+
// try {
|
|
35493
|
+
// const res = var_Arr.map((val, key) => {
|
|
35494
|
+
// if (sourceP === 'UI Property EXP' || sourceP === 'UI Attr EXP') {
|
|
35495
|
+
// const { changed, value } = func.utils.get_drive_url(SESSION_ID, val.value, sourceP === 'UI Attr EXP' && var_Arr.length > 1);
|
|
35496
|
+
// if (changed) return value;
|
|
35497
|
+
// }
|
|
35498
35498
|
|
|
35499
|
-
|
|
35500
|
-
|
|
35501
|
-
|
|
35502
|
-
|
|
35503
|
-
|
|
35504
|
-
|
|
35505
|
-
|
|
35506
|
-
|
|
35499
|
+
// let value = val.value;
|
|
35500
|
+
// if (var_Arr.length > 1) {
|
|
35501
|
+
// if (!['DbQuery', 'alert', 'exp', 'api_rendered_output'].includes(sourceP) && ['string', 'date'].includes(val.type)) {
|
|
35502
|
+
// value = `\`${value}\``;
|
|
35503
|
+
// } else if (sourceP === 'api_rendered_output' && api_output_type === 'json' && ['string', 'date'].includes(val.type)) {
|
|
35504
|
+
// value = `"${value}"`;
|
|
35505
|
+
// }
|
|
35506
|
+
// }
|
|
35507
35507
|
|
|
35508
|
-
|
|
35509
|
-
|
|
35510
|
-
|
|
35511
|
-
|
|
35512
|
-
|
|
35513
|
-
|
|
35508
|
+
// if (val.fieldId && typeof value === 'string') {
|
|
35509
|
+
// if (['query', 'condition', 'range', 'sort', 'locate'].includes(sourceP)) value = value.replace(/↵|\r\n|\n|\r/g, '');
|
|
35510
|
+
// if (['init', 'update', 'virtual'].includes(sourceP)) value = value.replace(/↵|\r\n|\n|\r/g, '\\n');
|
|
35511
|
+
// if (typeof IS_PROCESS_SERVER !== 'undefined') value = value.replace(/↵|\r\n|\n|\r/g, '<br>');
|
|
35512
|
+
// fields[val.fieldId] = value;
|
|
35513
|
+
// }
|
|
35514
35514
|
|
|
35515
|
-
|
|
35516
|
-
|
|
35517
|
-
|
|
35515
|
+
// if (typeof value === 'object' && var_Arr.length > 1) {
|
|
35516
|
+
// value = Array.isArray(value) || var_Arr[key + 1]?.value?.includes('.') ? JSON.stringify(value) : `(${JSON.stringify(value)})`;
|
|
35517
|
+
// }
|
|
35518
35518
|
|
|
35519
|
-
|
|
35520
|
-
|
|
35521
|
-
|
|
35522
|
-
|
|
35523
|
-
|
|
35524
|
-
|
|
35525
|
-
|
|
35519
|
+
// if (!val.type === 'exp' && sourceP !== 'exp' && typeof value === 'string' && value.startsWith('@')) {
|
|
35520
|
+
// warning = `Error encoding ${value}`;
|
|
35521
|
+
// var_error_found = true;
|
|
35522
|
+
// return '0';
|
|
35523
|
+
// }
|
|
35524
|
+
// return value;
|
|
35525
|
+
// });
|
|
35526
35526
|
|
|
35527
|
-
|
|
35528
|
-
|
|
35529
|
-
|
|
35530
|
-
|
|
35531
|
-
|
|
35532
|
-
|
|
35533
|
-
|
|
35534
|
-
|
|
35535
|
-
|
|
35536
|
-
|
|
35527
|
+
// ret = res.length === 1 ? res[0] : res.join('');
|
|
35528
|
+
// if (var_Arr.some((v) => v.type === 'exp') && sourceP !== 'exp' && !secondPassP) {
|
|
35529
|
+
// const exp = await func.expression.get(SESSION_ID, ret, dsSessionP, sourceP, rowIdP, sourceActionP, true, calling_fieldIdP, fields, debug_infoP);
|
|
35530
|
+
// ret = exp.res?.[0] ?? exp.result;
|
|
35531
|
+
// Object.assign(fields, exp.fields);
|
|
35532
|
+
// } else if (!secondPassP && !['arguments', 'api_rendered_output', 'DbQuery'].includes(sourceP)) {
|
|
35533
|
+
// ret = await func.expression.secure_eval(SESSION_ID, sourceP, ret, jobNo, dsSessionP, js_script_callback);
|
|
35534
|
+
// } else if (sourceP === 'DbQuery') {
|
|
35535
|
+
// ret = JSON.stringify(evalJson(ret));
|
|
35536
|
+
// }
|
|
35537
35537
|
|
|
35538
|
-
|
|
35539
|
-
|
|
35540
|
-
|
|
35541
|
-
|
|
35542
|
-
|
|
35543
|
-
|
|
35544
|
-
|
|
35538
|
+
// if (typeof ret === 'string' && ret.startsWith('@')) {
|
|
35539
|
+
// error = 'Error encoding @ var';
|
|
35540
|
+
// var_error_found = true;
|
|
35541
|
+
// }
|
|
35542
|
+
// } catch (err) {
|
|
35543
|
+
// error = err.message;
|
|
35544
|
+
// }
|
|
35545
35545
|
|
|
35546
|
-
|
|
35547
|
-
};
|
|
35546
|
+
// return endResults();
|
|
35547
|
+
// };
|
|
35548
35548
|
|
|
35549
|
-
func.expression.parse_org = function (strP) {
|
|
35550
|
-
|
|
35551
|
-
|
|
35552
|
-
|
|
35553
|
-
|
|
35554
|
-
|
|
35555
|
-
|
|
35556
|
-
|
|
35557
|
-
|
|
35558
|
-
|
|
35559
|
-
|
|
35560
|
-
|
|
35561
|
-
|
|
35562
|
-
|
|
35563
|
-
|
|
35564
|
-
|
|
35565
|
-
|
|
35566
|
-
|
|
35567
|
-
|
|
35568
|
-
|
|
35569
|
-
|
|
35570
|
-
|
|
35571
|
-
|
|
35572
|
-
|
|
35573
|
-
|
|
35574
|
-
|
|
35575
|
-
|
|
35576
|
-
|
|
35577
|
-
|
|
35578
|
-
|
|
35579
|
-
|
|
35580
|
-
|
|
35581
|
-
|
|
35582
|
-
|
|
35583
|
-
|
|
35584
|
-
|
|
35585
|
-
|
|
35586
|
-
|
|
35587
|
-
|
|
35588
|
-
|
|
35589
|
-
|
|
35590
|
-
|
|
35591
|
-
|
|
35592
|
-
|
|
35593
|
-
|
|
35594
|
-
|
|
35595
|
-
|
|
35596
|
-
|
|
35597
|
-
|
|
35598
|
-
|
|
35599
|
-
|
|
35600
|
-
|
|
35601
|
-
|
|
35602
|
-
|
|
35603
|
-
|
|
35604
|
-
|
|
35605
|
-
|
|
35606
|
-
|
|
35607
|
-
|
|
35608
|
-
|
|
35609
|
-
|
|
35610
|
-
|
|
35611
|
-
|
|
35612
|
-
|
|
35613
|
-
|
|
35614
|
-
|
|
35615
|
-
|
|
35616
|
-
|
|
35617
|
-
|
|
35618
|
-
|
|
35619
|
-
|
|
35620
|
-
|
|
35621
|
-
|
|
35622
|
-
|
|
35623
|
-
|
|
35624
|
-
|
|
35625
|
-
|
|
35626
|
-
|
|
35627
|
-
|
|
35628
|
-
|
|
35629
|
-
|
|
35630
|
-
|
|
35631
|
-
|
|
35632
|
-
|
|
35633
|
-
|
|
35634
|
-
|
|
35635
|
-
|
|
35636
|
-
|
|
35637
|
-
|
|
35638
|
-
|
|
35639
|
-
|
|
35640
|
-
|
|
35641
|
-
|
|
35642
|
-
};
|
|
35549
|
+
// func.expression.parse_org = function (strP) {
|
|
35550
|
+
// var extract_str = function (strP, posP) {
|
|
35551
|
+
// if (!posP) posP = 0;
|
|
35552
|
+
// var clean_split_str = function (arrP) {
|
|
35553
|
+
// var arr = [];
|
|
35554
|
+
// if (arrP && arrP.length > 1 && arrP[0] === '' && arrP[1].indexOf('@') > -1) {
|
|
35555
|
+
// for (var i = 1; i <= arrP.length; i++) {
|
|
35556
|
+
// arr.push(arrP[i]);
|
|
35557
|
+
// }
|
|
35558
|
+
// return arr;
|
|
35559
|
+
// } else return arrP;
|
|
35560
|
+
// };
|
|
35561
|
+
// var nonLettersPatt = /\W/; // non letters
|
|
35562
|
+
// var validSymbolsNoArray = /[^.@\[]/; //valid symbols no array /[^.@\[\]\]]/
|
|
35563
|
+
// var validSymbolsWithArray = /[^.@"'\[\]]/; //valid symbols with array
|
|
35564
|
+
// var validSymbols = validSymbolsNoArray;
|
|
35565
|
+
// var splitTmp = strP.replace(/@/g, '^^@').split('^^');
|
|
35566
|
+
// var split = clean_split_str(splitTmp);
|
|
35567
|
+
// var obj = [];
|
|
35568
|
+
// if (split) {
|
|
35569
|
+
// for (let val of split) {
|
|
35570
|
+
// // run on @ segments
|
|
35571
|
+
// if (val) {
|
|
35572
|
+
// var pos = strP.indexOf(val);
|
|
35573
|
+
// if (val && val.substr(0, 1) === '@') {
|
|
35574
|
+
// var tmpStr = '';
|
|
35575
|
+
// var word_start_pos = undefined;
|
|
35576
|
+
// var word_end_pos = undefined;
|
|
35577
|
+
// // run on @ segment string
|
|
35578
|
+
// for (var i = 0; i <= val.length; i++) {
|
|
35579
|
+
// var key1 = i;
|
|
35580
|
+
// var val1 = val.substr(i, 1);
|
|
35581
|
+
// if (
|
|
35582
|
+
// val1 === '.' &&
|
|
35583
|
+
// !word_start_pos // find first dot
|
|
35584
|
+
// )
|
|
35585
|
+
// word_start_pos = key1;
|
|
35586
|
+
// if (
|
|
35587
|
+
// word_start_pos &&
|
|
35588
|
+
// key1 > word_start_pos &&
|
|
35589
|
+
// nonLettersPatt.test(val1) // find any sign character to mark the end of word
|
|
35590
|
+
// )
|
|
35591
|
+
// word_end_pos = key1;
|
|
35592
|
+
// if (word_start_pos && word_start_pos >= 0 && word_end_pos && word_end_pos >= 0) {
|
|
35593
|
+
// // find the word
|
|
35594
|
+
// var word = val.substr(word_start_pos + 1, word_end_pos - word_start_pos - 1); // get the word
|
|
35595
|
+
// // if (glb.ALL_PROPERTIES_ARR.indexOf(word) === -1) {
|
|
35596
|
+
// // compare with internal properties
|
|
35597
|
+
// tmpStr = tmpStr.substr(0, word_start_pos) + '^^' + tmpStr.substr(word_start_pos, word_end_pos);
|
|
35598
|
+
// // }
|
|
35599
|
+
// if (val.substr(word_end_pos, 1) === '.') word_start_pos = word_end_pos;
|
|
35600
|
+
// else word_start_pos = null;
|
|
35601
|
+
// word_end_pos = null;
|
|
35602
|
+
// }
|
|
35603
|
+
// if (val1 === '[') validSymbols = validSymbolsWithArray;
|
|
35604
|
+
// if (nonLettersPatt.test(val1) && validSymbols.test(val1) && tmpStr.indexOf('^^') === -1) {
|
|
35605
|
+
// tmpStr += '^^' + val1;
|
|
35606
|
+
// } else tmpStr += val1;
|
|
35607
|
+
// }
|
|
35608
|
+
// // });
|
|
35609
|
+
// if (tmpStr.indexOf('^^') > -1) {
|
|
35610
|
+
// var obj1 = extract_str(tmpStr, pos);
|
|
35611
|
+
// obj = obj.concat(obj1);
|
|
35612
|
+
// } else {
|
|
35613
|
+
// // push clean @var
|
|
35614
|
+
// var fieldId = undefined;
|
|
35615
|
+
// if (val) {
|
|
35616
|
+
// fieldId = val.substr(1, val.length);
|
|
35617
|
+
// if (val.indexOf('.') > -1) fieldId = val.substr(1, val.indexOf('.') - 1);
|
|
35618
|
+
// if (val.indexOf('[') > -1) fieldId = val.substr(1, val.indexOf('[') - 1);
|
|
35619
|
+
// //
|
|
35620
|
+
// // if (val.indexOf("]") > -1)
|
|
35621
|
+
// // fieldId = val.substr(1, val.indexOf("]") - 1);
|
|
35622
|
+
// }
|
|
35623
|
+
// obj.push({
|
|
35624
|
+
// value: val,
|
|
35625
|
+
// fieldId: fieldId,
|
|
35626
|
+
// pos: pos + posP,
|
|
35627
|
+
// });
|
|
35628
|
+
// }
|
|
35629
|
+
// } else {
|
|
35630
|
+
// obj.push({
|
|
35631
|
+
// value: val,
|
|
35632
|
+
// pos: pos + posP,
|
|
35633
|
+
// });
|
|
35634
|
+
// }
|
|
35635
|
+
// }
|
|
35636
|
+
// }
|
|
35637
|
+
// return obj;
|
|
35638
|
+
// }
|
|
35639
|
+
// };
|
|
35640
|
+
// var res = extract_str(strP);
|
|
35641
|
+
// return res;
|
|
35642
|
+
// };
|
|
35643
35643
|
|
|
35644
35644
|
func.expression.parse = function (input) {
|
|
35645
35645
|
if (typeof input !== 'string') return [];
|
|
@@ -35708,50 +35708,50 @@ func.expression.get_property = async function (valP) {
|
|
|
35708
35708
|
};
|
|
35709
35709
|
};
|
|
35710
35710
|
|
|
35711
|
-
func.expression.get_property_bad = async function (valP) {
|
|
35712
|
-
|
|
35711
|
+
// func.expression.get_property_bad = async function (valP) {
|
|
35712
|
+
// if (typeof valP !== 'string') return { property1: undefined, property2: undefined };
|
|
35713
35713
|
|
|
35714
|
-
|
|
35715
|
-
|
|
35716
|
-
|
|
35717
|
-
|
|
35718
|
-
|
|
35719
|
-
|
|
35720
|
-
|
|
35721
|
-
|
|
35722
|
-
|
|
35723
|
-
|
|
35724
|
-
|
|
35725
|
-
|
|
35726
|
-
|
|
35727
|
-
|
|
35728
|
-
|
|
35729
|
-
|
|
35730
|
-
|
|
35731
|
-
|
|
35732
|
-
|
|
35733
|
-
|
|
35734
|
-
|
|
35735
|
-
|
|
35736
|
-
|
|
35737
|
-
|
|
35714
|
+
// const secureEval = async (expr) => {
|
|
35715
|
+
// if (typeof IS_PROCESS_SERVER === 'undefined') {
|
|
35716
|
+
// try {
|
|
35717
|
+
// return eval(expr);
|
|
35718
|
+
// } catch (err) {
|
|
35719
|
+
// console.error(err);
|
|
35720
|
+
// return undefined;
|
|
35721
|
+
// }
|
|
35722
|
+
// }
|
|
35723
|
+
// try {
|
|
35724
|
+
// const vm = new VM.VM({
|
|
35725
|
+
// sandbox: {
|
|
35726
|
+
// func,
|
|
35727
|
+
// SESSION_ID,
|
|
35728
|
+
// SESSION_OBJ: { [SESSION_ID]: SESSION_OBJ[SESSION_ID] },
|
|
35729
|
+
// },
|
|
35730
|
+
// timeout: 1000,
|
|
35731
|
+
// allowAsync: false,
|
|
35732
|
+
// });
|
|
35733
|
+
// return await vm.run(expr);
|
|
35734
|
+
// } catch {
|
|
35735
|
+
// return undefined; // Simplified error handling
|
|
35736
|
+
// }
|
|
35737
|
+
// };
|
|
35738
35738
|
|
|
35739
|
-
|
|
35740
|
-
|
|
35741
|
-
|
|
35739
|
+
// let property1, property2;
|
|
35740
|
+
// const bracketStart = valP.indexOf('[');
|
|
35741
|
+
// const bracketEnd = valP.indexOf(']');
|
|
35742
35742
|
|
|
35743
|
-
|
|
35744
|
-
|
|
35745
|
-
|
|
35746
|
-
|
|
35743
|
+
// if (bracketStart > -1 && bracketEnd > bracketStart) {
|
|
35744
|
+
// const expr = valP.slice(bracketStart + 1, bracketEnd);
|
|
35745
|
+
// property1 = await secureEval(expr);
|
|
35746
|
+
// }
|
|
35747
35747
|
|
|
35748
|
-
|
|
35749
|
-
|
|
35750
|
-
|
|
35751
|
-
|
|
35748
|
+
// const dotIndex = valP.indexOf('.');
|
|
35749
|
+
// if (dotIndex > -1) {
|
|
35750
|
+
// property2 = valP.slice(dotIndex + 1);
|
|
35751
|
+
// }
|
|
35752
35752
|
|
|
35753
|
-
|
|
35754
|
-
};
|
|
35753
|
+
// return { property1, property2 };
|
|
35754
|
+
// };
|
|
35755
35755
|
|
|
35756
35756
|
func.expression.validate_constant = function (valP) {
|
|
35757
35757
|
var patt = /["']/;
|
|
@@ -35779,107 +35779,107 @@ func.expression.remove_quotes = function (valP) {
|
|
|
35779
35779
|
// func.expression.validate_constant(valP) && typeof valP === 'string' ? valP.slice(1, -1) : valP;
|
|
35780
35780
|
// };
|
|
35781
35781
|
|
|
35782
|
-
func.expression.secure_eval_org = async function (SESSION_ID, sourceP, val, job_id, dsSessionP, js_script_callback, evt) {
|
|
35783
|
-
|
|
35784
|
-
|
|
35785
|
-
|
|
35786
|
-
|
|
35787
|
-
|
|
35788
|
-
|
|
35789
|
-
|
|
35790
|
-
|
|
35791
|
-
|
|
35792
|
-
|
|
35793
|
-
const xu = api_utils;
|
|
35794
|
-
|
|
35795
|
-
if (typeof IS_PROCESS_SERVER === 'undefined' && typeof IS_DOCKER === 'undefined') {
|
|
35796
|
-
try {
|
|
35797
|
-
return eval(val);
|
|
35798
|
-
} catch (err) {
|
|
35799
|
-
try {
|
|
35800
|
-
return JSON5.parse(val);
|
|
35801
|
-
} catch (err) {
|
|
35802
|
-
// console.error(err);
|
|
35803
|
-
return val;
|
|
35804
|
-
}
|
|
35805
|
-
}
|
|
35806
|
-
}
|
|
35807
|
-
// server side execution
|
|
35808
|
-
if (sourceP === 'javascript') {
|
|
35809
|
-
process.on('uncaughtException', (err) => {
|
|
35810
|
-
console.error('Asynchronous error caught.', err);
|
|
35782
|
+
// func.expression.secure_eval_org = async function (SESSION_ID, sourceP, val, job_id, dsSessionP, js_script_callback, evt) {
|
|
35783
|
+
// const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
35784
|
+
// func,
|
|
35785
|
+
// glb,
|
|
35786
|
+
// SESSION_OBJ,
|
|
35787
|
+
// SESSION_ID,
|
|
35788
|
+
// APP_OBJ,
|
|
35789
|
+
// dsSession: dsSessionP,
|
|
35790
|
+
// job_id,
|
|
35791
|
+
// });
|
|
35811
35792
|
|
|
35812
|
-
|
|
35813
|
-
|
|
35814
|
-
|
|
35815
|
-
|
|
35816
|
-
|
|
35817
|
-
|
|
35818
|
-
|
|
35819
|
-
|
|
35820
|
-
|
|
35821
|
-
|
|
35822
|
-
|
|
35823
|
-
|
|
35824
|
-
|
|
35825
|
-
|
|
35826
|
-
|
|
35827
|
-
|
|
35828
|
-
|
|
35829
|
-
|
|
35830
|
-
|
|
35831
|
-
|
|
35832
|
-
|
|
35833
|
-
|
|
35834
|
-
|
|
35835
|
-
|
|
35836
|
-
|
|
35837
|
-
|
|
35838
|
-
|
|
35839
|
-
|
|
35840
|
-
|
|
35841
|
-
|
|
35842
|
-
|
|
35843
|
-
|
|
35793
|
+
// const xu = api_utils;
|
|
35794
|
+
|
|
35795
|
+
// if (typeof IS_PROCESS_SERVER === 'undefined' && typeof IS_DOCKER === 'undefined') {
|
|
35796
|
+
// try {
|
|
35797
|
+
// return eval(val);
|
|
35798
|
+
// } catch (err) {
|
|
35799
|
+
// try {
|
|
35800
|
+
// return JSON5.parse(val);
|
|
35801
|
+
// } catch (err) {
|
|
35802
|
+
// // console.error(err);
|
|
35803
|
+
// return val;
|
|
35804
|
+
// }
|
|
35805
|
+
// }
|
|
35806
|
+
// }
|
|
35807
|
+
// // server side execution
|
|
35808
|
+
// if (sourceP === 'javascript') {
|
|
35809
|
+
// process.on('uncaughtException', (err) => {
|
|
35810
|
+
// console.error('Asynchronous error caught.', err);
|
|
35811
|
+
|
|
35812
|
+
// func.events.delete_job(SESSION_ID, job_id);
|
|
35813
|
+
// if (typeof IS_PROCESS_SERVER !== 'undefined' || typeof IS_DOCKER !== 'undefined') {
|
|
35814
|
+
// if (SESSION_OBJ[SESSION_ID].crawler) return;
|
|
35815
|
+
// return __.rpi.write_log(SESSION_OBJ[SESSION_ID].app_id, 'error', 'worker', 'vm error', err, null, val, 'func.expression.get.secure_eval');
|
|
35816
|
+
// }
|
|
35817
|
+
// });
|
|
35818
|
+
// try {
|
|
35819
|
+
// const dir = path.join(_conf.studio_drive_path, SESSION_OBJ[SESSION_ID].app_id, 'node_modules', '/');
|
|
35820
|
+
// const script = new VM.VMScript(`try{${val}}catch(e){func.api.error(SESSION_ID, "nodejs error", e); console.error(e); func.events.delete_job(SESSION_ID, job_id);}`, { filename: dir, dirname: dir });
|
|
35821
|
+
// let vm = new VM.NodeVM({
|
|
35822
|
+
// require: {
|
|
35823
|
+
// external: true,
|
|
35824
|
+
// },
|
|
35825
|
+
// sandbox: {
|
|
35826
|
+
// func,
|
|
35827
|
+
// xu,
|
|
35828
|
+
// SESSION_ID,
|
|
35829
|
+
// SESSION_OBJ: { [`${SESSION_ID}`]: SESSION_OBJ[SESSION_ID] },
|
|
35830
|
+
// callback: js_script_callback,
|
|
35831
|
+
// job_id,
|
|
35832
|
+
// axios,
|
|
35833
|
+
// got,
|
|
35834
|
+
// FormData,
|
|
35835
|
+
// },
|
|
35836
|
+
// timeout: 60000,
|
|
35837
|
+
// });
|
|
35838
|
+
// return await vm.run(script, {
|
|
35839
|
+
// filename: dir,
|
|
35840
|
+
// dirname: dir,
|
|
35841
|
+
// });
|
|
35842
|
+
// } catch (err) {
|
|
35843
|
+
// console.error('Failed to execute script.', err);
|
|
35844
35844
|
|
|
35845
|
-
|
|
35846
|
-
|
|
35847
|
-
|
|
35848
|
-
|
|
35849
|
-
|
|
35850
|
-
|
|
35851
|
-
|
|
35852
|
-
|
|
35853
|
-
|
|
35854
|
-
|
|
35855
|
-
|
|
35856
|
-
|
|
35857
|
-
|
|
35858
|
-
|
|
35859
|
-
|
|
35860
|
-
|
|
35861
|
-
|
|
35862
|
-
|
|
35863
|
-
|
|
35864
|
-
|
|
35865
|
-
|
|
35866
|
-
|
|
35867
|
-
|
|
35868
|
-
|
|
35869
|
-
|
|
35870
|
-
|
|
35871
|
-
|
|
35872
|
-
|
|
35873
|
-
|
|
35874
|
-
|
|
35875
|
-
|
|
35876
|
-
|
|
35877
|
-
|
|
35878
|
-
|
|
35879
|
-
|
|
35880
|
-
|
|
35881
|
-
|
|
35882
|
-
};
|
|
35845
|
+
// if (typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
35846
|
+
// func.events.delete_job(SESSION_ID, jobNo);
|
|
35847
|
+
// return __.db.add_error_log(SESSION_OBJ[SESSION_ID].app_id, 'api', err);
|
|
35848
|
+
// }
|
|
35849
|
+
// }
|
|
35850
|
+
// } else {
|
|
35851
|
+
// try {
|
|
35852
|
+
// try {
|
|
35853
|
+
// let vm = new VM.VM({
|
|
35854
|
+
// sandbox: {
|
|
35855
|
+
// xu,
|
|
35856
|
+
// func,
|
|
35857
|
+
// SESSION_ID,
|
|
35858
|
+
// SESSION_OBJ: { [`${SESSION_ID}`]: SESSION_OBJ[SESSION_ID] },
|
|
35859
|
+
// callback: js_script_callback,
|
|
35860
|
+
// job_id,
|
|
35861
|
+
// },
|
|
35862
|
+
// timeout: 1000,
|
|
35863
|
+
// allowAsync: false,
|
|
35864
|
+
// });
|
|
35865
|
+
// let ret = val;
|
|
35866
|
+
// if (typeof val === 'string') {
|
|
35867
|
+
// ret = await vm.run(val);
|
|
35868
|
+
// }
|
|
35869
|
+
// return ret;
|
|
35870
|
+
// } catch (err) {
|
|
35871
|
+
// throw '';
|
|
35872
|
+
// }
|
|
35873
|
+
// } catch (err) {
|
|
35874
|
+
// try {
|
|
35875
|
+
// return JSON5.parse(val);
|
|
35876
|
+
// } catch (err) {
|
|
35877
|
+
// // console.error(err);
|
|
35878
|
+
// return val;
|
|
35879
|
+
// }
|
|
35880
|
+
// }
|
|
35881
|
+
// }
|
|
35882
|
+
// };
|
|
35883
35883
|
|
|
35884
35884
|
func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id, dsSessionP, js_script_callback, evt) {
|
|
35885
35885
|
if (typeof val !== 'string') return val;
|
|
@@ -36706,14 +36706,14 @@ func.events.execute = async function (
|
|
|
36706
36706
|
|
|
36707
36707
|
call_native_javascript: async function () {
|
|
36708
36708
|
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
36709
|
-
const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession, false, $
|
|
36709
|
+
const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession, false, $div);
|
|
36710
36710
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
36711
36711
|
|
|
36712
36712
|
return result;
|
|
36713
36713
|
},
|
|
36714
36714
|
call_evaluate_javascript: async function () {
|
|
36715
36715
|
const module = await func.common.get_module(SESSION_ID, 'xuda-event-javascript-module.mjs');
|
|
36716
|
-
const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession, true, $
|
|
36716
|
+
const result = await module.call_javascript(SESSION_ID, jobNoP, refIdP, dsSession, true, $div);
|
|
36717
36717
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
36718
36718
|
|
|
36719
36719
|
return result;
|
|
@@ -36732,6 +36732,7 @@ func.events.execute = async function (
|
|
|
36732
36732
|
null,
|
|
36733
36733
|
null,
|
|
36734
36734
|
evt,
|
|
36735
|
+
$div,
|
|
36735
36736
|
);
|
|
36736
36737
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
36737
36738
|
|
|
@@ -36751,6 +36752,7 @@ func.events.execute = async function (
|
|
|
36751
36752
|
null,
|
|
36752
36753
|
null,
|
|
36753
36754
|
evt,
|
|
36755
|
+
$div,
|
|
36754
36756
|
);
|
|
36755
36757
|
await func.datasource.set_outputField(SESSION_ID, dsSessionP, result, args);
|
|
36756
36758
|
|