@xuda.io/runtime-bundle 1.0.885 → 1.0.887

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.
@@ -1724,53 +1724,12 @@ glb.API_OUTPUT_ARR = ['json', 'html', 'xml', 'text', 'css', 'javascript'];
1724
1724
 
1725
1725
  const PROTECTED_NAMES_ARR = ['THIS', 'ROWID']; //tbd
1726
1726
 
1727
- // func.common.get_custom_icon = async function (
1728
- // SESSION_ID,
1729
- // menuIdP,
1730
- // fromTreeP,
1731
- // get_image_onlyP
1732
- // ) {
1733
- // var ret = "";
1734
- // var iconItemId;
1735
- // let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, menuIdP);
1736
- // if (tree_ret) {
1737
- // if (tree_ret.menuType === "icon") {
1738
- // iconItemId = menuIdP;
1739
- // } else {
1740
- // if (tree_ret.rICN) iconItemId = tree_ret.rICN;
1741
- // }
1742
- // if (iconItemId) {
1743
- // let tree_ret2 = await func.utils.TREE_OBJ.get(SESSION_ID, iconItemId);
1744
- // if (tree_ret2) {
1745
- // if (get_image_onlyP) {
1746
- // return tree_ret2.rPTH;
1747
- // } else {
1748
- // const app_obj = APP_OBJ[SESSION_OBJ[SESSION_ID].app_id];
1749
- // const url = func.common.get_url(
1750
- // SESSION_ID,
1751
- // "studio-drive",
1752
- // `${app_obj.app_replicate ? app_obj.app_replicate : app_obj._id}/${
1753
- // tree_ret2.rPTH
1754
- // }`
1755
- // );
1756
- // return url;
1757
- // }
1758
- // // }
1759
- // } else {
1760
- // return ret;
1761
- // }
1762
- // } else {
1763
- // return ret;
1764
- // }
1765
- // } else return ret;
1766
- // };
1767
-
1768
1727
  func.common.db = async function (SESSION_ID, serviceP, dataP, opt = {}, dsSession) {
1769
1728
  return new Promise(async function (resolve, reject) {
1770
1729
  var _session = SESSION_OBJ[SESSION_ID];
1771
1730
  const app_id = _session.app_id;
1772
1731
 
1773
- if (_session.engine_mode === 'live_preview') {
1732
+ if (glb.DEBUG_MODE) {
1774
1733
  console.log('request', dataP);
1775
1734
  }
1776
1735
 
@@ -1805,7 +1764,7 @@ func.common.db = async function (SESSION_ID, serviceP, dataP, opt = {}, dsSessio
1805
1764
  });
1806
1765
  }
1807
1766
 
1808
- if (_session.engine_mode === 'live_preview') {
1767
+ if (glb.DEBUG_MODE) {
1809
1768
  console.log('response', ret);
1810
1769
  }
1811
1770
  resolve(ret, true);
@@ -2387,9 +2346,9 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
2387
2346
  }
2388
2347
  if (_session.worker_type === 'Debug') {
2389
2348
  if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
2390
- 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));
2349
+ ret = await get_ret(func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, `${_conf.xuda_home}root/dist/runtime/js/modules/` + module));
2391
2350
  } else {
2392
- 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)));
2351
+ ret = await get_ret(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/modules/' + module)));
2393
2352
  }
2394
2353
 
2395
2354
  return ret;
@@ -2400,9 +2359,9 @@ func.common.get_module = async function (SESSION_ID, module, paramsP = {}) {
2400
2359
  };
2401
2360
 
2402
2361
  if (typeof IS_DOCKER !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
2403
- 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()));
2362
+ ret = await get_ret(func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, `${_conf.xuda_home}root/dist/runtime/js/modules/` + rep()));
2404
2363
  } else {
2405
- 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())));
2364
+ ret = await get_ret(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/modules/' + rep())));
2406
2365
  }
2407
2366
 
2408
2367
  return ret;
