@xuda.io/runtime-bundle 1.0.1128 → 1.0.1129

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.
@@ -2671,11 +2671,32 @@ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data
2671
2671
  });
2672
2672
  };
2673
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('');
2674
+ func.common.sha256 = async function (inputString) {
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
+
2680
+ // 1. Create a hash buffer from the input string using SHA-256.
2681
+ // This part remains the same as it provides a strong, unique cryptographic starting point.
2682
+ const buffer = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(inputString));
2683
+
2684
+ // 2. Interpret the first 8 bytes (64 bits) of the hash as one big number.
2685
+ const view = new DataView(buffer);
2686
+ const bigInt = view.getBigUint64(0, false); // `false` for big-endian
2687
+
2688
+ // 3. Convert the BigInt to a Base36 string.
2689
+ // The .toString(36) method handles the conversion to an alphanumeric representation (0-9, a-z).
2690
+ const base36Hash = bigInt.toString(36);
2691
+
2692
+ // 4. Take the first 10 characters. If it's shorter, it will just return the whole string.
2693
+ // For a 64-bit integer, the Base36 representation will be about 13 characters long,
2694
+ // so slicing is a reliable way to get a fixed length.
2695
+ const shortHash = base36Hash.slice(0, 10);
2696
+
2697
+ // 5. Pad the start in the unlikely case the hash is shorter than 10 characters.
2698
+ // This ensures the output is always exactly 10 characters long.
2699
+ return shortHash.padStart(10, '0');
2679
2700
  };
2680
2701
 
2681
2702
  glb.new_xu_render = false;
@@ -7824,7 +7845,7 @@ func.UI.utils.get_element_info = function (SESSION_ID, dsSessionP, ui_idP, $cont
7824
7845
  // }
7825
7846
  // } else {
7826
7847
  // ret.nodeId = $elm.data().xuData.nodeId;
7827
- ret.nodeId = $elm.data().xuData.xu_id;
7848
+ ret.nodeId = $elm.attr('xu-ui-id'); //$elm.data().xuData.xu_id;
7828
7849
  // }
7829
7850
  }
7830
7851
  ret.$elm = $elm;
@@ -8688,7 +8709,8 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
8688
8709
  return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
8689
8710
  };
8690
8711
 
8691
- var $elm = func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', queue_obj.paramsP.elem_key);
8712
+ // var $elm = func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', queue_obj.paramsP.elem_key);
8713
+ var $elm = $(`[xu-ui-id="${queue_obj.paramsP.elem_key}"]`);
8692
8714
 
8693
8715
  if (glb.new_xu_render) {
8694
8716
  $elm = $(`[xu-ui-id="${queue_obj.paramsP.elem_key}"]`);
@@ -11585,7 +11607,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
11585
11607
  }
11586
11608
  }
11587
11609
  });
11588
-
11610
+ debugger;
11589
11611
  const selector_id = glb.new_xu_render ? $(this).data()?.xuData?.ui_id : $(this).data()?.xuData?.xu_id;
11590
11612
 
11591
11613
  if (attr.length) {
@@ -2672,11 +2672,32 @@ func.common.get_data_from_websocket = async function (SESSION_ID, serviceP, data
2672
2672
  });
2673
2673
  };
2674
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('');
2675
+ func.common.sha256 = async function (inputString) {
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
+
2681
+ // 1. Create a hash buffer from the input string using SHA-256.
2682
+ // This part remains the same as it provides a strong, unique cryptographic starting point.
2683
+ const buffer = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(inputString));
2684
+
2685
+ // 2. Interpret the first 8 bytes (64 bits) of the hash as one big number.
2686
+ const view = new DataView(buffer);
2687
+ const bigInt = view.getBigUint64(0, false); // `false` for big-endian
2688
+
2689
+ // 3. Convert the BigInt to a Base36 string.
2690
+ // The .toString(36) method handles the conversion to an alphanumeric representation (0-9, a-z).
2691
+ const base36Hash = bigInt.toString(36);
2692
+
2693
+ // 4. Take the first 10 characters. If it's shorter, it will just return the whole string.
2694
+ // For a 64-bit integer, the Base36 representation will be about 13 characters long,
2695
+ // so slicing is a reliable way to get a fixed length.
2696
+ const shortHash = base36Hash.slice(0, 10);
2697
+
2698
+ // 5. Pad the start in the unlikely case the hash is shorter than 10 characters.
2699
+ // This ensures the output is always exactly 10 characters long.
2700
+ return shortHash.padStart(10, '0');
2680
2701
  };
2681
2702
 
2682
2703
  glb.new_xu_render = false;
@@ -7825,7 +7846,7 @@ func.UI.utils.get_element_info = function (SESSION_ID, dsSessionP, ui_idP, $cont
7825
7846
  // }
7826
7847
  // } else {
7827
7848
  // ret.nodeId = $elm.data().xuData.nodeId;
7828
- ret.nodeId = $elm.data().xuData.xu_id;
7849
+ ret.nodeId = $elm.attr('xu-ui-id'); //$elm.data().xuData.xu_id;
7829
7850
  // }
7830
7851
  }
7831
7852
  ret.$elm = $elm;
@@ -8689,7 +8710,8 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
8689
8710
  return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
8690
8711
  };
8691
8712
 
8692
- var $elm = func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', queue_obj.paramsP.elem_key);
8713
+ // var $elm = func.UI.utils.find_in_element_data('xuData', $(SESSION_OBJ[SESSION_ID].root_element), 'xu_id', queue_obj.paramsP.elem_key);
8714
+ var $elm = $(`[xu-ui-id="${queue_obj.paramsP.elem_key}"]`);
8693
8715
 
8694
8716
  if (glb.new_xu_render) {
8695
8717
  $elm = $(`[xu-ui-id="${queue_obj.paramsP.elem_key}"]`);
@@ -9310,7 +9332,7 @@ func.UI.screen.refresh_xu_attributes = async function (SESSION_ID, fields_arr, j
9310
9332
  }
9311
9333
  }
9312
9334
  });
9313
-
9335
+ debugger;
9314
9336
  const selector_id = glb.new_xu_render ? $(this).data()?.xuData?.ui_id : $(this).data()?.xuData?.xu_id;
9315
9337
 
9316
9338
  if (attr.length) {