@xuda.io/runtime-bundle 1.0.791 → 1.0.792

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.
@@ -25737,7 +25737,9 @@ func.utils.get_drive_url = function (SESSION_ID, val, wrap) {
25737
25737
 
25738
25738
  if (!_app.is_deployment) {
25739
25739
  // the deployment server will handle the app_token
25740
- FILE_REPLACE_URL += `?app_token=${_session.app_token}`;
25740
+ FILE_REPLACE_URL += `?app_token=${_session.app_token}&ts=${Date.now()}`;
25741
+ } else {
25742
+ FILE_REPLACE_URL += `?ts=${_session?.opt?.app_build_id || 0}`;
25741
25743
  }
25742
25744
 
25743
25745
  let match = `drv_${_app.app_replicate || _session.app_id}_[0-9a-f\\-]+\\.[a-zA-Z0-9]+`;
@@ -38100,59 +38102,53 @@ function xuda(...args) {
38100
38102
  if (arg instanceof HTMLElement) {
38101
38103
  // Detect the element (e.g., <div>, <span>, etc.)
38102
38104
  element = arg;
38103
- } else if (typeof arg === "object" && arg !== null && !Array.isArray(arg)) {
38105
+ } else if (typeof arg === 'object' && arg !== null && !Array.isArray(arg)) {
38104
38106
  // Detect options (non-null object that's not an array)
38105
38107
  opt = arg;
38106
- } else if (typeof arg === "function") {
38108
+ } else if (typeof arg === 'function') {
38107
38109
  // Detect the callback function
38108
38110
  callback = arg;
38109
38111
  }
38110
38112
  }
38111
38113
 
38112
38114
  if (!element) {
38113
- if (typeof glb.SLIM_BUNDLE === "undefined" || !glb.SLIM_BUNDLE) {
38114
- return console.error("Xuda Error - element argument is empty");
38115
+ if (typeof glb.SLIM_BUNDLE === 'undefined' || !glb.SLIM_BUNDLE) {
38116
+ return console.error('Xuda Error - element argument is empty');
38115
38117
  }
38116
- element = "body";
38117
- console.warn("root element set to body");
38118
+ element = 'body';
38119
+ console.warn('root element set to body');
38118
38120
  }
38119
38121
  if (!$(element).length) {
38120
- return console.error("Xuda Error - element not found");
38122
+ return console.error('Xuda Error - element not found');
38121
38123
  }
38122
- if (typeof opt === "undefined") {
38123
- return console.error("Xuda Error - opt argument is undefined");
38124
+ if (typeof opt === 'undefined') {
38125
+ return console.error('Xuda Error - opt argument is undefined');
38124
38126
  }
38125
38127
 
38126
- if (typeof opt !== "object") {
38127
- return console.error("Xuda Error - opt argument is not an object");
38128
+ if (typeof opt !== 'object') {
38129
+ return console.error('Xuda Error - opt argument is not an object');
38128
38130
  }
38129
38131
  glb.URL_PARAMS = func.common.getJsonFromUrl(window.location.href);
38130
38132
 
38131
- glb.worker_type = "Worker";
38133
+ glb.worker_type = 'Worker';
38132
38134
  if (opt.debug_js) {
38133
38135
  glb.debug_js = true;
38134
38136
 
38135
- if (
38136
- (location.host.includes("localhost") ||
38137
- location.host.includes("127.0.0.1")) &&
38138
- typeof glb.SLIM_BUNDLE === "undefined" &&
38139
- typeof glb.CODE_BUNDLE === "undefined"
38140
- ) {
38141
- glb.worker_type = "Dev";
38137
+ if ((location.host.includes('localhost') || location.host.includes('127.0.0.1')) && typeof glb.SLIM_BUNDLE === 'undefined' && typeof glb.CODE_BUNDLE === 'undefined') {
38138
+ glb.worker_type = 'Dev';
38142
38139
  } else {
38143
- glb.worker_type = "Debug";
38140
+ glb.worker_type = 'Debug';
38144
38141
  }
38145
38142
  }
38146
38143
 
38147
38144
  const call_xuda = async function () {
38148
- const _instance_id =
38149
- Date.now().toString() + Math.round(Math.random() * 10000).toString();
38145
+ const _instance_id = Date.now().toString() + Math.round(Math.random() * 10000).toString();
38150
38146
 
38151
38147
  const _api_callback = callback;
38152
38148
 
38153
38149
  const create_index_html = function () {
38154
38150
  const { root_element, domain } = _session;
38155
- $(root_element).css("position", "relative");
38151
+ $(root_element).css('position', 'relative');
38156
38152
 
38157
38153
  $(root_element).append(`
38158
38154
 
@@ -38221,23 +38217,21 @@ function xuda(...args) {
38221
38217
  <div id="tailwind_toast_controller" class="w-full flex flex-col items-center space-y-4 sm:items-end">
38222
38218
 
38223
38219
  </div>
38224
- </div>`
38220
+ </div>`,
38225
38221
  );
38226
38222
 
38227
38223
  $(root_element).append(
38228
38224
  `
38229
38225
  <div id="progressScreen2" style="display: none">
38230
38226
  <div id="progressScreen2_text"></div>
38231
- </div>`
38227
+ </div>`,
38232
38228
  );
38233
38229
 
38234
38230
  const get_url = function (domain, method, path) {
38235
- return `https://${domain}/${method}${path ? "/" + path : "/"}`;
38231
+ return `https://${domain}/${method}${path ? '/' + path : '/'}`;
38236
38232
  };
38237
38233
 
38238
- func.utils.load_css_on_demand(
38239
- get_url(domain, "dist", "runtime/css/mobile.css")
38240
- );
38234
+ func.utils.load_css_on_demand(get_url(domain, 'dist', 'runtime/css/mobile.css'));
38241
38235
  };
38242
38236
  const device_ready = async function () {
38243
38237
  return new Promise(function (resolve, reject) {
@@ -38246,12 +38240,12 @@ function xuda(...args) {
38246
38240
  }
38247
38241
 
38248
38242
  document.addEventListener(
38249
- "deviceready",
38243
+ 'deviceready',
38250
38244
  function () {
38251
38245
  glb.is_cordova = true;
38252
38246
  resolve();
38253
38247
  },
38254
- false
38248
+ false,
38255
38249
  );
38256
38250
  });
38257
38251
  };
@@ -38264,16 +38258,16 @@ function xuda(...args) {
38264
38258
  };
38265
38259
  const get_session_id = function () {
38266
38260
  function defineTabID() {
38267
- var iPageTabID = sessionStorage.getItem("tabID");
38261
+ var iPageTabID = sessionStorage.getItem('tabID');
38268
38262
  // if it is the first time that this page is loaded
38269
38263
  if (iPageTabID == null) {
38270
- var iLocalTabID = localStorage.getItem("tabID");
38264
+ var iLocalTabID = localStorage.getItem('tabID');
38271
38265
  // if tabID is not yet defined in localStorage it is initialized to 1
38272
38266
  // else tabId counter is increment by 1
38273
38267
  var iPageTabID = iLocalTabID == null ? 1 : Number(iLocalTabID) + 1;
38274
38268
  // new computed value are saved in localStorage and in sessionStorage
38275
- localStorage.setItem("tabID", iPageTabID);
38276
- sessionStorage.setItem("tabID", iPageTabID);
38269
+ localStorage.setItem('tabID', iPageTabID);
38270
+ sessionStorage.setItem('tabID', iPageTabID);
38277
38271
  }
38278
38272
 
38279
38273
  return iPageTabID;
@@ -38287,7 +38281,7 @@ function xuda(...args) {
38287
38281
  return pair.value;
38288
38282
  })
38289
38283
  .join(),
38290
- 31
38284
+ 31,
38291
38285
  );
38292
38286
 
38293
38287
  return _instance_id + fingerprint_id + defineTabID();
@@ -38302,7 +38296,7 @@ function xuda(...args) {
38302
38296
  return pair.value;
38303
38297
  })
38304
38298
  .join(),
38305
- 31
38299
+ 31,
38306
38300
  );
38307
38301
  };
38308
38302
  const init_SESSION = function () {
@@ -38323,40 +38317,40 @@ function xuda(...args) {
38323
38317
  DS_GLB: {},
38324
38318
 
38325
38319
  SYS_GLOBAL_OBJ_FIREBASE_AUTH_INFO: {
38326
- token: "",
38327
- first_name: "",
38328
- last_name: "",
38329
- email: "",
38330
- user_id: "",
38331
- picture: "",
38332
- verified_email: "",
38333
- locale: "",
38334
- error_code: "",
38335
- error_msg: "",
38320
+ token: '',
38321
+ first_name: '',
38322
+ last_name: '',
38323
+ email: '',
38324
+ user_id: '',
38325
+ picture: '',
38326
+ verified_email: '',
38327
+ locale: '',
38328
+ error_code: '',
38329
+ error_msg: '',
38336
38330
  },
38337
38331
  SYS_GLOBAL_OBJ_CLIENT_INFO: {
38338
- fingerprint: "",
38339
- device: "",
38340
-
38341
- user_agent: "",
38342
- browser_version: "",
38343
- browser_name: "",
38344
- engine_version: "",
38345
- client_ip: "",
38346
- engine_name: "",
38347
- os_name: "",
38348
- os_version: "",
38349
- device_model: "",
38350
- device_vendor: "",
38351
- device_type: "",
38352
- screen_current_resolution_x: "",
38353
- screen_current_resolution_y: "",
38354
- screen_available_resolution_x: "",
38355
- screen_available_resolution_y: "",
38356
- language: "",
38357
- time_zone: "",
38358
- cpu_architecture: "",
38359
- uuid: "",
38332
+ fingerprint: '',
38333
+ device: '',
38334
+
38335
+ user_agent: '',
38336
+ browser_version: '',
38337
+ browser_name: '',
38338
+ engine_version: '',
38339
+ client_ip: '',
38340
+ engine_name: '',
38341
+ os_name: '',
38342
+ os_version: '',
38343
+ device_model: '',
38344
+ device_vendor: '',
38345
+ device_type: '',
38346
+ screen_current_resolution_x: '',
38347
+ screen_current_resolution_y: '',
38348
+ screen_available_resolution_x: '',
38349
+ screen_available_resolution_y: '',
38350
+ language: '',
38351
+ time_zone: '',
38352
+ cpu_architecture: '',
38353
+ uuid: '',
38360
38354
  },
38361
38355
  PUSH_NOTIFICATION_GRANTED: null,
38362
38356
  FIREBASE_TOKEN_ID: null,
@@ -38379,33 +38373,21 @@ function xuda(...args) {
38379
38373
  return SESSION_OBJ[SESSION_ID];
38380
38374
  };
38381
38375
  const set_SESSION = async function () {
38382
- for await (const key of [
38383
- "gtp_token",
38384
- "app_token",
38385
- "prog_id",
38386
- "domain",
38387
- "engine_mode",
38388
- "crawler",
38389
- "app_id",
38390
- "route_id",
38391
- "menu_id",
38392
- "local_live_preview",
38393
- "project_data",
38394
- ]) {
38376
+ for await (const key of ['gtp_token', 'app_token', 'prog_id', 'domain', 'engine_mode', 'crawler', 'app_id', 'route_id', 'menu_id', 'local_live_preview', 'project_data']) {
38395
38377
  _session[key] = func.UI.utils.get_url_attribute(SESSION_ID, key);
38396
38378
 
38397
38379
  // set defaults
38398
38380
  if (!_session[key]) {
38399
38381
  var val = _session[key];
38400
38382
  switch (key) {
38401
- case "domain":
38383
+ case 'domain':
38402
38384
  val = window.location.host;
38403
38385
  break;
38404
- case "engine_mode":
38405
- val = "run";
38386
+ case 'engine_mode':
38387
+ val = 'run';
38406
38388
  break;
38407
- case "app_id":
38408
- val = "unknown";
38389
+ case 'app_id':
38390
+ val = 'unknown';
38409
38391
  break;
38410
38392
 
38411
38393
  default:
@@ -38417,33 +38399,28 @@ function xuda(...args) {
38417
38399
  // set exceptions
38418
38400
 
38419
38401
  switch (key) {
38420
- case "domain":
38421
- if (
38422
- _session[key].includes("localhost") ||
38423
- _session[key].includes("127.0.0.1")
38424
- ) {
38402
+ case 'domain':
38403
+ if (_session[key].includes('localhost') || _session[key].includes('127.0.0.1')) {
38425
38404
  const getSubdomain = (url) => {
38426
38405
  let domain = url;
38427
- if (url.includes("://")) {
38428
- domain = url.split("://")[1];
38406
+ if (url.includes('://')) {
38407
+ domain = url.split('://')[1];
38429
38408
  }
38430
- let subdomain = "";
38409
+ let subdomain = '';
38431
38410
 
38432
- if (!_session[key].includes("127.0.0.1")) {
38433
- subdomain = domain.split(".")[0];
38411
+ if (!_session[key].includes('127.0.0.1')) {
38412
+ subdomain = domain.split('.')[0];
38434
38413
  }
38435
38414
 
38436
38415
  return subdomain;
38437
38416
  };
38438
- _session[key] = getSubdomain(_session[key])
38439
- ? getSubdomain(_session[key]) + ".xuda.io"
38440
- : "xuda.io";
38417
+ _session[key] = getSubdomain(_session[key]) ? getSubdomain(_session[key]) + '.xuda.io' : 'xuda.io';
38441
38418
  }
38442
38419
 
38443
38420
  break;
38444
38421
 
38445
- case "project_data": {
38446
- if (typeof glb.SLIM_BUNDLE !== "undefined" || glb.SLIM_BUNDLE) {
38422
+ case 'project_data': {
38423
+ if (typeof glb.SLIM_BUNDLE !== 'undefined' || glb.SLIM_BUNDLE) {
38447
38424
  const { root_element } = _session;
38448
38425
 
38449
38426
  if (!_session[key]) {
@@ -38456,28 +38433,25 @@ function xuda(...args) {
38456
38433
 
38457
38434
  if (!_session[key].globals) {
38458
38435
  _session[key].globals = {
38459
- _id: "globals",
38436
+ _id: 'globals',
38460
38437
  progDataSource: {},
38461
- properties: { menuType: "globals" },
38438
+ properties: { menuType: 'globals' },
38462
38439
  studio_meta: {},
38463
38440
  progEvents: [],
38464
38441
  progFields: [],
38465
38442
  };
38466
38443
  }
38467
38444
 
38468
- if ($("template").length) {
38469
- const module = await func.common.get_module(
38470
- SESSION_ID,
38471
- "xuda-cli-plugin-html-parser-module.esm.js"
38472
- );
38445
+ if ($('template').length) {
38446
+ const module = await func.common.get_module(SESSION_ID, 'xuda-cli-plugin-html-parser-module.esm.js');
38473
38447
 
38474
- $.each($("template"), function (idx, el) {
38475
- const _id = $(el).attr("id") || "template_" + idx.toString();
38448
+ $.each($('template'), function (idx, el) {
38449
+ const _id = $(el).attr('id') || 'template_' + idx.toString();
38476
38450
  if (!_session[key].programs[_id]) {
38477
38451
  _session[key].programs[_id] = {
38478
38452
  _id,
38479
38453
  progDataSource: {},
38480
- properties: { menuType: "component", renderType: "form" },
38454
+ properties: { menuType: 'component', renderType: 'form' },
38481
38455
  studio_meta: {},
38482
38456
  progEvents: [],
38483
38457
  progFields: [],
@@ -38488,13 +38462,11 @@ function xuda(...args) {
38488
38462
  window.xudaStringify = module.xudaStringify;
38489
38463
  const progUi = module.xudaPrase($(el).html());
38490
38464
 
38491
- _session[key].programs[_id].progUi =
38492
- progUi?.[0]?.children || [];
38465
+ _session[key].programs[_id].progUi = progUi?.[0]?.children || [];
38493
38466
  }
38494
38467
  });
38495
38468
  if (!_session.prog_id) {
38496
- _session.prog_id =
38497
- $($("template")?.[0])?.attr("id") || "template_0";
38469
+ _session.prog_id = $($('template')?.[0])?.attr('id') || 'template_0';
38498
38470
  }
38499
38471
  $(root_element).empty();
38500
38472
  // if (!_session[key].programs._default) {
@@ -38542,7 +38514,7 @@ function xuda(...args) {
38542
38514
 
38543
38515
  _client_info.fingerprint = get_fingerprint();
38544
38516
 
38545
- if (engine_mode === "live_preview") {
38517
+ if (engine_mode === 'live_preview') {
38546
38518
  _client_info.screen_current_resolution_x = window.innerWidth;
38547
38519
  _client_info.screen_current_resolution_y = window.innerHeight;
38548
38520
  _client_info.screen_available_resolution_x = window.innerWidth;
@@ -38576,10 +38548,7 @@ function xuda(...args) {
38576
38548
  _client_info.time_zone = client.getTimeZone();
38577
38549
  _client_info.cpu_architecture = browser_data.cpu.architecture;
38578
38550
 
38579
- if (
38580
- (engine_mode === "app" || engine_mode === "live_preview") &&
38581
- func.utils.get_device()
38582
- ) {
38551
+ if ((engine_mode === 'app' || engine_mode === 'live_preview') && func.utils.get_device()) {
38583
38552
  _client_info.uuid = window.device.uuid;
38584
38553
  if (window.device) {
38585
38554
  _client_info.device_name = window.device.name;
@@ -38588,7 +38557,7 @@ function xuda(...args) {
38588
38557
  };
38589
38558
  const init_globals = function () {
38590
38559
  const { app_id, worker_type } = _session;
38591
- if (worker_type !== "Worker") {
38560
+ if (worker_type !== 'Worker') {
38592
38561
  glb.DEBUG_MODE = true;
38593
38562
  }
38594
38563
  SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal = -1;
@@ -38597,8 +38566,7 @@ function xuda(...args) {
38597
38566
  DOCS_OBJ[app_id] = {};
38598
38567
  glb.APP_INFO[app_id] = {};
38599
38568
 
38600
- glb.ROOT_ELEMENT_ATTRIBUTES =
38601
- func.UI.utils.get_root_element_attributes(SESSION_ID);
38569
+ glb.ROOT_ELEMENT_ATTRIBUTES = func.UI.utils.get_root_element_attributes(SESSION_ID);
38602
38570
  DATASOURCE_INTERVALS[SESSION_ID] = {};
38603
38571
  // if (glb.DEBUG_MODE) glb.WORKER_TIMEOUT = 10000;
38604
38572
  };
@@ -38663,24 +38631,16 @@ function xuda(...args) {
38663
38631
  // // }
38664
38632
  // };
38665
38633
  const print_version_info = function () {
38666
- const version_name = `Xuda.io ${opt.engine_mode} ${
38667
- opt?.app_version || ""
38668
- } Session Id: ${SESSION_ID}`;
38669
- const divider = _.repeat("#", version_name.length);
38634
+ const version_name = `Xuda.io ${opt.engine_mode} ${opt?.app_version || ''} Session Id: ${SESSION_ID}`;
38635
+ const divider = _.repeat('#', version_name.length);
38670
38636
  console.info(divider);
38671
38637
  console.info(version_name);
38672
38638
  console.info(divider);
38673
38639
  };
38674
38640
  const print_xuda_banner = function () {
38675
- var banner = "";
38676
- [
38677
- "__ ___ _ ____ _ ",
38678
- "\\ \\/ / | | | _ \\ / \\ ",
38679
- " \\ /| | | | | | |/ _ \\ ",
38680
- " / \\| |_| | |_| / ___ \\ ",
38681
- "/_/\\_\\\\___/|____/_/ \\_\\",
38682
- ].forEach((e) => {
38683
- banner += e + "\r\n";
38641
+ var banner = '';
38642
+ ['__ ___ _ ____ _ ', '\\ \\/ / | | | _ \\ / \\ ', ' \\ /| | | | | | |/ _ \\ ', ' / \\| |_| | |_| / ___ \\ ', '/_/\\_\\\\___/|____/_/ \\_\\'].forEach((e) => {
38643
+ banner += e + '\r\n';
38684
38644
  });
38685
38645
 
38686
38646
  console.info(banner);
@@ -38690,7 +38650,7 @@ function xuda(...args) {
38690
38650
 
38691
38651
  var SESSION_ID = Date.now();
38692
38652
  var components;
38693
- if (typeof glb.SLIM_BUNDLE === "undefined" || !glb.SLIM_BUNDLE) {
38653
+ if (typeof glb.SLIM_BUNDLE === 'undefined' || !glb.SLIM_BUNDLE) {
38694
38654
  await device_ready();
38695
38655
  components = await get_fingerprint_component();
38696
38656
  SESSION_ID = get_session_id();
@@ -38706,7 +38666,7 @@ function xuda(...args) {
38706
38666
  init_globals();
38707
38667
  // await set_ViewUITreeObj_data();
38708
38668
 
38709
- if (typeof glb.SLIM_BUNDLE !== "undefined" && glb.SLIM_BUNDLE) {
38669
+ if (typeof glb.SLIM_BUNDLE !== 'undefined' && glb.SLIM_BUNDLE) {
38710
38670
  await func.UI.main.embed_loader(SESSION_ID);
38711
38671
  return;
38712
38672
  }
@@ -38714,41 +38674,30 @@ function xuda(...args) {
38714
38674
  set_SYS_GLOBAL_OBJ_CLIENT_INFO(SESSION_ID);
38715
38675
 
38716
38676
  if (!_session.app_id) {
38717
- func.UI.utils.progressScreen.show(
38718
- SESSION_ID,
38719
- "Error reading app_id",
38720
- false,
38721
- true
38722
- );
38723
- console.error("no app_id found");
38677
+ func.UI.utils.progressScreen.show(SESSION_ID, 'Error reading app_id', false, true);
38678
+ console.error('no app_id found');
38724
38679
  return;
38725
38680
  }
38726
38681
 
38727
- const module = await func.common.get_module(
38728
- SESSION_ID,
38729
- "xuda-project-loader-module.esm.js"
38730
- );
38682
+ const module = await func.common.get_module(SESSION_ID, 'xuda-project-loader-module.esm.js');
38731
38683
 
38732
- const db_adapter = await func.common.get_module(
38733
- SESSION_ID,
38734
- "xuda-db-adapter-module.mjs"
38735
- );
38684
+ const db_adapter = await func.common.get_module(SESSION_ID, 'xuda-db-adapter-module.mjs');
38736
38685
 
38737
38686
  func.db = db_adapter._db;
38738
38687
 
38739
38688
  await module.project_loader(SESSION_ID, _session.app_id);
38740
38689
  func.db.pouch.init_db_replication(SESSION_ID);
38741
38690
  };
38742
- glb.system_ready_event = new Event("on_mounted");
38691
+ glb.system_ready_event = new Event('on_mounted');
38743
38692
  call_xuda();
38744
38693
  return {
38745
38694
  on_mounted: function (fn) {
38746
- $("body")[0].addEventListener(
38747
- "on_mounted",
38695
+ $('body')[0].addEventListener(
38696
+ 'on_mounted',
38748
38697
  (e) => {
38749
38698
  fn();
38750
38699
  },
38751
- false
38700
+ false,
38752
38701
  );
38753
38702
  },
38754
38703
  };
@@ -38763,7 +38712,7 @@ function xuda(...args) {
38763
38712
  func.index.call_worker = async function (SESSION_ID, obj, params, promiseP) {
38764
38713
  var _session = SESSION_OBJ[SESSION_ID];
38765
38714
 
38766
- if (_session.opt.app_computing_mode === "main") {
38715
+ if (_session.opt.app_computing_mode === 'main') {
38767
38716
  return;
38768
38717
  }
38769
38718
 
@@ -38789,9 +38738,7 @@ func.index.call_worker = async function (SESSION_ID, obj, params, promiseP) {
38789
38738
 
38790
38739
  if (!_session.DS_GLB[ds]) {
38791
38740
  if (ds == 0) {
38792
- console.error(
38793
- "Error - onscreen (window,modal etc..) event cannot be invoked by on_load"
38794
- );
38741
+ console.error('Error - onscreen (window,modal etc..) event cannot be invoked by on_load');
38795
38742
  return;
38796
38743
  } else {
38797
38744
  // console.error("Error - worker not found");
@@ -38806,27 +38753,24 @@ func.index.call_worker = async function (SESSION_ID, obj, params, promiseP) {
38806
38753
  if (_session.DS_GLB[ds].worker_id) {
38807
38754
  return _session.DS_GLB[ds].worker_id;
38808
38755
  } else {
38809
- if (typeof _session.DS_GLB[ds].parentDataSourceNo !== "undefined") {
38756
+ if (typeof _session.DS_GLB[ds].parentDataSourceNo !== 'undefined') {
38810
38757
  return get_worker_id(_session.DS_GLB[ds].parentDataSourceNo);
38811
38758
  }
38812
38759
  }
38813
38760
  };
38814
38761
 
38815
- if (obj.service === "datasource_create") {
38762
+ if (obj.service === 'datasource_create') {
38816
38763
  if (!params || (params && !params.done)) {
38817
- var prog_obj = await func.utils.TREE_OBJ.get(
38818
- SESSION_ID,
38819
- obj.data.prog_id
38820
- );
38764
+ var prog_obj = await func.utils.TREE_OBJ.get(SESSION_ID, obj.data.prog_id);
38821
38765
  if (!prog_obj || !prog_obj.dedicatedWorker) {
38822
38766
  // MAIN WORKER
38823
38767
  if (!Object.keys(WEB_WORKER[SESSION_ID]).length) {
38824
38768
  worker_id = await func.index.new_webworker(
38825
38769
  SESSION_ID,
38826
38770
  {
38827
- menuName: "Main",
38771
+ menuName: 'Main',
38828
38772
  },
38829
- obj
38773
+ obj,
38830
38774
  );
38831
38775
  // return; //_resolve();
38832
38776
  } else {
@@ -38864,7 +38808,7 @@ func.index.call_worker = async function (SESSION_ID, obj, params, promiseP) {
38864
38808
  var msg = obj;
38865
38809
  msg.worker_id = worker_id;
38866
38810
  if (!worker_id) {
38867
- console.warn("missing worker_id");
38811
+ console.warn('missing worker_id');
38868
38812
  }
38869
38813
  msg.promise_queue_id = set_promise_queue(worker_id);
38870
38814
 
@@ -38873,18 +38817,13 @@ func.index.call_worker = async function (SESSION_ID, obj, params, promiseP) {
38873
38817
  return resolve();
38874
38818
  }
38875
38819
 
38876
- if (
38877
- RUNTIME_SERVER_WEBSOCKET &&
38878
- RUNTIME_SERVER_WEBSOCKET_CONNECTED &&
38879
- (!_session.opt.app_computing_mode ||
38880
- _session.opt.app_computing_mode === "server")
38881
- ) {
38820
+ if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED && (!_session.opt.app_computing_mode || _session.opt.app_computing_mode === 'server')) {
38882
38821
  msg.process_pid = WEBSOCKET_PROCESS_PID;
38883
- msg = JSON.stringify(obj, func.utils.clean_stringify_null, "\t");
38822
+ msg = JSON.stringify(obj, func.utils.clean_stringify_null, '\t');
38884
38823
  let msg_obj = JSON.parse(msg);
38885
- WEB_WORKER[SESSION_ID][worker_id].worker.emit("message", msg_obj);
38824
+ WEB_WORKER[SESSION_ID][worker_id].worker.emit('message', msg_obj);
38886
38825
  } else {
38887
- msg = JSON.stringify(obj, func.utils.clean_stringify_null, "\t");
38826
+ msg = JSON.stringify(obj, func.utils.clean_stringify_null, '\t');
38888
38827
  let msg_obj = JSON.parse(msg);
38889
38828
  msg_obj.data = JSON.stringify(msg_obj.data);
38890
38829
  WEB_WORKER[SESSION_ID][worker_id].worker.postMessage(msg_obj);
@@ -38898,10 +38837,7 @@ func.index.call_worker = async function (SESSION_ID, obj, params, promiseP) {
38898
38837
 
38899
38838
  func.index.init_SCREEN_BLOCKER = async function (SESSION_ID) {
38900
38839
  setInterval(async function () {
38901
- if (
38902
- glb.CURRENT_APP_LOADING ||
38903
- (!LOADER_ACTIVE && _.isEmpty(SCREEN_BLOCKER_OBJ))
38904
- ) {
38840
+ if (glb.CURRENT_APP_LOADING || (!LOADER_ACTIVE && _.isEmpty(SCREEN_BLOCKER_OBJ))) {
38905
38841
  return;
38906
38842
  }
38907
38843
  glb.CURRENT_APP_LOADING = 1;
@@ -38923,12 +38859,12 @@ func.index.init_SCREEN_BLOCKER = async function (SESSION_ID) {
38923
38859
  };
38924
38860
 
38925
38861
  func.index.init_document_listeners = function () {
38926
- $(document).on("keydown", function (event) {
38862
+ $(document).on('keydown', function (event) {
38927
38863
  CLIENT_ACTIVITY_TS = Date.now();
38928
38864
  var keys = {
38929
38865
  72: {
38930
- key: "h",
38931
- name: "Help",
38866
+ key: 'h',
38867
+ name: 'Help',
38932
38868
  fx: function () {
38933
38869
  let SESSION_ID = Object.keys(SESSION_OBJ)[0];
38934
38870
  let _session = SESSION_OBJ[SESSION_ID];
@@ -38974,7 +38910,7 @@ func.index.init_document_listeners = function () {
38974
38910
  <path d="M18.35 5.65l-3.35 3.35"></path>
38975
38911
  </svg>
38976
38912
  <h3 style="text-align: center;display: flex;align-items: center;gap: 10px;">Get support ${
38977
- SUPPORT_PEER ? "(in session, click to cancel)" : ""
38913
+ SUPPORT_PEER ? '(in session, click to cancel)' : ''
38978
38914
  }<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path></svg></h3>
38979
38915
 
38980
38916
 
@@ -38982,46 +38918,39 @@ func.index.init_document_listeners = function () {
38982
38918
 
38983
38919
  </div>
38984
38920
 
38985
- `
38921
+ `,
38986
38922
  );
38987
38923
 
38988
38924
  setTimeout(() => {
38989
38925
  $(`[name="hard_reload"]`)
38990
- .off("click")
38991
- .on("click", async function () {
38926
+ .off('click')
38927
+ .on('click', async function () {
38992
38928
  await func.index.delete_pouch(SESSION_ID);
38993
38929
  location.reload();
38994
38930
  });
38995
38931
  $(`[name="reset_worker"]`)
38996
- .off("click")
38997
- .on("click", function () {
38932
+ .off('click')
38933
+ .on('click', function () {
38998
38934
  // let session_id = Object.keys(SESSION_OBJ)[0];
38999
38935
  _session.WORKER_OBJ.jobs[0].stat = null;
39000
38936
  _session.WORKER_OBJ.stat = null;
39001
38937
  func.UI.utils.progressScreen.hide(SESSION_ID);
39002
38938
  });
39003
38939
  $(`[name="get_support"]`)
39004
- .off("click")
39005
- .on("click", async function () {
39006
- const get_support = await func.common.get_module(
39007
- SESSION_ID,
39008
- "xuda-get-support-module.esm.js"
39009
- );
38940
+ .off('click')
38941
+ .on('click', async function () {
38942
+ const get_support = await func.common.get_module(SESSION_ID, 'xuda-get-support-module.esm.js');
39010
38943
 
39011
38944
  var name, subject;
39012
38945
  const prompt_name = () => {
39013
- name = window.prompt(
39014
- `Get support from your ${APP_OBJ[app_id].app_general_prop?.app_name} team, \n\nYour Name (required):`
39015
- );
38946
+ name = window.prompt(`Get support from your ${APP_OBJ[app_id].app_general_prop?.app_name} team, \n\nYour Name (required):`);
39016
38947
 
39017
- if (name === "") prompt_name();
38948
+ if (name === '') prompt_name();
39018
38949
  };
39019
38950
  const prompt_subject = () => {
39020
- subject = window.prompt(
39021
- `When you click on "Ok," you are granting permission to ${APP_OBJ[app_id]?.app_name} team to access your browser. \n\nSubject (required):`
39022
- );
38951
+ subject = window.prompt(`When you click on "Ok," you are granting permission to ${APP_OBJ[app_id]?.app_name} team to access your browser. \n\nSubject (required):`);
39023
38952
 
39024
- if (subject === "") prompt_subject();
38953
+ if (subject === '') prompt_subject();
39025
38954
  };
39026
38955
  if (!SUPPORT_PEER) {
39027
38956
  // if (
@@ -39047,17 +38976,13 @@ func.index.init_document_listeners = function () {
39047
38976
  prompt_subject();
39048
38977
  if (subject === null) return;
39049
38978
 
39050
- func.common.db(SESSION_ID, "get_support", {
38979
+ func.common.db(SESSION_ID, 'get_support', {
39051
38980
  name,
39052
38981
  subject,
39053
38982
  });
39054
38983
  setTimeout(() => {
39055
- $("body").addClass("get_support_request");
39056
- $("body")
39057
- .remove(".get_support_request_title")
39058
- .append(
39059
- "<div class='get_support_request_title'>Support pending</div>"
39060
- );
38984
+ $('body').addClass('get_support_request');
38985
+ $('body').remove('.get_support_request_title').append("<div class='get_support_request_title'>Support pending</div>");
39061
38986
  }, 2000);
39062
38987
 
39063
38988
  // get_support.init_peer(SESSION_ID, name, subject);
@@ -39091,12 +39016,8 @@ func.index.init_document_listeners = function () {
39091
39016
  posY = e.pageY;
39092
39017
 
39093
39018
  if (SESSION_OBJ[SESSION_ID]?.DS_GLB?.[0]) {
39094
- SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system[
39095
- "SYS_GLOBAL_OBJ_CLIENT_INFO"
39096
- ].cursor_pos_x = posX;
39097
- SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system[
39098
- "SYS_GLOBAL_OBJ_CLIENT_INFO"
39099
- ].cursor_pos_y = posY;
39019
+ SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system['SYS_GLOBAL_OBJ_CLIENT_INFO'].cursor_pos_x = posX;
39020
+ SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system['SYS_GLOBAL_OBJ_CLIENT_INFO'].cursor_pos_y = posY;
39100
39021
  }
39101
39022
  // }
39102
39023
  }); //get pointer position
@@ -39104,11 +39025,11 @@ func.index.init_document_listeners = function () {
39104
39025
  $.fn.draggable = function () {
39105
39026
  CLIENT_ACTIVITY_TS = Date.now();
39106
39027
  var $this = this,
39107
- ns = "draggable_" + (Math.random() + "").replace(".", ""),
39108
- mm = "mousemove." + ns,
39109
- mu = "mouseup." + ns,
39028
+ ns = 'draggable_' + (Math.random() + '').replace('.', ''),
39029
+ mm = 'mousemove.' + ns,
39030
+ mu = 'mouseup.' + ns,
39110
39031
  $w = $(window),
39111
- isFixed = $this.css("position") === "fixed",
39032
+ isFixed = $this.css('position') === 'fixed',
39112
39033
  adjX = 0,
39113
39034
  adjY = 0;
39114
39035
 
@@ -39135,7 +39056,7 @@ func.index.init_document_listeners = function () {
39135
39056
  });
39136
39057
  });
39137
39058
  $w.on(mu, function () {
39138
- $w.off(mm + " " + mu).removeData(ns);
39059
+ $w.off(mm + ' ' + mu).removeData(ns);
39139
39060
  });
39140
39061
  });
39141
39062
 
@@ -39153,7 +39074,7 @@ func.index.init_document_listeners = function () {
39153
39074
  const set_idle = async function (stat) {
39154
39075
  var datasource_changes = {
39155
39076
  [0]: {
39156
- ["data_system"]: { SYS_GLOBAL_BOL_IDLE: stat },
39077
+ ['data_system']: { SYS_GLOBAL_BOL_IDLE: stat },
39157
39078
  },
39158
39079
  };
39159
39080
  await func.datasource.update(SESSION_ID, datasource_changes);
@@ -39165,15 +39086,12 @@ func.index.init_document_listeners = function () {
39165
39086
  set_idle(0);
39166
39087
  }
39167
39088
 
39168
- if (
39169
- _session.engine_mode === "live_preview" ||
39170
- !_session.opt.enable_user_monitor
39171
- ) {
39089
+ if (_session.engine_mode === 'live_preview' || !_session.opt.enable_user_monitor) {
39172
39090
  return;
39173
39091
  }
39174
39092
 
39175
39093
  const ret = await func.common
39176
- .db(SESSION_ID, "heartbeat", {
39094
+ .db(SESSION_ID, 'heartbeat', {
39177
39095
  stat: Date.now() - CLIENT_ACTIVITY_TS > 30000 ? 1 : 2,
39178
39096
  })
39179
39097
  .catch((err) => {
@@ -39189,25 +39107,21 @@ func.index.init_document_listeners = function () {
39189
39107
  // window.location.href = `https://${_session.domain}/error?error_code=408`;
39190
39108
  window.top.location.reload(); //href = `https://${_session.domain}?ts=${Date.now()}`;
39191
39109
  }
39192
- $("body").removeClass("get_support_request");
39193
- $("body").find(".get_support_request_title").remove();
39194
- $("body").removeClass("get_support_online");
39195
- $("body").find(".get_support_online_title").remove();
39110
+ $('body').removeClass('get_support_request');
39111
+ $('body').find('.get_support_request_title').remove();
39112
+ $('body').removeClass('get_support_online');
39113
+ $('body').find('.get_support_online_title').remove();
39196
39114
 
39197
39115
  if (ret?.data?.peer?.peer_status === 1) {
39198
39116
  if (ret.data.peer.peer_regional_server) {
39199
39117
  get_support.init_peer(SESSION_ID, ret.data.peer.peer_regional_server);
39200
39118
  }
39201
- $("body").addClass("get_support_request");
39202
- $("body")
39203
- .remove(".get_support_request_title")
39204
- .append("<div class='get_support_request_title'>Support pending</div>");
39119
+ $('body').addClass('get_support_request');
39120
+ $('body').remove('.get_support_request_title').append("<div class='get_support_request_title'>Support pending</div>");
39205
39121
  }
39206
39122
  if (ret?.data?.peer?.peer_status === 2) {
39207
- $("body").addClass("get_support_online");
39208
- $("body")
39209
- .remove(".get_support_online_title")
39210
- .append("<div class='get_support_online_title'>Support online</div>");
39123
+ $('body').addClass('get_support_online');
39124
+ $('body').remove('.get_support_online_title').append("<div class='get_support_online_title'>Support online</div>");
39211
39125
  }
39212
39126
  _session.res_token = ret.res_token;
39213
39127
  }, 30000);
@@ -39216,31 +39130,26 @@ func.index.init_document_listeners = function () {
39216
39130
  };
39217
39131
 
39218
39132
  func.index.init_service_workers = function () {
39219
- if ("serviceWorker" in navigator) {
39220
- navigator.serviceWorker.addEventListener("message", function (event) {
39221
- console.log("serviceWorker message:", event);
39133
+ if ('serviceWorker' in navigator) {
39134
+ navigator.serviceWorker.addEventListener('message', function (event) {
39135
+ console.log('serviceWorker message:', event);
39222
39136
  });
39223
39137
 
39224
- navigator.serviceWorker.register("xuda-sw.js").then(
39138
+ navigator.serviceWorker.register('xuda-sw.js').then(
39225
39139
  function (registration) {
39226
39140
  // Registration was successful
39227
- console.log(
39228
- "ServiceWorker registration successful with scope: ",
39229
- registration.scope
39230
- );
39141
+ console.log('ServiceWorker registration successful with scope: ', registration.scope);
39231
39142
  glb.sw_registration = registration;
39232
39143
  },
39233
39144
  function (err) {
39234
39145
  // registration failed :(
39235
- console.log("ServiceWorker registration failed: ", err);
39236
- }
39146
+ console.log('ServiceWorker registration failed: ', err);
39147
+ },
39237
39148
  );
39238
39149
  }
39239
39150
  };
39240
39151
 
39241
- func.index.delete_pouch = async function (
39242
- SESSION_ID = Object.keys(SESSION_OBJ)[0]
39243
- ) {
39152
+ func.index.delete_pouch = async function (SESSION_ID = Object.keys(SESSION_OBJ)[0]) {
39244
39153
  const db = await func.utils.connect_pouchdb(SESSION_ID);
39245
39154
 
39246
39155
  try {
@@ -39254,30 +39163,25 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39254
39163
  var worker_id = Object.keys(WEB_WORKER[SESSION_ID]).length + 1;
39255
39164
 
39256
39165
  var _session = SESSION_OBJ[SESSION_ID];
39257
- if (!_session.engine_mode === "docker") {
39166
+ if (!_session.engine_mode === 'docker') {
39258
39167
  ver = APP_OBJ[_session.app_id].app_version;
39259
39168
  }
39260
39169
 
39261
- var build_id =
39262
- _session.engine_mode === "live_preview" ? "" : _session.opt.app_build_id;
39263
- if (typeof XUDA_BUILD_ID !== "undefined") {
39170
+ var build_id = _session.engine_mode === 'live_preview' ? '' : _session.opt.app_build_id;
39171
+ if (typeof XUDA_BUILD_ID !== 'undefined') {
39264
39172
  build_id = XUDA_BUILD_ID;
39265
39173
  }
39266
39174
 
39267
39175
  const worker_name =
39268
- `${
39269
- typeof _session.SLIM_BUNDLE === "undefined" || !_session.SLIM_BUNDLE
39270
- ? ""
39271
- : "Slim "
39272
- }${prog_obj.menuName} worker` +
39176
+ `${typeof _session.SLIM_BUNDLE === 'undefined' || !_session.SLIM_BUNDLE ? '' : 'Slim '}${prog_obj.menuName} worker` +
39273
39177
  // (prog_obj.menuName || "xuda.io worker") +
39274
- " " +
39178
+ ' ' +
39275
39179
  glb.worker_type +
39276
- ": #" +
39180
+ ': #' +
39277
39181
  worker_id.toString() +
39278
- " " +
39279
- (build_id || "") +
39280
- " " +
39182
+ ' ' +
39183
+ (build_id || '') +
39184
+ ' ' +
39281
39185
  _session.domain;
39282
39186
 
39283
39187
  const init_worker_session = function (worker_id) {
@@ -39288,12 +39192,9 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39288
39192
  var ds_obj = {};
39289
39193
  if (ds && _session.DS_GLB[ds].parentDataSourceNo !== null) {
39290
39194
  ds_obj[ds] = func.utils.clean_returned_datasource(SESSION_ID, ds);
39291
- _.forEach(
39292
- get_parent_ds(_session.DS_GLB[ds].parentDataSourceNo),
39293
- function (val, key) {
39294
- ds_obj[key] = val;
39295
- }
39296
- );
39195
+ _.forEach(get_parent_ds(_session.DS_GLB[ds].parentDataSourceNo), function (val, key) {
39196
+ ds_obj[key] = val;
39197
+ });
39297
39198
  } else {
39298
39199
  ds_obj[ds] = func.utils.clean_returned_datasource(SESSION_ID, ds);
39299
39200
  }
@@ -39301,7 +39202,7 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39301
39202
  };
39302
39203
  var ds_obj = {};
39303
39204
  // send existing datasources to the worker when initiating on demand workers
39304
- if (typeof obj?.data?.parentDataSourceNoP !== "undefined") {
39205
+ if (typeof obj?.data?.parentDataSourceNoP !== 'undefined') {
39305
39206
  ds_obj = get_parent_ds(obj.data.parentDataSourceNoP);
39306
39207
  }
39307
39208
  _session.DS_GLB = {};
@@ -39331,7 +39232,7 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39331
39232
  STUDIO_WEBSOCKET_CONNECTION_ID: STUDIO_WEBSOCKET_CONNECTION_ID,
39332
39233
  };
39333
39234
 
39334
- if (_session.engine_mode === "live_preview") {
39235
+ if (_session.engine_mode === 'live_preview') {
39335
39236
  data.DOCS_OBJ = DOCS_OBJ[app_id];
39336
39237
  }
39337
39238
  delete data.SESSION_INFO.root_element;
@@ -39344,20 +39245,15 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39344
39245
 
39345
39246
  delete data.SESSION_INFO.DS_UI_EVENTS_GLB; // contains function produce error
39346
39247
 
39347
- if (
39348
- RUNTIME_SERVER_WEBSOCKET &&
39349
- RUNTIME_SERVER_WEBSOCKET_CONNECTED &&
39350
- (!_session.opt.app_computing_mode ||
39351
- _session.opt.app_computing_mode === "server")
39352
- ) {
39353
- WEB_WORKER[SESSION_ID][worker_id].worker.emit("message", {
39354
- service: "init",
39248
+ if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED && (!_session.opt.app_computing_mode || _session.opt.app_computing_mode === 'server')) {
39249
+ WEB_WORKER[SESSION_ID][worker_id].worker.emit('message', {
39250
+ service: 'init',
39355
39251
  data: data, //JSON.stringify(data),
39356
39252
  worker_id: worker_id,
39357
39253
  });
39358
39254
  } else {
39359
39255
  WEB_WORKER[SESSION_ID][worker_id].worker.postMessage({
39360
- service: "init",
39256
+ service: 'init',
39361
39257
  data: JSON.stringify(data),
39362
39258
  worker_id: worker_id,
39363
39259
  });
@@ -39365,9 +39261,9 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39365
39261
  };
39366
39262
  const create_worker = async function () {
39367
39263
  return new Promise((resolve, reject) => {
39368
- if (glb.worker_type === "Dev") {
39264
+ if (glb.worker_type === 'Dev') {
39369
39265
  WEB_WORKER[SESSION_ID][worker_id] = {
39370
- worker: new Worker("js/xuda_worker.js", {
39266
+ worker: new Worker('js/xuda_worker.js', {
39371
39267
  name: worker_name,
39372
39268
  }),
39373
39269
  promise_queue: {},
@@ -39375,23 +39271,10 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39375
39271
  } else {
39376
39272
  function getWorkerURL(url) {
39377
39273
  const content = `importScripts( "${url}" );`;
39378
- return URL.createObjectURL(
39379
- new Blob([content], { type: "text/javascript" })
39380
- );
39274
+ return URL.createObjectURL(new Blob([content], { type: 'text/javascript' }));
39381
39275
  }
39382
39276
 
39383
- let blob = getWorkerURL(
39384
- func.common.get_url(
39385
- SESSION_ID,
39386
- "dist",
39387
- func.utils.get_resource_filename(
39388
- SESSION_OBJ[SESSION_ID].engine_mode === "live_preview"
39389
- ? ""
39390
- : SESSION_OBJ[SESSION_ID]?.opt?.app_build_id,
39391
- "runtime/js/xuda_worker.js"
39392
- )
39393
- )
39394
- );
39277
+ 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')));
39395
39278
  WEB_WORKER[SESSION_ID][worker_id] = {
39396
39279
  worker: new Worker(blob, {
39397
39280
  name: worker_name,
@@ -39400,14 +39283,14 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39400
39283
  };
39401
39284
  }
39402
39285
  WEB_WORKER[SESSION_ID][worker_id].worker.addEventListener(
39403
- "message",
39286
+ 'message',
39404
39287
  function (e) {
39405
- if (e.data.service === "worker_ready") {
39288
+ if (e.data.service === 'worker_ready') {
39406
39289
  return resolve();
39407
39290
  }
39408
39291
  worker_functions(e);
39409
39292
  },
39410
- false
39293
+ false,
39411
39294
  );
39412
39295
  });
39413
39296
  };
@@ -39418,8 +39301,8 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39418
39301
  promise_queue: {},
39419
39302
  };
39420
39303
 
39421
- WEB_WORKER[SESSION_ID][worker_id].worker.on("message", async (e) => {
39422
- if (["deployment_server", "http_call"].includes(e.source)) return;
39304
+ WEB_WORKER[SESSION_ID][worker_id].worker.on('message', async (e) => {
39305
+ if (['deployment_server', 'http_call'].includes(e.source)) return;
39423
39306
  worker_functions({ data: e });
39424
39307
  });
39425
39308
  resolve();
@@ -39429,12 +39312,7 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39429
39312
  return new Promise(async (resolve, reject) => {
39430
39313
  var e = {};
39431
39314
  e.data = e_raw.data;
39432
- if (
39433
- RUNTIME_SERVER_WEBSOCKET &&
39434
- RUNTIME_SERVER_WEBSOCKET_CONNECTED &&
39435
- (!_session.opt.app_computing_mode ||
39436
- _session.opt.app_computing_mode === "server")
39437
- ) {
39315
+ if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED && (!_session.opt.app_computing_mode || _session.opt.app_computing_mode === 'server')) {
39438
39316
  WEBSOCKET_PROCESS_PID = e.data.process_pid;
39439
39317
  }
39440
39318
 
@@ -39447,11 +39325,11 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39447
39325
  }
39448
39326
  },
39449
39327
  alert: function () {
39450
- if (val[1] === "save_on") {
39328
+ if (val[1] === 'save_on') {
39451
39329
  func.UI.utils.save(SESSION_ID, true);
39452
39330
  return true;
39453
39331
  }
39454
- if (val[1] === "save_off") {
39332
+ if (val[1] === 'save_off') {
39455
39333
  func.UI.utils.save(SESSION_ID, false);
39456
39334
  return true;
39457
39335
  }
@@ -39476,16 +39354,16 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39476
39354
  return _resolve();
39477
39355
  },
39478
39356
  screen_blocker_on: function () {
39479
- func.UI.utils.screen_blocker(true, "Worker");
39357
+ func.UI.utils.screen_blocker(true, 'Worker');
39480
39358
  return _resolve();
39481
39359
  },
39482
39360
  ajax_error: function () {
39483
39361
  // location.reload();
39484
- func.utils.request_error(SESSION_ID, "ajax", "Session error");
39362
+ func.utils.request_error(SESSION_ID, 'ajax', 'Session error');
39485
39363
  return _resolve();
39486
39364
  },
39487
39365
  screen_blocker_off: function () {
39488
- func.UI.utils.screen_blocker(false, "Worker");
39366
+ func.UI.utils.screen_blocker(false, 'Worker');
39489
39367
  return _resolve();
39490
39368
  },
39491
39369
  job: function () {
@@ -39516,7 +39394,7 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39516
39394
  val.argumentsP,
39517
39395
  val.source_event_idP,
39518
39396
  val.calling_job,
39519
- val.args
39397
+ val.args,
39520
39398
  );
39521
39399
  return _resolve();
39522
39400
  },
@@ -39527,36 +39405,30 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39527
39405
  if (!val.worker_id) {
39528
39406
  return;
39529
39407
  }
39530
- fx.acknowledged_worker_with_eventChangesResults_done(
39531
- val.dssession,
39532
- val.worker_id
39533
- );
39534
- for await (const [worker_id, ds_arr] of Object.entries(
39535
- WEB_WORKER[SESSION_ID]
39536
- )) {
39408
+ fx.acknowledged_worker_with_eventChangesResults_done(val.dssession, val.worker_id);
39409
+ for await (const [worker_id, ds_arr] of Object.entries(WEB_WORKER[SESSION_ID])) {
39537
39410
  if (val.worker_id == worker_id) continue;
39538
39411
 
39539
39412
  await func.index.call_worker(
39540
39413
  SESSION_ID,
39541
39414
  {
39542
- service: "update_datasource_changes_from_client",
39415
+ service: 'update_datasource_changes_from_client',
39543
39416
  data: data,
39544
39417
  },
39545
39418
  {
39546
39419
  worker_id: worker_id,
39547
- }
39420
+ },
39548
39421
  );
39549
39422
  }
39550
39423
  },
39551
39424
  post_datasource: async function () {
39552
- if (typeof val.dsSessionP === "undefined" || val.dsSessionP === null)
39553
- return;
39425
+ if (typeof val.dsSessionP === 'undefined' || val.dsSessionP === null) return;
39554
39426
  if (!SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP]) {
39555
39427
  SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP] = val.ds_obj;
39556
39428
  } else {
39557
39429
  const update_existing_ds_object = function (old_obj, new_obj) {
39558
39430
  for (const [key, val] of Object.entries(new_obj)) {
39559
- if (typeof val !== "object") {
39431
+ if (typeof val !== 'object') {
39560
39432
  old_obj[key] = val2;
39561
39433
  } else {
39562
39434
  if (!old_obj[key]) {
@@ -39565,30 +39437,19 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39565
39437
  }
39566
39438
  }
39567
39439
  };
39568
- update_existing_ds_object(
39569
- SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP],
39570
- val.ds_obj
39571
- );
39440
+ update_existing_ds_object(SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP], val.ds_obj);
39572
39441
  }
39573
39442
  var verify_set_parent_ds = function () {
39574
39443
  var dsSession = val.dsSessionP;
39575
- for (const [key, val] of Object.entries(
39576
- SESSION_OBJ[SESSION_ID].DS_GLB[dsSession].parent_ds_chain
39577
- )) {
39444
+ for (const [key, val] of Object.entries(SESSION_OBJ[SESSION_ID].DS_GLB[dsSession].parent_ds_chain)) {
39578
39445
  if (SESSION_OBJ[SESSION_ID].DS_GLB[val]) {
39579
- SESSION_OBJ[SESSION_ID].DS_GLB[dsSession].parentDataSourceNo =
39580
- val;
39446
+ SESSION_OBJ[SESSION_ID].DS_GLB[dsSession].parentDataSourceNo = val;
39581
39447
  break;
39582
39448
  }
39583
39449
  }
39584
39450
  };
39585
39451
  verify_set_parent_ds();
39586
- if (
39587
- val.ds_obj.dataSourceSessionGlobal >
39588
- SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal
39589
- )
39590
- SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal =
39591
- val.ds_obj.dataSourceSessionGlobal;
39452
+ if (val.ds_obj.dataSourceSessionGlobal > SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal) SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal = val.ds_obj.dataSourceSessionGlobal;
39592
39453
  },
39593
39454
  return_to_data_source: function (type, dsSessionP, ds) {
39594
39455
  var data = {
@@ -39599,14 +39460,11 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39599
39460
  return_to_data_source_type: type,
39600
39461
  };
39601
39462
  func.index.call_worker(SESSION_ID, {
39602
- service: "return_to_data_source",
39463
+ service: 'return_to_data_source',
39603
39464
  data: data,
39604
39465
  });
39605
39466
  },
39606
- acknowledged_worker_with_eventChangesResults_done: async function (
39607
- dsSessionP,
39608
- worker_id
39609
- ) {
39467
+ acknowledged_worker_with_eventChangesResults_done: async function (dsSessionP, worker_id) {
39610
39468
  var data = {
39611
39469
  session_id: SESSION_ID,
39612
39470
  dssession: dsSessionP,
@@ -39614,23 +39472,19 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39614
39472
  await func.index.call_worker(
39615
39473
  SESSION_ID,
39616
39474
  {
39617
- service: "acknowledged_worker_with_eventChangesResults_done",
39475
+ service: 'acknowledged_worker_with_eventChangesResults_done',
39618
39476
  data: data,
39619
39477
  },
39620
39478
  {
39621
39479
  worker_id: worker_id,
39622
- }
39480
+ },
39623
39481
  );
39624
39482
  return _resolve();
39625
39483
  },
39626
39484
  execute_onscreen_view_events: async function () {
39627
39485
  await fx.post_datasource();
39628
39486
  var ds = SESSION_OBJ[SESSION_ID].DS_GLB[val.dsSessionP]; //val.ds_obj;
39629
- await func.datasource.execute_onscreen_view_events(
39630
- SESSION_ID,
39631
- val.dsSessionP,
39632
- "onscreen events"
39633
- );
39487
+ await func.datasource.execute_onscreen_view_events(SESSION_ID, val.dsSessionP, 'onscreen events');
39634
39488
 
39635
39489
  if (!ds.v.onscreen_events_active) return;
39636
39490
  var type = ds.v.onscreen_events_active.type;
@@ -39641,37 +39495,20 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39641
39495
  },
39642
39496
  execute_local_db_query: async function () {
39643
39497
  await fx.post_datasource();
39644
- const data = await func.db.get_query(
39645
- SESSION_ID,
39646
- val.fileIdP,
39647
- val.queryP,
39648
- val.dsSessionP,
39649
- val.viewSourceDescP,
39650
- val.sourceP,
39651
- val.reduceP,
39652
- val.skipP,
39653
- val.limitP,
39654
- val.countP,
39655
- val.idsP
39656
- );
39498
+ const data = await func.db.get_query(SESSION_ID, val.fileIdP, val.queryP, val.dsSessionP, val.viewSourceDescP, val.sourceP, val.reduceP, val.skipP, val.limitP, val.countP, val.idsP);
39657
39499
 
39658
39500
  var msg = {};
39659
39501
  msg.worker_id = worker_id;
39660
39502
  msg.data = {};
39661
- msg.service = "return_from_db_query";
39503
+ msg.service = 'return_from_db_query';
39662
39504
  msg.data.worker_id = worker_id;
39663
39505
  msg.data.callback_id = val.callback_id;
39664
39506
  msg.data.session_id = SESSION_ID;
39665
39507
  msg.data.data = data;
39666
39508
 
39667
- if (
39668
- RUNTIME_SERVER_WEBSOCKET &&
39669
- RUNTIME_SERVER_WEBSOCKET_CONNECTED &&
39670
- (!_session.opt.app_computing_mode ||
39671
- _session.opt.app_computing_mode === "server")
39672
- ) {
39509
+ if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED && (!_session.opt.app_computing_mode || _session.opt.app_computing_mode === 'server')) {
39673
39510
  msg.process_pid = WEBSOCKET_PROCESS_PID;
39674
- WEB_WORKER[SESSION_ID][worker_id].worker.emit("message", msg);
39511
+ WEB_WORKER[SESSION_ID][worker_id].worker.emit('message', msg);
39675
39512
  // WEB_WORKER[SESSION_ID][worker_id].worker.send(JSON.stringify(msg));
39676
39513
  } else {
39677
39514
  WEB_WORKER[SESSION_ID][worker_id].worker.postMessage(msg);
@@ -39681,29 +39518,20 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39681
39518
  execute_local_sava_data: async function () {
39682
39519
  await fx.post_datasource();
39683
39520
 
39684
- const data = await func.db.save_data(
39685
- SESSION_ID,
39686
- val.dsSessionP,
39687
- val.keyP
39688
- );
39521
+ const data = await func.db.save_data(SESSION_ID, val.dsSessionP, val.keyP);
39689
39522
 
39690
39523
  var msg = {};
39691
39524
  msg.worker_id = worker_id;
39692
39525
  msg.data = {};
39693
- msg.service = "return_from_sava_data";
39526
+ msg.service = 'return_from_sava_data';
39694
39527
  msg.data.worker_id = worker_id;
39695
39528
  msg.data.callback_id = val.callback_id;
39696
39529
  msg.data.session_id = SESSION_ID;
39697
39530
  msg.data.data = data;
39698
39531
 
39699
- if (
39700
- RUNTIME_SERVER_WEBSOCKET &&
39701
- RUNTIME_SERVER_WEBSOCKET_CONNECTED &&
39702
- (!_session.opt.app_computing_mode ||
39703
- _session.opt.app_computing_mode === "server")
39704
- ) {
39532
+ if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED && (!_session.opt.app_computing_mode || _session.opt.app_computing_mode === 'server')) {
39705
39533
  msg.process_pid = WEBSOCKET_PROCESS_PID;
39706
- WEB_WORKER[SESSION_ID][worker_id].worker.emit("message", msg);
39534
+ WEB_WORKER[SESSION_ID][worker_id].worker.emit('message', msg);
39707
39535
  } else {
39708
39536
  WEB_WORKER[SESSION_ID][worker_id].worker.postMessage(msg);
39709
39537
  }
@@ -39715,74 +39543,56 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39715
39543
  },
39716
39544
  write_log: async function (params) {
39717
39545
  if (SESSION_OBJ[SESSION_ID].crawler) return;
39718
- await func.common.db(SESSION_ID, "write_log", {
39546
+ await func.common.db(SESSION_ID, 'write_log', {
39719
39547
  msg: val.data,
39720
- source: "runtime",
39721
- log_type: "error",
39548
+ source: 'runtime',
39549
+ log_type: 'error',
39722
39550
  });
39723
39551
  _resolve();
39724
39552
  },
39725
39553
  change_loaded_image: function (params) {
39726
39554
  const new_image = e.data.params.data;
39727
- var $img = $("img");
39555
+ var $img = $('img');
39728
39556
 
39729
39557
  $.each($img, function (key, val) {
39730
- var src = $(val).prop("src");
39558
+ var src = $(val).prop('src');
39731
39559
 
39732
39560
  if (src.indexOf(new_image) > 0) {
39733
- $(val).attr("src", src + "?ts=" + new Date().valueOf());
39561
+ $(val).attr('src', src + '?ts=' + new Date().valueOf());
39734
39562
  }
39735
39563
  });
39736
39564
  _resolve();
39737
39565
  },
39738
39566
  send_watch_to_studio_websocket: function (params) {
39739
- STUDIO_WEBSOCKET.emit("message", val);
39567
+ STUDIO_WEBSOCKET.emit('message', val);
39740
39568
  _resolve();
39741
39569
  },
39742
39570
  get_doc_from_studio: async function (params) {
39743
- const module = await func.common.get_module(
39744
- SESSION_ID,
39745
- `xuda-progs-loader-module.mjs`
39746
- );
39571
+ const module = await func.common.get_module(SESSION_ID, `xuda-progs-loader-module.mjs`);
39747
39572
 
39748
- const data = await module.get_doc_from_studio(
39749
- SESSION_ID,
39750
- SESSION_OBJ[SESSION_ID].app_id,
39751
- params.params.doc_id
39752
- );
39573
+ const data = await module.get_doc_from_studio(SESSION_ID, SESSION_OBJ[SESSION_ID].app_id, params.params.doc_id);
39753
39574
  func.index.call_worker(SESSION_ID, {
39754
- service: "return_doc_from_studio",
39575
+ service: 'return_doc_from_studio',
39755
39576
  data,
39756
39577
  });
39757
39578
 
39758
39579
  _resolve();
39759
39580
  },
39760
39581
  get_doc_from_websocket: async function (params) {
39761
- const module = await func.common.get_module(
39762
- SESSION_ID,
39763
- `xuda-progs-loader-module.mjs`
39764
- );
39582
+ const module = await func.common.get_module(SESSION_ID, `xuda-progs-loader-module.mjs`);
39765
39583
 
39766
- const data = await module.get_doc_from_websocket(
39767
- SESSION_ID,
39768
- SESSION_OBJ[SESSION_ID].app_id,
39769
- params.params.doc_id
39770
- );
39584
+ const data = await module.get_doc_from_websocket(SESSION_ID, SESSION_OBJ[SESSION_ID].app_id, params.params.doc_id);
39771
39585
  func.index.call_worker(SESSION_ID, {
39772
- service: "return_doc_from_websocket",
39586
+ service: 'return_doc_from_websocket',
39773
39587
  data,
39774
39588
  });
39775
39589
 
39776
39590
  _resolve();
39777
39591
  },
39778
39592
  get_dbs_data_from_websocket: async function (params) {
39779
- const data = await func.common.get_data_from_websocket(
39780
- SESSION_ID,
39781
- params.params.service,
39782
- params.params.data
39783
- );
39593
+ const data = await func.common.get_data_from_websocket(SESSION_ID, params.params.service, params.params.data);
39784
39594
  func.index.call_worker(SESSION_ID, {
39785
- service: "return_dbs_data_from_websocket",
39595
+ service: 'return_dbs_data_from_websocket',
39786
39596
  data: {
39787
39597
  data,
39788
39598
  websocket_queue_num: params.params.websocket_queue_num,
@@ -39792,49 +39602,36 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39792
39602
  _resolve();
39793
39603
  },
39794
39604
  perform_rpi_request_from_studio: async function (params) {
39795
- const data = await func.common.db(
39796
- SESSION_ID,
39797
- params.params.service,
39798
- params.params.data
39799
- );
39605
+ const data = await func.common.db(SESSION_ID, params.params.service, params.params.data);
39800
39606
  func.index.call_worker(SESSION_ID, {
39801
- service: "return_rpi_request_from_studio",
39607
+ service: 'return_rpi_request_from_studio',
39802
39608
  data: { data: data.data, table_id: params.params.req_id },
39803
39609
  });
39804
39610
 
39805
39611
  _resolve();
39806
39612
  },
39807
39613
  refresh_document_changes_for_realtime_update: async function (params) {
39808
- func.UI.screen.refresh_document_changes_for_realtime_update(
39809
- SESSION_ID,
39810
- params.params.doc_change
39811
- );
39614
+ func.UI.screen.refresh_document_changes_for_realtime_update(SESSION_ID, params.params.doc_change);
39812
39615
  _resolve();
39813
39616
  },
39814
39617
  };
39815
39618
 
39816
39619
  const get_promise_queue = function (t, worker_id) {
39817
39620
  if (!WEB_WORKER[SESSION_ID][worker_id]) {
39818
- console.warn("worker job not found");
39621
+ console.warn('worker job not found');
39819
39622
  return;
39820
39623
  }
39821
39624
 
39822
39625
  return WEB_WORKER[SESSION_ID][worker_id].promise_queue[t];
39823
39626
  };
39824
39627
 
39825
- const promise_ret = await get_promise_queue(
39826
- e.data.promise_queue_id,
39827
- e.data.worker_id
39828
- );
39628
+ const promise_ret = await get_promise_queue(e.data.promise_queue_id, e.data.worker_id);
39829
39629
 
39830
39630
  const _resolve = function (params) {
39831
39631
  if (!promise_ret) return resolve();
39832
39632
  promise_ret.resolve(params);
39833
39633
  setTimeout(function () {
39834
- if (WEB_WORKER[SESSION_ID][e.data.worker_id])
39835
- delete WEB_WORKER[SESSION_ID][e.data.worker_id].promise_queue[
39836
- e.data.promise_queue_id
39837
- ];
39634
+ if (WEB_WORKER[SESSION_ID][e.data.worker_id]) delete WEB_WORKER[SESSION_ID][e.data.worker_id].promise_queue[e.data.promise_queue_id];
39838
39635
  }, 1000);
39839
39636
  };
39840
39637
 
@@ -39842,24 +39639,19 @@ func.index.new_webworker = async function (SESSION_ID, prog_obj, obj) {
39842
39639
  return await fx[e.data.fx_to_execute](e.data);
39843
39640
  }
39844
39641
 
39845
- if (!promise_ret) return console.error("promise not found");
39642
+ if (!promise_ret) return console.error('promise not found');
39846
39643
 
39847
39644
  if (!e.data.fx_to_execute) {
39848
39645
  // return datasource
39849
39646
  return _resolve(e.data.params);
39850
39647
  }
39851
39648
 
39852
- if (e.data.fx_to_execute === "worker_response") {
39649
+ if (e.data.fx_to_execute === 'worker_response') {
39853
39650
  return _resolve(e.data.params);
39854
39651
  }
39855
39652
  });
39856
39653
  };
39857
- if (
39858
- RUNTIME_SERVER_WEBSOCKET &&
39859
- RUNTIME_SERVER_WEBSOCKET_CONNECTED &&
39860
- (!_session.opt.app_computing_mode ||
39861
- _session.opt.app_computing_mode === "server")
39862
- ) {
39654
+ if (RUNTIME_SERVER_WEBSOCKET && RUNTIME_SERVER_WEBSOCKET_CONNECTED && (!_session.opt.app_computing_mode || _session.opt.app_computing_mode === 'server')) {
39863
39655
  await create_websocket();
39864
39656
  } else {
39865
39657
  await create_worker();