@@ -2983,7 +2942,7 @@ func.datasource.create = async function (
2983
2942
 
2984
2943
  var run_at = _prog_obj?.properties?.runAt;
2985
2944
 
2986
- if (_session.engine_mode !== 'live_preview') {
2945
+ if (!['live_preview', 'cms'].includes(_session.engine_mode)) {
2987
2946
  if (_session.opt.app_computing_mode === 'main') {
2988
2947
  run_at = 'client';
2989
2948
  }
@@ -3159,7 +3118,7 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
3159
3118
 
3160
3119
  if (typeof parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
3161
3120
  _ds.in_parameters[val.data.parameter].value = parameters_obj_inP[val.data.parameter];
3162
- } else if (_session.engine_mode === 'live_preview') {
3121
+ } else if (['live_preview', 'cms'].includes(_session.engine_mode)) {
3163
3122
  _ds.in_parameters[val.data.parameter].value = _session?.url_params?.[val.data.parameter];
3164
3123
  }
3165
3124
 
@@ -3181,7 +3140,7 @@ func.datasource.prepare = async function (SESSION_ID, prog_id, dataSourceNoP, pa
3181
3140
  _ds.data_system['SYS_GLOBAL_STR_SESSION_ID'] = SESSION_ID;
3182
3141
  _ds.data_system['SYS_GLOBAL_STR_LOGIN_USER_ID'] = _session.USR_OBJ._id;
3183
3142
 
3184
- if (_session.engine_mode !== 'live_preview' && PROJECT_OBJ[_session.app_id].info) {
3143
+ if (!['live_preview', 'cms'].includes(_session.engine_mode) && PROJECT_OBJ[_session.app_id].info) {
3185
3144
  _ds.data_system['SYS_GLOBAL_OBJ_APP_INFO'] = {
3186
3145
  build: PROJECT_OBJ[_session.app_id].info.build_id,
3187
3146
  author: PROJECT_OBJ[_session.app_id].info.author,
@@ -6246,7 +6205,7 @@ func.utils.ws_worker.functions = {
6246
6205
  APP_OBJ[data.app_id] = data.APP_OBJ;
6247
6206
  PROJECT_OBJ[data.app_id] = data.PROJECT_OBJ;
6248
6207
 
6249
- if (data.SESSION_INFO.engine_mode === 'live_preview') {
6208
+ if (['live_preview', 'cms'].includes(data.SESSION_INFO.engine_mode)) {
6250
6209
  DOCS_OBJ[data.app_id] = data.DOCS_OBJ;
6251
6210
  } else if (typeof IS_DOCKER === 'undefined' && typeof IS_PROCESS_SERVER === 'undefined') {
6252
6211
  if (!DOCS_OBJ[data.app_id]) {
@@ -9197,11 +9156,11 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9197
9156
  .find('*')
9198
9157
  .filter(function () {
9199
9158
  // // look if the changed field include in the calling in parameters
9200
- let parameter_in_filed_id;
9201
-
9159
+ const elm_data = $(this).data();
9160
+ const parameter_in_filed_id = elm_data?.paramsP?.parameters_raw_obj?.[val.substr(1)] ? val.substr(1) : '';
9202
9161
  let attr = [];
9203
9162
 
9204
- $.each($(this).data()?.xuAttributes, function (key, val) {
9163
+ $.each(elm_data?.xuAttributes, function (key, val) {
9205
9164
  if (key.substr(0, 3) !== 'xu-') return true;
9206
9165
 
9207
9166
  if (key === 'xu-bind') {
@@ -9418,7 +9377,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9418
9377
  if (avoid_xu_for_refresh) return;
9419
9378
  await func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'execute_xu_for', obj, new_job, _elem_val.$elm, _elem_val.$elm.data().xuData.paramsP.dsSessionP);
9420
9379
 
9421
- if (_session.engine_mode === 'live_preview') {
9380
+ if (glb.DEBUG_MODE) {
9422
9381
  console.info('node execute_xu_for', obj, panel_val);
9423
9382
  }
9424
9383
 
@@ -10259,7 +10218,16 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10259
10218
  console.warn(e);
10260
10219
  }
10261
10220
 
10262
- return {};
10221
+ return { abort: true };
10222
+ },
10223
+ 'xu-text': async function ($elm, val) {
10224
+ try {
10225
+ $elm.text(val.value);
10226
+ } catch (error) {
10227
+ console.warn(e);
10228
+ }
10229
+
10230
+ return { abort: true };
10263
10231
  },
10264
10232
  'xu-for': async function ($elm, data) {
10265
10233
  // exit if call from rendered xu-for item to prevent infante loop (parent_infoP?.iterate_info indicate call from rendered item)
@@ -12248,6 +12216,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12248
12216
  if (nodeP.content && nodeP.attributes) {
12249
12217
  nodeP.attributes['xu-content'] = nodeP.content;
12250
12218
  }
12219
+
12251
12220
  if (nodeP.tagName === 'xu-widget') {
12252
12221
  if (is_skeleton) return;
12253
12222
  return await fx['widget']();
@@ -15713,8 +15682,7 @@ function xuda(...args) {
15713
15682
  FIREBASE_TOKEN_ID: null,
15714
15683
 
15715
15684
  USR_OBJ: {},
15716
- // run_prog: null,
15717
- // engine_mode: null,
15685
+
15718
15686
  debug_js: null,
15719
15687
  DS_UI_EVENTS_GLB: {},
15720
15688
  host: location.host,
@@ -15741,7 +15709,7 @@ function xuda(...args) {
15741
15709
  val = window.location.host;
15742
15710
  break;
15743
15711
  case 'engine_mode':
15744
- val = 'run';
15712
+ val = 'cms'; //was 'run'
15745
15713
  break;
15746
15714
  case 'app_id':
15747
15715
  val = 'unknown';
@@ -15905,7 +15873,7 @@ function xuda(...args) {
15905
15873
  _client_info.time_zone = client.getTimeZone();
15906
15874
  _client_info.cpu_architecture = browser_data.cpu.architecture;
15907
15875
 
15908
- if ((engine_mode === 'app' || engine_mode === 'live_preview') && func.utils.get_device()) {
15876
+ if (['android', 'ios', 'windows', 'macos', 'linux', 'live_preview'].includes(engine_mode) && func.utils.get_device()) {
15909
15877
  _client_info.uuid = window.device.uuid;
15910
15878
  if (window.device) {
15911
15879
  _client_info.device_name = window.device.name;
@@ -16524,7 +16492,7 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
16524
16492
  ver = APP_OBJ[_session.app_id].app_version;
16525
16493
  }
16526
16494
 
16527
- var build_id = _session.engine_mode === 'live_preview' ? '' : _session.opt.app_build_id;
16495
+ var build_id = ['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session.opt.app_build_id;
16528
16496
  if (typeof XUDA_BUILD_ID !== 'undefined') {
16529
16497
  build_id = XUDA_BUILD_ID;
16530
16498
  }
@@ -16630,8 +16598,8 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
16630
16598
  const content = `importScripts( "${url}" );`;
16631
16599
  return URL.createObjectURL(new Blob([content], { type: 'text/javascript' }));
16632
16600
  }
16633
-
16634
- let blob = getWorkerURL(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/xuda_worker.js')));
16601
+ const _session = SESSION[SESSION_ID];
16602
+ let blob = getWorkerURL(func.common.get_url(SESSION_ID, 'dist', func.utils.get_resource_filename(['live_preview', 'cms'].includes(_session.engine_mode) ? '' : _session?.opt?.app_build_id, 'runtime/js/xuda_worker.js')));
16635
16603
  WEB_WORKER[SESSION_ID][worker_id] = {
16636
16604
  worker: new Worker(blob, {
16637
16605
  name: worker_name,