@xuda.io/runtime-bundle 1.0.559 → 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.
@@ -1623,12 +1623,9 @@ wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="o
1623
1623
  },
1624
1624
  };
1625
1625
  });
1626
-
1627
1626
  "use strict";
1627
+
1628
1628
  'use strict';
1629
1629
 
1630
- if (
1631
- typeof IS_DOCKER === "undefined" ||
1632
- typeof IS_PROCESS_SERVER === "undefined"
1633
- ) {
1630
+ if (typeof IS_DOCKER === 'undefined' || typeof IS_PROCESS_SERVER === 'undefined') {
1634
1631
  var SESSION_OBJ = {};
1635
1632
  var DOCS_OBJ = {};
1636
1633
  }
@@ -1645,17 +1642,7 @@ var PROJECT_OBJ = {};
1645
1642
  var APP_OBJ = {};
1646
1643
  var SESSION_ID = null;
1647
1644
 
1648
- glb.PROTECTED_VARS = [
1649
- "_NULL",
1650
- "_THIS",
1651
- "_FOR_KEY",
1652
- "_FOR_VAL",
1653
- "_ROWNO",
1654
- "_ROWID",
1655
- "_ROWDOC",
1656
- "_KEY",
1657
- "_VAL",
1658
- ];
1645
+ glb.PROTECTED_VARS = ['_NULL', '_THIS', '_FOR_KEY', '_FOR_VAL', '_ROWNO', '_ROWID', '_ROWDOC', '_KEY', '_VAL'];
1659
1646
 
1660
1647
  // glb.newRecord = 999999;
1661
1648
 
@@ -1672,7 +1659,7 @@ func.common.find_item_by_key_root = function (arr, key, val) {
1672
1659
  };
1673
1660
  func.common.find_ROWID_idx = function (_ds, rowId) {
1674
1661
  if (!_ds?.data_feed?.rows) {
1675
- throw new Error("data_feed not found");
1662
+ throw new Error('data_feed not found');
1676
1663
  }
1677
1664
 
1678
1665
  // Find the index of the object with the given _ROWID
@@ -1686,129 +1673,55 @@ func.common.find_ROWID_idx = function (_ds, rowId) {
1686
1673
  // Return the found index
1687
1674
  return index;
1688
1675
  };
1689
- func.common.input_mask = async function (
1690
- actionP,
1691
- valP,
1692
- typeP,
1693
- maskP,
1694
- elemP,
1695
- grid_objP,
1696
- grid_row_idP,
1697
- grid_col_idP,
1698
- dsSessionP
1699
- ) {
1700
- const module = await func.common.get_module(
1701
- SESSION_ID,
1702
- "xuda-input-musk-utils-module.mjs"
1703
- );
1676
+ func.common.input_mask = async function (actionP, valP, typeP, maskP, elemP, grid_objP, grid_row_idP, grid_col_idP, dsSessionP) {
1677
+ const module = await func.common.get_module(SESSION_ID, 'xuda-input-musk-utils-module.mjs');
1704
1678
 
1705
- module.input_mask(
1706
- actionP,
1707
- valP,
1708
- typeP,
1709
- maskP,
1710
- elemP,
1711
- grid_objP,
1712
- grid_row_idP,
1713
- grid_col_idP,
1714
- dsSessionP
1715
- );
1679
+ module.input_mask(actionP, valP, typeP, maskP, elemP, grid_objP, grid_row_idP, grid_col_idP, dsSessionP);
1716
1680
  };
1717
1681
 
1718
- glb.MAIN_WINDOW_TYPES_ARR = ["screen", "program"];
1719
- glb.FUNCTION_NODES_ARR = [
1720
- "batch",
1721
- "get_data",
1722
- "set_data",
1723
- "Alert_error",
1724
- "Alert_warning",
1725
- "Alert_info",
1726
- "Alert_ok",
1727
- "javascript",
1728
- "SQL",
1729
- ];
1682
+ glb.MAIN_WINDOW_TYPES_ARR = ['screen', 'program'];
1683
+ glb.FUNCTION_NODES_ARR = ['batch', 'get_data', 'set_data', 'Alert_error', 'Alert_warning', 'Alert_info', 'Alert_ok', 'javascript', 'SQL'];
1730
1684
  glb.emailRegex = /^[\w\.-]+@[a-zA-Z\d\.-]+\.[a-zA-Z]{2,}$/;
1731
1685
 
1732
- const FIREBASE_AUTH_PROPERTIES_ARR = [
1733
- "provider",
1734
- "token",
1735
- "first_name",
1736
- "last_name",
1737
- "email",
1738
- "user_id",
1739
- "picture",
1740
- "verified_email",
1741
- "locale",
1742
- "error_code",
1743
- "error_msg",
1744
- ];
1686
+ const FIREBASE_AUTH_PROPERTIES_ARR = ['provider', 'token', 'first_name', 'last_name', 'email', 'user_id', 'picture', 'verified_email', 'locale', 'error_code', 'error_msg'];
1745
1687
 
1746
1688
  const CLIENT_INFO_PROPERTIES_ARR = [
1747
- "fingerprint",
1748
- "device",
1749
- "user_agent",
1750
- "browser_version",
1751
- "browser_name",
1752
- "engine_version",
1753
- "engine_name",
1754
- "client_ip",
1755
- "os_name",
1756
- "os_version",
1757
- "device_model",
1758
- "device_vendor",
1759
- "device_type",
1760
- "screen_current_resolution_x",
1761
- "screen_current_resolution_y",
1762
- "screen_available_resolution_x",
1763
- "screen_available_resolution_y",
1764
- "language",
1765
- "time_zone",
1766
- "cpu_architecture",
1767
- "uuid",
1768
- "cursor_pos_x",
1769
- "cursor_pos_y",
1689
+ 'fingerprint',
1690
+ 'device',
1691
+ 'user_agent',
1692
+ 'browser_version',
1693
+ 'browser_name',
1694
+ 'engine_version',
1695
+ 'engine_name',
1696
+ 'client_ip',
1697
+ 'os_name',
1698
+ 'os_version',
1699
+ 'device_model',
1700
+ 'device_vendor',
1701
+ 'device_type',
1702
+ 'screen_current_resolution_x',
1703
+ 'screen_current_resolution_y',
1704
+ 'screen_available_resolution_x',
1705
+ 'screen_available_resolution_y',
1706
+ 'language',
1707
+ 'time_zone',
1708
+ 'cpu_architecture',
1709
+ 'uuid',
1710
+ 'cursor_pos_x',
1711
+ 'cursor_pos_y',
1770
1712
  ];
1771
1713
 
1772
- const APP_PROPERTIES_ARR = ["build", "author", "date", "name"];
1773
-
1774
- const DATASOURCE_PROPERTIES_ARR = [
1775
- "rows",
1776
- "type",
1777
- "first_row_id",
1778
- "last_row_id",
1779
- "query_from_segments_json",
1780
- "query_to_segments_json",
1781
- "locate_query_from_segments_json",
1782
- "locate_query_to_segments_json",
1783
- "first_row_segments_json",
1784
- "last_row_segments_json",
1785
- "rowid_snapshot",
1786
- "rowid",
1787
- ];
1714
+ const APP_PROPERTIES_ARR = ['build', 'author', 'date', 'name'];
1788
1715
 
1789
- glb.MOBILE_ARR = [
1790
- "component",
1791
- "web_app",
1792
- "ios_app",
1793
- "android_app",
1794
- "electron_app",
1795
- "osx_app",
1796
- "windows_app",
1797
- ];
1716
+ 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'];
1798
1717
 
1799
- glb.SYS_DATE_ARR = [
1800
- "SYS_DATE",
1801
- "SYS_DATE_TIME",
1802
- "SYS_DATE_VALUE",
1803
- "SYS_DATE_WEEK_YEAR",
1804
- "SYS_DATE_MONTH_YEAR",
1805
- "SYS_TIME_SHORT",
1806
- "SYS_TIME",
1807
- ];
1718
+ glb.MOBILE_ARR = ['component', 'web_app', 'ios_app', 'android_app', 'electron_app', 'osx_app', 'windows_app'];
1808
1719
 
1809
- glb.API_OUTPUT_ARR = ["json", "html", "xml", "text", "css", "javascript"];
1720
+ 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'];
1810
1721
 
1811
- const PROTECTED_NAMES_ARR = ["THIS", "ROWID"]; //tbd
1722
+ glb.API_OUTPUT_ARR = ['json', 'html', 'xml', 'text', 'css', 'javascript'];
1723
+
1724
+ const PROTECTED_NAMES_ARR = ['THIS', 'ROWID']; //tbd
1812
1725
 
1813
1726
  // func.common.get_custom_icon = async function (
1814
1727
  // SESSION_ID,
@@ -1851,19 +1764,13 @@ const PROTECTED_NAMES_ARR = ["THIS", "ROWID"]; //tbd
1851
1764
  // } else return ret;
1852
1765
  // };
1853
1766
 
1854
- func.common.db = async function (
1855
- SESSION_ID,
1856
- serviceP,
1857
- dataP,
1858
- opt = {},
1859
- dsSession
1860
- ) {
1767
+ func.common.db = async function (SESSION_ID, serviceP, dataP, opt = {}, dsSession) {
1861
1768
  return new Promise(async function (resolve, reject) {
1862
1769
  var _session = SESSION_OBJ[SESSION_ID];
1863
1770
  const app_id = _session.app_id;
1864
1771
 
1865
- if (_session.engine_mode === "live_preview") {
1866
- console.log("request", dataP);
1772
+ if (_session.engine_mode === 'live_preview') {
1773
+ console.log('request', dataP);
1867
1774
  }
1868
1775
 
1869
1776
  var data = {
@@ -1875,18 +1782,15 @@ func.common.db = async function (
1875
1782
  app_token: _session.app_token,
1876
1783
  res_token: _session.res_token,
1877
1784
  engine_mode: _session.engine_mode,
1878
- req_id: "rt_req_" + crypto.randomUUID(),
1785
+ req_id: 'rt_req_' + crypto.randomUUID(),
1879
1786
  app_replicate: APP_OBJ[app_id].app_replicate,
1880
1787
  };
1881
1788
 
1882
1789
  try {
1883
- if (
1884
- typeof firebase !== "undefined" &&
1885
- firebase?.auth()?.currentUser?.displayName
1886
- ) {
1790
+ if (typeof firebase !== 'undefined' && firebase?.auth()?.currentUser?.displayName) {
1887
1791
  data.device_name = firebase.auth().currentUser.displayName;
1888
1792
  }
1889
- } catch (error) { }
1793
+ } catch (error) {}
1890
1794
 
1891
1795
  for (const [key, val] of Object.entries(dataP)) {
1892
1796
  data[key] = val;
@@ -1894,20 +1798,14 @@ func.common.db = async function (
1894
1798
 
1895
1799
  const success_callback = function (ret) {
1896
1800
  if (dataP.table_id && DOCS_OBJ[app_id][dataP.table_id]) {
1897
- func.utils.debug.watch(
1898
- SESSION_ID,
1899
- dataP.table_id,
1900
- "table",
1901
- DOCS_OBJ[app_id][dataP.table_id].properties.menuName,
1902
- {
1903
- req: data,
1904
- res: ret,
1905
- }
1906
- );
1801
+ func.utils.debug.watch(SESSION_ID, dataP.table_id, 'table', DOCS_OBJ[app_id][dataP.table_id].properties.menuName, {
1802
+ req: data,
1803
+ res: ret,
1804
+ });
1907
1805
  }
1908
1806
 
1909
- if (_session.engine_mode === "live_preview") {
1910
- console.log("response", ret);
1807
+ if (_session.engine_mode === 'live_preview') {
1808
+ console.log('response', ret);
1911
1809
  }
1912
1810
  resolve(ret, true);
1913
1811
  };
@@ -1918,31 +1816,14 @@ func.common.db = async function (
1918
1816
  function cleanString(json) {
1919
1817
  let str = JSON.stringify(json);
1920
1818
  // Replace all non-alphanumeric characters with an empty string
1921
- return str.replace(/[^a-zA-Z0-9]/g, "");
1819
+ return str.replace(/[^a-zA-Z0-9]/g, '');
1922
1820
  }
1923
1821
  const get_rep_id = function () {
1924
1822
  let _data = {};
1925
- const fields_to_skip = [
1926
- "fields",
1927
- "viewSourceDesc",
1928
- "skip",
1929
- "limit",
1930
- "count",
1931
- "reduce",
1932
- "prog_id",
1933
- "sortModel",
1934
- "filterModelMongo",
1935
- "filterModelSql",
1936
- "filterModelUserMongo",
1937
- "filterModelUserSql",
1938
- ];
1823
+ const fields_to_skip = ['fields', 'viewSourceDesc', 'skip', 'limit', 'count', 'reduce', 'prog_id', 'sortModel', 'filterModelMongo', 'filterModelSql', 'filterModelUserMongo', 'filterModelUserSql'];
1939
1824
 
1940
1825
  for (let [key, val] of Object.entries(dataP)) {
1941
- if (
1942
- typeof val !== "undefined" &&
1943
- val !== null &&
1944
- !fields_to_skip.includes(key)
1945
- ) {
1826
+ if (typeof val !== 'undefined' && val !== null && !fields_to_skip.includes(key)) {
1946
1827
  _data[key] = val;
1947
1828
  }
1948
1829
  }
@@ -1960,13 +1841,13 @@ func.common.db = async function (
1960
1841
 
1961
1842
  let ret = await db.find({
1962
1843
  selector: {
1963
- docType: "rep_request",
1844
+ docType: 'rep_request',
1964
1845
  table_id: data.table_id,
1965
1846
  },
1966
1847
  });
1967
1848
 
1968
1849
  if (doc.stat < 3) {
1969
- throw "not ready";
1850
+ throw 'not ready';
1970
1851
  }
1971
1852
 
1972
1853
  /// delete table refunded requests
@@ -1981,10 +1862,7 @@ func.common.db = async function (
1981
1862
  };
1982
1863
 
1983
1864
  const read_dbs_pouch = async function (db) {
1984
- if (
1985
- _session?.DS_GLB?.[dsSession]?.refreshed &&
1986
- (dataP.filterModelMongo || dataP.filterModelSql)
1987
- ) {
1865
+ if (_session?.DS_GLB?.[dsSession]?.refreshed && (dataP.filterModelMongo || dataP.filterModelSql)) {
1988
1866
  return {
1989
1867
  code: 1,
1990
1868
  data: await func.db.pouch[serviceP](SESSION_ID, data),
@@ -1993,8 +1871,7 @@ func.common.db = async function (
1993
1871
 
1994
1872
  const rep_id = get_rep_id();
1995
1873
 
1996
- const { code: table_req_code, data: table_req_id } =
1997
- await validate_existence_of_whole_table_request(db);
1874
+ const { code: table_req_code, data: table_req_id } = await validate_existence_of_whole_table_request(db);
1998
1875
  if (table_req_code > 0) {
1999
1876
  return {
2000
1877
  code: 1,
@@ -2004,7 +1881,7 @@ func.common.db = async function (
2004
1881
 
2005
1882
  try {
2006
1883
  const doc = await db.get(rep_id);
2007
- if (doc.stat < 3) throw "replication not ready";
1884
+ if (doc.stat < 3) throw 'replication not ready';
2008
1885
  const json = {
2009
1886
  code: 1,
2010
1887
  data: await func.db.pouch[serviceP](SESSION_ID, data),
@@ -2012,12 +1889,7 @@ func.common.db = async function (
2012
1889
 
2013
1890
  return json;
2014
1891
  } catch (err) {
2015
- const json = await func.common.perform_rpi_request(
2016
- SESSION_ID,
2017
- serviceP,
2018
- opt,
2019
- data
2020
- );
1892
+ const json = await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
2021
1893
  if (json.data.opt) {
2022
1894
  try {
2023
1895
  try {
@@ -2028,16 +1900,16 @@ func.common.db = async function (
2028
1900
  selector: json.data.opt.selector,
2029
1901
  stat: 1,
2030
1902
  ts: Date.now(),
2031
- docType: "rep_request",
1903
+ docType: 'rep_request',
2032
1904
  table_id: dataP.table_id,
2033
1905
  prog_id: dataP.prog_id,
2034
1906
  entire_table: table_req_id === rep_id,
2035
- source: "runtime",
1907
+ source: 'runtime',
2036
1908
  e: data,
2037
1909
  });
2038
1910
  }
2039
1911
  func.db.pouch.set_db_replication_from_server(SESSION_ID);
2040
- } catch (err) { }
1912
+ } catch (err) {}
2041
1913
  }
2042
1914
  return json;
2043
1915
  }
@@ -2048,8 +1920,7 @@ func.common.db = async function (
2048
1920
  // throw "online";
2049
1921
  // }
2050
1922
 
2051
- const { code: table_req_code, data: table_req_id } =
2052
- await validate_existence_of_whole_table_request(db);
1923
+ const { code: table_req_code, data: table_req_id } = await validate_existence_of_whole_table_request(db);
2053
1924
 
2054
1925
  if (table_req_code > 0) {
2055
1926
  data.full_table_downloaded = true;
@@ -2058,37 +1929,25 @@ func.common.db = async function (
2058
1929
  await db.get(dataP.row_id);
2059
1930
  return await func.db.pouch[serviceP](SESSION_ID, data);
2060
1931
  } catch (err) {
2061
- return await func.common.perform_rpi_request(
2062
- SESSION_ID,
2063
- serviceP,
2064
- opt,
2065
- data
2066
- );
1932
+ return await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
2067
1933
  }
2068
1934
  };
2069
1935
  const create_dbs_pouch = async function (db) {
2070
1936
  try {
2071
- const { code: table_req_code, data: table_req_id } =
2072
- await validate_existence_of_whole_table_request(db);
1937
+ const { code: table_req_code, data: table_req_id } = await validate_existence_of_whole_table_request(db);
2073
1938
 
2074
1939
  if (table_req_code > 0) {
2075
1940
  data.full_table_downloaded = true;
2076
1941
  }
2077
1942
  return await func.db.pouch[serviceP](SESSION_ID, data);
2078
1943
  } catch (err) {
2079
- return await func.common.perform_rpi_request(
2080
- SESSION_ID,
2081
- serviceP,
2082
- opt,
2083
- data
2084
- );
1944
+ return await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
2085
1945
  }
2086
1946
  };
2087
1947
  const delete_dbs_pouch = async function (db) {
2088
- for await (let row_id of dataP.ids) {
1948
+ for await (let row_id of dataP.ids || []) {
2089
1949
  try {
2090
- const { code: table_req_code, data: table_req_id } =
2091
- await validate_existence_of_whole_table_request(db);
1950
+ const { code: table_req_code, data: table_req_id } = await validate_existence_of_whole_table_request(db);
2092
1951
 
2093
1952
  if (table_req_code > 0) {
2094
1953
  data.full_table_downloaded = true;
@@ -2097,41 +1956,32 @@ func.common.db = async function (
2097
1956
  await db.get(row_id);
2098
1957
  let _data = _.cloneDeep(dataP);
2099
1958
  _data.ids = [row_id];
2100
- return await func.db.pouch["dbs_delete"](SESSION_ID, _data);
1959
+ return await func.db.pouch['dbs_delete'](SESSION_ID, _data);
2101
1960
  } catch (err) {
2102
- return await func.common.perform_rpi_request(
2103
- SESSION_ID,
2104
- serviceP,
2105
- opt,
2106
- data
2107
- );
1961
+ return await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
2108
1962
  }
2109
1963
  }
2110
1964
  };
2111
- if (
2112
- typeof IS_DOCKER === "undefined" &&
2113
- typeof IS_PROCESS_SERVER === "undefined"
2114
- ) {
1965
+ if (typeof IS_DOCKER === 'undefined' && typeof IS_PROCESS_SERVER === 'undefined') {
2115
1966
  try {
2116
1967
  if (!SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)) {
2117
- throw "";
1968
+ throw '';
2118
1969
  }
2119
- if (!(await func?.db?.pouch?.get_replication_stat(SESSION_ID)))
2120
- throw "";
1970
+ if (!(await func?.db?.pouch?.get_replication_stat(SESSION_ID))) throw '';
2121
1971
  const db = await func.utils.connect_pouchdb(SESSION_ID);
2122
1972
  switch (serviceP) {
2123
- case "dbs_read": {
1973
+ case 'dbs_read': {
2124
1974
  try {
2125
1975
  return success_callback(await read_dbs_pouch(db));
2126
1976
  } catch (err) {
2127
- if (err === "creating index in progress") {
2128
- throw "";
1977
+ if (err === 'creating index in progress') {
1978
+ throw '';
2129
1979
  }
2130
1980
  return error_callback(err);
2131
1981
  }
2132
1982
  break;
2133
1983
  }
2134
- case "dbs_update": {
1984
+ case 'dbs_update': {
2135
1985
  try {
2136
1986
  const ret = {
2137
1987
  code: 1,
@@ -2143,7 +1993,7 @@ func.common.db = async function (
2143
1993
  }
2144
1994
  break;
2145
1995
  }
2146
- case "dbs_create": {
1996
+ case 'dbs_create': {
2147
1997
  try {
2148
1998
  const ret = {
2149
1999
  code: 1,
@@ -2155,7 +2005,7 @@ func.common.db = async function (
2155
2005
  }
2156
2006
  break;
2157
2007
  }
2158
- case "dbs_delete": {
2008
+ case 'dbs_delete': {
2159
2009
  try {
2160
2010
  const ret = {
2161
2011
  code: 1,
@@ -2169,17 +2019,12 @@ func.common.db = async function (
2169
2019
  }
2170
2020
 
2171
2021
  default:
2172
- throw "";
2022
+ throw '';
2173
2023
  break;
2174
2024
  }
2175
2025
  } catch (err) {
2176
2026
  try {
2177
- const json = await func.common.perform_rpi_request(
2178
- SESSION_ID,
2179
- serviceP,
2180
- opt,
2181
- data
2182
- );
2027
+ const json = await func.common.perform_rpi_request(SESSION_ID, serviceP, opt, data);
2183
2028
  return success_callback(json, true);
2184
2029
  } catch (err) {
2185
2030
  return error_callback(err);
@@ -2200,14 +2045,14 @@ func.common.db = async function (
2200
2045
  var e = {};
2201
2046
  _.forEach(data, function (val, key) {
2202
2047
  if (!val) {
2203
- if (typeof val === "boolean") {
2204
- e[key] = "false";
2048
+ if (typeof val === 'boolean') {
2049
+ e[key] = 'false';
2205
2050
  } else {
2206
- e[key] = "";
2051
+ e[key] = '';
2207
2052
  }
2208
2053
  } else {
2209
- if (typeof val === "boolean") {
2210
- e[key] = "true";
2054
+ if (typeof val === 'boolean') {
2055
+ e[key] = 'true';
2211
2056
  } else {
2212
2057
  e[key] = val;
2213
2058
  }
@@ -2215,7 +2060,7 @@ func.common.db = async function (
2215
2060
  });
2216
2061
 
2217
2062
  if (data.fields && !data.fields.length) {
2218
- e.fields = "";
2063
+ e.fields = '';
2219
2064
  }
2220
2065
 
2221
2066
  return e;
@@ -2225,13 +2070,8 @@ func.common.db = async function (
2225
2070
  await func.utils.FILES_OBJ.get(SESSION_ID, dataP.table_id);
2226
2071
  await func.utils.TREE_OBJ.get(SESSION_ID, dataP.table_id);
2227
2072
  }
2228
- data.db_driver = "xuda";
2229
- __.rpi.http_calls(
2230
- serviceP,
2231
- { body: get_white_spaced_data(data) },
2232
- null,
2233
- response
2234
- );
2073
+ data.db_driver = 'xuda';
2074
+ __.rpi.http_calls(serviceP, { body: get_white_spaced_data(data) }, null, response);
2235
2075
  });
2236
2076
  };
2237
2077
 
@@ -2251,11 +2091,7 @@ func.common.getParametersFromUrl = function () {
2251
2091
  return parameters;
2252
2092
  };
2253
2093
 
2254
- func.common.getObjectFromUrl = function (
2255
- url,
2256
- element_attributes_obj,
2257
- embed_params_obj
2258
- ) {
2094
+ func.common.getObjectFromUrl = function (url, element_attributes_obj, embed_params_obj) {
2259
2095
  var result = {};
2260
2096
  if (element_attributes_obj) {
2261
2097
  for (let [key, val] of Object.entries(element_attributes_obj)) {
@@ -2268,33 +2104,26 @@ func.common.getObjectFromUrl = function (
2268
2104
  }
2269
2105
  }
2270
2106
 
2271
- if (
2272
- !url &&
2273
- typeof IS_DOCKER === "undefined" &&
2274
- typeof IS_PROCESS_SERVER === "undefined"
2275
- ) {
2107
+ if (!url && typeof IS_DOCKER === 'undefined' && typeof IS_PROCESS_SERVER === 'undefined') {
2276
2108
  url = location.href;
2277
2109
  }
2278
- var question = url.indexOf("?");
2279
- var hash = url.indexOf("#");
2110
+ var question = url.indexOf('?');
2111
+ var hash = url.indexOf('#');
2280
2112
  if (hash == -1 && question == -1) return result;
2281
2113
  if (hash == -1) hash = url.length;
2282
- var query =
2283
- question == -1 || hash == question + 1
2284
- ? url.substring(hash)
2285
- : url.substring(question + 1, hash);
2114
+ var query = question == -1 || hash == question + 1 ? url.substring(hash) : url.substring(question + 1, hash);
2286
2115
  // var result = {};
2287
- query.split("&").forEach(function (part) {
2116
+ query.split('&').forEach(function (part) {
2288
2117
  if (!part) return;
2289
- part = part.split("+").join(" "); // replace every + with space, regexp-free version
2290
- var eq = part.indexOf("=");
2118
+ part = part.split('+').join(' '); // replace every + with space, regexp-free version
2119
+ var eq = part.indexOf('=');
2291
2120
  var key = eq > -1 ? part.substr(0, eq) : part;
2292
- var val = eq > -1 ? decodeURIComponent(part.substr(eq + 1)) : "";
2293
- var from = key.indexOf("[");
2121
+ var val = eq > -1 ? decodeURIComponent(part.substr(eq + 1)) : '';
2122
+ var from = key.indexOf('[');
2294
2123
  if (from == -1) {
2295
2124
  result[decodeURIComponent(key)] = val;
2296
2125
  } else {
2297
- var to = key.indexOf("]", from);
2126
+ var to = key.indexOf(']', from);
2298
2127
  var index = decodeURIComponent(key.substring(from + 1, to));
2299
2128
  key = decodeURIComponent(key.substring(0, from));
2300
2129
  if (!result[key]) result[key] = [];
@@ -2309,159 +2138,158 @@ func.common.getObjectFromUrl = function (
2309
2138
  func.common.getContrast_color = function (hexcolor) {
2310
2139
  function colourNameToHex(colour) {
2311
2140
  var colours = {
2312
- aliceblue: "#f0f8ff",
2313
- antiquewhite: "#faebd7",
2314
- aqua: "#00ffff",
2315
- aquamarine: "#7fffd4",
2316
- azure: "#f0ffff",
2317
- beige: "#f5f5dc",
2318
- bisque: "#ffe4c4",
2319
- black: "#000000",
2320
- blanchedalmond: "#ffebcd",
2321
- blue: "#0000ff",
2322
- blueviolet: "#8a2be2",
2323
- brown: "#a52a2a",
2324
- burlywood: "#deb887",
2325
- cadetblue: "#5f9ea0",
2326
- chartreuse: "#7fff00",
2327
- chocolate: "#d2691e",
2328
- coral: "#ff7f50",
2329
- cornflowerblue: "#6495ed",
2330
- cornsilk: "#fff8dc",
2331
- crimson: "#dc143c",
2332
- cyan: "#00ffff",
2333
- darkblue: "#00008b",
2334
- darkcyan: "#008b8b",
2335
- darkgoldenrod: "#b8860b",
2336
- darkgray: "#a9a9a9",
2337
- darkgreen: "#006400",
2338
- darkkhaki: "#bdb76b",
2339
- darkmagenta: "#8b008b",
2340
- darkolivegreen: "#556b2f",
2341
- darkorange: "#ff8c00",
2342
- darkorchid: "#9932cc",
2343
- darkred: "#8b0000",
2344
- darksalmon: "#e9967a",
2345
- darkseagreen: "#8fbc8f",
2346
- darkslateblue: "#483d8b",
2347
- darkslategray: "#2f4f4f",
2348
- darkturquoise: "#00ced1",
2349
- darkviolet: "#9400d3",
2350
- deeppink: "#ff1493",
2351
- deepskyblue: "#00bfff",
2352
- dimgray: "#696969",
2353
- dodgerblue: "#1e90ff",
2354
- firebrick: "#b22222",
2355
- floralwhite: "#fffaf0",
2356
- forestgreen: "#228b22",
2357
- fuchsia: "#ff00ff",
2358
- gainsboro: "#dcdcdc",
2359
- ghostwhite: "#f8f8ff",
2360
- gold: "#ffd700",
2361
- goldenrod: "#daa520",
2362
- gray: "#808080",
2363
- green: "#008000",
2364
- greenyellow: "#adff2f",
2365
- honeydew: "#f0fff0",
2366
- hotpink: "#ff69b4",
2367
- "indianred ": "#cd5c5c",
2368
- indigo: "#4b0082",
2369
- ivory: "#fffff0",
2370
- khaki: "#f0e68c",
2371
- lavender: "#e6e6fa",
2372
- lavenderblush: "#fff0f5",
2373
- lawngreen: "#7cfc00",
2374
- lemonchiffon: "#fffacd",
2375
- lightblue: "#add8e6",
2376
- lightcoral: "#f08080",
2377
- lightcyan: "#e0ffff",
2378
- lightgoldenrodyellow: "#fafad2",
2379
- lightgrey: "#d3d3d3",
2380
- lightgreen: "#90ee90",
2381
- lightpink: "#ffb6c1",
2382
- lightsalmon: "#ffa07a",
2383
- lightseagreen: "#20b2aa",
2384
- lightskyblue: "#87cefa",
2385
- lightslategray: "#778899",
2386
- lightsteelblue: "#b0c4de",
2387
- lightyellow: "#ffffe0",
2388
- lime: "#00ff00",
2389
- limegreen: "#32cd32",
2390
- linen: "#faf0e6",
2391
- magenta: "#ff00ff",
2392
- maroon: "#800000",
2393
- mediumaquamarine: "#66cdaa",
2394
- mediumblue: "#0000cd",
2395
- mediumorchid: "#ba55d3",
2396
- mediumpurple: "#9370d8",
2397
- mediumseagreen: "#3cb371",
2398
- mediumslateblue: "#7b68ee",
2399
- mediumspringgreen: "#00fa9a",
2400
- mediumturquoise: "#48d1cc",
2401
- mediumvioletred: "#c71585",
2402
- midnightblue: "#191970",
2403
- mintcream: "#f5fffa",
2404
- mistyrose: "#ffe4e1",
2405
- moccasin: "#ffe4b5",
2406
- navajowhite: "#ffdead",
2407
- navy: "#000080",
2408
- oldlace: "#fdf5e6",
2409
- olive: "#808000",
2410
- olivedrab: "#6b8e23",
2411
- orange: "#ffa500",
2412
- orangered: "#ff4500",
2413
- orchid: "#da70d6",
2414
- palegoldenrod: "#eee8aa",
2415
- palegreen: "#98fb98",
2416
- paleturquoise: "#afeeee",
2417
- palevioletred: "#d87093",
2418
- papayawhip: "#ffefd5",
2419
- peachpuff: "#ffdab9",
2420
- peru: "#cd853f",
2421
- pink: "#ffc0cb",
2422
- plum: "#dda0dd",
2423
- powderblue: "#b0e0e6",
2424
- purple: "#800080",
2425
- rebeccapurple: "#663399",
2426
- red: "#ff0000",
2427
- rosybrown: "#bc8f8f",
2428
- royalblue: "#4169e1",
2429
- saddlebrown: "#8b4513",
2430
- salmon: "#fa8072",
2431
- sandybrown: "#f4a460",
2432
- seagreen: "#2e8b57",
2433
- seashell: "#fff5ee",
2434
- sienna: "#a0522d",
2435
- silver: "#c0c0c0",
2436
- skyblue: "#87ceeb",
2437
- slateblue: "#6a5acd",
2438
- slategray: "#708090",
2439
- snow: "#fffafa",
2440
- springgreen: "#00ff7f",
2441
- steelblue: "#4682b4",
2442
- tan: "#d2b48c",
2443
- teal: "#008080",
2444
- thistle: "#d8bfd8",
2445
- tomato: "#ff6347",
2446
- turquoise: "#40e0d0",
2447
- violet: "#ee82ee",
2448
- wheat: "#f5deb3",
2449
- white: "#ffffff",
2450
- whitesmoke: "#f5f5f5",
2451
- yellow: "#ffff00",
2452
- yellowgreen: "#9acd32",
2141
+ aliceblue: '#f0f8ff',
2142
+ antiquewhite: '#faebd7',
2143
+ aqua: '#00ffff',
2144
+ aquamarine: '#7fffd4',
2145
+ azure: '#f0ffff',
2146
+ beige: '#f5f5dc',
2147
+ bisque: '#ffe4c4',
2148
+ black: '#000000',
2149
+ blanchedalmond: '#ffebcd',
2150
+ blue: '#0000ff',
2151
+ blueviolet: '#8a2be2',
2152
+ brown: '#a52a2a',
2153
+ burlywood: '#deb887',
2154
+ cadetblue: '#5f9ea0',
2155
+ chartreuse: '#7fff00',
2156
+ chocolate: '#d2691e',
2157
+ coral: '#ff7f50',
2158
+ cornflowerblue: '#6495ed',
2159
+ cornsilk: '#fff8dc',
2160
+ crimson: '#dc143c',
2161
+ cyan: '#00ffff',
2162
+ darkblue: '#00008b',
2163
+ darkcyan: '#008b8b',
2164
+ darkgoldenrod: '#b8860b',
2165
+ darkgray: '#a9a9a9',
2166
+ darkgreen: '#006400',
2167
+ darkkhaki: '#bdb76b',
2168
+ darkmagenta: '#8b008b',
2169
+ darkolivegreen: '#556b2f',
2170
+ darkorange: '#ff8c00',
2171
+ darkorchid: '#9932cc',
2172
+ darkred: '#8b0000',
2173
+ darksalmon: '#e9967a',
2174
+ darkseagreen: '#8fbc8f',
2175
+ darkslateblue: '#483d8b',
2176
+ darkslategray: '#2f4f4f',
2177
+ darkturquoise: '#00ced1',
2178
+ darkviolet: '#9400d3',
2179
+ deeppink: '#ff1493',
2180
+ deepskyblue: '#00bfff',
2181
+ dimgray: '#696969',
2182
+ dodgerblue: '#1e90ff',
2183
+ firebrick: '#b22222',
2184
+ floralwhite: '#fffaf0',
2185
+ forestgreen: '#228b22',
2186
+ fuchsia: '#ff00ff',
2187
+ gainsboro: '#dcdcdc',
2188
+ ghostwhite: '#f8f8ff',
2189
+ gold: '#ffd700',
2190
+ goldenrod: '#daa520',
2191
+ gray: '#808080',
2192
+ green: '#008000',
2193
+ greenyellow: '#adff2f',
2194
+ honeydew: '#f0fff0',
2195
+ hotpink: '#ff69b4',
2196
+ 'indianred ': '#cd5c5c',
2197
+ indigo: '#4b0082',
2198
+ ivory: '#fffff0',
2199
+ khaki: '#f0e68c',
2200
+ lavender: '#e6e6fa',
2201
+ lavenderblush: '#fff0f5',
2202
+ lawngreen: '#7cfc00',
2203
+ lemonchiffon: '#fffacd',
2204
+ lightblue: '#add8e6',
2205
+ lightcoral: '#f08080',
2206
+ lightcyan: '#e0ffff',
2207
+ lightgoldenrodyellow: '#fafad2',
2208
+ lightgrey: '#d3d3d3',
2209
+ lightgreen: '#90ee90',
2210
+ lightpink: '#ffb6c1',
2211
+ lightsalmon: '#ffa07a',
2212
+ lightseagreen: '#20b2aa',
2213
+ lightskyblue: '#87cefa',
2214
+ lightslategray: '#778899',
2215
+ lightsteelblue: '#b0c4de',
2216
+ lightyellow: '#ffffe0',
2217
+ lime: '#00ff00',
2218
+ limegreen: '#32cd32',
2219
+ linen: '#faf0e6',
2220
+ magenta: '#ff00ff',
2221
+ maroon: '#800000',
2222
+ mediumaquamarine: '#66cdaa',
2223
+ mediumblue: '#0000cd',
2224
+ mediumorchid: '#ba55d3',
2225
+ mediumpurple: '#9370d8',
2226
+ mediumseagreen: '#3cb371',
2227
+ mediumslateblue: '#7b68ee',
2228
+ mediumspringgreen: '#00fa9a',
2229
+ mediumturquoise: '#48d1cc',
2230
+ mediumvioletred: '#c71585',
2231
+ midnightblue: '#191970',
2232
+ mintcream: '#f5fffa',
2233
+ mistyrose: '#ffe4e1',
2234
+ moccasin: '#ffe4b5',
2235
+ navajowhite: '#ffdead',
2236
+ navy: '#000080',
2237
+ oldlace: '#fdf5e6',
2238
+ olive: '#808000',
2239
+ olivedrab: '#6b8e23',
2240
+ orange: '#ffa500',
2241
+ orangered: '#ff4500',
2242
+ orchid: '#da70d6',
2243
+ palegoldenrod: '#eee8aa',
2244
+ palegreen: '#98fb98',
2245
+ paleturquoise: '#afeeee',
2246
+ palevioletred: '#d87093',
2247
+ papayawhip: '#ffefd5',
2248
+ peachpuff: '#ffdab9',
2249
+ peru: '#cd853f',
2250
+ pink: '#ffc0cb',
2251
+ plum: '#dda0dd',
2252
+ powderblue: '#b0e0e6',
2253
+ purple: '#800080',
2254
+ rebeccapurple: '#663399',
2255
+ red: '#ff0000',
2256
+ rosybrown: '#bc8f8f',
2257
+ royalblue: '#4169e1',
2258
+ saddlebrown: '#8b4513',
2259
+ salmon: '#fa8072',
2260
+ sandybrown: '#f4a460',
2261
+ seagreen: '#2e8b57',
2262
+ seashell: '#fff5ee',
2263
+ sienna: '#a0522d',
2264
+ silver: '#c0c0c0',
2265
+ skyblue: '#87ceeb',
2266
+ slateblue: '#6a5acd',
2267
+ slategray: '#708090',
2268
+ snow: '#fffafa',
2269
+ springgreen: '#00ff7f',
2270
+ steelblue: '#4682b4',
2271
+ tan: '#d2b48c',
2272
+ teal: '#008080',
2273
+ thistle: '#d8bfd8',
2274
+ tomato: '#ff6347',
2275
+ turquoise: '#40e0d0',
2276
+ violet: '#ee82ee',
2277
+ wheat: '#f5deb3',
2278
+ white: '#ffffff',
2279
+ whitesmoke: '#f5f5f5',
2280
+ yellow: '#ffff00',
2281
+ yellowgreen: '#9acd32',
2453
2282
  };
2454
2283
 
2455
- if (typeof colours[colour.toLowerCase()] != "undefined")
2456
- return colours[colour.toLowerCase()];
2284
+ if (typeof colours[colour.toLowerCase()] != 'undefined') return colours[colour.toLowerCase()];
2457
2285
 
2458
2286
  return false;
2459
2287
  }
2460
- if (!hexcolor.includes("#")) {
2288
+ if (!hexcolor.includes('#')) {
2461
2289
  hexcolor = colourNameToHex(hexcolor);
2462
2290
  }
2463
2291
  // If a leading # is provided, remove it
2464
- if (hexcolor.slice(0, 1) === "#") {
2292
+ if (hexcolor.slice(0, 1) === '#') {
2465
2293
  hexcolor = hexcolor.slice(1);
2466
2294
  }
2467
2295
 
@@ -2474,51 +2302,30 @@ func.common.getContrast_color = function (hexcolor) {
2474
2302
  var yiq = (r * 299 + g * 587 + b * 114) / 1000;
2475
2303
 
2476
2304
  // Check contrast
2477
- return yiq >= 128 ? "black" : "white";
2305
+ return yiq >= 128 ? 'black' : 'white';
2478
2306
  };
2479
2307
 
2480
2308
  func.common.get_url = function (SESSION_ID, method, path) {
2481
- return `https://${SESSION_OBJ[SESSION_ID].domain}/${method}${path ? "/" + path : "/"
2482
- }`;
2309
+ return `https://${SESSION_OBJ[SESSION_ID].domain}/${method}${path ? '/' + path : '/'}`;
2483
2310
  };
2484
2311
 
2485
2312
  var UI_FRAMEWORK_INSTALLED = null;
2486
2313
  var UI_FRAMEWORK_PLUGIN = {};
2487
2314
 
2488
- func.common.get_cast_val = async function (
2489
- SESSION_ID,
2490
- source,
2491
- attributeP,
2492
- typeP,
2493
- valP,
2494
- errorP
2495
- ) {
2315
+ func.common.get_cast_val = async function (SESSION_ID, source, attributeP, typeP, valP, errorP) {
2496
2316
  const report_conversion_error = function (res) {
2497
2317
  if (errorP) {
2498
- return func.utils.debug_report(
2499
- SESSION_ID,
2500
- _.capitalize(source),
2501
- errorP,
2502
- "W"
2503
- );
2318
+ return func.utils.debug_report(SESSION_ID, _.capitalize(source), errorP, 'W');
2504
2319
  }
2505
2320
  var msg = `error converting ${attributeP} from ${valP} to ${typeP}`;
2506
- func.utils.debug_report(SESSION_ID, _.capitalize(source), msg, "E");
2321
+ func.utils.debug_report(SESSION_ID, _.capitalize(source), msg, 'E');
2507
2322
  };
2508
2323
  const report_conversion_warn = function (msg) {
2509
2324
  var msg = `type mismatch auto conversion made to ${attributeP} from value ${valP} to ${typeP}`;
2510
- func.utils.debug_report(SESSION_ID, _.capitalize(source), msg, "W");
2325
+ func.utils.debug_report(SESSION_ID, _.capitalize(source), msg, 'W');
2511
2326
  };
2512
- const module = await func.common.get_module(
2513
- SESSION_ID,
2514
- `xuda-get-cast-util-module.mjs`
2515
- );
2516
- return module.cast(
2517
- typeP,
2518
- valP,
2519
- report_conversion_error,
2520
- report_conversion_warn
2521
- );
2327
+ const module = await func.common.get_module(SESSION_ID, `xuda-get-cast-util-module.mjs`);
2328
+ return module.cast(typeP, valP, report_conversion_error, report_conversion_warn);
2522
2329
  };
2523
2330
  var WEB_WORKER = {};
2524
2331
  var WEB_WORKER_CALLBACK_QUEUE = {};
@@ -2540,9 +2347,7 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
2540
2347
  const module_ret = await import(src);
2541
2348
  var params = get_params();
2542
2349
 
2543
- const ret = module_ret.XudaModule
2544
- ? new module_ret.XudaModule(params)
2545
- : await invoke_init_module(module_ret, params);
2350
+ const ret = module_ret.XudaModule ? new module_ret.XudaModule(params) : await invoke_init_module(module_ret, params);
2546
2351
 
2547
2352
  return ret;
2548
2353
  };
@@ -2559,13 +2364,11 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
2559
2364
  _,
2560
2365
  ...paramsP,
2561
2366
  };
2562
- if (typeof IS_PROCESS_SERVER !== "undefined")
2563
- params.IS_PROCESS_SERVER = IS_PROCESS_SERVER;
2367
+ if (typeof IS_PROCESS_SERVER !== 'undefined') params.IS_PROCESS_SERVER = IS_PROCESS_SERVER;
2564
2368
 
2565
- if (typeof IS_API_SERVER !== "undefined")
2566
- params.IS_API_SERVER = IS_API_SERVER;
2369
+ if (typeof IS_API_SERVER !== 'undefined') params.IS_API_SERVER = IS_API_SERVER;
2567
2370
 
2568
- if (typeof IS_DOCKER !== "undefined") params.IS_DOCKER = IS_DOCKER;
2371
+ if (typeof IS_DOCKER !== 'undefined') params.IS_DOCKER = IS_DOCKER;
2569
2372
 
2570
2373
  return params;
2571
2374
  };
@@ -2576,73 +2379,29 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
2576
2379
  return module_ret;
2577
2380
  };
2578
2381
  const _session = SESSION_OBJ[SESSION_ID];
2579
- if (_session.worker_type === "Dev") {
2580
- ret = await get_ret("./modules/" + module);
2382
+ if (_session.worker_type === 'Dev') {
2383
+ ret = await get_ret('./modules/' + module);
2581
2384
 
2582
2385
  return ret;
2583
2386
  }
2584
- if (_session.worker_type === "Debug") {
2585
- if (
2586
- typeof IS_DOCKER !== "undefined" ||
2587
- typeof IS_PROCESS_SERVER !== "undefined"
2588
- ) {
2589
- ret = await get_ret(
2590
- func.utils.get_resource_filename(
2591
- SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
2592
- ? ""
2593
- : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
2594
- `${_conf.xuda_home}root/dist/runtime/js/modules/` + module
2595
- )
2596
- );
2387
+ if (_session.worker_type === 'Debug') {
2388
+ if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
2389
+ 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));
2597
2390
  } else {
2598
- ret = await get_ret(
2599
- func.common.get_url(
2600
- SESSION_ID,
2601
- "dist",
2602
- func.utils.get_resource_filename(
2603
- SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
2604
- ? ""
2605
- : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
2606
- "runtime/js/modules/" + module
2607
- )
2608
- )
2609
- );
2391
+ 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)));
2610
2392
  }
2611
2393
 
2612
2394
  return ret;
2613
2395
  }
2614
2396
 
2615
2397
  const rep = function () {
2616
- return _.endsWith(module, ".js")
2617
- ? module.replace(".js", ".min.js")
2618
- : module.replace(".mjs", ".min.mjs");
2398
+ return _.endsWith(module, '.js') ? module.replace('.js', '.min.js') : module.replace('.mjs', '.min.mjs');
2619
2399
  };
2620
2400
 
2621
- if (
2622
- typeof IS_DOCKER !== "undefined" ||
2623
- typeof IS_PROCESS_SERVER !== "undefined"
2624
- ) {
2625
- ret = await get_ret(
2626
- func.utils.get_resource_filename(
2627
- SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
2628
- ? ""
2629
- : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
2630
- `${_conf.xuda_home}root/dist/runtime/js/modules/` + rep()
2631
- )
2632
- );
2401
+ if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
2402
+ 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()));
2633
2403
  } else {
2634
- ret = await get_ret(
2635
- func.common.get_url(
2636
- SESSION_ID,
2637
- "dist",
2638
- func.utils.get_resource_filename(
2639
- SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
2640
- ? ""
2641
- : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
2642
- "runtime/js/modules/" + rep()
2643
- )
2644
- )
2645
- );
2404
+ 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())));
2646
2405
  }
2647
2406
 
2648
2407
  return ret;
@@ -2651,209 +2410,160 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
2651
2410
  func.api = {};
2652
2411
  func.api.set_field_value = async function (field_id, value, avoid_refresh) {
2653
2412
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2654
- const api_utils = await func.common.get_module(
2413
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2414
+ func,
2415
+ glb,
2416
+ SESSION_OBJ,
2655
2417
  SESSION_ID,
2656
- "xuda-api-library.mjs",
2657
- {
2658
- func,
2659
- glb,
2660
- SESSION_OBJ,
2661
- SESSION_ID,
2662
- APP_OBJ,
2663
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2664
- }
2665
- );
2418
+ APP_OBJ,
2419
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2420
+ });
2666
2421
 
2667
2422
  return await api_utils.set_field_value(field_id, value, avoid_refresh);
2668
2423
  };
2669
2424
  func.api.get_field_value = async function (field_id) {
2670
2425
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2671
- const api_utils = await func.common.get_module(
2426
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2427
+ func,
2428
+ glb,
2429
+ SESSION_OBJ,
2672
2430
  SESSION_ID,
2673
- "xuda-api-library.mjs",
2674
- {
2675
- func,
2676
- glb,
2677
- SESSION_OBJ,
2678
- SESSION_ID,
2679
- APP_OBJ,
2680
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2681
- }
2682
- );
2431
+ APP_OBJ,
2432
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2433
+ });
2683
2434
 
2684
2435
  return await api_utils.get_field_value(field_id);
2685
2436
  };
2686
2437
  func.api.invoke_event = async function (event_id) {
2687
2438
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2688
- const api_utils = await func.common.get_module(
2439
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2440
+ func,
2441
+ glb,
2442
+ SESSION_OBJ,
2689
2443
  SESSION_ID,
2690
- "xuda-api-library.mjs",
2691
- {
2692
- func,
2693
- glb,
2694
- SESSION_OBJ,
2695
- SESSION_ID,
2696
- APP_OBJ,
2697
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2698
- }
2699
- );
2444
+ APP_OBJ,
2445
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2446
+ });
2700
2447
 
2701
2448
  return await api_utils.invoke_event(event_id);
2702
2449
  };
2703
2450
  func.api.call_project_api = async function (prog_id, params) {
2704
2451
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2705
- const api_utils = await func.common.get_module(
2452
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2453
+ func,
2454
+ glb,
2455
+ SESSION_OBJ,
2706
2456
  SESSION_ID,
2707
- "xuda-api-library.mjs",
2708
- {
2709
- func,
2710
- glb,
2711
- SESSION_OBJ,
2712
- SESSION_ID,
2713
- APP_OBJ,
2714
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2715
- }
2716
- );
2457
+ APP_OBJ,
2458
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2459
+ });
2717
2460
 
2718
2461
  return await api_utils.call_project_api(prog_id, params, null);
2719
2462
  };
2720
2463
  func.api.call_system_api = async function (api_method, payload) {
2721
2464
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2722
- const api_utils = await func.common.get_module(
2465
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2466
+ func,
2467
+ glb,
2468
+ SESSION_OBJ,
2723
2469
  SESSION_ID,
2724
- "xuda-api-library.mjs",
2725
- {
2726
- func,
2727
- glb,
2728
- SESSION_OBJ,
2729
- SESSION_ID,
2730
- APP_OBJ,
2731
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2732
- }
2733
- );
2470
+ APP_OBJ,
2471
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2472
+ });
2734
2473
 
2735
2474
  return await api_utils.call_system_api(api_method, payload, null);
2736
2475
  };
2737
2476
 
2738
2477
  func.api.dbs_create = async function (table_id, data, cb) {
2739
2478
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2740
- const api_utils = await func.common.get_module(
2479
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2480
+ func,
2481
+ glb,
2482
+ SESSION_OBJ,
2741
2483
  SESSION_ID,
2742
- "xuda-api-library.mjs",
2743
- {
2744
- func,
2745
- glb,
2746
- SESSION_OBJ,
2747
- SESSION_ID,
2748
- APP_OBJ,
2749
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2750
- }
2751
- );
2484
+ APP_OBJ,
2485
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2486
+ });
2752
2487
 
2753
2488
  return await api_utils.dbs_create(table_id, row_id, data, cb);
2754
2489
  };
2755
2490
  func.api.dbs_read = async function (table_id, selector, fields, sort, limit, skip, cb) {
2756
2491
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2757
- const api_utils = await func.common.get_module(
2492
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2493
+ func,
2494
+ glb,
2495
+ SESSION_OBJ,
2758
2496
  SESSION_ID,
2759
- "xuda-api-library.mjs",
2760
- {
2761
- func,
2762
- glb,
2763
- SESSION_OBJ,
2764
- SESSION_ID,
2765
- APP_OBJ,
2766
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2767
- }
2768
- );
2497
+ APP_OBJ,
2498
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2499
+ });
2769
2500
 
2770
2501
  return await api_utils.dbs_read(table_id, selector, fields, sort, limit, skip, cb);
2771
2502
  };
2772
2503
  func.api.dbs_update = async function (table_id, row_id, data) {
2773
2504
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2774
- const api_utils = await func.common.get_module(
2505
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2506
+ func,
2507
+ glb,
2508
+ SESSION_OBJ,
2775
2509
  SESSION_ID,
2776
- "xuda-api-library.mjs",
2777
- {
2778
- func,
2779
- glb,
2780
- SESSION_OBJ,
2781
- SESSION_ID,
2782
- APP_OBJ,
2783
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2784
- }
2785
- );
2510
+ APP_OBJ,
2511
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2512
+ });
2786
2513
 
2787
2514
  return await api_utils.dbs_update(table_id, row_id, data, cb);
2788
2515
  };
2789
2516
  func.api.dbs_delete = async function (table_id, row_id, cb) {
2790
2517
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2791
- const api_utils = await func.common.get_module(
2518
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2519
+ func,
2520
+ glb,
2521
+ SESSION_OBJ,
2792
2522
  SESSION_ID,
2793
- "xuda-api-library.mjs",
2794
- {
2795
- func,
2796
- glb,
2797
- SESSION_OBJ,
2798
- SESSION_ID,
2799
- APP_OBJ,
2800
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2801
- }
2802
- );
2523
+ APP_OBJ,
2524
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2525
+ });
2803
2526
 
2804
2527
  return await api_utils.dbs_delete(table_id, row_id, cb);
2805
2528
  };
2806
2529
 
2807
2530
  func.api.call_javascript = async function (prog_id, params, evaluate) {
2808
2531
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2809
- const api_utils = await func.common.get_module(
2532
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2533
+ func,
2534
+ glb,
2535
+ SESSION_OBJ,
2810
2536
  SESSION_ID,
2811
- "xuda-api-library.mjs",
2812
- {
2813
- func,
2814
- glb,
2815
- SESSION_OBJ,
2816
- SESSION_ID,
2817
- APP_OBJ,
2818
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2819
- }
2820
- );
2537
+ APP_OBJ,
2538
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2539
+ });
2821
2540
 
2822
2541
  return await api_utils.call_javascript(prog_id, params, evaluate);
2823
2542
  };
2824
2543
 
2825
2544
  func.api.call_javascript = async function (prog_id, params, evaluate) {
2826
2545
  const SESSION_ID = Object.keys(SESSION_OBJ)[0];
2827
- const api_utils = await func.common.get_module(
2546
+ const api_utils = await func.common.get_module(SESSION_ID, 'xuda-api-library.mjs', {
2547
+ func,
2548
+ glb,
2549
+ SESSION_OBJ,
2828
2550
  SESSION_ID,
2829
- "xuda-api-library.mjs",
2830
- {
2831
- func,
2832
- glb,
2833
- SESSION_OBJ,
2834
- SESSION_ID,
2835
- APP_OBJ,
2836
- dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2837
- }
2838
- );
2551
+ APP_OBJ,
2552
+ dsSession: func.utils.get_last_datasource_no(SESSION_ID),
2553
+ });
2839
2554
 
2840
2555
  return await api_utils.call_javascript(prog_id, params, evaluate);
2841
2556
  };
2842
2557
 
2843
2558
  glb.rpi_request_queue_num = 0;
2844
- func.common.perform_rpi_request = async function (
2845
- SESSION_ID,
2846
- serviceP,
2847
- opt = {},
2848
- data
2849
- ) {
2559
+ func.common.perform_rpi_request = async function (SESSION_ID, serviceP, opt = {}, data) {
2850
2560
  var _session = SESSION_OBJ[SESSION_ID];
2851
2561
  var _data_system = _session?.DS_GLB?.[0]?.data_system;
2852
2562
 
2853
2563
  const set_ajax = async function (stat) {
2854
2564
  var datasource_changes = {
2855
2565
  [0]: {
2856
- ["data_system"]: { SYS_GLOBAL_BOL_AJAX_BUSY: stat },
2566
+ ['data_system']: { SYS_GLOBAL_BOL_AJAX_BUSY: stat },
2857
2567
  },
2858
2568
  };
2859
2569
  await func.datasource.update(SESSION_ID, datasource_changes);
@@ -2862,12 +2572,7 @@ func.common.perform_rpi_request = async function (
2862
2572
  // _data_system.SYS_GLOBAL_BOL_AJAX_BUSY = 1;
2863
2573
  await set_ajax(1);
2864
2574
  if (!_data_system.SYS_GLOBAL_BOL_CONNECTED) {
2865
- func.utils.alerts.toast(
2866
- SESSION_ID,
2867
- "Server connection error",
2868
- "You are not connected to the server, so your request cannot be processed.",
2869
- "error"
2870
- );
2575
+ func.utils.alerts.toast(SESSION_ID, 'Server connection error', 'You are not connected to the server, so your request cannot be processed.', 'error');
2871
2576
  return { code: 88, data: {} };
2872
2577
  }
2873
2578
  }
@@ -2881,8 +2586,8 @@ func.common.perform_rpi_request = async function (
2881
2586
  const timeoutPromise = new Promise((_, reject) =>
2882
2587
  setTimeout(() => {
2883
2588
  controller.abort();
2884
- reject(new Error("Request timed out"));
2885
- }, timeout)
2589
+ reject(new Error('Request timed out'));
2590
+ }, timeout),
2886
2591
  );
2887
2592
 
2888
2593
  const fetchPromise = fetch(url, { ...options, signal });
@@ -2890,27 +2595,24 @@ func.common.perform_rpi_request = async function (
2890
2595
  return Promise.race([fetchPromise, timeoutPromise]);
2891
2596
  };
2892
2597
 
2893
- var url = func.common.get_url(SESSION_ID, "rpi", "");
2598
+ var url = func.common.get_url(SESSION_ID, 'rpi', '');
2894
2599
  var _session = SESSION_OBJ[SESSION_ID];
2895
2600
  const app_id = _session.app_id;
2896
2601
 
2897
- if (
2898
- APP_OBJ[app_id].is_deployment &&
2899
- _session.rpi_http_methods?.includes(serviceP)
2900
- ) {
2901
- url = "https://" + _session.host + "/rpi/";
2602
+ if (APP_OBJ[app_id].is_deployment && _session.rpi_http_methods?.includes(serviceP)) {
2603
+ url = 'https://' + _session.host + '/rpi/';
2902
2604
  }
2903
2605
 
2904
2606
  url += serviceP;
2905
2607
 
2906
2608
  try {
2907
2609
  const response = await fetchWithTimeout(url, {
2908
- method: opt.type ? opt.type : "POST",
2610
+ method: opt.type ? opt.type : 'POST',
2909
2611
  headers: {
2910
- Accept: "application/json",
2911
- "Content-Type": "application/json",
2912
- "xu-gtp-token": _session.gtp_token,
2913
- "xu-app-token": _session.app_token,
2612
+ Accept: 'application/json',
2613
+ 'Content-Type': 'application/json',
2614
+ 'xu-gtp-token': _session.gtp_token,
2615
+ 'xu-app-token': _session.app_token,
2914
2616
  },
2915
2617
  body: JSON.stringify(data),
2916
2618
  });
@@ -2923,10 +2625,7 @@ func.common.perform_rpi_request = async function (
2923
2625
  } catch (err) {
2924
2626
  console.error(err);
2925
2627
  if (err === 503) {
2926
- _this.func.UI.utils.progressScreen.show(
2927
- SESSION_ID,
2928
- `Error code ${err}, reloading in 5 sec`
2929
- );
2628
+ _this.func.UI.utils.progressScreen.show(SESSION_ID, `Error code ${err}, reloading in 5 sec`);
2930
2629
  setTimeout(async () => {
2931
2630
  await func.index.delete_pouch(SESSION_ID);
2932
2631
  location.reload();
@@ -2937,23 +2636,19 @@ func.common.perform_rpi_request = async function (
2937
2636
  };
2938
2637
 
2939
2638
  try {
2940
- if (_session.engine_mode === "live_preview") {
2941
- throw new Error("live_preview");
2639
+ if (_session.engine_mode === 'live_preview') {
2640
+ throw new Error('live_preview');
2942
2641
  }
2943
2642
 
2944
2643
  if (SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)) {
2945
- const ret = await func.common.get_data_from_websocket(
2946
- SESSION_ID,
2947
- serviceP,
2948
- data
2949
- );
2644
+ const ret = await func.common.get_data_from_websocket(SESSION_ID, serviceP, data);
2950
2645
  if (_data_system) {
2951
2646
  // _data_system.SYS_GLOBAL_BOL_AJAX_BUSY = 0;
2952
2647
  await set_ajax(0);
2953
2648
  }
2954
2649
  return ret;
2955
2650
  } else {
2956
- throw new Error("method not found in rpi_http_methods");
2651
+ throw new Error('method not found in rpi_http_methods');
2957
2652
  }
2958
2653
  } catch (err) {
2959
2654
  const ret = await http();
@@ -2965,11 +2660,7 @@ func.common.perform_rpi_request = async function (
2965
2660
  }
2966
2661
  };
2967
2662
 
2968
- func.common.get_data_from_websocket = async function (
2969
- SESSION_ID,
2970
- serviceP,
2971
- data
2972
- ) {
2663
+ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data) {
2973
2664
  var _session = SESSION_OBJ[SESSION_ID];
2974
2665
  return new Promise(function (resolve, reject) {
2975
2666
  const dbs_calls = function () {
@@ -2980,60 +2671,46 @@ func.common.get_data_from_websocket = async function (
2980
2671
  websocket_queue_num: glb.websocket_queue_num,
2981
2672
  };
2982
2673
  if (glb.IS_WORKER) {
2983
- func.utils.post_back_to_client(
2984
- SESSION_ID,
2985
- "get_dbs_data_from_websocket",
2986
- _session.worker_id,
2987
- obj
2988
- );
2674
+ func.utils.post_back_to_client(SESSION_ID, 'get_dbs_data_from_websocket', _session.worker_id, obj);
2989
2675
 
2990
- self.addEventListener(
2991
- "get_ws_data_worker_" + glb.websocket_queue_num,
2992
- (event) => {
2993
- resolve(event.detail.data);
2994
- }
2995
- );
2676
+ self.addEventListener('get_ws_data_worker_' + glb.websocket_queue_num, (event) => {
2677
+ resolve(event.detail.data);
2678
+ });
2996
2679
  // throw new Error("not ready yet");
2997
2680
  } else {
2998
2681
  if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED) {
2999
- RUNTIME_SERVER_WEBSOCKET.emit("message", obj);
3000
- $("body").on(
3001
- "get_ws_data_response_" + glb.websocket_queue_num,
3002
- (e, data) => {
3003
- resolve(data.data);
3004
- $("body").off(
3005
- "get_ws_data_response_" + data.e.websocket_queue_num
3006
- );
3007
- }
3008
- );
2682
+ RUNTIME_SERVER_WEBSOCKET.emit('message', obj);
2683
+ $('body').on('get_ws_data_response_' + glb.websocket_queue_num, (e, data) => {
2684
+ resolve(data.data);
2685
+ $('body').off('get_ws_data_response_' + data.e.websocket_queue_num);
2686
+ });
3009
2687
  } else {
3010
- throw new Error("fail to fetch from ws websocket inactive");
2688
+ throw new Error('fail to fetch from ws websocket inactive');
3011
2689
  }
3012
2690
  }
3013
2691
  };
3014
2692
  const heartbeat = function () {
3015
2693
  const obj = {
3016
- service: "heartbeat",
2694
+ service: 'heartbeat',
3017
2695
  data,
3018
2696
  };
3019
2697
 
3020
2698
  if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED) {
3021
- RUNTIME_SERVER_WEBSOCKET.emit("message", obj);
3022
- $("body").on("heartbeat_response", (e, data) => {
2699
+ RUNTIME_SERVER_WEBSOCKET.emit('message', obj);
2700
+ $('body').on('heartbeat_response', (e, data) => {
3023
2701
  resolve(data.data);
3024
- $("body").off("heartbeat_response");
2702
+ $('body').off('heartbeat_response');
3025
2703
  });
3026
2704
  } else {
3027
- throw new Error("fail to fetch from ws websocket inactive");
2705
+ throw new Error('fail to fetch from ws websocket inactive');
3028
2706
  }
3029
2707
  };
3030
- if (serviceP === "heartbeat") {
2708
+ if (serviceP === 'heartbeat') {
3031
2709
  return heartbeat();
3032
2710
  }
3033
2711
  dbs_calls();
3034
2712
  });
3035
2713
  };
3036
-
3037
2714
  glb.DEBUG_INFO_OBJ = {};
3038
2715
  // var CONNECTION_ATTEMPTS = 0;
3039
2716
  glb.APP_INFO = {};