@xuda.io/runtime-bundle 1.0.1007 → 1.0.1009

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.
@@ -2670,6 +2670,13 @@ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data
2670
2670
  dbs_calls();
2671
2671
  });
2672
2672
  };
2673
+
2674
+ func.common.sha256 = async function (str) {
2675
+ const enc = new TextEncoder();
2676
+ const buf = await crypto.subtle.digest('SHA-256', enc.encode(str));
2677
+ const bytes = new Uint8Array(buf);
2678
+ return [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
2679
+ };
2673
2680
  glb.DEBUG_INFO_OBJ = {};
2674
2681
  // var CONNECTION_ATTEMPTS = 0;
2675
2682
  glb.APP_INFO = {};
@@ -12085,7 +12092,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12085
12092
  // };
12086
12093
  const program = val.value?.prog || val.value;
12087
12094
  var $wrapper = $('<div>');
12088
- var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
12095
+ var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
12089
12096
  const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
12090
12097
  let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, params_obj.params_res, 'alterXu_panel', undefined, undefined, params_obj.params_raw);
12091
12098
  ret = {
@@ -12620,7 +12627,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12620
12627
  }
12621
12628
 
12622
12629
  ////////////
12623
- const cache_str = get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
12630
+ const cache_str = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
12624
12631
  const xu_ui_id = $elm.attr('xu-ui-id');
12625
12632
  let new_$div = UI_WORKER_OBJ?.xu_render_cache?.[xu_ui_id]?.[cache_str]?.$container.clone(true);
12626
12633
 
@@ -12712,7 +12719,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
12712
12719
 
12713
12720
  $xurender.data().xuData.original_data_obj = original_data_obj;
12714
12721
 
12715
- const cache_str = get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
12722
+ const cache_str = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
12716
12723
  if (!UI_WORKER_OBJ.xu_render_cache[xu_ui_id]) {
12717
12724
  UI_WORKER_OBJ.xu_render_cache[xu_ui_id] = {};
12718
12725
  }
@@ -13563,7 +13570,7 @@ func.UI.screen.panel_post_render_handler = async function (
13563
13570
  return jobNoP;
13564
13571
  };
13565
13572
 
13566
- func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
13573
+ func.UI.screen.create_container = async function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
13567
13574
  const _paramsP = _.cloneDeep(paramsP);
13568
13575
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
13569
13576
  var $appendTo = $container;
@@ -13630,23 +13637,24 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
13630
13637
  $div = $(`<${div} ${attr_str ? attr_str : ''}>`);
13631
13638
  }
13632
13639
 
13633
- // Returns a 32-bit unsigned integer hash of a string (FNV-1a)
13634
- function hash32(str) {
13635
- let h = 0x811c9dc5; // FNV offset basis
13636
- for (let i = 0; i < str.length; i++) {
13637
- h ^= str.charCodeAt(i);
13638
- // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
13639
- h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
13640
- }
13641
- // Convert to unsigned 32-bit
13642
- return h >>> 0;
13643
- }
13640
+ // // Returns a 32-bit unsigned integer hash of a string (FNV-1a)
13641
+ // function hash32(str) {
13642
+ // let h = 0x811c9dc5; // FNV offset basis
13643
+ // for (let i = 0; i < str.length; i++) {
13644
+ // h ^= str.charCodeAt(i);
13645
+ // // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
13646
+ // h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
13647
+ // }
13648
+ // // Convert to unsigned 32-bit
13649
+ // return h >>> 0;
13650
+ // }
13644
13651
 
13645
- function hash32hex(str) {
13646
- return (hash32(str) >>> 0).toString(16).padStart(8, '0');
13647
- }
13652
+ // function hash32hex(str) {
13653
+ // return (hash32(str) >>> 0).toString(16).padStart(8, '0');
13654
+ // }
13648
13655
 
13649
- const new_ui_id = hash32hex(ui_id);
13656
+ // const new_ui_id = hash32hex(ui_id);
13657
+ const new_ui_id = await func.common.sha256(ui_id);
13650
13658
 
