@xuda.io/runtime-bundle 1.0.560 → 1.0.561
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 +380 -703
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +380 -703
- package/js/xuda-runtime-slim.min.es.js +380 -703
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +380 -703
- package/js/xuda-worker-bundle.js +380 -703
- package/js/xuda-worker-bundle.min.js +1 -1
- package/js/xuda_common-bundle.js +382 -705
- package/js/xuda_common-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -23582,12 +23582,9 @@ wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="o
|
|
|
23582
23582
|
},
|
|
23583
23583
|
};
|
|
23584
23584
|
});
|
|
23585
|
-
|
|
23586
23585
|
"use strict";
|
|
23586
|
+
|
|
23587
23587
|
'use strict';
|
|
23588
23588
|
|
|
23589
|
-
if (
|
|
23590
|
-
typeof IS_DOCKER === "undefined" ||
|
|
23591
|
-
typeof IS_PROCESS_SERVER === "undefined"
|
|
23592
|
-
) {
|
|
23589
|
+
if (typeof IS_DOCKER === 'undefined' || typeof IS_PROCESS_SERVER === 'undefined') {
|
|
23593
23590
|
var SESSION_OBJ = {};
|
|
23594
23591
|
var DOCS_OBJ = {};
|
|
23595
23592
|
}
|
|
@@ -23604,17 +23601,7 @@ var PROJECT_OBJ = {};
|
|
|
23604
23601
|
var APP_OBJ = {};
|
|
23605
23602
|
var SESSION_ID = null;
|
|
23606
23603
|
|
|
23607
|
-
glb.PROTECTED_VARS = [
|
|
23608
|
-
"_NULL",
|
|
23609
|
-
"_THIS",
|
|
23610
|
-
"_FOR_KEY",
|
|
23611
|
-
"_FOR_VAL",
|
|
23612
|
-
"_ROWNO",
|
|
23613
|
-
"_ROWID",
|
|
23614
|
-
"_ROWDOC",
|
|
23615
|
-
"_KEY",
|
|
23616
|
-
"_VAL",
|
|
23617
|
-
];
|
|
23604
|
+
glb.PROTECTED_VARS = ['_NULL', '_THIS', '_FOR_KEY', '_FOR_VAL', '_ROWNO', '_ROWID', '_ROWDOC', '_KEY', '_VAL'];
|
|
23618
23605
|
|
|
23619
23606
|
// glb.newRecord = 999999;
|
|
23620
23607
|
|
|
@@ -23631,7 +23618,7 @@ func.common.find_item_by_key_root = function (arr, key, val) {
|
|
|
23631
23618
|
};
|
|
23632
23619
|
func.common.find_ROWID_idx = function (_ds, rowId) {
|
|
23633
23620
|
if (!_ds?.data_feed?.rows) {
|
|
23634
|
-
throw new Error(
|
|
23621
|
+
throw new Error('data_feed not found');
|
|
23635
23622
|
}
|
|
23636
23623
|
|
|
23637
23624
|
// Find the index of the object with the given _ROWID
|
|
@@ -23645,129 +23632,55 @@ func.common.find_ROWID_idx = function (_ds, rowId) {
|
|
|
23645
23632
|
// Return the found index
|
|
23646
23633
|
return index;
|
|
23647
23634
|
};
|
|
23648
|
-
func.common.input_mask = async function (
|
|
23649
|
-
|
|
23650
|
-
valP,
|
|
23651
|
-
typeP,
|
|
23652
|
-
maskP,
|
|
23653
|
-
elemP,
|
|
23654
|
-
grid_objP,
|
|
23655
|
-
grid_row_idP,
|
|
23656
|
-
grid_col_idP,
|
|
23657
|
-
dsSessionP
|
|
23658
|
-
) {
|
|
23659
|
-
const module = await func.common.get_module(
|
|
23660
|
-
SESSION_ID,
|
|
23661
|
-
"xuda-input-musk-utils-module.mjs"
|
|
23662
|
-
);
|
|
23635
|
+
func.common.input_mask = async function (actionP, valP, typeP, maskP, elemP, grid_objP, grid_row_idP, grid_col_idP, dsSessionP) {
|
|
23636
|
+
const module = await func.common.get_module(SESSION_ID, 'xuda-input-musk-utils-module.mjs');
|
|
23663
23637
|
|
|
23664
|
-
module.input_mask(
|
|
23665
|
-
actionP,
|
|
23666
|
-
valP,
|
|
23667
|
-
typeP,
|
|
23668
|
-
maskP,
|
|
23669
|
-
elemP,
|
|
23670
|
-
grid_objP,
|
|
23671
|
-
grid_row_idP,
|
|
23672
|
-
grid_col_idP,
|
|
23673
|
-
dsSessionP
|
|
23674
|
-
);
|
|
23638
|
+
module.input_mask(actionP, valP, typeP, maskP, elemP, grid_objP, grid_row_idP, grid_col_idP, dsSessionP);
|
|
23675
23639
|
};
|
|
23676
23640
|
|
|
23677
|
-
glb.MAIN_WINDOW_TYPES_ARR = [
|
|
23678
|
-
glb.FUNCTION_NODES_ARR = [
|
|
23679
|
-
"batch",
|
|
23680
|
-
"get_data",
|
|
23681
|
-
"set_data",
|
|
23682
|
-
"Alert_error",
|
|
23683
|
-
"Alert_warning",
|
|
23684
|
-
"Alert_info",
|
|
23685
|
-
"Alert_ok",
|
|
23686
|
-
"javascript",
|
|
23687
|
-
"SQL",
|
|
23688
|
-
];
|
|
23641
|
+
glb.MAIN_WINDOW_TYPES_ARR = ['screen', 'program'];
|
|
23642
|
+
glb.FUNCTION_NODES_ARR = ['batch', 'get_data', 'set_data', 'Alert_error', 'Alert_warning', 'Alert_info', 'Alert_ok', 'javascript', 'SQL'];
|
|
23689
23643
|
glb.emailRegex = /^[\w\.-]+@[a-zA-Z\d\.-]+\.[a-zA-Z]{2,}$/;
|
|
23690
23644
|
|
|
23691
|
-
const FIREBASE_AUTH_PROPERTIES_ARR = [
|
|
23692
|
-
"provider",
|
|
23693
|
-
"token",
|
|
23694
|
-
"first_name",
|
|
23695
|
-
"last_name",
|
|
23696
|
-
"email",
|
|
23697
|
-
"user_id",
|
|
23698
|
-
"picture",
|
|
23699
|
-
"verified_email",
|
|
23700
|
-
"locale",
|
|
23701
|
-
"error_code",
|
|
23702
|
-
"error_msg",
|
|
23703
|
-
];
|
|
23645
|
+
const FIREBASE_AUTH_PROPERTIES_ARR = ['provider', 'token', 'first_name', 'last_name', 'email', 'user_id', 'picture', 'verified_email', 'locale', 'error_code', 'error_msg'];
|
|
23704
23646
|
|
|
23705
23647
|
const CLIENT_INFO_PROPERTIES_ARR = [
|
|
23706
|
-
|
|
23707
|
-
|
|
23708
|
-
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
23712
|
-
|
|
23713
|
-
|
|
23714
|
-
|
|
23715
|
-
|
|
23716
|
-
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
|
|
23720
|
-
|
|
23721
|
-
|
|
23722
|
-
|
|
23723
|
-
|
|
23724
|
-
|
|
23725
|
-
|
|
23726
|
-
|
|
23727
|
-
|
|
23728
|
-
|
|
23648
|
+
'fingerprint',
|
|
23649
|
+
'device',
|
|
23650
|
+
'user_agent',
|
|
23651
|
+
'browser_version',
|
|
23652
|
+
'browser_name',
|
|
23653
|
+
'engine_version',
|
|
23654
|
+
'engine_name',
|
|
23655
|
+
'client_ip',
|
|
23656
|
+
'os_name',
|
|
23657
|
+
'os_version',
|
|
23658
|
+
'device_model',
|
|
23659
|
+
'device_vendor',
|
|
23660
|
+
'device_type',
|
|
23661
|
+
'screen_current_resolution_x',
|
|
23662
|
+
'screen_current_resolution_y',
|
|
23663
|
+
'screen_available_resolution_x',
|
|
23664
|
+
'screen_available_resolution_y',
|
|
23665
|
+
'language',
|
|
23666
|
+
'time_zone',
|
|
23667
|
+
'cpu_architecture',
|
|
23668
|
+
'uuid',
|
|
23669
|
+
'cursor_pos_x',
|
|
23670
|
+
'cursor_pos_y',
|
|
23729
23671
|
];
|
|
23730
23672
|
|
|
23731
|
-
const APP_PROPERTIES_ARR = [
|
|
23732
|
-
|
|
23733
|
-
const DATASOURCE_PROPERTIES_ARR = [
|
|
23734
|
-
"rows",
|
|
23735
|
-
"type",
|
|
23736
|
-
"first_row_id",
|
|
23737
|
-
"last_row_id",
|
|
23738
|
-
"query_from_segments_json",
|
|
23739
|
-
"query_to_segments_json",
|
|
23740
|
-
"locate_query_from_segments_json",
|
|
23741
|
-
"locate_query_to_segments_json",
|
|
23742
|
-
"first_row_segments_json",
|
|
23743
|
-
"last_row_segments_json",
|
|
23744
|
-
"rowid_snapshot",
|
|
23745
|
-
"rowid",
|
|
23746
|
-
];
|
|
23673
|
+
const APP_PROPERTIES_ARR = ['build', 'author', 'date', 'name'];
|
|
23747
23674
|
|
|
23748
|
-
|
|
23749
|
-
"component",
|
|
23750
|
-
"web_app",
|
|
23751
|
-
"ios_app",
|
|
23752
|
-
"android_app",
|
|
23753
|
-
"electron_app",
|
|
23754
|
-
"osx_app",
|
|
23755
|
-
"windows_app",
|
|
23756
|
-
];
|
|
23675
|
+
const DATASOURCE_PROPERTIES_ARR = ['rows', 'type', 'first_row_id', 'last_row_id', 'query_from_segments_json', 'query_to_segments_json', 'locate_query_from_segments_json', 'locate_query_to_segments_json', 'first_row_segments_json', 'last_row_segments_json', 'rowid_snapshot', 'rowid'];
|
|
23757
23676
|
|
|
23758
|
-
glb.
|
|
23759
|
-
|
|
23760
|
-
|
|
23761
|
-
"SYS_DATE_VALUE",
|
|
23762
|
-
"SYS_DATE_WEEK_YEAR",
|
|
23763
|
-
"SYS_DATE_MONTH_YEAR",
|
|
23764
|
-
"SYS_TIME_SHORT",
|
|
23765
|
-
"SYS_TIME",
|
|
23766
|
-
];
|
|
23677
|
+
glb.MOBILE_ARR = ['component', 'web_app', 'ios_app', 'android_app', 'electron_app', 'osx_app', 'windows_app'];
|
|
23678
|
+
|
|
23679
|
+
glb.SYS_DATE_ARR = ['SYS_DATE', 'SYS_DATE_TIME', 'SYS_DATE_VALUE', 'SYS_DATE_WEEK_YEAR', 'SYS_DATE_MONTH_YEAR', 'SYS_TIME_SHORT', 'SYS_TIME'];
|
|
23767
23680
|
|
|
23768
|
-
glb.API_OUTPUT_ARR = [
|
|
23681
|
+
glb.API_OUTPUT_ARR = ['json', 'html', 'xml', 'text', 'css', 'javascript'];
|
|
23769
23682
|
|
|
23770
|
-
const PROTECTED_NAMES_ARR = [
|
|
23683
|
+
const PROTECTED_NAMES_ARR = ['THIS', 'ROWID']; //tbd
|
|
23771
23684
|
|
|
23772
23685
|
// func.common.get_custom_icon = async function (
|
|
23773
23686
|
// SESSION_ID,
|
|
@@ -23810,19 +23723,13 @@ const PROTECTED_NAMES_ARR = ["THIS", "ROWID"]; //tbd
|
|
|
23810
23723
|
// } else return ret;
|
|
23811
23724
|
// };
|
|
23812
23725
|
|
|
23813
|
-
func.common.db = async function (
|
|
23814
|
-
SESSION_ID,
|
|
23815
|
-
serviceP,
|
|
23816
|
-
dataP,
|
|
23817
|
-
opt = {},
|
|
23818
|
-
dsSession
|
|
23819
|
-
) {
|
|
23726
|
+
func.common.db = async function (SESSION_ID, serviceP, dataP, opt = {}, dsSession) {
|
|
23820
23727
|
return new Promise(async function (resolve, reject) {
|
|
23821
23728
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
23822
23729
|
const app_id = _session.app_id;
|
|
23823
23730
|
|
|
23824
|
-
if (_session.engine_mode ===
|
|
23825
|
-
console.log(
|
|
23731
|
+
if (_session.engine_mode === 'live_preview') {
|
|
23732
|
+
console.log('request', dataP);
|
|
23826
23733
|
}
|
|
23827
23734
|
|
|
23828
23735
|
var data = {
|
|
@@ -23834,18 +23741,15 @@ func.common.db = async function (
|
|
|
23834
23741
|
app_token: _session.app_token,
|
|
23835
23742
|
res_token: _session.res_token,
|
|
23836
23743
|
engine_mode: _session.engine_mode,
|
|
23837
|
-
req_id:
|
|
23744
|
+
req_id: 'rt_req_' + crypto.randomUUID(),
|
|
23838
23745
|
app_replicate: APP_OBJ[app_id].app_replicate,
|
|
23839
23746
|
};
|
|
23840
23747
|
|
|
23841
23748
|
try {
|
|
23842
|
-
if (
|
|
23843
|
-
typeof firebase !== "undefined" &&
|
|
23844
|
-
firebase?.auth()?.currentUser?.displayName
|
|
23845
|
-
) {
|
|
23749
|
+
if (typeof firebase !== 'undefined' && firebase?.auth()?.currentUser?.displayName) {
|
|
23846
23750
|
data.device_name = firebase.auth().currentUser.displayName;
|
|
23847
23751
|
}
|
|
23848
|
-
} catch (error) {
|
|
23752
|
+
} catch (error) {}
|
|
23849
23753
|
|
|
23850
23754
|
for (const [key, val] of Object.entries(dataP)) {
|
|
23851
23755
|
data[key] = val;
|
|
@@ -23853,20 +23757,14 @@ func.common.db = async function (
|
|
|
23853
23757
|
|
|
23854
23758
|
const success_callback = function (ret) {
|
|
23855
23759
|
if (dataP.table_id && DOCS_OBJ[app_id][dataP.table_id]) {
|
|
23856
|
-
func.utils.debug.watch(
|
|
23857
|
-
|
|
23858
|
-
|
|
23859
|
-
|
|
23860
|
-
DOCS_OBJ[app_id][dataP.table_id].properties.menuName,
|
|
23861
|
-
{
|
|
23862
|
-
req: data,
|
|
23863
|
-
res: ret,
|
|
23864
|
-
}
|
|
23865
|
-
);
|
|
23760
|
+
func.utils.debug.watch(SESSION_ID, dataP.table_id, 'table', DOCS_OBJ[app_id][dataP.table_id].properties.menuName, {
|
|
23761
|
+
req: data,
|
|
23762
|
+
res: ret,
|
|
23763
|
+
});
|
|
23866
23764
|
}
|
|
23867
23765
|
|
|
23868
|
-
if (_session.engine_mode ===
|
|
23869
|
-
console.log(
|
|
23766
|
+
if (_session.engine_mode === 'live_preview') {
|
|
23767
|
+
console.log('response', ret);
|
|
23870
23768
|
}
|
|
23871
23769
|
resolve(ret, true);
|
|
23872
23770
|
};
|
|
@@ -23877,31 +23775,14 @@ func.common.db = async function (
|
|
|
23877
23775
|
function cleanString(json) {
|
|
23878
23776
|
let str = JSON.stringify(json);
|
|
23879
23777
|
// Replace all non-alphanumeric characters with an empty string
|
|
23880
|
-
return str.replace(/[^a-zA-Z0-9]/g,
|
|
23778
|
+
return str.replace(/[^a-zA-Z0-9]/g, '');
|
|
23881
23779
|
}
|
|
23882
23780
|
const get_rep_id = function () {
|
|
23883
23781
|
let _data = {};
|
|
23884
|
-
const fields_to_skip = [
|
|
23885
|
-
"fields",
|
|
23886
|
-
"viewSourceDesc",
|
|
23887
|
-
"skip",
|
|
23888
|
-
"limit",
|
|
23889
|
-
"count",
|
|
23890
|
-
"reduce",
|
|
23891
|
-
"prog_id",
|
|
23892
|
-
"sortModel",
|
|
23893
|
-
"filterModelMongo",
|
|
23894
|
-
"filterModelSql",
|
|
23895
|
-
"filterModelUserMongo",
|
|
23896
|
-
"filterModelUserSql",
|
|
23897
|
-
];
|
|
23782
|
+
const fields_to_skip = ['fields', 'viewSourceDesc', 'skip', 'limit', 'count', 'reduce', 'prog_id', 'sortModel', 'filterModelMongo', 'filterModelSql', 'filterModelUserMongo', 'filterModelUserSql'];
|
|
23898
23783
|
|
|
23899
23784
|
for (let [key, val] of Object.entries(dataP)) {
|
|
23900
|
-
if (
|
|
23901
|
-
typeof val !== "undefined" &&
|
|
23902
|
-
val !== null &&
|
|
23903
|
-
!fields_to_skip.includes(key)
|
|
23904
|
-
) {
|
|
23785
|
+
if (typeof val !== 'undefined' && val !== null && !fields_to_skip.includes(key)) {
|
|
23905
23786
|
_data[key] = val;
|
|
23906
23787
|
}
|
|
23907
23788
|
}
|
|
@@ -23919,13 +23800,13 @@ func.common.db = async function (
|
|
|
23919
23800
|
|
|
23920
23801
|
let ret = await db.find({
|
|
23921
23802
|
selector: {
|
|
23922
|
-
docType:
|
|
23803
|
+
docType: 'rep_request',
|
|
23923
23804
|
table_id: data.table_id,
|
|
23924
23805
|
},
|
|
23925
23806
|
});
|
|
23926
23807
|
|
|
23927
23808
|
if (doc.stat < 3) {
|
|
23928
|
-
throw
|
|
23809
|
+
throw 'not ready';
|
|
23929
23810
|
}
|
|
23930
23811
|
|
|
23931
23812
|
/// delete table refunded requests
|
|
@@ -23940,10 +23821,7 @@ func.common.db = async function (
|
|
|
23940
23821
|
};
|
|
23941
23822
|
|
|
23942
23823
|
const read_dbs_pouch = async function (db) {
|
|
23943
|
-
if (
|
|
23944
|
-
_session?.DS_GLB?.[dsSession]?.refreshed &&
|
|
23945
|
-
(dataP.filterModelMongo || dataP.filterModelSql)
|
|
23946
|
-
) {
|
|
23824
|
+
if (_session?.DS_GLB?.[dsSession]?.refreshed && (dataP.filterModelMongo || dataP.filterModelSql)) {
|
|
23947
23825
|
return {
|
|
23948
23826
|
code: 1,
|
|
23949
23827
|
data: await func.db.pouch[serviceP](SESSION_ID, data),
|
|
@@ -23952,8 +23830,7 @@ func.common.db = async function (
|
|
|
23952
23830
|
|
|
23953
23831
|
const rep_id = get_rep_id();
|
|
23954
23832
|
|
|
23955
|
-
const { code: table_req_code, data: table_req_id } =
|
|
23956
|
-
await validate_existence_of_whole_table_request(db);
|
|
23833
|
+
const { code: table_req_code, data: table_req_id } = await validate_existence_of_whole_table_request(db);
|
|
23957
23834
|
if (table_req_code > 0) {
|
|
23958
23835
|
return {
|
|
23959
23836
|
code: 1,
|
|
@@ -23963,7 +23840,7 @@ func.common.db = async function (
|
|
|
23963
23840
|
|
|
23964
23841
|
try {
|
|
23965
23842
|
const doc = await db.get(rep_id);
|
|
23966
|
-
if (doc.stat < 3) throw
|
|
23843
|
+
if (doc.stat < 3) throw 'replication not ready';
|
|
23967
23844
|
const json = {
|
|
23968
23845
|
code: 1,
|
|
23969
23846
|
data: await func.db.pouch[serviceP](SESSION_ID, data),
|
|
@@ -23971,12 +23848,7 @@ func.common.db = async function (
|
|
|
23971
23848
|
|
|
23972
23849
|
return json;
|
|
23973
23850
|
} catch (err) {
|
|
23974
|
-
const json = await func.common.perform_rpi_request(
|
|
23975
|
-
SESSION_ID,
|
|
23976
|
-
serviceP,
|
|
23977
|
-
opt,
|
|
23978
|
-
data
|
|
23979
|
-
);
|
|
23851
|
+
const json = await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
|
|
23980
23852
|
if (json.data.opt) {
|
|
23981
23853
|
try {
|
|
23982
23854
|
try {
|
|
@@ -23987,16 +23859,16 @@ func.common.db = async function (
|
|
|
23987
23859
|
selector: json.data.opt.selector,
|
|
23988
23860
|
stat: 1,
|
|
23989
23861
|
ts: Date.now(),
|
|
23990
|
-
docType:
|
|
23862
|
+
docType: 'rep_request',
|
|
23991
23863
|
table_id: dataP.table_id,
|
|
23992
23864
|
prog_id: dataP.prog_id,
|
|
23993
23865
|
entire_table: table_req_id === rep_id,
|
|
23994
|
-
source:
|
|
23866
|
+
source: 'runtime',
|
|
23995
23867
|
e: data,
|
|
23996
23868
|
});
|
|
23997
23869
|
}
|
|
23998
23870
|
func.db.pouch.set_db_replication_from_server(SESSION_ID);
|
|
23999
|
-
} catch (err) {
|
|
23871
|
+
} catch (err) {}
|
|
24000
23872
|
}
|
|
24001
23873
|
return json;
|
|
24002
23874
|
}
|
|
@@ -24007,8 +23879,7 @@ func.common.db = async function (
|
|
|
24007
23879
|
// throw "online";
|
|
24008
23880
|
// }
|
|
24009
23881
|
|
|
24010
|
-
const { code: table_req_code, data: table_req_id } =
|
|
24011
|
-
await validate_existence_of_whole_table_request(db);
|
|
23882
|
+
const { code: table_req_code, data: table_req_id } = await validate_existence_of_whole_table_request(db);
|
|
24012
23883
|
|
|
24013
23884
|
if (table_req_code > 0) {
|
|
24014
23885
|
data.full_table_downloaded = true;
|
|
@@ -24017,37 +23888,25 @@ func.common.db = async function (
|
|
|
24017
23888
|
await db.get(dataP.row_id);
|
|
24018
23889
|
return await func.db.pouch[serviceP](SESSION_ID, data);
|
|
24019
23890
|
} catch (err) {
|
|
24020
|
-
return await func.common.perform_rpi_request(
|
|
24021
|
-
SESSION_ID,
|
|
24022
|
-
serviceP,
|
|
24023
|
-
opt,
|
|
24024
|
-
data
|
|
24025
|
-
);
|
|
23891
|
+
return await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
|
|
24026
23892
|
}
|
|
24027
23893
|
};
|
|
24028
23894
|
const create_dbs_pouch = async function (db) {
|
|
24029
23895
|
try {
|
|
24030
|
-
const { code: table_req_code, data: table_req_id } =
|
|
24031
|
-
await validate_existence_of_whole_table_request(db);
|
|
23896
|
+
const { code: table_req_code, data: table_req_id } = await validate_existence_of_whole_table_request(db);
|
|
24032
23897
|
|
|
24033
23898
|
if (table_req_code > 0) {
|
|
24034
23899
|
data.full_table_downloaded = true;
|
|
24035
23900
|
}
|
|
24036
23901
|
return await func.db.pouch[serviceP](SESSION_ID, data);
|
|
24037
23902
|
} catch (err) {
|
|
24038
|
-
return await func.common.perform_rpi_request(
|
|
24039
|
-
SESSION_ID,
|
|
24040
|
-
serviceP,
|
|
24041
|
-
opt,
|
|
24042
|
-
data
|
|
24043
|
-
);
|
|
23903
|
+
return await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
|
|
24044
23904
|
}
|
|
24045
23905
|
};
|
|
24046
23906
|
const delete_dbs_pouch = async function (db) {
|
|
24047
|
-
for await (let row_id of dataP.ids) {
|
|
23907
|
+
for await (let row_id of dataP.ids || []) {
|
|
24048
23908
|
try {
|
|
24049
|
-
const { code: table_req_code, data: table_req_id } =
|
|
24050
|
-
await validate_existence_of_whole_table_request(db);
|
|
23909
|
+
const { code: table_req_code, data: table_req_id } = await validate_existence_of_whole_table_request(db);
|
|
24051
23910
|
|
|
24052
23911
|
if (table_req_code > 0) {
|
|
24053
23912
|
data.full_table_downloaded = true;
|
|
@@ -24056,41 +23915,32 @@ func.common.db = async function (
|
|
|
24056
23915
|
await db.get(row_id);
|
|
24057
23916
|
let _data = _.cloneDeep(dataP);
|
|
24058
23917
|
_data.ids = [row_id];
|
|
24059
|
-
return await func.db.pouch[
|
|
23918
|
+
return await func.db.pouch['dbs_delete'](SESSION_ID, _data);
|
|
24060
23919
|
} catch (err) {
|
|
24061
|
-
return await func.common.perform_rpi_request(
|
|
24062
|
-
SESSION_ID,
|
|
24063
|
-
serviceP,
|
|
24064
|
-
opt,
|
|
24065
|
-
data
|
|
24066
|
-
);
|
|
23920
|
+
return await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
|
|
24067
23921
|
}
|
|
24068
23922
|
}
|
|
24069
23923
|
};
|
|
24070
|
-
if (
|
|
24071
|
-
typeof IS_DOCKER === "undefined" &&
|
|
24072
|
-
typeof IS_PROCESS_SERVER === "undefined"
|
|
24073
|
-
) {
|
|
23924
|
+
if (typeof IS_DOCKER === 'undefined' && typeof IS_PROCESS_SERVER === 'undefined') {
|
|
24074
23925
|
try {
|
|
24075
23926
|
if (!SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)) {
|
|
24076
|
-
throw
|
|
23927
|
+
throw '';
|
|
24077
23928
|
}
|
|
24078
|
-
if (!(await func?.db?.pouch?.get_replication_stat(SESSION_ID)))
|
|
24079
|
-
throw "";
|
|
23929
|
+
if (!(await func?.db?.pouch?.get_replication_stat(SESSION_ID))) throw '';
|
|
24080
23930
|
const db = await func.utils.connect_pouchdb(SESSION_ID);
|
|
24081
23931
|
switch (serviceP) {
|
|
24082
|
-
case
|
|
23932
|
+
case 'dbs_read': {
|
|
24083
23933
|
try {
|
|
24084
23934
|
return success_callback(await read_dbs_pouch(db));
|
|
24085
23935
|
} catch (err) {
|
|
24086
|
-
if (err ===
|
|
24087
|
-
throw
|
|
23936
|
+
if (err === 'creating index in progress') {
|
|
23937
|
+
throw '';
|
|
24088
23938
|
}
|
|
24089
23939
|
return error_callback(err);
|
|
24090
23940
|
}
|
|
24091
23941
|
break;
|
|
24092
23942
|
}
|
|
24093
|
-
case
|
|
23943
|
+
case 'dbs_update': {
|
|
24094
23944
|
try {
|
|
24095
23945
|
const ret = {
|
|
24096
23946
|
code: 1,
|
|
@@ -24102,7 +23952,7 @@ func.common.db = async function (
|
|
|
24102
23952
|
}
|
|
24103
23953
|
break;
|
|
24104
23954
|
}
|
|
24105
|
-
case
|
|
23955
|
+
case 'dbs_create': {
|
|
24106
23956
|
try {
|
|
24107
23957
|
const ret = {
|
|
24108
23958
|
code: 1,
|
|
@@ -24114,7 +23964,7 @@ func.common.db = async function (
|
|
|
24114
23964
|
}
|
|
24115
23965
|
break;
|
|
24116
23966
|
}
|
|
24117
|
-
case
|
|
23967
|
+
case 'dbs_delete': {
|
|
24118
23968
|
try {
|
|
24119
23969
|
const ret = {
|
|
24120
23970
|
code: 1,
|
|
@@ -24128,17 +23978,12 @@ func.common.db = async function (
|
|
|
24128
23978
|
}
|
|
24129
23979
|
|
|
24130
23980
|
default:
|
|
24131
|
-
throw
|
|
23981
|
+
throw '';
|
|
24132
23982
|
break;
|
|
24133
23983
|
}
|
|
24134
23984
|
} catch (err) {
|
|
24135
23985
|
try {
|
|
24136
|
-
const json = await func.common.perform_rpi_request(
|
|
24137
|
-
SESSION_ID,
|
|
24138
|
-
serviceP,
|
|
24139
|
-
opt,
|
|
24140
|
-
data
|
|
24141
|
-
);
|
|
23986
|
+
const json = await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
|
|
24142
23987
|
return success_callback(json, true);
|
|
24143
23988
|
} catch (err) {
|
|
24144
23989
|
return error_callback(err);
|
|
@@ -24159,14 +24004,14 @@ func.common.db = async function (
|
|
|
24159
24004
|
var e = {};
|
|
24160
24005
|
_.forEach(data, function (val, key) {
|
|
24161
24006
|
if (!val) {
|
|
24162
|
-
if (typeof val ===
|
|
24163
|
-
e[key] =
|
|
24007
|
+
if (typeof val === 'boolean') {
|
|
24008
|
+
e[key] = 'false';
|
|
24164
24009
|
} else {
|
|
24165
|
-
e[key] =
|
|
24010
|
+
e[key] = '';
|
|
24166
24011
|
}
|
|
24167
24012
|
} else {
|
|
24168
|
-
if (typeof val ===
|
|
24169
|
-
e[key] =
|
|
24013
|
+
if (typeof val === 'boolean') {
|
|
24014
|
+
e[key] = 'true';
|
|
24170
24015
|
} else {
|
|
24171
24016
|
e[key] = val;
|
|
24172
24017
|
}
|
|
@@ -24174,7 +24019,7 @@ func.common.db = async function (
|
|
|
24174
24019
|
});
|
|
24175
24020
|
|
|
24176
24021
|
if (data.fields && !data.fields.length) {
|
|
24177
|
-
e.fields =
|
|
24022
|
+
e.fields = '';
|
|
24178
24023
|
}
|
|
24179
24024
|
|
|
24180
24025
|
return e;
|
|
@@ -24184,13 +24029,8 @@ func.common.db = async function (
|
|
|
24184
24029
|
await func.utils.FILES_OBJ.get(SESSION_ID, dataP.table_id);
|
|
24185
24030
|
await func.utils.TREE_OBJ.get(SESSION_ID, dataP.table_id);
|
|
24186
24031
|
}
|
|
24187
|
-
data.db_driver =
|
|
24188
|
-
__.rpi.http_calls(
|
|
24189
|
-
serviceP,
|
|
24190
|
-
{ body: get_white_spaced_data(data) },
|
|
24191
|
-
null,
|
|
24192
|
-
response
|
|
24193
|
-
);
|
|
24032
|
+
data.db_driver = 'xuda';
|
|
24033
|
+
__.rpi.http_calls(serviceP, { body: get_white_spaced_data(data) }, null, response);
|
|
24194
24034
|
});
|
|
24195
24035
|
};
|
|
24196
24036
|
|
|
@@ -24210,11 +24050,7 @@ func.common.getParametersFromUrl = function () {
|
|
|
24210
24050
|
return parameters;
|
|
24211
24051
|
};
|
|
24212
24052
|
|
|
24213
|
-
func.common.getObjectFromUrl = function (
|
|
24214
|
-
url,
|
|
24215
|
-
element_attributes_obj,
|
|
24216
|
-
embed_params_obj
|
|
24217
|
-
) {
|
|
24053
|
+
func.common.getObjectFromUrl = function (url, element_attributes_obj, embed_params_obj) {
|
|
24218
24054
|
var result = {};
|
|
24219
24055
|
if (element_attributes_obj) {
|
|
24220
24056
|
for (let [key, val] of Object.entries(element_attributes_obj)) {
|
|
@@ -24227,33 +24063,26 @@ func.common.getObjectFromUrl = function (
|
|
|
24227
24063
|
}
|
|
24228
24064
|
}
|
|
24229
24065
|
|
|
24230
|
-
if (
|
|
24231
|
-
!url &&
|
|
24232
|
-
typeof IS_DOCKER === "undefined" &&
|
|
24233
|
-
typeof IS_PROCESS_SERVER === "undefined"
|
|
24234
|
-
) {
|
|
24066
|
+
if (!url && typeof IS_DOCKER === 'undefined' && typeof IS_PROCESS_SERVER === 'undefined') {
|
|
24235
24067
|
url = location.href;
|
|
24236
24068
|
}
|
|
24237
|
-
var question = url.indexOf(
|
|
24238
|
-
var hash = url.indexOf(
|
|
24069
|
+
var question = url.indexOf('?');
|
|
24070
|
+
var hash = url.indexOf('#');
|
|
24239
24071
|
if (hash == -1 && question == -1) return result;
|
|
24240
24072
|
if (hash == -1) hash = url.length;
|
|
24241
|
-
var query =
|
|
24242
|
-
question == -1 || hash == question + 1
|
|
24243
|
-
? url.substring(hash)
|
|
24244
|
-
: url.substring(question + 1, hash);
|
|
24073
|
+
var query = question == -1 || hash == question + 1 ? url.substring(hash) : url.substring(question + 1, hash);
|
|
24245
24074
|
// var result = {};
|
|
24246
|
-
query.split(
|
|
24075
|
+
query.split('&').forEach(function (part) {
|
|
24247
24076
|
if (!part) return;
|
|
24248
|
-
part = part.split(
|
|
24249
|
-
var eq = part.indexOf(
|
|
24077
|
+
part = part.split('+').join(' '); // replace every + with space, regexp-free version
|
|
24078
|
+
var eq = part.indexOf('=');
|
|
24250
24079
|
var key = eq > -1 ? part.substr(0, eq) : part;
|
|
24251
|
-
var val = eq > -1 ? decodeURIComponent(part.substr(eq + 1)) :
|
|
24252
|
-
var from = key.indexOf(
|
|
24080
|
+
var val = eq > -1 ? decodeURIComponent(part.substr(eq + 1)) : '';
|
|
24081
|
+
var from = key.indexOf('[');
|
|
24253
24082
|
if (from == -1) {
|
|
24254
24083
|
result[decodeURIComponent(key)] = val;
|
|
24255
24084
|
} else {
|
|
24256
|
-
var to = key.indexOf(
|
|
24085
|
+
var to = key.indexOf(']', from);
|
|
24257
24086
|
var index = decodeURIComponent(key.substring(from + 1, to));
|
|
24258
24087
|
key = decodeURIComponent(key.substring(0, from));
|
|
24259
24088
|
if (!result[key]) result[key] = [];
|
|
@@ -24268,159 +24097,158 @@ func.common.getObjectFromUrl = function (
|
|
|
24268
24097
|
func.common.getContrast_color = function (hexcolor) {
|
|
24269
24098
|
function colourNameToHex(colour) {
|
|
24270
24099
|
var colours = {
|
|
24271
|
-
aliceblue:
|
|
24272
|
-
antiquewhite:
|
|
24273
|
-
aqua:
|
|
24274
|
-
aquamarine:
|
|
24275
|
-
azure:
|
|
24276
|
-
beige:
|
|
24277
|
-
bisque:
|
|
24278
|
-
black:
|
|
24279
|
-
blanchedalmond:
|
|
24280
|
-
blue:
|
|
24281
|
-
blueviolet:
|
|
24282
|
-
brown:
|
|
24283
|
-
burlywood:
|
|
24284
|
-
cadetblue:
|
|
24285
|
-
chartreuse:
|
|
24286
|
-
chocolate:
|
|
24287
|
-
coral:
|
|
24288
|
-
cornflowerblue:
|
|
24289
|
-
cornsilk:
|
|
24290
|
-
crimson:
|
|
24291
|
-
cyan:
|
|
24292
|
-
darkblue:
|
|
24293
|
-
darkcyan:
|
|
24294
|
-
darkgoldenrod:
|
|
24295
|
-
darkgray:
|
|
24296
|
-
darkgreen:
|
|
24297
|
-
darkkhaki:
|
|
24298
|
-
darkmagenta:
|
|
24299
|
-
darkolivegreen:
|
|
24300
|
-
darkorange:
|
|
24301
|
-
darkorchid:
|
|
24302
|
-
darkred:
|
|
24303
|
-
darksalmon:
|
|
24304
|
-
darkseagreen:
|
|
24305
|
-
darkslateblue:
|
|
24306
|
-
darkslategray:
|
|
24307
|
-
darkturquoise:
|
|
24308
|
-
darkviolet:
|
|
24309
|
-
deeppink:
|
|
24310
|
-
deepskyblue:
|
|
24311
|
-
dimgray:
|
|
24312
|
-
dodgerblue:
|
|
24313
|
-
firebrick:
|
|
24314
|
-
floralwhite:
|
|
24315
|
-
forestgreen:
|
|
24316
|
-
fuchsia:
|
|
24317
|
-
gainsboro:
|
|
24318
|
-
ghostwhite:
|
|
24319
|
-
gold:
|
|
24320
|
-
goldenrod:
|
|
24321
|
-
gray:
|
|
24322
|
-
green:
|
|
24323
|
-
greenyellow:
|
|
24324
|
-
honeydew:
|
|
24325
|
-
hotpink:
|
|
24326
|
-
|
|
24327
|
-
indigo:
|
|
24328
|
-
ivory:
|
|
24329
|
-
khaki:
|
|
24330
|
-
lavender:
|
|
24331
|
-
lavenderblush:
|
|
24332
|
-
lawngreen:
|
|
24333
|
-
lemonchiffon:
|
|
24334
|
-
lightblue:
|
|
24335
|
-
lightcoral:
|
|
24336
|
-
lightcyan:
|
|
24337
|
-
lightgoldenrodyellow:
|
|
24338
|
-
lightgrey:
|
|
24339
|
-
lightgreen:
|
|
24340
|
-
lightpink:
|
|
24341
|
-
lightsalmon:
|
|
24342
|
-
lightseagreen:
|
|
24343
|
-
lightskyblue:
|
|
24344
|
-
lightslategray:
|
|
24345
|
-
lightsteelblue:
|
|
24346
|
-
lightyellow:
|
|
24347
|
-
lime:
|
|
24348
|
-
limegreen:
|
|
24349
|
-
linen:
|
|
24350
|
-
magenta:
|
|
24351
|
-
maroon:
|
|
24352
|
-
mediumaquamarine:
|
|
24353
|
-
mediumblue:
|
|
24354
|
-
mediumorchid:
|
|
24355
|
-
mediumpurple:
|
|
24356
|
-
mediumseagreen:
|
|
24357
|
-
mediumslateblue:
|
|
24358
|
-
mediumspringgreen:
|
|
24359
|
-
mediumturquoise:
|
|
24360
|
-
mediumvioletred:
|
|
24361
|
-
midnightblue:
|
|
24362
|
-
mintcream:
|
|
24363
|
-
mistyrose:
|
|
24364
|
-
moccasin:
|
|
24365
|
-
navajowhite:
|
|
24366
|
-
navy:
|
|
24367
|
-
oldlace:
|
|
24368
|
-
olive:
|
|
24369
|
-
olivedrab:
|
|
24370
|
-
orange:
|
|
24371
|
-
orangered:
|
|
24372
|
-
orchid:
|
|
24373
|
-
palegoldenrod:
|
|
24374
|
-
palegreen:
|
|
24375
|
-
paleturquoise:
|
|
24376
|
-
palevioletred:
|
|
24377
|
-
papayawhip:
|
|
24378
|
-
peachpuff:
|
|
24379
|
-
peru:
|
|
24380
|
-
pink:
|
|
24381
|
-
plum:
|
|
24382
|
-
powderblue:
|
|
24383
|
-
purple:
|
|
24384
|
-
rebeccapurple:
|
|
24385
|
-
red:
|
|
24386
|
-
rosybrown:
|
|
24387
|
-
royalblue:
|
|
24388
|
-
saddlebrown:
|
|
24389
|
-
salmon:
|
|
24390
|
-
sandybrown:
|
|
24391
|
-
seagreen:
|
|
24392
|
-
seashell:
|
|
24393
|
-
sienna:
|
|
24394
|
-
silver:
|
|
24395
|
-
skyblue:
|
|
24396
|
-
slateblue:
|
|
24397
|
-
slategray:
|
|
24398
|
-
snow:
|
|
24399
|
-
springgreen:
|
|
24400
|
-
steelblue:
|
|
24401
|
-
tan:
|
|
24402
|
-
teal:
|
|
24403
|
-
thistle:
|
|
24404
|
-
tomato:
|
|
24405
|
-
turquoise:
|
|
24406
|
-
violet:
|
|
24407
|
-
wheat:
|
|
24408
|
-
white:
|
|
24409
|
-
whitesmoke:
|
|
24410
|
-
yellow:
|
|
24411
|
-
yellowgreen:
|
|
24100
|
+
aliceblue: '#f0f8ff',
|
|
24101
|
+
antiquewhite: '#faebd7',
|
|
24102
|
+
aqua: '#00ffff',
|
|
24103
|
+
aquamarine: '#7fffd4',
|
|
24104
|
+
azure: '#f0ffff',
|
|
24105
|
+
beige: '#f5f5dc',
|
|
24106
|
+
bisque: '#ffe4c4',
|
|
24107
|
+
black: '#000000',
|
|
24108
|
+
blanchedalmond: '#ffebcd',
|
|
24109
|
+
blue: '#0000ff',
|
|
24110
|
+
blueviolet: '#8a2be2',
|
|
24111
|
+
brown: '#a52a2a',
|
|
24112
|
+
burlywood: '#deb887',
|
|
24113
|
+
cadetblue: '#5f9ea0',
|
|
24114
|
+
chartreuse: '#7fff00',
|
|
24115
|
+
chocolate: '#d2691e',
|
|
24116
|
+
coral: '#ff7f50',
|
|
24117
|
+
cornflowerblue: '#6495ed',
|
|
24118
|
+
cornsilk: '#fff8dc',
|
|
24119
|
+
crimson: '#dc143c',
|
|
24120
|
+
cyan: '#00ffff',
|
|
24121
|
+
darkblue: '#00008b',
|
|
24122
|
+
darkcyan: '#008b8b',
|
|
24123
|
+
darkgoldenrod: '#b8860b',
|
|
24124
|
+
darkgray: '#a9a9a9',
|
|
24125
|
+
darkgreen: '#006400',
|
|
24126
|
+
darkkhaki: '#bdb76b',
|
|
24127
|
+
darkmagenta: '#8b008b',
|
|
24128
|
+
darkolivegreen: '#556b2f',
|
|
24129
|
+
darkorange: '#ff8c00',
|
|
24130
|
+
darkorchid: '#9932cc',
|
|
24131
|
+
darkred: '#8b0000',
|
|
24132
|
+
darksalmon: '#e9967a',
|
|
24133
|
+
darkseagreen: '#8fbc8f',
|
|
24134
|
+
darkslateblue: '#483d8b',
|
|
24135
|
+
darkslategray: '#2f4f4f',
|
|
24136
|
+
darkturquoise: '#00ced1',
|
|
24137
|
+
darkviolet: '#9400d3',
|
|
24138
|
+
deeppink: '#ff1493',
|
|
24139
|
+
deepskyblue: '#00bfff',
|
|
24140
|
+
dimgray: '#696969',
|
|
24141
|
+
dodgerblue: '#1e90ff',
|
|
24142
|
+
firebrick: '#b22222',
|
|
24143
|
+
floralwhite: '#fffaf0',
|
|
24144
|
+
forestgreen: '#228b22',
|
|
24145
|
+
fuchsia: '#ff00ff',
|
|
24146
|
+
gainsboro: '#dcdcdc',
|
|
24147
|
+
ghostwhite: '#f8f8ff',
|
|
24148
|
+
gold: '#ffd700',
|
|
24149
|
+
goldenrod: '#daa520',
|
|
24150
|
+
gray: '#808080',
|
|
24151
|
+
green: '#008000',
|
|
24152
|
+
greenyellow: '#adff2f',
|
|
24153
|
+
honeydew: '#f0fff0',
|
|
24154
|
+
hotpink: '#ff69b4',
|
|
24155
|
+
'indianred ': '#cd5c5c',
|
|
24156
|
+
indigo: '#4b0082',
|
|
24157
|
+
ivory: '#fffff0',
|
|
24158
|
+
khaki: '#f0e68c',
|
|
24159
|
+
lavender: '#e6e6fa',
|
|
24160
|
+
lavenderblush: '#fff0f5',
|
|
24161
|
+
lawngreen: '#7cfc00',
|
|
24162
|
+
lemonchiffon: '#fffacd',
|
|
24163
|
+
lightblue: '#add8e6',
|
|
24164
|
+
lightcoral: '#f08080',
|
|
24165
|
+
lightcyan: '#e0ffff',
|
|
24166
|
+
lightgoldenrodyellow: '#fafad2',
|
|
24167
|
+
lightgrey: '#d3d3d3',
|
|
24168
|
+
lightgreen: '#90ee90',
|
|
24169
|
+
lightpink: '#ffb6c1',
|
|
24170
|
+
lightsalmon: '#ffa07a',
|
|
24171
|
+
lightseagreen: '#20b2aa',
|
|
24172
|
+
lightskyblue: '#87cefa',
|
|
24173
|
+
lightslategray: '#778899',
|
|
24174
|
+
lightsteelblue: '#b0c4de',
|
|
24175
|
+
lightyellow: '#ffffe0',
|
|
24176
|
+
lime: '#00ff00',
|
|
24177
|
+
limegreen: '#32cd32',
|
|
24178
|
+
linen: '#faf0e6',
|
|
24179
|
+
magenta: '#ff00ff',
|
|
24180
|
+
maroon: '#800000',
|
|
24181
|
+
mediumaquamarine: '#66cdaa',
|
|
24182
|
+
mediumblue: '#0000cd',
|
|
24183
|
+
mediumorchid: '#ba55d3',
|
|
24184
|
+
mediumpurple: '#9370d8',
|
|
24185
|
+
mediumseagreen: '#3cb371',
|
|
24186
|
+
mediumslateblue: '#7b68ee',
|
|
24187
|
+
mediumspringgreen: '#00fa9a',
|
|
24188
|
+
mediumturquoise: '#48d1cc',
|
|
24189
|
+
mediumvioletred: '#c71585',
|
|
24190
|
+
midnightblue: '#191970',
|
|
24191
|
+
mintcream: '#f5fffa',
|
|
24192
|
+
mistyrose: '#ffe4e1',
|
|
24193
|
+
moccasin: '#ffe4b5',
|
|
24194
|
+
navajowhite: '#ffdead',
|
|
24195
|
+
navy: '#000080',
|
|
24196
|
+
oldlace: '#fdf5e6',
|
|
24197
|
+
olive: '#808000',
|
|
24198
|
+
olivedrab: '#6b8e23',
|
|
24199
|
+
orange: '#ffa500',
|
|
24200
|
+
orangered: '#ff4500',
|
|
24201
|
+
orchid: '#da70d6',
|
|
24202
|
+
palegoldenrod: '#eee8aa',
|
|
24203
|
+
palegreen: '#98fb98',
|
|
24204
|
+
paleturquoise: '#afeeee',
|
|
24205
|
+
palevioletred: '#d87093',
|
|
24206
|
+
papayawhip: '#ffefd5',
|
|
24207
|
+
peachpuff: '#ffdab9',
|
|
24208
|
+
peru: '#cd853f',
|
|
24209
|
+
pink: '#ffc0cb',
|
|
24210
|
+
plum: '#dda0dd',
|
|
24211
|
+
powderblue: '#b0e0e6',
|
|
24212
|
+
purple: '#800080',
|
|
24213
|
+
rebeccapurple: '#663399',
|
|
24214
|
+
red: '#ff0000',
|
|
24215
|
+
rosybrown: '#bc8f8f',
|
|
24216
|
+
royalblue: '#4169e1',
|
|
24217
|
+
saddlebrown: '#8b4513',
|
|
24218
|
+
salmon: '#fa8072',
|
|
24219
|
+
sandybrown: '#f4a460',
|
|
24220
|
+
seagreen: '#2e8b57',
|
|
24221
|
+
seashell: '#fff5ee',
|
|
24222
|
+
sienna: '#a0522d',
|
|
24223
|
+
silver: '#c0c0c0',
|
|
24224
|
+
skyblue: '#87ceeb',
|
|
24225
|
+
slateblue: '#6a5acd',
|
|
24226
|
+
slategray: '#708090',
|
|
24227
|
+
snow: '#fffafa',
|
|
24228
|
+
springgreen: '#00ff7f',
|
|
24229
|
+
steelblue: '#4682b4',
|
|
24230
|
+
tan: '#d2b48c',
|
|
24231
|
+
teal: '#008080',
|
|
24232
|
+
thistle: '#d8bfd8',
|
|
24233
|
+
tomato: '#ff6347',
|
|
24234
|
+
turquoise: '#40e0d0',
|
|
24235
|
+
violet: '#ee82ee',
|
|
24236
|
+
wheat: '#f5deb3',
|
|
24237
|
+
white: '#ffffff',
|
|
24238
|
+
whitesmoke: '#f5f5f5',
|
|
24239
|
+
yellow: '#ffff00',
|
|
24240
|
+
yellowgreen: '#9acd32',
|
|
24412
24241
|
};
|
|
24413
24242
|
|
|
24414
|
-
if (typeof colours[colour.toLowerCase()] !=
|
|
24415
|
-
return colours[colour.toLowerCase()];
|
|
24243
|
+
if (typeof colours[colour.toLowerCase()] != 'undefined') return colours[colour.toLowerCase()];
|
|
24416
24244
|
|
|
24417
24245
|
return false;
|
|
24418
24246
|
}
|
|
24419
|
-
if (!hexcolor.includes(
|
|
24247
|
+
if (!hexcolor.includes('#')) {
|
|
24420
24248
|
hexcolor = colourNameToHex(hexcolor);
|
|
24421
24249
|
}
|
|
24422
24250
|
// If a leading # is provided, remove it
|
|
24423
|
-
if (hexcolor.slice(0, 1) ===
|
|
24251
|
+
if (hexcolor.slice(0, 1) === '#') {
|
|
24424
24252
|
hexcolor = hexcolor.slice(1);
|
|
24425
24253
|
}
|
|
24426
24254
|
|
|
@@ -24433,51 +24261,30 @@ func.common.getContrast_color = function (hexcolor) {
|
|
|
24433
24261
|
var yiq = (r * 299 + g * 587 + b * 114) / 1000;
|
|
24434
24262
|
|
|
24435
24263
|
// Check contrast
|
|
24436
|
-
return yiq >= 128 ?
|
|
24264
|
+
return yiq >= 128 ? 'black' : 'white';
|
|
24437
24265
|
};
|
|
24438
24266
|
|
|
24439
24267
|
func.common.get_url = function (SESSION_ID, method, path) {
|
|
24440
|
-
return `https://${SESSION_OBJ[SESSION_ID].domain}/${method}${path ?
|
|
24441
|
-
}`;
|
|
24268
|
+
return `https://${SESSION_OBJ[SESSION_ID].domain}/${method}${path ? '/' + path : '/'}`;
|
|
24442
24269
|
};
|
|
24443
24270
|
|
|
24444
24271
|
var UI_FRAMEWORK_INSTALLED = null;
|
|
24445
24272
|
var UI_FRAMEWORK_PLUGIN = {};
|
|
24446
24273
|
|
|
24447
|
-
func.common.get_cast_val = async function (
|
|
24448
|
-
SESSION_ID,
|
|
24449
|
-
source,
|
|
24450
|
-
attributeP,
|
|
24451
|
-
typeP,
|
|
24452
|
-
valP,
|
|
24453
|
-
errorP
|
|
24454
|
-
) {
|
|
24274
|
+
func.common.get_cast_val = async function (SESSION_ID, source, attributeP, typeP, valP, errorP) {
|
|
24455
24275
|
const report_conversion_error = function (res) {
|
|
24456
24276
|
if (errorP) {
|
|
24457
|
-
return func.utils.debug_report(
|
|
24458
|
-
SESSION_ID,
|
|
24459
|
-
_.capitalize(source),
|
|
24460
|
-
errorP,
|
|
24461
|
-
"W"
|
|
24462
|
-
);
|
|
24277
|
+
return func.utils.debug_report(SESSION_ID, _.capitalize(source), errorP, 'W');
|
|
24463
24278
|
}
|
|
24464
24279
|
var msg = `error converting ${attributeP} from ${valP} to ${typeP}`;
|
|
24465
|
-
func.utils.debug_report(SESSION_ID, _.capitalize(source), msg,
|
|
24280
|
+
func.utils.debug_report(SESSION_ID, _.capitalize(source), msg, 'E');
|
|
24466
24281
|
};
|
|
24467
24282
|
const report_conversion_warn = function (msg) {
|
|
24468
24283
|
var msg = `type mismatch auto conversion made to ${attributeP} from value ${valP} to ${typeP}`;
|
|
24469
|
-
func.utils.debug_report(SESSION_ID, _.capitalize(source), msg,
|
|
24284
|
+
func.utils.debug_report(SESSION_ID, _.capitalize(source), msg, 'W');
|
|
24470
24285
|
};
|
|
24471
|
-
const module = await func.common.get_module(
|
|
24472
|
-
|
|
24473
|
-
`xuda-get-cast-util-module.mjs`
|
|
24474
|
-
);
|
|
24475
|
-
return module.cast(
|
|
24476
|
-
typeP,
|
|
24477
|
-
valP,
|
|
24478
|
-
report_conversion_error,
|
|
24479
|
-
report_conversion_warn
|
|
24480
|
-
);
|
|
24286
|
+
const module = await func.common.get_module(SESSION_ID, `xuda-get-cast-util-module.mjs`);
|
|
24287
|
+
return module.cast(typeP, valP, report_conversion_error, report_conversion_warn);
|
|
24481
24288
|
};
|
|
24482
24289
|
var WEB_WORKER = {};
|
|
24483
24290
|
var WEB_WORKER_CALLBACK_QUEUE = {};
|
|
@@ -24499,9 +24306,7 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
|
|
|
24499
24306
|
const module_ret = await import(src);
|
|
24500
24307
|
var params = get_params();
|
|
24501
24308
|
|
|
24502
|
-
const ret = module_ret.XudaModule
|
|
24503
|
-
? new module_ret.XudaModule(params)
|
|
24504
|
-
: await invoke_init_module(module_ret, params);
|
|
24309
|
+
const ret = module_ret.XudaModule ? new module_ret.XudaModule(params) : await invoke_init_module(module_ret, params);
|
|
24505
24310
|
|
|
24506
24311
|
return ret;
|
|
24507
24312
|
};
|
|
@@ -24518,13 +24323,11 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
|
|
|
24518
24323
|
_,
|
|
24519
24324
|
...paramsP,
|
|
24520
24325
|
};
|
|
24521
|
-
if (typeof IS_PROCESS_SERVER !==
|
|
24522
|
-
params.IS_PROCESS_SERVER = IS_PROCESS_SERVER;
|
|
24326
|
+
if (typeof IS_PROCESS_SERVER !== 'undefined') params.IS_PROCESS_SERVER = IS_PROCESS_SERVER;
|
|
24523
24327
|
|
|
24524
|
-
if (typeof IS_API_SERVER !==
|
|
24525
|
-
params.IS_API_SERVER = IS_API_SERVER;
|
|
24328
|
+
if (typeof IS_API_SERVER !== 'undefined') params.IS_API_SERVER = IS_API_SERVER;
|
|
24526
24329
|
|
|
24527
|
-
if (typeof IS_DOCKER !==
|
|
24330
|
+
if (typeof IS_DOCKER !== 'undefined') params.IS_DOCKER = IS_DOCKER;
|
|
24528
24331
|
|
|
24529
24332
|
return params;
|
|
24530
24333
|
};
|
|
@@ -24535,73 +24338,29 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
|
|
|
24535
24338
|
return module_ret;
|
|
24536
24339
|
};
|
|
24537
24340
|
const _session = SESSION_OBJ[SESSION_ID];
|
|
24538
|
-
if (_session.worker_type ===
|
|
24539
|
-
ret = await get_ret(
|
|
24341
|
+
if (_session.worker_type === 'Dev') {
|
|
24342
|
+
ret = await get_ret('./modules/' + module);
|
|
24540
24343
|
|
|
24541
24344
|
return ret;
|
|
24542
24345
|
}
|
|
24543
|
-
if (_session.worker_type ===
|
|
24544
|
-
if (
|
|
24545
|
-
|
|
24546
|
-
typeof IS_PROCESS_SERVER !== "undefined"
|
|
24547
|
-
) {
|
|
24548
|
-
ret = await get_ret(
|
|
24549
|
-
func.utils.get_resource_filename(
|
|
24550
|
-
SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
|
|
24551
|
-
? ""
|
|
24552
|
-
: SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
|
|
24553
|
-
`${_conf.xuda_home}root/dist/runtime/js/modules/` + module
|
|
24554
|
-
)
|
|
24555
|
-
);
|
|
24346
|
+
if (_session.worker_type === 'Debug') {
|
|
24347
|
+
if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
24348
|
+
ret = await get_ret(func.utils.get_resource_filename(SESSION_OBJ[SESSION_ID].engine_mode === 'live_preview' ? '' : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id, `${_conf.xuda_home}root/dist/runtime/js/modules/` + module));
|
|
24556
24349
|
} else {
|
|
24557
|
-
ret = await get_ret(
|
|
24558
|
-
func.common.get_url(
|
|
24559
|
-
SESSION_ID,
|
|
24560
|
-
"dist",
|
|
24561
|
-
func.utils.get_resource_filename(
|
|
24562
|
-
SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
|
|
24563
|
-
? ""
|
|
24564
|
-
: SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
|
|
24565
|
-
"runtime/js/modules/" + module
|
|
24566
|
-
)
|
|
24567
|
-
)
|
|
24568
|
-
);
|
|
24350
|
+
ret = await get_ret(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(SESSION_OBJ[SESSION_ID].engine_mode === 'live_preview' ? '' : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id, 'runtime/js/modules/' + module)));
|
|
24569
24351
|
}
|
|
24570
24352
|
|
|
24571
24353
|
return ret;
|
|
24572
24354
|
}
|
|
24573
24355
|
|
|
24574
24356
|
const rep = function () {
|
|
24575
|
-
return _.endsWith(module,
|
|
24576
|
-
? module.replace(".js", ".min.js")
|
|
24577
|
-
: module.replace(".mjs", ".min.mjs");
|
|
24357
|
+
return _.endsWith(module, '.js') ? module.replace('.js', '.min.js') : module.replace('.mjs', '.min.mjs');
|
|
24578
24358
|
};
|
|
24579
24359
|
|
|
24580
|
-
if (
|
|
24581
|
-
|
|
24582
|
-
typeof IS_PROCESS_SERVER !== "undefined"
|
|
24583
|
-
) {
|
|
24584
|
-
ret = await get_ret(
|
|
24585
|
-
func.utils.get_resource_filename(
|
|
24586
|
-
SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
|
|
24587
|
-
? ""
|
|
24588
|
-
: SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
|
|
24589
|
-
`${_conf.xuda_home}root/dist/runtime/js/modules/` + rep()
|
|
24590
|
-
)
|
|
24591
|
-
);
|
|
24360
|
+
if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
24361
|
+
ret = await get_ret(func.utils.get_resource_filename(SESSION_OBJ[SESSION_ID].engine_mode === 'live_preview' ? '' : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id, `${_conf.xuda_home}root/dist/runtime/js/modules/` + rep()));
|
|
24592
24362
|
} else {
|
|
24593
|
-
ret = await get_ret(
|
|
24594
|
-
func.common.get_url(
|
|
24595
|
-
SESSION_ID,
|
|
24596
|
-
"dist",
|
|
24597
|
-
func.utils.get_resource_filename(
|
|
24598
|
-
SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
|
|
24599
|
-
? ""
|
|
24600
|
-
: SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
|
|
24601
|
-
"runtime/js/modules/" + rep()
|
|
24602
|
-
)
|
|
24603
|
-
)
|
|
24604
|
-
);
|
|
24363
|
+
ret = await get_ret(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(SESSION_OBJ[SESSION_ID].engine_mode === 'live_preview' ? '' : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id, 'runtime/js/modules/' + rep())));
|
|
24605
24364
|
}
|
|
24606
24365
|
|
|
24607
24366
|
return ret;
|
|
@@ -24610,209 +24369,160 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
|
|
|
24610
24369
|
func.api = {};
|
|
24611
24370
|
func.api.set_field_value = async function (field_id, value, avoid_refresh) {
|
|
24612
24371
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24613
|
-
const api_utils = await func.common.get_module(
|
|
24372
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24373
|
+
func,
|
|
24374
|
+
glb,
|
|
24375
|
+
SESSION_OBJ,
|
|
24614
24376
|
SESSION_ID,
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
glb,
|
|
24619
|
-
SESSION_OBJ,
|
|
24620
|
-
SESSION_ID,
|
|
24621
|
-
APP_OBJ,
|
|
24622
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24623
|
-
}
|
|
24624
|
-
);
|
|
24377
|
+
APP_OBJ,
|
|
24378
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24379
|
+
});
|
|
24625
24380
|
|
|
24626
24381
|
return await api_utils.set_field_value(field_id, value, avoid_refresh);
|
|
24627
24382
|
};
|
|
24628
24383
|
func.api.get_field_value = async function (field_id) {
|
|
24629
24384
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24630
|
-
const api_utils = await func.common.get_module(
|
|
24385
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24386
|
+
func,
|
|
24387
|
+
glb,
|
|
24388
|
+
SESSION_OBJ,
|
|
24631
24389
|
SESSION_ID,
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
glb,
|
|
24636
|
-
SESSION_OBJ,
|
|
24637
|
-
SESSION_ID,
|
|
24638
|
-
APP_OBJ,
|
|
24639
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24640
|
-
}
|
|
24641
|
-
);
|
|
24390
|
+
APP_OBJ,
|
|
24391
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24392
|
+
});
|
|
24642
24393
|
|
|
24643
24394
|
return await api_utils.get_field_value(field_id);
|
|
24644
24395
|
};
|
|
24645
24396
|
func.api.invoke_event = async function (event_id) {
|
|
24646
24397
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24647
|
-
const api_utils = await func.common.get_module(
|
|
24398
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24399
|
+
func,
|
|
24400
|
+
glb,
|
|
24401
|
+
SESSION_OBJ,
|
|
24648
24402
|
SESSION_ID,
|
|
24649
|
-
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
glb,
|
|
24653
|
-
SESSION_OBJ,
|
|
24654
|
-
SESSION_ID,
|
|
24655
|
-
APP_OBJ,
|
|
24656
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24657
|
-
}
|
|
24658
|
-
);
|
|
24403
|
+
APP_OBJ,
|
|
24404
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24405
|
+
});
|
|
24659
24406
|
|
|
24660
24407
|
return await api_utils.invoke_event(event_id);
|
|
24661
24408
|
};
|
|
24662
24409
|
func.api.call_project_api = async function (prog_id, params) {
|
|
24663
24410
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24664
|
-
const api_utils = await func.common.get_module(
|
|
24411
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24412
|
+
func,
|
|
24413
|
+
glb,
|
|
24414
|
+
SESSION_OBJ,
|
|
24665
24415
|
SESSION_ID,
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
glb,
|
|
24670
|
-
SESSION_OBJ,
|
|
24671
|
-
SESSION_ID,
|
|
24672
|
-
APP_OBJ,
|
|
24673
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24674
|
-
}
|
|
24675
|
-
);
|
|
24416
|
+
APP_OBJ,
|
|
24417
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24418
|
+
});
|
|
24676
24419
|
|
|
24677
24420
|
return await api_utils.call_project_api(prog_id, params, null);
|
|
24678
24421
|
};
|
|
24679
24422
|
func.api.call_system_api = async function (api_method, payload) {
|
|
24680
24423
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24681
|
-
const api_utils = await func.common.get_module(
|
|
24424
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24425
|
+
func,
|
|
24426
|
+
glb,
|
|
24427
|
+
SESSION_OBJ,
|
|
24682
24428
|
SESSION_ID,
|
|
24683
|
-
|
|
24684
|
-
|
|
24685
|
-
|
|
24686
|
-
glb,
|
|
24687
|
-
SESSION_OBJ,
|
|
24688
|
-
SESSION_ID,
|
|
24689
|
-
APP_OBJ,
|
|
24690
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24691
|
-
}
|
|
24692
|
-
);
|
|
24429
|
+
APP_OBJ,
|
|
24430
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24431
|
+
});
|
|
24693
24432
|
|
|
24694
24433
|
return await api_utils.call_system_api(api_method, payload, null);
|
|
24695
24434
|
};
|
|
24696
24435
|
|
|
24697
24436
|
func.api.dbs_create = async function (table_id, data, cb) {
|
|
24698
24437
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24699
|
-
const api_utils = await func.common.get_module(
|
|
24438
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24439
|
+
func,
|
|
24440
|
+
glb,
|
|
24441
|
+
SESSION_OBJ,
|
|
24700
24442
|
SESSION_ID,
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
glb,
|
|
24705
|
-
SESSION_OBJ,
|
|
24706
|
-
SESSION_ID,
|
|
24707
|
-
APP_OBJ,
|
|
24708
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24709
|
-
}
|
|
24710
|
-
);
|
|
24443
|
+
APP_OBJ,
|
|
24444
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24445
|
+
});
|
|
24711
24446
|
|
|
24712
24447
|
return await api_utils.dbs_create(table_id, row_id, data, cb);
|
|
24713
24448
|
};
|
|
24714
24449
|
func.api.dbs_read = async function (table_id, selector, fields, sort, limit, skip, cb) {
|
|
24715
24450
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24716
|
-
const api_utils = await func.common.get_module(
|
|
24451
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24452
|
+
func,
|
|
24453
|
+
glb,
|
|
24454
|
+
SESSION_OBJ,
|
|
24717
24455
|
SESSION_ID,
|
|
24718
|
-
|
|
24719
|
-
|
|
24720
|
-
|
|
24721
|
-
glb,
|
|
24722
|
-
SESSION_OBJ,
|
|
24723
|
-
SESSION_ID,
|
|
24724
|
-
APP_OBJ,
|
|
24725
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24726
|
-
}
|
|
24727
|
-
);
|
|
24456
|
+
APP_OBJ,
|
|
24457
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24458
|
+
});
|
|
24728
24459
|
|
|
24729
24460
|
return await api_utils.dbs_read(table_id, selector, fields, sort, limit, skip, cb);
|
|
24730
24461
|
};
|
|
24731
24462
|
func.api.dbs_update = async function (table_id, row_id, data) {
|
|
24732
24463
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24733
|
-
const api_utils = await func.common.get_module(
|
|
24464
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24465
|
+
func,
|
|
24466
|
+
glb,
|
|
24467
|
+
SESSION_OBJ,
|
|
24734
24468
|
SESSION_ID,
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
glb,
|
|
24739
|
-
SESSION_OBJ,
|
|
24740
|
-
SESSION_ID,
|
|
24741
|
-
APP_OBJ,
|
|
24742
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24743
|
-
}
|
|
24744
|
-
);
|
|
24469
|
+
APP_OBJ,
|
|
24470
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24471
|
+
});
|
|
24745
24472
|
|
|
24746
24473
|
return await api_utils.dbs_update(table_id, row_id, data, cb);
|
|
24747
24474
|
};
|
|
24748
24475
|
func.api.dbs_delete = async function (table_id, row_id, cb) {
|
|
24749
24476
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24750
|
-
const api_utils = await func.common.get_module(
|
|
24477
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24478
|
+
func,
|
|
24479
|
+
glb,
|
|
24480
|
+
SESSION_OBJ,
|
|
24751
24481
|
SESSION_ID,
|
|
24752
|
-
|
|
24753
|
-
|
|
24754
|
-
|
|
24755
|
-
glb,
|
|
24756
|
-
SESSION_OBJ,
|
|
24757
|
-
SESSION_ID,
|
|
24758
|
-
APP_OBJ,
|
|
24759
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24760
|
-
}
|
|
24761
|
-
);
|
|
24482
|
+
APP_OBJ,
|
|
24483
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24484
|
+
});
|
|
24762
24485
|
|
|
24763
24486
|
return await api_utils.dbs_delete(table_id, row_id, cb);
|
|
24764
24487
|
};
|
|
24765
24488
|
|
|
24766
24489
|
func.api.call_javascript = async function (prog_id, params, evaluate) {
|
|
24767
24490
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24768
|
-
const api_utils = await func.common.get_module(
|
|
24491
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24492
|
+
func,
|
|
24493
|
+
glb,
|
|
24494
|
+
SESSION_OBJ,
|
|
24769
24495
|
SESSION_ID,
|
|
24770
|
-
|
|
24771
|
-
|
|
24772
|
-
|
|
24773
|
-
glb,
|
|
24774
|
-
SESSION_OBJ,
|
|
24775
|
-
SESSION_ID,
|
|
24776
|
-
APP_OBJ,
|
|
24777
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24778
|
-
}
|
|
24779
|
-
);
|
|
24496
|
+
APP_OBJ,
|
|
24497
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24498
|
+
});
|
|
24780
24499
|
|
|
24781
24500
|
return await api_utils.call_javascript(prog_id, params, evaluate);
|
|
24782
24501
|
};
|
|
24783
24502
|
|
|
24784
24503
|
func.api.call_javascript = async function (prog_id, params, evaluate) {
|
|
24785
24504
|
const SESSION_ID = Object.keys(SESSION_OBJ)[0];
|
|
24786
|
-
const api_utils = await func.common.get_module(
|
|
24505
|
+
const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
|
|
24506
|
+
func,
|
|
24507
|
+
glb,
|
|
24508
|
+
SESSION_OBJ,
|
|
24787
24509
|
SESSION_ID,
|
|
24788
|
-
|
|
24789
|
-
|
|
24790
|
-
|
|
24791
|
-
glb,
|
|
24792
|
-
SESSION_OBJ,
|
|
24793
|
-
SESSION_ID,
|
|
24794
|
-
APP_OBJ,
|
|
24795
|
-
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24796
|
-
}
|
|
24797
|
-
);
|
|
24510
|
+
APP_OBJ,
|
|
24511
|
+
dsSession: func.utils.get_last_datasource_no(SESSION_ID),
|
|
24512
|
+
});
|
|
24798
24513
|
|
|
24799
24514
|
return await api_utils.call_javascript(prog_id, params, evaluate);
|
|
24800
24515
|
};
|
|
24801
24516
|
|
|
24802
24517
|
glb.rpi_request_queue_num = 0;
|
|
24803
|
-
func.common.perform_rpi_request = async function (
|
|
24804
|
-
SESSION_ID,
|
|
24805
|
-
serviceP,
|
|
24806
|
-
opt = {},
|
|
24807
|
-
data
|
|
24808
|
-
) {
|
|
24518
|
+
func.common.perform_rpi_request = async function (SESSION_ID, serviceP, opt = {}, data) {
|
|
24809
24519
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
24810
24520
|
var _data_system = _session?.DS_GLB?.[0]?.data_system;
|
|
24811
24521
|
|
|
24812
24522
|
const set_ajax = async function (stat) {
|
|
24813
24523
|
var datasource_changes = {
|
|
24814
24524
|
[0]: {
|
|
24815
|
-
[
|
|
24525
|
+
['data_system']: { SYS_GLOBAL_BOL_AJAX_BUSY: stat },
|
|
24816
24526
|
},
|
|
24817
24527
|
};
|
|
24818
24528
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -24821,12 +24531,7 @@ func.common.perform_rpi_request = async function (
|
|
|
24821
24531
|
// _data_system.SYS_GLOBAL_BOL_AJAX_BUSY = 1;
|
|
24822
24532
|
await set_ajax(1);
|
|
24823
24533
|
if (!_data_system.SYS_GLOBAL_BOL_CONNECTED) {
|
|
24824
|
-
func.utils.alerts.toast(
|
|
24825
|
-
SESSION_ID,
|
|
24826
|
-
"Server connection error",
|
|
24827
|
-
"You are not connected to the server, so your request cannot be processed.",
|
|
24828
|
-
"error"
|
|
24829
|
-
);
|
|
24534
|
+
func.utils.alerts.toast(SESSION_ID, 'Server connection error', 'You are not connected to the server, so your request cannot be processed.', 'error');
|
|
24830
24535
|
return { code: 88, data: {} };
|
|
24831
24536
|
}
|
|
24832
24537
|
}
|
|
@@ -24840,8 +24545,8 @@ func.common.perform_rpi_request = async function (
|
|
|
24840
24545
|
const timeoutPromise = new Promise((_, reject) =>
|
|
24841
24546
|
setTimeout(() => {
|
|
24842
24547
|
controller.abort();
|
|
24843
|
-
reject(new Error(
|
|
24844
|
-
}, timeout)
|
|
24548
|
+
reject(new Error('Request timed out'));
|
|
24549
|
+
}, timeout),
|
|
24845
24550
|
);
|
|
24846
24551
|
|
|
24847
24552
|
const fetchPromise = fetch(url, { ...options, signal });
|
|
@@ -24849,27 +24554,24 @@ func.common.perform_rpi_request = async function (
|
|
|
24849
24554
|
return Promise.race([fetchPromise, timeoutPromise]);
|
|
24850
24555
|
};
|
|
24851
24556
|
|
|
24852
|
-
var url = func.common.get_url(SESSION_ID,
|
|
24557
|
+
var url = func.common.get_url(SESSION_ID, 'rpi', '');
|
|
24853
24558
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
24854
24559
|
const app_id = _session.app_id;
|
|
24855
24560
|
|
|
24856
|
-
if (
|
|
24857
|
-
|
|
24858
|
-
_session.rpi_http_methods?.includes(serviceP)
|
|
24859
|
-
) {
|
|
24860
|
-
url = "https://" + _session.host + "/rpi/";
|
|
24561
|
+
if (APP_OBJ[app_id].is_deployment && _session.rpi_http_methods?.includes(serviceP)) {
|
|
24562
|
+
url = 'https://' + _session.host + '/rpi/';
|
|
24861
24563
|
}
|
|
24862
24564
|
|
|
24863
24565
|
url += serviceP;
|
|
24864
24566
|
|
|
24865
24567
|
try {
|
|
24866
24568
|
const response = await fetchWithTimeout(url, {
|
|
24867
|
-
method: opt.type ? opt.type :
|
|
24569
|
+
method: opt.type ? opt.type : 'POST',
|
|
24868
24570
|
headers: {
|
|
24869
|
-
Accept:
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24571
|
+
Accept: 'application/json',
|
|
24572
|
+
'Content-Type': 'application/json',
|
|
24573
|
+
'xu-gtp-token': _session.gtp_token,
|
|
24574
|
+
'xu-app-token': _session.app_token,
|
|
24873
24575
|
},
|
|
24874
24576
|
body: JSON.stringify(data),
|
|
24875
24577
|
});
|
|
@@ -24882,10 +24584,7 @@ func.common.perform_rpi_request = async function (
|
|
|
24882
24584
|
} catch (err) {
|
|
24883
24585
|
console.error(err);
|
|
24884
24586
|
if (err === 503) {
|
|
24885
|
-
_this.func.UI.utils.progressScreen.show(
|
|
24886
|
-
SESSION_ID,
|
|
24887
|
-
`Error code ${err}, reloading in 5 sec`
|
|
24888
|
-
);
|
|
24587
|
+
_this.func.UI.utils.progressScreen.show(SESSION_ID, `Error code ${err}, reloading in 5 sec`);
|
|
24889
24588
|
setTimeout(async () => {
|
|
24890
24589
|
await func.index.delete_pouch(SESSION_ID);
|
|
24891
24590
|
location.reload();
|
|
@@ -24896,23 +24595,19 @@ func.common.perform_rpi_request = async function (
|
|
|
24896
24595
|
};
|
|
24897
24596
|
|
|
24898
24597
|
try {
|
|
24899
|
-
if (_session.engine_mode ===
|
|
24900
|
-
throw new Error(
|
|
24598
|
+
if (_session.engine_mode === 'live_preview') {
|
|
24599
|
+
throw new Error('live_preview');
|
|
24901
24600
|
}
|
|
24902
24601
|
|
|
24903
24602
|
if (SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)) {
|
|
24904
|
-
const ret = await func.common.get_data_from_websocket(
|
|
24905
|
-
SESSION_ID,
|
|
24906
|
-
serviceP,
|
|
24907
|
-
data
|
|
24908
|
-
);
|
|
24603
|
+
const ret = await func.common.get_data_from_websocket(SESSION_ID, serviceP, data);
|
|
24909
24604
|
if (_data_system) {
|
|
24910
24605
|
// _data_system.SYS_GLOBAL_BOL_AJAX_BUSY = 0;
|
|
24911
24606
|
await set_ajax(0);
|
|
24912
24607
|
}
|
|
24913
24608
|
return ret;
|
|
24914
24609
|
} else {
|
|
24915
|
-
throw new Error(
|
|
24610
|
+
throw new Error('method not found in rpi_http_methods');
|
|
24916
24611
|
}
|
|
24917
24612
|
} catch (err) {
|
|
24918
24613
|
const ret = await http();
|
|
@@ -24924,11 +24619,7 @@ func.common.perform_rpi_request = async function (
|
|
|
24924
24619
|
}
|
|
24925
24620
|
};
|
|
24926
24621
|
|
|
24927
|
-
func.common.get_data_from_websocket = async function (
|
|
24928
|
-
SESSION_ID,
|
|
24929
|
-
serviceP,
|
|
24930
|
-
data
|
|
24931
|
-
) {
|
|
24622
|
+
func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data) {
|
|
24932
24623
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
24933
24624
|
return new Promise(function (resolve, reject) {
|
|
24934
24625
|
const dbs_calls = function () {
|
|
@@ -24939,60 +24630,46 @@ func.common.get_data_from_websocket = async function (
|
|
|
24939
24630
|
websocket_queue_num: glb.websocket_queue_num,
|
|
24940
24631
|
};
|
|
24941
24632
|
if (glb.IS_WORKER) {
|
|
24942
|
-
func.utils.post_back_to_client(
|
|
24943
|
-
SESSION_ID,
|
|
24944
|
-
"get_dbs_data_from_websocket",
|
|
24945
|
-
_session.worker_id,
|
|
24946
|
-
obj
|
|
24947
|
-
);
|
|
24633
|
+
func.utils.post_back_to_client(SESSION_ID, 'get_dbs_data_from_websocket', _session.worker_id, obj);
|
|
24948
24634
|
|
|
24949
|
-
self.addEventListener(
|
|
24950
|
-
|
|
24951
|
-
|
|
24952
|
-
resolve(event.detail.data);
|
|
24953
|
-
}
|
|
24954
|
-
);
|
|
24635
|
+
self.addEventListener('get_ws_data_worker_' + glb.websocket_queue_num, (event) => {
|
|
24636
|
+
resolve(event.detail.data);
|
|
24637
|
+
});
|
|
24955
24638
|
// throw new Error("not ready yet");
|
|
24956
24639
|
} else {
|
|
24957
24640
|
if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED) {
|
|
24958
|
-
RUNTIME_SERVER_WEBSOCKET.emit(
|
|
24959
|
-
$(
|
|
24960
|
-
|
|
24961
|
-
(
|
|
24962
|
-
|
|
24963
|
-
$("body").off(
|
|
24964
|
-
"get_ws_data_response_" + data.e.websocket_queue_num
|
|
24965
|
-
);
|
|
24966
|
-
}
|
|
24967
|
-
);
|
|
24641
|
+
RUNTIME_SERVER_WEBSOCKET.emit('message', obj);
|
|
24642
|
+
$('body').on('get_ws_data_response_' + glb.websocket_queue_num, (e, data) => {
|
|
24643
|
+
resolve(data.data);
|
|
24644
|
+
$('body').off('get_ws_data_response_' + data.e.websocket_queue_num);
|
|
24645
|
+
});
|
|
24968
24646
|
} else {
|
|
24969
|
-
throw new Error(
|
|
24647
|
+
throw new Error('fail to fetch from ws websocket inactive');
|
|
24970
24648
|
}
|
|
24971
24649
|
}
|
|
24972
24650
|
};
|
|
24973
24651
|
const heartbeat = function () {
|
|
24974
24652
|
const obj = {
|
|
24975
|
-
service:
|
|
24653
|
+
service: 'heartbeat',
|
|
24976
24654
|
data,
|
|
24977
24655
|
};
|
|
24978
24656
|
|
|
24979
24657
|
if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED) {
|
|
24980
|
-
RUNTIME_SERVER_WEBSOCKET.emit(
|
|
24981
|
-
$(
|
|
24658
|
+
RUNTIME_SERVER_WEBSOCKET.emit('message', obj);
|
|
24659
|
+
$('body').on('heartbeat_response', (e, data) => {
|
|
24982
24660
|
resolve(data.data);
|
|
24983
|
-
$(
|
|
24661
|
+
$('body').off('heartbeat_response');
|
|
24984
24662
|
});
|
|
24985
24663
|
} else {
|
|
24986
|
-
throw new Error(
|
|
24664
|
+
throw new Error('fail to fetch from ws websocket inactive');
|
|
24987
24665
|
}
|
|
24988
24666
|
};
|
|
24989
|
-
if (serviceP ===
|
|
24667
|
+
if (serviceP === 'heartbeat') {
|
|
24990
24668
|
return heartbeat();
|
|
24991
24669
|
}
|
|
24992
24670
|
dbs_calls();
|
|
24993
24671
|
});
|
|
24994
24672
|
};
|
|
24995
|
-
|
|
24996
24673
|
glb.DEBUG_INFO_OBJ = {};
|
|
24997
24674
|
// var CONNECTION_ATTEMPTS = 0;
|
|
24998
24675
|
glb.APP_INFO = {};
|