@xuda.io/runtime-bundle 1.0.1413 → 1.0.1415
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/modules/xuda-actions-module.esm.js +10 -10
- package/js/modules/xuda-actions-module.esm.min.js +1 -1
- package/js/modules/xuda-api-library.min.mjs +1 -1
- package/js/modules/xuda-api-library.mjs +1 -1
- package/js/modules/xuda-datasource-db-adapter-module.min.mjs +1 -1
- package/js/modules/xuda-datasource-db-adapter-module.mjs +4 -4
- package/js/modules/xuda-db-adapter-module.min.mjs +1 -1
- package/js/modules/xuda-db-adapter-module.mjs +9 -9
- package/js/modules/xuda-debug-utils-module.min.mjs +1 -1
- package/js/modules/xuda-debug-utils-module.mjs +6 -6
- package/js/modules/xuda-event-ui-elements-module.esm.js +6 -6
- package/js/modules/xuda-event-ui-elements-module.esm.min.js +1 -1
- package/js/modules/xuda-get-cast-util-module.min.mjs +1 -1
- package/js/modules/xuda-get-cast-util-module.mjs +5 -10
- package/js/modules/xuda-get-support-module.esm.js +15 -12
- package/js/modules/xuda-get-support-module.esm.min.js +1 -1
- package/js/modules/xuda-input-musk-utils-module.min.mjs +1 -1
- package/js/modules/xuda-input-musk-utils-module.mjs +22 -35
- package/js/modules/xuda-live-preview-module.esm.js +36 -31
- package/js/modules/xuda-live-preview-module.esm.min.js +1 -1
- package/js/modules/xuda-peer-actions-module.esm.js +5 -5
- package/js/modules/xuda-peer-actions-module.esm.min.js +1 -1
- package/js/modules/xuda-progs-loader-module.min.mjs +1 -1
- package/js/modules/xuda-progs-loader-module.mjs +8 -7
- package/js/modules/xuda-project-loader-module.esm.js +17 -12
- package/js/modules/xuda-project-loader-module.esm.min.js +1 -1
- package/js/modules/xuda-studio-checker.min.mjs +1 -1
- package/js/modules/xuda-studio-checker.mjs +79 -80
- package/js/xuda-runtime-bundle.js +1604 -1186
- package/js/xuda-runtime-bundle.min.js +5 -5
- package/js/xuda-runtime-mini-bundle.js +22 -52
- package/js/xuda-runtime-mini-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +1604 -1111
- package/js/xuda-runtime-slim.min.es.js +1605 -1187
- package/js/xuda-runtime-slim.min.js +4 -4
- package/js/xuda-runtime-vendor.js +1 -212
- package/js/xuda-runtime-vendor.min.js +2 -2
- package/js/xuda-server-bundle.min.mjs +2 -2
- package/js/xuda-server-bundle.mjs +746 -158
- package/js/xuda-worker-bundle.js +746 -158
- package/js/xuda-worker-bundle.min.js +2 -2
- package/js/xuda_common-bundle.js +237 -29
- package/js/xuda_common-bundle.min.js +1 -1
- package/js/xuda_worker.js +0 -6
- package/js/xuda_worker.min.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// check unique index id
|
|
4
4
|
// check unique field id
|
|
5
5
|
|
|
6
|
-
var app_obj, progs_obj,
|
|
6
|
+
var app_obj, progs_obj, progs_str, hide_not_in_use_check, is_server, deployments, UglifyJS, JSON5, _conf, warn_plugin_check, z;
|
|
7
7
|
const PROTECTED_VARS = ['_NULL', '_THIS', '_FOR_KEY', '_FOR_VAL', '_ROWNO', '_ROWID', '_ROWDOC', '_KEY', '_VAL'];
|
|
8
8
|
const ALL_MENU_TYPE = ['globals', 'component', 'ai_agent', 'batch', 'get_data', 'set_data', 'alert', 'javascript', 'api', 'table', 'folder'];
|
|
9
9
|
|
|
@@ -14,7 +14,6 @@ export const init = function (app_obj_in, progs_obj_in = {}, _in, _hide_not_in_u
|
|
|
14
14
|
progs_obj = progs_obj_in;
|
|
15
15
|
progs_str = JSON.stringify(progs_obj);
|
|
16
16
|
hide_not_in_use_check = _hide_not_in_use_check;
|
|
17
|
-
_ = _in;
|
|
18
17
|
is_server = is_server_in;
|
|
19
18
|
deployments = deployments_in;
|
|
20
19
|
UglifyJS = UglifyJS_in;
|
|
@@ -48,7 +47,7 @@ export const check = function (doc) {
|
|
|
48
47
|
};
|
|
49
48
|
|
|
50
49
|
// Early validation checks
|
|
51
|
-
if (
|
|
50
|
+
if (xu_isEmpty(doc)) {
|
|
52
51
|
addValidationError('CHK_MSG_OBJ_GEN_110', 'doc in empty');
|
|
53
52
|
return {
|
|
54
53
|
check_errors: ret,
|
|
@@ -219,13 +218,13 @@ export const check_structure = function (doc, critical_error) {
|
|
|
219
218
|
};
|
|
220
219
|
|
|
221
220
|
// Early exit conditions that prevent further validation
|
|
222
|
-
if (typeof app_obj !== 'undefined' && (!app_obj || !
|
|
221
|
+
if (typeof app_obj !== 'undefined' && (!app_obj || !(typeof app_obj === 'object' && app_obj !== null) || xu_isEmpty(app_obj))) {
|
|
223
222
|
addValidationError('CHK_MSG_OBJ_GEN_002', 'invalid app_obj');
|
|
224
223
|
critical_error = true;
|
|
225
224
|
return ret;
|
|
226
225
|
}
|
|
227
226
|
|
|
228
|
-
if (!doc || !
|
|
227
|
+
if (!doc || !(typeof doc === 'object' && doc !== null) || xu_isEmpty(doc)) {
|
|
229
228
|
addValidationError('CHK_MSG_OBJ_GEN_004', 'doc is not a object');
|
|
230
229
|
critical_error = true;
|
|
231
230
|
return ret;
|
|
@@ -300,7 +299,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
300
299
|
if (!doc.properties) {
|
|
301
300
|
addValidationError('CHK_MSG_OBJ_GEN_100', 'missing properties object');
|
|
302
301
|
} else {
|
|
303
|
-
if (!
|
|
302
|
+
if (!(typeof doc.properties === 'object' && doc.properties !== null)) {
|
|
304
303
|
addValidationError('CHK_MSG_OBJ_GEN_102', 'invalid properties object');
|
|
305
304
|
} else {
|
|
306
305
|
if (!doc.properties.menuType) {
|
|
@@ -320,7 +319,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
320
319
|
if (!doc.studio_meta) {
|
|
321
320
|
addValidationError('CHK_MSG_OBJ_GEN_112', 'missing studio_meta property');
|
|
322
321
|
} else {
|
|
323
|
-
if (!
|
|
322
|
+
if (!(typeof doc.studio_meta === 'object' && doc.studio_meta !== null)) {
|
|
324
323
|
addValidationError('CHK_MSG_OBJ_GEN_112', 'invalid studio_meta object');
|
|
325
324
|
} else {
|
|
326
325
|
if (!doc.studio_meta.parentId) {
|
|
@@ -338,7 +337,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
338
337
|
if (!doc.progFields) return;
|
|
339
338
|
|
|
340
339
|
var ids = [];
|
|
341
|
-
if (!
|
|
340
|
+
if (!Array.isArray(doc.progFields)) {
|
|
342
341
|
addValidationError('CHK_MSG_OBJ_GEN_402', 'invalid progFields Array property');
|
|
343
342
|
return;
|
|
344
343
|
}
|
|
@@ -347,7 +346,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
347
346
|
const validFieldTypes = ['string', 'number', 'boolean', 'array', 'object'];
|
|
348
347
|
|
|
349
348
|
for (let val of doc.progFields) {
|
|
350
|
-
if (!
|
|
349
|
+
if (!(typeof val === 'object' && val !== null)) {
|
|
351
350
|
addValidationError('CHK_MSG_OBJ_GEN_404', `Invalid progFields object `);
|
|
352
351
|
continue;
|
|
353
352
|
}
|
|
@@ -363,7 +362,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
363
362
|
}
|
|
364
363
|
ids.push(val.id);
|
|
365
364
|
}
|
|
366
|
-
if (!
|
|
365
|
+
if (!(typeof val.data === 'object' && val.data !== null)) {
|
|
367
366
|
addValidationError('CHK_MSG_OBJ_GEN_410', `Invalid progFields data object ${fieldId}`);
|
|
368
367
|
} else {
|
|
369
368
|
if (!val.data.field_id) {
|
|
@@ -377,7 +376,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
377
376
|
}
|
|
378
377
|
}
|
|
379
378
|
|
|
380
|
-
if (!
|
|
379
|
+
if (!(typeof val.props === 'object' && val.props !== null)) {
|
|
381
380
|
addValidationError('CHK_MSG_OBJ_GEN_416', `Invalid progFields props object ${fieldId}`);
|
|
382
381
|
} else {
|
|
383
382
|
if (!val.props.fieldType) {
|
|
@@ -386,7 +385,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
386
385
|
addValidationError('CHK_MSG_OBJ_GEN_419', `Invalid progFields fieldType "${val.props.fieldType}" ${fieldId}. Must be one of: ${validFieldTypes.join(', ')}`);
|
|
387
386
|
}
|
|
388
387
|
|
|
389
|
-
if (!
|
|
388
|
+
if (!(typeof val.props.propExpressions === 'object' && val.props.propExpressions !== null)) {
|
|
390
389
|
addValidationError('CHK_MSG_OBJ_GEN_4120', `Invalid progFields propExpressions object ${fieldId}`);
|
|
391
390
|
} else {
|
|
392
391
|
// Validate propExpressions only contains allowed properties
|
|
@@ -408,13 +407,13 @@ export const check_structure = function (doc, critical_error) {
|
|
|
408
407
|
if (!doc.progEvents) return;
|
|
409
408
|
|
|
410
409
|
var ids = [];
|
|
411
|
-
if (!
|
|
410
|
+
if (!Array.isArray(doc.progEvents)) {
|
|
412
411
|
addValidationError('CHK_MSG_OBJ_GEN_502', 'invalid progEvents Array property');
|
|
413
412
|
return;
|
|
414
413
|
}
|
|
415
414
|
|
|
416
415
|
for (let val of doc.progEvents) {
|
|
417
|
-
if (!
|
|
416
|
+
if (!(typeof val === 'object' && val !== null)) {
|
|
418
417
|
addValidationError('CHK_MSG_OBJ_GEN_504', 'invalid progEvents object property');
|
|
419
418
|
continue;
|
|
420
419
|
}
|
|
@@ -430,7 +429,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
430
429
|
}
|
|
431
430
|
ids.push(val.id);
|
|
432
431
|
|
|
433
|
-
if (!
|
|
432
|
+
if (!(typeof val.data === 'object' && val.data !== null)) {
|
|
434
433
|
addValidationError('CHK_MSG_OBJ_GEN_510', 'invalid progEvents.data object property');
|
|
435
434
|
continue;
|
|
436
435
|
}
|
|
@@ -451,11 +450,11 @@ export const check_structure = function (doc, critical_error) {
|
|
|
451
450
|
addValidationError('CHK_MSG_OBJ_GEN_518', 'undefined progEvents.data.type string property');
|
|
452
451
|
}
|
|
453
452
|
|
|
454
|
-
if (!
|
|
453
|
+
if (!Array.isArray(val.data.parameters)) {
|
|
455
454
|
addValidationError('CHK_MSG_OBJ_GEN_522', 'invalid progEvents.data.parameters Array property');
|
|
456
455
|
}
|
|
457
456
|
|
|
458
|
-
if (!
|
|
457
|
+
if (!(typeof val.props === 'object' && val.props !== null)) {
|
|
459
458
|
addValidationError('CHK_MSG_OBJ_GEN_522', 'invalid progEvents.props Object property');
|
|
460
459
|
}
|
|
461
460
|
|
|
@@ -467,13 +466,13 @@ export const check_structure = function (doc, critical_error) {
|
|
|
467
466
|
if (!workflow) return;
|
|
468
467
|
|
|
469
468
|
var ids = [];
|
|
470
|
-
if (!
|
|
469
|
+
if (!Array.isArray(workflow)) {
|
|
471
470
|
addValidationError('CHK_MSG_OBJ_GEN_850', 'invalid workflow Array property');
|
|
472
471
|
return;
|
|
473
472
|
}
|
|
474
473
|
|
|
475
474
|
for (let val of workflow) {
|
|
476
|
-
if (!
|
|
475
|
+
if (!(typeof val === 'object' && val !== null)) {
|
|
477
476
|
addValidationError('CHK_MSG_OBJ_GEN_852', 'invalid workflow item object property');
|
|
478
477
|
continue;
|
|
479
478
|
}
|
|
@@ -489,11 +488,11 @@ export const check_structure = function (doc, critical_error) {
|
|
|
489
488
|
}
|
|
490
489
|
ids.push(val.id);
|
|
491
490
|
|
|
492
|
-
if (!
|
|
491
|
+
if (!(typeof val.data === 'object' && val.data !== null)) {
|
|
493
492
|
addValidationError('CHK_MSG_OBJ_GEN_858', 'invalid workflow.data Object property');
|
|
494
493
|
}
|
|
495
494
|
|
|
496
|
-
if (!
|
|
495
|
+
if (!(typeof val.props === 'object' && val.props !== null)) {
|
|
497
496
|
addValidationError('CHK_MSG_OBJ_GEN_860', 'invalid workflow.props item object property');
|
|
498
497
|
}
|
|
499
498
|
}
|
|
@@ -502,7 +501,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
502
501
|
const check_progDataSource = function () {
|
|
503
502
|
if (!doc.progDataSource) return;
|
|
504
503
|
|
|
505
|
-
if (!
|
|
504
|
+
if (!(typeof doc.progDataSource === 'object' && doc.progDataSource !== null)) {
|
|
506
505
|
addValidationError('CHK_MSG_OBJ_GEN_602', 'invalid progDataSource Object property');
|
|
507
506
|
return;
|
|
508
507
|
}
|
|
@@ -515,7 +514,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
515
514
|
const check_progUi = function () {
|
|
516
515
|
if (!doc.progUi) return;
|
|
517
516
|
|
|
518
|
-
if (!
|
|
517
|
+
if (!Array.isArray(doc.progUi)) {
|
|
519
518
|
addValidationError('CHK_MSG_OBJ_GEN_702', 'invalid progUi Array property');
|
|
520
519
|
return;
|
|
521
520
|
}
|
|
@@ -523,7 +522,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
523
522
|
var ids = [];
|
|
524
523
|
const run_tree = function (node) {
|
|
525
524
|
for (let item of node) {
|
|
526
|
-
if (!
|
|
525
|
+
if (!(typeof item === 'object' && item !== null)) {
|
|
527
526
|
addValidationError('CHK_MSG_OBJ_GEN_704', 'invalid progUi item Object property');
|
|
528
527
|
continue;
|
|
529
528
|
}
|
|
@@ -543,7 +542,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
543
542
|
continue;
|
|
544
543
|
}
|
|
545
544
|
|
|
546
|
-
if (item?.attributes && !
|
|
545
|
+
if (item?.attributes && !(typeof item.attributes === 'object' && item.attributes !== null)) {
|
|
547
546
|
addValidationError('CHK_MSG_OBJ_GEN_707', `Invalid progUi attributes object property (${item.id})`);
|
|
548
547
|
}
|
|
549
548
|
|
|
@@ -583,13 +582,13 @@ export const check_structure = function (doc, critical_error) {
|
|
|
583
582
|
if (!doc.tableFields) {
|
|
584
583
|
addValidationError('CHK_MSG_OBJ_GEN_200', 'missing tableFields property');
|
|
585
584
|
} else {
|
|
586
|
-
if (!
|
|
585
|
+
if (!Array.isArray(doc.tableFields)) {
|
|
587
586
|
addValidationError('CHK_MSG_OBJ_GEN_202', 'invalid tableFields Array property');
|
|
588
587
|
} else {
|
|
589
588
|
var ids = [];
|
|
590
589
|
|
|
591
590
|
for (let val of doc.tableFields) {
|
|
592
|
-
if (!
|
|
591
|
+
if (!(typeof val === 'object' && val !== null)) {
|
|
593
592
|
addValidationError('CHK_MSG_OBJ_GEN_204', 'invalid tableFields object property');
|
|
594
593
|
continue;
|
|
595
594
|
}
|
|
@@ -605,7 +604,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
605
604
|
}
|
|
606
605
|
ids.push(val.id);
|
|
607
606
|
|
|
608
|
-
if (!
|
|
607
|
+
if (!(typeof val.data === 'object' && val.data !== null)) {
|
|
609
608
|
addValidationError('CHK_MSG_OBJ_GEN_210', 'invalid tableFields.data object property');
|
|
610
609
|
continue;
|
|
611
610
|
}
|
|
@@ -614,7 +613,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
614
613
|
addValidationError('CHK_MSG_OBJ_GEN_212', 'invalid tableFields.data.field_id property');
|
|
615
614
|
}
|
|
616
615
|
|
|
617
|
-
if (!
|
|
616
|
+
if (!(typeof val.props === 'object' && val.props !== null)) {
|
|
618
617
|
addValidationError('CHK_MSG_OBJ_GEN_214', 'invalid tableFields.props object property');
|
|
619
618
|
continue;
|
|
620
619
|
}
|
|
@@ -629,12 +628,12 @@ export const check_structure = function (doc, critical_error) {
|
|
|
629
628
|
// tableIndexes validation
|
|
630
629
|
if (!doc.tableIndexes) {
|
|
631
630
|
addValidationError('CHK_MSG_OBJ_GEN_302', 'missing tableIndexes property');
|
|
632
|
-
} else if (!
|
|
631
|
+
} else if (!Array.isArray(doc.tableIndexes)) {
|
|
633
632
|
addValidationError('CHK_MSG_OBJ_GEN_302', 'invalid tableIndexes Array property');
|
|
634
633
|
} else {
|
|
635
634
|
var index_ids = [];
|
|
636
635
|
for (let val of doc.tableIndexes) {
|
|
637
|
-
if (!
|
|
636
|
+
if (!(typeof val === 'object' && val !== null)) {
|
|
638
637
|
addValidationError('CHK_MSG_OBJ_GEN_304', 'invalid tableIndexes object property');
|
|
639
638
|
continue;
|
|
640
639
|
}
|
|
@@ -650,7 +649,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
650
649
|
}
|
|
651
650
|
index_ids.push(val.id);
|
|
652
651
|
|
|
653
|
-
if (!
|
|
652
|
+
if (!(typeof val.data === 'object' && val.data !== null)) {
|
|
654
653
|
addValidationError('CHK_MSG_OBJ_GEN_310', 'invalid tableIndexes.data object property');
|
|
655
654
|
continue;
|
|
656
655
|
}
|
|
@@ -659,7 +658,7 @@ export const check_structure = function (doc, critical_error) {
|
|
|
659
658
|
addValidationError('CHK_MSG_OBJ_GEN_312', 'invalid tableIndexes.data.name property');
|
|
660
659
|
}
|
|
661
660
|
|
|
662
|
-
if (!
|
|
661
|
+
if (!Array.isArray(val.data.keys)) {
|
|
663
662
|
addValidationError('CHK_MSG_OBJ_GEN_312', 'invalid tableIndexes.data.keys Array property');
|
|
664
663
|
}
|
|
665
664
|
}
|
|
@@ -849,7 +848,7 @@ const check_table = function (doc) {
|
|
|
849
848
|
});
|
|
850
849
|
} else {
|
|
851
850
|
for (let key of index.data.keys) {
|
|
852
|
-
if (!doc.tableFields || !
|
|
851
|
+
if (!doc.tableFields || !Array.isArray(doc.tableFields) || !find_item_by_key(doc.tableFields, 'field_id', key)) {
|
|
853
852
|
ret.push({
|
|
854
853
|
code: 'CHK_MSG_TBL_IDX_080',
|
|
855
854
|
data: `invalid key ${key} in tableIndexes.data.keys for "${index.id}" index`,
|
|
@@ -992,7 +991,7 @@ const check_component = function (doc) {
|
|
|
992
991
|
}
|
|
993
992
|
|
|
994
993
|
if (key.substr(0, 6) === 'xu-on:') {
|
|
995
|
-
if (!
|
|
994
|
+
if (!xu_isEmpty(val)) {
|
|
996
995
|
for (let trigger_item of val) {
|
|
997
996
|
// try {
|
|
998
997
|
ret = [...ret, ...check_prog_triggers(doc, trigger_item.workflow, 'ui_trigger', item.id, item.attributes.tree_id)];
|
|
@@ -1026,7 +1025,7 @@ const check_component = function (doc) {
|
|
|
1026
1025
|
}
|
|
1027
1026
|
}
|
|
1028
1027
|
|
|
1029
|
-
// if (!
|
|
1028
|
+
// if (!xu_isEmpty(item.workflow)) {
|
|
1030
1029
|
// debugger;
|
|
1031
1030
|
// ret = [
|
|
1032
1031
|
// ...ret,
|
|
@@ -1098,7 +1097,7 @@ const check_set_data = function (doc) {
|
|
|
1098
1097
|
const check_alert = function (doc) {
|
|
1099
1098
|
var ret = [];
|
|
1100
1099
|
|
|
1101
|
-
if (
|
|
1100
|
+
if (xu_isEmpty(doc.alertData)) {
|
|
1102
1101
|
ret.push({
|
|
1103
1102
|
code: 'CHK_MSG_PRG_ART_010',
|
|
1104
1103
|
data: `no alert properties defined`,
|
|
@@ -1154,7 +1153,7 @@ const check_alert = function (doc) {
|
|
|
1154
1153
|
const check_route = function (doc) {
|
|
1155
1154
|
var ret = [];
|
|
1156
1155
|
|
|
1157
|
-
if (
|
|
1156
|
+
if (xu_isEmpty(doc?.routeMenu?.menu)) {
|
|
1158
1157
|
ret.push({
|
|
1159
1158
|
code: 'CHK_MSG_RTE_MNU_010',
|
|
1160
1159
|
data: `no route properties defined`,
|
|
@@ -1256,7 +1255,7 @@ const check_ai_agent = function (doc) {
|
|
|
1256
1255
|
for (const tool of doc?.agentConfig?.agent_tools || []) {
|
|
1257
1256
|
switch (tool.type) {
|
|
1258
1257
|
case 'file_search': {
|
|
1259
|
-
if (
|
|
1258
|
+
if (xu_isEmpty(tool.file)) {
|
|
1260
1259
|
ret.push({
|
|
1261
1260
|
code: 'CHK_MSG_PRG_AGN_100',
|
|
1262
1261
|
data: 'Ai Agent file_search set but could not find file configuration',
|
|
@@ -1266,7 +1265,7 @@ const check_ai_agent = function (doc) {
|
|
|
1266
1265
|
id: `${doc._id}`,
|
|
1267
1266
|
});
|
|
1268
1267
|
} else {
|
|
1269
|
-
if (
|
|
1268
|
+
if (xu_isEmpty(tool?.file?.access_link)) {
|
|
1270
1269
|
ret.push({
|
|
1271
1270
|
code: 'CHK_MSG_PRG_AGN_110',
|
|
1272
1271
|
data: 'Ai Agent file_search set but could not find file configuration',
|
|
@@ -1276,7 +1275,7 @@ const check_ai_agent = function (doc) {
|
|
|
1276
1275
|
id: `${doc._id}`,
|
|
1277
1276
|
});
|
|
1278
1277
|
} else {
|
|
1279
|
-
if (
|
|
1278
|
+
if (xu_isEmpty(tool?.file?.file_id)) {
|
|
1280
1279
|
ret.push({
|
|
1281
1280
|
code: 'CHK_MSG_PRG_AGN_120',
|
|
1282
1281
|
data: 'Ai Agent file_search set but could not find file uploaded',
|
|
@@ -1286,7 +1285,7 @@ const check_ai_agent = function (doc) {
|
|
|
1286
1285
|
id: `${doc._id}`,
|
|
1287
1286
|
});
|
|
1288
1287
|
} else {
|
|
1289
|
-
if (
|
|
1288
|
+
if (xu_isEmpty(tool?.file?.vector_file_id)) {
|
|
1290
1289
|
ret.push({
|
|
1291
1290
|
code: 'CHK_MSG_PRG_AGN_130',
|
|
1292
1291
|
data: 'Ai Agent file_search set but could not find vector_file uploaded',
|
|
@@ -1302,7 +1301,7 @@ const check_ai_agent = function (doc) {
|
|
|
1302
1301
|
break;
|
|
1303
1302
|
}
|
|
1304
1303
|
case 'youtube': {
|
|
1305
|
-
if (
|
|
1304
|
+
if (xu_isEmpty(tool?.youtube?.url)) {
|
|
1306
1305
|
ret.push({
|
|
1307
1306
|
code: 'CHK_MSG_PRG_AGN_200',
|
|
1308
1307
|
data: 'Ai Agent youtube set but could not find url',
|
|
@@ -1312,7 +1311,7 @@ const check_ai_agent = function (doc) {
|
|
|
1312
1311
|
id: `${doc._id}`,
|
|
1313
1312
|
});
|
|
1314
1313
|
} else {
|
|
1315
|
-
if (
|
|
1314
|
+
if (xu_isEmpty(tool?.youtube?.file_id)) {
|
|
1316
1315
|
ret.push({
|
|
1317
1316
|
code: 'CHK_MSG_PRG_AGN_210',
|
|
1318
1317
|
data: 'Ai Agent youtube set but could not find file uploaded',
|
|
@@ -1322,7 +1321,7 @@ const check_ai_agent = function (doc) {
|
|
|
1322
1321
|
id: `${doc._id}`,
|
|
1323
1322
|
});
|
|
1324
1323
|
} else {
|
|
1325
|
-
if (
|
|
1324
|
+
if (xu_isEmpty(tool?.youtube?.vector_store_id)) {
|
|
1326
1325
|
ret.push({
|
|
1327
1326
|
code: 'CHK_MSG_PRG_AGN_220',
|
|
1328
1327
|
data: 'Ai Agent youtube set but could not find vector_file uploaded',
|
|
@@ -1338,7 +1337,7 @@ const check_ai_agent = function (doc) {
|
|
|
1338
1337
|
}
|
|
1339
1338
|
|
|
1340
1339
|
case 'mcp': {
|
|
1341
|
-
if (
|
|
1340
|
+
if (xu_isEmpty(tool?.url)) {
|
|
1342
1341
|
ret.push({
|
|
1343
1342
|
code: 'CHK_MSG_PRG_AGN_310',
|
|
1344
1343
|
data: 'Ai Agent mcp tool set but could not find url',
|
|
@@ -1365,7 +1364,7 @@ const check_ai_agent = function (doc) {
|
|
|
1365
1364
|
break;
|
|
1366
1365
|
}
|
|
1367
1366
|
case 'table': {
|
|
1368
|
-
if (
|
|
1367
|
+
if (xu_isEmpty(tool?.prog_id)) {
|
|
1369
1368
|
ret.push({
|
|
1370
1369
|
code: 'CHK_MSG_PRG_AGN_410',
|
|
1371
1370
|
data: 'Ai Agent table tool set but could not find table id',
|
|
@@ -1381,7 +1380,7 @@ const check_ai_agent = function (doc) {
|
|
|
1381
1380
|
break;
|
|
1382
1381
|
}
|
|
1383
1382
|
case 'plugin': {
|
|
1384
|
-
if (
|
|
1383
|
+
if (xu_isEmpty(tool?.plugin_id)) {
|
|
1385
1384
|
ret.push({
|
|
1386
1385
|
code: 'CHK_MSG_PRG_AGN_510',
|
|
1387
1386
|
data: 'Ai Agent plugin tool set but could not find plugin id',
|
|
@@ -1391,7 +1390,7 @@ const check_ai_agent = function (doc) {
|
|
|
1391
1390
|
id: `${doc._id}`,
|
|
1392
1391
|
});
|
|
1393
1392
|
} else {
|
|
1394
|
-
if (
|
|
1393
|
+
if (xu_isEmpty(tool?.method)) {
|
|
1395
1394
|
ret.push({
|
|
1396
1395
|
code: 'CHK_MSG_PRG_AGN_520',
|
|
1397
1396
|
data: 'Ai Agent plugin tool set but could not find method property',
|
|
@@ -1405,7 +1404,7 @@ const check_ai_agent = function (doc) {
|
|
|
1405
1404
|
break;
|
|
1406
1405
|
}
|
|
1407
1406
|
case 'program': {
|
|
1408
|
-
if (
|
|
1407
|
+
if (xu_isEmpty(tool?.prog_id)) {
|
|
1409
1408
|
ret.push({
|
|
1410
1409
|
code: 'CHK_MSG_PRG_AGN_410',
|
|
1411
1410
|
data: 'Ai Agent program tool set but could not find program id',
|
|
@@ -1427,7 +1426,7 @@ const check_ai_agent = function (doc) {
|
|
|
1427
1426
|
// const call_project_api = function (doc) {
|
|
1428
1427
|
// var ret = [];
|
|
1429
1428
|
|
|
1430
|
-
// if (
|
|
1429
|
+
// if (xu_isEmpty(doc.alertData)) {
|
|
1431
1430
|
// ret.push({
|
|
1432
1431
|
// code: "CHK_MSG_PRG_ART_010",
|
|
1433
1432
|
// data: `no alert properties defined`,
|
|
@@ -1444,7 +1443,7 @@ const check_ai_agent = function (doc) {
|
|
|
1444
1443
|
const check_prog_fieldset = function (doc) {
|
|
1445
1444
|
var ret = [];
|
|
1446
1445
|
|
|
1447
|
-
if (!doc.progFields ||
|
|
1446
|
+
if (!doc.progFields || xu_isEmpty(doc.progFields)) {
|
|
1448
1447
|
if (doc.progDataSource.dataSourceTableId) {
|
|
1449
1448
|
ret.push({
|
|
1450
1449
|
code: 'CHK_MSG_PRG_FLD_012',
|
|
@@ -1488,7 +1487,7 @@ const check_prog_fieldset = function (doc) {
|
|
|
1488
1487
|
if (!find_field_in_progs(doc, field.data.field_id)) {
|
|
1489
1488
|
// find in Out parameters
|
|
1490
1489
|
var found_parameter_out_match;
|
|
1491
|
-
if (!
|
|
1490
|
+
if (!xu_isEmpty(doc.properties.progParams)) {
|
|
1492
1491
|
for (let parameter_item of doc.properties.progParams) {
|
|
1493
1492
|
if (parameter_item.data.dir === 'out' && parameter_item.data.parameter === field.data.field_id) {
|
|
1494
1493
|
found_parameter_out_match = true;
|
|
@@ -1552,7 +1551,7 @@ const check_prog_fieldset = function (doc) {
|
|
|
1552
1551
|
} else {
|
|
1553
1552
|
// check against table
|
|
1554
1553
|
|
|
1555
|
-
if (!doc.progDataSource ||
|
|
1554
|
+
if (!doc.progDataSource || xu_isEmpty(doc.progDataSource) || !doc.progDataSource.dataSourceType || doc.progDataSource.dataSourceType === 'none') {
|
|
1556
1555
|
ret.push({
|
|
1557
1556
|
code: 'CHK_MSG_PRG_FLD_300',
|
|
1558
1557
|
data: `undefined datasource for ${field.data.field_id} field`,
|
|
@@ -1639,7 +1638,7 @@ const check_prog_fieldset = function (doc) {
|
|
|
1639
1638
|
case 'number':
|
|
1640
1639
|
case 'boolean':
|
|
1641
1640
|
if (field?.props?.fieldValue) {
|
|
1642
|
-
if (
|
|
1641
|
+
if (Number.isNaN(Number(field?.props?.fieldValue))) {
|
|
1643
1642
|
ret.push({
|
|
1644
1643
|
code: 'CHK_MSG_PRG_FLD_210',
|
|
1645
1644
|
data: `invalid value type ${field.props.fieldType} for ${field.data.field_id} field`,
|
|
@@ -1685,10 +1684,10 @@ const check_prog_fieldset = function (doc) {
|
|
|
1685
1684
|
}
|
|
1686
1685
|
}
|
|
1687
1686
|
|
|
1688
|
-
// if (!
|
|
1687
|
+
// if (!xu_isEmpty(field.workflow)) {}
|
|
1689
1688
|
// propExpressions
|
|
1690
1689
|
|
|
1691
|
-
if (!
|
|
1690
|
+
if (!xu_isEmpty(field.workflow)) {
|
|
1692
1691
|
ret = [...ret, ...check_prog_triggers(doc, field.workflow, 'field', field.id, field.data.field_id)];
|
|
1693
1692
|
}
|
|
1694
1693
|
}
|
|
@@ -1711,7 +1710,7 @@ const check_prog_fieldset = function (doc) {
|
|
|
1711
1710
|
const check_prog_events = function (doc) {
|
|
1712
1711
|
var ret = [];
|
|
1713
1712
|
|
|
1714
|
-
if (!doc.progEvents ||
|
|
1713
|
+
if (!doc.progEvents || xu_isEmpty(doc.progEvents)) return ret;
|
|
1715
1714
|
var name_counts_obj = {};
|
|
1716
1715
|
for (let event_item of doc.progEvents) {
|
|
1717
1716
|
switch (event_item?.data?.type) {
|
|
@@ -1818,7 +1817,7 @@ const check_prog_events = function (doc) {
|
|
|
1818
1817
|
}
|
|
1819
1818
|
|
|
1820
1819
|
// check workflow
|
|
1821
|
-
if (!
|
|
1820
|
+
if (!xu_isEmpty(event_item.workflow)) {
|
|
1822
1821
|
ret = [...ret, ...check_prog_triggers(doc, event_item.workflow, 'event', event_item.id, event_item.data.event_name || event_item.data.type)];
|
|
1823
1822
|
} else {
|
|
1824
1823
|
ret.push({
|
|
@@ -1849,17 +1848,17 @@ const check_prog_events = function (doc) {
|
|
|
1849
1848
|
const check_prog_triggers = function (doc, workflow, source_type, source_id, source_name) {
|
|
1850
1849
|
var ret = [];
|
|
1851
1850
|
|
|
1852
|
-
if (!workflow ||
|
|
1851
|
+
if (!workflow || xu_isEmpty(workflow)) return ret;
|
|
1853
1852
|
|
|
1854
1853
|
const check_target_program_parameters = function (trigger_item) {
|
|
1855
1854
|
if (!trigger_item.data.name.prog) return;
|
|
1856
1855
|
|
|
1857
1856
|
const target_program_parameters_arr = progs_obj?.[trigger_item.data.name.prog]?.properties?.progParams || [];
|
|
1858
1857
|
|
|
1859
|
-
if (trigger_item?.data?.name?.parameters && !
|
|
1858
|
+
if (trigger_item?.data?.name?.parameters && !xu_isEmpty(trigger_item.data.name.parameters)) {
|
|
1860
1859
|
for (let [key, val] of Object.entries(trigger_item.data.name.parameters)) {
|
|
1861
1860
|
const param_ret = find_item_by_key(target_program_parameters_arr, 'parameter', key);
|
|
1862
|
-
if (
|
|
1861
|
+
if (xu_isEmpty(param_ret)) {
|
|
1863
1862
|
ret.push({
|
|
1864
1863
|
code: 'CHK_MSG_PRG_TRG_370',
|
|
1865
1864
|
data: `parameter "${key}" not found in the target program "${progs_obj?.[trigger_item.data.name.prog].properties.menuName}" parameter list in ${source_type} "${source_name}" trigger`,
|
|
@@ -2083,9 +2082,9 @@ const check_prog_triggers = function (doc, workflow, source_type, source_id, sou
|
|
|
2083
2082
|
});
|
|
2084
2083
|
} else {
|
|
2085
2084
|
// if exist check parameters
|
|
2086
|
-
if (ret_event_name.length === 1 && !
|
|
2085
|
+
if (ret_event_name.length === 1 && !xu_isEmpty(trigger_item.data.name.parameters)) {
|
|
2087
2086
|
for (let [key, val] of Object.entries(trigger_item.data.name.parameters)) {
|
|
2088
|
-
if (
|
|
2087
|
+
if (xu_isEmpty(progs_obj?.[ret_event_name[0].prog_id].progFields)) {
|
|
2089
2088
|
if (!find_item_by_key(progs_obj?.[ret_event_name[0].prog_id].progFields, 'field_id', key)) {
|
|
2090
2089
|
ret.push({
|
|
2091
2090
|
code: 'CHK_MSG_PRG_TRG_130',
|
|
@@ -2406,13 +2405,13 @@ const check_prog_triggers = function (doc, workflow, source_type, source_id, sou
|
|
|
2406
2405
|
// // // if exist check parameters
|
|
2407
2406
|
// // if (
|
|
2408
2407
|
// // ret_event_name.length === 1 &&
|
|
2409
|
-
// // !
|
|
2408
|
+
// // !xu_isEmpty(trigger_item.data.name.parameters)
|
|
2410
2409
|
// // ) {
|
|
2411
2410
|
// // for (let [key, val] of Object.entries(
|
|
2412
2411
|
// // trigger_item.data.name.parameters
|
|
2413
2412
|
// // )) {
|
|
2414
2413
|
// // if (
|
|
2415
|
-
// //
|
|
2414
|
+
// // xu_isEmpty(progs_obj[ret_event_name[0].prog_id].progFields)
|
|
2416
2415
|
// // ) {
|
|
2417
2416
|
// // if (
|
|
2418
2417
|
// // !find_item_by_key(
|
|
@@ -2439,7 +2438,7 @@ const check_prog_triggers = function (doc, workflow, source_type, source_id, sou
|
|
|
2439
2438
|
break;
|
|
2440
2439
|
|
|
2441
2440
|
case 'alert':
|
|
2442
|
-
if (
|
|
2441
|
+
if (xu_isEmpty(trigger_item.data.name)) {
|
|
2443
2442
|
ret.push({
|
|
2444
2443
|
code: 'CHK_MSG_PRG_TRG_610',
|
|
2445
2444
|
data: `no alert properties defined`,
|
|
@@ -2658,7 +2657,7 @@ const check_prog_triggers = function (doc, workflow, source_type, source_id, sou
|
|
|
2658
2657
|
const check_prog_datasource = function (doc) {
|
|
2659
2658
|
var ret = [];
|
|
2660
2659
|
|
|
2661
|
-
if (!doc.progDataSource ||
|
|
2660
|
+
if (!doc.progDataSource || xu_isEmpty(doc.progDataSource) || !doc.progDataSource.dataSourceType || doc.progDataSource.dataSourceType === 'none') {
|
|
2662
2661
|
return ret;
|
|
2663
2662
|
}
|
|
2664
2663
|
|
|
@@ -3014,7 +3013,7 @@ const find_field_in_progs = function (doc, field_id, prog_id) {
|
|
|
3014
3013
|
fields_arr = prog.progFields;
|
|
3015
3014
|
}
|
|
3016
3015
|
|
|
3017
|
-
if (
|
|
3016
|
+
if (xu_isEmpty(fields_arr)) {
|
|
3018
3017
|
continue;
|
|
3019
3018
|
}
|
|
3020
3019
|
|
|
@@ -3068,11 +3067,11 @@ const check_prog_expression = function (doc, exp, path, category) {
|
|
|
3068
3067
|
}
|
|
3069
3068
|
|
|
3070
3069
|
// error ocurred
|
|
3071
|
-
if (!
|
|
3070
|
+
if (!xu_isEmpty(ret)) {
|
|
3072
3071
|
return ret;
|
|
3073
3072
|
}
|
|
3074
3073
|
|
|
3075
|
-
if (
|
|
3074
|
+
if (xu_isEmpty(field_matches)) {
|
|
3076
3075
|
// try {
|
|
3077
3076
|
// eval(exp);
|
|
3078
3077
|
// } catch (err) {
|
|
@@ -3203,7 +3202,7 @@ const find_event_id_in_progs = function (doc, event_id) {
|
|
|
3203
3202
|
var ret = [];
|
|
3204
3203
|
|
|
3205
3204
|
for (let [key, prog] of Object.entries(progs_obj)) {
|
|
3206
|
-
if (!prog.progEvents ||
|
|
3205
|
+
if (!prog.progEvents || xu_isEmpty(prog.progEvents)) {
|
|
3207
3206
|
continue;
|
|
3208
3207
|
}
|
|
3209
3208
|
//&& prog._id !== doc._id
|
|
@@ -3224,7 +3223,7 @@ const find_xu_tree_id_in_progs = function (doc, xu_tree_id) {
|
|
|
3224
3223
|
var ret = [];
|
|
3225
3224
|
|
|
3226
3225
|
for (let [key, prog] of Object.entries(progs_obj)) {
|
|
3227
|
-
if (!prog.progUi ||
|
|
3226
|
+
if (!prog.progUi || xu_isEmpty(prog.progUi)) {
|
|
3228
3227
|
continue;
|
|
3229
3228
|
}
|
|
3230
3229
|
|
|
@@ -3291,7 +3290,7 @@ const find_trigger_property_value_in_progs = function (doc, triggers_arr, proper
|
|
|
3291
3290
|
|
|
3292
3291
|
const run_program_search = function (prog) {
|
|
3293
3292
|
// find in events
|
|
3294
|
-
if (prog?.progEvents && !
|
|
3293
|
+
if (prog?.progEvents && !xu_isEmpty(prog.progEvents)) {
|
|
3295
3294
|
for (let event_item of prog.progEvents) {
|
|
3296
3295
|
if (event_item.workflow) {
|
|
3297
3296
|
find_in_triggers(prog, event_item.workflow);
|
|
@@ -3300,7 +3299,7 @@ const find_trigger_property_value_in_progs = function (doc, triggers_arr, proper
|
|
|
3300
3299
|
}
|
|
3301
3300
|
|
|
3302
3301
|
// find in fields
|
|
3303
|
-
if (prog?.progFields && !
|
|
3302
|
+
if (prog?.progFields && !xu_isEmpty(prog.progFields)) {
|
|
3304
3303
|
for (let field_item of prog.progFields) {
|
|
3305
3304
|
if (field_item.workflow) {
|
|
3306
3305
|
find_in_triggers(prog, field_item.workflow);
|
|
@@ -3309,14 +3308,14 @@ const find_trigger_property_value_in_progs = function (doc, triggers_arr, proper
|
|
|
3309
3308
|
}
|
|
3310
3309
|
|
|
3311
3310
|
// find in ui workflow
|
|
3312
|
-
if (prog?.progUi && !
|
|
3311
|
+
if (prog?.progUi && !xu_isEmpty(prog.progUi)) {
|
|
3313
3312
|
const run_tree = function (node) {
|
|
3314
3313
|
try {
|
|
3315
3314
|
for (let item of node) {
|
|
3316
3315
|
if (item.attributes) {
|
|
3317
3316
|
for (let [key, val] of Object.entries(item.attributes)) {
|
|
3318
3317
|
if (key.substr(0, 6) === 'xu-on:') {
|
|
3319
|
-
if (!
|
|
3318
|
+
if (!xu_isEmpty(val)) {
|
|
3320
3319
|
for (let trigger_item of val) {
|
|
3321
3320
|
find_in_triggers(prog, trigger_item.workflow);
|
|
3322
3321
|
}
|
|
@@ -3352,7 +3351,7 @@ const find_panel_prog_in_progs = function (doc, prog_id, search_in_doc_prog_only
|
|
|
3352
3351
|
var ret = [];
|
|
3353
3352
|
|
|
3354
3353
|
const find_in_prog = function (prog) {
|
|
3355
|
-
if (
|
|
3354
|
+
if (xu_isEmpty(prog?.progUi)) return;
|
|
3356
3355
|
|
|
3357
3356
|
const run_tree = function (node) {
|
|
3358
3357
|
for (let item of node) {
|
|
@@ -3404,7 +3403,7 @@ const find_table_in_progs = function (doc, table_id, search_in_doc_prog_only) {
|
|
|
3404
3403
|
// for (let [key, prog] of Object.entries(progs_obj)) {
|
|
3405
3404
|
// if (
|
|
3406
3405
|
// !prog.progDataSource ||
|
|
3407
|
-
//
|
|
3406
|
+
// xu_isEmpty(prog.progDataSource) ||
|
|
3408
3407
|
// prog.progDataSource.dataSourceType !== "table"
|
|
3409
3408
|
// ) {
|
|
3410
3409
|
// continue;
|
|
@@ -3421,7 +3420,7 @@ const find_table_in_progs = function (doc, table_id, search_in_doc_prog_only) {
|
|
|
3421
3420
|
// }
|
|
3422
3421
|
|
|
3423
3422
|
const find_in_prog = function (prog) {
|
|
3424
|
-
if (!prog.progDataSource ||
|
|
3423
|
+
if (!prog.progDataSource || xu_isEmpty(prog.progDataSource) || prog.progDataSource.dataSourceType !== 'table') {
|
|
3425
3424
|
return;
|
|
3426
3425
|
}
|
|
3427
3426
|
|