13651
13659
  $div.attr('xu-ui-id', new_ui_id).data({
13652
13660
  xuData: {
@@ -14339,7 +14347,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14339
14347
  var exist_elm_obj = get_element_info();
14340
14348
  var $div = exist_elm_obj.div;
14341
14349
  if (!exist_elm_obj.div) {
14342
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
14350
+ $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
14343
14351
 
14344
14352
  //////////////////////////
14345
14353
 
@@ -14541,7 +14549,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14541
14549
 
14542
14550
  if (!exist_elm_obj.div) {
14543
14551
  var $wrapper = $('<div>');
14544
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
14552
+ $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
14545
14553
 
14546
14554
  if (!$div) return;
14547
14555
 
@@ -14681,7 +14689,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14681
14689
  };
14682
14690
 
14683
14691
  var $wrapper = $('<div>');
14684
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
14692
+ $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
14685
14693
 
14686
14694
  let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div.clone(true), true, undefined, refreshed_ds);
14687
14695
  if (ret.abort) {
@@ -14711,7 +14719,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
14711
14719
  if (!element || element === 'script') return await done();
14712
14720
  let str = '';
14713
14721
 
14714
- var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
14722
+ var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
14715
14723
 
14716
14724
  $div.hover(
14717
14725
  function (e) {
@@ -14878,7 +14886,7 @@ func.UI.screen.refresh_document_changes_for_realtime_update = async function (SE
14878
14886
  }
14879
14887
  };
14880
14888
 
14881
- const get_xu_render_cache_str = function (SESSION_ID, dsSessionP) {
14889
+ const get_xu_render_cache_str = async function (SESSION_ID, dsSessionP) {
14882
14890
  var _session = SESSION_OBJ[SESSION_ID];
14883
14891
  var _ds = _session.DS_GLB[dsSessionP];
14884
14892
 
@@ -14892,10 +14900,10 @@ const get_xu_render_cache_str = function (SESSION_ID, dsSessionP) {
14892
14900
  }
14893
14901
 
14894
14902
  if (typeof _ds.parentDataSourceNo !== 'undefined') {
14895
- str += get_xu_render_cache_str(SESSION_ID, _ds.parentDataSourceNo);
14903
+ str += await get_xu_render_cache_str(SESSION_ID, _ds.parentDataSourceNo);
14896
14904
  }
14897
14905
 
14898
- return str;
14906
+ return await func.common.sha256(str);
14899
14907
  };
14900
14908
  func.UI.component = {};
14901
14909
 
@@ -2671,6 +2671,13 @@ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data
2671
2671
  dbs_calls();
2672
2672
  });
2673
2673
  };
2674
+
2675
+ func.common.sha256 = async function (str) {
2676
+ const enc = new TextEncoder();
2677
+ const buf = await crypto.subtle.digest('SHA-256', enc.encode(str));
2678
+ const bytes = new Uint8Array(buf);
2679
+ return [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
2680
+ };
2674
2681
  glb.DEBUG_INFO_OBJ = {};
2675
2682
  // var CONNECTION_ATTEMPTS = 0;
2676
2683
  glb.APP_INFO = {};
@@ -9810,7 +9817,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
9810
9817
  // };
9811
9818
  const program = val.value?.prog || val.value;
9812
9819
  var $wrapper = $('<div>');
9813
- var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
9820
+ var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, nodeP.attributes, null, null, null, $wrapper, '');
9814
9821
  const params_obj = await get_params_obj_new(SESSION_ID, program, nodeP, paramsP.dsSessionP);
9815
9822
  let ret_init = await func.UI.screen.init(SESSION_ID, program, paramsP.screenId, _ds, $div, null, _ds.currentRecordId, jobNoP, true, params_obj.params_res, 'alterXu_panel', undefined, undefined, params_obj.params_raw);
9816
9823
  ret = {
@@ -10345,7 +10352,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10345
10352
  }
10346
10353
 
10347
10354
  ////////////
10348
- const cache_str = get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
10355
+ const cache_str = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
10349
10356
  const xu_ui_id = $elm.attr('xu-ui-id');
10350
10357
  let new_$div = UI_WORKER_OBJ?.xu_render_cache?.[xu_ui_id]?.[cache_str]?.$container.clone(true);
10351
10358
 
@@ -10437,7 +10444,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
10437
10444
 
10438
10445
  $xurender.data().xuData.original_data_obj = original_data_obj;
10439
10446
 
10440
- const cache_str = get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
10447
+ const cache_str = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP);
10441
10448
  if (!UI_WORKER_OBJ.xu_render_cache[xu_ui_id]) {
10442
10449
  UI_WORKER_OBJ.xu_render_cache[xu_ui_id] = {};
10443
10450
  }
@@ -11288,7 +11295,7 @@ func.UI.screen.panel_post_render_handler = async function (
11288
11295
  return jobNoP;
11289
11296
  };
11290
11297
 
11291
- func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
11298
+ func.UI.screen.create_container = async function (SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, classP, elem_propP, div_typeP, $appendToP, attr_str) {
11292
11299
  const _paramsP = _.cloneDeep(paramsP);
11293
11300
  var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[_paramsP.dsSessionP];
11294
11301
  var $appendTo = $container;
@@ -11355,23 +11362,24 @@ func.UI.screen.create_container = function (SESSION_ID, $root_container, nodeP,
11355
11362
  $div = $(`<${div} ${attr_str ? attr_str : ''}>`);
11356
11363
  }
11357
11364
 
11358
- // Returns a 32-bit unsigned integer hash of a string (FNV-1a)
11359
- function hash32(str) {
11360
- let h = 0x811c9dc5; // FNV offset basis
11361
- for (let i = 0; i < str.length; i++) {
11362
- h ^= str.charCodeAt(i);
11363
- // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
11364
- h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
11365
- }
11366
- // Convert to unsigned 32-bit
11367
- return h >>> 0;
11368
- }
11365
+ // // Returns a 32-bit unsigned integer hash of a string (FNV-1a)
11366
+ // function hash32(str) {
11367
+ // let h = 0x811c9dc5; // FNV offset basis
11368
+ // for (let i = 0; i < str.length; i++) {
11369
+ // h ^= str.charCodeAt(i);
11370
+ // // multiply by FNV prime (2^24 + 2^8 + 0x93) with 32-bit overflow
11371
+ // h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
11372
+ // }
11373
+ // // Convert to unsigned 32-bit
11374
+ // return h >>> 0;
11375
+ // }
11369
11376
 
11370
- function hash32hex(str) {
11371
- return (hash32(str) >>> 0).toString(16).padStart(8, '0');
11372
- }
11377
+ // function hash32hex(str) {
11378
+ // return (hash32(str) >>> 0).toString(16).padStart(8, '0');
11379
+ // }
11373
11380
 
11374
- const new_ui_id = hash32hex(ui_id);
11381
+ // const new_ui_id = hash32hex(ui_id);
11382
+ const new_ui_id = await func.common.sha256(ui_id);
11375
11383
 
11376
11384
  $div.attr('xu-ui-id', new_ui_id).data({
11377
11385
  xuData: {
@@ -12064,7 +12072,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12064
12072
  var exist_elm_obj = get_element_info();
12065
12073
  var $div = exist_elm_obj.div;
12066
12074
  if (!exist_elm_obj.div) {
12067
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
12075
+ $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, 'widget_wrapper', null, null, null, null);
12068
12076
 
12069
12077
  //////////////////////////
12070
12078
 
@@ -12266,7 +12274,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12266
12274
 
12267
12275
  if (!exist_elm_obj.div) {
12268
12276
  var $wrapper = $('<div>');
12269
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
12277
+ $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, 'div', $wrapper, '');
12270
12278
 
12271
12279
  if (!$div) return;
12272
12280
 
@@ -12406,7 +12414,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12406
12414
  };
12407
12415
 
12408
12416
  var $wrapper = $('<div>');
12409
- $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
12417
+ $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, null, $wrapper, '');
12410
12418
 
12411
12419
  let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div.clone(true), true, undefined, refreshed_ds);
12412
12420
  if (ret.abort) {
@@ -12436,7 +12444,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
12436
12444
  if (!element || element === 'script') return await done();
12437
12445
  let str = '';
12438
12446
 
12439
- var $div = func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
12447
+ var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
12440
12448
 
12441
12449
  $div.hover(
12442
12450
  function (e) {
@@ -12603,7 +12611,7 @@ func.UI.screen.refresh_document_changes_for_realtime_update = async function (SE
12603
12611
  }
12604
12612
  };
12605
12613
 
12606
- const get_xu_render_cache_str = function (SESSION_ID, dsSessionP) {
12614
+ const get_xu_render_cache_str = async function (SESSION_ID, dsSessionP) {
12607
12615
  var _session = SESSION_OBJ[SESSION_ID];
12608
12616
  var _ds = _session.DS_GLB[dsSessionP];
12609
12617
 
@@ -12617,10 +12625,10 @@ const get_xu_render_cache_str = function (SESSION_ID, dsSessionP) {
12617
12625
  }
12618
12626
 
12619
12627
  if (typeof _ds.parentDataSourceNo !== 'undefined') {
12620
- str += get_xu_render_cache_str(SESSION_ID, _ds.parentDataSourceNo);
12628
+ str += await get_xu_render_cache_str(SESSION_ID, _ds.parentDataSourceNo);
12621
12629
  }
12622
12630
 
12623
- return str;
12631
+ return await func.common.sha256(str);
12624
12632
  };
12625
12633
  func.UI.component = {};
12626
12634